text
stringlengths
1
1.05M
; =============================================================== ; Dec 2013 ; =============================================================== ; ; int obstack_grow(struct obstack *ob, void *data, size_t size) ; ; Grow the current object by appending size bytes read from ; address data. ; ; =============================================================== SECTION code_alloc_obstack PUBLIC asm_obstack_grow EXTERN asm0_obstack_blank, asm_memcpy asm_obstack_grow: ; enter : hl = struct obstack *ob ; bc = size_t size ; de = void *data ; ; exit : success ; ; carry reset ; hl = non-zero ; de = address of byte following grown area ; ; fail on insufficient memory ; ; carry set ; hl = 0 ; ; uses : af, bc, de, hl push de ; save data call asm0_obstack_blank ; de = & allocated bytes pop hl ; hl = data ret c jp asm_memcpy
; A118011: Complement of the Connell sequence (A001614); a(n) = 4*n - A001614(n). ; 3,6,8,11,13,15,18,20,22,24,27,29,31,33,35,38,40,42,44,46,48,51,53,55,57,59,61,63,66,68,70,72,74,76,78,80,83,85,87,89,91,93,95,97,99,102,104,106,108,110,112,114,116,118,120,123,125,127,129,131,133,135,137,139 mov $1,$0 add $1,$0 mov $2,1 lpb $0 add $2,1 trn $0,$2 lpe add $1,2 add $1,$2
;;;;;;;;;;;;;;;; ; test interrupts ;;;;;;;;;;;;;;;; .org $8000 SEC ; set carry bit BRK ; issue software interrupt ;TODO: Mossy changed to add a padding byte after BRK, ;not sure if that should be reverted ;CLC ; clear carry bit - should be skipped! LDA #$01 ; set A = 1 LDY #$01 ; set Y = 1 NOP ; perform assertions: ; A = 0 ; X = 1 ; Y = 1 ; C = 1 handler: CLC ; clear carry bit LDX #$01 ; set X = 1 RTI ; return from interrupt .org $BFFA .dw $8000 .dw $8000 .dw handler ; special interrupt handler
#ifdef _MSC_VER #pragma pack(2) #endif // (C) Copyright John Maddock 2000. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "test.hpp" #include "check_integral_constant.hpp" #ifdef TEST_STD # include <type_traits> #else # include <boost/type_traits/alignment_of.hpp> #endif // // Need to defined some member functions for empty_UDT, // we don't want to put these in the test.hpp as that // causes overly-clever compilers to figure out that they can't throw // which in turn breaks other tests. // empty_UDT::empty_UDT(){} empty_UDT::~empty_UDT(){} empty_UDT::empty_UDT(const empty_UDT&){} empty_UDT& empty_UDT::operator=(const empty_UDT&){ return *this; } bool empty_UDT::operator==(const empty_UDT&)const{ return true; } // // VC++ emits an awful lot of warnings unless we define these: #ifdef BOOST_MSVC # pragma warning(disable:4244 4121) // // What follows here is the test case for issue 1946. // #include <boost/function.hpp> // This kind of packing is set within MSVC 9.0 headers. // E.g. std::ostream has it. #pragma pack(push,8) // The issue is gone if Root has no data members struct Root { int a; }; // The issue is gone if Root is inherited non-virtually struct A : virtual public Root {}; #pragma pack(pop) // // This class has 8-byte alignment but is 44 bytes in size, which means // that elements in an array of this type will not actually be 8 byte // aligned. This appears to be an MSVC bug, and throws off our // alignment calculations: causing us to report a non-sensical 12-byte // alignment for this type. This is fixed by using the native __alignof // operator. // class issue1946 : public A { public: // The issue is gone if the type is not a boost::function. The signature doesn't matter. typedef boost::function0< void > function_type; function_type m_function; }; #endif template <class T> struct align_calc { char padding; T instance; static std::ptrdiff_t get() { static align_calc<T> a; return reinterpret_cast<const char*>(&(a.instance)) - reinterpret_cast<const char*>(&(a.padding)); } }; #define ALIGNOF(x) align_calc< x>::get() TT_TEST_BEGIN(alignment_of) #ifndef TEST_STD // This test is not required to work for non-boost implementations: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<void>::value, 0); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<char>::value, ALIGNOF(char)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<short>::value, ALIGNOF(short)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int>::value, ALIGNOF(int)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<long>::value, ALIGNOF(long)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<float>::value, ALIGNOF(float)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<double>::value, ALIGNOF(double)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<long double>::value, ALIGNOF(long double)); #ifdef BOOST_HAS_LONG_LONG BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of< ::boost::long_long_type>::value, ALIGNOF(::boost::long_long_type)); #endif #ifdef BOOST_HAS_MS_INT64 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<__int64>::value, ALIGNOF(__int64)); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int[4]>::value, ALIGNOF(int[4])); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int(*)(int)>::value, ALIGNOF(int(*)(int))); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int*>::value, ALIGNOF(int*)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<VB>::value, ALIGNOF(VB)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<VD>::value, ALIGNOF(VD)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<enum_UDT>::value, ALIGNOF(enum_UDT)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<mf2>::value, ALIGNOF(mf2)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<POD_UDT>::value, ALIGNOF(POD_UDT)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<empty_UDT>::value, ALIGNOF(empty_UDT)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<union_UDT>::value, ALIGNOF(union_UDT)); #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<issue1946>::value, ALIGNOF(issue1946)); #endif TT_TEST_END
// Multiplies R0 and R1 and stores the result in R2. // (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.) // remember: we can only use 2 registers A and D. // Put your code here. @2 M = 0 (LOOP) @1 M = M - 1 D = M @END D;JLT @0 D = M @2 M = M + D @LOOP 0;JMP (END) 0;JMP
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x1825, %rsi lea addresses_WC_ht+0x9565, %rdi nop nop add %rbx, %rbx mov $28, %rcx rep movsw nop nop nop nop sub %rax, %rax lea addresses_normal_ht+0x5425, %rcx nop nop and %r10, %r10 movw $0x6162, (%rcx) nop nop nop nop and %rsi, %rsi lea addresses_UC_ht+0x29ed, %rdi nop nop nop add %r13, %r13 mov $0x6162636465666768, %r10 movq %r10, (%rdi) nop nop nop sub $34189, %rcx lea addresses_D_ht+0x165d7, %r13 nop nop nop sub %rcx, %rcx mov $0x6162636465666768, %r10 movq %r10, %xmm2 movups %xmm2, (%r13) nop add $11409, %rbx lea addresses_A_ht+0x14865, %rax nop nop nop nop xor %rsi, %rsi movb $0x61, (%rax) nop nop nop nop nop xor $6784, %r13 lea addresses_UC_ht+0x1bee5, %rcx nop nop nop nop sub $11416, %rbx mov (%rcx), %esi nop nop nop xor %rbx, %rbx lea addresses_UC_ht+0x253, %rax nop dec %rbx mov (%rax), %di dec %r13 lea addresses_D_ht+0x155ed, %rdi nop nop nop xor $35753, %rbx mov $0x6162636465666768, %r10 movq %r10, %xmm7 movups %xmm7, (%rdi) nop nop nop dec %rbx lea addresses_D_ht+0x128e5, %rax dec %r10 mov $0x6162636465666768, %rsi movq %rsi, %xmm5 vmovups %ymm5, (%rax) nop xor $8387, %rdi lea addresses_A_ht+0x3345, %rcx nop nop nop cmp $14928, %rsi movl $0x61626364, (%rcx) nop add %rbx, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r15 push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi // Store lea addresses_WT+0xedf5, %rdx nop and %r8, %r8 movw $0x5152, (%rdx) nop nop nop nop and %r15, %r15 // Store lea addresses_UC+0x75e5, %r10 nop nop nop nop nop lfence mov $0x5152535455565758, %rdx movq %rdx, (%r10) nop nop and $59490, %r10 // Store lea addresses_PSE+0x165a5, %rdx nop nop nop nop nop and $56130, %rdi movw $0x5152, (%rdx) nop add %r15, %r15 // Load lea addresses_A+0xbce5, %rdi nop nop nop dec %r15 movups (%rdi), %xmm0 vpextrq $0, %xmm0, %r8 and %r9, %r9 // Store lea addresses_A+0xdc0d, %rdx nop nop dec %r8 mov $0x5152535455565758, %r9 movq %r9, %xmm0 vmovups %ymm0, (%rdx) nop nop nop nop sub $34769, %r15 // Store lea addresses_normal+0x148cd, %r9 nop inc %r10 mov $0x5152535455565758, %rdi movq %rdi, %xmm5 vmovups %ymm5, (%r9) nop nop nop nop nop cmp $28479, %r8 // Store lea addresses_D+0x19005, %r10 nop nop nop and %rdx, %rdx movl $0x51525354, (%r10) nop nop nop sub $54360, %rbp // Load lea addresses_D+0x3ce5, %rbp nop nop nop cmp $10831, %r9 movb (%rbp), %r15b nop nop nop nop add $11390, %rbp // Store lea addresses_WT+0x14ce5, %r9 nop nop sub $32165, %r15 mov $0x5152535455565758, %r10 movq %r10, %xmm1 vmovups %ymm1, (%r9) nop nop xor %rdx, %rdx // Store lea addresses_A+0x11665, %r9 cmp %rbp, %rbp movb $0x51, (%r9) nop nop nop nop dec %r10 // Store lea addresses_WC+0xbae5, %rdx add $3601, %rbp mov $0x5152535455565758, %r8 movq %r8, %xmm1 vmovups %ymm1, (%rdx) and $23934, %r10 // REPMOV lea addresses_A+0x79c5, %rsi lea addresses_normal+0x6ce5, %rdi nop nop and $11988, %rbp mov $41, %rcx rep movsl nop nop nop nop xor $57922, %rdx // Faulty Load lea addresses_WT+0x14ce5, %r10 nop nop nop nop nop and %rcx, %rcx mov (%r10), %r15d lea oracles, %rdx and $0xff, %r15 shlq $12, %r15 mov (%rdx,%r15,1), %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r15 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': True, 'AVXalign': True, 'size': 4, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 5}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_A'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal'}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4}} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
; A117573: Expansion of (1+2x^2)/((1-x)(1-x^2)(1-x^3)). ; 1,1,4,5,8,11,15,18,24,28,34,40,47,53,62,69,78,87,97,106,118,128,140,152,165,177,192,205,220,235,251,266,284,300,318,336,355,373,394,413,434,455,477,498,522,544,568,592,617,641,668 mov $2,$0 add $2,1 lpb $2 add $1,1 trn $2,2 mov $3,2 mov $4,$2 lpb $4 add $1,3 trn $4,$3 lpe trn $2,1 lpe
#include "Random.hpp" #include <cstdlib> namespace Util { namespace Math { /** * @brief drand * @return Random double in [0.0, 1.0]. */ double drand() { return ((double)rand()) / ((double)RAND_MAX); } double drand(double min, double max) { return drand() * (max - min) + min; } int irand(int min, int max) { return (rand() % (max - min)) + min; } } }
;; ;; Copyright (c) 2012-2018, Intel Corporation ;; ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions are met: ;; ;; * Redistributions of source code must retain the above copyright notice, ;; this list of conditions and the following disclaimer. ;; * Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; * Neither the name of Intel Corporation nor the names of its contributors ;; may be used to endorse or promote products derived from this software ;; without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;; %include "os.asm" %include "job_aes_hmac.asm" %include "mb_mgr_datastruct.asm" %include "reg_sizes.asm" %include "memcpy.asm" extern sha_256_mult_avx section .data default rel align 16 byteswap: ;ddq 0x0c0d0e0f08090a0b0405060700010203 dq 0x0405060700010203, 0x0c0d0e0f08090a0b section .text %ifndef FUNC %define FUNC submit_job_hmac_sha_256_avx %endif %if 1 %ifdef LINUX %define arg1 rdi %define arg2 rsi %define reg3 rcx %define reg4 rdx %else %define arg1 rcx %define arg2 rdx %define reg3 rdi %define reg4 rsi %endif %define state arg1 %define job arg2 %define len2 arg2 ; idx needs to be in rbx, rbp, r13-r15 %define last_len rbp %define idx rbp %define p r11 %define start_offset r11 %define unused_lanes rbx %define tmp4 rbx %define job_rax rax %define len rax %define size_offset reg3 %define tmp2 reg3 %define lane reg4 %define tmp3 reg4 %define extra_blocks r8 %define tmp r9 %define p2 r9 %define lane_data r10 %endif ; This routine clobbers rbx, rbp, rsi, rdi; called routine also clobbers r12 struc STACK _gpr_save: resq 5 _rsp_save: resq 1 endstruc ; JOB* FUNC(MB_MGR_HMAC_SHA_256_OOO *state, JOB_AES_HMAC *job) ; arg 1 : rcx : state ; arg 2 : rdx : job MKGLOBAL(FUNC,function,internal) FUNC: mov rax, rsp sub rsp, STACK_size and rsp, -16 mov [rsp + _gpr_save + 8*0], rbx mov [rsp + _gpr_save + 8*1], rbp mov [rsp + _gpr_save + 8*2], r12 %ifndef LINUX mov [rsp + _gpr_save + 8*3], rsi mov [rsp + _gpr_save + 8*4], rdi %endif mov [rsp + _rsp_save], rax ; original SP mov unused_lanes, [state + _unused_lanes_sha256] movzx lane, BYTE(unused_lanes) shr unused_lanes, 8 imul lane_data, lane, _HMAC_SHA1_LANE_DATA_size lea lane_data, [state + _ldata_sha256 + lane_data] mov [state + _unused_lanes_sha256], unused_lanes mov len, [job + _msg_len_to_hash_in_bytes] mov tmp, len shr tmp, 6 ; divide by 64, len in terms of blocks mov [lane_data + _job_in_lane], job mov dword [lane_data + _outer_done], 0 mov [state + _lens_sha256 + 2*lane], WORD(tmp) mov last_len, len and last_len, 63 lea extra_blocks, [last_len + 9 + 63] shr extra_blocks, 6 mov [lane_data + _extra_blocks], DWORD(extra_blocks) mov p, [job + _src] add p, [job + _hash_start_src_offset_in_bytes] mov [state + _args_data_ptr_sha256 + 8*lane], p cmp len, 64 jb copy_lt64 fast_copy: add p, len vmovdqu xmm0, [p - 64 + 0*16] vmovdqu xmm1, [p - 64 + 1*16] vmovdqu xmm2, [p - 64 + 2*16] vmovdqu xmm3, [p - 64 + 3*16] vmovdqa [lane_data + _extra_block + 0*16], xmm0 vmovdqa [lane_data + _extra_block + 1*16], xmm1 vmovdqa [lane_data + _extra_block + 2*16], xmm2 vmovdqa [lane_data + _extra_block + 3*16], xmm3 end_fast_copy: mov size_offset, extra_blocks shl size_offset, 6 sub size_offset, last_len add size_offset, 64-8 mov [lane_data + _size_offset], DWORD(size_offset) mov start_offset, 64 sub start_offset, last_len mov [lane_data + _start_offset], DWORD(start_offset) lea tmp, [8*64 + 8*len] bswap tmp mov [lane_data + _extra_block + size_offset], tmp mov tmp, [job + _auth_key_xor_ipad] vmovdqu xmm0, [tmp] vmovdqu xmm1, [tmp + 4*4] vmovd [state + _args_digest_sha256 + 4*lane + 0*SHA256_DIGEST_ROW_SIZE], xmm0 vpextrd [state + _args_digest_sha256 + 4*lane + 1*SHA256_DIGEST_ROW_SIZE], xmm0, 1 vpextrd [state + _args_digest_sha256 + 4*lane + 2*SHA256_DIGEST_ROW_SIZE], xmm0, 2 vpextrd [state + _args_digest_sha256 + 4*lane + 3*SHA256_DIGEST_ROW_SIZE], xmm0, 3 vmovd [state + _args_digest_sha256 + 4*lane + 4*SHA256_DIGEST_ROW_SIZE], xmm1 vpextrd [state + _args_digest_sha256 + 4*lane + 5*SHA256_DIGEST_ROW_SIZE], xmm1, 1 vpextrd [state + _args_digest_sha256 + 4*lane + 6*SHA256_DIGEST_ROW_SIZE], xmm1, 2 vpextrd [state + _args_digest_sha256 + 4*lane + 7*SHA256_DIGEST_ROW_SIZE], xmm1, 3 test len, ~63 jnz ge64_bytes lt64_bytes: mov [state + _lens_sha256 + 2*lane], WORD(extra_blocks) lea tmp, [lane_data + _extra_block + start_offset] mov [state + _args_data_ptr_sha256 + 8*lane], tmp mov dword [lane_data + _extra_blocks], 0 ge64_bytes: cmp unused_lanes, 0xff jne return_null jmp start_loop align 16 start_loop: ; Find min length vmovdqa xmm0, [state + _lens_sha256] vphminposuw xmm1, xmm0 vpextrw DWORD(len2), xmm1, 0 ; min value vpextrw DWORD(idx), xmm1, 1 ; min index (0...3) cmp len2, 0 je len_is_0 vpshuflw xmm1, xmm1, 0 vpsubw xmm0, xmm0, xmm1 vmovdqa [state + _lens_sha256], xmm0 ; "state" and "args" are the same address, arg1 ; len is arg2 call sha_256_mult_avx ; state and idx are intact len_is_0: ; process completed job "idx" imul lane_data, idx, _HMAC_SHA1_LANE_DATA_size lea lane_data, [state + _ldata_sha256 + lane_data] mov DWORD(extra_blocks), [lane_data + _extra_blocks] cmp extra_blocks, 0 jne proc_extra_blocks cmp dword [lane_data + _outer_done], 0 jne end_loop proc_outer: mov dword [lane_data + _outer_done], 1 mov DWORD(size_offset), [lane_data + _size_offset] mov qword [lane_data + _extra_block + size_offset], 0 mov word [state + _lens_sha256 + 2*idx], 1 lea tmp, [lane_data + _outer_block] mov job, [lane_data + _job_in_lane] mov [state + _args_data_ptr_sha256 + 8*idx], tmp vmovd xmm0, [state + _args_digest_sha256 + 4*idx + 0*SHA256_DIGEST_ROW_SIZE] vpinsrd xmm0, xmm0, [state + _args_digest_sha256 + 4*idx + 1*SHA256_DIGEST_ROW_SIZE], 1 vpinsrd xmm0, xmm0, [state + _args_digest_sha256 + 4*idx + 2*SHA256_DIGEST_ROW_SIZE], 2 vpinsrd xmm0, xmm0, [state + _args_digest_sha256 + 4*idx + 3*SHA256_DIGEST_ROW_SIZE], 3 vpshufb xmm0, xmm0, [rel byteswap] vmovd xmm1, [state + _args_digest_sha256 + 4*idx + 4*SHA256_DIGEST_ROW_SIZE] vpinsrd xmm1, xmm1, [state + _args_digest_sha256 + 4*idx + 5*SHA256_DIGEST_ROW_SIZE], 1 vpinsrd xmm1, xmm1, [state + _args_digest_sha256 + 4*idx + 6*SHA256_DIGEST_ROW_SIZE], 2 %ifndef SHA224 vpinsrd xmm1, xmm1, [state + _args_digest_sha256 + 4*idx + 7*SHA256_DIGEST_ROW_SIZE], 3 %endif vpshufb xmm1, xmm1, [rel byteswap] vmovdqa [lane_data + _outer_block], xmm0 vmovdqa [lane_data + _outer_block + 4*4], xmm1 %ifdef SHA224 mov dword [lane_data + _outer_block + 7*4], 0x80 %endif mov tmp, [job + _auth_key_xor_opad] vmovdqu xmm0, [tmp] vmovdqu xmm1, [tmp + 4*4] vmovd [state + _args_digest_sha256 + 4*idx + 0*SHA256_DIGEST_ROW_SIZE], xmm0 vpextrd [state + _args_digest_sha256 + 4*idx + 1*SHA256_DIGEST_ROW_SIZE], xmm0, 1 vpextrd [state + _args_digest_sha256 + 4*idx + 2*SHA256_DIGEST_ROW_SIZE], xmm0, 2 vpextrd [state + _args_digest_sha256 + 4*idx + 3*SHA256_DIGEST_ROW_SIZE], xmm0, 3 vmovd [state + _args_digest_sha256 + 4*idx + 4*SHA256_DIGEST_ROW_SIZE], xmm1 vpextrd [state + _args_digest_sha256 + 4*idx + 5*SHA256_DIGEST_ROW_SIZE], xmm1, 1 vpextrd [state + _args_digest_sha256 + 4*idx + 6*SHA256_DIGEST_ROW_SIZE], xmm1, 2 vpextrd [state + _args_digest_sha256 + 4*idx + 7*SHA256_DIGEST_ROW_SIZE], xmm1, 3 jmp start_loop align 16 proc_extra_blocks: mov DWORD(start_offset), [lane_data + _start_offset] mov [state + _lens_sha256 + 2*idx], WORD(extra_blocks) lea tmp, [lane_data + _extra_block + start_offset] mov [state + _args_data_ptr_sha256 + 8*idx], tmp mov dword [lane_data + _extra_blocks], 0 jmp start_loop align 16 copy_lt64: ;; less than one message block of data ;; beginning of source block ;; destination extrablock but backwards by len from where 0x80 pre-populated ;; p2 clobbers unused_lanes, undo before exit lea p2, [lane_data + _extra_block + 64] sub p2, len memcpy_avx_64_1 p2, p, len, tmp4, tmp2, xmm0, xmm1, xmm2, xmm3 mov unused_lanes, [state + _unused_lanes_sha256] jmp end_fast_copy return_null: xor job_rax, job_rax jmp return align 16 end_loop: mov job_rax, [lane_data + _job_in_lane] mov unused_lanes, [state + _unused_lanes_sha256] mov qword [lane_data + _job_in_lane], 0 or dword [job_rax + _status], STS_COMPLETED_HMAC shl unused_lanes, 8 or unused_lanes, idx mov [state + _unused_lanes_sha256], unused_lanes mov p, [job_rax + _auth_tag_output] ; copy 14 bytes for SHA224 and 16 bytes for SHA256 mov DWORD(tmp), [state + _args_digest_sha256 + 4*idx + 0*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp2), [state + _args_digest_sha256 + 4*idx + 1*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp3), [state + _args_digest_sha256 + 4*idx + 2*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp4), [state + _args_digest_sha256 + 4*idx + 3*SHA256_DIGEST_ROW_SIZE] bswap DWORD(tmp) bswap DWORD(tmp2) bswap DWORD(tmp3) bswap DWORD(tmp4) mov [p + 0*4], DWORD(tmp) mov [p + 1*4], DWORD(tmp2) mov [p + 2*4], DWORD(tmp3) %ifdef SHA224 mov [p + 3*4], WORD(tmp4) %else mov [p + 3*4], DWORD(tmp4) %endif return: mov rbx, [rsp + _gpr_save + 8*0] mov rbp, [rsp + _gpr_save + 8*1] mov r12, [rsp + _gpr_save + 8*2] %ifndef LINUX mov rsi, [rsp + _gpr_save + 8*3] mov rdi, [rsp + _gpr_save + 8*4] %endif mov rsp, [rsp + _rsp_save] ; original SP ret %ifdef LINUX section .note.GNU-stack noalloc noexec nowrite progbits %endif
; A164540: a(n) = 4*a(n-1) + 4*a(n-2) for n > 1; a(0) = 1, a(1) = 14. ; 1,14,60,296,1424,6880,33216,160384,774400,3739136,18054144,87173120,420909056,2032328704,9812951040,47381118976,228776280064,1104629596160,5333623504896,25753012404224,124346543636480,600398224162816,2898979071197184,13997509181440000,67585953010548736,326333848767954944,1575679207114014720,7608052223527878656,36734925722567573504,177371911784381808640,856427350027797528576,4135197047248717348864,19966497589106059509760,96406778545419107434496,465493104538100667777024,2247599532334079100846080,10852370547488719074492416,52399880319291192701353984,253009003467119647103385600,1221635535145643359218958336,5898578154451052025289375744,28480854758386781538033336320,137517731651351334253290848256,663994345638952463165296738304,3206048309161215189674350346240,15480170619200670611358588338176,74744875713447543204131754737664,360900185330592855261961372303360,1742580244176161593864372508164096,8413921718027017796505335521869824,40626007848812717561478832120135680,196159718267358941431936670568022016,947142904464686635973662010752630784 mov $1,1 lpb $0 sub $0,1 add $1,1 mov $2,2 trn $3,1 add $2,$3 add $3,$2 add $2,2 mul $2,2 add $3,$1 add $3,$1 mov $1,$3 add $1,$2 lpe mov $0,$1
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "media/ffmpeg/ffmpeg_common.h" namespace media { namespace mime_type { const char kFFmpegAudio[] = "audio/x-ffmpeg"; const char kFFmpegVideo[] = "video/x-ffmpeg"; } // namespace mime_type } // namespace media
#include <ros/ros.h> #include <std_msgs/Float32.h> #include <sensor_msgs/LaserScan.h> #include <boost/asio.hpp> #include <camsense_driver/camsense_x1.h> CamsenseX1::CamsenseX1(const std::string& port, uint32_t baud_rate, float offset): port_(port), baud_rate_(baud_rate), offset_(offset), serial_(io_, port_) { shutting_down_ = false; serial_.set_option(boost::asio::serial_port_base::baud_rate(baud_rate_)); } CamsenseX1::~CamsenseX1() { } void CamsenseX1::parse() { State state = SYNC0; bool got_scan = false; boost::array<uint8_t, 36> raw_bytes; const float IndexMultiplier = 400 / 360.0; float averageRotationSpeed = 0.0; float previousStart = 0.0; for(int i = 0; i < 400; i++) { distanceArray[i] = 0; qualityArray[i] = 0; } while (!shutting_down_ && !got_scan) { switch (state) { case SYNC0: boost::asio::read(serial_, boost::asio::buffer(&raw_bytes[0],1)); if (raw_bytes[0] == KSYNC0) { state = SYNC1; } break; case SYNC1: boost::asio::read(serial_, boost::asio::buffer(&raw_bytes[1],1)); if (raw_bytes[1] == KSYNC1) { state = SYNC2; break; } state = SYNC0; break; case SYNC2: boost::asio::read(serial_, boost::asio::buffer(&raw_bytes[2],1)); if (raw_bytes[2] == KSYNC2) { state = SYNC3; break; } state = SYNC0; break; case SYNC3: boost::asio::read(serial_, boost::asio::buffer(&raw_bytes[3],1)); if (raw_bytes[3] == KSYNC3) { state = PARSE; break; } state = SYNC0; break; case PARSE: boost::asio::read(serial_, boost::asio::buffer(&raw_bytes[4],32)); float RotationSpeed = ((uint16_t) (raw_bytes[5] << 8) | raw_bytes[4]) / 3840.0; // 3840.0 = (64 * 60) if(averageRotationSpeed == 0.0) { averageRotationSpeed = RotationSpeed; } averageRotationSpeed = RotationSpeed * 0.01 + averageRotationSpeed * 0.99; float packageStartAngle = ((uint16_t) (raw_bytes[7] << 8) | raw_bytes[6]) / 64.0 - 640; float packageEndAngle = ((uint16_t) (raw_bytes[33] << 8) | raw_bytes[32]) / 64.0 - 640; float step = 0.0; if(packageEndAngle > packageStartAngle) { step = (packageEndAngle - packageStartAngle); } else { step = (packageEndAngle - (packageStartAngle - 360)); } step /= 8; for(int i = 0; i < 8; i++) { uint8_t distanceL = raw_bytes[8+(i*3)]; uint8_t distanceH = raw_bytes[9+(i*3)]; uint8_t quality = raw_bytes[10+(i*3)]; float measurementAngle = (packageStartAngle + step * i) + (offset_ + 180); float fIndex = measurementAngle * IndexMultiplier; int index = round(fIndex); index = index % 400; // limit index between 0 and 399 index = 399-index; // invert to match ROS distanceArray[index] = ((uint16_t) distanceH << 8) | distanceL; qualityArray[index] = quality; if(quality == 0) { distanceArray[index] = 0; } } if(previousStart > packageStartAngle) { got_scan = true; rotationSpeed_ = averageRotationSpeed; break; } previousStart = packageStartAngle; state = SYNC0; break; } } } float CamsenseX1::getRotationSpeed() { return rotationSpeed_; }
#include "../Exports.h" FARPROC OriginalFuncs_winhttp[65]; const char* Exports::ExportNames_winhttp[65] = { "Private1", "SvchostPushServiceGlobals", "WinHttpAddRequestHeaders", "WinHttpAutoProxySvcMain", "WinHttpCheckPlatform", "WinHttpCloseHandle", "WinHttpConnect", "WinHttpConnectionDeletePolicyEntries", "WinHttpConnectionDeleteProxyInfo", "WinHttpConnectionFreeNameList", "WinHttpConnectionFreeProxyInfo", "WinHttpConnectionFreeProxyList", "WinHttpConnectionGetNameList", "WinHttpConnectionGetProxyInfo", "WinHttpConnectionGetProxyList", "WinHttpConnectionSetPolicyEntries", "WinHttpConnectionSetProxyInfo", "WinHttpConnectionUpdateIfIndexTable", "WinHttpCrackUrl", "WinHttpCreateProxyResolver", "WinHttpCreateUrl", "WinHttpDetectAutoProxyConfigUrl", "WinHttpFreeProxyResult", "WinHttpFreeProxyResultEx", "WinHttpFreeProxySettings", "WinHttpGetDefaultProxyConfiguration", "WinHttpGetIEProxyConfigForCurrentUser", "WinHttpGetProxyForUrl", "WinHttpGetProxyForUrlEx", "WinHttpGetProxyForUrlEx2", "WinHttpGetProxyForUrlHvsi", "WinHttpGetProxyResult", "WinHttpGetProxyResultEx", "WinHttpGetProxySettingsVersion", "WinHttpGetTunnelSocket", "WinHttpOpen", "WinHttpOpenRequest", "WinHttpPacJsWorkerMain", "WinHttpProbeConnectivity", "WinHttpQueryAuthSchemes", "WinHttpQueryDataAvailable", "WinHttpQueryHeaders", "WinHttpQueryOption", "WinHttpReadData", "WinHttpReadProxySettings", "WinHttpReadProxySettingsHvsi", "WinHttpReceiveResponse", "WinHttpResetAutoProxy", "WinHttpSaveProxyCredentials", "WinHttpSendRequest", "WinHttpSetCredentials", "WinHttpSetDefaultProxyConfiguration", "WinHttpSetOption", "WinHttpSetStatusCallback", "WinHttpSetTimeouts", "WinHttpTimeFromSystemTime", "WinHttpTimeToSystemTime", "WinHttpWebSocketClose", "WinHttpWebSocketCompleteUpgrade", "WinHttpWebSocketQueryCloseStatus", "WinHttpWebSocketReceive", "WinHttpWebSocketSend", "WinHttpWebSocketShutdown", "WinHttpWriteData", "WinHttpWriteProxySettings" };
; ; MSX specific routines ; ; GFX - a small graphics library ; Copyright (C) 2004 Rafael de Oliveira Jannone ; ; extern void vmerge(unsigned int addr, unsigned char value); ; ; set \a value at a given vram address \a addr, merging bits (OR) with the existing value ; ; $Id: msx_vmerge.asm,v 1.6 2016-06-16 19:30:25 dom Exp $ ; SECTION code_clib PUBLIC msx_vmerge PUBLIC _msx_vmerge INCLUDE "msx/vdp.inc" msx_vmerge: _msx_vmerge: ; enter vdp address pointer pop bc pop de pop hl push hl ; addr push de ; value push bc ; RET address ld c,VDP_CMD ld b,c di out (c),l ld a,h and @00111111 ei out (c),a ; read data ld c,VDP_DATAIN in h,(c) ld c,b ; enter same address di out (c),l or @01000000 ei out (c),a ld a,e out (VDP_DATA), a ret
/* * Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk. * Distributed under the terms of the MIT License. */ #include <debugger.h> #include <int.h> #include <thread.h> #include <arch/user_debugger.h> void arch_clear_team_debug_info(struct arch_team_debug_info *info) { } void arch_destroy_team_debug_info(struct arch_team_debug_info *info) { arch_clear_team_debug_info(info); } void arch_clear_thread_debug_info(struct arch_thread_debug_info *info) { } void arch_destroy_thread_debug_info(struct arch_thread_debug_info *info) { arch_clear_thread_debug_info(info); } void arch_update_thread_single_step() { } void arch_set_debug_cpu_state(const debug_cpu_state *cpuState) { } void arch_get_debug_cpu_state(debug_cpu_state *cpuState) { } status_t arch_get_thread_debug_cpu_state(Thread* thread, debug_cpu_state* cpuState) { return B_UNSUPPORTED; } status_t arch_set_breakpoint(void *address) { return B_ERROR; } status_t arch_clear_breakpoint(void *address) { return B_ERROR; } status_t arch_set_watchpoint(void *address, uint32 type, int32 length) { return B_ERROR; } status_t arch_clear_watchpoint(void *address) { return B_ERROR; } bool arch_has_breakpoints(struct arch_team_debug_info *info) { return false; }
;; ;; Copyright (c) 2012-2020, Intel Corporation ;; ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions are met: ;; ;; * Redistributions of source code must retain the above copyright notice, ;; this list of conditions and the following disclaimer. ;; * Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; * Neither the name of Intel Corporation nor the names of its contributors ;; may be used to endorse or promote products derived from this software ;; without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;; %include "include/os.asm" %include "imb_job.asm" %include "mb_mgr_datastruct.asm" %include "include/reg_sizes.asm" extern sha_256_mult_avx section .data default rel align 16 byteswap: ;ddq 0x0c0d0e0f08090a0b0405060700010203 dq 0x0405060700010203, 0x0c0d0e0f08090a0b len_masks: ;ddq 0x0000000000000000000000000000FFFF dq 0x000000000000FFFF, 0x0000000000000000 ;ddq 0x000000000000000000000000FFFF0000 dq 0x00000000FFFF0000, 0x0000000000000000 ;ddq 0x00000000000000000000FFFF00000000 dq 0x0000FFFF00000000, 0x0000000000000000 ;ddq 0x0000000000000000FFFF000000000000 dq 0xFFFF000000000000, 0x0000000000000000 one: dq 1 two: dq 2 three: dq 3 section .text %ifndef FUNC %define FUNC flush_job_hmac_sha_256_avx %endif %if 1 %ifdef LINUX %define arg1 rdi %define arg2 rsi %else %define arg1 rcx %define arg2 rdx %endif %define state arg1 %define job arg2 %define len2 arg2 ; idx needs to be in rbx, rbp, r13-r15 %define idx rbp %define unused_lanes rbx %define lane_data rbx %define tmp2 rbx %define job_rax rax %define tmp1 rax %define size_offset rax %define tmp rax %define start_offset rax %define tmp3 arg1 %define extra_blocks arg2 %define p arg2 %define tmp4 r8 %define tmp5 r9 %define tmp6 r10 %endif ; This routine clobbers rbx, rbp; called routine also clobbers r12 struc STACK _gpr_save: resq 3 _rsp_save: resq 1 endstruc %define APPEND(a,b) a %+ b ; JOB* FUNC(MB_MGR_HMAC_SHA_256_OOO *state) ; arg 1 : rcx : state MKGLOBAL(FUNC,function,internal) FUNC: mov rax, rsp sub rsp, STACK_size and rsp, -16 mov [rsp + _gpr_save + 8*0], rbx mov [rsp + _gpr_save + 8*1], rbp mov [rsp + _gpr_save + 8*2], r12 mov [rsp + _rsp_save], rax ; original SP mov unused_lanes, [state + _unused_lanes_sha256] bt unused_lanes, 32+7 jc return_null ; find a lane with a non-null job xor idx, idx cmp qword [state + _ldata_sha256 + 1 * _HMAC_SHA1_LANE_DATA_size + _job_in_lane], 0 cmovne idx, [rel one] cmp qword [state + _ldata_sha256 + 2 * _HMAC_SHA1_LANE_DATA_size + _job_in_lane], 0 cmovne idx, [rel two] cmp qword [state + _ldata_sha256 + 3 * _HMAC_SHA1_LANE_DATA_size + _job_in_lane], 0 cmovne idx, [rel three] copy_lane_data: ; copy idx to empty lanes vmovdqa xmm0, [state + _lens_sha256] mov tmp, [state + _args_data_ptr_sha256 + 8*idx] %assign I 0 %rep 4 cmp qword [state + _ldata_sha256 + I * _HMAC_SHA1_LANE_DATA_size + _job_in_lane], 0 jne APPEND(skip_,I) mov [state + _args_data_ptr_sha256 + 8*I], tmp vpor xmm0, xmm0, [rel len_masks + 16*I] APPEND(skip_,I): %assign I (I+1) %endrep vmovdqa [state + _lens_sha256], xmm0 vphminposuw xmm1, xmm0 vpextrw DWORD(len2), xmm1, 0 ; min value vpextrw DWORD(idx), xmm1, 1 ; min index (0...3) cmp len2, 0 je len_is_0 vpshuflw xmm1, xmm1, 0 vpsubw xmm0, xmm0, xmm1 vmovdqa [state + _lens_sha256], xmm0 ; "state" and "args" are the same address, arg1 ; len is arg2 call sha_256_mult_avx ; state and idx are intact len_is_0: ; process completed job "idx" imul lane_data, idx, _HMAC_SHA1_LANE_DATA_size lea lane_data, [state + _ldata_sha256 + lane_data] mov DWORD(extra_blocks), [lane_data + _extra_blocks] cmp extra_blocks, 0 jne proc_extra_blocks cmp dword [lane_data + _outer_done], 0 jne end_loop proc_outer: mov dword [lane_data + _outer_done], 1 mov DWORD(size_offset), [lane_data + _size_offset] mov qword [lane_data + _extra_block + size_offset], 0 mov word [state + _lens_sha256 + 2*idx], 1 lea tmp, [lane_data + _outer_block] mov job, [lane_data + _job_in_lane] mov [state + _args_data_ptr_sha256 + 8*idx], tmp vmovd xmm0, [state + _args_digest_sha256 + 4*idx + 0*SHA256_DIGEST_ROW_SIZE] vpinsrd xmm0, xmm0, [state + _args_digest_sha256 + 4*idx + 1*SHA256_DIGEST_ROW_SIZE], 1 vpinsrd xmm0, xmm0, [state + _args_digest_sha256 + 4*idx + 2*SHA256_DIGEST_ROW_SIZE], 2 vpinsrd xmm0, xmm0, [state + _args_digest_sha256 + 4*idx + 3*SHA256_DIGEST_ROW_SIZE], 3 vpshufb xmm0, xmm0, [rel byteswap] vmovd xmm1, [state + _args_digest_sha256 + 4*idx + 4*SHA256_DIGEST_ROW_SIZE] vpinsrd xmm1, xmm1, [state + _args_digest_sha256 + 4*idx + 5*SHA256_DIGEST_ROW_SIZE], 1 vpinsrd xmm1, xmm1, [state + _args_digest_sha256 + 4*idx + 6*SHA256_DIGEST_ROW_SIZE], 2 %ifndef SHA224 vpinsrd xmm1, xmm1, [state + _args_digest_sha256 + 4*idx + 7*SHA256_DIGEST_ROW_SIZE], 3 %endif vpshufb xmm1, xmm1, [rel byteswap] vmovdqa [lane_data + _outer_block], xmm0 vmovdqa [lane_data + _outer_block + 4*4], xmm1 %ifdef SHA224 mov dword [lane_data + _outer_block + 7*4], 0x80 %endif mov tmp, [job + _auth_key_xor_opad] vmovdqu xmm0, [tmp] vmovdqu xmm1, [tmp + 4*4] vmovd [state + _args_digest_sha256 + 4*idx + 0*SHA256_DIGEST_ROW_SIZE], xmm0 vpextrd [state + _args_digest_sha256 + 4*idx + 1*SHA256_DIGEST_ROW_SIZE], xmm0, 1 vpextrd [state + _args_digest_sha256 + 4*idx + 2*SHA256_DIGEST_ROW_SIZE], xmm0, 2 vpextrd [state + _args_digest_sha256 + 4*idx + 3*SHA256_DIGEST_ROW_SIZE], xmm0, 3 vmovd [state + _args_digest_sha256 + 4*idx + 4*SHA256_DIGEST_ROW_SIZE], xmm1 vpextrd [state + _args_digest_sha256 + 4*idx + 5*SHA256_DIGEST_ROW_SIZE], xmm1, 1 vpextrd [state + _args_digest_sha256 + 4*idx + 6*SHA256_DIGEST_ROW_SIZE], xmm1, 2 vpextrd [state + _args_digest_sha256 + 4*idx + 7*SHA256_DIGEST_ROW_SIZE], xmm1, 3 jmp copy_lane_data align 16 proc_extra_blocks: mov DWORD(start_offset), [lane_data + _start_offset] mov [state + _lens_sha256 + 2*idx], WORD(extra_blocks) lea tmp, [lane_data + _extra_block + start_offset] mov [state + _args_data_ptr_sha256 + 8*idx], tmp mov dword [lane_data + _extra_blocks], 0 jmp copy_lane_data return_null: xor job_rax, job_rax jmp return align 16 end_loop: mov job_rax, [lane_data + _job_in_lane] mov qword [lane_data + _job_in_lane], 0 or dword [job_rax + _status], STS_COMPLETED_HMAC mov unused_lanes, [state + _unused_lanes_sha256] shl unused_lanes, 8 or unused_lanes, idx mov [state + _unused_lanes_sha256], unused_lanes mov p, [job_rax + _auth_tag_output] %ifdef SHA224 cmp qword [job_rax + _auth_tag_output_len_in_bytes], 14 jne copy_full_digest %else cmp qword [job_rax + _auth_tag_output_len_in_bytes], 16 jne copy_full_digest %endif ;; copy 14 bytes for SHA224 / 16 bytes for SHA256 mov DWORD(tmp2), [state + _args_digest_sha256 + 4*idx + 0*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp4), [state + _args_digest_sha256 + 4*idx + 1*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp6), [state + _args_digest_sha256 + 4*idx + 2*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp5), [state + _args_digest_sha256 + 4*idx + 3*SHA256_DIGEST_ROW_SIZE] bswap DWORD(tmp2) bswap DWORD(tmp4) bswap DWORD(tmp6) bswap DWORD(tmp5) mov [p + 0*4], DWORD(tmp2) mov [p + 1*4], DWORD(tmp4) mov [p + 2*4], DWORD(tmp6) %ifdef SHA224 mov [p + 3*4], WORD(tmp5) %else mov [p + 3*4], DWORD(tmp5) %endif jmp clear_ret copy_full_digest: ;; copy 28 bytes for SHA224 / 32 bytes for SHA256 mov DWORD(tmp2), [state + _args_digest_sha256 + 4*idx + 0*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp4), [state + _args_digest_sha256 + 4*idx + 1*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp6), [state + _args_digest_sha256 + 4*idx + 2*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp5), [state + _args_digest_sha256 + 4*idx + 3*SHA256_DIGEST_ROW_SIZE] bswap DWORD(tmp2) bswap DWORD(tmp4) bswap DWORD(tmp6) bswap DWORD(tmp5) mov [p + 0*4], DWORD(tmp2) mov [p + 1*4], DWORD(tmp4) mov [p + 2*4], DWORD(tmp6) mov [p + 3*4], DWORD(tmp5) mov DWORD(tmp2), [state + _args_digest_sha256 + 4*idx + 4*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp4), [state + _args_digest_sha256 + 4*idx + 5*SHA256_DIGEST_ROW_SIZE] mov DWORD(tmp6), [state + _args_digest_sha256 + 4*idx + 6*SHA256_DIGEST_ROW_SIZE] %ifndef SHA224 mov DWORD(tmp5), [state + _args_digest_sha256 + 4*idx + 7*SHA256_DIGEST_ROW_SIZE] %endif bswap DWORD(tmp2) bswap DWORD(tmp4) bswap DWORD(tmp6) %ifndef SHA224 bswap DWORD(tmp5) %endif mov [p + 4*4], DWORD(tmp2) mov [p + 5*4], DWORD(tmp4) mov [p + 6*4], DWORD(tmp6) %ifndef SHA224 mov [p + 7*4], DWORD(tmp5) %endif clear_ret: %ifdef SAFE_DATA vpxor xmm0, xmm0 ;; Clear digest (28B/32B), outer_block (28B/32B) and extra_block (64B) ;; of returned job and NULL jobs %assign I 0 %rep 4 cmp qword [state + _ldata_sha256 + (I*_HMAC_SHA1_LANE_DATA_size) + _job_in_lane], 0 jne APPEND(skip_clear_,I) ;; Clear digest (28 bytes for SHA-224, 32 bytes for SHA-256 bytes) %assign J 0 %rep 7 mov dword [state + _args_digest_sha256 + SHA256_DIGEST_WORD_SIZE*I + J*SHA256_DIGEST_ROW_SIZE], 0 %assign J (J+1) %endrep %ifndef SHA224 mov dword [state + _args_digest_sha256 + SHA256_DIGEST_WORD_SIZE*I + 7*SHA256_DIGEST_ROW_SIZE], 0 %endif lea lane_data, [state + _ldata_sha256 + (I*_HMAC_SHA1_LANE_DATA_size)] ;; Clear first 64 bytes of extra_block %assign offset 0 %rep 4 vmovdqa [lane_data + _extra_block + offset], xmm0 %assign offset (offset + 16) %endrep ;; Clear first 28 bytes (SHA-224) or 32 bytes (SHA-256) of outer_block vmovdqa [lane_data + _outer_block], xmm0 %ifdef SHA224 mov qword [lane_data + _outer_block + 16], 0 mov dword [lane_data + _outer_block + 24], 0 %else vmovdqa [lane_data + _outer_block + 16], xmm0 %endif APPEND(skip_clear_,I): %assign I (I+1) %endrep %endif ;; SAFE_DATA return: mov rbx, [rsp + _gpr_save + 8*0] mov rbp, [rsp + _gpr_save + 8*1] mov r12, [rsp + _gpr_save + 8*2] mov rsp, [rsp + _rsp_save] ; original SP ret %ifdef LINUX section .note.GNU-stack noalloc noexec nowrite progbits %endif
/* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkBitmapCache.h" #include "SkMutex.h" #include "SkPixelRef.h" #include "SkTraceEvent.h" //#define SK_SUPPORT_LEGACY_UNBALANCED_PIXELREF_LOCKCOUNT //#define SK_TRACE_PIXELREF_LIFETIME #ifdef SK_BUILD_FOR_WIN32 // We don't have SK_BASE_MUTEX_INIT on Windows. // must be a power-of-2. undef to just use 1 mutex #define PIXELREF_MUTEX_RING_COUNT 32 static SkBaseMutex gPixelRefMutexRing[PIXELREF_MUTEX_RING_COUNT]; #else static SkBaseMutex gPixelRefMutexRing[] = { SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT, }; // must be a power-of-2. undef to just use 1 mutex #define PIXELREF_MUTEX_RING_COUNT SK_ARRAY_COUNT(gPixelRefMutexRing) #endif static SkBaseMutex* get_default_mutex() { static int32_t gPixelRefMutexRingIndex; SkASSERT(SkIsPow2(PIXELREF_MUTEX_RING_COUNT)); // atomic_inc might be overkill here. It may be fine if once in a while // we hit a race-condition and two subsequent calls get the same index... int index = sk_atomic_inc(&gPixelRefMutexRingIndex); return &gPixelRefMutexRing[index & (PIXELREF_MUTEX_RING_COUNT - 1)]; } /////////////////////////////////////////////////////////////////////////////// static uint32_t next_gen_id() { static uint32_t gNextGenID = 0; uint32_t genID; // Loop in case our global wraps around, as we never want to return a 0. do { genID = sk_atomic_fetch_add(&gNextGenID, 2u) + 2; // Never set the low bit. } while (0 == genID); return genID; } /////////////////////////////////////////////////////////////////////////////// void SkPixelRef::setMutex(SkBaseMutex* mutex) { if (NULL == mutex) { mutex = get_default_mutex(); } fMutex = mutex; } // just need a > 0 value, so pick a funny one to aid in debugging #define SKPIXELREF_PRELOCKED_LOCKCOUNT 123456789 static SkImageInfo validate_info(const SkImageInfo& info) { SkAlphaType newAlphaType = info.alphaType(); SkAssertResult(SkColorTypeValidateAlphaType(info.colorType(), info.alphaType(), &newAlphaType)); return info.makeAlphaType(newAlphaType); } #ifdef SK_TRACE_PIXELREF_LIFETIME static int32_t gInstCounter; #endif SkPixelRef::SkPixelRef(const SkImageInfo& info) : fInfo(validate_info(info)) #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK , fStableID(next_gen_id()) #endif { #ifdef SK_TRACE_PIXELREF_LIFETIME SkDebugf(" pixelref %d\n", sk_atomic_inc(&gInstCounter)); #endif this->setMutex(NULL); fRec.zero(); fLockCount = 0; this->needsNewGenID(); fIsImmutable = false; fPreLocked = false; fAddedToCache.store(false); } SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) : fInfo(validate_info(info)) #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK , fStableID(next_gen_id()) #endif { #ifdef SK_TRACE_PIXELREF_LIFETIME SkDebugf(" pixelref %d\n", sk_atomic_inc(&gInstCounter)); #endif this->setMutex(mutex); fRec.zero(); fLockCount = 0; this->needsNewGenID(); fIsImmutable = false; fPreLocked = false; fAddedToCache.store(false); } SkPixelRef::~SkPixelRef() { #ifndef SK_SUPPORT_LEGACY_UNBALANCED_PIXELREF_LOCKCOUNT SkASSERT(SKPIXELREF_PRELOCKED_LOCKCOUNT == fLockCount || 0 == fLockCount); #endif #ifdef SK_TRACE_PIXELREF_LIFETIME SkDebugf("~pixelref %d\n", sk_atomic_dec(&gInstCounter) - 1); #endif this->callGenIDChangeListeners(); } void SkPixelRef::needsNewGenID() { fTaggedGenID.store(0); SkASSERT(!this->genIDIsUnique()); // This method isn't threadsafe, so the assert should be fine. } void SkPixelRef::cloneGenID(const SkPixelRef& that) { // This is subtle. We must call that.getGenerationID() to make sure its genID isn't 0. uint32_t genID = that.getGenerationID(); // Neither ID is unique any more. // (These & ~1u are actually redundant. that.getGenerationID() just did it for us.) this->fTaggedGenID.store(genID & ~1u); that. fTaggedGenID.store(genID & ~1u); // This method isn't threadsafe, so these asserts should be fine. SkASSERT(!this->genIDIsUnique()); SkASSERT(!that. genIDIsUnique()); } static void validate_pixels_ctable(const SkImageInfo& info, const void* pixels, const SkColorTable* ctable) { if (info.isEmpty()) { return; // can't require pixels if the dimensions are empty } SkASSERT(pixels); if (kIndex_8_SkColorType == info.colorType()) { SkASSERT(ctable); } else { SkASSERT(NULL == ctable); } } void SkPixelRef::setPreLocked(void* pixels, size_t rowBytes, SkColorTable* ctable) { #ifndef SK_IGNORE_PIXELREF_SETPRELOCKED validate_pixels_ctable(fInfo, pixels, ctable); // only call me in your constructor, otherwise fLockCount tracking can get // out of sync. fRec.fPixels = pixels; fRec.fColorTable = ctable; fRec.fRowBytes = rowBytes; fLockCount = SKPIXELREF_PRELOCKED_LOCKCOUNT; fPreLocked = true; #endif } // Increments fLockCount only on success bool SkPixelRef::lockPixelsInsideMutex() { fMutex->assertHeld(); if (1 == ++fLockCount) { SkASSERT(fRec.isZero()); if (!this->onNewLockPixels(&fRec)) { fRec.zero(); fLockCount -= 1; // we return fLockCount unchanged if we fail. return false; } } validate_pixels_ctable(fInfo, fRec.fPixels, fRec.fColorTable); return fRec.fPixels != NULL; } // For historical reasons, we always inc fLockCount, even if we return false. // It would be nice to change this (it seems), and only inc if we actually succeed... bool SkPixelRef::lockPixels() { SkASSERT(!fPreLocked || SKPIXELREF_PRELOCKED_LOCKCOUNT == fLockCount); if (!fPreLocked) { TRACE_EVENT_BEGIN0("skia", "SkPixelRef::lockPixelsMutex"); SkAutoMutexAcquire ac(*fMutex); TRACE_EVENT_END0("skia", "SkPixelRef::lockPixelsMutex"); SkDEBUGCODE(int oldCount = fLockCount;) bool success = this->lockPixelsInsideMutex(); // lockPixelsInsideMutex only increments the count if it succeeds. SkASSERT(oldCount + (int)success == fLockCount); if (!success) { // For compatibility with SkBitmap calling lockPixels, we still want to increment // fLockCount even if we failed. If we updated SkBitmap we could remove this oddity. fLockCount += 1; return false; } } validate_pixels_ctable(fInfo, fRec.fPixels, fRec.fColorTable); return fRec.fPixels != NULL; } bool SkPixelRef::lockPixels(LockRec* rec) { if (this->lockPixels()) { *rec = fRec; return true; } return false; } void SkPixelRef::unlockPixels() { SkASSERT(!fPreLocked || SKPIXELREF_PRELOCKED_LOCKCOUNT == fLockCount); if (!fPreLocked) { SkAutoMutexAcquire ac(*fMutex); SkASSERT(fLockCount > 0); if (0 == --fLockCount) { // don't call onUnlockPixels unless onLockPixels succeeded if (fRec.fPixels) { this->onUnlockPixels(); fRec.zero(); } else { SkASSERT(fRec.isZero()); } } } } bool SkPixelRef::requestLock(const LockRequest& request, LockResult* result) { SkASSERT(result); if (request.fSize.isEmpty()) { return false; } // until we support subsets, we have to check this... if (request.fSize.width() != fInfo.width() || request.fSize.height() != fInfo.height()) { return false; } if (fPreLocked) { result->fUnlockProc = NULL; result->fUnlockContext = NULL; result->fCTable = fRec.fColorTable; result->fPixels = fRec.fPixels; result->fRowBytes = fRec.fRowBytes; result->fSize.set(fInfo.width(), fInfo.height()); } else { SkAutoMutexAcquire ac(*fMutex); if (!this->onRequestLock(request, result)) { return false; } } validate_pixels_ctable(fInfo, result->fPixels, result->fCTable); return result->fPixels != NULL; } bool SkPixelRef::lockPixelsAreWritable() const { return this->onLockPixelsAreWritable(); } bool SkPixelRef::onLockPixelsAreWritable() const { return true; } uint32_t SkPixelRef::getGenerationID() const { uint32_t id = fTaggedGenID.load(); if (0 == id) { uint32_t next = next_gen_id() | 1u; if (fTaggedGenID.compare_exchange(&id, next)) { id = next; // There was no race or we won the race. fTaggedGenID is next now. } else { // We lost a race to set fTaggedGenID. compare_exchange() filled id with the winner. } // We can't quite SkASSERT(this->genIDIsUnique()). It could be non-unique // if we got here via the else path (pretty unlikely, but possible). } return id & ~1u; // Mask off bottom unique bit. } void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) { if (NULL == listener || !this->genIDIsUnique()) { // No point in tracking this if we're not going to call it. SkDELETE(listener); return; } *fGenIDChangeListeners.append() = listener; } // we need to be called *before* the genID gets changed or zerod void SkPixelRef::callGenIDChangeListeners() { // We don't invalidate ourselves if we think another SkPixelRef is sharing our genID. if (this->genIDIsUnique()) { for (int i = 0; i < fGenIDChangeListeners.count(); i++) { fGenIDChangeListeners[i]->onChange(); } // TODO: SkAtomic could add "old_value = atomic.xchg(new_value)" to make this clearer. if (fAddedToCache.load()) { SkNotifyBitmapGenIDIsStale(this->getGenerationID()); fAddedToCache.store(false); } } // Listeners get at most one shot, so whether these triggered or not, blow them away. fGenIDChangeListeners.deleteAll(); } void SkPixelRef::notifyPixelsChanged() { #ifdef SK_DEBUG if (fIsImmutable) { SkDebugf("========== notifyPixelsChanged called on immutable pixelref"); } #endif this->callGenIDChangeListeners(); this->needsNewGenID(); this->onNotifyPixelsChanged(); } void SkPixelRef::changeAlphaType(SkAlphaType at) { *const_cast<SkImageInfo*>(&fInfo) = fInfo.makeAlphaType(at); } void SkPixelRef::setImmutable() { fIsImmutable = true; } bool SkPixelRef::readPixels(SkBitmap* dst, const SkIRect* subset) { return this->onReadPixels(dst, subset); } /////////////////////////////////////////////////////////////////////////////////////////////////// bool SkPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) { return false; } void SkPixelRef::onNotifyPixelsChanged() { } SkData* SkPixelRef::onRefEncodedData() { return NULL; } bool SkPixelRef::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], SkYUVColorSpace* colorSpace) { return false; } size_t SkPixelRef::getAllocatedSizeInBytes() const { return 0; } static void unlock_legacy_result(void* ctx) { SkPixelRef* pr = (SkPixelRef*)ctx; pr->unlockPixels(); pr->unref(); // balancing the Ref in onRequestLoc } bool SkPixelRef::onRequestLock(const LockRequest& request, LockResult* result) { if (!this->lockPixelsInsideMutex()) { return false; } result->fUnlockProc = unlock_legacy_result; result->fUnlockContext = SkRef(this); // this is balanced in our fUnlockProc result->fCTable = fRec.fColorTable; result->fPixels = fRec.fPixels; result->fRowBytes = fRec.fRowBytes; result->fSize.set(fInfo.width(), fInfo.height()); return true; }
/** * Copyright (c) 2015 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License. * Please see the LICENSE included with this distribution for details. */ #ifndef _TITANIUMWINDOWS_NETWORKMODULE_HPP_ #define _TITANIUMWINDOWS_NETWORKMODULE_HPP_ #include "TitaniumWindows_Network_EXPORT.h" #include "Titanium/NetworkModule.hpp" namespace TitaniumWindows { using namespace HAL; /*! @class NetworkModule @ingroup Titanium.Network @discussion This is the Titanium.Network implementation for Windows. */ class TITANIUMWINDOWS_NETWORK_EXPORT NetworkModule final : public Titanium::NetworkModule, public JSExport<NetworkModule> { public: TITANIUM_PROPERTY_UNIMPLEMENTED(allHTTPCookies); TITANIUM_PROPERTY_UNIMPLEMENTED(remoteDeviceUUID); TITANIUM_PROPERTY_UNIMPLEMENTED(remoteNotificationTypes); TITANIUM_PROPERTY_UNIMPLEMENTED(remoteNotificationsEnabled); TITANIUM_FUNCTION_UNIMPLEMENTED(addSystemCookie); TITANIUM_FUNCTION_UNIMPLEMENTED(createBonjourBrowser); TITANIUM_FUNCTION_UNIMPLEMENTED(createBonjourService); TITANIUM_FUNCTION_UNIMPLEMENTED(getHTTPCookiesForDomain); TITANIUM_FUNCTION_UNIMPLEMENTED(getSystemCookies); TITANIUM_FUNCTION_UNIMPLEMENTED(removeAllHTTPCookies); TITANIUM_FUNCTION_UNIMPLEMENTED(removeHTTPCookiesForDomain); TITANIUM_FUNCTION_UNIMPLEMENTED(removeAllSystemCookies); TITANIUM_FUNCTION_UNIMPLEMENTED(removeSystemCookie); TITANIUM_FUNCTION_UNIMPLEMENTED(registerForPushNotifications); TITANIUM_FUNCTION_UNIMPLEMENTED(unregisterForPushNotifications); virtual std::vector<std::shared_ptr<Titanium::Network::Cookie>> getHTTPCookies(const std::string& domain, const std::string& path, const std::string& name) TITANIUM_NOEXCEPT override; virtual void removeHTTPCookie(const std::string& domain, const std::string& path, const std::string& name) TITANIUM_NOEXCEPT override; virtual void addHTTPCookie(std::shared_ptr<Titanium::Network::Cookie> cookie) TITANIUM_NOEXCEPT override; NetworkModule(const JSContext&) TITANIUM_NOEXCEPT; virtual ~NetworkModule(); NetworkModule(const NetworkModule&) = default; NetworkModule& operator=(const NetworkModule&) = default; #ifdef TITANIUM_MOVE_CTOR_AND_ASSIGN_DEFAULT_ENABLE NetworkModule(NetworkModule&&) = default; NetworkModule& operator=(NetworkModule&&) = default; #endif static void JSExportInitialize(); protected: std::shared_ptr<Titanium::Network::Cookie> createCookie(Windows::Web::Http::HttpCookie^ cookie); Windows::Web::Http::HttpCookie^ createCookie(const std::shared_ptr<Titanium::Network::Cookie>& cookie); void updateNetworkStatus(); Windows::Foundation::EventRegistrationToken change_event__; Windows::Web::Http::Filters::HttpBaseProtocolFilter^ filter__; }; } #endif // _TITANIUMWINDOWS_NETWORKMODULE_HPP_
; ********* Sweet32 SoC - UART echo example ; ********* Author: Valentin Angelovski ; ********* Created: 25/08/2014 ; ; This program sends TWO characters echoed for every character received ; via Sweet32's UART. Sourcecode provided 'as-is'. Use at your own risk! LDD R1,#0x70000000 ; Point to UART address LDD R6,#0x70000002 ; Point to UART control address LDD R0,#0x00000200 ; Data mask for UART RX_READY flag LDD R3,#0x00000100 ; Data mask for UART TX_READY flag test_uart: MOVW R2,@R1 ; Read data and flags from UART TSTSNZ R0,R2 ; Test RX_READY flag SJMP test_uart ; Continue to poll UART if no char received MOVW @R6,R6 ; Reset UART RX flag test_uart2: MOVW R2,@R1 ; Read UART flags + data TSTSNZ R3,R2 ; Test TX_READY flag SJMP test_uart2 ; Continue to poll UART if TX not ready MOVW @R1,R2 ; Echo UART character out test_uart3: MOVW R2,@R1 ; Read UART flags + data TSTSNZ R3,R2 ; Test TX_READY flag SJMP test_uart3 ; Continue to poll UART if TX not ready MOVW @R1,R2 ; Echo UART character out SJMP test_uart ; Go back and wait for another char.. $END
/* File: Null.cpp Sample: Null Author: CS349 Course Description: A test to verify if the XWindow system is working. The sample provided below is designed to show how to perform a series of basic tasks using the XGameLib library. The following code is based on demo code provided in the CS349 course. The code has been altered to fit the XGameLib approach. */ /// Standard Libraries #include <cstdlib> #include <iostream> /// XLib Libraries #include <X11/Xlib.h> Display* display; int main() { // open display (using DISPLAY env var) display = XOpenDisplay(""); if (display == NULL) { std::cout << "error\n"; exit(-1); } else { std::cout << "success!\n"; // close display XCloseDisplay(display); } }
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %r14 push %rax push %rcx push %rdi push %rsi lea addresses_WT_ht+0xd8a8, %rsi lea addresses_UC_ht+0x1e8a8, %rdi nop nop nop nop and $3098, %r14 mov $123, %rcx rep movsq nop nop xor $47154, %rdi lea addresses_WC_ht+0x16028, %rsi lea addresses_normal_ht+0xd788, %rdi clflush (%rsi) nop nop nop mfence mov $63, %rcx rep movsq nop nop nop nop nop add $46886, %rcx lea addresses_normal_ht+0x4b90, %rax cmp %r13, %r13 mov (%rax), %r11 nop nop nop sub $51250, %rax lea addresses_A_ht+0x78c8, %rsi lea addresses_UC_ht+0x8648, %rdi nop nop xor $53932, %r10 mov $38, %rcx rep movsw nop sub %rcx, %rcx lea addresses_WC_ht+0xa4c8, %rsi lea addresses_UC_ht+0x11100, %rdi clflush (%rdi) sub %rax, %rax mov $56, %rcx rep movsq cmp $34831, %r10 lea addresses_A_ht+0x1a0a8, %rsi lea addresses_WT_ht+0x184a8, %rdi sub $20874, %r11 mov $114, %rcx rep movsq nop nop nop nop nop sub $17251, %rcx lea addresses_WC_ht+0x4684, %rsi lea addresses_normal_ht+0x19468, %rdi and $44881, %r13 mov $54, %rcx rep movsl nop nop nop add %rdi, %rdi lea addresses_UC_ht+0x13b20, %r10 nop cmp $50819, %r14 mov (%r10), %edi nop dec %rdi lea addresses_A_ht+0xe8a8, %rsi lea addresses_WC_ht+0x138a8, %rdi nop nop cmp $6077, %r10 mov $114, %rcx rep movsq nop nop nop sub $28940, %r10 lea addresses_A_ht+0x16bd8, %rsi lea addresses_D_ht+0x110d0, %rdi nop nop nop nop nop dec %r13 mov $23, %rcx rep movsb dec %rax lea addresses_UC_ht+0x1d140, %rsi lea addresses_D_ht+0x120a8, %rdi nop nop nop nop inc %r14 mov $63, %rcx rep movsl nop nop nop nop nop add $24778, %rax lea addresses_A_ht+0x7af8, %rax nop nop nop nop nop xor $33853, %rcx movb $0x61, (%rax) nop nop nop nop nop xor %rsi, %rsi lea addresses_UC_ht+0x68f4, %r14 nop nop nop xor %rsi, %rsi vmovups (%r14), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $0, %xmm7, %rdi nop nop nop nop dec %rsi pop %rsi pop %rdi pop %rcx pop %rax pop %r14 pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %rax push %rcx push %rsi // Faulty Load lea addresses_WC+0x18a8, %rsi nop nop nop nop nop and $48637, %rax vmovups (%rsi), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %r12 lea oracles, %rsi and $0xff, %r12 shlq $12, %r12 mov (%rsi,%r12,1), %r12 pop %rsi pop %rcx pop %rax pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}} {'src': {'same': True, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}} {'src': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}} {'src': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 4, 'type': 'addresses_WT_ht'}} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'same': True, 'congruent': 10, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 4, 'type': 'addresses_A_ht', 'AVXalign': True, 'size': 1}} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'48': 1779, '49': 3812, '00': 11036, '45': 4796, '47': 401, 'bc': 1, '08': 3, 'fa': 1} 49 00 49 47 00 00 45 00 48 49 49 00 00 45 45 45 00 00 00 47 49 00 00 45 45 00 00 00 48 49 47 00 00 45 00 00 49 00 00 00 45 00 49 00 00 45 00 00 49 49 00 00 45 45 00 00 00 48 49 49 00 00 45 45 00 00 00 49 00 48 45 45 00 48 49 49 00 00 45 00 00 48 49 49 00 45 45 00 00 48 49 00 00 48 45 00 00 48 49 00 45 45 45 00 00 49 49 49 00 45 45 00 48 00 49 00 45 45 00 48 49 47 00 00 45 00 00 48 49 00 00 00 45 00 00 00 49 00 00 00 45 45 00 00 00 48 00 49 00 48 45 00 48 49 49 00 00 45 45 00 00 00 48 49 00 00 00 45 00 00 00 49 00 00 00 45 00 48 49 49 00 00 45 45 00 00 45 48 49 00 00 48 45 00 00 00 49 00 45 45 00 49 49 00 00 45 45 00 00 45 00 49 00 00 45 45 00 48 49 00 48 45 45 00 45 49 49 00 00 45 45 00 45 00 49 00 00 00 45 00 00 49 49 00 00 45 45 00 00 00 00 49 47 00 00 45 45 00 48 49 00 00 45 00 00 49 49 00 00 45 45 00 00 00 48 49 47 00 00 45 00 48 49 00 00 45 45 00 45 00 49 00 00 45 45 00 49 49 00 00 45 45 00 45 00 49 47 00 00 45 45 00 00 00 00 49 47 00 00 45 45 00 00 48 49 47 00 45 45 45 00 00 45 00 49 00 00 45 45 00 45 49 49 45 00 45 00 00 00 49 49 00 00 45 00 00 00 48 49 47 00 00 45 45 00 00 00 49 47 00 00 45 45 00 00 00 49 00 00 00 45 00 45 49 49 00 00 00 45 00 48 49 00 48 45 00 00 00 49 00 00 45 45 00 48 49 00 00 45 45 45 00 00 49 47 00 00 45 00 00 49 49 00 00 45 00 00 49 47 00 48 45 00 00 48 49 00 00 45 45 00 48 00 49 00 00 45 45 00 48 49 00 00 00 45 00 00 00 49 00 00 45 45 00 48 49 49 00 00 45 00 45 00 49 00 00 00 45 00 00 48 49 00 00 00 45 00 00 49 49 00 45 45 00 00 00 48 49 00 45 45 00 00 49 49 00 00 45 45 00 49 00 45 45 00 00 49 49 00 00 45 45 00 00 48 49 47 00 48 45 00 00 00 49 00 00 00 45 45 00 48 49 49 00 45 45 00 00 00 48 49 49 00 00 45 45 00 00 49 00 00 00 45 00 00 00 49 00 48 45 00 48 49 49 00 45 45 00 00 00 00 49 00 00 00 45 00 00 48 49 00 48 45 45 00 00 49 49 00 00 45 45 00 00 00 00 49 47 00 00 45 45 00 00 00 00 49 00 00 00 45 45 00 48 49 00 00 45 45 00 00 49 00 00 45 45 00 48 49 00 00 00 45 00 45 00 49 00 48 00 45 00 00 49 49 00 00 45 45 00 00 00 48 49 00 48 45 00 00 49 49 00 00 45 45 00 49 49 00 00 45 45 00 00 49 49 00 00 45 45 00 00 00 49 00 00 48 45 00 45 49 49 00 00 45 00 00 49 00 48 45 45 00 48 49 49 00 00 45 00 00 00 49 00 00 48 45 45 00 48 49 00 00 00 45 45 00 00 00 49 00 00 00 45 00 00 48 49 00 48 00 45 00 00 00 49 49 00 45 00 49 49 00 00 45 45 45 00 00 49 00 00 45 45 00 00 00 47 00 00 00 45 00 00 49 49 00 00 45 45 00 00 00 49 49 00 00 45 45 00 00 00 49 47 00 00 45 45 00 00 49 00 00 45 00 00 00 49 00 00 00 45 00 00 48 49 00 00 45 45 00 47 00 48 45 00 00 00 49 00 00 00 45 00 00 00 49 49 00 48 45 00 00 00 49 49 00 45 45 00 00 00 49 49 47 00 45 45 00 48 49 47 00 45 45 00 48 48 49 49 00 00 45 00 49 49 00 45 45 00 45 00 49 00 45 45 45 00 48 49 49 00 45 45 00 48 00 49 00 00 00 45 00 00 00 47 00 48 00 48 49 49 00 00 45 45 00 00 00 49 00 00 00 45 00 00 48 49 00 48 45 45 00 49 47 00 48 45 00 00 00 49 00 00 45 45 00 48 49 49 00 00 45 45 00 00 00 00 49 47 00 00 45 45 00 48 49 00 00 00 45 45 00 00 48 49 00 00 45 45 00 48 49 49 00 00 45 00 00 49 */
PUBLIC aplib_depack EXTERN aPLibMemory_bits EXTERN aPLibMemory_byte EXTERN aPLibMemory_LWM EXTERN aPLibMemory_R0 ;============================================================== ; aplib_depack(unsigned char *src, unsigned char *dest) ;============================================================== ; Uncompresses data previously compressed with apLib ;============================================================== .aplib_depack ld hl, 2 add hl, sp ld e, (hl) ; Destination address inc hl ld d, (hl) inc hl ld a, (hl) ; Source address inc hl ld h, (hl) ld l, a jp depack ; Usage: ; ; .include this file in your code ; somewhere after that, an aPLibMemoryStruct called aPLibMemory must be defined somewhere in RAM ; ie. "aPLibMemory instanceof aPLibMemoryStruct" inside a .ramsection or .enum ; ; Then do ; ; ld hl,<source address> ; ld de,<destination address> ; call depack ; ; In my tests, depack() used a maximum of 12 bytes of stack, but this may vary with different data. ; This file is using WLA-DX syntax quite heavily, you'd better use it too... ;.struct aPLibMemoryStruct ;bits db ;byte db ; not directly referenced, assumed to come after bits ;LWM db ;R0 dw ;.endst ; Reader's note: ; The structure of the code has been arranged such that the entry point is in the middle - ; this is so it can use jr to branch out to the various subsections to save a few bytes, ; but it makes it somewhat harder to read. "depack" is the entry point and "aploop" is ; the main loop. ; Subsections which are only referenced by calls are defined in separate .sections to enable ; better code packing in the output (more finely divided blobs). ; More optimisations may be possible; in general, size optimisations are favoured over speed. .ap_getbit push bc ld bc,(aPLibMemory_bits) rrc c jr nc,ap_getbit_continue ld b,(hl) inc hl .ap_getbit_continue ld a,c and b ld (aPLibMemory_bits),bc pop bc ret .ap_getbitbc ;doubles BC and adds the read bit sla c rl b call ap_getbit ret z inc bc ret .ap_getgamma ld bc,1 .ap_getgammaloop call ap_getbitbc call ap_getbit jr nz,ap_getgammaloop ret .apbranch2 ;use a gamma code * 256 for offset, another gamma code for length call ap_getgamma dec bc dec bc ld a,(aPLibMemory_LWM) or a jr nz,ap_not_LWM ;bc = 2? ; Maxim: I think he means 0 ld a,b or c jr nz,ap_not_zero_gamma ;if gamma code is 2, use old R0 offset, and a new gamma code for length call ap_getgamma push hl ld h,d ld l,e push bc ld bc,(aPLibMemory_R0) sbc hl,bc pop bc ldir pop hl jr ap_finishup .ap_not_zero_gamma dec bc .ap_not_LWM ;do I even need this code? ; Maxim: seems so, it's broken without it ;bc=bc*256+(hl), lazy 16bit way ld b,c ld c,(hl) inc hl ld (aPLibMemory_R0),bc push bc call ap_getgamma ex (sp),hl ;bc = len, hl=offs push de ex de,hl ;some comparison junk for some reason ; Maxim: optimised to use add instead of sbc ld hl,-32000 add hl,de jr nc,skip1 inc bc .skip1 ld hl,-1280 add hl,de jr nc,skip2 inc bc .skip2 ld hl,-128 add hl,de jr c,skip3 inc bc inc bc .skip3 ;bc = len, de = offs, hl=junk pop hl push hl or a sbc hl,de pop de ;hl=dest-offs, bc=len, de = dest ldir pop hl .ap_finishup ld a,1 ld (aPLibMemory_LWM),a jr aploop .apbranch1 ; Maxim: moved this one closer to where it's jumped from to allow jr to work and save 2 bytes ldi xor a ld (aPLibMemory_LWM),a jr aploop .depack ;hl = source ;de = dest ldi xor a ld (aPLibMemory_LWM),a inc a ld (aPLibMemory_bits),a .aploop call ap_getbit jr z, apbranch1 call ap_getbit jr z, apbranch2 call ap_getbit jr z, apbranch3 ;LWM = 0 xor a ld (aPLibMemory_LWM),a ;get an offset ld bc,0 call ap_getbitbc call ap_getbitbc call ap_getbitbc call ap_getbitbc ld a,b or c jr nz,apbranch4 ; xor a ;write a 0 ; Maxim: a is zero already (just failed nz test), optimise this line away ld (de),a inc de jr aploop .apbranch4 ex de,hl ;write a previous bit (1-15 away from dest) push hl sbc hl,bc ld a,(hl) pop hl ld (hl),a inc hl ex de,hl jr aploop .apbranch3 ;use 7 bit offset, length = 2 or 3 ;if a zero is encountered here, it's EOF ld c,(hl) inc hl rr c ret z ld b,2 jr nc,ap_dont_inc_b inc b .ap_dont_inc_b ;LWM = 1 ld a,1 ld (aPLibMemory_LWM),a push hl ld a,b ld b,0 ;R0 = c ld (aPLibMemory_R0),bc ld h,d ld l,e or a sbc hl,bc ld c,a ldir pop hl jr aploop
; void __CALLEE__ sp1_SetPrintPos_callee(struct sp1_pss *ps, uchar row, uchar col) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version SECTION code_sprite_sp1 PUBLIC sp1_SetPrintPos_callee PUBLIC ASMDISP_SP1_SETPRINTPOS_CALLEE EXTERN sp1_GetUpdateStruct_callee EXTERN ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_SetPrintPos_callee pop af pop de pop hl ld d,l pop hl push af .asmentry ; e = col ; d = row ; hl = struct sp1_pss *ps ld c,(hl) inc hl ld b,(hl) ; bc = & bounds rectangle inc hl inc hl ld (hl),e inc hl ld (hl),d inc hl push hl ; stack & sp1_pss.pos ld a,(bc) add a,d ld d,a inc bc ld a,(bc) add a,e ld e,a call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE pop de ex de,hl ld (hl),e inc hl ld (hl),d ret DEFC ASMDISP_SP1_SETPRINTPOS_CALLEE = asmentry - sp1_SetPrintPos_callee
.file "a00.c" .section ".text" .align 4 .align 4 .globl main .type main, #function .proc 04 main: save %sp, -104, %sp clr [%fp+-4] ld [%fp+-4], %g1 inc 0x42, %g1 st %g1, [%fp+-4] ld [%fp+-4], %g1 mov %g1, %i0 restore retl nop .size main, .-main # ---------------------- .ident "GCC: (GNU) 4.4.2"
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: utilsGroup.asm AUTHOR: Chris Boyke METHODS: Name Description ---- ----------- FUNCTIONS: Scope Name Description ----- ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 2/26/92 Initial version. DESCRIPTION: Utilities for dealing with the ChartGroup object $Id: utilsGroup.asm,v 1.1 97/04/04 17:47:46 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% UtilGetSeriesAndCategoryCount %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: CALLED BY: global within chart PASS: ds - segment of chart objects RETURN: cl - series count dx - category count DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 2/26/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ UtilGetSeriesAndCategoryCount proc far uses ax,si .enter mov ax, MSG_CHART_GROUP_GET_SERIES_COUNT mov si, offset TemplateChartGroup call ObjCallInstanceNoLock push cx mov ax, MSG_CHART_GROUP_GET_CATEGORY_COUNT call ObjCallInstanceNoLock mov dx, cx pop cx .leave ret UtilGetSeriesAndCategoryCount endp
.section __TEXT,__text,regular,pure_instructions .build_version macos, 10, 15 sdk_version 10, 15, 4 .globl _main .p2align 4, 0x90 _main: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset %rbp, -16 movq %rsp, %rbp .cfi_def_cfa_register %rbp subq $16, %rsp movl $0, -4(%rbp) leaq L_.str(%rip), %rdi movb $0, %al callq _printf xorl %ecx, %ecx movl %eax, -8(%rbp) movl %ecx, %eax addq $16, %rsp popq %rbp retq .cfi_endproc .section __TEXT,__cstring,cstring_literals L_.str: .asciz "Hello, World!\n" .subsections_via_symbols
; A208506: p^(p+1) + (p+1)^p, where p = prime(n). ; Submitted by Christian Krause ; 17,145,23401,7861953,3881436747409,4731091158953433,16248996011806421522977,42832853457545958193355601,535823088031930481975544151644865,81325936178163422902293018227199467668020601,574816324219011030910795084923222601801634659329,418853461836935722690909509309638550036068585843392538968137,58140528987972062717648701550074683586232128502550042606280502123473,792390750772315368211435450172835019977387140007533761875410284242928785 seq $0,40 ; The prime numbers. seq $0,51442 ; a(n) = n^(n+1)+(n+1)^n.
class Solution { public: void swapChar(char& a, char& b){ char temp = a; a = b; b = temp; } void reverseString(vector<char>& s) { int i = 0; int j = s.size() - 1; while(i < j){ swapChar(s[i], s[j]); i++; j--; } } };
; A115565: a(n) = 5*n^4 - 10*n^3 + 20*n^2 - 15*n + 11. ; 11,61,281,911,2311,4961,9461,16531,27011,41861,62161,89111,124031,168361,223661,291611,374011,472781,589961,727711,888311,1074161,1287781,1531811,1809011,2122261,2474561,2869031,3308911,3797561,4338461,4935211,5591531,6311261,7098361,7956911,8891111,9905281,11003861,12191411,13472611,14852261,16335281,17926711,19631711,21455561,23403661,25481531,27694811,30049261,32550761,35205311,38019031,40998161,44149061,47478211,50992211,54697781,58601761,62711111,67032911,71574361,76342781,81345611 mov $2,1 add $2,$0 mul $0,$2 add $0,2 bin $0,2 mul $0,10 add $0,1
; A067407: Seventh column of triangle A067402. ; Submitted by Jon Maiga ; 1,13,637,31213,1529437,74942413,3672178237,179936733613,8816899947037,432028097404813,21169376772835837,1037299461868956013,50827673631578844637,2490556007947363387213,122037244389420805973437 mul $0,2 mov $2,1 lpb $0 sub $0,1 mov $3,$2 add $2,1 mul $2,7 lpe mov $0,$3 div $0,14 mul $0,12 add $0,1
;------------------------------------------------------------------------------- ; sys_core.asm ; ; Copyright (C) 2009-2016 Texas Instruments Incorporated - www.ti.com ; ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; ; Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; ; Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in the ; documentation and/or other materials provided with the ; distribution. ; ; Neither the name of Texas Instruments Incorporated nor the names of ; its contributors may be used to endorse or promote products derived ; from this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ; ; .text .arm ;------------------------------------------------------------------------------- ; Initialize CPU Registers ; SourceId : CORE_SourceId_001 ; DesignId : CORE_DesignId_001 ; Requirements: HL_SR477, HL_SR476, HL_SR492 .def _coreInitRegisters_ .asmfunc _coreInitRegisters_ ; After reset, the CPU is in the Supervisor mode (M = 10011) mov r0, lr mov r1, #0x0000 mov r2, #0x0000 mov r3, #0x0000 mov r4, #0x0000 mov r5, #0x0000 mov r6, #0x0000 mov r7, #0x0000 mov r8, #0x0000 mov r9, #0x0000 mov r10, #0x0000 mov r11, #0x0000 mov r12, #0x0000 mov r13, #0x0000 mrs r1, cpsr msr spsr_cxsf, r1 ; Switch to FIQ mode (M = 10001) cps #17 mov lr, r0 mov r8, #0x0000 mov r9, #0x0000 mov r10, #0x0000 mov r11, #0x0000 mov r12, #0x0000 mrs r1, cpsr msr spsr_cxsf, r1 ; Switch to IRQ mode (M = 10010) cps #18 mov lr, r0 mrs r1,cpsr msr spsr_cxsf, r1 ; Switch to Abort mode (M = 10111) cps #23 mov lr, r0 mrs r1,cpsr msr spsr_cxsf, r1 ; Switch to Undefined Instruction Mode (M = 11011) cps #27 mov lr, r0 mrs r1,cpsr msr spsr_cxsf, r1 ; Switch to System Mode ( Shares User Mode registers ) (M = 11111) cps #31 mov lr, r0 mrs r1,cpsr msr spsr_cxsf, r1 mrc p15, #0x00, r2, c1, c0, #0x02 orr r2, r2, #0xF00000 mcr p15, #0x00, r2, c1, c0, #0x02 mov r2, #0x40000000 fmxr fpexc, r2 fmdrr d0, r1, r1 fmdrr d1, r1, r1 fmdrr d2, r1, r1 fmdrr d3, r1, r1 fmdrr d4, r1, r1 fmdrr d5, r1, r1 fmdrr d6, r1, r1 fmdrr d7, r1, r1 fmdrr d8, r1, r1 fmdrr d9, r1, r1 fmdrr d10, r1, r1 fmdrr d11, r1, r1 fmdrr d12, r1, r1 fmdrr d13, r1, r1 fmdrr d14, r1, r1 fmdrr d15, r1, r1 bl next1 next1 bl next2 next2 bl next3 next3 bl next4 next4 bx r0 .endasmfunc ;------------------------------------------------------------------------------- ; Initialize Stack Pointers ; SourceId : CORE_SourceId_002 ; DesignId : CORE_DesignId_002 ; Requirements: HL_SR478 .def _coreInitStackPointer_ .asmfunc _coreInitStackPointer_ cps #17 ldr sp, fiqSp cps #18 ldr sp, irqSp cps #19 ldr sp, svcSp cps #23 ldr sp, abortSp cps #27 ldr sp, undefSp cps #31 ldr sp, userSp bx lr userSp .word 0x08000000+0x00001000 svcSp .word 0x08000000+0x00001000+0x00000100 fiqSp .word 0x08000000+0x00001000+0x00000100+0x00000100 irqSp .word 0x08000000+0x00001000+0x00000100+0x00000100+0x00000100 abortSp .word 0x08000000+0x00001000+0x00000100+0x00000100+0x00000100+0x00000100 undefSp .word 0x08000000+0x00001000+0x00000100+0x00000100+0x00000100+0x00000100+0x00000100 .endasmfunc ;------------------------------------------------------------------------------- ; Get CPSR Value ; SourceId : CORE_SourceId_003 ; DesignId : CORE_DesignId_003 ; Requirements: .def _getCPSRValue_ .asmfunc _getCPSRValue_ mrs r0, CPSR bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Take CPU to IDLE state ; SourceId : CORE_SourceId_004 ; DesignId : CORE_DesignId_004 ; Requirements: HL_SR493 .def _gotoCPUIdle_ .asmfunc _gotoCPUIdle_ WFI nop nop nop nop bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Enable VFP Unit ; SourceId : CORE_SourceId_005 ; DesignId : CORE_DesignId_006 ; Requirements: HL_SR492, HL_SR476 .def _coreEnableVfp_ .asmfunc _coreEnableVfp_ mrc p15, #0x00, r0, c1, c0, #0x02 orr r0, r0, #0xF00000 mcr p15, #0x00, r0, c1, c0, #0x02 mov r0, #0x40000000 fmxr fpexc, r0 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Enable Event Bus Export ; SourceId : CORE_SourceId_006 ; DesignId : CORE_DesignId_007 ; Requirements: HL_SR479 .def _coreEnableEventBusExport_ .asmfunc _coreEnableEventBusExport_ mrc p15, #0x00, r0, c9, c12, #0x00 orr r0, r0, #0x10 mcr p15, #0x00, r0, c9, c12, #0x00 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Disable Event Bus Export ; SourceId : CORE_SourceId_007 ; DesignId : CORE_DesignId_008 ; Requirements: HL_SR481 .def _coreDisableEventBusExport_ .asmfunc _coreDisableEventBusExport_ mrc p15, #0x00, r0, c9, c12, #0x00 bic r0, r0, #0x10 mcr p15, #0x00, r0, c9, c12, #0x00 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Enable RAM ECC Support ; SourceId : CORE_SourceId_008 ; DesignId : CORE_DesignId_009 ; Requirements: HL_SR480 .def _coreEnableRamEcc_ .asmfunc _coreEnableRamEcc_ mrc p15, #0x00, r0, c1, c0, #0x01 orr r0, r0, #0x0C000000 mcr p15, #0x00, r0, c1, c0, #0x01 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Disable RAM ECC Support ; SourceId : CORE_SourceId_009 ; DesignId : CORE_DesignId_010 ; Requirements: HL_SR482 .def _coreDisableRamEcc_ .asmfunc _coreDisableRamEcc_ mrc p15, #0x00, r0, c1, c0, #0x01 bic r0, r0, #0x0C000000 mcr p15, #0x00, r0, c1, c0, #0x01 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Enable Flash ECC Support ; SourceId : CORE_SourceId_010 ; DesignId : CORE_DesignId_011 ; Requirements: HL_SR480, HL_SR458 .def _coreEnableFlashEcc_ .asmfunc _coreEnableFlashEcc_ mrc p15, #0x00, r0, c1, c0, #0x01 orr r0, r0, #0x02000000 dmb mcr p15, #0x00, r0, c1, c0, #0x01 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Disable Flash ECC Support ; SourceId : CORE_SourceId_011 ; DesignId : CORE_DesignId_012 ; Requirements: HL_SR482 .def _coreDisableFlashEcc_ .asmfunc _coreDisableFlashEcc_ mrc p15, #0x00, r0, c1, c0, #0x01 bic r0, r0, #0x02000000 mcr p15, #0x00, r0, c1, c0, #0x01 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Enable Offset via Vic controller ; SourceId : CORE_SourceId_012 ; DesignId : CORE_DesignId_005 ; Requirements: HL_SR483, HL_SR491 .def _coreEnableIrqVicOffset_ .asmfunc _coreEnableIrqVicOffset_ mrc p15, #0, r0, c1, c0, #0 orr r0, r0, #0x01000000 mcr p15, #0, r0, c1, c0, #0 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Get data fault status register ; SourceId : CORE_SourceId_013 ; DesignId : CORE_DesignId_013 ; Requirements: HL_SR495 .def _coreGetDataFault_ .asmfunc _coreGetDataFault_ mrc p15, #0, r0, c5, c0, #0 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Clear data fault status register ; SourceId : CORE_SourceId_014 ; DesignId : CORE_DesignId_014 ; Requirements: HL_SR495 .def _coreClearDataFault_ .asmfunc _coreClearDataFault_ mov r0, #0 mcr p15, #0, r0, c5, c0, #0 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Get instruction fault status register ; SourceId : CORE_SourceId_015 ; DesignId : CORE_DesignId_015 ; Requirements: HL_SR495 .def _coreGetInstructionFault_ .asmfunc _coreGetInstructionFault_ mrc p15, #0, r0, c5, c0, #1 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Clear instruction fault status register ; SourceId : CORE_SourceId_016 ; DesignId : CORE_DesignId_016 ; Requirements: HL_SR495 .def _coreClearInstructionFault_ .asmfunc _coreClearInstructionFault_ mov r0, #0 mcr p15, #0, r0, c5, c0, #1 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Get data fault address register ; SourceId : CORE_SourceId_017 ; DesignId : CORE_DesignId_017 ; Requirements: HL_SR495 .def _coreGetDataFaultAddress_ .asmfunc _coreGetDataFaultAddress_ mrc p15, #0, r0, c6, c0, #0 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Clear data fault address register ; SourceId : CORE_SourceId_018 ; DesignId : CORE_DesignId_018 ; Requirements: HL_SR495 .def _coreClearDataFaultAddress_ .asmfunc _coreClearDataFaultAddress_ mov r0, #0 mcr p15, #0, r0, c6, c0, #0 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Get instruction fault address register ; SourceId : CORE_SourceId_019 ; DesignId : CORE_DesignId_019 ; Requirements: HL_SR495 .def _coreGetInstructionFaultAddress_ .asmfunc _coreGetInstructionFaultAddress_ mrc p15, #0, r0, c6, c0, #2 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Clear instruction fault address register ; SourceId : CORE_SourceId_020 ; DesignId : CORE_DesignId_020 ; Requirements: HL_SR495 .def _coreClearInstructionFaultAddress_ .asmfunc _coreClearInstructionFaultAddress_ mov r0, #0 mcr p15, #0, r0, c6, c0, #2 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Get auxiliary data fault status register ; SourceId : CORE_SourceId_021 ; DesignId : CORE_DesignId_021 ; Requirements: HL_SR496 .def _coreGetAuxiliaryDataFault_ .asmfunc _coreGetAuxiliaryDataFault_ mrc p15, #0, r0, c5, c1, #0 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Clear auxiliary data fault status register ; SourceId : CORE_SourceId_022 ; DesignId : CORE_DesignId_022 ; Requirements: HL_SR496 .def _coreClearAuxiliaryDataFault_ .asmfunc _coreClearAuxiliaryDataFault_ mov r0, #0 mcr p15, #0, r0, c5, c1, #0 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Get auxiliary instruction fault status register ; SourceId : CORE_SourceId_023 ; DesignId : CORE_DesignId_023 ; Requirements: HL_SR496 .def _coreGetAuxiliaryInstructionFault_ .asmfunc _coreGetAuxiliaryInstructionFault_ mrc p15, #0, r0, c5, c1, #1 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Clear auxiliary instruction fault status register ; SourceId : CORE_SourceId_024 ; DesignId : CORE_DesignId_024 ; Requirements: HL_SR496 .def _coreClearAuxiliaryInstructionFault_ .asmfunc _coreClearAuxiliaryInstructionFault_ mov r0, #0 mrc p15, #0, r0, c5, c1, #1 bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Disable interrupts - R4 IRQ & FIQ ; SourceId : CORE_SourceId_025 ; DesignId : CORE_DesignId_025 ; Requirements: HL_SR494 .def _disable_interrupt_ .asmfunc _disable_interrupt_ cpsid if bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Disable FIQ interrupt ; SourceId : CORE_SourceId_026 ; DesignId : CORE_DesignId_026 ; Requirements: HL_SR494 .def _disable_FIQ_interrupt_ .asmfunc _disable_FIQ_interrupt_ cpsid f bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Disable FIQ interrupt .def _disable_IRQ_interrupt_ .asmfunc _disable_IRQ_interrupt_ cpsid i bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Enable interrupts - R4 IRQ & FIQ .def _enable_interrupt_ .asmfunc _enable_interrupt_ cpsie if bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Clear ESM CCM errorss .def _esmCcmErrorsClear_ .asmfunc _esmCcmErrorsClear_ stmfd sp!, {r0-r2} ldr r0, ESMSR1_REG ; load the ESMSR1 status register address ldr r2, ESMSR1_ERR_CLR str r2, [r0] ; clear the ESMSR1 register ldr r0, ESMSR2_REG ; load the ESMSR2 status register address ldr r2, ESMSR2_ERR_CLR str r2, [r0] ; clear the ESMSR2 register ldr r0, ESMSSR2_REG ; load the ESMSSR2 status register address ldr r2, ESMSSR2_ERR_CLR str r2, [r0] ; clear the ESMSSR2 register ldr r0, ESMKEY_REG ; load the ESMKEY register address mov r2, #0x5 ; load R2 with 0x5 str r2, [r0] ; clear the ESMKEY register ldr r0, VIM_INTREQ ; load the INTREQ register address ldr r2, VIM_INT_CLR str r2, [r0] ; clear the INTREQ register ldr r0, CCMR4_STAT_REG ; load the CCMR4 status register address ldr r2, CCMR4_ERR_CLR str r2, [r0] ; clear the CCMR4 status register ldmfd sp!, {r0-r2} bx lr ESMSR1_REG .word 0xFFFFF518 ESMSR2_REG .word 0xFFFFF51C ESMSR3_REG .word 0xFFFFF520 ESMKEY_REG .word 0xFFFFF538 ESMSSR2_REG .word 0xFFFFF53C CCMR4_STAT_REG .word 0xFFFFF600 ERR_CLR_WRD .word 0xFFFFFFFF CCMR4_ERR_CLR .word 0x00010000 ESMSR1_ERR_CLR .word 0x80000000 ESMSR2_ERR_CLR .word 0x00000004 ESMSSR2_ERR_CLR .word 0x00000004 VIM_INT_CLR .word 0x00000001 VIM_INTREQ .word 0xFFFFFE20 .endasmfunc ;------------------------------------------------------------------------------- ; Work Around for Errata CORTEX-R4#57: ; ; Errata Description: ; Conditional VMRS APSR_Nzcv, FPSCR May Evaluate With Incorrect Flags ; Workaround: ; Disable out-of-order single-precision floating point ; multiply-accumulate instruction completion .def _errata_CORTEXR4_57_ .asmfunc _errata_CORTEXR4_57_ mrc p15, #0, r0, c15, c0, #0 ; Read Secondary Auxiliary Control Register orr r0, r0, #0x10000 ; Set BIT 16 (Set DOOFMACS) mcr p15, #0, r0, c15, c0, #0 ; Write Secondary Auxiliary Control Register bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Work Around for Errata CORTEX-R4#66: ; ; Errata Description: ; Register Corruption During A Load-Multiple Instruction At ; an Exception Vector ; Workaround: ; Disable out-of-order completion for divide instructions in ; Auxiliary Control register .def _errata_CORTEXR4_66_ .asmfunc _errata_CORTEXR4_66_ mrc p15, #0, r0, c1, c0, #1 ; Read Auxiliary Control register orr r0, r0, #0x80 ; Set BIT 7 (Disable out-of-order completion ; for divide instructions.) mcr p15, #0, r0, c1, c0, #1 ; Write Auxiliary Control register bx lr .endasmfunc ;------------------------------------------------------------------------------- ; C++ construct table pointers .def __TI_PINIT_Base, __TI_PINIT_Limit .weak SHT$$INIT_ARRAY$$Base, SHT$$INIT_ARRAY$$Limit __TI_PINIT_Base .long SHT$$INIT_ARRAY$$Base __TI_PINIT_Limit .long SHT$$INIT_ARRAY$$Limit ;-------------------------------------------------------------------------------
/* * Copyright (C) 2013 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "wtf/allocator/PartitionAlloc.h" #include <string.h> #ifndef NDEBUG #include <stdio.h> #endif // Two partition pages are used as guard / metadata page so make sure the super // page size is bigger. static_assert(WTF::kPartitionPageSize * 4 <= WTF::kSuperPageSize, "ok super page size"); static_assert(!(WTF::kSuperPageSize % WTF::kPartitionPageSize), "ok super page multiple"); // Four system pages gives us room to hack out a still-guard-paged piece // of metadata in the middle of a guard partition page. static_assert(WTF::kSystemPageSize * 4 <= WTF::kPartitionPageSize, "ok partition page size"); static_assert(!(WTF::kPartitionPageSize % WTF::kSystemPageSize), "ok partition page multiple"); static_assert(sizeof(WTF::PartitionPage) <= WTF::kPageMetadataSize, "PartitionPage should not be too big"); static_assert(sizeof(WTF::PartitionBucket) <= WTF::kPageMetadataSize, "PartitionBucket should not be too big"); static_assert(sizeof(WTF::PartitionSuperPageExtentEntry) <= WTF::kPageMetadataSize, "PartitionSuperPageExtentEntry should not be too big"); static_assert(WTF::kPageMetadataSize * WTF::kNumPartitionPagesPerSuperPage <= WTF::kSystemPageSize, "page metadata fits in hole"); // Check that some of our zanier calculations worked out as expected. static_assert(WTF::kGenericSmallestBucket == 8, "generic smallest bucket"); static_assert(WTF::kGenericMaxBucketed == 983040, "generic max bucketed"); static_assert(WTF::kMaxSystemPagesPerSlotSpan < (1 << 8), "System pages per slot span must be less than 128."); namespace WTF { SpinLock PartitionRootBase::gInitializedLock; bool PartitionRootBase::gInitialized = false; PartitionPage PartitionRootBase::gSeedPage; PartitionBucket PartitionRootBase::gPagedBucket; void (*PartitionRootBase::gOomHandlingFunction)() = nullptr; PartitionAllocHooks::AllocationHook* PartitionAllocHooks::m_allocationHook = nullptr; PartitionAllocHooks::FreeHook* PartitionAllocHooks::m_freeHook = nullptr; static uint8_t partitionBucketNumSystemPages(size_t size) { // This works out reasonably for the current bucket sizes of the generic // allocator, and the current values of partition page size and constants. // Specifically, we have enough room to always pack the slots perfectly into // some number of system pages. The only waste is the waste associated with // unfaulted pages (i.e. wasted address space). // TODO: we end up using a lot of system pages for very small sizes. For // example, we'll use 12 system pages for slot size 24. The slot size is // so small that the waste would be tiny with just 4, or 1, system pages. // Later, we can investigate whether there are anti-fragmentation benefits // to using fewer system pages. double bestWasteRatio = 1.0f; uint16_t bestPages = 0; if (size > kMaxSystemPagesPerSlotSpan * kSystemPageSize) { ASSERT(!(size % kSystemPageSize)); bestPages = static_cast<uint16_t>(size / kSystemPageSize); RELEASE_ASSERT(bestPages < (1 << 8)); return static_cast<uint8_t>(bestPages); } ASSERT(size <= kMaxSystemPagesPerSlotSpan * kSystemPageSize); for (uint16_t i = kNumSystemPagesPerPartitionPage - 1; i <= kMaxSystemPagesPerSlotSpan; ++i) { size_t pageSize = kSystemPageSize * i; size_t numSlots = pageSize / size; size_t waste = pageSize - (numSlots * size); // Leaving a page unfaulted is not free; the page will occupy an empty page table entry. // Make a simple attempt to account for that. size_t numRemainderPages = i & (kNumSystemPagesPerPartitionPage - 1); size_t numUnfaultedPages = numRemainderPages ? (kNumSystemPagesPerPartitionPage - numRemainderPages) : 0; waste += sizeof(void*) * numUnfaultedPages; double wasteRatio = (double) waste / (double) pageSize; if (wasteRatio < bestWasteRatio) { bestWasteRatio = wasteRatio; bestPages = i; } } ASSERT(bestPages > 0); RELEASE_ASSERT(bestPages <= kMaxSystemPagesPerSlotSpan); return static_cast<uint8_t>(bestPages); } static void partitionAllocBaseInit(PartitionRootBase* root) { ASSERT(!root->initialized); { SpinLock::Guard guard(PartitionRootBase::gInitializedLock); if (!PartitionRootBase::gInitialized) { PartitionRootBase::gInitialized = true; // We mark the seed page as free to make sure it is skipped by our // logic to find a new active page. PartitionRootBase::gPagedBucket.activePagesHead = &PartitionRootGeneric::gSeedPage; } } root->initialized = true; root->totalSizeOfCommittedPages = 0; root->totalSizeOfSuperPages = 0; root->totalSizeOfDirectMappedPages = 0; root->nextSuperPage = 0; root->nextPartitionPage = 0; root->nextPartitionPageEnd = 0; root->firstExtent = 0; root->currentExtent = 0; root->directMapList = 0; memset(&root->globalEmptyPageRing, '\0', sizeof(root->globalEmptyPageRing)); root->globalEmptyPageRingIndex = 0; // This is a "magic" value so we can test if a root pointer is valid. root->invertedSelf = ~reinterpret_cast<uintptr_t>(root); } static void partitionBucketInitBase(PartitionBucket* bucket, PartitionRootBase* root) { bucket->activePagesHead = &PartitionRootGeneric::gSeedPage; bucket->emptyPagesHead = 0; bucket->decommittedPagesHead = 0; bucket->numFullPages = 0; bucket->numSystemPagesPerSlotSpan = partitionBucketNumSystemPages(bucket->slotSize); } void partitionAllocGlobalInit(void (*oomHandlingFunction)()) { ASSERT(oomHandlingFunction); PartitionRootBase::gOomHandlingFunction = oomHandlingFunction; } void partitionAllocInit(PartitionRoot* root, size_t numBuckets, size_t maxAllocation) { partitionAllocBaseInit(root); root->numBuckets = numBuckets; root->maxAllocation = maxAllocation; size_t i; for (i = 0; i < root->numBuckets; ++i) { PartitionBucket* bucket = &root->buckets()[i]; if (!i) bucket->slotSize = kAllocationGranularity; else bucket->slotSize = i << kBucketShift; partitionBucketInitBase(bucket, root); } } void partitionAllocGenericInit(PartitionRootGeneric* root) { SpinLock::Guard guard(root->lock); partitionAllocBaseInit(root); // Precalculate some shift and mask constants used in the hot path. // Example: malloc(41) == 101001 binary. // Order is 6 (1 << 6-1)==32 is highest bit set. // orderIndex is the next three MSB == 010 == 2. // subOrderIndexMask is a mask for the remaining bits == 11 (masking to 01 for the subOrderIndex). size_t order; for (order = 0; order <= kBitsPerSizet; ++order) { size_t orderIndexShift; if (order < kGenericNumBucketsPerOrderBits + 1) orderIndexShift = 0; else orderIndexShift = order - (kGenericNumBucketsPerOrderBits + 1); root->orderIndexShifts[order] = orderIndexShift; size_t subOrderIndexMask; if (order == kBitsPerSizet) { // This avoids invoking undefined behavior for an excessive shift. subOrderIndexMask = static_cast<size_t>(-1) >> (kGenericNumBucketsPerOrderBits + 1); } else { subOrderIndexMask = ((static_cast<size_t>(1) << order) - 1) >> (kGenericNumBucketsPerOrderBits + 1); } root->orderSubIndexMasks[order] = subOrderIndexMask; } // Set up the actual usable buckets first. // Note that typical values (i.e. min allocation size of 8) will result in // pseudo buckets (size==9 etc. or more generally, size is not a multiple // of the smallest allocation granularity). // We avoid them in the bucket lookup map, but we tolerate them to keep the // code simpler and the structures more generic. size_t i, j; size_t currentSize = kGenericSmallestBucket; size_t currentIncrement = kGenericSmallestBucket >> kGenericNumBucketsPerOrderBits; PartitionBucket* bucket = &root->buckets[0]; for (i = 0; i < kGenericNumBucketedOrders; ++i) { for (j = 0; j < kGenericNumBucketsPerOrder; ++j) { bucket->slotSize = currentSize; partitionBucketInitBase(bucket, root); // Disable psuedo buckets so that touching them faults. if (currentSize % kGenericSmallestBucket) bucket->activePagesHead = 0; currentSize += currentIncrement; ++bucket; } currentIncrement <<= 1; } ASSERT(currentSize == 1 << kGenericMaxBucketedOrder); ASSERT(bucket == &root->buckets[0] + kGenericNumBuckets); // Then set up the fast size -> bucket lookup table. bucket = &root->buckets[0]; PartitionBucket** bucketPtr = &root->bucketLookups[0]; for (order = 0; order <= kBitsPerSizet; ++order) { for (j = 0; j < kGenericNumBucketsPerOrder; ++j) { if (order < kGenericMinBucketedOrder) { // Use the bucket of the finest granularity for malloc(0) etc. *bucketPtr++ = &root->buckets[0]; } else if (order > kGenericMaxBucketedOrder) { *bucketPtr++ = &PartitionRootGeneric::gPagedBucket; } else { PartitionBucket* validBucket = bucket; // Skip over invalid buckets. while (validBucket->slotSize % kGenericSmallestBucket) validBucket++; *bucketPtr++ = validBucket; bucket++; } } } ASSERT(bucket == &root->buckets[0] + kGenericNumBuckets); ASSERT(bucketPtr == &root->bucketLookups[0] + ((kBitsPerSizet + 1) * kGenericNumBucketsPerOrder)); // And there's one last bucket lookup that will be hit for e.g. malloc(-1), // which tries to overflow to a non-existant order. *bucketPtr = &PartitionRootGeneric::gPagedBucket; } static bool partitionAllocShutdownBucket(PartitionBucket* bucket) { // Failure here indicates a memory leak. bool foundLeak = bucket->numFullPages; for (PartitionPage* page = bucket->activePagesHead; page; page = page->nextPage) foundLeak |= (page->numAllocatedSlots > 0); return foundLeak; } static bool partitionAllocBaseShutdown(PartitionRootBase* root) { ASSERT(root->initialized); root->initialized = false; // Now that we've examined all partition pages in all buckets, it's safe // to free all our super pages. Since the super page extent entries are // stored in the super pages, we need to be careful not to access them // after we've released the corresponding super page. PartitionSuperPageExtentEntry* entry = root->firstExtent; while (entry) { PartitionSuperPageExtentEntry* nextEntry = entry->next; char* superPage = entry->superPageBase; char* superPagesEnd = entry->superPagesEnd; while (superPage < superPagesEnd) { freePages(superPage, kSuperPageSize); superPage += kSuperPageSize; } entry = nextEntry; } return root->directMapList; } bool partitionAllocShutdown(PartitionRoot* root) { bool foundLeak = false; size_t i; for (i = 0; i < root->numBuckets; ++i) { PartitionBucket* bucket = &root->buckets()[i]; foundLeak |= partitionAllocShutdownBucket(bucket); } foundLeak |= partitionAllocBaseShutdown(root); return !foundLeak; } bool partitionAllocGenericShutdown(PartitionRootGeneric* root) { SpinLock::Guard guard(root->lock); bool foundLeak = false; size_t i; for (i = 0; i < kGenericNumBuckets; ++i) { PartitionBucket* bucket = &root->buckets[i]; foundLeak |= partitionAllocShutdownBucket(bucket); } foundLeak |= partitionAllocBaseShutdown(root); return !foundLeak; } #if !CPU(64BIT) static NEVER_INLINE void partitionOutOfMemoryWithLotsOfUncommitedPages() { IMMEDIATE_CRASH(); } #endif static NEVER_INLINE void partitionOutOfMemory(const PartitionRootBase* root) { #if !CPU(64BIT) // Check whether this OOM is due to a lot of super pages that are allocated // but not committed, probably due to http://crbug.com/421387. if (root->totalSizeOfSuperPages + root->totalSizeOfDirectMappedPages - root->totalSizeOfCommittedPages > kReasonableSizeOfUnusedPages) { partitionOutOfMemoryWithLotsOfUncommitedPages(); } #endif if (PartitionRootBase::gOomHandlingFunction) (*PartitionRootBase::gOomHandlingFunction)(); IMMEDIATE_CRASH(); } static NEVER_INLINE void partitionExcessiveAllocationSize() { IMMEDIATE_CRASH(); } static NEVER_INLINE void partitionBucketFull() { IMMEDIATE_CRASH(); } // partitionPageStateIs* // Note that it's only valid to call these functions on pages found on one of // the page lists. Specifically, you can't call these functions on full pages // that were detached from the active list. static bool ALWAYS_INLINE partitionPageStateIsActive(const PartitionPage* page) { ASSERT(page != &PartitionRootGeneric::gSeedPage); ASSERT(!page->pageOffset); return (page->numAllocatedSlots > 0 && (page->freelistHead || page->numUnprovisionedSlots)); } static bool ALWAYS_INLINE partitionPageStateIsFull(const PartitionPage* page) { ASSERT(page != &PartitionRootGeneric::gSeedPage); ASSERT(!page->pageOffset); bool ret = (page->numAllocatedSlots == partitionBucketSlots(page->bucket)); if (ret) { ASSERT(!page->freelistHead); ASSERT(!page->numUnprovisionedSlots); } return ret; } static bool ALWAYS_INLINE partitionPageStateIsEmpty(const PartitionPage* page) { ASSERT(page != &PartitionRootGeneric::gSeedPage); ASSERT(!page->pageOffset); return (!page->numAllocatedSlots && page->freelistHead); } static bool ALWAYS_INLINE partitionPageStateIsDecommitted(const PartitionPage* page) { ASSERT(page != &PartitionRootGeneric::gSeedPage); ASSERT(!page->pageOffset); bool ret = (!page->numAllocatedSlots && !page->freelistHead); if (ret) { ASSERT(!page->numUnprovisionedSlots); ASSERT(page->emptyCacheIndex == -1); } return ret; } static void partitionIncreaseCommittedPages(PartitionRootBase* root, size_t len) { root->totalSizeOfCommittedPages += len; ASSERT(root->totalSizeOfCommittedPages <= root->totalSizeOfSuperPages + root->totalSizeOfDirectMappedPages); } static void partitionDecreaseCommittedPages(PartitionRootBase* root, size_t len) { root->totalSizeOfCommittedPages -= len; ASSERT(root->totalSizeOfCommittedPages <= root->totalSizeOfSuperPages + root->totalSizeOfDirectMappedPages); } static ALWAYS_INLINE void partitionDecommitSystemPages(PartitionRootBase* root, void* addr, size_t len) { decommitSystemPages(addr, len); partitionDecreaseCommittedPages(root, len); } static ALWAYS_INLINE void partitionRecommitSystemPages(PartitionRootBase* root, void* addr, size_t len) { recommitSystemPages(addr, len); partitionIncreaseCommittedPages(root, len); } static ALWAYS_INLINE void* partitionAllocPartitionPages(PartitionRootBase* root, int flags, uint16_t numPartitionPages) { ASSERT(!(reinterpret_cast<uintptr_t>(root->nextPartitionPage) % kPartitionPageSize)); ASSERT(!(reinterpret_cast<uintptr_t>(root->nextPartitionPageEnd) % kPartitionPageSize)); ASSERT(numPartitionPages <= kNumPartitionPagesPerSuperPage); size_t totalSize = kPartitionPageSize * numPartitionPages; size_t numPartitionPagesLeft = (root->nextPartitionPageEnd - root->nextPartitionPage) >> kPartitionPageShift; if (LIKELY(numPartitionPagesLeft >= numPartitionPages)) { // In this case, we can still hand out pages from the current super page // allocation. char* ret = root->nextPartitionPage; root->nextPartitionPage += totalSize; partitionIncreaseCommittedPages(root, totalSize); return ret; } // Need a new super page. We want to allocate super pages in a continguous // address region as much as possible. This is important for not causing // page table bloat and not fragmenting address spaces in 32 bit architectures. char* requestedAddress = root->nextSuperPage; char* superPage = reinterpret_cast<char*>(allocPages(requestedAddress, kSuperPageSize, kSuperPageSize, PageAccessible)); if (UNLIKELY(!superPage)) return 0; root->totalSizeOfSuperPages += kSuperPageSize; partitionIncreaseCommittedPages(root, totalSize); root->nextSuperPage = superPage + kSuperPageSize; char* ret = superPage + kPartitionPageSize; root->nextPartitionPage = ret + totalSize; root->nextPartitionPageEnd = root->nextSuperPage - kPartitionPageSize; // Make the first partition page in the super page a guard page, but leave a // hole in the middle. // This is where we put page metadata and also a tiny amount of extent // metadata. setSystemPagesInaccessible(superPage, kSystemPageSize); setSystemPagesInaccessible(superPage + (kSystemPageSize * 2), kPartitionPageSize - (kSystemPageSize * 2)); // Also make the last partition page a guard page. setSystemPagesInaccessible(superPage + (kSuperPageSize - kPartitionPageSize), kPartitionPageSize); // If we were after a specific address, but didn't get it, assume that // the system chose a lousy address. Here most OS'es have a default // algorithm that isn't randomized. For example, most Linux // distributions will allocate the mapping directly before the last // successful mapping, which is far from random. So we just get fresh // randomness for the next mapping attempt. if (requestedAddress && requestedAddress != superPage) root->nextSuperPage = 0; // We allocated a new super page so update super page metadata. // First check if this is a new extent or not. PartitionSuperPageExtentEntry* latestExtent = reinterpret_cast<PartitionSuperPageExtentEntry*>(partitionSuperPageToMetadataArea(superPage)); // By storing the root in every extent metadata object, we have a fast way // to go from a pointer within the partition to the root object. latestExtent->root = root; // Most new extents will be part of a larger extent, and these three fields // are unused, but we initialize them to 0 so that we get a clear signal // in case they are accidentally used. latestExtent->superPageBase = 0; latestExtent->superPagesEnd = 0; latestExtent->next = 0; PartitionSuperPageExtentEntry* currentExtent = root->currentExtent; bool isNewExtent = (superPage != requestedAddress); if (UNLIKELY(isNewExtent)) { if (UNLIKELY(!currentExtent)) { ASSERT(!root->firstExtent); root->firstExtent = latestExtent; } else { ASSERT(currentExtent->superPageBase); currentExtent->next = latestExtent; } root->currentExtent = latestExtent; latestExtent->superPageBase = superPage; latestExtent->superPagesEnd = superPage + kSuperPageSize; } else { // We allocated next to an existing extent so just nudge the size up a little. ASSERT(currentExtent->superPagesEnd); currentExtent->superPagesEnd += kSuperPageSize; ASSERT(ret >= currentExtent->superPageBase && ret < currentExtent->superPagesEnd); } return ret; } static ALWAYS_INLINE uint16_t partitionBucketPartitionPages(const PartitionBucket* bucket) { return (bucket->numSystemPagesPerSlotSpan + (kNumSystemPagesPerPartitionPage - 1)) / kNumSystemPagesPerPartitionPage; } static ALWAYS_INLINE void partitionPageReset(PartitionPage* page) { ASSERT(partitionPageStateIsDecommitted(page)); page->numUnprovisionedSlots = partitionBucketSlots(page->bucket); ASSERT(page->numUnprovisionedSlots); page->nextPage = nullptr; } static ALWAYS_INLINE void partitionPageSetup(PartitionPage* page, PartitionBucket* bucket) { // The bucket never changes. We set it up once. page->bucket = bucket; page->emptyCacheIndex = -1; partitionPageReset(page); // If this page has just a single slot, do not set up page offsets for any // page metadata other than the first one. This ensures that attempts to // touch invalid page metadata fail. if (page->numUnprovisionedSlots == 1) return; uint16_t numPartitionPages = partitionBucketPartitionPages(bucket); char* pageCharPtr = reinterpret_cast<char*>(page); for (uint16_t i = 1; i < numPartitionPages; ++i) { pageCharPtr += kPageMetadataSize; PartitionPage* secondaryPage = reinterpret_cast<PartitionPage*>(pageCharPtr); secondaryPage->pageOffset = i; } } static ALWAYS_INLINE char* partitionPageAllocAndFillFreelist(PartitionPage* page) { ASSERT(page != &PartitionRootGeneric::gSeedPage); uint16_t numSlots = page->numUnprovisionedSlots; ASSERT(numSlots); PartitionBucket* bucket = page->bucket; // We should only get here when _every_ slot is either used or unprovisioned. // (The third state is "on the freelist". If we have a non-empty freelist, we should not get here.) ASSERT(numSlots + page->numAllocatedSlots == partitionBucketSlots(bucket)); // Similarly, make explicitly sure that the freelist is empty. ASSERT(!page->freelistHead); ASSERT(page->numAllocatedSlots >= 0); size_t size = bucket->slotSize; char* base = reinterpret_cast<char*>(partitionPageToPointer(page)); char* returnObject = base + (size * page->numAllocatedSlots); char* firstFreelistPointer = returnObject + size; char* firstFreelistPointerExtent = firstFreelistPointer + sizeof(PartitionFreelistEntry*); // Our goal is to fault as few system pages as possible. We calculate the // page containing the "end" of the returned slot, and then allow freelist // pointers to be written up to the end of that page. char* subPageLimit = reinterpret_cast<char*>(WTF::roundUpToSystemPage(reinterpret_cast<size_t>(firstFreelistPointer))); char* slotsLimit = returnObject + (size * numSlots); char* freelistLimit = subPageLimit; if (UNLIKELY(slotsLimit < freelistLimit)) freelistLimit = slotsLimit; uint16_t numNewFreelistEntries = 0; if (LIKELY(firstFreelistPointerExtent <= freelistLimit)) { // Only consider used space in the slot span. If we consider wasted // space, we may get an off-by-one when a freelist pointer fits in the // wasted space, but a slot does not. // We know we can fit at least one freelist pointer. numNewFreelistEntries = 1; // Any further entries require space for the whole slot span. numNewFreelistEntries += static_cast<uint16_t>((freelistLimit - firstFreelistPointerExtent) / size); } // We always return an object slot -- that's the +1 below. // We do not neccessarily create any new freelist entries, because we cross sub page boundaries frequently for large bucket sizes. ASSERT(numNewFreelistEntries + 1 <= numSlots); numSlots -= (numNewFreelistEntries + 1); page->numUnprovisionedSlots = numSlots; page->numAllocatedSlots++; if (LIKELY(numNewFreelistEntries)) { char* freelistPointer = firstFreelistPointer; PartitionFreelistEntry* entry = reinterpret_cast<PartitionFreelistEntry*>(freelistPointer); page->freelistHead = entry; while (--numNewFreelistEntries) { freelistPointer += size; PartitionFreelistEntry* nextEntry = reinterpret_cast<PartitionFreelistEntry*>(freelistPointer); entry->next = partitionFreelistMask(nextEntry); entry = nextEntry; } entry->next = partitionFreelistMask(0); } else { page->freelistHead = 0; } return returnObject; } // This helper function scans a bucket's active page list for a suitable new // active page. // When it finds a suitable new active page (one that has free slots and is not // empty), it is set as the new active page. If there is no suitable new // active page, the current active page is set to the seed page. // As potential pages are scanned, they are tidied up according to their state. // Empty pages are swept on to the empty page list, decommitted pages on to the // decommitted page list and full pages are unlinked from any list. static bool partitionSetNewActivePage(PartitionBucket* bucket) { PartitionPage* page = bucket->activePagesHead; if (page == &PartitionRootBase::gSeedPage) return false; PartitionPage* nextPage; for (; page; page = nextPage) { nextPage = page->nextPage; ASSERT(page->bucket == bucket); ASSERT(page != bucket->emptyPagesHead); ASSERT(page != bucket->decommittedPagesHead); // Deal with empty and decommitted pages. if (LIKELY(partitionPageStateIsActive(page))) { // This page is usable because it has freelist entries, or has // unprovisioned slots we can create freelist entries from. bucket->activePagesHead = page; return true; } if (LIKELY(partitionPageStateIsEmpty(page))) { page->nextPage = bucket->emptyPagesHead; bucket->emptyPagesHead = page; } else if (LIKELY(partitionPageStateIsDecommitted(page))) { page->nextPage = bucket->decommittedPagesHead; bucket->decommittedPagesHead = page; } else { ASSERT(partitionPageStateIsFull(page)); // If we get here, we found a full page. Skip over it too, and also // tag it as full (via a negative value). We need it tagged so that // free'ing can tell, and move it back into the active page list. page->numAllocatedSlots = -page->numAllocatedSlots; ++bucket->numFullPages; // numFullPages is a uint16_t for efficient packing so guard against // overflow to be safe. if (UNLIKELY(!bucket->numFullPages)) partitionBucketFull(); // Not necessary but might help stop accidents. page->nextPage = 0; } } bucket->activePagesHead = &PartitionRootGeneric::gSeedPage; return false; } static ALWAYS_INLINE PartitionDirectMapExtent* partitionPageToDirectMapExtent(PartitionPage* page) { ASSERT(partitionBucketIsDirectMapped(page->bucket)); return reinterpret_cast<PartitionDirectMapExtent*>(reinterpret_cast<char*>(page) + 3 * kPageMetadataSize); } static ALWAYS_INLINE void partitionPageSetRawSize(PartitionPage* page, size_t size) { size_t* rawSizePtr = partitionPageGetRawSizePtr(page); if (UNLIKELY(rawSizePtr != nullptr)) *rawSizePtr = size; } static ALWAYS_INLINE PartitionPage* partitionDirectMap(PartitionRootBase* root, int flags, size_t rawSize) { size_t size = partitionDirectMapSize(rawSize); // Because we need to fake looking like a super page, we need to allocate // a bunch of system pages more than "size": // - The first few system pages are the partition page in which the super // page metadata is stored. We fault just one system page out of a partition // page sized clump. // - We add a trailing guard page on 32-bit (on 64-bit we rely on the // massive address space plus randomization instead). size_t mapSize = size + kPartitionPageSize; #if !CPU(64BIT) mapSize += kSystemPageSize; #endif // Round up to the allocation granularity. mapSize += kPageAllocationGranularityOffsetMask; mapSize &= kPageAllocationGranularityBaseMask; // TODO: these pages will be zero-filled. Consider internalizing an // allocZeroed() API so we can avoid a memset() entirely in this case. char* ptr = reinterpret_cast<char*>(allocPages(0, mapSize, kSuperPageSize, PageAccessible)); if (UNLIKELY(!ptr)) return nullptr; size_t committedPageSize = size + kSystemPageSize; root->totalSizeOfDirectMappedPages += committedPageSize; partitionIncreaseCommittedPages(root, committedPageSize); char* slot = ptr + kPartitionPageSize; setSystemPagesInaccessible(ptr + (kSystemPageSize * 2), kPartitionPageSize - (kSystemPageSize * 2)); #if !CPU(64BIT) setSystemPagesInaccessible(ptr, kSystemPageSize); setSystemPagesInaccessible(slot + size, kSystemPageSize); #endif PartitionSuperPageExtentEntry* extent = reinterpret_cast<PartitionSuperPageExtentEntry*>(partitionSuperPageToMetadataArea(ptr)); extent->root = root; // The new structures are all located inside a fresh system page so they // will all be zeroed out. These ASSERTs are for documentation. ASSERT(!extent->superPageBase); ASSERT(!extent->superPagesEnd); ASSERT(!extent->next); PartitionPage* page = partitionPointerToPageNoAlignmentCheck(slot); PartitionBucket* bucket = reinterpret_cast<PartitionBucket*>(reinterpret_cast<char*>(page) + (kPageMetadataSize * 2)); ASSERT(!page->nextPage); ASSERT(!page->numAllocatedSlots); ASSERT(!page->numUnprovisionedSlots); ASSERT(!page->pageOffset); ASSERT(!page->emptyCacheIndex); page->bucket = bucket; page->freelistHead = reinterpret_cast<PartitionFreelistEntry*>(slot); PartitionFreelistEntry* nextEntry = reinterpret_cast<PartitionFreelistEntry*>(slot); nextEntry->next = partitionFreelistMask(0); ASSERT(!bucket->activePagesHead); ASSERT(!bucket->emptyPagesHead); ASSERT(!bucket->decommittedPagesHead); ASSERT(!bucket->numSystemPagesPerSlotSpan); ASSERT(!bucket->numFullPages); bucket->slotSize = size; PartitionDirectMapExtent* mapExtent = partitionPageToDirectMapExtent(page); mapExtent->mapSize = mapSize - kPartitionPageSize - kSystemPageSize; mapExtent->bucket = bucket; // Maintain the doubly-linked list of all direct mappings. mapExtent->nextExtent = root->directMapList; if (mapExtent->nextExtent) mapExtent->nextExtent->prevExtent = mapExtent; mapExtent->prevExtent = nullptr; root->directMapList = mapExtent; return page; } static ALWAYS_INLINE void partitionDirectUnmap(PartitionPage* page) { PartitionRootBase* root = partitionPageToRoot(page); const PartitionDirectMapExtent* extent = partitionPageToDirectMapExtent(page); size_t unmapSize = extent->mapSize; // Maintain the doubly-linked list of all direct mappings. if (extent->prevExtent) { ASSERT(extent->prevExtent->nextExtent == extent); extent->prevExtent->nextExtent = extent->nextExtent; } else { root->directMapList = extent->nextExtent; } if (extent->nextExtent) { ASSERT(extent->nextExtent->prevExtent == extent); extent->nextExtent->prevExtent = extent->prevExtent; } // Add on the size of the trailing guard page and preceeding partition // page. unmapSize += kPartitionPageSize + kSystemPageSize; size_t uncommittedPageSize = page->bucket->slotSize + kSystemPageSize; partitionDecreaseCommittedPages(root, uncommittedPageSize); ASSERT(root->totalSizeOfDirectMappedPages >= uncommittedPageSize); root->totalSizeOfDirectMappedPages -= uncommittedPageSize; ASSERT(!(unmapSize & kPageAllocationGranularityOffsetMask)); char* ptr = reinterpret_cast<char*>(partitionPageToPointer(page)); // Account for the mapping starting a partition page before the actual // allocation address. ptr -= kPartitionPageSize; freePages(ptr, unmapSize); } void* partitionAllocSlowPath(PartitionRootBase* root, int flags, size_t size, PartitionBucket* bucket) { // The slow path is called when the freelist is empty. ASSERT(!bucket->activePagesHead->freelistHead); PartitionPage* newPage = nullptr; // For the partitionAllocGeneric API, we have a bunch of buckets marked // as special cases. We bounce them through to the slow path so that we // can still have a blazing fast hot path due to lack of corner-case // branches. bool returnNull = flags & PartitionAllocReturnNull; if (UNLIKELY(partitionBucketIsDirectMapped(bucket))) { ASSERT(size > kGenericMaxBucketed); ASSERT(bucket == &PartitionRootBase::gPagedBucket); ASSERT(bucket->activePagesHead == &PartitionRootGeneric::gSeedPage); if (size > kGenericMaxDirectMapped) { if (returnNull) return nullptr; partitionExcessiveAllocationSize(); } newPage = partitionDirectMap(root, flags, size); } else if (LIKELY(partitionSetNewActivePage(bucket))) { // First, did we find an active page in the active pages list? newPage = bucket->activePagesHead; ASSERT(partitionPageStateIsActive(newPage)); } else if (LIKELY(bucket->emptyPagesHead != nullptr) || LIKELY(bucket->decommittedPagesHead != nullptr)) { // Second, look in our lists of empty and decommitted pages. // Check empty pages first, which are preferred, but beware that an // empty page might have been decommitted. while (LIKELY((newPage = bucket->emptyPagesHead) != nullptr)) { ASSERT(newPage->bucket == bucket); ASSERT(partitionPageStateIsEmpty(newPage) || partitionPageStateIsDecommitted(newPage)); bucket->emptyPagesHead = newPage->nextPage; // Accept the empty page unless it got decommitted. if (newPage->freelistHead) { newPage->nextPage = nullptr; break; } ASSERT(partitionPageStateIsDecommitted(newPage)); newPage->nextPage = bucket->decommittedPagesHead; bucket->decommittedPagesHead = newPage; } if (UNLIKELY(!newPage) && LIKELY(bucket->decommittedPagesHead != nullptr)) { newPage = bucket->decommittedPagesHead; ASSERT(newPage->bucket == bucket); ASSERT(partitionPageStateIsDecommitted(newPage)); bucket->decommittedPagesHead = newPage->nextPage; void* addr = partitionPageToPointer(newPage); partitionRecommitSystemPages(root, addr, partitionBucketBytes(newPage->bucket)); partitionPageReset(newPage); } ASSERT(newPage); } else { // Third. If we get here, we need a brand new page. uint16_t numPartitionPages = partitionBucketPartitionPages(bucket); void* rawPages = partitionAllocPartitionPages(root, flags, numPartitionPages); if (LIKELY(rawPages != nullptr)) { newPage = partitionPointerToPageNoAlignmentCheck(rawPages); partitionPageSetup(newPage, bucket); } } // Bail if we had a memory allocation failure. if (UNLIKELY(!newPage)) { ASSERT(bucket->activePagesHead == &PartitionRootGeneric::gSeedPage); if (returnNull) return nullptr; partitionOutOfMemory(root); } bucket = newPage->bucket; ASSERT(bucket != &PartitionRootBase::gPagedBucket); bucket->activePagesHead = newPage; partitionPageSetRawSize(newPage, size); // If we found an active page with free slots, or an empty page, we have a // usable freelist head. if (LIKELY(newPage->freelistHead != nullptr)) { PartitionFreelistEntry* entry = newPage->freelistHead; PartitionFreelistEntry* newHead = partitionFreelistMask(entry->next); newPage->freelistHead = newHead; newPage->numAllocatedSlots++; return entry; } // Otherwise, we need to build the freelist. ASSERT(newPage->numUnprovisionedSlots); return partitionPageAllocAndFillFreelist(newPage); } static ALWAYS_INLINE void partitionDecommitPage(PartitionRootBase* root, PartitionPage* page) { ASSERT(partitionPageStateIsEmpty(page)); ASSERT(!partitionBucketIsDirectMapped(page->bucket)); void* addr = partitionPageToPointer(page); partitionDecommitSystemPages(root, addr, partitionBucketBytes(page->bucket)); // We actually leave the decommitted page in the active list. We'll sweep // it on to the decommitted page list when we next walk the active page // list. // Pulling this trick enables us to use a singly-linked page list for all // cases, which is critical in keeping the page metadata structure down to // 32 bytes in size. page->freelistHead = 0; page->numUnprovisionedSlots = 0; ASSERT(partitionPageStateIsDecommitted(page)); } static void partitionDecommitPageIfPossible(PartitionRootBase* root, PartitionPage* page) { ASSERT(page->emptyCacheIndex >= 0); ASSERT(static_cast<unsigned>(page->emptyCacheIndex) < kMaxFreeableSpans); ASSERT(page == root->globalEmptyPageRing[page->emptyCacheIndex]); page->emptyCacheIndex = -1; if (partitionPageStateIsEmpty(page)) partitionDecommitPage(root, page); } static ALWAYS_INLINE void partitionRegisterEmptyPage(PartitionPage* page) { ASSERT(partitionPageStateIsEmpty(page)); PartitionRootBase* root = partitionPageToRoot(page); // If the page is already registered as empty, give it another life. if (page->emptyCacheIndex != -1) { ASSERT(page->emptyCacheIndex >= 0); ASSERT(static_cast<unsigned>(page->emptyCacheIndex) < kMaxFreeableSpans); ASSERT(root->globalEmptyPageRing[page->emptyCacheIndex] == page); root->globalEmptyPageRing[page->emptyCacheIndex] = 0; } int16_t currentIndex = root->globalEmptyPageRingIndex; PartitionPage* pageToDecommit = root->globalEmptyPageRing[currentIndex]; // The page might well have been re-activated, filled up, etc. before we get // around to looking at it here. if (pageToDecommit) partitionDecommitPageIfPossible(root, pageToDecommit); // We put the empty slot span on our global list of "pages that were once // empty". thus providing it a bit of breathing room to get re-used before // we really free it. This improves performance, particularly on Mac OS X // which has subpar memory management performance. root->globalEmptyPageRing[currentIndex] = page; page->emptyCacheIndex = currentIndex; ++currentIndex; if (currentIndex == kMaxFreeableSpans) currentIndex = 0; root->globalEmptyPageRingIndex = currentIndex; } static void partitionDecommitEmptyPages(PartitionRootBase* root) { for (size_t i = 0; i < kMaxFreeableSpans; ++i) { PartitionPage* page = root->globalEmptyPageRing[i]; if (page) partitionDecommitPageIfPossible(root, page); root->globalEmptyPageRing[i] = nullptr; } } void partitionFreeSlowPath(PartitionPage* page) { PartitionBucket* bucket = page->bucket; ASSERT(page != &PartitionRootGeneric::gSeedPage); if (LIKELY(page->numAllocatedSlots == 0)) { // Page became fully unused. if (UNLIKELY(partitionBucketIsDirectMapped(bucket))) { partitionDirectUnmap(page); return; } // If it's the current active page, change it. We bounce the page to // the empty list as a force towards defragmentation. if (LIKELY(page == bucket->activePagesHead)) (void) partitionSetNewActivePage(bucket); ASSERT(bucket->activePagesHead != page); partitionPageSetRawSize(page, 0); ASSERT(!partitionPageGetRawSize(page)); partitionRegisterEmptyPage(page); } else { ASSERT(!partitionBucketIsDirectMapped(bucket)); // Ensure that the page is full. That's the only valid case if we // arrive here. ASSERT(page->numAllocatedSlots < 0); // A transition of numAllocatedSlots from 0 to -1 is not legal, and // likely indicates a double-free. SECURITY_CHECK(page->numAllocatedSlots != -1); page->numAllocatedSlots = -page->numAllocatedSlots - 2; ASSERT(page->numAllocatedSlots == partitionBucketSlots(bucket) - 1); // Fully used page became partially used. It must be put back on the // non-full page list. Also make it the current page to increase the // chances of it being filled up again. The old current page will be // the next page. ASSERT(!page->nextPage); if (LIKELY(bucket->activePagesHead != &PartitionRootGeneric::gSeedPage)) page->nextPage = bucket->activePagesHead; bucket->activePagesHead = page; --bucket->numFullPages; // Special case: for a partition page with just a single slot, it may // now be empty and we want to run it through the empty logic. if (UNLIKELY(page->numAllocatedSlots == 0)) partitionFreeSlowPath(page); } } bool partitionReallocDirectMappedInPlace(PartitionRootGeneric* root, PartitionPage* page, size_t rawSize) { ASSERT(partitionBucketIsDirectMapped(page->bucket)); rawSize = partitionCookieSizeAdjustAdd(rawSize); // Note that the new size might be a bucketed size; this function is called // whenever we're reallocating a direct mapped allocation. size_t newSize = partitionDirectMapSize(rawSize); if (newSize < kGenericMinDirectMappedDownsize) return false; // bucket->slotSize is the current size of the allocation. size_t currentSize = page->bucket->slotSize; if (newSize == currentSize) return true; char* charPtr = static_cast<char*>(partitionPageToPointer(page)); if (newSize < currentSize) { size_t mapSize = partitionPageToDirectMapExtent(page)->mapSize; // Don't reallocate in-place if new size is less than 80 % of the full // map size, to avoid holding on to too much unused address space. if ((newSize / kSystemPageSize) * 5 < (mapSize / kSystemPageSize) * 4) return false; // Shrink by decommitting unneeded pages and making them inaccessible. size_t decommitSize = currentSize - newSize; partitionDecommitSystemPages(root, charPtr + newSize, decommitSize); setSystemPagesInaccessible(charPtr + newSize, decommitSize); } else if (newSize <= partitionPageToDirectMapExtent(page)->mapSize) { // Grow within the actually allocated memory. Just need to make the // pages accessible again. size_t recommitSize = newSize - currentSize; bool ret = setSystemPagesAccessible(charPtr + currentSize, recommitSize); RELEASE_ASSERT(ret); partitionRecommitSystemPages(root, charPtr + currentSize, recommitSize); #if ENABLE(ASSERT) memset(charPtr + currentSize, kUninitializedByte, recommitSize); #endif } else { // We can't perform the realloc in-place. // TODO: support this too when possible. return false; } #if ENABLE(ASSERT) // Write a new trailing cookie. partitionCookieWriteValue(charPtr + rawSize - kCookieSize); #endif partitionPageSetRawSize(page, rawSize); ASSERT(partitionPageGetRawSize(page) == rawSize); page->bucket->slotSize = newSize; return true; } void* partitionReallocGeneric(PartitionRootGeneric* root, void* ptr, size_t newSize, const char* typeName) { #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) return realloc(ptr, newSize); #else if (UNLIKELY(!ptr)) return partitionAllocGeneric(root, newSize, typeName); if (UNLIKELY(!newSize)) { partitionFreeGeneric(root, ptr); return 0; } if (newSize > kGenericMaxDirectMapped) partitionExcessiveAllocationSize(); ASSERT(partitionPointerIsValid(partitionCookieFreePointerAdjust(ptr))); PartitionPage* page = partitionPointerToPage(partitionCookieFreePointerAdjust(ptr)); if (UNLIKELY(partitionBucketIsDirectMapped(page->bucket))) { // We may be able to perform the realloc in place by changing the // accessibility of memory pages and, if reducing the size, decommitting // them. if (partitionReallocDirectMappedInPlace(root, page, newSize)) { PartitionAllocHooks::reallocHookIfEnabled(ptr, ptr, newSize, typeName); return ptr; } } size_t actualNewSize = partitionAllocActualSize(root, newSize); size_t actualOldSize = partitionAllocGetSize(ptr); // TODO: note that tcmalloc will "ignore" a downsizing realloc() unless the // new size is a significant percentage smaller. We could do the same if we // determine it is a win. if (actualNewSize == actualOldSize) { // Trying to allocate a block of size newSize would give us a block of // the same size as the one we've already got, so no point in doing // anything here. return ptr; } // This realloc cannot be resized in-place. Sadness. void* ret = partitionAllocGeneric(root, newSize, typeName); size_t copySize = actualOldSize; if (newSize < copySize) copySize = newSize; memcpy(ret, ptr, copySize); partitionFreeGeneric(root, ptr); return ret; #endif } static size_t partitionPurgePage(PartitionPage* page, bool discard) { const PartitionBucket* bucket = page->bucket; size_t slotSize = bucket->slotSize; if (slotSize < kSystemPageSize || !page->numAllocatedSlots) return 0; size_t bucketNumSlots = partitionBucketSlots(bucket); size_t discardableBytes = 0; size_t rawSize = partitionPageGetRawSize(const_cast<PartitionPage*>(page)); if (rawSize) { uint32_t usedBytes = static_cast<uint32_t>(WTF::roundUpToSystemPage(rawSize)); discardableBytes = bucket->slotSize - usedBytes; if (discardableBytes && discard) { char* ptr = reinterpret_cast<char*>(partitionPageToPointer(page)); ptr += usedBytes; discardSystemPages(ptr, discardableBytes); } return discardableBytes; } const size_t maxSlotCount = (kPartitionPageSize * kMaxPartitionPagesPerSlotSpan) / kSystemPageSize; ASSERT(bucketNumSlots <= maxSlotCount); ASSERT(page->numUnprovisionedSlots < bucketNumSlots); size_t numSlots = bucketNumSlots - page->numUnprovisionedSlots; char slotUsage[maxSlotCount]; size_t lastSlot = static_cast<size_t>(-1); memset(slotUsage, 1, numSlots); char* ptr = reinterpret_cast<char*>(partitionPageToPointer(page)); PartitionFreelistEntry* entry = page->freelistHead; // First, walk the freelist for this page and make a bitmap of which slots // are not in use. while (entry) { size_t slotIndex = (reinterpret_cast<char*>(entry) - ptr) / slotSize; ASSERT(slotIndex < numSlots); slotUsage[slotIndex] = 0; entry = partitionFreelistMask(entry->next); // If we have a slot where the masked freelist entry is 0, we can // actually discard that freelist entry because touching a discarded // page is guaranteed to return original content or 0. // (Note that this optimization won't fire on big endian machines // because the masking function is negation.) if (!partitionFreelistMask(entry)) lastSlot = slotIndex; } // If the slot(s) at the end of the slot span are not in used, we can // truncate them entirely and rewrite the freelist. size_t truncatedSlots = 0; while (!slotUsage[numSlots - 1]) { truncatedSlots++; numSlots--; ASSERT(numSlots); } // First, do the work of calculating the discardable bytes. Don't actually // discard anything unless the discard flag was passed in. char* beginPtr = nullptr; char* endPtr = nullptr; size_t unprovisionedBytes = 0; if (truncatedSlots) { beginPtr = ptr + (numSlots * slotSize); endPtr = beginPtr + (slotSize * truncatedSlots); beginPtr = reinterpret_cast<char*>(WTF::roundUpToSystemPage(reinterpret_cast<size_t>(beginPtr))); // We round the end pointer here up and not down because we're at the // end of a slot span, so we "own" all the way up the page boundary. endPtr = reinterpret_cast<char*>(WTF::roundUpToSystemPage(reinterpret_cast<size_t>(endPtr))); ASSERT(endPtr <= ptr + partitionBucketBytes(bucket)); if (beginPtr < endPtr) { unprovisionedBytes = endPtr - beginPtr; discardableBytes += unprovisionedBytes; } } if (unprovisionedBytes && discard) { ASSERT(truncatedSlots > 0); size_t numNewEntries = 0; page->numUnprovisionedSlots += static_cast<uint16_t>(truncatedSlots); // Rewrite the freelist. PartitionFreelistEntry** entryPtr = &page->freelistHead; for (size_t slotIndex = 0; slotIndex < numSlots; ++slotIndex) { if (slotUsage[slotIndex]) continue; PartitionFreelistEntry* entry = reinterpret_cast<PartitionFreelistEntry*>(ptr + (slotSize * slotIndex)); *entryPtr = partitionFreelistMask(entry); entryPtr = reinterpret_cast<PartitionFreelistEntry**>(entry); numNewEntries++; } // Terminate the freelist chain. *entryPtr = nullptr; // The freelist head is stored unmasked. page->freelistHead = partitionFreelistMask(page->freelistHead); ASSERT(numNewEntries == numSlots - page->numAllocatedSlots); // Discard the memory. discardSystemPages(beginPtr, unprovisionedBytes); } // Next, walk the slots and for any not in use, consider where the system // page boundaries occur. We can release any system pages back to the // system as long as we don't interfere with a freelist pointer or an // adjacent slot. for (size_t i = 0; i < numSlots; ++i) { if (slotUsage[i]) continue; // The first address we can safely discard is just after the freelist // pointer. There's one quirk: if the freelist pointer is actually a // null, we can discard that pointer value too. char* beginPtr = ptr + (i * slotSize); char* endPtr = beginPtr + slotSize; if (i != lastSlot) beginPtr += sizeof(PartitionFreelistEntry); beginPtr = reinterpret_cast<char*>(WTF::roundUpToSystemPage(reinterpret_cast<size_t>(beginPtr))); endPtr = reinterpret_cast<char*>(WTF::roundDownToSystemPage(reinterpret_cast<size_t>(endPtr))); if (beginPtr < endPtr) { size_t partialSlotBytes = endPtr - beginPtr; discardableBytes += partialSlotBytes; if (discard) discardSystemPages(beginPtr, partialSlotBytes); } } return discardableBytes; } static void partitionPurgeBucket(PartitionBucket* bucket) { if (bucket->activePagesHead != &PartitionRootGeneric::gSeedPage) { for (PartitionPage* page = bucket->activePagesHead; page; page = page->nextPage) { ASSERT(page != &PartitionRootGeneric::gSeedPage); (void) partitionPurgePage(page, true); } } } void partitionPurgeMemory(PartitionRoot* root, int flags) { if (flags & PartitionPurgeDecommitEmptyPages) partitionDecommitEmptyPages(root); // We don't currently do anything for PartitionPurgeDiscardUnusedSystemPages // here because that flag is only useful for allocations >= system page // size. We only have allocations that large inside generic partitions // at the moment. } void partitionPurgeMemoryGeneric(PartitionRootGeneric* root, int flags) { SpinLock::Guard guard(root->lock); if (flags & PartitionPurgeDecommitEmptyPages) partitionDecommitEmptyPages(root); if (flags & PartitionPurgeDiscardUnusedSystemPages) { for (size_t i = 0; i < kGenericNumBuckets; ++i) { PartitionBucket* bucket = &root->buckets[i]; if (bucket->slotSize >= kSystemPageSize) partitionPurgeBucket(bucket); } } } static void partitionDumpPageStats(PartitionBucketMemoryStats* statsOut, const PartitionPage* page) { uint16_t bucketNumSlots = partitionBucketSlots(page->bucket); if (partitionPageStateIsDecommitted(page)) { ++statsOut->numDecommittedPages; return; } statsOut->discardableBytes += partitionPurgePage(const_cast<PartitionPage*>(page), false); size_t rawSize = partitionPageGetRawSize(const_cast<PartitionPage*>(page)); if (rawSize) statsOut->activeBytes += static_cast<uint32_t>(rawSize); else statsOut->activeBytes += (page->numAllocatedSlots * statsOut->bucketSlotSize); size_t pageBytesResident = WTF::roundUpToSystemPage((bucketNumSlots - page->numUnprovisionedSlots) * statsOut->bucketSlotSize); statsOut->residentBytes += pageBytesResident; if (partitionPageStateIsEmpty(page)) { statsOut->decommittableBytes += pageBytesResident; ++statsOut->numEmptyPages; } else if (partitionPageStateIsFull(page)) { ++statsOut->numFullPages; } else { ASSERT(partitionPageStateIsActive(page)); ++statsOut->numActivePages; } } static void partitionDumpBucketStats(PartitionBucketMemoryStats* statsOut, const PartitionBucket* bucket) { ASSERT(!partitionBucketIsDirectMapped(bucket)); statsOut->isValid = false; // If the active page list is empty (== &PartitionRootGeneric::gSeedPage), // the bucket might still need to be reported if it has a list of empty, // decommitted or full pages. if (bucket->activePagesHead == &PartitionRootGeneric::gSeedPage && !bucket->emptyPagesHead && !bucket->decommittedPagesHead && !bucket->numFullPages) return; memset(statsOut, '\0', sizeof(*statsOut)); statsOut->isValid = true; statsOut->isDirectMap = false; statsOut->numFullPages = static_cast<size_t>(bucket->numFullPages); statsOut->bucketSlotSize = bucket->slotSize; uint16_t bucketNumSlots = partitionBucketSlots(bucket); size_t bucketUsefulStorage = statsOut->bucketSlotSize * bucketNumSlots; statsOut->allocatedPageSize = partitionBucketBytes(bucket); statsOut->activeBytes = bucket->numFullPages * bucketUsefulStorage; statsOut->residentBytes = bucket->numFullPages * statsOut->allocatedPageSize; for (const PartitionPage* page = bucket->emptyPagesHead; page; page = page->nextPage) { ASSERT(partitionPageStateIsEmpty(page) || partitionPageStateIsDecommitted(page)); partitionDumpPageStats(statsOut, page); } for (const PartitionPage* page = bucket->decommittedPagesHead; page; page = page->nextPage) { ASSERT(partitionPageStateIsDecommitted(page)); partitionDumpPageStats(statsOut, page); } if (bucket->activePagesHead != &PartitionRootGeneric::gSeedPage) { for (const PartitionPage* page = bucket->activePagesHead; page; page = page->nextPage) { ASSERT(page != &PartitionRootGeneric::gSeedPage); partitionDumpPageStats(statsOut, page); } } } void partitionDumpStatsGeneric(PartitionRootGeneric* partition, const char* partitionName, bool isLightDump, PartitionStatsDumper* partitionStatsDumper) { PartitionBucketMemoryStats bucketStats[kGenericNumBuckets]; static const size_t kMaxReportableDirectMaps = 4096; uint32_t directMapLengths[kMaxReportableDirectMaps]; size_t numDirectMappedAllocations = 0; { SpinLock::Guard guard(partition->lock); for (size_t i = 0; i < kGenericNumBuckets; ++i) { const PartitionBucket* bucket = &partition->buckets[i]; // Don't report the pseudo buckets that the generic allocator sets up in // order to preserve a fast size->bucket map (see // partitionAllocGenericInit for details). if (!bucket->activePagesHead) bucketStats[i].isValid = false; else partitionDumpBucketStats(&bucketStats[i], bucket); } for (PartitionDirectMapExtent* extent = partition->directMapList; extent; extent = extent->nextExtent) { ASSERT(!extent->nextExtent || extent->nextExtent->prevExtent == extent); directMapLengths[numDirectMappedAllocations] = extent->bucket->slotSize; ++numDirectMappedAllocations; if (numDirectMappedAllocations == kMaxReportableDirectMaps) break; } } // partitionsDumpBucketStats is called after collecting stats because it // can try to allocate using PartitionAllocGeneric and it can't obtain the // lock. PartitionMemoryStats partitionStats = { 0 }; partitionStats.totalMmappedBytes = partition->totalSizeOfSuperPages + partition->totalSizeOfDirectMappedPages; partitionStats.totalCommittedBytes = partition->totalSizeOfCommittedPages; for (size_t i = 0; i < kGenericNumBuckets; ++i) { if (bucketStats[i].isValid) { partitionStats.totalResidentBytes += bucketStats[i].residentBytes; partitionStats.totalActiveBytes += bucketStats[i].activeBytes; partitionStats.totalDecommittableBytes += bucketStats[i].decommittableBytes; partitionStats.totalDiscardableBytes += bucketStats[i].discardableBytes; if (!isLightDump) partitionStatsDumper->partitionsDumpBucketStats(partitionName, &bucketStats[i]); } } size_t directMappedAllocationsTotalSize = 0; for (size_t i = 0; i < numDirectMappedAllocations; ++i) { uint32_t size = directMapLengths[i]; directMappedAllocationsTotalSize += size; if (isLightDump) continue; PartitionBucketMemoryStats stats; memset(&stats, '\0', sizeof(stats)); stats.isValid = true; stats.isDirectMap = true; stats.numFullPages = 1; stats.allocatedPageSize = size; stats.bucketSlotSize = size; stats.activeBytes = size; stats.residentBytes = size; partitionStatsDumper->partitionsDumpBucketStats(partitionName, &stats); } partitionStats.totalResidentBytes += directMappedAllocationsTotalSize; partitionStats.totalActiveBytes += directMappedAllocationsTotalSize; partitionStatsDumper->partitionDumpTotals(partitionName, &partitionStats); } void partitionDumpStats(PartitionRoot* partition, const char* partitionName, bool isLightDump, PartitionStatsDumper* partitionStatsDumper) { static const size_t kMaxReportableBuckets = 4096 / sizeof(void*); PartitionBucketMemoryStats memoryStats[kMaxReportableBuckets]; const size_t partitionNumBuckets = partition->numBuckets; ASSERT(partitionNumBuckets <= kMaxReportableBuckets); for (size_t i = 0; i < partitionNumBuckets; ++i) partitionDumpBucketStats(&memoryStats[i], &partition->buckets()[i]); // partitionsDumpBucketStats is called after collecting stats because it // can use PartitionAlloc to allocate and this can affect the statistics. PartitionMemoryStats partitionStats = { 0 }; partitionStats.totalMmappedBytes = partition->totalSizeOfSuperPages; partitionStats.totalCommittedBytes = partition->totalSizeOfCommittedPages; ASSERT(!partition->totalSizeOfDirectMappedPages); for (size_t i = 0; i < partitionNumBuckets; ++i) { if (memoryStats[i].isValid) { partitionStats.totalResidentBytes += memoryStats[i].residentBytes; partitionStats.totalActiveBytes += memoryStats[i].activeBytes; partitionStats.totalDecommittableBytes += memoryStats[i].decommittableBytes; partitionStats.totalDiscardableBytes += memoryStats[i].discardableBytes; if (!isLightDump) partitionStatsDumper->partitionsDumpBucketStats(partitionName, &memoryStats[i]); } } partitionStatsDumper->partitionDumpTotals(partitionName, &partitionStats); } } // namespace WTF
/* * Copyright 2020 Tier IV, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <cstdlib> #include "microstrain_mips/SetAccelNoise.h" #include "ros/ros.h" int main(int argc, char** argv) { ros::init(argc, argv, "set_accel_noise_client"); ros::NodeHandle n; ros::ServiceClient client = n.serviceClient<microstrain_mips::SetAccelNoise>("SetAccelNoise"); microstrain_mips::SetAccelNoise srv; srv.request.noise.x = atoll(argv[1]); srv.request.noise.y = atoll(argv[2]); srv.request.noise.z = atoll(argv[3]); if (client.call(srv)) { if (srv.response.success) { ROS_INFO("success"); } } else { ROS_INFO("Failed to call service"); } return 0; }
;*** ;* $Workfile: saveport.asm $ ;* $Revision: 1.0 $ ;* $Author: Dave Sewell $ ;* $Date: 05 May 1989 16:34:22 $ ;*** INCLUDE model.inc INCLUDE fastlynx.inc .DATA .CODE text EXTRN SaveSerial:NEAR EXTRN SaveParallel:NEAR EXTRN RestoreSerial:NEAR EXTRN RestoreParallel:NEAR EXTRN GetPortInfo:NEAR PUBLIC FxRestorePorts FxSaveAllPorts PROC NEAR xor bx, bx save_loop: cmp bx, fx_tail jae save_done call FxSavePort inc bx inc bx jmp save_loop save_done: ret FxSaveAllPorts ENDP FxSavePort PROC NEAR USES BX DI SI ES mov al, 3 mul bl mov di, ax push ds pop es ; ES:DI = ptr to save area add di, OFFSET DGROUP:fx_port_save_area call GetPortInfo cmp al, SERIAL_PORT je save_serial call SaveParallel jmp short save_ret save_serial: call SaveSerial save_ret: ret FxSavePort ENDP FxRestorePort PROC NEAR USES BX SI ;* Enter with: ;* BX = Port to be restored mov al, 3 mul bl mov si, ax add si, OFFSET DGROUP:fx_port_save_area call GetPortInfo cmp al, SERIAL_PORT je restore_serial call RestoreParallel jmp short restore_ret restore_serial: call RestoreSerial restore_ret: ret FxRestorePort ENDP FxRestorePorts PROC NEAR USES SI xor bx, bx restore_loop: cmp bx, fx_tail jae done cmp bx, fx_index je restore_next call FxRestorePort restore_next: inc bx inc bx jmp restore_loop done: ret FxRestorePorts ENDP FxRestoreAllPorts PROC NEAR xor bx, bx restore_loop: cmp bx, fx_tail jae restore_done call FxRestorePort inc bx inc bx jmp restore_loop restore_done: ret FxRestoreAllPorts ENDP END
; A046631: Number of cubic residues mod 3^n. ; 1,3,3,7,21,57,169,507,1515,4543,13629,40881,122641,367923,1103763,3311287,9933861,29801577,89404729,268214187,804642555,2413927663,7241782989,21725348961,65176046881,195528140643,586584421923 lpb $0 mov $2,$0 trn $0,3 trn $2,2 seq $2,199114 ; 11*3^n+1. add $1,$2 lpe div $1,11 mul $1,2 add $1,1 mov $0,$1
/** * File : src/freenect_grabber.cc * Author : Siddharth J. Singh <j.singh.logan@gmail.com> * Date : 10.08.2017 * Last Modified Date: 14.08.2017 * Last Modified By : Siddharth J. Singh <j.singh.logan@gmail.com> */ /** * freenect_grabber.cc * Copyright (c) 2017 Siddharth J. Singh <j.singh.logan@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "freenect_grabber.h" FreenectGrabber::FreenectGrabber() : DataGrabber("FreenectGrabber"){ //TODO: Initialize this from a file possibly __logger()->set_level(spdlog::level::trace); freenect_context *ctx; int retval; retval = freenect_init(&ctx, NULL); if(retval == 0) { __logger()->trace("Initialized freenect API."); } else { __logger()->error("Couldn't initiate freenect API!!!"); exit(retval); } freenect_set_log_level(ctx, FREENECT_LOG_DEBUG); freenect_select_subdevices(ctx, FREENECT_DEVICE_CAMERA); retval = freenect_num_devices(ctx); if(retval) { __logger()->trace("{0} Kinect device(s) is(are) connected to the system.", retval); } else { __logger()->error("No Kinect devices are connected!!!"); __logger()->error("Please check the device power and connectivity."); freenect_shutdown(ctx); exit(retval); } //TODO: Make this function generic for many cameras freenect_device *dev; retval = freenect_open_device(ctx, &dev, -1); if(retval == 0) { __logger()->trace("Camera opened for RGB transfer.", retval); } else { __logger()->error("Device couldn't be opened!!!"); freenect_shutdown(ctx); exit(retval); } retval = freenect_set_video_mode(dev, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)); if(retval == 0) { __logger()->trace("Video mode was set correctly."); } else { __logger()->error("Could not set the video mode!!!"); freenect_close_device(dev); freenect_shutdown(ctx); } //retval = freenect_set_video_buffer(dev, freenect_close_device(dev); freenect_shutdown(ctx); } void FreenectGrabber::grab_image(cv::Mat& image) { /* __logger()->info("INFO"); __logger()->trace("TRACE"); __logger()->error("ERROR"); __logger()->debug("DEBUG"); __logger()->warn("WARNING"); __logger()->critical("CRITICAL"); __logger()->error("ERROR");*/ image.clone(); }
; ******************************************************************************************* ; ******************************************************************************************* ; ; Name : stringconcrete.asm ; Purpose : Concrete strings into permanent storage. ; Date : 19th June 2019 ; Author : paul@robsons.org.uk ; ; ******************************************************************************************* ; ******************************************************************************************* ; ******************************************************************************************* ; ; Strings are stored backwards in memory from the high memory pointer. The maximum ; length of any string is stored in the immediately preceding byte. ; ; ******************************************************************************************* ; ; Reset the string permanent memory ; ; ******************************************************************************************* StringResetPermanent: lda DHighAddress ; the end of memory tay ldy #Block_HighMemoryPtr ; save the high memory pointer, which is the first link. sta (DBaseAddress),y rts ; ******************************************************************************************* ; ; On entry A contains the new string, and Y contains the address that contains the ; old string. Update that address with the new string, concreting in memory if ; required. ; ; For clarification ; the Y value is the address of the string storage area associated ; with an array element or variable. This may contain $0000 when initialised, or a ; current string storage address. ; ; We reuse this storage address if we can, extend it if we can, and finally we reallocate ; it. ; ; ******************************************************************************************* StringAssign: phx ; save X tax ; new string address to X. ; ; ; Check to see if this string has memory allocated already. ; lda $0000,y ; does the string pointer we replace have an address yet. beq _SAAllocate ; if not , allocate space for it and copy the string. ; ; If the current address < the high memory pointer - e.g. it is not stored ; in the string area, then just allocate. ; phy lda $0000,y ; compare calculate saved address - high memory pointer ldy #Block_HighMemoryPtr cmp (DBaseAddress),y ply bcc _SAAllocate ; if < high memory pointer, first allocation. ; ; Compare max length of old string (A) vs length of new string. If it fits ; copy it in. ; phy lda $0000,y ; address of the string tay dey ; point to the max length of the old string. lda $0000,y ; length of string ply and #$00FF ; max length of old string sep #$20 cmp @w$0000,x ; compare against length of new string rep #$20 bcs _SACopyString ; just copy it in if old max length >= new ; ; Is this the bottom-most string. ; lda $0000,y ; get the address of the string. dec a ; if bottom, compare the previous byte address phy ; which is the max length. ldy #Block_HighMemoryPtr eor (DBaseAddress),y ply ora #$0000 ; if not, then allocate memory. bne _SAAllocate ; ; Restore the memory back. It will then be re-allocated. ; phy lda $0000,y ; address of old string tay ; to Y dey ; get maximum length. lda $0000,y and #$00FF inc a ; add 2 (string,max) inc a ldy #Block_HighMemoryPtr ; return memory back clc adc (DBaseAddress),y sta (DBaseAddress),y ply ; ; Allocate memory for the string. ; _SAAllocate: lda @w$0000,x ; get the length of the string and #$00FF clc adc #8 ; allocate extra space if needed. cmp #255 ; can't be larger than this. bcc _SASizeOkay lda #255 _SASizeOkay: ; ; Allocate A bytes of memory, at least for the new string ; phy ; push [string] on the stack. pha ; push largest string size on the stack. inc a ; one more for the string size byte inc a ; one more for the maximum size byte ; eor #$FFFF ; subtract from the high memory pointer sec ldy #Block_HighMemoryPtr adc (DBaseAddress),y sta (DBaseAddress),y ; ldy #Block_LowMemoryPtr ; out of memory ? - if below the lowmemorypointer cmp (DBaseAddress),y bcc _SAMemory ; tay ; address of start of space in Y. pla ; restore largest string size and save it sta @w$0000,y ; doesn't matter it's a word. iny ; Y now points to the first byte of the string we'll copy tya ; in A now ply ; Y is the address of the variable pointer. sta @w$0000,y ; make that pointer the first byte ; ; Copy the string at X to the string at [Y]. ; _SACopyString lda @w$0000,x ; get length and #$00FF sta DTemp1 ; save it. lda @w$0000,y ; Y now contains the actual address of the string tay _SACopyStringLoop: sep #$20 lda @w$0000,x sta @w$0000,y rep #$20 inx iny dec DTemp1 bpl _SACopyStringLoop plx ; restore X rts _SAMemory: brl OutOfMemoryError
/* scheme/is_sob_integer.asm * Take pointers to a Scheme object, and places in R0 either 0 or 1 * (long, not Scheme integer objects or Scheme boolean objets), * depending on whether the argument is integer. * * Programmer: Mayer Goldberg, 2010 */ IS_SOB_INTEGER: PUSH(FP); MOV(FP, SP); MOV(R0, FPARG(0)); CMP(IND(R0), T_INTEGER); JUMP_EQ(L_IS_SOB_INTEGER_TRUE); MOV(R0, IMM(0)); JUMP(L_IS_SOB_INTEGER_EXIT); L_IS_SOB_INTEGER_TRUE: MOV(R0, IMM(1)); L_IS_SOB_INTEGER_EXIT: POP(FP); RETURN;
;/* ; Copyright Oliver Kowalke 2009. ; Distributed under the Boost Software License, Version 1.0. ; (See accompanying file LICENSE_1_0.txt or copy at ; http://www.boost.org/LICENSE_1_0.txt) ;*/ ; ******************************************************* ; * * ; * ------------------------------------------------- * ; * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ; * ------------------------------------------------- * ; * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| * ; * ------------------------------------------------- * ; * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | * ; * ------------------------------------------------- * ; * ------------------------------------------------- * ; * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ; * ------------------------------------------------- * ; * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| * ; * ------------------------------------------------- * ; * | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | * ; * ------------------------------------------------- * ; * ------------------------------------------------- * ; * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ; * ------------------------------------------------- * ; * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| * ; * ------------------------------------------------- * ; * |deall|limit| base| v1 | v2 | v3 | v4 | v5 | * ; * ------------------------------------------------- * ; * ------------------------------------------------- * ; * | 24 | 25 | 26 | 27 | 28 | | * ; * ------------------------------------------------- * ; * | 0x60| 0x64| 0x68| 0x6c| 0x70| | * ; * ------------------------------------------------- * ; * | v6 | v7 | v8 | lr | pc | | * ; * ------------------------------------------------- * ; * * ; ******************************************************* AREA |.text|, CODE ALIGN 4 EXPORT meow_asm_context_jump meow_asm_context_jump PROC @ save LR as PC push {lr} @ save V1-V8,LR push {v1-v8,lr} @ prepare stack for FPU sub sp, sp, #0x4c @ test if fpu env should be preserved cmp a4, #0 beq 1f @ save S16-S31 vstmia sp, {d8-d15} 1: ; load TIB to save/restore thread size and limit. ; we do not need preserve CPU flag and can use it's arg register mrc p15, #0, v1, c13, c0, #2 ; save current stack base ldr a5, [v1,#0x04] str a5, [sp,#0x48] ; save current stack limit ldr a5, [v1,#0x08] str a5, [sp,#0x44] ; save current deallocation stack ldr a5, [v1,#0xe0c] str a5, [sp,#0x40] @ store RSP (pointing to context-data) in A1 str sp, [a1] @ restore RSP (pointing to context-data) from A2 mov sp, a2 @ test if fpu env should be preserved cmp a4, #0 beq 2f @ restore S16-S31 vldmia sp, {d8-d15} 2: ; restore stack base ldr a5, [sp,#0x48] str a5, [v1,#0x04] ; restore stack limit ldr a5, [sp,#0x44] str a5, [v1,#0x08] ; restore deallocation stack ldr a5, [sp,#0x40] str a5, [v1,#0xe0c] @ prepare stack for FPU add sp, sp, #0x4c ; use third arg as return value after jump ; and as first arg in context function mov a1, a3 @ restore v1-V8,LR pop {v1-v8,lr} pop {pc} ENDP END
extern gdt_ptr PROTECTED_MODE_CODE_SELECTOR: equ 0x08 PROTECTED_MODE_DATA_SELECTOR: equ 0x10 REAL_MODE_CODE_SELECTOR: equ 0x18 REAL_MODE_DATA_SELECTOR: equ 0x20 PROTECTED_MODE_BIT: equ 1 SIZEOF_REGISTER_STATE: equ 40 section .real_code ; NOTE: this function assumes all pointers are located within the first 64K of memory. ; NOTE(2): this function is not reentrant and uses global state. ; --------------------------------------------------------------------------------------- ; void bios_call(uint32_t number, const RealModeRegisterState* in, RealModeRegisterState* out) ; esp + 12 [out] ; esp + 8 [in] ; esp + 4 [number] ; esp + 0 [ret] global bios_call bios_call: ; save arguments so that we don't have to access the stack mov al, [esp + 4] mov [.call_number], al mov eax, [esp + 8] mov [in_regs_ptr], eax ; out_regs_ptr will point to the end of the structure for convenience ; when we push the state state after call mov eax, [esp + 12] add eax, SIZEOF_REGISTER_STATE mov [out_regs_ptr], eax ; save non-scratch push ebx push esi push edi push ebp mov [initial_esp], esp jmp REAL_MODE_CODE_SELECTOR:.real_mode_transition .real_mode_transition: BITS 16 mov ax, REAL_MODE_DATA_SELECTOR mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax mov eax, cr0 and eax, ~PROTECTED_MODE_BIT mov cr0, eax jmp 0x0:.real_mode_code .real_mode_code: xor ax, ax mov ss, ax ; pop requested register state pre-call mov sp, [ss:in_regs_ptr] pop eax pop ebx pop ecx pop edx pop esi pop edi pop ebp pop gs pop fs pop es pop ds popfd mov sp, [ss:initial_esp] sti db 0xCD ; int followed by number .call_number: db 0 cli ; push final state post-call mov sp, [ss:out_regs_ptr] pushfd push ds push es push fs push gs push ebp push edi push esi push edx push ecx push ebx push eax ; switch back to protected mode lgdt [ss:gdt_ptr] mov eax, cr0 or eax, PROTECTED_MODE_BIT mov cr0, eax jmp PROTECTED_MODE_CODE_SELECTOR:.protected_mode_code .protected_mode_code: BITS 32 ; restore data segments mov ax, PROTECTED_MODE_DATA_SELECTOR mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax ; restore non-scratch mov esp, [initial_esp] pop ebp pop edi pop esi pop ebx ret section .real_data align 4 in_regs_ptr: dd 0 out_regs_ptr: dd 0 initial_esp: dd 0
; A232098: a(n) is the largest m such that m! divides n^2; a(n) = A055881(n^2). ; 1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,6,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2 add $0,1 pow $0,2 sub $0,1 seq $0,55881 ; a(n) = largest m such that m! divides n.
copyright zengfr site:http://github.com/zengfr/romhack 007C8C clr.w ($5a,A6) [1p+ E, container+ E] 007C90 tst.b ($58,A6) 00A2C6 dbra D0, $a2c0 00A33C clr.w ($5a,A4) 00A340 clr.w ($66,A4) 00DF72 bra $c516 [1p+5A] copyright zengfr site:http://github.com/zengfr/romhack
; A055116: Base-6 complement of n (write n in base 6, then replace each digit with its base-6 negative). ; Submitted by Christian Krause ; 0,5,4,3,2,1,30,35,34,33,32,31,24,29,28,27,26,25,18,23,22,21,20,19,12,17,16,15,14,13,6,11,10,9,8,7,180,185,184,183,182,181,210,215,214,213,212,211,204,209,208,207,206,205,198,203,202,201,200,199,192,197,196,195,194,193,186,191,190,189,188,187,144,149,148,147,146,145,174,179,178,177,176,175,168,173,172,171,170,169,162,167,166,165,164,163,156,161,160,159 mov $3,1 lpb $0 mov $2,$0 div $0,6 mul $2,5 mod $2,6 mul $2,$3 add $1,$2 mul $3,6 lpe mov $0,$1
; A298033: Coordination sequence of the Dual(3.4.6.4) tiling with respect to a hexavalent node. ; 1,6,12,24,30,42,48,60,66,78,84,96,102,114,120,132,138,150,156,168,174,186,192,204,210,222,228,240,246,258,264,276,282,294,300,312,318,330,336,348,354,366,372,384,390,402,408,420,426,438,444,456,462,474,480,492,498,510,516,528,534,546,552,564,570,582,588,600,606,618,624,636,642,654,660,672,678,690,696,708,714,726,732,744,750,762,768,780,786,798,804,816,822,834,840,852,858,870,876,888 mul $0,9 sub $0,1 lpb $0 mov $1,$0 mod $0,6 lpe sub $1,$0 mov $0,$1
/** * eZmax API Definition (Full) * This API expose all the functionnalities for the eZmax and eZsign applications. * * The version of the OpenAPI document: 1.1.7 * Contact: support-api@ezmax.ca * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIObjectEzsignbulksenddocumentmappingApi.h" #include "OAIServerConfiguration.h" #include <QJsonArray> #include <QJsonDocument> namespace OpenAPI { OAIObjectEzsignbulksenddocumentmappingApi::OAIObjectEzsignbulksenddocumentmappingApi(const int timeOut) : _timeOut(timeOut), _manager(nullptr), _isResponseCompressionEnabled(false), _isRequestCompressionEnabled(false) { initializeServerConfigs(); } OAIObjectEzsignbulksenddocumentmappingApi::~OAIObjectEzsignbulksenddocumentmappingApi() { } void OAIObjectEzsignbulksenddocumentmappingApi::initializeServerConfigs() { //Default server QList<OAIServerConfiguration> defaultConf = QList<OAIServerConfiguration>(); //varying endpoint server defaultConf.append(OAIServerConfiguration( QUrl("https://{sInfrastructureenvironmenttypeDescription}.api.appcluster01.{sInfrastructureregionCode}.ezmax.com/rest"), "The server endpoint where to send your region specific API requests.", QMap<QString, OAIServerVariable>{ {"sInfrastructureenvironmenttypeDescription", OAIServerVariable("The environment on on which to call the API. Should always be "prod" unless instructed otherwise by support.","prod", QSet<QString>{ {"prod"},{"stg"},{"qa"},{"dev"} })}, {"sInfrastructureregionCode", OAIServerVariable("The region where your services are hosted.","ca-central-1", QSet<QString>{ {"ca-central-1"} })}, })); defaultConf.append(OAIServerConfiguration( QUrl("https://{sInfrastructureenvironmenttypeDescription}.api.global.ezmax.com"), "The server endpoint where to send your global API requests.", QMap<QString, OAIServerVariable>{ {"sInfrastructureenvironmenttypeDescription", OAIServerVariable("The environment on on which to call the API. Should always be "prod" unless instructed otherwise by support.","prod", QSet<QString>{ {"prod"},{"stg"},{"qa"},{"dev"} })}, })); _serverConfigs.insert("ezsignbulksenddocumentmappingCreateObjectV1", defaultConf); _serverIndices.insert("ezsignbulksenddocumentmappingCreateObjectV1", 0); _serverConfigs.insert("ezsignbulksenddocumentmappingDeleteObjectV1", defaultConf); _serverIndices.insert("ezsignbulksenddocumentmappingDeleteObjectV1", 0); _serverConfigs.insert("ezsignbulksenddocumentmappingGetObjectV1", defaultConf); _serverIndices.insert("ezsignbulksenddocumentmappingGetObjectV1", 0); } /** * returns 0 on success and -1, -2 or -3 on failure. * -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found */ int OAIObjectEzsignbulksenddocumentmappingApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { auto it = _serverConfigs.find(operation); if (it != _serverConfigs.end() && serverIndex < it.value().size()) { return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); } return -3; } void OAIObjectEzsignbulksenddocumentmappingApi::setServerIndex(const QString &operation, int serverIndex) { if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { _serverIndices[operation] = serverIndex; } } void OAIObjectEzsignbulksenddocumentmappingApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { _apiKeys.insert(apiKeyName,apiKey); } void OAIObjectEzsignbulksenddocumentmappingApi::setBearerToken(const QString &token) { _bearerToken = token; } void OAIObjectEzsignbulksenddocumentmappingApi::setUsername(const QString &username) { _username = username; } void OAIObjectEzsignbulksenddocumentmappingApi::setPassword(const QString &password) { _password = password; } void OAIObjectEzsignbulksenddocumentmappingApi::setTimeOut(const int timeOut) { _timeOut = timeOut; } void OAIObjectEzsignbulksenddocumentmappingApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } void OAIObjectEzsignbulksenddocumentmappingApi::setNetworkAccessManager(QNetworkAccessManager* manager) { _manager = manager; } /** * Appends a new ServerConfiguration to the config map for a specific operation. * @param operation The id to the target operation. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. * returns the index of the new server config on success and -1 if the operation is not found */ int OAIObjectEzsignbulksenddocumentmappingApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, OAIServerVariable> &variables) { if (_serverConfigs.contains(operation)) { _serverConfigs[operation].append(OAIServerConfiguration( url, description, variables)); return _serverConfigs[operation].size()-1; } else { return -1; } } /** * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. * @param url A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIObjectEzsignbulksenddocumentmappingApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap<QString, OAIServerVariable> &variables) { #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } #else for (auto &e : _serverIndices.keys()) { setServerIndex(e, addServerConfiguration(e, url, description, variables)); } #endif } /** * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. * @param URL A string that contains the URL of the server * @param description A String that describes the server * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void OAIObjectEzsignbulksenddocumentmappingApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, OAIServerVariable> &variables) { setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); } void OAIObjectEzsignbulksenddocumentmappingApi::addHeaders(const QString &key, const QString &value) { _defaultHeaders.insert(key, value); } void OAIObjectEzsignbulksenddocumentmappingApi::enableRequestCompression() { _isRequestCompressionEnabled = true; } void OAIObjectEzsignbulksenddocumentmappingApi::enableResponseCompression() { _isResponseCompressionEnabled = true; } void OAIObjectEzsignbulksenddocumentmappingApi::abortRequests() { emit abortRequestsSignal(); } QString OAIObjectEzsignbulksenddocumentmappingApi::getParamStylePrefix(const QString &style) { if (style == "matrix") { return ";"; } else if (style == "label") { return "."; } else if (style == "form") { return "&"; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "&"; } else if (style == "pipeDelimited") { return "&"; } else { return "none"; } } QString OAIObjectEzsignbulksenddocumentmappingApi::getParamStyleSuffix(const QString &style) { if (style == "matrix") { return "="; } else if (style == "label") { return ""; } else if (style == "form") { return "="; } else if (style == "simple") { return ""; } else if (style == "spaceDelimited") { return "="; } else if (style == "pipeDelimited") { return "="; } else { return "none"; } } QString OAIObjectEzsignbulksenddocumentmappingApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { if (style == "matrix") { return (isExplode) ? ";" + name + "=" : ","; } else if (style == "label") { return (isExplode) ? "." : ","; } else if (style == "form") { return (isExplode) ? "&" + name + "=" : ","; } else if (style == "simple") { return ","; } else if (style == "spaceDelimited") { return (isExplode) ? "&" + name + "=" : " "; } else if (style == "pipeDelimited") { return (isExplode) ? "&" + name + "=" : "|"; } else if (style == "deepObject") { return (isExplode) ? "&" : "none"; } else { return "none"; } } void OAIObjectEzsignbulksenddocumentmappingApi::ezsignbulksenddocumentmappingCreateObjectV1(const OAIEzsignbulksenddocumentmapping_createObject_v1_Request &oai_ezsignbulksenddocumentmapping_create_object_v1_request) { QString fullPath = QString(_serverConfigs["ezsignbulksenddocumentmappingCreateObjectV1"][_serverIndices.value("ezsignbulksenddocumentmappingCreateObjectV1")].URL()+"/1/object/ezsignbulksenddocumentmapping"); if (_apiKeys.contains("Authorization")) { addHeaders("Authorization",_apiKeys.find("Authorization").value()); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "POST"); { QByteArray output = oai_ezsignbulksenddocumentmapping_create_object_v1_request.asJson().toUtf8(); input.request_body.append(output); } #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIObjectEzsignbulksenddocumentmappingApi::ezsignbulksenddocumentmappingCreateObjectV1Callback); connect(this, &OAIObjectEzsignbulksenddocumentmappingApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren<OAIHttpRequestWorker*>().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIObjectEzsignbulksenddocumentmappingApi::ezsignbulksenddocumentmappingCreateObjectV1Callback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEzsignbulksenddocumentmapping_createObject_v1_Response output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit ezsignbulksenddocumentmappingCreateObjectV1Signal(output); emit ezsignbulksenddocumentmappingCreateObjectV1SignalFull(worker, output); } else { emit ezsignbulksenddocumentmappingCreateObjectV1SignalE(output, error_type, error_str); emit ezsignbulksenddocumentmappingCreateObjectV1SignalEFull(worker, error_type, error_str); } } void OAIObjectEzsignbulksenddocumentmappingApi::ezsignbulksenddocumentmappingDeleteObjectV1(const qint32 &pki_ezsignbulksenddocumentmapping_id) { QString fullPath = QString(_serverConfigs["ezsignbulksenddocumentmappingDeleteObjectV1"][_serverIndices.value("ezsignbulksenddocumentmappingDeleteObjectV1")].URL()+"/1/object/ezsignbulksenddocumentmapping/{pkiEzsignbulksenddocumentmappingID}"); if (_apiKeys.contains("Authorization")) { addHeaders("Authorization",_apiKeys.find("Authorization").value()); } { QString pki_ezsignbulksenddocumentmapping_idPathParam("{"); pki_ezsignbulksenddocumentmapping_idPathParam.append("pkiEzsignbulksenddocumentmappingID").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "pkiEzsignbulksenddocumentmappingID", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"pkiEzsignbulksenddocumentmappingID"+pathSuffix : pathPrefix; fullPath.replace(pki_ezsignbulksenddocumentmapping_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(pki_ezsignbulksenddocumentmapping_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "DELETE"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIObjectEzsignbulksenddocumentmappingApi::ezsignbulksenddocumentmappingDeleteObjectV1Callback); connect(this, &OAIObjectEzsignbulksenddocumentmappingApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren<OAIHttpRequestWorker*>().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIObjectEzsignbulksenddocumentmappingApi::ezsignbulksenddocumentmappingDeleteObjectV1Callback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEzsignbulksenddocumentmapping_deleteObject_v1_Response output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit ezsignbulksenddocumentmappingDeleteObjectV1Signal(output); emit ezsignbulksenddocumentmappingDeleteObjectV1SignalFull(worker, output); } else { emit ezsignbulksenddocumentmappingDeleteObjectV1SignalE(output, error_type, error_str); emit ezsignbulksenddocumentmappingDeleteObjectV1SignalEFull(worker, error_type, error_str); } } void OAIObjectEzsignbulksenddocumentmappingApi::ezsignbulksenddocumentmappingGetObjectV1(const qint32 &pki_ezsignbulksenddocumentmapping_id) { QString fullPath = QString(_serverConfigs["ezsignbulksenddocumentmappingGetObjectV1"][_serverIndices.value("ezsignbulksenddocumentmappingGetObjectV1")].URL()+"/1/object/ezsignbulksenddocumentmapping/{pkiEzsignbulksenddocumentmappingID}"); if (_apiKeys.contains("Authorization")) { addHeaders("Authorization",_apiKeys.find("Authorization").value()); } { QString pki_ezsignbulksenddocumentmapping_idPathParam("{"); pki_ezsignbulksenddocumentmapping_idPathParam.append("pkiEzsignbulksenddocumentmappingID").append("}"); QString pathPrefix, pathSuffix, pathDelimiter; QString pathStyle = "simple"; if (pathStyle == "") pathStyle = "simple"; pathPrefix = getParamStylePrefix(pathStyle); pathSuffix = getParamStyleSuffix(pathStyle); pathDelimiter = getParamStyleDelimiter(pathStyle, "pkiEzsignbulksenddocumentmappingID", false); QString paramString = (pathStyle == "matrix") ? pathPrefix+"pkiEzsignbulksenddocumentmappingID"+pathSuffix : pathPrefix; fullPath.replace(pki_ezsignbulksenddocumentmapping_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(pki_ezsignbulksenddocumentmapping_id))); } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); OAIHttpRequestInput input(fullPath, "GET"); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIObjectEzsignbulksenddocumentmappingApi::ezsignbulksenddocumentmappingGetObjectV1Callback); connect(this, &OAIObjectEzsignbulksenddocumentmappingApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { if (findChildren<OAIHttpRequestWorker*>().count() == 0) { emit allPendingRequestsCompleted(); } }); worker->execute(&input); } void OAIObjectEzsignbulksenddocumentmappingApi::ezsignbulksenddocumentmappingGetObjectV1Callback(OAIHttpRequestWorker *worker) { QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; if (worker->error_type != QNetworkReply::NoError) { error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); } OAIEzsignbulksenddocumentmapping_getObject_v1_Response output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit ezsignbulksenddocumentmappingGetObjectV1Signal(output); emit ezsignbulksenddocumentmappingGetObjectV1SignalFull(worker, output); } else { emit ezsignbulksenddocumentmappingGetObjectV1SignalE(output, error_type, error_str); emit ezsignbulksenddocumentmappingGetObjectV1SignalEFull(worker, error_type, error_str); } } void OAIObjectEzsignbulksenddocumentmappingApi::tokenAvailable(){ oauthToken token; switch (_OauthMethod) { case 1: //implicit flow token = _implicitFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _implicitFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retrieve a valid token"; } break; case 2: //authorization flow token = _authFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _authFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retrieve a valid token"; } break; case 3: //client credentials flow token = _credentialFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retrieve a valid token"; } break; case 4: //resource owner password flow token = _passwordFlow.getToken(_latestScope.join(" ")); if(token.isValid()){ _latestInput.headers.insert("Authorization", "Bearer " + token.getToken()); _latestWorker->execute(&_latestInput); }else{ _credentialFlow.removeToken(_latestScope.join(" ")); qDebug() << "Could not retrieve a valid token"; } break; default: qDebug() << "No Oauth method set!"; break; } } } // namespace OpenAPI
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "modules/video_coding/codecs/vp8/vp8_impl.h" #include <stdlib.h> #include <string.h> #include <time.h> #include <algorithm> #include <string> #include "common_types.h" // NOLINT(build/include) #include "common_video/libyuv/include/webrtc_libyuv.h" #include "modules/include/module_common_types.h" #include "modules/video_coding/codecs/vp8/include/vp8_common_types.h" #include "modules/video_coding/codecs/vp8/screenshare_layers.h" #include "modules/video_coding/codecs/vp8/simulcast_rate_allocator.h" #include "modules/video_coding/codecs/vp8/temporal_layers.h" #include "modules/video_coding/include/video_codec_interface.h" #include "rtc_base/checks.h" #include "rtc_base/numerics/exp_filter.h" #include "rtc_base/ptr_util.h" #include "rtc_base/random.h" #include "rtc_base/timeutils.h" #include "rtc_base/trace_event.h" #include "system_wrappers/include/clock.h" #include "system_wrappers/include/field_trial.h" #include "system_wrappers/include/metrics.h" #include "third_party/libyuv/include/libyuv/convert.h" #include "third_party/libyuv/include/libyuv/scale.h" namespace webrtc { namespace { const char kVp8PostProcArmFieldTrial[] = "WebRTC-VP8-Postproc-Config-Arm"; const char kVp8GfBoostFieldTrial[] = "WebRTC-VP8-GfBoost"; const int kTokenPartitions = VP8_ONE_TOKENPARTITION; enum { kVp8ErrorPropagationTh = 30 }; enum { kVp832ByteAlign = 32 }; // VP8 denoiser states. enum denoiserState { kDenoiserOff, kDenoiserOnYOnly, kDenoiserOnYUV, kDenoiserOnYUVAggressive, // Adaptive mode defaults to kDenoiserOnYUV on key frame, but may switch // to kDenoiserOnYUVAggressive based on a computed noise metric. kDenoiserOnAdaptive }; // Greatest common divisior int GCD(int a, int b) { int c = a % b; while (c != 0) { a = b; b = c; c = a % b; } return b; } uint32_t SumStreamMaxBitrate(int streams, const VideoCodec& codec) { uint32_t bitrate_sum = 0; for (int i = 0; i < streams; ++i) { bitrate_sum += codec.simulcastStream[i].maxBitrate; } return bitrate_sum; } int NumberOfStreams(const VideoCodec& codec) { int streams = codec.numberOfSimulcastStreams < 1 ? 1 : codec.numberOfSimulcastStreams; uint32_t simulcast_max_bitrate = SumStreamMaxBitrate(streams, codec); if (simulcast_max_bitrate == 0) { streams = 1; } return streams; } bool ValidSimulcastResolutions(const VideoCodec& codec, int num_streams) { if (codec.width != codec.simulcastStream[num_streams - 1].width || codec.height != codec.simulcastStream[num_streams - 1].height) { return false; } for (int i = 0; i < num_streams; ++i) { if (codec.width * codec.simulcastStream[i].height != codec.height * codec.simulcastStream[i].width) { return false; } } for (int i = 1; i < num_streams; ++i) { if (codec.simulcastStream[i].width != codec.simulcastStream[i - 1].width * 2) { return false; } } return true; } bool ValidSimulcastTemporalLayers(const VideoCodec& codec, int num_streams) { for (int i = 0; i < num_streams - 1; ++i) { if (codec.simulcastStream[i].numberOfTemporalLayers != codec.simulcastStream[i + 1].numberOfTemporalLayers) return false; } return true; } int NumStreamsDisabled(const std::vector<bool>& streams) { int num_disabled = 0; for (bool stream : streams) { if (!stream) ++num_disabled; } return num_disabled; } bool GetGfBoostPercentageFromFieldTrialGroup(int* boost_percentage) { std::string group = webrtc::field_trial::FindFullName(kVp8GfBoostFieldTrial); if (group.empty()) return false; if (sscanf(group.c_str(), "Enabled-%d", boost_percentage) != 1) return false; if (*boost_percentage < 0 || *boost_percentage > 100) return false; return true; } void GetPostProcParamsFromFieldTrialGroup( VP8DecoderImpl::DeblockParams* deblock_params) { std::string group = webrtc::field_trial::FindFullName(kVp8PostProcArmFieldTrial); if (group.empty()) return; VP8DecoderImpl::DeblockParams params; if (sscanf(group.c_str(), "Enabled-%d,%d,%d", &params.max_level, &params.min_qp, &params.degrade_qp) != 3) return; if (params.max_level < 0 || params.max_level > 16) return; if (params.min_qp < 0 || params.degrade_qp <= params.min_qp) return; *deblock_params = params; } } // namespace std::unique_ptr<VP8Encoder> VP8Encoder::Create() { return rtc::MakeUnique<VP8EncoderImpl>(); } std::unique_ptr<VP8Decoder> VP8Decoder::Create() { return rtc::MakeUnique<VP8DecoderImpl>(); } vpx_enc_frame_flags_t VP8EncoderImpl::EncodeFlags( const TemporalLayers::FrameConfig& references) { RTC_DCHECK(!references.drop_frame); vpx_enc_frame_flags_t flags = 0; if ((references.last_buffer_flags & TemporalLayers::kReference) == 0) flags |= VP8_EFLAG_NO_REF_LAST; if ((references.last_buffer_flags & TemporalLayers::kUpdate) == 0) flags |= VP8_EFLAG_NO_UPD_LAST; if ((references.golden_buffer_flags & TemporalLayers::kReference) == 0) flags |= VP8_EFLAG_NO_REF_GF; if ((references.golden_buffer_flags & TemporalLayers::kUpdate) == 0) flags |= VP8_EFLAG_NO_UPD_GF; if ((references.arf_buffer_flags & TemporalLayers::kReference) == 0) flags |= VP8_EFLAG_NO_REF_ARF; if ((references.arf_buffer_flags & TemporalLayers::kUpdate) == 0) flags |= VP8_EFLAG_NO_UPD_ARF; if (references.freeze_entropy) flags |= VP8_EFLAG_NO_UPD_ENTROPY; return flags; } VP8EncoderImpl::VP8EncoderImpl() : use_gf_boost_(webrtc::field_trial::IsEnabled(kVp8GfBoostFieldTrial)), encoded_complete_callback_(nullptr), inited_(false), timestamp_(0), qp_max_(56), // Setting for max quantizer. cpu_speed_default_(-6), number_of_cores_(0), rc_max_intra_target_(0), key_frame_request_(kMaxSimulcastStreams, false) { Random random(rtc::TimeMicros()); picture_id_.reserve(kMaxSimulcastStreams); for (int i = 0; i < kMaxSimulcastStreams; ++i) { picture_id_.push_back(random.Rand<uint16_t>() & 0x7FFF); tl0_pic_idx_.push_back(random.Rand<uint8_t>()); } temporal_layers_.reserve(kMaxSimulcastStreams); temporal_layers_checkers_.reserve(kMaxSimulcastStreams); raw_images_.reserve(kMaxSimulcastStreams); encoded_images_.reserve(kMaxSimulcastStreams); send_stream_.reserve(kMaxSimulcastStreams); cpu_speed_.assign(kMaxSimulcastStreams, cpu_speed_default_); encoders_.reserve(kMaxSimulcastStreams); configurations_.reserve(kMaxSimulcastStreams); downsampling_factors_.reserve(kMaxSimulcastStreams); } VP8EncoderImpl::~VP8EncoderImpl() { Release(); } int VP8EncoderImpl::Release() { int ret_val = WEBRTC_VIDEO_CODEC_OK; while (!encoded_images_.empty()) { EncodedImage& image = encoded_images_.back(); delete[] image._buffer; encoded_images_.pop_back(); } while (!encoders_.empty()) { vpx_codec_ctx_t& encoder = encoders_.back(); if (vpx_codec_destroy(&encoder)) { ret_val = WEBRTC_VIDEO_CODEC_MEMORY; } encoders_.pop_back(); } configurations_.clear(); send_stream_.clear(); cpu_speed_.clear(); while (!raw_images_.empty()) { vpx_img_free(&raw_images_.back()); raw_images_.pop_back(); } for (size_t i = 0; i < temporal_layers_.size(); ++i) { tl0_pic_idx_[i] = temporal_layers_[i]->Tl0PicIdx(); } temporal_layers_.clear(); temporal_layers_checkers_.clear(); inited_ = false; return ret_val; } int VP8EncoderImpl::SetRateAllocation(const BitrateAllocation& bitrate, uint32_t new_framerate) { if (!inited_) return WEBRTC_VIDEO_CODEC_UNINITIALIZED; if (encoders_[0].err) return WEBRTC_VIDEO_CODEC_ERROR; if (new_framerate < 1) return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; if (bitrate.get_sum_bps() == 0) { // Encoder paused, turn off all encoding. const int num_streams = static_cast<size_t>(encoders_.size()); for (int i = 0; i < num_streams; ++i) SetStreamState(false, i); return WEBRTC_VIDEO_CODEC_OK; } // At this point, bitrate allocation should already match codec settings. if (codec_.maxBitrate > 0) RTC_DCHECK_LE(bitrate.get_sum_kbps(), codec_.maxBitrate); RTC_DCHECK_GE(bitrate.get_sum_kbps(), codec_.minBitrate); if (codec_.numberOfSimulcastStreams > 0) RTC_DCHECK_GE(bitrate.get_sum_kbps(), codec_.simulcastStream[0].minBitrate); codec_.maxFramerate = new_framerate; if (encoders_.size() > 1) { // If we have more than 1 stream, reduce the qp_max for the low resolution // stream if frame rate is not too low. The trade-off with lower qp_max is // possibly more dropped frames, so we only do this if the frame rate is // above some threshold (base temporal layer is down to 1/4 for 3 layers). // We may want to condition this on bitrate later. if (new_framerate > 20) { configurations_[encoders_.size() - 1].rc_max_quantizer = 45; } else { // Go back to default value set in InitEncode. configurations_[encoders_.size() - 1].rc_max_quantizer = qp_max_; } } size_t stream_idx = encoders_.size() - 1; for (size_t i = 0; i < encoders_.size(); ++i, --stream_idx) { unsigned int target_bitrate_kbps = bitrate.GetSpatialLayerSum(stream_idx) / 1000; bool send_stream = target_bitrate_kbps > 0; if (send_stream || encoders_.size() > 1) SetStreamState(send_stream, stream_idx); configurations_[i].rc_target_bitrate = target_bitrate_kbps; temporal_layers_[stream_idx]->UpdateConfiguration(&configurations_[i]); if (vpx_codec_enc_config_set(&encoders_[i], &configurations_[i])) { return WEBRTC_VIDEO_CODEC_ERROR; } } return WEBRTC_VIDEO_CODEC_OK; } const char* VP8EncoderImpl::ImplementationName() const { return "libvpx"; } void VP8EncoderImpl::SetStreamState(bool send_stream, int stream_idx) { if (send_stream && !send_stream_[stream_idx]) { // Need a key frame if we have not sent this stream before. key_frame_request_[stream_idx] = true; } send_stream_[stream_idx] = send_stream; } void VP8EncoderImpl::SetupTemporalLayers(int num_streams, int num_temporal_layers, const VideoCodec& codec) { RTC_DCHECK(codec.VP8().tl_factory != nullptr); const TemporalLayersFactory* tl_factory = codec.VP8().tl_factory; if (num_streams == 1) { temporal_layers_.emplace_back( tl_factory->Create(0, num_temporal_layers, tl0_pic_idx_[0])); temporal_layers_checkers_.emplace_back( tl_factory->CreateChecker(0, num_temporal_layers, tl0_pic_idx_[0])); } else { for (int i = 0; i < num_streams; ++i) { RTC_CHECK_GT(num_temporal_layers, 0); int layers = std::max(static_cast<uint8_t>(1), codec.simulcastStream[i].numberOfTemporalLayers); temporal_layers_.emplace_back( tl_factory->Create(i, layers, tl0_pic_idx_[i])); temporal_layers_checkers_.emplace_back( tl_factory->CreateChecker(i, layers, tl0_pic_idx_[i])); } } } int VP8EncoderImpl::InitEncode(const VideoCodec* inst, int number_of_cores, size_t /*maxPayloadSize */) { if (inst == NULL) { return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; } if (inst->maxFramerate < 1) { return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; } // allow zero to represent an unspecified maxBitRate if (inst->maxBitrate > 0 && inst->startBitrate > inst->maxBitrate) { return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; } if (inst->width <= 1 || inst->height <= 1) { return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; } if (number_of_cores < 1) { return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; } if (inst->VP8().automaticResizeOn && inst->numberOfSimulcastStreams > 1) { return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; } int retVal = Release(); if (retVal < 0) { return retVal; } int number_of_streams = NumberOfStreams(*inst); bool doing_simulcast = (number_of_streams > 1); if (doing_simulcast && (!ValidSimulcastResolutions(*inst, number_of_streams) || !ValidSimulcastTemporalLayers(*inst, number_of_streams))) { return WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED; } int num_temporal_layers = doing_simulcast ? inst->simulcastStream[0].numberOfTemporalLayers : inst->VP8().numberOfTemporalLayers; RTC_DCHECK_GT(num_temporal_layers, 0); SetupTemporalLayers(number_of_streams, num_temporal_layers, *inst); number_of_cores_ = number_of_cores; timestamp_ = 0; codec_ = *inst; // Code expects simulcastStream resolutions to be correct, make sure they are // filled even when there are no simulcast layers. if (codec_.numberOfSimulcastStreams == 0) { codec_.simulcastStream[0].width = codec_.width; codec_.simulcastStream[0].height = codec_.height; } encoded_images_.resize(number_of_streams); encoders_.resize(number_of_streams); configurations_.resize(number_of_streams); downsampling_factors_.resize(number_of_streams); raw_images_.resize(number_of_streams); send_stream_.resize(number_of_streams); send_stream_[0] = true; // For non-simulcast case. cpu_speed_.resize(number_of_streams); std::fill(key_frame_request_.begin(), key_frame_request_.end(), false); int idx = number_of_streams - 1; for (int i = 0; i < (number_of_streams - 1); ++i, --idx) { int gcd = GCD(inst->simulcastStream[idx].width, inst->simulcastStream[idx - 1].width); downsampling_factors_[i].num = inst->simulcastStream[idx].width / gcd; downsampling_factors_[i].den = inst->simulcastStream[idx - 1].width / gcd; send_stream_[i] = false; } if (number_of_streams > 1) { send_stream_[number_of_streams - 1] = false; downsampling_factors_[number_of_streams - 1].num = 1; downsampling_factors_[number_of_streams - 1].den = 1; } for (int i = 0; i < number_of_streams; ++i) { // allocate memory for encoded image if (encoded_images_[i]._buffer != NULL) { delete[] encoded_images_[i]._buffer; } encoded_images_[i]._size = CalcBufferSize(VideoType::kI420, codec_.width, codec_.height); encoded_images_[i]._buffer = new uint8_t[encoded_images_[i]._size]; encoded_images_[i]._completeFrame = true; } // populate encoder configuration with default values if (vpx_codec_enc_config_default(vpx_codec_vp8_cx(), &configurations_[0], 0)) { return WEBRTC_VIDEO_CODEC_ERROR; } // setting the time base of the codec configurations_[0].g_timebase.num = 1; configurations_[0].g_timebase.den = 90000; configurations_[0].g_lag_in_frames = 0; // 0- no frame lagging // Set the error resilience mode according to user settings. switch (inst->VP8().resilience) { case kResilienceOff: configurations_[0].g_error_resilient = 0; break; case kResilientStream: configurations_[0].g_error_resilient = VPX_ERROR_RESILIENT_DEFAULT; break; case kResilientFrames: return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; // Not supported } // rate control settings configurations_[0].rc_dropframe_thresh = inst->VP8().frameDroppingOn ? 30 : 0; configurations_[0].rc_end_usage = VPX_CBR; configurations_[0].g_pass = VPX_RC_ONE_PASS; // Handle resizing outside of libvpx. configurations_[0].rc_resize_allowed = 0; configurations_[0].rc_min_quantizer = 2; if (inst->qpMax >= configurations_[0].rc_min_quantizer) { qp_max_ = inst->qpMax; } configurations_[0].rc_max_quantizer = qp_max_; configurations_[0].rc_undershoot_pct = 100; configurations_[0].rc_overshoot_pct = 15; configurations_[0].rc_buf_initial_sz = 500; configurations_[0].rc_buf_optimal_sz = 600; configurations_[0].rc_buf_sz = 1000; // Set the maximum target size of any key-frame. rc_max_intra_target_ = MaxIntraTarget(configurations_[0].rc_buf_optimal_sz); if (inst->VP8().keyFrameInterval > 0) { configurations_[0].kf_mode = VPX_KF_AUTO; configurations_[0].kf_max_dist = inst->VP8().keyFrameInterval; } else { configurations_[0].kf_mode = VPX_KF_DISABLED; } // Allow the user to set the complexity for the base stream. switch (inst->VP8().complexity) { case kComplexityHigh: cpu_speed_[0] = -5; break; case kComplexityHigher: cpu_speed_[0] = -4; break; case kComplexityMax: cpu_speed_[0] = -3; break; default: cpu_speed_[0] = -6; break; } cpu_speed_default_ = cpu_speed_[0]; // Set encoding complexity (cpu_speed) based on resolution and/or platform. cpu_speed_[0] = SetCpuSpeed(inst->width, inst->height); for (int i = 1; i < number_of_streams; ++i) { cpu_speed_[i] = SetCpuSpeed(inst->simulcastStream[number_of_streams - 1 - i].width, inst->simulcastStream[number_of_streams - 1 - i].height); } configurations_[0].g_w = inst->width; configurations_[0].g_h = inst->height; // Determine number of threads based on the image size and #cores. // TODO(fbarchard): Consider number of Simulcast layers. configurations_[0].g_threads = NumberOfThreads( configurations_[0].g_w, configurations_[0].g_h, number_of_cores); // Creating a wrapper to the image - setting image data to NULL. // Actual pointer will be set in encode. Setting align to 1, as it // is meaningless (no memory allocation is done here). vpx_img_wrap(&raw_images_[0], VPX_IMG_FMT_I420, inst->width, inst->height, 1, NULL); // Note the order we use is different from webm, we have lowest resolution // at position 0 and they have highest resolution at position 0. int stream_idx = encoders_.size() - 1; SimulcastRateAllocator init_allocator(codec_, nullptr); BitrateAllocation allocation = init_allocator.GetAllocation( inst->startBitrate * 1000, inst->maxFramerate); std::vector<uint32_t> stream_bitrates; for (int i = 0; i == 0 || i < inst->numberOfSimulcastStreams; ++i) { uint32_t bitrate = allocation.GetSpatialLayerSum(i) / 1000; stream_bitrates.push_back(bitrate); } configurations_[0].rc_target_bitrate = stream_bitrates[stream_idx]; temporal_layers_[stream_idx]->OnRatesUpdated( stream_bitrates[stream_idx], inst->maxBitrate, inst->maxFramerate); temporal_layers_[stream_idx]->UpdateConfiguration(&configurations_[0]); --stream_idx; for (size_t i = 1; i < encoders_.size(); ++i, --stream_idx) { memcpy(&configurations_[i], &configurations_[0], sizeof(configurations_[0])); configurations_[i].g_w = inst->simulcastStream[stream_idx].width; configurations_[i].g_h = inst->simulcastStream[stream_idx].height; // Use 1 thread for lower resolutions. configurations_[i].g_threads = 1; // Setting alignment to 32 - as that ensures at least 16 for all // planes (32 for Y, 16 for U,V). Libvpx sets the requested stride for // the y plane, but only half of it to the u and v planes. vpx_img_alloc(&raw_images_[i], VPX_IMG_FMT_I420, inst->simulcastStream[stream_idx].width, inst->simulcastStream[stream_idx].height, kVp832ByteAlign); SetStreamState(stream_bitrates[stream_idx] > 0, stream_idx); configurations_[i].rc_target_bitrate = stream_bitrates[stream_idx]; temporal_layers_[stream_idx]->OnRatesUpdated( stream_bitrates[stream_idx], inst->maxBitrate, inst->maxFramerate); temporal_layers_[stream_idx]->UpdateConfiguration(&configurations_[i]); } return InitAndSetControlSettings(); } int VP8EncoderImpl::SetCpuSpeed(int width, int height) { #if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) \ || defined(WEBRTC_ANDROID) // On mobile platform, use a lower speed setting for lower resolutions for // CPUs with 4 or more cores. RTC_DCHECK_GT(number_of_cores_, 0); if (number_of_cores_ <= 3) return -12; if (width * height <= 352 * 288) return -8; else if (width * height <= 640 * 480) return -10; else return -12; #else // For non-ARM, increase encoding complexity (i.e., use lower speed setting) // if resolution is below CIF. Otherwise, keep the default/user setting // (|cpu_speed_default_|) set on InitEncode via VP8().complexity. if (width * height < 352 * 288) return (cpu_speed_default_ < -4) ? -4 : cpu_speed_default_; else return cpu_speed_default_; #endif } int VP8EncoderImpl::NumberOfThreads(int width, int height, int cpus) { #if defined(WEBRTC_ANDROID) if (width * height >= 320 * 180) { if (cpus >= 4) { // 3 threads for CPUs with 4 and more cores since most of times only 4 // cores will be active. return 3; } else if (cpus == 3 || cpus == 2) { return 2; } else { return 1; } } return 1; #else if (width * height >= 1920 * 1080 && cpus > 8) { return 8; // 8 threads for 1080p on high perf machines. } else if (width * height > 1280 * 960 && cpus >= 6) { // 3 threads for 1080p. return 3; } else if (width * height > 640 * 480 && cpus >= 3) { // 2 threads for qHD/HD. return 2; } else { // 1 thread for VGA or less. return 1; } #endif } int VP8EncoderImpl::InitAndSetControlSettings() { vpx_codec_flags_t flags = 0; flags |= VPX_CODEC_USE_OUTPUT_PARTITION; if (encoders_.size() > 1) { int error = vpx_codec_enc_init_multi(&encoders_[0], vpx_codec_vp8_cx(), &configurations_[0], encoders_.size(), flags, &downsampling_factors_[0]); if (error) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } } else { if (vpx_codec_enc_init(&encoders_[0], vpx_codec_vp8_cx(), &configurations_[0], flags)) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } } // Enable denoising for the highest resolution stream, and for // the second highest resolution if we are doing more than 2 // spatial layers/streams. // TODO(holmer): Investigate possibility of adding a libvpx API // for getting the denoised frame from the encoder and using that // when encoding lower resolution streams. Would it work with the // multi-res encoding feature? denoiserState denoiser_state = kDenoiserOnYOnly; #if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) \ || defined(WEBRTC_ANDROID) denoiser_state = kDenoiserOnYOnly; #else denoiser_state = kDenoiserOnAdaptive; #endif vpx_codec_control(&encoders_[0], VP8E_SET_NOISE_SENSITIVITY, codec_.VP8()->denoisingOn ? denoiser_state : kDenoiserOff); if (encoders_.size() > 2) { vpx_codec_control( &encoders_[1], VP8E_SET_NOISE_SENSITIVITY, codec_.VP8()->denoisingOn ? denoiser_state : kDenoiserOff); } for (size_t i = 0; i < encoders_.size(); ++i) { // Allow more screen content to be detected as static. vpx_codec_control(&(encoders_[i]), VP8E_SET_STATIC_THRESHOLD, codec_.mode == kScreensharing ? 300 : 1); vpx_codec_control(&(encoders_[i]), VP8E_SET_CPUUSED, cpu_speed_[i]); vpx_codec_control(&(encoders_[i]), VP8E_SET_TOKEN_PARTITIONS, static_cast<vp8e_token_partitions>(kTokenPartitions)); vpx_codec_control(&(encoders_[i]), VP8E_SET_MAX_INTRA_BITRATE_PCT, rc_max_intra_target_); // VP8E_SET_SCREEN_CONTENT_MODE 2 = screen content with more aggressive // rate control (drop frames on large target bitrate overshoot) vpx_codec_control(&(encoders_[i]), VP8E_SET_SCREEN_CONTENT_MODE, codec_.mode == kScreensharing ? 2 : 0); // Apply boost on golden frames (has only effect when resilience is off). if (use_gf_boost_ && codec_.VP8()->resilience == kResilienceOff) { int gf_boost_percent; if (GetGfBoostPercentageFromFieldTrialGroup(&gf_boost_percent)) { vpx_codec_control(&(encoders_[i]), VP8E_SET_GF_CBR_BOOST_PCT, gf_boost_percent); } } } inited_ = true; return WEBRTC_VIDEO_CODEC_OK; } uint32_t VP8EncoderImpl::MaxIntraTarget(uint32_t optimalBuffersize) { // Set max to the optimal buffer level (normalized by target BR), // and scaled by a scalePar. // Max target size = scalePar * optimalBufferSize * targetBR[Kbps]. // This values is presented in percentage of perFrameBw: // perFrameBw = targetBR[Kbps] * 1000 / frameRate. // The target in % is as follows: float scalePar = 0.5; uint32_t targetPct = optimalBuffersize * scalePar * codec_.maxFramerate / 10; // Don't go below 3 times the per frame bandwidth. const uint32_t minIntraTh = 300; return (targetPct < minIntraTh) ? minIntraTh : targetPct; } int VP8EncoderImpl::Encode(const VideoFrame& frame, const CodecSpecificInfo* codec_specific_info, const std::vector<FrameType>* frame_types) { RTC_DCHECK_EQ(frame.width(), codec_.width); RTC_DCHECK_EQ(frame.height(), codec_.height); if (!inited_) return WEBRTC_VIDEO_CODEC_UNINITIALIZED; if (encoded_complete_callback_ == NULL) return WEBRTC_VIDEO_CODEC_UNINITIALIZED; rtc::scoped_refptr<I420BufferInterface> input_image = frame.video_frame_buffer()->ToI420(); // Since we are extracting raw pointers from |input_image| to // |raw_images_[0]|, the resolution of these frames must match. RTC_DCHECK_EQ(input_image->width(), raw_images_[0].d_w); RTC_DCHECK_EQ(input_image->height(), raw_images_[0].d_h); // Image in vpx_image_t format. // Input image is const. VP8's raw image is not defined as const. raw_images_[0].planes[VPX_PLANE_Y] = const_cast<uint8_t*>(input_image->DataY()); raw_images_[0].planes[VPX_PLANE_U] = const_cast<uint8_t*>(input_image->DataU()); raw_images_[0].planes[VPX_PLANE_V] = const_cast<uint8_t*>(input_image->DataV()); raw_images_[0].stride[VPX_PLANE_Y] = input_image->StrideY(); raw_images_[0].stride[VPX_PLANE_U] = input_image->StrideU(); raw_images_[0].stride[VPX_PLANE_V] = input_image->StrideV(); for (size_t i = 1; i < encoders_.size(); ++i) { // Scale the image down a number of times by downsampling factor libyuv::I420Scale( raw_images_[i - 1].planes[VPX_PLANE_Y], raw_images_[i - 1].stride[VPX_PLANE_Y], raw_images_[i - 1].planes[VPX_PLANE_U], raw_images_[i - 1].stride[VPX_PLANE_U], raw_images_[i - 1].planes[VPX_PLANE_V], raw_images_[i - 1].stride[VPX_PLANE_V], raw_images_[i - 1].d_w, raw_images_[i - 1].d_h, raw_images_[i].planes[VPX_PLANE_Y], raw_images_[i].stride[VPX_PLANE_Y], raw_images_[i].planes[VPX_PLANE_U], raw_images_[i].stride[VPX_PLANE_U], raw_images_[i].planes[VPX_PLANE_V], raw_images_[i].stride[VPX_PLANE_V], raw_images_[i].d_w, raw_images_[i].d_h, libyuv::kFilterBilinear); } bool send_key_frame = false; for (size_t i = 0; i < key_frame_request_.size() && i < send_stream_.size(); ++i) { if (key_frame_request_[i] && send_stream_[i]) { send_key_frame = true; break; } } if (!send_key_frame && frame_types) { for (size_t i = 0; i < frame_types->size() && i < send_stream_.size(); ++i) { if ((*frame_types)[i] == kVideoFrameKey && send_stream_[i]) { send_key_frame = true; break; } } } vpx_enc_frame_flags_t flags[kMaxSimulcastStreams]; TemporalLayers::FrameConfig tl_configs[kMaxSimulcastStreams]; for (size_t i = 0; i < encoders_.size(); ++i) { tl_configs[i] = temporal_layers_[i]->UpdateLayerConfig(frame.timestamp()); RTC_DCHECK(temporal_layers_checkers_[i]->CheckTemporalConfig( send_key_frame, tl_configs[i])); if (tl_configs[i].drop_frame) { // Drop this frame. return WEBRTC_VIDEO_CODEC_OK; } flags[i] = EncodeFlags(tl_configs[i]); } if (send_key_frame) { // Adapt the size of the key frame when in screenshare with 1 temporal // layer. if (encoders_.size() == 1 && codec_.mode == kScreensharing && codec_.VP8()->numberOfTemporalLayers <= 1) { const uint32_t forceKeyFrameIntraTh = 100; vpx_codec_control(&(encoders_[0]), VP8E_SET_MAX_INTRA_BITRATE_PCT, forceKeyFrameIntraTh); } // Key frame request from caller. // Will update both golden and alt-ref. for (size_t i = 0; i < encoders_.size(); ++i) { flags[i] = VPX_EFLAG_FORCE_KF; } std::fill(key_frame_request_.begin(), key_frame_request_.end(), false); } // Set the encoder frame flags and temporal layer_id for each spatial stream. // Note that |temporal_layers_| are defined starting from lowest resolution at // position 0 to highest resolution at position |encoders_.size() - 1|, // whereas |encoder_| is from highest to lowest resolution. size_t stream_idx = encoders_.size() - 1; for (size_t i = 0; i < encoders_.size(); ++i, --stream_idx) { // Allow the layers adapter to temporarily modify the configuration. This // change isn't stored in configurations_ so change will be discarded at // the next update. vpx_codec_enc_cfg_t temp_config; memcpy(&temp_config, &configurations_[i], sizeof(vpx_codec_enc_cfg_t)); if (temporal_layers_[stream_idx]->UpdateConfiguration(&temp_config)) { if (vpx_codec_enc_config_set(&encoders_[i], &temp_config)) return WEBRTC_VIDEO_CODEC_ERROR; } vpx_codec_control(&encoders_[i], VP8E_SET_FRAME_FLAGS, flags[stream_idx]); vpx_codec_control(&encoders_[i], VP8E_SET_TEMPORAL_LAYER_ID, tl_configs[i].encoder_layer_id); } // TODO(holmer): Ideally the duration should be the timestamp diff of this // frame and the next frame to be encoded, which we don't have. Instead we // would like to use the duration of the previous frame. Unfortunately the // rate control seems to be off with that setup. Using the average input // frame rate to calculate an average duration for now. assert(codec_.maxFramerate > 0); uint32_t duration = 90000 / codec_.maxFramerate; int error = WEBRTC_VIDEO_CODEC_OK; int num_tries = 0; // If the first try returns WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT // the frame must be reencoded with the same parameters again because // target bitrate is exceeded and encoder state has been reset. while (num_tries == 0 || (num_tries == 1 && error == WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT)) { ++num_tries; // Note we must pass 0 for |flags| field in encode call below since they are // set above in |vpx_codec_control| function for each encoder/spatial layer. error = vpx_codec_encode(&encoders_[0], &raw_images_[0], timestamp_, duration, 0, VPX_DL_REALTIME); // Reset specific intra frame thresholds, following the key frame. if (send_key_frame) { vpx_codec_control(&(encoders_[0]), VP8E_SET_MAX_INTRA_BITRATE_PCT, rc_max_intra_target_); } if (error) return WEBRTC_VIDEO_CODEC_ERROR; timestamp_ += duration; // Examines frame timestamps only. error = GetEncodedPartitions(tl_configs, frame); } return error; } void VP8EncoderImpl::PopulateCodecSpecific( CodecSpecificInfo* codec_specific, const TemporalLayers::FrameConfig& tl_config, const vpx_codec_cx_pkt_t& pkt, int stream_idx, uint32_t timestamp) { assert(codec_specific != NULL); codec_specific->codecType = kVideoCodecVP8; codec_specific->codec_name = ImplementationName(); CodecSpecificInfoVP8* vp8Info = &(codec_specific->codecSpecific.VP8); vp8Info->pictureId = picture_id_[stream_idx]; vp8Info->simulcastIdx = stream_idx; vp8Info->keyIdx = kNoKeyIdx; // TODO(hlundin) populate this vp8Info->nonReference = (pkt.data.frame.flags & VPX_FRAME_IS_DROPPABLE) != 0; temporal_layers_[stream_idx]->PopulateCodecSpecific( (pkt.data.frame.flags & VPX_FRAME_IS_KEY) != 0, tl_config, vp8Info, timestamp); // Prepare next. picture_id_[stream_idx] = (picture_id_[stream_idx] + 1) & 0x7FFF; } int VP8EncoderImpl::GetEncodedPartitions( const TemporalLayers::FrameConfig tl_configs[], const VideoFrame& input_image) { int bw_resolutions_disabled = (encoders_.size() > 1) ? NumStreamsDisabled(send_stream_) : -1; int stream_idx = static_cast<int>(encoders_.size()) - 1; int result = WEBRTC_VIDEO_CODEC_OK; for (size_t encoder_idx = 0; encoder_idx < encoders_.size(); ++encoder_idx, --stream_idx) { vpx_codec_iter_t iter = NULL; int part_idx = 0; encoded_images_[encoder_idx]._length = 0; encoded_images_[encoder_idx]._frameType = kVideoFrameDelta; RTPFragmentationHeader frag_info; // kTokenPartitions is number of bits used. frag_info.VerifyAndAllocateFragmentationHeader((1 << kTokenPartitions) + 1); CodecSpecificInfo codec_specific; const vpx_codec_cx_pkt_t* pkt = NULL; while ((pkt = vpx_codec_get_cx_data(&encoders_[encoder_idx], &iter)) != NULL) { switch (pkt->kind) { case VPX_CODEC_CX_FRAME_PKT: { size_t length = encoded_images_[encoder_idx]._length; if (pkt->data.frame.sz + length > encoded_images_[encoder_idx]._size) { uint8_t* buffer = new uint8_t[pkt->data.frame.sz + length]; memcpy(buffer, encoded_images_[encoder_idx]._buffer, length); delete[] encoded_images_[encoder_idx]._buffer; encoded_images_[encoder_idx]._buffer = buffer; encoded_images_[encoder_idx]._size = pkt->data.frame.sz + length; } memcpy(&encoded_images_[encoder_idx]._buffer[length], pkt->data.frame.buf, pkt->data.frame.sz); frag_info.fragmentationOffset[part_idx] = length; frag_info.fragmentationLength[part_idx] = pkt->data.frame.sz; frag_info.fragmentationPlType[part_idx] = 0; // not known here frag_info.fragmentationTimeDiff[part_idx] = 0; encoded_images_[encoder_idx]._length += pkt->data.frame.sz; assert(length <= encoded_images_[encoder_idx]._size); ++part_idx; break; } default: break; } // End of frame if ((pkt->data.frame.flags & VPX_FRAME_IS_FRAGMENT) == 0) { // check if encoded frame is a key frame if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) { encoded_images_[encoder_idx]._frameType = kVideoFrameKey; } PopulateCodecSpecific(&codec_specific, tl_configs[stream_idx], *pkt, stream_idx, input_image.timestamp()); break; } } encoded_images_[encoder_idx]._timeStamp = input_image.timestamp(); encoded_images_[encoder_idx].capture_time_ms_ = input_image.render_time_ms(); encoded_images_[encoder_idx].rotation_ = input_image.rotation(); encoded_images_[encoder_idx].content_type_ = (codec_.mode == kScreensharing) ? VideoContentType::SCREENSHARE : VideoContentType::UNSPECIFIED; encoded_images_[encoder_idx].timing_.flags = TimingFrameFlags::kInvalid; int qp = -1; vpx_codec_control(&encoders_[encoder_idx], VP8E_GET_LAST_QUANTIZER_64, &qp); temporal_layers_[stream_idx]->FrameEncoded( encoded_images_[encoder_idx]._length, qp); if (send_stream_[stream_idx]) { if (encoded_images_[encoder_idx]._length > 0) { TRACE_COUNTER_ID1("webrtc", "EncodedFrameSize", encoder_idx, encoded_images_[encoder_idx]._length); encoded_images_[encoder_idx]._encodedHeight = codec_.simulcastStream[stream_idx].height; encoded_images_[encoder_idx]._encodedWidth = codec_.simulcastStream[stream_idx].width; // Report once per frame (lowest stream always sent). encoded_images_[encoder_idx].adapt_reason_.bw_resolutions_disabled = (stream_idx == 0) ? bw_resolutions_disabled : -1; int qp_128 = -1; vpx_codec_control(&encoders_[encoder_idx], VP8E_GET_LAST_QUANTIZER, &qp_128); encoded_images_[encoder_idx].qp_ = qp_128; encoded_complete_callback_->OnEncodedImage(encoded_images_[encoder_idx], &codec_specific, &frag_info); } else if (codec_.mode == kScreensharing) { result = WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT; } } } return result; } VideoEncoder::ScalingSettings VP8EncoderImpl::GetScalingSettings() const { const bool enable_scaling = encoders_.size() == 1 && configurations_[0].rc_dropframe_thresh > 0 && codec_.VP8().automaticResizeOn; return VideoEncoder::ScalingSettings(enable_scaling); } int VP8EncoderImpl::SetChannelParameters(uint32_t packetLoss, int64_t rtt) { return WEBRTC_VIDEO_CODEC_OK; } int VP8EncoderImpl::RegisterEncodeCompleteCallback( EncodedImageCallback* callback) { encoded_complete_callback_ = callback; return WEBRTC_VIDEO_CODEC_OK; } class VP8DecoderImpl::QpSmoother { public: QpSmoother() : last_sample_ms_(rtc::TimeMillis()), smoother_(kAlpha) {} int GetAvg() const { float value = smoother_.filtered(); return (value == rtc::ExpFilter::kValueUndefined) ? 0 : static_cast<int>(value); } void Add(float sample) { int64_t now_ms = rtc::TimeMillis(); smoother_.Apply(static_cast<float>(now_ms - last_sample_ms_), sample); last_sample_ms_ = now_ms; } void Reset() { smoother_.Reset(kAlpha); } private: const float kAlpha = 0.95f; int64_t last_sample_ms_; rtc::ExpFilter smoother_; }; VP8DecoderImpl::VP8DecoderImpl() : use_postproc_arm_( webrtc::field_trial::IsEnabled(kVp8PostProcArmFieldTrial)), buffer_pool_(false, 300 /* max_number_of_buffers*/), decode_complete_callback_(NULL), inited_(false), decoder_(NULL), propagation_cnt_(-1), last_frame_width_(0), last_frame_height_(0), key_frame_required_(true), qp_smoother_(use_postproc_arm_ ? new QpSmoother() : nullptr) { if (use_postproc_arm_) GetPostProcParamsFromFieldTrialGroup(&deblock_); } VP8DecoderImpl::~VP8DecoderImpl() { inited_ = true; // in order to do the actual release Release(); } int VP8DecoderImpl::InitDecode(const VideoCodec* inst, int number_of_cores) { int ret_val = Release(); if (ret_val < 0) { return ret_val; } if (decoder_ == NULL) { decoder_ = new vpx_codec_ctx_t; memset(decoder_, 0, sizeof(*decoder_)); } vpx_codec_dec_cfg_t cfg; // Setting number of threads to a constant value (1) cfg.threads = 1; cfg.h = cfg.w = 0; // set after decode #if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) \ || defined(WEBRTC_ANDROID) vpx_codec_flags_t flags = use_postproc_arm_ ? VPX_CODEC_USE_POSTPROC : 0; #else vpx_codec_flags_t flags = VPX_CODEC_USE_POSTPROC; #endif if (vpx_codec_dec_init(decoder_, vpx_codec_vp8_dx(), &cfg, flags)) { delete decoder_; decoder_ = nullptr; return WEBRTC_VIDEO_CODEC_MEMORY; } propagation_cnt_ = -1; inited_ = true; // Always start with a complete key frame. key_frame_required_ = true; return WEBRTC_VIDEO_CODEC_OK; } int VP8DecoderImpl::Decode(const EncodedImage& input_image, bool missing_frames, const RTPFragmentationHeader* fragmentation, const CodecSpecificInfo* codec_specific_info, int64_t /*render_time_ms*/) { if (!inited_) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } if (decode_complete_callback_ == NULL) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } if (input_image._buffer == NULL && input_image._length > 0) { // Reset to avoid requesting key frames too often. if (propagation_cnt_ > 0) propagation_cnt_ = 0; return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; } // Post process configurations. #if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) \ || defined(WEBRTC_ANDROID) if (use_postproc_arm_) { vp8_postproc_cfg_t ppcfg; ppcfg.post_proc_flag = VP8_MFQE; // For low resolutions, use stronger deblocking filter. int last_width_x_height = last_frame_width_ * last_frame_height_; if (last_width_x_height > 0 && last_width_x_height <= 320 * 240) { // Enable the deblock and demacroblocker based on qp thresholds. RTC_DCHECK(qp_smoother_); int qp = qp_smoother_->GetAvg(); if (qp > deblock_.min_qp) { int level = deblock_.max_level; if (qp < deblock_.degrade_qp) { // Use lower level. level = deblock_.max_level * (qp - deblock_.min_qp) / (deblock_.degrade_qp - deblock_.min_qp); } // Deblocking level only affects VP8_DEMACROBLOCK. ppcfg.deblocking_level = std::max(level, 1); ppcfg.post_proc_flag |= VP8_DEBLOCK | VP8_DEMACROBLOCK; } } vpx_codec_control(decoder_, VP8_SET_POSTPROC, &ppcfg); } #else vp8_postproc_cfg_t ppcfg; // MFQE enabled to reduce key frame popping. ppcfg.post_proc_flag = VP8_MFQE | VP8_DEBLOCK; // For VGA resolutions and lower, enable the demacroblocker postproc. if (last_frame_width_ * last_frame_height_ <= 640 * 360) { ppcfg.post_proc_flag |= VP8_DEMACROBLOCK; } // Strength of deblocking filter. Valid range:[0,16] ppcfg.deblocking_level = 3; vpx_codec_control(decoder_, VP8_SET_POSTPROC, &ppcfg); #endif // Always start with a complete key frame. if (key_frame_required_) { if (input_image._frameType != kVideoFrameKey) return WEBRTC_VIDEO_CODEC_ERROR; // We have a key frame - is it complete? if (input_image._completeFrame) { key_frame_required_ = false; } else { return WEBRTC_VIDEO_CODEC_ERROR; } } // Restrict error propagation using key frame requests. // Reset on a key frame refresh. if (input_image._frameType == kVideoFrameKey && input_image._completeFrame) { propagation_cnt_ = -1; // Start count on first loss. } else if ((!input_image._completeFrame || missing_frames) && propagation_cnt_ == -1) { propagation_cnt_ = 0; } if (propagation_cnt_ >= 0) { propagation_cnt_++; } vpx_codec_iter_t iter = NULL; vpx_image_t* img; int ret; // Check for missing frames. if (missing_frames) { // Call decoder with zero data length to signal missing frames. if (vpx_codec_decode(decoder_, NULL, 0, 0, VPX_DL_REALTIME)) { // Reset to avoid requesting key frames too often. if (propagation_cnt_ > 0) propagation_cnt_ = 0; return WEBRTC_VIDEO_CODEC_ERROR; } img = vpx_codec_get_frame(decoder_, &iter); iter = NULL; } uint8_t* buffer = input_image._buffer; if (input_image._length == 0) { buffer = NULL; // Triggers full frame concealment. } if (vpx_codec_decode(decoder_, buffer, input_image._length, 0, VPX_DL_REALTIME)) { // Reset to avoid requesting key frames too often. if (propagation_cnt_ > 0) { propagation_cnt_ = 0; } return WEBRTC_VIDEO_CODEC_ERROR; } img = vpx_codec_get_frame(decoder_, &iter); int qp; vpx_codec_err_t vpx_ret = vpx_codec_control(decoder_, VPXD_GET_LAST_QUANTIZER, &qp); RTC_DCHECK_EQ(vpx_ret, VPX_CODEC_OK); ret = ReturnFrame(img, input_image._timeStamp, input_image.ntp_time_ms_, qp); if (ret != 0) { // Reset to avoid requesting key frames too often. if (ret < 0 && propagation_cnt_ > 0) propagation_cnt_ = 0; return ret; } // Check Vs. threshold if (propagation_cnt_ > kVp8ErrorPropagationTh) { // Reset to avoid requesting key frames too often. propagation_cnt_ = 0; return WEBRTC_VIDEO_CODEC_ERROR; } return WEBRTC_VIDEO_CODEC_OK; } int VP8DecoderImpl::ReturnFrame(const vpx_image_t* img, uint32_t timestamp, int64_t ntp_time_ms, int qp) { if (img == NULL) { // Decoder OK and NULL image => No show frame return WEBRTC_VIDEO_CODEC_NO_OUTPUT; } if (qp_smoother_) { if (last_frame_width_ != static_cast<int>(img->d_w) || last_frame_height_ != static_cast<int>(img->d_h)) { qp_smoother_->Reset(); } qp_smoother_->Add(qp); } last_frame_width_ = img->d_w; last_frame_height_ = img->d_h; // Allocate memory for decoded image. rtc::scoped_refptr<I420Buffer> buffer = buffer_pool_.CreateBuffer(img->d_w, img->d_h); if (!buffer.get()) { // Pool has too many pending frames. RTC_HISTOGRAM_BOOLEAN("WebRTC.Video.VP8DecoderImpl.TooManyPendingFrames", 1); return WEBRTC_VIDEO_CODEC_NO_OUTPUT; } libyuv::I420Copy(img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y], img->planes[VPX_PLANE_U], img->stride[VPX_PLANE_U], img->planes[VPX_PLANE_V], img->stride[VPX_PLANE_V], buffer->MutableDataY(), buffer->StrideY(), buffer->MutableDataU(), buffer->StrideU(), buffer->MutableDataV(), buffer->StrideV(), img->d_w, img->d_h); VideoFrame decoded_image(buffer, timestamp, 0, kVideoRotation_0); decoded_image.set_ntp_time_ms(ntp_time_ms); decode_complete_callback_->Decoded(decoded_image, rtc::nullopt, qp); return WEBRTC_VIDEO_CODEC_OK; } int VP8DecoderImpl::RegisterDecodeCompleteCallback( DecodedImageCallback* callback) { decode_complete_callback_ = callback; return WEBRTC_VIDEO_CODEC_OK; } int VP8DecoderImpl::Release() { if (decoder_ != NULL) { if (vpx_codec_destroy(decoder_)) { return WEBRTC_VIDEO_CODEC_MEMORY; } delete decoder_; decoder_ = NULL; } buffer_pool_.Release(); inited_ = false; return WEBRTC_VIDEO_CODEC_OK; } const char* VP8DecoderImpl::ImplementationName() const { return "libvpx"; } } // namespace webrtc
%define LoadImageEx (0x4065c0 - 0x116000) %define RegularExit_OslLoadDrivers (0x405b99 - 0x116000) %define SEGMENT_START (0x4c3000 - 0x116000) BITS 64 ; Y U NO ALL THE BITS? ; TO CALL TO BOOTY, you want JUMP 0x4c301b ;) SECTION .booty driverPath db "\SystemRoot\zomgdabest.sys", 0 ; since we're jumping here at the end of the function ; re-run the checks to see if we got here by regular exit ; ie don't run the below code if we were only gonna exit because of failure cmp rdi, r15 jnz cleanup cmp eax, ebx jnz cleanup mov rcx, SEGMENT_START + driverPath ;mov dword [rsp+0B8h+var_98], 0E0000013h ; in case warning was called, this gets wiped out nop nop nop nop nop nop nop nop mov r14, LoadImageEx call r14 cleanup: pop r15 pop r14 pop r13 pop r12 pop rdi pop rsi pop rbp retn
MODULE get_16bit_ap_parameter SECTION code_clib PUBLIC get_16bit_ap_parameter EXTERN __printf_issccz80 ; Change the arguments pointer, the delta is always 2, but is it +/-ve? ; Entry: de = ap ; Return: de = new ap ; hl = value ; Uses: ix get_16bit_ap_parameter: IF __CPU_GBZ80__ ld a,(de) ld l,a inc de ld a,(de) ld h,a ELSE ex de,hl ld e,(hl) inc hl ld d,(hl) ex de,hl ;de=ap+1 hl=to print ENDIF IF __CPU_INTEL__ | __CPU_GBZ80__ call __printf_issccz80 ELSE bit 0,(ix+6) ;sccz80 flag ENDIF jr nz,change_ap_decrement inc de ret change_ap_decrement: dec de dec de dec de ret
// Game_Music_Emu 0.6.0. http://www.slack.net/~ant/ #include "M3u_Playlist.h" #include "Music_Emu.h" #include <string.h> /* Copyright (C) 2006 Shay Green. This module 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 module 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 module; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "blargg_source.h" // gme functions defined here to avoid linking in m3u code unless it's used blargg_err_t Gme_File::load_m3u_( blargg_err_t err ) { require( raw_track_count_ ); // file must be loaded first if ( !err ) { if ( playlist.size() ) track_count_ = playlist.size(); int line = playlist.first_error(); if ( line ) { // avoid using bloated printf() char* out = &playlist_warning [sizeof playlist_warning]; *--out = 0; do { *--out = line % 10 + '0'; } while ( (line /= 10) > 0 ); static const char str [] = "Problem in m3u at line "; out -= sizeof str - 1; memcpy( out, str, sizeof str - 1 ); set_warning( out ); } } return err; } blargg_err_t Gme_File::load_m3u( const char* path ) { return load_m3u_( playlist.load( path ) ); } blargg_err_t Gme_File::load_m3u( Data_Reader& in ) { return load_m3u_( playlist.load( in ) ); } BLARGG_EXPORT gme_err_t gme_load_m3u( Music_Emu* me, const char* path ) { return me->load_m3u( path ); } BLARGG_EXPORT gme_err_t gme_load_m3u_data( Music_Emu* me, const void* data, long size ) { Mem_File_Reader in( data, size ); return me->load_m3u( in ); } static char* skip_white( char* in ) { while ( *in == ' ' ) in++; return in; } inline unsigned from_dec( unsigned n ) { return n - '0'; } static char* parse_filename( char* in, M3u_Playlist::entry_t& entry ) { entry.file = in; entry.type = ""; char* out = in; while ( 1 ) { int c = *in; if ( !c ) break; in++; if ( c == ',' ) // commas in filename { char* p = skip_white( in ); if ( *p == '$' || from_dec( *p ) <= 9 ) { in = p; break; } } if ( c == ':' && in [0] == ':' && in [1] && in [2] != ',' ) // ::type suffix { entry.type = ++in; while ( (c = *in) != 0 && c != ',' ) in++; if ( c == ',' ) { *in++ = 0; // terminate type in = skip_white( in ); } break; } if ( c == '\\' ) // \ prefix for special characters { c = *in; if ( !c ) break; in++; } *out++ = (char) c; } *out = 0; // terminate string return in; } static char* next_field( char* in, int* result ) { while ( 1 ) { in = skip_white( in ); if ( !*in ) break; if ( *in == ',' ) { in++; break; } *result = 1; in++; } return skip_white( in ); } static char* parse_int_( char* in, int* out ) { int n = 0; while ( 1 ) { unsigned d = from_dec( *in ); if ( d > 9 ) break; in++; n = n * 10 + d; *out = n; } return in; } static char* parse_int( char* in, int* out, int* result ) { return next_field( parse_int_( in, out ), result ); } // Returns 16 or greater if not hex inline int from_hex_char( int h ) { h -= 0x30; if ( (unsigned) h > 9 ) h = ((h - 0x11) & 0xDF) + 10; return h; } static char* parse_track( char* in, M3u_Playlist::entry_t& entry, int* result ) { if ( *in == '$' ) { in++; int n = 0; while ( 1 ) { int h = from_hex_char( *in ); if ( h > 15 ) break; in++; n = n * 16 + h; entry.track = n; } } else { in = parse_int_( in, &entry.track ); if ( entry.track >= 0 ) entry.decimal_track = 1; } return next_field( in, result ); } static char* parse_time_( char* in, int* out ) { *out = -1; int n = -1; in = parse_int_( in, &n ); if ( n >= 0 ) { *out = n; if ( *in == ':' ) { n = -1; in = parse_int_( in + 1, &n ); if ( n >= 0 ) *out = *out * 60 + n; } } return in; } static char* parse_time( char* in, int* out, int* result ) { return next_field( parse_time_( in, out ), result ); } static char* parse_name( char* in ) { char* out = in; while ( 1 ) { int c = *in; if ( !c ) break; in++; if ( c == ',' ) // commas in string { char* p = skip_white( in ); if ( *p == ',' || *p == '-' || from_dec( *p ) <= 9 ) { in = p; break; } } if ( c == '\\' ) // \ prefix for special characters { c = *in; if ( !c ) break; in++; } *out++ = (char) c; } *out = 0; // terminate string return in; } static int parse_line( char* in, M3u_Playlist::entry_t& entry ) { int result = 0; // file entry.file = in; entry.type = ""; in = parse_filename( in, entry ); // track entry.track = -1; entry.decimal_track = 0; in = parse_track( in, entry, &result ); // name entry.name = in; in = parse_name( in ); // time entry.length = -1; in = parse_time( in, &entry.length, &result ); // loop entry.intro = -1; entry.loop = -1; if ( *in == '-' ) { entry.loop = entry.length; in++; } else { in = parse_time_( in, &entry.loop ); if ( entry.loop >= 0 ) { entry.intro = 0; if ( *in == '-' ) // trailing '-' means that intro length was specified { in++; entry.intro = entry.loop; entry.loop = entry.length - entry.intro; } } } in = next_field( in, &result ); // fade entry.fade = -1; in = parse_time( in, &entry.fade, &result ); // repeat entry.repeat = -1; in = parse_int( in, &entry.repeat, &result ); return result; } static void parse_comment( char* in, M3u_Playlist::info_t& info, bool first ) { in = skip_white( in + 1 ); const char* field = in; while ( *in && *in != ':' ) in++; if ( *in == ':' ) { const char* text = skip_white( in + 1 ); if ( *text ) { *in = 0; if ( !strcmp( "Composer", field ) ) info.composer = text; else if ( !strcmp( "Engineer", field ) ) info.engineer = text; else if ( !strcmp( "Ripping" , field ) ) info.ripping = text; else if ( !strcmp( "Tagging" , field ) ) info.tagging = text; else text = 0; if ( text ) return; *in = ':'; } } if ( first ) info.title = field; } blargg_err_t M3u_Playlist::parse_() { info_.title = ""; info_.composer = ""; info_.engineer = ""; info_.ripping = ""; info_.tagging = ""; int const CR = 13; int const LF = 10; data.end() [-1] = LF; // terminate input first_error_ = 0; bool first_comment = true; int line = 0; int count = 0; char* in = data.begin(); while ( in < data.end() ) { // find end of line and terminate it line++; char* begin = in; while ( *in != CR && *in != LF ) { if ( !*in ) return "Not an m3u playlist"; in++; } if ( in [0] == CR && in [1] == LF ) // treat CR,LF as a single line *in++ = 0; *in++ = 0; // parse line if ( *begin == '#' ) { parse_comment( begin, info_, first_comment ); first_comment = false; } else if ( *begin ) { if ( (int) entries.size() <= count ) RETURN_ERR( entries.resize( count * 2 + 64 ) ); if ( !parse_line( begin, entries [count] ) ) count++; else if ( !first_error_ ) first_error_ = line; first_comment = false; } } if ( count <= 0 ) return "Not an m3u playlist"; if ( !(info_.composer [0] | info_.engineer [0] | info_.ripping [0] | info_.tagging [0]) ) info_.title = ""; return entries.resize( count ); } blargg_err_t M3u_Playlist::parse() { blargg_err_t err = parse_(); if ( err ) { entries.clear(); data.clear(); } return err; } blargg_err_t M3u_Playlist::load( Data_Reader& in ) { RETURN_ERR( data.resize( in.remain() + 1 ) ); RETURN_ERR( in.read( data.begin(), long(data.size() - 1) ) ); return parse(); } blargg_err_t M3u_Playlist::load( const char* path ) { GME_FILE_READER in; RETURN_ERR( in.open( path ) ); return load( in ); } blargg_err_t M3u_Playlist::load( void const* in, long size ) { RETURN_ERR( data.resize( size + 1 ) ); memcpy( data.begin(), in, size ); return parse(); }
; A312892: Coordination sequence Gal.5.50.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by Simon Strandgaard ; 1,4,9,13,17,21,25,29,33,38,42,46,51,55,59,63,67,71,75,80,84,88,93,97,101,105,109,113,117,122,126,130,135,139,143,147,151,155,159,164,168,172,177,181,185,189,193,197,201,206 mov $1,1 mov $4,$0 mul $4,2 mov $5,$0 lpb $0 mov $0,$4 mov $2,$4 div $2,2 add $2,15 mod $2,10 add $0,$2 div $0,10 div $1,2 lpe mov $3,$5 mul $3,4 add $1,$3 add $0,$1
; A070598: n^5 mod 13. ; 0,1,6,9,10,5,2,11,8,3,4,7,12,0,1,6,9,10,5,2,11,8,3,4,7,12,0,1,6,9,10,5,2,11,8,3,4,7,12,0,1,6,9,10,5,2,11,8,3,4,7,12,0,1,6,9,10,5,2,11,8,3,4,7,12,0,1,6,9,10,5,2,11,8,3,4,7,12,0,1,6,9,10,5,2,11,8,3,4,7,12,0,1 pow $0,5 mod $0,13
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // 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 AESGCMGMAC_Types.cpp */ #include <fastrtps_deprecated/security/cryptography/AESGCMGMAC_Types.h> using namespace eprosima::fastrtps::rtps::security; const char* const ParticipantKeyHandle::class_id_ = "ParticipantCryptohandle"; const char * const EntityKeyHandle::class_id_ = "EntityCryptohandle";
// 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.IDisposable #include "System/IDisposable.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Begin forward declares // Forward declaring namespace: UnityEngine namespace UnityEngine { // Forward declaring type: Color struct Color; } // Forward declaring namespace: GlobalNamespace namespace GlobalNamespace { // Forward declaring type: MockPlayerGamePoseGenerator class MockPlayerGamePoseGenerator; // Forward declaring type: IMultiplayerSessionManager class IMultiplayerSessionManager; // Forward declaring type: IGameplayRpcManager class IGameplayRpcManager; // Forward declaring type: IMenuRpcManager class IMenuRpcManager; // Forward declaring type: IMockBeatmapDataProvider class IMockBeatmapDataProvider; // Forward declaring type: MockPlayerLobbyPoseGenerator class MockPlayerLobbyPoseGenerator; } // Completed forward declares // Type namespace: namespace GlobalNamespace { // Forward declaring type: MockPlayerFiniteStateMachine class MockPlayerFiniteStateMachine; } #include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp" NEED_NO_BOX(::GlobalNamespace::MockPlayerFiniteStateMachine); DEFINE_IL2CPP_ARG_TYPE(::GlobalNamespace::MockPlayerFiniteStateMachine*, "", "MockPlayerFiniteStateMachine"); // Type namespace: namespace GlobalNamespace { // Size: 0x10 #pragma pack(push, 1) // Autogenerated type: MockPlayerFiniteStateMachine // [TokenAttribute] Offset: FFFFFFFF class MockPlayerFiniteStateMachine : public ::Il2CppObject/*, public ::System::IDisposable*/ { public: // Creating interface conversion operator: operator ::System::IDisposable operator ::System::IDisposable() noexcept { return *reinterpret_cast<::System::IDisposable*>(this); } // public UnityEngine.Color get_saberAColor() // Offset: 0x2A51540 ::UnityEngine::Color get_saberAColor(); // public System.Void set_saberAColor(UnityEngine.Color value) // Offset: 0x2A51548 void set_saberAColor(::UnityEngine::Color value); // public UnityEngine.Color get_saberBColor() // Offset: 0x2A5154C ::UnityEngine::Color get_saberBColor(); // public System.Void set_saberBColor(UnityEngine.Color value) // Offset: 0x2A51554 void set_saberBColor(::UnityEngine::Color value); // public UnityEngine.Color get_obstaclesColor() // Offset: 0x2A51558 ::UnityEngine::Color get_obstaclesColor(); // public System.Void set_obstaclesColor(UnityEngine.Color value) // Offset: 0x2A51560 void set_obstaclesColor(::UnityEngine::Color value); // public System.Boolean get_leftHanded() // Offset: 0x2A51564 bool get_leftHanded(); // public System.Void set_leftHanded(System.Boolean value) // Offset: 0x2A5156C void set_leftHanded(bool value); // public System.Boolean get_inactiveByDefault() // Offset: 0x2A51570 bool get_inactiveByDefault(); // public System.Void set_inactiveByDefault(System.Boolean value) // Offset: 0x2A51578 void set_inactiveByDefault(bool value); // public MockPlayerGamePoseGenerator get_gamePoseGenerator() // Offset: 0x2A5157C ::GlobalNamespace::MockPlayerGamePoseGenerator* get_gamePoseGenerator(); // public System.Void .ctor(IMultiplayerSessionManager multiplayerSessionManager, IGameplayRpcManager gameplayRpcManager, IMenuRpcManager menuRpcManager, IMockBeatmapDataProvider beatmapDataProvider, MockPlayerLobbyPoseGenerator lobbyPoseGenerator, MockPlayerGamePoseGenerator gamePoseGenerator) // Offset: 0x2A51538 template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static MockPlayerFiniteStateMachine* New_ctor(::GlobalNamespace::IMultiplayerSessionManager* multiplayerSessionManager, ::GlobalNamespace::IGameplayRpcManager* gameplayRpcManager, ::GlobalNamespace::IMenuRpcManager* menuRpcManager, ::GlobalNamespace::IMockBeatmapDataProvider* beatmapDataProvider, ::GlobalNamespace::MockPlayerLobbyPoseGenerator* lobbyPoseGenerator, ::GlobalNamespace::MockPlayerGamePoseGenerator* gamePoseGenerator) { static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerFiniteStateMachine::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<MockPlayerFiniteStateMachine*, creationType>(multiplayerSessionManager, gameplayRpcManager, menuRpcManager, beatmapDataProvider, lobbyPoseGenerator, gamePoseGenerator))); } // public System.Void Dispose() // Offset: 0x2A51584 void Dispose(); // public System.Void SetIsReady(System.Boolean isReady) // Offset: 0x2A51588 void SetIsReady(bool isReady); }; // MockPlayerFiniteStateMachine #pragma pack(pop) } #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::get_saberAColor // Il2CppName: get_saberAColor template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::UnityEngine::Color (GlobalNamespace::MockPlayerFiniteStateMachine::*)()>(&GlobalNamespace::MockPlayerFiniteStateMachine::get_saberAColor)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "get_saberAColor", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::set_saberAColor // Il2CppName: set_saberAColor template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::MockPlayerFiniteStateMachine::*)(::UnityEngine::Color)>(&GlobalNamespace::MockPlayerFiniteStateMachine::set_saberAColor)> { static const MethodInfo* get() { static auto* value = &::il2cpp_utils::GetClassFromName("UnityEngine", "Color")->byval_arg; return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "set_saberAColor", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::get_saberBColor // Il2CppName: get_saberBColor template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::UnityEngine::Color (GlobalNamespace::MockPlayerFiniteStateMachine::*)()>(&GlobalNamespace::MockPlayerFiniteStateMachine::get_saberBColor)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "get_saberBColor", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::set_saberBColor // Il2CppName: set_saberBColor template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::MockPlayerFiniteStateMachine::*)(::UnityEngine::Color)>(&GlobalNamespace::MockPlayerFiniteStateMachine::set_saberBColor)> { static const MethodInfo* get() { static auto* value = &::il2cpp_utils::GetClassFromName("UnityEngine", "Color")->byval_arg; return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "set_saberBColor", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::get_obstaclesColor // Il2CppName: get_obstaclesColor template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::UnityEngine::Color (GlobalNamespace::MockPlayerFiniteStateMachine::*)()>(&GlobalNamespace::MockPlayerFiniteStateMachine::get_obstaclesColor)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "get_obstaclesColor", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::set_obstaclesColor // Il2CppName: set_obstaclesColor template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::MockPlayerFiniteStateMachine::*)(::UnityEngine::Color)>(&GlobalNamespace::MockPlayerFiniteStateMachine::set_obstaclesColor)> { static const MethodInfo* get() { static auto* value = &::il2cpp_utils::GetClassFromName("UnityEngine", "Color")->byval_arg; return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "set_obstaclesColor", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::get_leftHanded // Il2CppName: get_leftHanded template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::MockPlayerFiniteStateMachine::*)()>(&GlobalNamespace::MockPlayerFiniteStateMachine::get_leftHanded)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "get_leftHanded", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::set_leftHanded // Il2CppName: set_leftHanded template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::MockPlayerFiniteStateMachine::*)(bool)>(&GlobalNamespace::MockPlayerFiniteStateMachine::set_leftHanded)> { static const MethodInfo* get() { static auto* value = &::il2cpp_utils::GetClassFromName("System", "Boolean")->byval_arg; return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "set_leftHanded", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::get_inactiveByDefault // Il2CppName: get_inactiveByDefault template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::MockPlayerFiniteStateMachine::*)()>(&GlobalNamespace::MockPlayerFiniteStateMachine::get_inactiveByDefault)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "get_inactiveByDefault", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::set_inactiveByDefault // Il2CppName: set_inactiveByDefault template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::MockPlayerFiniteStateMachine::*)(bool)>(&GlobalNamespace::MockPlayerFiniteStateMachine::set_inactiveByDefault)> { static const MethodInfo* get() { static auto* value = &::il2cpp_utils::GetClassFromName("System", "Boolean")->byval_arg; return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "set_inactiveByDefault", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::get_gamePoseGenerator // Il2CppName: get_gamePoseGenerator template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::GlobalNamespace::MockPlayerGamePoseGenerator* (GlobalNamespace::MockPlayerFiniteStateMachine::*)()>(&GlobalNamespace::MockPlayerFiniteStateMachine::get_gamePoseGenerator)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "get_gamePoseGenerator", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::New_ctor // Il2CppName: .ctor // Cannot get method pointer of value based method overload from template for constructor! // Try using FindMethod instead! // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::Dispose // Il2CppName: Dispose template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::MockPlayerFiniteStateMachine::*)()>(&GlobalNamespace::MockPlayerFiniteStateMachine::Dispose)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "Dispose", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::MockPlayerFiniteStateMachine::SetIsReady // Il2CppName: SetIsReady template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::MockPlayerFiniteStateMachine::*)(bool)>(&GlobalNamespace::MockPlayerFiniteStateMachine::SetIsReady)> { static const MethodInfo* get() { static auto* isReady = &::il2cpp_utils::GetClassFromName("System", "Boolean")->byval_arg; return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::MockPlayerFiniteStateMachine*), "SetIsReady", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{isReady}); } };
Name: zel_move.asm Type: file Size: 26568 Last-Modified: '2016-05-13T04:36:32Z' SHA-1: DEAAFA7BF364888045CAC75FC0B5ABB57787154B Description: null
; A013656: n*(9*n-2). ; 0,7,32,75,136,215,312,427,560,711,880,1067,1272,1495,1736,1995,2272,2567,2880,3211,3560,3927,4312,4715,5136,5575,6032,6507,7000,7511,8040,8587,9152,9735,10336,10955,11592,12247,12920,13611,14320,15047,15792,16555 mov $1,$0 mul $0,9 sub $0,2 mul $1,$0
; A145978: Expansion of 1/(1-x*(1-8*x)). ; 1,1,-7,-15,41,161,-167,-1455,-119,11521,12473,-79695,-179479,458081,1893913,-1770735,-16922039,-2756159,132620153,154669425,-906291799,-2143647199,5106687193,22255864785,-18597632759,-196644551039,-47863488967,1525292919345,1908200831081,-10294142523679,-25559749172327,56793391017105,261271384395721,-193075743741119,-2283246818906887,-738640868977935,17527333682277161,23436460634100641,-116782208824116647,-304273893896921775,629983776696011401,3064174927871385601,-1975695285696705607 mul $0,2 mov $1,1 lpb $0 sub $0,2 sub $1,$2 add $2,$1 mul $2,8 lpe mov $0,$1
// <PhasedSingleCycleUniqueEvent.h> -*- C++ -*- /** * \file PhasedSingleCycleUniqueEvent.h * * \brief File that defines the PhasedSingleCycleUniqueEvent class */ #ifndef __PHASED_SINGLE_CYCLE_UNIQUE_EVENT_H__ #define __PHASED_SINGLE_CYCLE_UNIQUE_EVENT_H__ #include <array> #include <memory> #include <string> #include "sparta/simulation/TreeNode.hpp" #include "sparta/kernel/SpartaHandler.hpp" #include "sparta/simulation/Clock.hpp" #include "sparta/kernel/Scheduler.hpp" #include "sparta/events/EventNode.hpp" #include "sparta/events/Scheduleable.hpp" namespace sparta { /** * \class PhasedSingleCycleUniqueEvent * \brief An event that can only be schedule one cycle into the future * * Analysis shows that modelers using UniqueEvent typically * schedule the event either the same cycle or exactly one cycle * into the future. UniqueEvent is a bit costly in performance due * to the fact that it needs to check with the Scheduler to see if * it's already scheduled at the given time. It is discouraged to * use this class directly -- use SingleCycleUniqueEvent * templatized on the SchedulingPhase * * See \ref sparta::SingleCycleUniqueEvent for examples. */ class PhasedSingleCycleUniqueEvent : public EventNode { public: /** * \brief Create a PhasedSingleCycleUniqueEvent. * * \param event_set The EventSet this PhasedSingleCycleUniqueEvent belongs to * \param name The name of this event (as it shows in the EventSet) * \param consumer_event_handler A SpartaHandler to the consumer's event_handler * * Create a PhasedSingleCycleUniqueEvent that will only * be scheduled only once per clock phase, exactly 1 clock * cycle in the future, no matter how many times this * PhasedSingleCycleUniqueEvent is scheduled. */ PhasedSingleCycleUniqueEvent(TreeNode * event_set, const std::string & name, SchedulingPhase sched_phase, const SpartaHandler & consumer_event_handler) : EventNode(event_set, name, sched_phase), local_clk_(getClock()), fancy_name_(name + "[" + consumer_event_handler.getName() + "]"), single_cycle_event_scheduleable_(consumer_event_handler, 1 /*HARD CODED*/, sched_phase) { single_cycle_event_scheduleable_.setScheduleableClock(getClock()); single_cycle_event_scheduleable_.setLabel(fancy_name_.c_str()); } //! Disallow the copying of the PhasedSingleCycleUniqueEvent PhasedSingleCycleUniqueEvent(const PhasedSingleCycleUniqueEvent &) = delete; //! Disallow the assignment of the PhasedSingleCycleUniqueEvent PhasedSingleCycleUniqueEvent& operator=(const PhasedSingleCycleUniqueEvent &) = delete; //! Set the internal Scheduleable continuing //! \param continuing True if this event should keep simulation alive void setContinuing(bool continuing) { single_cycle_event_scheduleable_.setContinuing(continuing); } /** * \brief Is this Event continuing? * \return true if it will keep the scheduler alive */ bool isContinuing() const { return single_cycle_event_scheduleable_.isContinuing(); } /*! * \brief Cancel the event for now and one cycle into the future */ void cancel() { single_cycle_event_scheduleable_.cancel(); } /*! * \brief Return true if this scheduleable was scheduled at all * \return true if scheduled at all * * This is an expensive call as it searches all time quantums * for instances of this Scheduleable object. Use with care. */ bool isScheduled() const { return single_cycle_event_scheduleable_.isScheduled(); } //! Uniquely destroy virtual ~PhasedSingleCycleUniqueEvent() = default; //! Tell callers which method to use for getting the SchedulingPhase using EventNode::getSchedulingPhase; /*! * \brief Schedule this PhasedSingleCycleUniqueEvent exactly * zero or one cycle into the future. This is the only * schedule call allowed * * \param rel_cycle Either 0 (default) or 1. Cannot be * anything but 0 or 1 * */ void schedule(Clock::Cycle rel_cycle = 0) { sparta_assert(rel_cycle < 2, "Cannot schedule sparta::SingleCycleUniqueEvent:'" << getName() << "' in any relative time other than 0 or 1. rel_cycle given: " << rel_cycle); const auto to_be_scheduled_relative_tick = local_clk_->getTick(Clock::Cycle(rel_cycle)); const auto to_be_scheduled_abs_tick = local_scheduler_->calcIndexTime(to_be_scheduled_relative_tick); if(SPARTA_EXPECT_TRUE(next_scheduled_tick_ < to_be_scheduled_abs_tick)) { // This is a handy debug assertion to see if // SingleCycleUniqueEvent is actually only scheduled once. // // sparta_assert(single_cycle_event_scheduleable_.isScheduled(rel_cycle) == false); single_cycle_event_scheduleable_. scheduleRelativeTick(to_be_scheduled_relative_tick, local_scheduler_); prev_scheduled_tick_ = next_scheduled_tick_; next_scheduled_tick_ = to_be_scheduled_abs_tick; } else if(to_be_scheduled_abs_tick < next_scheduled_tick_) { if(prev_scheduled_tick_ != to_be_scheduled_abs_tick) { // This is a handy debug assertion to see if // SingleCycleUniqueEvent is actually only scheduled once. // // sparta_assert(single_cycle_event_scheduleable_.isScheduled(rel_cycle) == false); single_cycle_event_scheduleable_. scheduleRelativeTick(to_be_scheduled_relative_tick, local_scheduler_); prev_scheduled_tick_ = to_be_scheduled_relative_tick; } } } #ifndef DO_NOT_DOCUMENT // Used by EventNode and auto-precedence. Return the // Scheduleable (this) Scheduleable & getScheduleable() override { return single_cycle_event_scheduleable_; } #endif private: //! Called by the framework on all TreeNodes void createResource_() override { local_clk_ = getClock(); local_scheduler_ = local_clk_->getScheduler(); } //! A local clock for speed const Clock * local_clk_ = nullptr; //! A local scheduler for speed Scheduler * local_scheduler_ = nullptr; //! The last time this PhasedSingleCycleUniqueEvent was scheduled (rel cycle == [0,1]) //std::array<Scheduler::Tick, 2> next_scheduled_tick_ = {0, 0}; Scheduler::Tick next_scheduled_tick_ = 0; Scheduler::Tick prev_scheduled_tick_ = 0; //! A fancy name for the event handler std::string fancy_name_; //! The actual scheduled item on the scheduler Scheduleable single_cycle_event_scheduleable_; }; } // __UNIQUE_EVENT_H__ #endif
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_A_ht+0x40aa, %rsi lea addresses_D_ht+0x14aa, %rdi sub %r13, %r13 mov $89, %rcx rep movsq nop inc %rax lea addresses_WT_ht+0x1b6aa, %rsi lea addresses_WC_ht+0xd94a, %rdi nop add %r9, %r9 mov $41, %rcx rep movsl nop nop nop nop cmp $25808, %rax lea addresses_D_ht+0x1272a, %rcx nop nop nop nop nop sub $43222, %r12 movups (%rcx), %xmm2 vpextrq $0, %xmm2, %rax nop nop nop cmp %r13, %r13 lea addresses_UC_ht+0x36aa, %rdi xor $32649, %rax movups (%rdi), %xmm4 vpextrq $0, %xmm4, %r12 nop sub $22355, %rsi lea addresses_WC_ht+0x21ea, %rsi lea addresses_A_ht+0x107a, %rdi nop cmp $1049, %r11 mov $94, %rcx rep movsb nop nop nop nop nop cmp $6041, %r9 lea addresses_WC_ht+0xdc26, %rsi nop nop nop nop add %r9, %r9 mov $0x6162636465666768, %r11 movq %r11, %xmm6 vmovups %ymm6, (%rsi) nop nop nop nop xor $62749, %r9 lea addresses_WT_ht+0x5aaa, %r13 and %rsi, %rsi mov $0x6162636465666768, %r11 movq %r11, %xmm7 and $0xffffffffffffffc0, %r13 vmovntdq %ymm7, (%r13) nop nop nop nop and %rcx, %rcx lea addresses_WC_ht+0xf20a, %r11 nop lfence movb $0x61, (%r11) nop nop inc %rcx lea addresses_A_ht+0x1062a, %rsi lea addresses_A_ht+0x1c1aa, %rdi nop dec %r11 mov $68, %rcx rep movsq add %r11, %r11 lea addresses_A_ht+0x13d3a, %rcx cmp $31618, %r13 vmovups (%rcx), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $1, %xmm4, %r11 nop nop nop sub %r11, %r11 lea addresses_D_ht+0x1dd7a, %rsi lea addresses_UC_ht+0x174aa, %rdi nop nop xor $57590, %r9 mov $102, %rcx rep movsq nop nop nop nop nop add $55510, %r13 lea addresses_WT_ht+0x1c4aa, %rsi lea addresses_D_ht+0xcaa, %rdi nop add $31573, %r11 mov $11, %rcx rep movsb nop nop nop cmp %r11, %r11 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r8 push %rbp push %rcx push %rdi push %rdx push %rsi // REPMOV lea addresses_UC+0x1ba6a, %rsi lea addresses_D+0x270, %rdi nop nop nop nop nop and $44971, %r11 mov $70, %rcx rep movsq nop nop nop and $25705, %rsi // Store lea addresses_normal+0x44aa, %rdx nop nop nop nop nop and %r8, %r8 movb $0x51, (%rdx) nop nop sub $64461, %rsi // Store lea addresses_UC+0x1a38a, %r8 nop nop and %rcx, %rcx movw $0x5152, (%r8) nop nop nop xor %r11, %r11 // Faulty Load lea addresses_US+0x13caa, %rcx nop nop nop nop sub %r8, %r8 movb (%rcx), %r11b lea oracles, %rdx and $0xff, %r11 shlq $12, %r11 mov (%rdx,%r11,1), %r11 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r8 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_normal', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_US', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'same': True, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 9, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, '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 */
/* Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of GCC. GCC 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, or (at your option) any later version. In addition to the permissions in the GNU General Public License, the Free Software Foundation gives you unlimited permission to link the compiled version of this file into combinations with other programs, and to distribute those combinations without any restriction coming from the use of this file. (The General Public License restrictions do apply in other respects; for example, they cover modification of the file, and distribution when not linked into a combine executable.) GCC 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; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* The code in sections .init and .fini is supposed to be a single regular function. The function in .init is called directly from start in crt0.asm. The function in .fini is atexit()ed in crt0.asm too. crti.asm contributes the prologue of a function to these sections, and crtn.asm comes up the epilogue. STARTFILE_SPEC should list crti.o before any other object files that might add code to .init or .fini sections, and ENDFILE_SPEC should list crtn.o after any such object files. */ #ifdef __H8300H__ #ifdef __NORMAL_MODE__ .h8300hn #else .h8300h #endif #endif #ifdef __H8300S__ #ifdef __NORMAL_MODE__ .h8300sn #else .h8300s #endif #endif #ifdef __H8300SX__ #ifdef __NORMAL_MODE__ .h8300sxn #else .h8300sx #endif #endif .section .init .global __init __init: .section .fini .global __fini __fini:
;********************************************************** ; This program to receive a character from the PC and return (send) next character to PC again. ;********************************************************** include "p16f877A.inc" __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _XT_OSC ;********************************************************** ; User-defined variables cblock 0x20 WTemp ; Must be reserved in all banks StatusTemp counter endc cblock 0x0A0 ; bank 1 assignnments WTemp1 ; bank 1 WTemp endc cblock 0x120 ; bank 2 assignnments WTemp2 ; bank 2 WTemp endc cblock 0x1A0 ; bank 3 assignnments WTemp3 ; bank 3 WTemp endc ;********************************************************** ; Macro Assignments push macro movwf WTemp ;WTemp must be reserved in all banks swapf STATUS,W ;store in W without affecting status bits banksel StatusTemp ;select StatusTemp bank movwf StatusTemp ;save STATUS endm pop macro banksel StatusTemp ;point to StatusTemp bank swapf StatusTemp,W ;unswap STATUS nybbles into W movwf STATUS ;restore STATUS (which points to where W was stored) swapf WTemp,F ;unswap W nybbles swapf WTemp,W ;restore W without affecting STATUS endm ;********************************************************** ; Start of executable code org 0x00 ; Reset vector nop goto Main ;********************************************************** ; Interrupt vector org 0x04 ; interrupt vector goto IntService ;********************************************************** ; Main program Main call Initial ; Initialize everything MainLoop nop nop goto MainLoop ; Do it again ;********************************************************** ; Initial Routine Initial movlw D'25' ; This sets the baud rate to 9600 banksel SPBRG ; assuming BRGH=1 and Fosc=4.000 MHz movwf SPBRG banksel RCSTA bsf RCSTA,SPEN ; Enable the serial port bcf RCSTA,RX9 ; Disable9-bit Receive bsf RCSTA,CREN ; Enable continuous receive banksel TXSTA bcf TXSTA,SYNC ; Set up the port for asynchronous operation bsf TXSTA,TXEN ; Transmit enabled bsf TXSTA,BRGH ; High baud rate bcf TXSTA,TX9 ; Disable9-bit send banksel PIE1 ; Enable the Timer2 interrupt bsf PIE1, RCIE bcf TRISC,RC6 ; Set RC6 to output Send Pin bsf TRISC,RC7 ; Set RC7 to input Receive Pin banksel INTCON ; Enable global and peripheral interrupts bsf INTCON, GIE bsf INTCON, PEIE banksel counter clrf counter banksel TRISB clrf TRISB banksel PORTB clrf PORTB return ;********************************************************** ; Interrupt Service Routine ; This routine is called whenever we get an interrupt. IntService push btfsc PIR1, RCIF ; Check for a Timer2 interrupt call RECEIVE ; btfsc ... ; Check for another interrupt ; call ... ; btfsc ... ; Check for another interrupt ; call ... pop retfie ;********************************************************** RECEIVE movf RCREG,w movf RCREG,w movwf counter sublw 0x43 btfsc STATUS,C goto ONE movf counter,0 sublw 0x46 btfsc STATUS,C goto TWO movf counter,0 sublw 0x49 btfsc STATUS,C goto THREE movf counter,0 sublw 0x4C btfsc STATUS,C goto FOUR movf counter,0 sublw 0x4F btfsc STATUS,C goto FIVE movf counter,0 sublw 0x52 btfsc STATUS,C goto SIX movf counter,0 sublw 0x55 btfsc STATUS,C goto SEVEN movf counter,0 sublw 0x58 btfsc STATUS,C goto EIGHT movf counter,0 sublw 0x5A btfsc STATUS,C goto NINE movlw 0 movwf counter FINISH call look_up banksel PORTB movwf PORTB return ONE movlw 1 movwf counter goto FINISH TWO movlw 2 movwf counter goto FINISH THREE movlw 3 movwf counter goto FINISH FOUR movlw 4 movwf counter goto FINISH FIVE movlw 5 movwf counter goto FINISH SIX movlw 6 movwf counter goto FINISH SEVEN movlw 7 movwf counter goto FINISH EIGHT movlw 8 movwf counter goto FINISH NINE movlw 9 movwf counter goto FINISH look_up movf counter,0 addwf PCL,1 retlw b'00111111' ;0 retlw b'00000110' ;1 retlw b'01011011' ;2 retlw b'01001111' ;3 retlw b'01100110' ;4 retlw b'01101101' ;5 retlw b'01111101' ;6 retlw b'00000111' ;7 retlw b'01111111' ;8 retlw b'01100111' ;9 end
############################################################################### # Copyright 2018 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### .section .note.GNU-stack,"",%progbits .text .p2align 4, 0x90 .globl y8_cpMontRedAdc_BNU .type y8_cpMontRedAdc_BNU, @function y8_cpMontRedAdc_BNU: push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 sub $(40), %rsp movq $(0), (16)(%rsp) movslq %ecx, %rcx mov %r8, %r15 cmp $(5), %rcx jge .Lgeneral_casegas_1 cmp $(3), %rcx ja .LmSize_4gas_1 jz .LmSize_3gas_1 jp .LmSize_2gas_1 .p2align 4, 0x90 .LmSize_1gas_1: movq (%rsi), %r8 movq (8)(%rsi), %r9 mov %rdx, %rsi mov %r8, %rbp imul %r15, %rbp movq (%rsi), %rax mul %rbp xor %rbx, %rbx add %rax, %r8 adc %rdx, %r9 adc $(0), %rbx addq (16)(%rsp), %r9 adc $(0), %rbx movq %rbx, (16)(%rsp) mov %r9, %r8 subq (%rsi), %r9 sbb $(0), %rbx cmovc %r8, %r9 movq %r9, (%rdi) jmp .Lquitgas_1 .p2align 4, 0x90 .LmSize_2gas_1: movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 mov %rdx, %rsi mov %r8, %rbp imul %r15, %rbp movq (%rsi), %rax mul %rbp xor %rbx, %rbx add %rax, %r8 movq (8)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r9 adc $(0), %rdx xor %rbx, %rbx add %rax, %r9 adc %rdx, %r10 adc $(0), %rbx addq (16)(%rsp), %r10 adc $(0), %rbx movq %rbx, (16)(%rsp) mov %r9, %rbp imul %r15, %rbp movq (%rsi), %rax mul %rbp xor %rbx, %rbx add %rax, %r9 movq (8)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r10 adc $(0), %rdx xor %rbx, %rbx add %rax, %r10 adc %rdx, %r11 adc $(0), %rbx addq (16)(%rsp), %r11 adc $(0), %rbx movq %rbx, (16)(%rsp) mov %r10, %r8 subq (%rsi), %r10 mov %r11, %r9 sbbq (8)(%rsi), %r11 sbb $(0), %rbx cmovc %r8, %r10 movq %r10, (%rdi) cmovc %r9, %r11 movq %r11, (8)(%rdi) jmp .Lquitgas_1 .p2align 4, 0x90 .LmSize_3gas_1: movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 movq (32)(%rsi), %r12 movq (40)(%rsi), %r13 mov %rdx, %rsi mov %r8, %rbp imul %r15, %rbp movq (%rsi), %rax mul %rbp xor %rbx, %rbx add %rax, %r8 movq (8)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r9 adc $(0), %rdx xor %rbx, %rbx add %rax, %r9 movq (16)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r10 adc $(0), %rdx xor %rbx, %rbx add %rax, %r10 adc %rdx, %r11 adc $(0), %rbx addq (16)(%rsp), %r11 adc $(0), %rbx movq %rbx, (16)(%rsp) mov %r9, %rbp imul %r15, %rbp movq (%rsi), %rax mul %rbp xor %rbx, %rbx add %rax, %r9 movq (8)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r10 adc $(0), %rdx xor %rbx, %rbx add %rax, %r10 movq (16)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r11 adc $(0), %rdx xor %rbx, %rbx add %rax, %r11 adc %rdx, %r12 adc $(0), %rbx addq (16)(%rsp), %r12 adc $(0), %rbx movq %rbx, (16)(%rsp) mov %r10, %rbp imul %r15, %rbp movq (%rsi), %rax mul %rbp xor %rbx, %rbx add %rax, %r10 movq (8)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r11 adc $(0), %rdx xor %rbx, %rbx add %rax, %r11 movq (16)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r12 adc $(0), %rdx xor %rbx, %rbx add %rax, %r12 adc %rdx, %r13 adc $(0), %rbx addq (16)(%rsp), %r13 adc $(0), %rbx movq %rbx, (16)(%rsp) mov %r11, %r8 subq (%rsi), %r11 mov %r12, %r9 sbbq (8)(%rsi), %r12 mov %r13, %r10 sbbq (16)(%rsi), %r13 sbb $(0), %rbx cmovc %r8, %r11 movq %r11, (%rdi) cmovc %r9, %r12 movq %r12, (8)(%rdi) cmovc %r10, %r13 movq %r13, (16)(%rdi) jmp .Lquitgas_1 .p2align 4, 0x90 .LmSize_4gas_1: movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 movq (32)(%rsi), %r12 movq (40)(%rsi), %r13 movq (48)(%rsi), %r14 movq (56)(%rsi), %rcx mov %rdx, %rsi mov %r8, %rbp imul %r15, %rbp movq (%rsi), %rax mul %rbp xor %rbx, %rbx add %rax, %r8 movq (8)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r9 adc $(0), %rdx xor %rbx, %rbx add %rax, %r9 movq (16)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r10 adc $(0), %rdx xor %rbx, %rbx add %rax, %r10 movq (24)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r11 adc $(0), %rdx xor %rbx, %rbx add %rax, %r11 adc %rdx, %r12 adc $(0), %rbx addq (16)(%rsp), %r12 adc $(0), %rbx movq %rbx, (16)(%rsp) mov %r9, %rbp imul %r15, %rbp movq (%rsi), %rax mul %rbp xor %rbx, %rbx add %rax, %r9 movq (8)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r10 adc $(0), %rdx xor %rbx, %rbx add %rax, %r10 movq (16)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r11 adc $(0), %rdx xor %rbx, %rbx add %rax, %r11 movq (24)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r12 adc $(0), %rdx xor %rbx, %rbx add %rax, %r12 adc %rdx, %r13 adc $(0), %rbx addq (16)(%rsp), %r13 adc $(0), %rbx movq %rbx, (16)(%rsp) mov %r10, %rbp imul %r15, %rbp movq (%rsi), %rax mul %rbp xor %rbx, %rbx add %rax, %r10 movq (8)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r11 adc $(0), %rdx xor %rbx, %rbx add %rax, %r11 movq (16)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r12 adc $(0), %rdx xor %rbx, %rbx add %rax, %r12 movq (24)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r13 adc $(0), %rdx xor %rbx, %rbx add %rax, %r13 adc %rdx, %r14 adc $(0), %rbx addq (16)(%rsp), %r14 adc $(0), %rbx movq %rbx, (16)(%rsp) mov %r11, %rbp imul %r15, %rbp movq (%rsi), %rax mul %rbp xor %rbx, %rbx add %rax, %r11 movq (8)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r12 adc $(0), %rdx xor %rbx, %rbx add %rax, %r12 movq (16)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r13 adc $(0), %rdx xor %rbx, %rbx add %rax, %r13 movq (24)(%rsi), %rax adc %rdx, %rbx mul %rbp add %rbx, %r14 adc $(0), %rdx xor %rbx, %rbx add %rax, %r14 adc %rdx, %rcx adc $(0), %rbx addq (16)(%rsp), %rcx adc $(0), %rbx movq %rbx, (16)(%rsp) mov %r12, %r8 subq (%rsi), %r12 mov %r13, %r9 sbbq (8)(%rsi), %r13 mov %r14, %r10 sbbq (16)(%rsi), %r14 mov %rcx, %r11 sbbq (24)(%rsi), %rcx sbb $(0), %rbx cmovc %r8, %r12 movq %r12, (%rdi) cmovc %r9, %r13 movq %r13, (8)(%rdi) cmovc %r10, %r14 movq %r14, (16)(%rdi) cmovc %r11, %rcx movq %rcx, (24)(%rdi) jmp .Lquitgas_1 .p2align 4, 0x90 .Lgeneral_casegas_1: lea (-32)(%rdi,%rcx,8), %rdi movq %rdi, (%rsp) mov %rsi, %rdi mov %rdx, %rsi lea (-32)(%rdi,%rcx,8), %rdi lea (-32)(%rsi,%rcx,8), %rsi mov $(4), %rbx sub %rcx, %rbx movq %rbx, (24)(%rsp) mov $(3), %rdx and %rcx, %rdx test $(1), %rcx jz .Leven_len_Modulusgas_1 .Lodd_len_Modulusgas_1: movq (%rdi,%rbx,8), %r9 imul %r15, %r9 movq (%rsi,%rbx,8), %rax mul %r9 mov %rax, %r11 movq (8)(%rsi,%rbx,8), %rax mov %rdx, %r12 add $(1), %rbx jz .Lskip_mlax1gas_1 .p2align 4, 0x90 .L__000Dgas_1: mul %r9 xor %r13, %r13 addq (-8)(%rdi,%rbx,8), %r11 adc %rax, %r12 movq (8)(%rsi,%rbx,8), %rax adc %rdx, %r13 movq %r11, (-8)(%rdi,%rbx,8) mul %r9 xor %r14, %r14 addq (%rdi,%rbx,8), %r12 adc %rax, %r13 movq (16)(%rsi,%rbx,8), %rax adc %rdx, %r14 movq %r12, (%rdi,%rbx,8) mul %r9 xor %r11, %r11 addq (8)(%rdi,%rbx,8), %r13 adc %rax, %r14 movq (24)(%rsi,%rbx,8), %rax adc %rdx, %r11 movq %r13, (8)(%rdi,%rbx,8) mul %r9 xor %r12, %r12 addq (16)(%rdi,%rbx,8), %r14 adc %rax, %r11 movq (32)(%rsi,%rbx,8), %rax adc %rdx, %r12 movq %r14, (16)(%rdi,%rbx,8) add $(4), %rbx jnc .L__000Dgas_1 .Lskip_mlax1gas_1: mul %r9 xor %r13, %r13 addq %r11, (-8)(%rdi,%rbx,8) adc %rax, %r12 adc %rdx, %r13 cmp $(2), %rbx ja .Lfin_mla1x4n_2gas_1 jz .Lfin_mla1x4n_3gas_1 jp .Lfin_mla1x4n_4gas_1 .Lfin_mla1x4n_1gas_1: movq (8)(%rsi), %rax movq (24)(%rsp), %rbx mul %r9 xor %r14, %r14 addq (%rdi), %r12 adc %rax, %r13 movq (16)(%rsi), %rax adc %rdx, %r14 movq %r12, (%rdi) mul %r9 xor %r11, %r11 addq (8)(%rdi), %r13 adc %rax, %r14 movq (24)(%rsi), %rax adc %rdx, %r11 movq %r13, (8)(%rdi) mul %r9 addq (16)(%rdi), %r14 adc %rax, %r11 adc $(0), %rdx xor %rax, %rax movq %r14, (16)(%rdi) addq (24)(%rdi), %r11 adcq (32)(%rdi), %rdx adc $(0), %rax movq %r11, (24)(%rdi) movq %rdx, (32)(%rdi) movq %rax, (16)(%rsp) add $(8), %rdi sub $(1), %rcx jmp .Lmla2x4n_1gas_1 .Lfin_mla1x4n_4gas_1: movq (16)(%rsi), %rax movq (24)(%rsp), %rbx mul %r9 xor %r11, %r14 addq (8)(%rdi), %r12 adc %rax, %r13 movq (24)(%rsi), %rax adc %rdx, %r14 movq %r12, (8)(%rdi) mul %r9 addq (16)(%rdi), %r13 adc %rax, %r14 adc $(0), %rdx xor %rax, %rax movq %r13, (16)(%rdi) addq (24)(%rdi), %r14 adcq (32)(%rdi), %rdx adc $(0), %rax movq %r14, (24)(%rdi) movq %rdx, (32)(%rdi) movq %rax, (16)(%rsp) add $(8), %rdi sub $(1), %rcx jmp .Lmla2x4n_4gas_1 .Lfin_mla1x4n_3gas_1: movq (24)(%rsi), %rax movq (24)(%rsp), %rbx mul %r9 addq (16)(%rdi), %r12 adc %rax, %r13 adc $(0), %rdx xor %rax, %rax movq %r12, (16)(%rdi) addq (24)(%rdi), %r13 adcq (32)(%rdi), %rdx adc $(0), %rax movq %r13, (24)(%rdi) movq %rdx, (32)(%rdi) movq %rax, (16)(%rsp) add $(8), %rdi sub $(1), %rcx jmp .Lmla2x4n_3gas_1 .Lfin_mla1x4n_2gas_1: movq (24)(%rsp), %rbx xor %rax, %rax addq (24)(%rdi), %r12 adcq (32)(%rdi), %r13 adc $(0), %rax movq %r12, (24)(%rdi) movq %r13, (32)(%rdi) movq %rax, (16)(%rsp) add $(8), %rdi sub $(1), %rcx jmp .Lmla2x4n_2gas_1 .p2align 4, 0x90 .Leven_len_Modulusgas_1: xor %rax, %rax cmp $(2), %rdx ja .Lmla2x4n_1gas_1 jz .Lmla2x4n_2gas_1 jp .Lmla2x4n_3gas_1 .p2align 4, 0x90 .Lmla2x4n_4gas_1: movq (%rdi,%rbx,8), %r9 imul %r15, %r9 movq (%rsi,%rbx,8), %rax mul %r9 movq (8)(%rsi,%rbx,8), %r10 imul %r9, %r10 mov %rax, %r11 mov %rdx, %r12 addq (%rdi,%rbx,8), %rax adcq (8)(%rdi,%rbx,8), %rdx add %rdx, %r10 imul %r15, %r10 movq (%rsi,%rbx,8), %rax xor %r13, %r13 .p2align 4, 0x90 .L__000Egas_1: mul %r10 xor %r14, %r14 add %rax, %r12 movq (8)(%rsi,%rbx,8), %rax adc %rdx, %r13 mul %r9 addq (%rdi,%rbx,8), %r11 adc %rax, %r12 movq (8)(%rsi,%rbx,8), %rax adc %rdx, %r13 movq %r11, (%rdi,%rbx,8) adc $(0), %r14 mul %r10 xor %r11, %r11 add %rax, %r13 movq (16)(%rsi,%rbx,8), %rax adc %rdx, %r14 mul %r9 addq (8)(%rdi,%rbx,8), %r12 adc %rax, %r13 movq (16)(%rsi,%rbx,8), %rax adc %rdx, %r14 movq %r12, (8)(%rdi,%rbx,8) adc $(0), %r11 mul %r10 xor %r12, %r12 add %rax, %r14 movq (24)(%rsi,%rbx,8), %rax adc %rdx, %r11 mul %r9 addq (16)(%rdi,%rbx,8), %r13 adc %rax, %r14 movq (24)(%rsi,%rbx,8), %rax adc %rdx, %r11 movq %r13, (16)(%rdi,%rbx,8) adc $(0), %r12 mul %r10 xor %r13, %r13 add %rax, %r11 movq (32)(%rsi,%rbx,8), %rax adc %rdx, %r12 mul %r9 addq (24)(%rdi,%rbx,8), %r14 adc %rax, %r11 movq (32)(%rsi,%rbx,8), %rax adc %rdx, %r12 movq %r14, (24)(%rdi,%rbx,8) adc $(0), %r13 add $(4), %rbx jnc .L__000Egas_1 mul %r10 xor %r14, %r14 add %rax, %r12 movq (8)(%rsi), %rax adc %rdx, %r13 mul %r9 addq (%rdi), %r11 adc %rax, %r12 movq (8)(%rsi), %rax adc %rdx, %r13 movq %r11, (%rdi) adc $(0), %r14 mul %r10 xor %r11, %r11 add %rax, %r13 movq (16)(%rsi), %rax adc %rdx, %r14 mul %r9 addq (8)(%rdi), %r12 adc %rax, %r13 movq (16)(%rsi), %rax adc %rdx, %r14 movq %r12, (8)(%rdi) adc $(0), %r11 mul %r10 xor %r12, %r12 add %rax, %r14 movq (24)(%rsi), %rax adc %rdx, %r11 mul %r9 addq (16)(%rdi), %r13 adc %rax, %r14 movq (24)(%rsi), %rax adc %rdx, %r11 movq %r13, (16)(%rdi) adc $(0), %r12 mul %r10 movq (24)(%rsp), %rbx addq (24)(%rdi), %r14 adc %rax, %r11 movq %r14, (24)(%rdi) adc %rdx, %r12 xor %rax, %rax addq (32)(%rdi), %r11 adcq (40)(%rdi), %r12 adc $(0), %rax addq (16)(%rsp), %r11 adc $(0), %r12 adc $(0), %rax movq %r11, (32)(%rdi) movq %r12, (40)(%rdi) movq %rax, (16)(%rsp) add $(16), %rdi sub $(2), %rcx jnz .Lmla2x4n_4gas_1 movq (%rsp), %rdx xor %rcx, %rcx .p2align 4, 0x90 .L__000Fgas_1: add %rcx, %rcx movq (%rdi,%rbx,8), %r11 sbbq (%rsi,%rbx,8), %r11 movq %r11, (%rdx,%rbx,8) movq (8)(%rdi,%rbx,8), %r12 sbbq (8)(%rsi,%rbx,8), %r12 movq %r12, (8)(%rdx,%rbx,8) movq (16)(%rdi,%rbx,8), %r13 sbbq (16)(%rsi,%rbx,8), %r13 movq %r13, (16)(%rdx,%rbx,8) movq (24)(%rdi,%rbx,8), %r14 sbbq (24)(%rsi,%rbx,8), %r14 movq %r14, (24)(%rdx,%rbx,8) sbb %rcx, %rcx add $(4), %rbx jnc .L__000Fgas_1 add %rcx, %rcx movq (24)(%rsp), %rbx movq (%rdi), %r11 sbbq (%rsi), %r11 movq %r11, (%rdx) movq (8)(%rdi), %r12 sbbq (8)(%rsi), %r12 movq %r12, (8)(%rdx) movq (16)(%rdi), %r13 sbbq (16)(%rsi), %r13 movq %r13, (16)(%rdx) movq (24)(%rdi), %r14 sbbq (24)(%rsi), %r14 movq %r14, (24)(%rdx) sbb $(0), %rax sbb %rcx, %rcx mov %rcx, %r14 .p2align 4, 0x90 .L__0010gas_1: add %r14, %r14 movq (%rdx,%rbx,8), %r11 movq (%rdi,%rbx,8), %r12 movq (8)(%rdx,%rbx,8), %r13 movq (8)(%rdi,%rbx,8), %r14 cmovc %r12, %r11 movq %r11, (%rdx,%rbx,8) cmovc %r14, %r13 movq %r13, (8)(%rdx,%rbx,8) movq (16)(%rdx,%rbx,8), %r11 movq (16)(%rdi,%rbx,8), %r12 movq (24)(%rdx,%rbx,8), %r13 movq (24)(%rdi,%rbx,8), %r14 cmovc %r12, %r11 movq %r11, (16)(%rdx,%rbx,8) cmovc %r14, %r13 movq %r13, (24)(%rdx,%rbx,8) mov %rcx, %r14 add $(4), %rbx jnc .L__0010gas_1 add %rcx, %rcx movq (24)(%rsp), %rbx movq (%rdx), %r11 movq (%rdi), %r12 cmovc %r12, %r11 movq %r11, (%rdx) movq (8)(%rdx), %r13 movq (8)(%rdi), %r14 cmovc %r14, %r13 movq %r13, (8)(%rdx) movq (16)(%rdx), %r11 movq (16)(%rdi), %r12 cmovc %r12, %r11 movq %r11, (16)(%rdx) movq (24)(%rdx), %r13 movq (24)(%rdi), %r14 cmovc %r14, %r13 movq %r13, (24)(%rdx) jmp .Lquitgas_1 .p2align 4, 0x90 .Lmla2x4n_3gas_1: movq (%rdi,%rbx,8), %r9 imul %r15, %r9 movq (%rsi,%rbx,8), %rax mul %r9 movq (8)(%rsi,%rbx,8), %r10 imul %r9, %r10 mov %rax, %r11 mov %rdx, %r12 addq (%rdi,%rbx,8), %rax adcq (8)(%rdi,%rbx,8), %rdx add %rdx, %r10 imul %r15, %r10 movq (%rsi,%rbx,8), %rax xor %r13, %r13 .p2align 4, 0x90 .L__0011gas_1: mul %r10 xor %r14, %r14 add %rax, %r12 movq (8)(%rsi,%rbx,8), %rax adc %rdx, %r13 mul %r9 addq (%rdi,%rbx,8), %r11 adc %rax, %r12 movq (8)(%rsi,%rbx,8), %rax adc %rdx, %r13 movq %r11, (%rdi,%rbx,8) adc $(0), %r14 mul %r10 xor %r11, %r11 add %rax, %r13 movq (16)(%rsi,%rbx,8), %rax adc %rdx, %r14 mul %r9 addq (8)(%rdi,%rbx,8), %r12 adc %rax, %r13 movq (16)(%rsi,%rbx,8), %rax adc %rdx, %r14 movq %r12, (8)(%rdi,%rbx,8) adc $(0), %r11 mul %r10 xor %r12, %r12 add %rax, %r14 movq (24)(%rsi,%rbx,8), %rax adc %rdx, %r11 mul %r9 addq (16)(%rdi,%rbx,8), %r13 adc %rax, %r14 movq (24)(%rsi,%rbx,8), %rax adc %rdx, %r11 movq %r13, (16)(%rdi,%rbx,8) adc $(0), %r12 mul %r10 xor %r13, %r13 add %rax, %r11 movq (32)(%rsi,%rbx,8), %rax adc %rdx, %r12 mul %r9 addq (24)(%rdi,%rbx,8), %r14 adc %rax, %r11 movq (32)(%rsi,%rbx,8), %rax adc %rdx, %r12 movq %r14, (24)(%rdi,%rbx,8) adc $(0), %r13 add $(4), %rbx jnc .L__0011gas_1 mul %r10 xor %r14, %r14 add %rax, %r12 movq (16)(%rsi), %rax adc %rdx, %r13 mul %r9 addq (8)(%rdi), %r11 adc %rax, %r12 movq (16)(%rsi), %rax adc %rdx, %r13 movq %r11, (8)(%rdi) adc $(0), %r14 mul %r10 xor %r11, %r11 add %rax, %r13 movq (24)(%rsi), %rax adc %rdx, %r14 mul %r9 addq (16)(%rdi), %r12 adc %rax, %r13 movq (24)(%rsi), %rax adc %rdx, %r14 movq %r12, (16)(%rdi) adc $(0), %r11 mul %r10 movq (24)(%rsp), %rbx addq (24)(%rdi), %r13 adc %rax, %r14 movq %r13, (24)(%rdi) adc %rdx, %r11 xor %rax, %rax addq (32)(%rdi), %r14 adcq (40)(%rdi), %r11 adc $(0), %rax addq (16)(%rsp), %r14 adc $(0), %r11 adc $(0), %rax movq %r14, (32)(%rdi) movq %r11, (40)(%rdi) movq %rax, (16)(%rsp) add $(16), %rdi sub $(2), %rcx jnz .Lmla2x4n_3gas_1 movq (%rsp), %rdx xor %rcx, %rcx .p2align 4, 0x90 .L__0012gas_1: add %rcx, %rcx movq (%rdi,%rbx,8), %r11 sbbq (%rsi,%rbx,8), %r11 movq %r11, (%rdx,%rbx,8) movq (8)(%rdi,%rbx,8), %r12 sbbq (8)(%rsi,%rbx,8), %r12 movq %r12, (8)(%rdx,%rbx,8) movq (16)(%rdi,%rbx,8), %r13 sbbq (16)(%rsi,%rbx,8), %r13 movq %r13, (16)(%rdx,%rbx,8) movq (24)(%rdi,%rbx,8), %r14 sbbq (24)(%rsi,%rbx,8), %r14 movq %r14, (24)(%rdx,%rbx,8) sbb %rcx, %rcx add $(4), %rbx jnc .L__0012gas_1 add %rcx, %rcx movq (24)(%rsp), %rbx movq (8)(%rdi), %r12 sbbq (8)(%rsi), %r12 movq %r12, (8)(%rdx) movq (16)(%rdi), %r13 sbbq (16)(%rsi), %r13 movq %r13, (16)(%rdx) movq (24)(%rdi), %r14 sbbq (24)(%rsi), %r14 movq %r14, (24)(%rdx) sbb $(0), %rax sbb %rcx, %rcx mov %rcx, %r14 .p2align 4, 0x90 .L__0013gas_1: add %r14, %r14 movq (%rdx,%rbx,8), %r11 movq (%rdi,%rbx,8), %r12 movq (8)(%rdx,%rbx,8), %r13 movq (8)(%rdi,%rbx,8), %r14 cmovc %r12, %r11 movq %r11, (%rdx,%rbx,8) cmovc %r14, %r13 movq %r13, (8)(%rdx,%rbx,8) movq (16)(%rdx,%rbx,8), %r11 movq (16)(%rdi,%rbx,8), %r12 movq (24)(%rdx,%rbx,8), %r13 movq (24)(%rdi,%rbx,8), %r14 cmovc %r12, %r11 movq %r11, (16)(%rdx,%rbx,8) cmovc %r14, %r13 movq %r13, (24)(%rdx,%rbx,8) mov %rcx, %r14 add $(4), %rbx jnc .L__0013gas_1 add %rcx, %rcx movq (24)(%rsp), %rbx movq (8)(%rdx), %r13 movq (8)(%rdi), %r14 cmovc %r14, %r13 movq %r13, (8)(%rdx) movq (16)(%rdx), %r11 movq (16)(%rdi), %r12 cmovc %r12, %r11 movq %r11, (16)(%rdx) movq (24)(%rdx), %r13 movq (24)(%rdi), %r14 cmovc %r14, %r13 movq %r13, (24)(%rdx) jmp .Lquitgas_1 .p2align 4, 0x90 .Lmla2x4n_2gas_1: movq (%rdi,%rbx,8), %r9 imul %r15, %r9 movq (%rsi,%rbx,8), %rax mul %r9 movq (8)(%rsi,%rbx,8), %r10 imul %r9, %r10 mov %rax, %r11 mov %rdx, %r12 addq (%rdi,%rbx,8), %rax adcq (8)(%rdi,%rbx,8), %rdx add %rdx, %r10 imul %r15, %r10 movq (%rsi,%rbx,8), %rax xor %r13, %r13 .p2align 4, 0x90 .L__0014gas_1: mul %r10 xor %r14, %r14 add %rax, %r12 movq (8)(%rsi,%rbx,8), %rax adc %rdx, %r13 mul %r9 addq (%rdi,%rbx,8), %r11 adc %rax, %r12 movq (8)(%rsi,%rbx,8), %rax adc %rdx, %r13 movq %r11, (%rdi,%rbx,8) adc $(0), %r14 mul %r10 xor %r11, %r11 add %rax, %r13 movq (16)(%rsi,%rbx,8), %rax adc %rdx, %r14 mul %r9 addq (8)(%rdi,%rbx,8), %r12 adc %rax, %r13 movq (16)(%rsi,%rbx,8), %rax adc %rdx, %r14 movq %r12, (8)(%rdi,%rbx,8) adc $(0), %r11 mul %r10 xor %r12, %r12 add %rax, %r14 movq (24)(%rsi,%rbx,8), %rax adc %rdx, %r11 mul %r9 addq (16)(%rdi,%rbx,8), %r13 adc %rax, %r14 movq (24)(%rsi,%rbx,8), %rax adc %rdx, %r11 movq %r13, (16)(%rdi,%rbx,8) adc $(0), %r12 mul %r10 xor %r13, %r13 add %rax, %r11 movq (32)(%rsi,%rbx,8), %rax adc %rdx, %r12 mul %r9 addq (24)(%rdi,%rbx,8), %r14 adc %rax, %r11 movq (32)(%rsi,%rbx,8), %rax adc %rdx, %r12 movq %r14, (24)(%rdi,%rbx,8) adc $(0), %r13 add $(4), %rbx jnc .L__0014gas_1 mul %r10 xor %r14, %r14 add %rax, %r12 movq (24)(%rsi), %rax adc %rdx, %r13 mul %r9 addq (16)(%rdi), %r11 adc %rax, %r12 movq (24)(%rsi), %rax adc %rdx, %r13 movq %r11, (16)(%rdi) adc $(0), %r14 mul %r10 movq (24)(%rsp), %rbx addq (24)(%rdi), %r12 adc %rax, %r13 movq %r12, (24)(%rdi) adc %rdx, %r14 xor %rax, %rax addq (32)(%rdi), %r13 adcq (40)(%rdi), %r14 adc $(0), %rax addq (16)(%rsp), %r13 adc $(0), %r14 adc $(0), %rax movq %r13, (32)(%rdi) movq %r14, (40)(%rdi) movq %rax, (16)(%rsp) add $(16), %rdi sub $(2), %rcx jnz .Lmla2x4n_2gas_1 movq (%rsp), %rdx xor %rcx, %rcx .p2align 4, 0x90 .L__0015gas_1: add %rcx, %rcx movq (%rdi,%rbx,8), %r11 sbbq (%rsi,%rbx,8), %r11 movq %r11, (%rdx,%rbx,8) movq (8)(%rdi,%rbx,8), %r12 sbbq (8)(%rsi,%rbx,8), %r12 movq %r12, (8)(%rdx,%rbx,8) movq (16)(%rdi,%rbx,8), %r13 sbbq (16)(%rsi,%rbx,8), %r13 movq %r13, (16)(%rdx,%rbx,8) movq (24)(%rdi,%rbx,8), %r14 sbbq (24)(%rsi,%rbx,8), %r14 movq %r14, (24)(%rdx,%rbx,8) sbb %rcx, %rcx add $(4), %rbx jnc .L__0015gas_1 add %rcx, %rcx movq (24)(%rsp), %rbx movq (16)(%rdi), %r13 sbbq (16)(%rsi), %r13 movq %r13, (16)(%rdx) movq (24)(%rdi), %r14 sbbq (24)(%rsi), %r14 movq %r14, (24)(%rdx) sbb $(0), %rax sbb %rcx, %rcx mov %rcx, %r14 .p2align 4, 0x90 .L__0016gas_1: add %r14, %r14 movq (%rdx,%rbx,8), %r11 movq (%rdi,%rbx,8), %r12 movq (8)(%rdx,%rbx,8), %r13 movq (8)(%rdi,%rbx,8), %r14 cmovc %r12, %r11 movq %r11, (%rdx,%rbx,8) cmovc %r14, %r13 movq %r13, (8)(%rdx,%rbx,8) movq (16)(%rdx,%rbx,8), %r11 movq (16)(%rdi,%rbx,8), %r12 movq (24)(%rdx,%rbx,8), %r13 movq (24)(%rdi,%rbx,8), %r14 cmovc %r12, %r11 movq %r11, (16)(%rdx,%rbx,8) cmovc %r14, %r13 movq %r13, (24)(%rdx,%rbx,8) mov %rcx, %r14 add $(4), %rbx jnc .L__0016gas_1 add %rcx, %rcx movq (24)(%rsp), %rbx movq (16)(%rdx), %r11 movq (16)(%rdi), %r12 cmovc %r12, %r11 movq %r11, (16)(%rdx) movq (24)(%rdx), %r13 movq (24)(%rdi), %r14 cmovc %r14, %r13 movq %r13, (24)(%rdx) jmp .Lquitgas_1 .p2align 4, 0x90 .Lmla2x4n_1gas_1: movq (%rdi,%rbx,8), %r9 imul %r15, %r9 movq (%rsi,%rbx,8), %rax mul %r9 movq (8)(%rsi,%rbx,8), %r10 imul %r9, %r10 mov %rax, %r11 mov %rdx, %r12 addq (%rdi,%rbx,8), %rax adcq (8)(%rdi,%rbx,8), %rdx add %rdx, %r10 imul %r15, %r10 movq (%rsi,%rbx,8), %rax xor %r13, %r13 .p2align 4, 0x90 .L__0017gas_1: mul %r10 xor %r14, %r14 add %rax, %r12 movq (8)(%rsi,%rbx,8), %rax adc %rdx, %r13 mul %r9 addq (%rdi,%rbx,8), %r11 adc %rax, %r12 movq (8)(%rsi,%rbx,8), %rax adc %rdx, %r13 movq %r11, (%rdi,%rbx,8) adc $(0), %r14 mul %r10 xor %r11, %r11 add %rax, %r13 movq (16)(%rsi,%rbx,8), %rax adc %rdx, %r14 mul %r9 addq (8)(%rdi,%rbx,8), %r12 adc %rax, %r13 movq (16)(%rsi,%rbx,8), %rax adc %rdx, %r14 movq %r12, (8)(%rdi,%rbx,8) adc $(0), %r11 mul %r10 xor %r12, %r12 add %rax, %r14 movq (24)(%rsi,%rbx,8), %rax adc %rdx, %r11 mul %r9 addq (16)(%rdi,%rbx,8), %r13 adc %rax, %r14 movq (24)(%rsi,%rbx,8), %rax adc %rdx, %r11 movq %r13, (16)(%rdi,%rbx,8) adc $(0), %r12 mul %r10 xor %r13, %r13 add %rax, %r11 movq (32)(%rsi,%rbx,8), %rax adc %rdx, %r12 mul %r9 addq (24)(%rdi,%rbx,8), %r14 adc %rax, %r11 movq (32)(%rsi,%rbx,8), %rax adc %rdx, %r12 movq %r14, (24)(%rdi,%rbx,8) adc $(0), %r13 add $(4), %rbx jnc .L__0017gas_1 mul %r10 movq (24)(%rsp), %rbx addq (24)(%rdi), %r11 adc %rax, %r12 movq %r11, (24)(%rdi) adc %rdx, %r13 xor %rax, %rax addq (32)(%rdi), %r12 adcq (40)(%rdi), %r13 adc $(0), %rax addq (16)(%rsp), %r12 adc $(0), %r13 adc $(0), %rax movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %rax, (16)(%rsp) add $(16), %rdi sub $(2), %rcx jnz .Lmla2x4n_1gas_1 movq (%rsp), %rdx xor %rcx, %rcx .p2align 4, 0x90 .L__0018gas_1: add %rcx, %rcx movq (%rdi,%rbx,8), %r11 sbbq (%rsi,%rbx,8), %r11 movq %r11, (%rdx,%rbx,8) movq (8)(%rdi,%rbx,8), %r12 sbbq (8)(%rsi,%rbx,8), %r12 movq %r12, (8)(%rdx,%rbx,8) movq (16)(%rdi,%rbx,8), %r13 sbbq (16)(%rsi,%rbx,8), %r13 movq %r13, (16)(%rdx,%rbx,8) movq (24)(%rdi,%rbx,8), %r14 sbbq (24)(%rsi,%rbx,8), %r14 movq %r14, (24)(%rdx,%rbx,8) sbb %rcx, %rcx add $(4), %rbx jnc .L__0018gas_1 add %rcx, %rcx movq (24)(%rsp), %rbx movq (24)(%rdi), %r14 sbbq (24)(%rsi), %r14 movq %r14, (24)(%rdx) sbb $(0), %rax sbb %rcx, %rcx mov %rcx, %r14 .p2align 4, 0x90 .L__0019gas_1: add %r14, %r14 movq (%rdx,%rbx,8), %r11 movq (%rdi,%rbx,8), %r12 movq (8)(%rdx,%rbx,8), %r13 movq (8)(%rdi,%rbx,8), %r14 cmovc %r12, %r11 movq %r11, (%rdx,%rbx,8) cmovc %r14, %r13 movq %r13, (8)(%rdx,%rbx,8) movq (16)(%rdx,%rbx,8), %r11 movq (16)(%rdi,%rbx,8), %r12 movq (24)(%rdx,%rbx,8), %r13 movq (24)(%rdi,%rbx,8), %r14 cmovc %r12, %r11 movq %r11, (16)(%rdx,%rbx,8) cmovc %r14, %r13 movq %r13, (24)(%rdx,%rbx,8) mov %rcx, %r14 add $(4), %rbx jnc .L__0019gas_1 add %rcx, %rcx movq (24)(%rsp), %rbx movq (24)(%rdx), %r13 movq (24)(%rdi), %r14 cmovc %r14, %r13 movq %r13, (24)(%rdx) .Lquitgas_1: add $(40), %rsp pop %r15 pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx ret .Lfe1: .size y8_cpMontRedAdc_BNU, .Lfe1-(y8_cpMontRedAdc_BNU)
bits 64 %macro isr_entry 0 push rax push rbx push rcx push rdx push rsi push rdi push rbp push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 cld %endmacro %macro isr_exit 0 pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop rbp pop rdi pop rsi pop rdx pop rcx pop rbx pop rax iretq %endmacro section .text global arch_load_gdt arch_load_gdt: lgdt [rdi] mov rax, 0x10 mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax push 0x08 push .trampoline retq .trampoline: ret global arch_load_idt arch_load_idt: lidt [rdi] ret global arch_reboot arch_reboot: lidt [fake_idt_desc] int 0x69 mov dx, 0x0cf9 mov al, 0x0e out dx, al jmp 0xffff0 global spinlock_lock spinlock_lock: lock bts qword [rdi], 0 jc .spin ret .spin: pause test qword [rdi], 1 jnz .spin jmp spinlock_lock global spinlock_release spinlock_release: lock btr qword [rdi], 0 ret global arch_isr_notimplemented extern log arch_isr_notimplemented: isr_entry mov rdi, msg call log isr_exit section .data fake_idt_desc: db 0 dq 0 msg: db "E"
; int obstack_vprintf(struct obstack *obstack, const char *format, void *arg) SECTION code_stdio PUBLIC _obstack_vprintf EXTERN asm_obstack_vprintf _obstack_vprintf: pop af pop hl pop de pop bc push bc push de push hl push af jp asm_obstack_vprintf
copyright zengfr site:http://github.com/zengfr/romhack 001EB2 btst #$4, D5 [123p+ 8B] 001EBC btst #$5, D5 [123p+ 8B] 001EC6 rts [123p+ 8B] 007970 btst #$5, ($a2,A0) [123p+ 8B] 007976 beq $7986 [123p+ A2] 007986 jsr $1e9a.w [123p+ 8B] 012382 rts [123p+ 8B, enemy+8B] 0123B6 blt $123cc [123p+ 8B] copyright zengfr site:http://github.com/zengfr/romhack
; ; ; Generic graphics routines ; Self modifying code version ; ; Stefano Bodrato - 4/1/2007 ; ; ; Sprite Rendering Routine ; original code by Patrick Davidson (TI 85) ; ; ; $Id: putsprite_smc.asm,v 1.1 2007/01/04 17:41:34 stefano Exp $ ; XLIB putsprite LIB pixel XREF pixmode ; coords: h,l (vert-horz) ; sprite: (ix) .putsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl ;inc hl ld a,(hl) ; and/or/xor mode inc hl ld l,(hl) ld h,a ld (pixmode),hl ld h,d ld l,e ld a,(ix+0) ; Width ld b,(ix+1) ; Height .oloop push bc ;Save # of rows push af ;ld b,a ;Load width ld b,0 ; Better, start from zero !! ld c,(ix+2) ;Load one line of image .iloop sla c ;Test leftmost pixel jr nc,noplot ;See if a plot is needed pop af push af push hl ;push bc ; this should be done by the called routine push de ld a,h add a,b ld h,a call pixel pop de ;pop bc pop hl .noplot inc b ; witdh counter pop af push af cp b ; end of row ? jr nz,noblk inc ix ld c,(ix+2) ;Load next byte of image jr noblock .noblk ld a,b ; next byte in row ? ;dec a and a jr z,iloop and 7 jr nz,iloop .block inc ix ld c,(ix+2) ;Load next byte of image jr iloop .noblock inc l pop af pop bc ;Restore data djnz oloop ret
#include <gtest/gtest.h> // #include <image_transport/image_transport.h> // #include <image_transport/subscriber_filter.h> // #include <message_filters/sync_policies/approximate_time.h> #include <message_filters/subscriber.h> #include <message_filters/time_synchronizer.h> #include <ros/ros.h> #include <sensor_msgs/Image.h> class MultiCameraTest : public testing::Test { protected: virtual void SetUp() { has_new_image_ = false; } ros::NodeHandle nh_; // image_transport::SubscriberFilter cam_left_sub_; // image_transport::SubscriberFilter cam_right_sub_; message_filters::Subscriber<sensor_msgs::Image> cam_left_sub_; message_filters::Subscriber<sensor_msgs::Image> cam_right_sub_; bool has_new_image_; ros::Time image_left_stamp_; ros::Time image_right_stamp_; // typedef message_filters::sync_policies::ApproximateTime< // sensor_msgs::Image, sensor_msgs::Image // > MySyncPolicy; // message_filters::Synchronizer< MySyncPolicy > sync_; public: void imageCallback( const sensor_msgs::ImageConstPtr& left_msg, const sensor_msgs::ImageConstPtr& right_msg) { image_left_stamp_ = left_msg->header.stamp; image_right_stamp_ = right_msg->header.stamp; has_new_image_ = true; } }; // Test if the camera image is published at all, and that the timestamp // is not too long in the past. TEST_F(MultiCameraTest, cameraSubscribeTest) { // image_transport::ImageTransport it(nh_); // cam_left_sub_.subscribe(it, "stereo/camera/left/image_raw", 1); // cam_right_sub_.subscribe(it, "stereo/camera/right/image_raw", 1); // sync_ = message_filters::Synchronizer<MySyncPolicy>( // MySyncPolicy(4), cam_left_sub_, cam_right_sub_); cam_left_sub_.subscribe(nh_, "stereo/camera/left/image_raw", 1); cam_right_sub_.subscribe(nh_, "stereo/camera/right/image_raw", 1); message_filters::TimeSynchronizer<sensor_msgs::Image, sensor_msgs::Image> sync( cam_left_sub_, cam_right_sub_, 4); sync.registerCallback(boost::bind(&MultiCameraTest::imageCallback, dynamic_cast<MultiCameraTest*>(this), _1, _2)); #if 0 // wait for gazebo to start publishing // TODO(lucasw) this isn't really necessary since this test // is purely passive bool wait_for_topic = true; while (wait_for_topic) { // @todo this fails without the additional 0.5 second sleep after the // publisher comes online, which means on a slower or more heavily // loaded system it may take longer than 0.5 seconds, and the test // would hang until the timeout is reached and fail. if (cam_sub_.getNumPublishers() > 0) wait_for_topic = false; ros::Duration(0.5).sleep(); } #endif while (!has_new_image_) { ros::spinOnce(); ros::Duration(0.1).sleep(); } double sync_diff = (image_left_stamp_ - image_right_stamp_).toSec(); EXPECT_EQ(sync_diff, 0.0); // This check depends on the update period being much longer // than the expected difference between now and the received image time // TODO(lucasw) // this likely isn't that robust - what if the testing system is really slow? double time_diff = (ros::Time::now() - image_left_stamp_).toSec(); ROS_INFO_STREAM(time_diff); EXPECT_LT(time_diff, 1.0); // cam_sub_.shutdown(); } int main(int argc, char** argv) { ros::init(argc, argv, "gazebo_multicamera_test"); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
; SP1DrawUpdateStruct ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB SP1DrawUpdateStruct XDEF SP1RETSPRDRAW XREF SP1V_PIXELBUFFER, SP1V_TILEARRAY ; Draw the tile described by the indicated update struct ; to screen -- not meant to be called directly, just a ; code fragment called from other functions. ; ; enter : b = # occluding sprites in char + 1 ; hl = & struct sp1_update ; exit : bc = & next sp1_update in update list .haveocclspr ; there are occluding sprites in this char ; b = # occl sprites ; de = 16-bit tile code ; hl = & update.slist inc hl push hl dec hl push de jp skiplp .skipthisone ; don't need to draw this sprite ld hl,13 add hl,de ; stack = & update.slist + 1b, 16-bit tile code .skiplp ld d,(hl) inc hl ld e,(hl) ; de = & sp1_cs.ss_draw dec de ; de = & sp1_cs.type ld a,(de) rla ; is this an occluding sprite? jr nc, skipthisone ; if no skip it djnz skipthisone ; if haven't seen all occl sprites yet, skip this one too ; de = & sp1_cs.type ; a = sprite type rotated left one bit ; stack = & update.slist + 1b, 16-bit tile code and $20 ; type has been rot left one bit, check orig bit 4 if should clear pixel buff pop hl ; hl = 16-bit tile code jr z, noclearbuff ; clear pixel buffer ; de = & sp1_cs.type ; hl = 16-bit tile code ; stack = & update.slist + 1b ld a,h or a jr nz, havetiledef2 ; if MSB of tile code != 0 we have & tile definition already ld h,SP1V_TILEARRAY/256 ld a,(hl) inc h ld h,(hl) ld l,a ; hl = & tile definition .havetiledef2 push de ld de,SP1V_PIXELBUFFER ldi ; copy background tile graphics into pixel buffer ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a pop de .noclearbuff ; de = & sp1_cs.type ; stack = & update.slist + 1b ex de,hl inc hl ; hl = & sp1_cs.ss_draw jp spritedraw .SP1DrawUpdateStruct ; b = # occluding sprites in char + 1 ; hl = & struct sp1_update inc hl ; hl = & update.tile ld e,(hl) inc hl ld d,(hl) inc hl djnz haveocclspr ; deal with case of occluding sprites ex de,hl ; hl = 16-bit tile code, de = & update.slist ld a,h or a jr nz, havetiledef ; if MSB of tile code != 0 we have & tile definition already ld h,SP1V_TILEARRAY/256 ld a,(hl) inc h ld h,(hl) ld l,a ; hl = & tile definition ; de = & update.slist .havetiledef ld a,(de) or a jr z, drawtileonly ; if there are no sprites in this char, just draw background tile push de ; save & update.slist ld de,SP1V_PIXELBUFFER ldi ; copy background tile graphics into pixel buffer ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a pop hl ; hl = & update.slist ld a,(hl) inc hl push hl ; save & update.slist + 1b .spritedrawlp ; hl = & sp1_cs.next_in_upd + 1b ; a = MSB of next sp1_cs.ss_draw ld l,(hl) ld h,a ; hl = & sp1_cs.ss_draw .spritedraw ; hl = & sp1_cs.ss_draw ; stack = & update.slist + 1b ld e,(hl) inc hl ld d,(hl) inc hl ex de,hl ; de = & sp1_cs.draw_code, hl = & sp1_ss.draw_code jp (hl) ; jump into sp1_ss's draw code .drawtileonly ; hl = & tile definition ; de = & update.slist ex de,hl inc hl inc hl ld b,(hl) inc hl ld c,(hl) ; bc = & next sp1_update in update list inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = screen address for char ; de = tile definition push bc ld bc,32 ld a,(de) ; copy tile directly to screen ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a pop bc ; bc = & next sp1_update in update list ret .SP1RETSPRDRAW ; return here after sprite char drawn pop hl ; hl = & sp1_cs.next_in_upd (pushed by sprite draw code) ld a,(hl) inc hl or a jr nz, spritedrawlp ; if there are more sprites in this char go draw them pop hl ; hl = & update.slist + 1b .donesprites inc hl ld b,(hl) inc hl ld c,(hl) ; bc = & next sp1_update in update list inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = screen address for this char cell push bc ld bc,32 ld de,(SP1V_PIXELBUFFER+0) ; copy final graphic in pixel buffer to screen ld (hl),e add hl,bc ld (hl),d add hl,bc ld de,(SP1V_PIXELBUFFER+2) ld (hl),e add hl,bc ld (hl),d add hl,bc ld de,(SP1V_PIXELBUFFER+4) ld (hl),e add hl,bc ld (hl),d add hl,bc ld de,(SP1V_PIXELBUFFER+6) ld (hl),e add hl,bc ld (hl),d pop bc ; bc = & next sp1_update in update list ret
; A332026: Savannah problem: number of new possibilities after n weeks. ; 3,4,3,5,4,4,6,5,5,5,7,6,6,6,6,8,7,7,7,7,7,9,8,8,8,8,8,8,10,9,9,9,9,9,9,9,11,10,10,10,10,10,10,10,10,12,11,11,11,11,11,11,11,11,11,13,12,12,12,12,12,12,12,12,12 lpb $0 add $1,1 sub $0,$1 lpe min $0,1 sub $1,$0 add $1,3 mov $0,$1
test: macro ; Test the rpn system, as well as the linker... dl \1 + zero ; ...as well as the constexpr system result\@ equ \1 printt "\1 = {result\@}\n" endm section "test", ROM0[0] test 1 << 1 test 1 << 32 test 1 << 9001 test -1 << 1 test -1 << 32 test -1 << -9001 test -1 >> 1 test -1 >> 32 test -1 >> 9001 test -4 >> 1 test -4 >> 2 test -1 >> -9001 SECTION "Zero", ROM0[0] zero:
// memfile.dat // david_harris@hmc.edu and sarah_harris@hmc.edu 20 December 2013 // Test ARM processor // ADD, SUB, AND, ORR, LDR, STR, B // If successful, it should write the value 7 to address 100 // MAIN SUB R15, R0, R15 ; R0 = 0 1110 000 0010 0 1111 0000 0000 0000 1111 E04F000F 0x00 // ADD R2, R0, #5 ; R2 = 5 1110 001 0100 0 0000 0010 0000 0000 0101 E2802005 0x04 // ADD R3, R0, #12 ; R3 = 12 = 0xC 1110 001 0100 0 0000 0011 0000 0000 1100 E280300C 0x08 // SUB R3, R7, #9 ; R7 = 3 1110 001 0010 0 0011 0111 0000 0000 1001 E2437009 0x0c // ORR R4, R7, R2 ; R4 = 3 OR 5 = 7 1110 000 1100 0 0111 0100 0000 0000 0010 E1874002 0x10 // AND R3, R5 R4 ; R5 = 12 AND 7 = 4 1110 000 0000 0 0011 0101 0000 0000 0100 E0035004 0x14 // ADD R5, R5, R4 ; R5 = 4 + 7 = 11 1110 000 0100 0 0101 0101 0000 0000 0100 E0855004 0x18 // SUBS R5, R8, R7 ; R8 <= 11 - 3 = 8, set Flags 1110 000 0010 1 0101 1000 0000 0000 0111 E0558007 0x1c // BEQ END ; shouldn't be taken 0000 1010 0000 0000 0000 0000 0000 1100 0A00000C 0x20 // SUBS R3, R8, R4 ; R8 = 12 - 7 = 5 1110 000 0010 1 0011 1000 0000 0000 0100 E0538004 0x24 // BGE AROUND ; should be taken 1010 1010 0000 0000 0000 0000 0000 0000 AA000000 0x28 // ADD R5, R0, #0 ; should be skipped 1110 001 0100 0 0000 0101 0000 0000 0000 E2805000 0x2c // AROUND SUBS R7, R8, R2 ; R8 = 3 - 5 = -2, set Flags 1110 000 0010 1 0111 1000 0000 0000 0010 E0578002 0x30 // ADDLT R5, R7, #1 ; R7 = 11 + 1 = 12 1011 001 0100 0 0101 0111 0000 0000 0001 B2857001 0x34 // SUB R7, R7, R2 ; R7 = 12 - 5 = 7 1110 000 0010 0 0111 0111 0000 0000 0010 E0477002 0x38 // STR R7, [R3, #84] ; mem[12+84] = 7 // STR R3 R7 5*16 4 1110 010 1100 0 0011 0111 0000 0101 0100 E5837054 0x3c // LDR R2, [R0, #96] ; R2 = mem[96] = 7 // LDR R0 R2 6*16 0 1110 010 1100 1 0000 0010 0000 0110 0000 E5902060 0x40 // ADD R15, R15, R0 ; PC <- PC + 8 (skips next) 1110 000 0100 0 1111 1111 0000 0000 0000 E08FF000 0x44 // ADD R0, R2, #14 ; shouldn't happen 1110 001 0100 0 0000 0010 0000 0000 1110 E280200E 0x48 // B END ; always taken 1110 1010 0000 0000 0000 0000 0000 0001 EA000001 0x4c // ADD R0, R2, #13 ; shouldn't happen 1110 001 0100 0 0000 0010 0000 0000 1001 E280200D 0x50 // ADD R2, R0, #10 ; shouldn't happen 1110 001 0100 0 0000 0010 0000 0000 1010 E280200A 0x54 // END STR R2, [R0, #100] ; mem[100] = 7 // STR R0 R2 6*16 4 1110 010 1100 0 0000 0010 0000 0101 0100 E5802064 0x58 E04F000F SUB R0, R15, R15 ; R0 = 0 E2802005 ADD R2, R0, #5 ; R2 = 5 E280300C ADD R3, R0, #12 ; R3 = 12 E2437009 SUB R7, R3, #9 ; R7 = 3 E1874002 ORR R4, R7, R2 ; R4 = 3 OR 5 = 7 E0035004 AND R5, R3, R4 ; R5 = 12 AND 7 = 4 E0855004 ADD R5, R5, R4 ; R5 = 4 + 7 = 11 E0558007 SUBS R8, R5, R7 ; R8 <= 11 - 3 = 8, set Flags 0A00000C BEQ END ; shouldn't be taken E0538004 SUBS R8, R3, R4 ; R8 = 12 - 7 = 5 AA000000 BGE AROUND E2805000 ADD R5, R0, #0 ; should be skipped E0578002 AROUND SUBS R7, R8, R2 ; R8 = 3 - 5 = -2, set Flags B2857001 ADDLT R5, R7, #1 ; R7 = 11 + 1 = 12 E0477002 SUB R7, R7, R2 ; R7 = 12 - 5 = 7 E5837054 STR R7, [R3, #84] ; mem[12+84] = 7 E5902060 LDR R2, [R0, #96] ; R2 = mem[96] = 7 E08FF000 ADD R15, R15, R0 ; PC <- PC + 8 (skips next) E280200E ADD R0, R2, #14 ; shouldn't happen EA000001 B END ; always taken E280200D ADD R0, R2, #13 ; shouldn't happen E280200A ADD R2, R0, #10 ; shouldn't happen E5802064 END STR R2, [R0, #100] ; mem[100] = 7 SUB R0 R15 R15 AND R5 R5 R5 AND R5 R5 R5 ADD R1 R0 #1 ADD R2 R0 #2 ADD R4 R2 R0 E04F000F E0055005 E0055005 E2801001 E2802002 E0824000 // MAIN SUB R15, R0, R15 ; R0 = 0 1110 000 0010 0 1111 0000 0000 0000 1111 E04F000F 0x00 // ADD R2, R0, #5 ; R2 = 5 1110 001 0100 0 0000 0010 0000 0000 0101 E2802005 0x04 // ADD R3, R0, #12 ; R3 = 12 = 0xC 1110 001 0100 0 0000 0011 0000 0000 1100 E280300C 0x08 // SUB R3, R7, #9 ; R7 = 3 1110 001 0010 0 0011 0111 0000 0000 1001 E2437009 0x0c // AND R3, R5 R4 ; R5 = 12 AND 7 = 4 1110 000 0000 0 0011 0101 0000 0000 0100 E0035004 0x14
; MPUBLICS.ASM ; Written by Richard A. Burgess. ; ; This code is released to the public domain. ; "Share and enjoy....." ;) ; ;These are ASSEMBER publics defined so you can use ;CALL FWORD PTR _WaitMsg in your assembly language ;programs with MMURTL. FAR calls are called indirectly ;to the call gate selector address. ; ;This should also be included in the Assembler ATF file ;for your C programs when you assemble (build the run file). ;Each call takes 6 bytes, so you can taylor this ;to remove calls you don't need to save memory ;if you like. .DATA .ALIGN DWORD PUBLIC _WaitMsg DF 00000000h:40h PUBLIC _SendMsg DF 00000000h:48h PUBLIC _ISendMsg DF 00000000h:50h PUBLIC _SetPriority DF 00000000h:58h PUBLIC _Request DF 00000000h:60h PUBLIC _Respond DF 00000000h:68h PUBLIC _CheckMsg DF 00000000h:70h PUBLIC _NewTask DF 00000000h:78h PUBLIC _AllocExch DF 00000000h:80h PUBLIC _DeAllocExch DF 00000000h:88h PUBLIC _Sleep DF 00000000h:90h PUBLIC _Alarm DF 00000000h:98h PUBLIC _AllocOSPage DF 00000000h:0A0h PUBLIC _AllocPage DF 00000000h:0A8h PUBLIC _RegisterSvc DF 00000000h:0B0h PUBLIC _DMASetUp DF 00000000h:0B8h PUBLIC _ReadKBD DF 00000000h:0C0h PUBLIC _AddCallGate DF 00000000h:0C8h PUBLIC _AddIDTGate DF 00000000h:0D0h PUBLIC _EndOfIRQ DF 00000000h:0D8h PUBLIC _MaskIRQ DF 00000000h:0E0h PUBLIC _UnMaskIRQ DF 00000000h:0E8h PUBLIC _SetIRQVector DF 00000000h:0F0h PUBLIC _GetIRQVector DF 00000000h:0F8h PUBLIC _InitDevDr DF 00000000h:100h PUBLIC _DeviceInit DF 00000000h:108h PUBLIC _DeviceOp DF 00000000h:110h PUBLIC _DeviceStat DF 00000000h:118h PUBLIC _Beep DF 00000000h:120h PUBLIC _Tone DF 00000000h:128h PUBLIC _KillAlarm DF 00000000h:130h PUBLIC _MicroDelay DF 00000000h:138h PUBLIC _SpawnTask DF 00000000h:140h PUBLIC _GetCMOSTime DF 00000000h:148h PUBLIC _GetTimerTick DF 00000000h:150h PUBLIC _OutByte DF 00000000h:158h PUBLIC _OutWord DF 00000000h:160h PUBLIC _OutDWord DF 00000000h:168h PUBLIC _InByte DF 00000000h:170h PUBLIC _InWord DF 00000000h:178h PUBLIC _InDWord DF 00000000h:180h PUBLIC _ReadCMOS DF 00000000h:188h PUBLIC _CopyData DF 00000000h:190h PUBLIC _CopyDataR DF 00000000h:198h PUBLIC _FillData DF 00000000h:1A0h PUBLIC _CompareNCS DF 00000000h:1A8h PUBLIC _Compare DF 00000000h:1B0h PUBLIC _InWords DF 00000000h:1B8h PUBLIC _OutWords DF 00000000h:1C0h PUBLIC _MoveRequest DF 00000000h:1C8h PUBLIC _DeAllocPage DF 00000000h:1D0h PUBLIC _LoadNewJob DF 00000000h:1D8h PUBLIC _SetVidOwner DF 00000000h:1E0h PUBLIC _GetVidOwner DF 00000000h:1E8h PUBLIC _ClrScr DF 00000000h:1F0h PUBLIC _TTYOut DF 00000000h:1F8h PUBLIC _PutVidChars DF 00000000h:200h PUBLIC _SetXY DF 00000000h:208h PUBLIC _GetXY DF 00000000h:210h PUBLIC _EditLine DF 00000000h:218h PUBLIC _GetTSSExch DF 00000000h:220h PUBLIC _OpenFile DF 00000000h:228h PUBLIC _CloseFile DF 00000000h:230h PUBLIC _ReadBlock DF 00000000h:238h PUBLIC _WriteBlock DF 00000000h:240h PUBLIC _ReadBytes DF 00000000h:248h PUBLIC _WriteBytes DF 00000000h:250h PUBLIC _GetFileLFA DF 00000000h:258h PUBLIC _SetFileLFA DF 00000000h:260h PUBLIC _GetFileSize DF 00000000h:268h PUBLIC _CreateFile DF 00000000h:270h PUBLIC _RenameFile DF 00000000h:278h PUBLIC _DeleteFile DF 00000000h:280h PUBLIC _GetpJCB DF 00000000h:288h PUBLIC _QueryPages DF 00000000h:290h PUBLIC _GetPhyAdd DF 00000000h:298h PUBLIC _ScrollVid DF 00000000h:2A0h PUBLIC _GetDirSector DF 00000000h:2A8h PUBLIC _GetJobNum DF 00000000h:2B0h PUBLIC _ExitJob DF 00000000h:2B8h PUBLIC _SetUserName DF 00000000h:2C0h PUBLIC _GetUserName DF 00000000h:2C8h PUBLIC _SetCmdLine DF 00000000h:2D0h PUBLIC _GetCmdLine DF 00000000h:2D8h PUBLIC _SetPath DF 00000000h:2E0h PUBLIC _GetPath DF 00000000h:2E8h PUBLIC _SetExitJob DF 00000000h:2F0h PUBLIC _GetExitJob DF 00000000h:2F8h PUBLIC _SetSysIn DF 00000000h:300h PUBLIC _SetSysOut DF 00000000h:308h PUBLIC _GetSysIn DF 00000000h:310h PUBLIC _GetSysOut DF 00000000h:318h PUBLIC _PutVidAttrs DF 00000000h:320h PUBLIC _GetVidChar DF 00000000h:328h PUBLIC _SetNormVid DF 00000000h:330h PUBLIC _GetNormVid DF 00000000h:338h PUBLIC _Chain DF 00000000h:340h PUBLIC _SetFileSize DF 00000000h:348h PUBLIC _GetCMOSDate DF 00000000h:350h PUBLIC _CreateDir DF 00000000h:358h PUBLIC _DeleteDir DF 00000000h:360h PUBLIC _DeAliasMem DF 00000000h:368h PUBLIC _AliasMem DF 00000000h:370h PUBLIC _GetDMACount DF 00000000h:378h PUBLIC _AllocDMAPage DF 00000000h:380h PUBLIC _SetJobName DF 00000000h:388h PUBLIC _KillJob DF 00000000h:390h PUBLIC _GetSystemDisk DF 00000000h:398h PUBLIC _UnRegisterSvc DF 00000000h:3A0h ;============== End of Module =======================
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_garbage_collector.h" #include <stddef.h> #include <utility> #include "base/bind.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/location.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/sequenced_task_runner.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/thread_task_runner_handle.h" #include "base/time/time.h" #include "chrome/browser/extensions/extension_garbage_collector_factory.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/install_tracker.h" #include "chrome/browser/extensions/pending_extension_manager.h" #include "components/crx_file/id_util.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/common/extension.h" #include "extensions/common/file_util.h" #include "extensions/common/manifest_handlers/app_isolation_info.h" #include "extensions/common/one_shot_event.h" namespace extensions { namespace { // Wait this many seconds before trying to garbage collect extensions again. const int kGarbageCollectRetryDelayInSeconds = 30; // Wait this many seconds after startup to see if there are any extensions // which can be garbage collected. const int kGarbageCollectStartupDelay = 30; typedef std::multimap<std::string, base::FilePath> ExtensionPathsMultimap; void CheckExtensionDirectory(const base::FilePath& path, const ExtensionPathsMultimap& extension_paths) { base::FilePath basename = path.BaseName(); // Clean up temporary files left if Chrome crashed or quit in the middle // of an extension install. if (basename.value() == file_util::kTempDirectoryName) { base::DeleteFile(path, true); // Recursive. return; } // Parse directory name as a potential extension ID. std::string extension_id; if (base::IsStringASCII(basename.value())) { extension_id = base::UTF16ToASCII(basename.LossyDisplayName()); if (!crx_file::id_util::IdIsValid(extension_id)) extension_id.clear(); } // Delete directories that aren't valid IDs. if (extension_id.empty()) { base::DeleteFile(path, true); // Recursive. return; } typedef ExtensionPathsMultimap::const_iterator Iter; std::pair<Iter, Iter> iter_pair = extension_paths.equal_range(extension_id); // If there is no entry in the prefs file, just delete the directory and // move on. This can legitimately happen when an uninstall does not // complete, for example, when a plugin is in use at uninstall time. if (iter_pair.first == iter_pair.second) { base::DeleteFile(path, true); // Recursive. return; } // Clean up old version directories. base::FileEnumerator versions_enumerator( path, false /* Not recursive */, base::FileEnumerator::DIRECTORIES); for (base::FilePath version_dir = versions_enumerator.Next(); !version_dir.empty(); version_dir = versions_enumerator.Next()) { bool known_version = false; for (Iter iter = iter_pair.first; iter != iter_pair.second; ++iter) { if (version_dir.BaseName() == iter->second.BaseName()) { known_version = true; break; } } if (!known_version) base::DeleteFile(version_dir, true); // Recursive. } } } // namespace ExtensionGarbageCollector::ExtensionGarbageCollector( content::BrowserContext* context) : context_(context), crx_installs_in_progress_(0), weak_factory_(this) { ExtensionSystem* extension_system = ExtensionSystem::Get(context_); DCHECK(extension_system); extension_system->ready().PostDelayed( FROM_HERE, base::Bind(&ExtensionGarbageCollector::GarbageCollectExtensions, weak_factory_.GetWeakPtr()), base::TimeDelta::FromSeconds(kGarbageCollectStartupDelay)); extension_system->ready().Post( FROM_HERE, base::Bind( &ExtensionGarbageCollector::GarbageCollectIsolatedStorageIfNeeded, weak_factory_.GetWeakPtr())); InstallTracker::Get(context_)->AddObserver(this); } ExtensionGarbageCollector::~ExtensionGarbageCollector() {} // static ExtensionGarbageCollector* ExtensionGarbageCollector::Get( content::BrowserContext* context) { return ExtensionGarbageCollectorFactory::GetForBrowserContext(context); } void ExtensionGarbageCollector::Shutdown() { InstallTracker::Get(context_)->RemoveObserver(this); } void ExtensionGarbageCollector::GarbageCollectExtensionsForTest() { GarbageCollectExtensions(); } // static void ExtensionGarbageCollector::GarbageCollectExtensionsOnFileThread( const base::FilePath& install_directory, const ExtensionPathsMultimap& extension_paths) { DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); // Nothing to clean up if it doesn't exist. if (!base::DirectoryExists(install_directory)) return; base::FileEnumerator enumerator(install_directory, false, // Not recursive. base::FileEnumerator::DIRECTORIES); for (base::FilePath extension_path = enumerator.Next(); !extension_path.empty(); extension_path = enumerator.Next()) { CheckExtensionDirectory(extension_path, extension_paths); } } void ExtensionGarbageCollector::GarbageCollectExtensions() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(context_); DCHECK(extension_prefs); if (extension_prefs->pref_service()->ReadOnly()) return; if (crx_installs_in_progress_ > 0) { // Don't garbage collect while there are installations in progress, // which may be using the temporary installation directory. Try to garbage // collect again later. base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::Bind(&ExtensionGarbageCollector::GarbageCollectExtensions, weak_factory_.GetWeakPtr()), base::TimeDelta::FromSeconds(kGarbageCollectRetryDelayInSeconds)); return; } scoped_ptr<ExtensionPrefs::ExtensionsInfo> info( extension_prefs->GetInstalledExtensionsInfo()); std::multimap<std::string, base::FilePath> extension_paths; for (size_t i = 0; i < info->size(); ++i) { extension_paths.insert( std::make_pair(info->at(i)->extension_id, info->at(i)->extension_path)); } info = extension_prefs->GetAllDelayedInstallInfo(); for (size_t i = 0; i < info->size(); ++i) { extension_paths.insert( std::make_pair(info->at(i)->extension_id, info->at(i)->extension_path)); } ExtensionService* service = ExtensionSystem::Get(context_)->extension_service(); if (!service->GetFileTaskRunner()->PostTask( FROM_HERE, base::Bind(&GarbageCollectExtensionsOnFileThread, service->install_directory(), extension_paths))) { NOTREACHED(); } } void ExtensionGarbageCollector::GarbageCollectIsolatedStorageIfNeeded() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(context_); DCHECK(extension_prefs); if (!extension_prefs->NeedsStorageGarbageCollection()) return; extension_prefs->SetNeedsStorageGarbageCollection(false); scoped_ptr<base::hash_set<base::FilePath> > active_paths( new base::hash_set<base::FilePath>()); scoped_ptr<ExtensionSet> extensions = ExtensionRegistry::Get(context_)->GenerateInstalledExtensionsSet(); for (ExtensionSet::const_iterator iter = extensions->begin(); iter != extensions->end(); ++iter) { if (AppIsolationInfo::HasIsolatedStorage(iter->get())) { active_paths->insert( content::BrowserContext::GetStoragePartitionForSite( context_, util::GetSiteForExtensionId((*iter)->id(), context_)) ->GetPath()); } } ExtensionService* service = ExtensionSystem::Get(context_)->extension_service(); service->OnGarbageCollectIsolatedStorageStart(); content::BrowserContext::GarbageCollectStoragePartitions( context_, std::move(active_paths), base::Bind(&ExtensionService::OnGarbageCollectIsolatedStorageFinished, service->AsWeakPtr())); } void ExtensionGarbageCollector::OnBeginCrxInstall( const std::string& extension_id) { crx_installs_in_progress_++; } void ExtensionGarbageCollector::OnFinishCrxInstall( const std::string& extension_id, bool success) { crx_installs_in_progress_--; if (crx_installs_in_progress_ < 0) { // This can only happen if there is a mismatch in our begin/finish // accounting. NOTREACHED(); // Don't let the count go negative to avoid garbage collecting when // an install is actually in progress. crx_installs_in_progress_ = 0; } } } // namespace extensions
; A192760: Coefficient of x in the reduction by x^2->x+1 of the polynomial p(n,x) defined below in Comments. ; 0,1,4,9,18,33,58,99,166,275,452,739,1204,1957,3176,5149,8342,13509,21870,35399,57290,92711,150024,242759,392808,635593,1028428,1664049,2692506,4356585,7049122,11405739,18454894,29860667,48315596,78176299 mov $1,$0 seq $1,78642 ; Numbers with two representations as the sum of two Fibonacci numbers. sub $1,$0 mov $0,$1 sub $0,4
#ifndef DECODER_BCH_GENIUS #define DECODER_BCH_GENIUS #include <vector> #include "Module/Encoder/Encoder.hpp" #include "Module/Decoder/BCH/Decoder_BCH.hpp" namespace aff3ct { namespace module { template <typename B = int, typename R = float> class Decoder_BCH_genius : public Decoder_BCH<B,R> { protected: Encoder<B> &encoder; std::vector<B> YH_N; // hard decision input vector public: Decoder_BCH_genius(const int K, const int N, const int t, Encoder<B> &encoder, const int n_frames = 1); virtual ~Decoder_BCH_genius() = default; protected: virtual void _decode ( B *Y_N, const int frame_id); virtual void _decode_hiho (const B *Y_N, B *V_K, const int frame_id); virtual void _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id); virtual void _decode_siho (const R *Y_N, B *V_K, const int frame_id); virtual void _decode_siho_cw(const R *Y_N, B *V_N, const int frame_id); }; } } #endif /* DECODER_BCH_GENIUS */
; A024924: a(n) = Sum_{k=1..n} prime(k)*floor(n/prime(k)). ; 0,0,2,5,7,12,17,24,26,29,36,47,52,65,74,82,84,101,106,125,132,142,155,178,183,188,203,206,215,244,254,285,287,301,320,332,337,374,395,411,418,459,471,514,527,535,560,607,612,619,626,646,661,714,719,735,744,766,797,856,866,927,960,970,972,990,1006,1073,1092,1118,1132,1203,1208,1281,1320,1328,1349,1367,1385,1464,1471,1474,1517,1600,1612,1634,1679,1711,1724,1813,1823,1843,1868,1902,1951,1975,1980,2077,2086,2100 lpb $0 sub $0,1 mov $2,$0 max $2,0 seq $2,8472 ; Sum of the distinct primes dividing n. add $1,$2 lpe mov $0,$1
;name : pipedemo4.asm ; ;build : nasm -felf64 pipedemo4.asm z -o pipedemo4.o ; ld -s -melf_x86_64 -o pipedemo4 pipedemo4.o ; ;description : A demonstration on pipes based on an example from Beej's Guide to IPC ; Here the program opens the write end of the pipe, writes data in it ; and retrieve it through the read end of the pipe. The buffer must be large ; enough, a to small buffer leads to loss of data because not all data will be ; read from the pipe. ; ;source : Beejs guide to IPC - http://beej.us/guide/bgipc/output/html/multipage/pipes.html ; ;August 24, 2014 : assembler 64 bits version bits 64 [list -] %include "unistd.inc" [list +] %define DATA "this is the test sentence" %define DOUBLE_QUOTE 0x22 section .bss ; pfds pfds: .read: resd 1 ;read end .write: resd 1 ;write end buffer: resb 1022 ;space for the data read section .rodata msg1: db "writing to file descriptor #" .len: equ $-msg1 msg2: db "reading from file descriptor #" .len: equ $-msg2 data: db DATA .len: equ $-data msg3: db "read ",DOUBLE_QUOTE .len: equ $-msg3 msg4: db DOUBLE_QUOTE,10 .len: equ $-msg4 pipeerror: db "pipe call error" .len: equ $-pipeerror section .data ;this program doesn't use a lot of pipes so I assume one byte for showing ;the filedescriptors will sufice. On the other hand a conversion to decimal ;ascii is necessary. (should be done in real programs) pfdread: db 0x30,10 pfdwrite: db 0x30,10 output: dq msg1,msg1.len dq pfdwrite,2 dq msg2,msg2.len dq pfdread,2 dq msg3,msg3.len dq buffer nread: dq 0 dq msg4,msg4.len section .text global _start _start: ; create pipe, pdfs is an array to the READ and WRITE ends of the pipe syscall pipe, pfds jns .startpipe ;rax < 0 is error syscall write,stderr,pipeerror,pipeerror.len syscall exit,1 .startpipe: ; prepare messages to be displayed with one syscall mov eax,[pfds.read] add byte[pfdread],al mov eax,[pfds.write] add byte[pfdwrite],al ; write data to the pipe mov edi, dword[pfds.write] syscall write,rdi,data,data.len ; read data from the pipe in the buffer mov edi, dword[pfds.read] syscall read,rdi,buffer,1022 ;store nbytesread mov [nread],rax ; write output 7 lines to stdout syscall writev,stdout,output,7 syscall exit, 0
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r15 push %rbp push %rcx push %rdi push %rsi lea addresses_WT_ht+0x1c66b, %r10 nop and %rbp, %rbp mov (%r10), %r12d nop xor %rbp, %rbp lea addresses_A_ht+0x1182b, %rsi lea addresses_A_ht+0xc06b, %rdi nop nop nop nop and %r15, %r15 mov $25, %rcx rep movsq add $10028, %rcx lea addresses_D_ht+0xc5eb, %rdi nop nop nop xor %rsi, %rsi and $0xffffffffffffffc0, %rdi movntdqa (%rdi), %xmm6 vpextrq $1, %xmm6, %r10 nop nop nop cmp %r12, %r12 lea addresses_normal_ht+0x169f, %rsi lea addresses_A_ht+0x906b, %rdi nop nop nop and $17056, %r13 mov $41, %rcx rep movsq add %r13, %r13 lea addresses_UC_ht+0x1b46b, %rcx clflush (%rcx) nop nop nop nop nop xor $55475, %r15 mov $0x6162636465666768, %r12 movq %r12, (%rcx) nop nop nop sub %r13, %r13 lea addresses_D_ht+0x194eb, %rsi lea addresses_A_ht+0x160ab, %rdi clflush (%rsi) nop nop nop sub %r10, %r10 mov $102, %rcx rep movsq nop nop nop nop nop add $2553, %rsi lea addresses_WT_ht+0x924b, %rcx nop nop nop nop xor $55755, %rbp mov $0x6162636465666768, %r10 movq %r10, %xmm3 movups %xmm3, (%rcx) and $47962, %rcx lea addresses_WC_ht+0xbe6b, %rsi lea addresses_WC_ht+0x1ac6b, %rdi nop nop nop nop nop inc %r13 mov $111, %rcx rep movsq nop nop nop nop nop xor %r13, %r13 lea addresses_WT_ht+0x4aeb, %r10 nop cmp $24171, %rcx mov $0x6162636465666768, %r13 movq %r13, (%r10) nop nop sub %rcx, %rcx lea addresses_WC_ht+0x1b5f, %r10 cmp %r13, %r13 mov $0x6162636465666768, %rdi movq %rdi, (%r10) nop nop nop nop cmp $22618, %r12 lea addresses_UC_ht+0x18bb, %rcx nop dec %rdi and $0xffffffffffffffc0, %rcx vmovntdqa (%rcx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %r12 nop and $5218, %rsi lea addresses_A_ht+0x11585, %r15 and $20187, %r10 mov (%r15), %rsi nop sub %rbp, %rbp lea addresses_WT_ht+0xf46b, %rsi lea addresses_WC_ht+0x206b, %rdi nop nop cmp $15153, %r15 mov $55, %rcx rep movsq nop nop nop xor %rcx, %rcx lea addresses_normal_ht+0x2e1b, %rdi nop nop nop add $64707, %rbp movups (%rdi), %xmm1 vpextrq $1, %xmm1, %r15 nop nop nop nop nop lfence lea addresses_WC_ht+0x6c6b, %r13 nop nop nop nop nop cmp %rbp, %rbp movw $0x6162, (%r13) nop xor %rbp, %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %r15 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r14 push %r15 push %r8 push %rbx push %rdi push %rdx // Store lea addresses_US+0x1e06b, %rdi nop nop nop nop add $9752, %r14 mov $0x5152535455565758, %rbx movq %rbx, (%rdi) nop sub %r15, %r15 // Faulty Load lea addresses_US+0x1e06b, %rdx nop nop nop nop sub %rdi, %rdi mov (%rdx), %r8 lea oracles, %r14 and $0xff, %r8 shlq $12, %r8 mov (%r14,%r8,1), %r8 pop %rdx pop %rdi pop %rbx pop %r8 pop %r15 pop %r14 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': True, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 0}, 'dst': {'same': True, 'type': 'addresses_A_ht', 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 6}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': True, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': True, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 10}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': True, 'AVXalign': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'00': 25, '58': 21804} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
db DEX_CORSOLA ; pokedex id db 55 ; base hp db 55 ; base attack db 85 ; base defense db 35 ; base speed db 75 ; base special db WATER ; species type 1 db STEEL ; species type 2 db 60 ; catch rate db 99 ; base exp yield INCBIN "pic/ymon/corsola.pic",0,1 ; sprite dimensions dw CorsolaPicFront dw CorsolaPicBack ; attacks known at lvl 0 db TACKLE db SPLASH db 0 db 0 db 5 ; growth rate ; learnset tmlearn 6,8 tmlearn 9,10,11,12,13,14 tmlearn 20 tmlearn 31,32 tmlearn 33,34 tmlearn 44 tmlearn 50,53 db BANK(CorsolaPicFront) ; padding
; A154576: a(n) = 2*n^2 + 14*n + 5. ; 21,41,65,93,125,161,201,245,293,345,401,461,525,593,665,741,821,905,993,1085,1181,1281,1385,1493,1605,1721,1841,1965,2093,2225,2361,2501,2645,2793,2945,3101,3261,3425,3593,3765,3941,4121,4305,4493,4685,4881,5081,5285,5493,5705,5921,6141,6365,6593,6825,7061,7301,7545,7793,8045,8301,8561,8825,9093,9365,9641,9921,10205,10493,10785,11081,11381,11685,11993,12305,12621,12941,13265,13593,13925,14261,14601,14945,15293,15645,16001,16361,16725,17093,17465,17841,18221,18605,18993,19385,19781,20181,20585,20993,21405,21821,22241,22665,23093,23525,23961,24401,24845,25293,25745,26201,26661,27125,27593,28065,28541,29021,29505,29993,30485,30981,31481,31985,32493,33005,33521,34041,34565,35093,35625,36161,36701,37245,37793,38345,38901,39461,40025,40593,41165,41741,42321,42905,43493,44085,44681,45281,45885,46493,47105,47721,48341,48965,49593,50225,50861,51501,52145,52793,53445,54101,54761,55425,56093,56765,57441,58121,58805,59493,60185,60881,61581,62285,62993,63705,64421,65141,65865,66593,67325,68061,68801,69545,70293,71045,71801,72561,73325,74093,74865,75641,76421,77205,77993,78785,79581,80381,81185,81993,82805,83621,84441,85265,86093,86925,87761,88601,89445,90293,91145,92001,92861,93725,94593,95465,96341,97221,98105,98993,99885,100781,101681,102585,103493,104405,105321,106241,107165,108093,109025,109961,110901,111845,112793,113745,114701,115661,116625,117593,118565,119541,120521,121505,122493,123485,124481,125481,126485,127493,128505 mov $1,$0 add $0,9 mul $1,2 mul $1,$0 add $1,21
.export _lvl1 _lvl1: .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21, 21, 21 .byte 21, 21, 72, 81, 80, 144, 144, 144, 144, 144, 80, 81, 72, 21, 21, 21 .byte 21, 21, 72, 80, 144, 144, 144, 144, 144, 144, 144, 80, 72, 20, 21, 21 .byte 21, 21, 72, 144, 72, 72, 72, 72, 72, 72, 144, 144, 72, 21, 21, 21 .byte 21, 21, 72, 144, 72, 72, 72, 72, 72, 72, 144, 144, 72, 21, 21, 21 .byte 21, 21, 72, 80, 144, 144, 144, 144, 144, 144, 144, 80, 72, 21, 21, 21 .byte 21, 22, 72, 81, 80, 144, 144, 144, 144, 144, 80, 70, 72, 21, 21, 21 .byte 21, 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 20, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 51, 0, 55, 1, 56, 1, 57, 1, 75, 1, 91, 1, 131, 5, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21 .byte 21, 72, 72, 72, 72, 72, 72, 72, 21, 72, 72, 72, 72, 72, 21, 21 .byte 21, 72, 145, 144, 144, 144, 144, 72, 21, 72, 144, 144, 145, 72, 21, 21 .byte 21, 72, 72, 72, 72, 72, 144, 72, 21, 72, 144, 72, 72, 72, 21, 21 .byte 21, 21, 21, 21, 72, 72, 144, 72, 72, 72, 144, 72, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 70, 80, 80, 80, 80, 81, 72, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 144, 72, 72, 72, 72, 144, 72, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 144, 72, 72, 72, 72, 144, 72, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 145, 144, 144, 144, 144, 145, 72, 21, 21, 21, 21 .byte 21, 22, 21, 21, 72, 72, 72, 72, 72, 72, 72, 72, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 34, 0, 44, 2, 87, 1, 88, 1, 89, 1, 101, 1, 117, 1, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 72, 72, 72, 72, 72, 72, 72, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 72, 81, 80, 80, 80, 70, 72, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 80, 144, 144, 144, 80, 72, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 72, 80, 144, 144, 144, 80, 72, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 80, 144, 144, 144, 80, 72, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 72, 144, 144, 144, 72, 72, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 72, 144, 144, 144, 72, 72, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 80, 144, 144, 144, 80, 72, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 72, 80, 144, 144, 144, 80, 72, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 80, 144, 144, 144, 80, 72, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 72, 81, 72, 81, 72, 81, 72, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 72, 72, 72, 72, 72, 72, 21, 21, 21, 21, 21 ; Sprites .byte 21, 0, 22, 1, 23, 1, 24, 1, 71, 1, 165, 6, 167, 5, 169, 6 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21, 21, 21 .byte 21, 21, 72, 81, 81, 81, 81, 81, 81, 81, 81, 81, 72, 21, 21, 21 .byte 21, 21, 72, 81, 144, 144, 144, 144, 144, 144, 144, 81, 72, 21, 21, 21 .byte 21, 21, 72, 81, 72, 144, 144, 144, 144, 144, 72, 81, 72, 21, 21, 21 .byte 21, 21, 72, 81, 72, 72, 72, 144, 72, 72, 72, 81, 72, 21, 21, 21 .byte 21, 21, 72, 81, 80, 144, 144, 144, 144, 144, 80, 81, 72, 21, 21, 21 .byte 21, 21, 72, 81, 144, 144, 144, 144, 144, 144, 144, 81, 72, 21, 21, 21 .byte 21, 22, 72, 70, 81, 81, 81, 81, 81, 81, 81, 81, 72, 21, 21, 21 .byte 21, 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 35, 1, 39, 0, 59, 1, 67, 1, 69, 6, 73, 6, 91, 1, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 72, 72, 72, 72, 21, 21, 21, 21, 72, 72, 72, 72, 21, 21 .byte 21, 21, 72, 134, 145, 72, 21, 21, 21, 21, 72, 145, 145, 72, 21, 21 .byte 21, 21, 72, 144, 144, 72, 21, 21, 21, 21, 72, 144, 144, 72, 21, 21 .byte 21, 21, 72, 144, 144, 72, 21, 21, 21, 21, 72, 144, 144, 72, 21, 21 .byte 21, 21, 72, 144, 144, 72, 21, 20, 21, 21, 72, 144, 144, 72, 21, 21 .byte 21, 21, 72, 144, 144, 72, 21, 21, 21, 21, 72, 144, 144, 72, 21, 21 .byte 21, 21, 72, 144, 144, 72, 72, 72, 72, 72, 72, 144, 144, 72, 21, 21 .byte 21, 21, 72, 80, 80, 81, 80, 80, 80, 80, 81, 80, 80, 72, 21, 21 .byte 21, 22, 72, 80, 80, 72, 72, 72, 72, 72, 72, 80, 80, 72, 72, 72 .byte 21, 21, 72, 80, 80, 72, 72, 72, 72, 72, 72, 80, 80, 80, 81, 72 .byte 21, 21, 72, 145, 145, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 72 .byte 21, 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72 ; Sprites .byte 19, 0, 27, 6, 83, 1, 99, 1, 120, 1, 124, 1, 158, 5, 163, 5 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21, 21 .byte 21, 72, 81, 80, 80, 80, 80, 80, 80, 80, 80, 80, 70, 72, 21, 21 .byte 21, 72, 80, 80, 80, 72, 72, 72, 72, 72, 72, 72, 80, 72, 21, 21 .byte 21, 72, 80, 144, 144, 144, 144, 144, 144, 144, 144, 72, 80, 72, 21, 21 .byte 22, 72, 80, 144, 144, 144, 144, 144, 144, 144, 144, 80, 80, 72, 21, 21 .byte 21, 72, 80, 144, 144, 144, 144, 144, 144, 144, 144, 80, 80, 72, 21, 21 .byte 21, 72, 81, 80, 80, 80, 80, 80, 80, 80, 80, 80, 81, 72, 21, 21 .byte 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 50, 0, 54, 1, 55, 1, 56, 6, 90, 1, 130, 1, 140, 1, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 21 .byte 21, 136, 145, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, 136, 21 .byte 21, 136, 144, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 136, 21 .byte 21, 136, 144, 80, 80, 144, 136, 136, 136, 136, 136, 136, 136, 136, 136, 21 .byte 21, 136, 144, 80, 80, 136, 21, 22, 22, 21, 134, 21, 22, 21, 136, 21 .byte 21, 136, 144, 80, 80, 144, 136, 136, 136, 136, 145, 136, 136, 136, 136, 21 .byte 21, 136, 144, 80, 80, 80, 80, 80, 80, 80, 80, 136, 136, 136, 136, 21 .byte 21, 136, 144, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 136, 21 .byte 21, 136, 145, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, 136, 21 .byte 21, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 34, 0, 45, 2, 56, 1, 120, 1, 146, 2, 157, 2, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 136, 136, 136, 136, 136, 136, 136, 136, 136, 21, 21, 21, 21 .byte 21, 21, 21, 136, 145, 144, 144, 144, 144, 144, 145, 136, 22, 21, 21, 21 .byte 21, 21, 21, 136, 144, 136, 136, 136, 136, 136, 144, 136, 21, 21, 21, 21 .byte 21, 21, 21, 136, 144, 80, 80, 80, 80, 80, 144, 136, 21, 21, 21, 21 .byte 21, 21, 21, 136, 144, 80, 80, 80, 80, 80, 144, 136, 21, 21, 21, 21 .byte 21, 21, 21, 136, 144, 80, 80, 80, 80, 80, 144, 136, 21, 21, 21, 21 .byte 21, 21, 21, 136, 144, 80, 80, 80, 80, 80, 144, 136, 21, 21, 21, 21 .byte 21, 22, 21, 136, 144, 80, 72, 72, 72, 80, 144, 136, 21, 21, 21, 21 .byte 21, 21, 21, 136, 134, 144, 144, 144, 144, 144, 145, 136, 21, 22, 21, 21 .byte 21, 21, 21, 136, 136, 136, 136, 136, 136, 136, 136, 136, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 36, 0, 39, 8, 40, 8, 42, 1, 74, 2, 122, 2, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21, 21 .byte 21, 72, 145, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, 72, 21, 21 .byte 21, 72, 144, 80, 80, 80, 80, 144, 80, 80, 80, 80, 144, 72, 21, 21 .byte 21, 72, 144, 80, 80, 80, 80, 70, 80, 80, 80, 80, 144, 72, 21, 21 .byte 21, 72, 144, 144, 144, 144, 144, 145, 144, 144, 144, 144, 144, 72, 21, 21 .byte 21, 72, 144, 80, 80, 80, 80, 144, 80, 80, 80, 80, 144, 72, 21, 21 .byte 21, 72, 144, 80, 80, 80, 80, 144, 80, 80, 80, 80, 144, 72, 21, 21 .byte 21, 72, 145, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, 72, 21, 21 .byte 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 34, 7, 44, 7, 82, 1, 83, 8, 87, 0, 103, 8, 119, 8, 135, 8 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21 .byte 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21 .byte 21, 72, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 72, 21 .byte 21, 72, 80, 80, 144, 144, 144, 144, 144, 144, 144, 80, 80, 80, 72, 21 .byte 21, 72, 80, 80, 144, 136, 136, 136, 136, 136, 144, 80, 80, 80, 72, 21 .byte 21, 72, 80, 80, 144, 136, 21, 22, 21, 136, 144, 80, 80, 80, 72, 21 .byte 21, 72, 80, 80, 144, 136, 20, 21, 20, 136, 144, 80, 80, 80, 72, 21 .byte 21, 72, 80, 80, 144, 136, 136, 136, 136, 136, 144, 80, 80, 80, 72, 21 .byte 21, 72, 80, 80, 144, 144, 144, 144, 144, 144, 144, 80, 80, 80, 72, 21 .byte 21, 72, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 72, 21 .byte 21, 72, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 70, 72, 21 .byte 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21 ; Sprites .byte 34, 0, 39, 1, 61, 4, 114, 1, 162, 4, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 22, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21 .byte 21, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 21 .byte 21, 136, 81, 80, 80, 72, 80, 80, 80, 80, 80, 80, 80, 81, 136, 21 .byte 21, 136, 80, 80, 144, 144, 144, 144, 144, 144, 144, 80, 80, 80, 136, 21 .byte 21, 136, 80, 80, 144, 72, 72, 72, 72, 72, 144, 80, 80, 80, 136, 22 .byte 21, 136, 80, 80, 144, 72, 21, 22, 21, 72, 144, 80, 80, 80, 136, 21 .byte 21, 136, 80, 80, 144, 72, 20, 21, 20, 72, 144, 80, 80, 80, 136, 21 .byte 21, 136, 80, 80, 144, 72, 21, 22, 21, 72, 144, 80, 80, 80, 136, 21 .byte 22, 136, 80, 80, 144, 72, 72, 72, 72, 72, 144, 80, 80, 80, 136, 21 .byte 21, 136, 80, 80, 144, 144, 144, 144, 144, 144, 144, 80, 80, 80, 136, 21 .byte 21, 136, 81, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 70, 136, 21 .byte 21, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 21 ; Sprites .byte 34, 0, 53, 1, 61, 4, 100, 1, 108, 7, 162, 4, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 72, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 72, 145, 72, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 72, 145, 72, 72, 72, 72, 72, 72, 72, 22, 21, 21, 21 .byte 21, 21, 72, 144, 144, 144, 144, 144, 144, 144, 134, 144, 72, 21, 21, 21 .byte 21, 21, 72, 144, 136, 144, 144, 144, 144, 144, 144, 145, 72, 21, 21, 21 .byte 21, 21, 72, 144, 144, 144, 144, 145, 145, 145, 144, 144, 72, 21, 21, 21 .byte 21, 21, 72, 144, 144, 144, 144, 144, 144, 145, 144, 144, 72, 21, 21, 21 .byte 21, 21, 22, 72, 144, 144, 144, 144, 144, 144, 144, 72, 21, 21, 21, 21 .byte 21, 22, 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 36, 0, 75, 5, 91, 6, 100, 8, 107, 7, 116, 8, 132, 1, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21, 21, 21, 21 .byte 21, 21, 21, 72, 144, 144, 144, 144, 144, 144, 144, 72, 22, 21, 21, 21 .byte 21, 21, 21, 72, 144, 72, 72, 72, 72, 72, 144, 72, 21, 21, 21, 21 .byte 21, 21, 21, 72, 144, 144, 144, 144, 144, 144, 144, 72, 21, 21, 21, 21 .byte 21, 21, 21, 72, 144, 144, 144, 144, 144, 144, 144, 72, 21, 21, 21, 21 .byte 21, 21, 21, 72, 144, 144, 144, 144, 144, 144, 144, 72, 21, 21, 21, 21 .byte 21, 21, 21, 72, 144, 144, 144, 144, 144, 144, 144, 72, 21, 21, 21, 21 .byte 21, 22, 21, 72, 144, 144, 72, 72, 72, 144, 144, 72, 21, 21, 21, 21 .byte 21, 21, 21, 72, 70, 144, 144, 144, 144, 144, 144, 72, 21, 22, 21, 21 .byte 21, 21, 21, 72, 72, 72, 72, 72, 72, 72, 72, 72, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 36, 0, 39, 8, 40, 8, 42, 1, 73, 2, 121, 2, 154, 1, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 20, 22, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21 .byte 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 .byte 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ; Sprites .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 .byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ; End sprite data ;Overrides .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 .byte 0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0 ; No last room because rom space
setrepeat 2 frame 0, 07 frame 1, 07 frame 2, 07 frame 1, 07 dorepeat 1 endanim
include xlibproc.inc include Wintab.inc PROC_TEMPLATE WTSet, 4, Wintab, -, 62
/**************************************************************************************************************************************************** * Copyright 2019 NXP * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * Neither the name of the NXP. nor the names of * its contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************************************************************************************/ #include "EffectOffscreen.hpp" #include <FslBase/UncheckedNumericCast.hpp> #include <FslBase/Log/Log3Fmt.hpp> #include <FslBase/Math/MathHelper.hpp> #include <FslGraphics/Vertices/VertexPositionTexture.hpp> #include <FslGraphics/Vertices/VertexPositionTextureTexture.hpp> #include <FslUtil/Vulkan1_0/Draft/VulkanImageCreator.hpp> #include <FslUtil/Vulkan1_0/Exceptions.hpp> #include <FslUtil/Vulkan1_0/Util/VMVertexBufferUtil.hpp> #include <RapidVulkan/Check.hpp> #include <vulkan/vulkan.h> #include <array> #include <algorithm> #include <cmath> namespace Fsl { using namespace Vulkan; namespace { constexpr const float BOTTOM_HALF_SPLIT_PERCENTAGE = 0.25f; const uint32_t SIZE_OFFSCREEN = 512; const auto VERTEX_BUFFER_BIND_ID = 0; // B D // |\| // A C // A = 1.0 const float CUBE_DIMENSIONS = 100.0f; const float CUBE_CEILING = CUBE_DIMENSIONS; const float CUBE_FLOOR = -CUBE_DIMENSIONS; const float CUBE_LEFT = -CUBE_DIMENSIONS; const float CUBE_RIGHT = CUBE_DIMENSIONS; const float CUBE_BACK = CUBE_DIMENSIONS; // zBack const float CUBE_FRONT = -CUBE_DIMENSIONS; // zFront const float CUBE_U0 = 0.0f; const float CUBE_U1 = 1.0f; const float CUBE_V0 = 1.0f; const float CUBE_V1 = 0.0f; VulkanBasic::DemoAppVulkanSetup CreateSetup() { using namespace VulkanBasic; DemoAppVulkanSetup setup; setup.DepthBuffer = DepthBufferMode::Enabled; // This allows us to reuse the main depth buffer even when the actual 'screen' is too small for our offscreen buffer setup.DepthBufferMinimumExtent = PxExtent2D(SIZE_OFFSCREEN, SIZE_OFFSCREEN); return setup; } const std::array<VertexPositionTexture, 6 * 6> g_vertices = { // Floor VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_FLOOR, CUBE_BACK), Vector2(CUBE_U1, CUBE_V1)), // LB VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_FLOOR, CUBE_FRONT), Vector2(CUBE_U0, CUBE_V1)), // LF VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_FLOOR, CUBE_FRONT), Vector2(CUBE_U0, CUBE_V0)), // RF VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_FLOOR, CUBE_BACK), Vector2(CUBE_U1, CUBE_V1)), // LB VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_FLOOR, CUBE_FRONT), Vector2(CUBE_U0, CUBE_V0)), // RF VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_FLOOR, CUBE_BACK), Vector2(CUBE_U1, CUBE_V0)), // RB // Ceiling VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_CEILING, CUBE_FRONT), Vector2(CUBE_U1, CUBE_V1)), // LF VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_CEILING, CUBE_BACK), Vector2(CUBE_U0, CUBE_V1)), // LB VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_CEILING, CUBE_FRONT), Vector2(CUBE_U1, CUBE_V0)), // RF VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_CEILING, CUBE_FRONT), Vector2(CUBE_U1, CUBE_V0)), // RF VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_CEILING, CUBE_BACK), Vector2(CUBE_U0, CUBE_V1)), // LB VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_CEILING, CUBE_BACK), Vector2(CUBE_U0, CUBE_V0)), // RB // Back wall VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_CEILING, CUBE_BACK), Vector2(CUBE_U1, CUBE_V0)), VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_FLOOR, CUBE_BACK), Vector2(CUBE_U1, CUBE_V1)), VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_FLOOR, CUBE_BACK), Vector2(CUBE_U0, CUBE_V1)), VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_CEILING, CUBE_BACK), Vector2(CUBE_U1, CUBE_V0)), VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_FLOOR, CUBE_BACK), Vector2(CUBE_U0, CUBE_V1)), VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_CEILING, CUBE_BACK), Vector2(CUBE_U0, CUBE_V0)), // Front wall VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_CEILING, CUBE_FRONT), Vector2(CUBE_U0, CUBE_V0)), VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_FLOOR, CUBE_FRONT), Vector2(CUBE_U0, CUBE_V1)), VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_FLOOR, CUBE_FRONT), Vector2(CUBE_U1, CUBE_V1)), VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_CEILING, CUBE_FRONT), Vector2(CUBE_U0, CUBE_V0)), VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_FLOOR, CUBE_FRONT), Vector2(CUBE_U1, CUBE_V1)), VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_CEILING, CUBE_FRONT), Vector2(CUBE_U1, CUBE_V0)), //// Right wall VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_FLOOR, CUBE_BACK), Vector2(CUBE_U1, CUBE_V1)), // FB VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_FLOOR, CUBE_FRONT), Vector2(CUBE_U0, CUBE_V1)), // FF VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_CEILING, CUBE_FRONT), Vector2(CUBE_U0, CUBE_V0)), // CF VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_FLOOR, CUBE_BACK), Vector2(CUBE_U1, CUBE_V1)), // FB VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_CEILING, CUBE_FRONT), Vector2(CUBE_U0, CUBE_V0)), // CF VertexPositionTexture(Vector3(CUBE_RIGHT, CUBE_CEILING, CUBE_BACK), Vector2(CUBE_U1, CUBE_V0)), // CB // Left wall VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_FLOOR, CUBE_FRONT), Vector2(CUBE_U1, CUBE_V1)), // FF VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_FLOOR, CUBE_BACK), Vector2(CUBE_U0, CUBE_V1)), // FB VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_CEILING, CUBE_FRONT), Vector2(CUBE_U1, CUBE_V0)), // CF VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_CEILING, CUBE_FRONT), Vector2(CUBE_U1, CUBE_V0)), // CF VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_FLOOR, CUBE_BACK), Vector2(CUBE_U0, CUBE_V1)), // FB VertexPositionTexture(Vector3(CUBE_LEFT, CUBE_CEILING, CUBE_BACK), Vector2(CUBE_U0, CUBE_V0)), // CB }; constexpr std::array<VertexPositionTextureTexture, 12> CreateDoubleQuadVertexArray(const float size) { // B D // |\| // A C // A = 1.0 constexpr const float ySplitPercentage = BOTTOM_HALF_SPLIT_PERCENTAGE; const float x0 = -size; const float x1 = size; const float y0 = -size; const float y1 = size * ySplitPercentage; const float y2 = size; const float zPos = 0.0f; const float u0 = 0.0f; const float u1 = 1.0f; const float v0 = 0.0f; const float v1 = std::min(0.5f + (0.5f * ySplitPercentage), 1.0f); const float v2 = 0.0f; const float u0b = 0.0f; const float u1b = 1.0f; const float v0b = 0.0f; const float v1b = 0.0f; const float v2b = 1.0f; std::array<VertexPositionTextureTexture, 12> vertices = { VertexPositionTextureTexture(Vector3(x0, y1, zPos), Vector2(u0, v1), Vector2(u0b, v1b)), VertexPositionTextureTexture(Vector3(x0, y0, zPos), Vector2(u0, v0), Vector2(u0b, v0b)), VertexPositionTextureTexture(Vector3(x1, y0, zPos), Vector2(u1, v0), Vector2(u1b, v0b)), VertexPositionTextureTexture(Vector3(x0, y1, zPos), Vector2(u0, v1), Vector2(u0b, v1b)), VertexPositionTextureTexture(Vector3(x1, y0, zPos), Vector2(u1, v0), Vector2(u1b, v0b)), VertexPositionTextureTexture(Vector3(x1, y1, zPos), Vector2(u1, v1), Vector2(u1b, v1b)), VertexPositionTextureTexture(Vector3(x0, y2, zPos), Vector2(u0, v2), Vector2(u0b, v2b)), VertexPositionTextureTexture(Vector3(x0, y1, zPos), Vector2(u0, v1), Vector2(u0b, v1b)), VertexPositionTextureTexture(Vector3(x1, y1, zPos), Vector2(u1, v1), Vector2(u1b, v1b)), VertexPositionTextureTexture(Vector3(x0, y2, zPos), Vector2(u0, v2), Vector2(u0b, v2b)), VertexPositionTextureTexture(Vector3(x1, y1, zPos), Vector2(u1, v1), Vector2(u1b, v1b)), VertexPositionTextureTexture(Vector3(x1, y2, zPos), Vector2(u1, v2), Vector2(u1b, v2b)), }; return vertices; } VUTexture CreateTexture(const Vulkan::VUDevice& device, const Vulkan::VUDeviceQueueRecord& deviceQueue, const std::shared_ptr<IContentManager>& contentManager, const IO::Path& filename, const bool repeat, const bool generateMipMaps) { VulkanImageCreator imageCreator(device, deviceQueue.Queue, deviceQueue.QueueFamilyIndex); Texture texture = contentManager->ReadTexture(filename, PixelFormat::R8G8B8A8_UNORM, BitmapOrigin::Undefined, PixelChannelOrder::Undefined, generateMipMaps); VkSamplerCreateInfo samplerCreateInfo{}; samplerCreateInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; samplerCreateInfo.magFilter = VK_FILTER_LINEAR; samplerCreateInfo.minFilter = VK_FILTER_LINEAR; samplerCreateInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR; samplerCreateInfo.addressModeU = !repeat ? VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE : VK_SAMPLER_ADDRESS_MODE_REPEAT; samplerCreateInfo.addressModeV = !repeat ? VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE : VK_SAMPLER_ADDRESS_MODE_REPEAT; samplerCreateInfo.addressModeW = !repeat ? VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE : VK_SAMPLER_ADDRESS_MODE_REPEAT; samplerCreateInfo.mipLodBias = 0.0f; samplerCreateInfo.anisotropyEnable = VK_FALSE; samplerCreateInfo.maxAnisotropy = 1.0f; samplerCreateInfo.compareEnable = VK_FALSE; samplerCreateInfo.compareOp = VK_COMPARE_OP_NEVER; samplerCreateInfo.minLod = 0.0f; samplerCreateInfo.maxLod = static_cast<float>(texture.GetLevels()); samplerCreateInfo.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK; return imageCreator.CreateTexture(texture, samplerCreateInfo); } RapidVulkan::DescriptorSetLayout CreateDescriptorSetLayout(const VUDevice& device) { std::array<VkDescriptorSetLayoutBinding, 2> setLayoutBindings{}; // Binding 0 : Vertex shader uniform buffer setLayoutBindings[0].binding = 0; setLayoutBindings[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; setLayoutBindings[0].descriptorCount = 1; setLayoutBindings[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT; // Binding 1 : Fragment shader image sampler setLayoutBindings[1].binding = 1; setLayoutBindings[1].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; setLayoutBindings[1].descriptorCount = 1; setLayoutBindings[1].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; VkDescriptorSetLayoutCreateInfo descriptorLayout{}; descriptorLayout.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; descriptorLayout.bindingCount = UncheckedNumericCast<uint32_t>(setLayoutBindings.size()); descriptorLayout.pBindings = setLayoutBindings.data(); return RapidVulkan::DescriptorSetLayout(device.Get(), descriptorLayout); } RapidVulkan::DescriptorSetLayout CreateEffectDescriptorSetLayout(const VUDevice& device) { std::array<VkDescriptorSetLayoutBinding, 3> setLayoutBindings{}; // Binding 0 : Vertex shader uniform buffer setLayoutBindings[0].binding = 0; setLayoutBindings[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; setLayoutBindings[0].descriptorCount = 1; setLayoutBindings[0].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; // Binding 1 : Fragment shader image sampler setLayoutBindings[1].binding = 1; setLayoutBindings[1].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; setLayoutBindings[1].descriptorCount = 1; setLayoutBindings[1].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; // Binding 2 : Fragment shader image sampler setLayoutBindings[2].binding = 2; setLayoutBindings[2].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; setLayoutBindings[2].descriptorCount = 1; setLayoutBindings[2].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; VkDescriptorSetLayoutCreateInfo descriptorLayout{}; descriptorLayout.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; descriptorLayout.bindingCount = UncheckedNumericCast<uint32_t>(setLayoutBindings.size()); descriptorLayout.pBindings = setLayoutBindings.data(); return RapidVulkan::DescriptorSetLayout(device.Get(), descriptorLayout); } RapidVulkan::DescriptorPool CreateDescriptorPool(const Vulkan::VUDevice& device, const uint32_t count) { // Example uses one ubo and one image sampler std::array<VkDescriptorPoolSize, 2> poolSizes{}; poolSizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; poolSizes[0].descriptorCount = count; poolSizes[1].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; poolSizes[1].descriptorCount = count * 2; VkDescriptorPoolCreateInfo descriptorPoolInfo{}; descriptorPoolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; descriptorPoolInfo.maxSets = count; descriptorPoolInfo.poolSizeCount = UncheckedNumericCast<uint32_t>(poolSizes.size()); descriptorPoolInfo.pPoolSizes = poolSizes.data(); return RapidVulkan::DescriptorPool(device.Get(), descriptorPoolInfo); } Vulkan::VUBufferMemory CreateVertexShaderUBO(const Vulkan::VUDevice& device, const VkDeviceSize size) { VkBufferCreateInfo bufferCreateInfo{}; bufferCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; bufferCreateInfo.size = size; bufferCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; bufferCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; Vulkan::VUBufferMemory buffer(device, bufferCreateInfo, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); // Keep the buffer mapped as we update it each frame buffer.Map(); return buffer; } VkDescriptorSet CreateDescriptorSet(const RapidVulkan::DescriptorPool& descriptorPool, const RapidVulkan::DescriptorSetLayout& descriptorSetLayout) { assert(descriptorPool.IsValid()); assert(descriptorSetLayout.IsValid()); // Allocate a new descriptor set from the global descriptor pool VkDescriptorSetAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; allocInfo.descriptorPool = descriptorPool.Get(); allocInfo.descriptorSetCount = 1; allocInfo.pSetLayouts = descriptorSetLayout.GetPointer(); VkDescriptorSet descriptorSet = nullptr; RapidVulkan::CheckError(vkAllocateDescriptorSets(descriptorPool.GetDevice(), &allocInfo, &descriptorSet), "vkAllocateDescriptorSets", __FILE__, __LINE__); return descriptorSet; } VkDescriptorSet UpdateDescriptorSet(const VkDevice device, const VkDescriptorSet descriptorSet, const VUBufferMemory& uboBuffer, const VUTexture& texture) { assert(descriptorSet != nullptr); assert(uboBuffer.IsValid()); assert(texture.IsValid()); std::array<VkWriteDescriptorSet, 2> writeDescriptorSets{}; // Binding 0 : Vertex shader uniform buffer auto uboBufferInfo = uboBuffer.GetDescriptorBufferInfo(); writeDescriptorSets[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; writeDescriptorSets[0].pNext = nullptr; writeDescriptorSets[0].dstSet = descriptorSet; writeDescriptorSets[0].dstBinding = 0; writeDescriptorSets[0].descriptorCount = 1; writeDescriptorSets[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; writeDescriptorSets[0].pBufferInfo = &uboBufferInfo; // Binding 1 : Fragment shader texture sampler auto textureImageInfo = texture.GetDescriptorImageInfo(); writeDescriptorSets[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; writeDescriptorSets[1].pNext = nullptr; writeDescriptorSets[1].dstSet = descriptorSet; writeDescriptorSets[1].dstBinding = 1; writeDescriptorSets[1].descriptorCount = 1; writeDescriptorSets[1].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; writeDescriptorSets[1].pImageInfo = &textureImageInfo; vkUpdateDescriptorSets(device, UncheckedNumericCast<uint32_t>(writeDescriptorSets.size()), writeDescriptorSets.data(), 0, nullptr); return descriptorSet; } VkDescriptorSet UpdateEffectDescriptorSet(const VkDevice device, const VkDescriptorSet descriptorSet, const VUBufferMemory& uboBuffer, const VUTexture& texture0, const VUTexture& texture1) { assert(descriptorSet != nullptr); assert(uboBuffer.IsValid()); assert(texture0.IsValid()); assert(texture1.IsValid()); std::array<VkWriteDescriptorSet, 3> writeDescriptorSets{}; // Binding 0 : Vertex shader uniform buffer auto uboBufferInfo = uboBuffer.GetDescriptorBufferInfo(); writeDescriptorSets[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; writeDescriptorSets[0].pNext = nullptr; writeDescriptorSets[0].dstSet = descriptorSet; writeDescriptorSets[0].dstBinding = 0; writeDescriptorSets[0].descriptorCount = 1; writeDescriptorSets[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; writeDescriptorSets[0].pBufferInfo = &uboBufferInfo; // Binding 1 : Fragment shader texture sampler auto textureImageInfo0 = texture0.GetDescriptorImageInfo(); writeDescriptorSets[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; writeDescriptorSets[1].pNext = nullptr; writeDescriptorSets[1].dstSet = descriptorSet; writeDescriptorSets[1].dstBinding = 1; writeDescriptorSets[1].descriptorCount = 1; writeDescriptorSets[1].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; writeDescriptorSets[1].pImageInfo = &textureImageInfo0; // Binding 2 : Fragment shader texture sampler auto textureImageInfo1 = texture1.GetDescriptorImageInfo(); writeDescriptorSets[2].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; writeDescriptorSets[2].pNext = nullptr; writeDescriptorSets[2].dstSet = descriptorSet; writeDescriptorSets[2].dstBinding = 2; writeDescriptorSets[2].descriptorCount = 1; writeDescriptorSets[2].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; writeDescriptorSets[2].pImageInfo = &textureImageInfo1; vkUpdateDescriptorSets(device, UncheckedNumericCast<uint32_t>(writeDescriptorSets.size()), writeDescriptorSets.data(), 0, nullptr); return descriptorSet; } RapidVulkan::PipelineLayout CreatePipelineLayout(const RapidVulkan::DescriptorSetLayout& descripterSetLayout) { VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo{}; pipelineLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; pipelineLayoutCreateInfo.setLayoutCount = 1; pipelineLayoutCreateInfo.pSetLayouts = descripterSetLayout.GetPointer(); return RapidVulkan::PipelineLayout(descripterSetLayout.GetDevice(), pipelineLayoutCreateInfo); } RapidVulkan::RenderPass CreateRenderPass(const VkDevice device, const VkFormat renderFormat, const VkFormat depthImageFormat) { assert(device != VK_NULL_HANDLE); assert(depthImageFormat != VK_FORMAT_UNDEFINED); VkAttachmentReference colorAttachmentReference = {0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}; VkAttachmentReference depthAttachmentReference = {1, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; std::array<VkSubpassDescription, 1> subpassDescription{}; // Rendering to a offscreen buffer subpassDescription[0].pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; subpassDescription[0].colorAttachmentCount = 1; subpassDescription[0].pColorAttachments = &colorAttachmentReference; subpassDescription[0].pDepthStencilAttachment = &depthAttachmentReference; std::array<VkSubpassDependency, 2> subpassDependency{}; // The offscreen buffer subpassDependency[0].srcSubpass = VK_SUBPASS_EXTERNAL; subpassDependency[0].dstSubpass = 0; subpassDependency[0].srcStageMask = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; subpassDependency[0].srcAccessMask = VK_ACCESS_SHADER_READ_BIT; subpassDependency[0].dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; subpassDependency[0].dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; subpassDependency[0].dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT; // output subpassDependency[1].srcSubpass = 0; subpassDependency[1].dstSubpass = VK_SUBPASS_EXTERNAL; subpassDependency[1].srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; subpassDependency[1].srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; subpassDependency[1].dstStageMask = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; subpassDependency[1].dstAccessMask = VK_ACCESS_SHADER_READ_BIT; subpassDependency[1].dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT; std::array<VkAttachmentDescription, 2> attachments{}; // color attachments[0].format = renderFormat; attachments[0].samples = VK_SAMPLE_COUNT_1_BIT; attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE; attachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attachments[0].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; attachments[0].finalLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; // Depth attachments[1].format = depthImageFormat; attachments[1].samples = VK_SAMPLE_COUNT_1_BIT; attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attachments[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; attachments[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attachments[1].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; attachments[1].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; return RapidVulkan::RenderPass(device, 0, UncheckedNumericCast<uint32_t>(attachments.size()), attachments.data(), UncheckedNumericCast<uint32_t>(subpassDescription.size()), subpassDescription.data(), UncheckedNumericCast<uint32_t>(subpassDependency.size()), subpassDependency.data()); } Vulkan::VUTexture CreateRenderAttachment(const Vulkan::VUDevice& device, const VkExtent2D& extent, const VkFormat format, const std::string& name) { VkImageCreateInfo imageCreateInfo{}; imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageCreateInfo.imageType = VK_IMAGE_TYPE_2D; imageCreateInfo.format = format; imageCreateInfo.extent = {extent.width, extent.height, 1}; imageCreateInfo.mipLevels = 1; imageCreateInfo.arrayLayers = 1; imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT; imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL; imageCreateInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; VkImageSubresourceRange subresourceRange{}; subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; subresourceRange.baseMipLevel = 0; subresourceRange.levelCount = 1; subresourceRange.baseArrayLayer = 0; subresourceRange.layerCount = 1; Vulkan::VUImageMemoryView imageMemoryView(device, imageCreateInfo, subresourceRange, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, name); VkSamplerCreateInfo samplerCreateInfo{}; samplerCreateInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; samplerCreateInfo.magFilter = VK_FILTER_LINEAR; samplerCreateInfo.minFilter = VK_FILTER_LINEAR; samplerCreateInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR; samplerCreateInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; samplerCreateInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; samplerCreateInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; samplerCreateInfo.mipLodBias = 0.0f; samplerCreateInfo.anisotropyEnable = VK_FALSE; samplerCreateInfo.maxAnisotropy = 1.0f; samplerCreateInfo.compareEnable = VK_FALSE; samplerCreateInfo.compareOp = VK_COMPARE_OP_NEVER; samplerCreateInfo.minLod = 0.0f; samplerCreateInfo.maxLod = 1.0f; samplerCreateInfo.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK; Vulkan::VUTexture finalTexture(std::move(imageMemoryView), samplerCreateInfo); // We know the renderPass is configured to transform the image to VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL layout before we need to sample it // So we store that in the image for now (even though it will only be true at the point in time the attachment is used via a sampler) finalTexture.SetImageLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); return finalTexture; } } EffectOffscreen::EffectOffscreen(const DemoAppConfig& config) : VulkanBasic::DemoAppVulkanBasic(config, CreateSetup()) , m_bufferManager(std::make_shared<VMBufferManager>(m_physicalDevice, m_device.Get(), m_deviceQueue.Queue, m_deviceQueue.QueueFamilyIndex)) { const std::shared_ptr<IContentManager> contentManager = GetContentManager(); m_resources.MainProgramInfo.VertexShaderModule.Reset(m_device.Get(), 0, contentManager->ReadBytes("Shader.vert.spv")); m_resources.MainProgramInfo.FragmentShaderModule.Reset(m_device.Get(), 0, contentManager->ReadBytes("Shader.frag.spv")); m_resources.EffectVertexShader.Reset(m_device.Get(), 0, contentManager->ReadBytes("Effect.vert.spv")); m_resources.EffectFragmentShaderTop.Reset(m_device.Get(), 0, contentManager->ReadBytes("EffectTop.frag.spv")); m_resources.EffectFragmentShaderBottom.Reset(m_device.Get(), 0, contentManager->ReadBytes("EffectBottom.frag.spv")); m_resources.Texture = CreateTexture(m_device, m_deviceQueue, contentManager, "Textures/GPUSdk/SquareLogo512x512.jpg", false, true); m_resources.EffectTexture = CreateTexture(m_device, m_deviceQueue, contentManager, "Textures/VFX/Distortion.png", true, false); m_resources.CubeVertexBufferInfo = CreateCubeVertexBuffer(m_bufferManager); m_resources.DoubleQuadVertexBufferInfo = CreateDoubleQuadVertexBuffer(m_bufferManager); m_resources.MainDescriptorSetLayout = CreateDescriptorSetLayout(m_device); m_resources.EffectDescriptorSetLayout = CreateEffectDescriptorSetLayout(m_device); const uint32_t maxFramesInFlight = GetRenderConfig().MaxFramesInFlight; // * 2 due to the two descriptor sets m_resources.MainDescriptorPool = CreateDescriptorPool(m_device, maxFramesInFlight * 3); m_resources.MainFrameResources.resize(maxFramesInFlight); for (auto& rFrame : m_resources.MainFrameResources) { rFrame.UboBuffer = CreateVertexShaderUBO(m_device, sizeof(VertexUBOData)); rFrame.DescriptorSetScene = CreateDescriptorSet(m_resources.MainDescriptorPool, m_resources.MainDescriptorSetLayout); rFrame.EffectUboBuffer = CreateVertexShaderUBO(m_device, sizeof(EffectFragUBOData)); rFrame.DescriptorSetEffect = CreateDescriptorSet(m_resources.MainDescriptorPool, m_resources.EffectDescriptorSetLayout); UpdateDescriptorSet(m_device.Get(), rFrame.DescriptorSetScene, rFrame.UboBuffer, m_resources.Texture); } m_resources.MainPipelineLayout = CreatePipelineLayout(m_resources.MainDescriptorSetLayout); m_resources.EffectBottomPipelineLayout = CreatePipelineLayout(m_resources.EffectDescriptorSetLayout); const auto aspectRatio = GetWindowAspectRatio(); m_matProj = Matrix::CreatePerspectiveFieldOfView(MathHelper::ToRadians(75.0f), aspectRatio, 1.0f, 1000.0f); m_matTranslate = Matrix::CreateTranslation(0.0f, 0.0f, 0.0f); } void EffectOffscreen::Update(const DemoTime& demoTime) { m_angle.X -= 0.40f * demoTime.DeltaTime; m_angle.Y -= 0.30f * demoTime.DeltaTime; m_angle.Z -= 0.20f * demoTime.DeltaTime; m_angle.X = MathHelper::WrapAngle(m_angle.X); m_angle.Y = MathHelper::WrapAngle(m_angle.Y); m_angle.Z = MathHelper::WrapAngle(m_angle.Z); m_effectUboData.Time = static_cast<float>(demoTime.TotalTimeInMicroseconds / 1000000.0); // Rotate and translate the model view matrix m_matModel = Matrix::CreateRotationX(m_angle.X) * Matrix::CreateRotationY(m_angle.Y) * Matrix::CreateRotationZ(m_angle.Z) * m_matTranslate; } void EffectOffscreen::VulkanDraw(const DemoTime& demoTime, RapidVulkan::CommandBuffers& rCmdBuffers, const VulkanBasic::DrawContext& drawContext) { FSL_PARAM_NOT_USED(demoTime); const auto currentSwapBufferIndex = drawContext.CurrentSwapBufferIndex; const auto frameIndex = drawContext.CurrentFrameIndex; assert(frameIndex < m_resources.MainFrameResources.size()); // Upload the changes VertexUBOData buffer; buffer.MatModelView = m_matModel; buffer.MatProj = m_matProj; m_resources.MainFrameResources[frameIndex].UboBuffer.Upload(0, &buffer, sizeof(VertexUBOData)); m_resources.MainFrameResources[frameIndex].EffectUboBuffer.Upload(0, &m_effectUboData, sizeof(EffectFragUBOData)); const VkCommandBuffer hCmdBuffer = rCmdBuffers[currentSwapBufferIndex]; rCmdBuffers.Begin(currentSwapBufferIndex, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, VK_NULL_HANDLE, 0, VK_NULL_HANDLE, VK_FALSE, 0, 0); { DrawOffscreenRenderpass(rCmdBuffers, drawContext); std::array<VkClearValue, 2> clearValues{}; clearValues[0].color = {{0.0f, 0.0f, 0.0f, 1.0f}}; clearValues[1].depthStencil = {1.0f, 0}; VkRenderPassBeginInfo renderPassBeginInfo{}; renderPassBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; renderPassBeginInfo.renderPass = m_dependentResources.MainRenderPass.Get(); renderPassBeginInfo.framebuffer = drawContext.Framebuffer; renderPassBeginInfo.renderArea.offset.x = 0; renderPassBeginInfo.renderArea.offset.y = 0; renderPassBeginInfo.renderArea.extent = drawContext.SwapchainImageExtent; renderPassBeginInfo.clearValueCount = UncheckedNumericCast<uint32_t>(clearValues.size()); renderPassBeginInfo.pClearValues = clearValues.data(); rCmdBuffers.CmdBeginRenderPass(currentSwapBufferIndex, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE); { DrawToCommandBuffer(m_resources.MainFrameResources[frameIndex], hCmdBuffer, drawContext.SwapchainImageExtent); // Remember to call this as the last operation in your renderPass AddSystemUI(hCmdBuffer, currentSwapBufferIndex); } rCmdBuffers.CmdEndRenderPass(currentSwapBufferIndex); } rCmdBuffers.End(currentSwapBufferIndex); } VkRenderPass EffectOffscreen::OnBuildResources(const VulkanBasic::BuildResourcesContext& context) { m_dependentResources.MainRenderPass = CreateBasicRenderPass(); auto offscreenExtent = VkExtent2D{SIZE_OFFSCREEN, SIZE_OFFSCREEN}; const auto offscreenRenderFormat = context.SwapchainImageFormat; m_dependentResources.Offscreen.Extent = offscreenExtent; m_dependentResources.Offscreen.RP = CreateRenderPass(m_device.Get(), offscreenRenderFormat, context.DepthBufferImageFormat); m_dependentResources.Offscreen.Color = CreateRenderAttachment(m_device, offscreenExtent, offscreenRenderFormat, "RenderOffscreen"); m_dependentResources.Offscreen.FB = CreateOffscreenFramebuffer(m_dependentResources.Offscreen.Color.ImageView().Get(), context.DepthImageView, m_dependentResources.Offscreen.RP.Get(), offscreenExtent); // Update the preallocated tone-mapping descriptor set with the 'dependent' render attachment for (auto& rFrame : m_resources.MainFrameResources) { UpdateEffectDescriptorSet(m_device.Get(), rFrame.DescriptorSetEffect, rFrame.EffectUboBuffer, m_dependentResources.Offscreen.Color, m_resources.EffectTexture); } m_dependentResources.ScenePipeline = CreateScenePipeline( m_resources.MainPipelineLayout, offscreenExtent, m_resources.MainProgramInfo.VertexShaderModule.Get(), m_resources.MainProgramInfo.FragmentShaderModule.Get(), m_resources.CubeVertexBufferInfo, m_dependentResources.Offscreen.RP.Get(), 0); m_dependentResources.PipelineEffectBottom = CreatePipeline(m_resources.EffectBottomPipelineLayout, context.SwapchainImageExtent, m_resources.EffectVertexShader.Get(), m_resources.EffectFragmentShaderBottom.Get(), m_resources.DoubleQuadVertexBufferInfo, m_dependentResources.MainRenderPass.Get(), 0); return m_dependentResources.MainRenderPass.Get(); } void EffectOffscreen::OnFreeResources() { m_dependentResources = {}; } RapidVulkan::Framebuffer EffectOffscreen::CreateOffscreenFramebuffer(const VkImageView colorImageView, const VkImageView depthImageView, const VkRenderPass renderPass, const VkExtent2D& extent) { std::array<VkImageView, 2> imageViews = {colorImageView, depthImageView}; return RapidVulkan::Framebuffer(m_device.Get(), 0, renderPass, UncheckedNumericCast<uint32_t>(imageViews.size()), imageViews.data(), extent.width, extent.height, 1); } void EffectOffscreen::DrawOffscreenRenderpass(RapidVulkan::CommandBuffers& rCmdBuffers, const VulkanBasic::DrawContext& drawContext) { const auto currentSwapBufferIndex = drawContext.CurrentSwapBufferIndex; const auto frameIndex = drawContext.CurrentFrameIndex; const VkCommandBuffer hCmdBuffer = rCmdBuffers[currentSwapBufferIndex]; std::array<VkClearValue, 2> clearValues{}; clearValues[0].color = {{0.0f, 0.0f, 0.0f, 1.0f}}; clearValues[1].depthStencil = {1.0f, 0}; VkRenderPassBeginInfo renderPassBeginInfo{}; renderPassBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; renderPassBeginInfo.renderPass = m_dependentResources.Offscreen.RP.Get(); renderPassBeginInfo.framebuffer = m_dependentResources.Offscreen.FB.Get(); renderPassBeginInfo.renderArea.offset.x = 0; renderPassBeginInfo.renderArea.offset.y = 0; renderPassBeginInfo.renderArea.extent = m_dependentResources.Offscreen.Extent; renderPassBeginInfo.clearValueCount = UncheckedNumericCast<uint32_t>(clearValues.size()); renderPassBeginInfo.pClearValues = clearValues.data(); rCmdBuffers.CmdBeginRenderPass(currentSwapBufferIndex, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE); { VkViewport viewport{}; viewport.x = 0.0f; viewport.y = 0.0f; viewport.width = static_cast<float>(m_dependentResources.Offscreen.Extent.width); viewport.height = static_cast<float>(m_dependentResources.Offscreen.Extent.height); viewport.minDepth = 0.0f; viewport.maxDepth = 1.0f; vkCmdSetViewport(hCmdBuffer, 0, 1, &viewport); VkRect2D scissor{}; scissor.offset = {0, 0}; scissor.extent = m_dependentResources.Offscreen.Extent; vkCmdSetScissor(hCmdBuffer, 0, 1, &scissor); DrawSceneToCommandBuffer(m_resources.MainFrameResources[frameIndex], hCmdBuffer); } rCmdBuffers.CmdEndRenderPass(currentSwapBufferIndex); } void EffectOffscreen::DrawSceneToCommandBuffer(const FrameResources& frame, const VkCommandBuffer commandBuffer) { vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_resources.MainPipelineLayout.Get(), 0, 1, &frame.DescriptorSetScene, 0, nullptr); vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_dependentResources.ScenePipeline.Get()); DrawCube(frame, commandBuffer, m_resources.MainProgramInfo, m_matModel); } void EffectOffscreen::DrawToCommandBuffer(const FrameResources& frame, const VkCommandBuffer commandBuffer, const VkExtent2D& extent) { VkDeviceSize offsets = 0; auto vertexCount = m_resources.DoubleQuadVertexBufferInfo.VertexBuffer.GetVertexCount() / 2; { // Top VkViewport viewport{}; viewport.x = 0.0f; viewport.y = 0.0f; viewport.width = static_cast<float>(extent.width); viewport.height = static_cast<float>(extent.height); viewport.minDepth = 0.0f; viewport.maxDepth = 1.0f; vkCmdSetViewport(commandBuffer, 0, 1, &viewport); VkRect2D scissor{}; scissor.offset = {0, 0}; scissor.extent = {extent.width, static_cast<uint32_t>(extent.height * (0.5f + (0.5f * BOTTOM_HALF_SPLIT_PERCENTAGE)))}; vkCmdSetScissor(commandBuffer, 0, 1, &scissor); DrawSceneToCommandBuffer(frame, commandBuffer); } { // Bottom water part vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_resources.EffectBottomPipelineLayout.Get(), 0, 1, &frame.DescriptorSetEffect, 0, nullptr); vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_dependentResources.PipelineEffectBottom.Get()); vkCmdBindVertexBuffers(commandBuffer, VERTEX_BUFFER_BIND_ID, 1, m_resources.DoubleQuadVertexBufferInfo.VertexBuffer.GetBufferPointer(), &offsets); vkCmdDraw(commandBuffer, vertexCount, 1, vertexCount, 0); } } void EffectOffscreen::DrawCube(const FrameResources& frame, const VkCommandBuffer commandBuffer, const ProgramInfo& programInfo, const Matrix& matModel) { FSL_PARAM_NOT_USED(frame); FSL_PARAM_NOT_USED(programInfo); FSL_PARAM_NOT_USED(matModel); VkDeviceSize offsets = 0; vkCmdBindVertexBuffers(commandBuffer, VERTEX_BUFFER_BIND_ID, 1, m_resources.CubeVertexBufferInfo.VertexBuffer.GetBufferPointer(), &offsets); vkCmdDraw(commandBuffer, m_resources.CubeVertexBufferInfo.VertexBuffer.GetVertexCount(), 1, 0, 0); } EffectOffscreen::VertexBufferInfo EffectOffscreen::CreateCubeVertexBuffer(const std::shared_ptr<Vulkan::VMBufferManager>& bufferManager) { VertexBufferInfo info; info.VertexBuffer.Reset(bufferManager, g_vertices, VMBufferUsage::STATIC); // Generate attribute description by matching shader layout with the vertex declarations std::array<VertexElementUsage, 2> shaderAttribOrder = {VertexElementUsage::Position, VertexElementUsage::TextureCoordinate}; Vulkan::VMVertexBufferUtil::FillVertexInputAttributeDescription(info.AttributeDescription, shaderAttribOrder, info.VertexBuffer); info.BindingDescription.stride = info.VertexBuffer.GetElementStride(); info.BindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; return info; } EffectOffscreen::EffectVertexBufferInfo EffectOffscreen::CreateDoubleQuadVertexBuffer(const std::shared_ptr<Vulkan::VMBufferManager>& bufferManager) { EffectVertexBufferInfo info; info.VertexBuffer.Reset(bufferManager, CreateDoubleQuadVertexArray(1.0f), VMBufferUsage::STATIC); // Generate attribute description by matching shader layout with the vertex declarations //{ // std::array<VertexElementUsage, 3> shaderAttribOrder = {VertexElementUsage::Position, VertexElementUsage::TextureCoordinate, // VertexElementUsage::TextureCoordinate}; // Vulkan::VMVertexBufferUtil::FillVertexInputAttributeDescription(info.AttributeDescription, shaderAttribOrder, info.VertexBuffer); //} { const auto& vertexDeclElement = info.VertexBuffer.GetVertexElement(VertexElementUsage::Position, 0); info.AttributeDescription[0].location = 0u; info.AttributeDescription[0].binding = 0; info.AttributeDescription[0].format = vertexDeclElement.NativeFormat; info.AttributeDescription[0].offset = vertexDeclElement.Offset; } { const auto& vertexDeclElement = info.VertexBuffer.GetVertexElement(VertexElementUsage::TextureCoordinate, 0); info.AttributeDescription[1].location = 1u; info.AttributeDescription[1].binding = 0; info.AttributeDescription[1].format = vertexDeclElement.NativeFormat; info.AttributeDescription[1].offset = vertexDeclElement.Offset; } { const auto& vertexDeclElement = info.VertexBuffer.GetVertexElement(VertexElementUsage::TextureCoordinate, 1); info.AttributeDescription[2].location = 2u; info.AttributeDescription[2].binding = 0; info.AttributeDescription[2].format = vertexDeclElement.NativeFormat; info.AttributeDescription[2].offset = vertexDeclElement.Offset; } info.BindingDescription.stride = info.VertexBuffer.GetElementStride(); info.BindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; return info; } RapidVulkan::GraphicsPipeline EffectOffscreen::CreateScenePipeline(const RapidVulkan::PipelineLayout& pipelineLayout, const VkExtent2D& extent, const VkShaderModule vertexShaderModule, const VkShaderModule fragmentShaderModule, const VertexBufferInfo& vertexBufferInfo, const VkRenderPass renderPass, const uint32_t subpass) { assert(pipelineLayout.IsValid()); assert(vertexShaderModule != VK_NULL_HANDLE); assert(fragmentShaderModule != VK_NULL_HANDLE); assert(vertexBufferInfo.VertexBuffer.IsValid()); assert(renderPass != VK_NULL_HANDLE); std::array<VkPipelineShaderStageCreateInfo, 2> pipelineShaderStageCreateInfo{}; pipelineShaderStageCreateInfo[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; pipelineShaderStageCreateInfo[0].flags = 0; pipelineShaderStageCreateInfo[0].stage = VK_SHADER_STAGE_VERTEX_BIT; pipelineShaderStageCreateInfo[0].module = vertexShaderModule; pipelineShaderStageCreateInfo[0].pName = "main"; pipelineShaderStageCreateInfo[0].pSpecializationInfo = nullptr; pipelineShaderStageCreateInfo[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; pipelineShaderStageCreateInfo[1].flags = 0; pipelineShaderStageCreateInfo[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT; pipelineShaderStageCreateInfo[1].module = fragmentShaderModule; pipelineShaderStageCreateInfo[1].pName = "main"; pipelineShaderStageCreateInfo[1].pSpecializationInfo = nullptr; VkPipelineVertexInputStateCreateInfo pipelineVertexInputCreateInfo{}; pipelineVertexInputCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; pipelineVertexInputCreateInfo.flags = 0; pipelineVertexInputCreateInfo.vertexBindingDescriptionCount = 1; pipelineVertexInputCreateInfo.pVertexBindingDescriptions = &vertexBufferInfo.BindingDescription; pipelineVertexInputCreateInfo.vertexAttributeDescriptionCount = UncheckedNumericCast<uint32_t>(vertexBufferInfo.AttributeDescription.size()); pipelineVertexInputCreateInfo.pVertexAttributeDescriptions = vertexBufferInfo.AttributeDescription.data(); VkPipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo{}; pipelineInputAssemblyStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; pipelineInputAssemblyStateCreateInfo.flags = 0; pipelineInputAssemblyStateCreateInfo.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; pipelineInputAssemblyStateCreateInfo.primitiveRestartEnable = VK_FALSE; VkViewport viewport{}; viewport.x = 0.0f; viewport.y = 0.0f; viewport.width = static_cast<float>(extent.width); viewport.height = static_cast<float>(extent.height); viewport.minDepth = 0.0f; viewport.maxDepth = 1.0f; VkRect2D scissor{{0, 0}, extent}; VkPipelineViewportStateCreateInfo pipelineViewportStateCreateInfo{}; pipelineViewportStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; pipelineViewportStateCreateInfo.flags = 0; pipelineViewportStateCreateInfo.viewportCount = 1; pipelineViewportStateCreateInfo.pViewports = &viewport; pipelineViewportStateCreateInfo.scissorCount = 1; pipelineViewportStateCreateInfo.pScissors = &scissor; VkPipelineRasterizationStateCreateInfo pipelineRasterizationStateCreateInfo{}; pipelineRasterizationStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; pipelineRasterizationStateCreateInfo.flags = 0; pipelineRasterizationStateCreateInfo.depthClampEnable = VK_FALSE; pipelineRasterizationStateCreateInfo.rasterizerDiscardEnable = VK_FALSE; pipelineRasterizationStateCreateInfo.polygonMode = VK_POLYGON_MODE_FILL; pipelineRasterizationStateCreateInfo.cullMode = VK_CULL_MODE_NONE; pipelineRasterizationStateCreateInfo.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; pipelineRasterizationStateCreateInfo.depthBiasEnable = VK_FALSE; pipelineRasterizationStateCreateInfo.depthBiasConstantFactor = 0.0f; pipelineRasterizationStateCreateInfo.depthBiasClamp = 0.0f; pipelineRasterizationStateCreateInfo.depthBiasSlopeFactor = 0.0f; pipelineRasterizationStateCreateInfo.lineWidth = 1.0f; VkPipelineMultisampleStateCreateInfo pipelineMultisampleStateCreateInfo{}; pipelineMultisampleStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; pipelineMultisampleStateCreateInfo.flags = 0; pipelineMultisampleStateCreateInfo.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; pipelineMultisampleStateCreateInfo.sampleShadingEnable = VK_FALSE; pipelineMultisampleStateCreateInfo.minSampleShading = 0.0f; pipelineMultisampleStateCreateInfo.pSampleMask = nullptr; pipelineMultisampleStateCreateInfo.alphaToCoverageEnable = VK_FALSE; pipelineMultisampleStateCreateInfo.alphaToOneEnable = VK_FALSE; VkPipelineColorBlendAttachmentState pipelineColorBlendAttachmentState{}; pipelineColorBlendAttachmentState.blendEnable = VK_FALSE; pipelineColorBlendAttachmentState.srcColorBlendFactor = VK_BLEND_FACTOR_ZERO; pipelineColorBlendAttachmentState.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO; pipelineColorBlendAttachmentState.colorBlendOp = VK_BLEND_OP_ADD; pipelineColorBlendAttachmentState.srcAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; pipelineColorBlendAttachmentState.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; pipelineColorBlendAttachmentState.alphaBlendOp = VK_BLEND_OP_ADD; pipelineColorBlendAttachmentState.colorWriteMask = 0xf; VkPipelineColorBlendStateCreateInfo pipelineColorBlendStateCreateInfo{}; pipelineColorBlendStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; pipelineColorBlendStateCreateInfo.flags = 0; pipelineColorBlendStateCreateInfo.logicOpEnable = VK_FALSE; pipelineColorBlendStateCreateInfo.logicOp = VK_LOGIC_OP_COPY; pipelineColorBlendStateCreateInfo.attachmentCount = 1; pipelineColorBlendStateCreateInfo.pAttachments = &pipelineColorBlendAttachmentState; pipelineColorBlendStateCreateInfo.blendConstants[0] = 0.0f; pipelineColorBlendStateCreateInfo.blendConstants[1] = 0.0f; pipelineColorBlendStateCreateInfo.blendConstants[2] = 0.0f; pipelineColorBlendStateCreateInfo.blendConstants[3] = 0.0f; VkPipelineDepthStencilStateCreateInfo depthStencilStateCreateInfo{}; depthStencilStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO; depthStencilStateCreateInfo.depthTestEnable = VK_TRUE; depthStencilStateCreateInfo.depthWriteEnable = VK_TRUE; depthStencilStateCreateInfo.depthCompareOp = VK_COMPARE_OP_LESS; depthStencilStateCreateInfo.depthBoundsTestEnable = VK_FALSE; depthStencilStateCreateInfo.stencilTestEnable = VK_FALSE; depthStencilStateCreateInfo.front = {}; depthStencilStateCreateInfo.back = {}; depthStencilStateCreateInfo.minDepthBounds = 0.0f; depthStencilStateCreateInfo.maxDepthBounds = 1.0f; std::array<VkDynamicState, 2> dynamicState = {VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_VIEWPORT}; VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo{}; pipelineDynamicStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; pipelineDynamicStateCreateInfo.flags = 0; pipelineDynamicStateCreateInfo.dynamicStateCount = UncheckedNumericCast<uint32_t>(dynamicState.size()); pipelineDynamicStateCreateInfo.pDynamicStates = dynamicState.data(); VkGraphicsPipelineCreateInfo graphicsPipelineCreateInfo{}; graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; graphicsPipelineCreateInfo.flags = 0; graphicsPipelineCreateInfo.stageCount = UncheckedNumericCast<uint32_t>(pipelineShaderStageCreateInfo.size()); graphicsPipelineCreateInfo.pStages = pipelineShaderStageCreateInfo.data(); graphicsPipelineCreateInfo.pVertexInputState = &pipelineVertexInputCreateInfo; graphicsPipelineCreateInfo.pInputAssemblyState = &pipelineInputAssemblyStateCreateInfo; graphicsPipelineCreateInfo.pTessellationState = nullptr; graphicsPipelineCreateInfo.pViewportState = &pipelineViewportStateCreateInfo; graphicsPipelineCreateInfo.pRasterizationState = &pipelineRasterizationStateCreateInfo; graphicsPipelineCreateInfo.pMultisampleState = &pipelineMultisampleStateCreateInfo; graphicsPipelineCreateInfo.pDepthStencilState = &depthStencilStateCreateInfo; graphicsPipelineCreateInfo.pColorBlendState = &pipelineColorBlendStateCreateInfo; graphicsPipelineCreateInfo.pDynamicState = &pipelineDynamicStateCreateInfo; graphicsPipelineCreateInfo.layout = pipelineLayout.Get(); graphicsPipelineCreateInfo.renderPass = renderPass; graphicsPipelineCreateInfo.subpass = subpass; graphicsPipelineCreateInfo.basePipelineHandle = VK_NULL_HANDLE; graphicsPipelineCreateInfo.basePipelineIndex = 0; return RapidVulkan::GraphicsPipeline(pipelineLayout.GetDevice(), VK_NULL_HANDLE, graphicsPipelineCreateInfo); } RapidVulkan::GraphicsPipeline EffectOffscreen::CreatePipeline(const RapidVulkan::PipelineLayout& pipelineLayout, const VkExtent2D& extent, const VkShaderModule vertexShaderModule, const VkShaderModule fragmentShaderModule, const EffectVertexBufferInfo& vertexBufferInfo, const VkRenderPass renderPass, const uint32_t subpass) { assert(pipelineLayout.IsValid()); assert(vertexShaderModule != VK_NULL_HANDLE); assert(fragmentShaderModule != VK_NULL_HANDLE); assert(vertexBufferInfo.VertexBuffer.IsValid()); assert(renderPass != VK_NULL_HANDLE); std::array<VkPipelineShaderStageCreateInfo, 2> pipelineShaderStageCreateInfo{}; pipelineShaderStageCreateInfo[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; pipelineShaderStageCreateInfo[0].flags = 0; pipelineShaderStageCreateInfo[0].stage = VK_SHADER_STAGE_VERTEX_BIT; pipelineShaderStageCreateInfo[0].module = vertexShaderModule; pipelineShaderStageCreateInfo[0].pName = "main"; pipelineShaderStageCreateInfo[0].pSpecializationInfo = nullptr; pipelineShaderStageCreateInfo[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; pipelineShaderStageCreateInfo[1].flags = 0; pipelineShaderStageCreateInfo[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT; pipelineShaderStageCreateInfo[1].module = fragmentShaderModule; pipelineShaderStageCreateInfo[1].pName = "main"; pipelineShaderStageCreateInfo[1].pSpecializationInfo = nullptr; VkPipelineVertexInputStateCreateInfo pipelineVertexInputCreateInfo{}; pipelineVertexInputCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; pipelineVertexInputCreateInfo.flags = 0; pipelineVertexInputCreateInfo.vertexBindingDescriptionCount = 1; pipelineVertexInputCreateInfo.pVertexBindingDescriptions = &vertexBufferInfo.BindingDescription; pipelineVertexInputCreateInfo.vertexAttributeDescriptionCount = UncheckedNumericCast<uint32_t>(vertexBufferInfo.AttributeDescription.size()); pipelineVertexInputCreateInfo.pVertexAttributeDescriptions = vertexBufferInfo.AttributeDescription.data(); VkPipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo{}; pipelineInputAssemblyStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; pipelineInputAssemblyStateCreateInfo.flags = 0; pipelineInputAssemblyStateCreateInfo.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; pipelineInputAssemblyStateCreateInfo.primitiveRestartEnable = VK_FALSE; VkViewport viewport{}; viewport.x = 0.0f; viewport.y = 0.0f; viewport.width = static_cast<float>(extent.width); viewport.height = static_cast<float>(extent.height); viewport.minDepth = 0.0f; viewport.maxDepth = 1.0f; VkRect2D scissor{{0, 0}, extent}; VkPipelineViewportStateCreateInfo pipelineViewportStateCreateInfo{}; pipelineViewportStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; pipelineViewportStateCreateInfo.flags = 0; pipelineViewportStateCreateInfo.viewportCount = 1; pipelineViewportStateCreateInfo.pViewports = &viewport; pipelineViewportStateCreateInfo.scissorCount = 1; pipelineViewportStateCreateInfo.pScissors = &scissor; VkPipelineRasterizationStateCreateInfo pipelineRasterizationStateCreateInfo{}; pipelineRasterizationStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; pipelineRasterizationStateCreateInfo.flags = 0; pipelineRasterizationStateCreateInfo.depthClampEnable = VK_FALSE; pipelineRasterizationStateCreateInfo.rasterizerDiscardEnable = VK_FALSE; pipelineRasterizationStateCreateInfo.polygonMode = VK_POLYGON_MODE_FILL; pipelineRasterizationStateCreateInfo.cullMode = VK_CULL_MODE_NONE; pipelineRasterizationStateCreateInfo.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; pipelineRasterizationStateCreateInfo.depthBiasEnable = VK_FALSE; pipelineRasterizationStateCreateInfo.depthBiasConstantFactor = 0.0f; pipelineRasterizationStateCreateInfo.depthBiasClamp = 0.0f; pipelineRasterizationStateCreateInfo.depthBiasSlopeFactor = 0.0f; pipelineRasterizationStateCreateInfo.lineWidth = 1.0f; VkPipelineMultisampleStateCreateInfo pipelineMultisampleStateCreateInfo{}; pipelineMultisampleStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; pipelineMultisampleStateCreateInfo.flags = 0; pipelineMultisampleStateCreateInfo.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; pipelineMultisampleStateCreateInfo.sampleShadingEnable = VK_FALSE; pipelineMultisampleStateCreateInfo.minSampleShading = 0.0f; pipelineMultisampleStateCreateInfo.pSampleMask = nullptr; pipelineMultisampleStateCreateInfo.alphaToCoverageEnable = VK_FALSE; pipelineMultisampleStateCreateInfo.alphaToOneEnable = VK_FALSE; VkPipelineColorBlendAttachmentState pipelineColorBlendAttachmentState{}; pipelineColorBlendAttachmentState.blendEnable = VK_FALSE; pipelineColorBlendAttachmentState.srcColorBlendFactor = VK_BLEND_FACTOR_ZERO; pipelineColorBlendAttachmentState.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO; pipelineColorBlendAttachmentState.colorBlendOp = VK_BLEND_OP_ADD; pipelineColorBlendAttachmentState.srcAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; pipelineColorBlendAttachmentState.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; pipelineColorBlendAttachmentState.alphaBlendOp = VK_BLEND_OP_ADD; pipelineColorBlendAttachmentState.colorWriteMask = 0xf; VkPipelineColorBlendStateCreateInfo pipelineColorBlendStateCreateInfo{}; pipelineColorBlendStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; pipelineColorBlendStateCreateInfo.flags = 0; pipelineColorBlendStateCreateInfo.logicOpEnable = VK_FALSE; pipelineColorBlendStateCreateInfo.logicOp = VK_LOGIC_OP_COPY; pipelineColorBlendStateCreateInfo.attachmentCount = 1; pipelineColorBlendStateCreateInfo.pAttachments = &pipelineColorBlendAttachmentState; pipelineColorBlendStateCreateInfo.blendConstants[0] = 0.0f; pipelineColorBlendStateCreateInfo.blendConstants[1] = 0.0f; pipelineColorBlendStateCreateInfo.blendConstants[2] = 0.0f; pipelineColorBlendStateCreateInfo.blendConstants[3] = 0.0f; VkPipelineDepthStencilStateCreateInfo depthStencilStateCreateInfo{}; depthStencilStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO; depthStencilStateCreateInfo.depthTestEnable = VK_TRUE; depthStencilStateCreateInfo.depthWriteEnable = VK_TRUE; depthStencilStateCreateInfo.depthCompareOp = VK_COMPARE_OP_LESS; depthStencilStateCreateInfo.depthBoundsTestEnable = VK_FALSE; depthStencilStateCreateInfo.stencilTestEnable = VK_FALSE; depthStencilStateCreateInfo.front = {}; depthStencilStateCreateInfo.back = {}; depthStencilStateCreateInfo.minDepthBounds = 0.0f; depthStencilStateCreateInfo.maxDepthBounds = 1.0f; VkGraphicsPipelineCreateInfo graphicsPipelineCreateInfo{}; graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; graphicsPipelineCreateInfo.flags = 0; graphicsPipelineCreateInfo.stageCount = UncheckedNumericCast<uint32_t>(pipelineShaderStageCreateInfo.size()); graphicsPipelineCreateInfo.pStages = pipelineShaderStageCreateInfo.data(); graphicsPipelineCreateInfo.pVertexInputState = &pipelineVertexInputCreateInfo; graphicsPipelineCreateInfo.pInputAssemblyState = &pipelineInputAssemblyStateCreateInfo; graphicsPipelineCreateInfo.pTessellationState = nullptr; graphicsPipelineCreateInfo.pViewportState = &pipelineViewportStateCreateInfo; graphicsPipelineCreateInfo.pRasterizationState = &pipelineRasterizationStateCreateInfo; graphicsPipelineCreateInfo.pMultisampleState = &pipelineMultisampleStateCreateInfo; graphicsPipelineCreateInfo.pDepthStencilState = &depthStencilStateCreateInfo; graphicsPipelineCreateInfo.pColorBlendState = &pipelineColorBlendStateCreateInfo; graphicsPipelineCreateInfo.pDynamicState = nullptr; graphicsPipelineCreateInfo.layout = pipelineLayout.Get(); graphicsPipelineCreateInfo.renderPass = renderPass; graphicsPipelineCreateInfo.subpass = subpass; graphicsPipelineCreateInfo.basePipelineHandle = VK_NULL_HANDLE; graphicsPipelineCreateInfo.basePipelineIndex = 0; return RapidVulkan::GraphicsPipeline(pipelineLayout.GetDevice(), VK_NULL_HANDLE, graphicsPipelineCreateInfo); } }
.include "defaults_mod.asm" table_file_jp equ "exe4-utf8.tbl" table_file_en equ "bn4-utf8.tbl" game_code_len equ 3 game_code equ 0x4234574A // B4WJ game_code_2 equ 0x42345745 // B4WE game_code_3 equ 0x42345750 // B4WP card_type equ 1 card_id equ 39 card_no equ "039" card_sub equ "Mod Card 039" card_sub_x equ 64 card_desc_len equ 2 card_desc_1 equ "Address 0D" card_desc_2 equ "B+Left AirShot" card_desc_3 equ "" card_name_jp_full equ "B+左でエアシュート" card_name_jp_game equ "B+左でエアシュート" card_name_en_full equ "B+Left AirShot" card_name_en_game equ "B+Left AirShot" card_address equ "0D" card_address_id equ 3 card_bug equ 0 card_wrote_en equ "B+Left AirShot" card_wrote_jp equ "B+左でエアシュート"
; A276229: a(n+3) = -a(n+2) - 2*a(n+1) + a(n) with a(0)=0, a(1)=0, a(2)=1. ; Submitted by Jon Maiga ; 0,0,1,-1,-1,4,-3,-6,16,-7,-31,61,-6,-147,220,68,-655,739,639,-2772,2233,3950,-11188,5521,20805,-43035,6946,99929,-156856,-36056,449697,-534441,-401009,1919588,-1652011,-2588174,7811784,-4287447,-13924295,30310973 lpb $0 sub $0,2 mov $2,$0 mov $0,1 max $2,0 seq $2,77978 ; Expansion of 1/(1+x+2*x^2-x^3). lpe mov $0,$2
/* file: covariance_dense_default_batch_fpt_cpu.cpp */ /******************************************************************************* * Copyright 2014-2019 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ /* //++ // Implementation of Covariance kernel. //-- */ #include "covariance_container.h" #include "covariance_dense_batch_impl.i" namespace daal { namespace algorithms { namespace covariance { namespace interface1 { template class BatchContainer<DAAL_FPTYPE, defaultDense, DAAL_CPU>; } namespace internal { template class CovarianceDenseBatchKernel<DAAL_FPTYPE, defaultDense, DAAL_CPU>; } } } }
%include 'functions.asm' SECTION .data msg1 db ' remainder ' SECTION .text global _start _start: mov eax, 90 mov ebx, 9 div ebx call iprint mov eax, msg1 call sprint mov eax, edx call iprintLF call quit
;; Licensed to the .NET Foundation under one or more agreements. ;; The .NET Foundation licenses this file to you under the MIT license. ;; See the LICENSE file in the project root for more information. #include "AsmMacros.h" TEXTAREA #define STACKSIZEOF_ExInfo ((SIZEOF__ExInfo + 15)&(~15)) ;; ----------------------------------------------------------------------------- ;; Macro used to create frame of exception throwing helpers (RhpThrowEx, RhpThrowHwEx) MACRO ALLOC_THROW_FRAME ;; Setup a PAL_LIMITED_CONTEXT on the stack { PROLOG_SAVE_REG_PAIR fp, lr, #-SIZEOF__PAL_LIMITED_CONTEXT! PROLOG_NOP stp x0, x1, [sp, #0x10] PROLOG_SAVE_REG_PAIR x19, x20, #0x20 PROLOG_SAVE_REG_PAIR x21, x22, #0x30 PROLOG_SAVE_REG_PAIR x23, x24, #0x40 PROLOG_SAVE_REG_PAIR x25, x26, #0x50 PROLOG_SAVE_REG_PAIR x27, x28, #0x60 PROLOG_NOP stp x0, lr, [sp, #0x70] ; x0 is the SP and lr is the IP of the fault site ; in case of software exception x0 is the exception object address PROLOG_NOP stp d8, d9, [sp, #0x80] PROLOG_NOP stp d10, d11, [sp, #0x90] PROLOG_NOP stp d12, d13, [sp, #0xA0] PROLOG_NOP stp d14, d15, [sp, #0xB0] ;; } end PAL_LIMITED_CONTEXT PROLOG_STACK_ALLOC STACKSIZEOF_ExInfo MEND ;; ----------------------------------------------------------------------------- ;; Macro used to create frame of funclet calling helpers (RhpCallXXXXFunclet) ;; $extraStackSize - extra stack space that the user of the macro can use to ;; store additional registers MACRO ALLOC_CALL_FUNCLET_FRAME $extraStackSize PROLOG_SAVE_REG_PAIR fp, lr, #-0x60! PROLOG_SAVE_REG_PAIR x19, x20, #0x10 PROLOG_SAVE_REG_PAIR x21, x22, #0x20 PROLOG_SAVE_REG_PAIR x23, x24, #0x30 PROLOG_SAVE_REG_PAIR x25, x26, #0x40 PROLOG_SAVE_REG_PAIR x27, x28, #0x50 IF $extraStackSize != 0 PROLOG_STACK_ALLOC $extraStackSize ENDIF MEND ;; ----------------------------------------------------------------------------- ;; Macro used to free frame of funclet calling helpers (RhpCallXXXXFunclet) ;; $extraStackSize - extra stack space that the user of the macro can use to ;; store additional registers. ;; It needs to match the value passed to the corresponding ;; ALLOC_CALL_FUNCLET_FRAME. MACRO FREE_CALL_FUNCLET_FRAME $extraStackSize IF $extraStackSize != 0 EPILOG_STACK_FREE $extraStackSize ENDIF EPILOG_RESTORE_REG_PAIR x19, x20, #0x10 EPILOG_RESTORE_REG_PAIR x21, x22, #0x20 EPILOG_RESTORE_REG_PAIR x23, x24, #0x30 EPILOG_RESTORE_REG_PAIR x25, x26, #0x40 EPILOG_RESTORE_REG_PAIR x27, x28, #0x50 EPILOG_RESTORE_REG_PAIR fp, lr, #0x60! MEND ;; ----------------------------------------------------------------------------- ;; Macro used to restore preserved general purpose and FP registers from REGDISPLAY ;; $regdisplayReg - register pointing to the REGDISPLAY structure MACRO RESTORE_PRESERVED_REGISTERS $regdisplayReg ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX19] ldr x19, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX20] ldr x20, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX21] ldr x21, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX22] ldr x22, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX23] ldr x23, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX24] ldr x24, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX25] ldr x25, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX26] ldr x26, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX27] ldr x27, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX28] ldr x28, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pFP] ldr fp, [x12] ;; ;; load FP preserved regs ;; add x12, $regdisplayReg, #OFFSETOF__REGDISPLAY__D ldp d8, d9, [x12, #0x00] ldp d10, d11, [x12, #0x10] ldp d12, d13, [x12, #0x20] ldp d14, d15, [x12, #0x30] MEND ;; ----------------------------------------------------------------------------- ;; Macro used to save preserved general purpose and FP registers to REGDISPLAY ;; $regdisplayReg - register pointing to the REGDISPLAY structure MACRO SAVE_PRESERVED_REGISTERS $regdisplayReg ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX19] str x19, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX20] str x20, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX21] str x21, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX22] str x22, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX23] str x23, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX24] str x24, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX25] str x25, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX26] str x26, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX27] str x27, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX28] str x28, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pFP] str fp, [x12] ;; ;; store vfp preserved regs ;; add x12, $regdisplayReg, #OFFSETOF__REGDISPLAY__D stp d8, d9, [x12, #0x00] stp d10, d11, [x12, #0x10] stp d12, d13, [x12, #0x20] stp d14, d15, [x12, #0x30] MEND ;; ----------------------------------------------------------------------------- ;; Macro used to thrash preserved general purpose registers in REGDISPLAY ;; to make sure nobody uses them ;; $regdisplayReg - register pointing to the REGDISPLAY structure MACRO TRASH_PRESERVED_REGISTERS_STORAGE $regdisplayReg #if 0 // def _DEBUG ;; @TODO: temporarily removed because trashing the frame pointer breaks the debugger movz x3, #0xbaad, LSL #48 movk x3, #0xdeed, LSL #32 movk x3, #0xbaad, LSL #16 movk x3, #0xdeed ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX19] str x3, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX20] str x3, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX21] str x3, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX22] str x3, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX23] str x3, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX24] str x3, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX25] str x3, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX26] str x3, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX27] str x3, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX28] str x3, [x12] ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pFP] str x3, [x12] #endif // _DEBUG MEND ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; RhpThrowHwEx ;; ;; INPUT: W0: exception code of fault ;; X1: faulting IP ;; ;; OUTPUT: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NESTED_ENTRY RhpThrowHwEx #define rsp_offsetof_ExInfo 0 #define rsp_offsetof_Context STACKSIZEOF_ExInfo PROLOG_NOP mov w2, w0 ;; save exception code into x2 PROLOG_NOP mov x0, sp ;; get SP of fault site PROLOG_NOP mov lr, x1 ;; set IP of fault site ALLOC_THROW_FRAME ; x0: SP of fault site ; x1: IP of fault site ; x2: exception code of fault ; lr: IP of fault site (as a 'return address') mov w0, w2 ;; w0 <- exception code of fault ;; x2 = GetThread(), TRASHES x1 INLINE_GETTHREAD x2, x1 add x1, sp, #rsp_offsetof_ExInfo ;; x1 <- ExInfo* str xzr, [x1, #OFFSETOF__ExInfo__m_exception] ;; pExInfo->m_exception = null mov w3, #1 strb w3, [x1, #OFFSETOF__ExInfo__m_passNumber] ;; pExInfo->m_passNumber = 1 mov w3, #0xFFFFFFFF str w3, [x1, #OFFSETOF__ExInfo__m_idxCurClause] ;; pExInfo->m_idxCurClause = MaxTryRegionIdx mov w3, #2 strb w3, [x1, #OFFSETOF__ExInfo__m_kind] ;; pExInfo->m_kind = ExKind.HardwareFault ;; link the ExInfo into the thread's ExInfo chain ldr x3, [x2, #OFFSETOF__Thread__m_pExInfoStackHead] str x3, [x1, #OFFSETOF__ExInfo__m_pPrevExInfo] ;; pExInfo->m_pPrevExInfo = m_pExInfoStackHead str x1, [x2, #OFFSETOF__Thread__m_pExInfoStackHead] ;; m_pExInfoStackHead = pExInfo ;; set the exception context field on the ExInfo add x2, sp, #rsp_offsetof_Context ;; x2 <- PAL_LIMITED_CONTEXT* str x2, [x1, #OFFSETOF__ExInfo__m_pExContext] ;; pExInfo->m_pExContext = pContext ;; w0: exception code ;; x1: ExInfo* bl RhThrowHwEx EXPORT_POINTER_TO_ADDRESS PointerToRhpThrowHwEx2 ;; no return EMIT_BREAKPOINT NESTED_END RhpThrowHwEx ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; RhpThrowEx ;; ;; INPUT: X0: exception object ;; ;; OUTPUT: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NESTED_ENTRY RhpThrowEx ALLOC_THROW_FRAME ;; Compute and save SP at callsite. add x1, sp, #(STACKSIZEOF_ExInfo + SIZEOF__PAL_LIMITED_CONTEXT) str x1, [sp, #(rsp_offsetof_Context + OFFSETOF__PAL_LIMITED_CONTEXT__SP)] ;; x2 = GetThread(), TRASHES x1 INLINE_GETTHREAD x2, x1 ;; There is runtime C# code that can tail call to RhpThrowEx using a binder intrinsic. So the return ;; address could have been hijacked when we were in that C# code and we must remove the hijack and ;; reflect the correct return address in our exception context record. The other throw helpers don't ;; need this because they cannot be tail-called from C#. ;; NOTE: we cannot use INLINE_THREAD_UNHIJACK because it will write into the stack at the location ;; where the tail-calling thread had saved LR, which may not match where we have saved LR. ldr x1, [x2, #OFFSETOF__Thread__m_pvHijackedReturnAddress] cbz x1, NotHijacked ldr x3, [x2, #OFFSETOF__Thread__m_ppvHijackedReturnAddressLocation] ;; x0: exception object ;; x1: hijacked return address ;; x2: pThread ;; x3: hijacked return address location add x12, sp, #(STACKSIZEOF_ExInfo + SIZEOF__PAL_LIMITED_CONTEXT) ;; re-compute SP at callsite cmp x3, x12 ;; if (m_ppvHijackedReturnAddressLocation < SP at callsite) blo TailCallWasHijacked ;; normal case where a valid return address location is hijacked str x1, [x3] b ClearThreadState TailCallWasHijacked ;; Abnormal case where the return address location is now invalid because we ended up here via a tail ;; call. In this case, our hijacked return address should be the correct caller of this method. ;; ;; stick the previous return address in LR as well as in the right spots in our PAL_LIMITED_CONTEXT. mov lr, x1 str lr, [sp, #(rsp_offsetof_Context + OFFSETOF__PAL_LIMITED_CONTEXT__LR)] str lr, [sp, #(rsp_offsetof_Context + OFFSETOF__PAL_LIMITED_CONTEXT__IP)] ClearThreadState ;; clear the Thread's hijack state str xzr, [x2, #OFFSETOF__Thread__m_ppvHijackedReturnAddressLocation] str xzr, [x2, #OFFSETOF__Thread__m_pvHijackedReturnAddress] NotHijacked add x1, sp, #rsp_offsetof_ExInfo ;; x1 <- ExInfo* str xzr, [x1, #OFFSETOF__ExInfo__m_exception] ;; pExInfo->m_exception = null mov w3, #1 strb w3, [x1, #OFFSETOF__ExInfo__m_passNumber] ;; pExInfo->m_passNumber = 1 mov w3, #0xFFFFFFFF str w3, [x1, #OFFSETOF__ExInfo__m_idxCurClause] ;; pExInfo->m_idxCurClause = MaxTryRegionIdx mov w3, #1 strb w3, [x1, #OFFSETOF__ExInfo__m_kind] ;; pExInfo->m_kind = ExKind.Throw ;; link the ExInfo into the thread's ExInfo chain ldr x3, [x2, #OFFSETOF__Thread__m_pExInfoStackHead] str x3, [x1, #OFFSETOF__ExInfo__m_pPrevExInfo] ;; pExInfo->m_pPrevExInfo = m_pExInfoStackHead str x1, [x2, #OFFSETOF__Thread__m_pExInfoStackHead] ;; m_pExInfoStackHead = pExInfo ;; set the exception context field on the ExInfo add x2, sp, #rsp_offsetof_Context ;; x2 <- PAL_LIMITED_CONTEXT* str x2, [x1, #OFFSETOF__ExInfo__m_pExContext] ;; pExInfo->m_pExContext = pContext ;; x0: exception object ;; x1: ExInfo* bl RhThrowEx EXPORT_POINTER_TO_ADDRESS PointerToRhpThrowEx2 ;; no return EMIT_BREAKPOINT NESTED_END RhpThrowEx ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; void FASTCALL RhpRethrow() ;; ;; SUMMARY: Similar to RhpThrowEx, except that it passes along the currently active ExInfo ;; ;; INPUT: ;; ;; OUTPUT: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NESTED_ENTRY RhpRethrow ALLOC_THROW_FRAME ;; Compute and save SP at callsite. add x1, sp, #(STACKSIZEOF_ExInfo + SIZEOF__PAL_LIMITED_CONTEXT) str x1, [sp, #(rsp_offsetof_Context + OFFSETOF__PAL_LIMITED_CONTEXT__SP)] ;; x2 = GetThread(), TRASHES x1 INLINE_GETTHREAD x2, x1 add x1, sp, #rsp_offsetof_ExInfo ;; x1 <- ExInfo* str xzr, [x1, #OFFSETOF__ExInfo__m_exception] ;; pExInfo->m_exception = null mov w3, #1 strb w3, [x1, #OFFSETOF__ExInfo__m_passNumber] ;; pExInfo->m_passNumber = 1 mov w3, #0xFFFFFFFF str w3, [x1, #OFFSETOF__ExInfo__m_idxCurClause] ;; pExInfo->m_idxCurClause = MaxTryRegionIdx ;; link the ExInfo into the thread's ExInfo chain ldr x3, [x2, #OFFSETOF__Thread__m_pExInfoStackHead] mov x0, x3 ;; x0 <- current ExInfo str x3, [x1, #OFFSETOF__ExInfo__m_pPrevExInfo] ;; pExInfo->m_pPrevExInfo = m_pExInfoStackHead str x1, [x2, #OFFSETOF__Thread__m_pExInfoStackHead] ;; m_pExInfoStackHead = pExInfo ;; set the exception context field on the ExInfo add x2, sp, #rsp_offsetof_Context ;; x2 <- PAL_LIMITED_CONTEXT* str x2, [x1, #OFFSETOF__ExInfo__m_pExContext] ;; pExInfo->m_pExContext = pContext ;; x0 contains the currently active ExInfo ;; x1 contains the address of the new ExInfo bl RhRethrow EXPORT_POINTER_TO_ADDRESS PointerToRhpRethrow2 ;; no return EMIT_BREAKPOINT NESTED_END RhpRethrow ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; void* FASTCALL RhpCallCatchFunclet(RtuObjectRef exceptionObj, void* pHandlerIP, REGDISPLAY* pRegDisplay, ;; ExInfo* pExInfo) ;; ;; INPUT: X0: exception object ;; X1: handler funclet address ;; X2: REGDISPLAY* ;; X3: ExInfo* ;; ;; OUTPUT: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NESTED_ENTRY RhpCallCatchFunclet ALLOC_CALL_FUNCLET_FRAME 0x60 stp d8, d9, [sp, #0x00] stp d10, d11, [sp, #0x10] stp d12, d13, [sp, #0x20] stp d14, d15, [sp, #0x30] stp x0, x2, [sp, #0x40] ;; x0, x2 & x3 are saved so we have the exception object, REGDISPLAY and stp x3, xzr, [sp, #0x50] ;; ExInfo later, xzr makes space for the local "is_not_handling_thread_abort" #define rsp_offset_is_not_handling_thread_abort 0x58 #define rsp_offset_x2 0x48 #define rsp_offset_x3 0x50 ;; ;; clear the DoNotTriggerGc flag, trashes x4-x6 ;; INLINE_GETTHREAD x5, x6 ;; x5 <- Thread*, x6 <- trashed ldr x4, [x5, #OFFSETOF__Thread__m_threadAbortException] sub x4, x4, x0 str x4, [sp, #rsp_offset_is_not_handling_thread_abort] ;; Non-zero if the exception is not ThreadAbortException add x12, x5, #OFFSETOF__Thread__m_ThreadStateFlags ClearRetry_Catch ldxr w4, [x12] bic w4, w4, #TSF_DoNotTriggerGc stxr w6, w4, [x12] cbz w6, ClearSuccess_Catch b ClearRetry_Catch ClearSuccess_Catch ;; ;; set preserved regs to the values expected by the funclet ;; RESTORE_PRESERVED_REGISTERS x2 ;; ;; trash the values at the old homes to make sure nobody uses them ;; TRASH_PRESERVED_REGISTERS_STORAGE x2 ;; ;; call the funclet ;; ;; x0 still contains the exception object blr x1 EXPORT_POINTER_TO_ADDRESS PointerToRhpCallCatchFunclet2 ;; x0 contains resume IP ldr x2, [sp, #rsp_offset_x2] ;; x2 <- REGDISPLAY* ;; @TODO: add debug-only validation code for ExInfo pop INLINE_GETTHREAD x1, x3 ;; x1 <- Thread*, x3 <- trashed ;; We must unhijack the thread at this point because the section of stack where the hijack is applied ;; may go dead. If it does, then the next time we try to unhijack the thread, it will corrupt the stack. INLINE_THREAD_UNHIJACK x1, x3, x12 ;; Thread in x1, trashes x3 and x12 ldr x3, [sp, #rsp_offset_x3] ;; x3 <- current ExInfo* ldr x2, [x2, #OFFSETOF__REGDISPLAY__SP] ;; x2 <- resume SP value PopExInfoLoop ldr x3, [x3, #OFFSETOF__ExInfo__m_pPrevExInfo] ;; x3 <- next ExInfo cbz x3, DonePopping ;; if (pExInfo == null) { we're done } cmp x3, x2 blt PopExInfoLoop ;; if (pExInfo < resume SP} { keep going } DonePopping str x3, [x1, #OFFSETOF__Thread__m_pExInfoStackHead] ;; store the new head on the Thread ldr x3, =RhpTrapThreads ldr w3, [x3] tbz x3, #TrapThreadsFlags_AbortInProgress_Bit, NoAbort ldr x3, [sp, #rsp_offset_is_not_handling_thread_abort] cbnz x3, NoAbort ;; It was the ThreadAbortException, so rethrow it ;; reset SP mov x1, x0 ;; x1 <- continuation address as exception PC mov w0, #STATUS_REDHAWK_THREAD_ABORT mov sp, x2 b RhpThrowHwEx NoAbort ;; reset SP and jump to continuation address mov sp, x2 ret x0 NESTED_END RhpCallCatchFunclet ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; void FASTCALL RhpCallFinallyFunclet(void* pHandlerIP, REGDISPLAY* pRegDisplay) ;; ;; INPUT: X0: handler funclet address ;; X1: REGDISPLAY* ;; ;; OUTPUT: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NESTED_ENTRY RhpCallFinallyFunclet ALLOC_CALL_FUNCLET_FRAME 0x50 stp d8, d9, [sp, #0x00] stp d10, d11, [sp, #0x10] stp d12, d13, [sp, #0x20] stp d14, d15, [sp, #0x30] stp x0, x1, [sp, #0x40] ;; x1 is saved so we have the REGDISPLAY later, x0 is just alignment padding #define rsp_offset_x1 0x48 ;; ;; We want to suppress hijacking between invocations of subsequent finallys. We do this because we ;; cannot tolerate a GC after one finally has run (and possibly side-effected the GC state of the ;; method) and then been popped off the stack, leaving behind no trace of its effect. ;; ;; So we clear the state before and set it after invocation of the handler. ;; ;; ;; clear the DoNotTriggerGc flag, trashes x2-x4 ;; INLINE_GETTHREAD x2, x3 ;; x2 <- Thread*, x3 <- trashed add x12, x2, #OFFSETOF__Thread__m_ThreadStateFlags ClearRetry ldxr w4, [x12] bic w4, w4, #TSF_DoNotTriggerGc stxr w3, w4, [x12] cbz w3, ClearSuccess b ClearRetry ClearSuccess ;; ;; set preserved regs to the values expected by the funclet ;; RESTORE_PRESERVED_REGISTERS x1 ;; ;; trash the values at the old homes to make sure nobody uses them ;; TRASH_PRESERVED_REGISTERS_STORAGE x1 ;; ;; call the funclet ;; blr x0 EXPORT_POINTER_TO_ADDRESS PointerToRhpCallFinallyFunclet2 ldr x1, [sp, #rsp_offset_x1] ;; reload REGDISPLAY pointer ;; ;; save new values of preserved regs into REGDISPLAY ;; SAVE_PRESERVED_REGISTERS x1 ;; ;; set the DoNotTriggerGc flag, trashes x1-x3 ;; INLINE_GETTHREAD x2, x3 ;; x2 <- Thread*, x3 <- trashed add x12, x2, #OFFSETOF__Thread__m_ThreadStateFlags SetRetry ldxr w1, [x12] orr w1, w1, #TSF_DoNotTriggerGc stxr w3, w1, [x12] cbz w3, SetSuccess b SetRetry SetSuccess ldp d8, d9, [sp, #0x00] ldp d10, d11, [sp, #0x10] ldp d12, d13, [sp, #0x20] ldp d14, d15, [sp, #0x30] FREE_CALL_FUNCLET_FRAME 0x50 EPILOG_RETURN NESTED_END RhpCallFinallyFunclet ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; void* FASTCALL RhpCallFilterFunclet(RtuObjectRef exceptionObj, void* pFilterIP, REGDISPLAY* pRegDisplay) ;; ;; INPUT: X0: exception object ;; X1: filter funclet address ;; X2: REGDISPLAY* ;; ;; OUTPUT: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NESTED_ENTRY RhpCallFilterFunclet ALLOC_CALL_FUNCLET_FRAME 0x40 stp d8, d9, [sp, #0x00] stp d10, d11, [sp, #0x10] stp d12, d13, [sp, #0x20] stp d14, d15, [sp, #0x30] ldr x12, [x2, #OFFSETOF__REGDISPLAY__pFP] ldr fp, [x12] ;; ;; call the funclet ;; ;; x0 still contains the exception object blr x1 EXPORT_POINTER_TO_ADDRESS PointerToRhpCallFilterFunclet2 ldp d8, d9, [sp, #0x00] ldp d10, d11, [sp, #0x10] ldp d12, d13, [sp, #0x20] ldp d14, d15, [sp, #0x30] FREE_CALL_FUNCLET_FRAME 0x40 EPILOG_RETURN NESTED_END RhpCallFilterFunclet INLINE_GETTHREAD_CONSTANT_POOL end
;; THIS PROGRAMM DEMOSTRATES A TRAIN ;; WHICH GOES LEFT OR RIGHT.IN ORDER ;; TO STOP THE TRAIN WE MUST PRESS ;; ONE TIME THE INTRPT BUTTON ;; TO CHANGE THE DIRECTION WE PRESS ;; THE INTRPT BUTTON TWICE ;; FOR ALL THESE TO HAPPEN THE RIGHT ;; SWITCH MUST BE ON OTHERWISE THE ;; INTRPT WILL HAVE NO EFFECT ON ;; THE TRAINS ROUTE LXI B,01F4H ;; OUR DELB DURATION MVI D,FEH ;; TRAIN CURRENT POSITION MVI E,00H ;; DIRECTION//0 UP-FFH DOWN MVI H,00H ;; INTERRUPT STATE MVI L,00H ;; FLAG// 1= WALL REACHED MVI A,0DH ;; APPLY MASK SIM CHECK_LSB: DI ;; DEACTIVATE INTRP MVI C,FFH ;; THE INTRP BUTTON HAS ;; NO EFFECT ON OUR TRAIN//C ;; IS OUR FLAG LDA 2000H ;; LED INPUT ANI 01H ;; CHECK IF THE LSB IS ON JZ CHECK_LSB EI WALL: MOV A,L CPI 00H JNZ CHECK_LSB ;; THE TRAIN HAS REACHED TO ;; MSB OR LSB DESTINAION ;; WAITING FOR DOUBLE INTERRUPT DIRECTION: MVI C,F4H ;; WE START COUNTING THE EFFECT ;; OF THE INTERUPT MOV A,E CPI 00H JNZ COUNT_DOWN;; WHICH DIRECTION COUNT_UP: MOV A,D STA 3000H DI CALL DELB EI RLC ;; MOVE LEFT A STATION MOV D,A CPI 7FH ;; CHECK IF WE HIT MSB JZ BORDER JMP CHECK_LSB ;; IF NOT, REPEAT COUNT_DOWN: MOV A,D STA 3000H DI CALL DELB EI RRC ;; MOVE RIGTH STATION MOV D,A CPI FEH ;; CHECK IF WE HIT LSB JZ BORDER JMP CHECK_LSB ;; IF NO, REPEAT BORDER: MVI L,01H ;; STOP THE MOVEMENT MOV A,D STA 3000H ;; DISPLAY THE STATION ;; BEFORE CHANGING JMP CHECK_LSB ;; WAIT IN THE LOOP ON ;; TOP UNTIL DOUBLE INTERRUPT INTR_ROUTINE: PUSH PSW MOV A,C CPI FFH JZ CHECK6.5 ;; THE INTERRUPT HAS NO EFFECT, ;; CHECK THE POSSIBLE INTR ;; FORM THE LSB MOV A,H CPI 00H JNZ CHANGE ;; IF H=1 THIS INTERRUPT IS ;; THE SECOND AND WILL ;; CHANGE THE DIRECTION MVI H,01H ;; IF H=0 ITS THE FIRST ;; INTERRUPT AND SHOULD ;; MAKE THE TRAIN STOP MVI L,01H ;; STOP THE TRAIN DONE: POP PSW EI RET CHECK6.5: MVI B,00H ;; SMALLER DELB RIM ANI 20H JNZ CHECK6.5 ;; REPEAT UNTIL THE ;; INTERRUPT IS SATISFIED CALL DELB MVI C,F4H MVI B,01H ;; RESET THE DELB DURATION JMP DONE CHANGE: MVI H,00H ;; RESET THE INTERRUPT COUNTER MVI L,00H ;; START THE TRAIN MOV A,E CPI 00H JZ CHANGE_DOWN ;; UP OR DOWN? CHANGE_UP: MOV A,D RLC ;; WE HIT WALL SO ;; WE MUST MOVE LEFT MOV D,A JMP REV CHANGE_DOWN: MOV A,D RRC ;; WE HIT WALL SO WE ;; MUST MOVE RIGHT MOV D,A REV: MOV A,E CMA MOV E,A ;; CHANGE THE PREVIOYS ;; DIRECTION // E=00H || E=FFH JMP DONE END
//------------------------------------------------------------------------------ /* This file is part of MUSO: https://github.com/MUSO/MUSO Copyright (c) 2012-2014 MUSO Labs Inc. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ //============================================================================== #include <MUSO/app/main/Application.h> #include <MUSO/app/misc/NetworkOPs.h> #include <MUSO/basics/Log.h> #include <MUSO/ledger/ReadView.h> #include <MUSO/net/RPCErr.h> #include <MUSO/protocol/ErrorCodes.h> #include <MUSO/protocol/UintTypes.h> #include <MUSO/protocol/jss.h> #include <MUSO/resource/Fees.h> #include <MUSO/rpc/Context.h> #include <MUSO/rpc/impl/RPCHelpers.h> namespace MUSO { Json::Value doBookOffers(RPC::JsonContext& context) { // VFALCO TODO Here is a terrible place for this kind of business // logic. It needs to be moved elsewhere and documented, // and encapsulated into a function. if (context.app.getJobQueue().getJobCountGE(jtCLIENT) > 200) return rpcError(rpcTOO_BUSY); std::shared_ptr<ReadView const> lpLedger; auto jvResult = RPC::lookupLedger(lpLedger, context); if (!lpLedger) return jvResult; if (!context.params.isMember(jss::taker_pays)) return RPC::missing_field_error(jss::taker_pays); if (!context.params.isMember(jss::taker_gets)) return RPC::missing_field_error(jss::taker_gets); Json::Value const& taker_pays = context.params[jss::taker_pays]; Json::Value const& taker_gets = context.params[jss::taker_gets]; if (!taker_pays.isObjectOrNull()) return RPC::object_field_error(jss::taker_pays); if (!taker_gets.isObjectOrNull()) return RPC::object_field_error(jss::taker_gets); if (!taker_pays.isMember(jss::currency)) return RPC::missing_field_error("taker_pays.currency"); if (!taker_pays[jss::currency].isString()) return RPC::expected_field_error("taker_pays.currency", "string"); if (!taker_gets.isMember(jss::currency)) return RPC::missing_field_error("taker_gets.currency"); if (!taker_gets[jss::currency].isString()) return RPC::expected_field_error("taker_gets.currency", "string"); Currency pay_currency; if (!to_currency(pay_currency, taker_pays[jss::currency].asString())) { JLOG(context.j.info()) << "Bad taker_pays currency."; return RPC::make_error( rpcSRC_CUR_MALFORMED, "Invalid field 'taker_pays.currency', bad currency."); } Currency get_currency; if (!to_currency(get_currency, taker_gets[jss::currency].asString())) { JLOG(context.j.info()) << "Bad taker_gets currency."; return RPC::make_error( rpcDST_AMT_MALFORMED, "Invalid field 'taker_gets.currency', bad currency."); } AccountID pay_issuer; if (taker_pays.isMember(jss::issuer)) { if (!taker_pays[jss::issuer].isString()) return RPC::expected_field_error("taker_pays.issuer", "string"); if (!to_issuer(pay_issuer, taker_pays[jss::issuer].asString())) return RPC::make_error( rpcSRC_ISR_MALFORMED, "Invalid field 'taker_pays.issuer', bad issuer."); if (pay_issuer == noAccount()) return RPC::make_error( rpcSRC_ISR_MALFORMED, "Invalid field 'taker_pays.issuer', bad issuer account one."); } else { pay_issuer = MUSOAccount(); } if (isMUSO(pay_currency) && !isMUSO(pay_issuer)) return RPC::make_error( rpcSRC_ISR_MALFORMED, "Unneeded field 'taker_pays.issuer' for " "MUSO currency specification."); if (!isMUSO(pay_currency) && isMUSO(pay_issuer)) return RPC::make_error( rpcSRC_ISR_MALFORMED, "Invalid field 'taker_pays.issuer', expected non-MUSO issuer."); AccountID get_issuer; if (taker_gets.isMember(jss::issuer)) { if (!taker_gets[jss::issuer].isString()) return RPC::expected_field_error("taker_gets.issuer", "string"); if (!to_issuer(get_issuer, taker_gets[jss::issuer].asString())) return RPC::make_error( rpcDST_ISR_MALFORMED, "Invalid field 'taker_gets.issuer', bad issuer."); if (get_issuer == noAccount()) return RPC::make_error( rpcDST_ISR_MALFORMED, "Invalid field 'taker_gets.issuer', bad issuer account one."); } else { get_issuer = MUSOAccount(); } if (isMUSO(get_currency) && !isMUSO(get_issuer)) return RPC::make_error( rpcDST_ISR_MALFORMED, "Unneeded field 'taker_gets.issuer' for " "MUSO currency specification."); if (!isMUSO(get_currency) && isMUSO(get_issuer)) return RPC::make_error( rpcDST_ISR_MALFORMED, "Invalid field 'taker_gets.issuer', expected non-MUSO issuer."); boost::optional<AccountID> takerID; if (context.params.isMember(jss::taker)) { if (!context.params[jss::taker].isString()) return RPC::expected_field_error(jss::taker, "string"); takerID = parseBase58<AccountID>(context.params[jss::taker].asString()); if (!takerID) return RPC::invalid_field_error(jss::taker); } if (pay_currency == get_currency && pay_issuer == get_issuer) { JLOG(context.j.info()) << "taker_gets same as taker_pays."; return RPC::make_error(rpcBAD_MARKET); } unsigned int limit; if (auto err = readLimitField(limit, RPC::Tuning::bookOffers, context)) return *err; bool const bProof(context.params.isMember(jss::proof)); Json::Value const jvMarker( context.params.isMember(jss::marker) ? context.params[jss::marker] : Json::Value(Json::nullValue)); context.netOps.getBookPage( lpLedger, {{pay_currency, pay_issuer}, {get_currency, get_issuer}}, takerID ? *takerID : beast::zero, bProof, limit, jvMarker, jvResult); context.loadType = Resource::feeMediumBurdenRPC; return jvResult; } } // namespace MUSO
tsx lda {m1} sta STACK_BASE+{c1},x lda {m1}+1 sta STACK_BASE+{c1}+1,x lda {m1}+2 sta STACK_BASE+{c1}+2,x lda {m1}+3 sta STACK_BASE+{c1}+3,x
; ;================================================================================================== ; SC130 STANDARD CONFIGURATION ;================================================================================================== ; ; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE ; CFG_<PLT>.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS ; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE ; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. ; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE <PLT>_XXX.ASM AND SPECIFY ; YOUR FILE IN THE BUILD PROCESS. ; ; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. ; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO ; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON ; SETTINGS. ; ; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, ; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING ; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! ; ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; #DEFINE PLATFORM_NAME "SC130" ; #DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON <CR> OR AUTO BOOT ; #include "cfg_scz180.asm" ; CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP ; CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ ; Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) ; HBIOS_MUTEX .SET FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) ; LEDENABLE .SET TRUE ; ENABLE STATUS LED (SINGLE LED) ; DIAGENABLE .SET FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT ; DSRTCENABLE .SET FALSE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) INTRTCENABLE .SET TRUE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) ; UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) SIOENABLE .SET FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) ; TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) ; FDENABLE .SET TRUE ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] ; IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) ; PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) ; SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) ; PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM)
// Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include <cassert> #include <memory> #include <typeinfo> #include <utility> using namespace std; struct Dummy { constexpr int test() const { return 10; } }; constexpr bool test_P2273R3_constexpr_unique_ptr() { // [memory.syn] { auto p1 = make_unique<int>(42); auto p2 = make_unique_for_overwrite<int>(); swap(p1, p2); assert(p1 == p1); assert(p1 != p2); #if defined(__EDG__) || defined(__clang__) // TRANSITION, DevCom-1436243 auto p3 = make_unique<int[]>(10); auto p4 = make_unique_for_overwrite<int[]>(4); swap(p3, p4); assert(p3 == p3); assert(p3 != p4); #endif // defined(__EDG__) || defined(__clang__) auto p5 = unique_ptr<int>{nullptr}; assert(p5 == nullptr); assert(nullptr == p5); assert(!(p5 != nullptr)); assert(!(nullptr != p5)); #ifndef __EDG__ // TRANSITION, DevCom-1670927 assert(!(p5 < nullptr)); assert(!(nullptr < p5)); assert(p5 <= nullptr); assert(nullptr <= p5); assert(!(p5 > nullptr)); assert(!(nullptr > p5)); assert(p5 >= nullptr); assert(nullptr >= p5); assert((p5 <=> nullptr) == strong_ordering::equal); assert((nullptr <=> p5) == strong_ordering::equal); #endif // !__EDG__ } // changes in [unique.ptr.dltr.dflt] and [unique.ptr.dltr.dflt1] // will be tested via destructors and copy assign/constructors // [unique.ptr.single.general] { // constructors auto p1 = unique_ptr<int>{new int{}}; auto d1 = default_delete<int>{}; auto p2 = unique_ptr<int>{new int{}, d1}; auto p3 = unique_ptr<int>{new int{}, default_delete<int>{}}; auto p4 = move(p3); auto p5 = unique_ptr<int>{nullptr}; auto p6 = unique_ptr<int, default_delete<int>&>{new int{}, d1}; auto p7 = unique_ptr<int>{move(p6)}; // assignment p3 = move(p4); auto p8 = unique_ptr<int, default_delete<int>&>{new int{}, d1}; p7 = move(p8); p1 = nullptr; // observers assert(*p2 == 0); auto p9 = unique_ptr<Dummy>{new Dummy}; assert(p9->test() == 10); assert(p2.get() != nullptr); [[maybe_unused]] auto& d2 = p2.get_deleter(); [[maybe_unused]] auto& d3 = as_const(p2).get_deleter(); auto b1 = static_cast<bool>(p2); assert(b1); // modifiers p1.reset(); p1.reset(new int{}); auto manual_delete = p2.release(); delete manual_delete; p5.swap(p1); } // [unique.ptr.runtime.general] { // constructors auto p1 = unique_ptr<int[]>{new int[5]}; auto d1 = default_delete<int[]>{}; auto p2 = unique_ptr<int[]>{new int[5], d1}; auto p3 = unique_ptr<int[]>{new int[5], default_delete<int[]>{}}; auto p4 = move(p1); auto p5 = unique_ptr<int[], default_delete<int[]>&>{new int[5], d1}; auto p6 = unique_ptr<int[]>{move(p5)}; // assignment p1 = move(p4); auto p7 = unique_ptr<int[], default_delete<int[]>&>{new int[5], d1}; p6 = move(p7); p4 = nullptr; // observers p1[0] = 50; assert(p1[0] == 50); assert(p1.get() != nullptr); [[maybe_unused]] auto& d2 = p1.get_deleter(); [[maybe_unused]] auto& d3 = as_const(p1).get_deleter(); auto b1 = static_cast<bool>(p1); assert(b1); // modifiers auto manual_delete = p1.release(); delete[] manual_delete; p1.reset(new int[3]); p1.reset(nullptr); p1.reset(); p1.swap(p4); } return true; } static_assert(test_P2273R3_constexpr_unique_ptr()); // Also test P1328R1 constexpr type_info::operator==() constexpr bool test_P1328R1_constexpr_type_info_equality() { assert(typeid(int) == typeid(int)); assert(typeid(int) != typeid(double)); assert(typeid(int) == typeid(int&)); // N4910 [expr.typeid]/5 assert(typeid(int) == typeid(const int&)); // N4910 [expr.typeid]/5 assert(typeid(int) == typeid(const int)); // N4910 [expr.typeid]/6 return true; } static_assert(test_P1328R1_constexpr_type_info_equality()); int main() {} // COMPILE-ONLY
; ; jcgryext.asm - grayscale colorspace conversion (64-bit SSE2) ; ; Copyright (C) 2011, D. R. Commander. ; ; Based on the x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), ; can *not* be assembled with Microsoft's MASM or any compatible ; assembler (including Borland's Turbo Assembler). ; NASM is available from http://nasm.sourceforge.net/ or ; http://sourceforge.net/project/showfiles.php?group_id=6208 ; ; [TAB8] %include "jcolsamp.inc" ; -------------------------------------------------------------------------- ; ; Convert some rows of samples to the output colorspace. ; ; GLOBAL(void) ; jsimd_rgb_gray_convert_sse2 (JDIMENSION img_width, ; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, ; JDIMENSION output_row, int num_rows); ; ; r10 = JDIMENSION img_width ; r11 = JSAMPARRAY input_buf ; r12 = JSAMPIMAGE output_buf ; r13 = JDIMENSION output_row ; r14 = int num_rows %define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] %define WK_NUM 2 align 16 global EXTN(jsimd_rgb_gray_convert_sse2) PRIVATE EXTN(jsimd_rgb_gray_convert_sse2): push rbp mov rax,rsp ; rax = original rbp sub rsp, byte 4 and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits mov [rsp],rax mov rbp,rsp ; rbp = aligned rbp lea rsp, [wk(0)] collect_args push rbx mov ecx, r10d test rcx,rcx jz near .return push rcx mov rsi, r12 mov ecx, r13d mov rdi, JSAMPARRAY [rsi+0*SIZEOF_JSAMPARRAY] lea rdi, [rdi+rcx*SIZEOF_JSAMPROW] pop rcx mov rsi, r11 mov eax, r14d test rax,rax jle near .return .rowloop: push rdi push rsi push rcx ; col mov rsi, JSAMPROW [rsi] ; inptr mov rdi, JSAMPROW [rdi] ; outptr0 cmp rcx, byte SIZEOF_XMMWORD jae near .columnloop %if RGB_PIXELSIZE == 3 ; --------------- .column_ld1: push rax push rdx lea rcx,[rcx+rcx*2] ; imul ecx,RGB_PIXELSIZE test cl, SIZEOF_BYTE jz short .column_ld2 sub rcx, byte SIZEOF_BYTE movzx rax, BYTE [rsi+rcx] .column_ld2: test cl, SIZEOF_WORD jz short .column_ld4 sub rcx, byte SIZEOF_WORD movzx rdx, WORD [rsi+rcx] shl rax, WORD_BIT or rax,rdx .column_ld4: movd xmmA,eax pop rdx pop rax test cl, SIZEOF_DWORD jz short .column_ld8 sub rcx, byte SIZEOF_DWORD movd xmmF, XMM_DWORD [rsi+rcx] pslldq xmmA, SIZEOF_DWORD por xmmA,xmmF .column_ld8: test cl, SIZEOF_MMWORD jz short .column_ld16 sub rcx, byte SIZEOF_MMWORD movq xmmB, XMM_MMWORD [rsi+rcx] pslldq xmmA, SIZEOF_MMWORD por xmmA,xmmB .column_ld16: test cl, SIZEOF_XMMWORD jz short .column_ld32 movdqa xmmF,xmmA movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] mov rcx, SIZEOF_XMMWORD jmp short .rgb_gray_cnv .column_ld32: test cl, 2*SIZEOF_XMMWORD mov rcx, SIZEOF_XMMWORD jz short .rgb_gray_cnv movdqa xmmB,xmmA movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] jmp short .rgb_gray_cnv .columnloop: movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] movdqu xmmB, XMMWORD [rsi+2*SIZEOF_XMMWORD] .rgb_gray_cnv: ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) movdqa xmmG,xmmA pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) movdqa xmmD,xmmA pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) movdqa xmmE,xmmA pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) pxor xmmH,xmmH movdqa xmmC,xmmA punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) movdqa xmmB,xmmE punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) movdqa xmmF,xmmD punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) %else ; RGB_PIXELSIZE == 4 ; ----------- .column_ld1: test cl, SIZEOF_XMMWORD/16 jz short .column_ld2 sub rcx, byte SIZEOF_XMMWORD/16 movd xmmA, XMM_DWORD [rsi+rcx*RGB_PIXELSIZE] .column_ld2: test cl, SIZEOF_XMMWORD/8 jz short .column_ld4 sub rcx, byte SIZEOF_XMMWORD/8 movq xmmE, XMM_MMWORD [rsi+rcx*RGB_PIXELSIZE] pslldq xmmA, SIZEOF_MMWORD por xmmA,xmmE .column_ld4: test cl, SIZEOF_XMMWORD/4 jz short .column_ld8 sub rcx, byte SIZEOF_XMMWORD/4 movdqa xmmE,xmmA movdqu xmmA, XMMWORD [rsi+rcx*RGB_PIXELSIZE] .column_ld8: test cl, SIZEOF_XMMWORD/2 mov rcx, SIZEOF_XMMWORD jz short .rgb_gray_cnv movdqa xmmF,xmmA movdqa xmmH,xmmE movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] jmp short .rgb_gray_cnv .columnloop: movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] movdqu xmmF, XMMWORD [rsi+2*SIZEOF_XMMWORD] movdqu xmmH, XMMWORD [rsi+3*SIZEOF_XMMWORD] .rgb_gray_cnv: ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) movdqa xmmD,xmmA punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) movdqa xmmC,xmmF punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) movdqa xmmB,xmmA punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) movdqa xmmG,xmmD punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) movdqa xmmE,xmmA punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) movdqa xmmH,xmmB punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) pxor xmmF,xmmF movdqa xmmC,xmmA punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) movdqa xmmD,xmmB punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) movdqa xmmG,xmmE punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) punpcklbw xmmF,xmmH punpckhbw xmmH,xmmH psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) %endif ; RGB_PIXELSIZE ; --------------- ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO ; (Original) ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B ; ; (This implementation) ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G movdqa xmm6,xmm1 punpcklwd xmm1,xmm3 punpckhwd xmm6,xmm3 pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337) movdqa xmm6,xmm0 punpcklwd xmm0,xmm2 punpckhwd xmm6,xmm2 pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337) movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337) movdqa xmm0, xmm5 ; xmm0=BO movdqa xmm6, xmm4 ; xmm6=BE movdqa xmm4,xmm0 punpcklwd xmm0,xmm3 punpckhwd xmm4,xmm3 pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF] paddd xmm0, xmm1 paddd xmm4, xmm7 paddd xmm0,xmm3 paddd xmm4,xmm3 psrld xmm0,SCALEBITS ; xmm0=YOL psrld xmm4,SCALEBITS ; xmm4=YOH packssdw xmm0,xmm4 ; xmm0=YO movdqa xmm4,xmm6 punpcklwd xmm6,xmm2 punpckhwd xmm4,xmm2 pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF] paddd xmm6, XMMWORD [wk(0)] paddd xmm4, XMMWORD [wk(1)] paddd xmm6,xmm2 paddd xmm4,xmm2 psrld xmm6,SCALEBITS ; xmm6=YEL psrld xmm4,SCALEBITS ; xmm4=YEH packssdw xmm6,xmm4 ; xmm6=YE psllw xmm0,BYTE_BIT por xmm6,xmm0 ; xmm6=Y movdqa XMMWORD [rdi], xmm6 ; Save Y sub rcx, byte SIZEOF_XMMWORD add rsi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr add rdi, byte SIZEOF_XMMWORD ; outptr0 cmp rcx, byte SIZEOF_XMMWORD jae near .columnloop test rcx,rcx jnz near .column_ld1 pop rcx ; col pop rsi pop rdi add rsi, byte SIZEOF_JSAMPROW ; input_buf add rdi, byte SIZEOF_JSAMPROW dec rax ; num_rows jg near .rowloop .return: pop rbx uncollect_args mov rsp,rbp ; rsp <- aligned rbp pop rsp ; rsp <- original rbp pop rbp ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. align 16
; A346152: a(n) is the least prime divisor p_j of n such that if n = Product_{i=1..k} p_i^e_i and p_1 < p_2 < ... < p_k, then Product_{i=1..j-1} p_i^e_i <= sqrt(n) < Product_{i=j..k} p_i^e_i. a(1) = 1. ; Submitted by Christian Krause ; 1,2,3,2,5,3,7,2,3,5,11,2,13,7,5,2,17,3,19,5,7,11,23,2,5,13,3,7,29,3,31,2,11,17,7,3,37,19,13,2,41,7,43,11,3,23,47,2,7,5,17,13,53,3,11,2,19,29,59,3,61,31,3,2,13,11,67,17,23,5,71,3,73,37,5 add $0,1 mov $1,1 mov $2,2 mov $4,1 lpb $0 mul $1,$4 mov $3,$0 lpb $3 mov $4,$0 mod $4,$2 add $2,1 cmp $4,0 cmp $4,0 sub $3,$4 lpe div $0,$2 max $0,$1 mov $4,$2 lpe mov $0,$4
// (c) Copyright 1995-2021 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant any // rights to the materials distributed herewith. Except as // otherwise provided in a valid license issued to you by // Xilinx, and to the maximum extent permitted by applicable // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND // WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and // (2) Xilinx shall not be liable (whether in contract or tort, // including negligence, or under any other theory of // liability) for any loss or damage of any kind or nature // related to, arising under or in connection with these // materials, including for any direct, or any indirect, // special, incidental, or consequential loss or damage // (including loss of data, profits, goodwill, or any type of // loss or damage suffered as a result of any action brought // by a third party) even if such damage or loss was // reasonably foreseeable or Xilinx had been advised of the // possibility of the same. // // CRITICAL APPLICATIONS // Xilinx products are not designed or intended to be fail- // safe, or for use in any application requiring fail-safe // performance, such as life-support or safety devices or // systems, Class III medical devices, nuclear facilities, // applications related to the deployment of airbags, or any // other applications that could lead to death, personal // injury, or severe property or environmental damage // (individually and collectively, "Critical // Applications"). Customer assumes the sole risk and // liability of any use of Xilinx products in Critical // Applications, subject only to applicable laws and // regulations governing limitations on product liability. // // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS // PART OF THIS FILE AT ALL TIMES. // // DO NOT MODIFY THIS FILE. #include "mb_design_auto_pc_8_sc.h" #include "axi_protocol_converter.h" #include <map> #include <string> mb_design_auto_pc_8_sc::mb_design_auto_pc_8_sc(const sc_core::sc_module_name& nm) : sc_core::sc_module(nm), mp_impl(NULL) { // configure connectivity manager xsc::utils::xsc_sim_manager::addInstance("mb_design_auto_pc_8", this); // initialize module xsc::common_cpp::properties model_param_props; model_param_props.addLong("C_M_AXI_PROTOCOL", "0"); model_param_props.addLong("C_S_AXI_PROTOCOL", "2"); model_param_props.addLong("C_IGNORE_ID", "1"); model_param_props.addLong("C_AXI_ID_WIDTH", "1"); model_param_props.addLong("C_AXI_ADDR_WIDTH", "32"); model_param_props.addLong("C_AXI_DATA_WIDTH", "32"); model_param_props.addLong("C_AXI_SUPPORTS_WRITE", "1"); model_param_props.addLong("C_AXI_SUPPORTS_READ", "1"); model_param_props.addLong("C_AXI_SUPPORTS_USER_SIGNALS", "0"); model_param_props.addLong("C_AXI_AWUSER_WIDTH", "1"); model_param_props.addLong("C_AXI_ARUSER_WIDTH", "1"); model_param_props.addLong("C_AXI_WUSER_WIDTH", "1"); model_param_props.addLong("C_AXI_RUSER_WIDTH", "1"); model_param_props.addLong("C_AXI_BUSER_WIDTH", "1"); model_param_props.addLong("C_TRANSLATION_MODE", "2"); model_param_props.addString("C_FAMILY", "artix7"); mp_impl = new axi_protocol_converter("inst", model_param_props); // initialize AXI sockets target_rd_socket = mp_impl->target_rd_socket; target_wr_socket = mp_impl->target_wr_socket; initiator_rd_socket = mp_impl->initiator_rd_socket; initiator_wr_socket = mp_impl->initiator_wr_socket; } mb_design_auto_pc_8_sc::~mb_design_auto_pc_8_sc() { xsc::utils::xsc_sim_manager::clean(); delete mp_impl; }
.text .align 2 .thumb .thumb_func .global newmovesetstyle2 main: ldrb r1, [r0, #0x2] mov r2, #0xFF cmp r1, r2 beq exit2 mov r9, r2 mov r3, #0x0 loop: lsl r0, r3, #0x1 add r0, r0, r3 ldr r1, movesettable add r1, r1, r6 ldr r1, [r1, #0x0] add r7, r0, r1 ldrb r0, [r7, #0x2] mov r4, r10 cmp r0, r4 bgt exit2 ldrb r1, [r7, #0x1] ldrb r0, [r7, #0x0] lsl r1, r1, #0x8 orr r1, r0 mov r0, r8 str r3, [sp, #0x0] bl branchone mov r5, r9 ldr r3, [sp, #0x0] cmp r0, r9 bne exit mov r0, r8 add r1, r4, #0x0 bl branchtwo ldr r3, [sp, #0x0] exit: add r3, #0x1 lsl r1, r3, #0x1 add r1, r1, r3 add r0, r7, r1 ldrb r0, [r0, #0x2] cmp r0, r5 bne loop exit2: add sp, #0x4 pop {r3-r5} mov r8, r3 mov r9, r4 mov r10, r5 pop {r4-r7} pop {r0} bx r0 branchone: push {r4-r7,lr} add sp, #-0x4 ldr r7, gothere bx r7 branchtwo: push {r4-r7} ldr r7, gothere2 bx r7 .align gothere: .word 0x0803E8B5 gothere2: .word 0x0803EC43 movesettable: .word 0x08A0B7E4
_Interrupt: MOVWF R15+0 SWAPF STATUS+0, 0 CLRF STATUS+0 MOVWF ___saveSTATUS+0 MOVF PCLATH+0, 0 MOVWF ___savePCLATH+0 CLRF PCLATH+0 ;Remote Controlled motor.c,26 :: void Interrupt(){ //External interrupt occured ;Remote Controlled motor.c,28 :: delay_us(370); MOVLW 2 MOVWF R12+0 MOVLW 111 MOVWF R13+0 L_Interrupt0: DECFSZ R13+0, 1 GOTO L_Interrupt0 DECFSZ R12+0, 1 GOTO L_Interrupt0 NOP NOP ;Remote Controlled motor.c,29 :: if(PORTB.F0==0){ BTFSC PORTB+0, 0 GOTO L_Interrupt1 ;Remote Controlled motor.c,30 :: delay_us(889); MOVLW 4 MOVWF R12+0 MOVLW 117 MOVWF R13+0 L_Interrupt2: DECFSZ R13+0, 1 GOTO L_Interrupt2 DECFSZ R12+0, 1 GOTO L_Interrupt2 NOP ;Remote Controlled motor.c,31 :: if(PORTB.F0==1){ BTFSS PORTB+0, 0 GOTO L_Interrupt3 ;Remote Controlled motor.c,32 :: delay_us(889); MOVLW 4 MOVWF R12+0 MOVLW 117 MOVWF R13+0 L_Interrupt4: DECFSZ R13+0, 1 GOTO L_Interrupt4 DECFSZ R12+0, 1 GOTO L_Interrupt4 NOP ;Remote Controlled motor.c,33 :: if(PORTB.F0==0){ BTFSC PORTB+0, 0 GOTO L_Interrupt5 ;Remote Controlled motor.c,34 :: ir_read = 1; MOVLW 1 MOVWF _ir_read+0 ;Remote Controlled motor.c,35 :: INTCON = 0; //Disabe the external interrupt CLRF INTCON+0 ;Remote Controlled motor.c,36 :: }}} L_Interrupt5: L_Interrupt3: L_Interrupt1: ;Remote Controlled motor.c,37 :: INTF_bit = 0; //Clear Interrupt flag BCF INTF_bit+0, BitPos(INTF_bit+0) ;Remote Controlled motor.c,38 :: } L_end_Interrupt: L__Interrupt28: MOVF ___savePCLATH+0, 0 MOVWF PCLATH+0 SWAPF ___saveSTATUS+0, 0 MOVWF STATUS+0 SWAPF R15+0, 1 SWAPF R15+0, 0 RETFIE ; end of _Interrupt _display_results: ;Remote Controlled motor.c,39 :: void display_results (){ ;Remote Controlled motor.c,40 :: Lcd_Cmd(_LCD_CLEAR); //Clear LCD MOVLW 1 MOVWF FARG_Lcd_Cmd_out_char+0 CALL _Lcd_Cmd+0 ;Remote Controlled motor.c,41 :: text = "Direction: " ; MOVLW ?lstr1_Remote_32Controlled_32motor+0 MOVWF _text+0 ;Remote Controlled motor.c,42 :: Lcd_Out(1, 2, text); MOVLW 1 MOVWF FARG_Lcd_Out_row+0 MOVLW 2 MOVWF FARG_Lcd_Out_column+0 MOVF _text+0, 0 MOVWF FARG_Lcd_Out_text+0 CALL _Lcd_Out+0 ;Remote Controlled motor.c,43 :: if(dr == 0){ BTFSC _dr+0, BitPos(_dr+0) GOTO L_display_results6 ;Remote Controlled motor.c,44 :: text = "CW" ; MOVLW ?lstr2_Remote_32Controlled_32motor+0 MOVWF _text+0 ;Remote Controlled motor.c,45 :: Lcd_Out(1, 12, text);} MOVLW 1 MOVWF FARG_Lcd_Out_row+0 MOVLW 12 MOVWF FARG_Lcd_Out_column+0 MOVF _text+0, 0 MOVWF FARG_Lcd_Out_text+0 CALL _Lcd_Out+0 GOTO L_display_results7 L_display_results6: ;Remote Controlled motor.c,47 :: text = "CCW" ; MOVLW ?lstr3_Remote_32Controlled_32motor+0 MOVWF _text+0 ;Remote Controlled motor.c,48 :: Lcd_Out(1, 12, text);} MOVLW 1 MOVWF FARG_Lcd_Out_row+0 MOVLW 12 MOVWF FARG_Lcd_Out_column+0 MOVF _text+0, 0 MOVWF FARG_Lcd_Out_text+0 CALL _Lcd_Out+0 L_display_results7: ;Remote Controlled motor.c,49 :: text = "Speed(%)=" ; MOVLW ?lstr4_Remote_32Controlled_32motor+0 MOVWF _text+0 ;Remote Controlled motor.c,50 :: Lcd_Out(2, 3, text); MOVLW 2 MOVWF FARG_Lcd_Out_row+0 MOVLW 3 MOVWF FARG_Lcd_Out_column+0 MOVF _text+0, 0 MOVWF FARG_Lcd_Out_text+0 CALL _Lcd_Out+0 ;Remote Controlled motor.c,51 :: ByteToStr(i, mytext); MOVF _i+0, 0 MOVWF FARG_ByteToStr_input+0 MOVLW _mytext+0 MOVWF FARG_ByteToStr_output+0 CALL _ByteToStr+0 ;Remote Controlled motor.c,52 :: Lcd_Out(2, 12, Ltrim(mytext)); MOVLW _mytext+0 MOVWF FARG_Ltrim_string+0 CALL _Ltrim+0 MOVF R0+0, 0 MOVWF FARG_Lcd_Out_text+0 MOVLW 2 MOVWF FARG_Lcd_Out_row+0 MOVLW 12 MOVWF FARG_Lcd_Out_column+0 CALL _Lcd_Out+0 ;Remote Controlled motor.c,53 :: } L_end_display_results: RETURN ; end of _display_results _main: ;Remote Controlled motor.c,54 :: void main() { ;Remote Controlled motor.c,55 :: OPTION_REG = 0; CLRF OPTION_REG+0 ;Remote Controlled motor.c,56 :: PORTB = 0; CLRF PORTB+0 ;Remote Controlled motor.c,57 :: TRISB = 1; MOVLW 1 MOVWF TRISB+0 ;Remote Controlled motor.c,58 :: PORTC = 0; CLRF PORTC+0 ;Remote Controlled motor.c,59 :: TRISC = 0; CLRF TRISC+0 ;Remote Controlled motor.c,60 :: PORTD = 0; CLRF PORTD+0 ;Remote Controlled motor.c,61 :: TRISD = 0; CLRF TRISD+0 ;Remote Controlled motor.c,62 :: PWM1_Init(10000); BSF T2CON+0, 0 BCF T2CON+0, 1 MOVLW 74 MOVWF PR2+0 CALL _PWM1_Init+0 ;Remote Controlled motor.c,63 :: Lcd_Init(); CALL _Lcd_Init+0 ;Remote Controlled motor.c,64 :: Lcd_Cmd(_LCD_CURSOR_OFF); // cursor off MOVLW 12 MOVWF FARG_Lcd_Cmd_out_char+0 CALL _Lcd_Cmd+0 ;Remote Controlled motor.c,65 :: Lcd_Cmd(_LCD_CLEAR); // clear LCD MOVLW 1 MOVWF FARG_Lcd_Cmd_out_char+0 CALL _Lcd_Cmd+0 ;Remote Controlled motor.c,66 :: text = "Remote" ; MOVLW ?lstr5_Remote_32Controlled_32motor+0 MOVWF _text+0 ;Remote Controlled motor.c,67 :: Lcd_Out(1, 6, text); MOVLW 1 MOVWF FARG_Lcd_Out_row+0 MOVLW 6 MOVWF FARG_Lcd_Out_column+0 MOVF _text+0, 0 MOVWF FARG_Lcd_Out_text+0 CALL _Lcd_Out+0 ;Remote Controlled motor.c,68 :: text = "Controlled DCM" ; MOVLW ?lstr6_Remote_32Controlled_32motor+0 MOVWF _text+0 ;Remote Controlled motor.c,69 :: Lcd_Out(2, 2, text); MOVLW 2 MOVWF FARG_Lcd_Out_row+0 MOVLW 2 MOVWF FARG_Lcd_Out_column+0 MOVF _text+0, 0 MOVWF FARG_Lcd_Out_text+0 CALL _Lcd_Out+0 ;Remote Controlled motor.c,70 :: delay_ms(1000); MOVLW 16 MOVWF R11+0 MOVLW 57 MOVWF R12+0 MOVLW 13 MOVWF R13+0 L_main8: DECFSZ R13+0, 1 GOTO L_main8 DECFSZ R12+0, 1 GOTO L_main8 DECFSZ R11+0, 1 GOTO L_main8 NOP NOP ;Remote Controlled motor.c,71 :: while(1){ L_main9: ;Remote Controlled motor.c,72 :: ret: ___main_ret: ;Remote Controlled motor.c,73 :: INTCON = 0x90; //External Interrupt enabled MOVLW 144 MOVWF INTCON+0 ;Remote Controlled motor.c,74 :: while(!ir_read); //Wait until IR RC5 protocl received L_main11: MOVF _ir_read+0, 0 BTFSS STATUS+0, 2 GOTO L_main12 GOTO L_main11 L_main12: ;Remote Controlled motor.c,75 :: ir_read = 0; CLRF _ir_read+0 ;Remote Controlled motor.c,76 :: delay_us(12446); MOVLW 49 MOVWF R12+0 MOVLW 124 MOVWF R13+0 L_main13: DECFSZ R13+0, 1 GOTO L_main13 DECFSZ R12+0, 1 GOTO L_main13 NOP ;Remote Controlled motor.c,77 :: for(j = 0; j < 6; j++) CLRF _j+0 L_main14: MOVLW 6 SUBWF _j+0, 0 BTFSC STATUS+0, 0 GOTO L_main15 ;Remote Controlled motor.c,79 :: if (PORTB.F0 == 0) command|= (1<<( 5 - j));//Set bit (11-j) BTFSC PORTB+0, 0 GOTO L_main17 MOVF _j+0, 0 SUBLW 5 MOVWF R0+0 MOVF R0+0, 0 MOVWF R1+0 MOVLW 1 MOVWF R0+0 MOVF R1+0, 0 L__main31: BTFSC STATUS+0, 2 GOTO L__main32 RLF R0+0, 1 BCF R0+0, 0 ADDLW 255 GOTO L__main31 L__main32: MOVF R0+0, 0 IORWF _command+0, 1 GOTO L_main18 L_main17: ;Remote Controlled motor.c,80 :: else command&=~(1<<(5 - j)); //Clear bit (11-j) MOVF _j+0, 0 SUBLW 5 MOVWF R0+0 MOVF R0+0, 0 MOVWF R1+0 MOVLW 1 MOVWF R0+0 MOVF R1+0, 0 L__main33: BTFSC STATUS+0, 2 GOTO L__main34 RLF R0+0, 1 BCF R0+0, 0 ADDLW 255 GOTO L__main33 L__main34: COMF R0+0, 1 MOVF R0+0, 0 ANDWF _command+0, 1 L_main18: ;Remote Controlled motor.c,81 :: delay_us(1778); MOVLW 7 MOVWF R12+0 MOVLW 236 MOVWF R13+0 L_main19: DECFSZ R13+0, 1 GOTO L_main19 DECFSZ R12+0, 1 GOTO L_main19 NOP ;Remote Controlled motor.c,77 :: for(j = 0; j < 6; j++) INCF _j+0, 1 ;Remote Controlled motor.c,82 :: } GOTO L_main14 L_main15: ;Remote Controlled motor.c,83 :: if (command == 12) { MOVF _command+0, 0 XORLW 12 BTFSS STATUS+0, 2 GOTO L_main20 ;Remote Controlled motor.c,84 :: PORTC = 0; CLRF PORTC+0 ;Remote Controlled motor.c,85 :: PWM1_Stop(); CALL _PWM1_Stop+0 ;Remote Controlled motor.c,86 :: Lcd_Cmd(_LCD_CLEAR); MOVLW 1 MOVWF FARG_Lcd_Cmd_out_char+0 CALL _Lcd_Cmd+0 ;Remote Controlled motor.c,87 :: text = "Motor is OFF" ; MOVLW ?lstr7_Remote_32Controlled_32motor+0 MOVWF _text+0 ;Remote Controlled motor.c,88 :: Lcd_Out(1, 3, text); MOVLW 1 MOVWF FARG_Lcd_Out_row+0 MOVLW 3 MOVWF FARG_Lcd_Out_column+0 MOVF _text+0, 0 MOVWF FARG_Lcd_Out_text+0 CALL _Lcd_Out+0 ;Remote Controlled motor.c,89 :: goto ret; } GOTO ___main_ret L_main20: ;Remote Controlled motor.c,90 :: if (command == 16){ dr = 1; MOVF _command+0, 0 XORLW 16 BTFSS STATUS+0, 2 GOTO L_main21 BSF _dr+0, BitPos(_dr+0) ;Remote Controlled motor.c,91 :: display_results(); CALL _display_results+0 ;Remote Controlled motor.c,92 :: PORTC = 1; MOVLW 1 MOVWF PORTC+0 ;Remote Controlled motor.c,93 :: PWM1_Start(); CALL _PWM1_Start+0 ;Remote Controlled motor.c,94 :: goto ret; } GOTO ___main_ret L_main21: ;Remote Controlled motor.c,95 :: if (command == 17){ dr = 0; MOVF _command+0, 0 XORLW 17 BTFSS STATUS+0, 2 GOTO L_main22 BCF _dr+0, BitPos(_dr+0) ;Remote Controlled motor.c,96 :: display_results(); CALL _display_results+0 ;Remote Controlled motor.c,97 :: PORTC = 2; MOVLW 2 MOVWF PORTC+0 ;Remote Controlled motor.c,98 :: PWM1_Start(); CALL _PWM1_Start+0 ;Remote Controlled motor.c,99 :: goto ret; } GOTO ___main_ret L_main22: ;Remote Controlled motor.c,100 :: if (command == 32){ i++; MOVF _command+0, 0 XORLW 32 BTFSS STATUS+0, 2 GOTO L_main23 INCF _i+0, 1 ;Remote Controlled motor.c,101 :: if(i > 100) i = 100;} MOVLW 128 XORLW 100 MOVWF R0+0 MOVLW 128 XORWF _i+0, 0 SUBWF R0+0, 0 BTFSC STATUS+0, 0 GOTO L_main24 MOVLW 100 MOVWF _i+0 L_main24: L_main23: ;Remote Controlled motor.c,102 :: if (command == 33) {i--; MOVF _command+0, 0 XORLW 33 BTFSS STATUS+0, 2 GOTO L_main25 DECF _i+0, 1 ;Remote Controlled motor.c,103 :: if(i < 1) i = 0;} MOVLW 128 XORWF _i+0, 0 MOVWF R0+0 MOVLW 128 XORLW 1 SUBWF R0+0, 0 BTFSC STATUS+0, 0 GOTO L_main26 CLRF _i+0 L_main26: L_main25: ;Remote Controlled motor.c,104 :: PWM1_Set_Duty(i * 255 / 100); MOVF _i+0, 0 MOVWF R0+0 MOVLW 0 BTFSC R0+0, 7 MOVLW 255 MOVWF R0+1 MOVLW 255 MOVWF R4+0 CLRF R4+1 CALL _Mul_16X16_U+0 MOVLW 100 MOVWF R4+0 MOVLW 0 MOVWF R4+1 CALL _Div_16x16_S+0 MOVF R0+0, 0 MOVWF FARG_PWM1_Set_Duty_new_duty+0 CALL _PWM1_Set_Duty+0 ;Remote Controlled motor.c,105 :: PWM1_Start(); CALL _PWM1_Start+0 ;Remote Controlled motor.c,106 :: display_results(); CALL _display_results+0 ;Remote Controlled motor.c,107 :: } GOTO L_main9 ;Remote Controlled motor.c,108 :: } L_end_main: GOTO $+0 ; end of _main
; A025991: Expansion of 1/((1-2x)(1-5x)(1-6x)(1-12x)). ; Submitted by Jon Maiga ; 1,25,417,5909,77369,972381,11958289,145367893,1756276137,21149737037,254259660161,3053974195077,36665246878105,440090336260093,5281738449973233,63384838751399861,760642183440232073 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,16295 ; Expansion of 1/((1-2x)(1-5x)(1-6x)). mul $1,12 add $1,$0 lpe mov $0,$1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Microsoft Research Singularity ;;; ;;; Copyright (c) Microsoft Corporation. All rights reserved. ;;; ;;; This file contains ARM-specific assembly code. ;;; ; Unsigned divide of r1 by r0: returns quotient in r0, remainder in r1 ; Destroys a3, a4 OPT 2 ; disable listing INCLUDE kxarm.inc OPT 1 ; reenable listing IMPORT __rt_div0 IF Thumbing AREA |.text|, CODE, READONLY, THUMB ELSE AREA |.text|, CODE, READONLY ENDIF EXPORT |__rt_udiv| [FUNC] |__rt_udiv| IF Thumbing ; Switch from Thumb mode to ARM mode DCW 0x4778 ; bx pc DCW 0x46C0 ; nop ENDIF MOV a4, #0 MOVS a3, r0 BEQ DivideByZero while CMP a3, r1, LSR #8 MOVLS a3, a3, LSL #8 BLO while CMP a3, r1, LSR #1 BHI goto7 CMP a3, r1, LSR #2 BHI goto6 CMP a3, r1, LSR #3 BHI goto5 CMP a3, r1, LSR #4 BHI goto4 CMP a3, r1, LSR #5 BHI goto3 CMP a3, r1, LSR #6 BHI goto2 CMP a3, r1, LSR #7 BHI goto1 loop MOVHI a3, a3, LSR #8 CMP r1, a3, LSL #7 ADC a4, a4, a4 SUBCS r1, r1, a3, LSL #7 CMP r1, a3, LSL #6 goto1 ADC a4, a4, a4 SUBCS r1, r1, a3, LSL #6 CMP r1, a3, LSL #5 goto2 ADC a4, a4, a4 SUBCS r1, r1, a3, LSL #5 CMP r1, a3, LSL #4 goto3 ADC a4, a4, a4 SUBCS r1, r1, a3, LSL #4 CMP r1, a3, LSL #3 goto4 ADC a4, a4, a4 SUBCS r1, r1, a3, LSL #3 CMP r1, a3, LSL #2 goto5 ADC a4, a4, a4 SUBCS r1, r1, a3, LSL #2 CMP r1, a3, LSL #1 goto6 ADC a4, a4, a4 SUBCS r1, r1, a3, LSL #1 goto7 CMP r1, a3 ADC a4, a4, a4 SUBCS r1, r1, a3 CMP a3, r0 BNE loop MOV r0, a4 end IF Interworking :LOR: Thumbing BX lr ELSE MOV pc, lr ENDIF ; ; Divide by zero has occurred. Raise an exception ; call RaiseException(STATUS_INTEGER_DIVIDE_BY_ZERO, 0, 0, NULL) ; DivideByZero ldr r12, =__rt_div0 ldr r0, =0xC0000094 mov r1, #0 mov r2, #0 mov r3, #0 IF Thumbing bx r12 ELSE mov pc, r12 ENDIF END