Dataset Viewer
Auto-converted to Parquet
text
stringlengths
1
1.05M
ASAM1 AMODE 31 ASAM1 CSECT USING ASAM1,R15 * ************************************************* * SAMPLE PROGRAM ASAM1 * AUTHOR: DOUG STOUT * IBM CORPORATION * * A SIMPLE PROGRAM THAT: * - READS A QSAM FILE * - WRITES THE FIRST 80 BYTES OF EACH RECORD TO AN OUTPUT FILE * IN CHARACTER AND HEX * * PARAMETERS PASSED FROM CALLING PROGRAM: * NONE * * FILES: * 1. INPUT FILE IS QSAM AND HAS DD NAME = FILEIN * LRECL = 80 * 2. OUTPUT FILE IS QSAM OR SYSPRINT AND HAS DD NAME = FILEOUT * LRECL = 80 * ************************************************************ * AT ENTRY, R13 = REGISTER SAVE AREA * R14 = RETURN ADDR * R15 = ADDR OF THIS PROGRAM START STM R14,R12,12(R13) SAVE REGISTERS IN PASSED SAVE AREA DROP R15 NO LONGER NEEDED AS BASE REGISTER LR R12,R15 USE R12 AS THE BASE REGISTER USING ASAM1,R12 " LA R14,SAVEAREA R14 = ADDR OF NEW SAVE AREA ST R13,4(R14) STORE PREVIOUS SAVE AREA ADDR ST R14,8(R13) STORE NEW SAVE AREA ADDRESS LR R13,R14 R13 = ADDR OF NEW SAVE AREA B MAINLINE DS 0H DC CL32'******** PROGRAM ASAM1 *********' MAINLINE BAL R11,OPENFILS BAL R11,MAINLOOP BAL R11,CLOSFILS * MVC STATUS,=C'RETURNING TO CALLING PROGRAM ' * RETURN00 L R15,RETCODE L R13,4(R13) R13 = ADDR OF PREVIOUS SAVE AREA ST R15,16(R13) SAVE RETURN CODE LM R14,R12,12(R13) RESTORE REGISTERS (EXCEPT 13) BR R14 RETURN TO CALLER ******************************************* * PROCEDURE MAINLOOP * MAINLOOP ST R11,MAINLSAV SAVE RETURN ADDRESS * * READ INPUT RECORD MAINLTOP BAL R11,READIN * * CHECK FOR END-OF-FILE CLC EOFFLAG,=X'FF' END OF FILE? BE MAINLEX IF YES - EXIT MAIN LOOP * * CALL SUBPROGRAM TO GET HEX CHARACTERS MVC STATUS,=C'CALLING SUBPROGRAM ASAM2 ' LA R13,SAVEAREA **** LINK EP=ASAM2,(DATALEN,INREC,HEXTOP,HEXBOT),VL=1 * FOLLOWING LINES COMMENTED OUT WHEN LOAD CHANGED TO STATIC CALL ***** LOAD EP=ASAM2 ***** LTR R15,R15 ***** BNZ LOADERR ***** LA R13,SAVEAREA ***** LA R1,PARMLIST R1 = PARM LIST ***** LR R15,R0 R0 = ADD OF LOADED PROGRAM ***** BALR R14,R15 BRANCH TO SUBPROGRAM CALL ASAM2,(DATALEN,INREC,HEXTOP,HEXBOT),VL * * WRITE LINE: 'RECORD NUMBER NNNNNN' UNPK DIAGRECT,RECCOUNT FORMAT RECORD COUNT OI DIAGRECT+9,X'F0' MVC DIAGREC,OUTLINE1 REC NUM LINE BAL R11,WRITEOUT * * WRITE RULE LINES ....5...10...15...20... MVC DIAGREC,OUTLINE2 BAL R11,WRITEOUT MVC DIAGREC,OUTLINE3 BAL R11,WRITEOUT * * WRITE DATA LINE 1: (CHARACTER FORMAT) MVC DIAGREC,INREC BAL R11,WRITEOUT * * WRITE DATA LINE 2: (TOP HEX LINE) MVC DIAGREC,HEXTOP BAL R11,WRITEOUT * * WRITE DATA LINE 3: (BOTTOM HEX LINE) MVC DIAGREC,HEXBOT BAL R11,WRITEOUT * * WRITE BLANK LINE MVC DIAGREC,BLANKS BAL R11,WRITEOUT * * GO BACK TO TOP OF LOOP B MAINLTOP * LOADERR WTO '* ASAM1: ERROR LOADING PROGRAM ASAM2 ' MVI EOFFLAG,X'FF' MAINLEX L R11,MAINLSAV BR R11 RETURN TO MAINLINE LOGIC * ******************************************* * PROCEDURE OPENFILS * OPENFILS ST R11,OPENFSAV MVC STATUS,=C'IN OPENFILS SUBROUTINE ' SLR R15,R15 SET DEFAULT RETURN CODE TO ZERO OPEN (FILEOUT,OUTPUT) OPEN DDNAME LTR R15,R15 OPEN RC = 0 ? BNZ BADOPENI IF NO - THEN ERROR OPEN (FILEIN,INPUT) OPEN DDNAME LTR R15,R15 OPEN RC = 0 ? BNZ BADOPENI IF NO - THEN ERROR L R11,OPENFSAV BR R11 RETURN TO MAINLINE LOGIC BADOPENI WTO '* ASAM1: ERROR OPENING INPUT FILE ' ST R15,RETCODE B RETURN00 BADOPENO WTO '* ASAM1: ERROR OPENING OUTPUT FILE ' ST R15,RETCODE B RETURN00 ******************************************* * PROCEDURE CLOSFILS * CLOSFILS ST R11,CLOSFSAV SAVE RETURN ADDRESS MVC STATUS,=C'IN CLOSFILS PROCEDURE ' CLOSE FILEOUT CLOSE FILEIN L R11,CLOSFSAV BR R11 RETURN ******************************************* * PROCEDURE READIN * READIN ST R11,READISAV MVC STATUS,=C'IN READIN PROCEDURE ' SLR R15,R15 SET DEFAULT RETURN CODE TO ZERO GET FILEIN,INREC READ INPUT RECORD AP RECCOUNT,=PL1'1' INCREMENT RECORD COUNTER B READIEX READIEOF MVI EOFFLAG,X'FF' READIEX L R11,READISAV BR R11 * ******************************************* * PROCEDURE WRITEOUT * WRITEOUT ST R11,WRITOSAV MVC STATUS,=C'IN WRITEOUT PROCEDURE ' PUT FILEOUT,DIAGREC WRITE OUTPUT RECORD L R11,WRITOSAV BR R11 ******************************************************** * STORAGE AREAS * EYECATCH DC CL32'*** PROGRAM ASAM1 DATA AREAS ***' FILECC DC H'0' MAX RETURN CODE FROM FILE OPENS RECCOUNT DC PL4'0' INPUT RECORD COUNT PROCCNT DC PL4'0' PROCEDURE COUNT STATUS DC CL30' ' CURRENT PROGRAM STATUS EOFFLAG DC XL1'00' END OF INPUT FILE FLAG DATALEN DC F'80' LENGTH OF DATA PASSED TO SUBPGM INREC DC CL80' ' INPUT RECORD DIAGREC DC CL80' ' OUTPUT RECORD HEXTOP DC CL80' ' TOP ROW OF HEX DATA HEXBOT DC CL80' ' BOTTOM ROW OF HEX DATA RETCODE DC F'0' DEFAULT RETURN CODE IS ZERO MAINLSAV DC F'0' OPENFSAV DC F'0' CLOSFSAV DC F'0' READISAV DC F'0' WRITOSAV DC F'0' * * PARAMETER LIST FOR SUBPGM ASAM2 PARMLIST EQU * DC AL4(DATALEN) DC AL4(INREC) DC AL4(HEXTOP) DC AL4(HEXBOT) SET HIGH ORDER BIT ON * TO FLAG END OF PARM LIST OUTLINE1 DS 0CL80 DC CL14'RECORD NUMBER ' DIAGRECT DC CL10' ' DC 56C' ' * OUTLINE2 DS 0CL80 DC CL40'....0....1....1....2....2....3....3....4' DC CL40'....4....5....5....6....6....7....7....8' * OUTLINE3 DS 0CL80 DC CL40'....5....0....5....0....5....0....5....0' DC CL40'....5....0....5....0....5....0....5....0' * BLANKS DC 80C' ' * * LTORG SAVEAREA DC 18F'0' ******************************************************** * FILE DEFINITIONS * FILEOUT DCB DSORG=PS,RECFM=FB,MACRF=(PM),LRECL=80, X DDNAME=FILEOUT FILEIN DCB DSORG=PS,RECFM=FB,MACRF=(GM),LRECL=80, X DDNAME=FILEIN,EODAD=READIEOF * * REGISTER EQUATES * R0 EQU 0 R1 EQU 1 R2 EQU 2 R3 EQU 3 R4 EQU 4 R5 EQU 5 R6 EQU 6 R7 EQU 7 R8 EQU 8 R9 EQU 9 R10 EQU 10 R11 EQU 11 R12 EQU 12 R13 EQU 13 R14 EQU 14 R15 EQU 15 * END
############################################################################### # Copyright 2018 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### .text .p2align 4, 0x90 .globl _y8_EncryptStreamCTR32_AES_NI _y8_EncryptStreamCTR32_AES_NI: push %rbx sub $(128), %rsp movdqu (%r9), %xmm0 movslq %r8d, %r8 lea (15)(%r8), %r11 shr $(4), %r11 movq (8)(%r9), %rax movq (%r9), %rbx bswap %rax bswap %rbx mov %eax, %r10d add %r11, %rax adc $(0), %rbx bswap %rax bswap %rbx movq %rax, (8)(%r9) movq %rbx, (%r9) movl (12)(%rcx), %r11d pxor (%rcx), %xmm0 add $(16), %rcx movdqa %xmm0, (%rsp) movdqa %xmm0, (16)(%rsp) movdqa %xmm0, (32)(%rsp) movdqa %xmm0, (48)(%rsp) movdqa %xmm0, (64)(%rsp) movdqa %xmm0, (80)(%rsp) movdqa %xmm0, (96)(%rsp) movdqa %xmm0, (112)(%rsp) mov %rsp, %r9 cmp $(16), %r8 jle .Lshort123_inputgas_1 movdqa %xmm0, %xmm1 movdqa %xmm0, %xmm2 movdqa %xmm0, %xmm3 lea (1)(%r10d), %ebx lea (2)(%r10d), %eax lea (3)(%r10d), %r9d bswap %ebx bswap %eax bswap %r9d xor %r11d, %ebx pinsrd $(3), %ebx, %xmm1 xor %r11d, %eax pinsrd $(3), %eax, %xmm2 xor %r11d, %r9d pinsrd $(3), %r9d, %xmm3 movdqa %xmm1, (16)(%rsp) movdqa %xmm2, (32)(%rsp) movdqa %xmm3, (48)(%rsp) mov %rsp, %r9 movdqa (%rcx), %xmm4 movdqa (16)(%rcx), %xmm5 cmp $(64), %r8 jl .Lshort123_inputgas_1 jz .Lshort_inputgas_1 lea (4)(%r10d), %eax lea (5)(%r10d), %ebx bswap %eax bswap %ebx xor %r11d, %ebx xor %r11d, %eax movl %eax, (76)(%rsp) movl %ebx, (92)(%rsp) lea (6)(%r10d), %eax lea (7)(%r10d), %ebx bswap %eax bswap %ebx xor %r11d, %eax xor %r11d, %ebx movl %eax, (108)(%rsp) movl %ebx, (124)(%rsp) cmp $(128), %r8 jl .Lshort_inputgas_1 sub $(64), %rsp movdqa %xmm10, (%rsp) movdqa %xmm11, (16)(%rsp) movdqa %xmm12, (32)(%rsp) movdqa %xmm13, (48)(%rsp) push %rcx push %rdx sub $(128), %r8 .p2align 4, 0x90 .Lblk8_loopgas_1: add $(32), %rcx add $(8), %r10d sub $(4), %rdx movdqa (64)(%r9), %xmm6 movdqa (80)(%r9), %xmm7 movdqa (96)(%r9), %xmm8 movdqa (112)(%r9), %xmm9 mov %r10d, %eax aesenc %xmm4, %xmm0 lea (1)(%r10d), %ebx aesenc %xmm4, %xmm1 bswap %eax aesenc %xmm4, %xmm2 bswap %ebx aesenc %xmm4, %xmm3 xor %r11d, %eax aesenc %xmm4, %xmm6 xor %r11d, %ebx aesenc %xmm4, %xmm7 movl %eax, (12)(%r9) aesenc %xmm4, %xmm8 movl %ebx, (28)(%r9) aesenc %xmm4, %xmm9 movdqa (%rcx), %xmm4 lea (2)(%r10d), %eax aesenc %xmm5, %xmm0 lea (3)(%r10d), %ebx aesenc %xmm5, %xmm1 bswap %eax aesenc %xmm5, %xmm2 bswap %ebx aesenc %xmm5, %xmm3 xor %r11d, %eax aesenc %xmm5, %xmm6 xor %r11d, %ebx aesenc %xmm5, %xmm7 movl %eax, (44)(%r9) aesenc %xmm5, %xmm8 movl %ebx, (60)(%r9) aesenc %xmm5, %xmm9 movdqa (16)(%rcx), %xmm5 .p2align 4, 0x90 .Lcipher_loopgas_1: add $(32), %rcx sub $(2), %rdx aesenc %xmm4, %xmm0 aesenc %xmm4, %xmm1 aesenc %xmm4, %xmm2 aesenc %xmm4, %xmm3 aesenc %xmm4, %xmm6 aesenc %xmm4, %xmm7 aesenc %xmm4, %xmm8 aesenc %xmm4, %xmm9 movdqa (%rcx), %xmm4 aesenc %xmm5, %xmm0 aesenc %xmm5, %xmm1 aesenc %xmm5, %xmm2 aesenc %xmm5, %xmm3 aesenc %xmm5, %xmm6 aesenc %xmm5, %xmm7 aesenc %xmm5, %xmm8 aesenc %xmm5, %xmm9 movdqa (16)(%rcx), %xmm5 jnz .Lcipher_loopgas_1 lea (4)(%r10d), %eax aesenc %xmm4, %xmm0 lea (5)(%r10d), %ebx aesenc %xmm4, %xmm1 bswap %eax aesenc %xmm4, %xmm2 bswap %ebx aesenc %xmm4, %xmm3 xor %r11d, %eax aesenc %xmm4, %xmm6 xor %r11d, %ebx aesenc %xmm4, %xmm7 movl %eax, (76)(%r9) aesenc %xmm4, %xmm8 movl %ebx, (92)(%r9) aesenc %xmm4, %xmm9 lea (6)(%r10d), %eax aesenclast %xmm5, %xmm0 lea (7)(%r10d), %ebx aesenclast %xmm5, %xmm1 bswap %eax aesenclast %xmm5, %xmm2 bswap %ebx aesenclast %xmm5, %xmm3 xor %r11d, %eax aesenclast %xmm5, %xmm6 xor %r11d, %ebx aesenclast %xmm5, %xmm7 movl %eax, (108)(%r9) aesenclast %xmm5, %xmm8 movl %ebx, (124)(%r9) aesenclast %xmm5, %xmm9 movdqu (%rdi), %xmm10 movdqu (16)(%rdi), %xmm11 movdqu (32)(%rdi), %xmm12 movdqu (48)(%rdi), %xmm13 pxor %xmm10, %xmm0 pxor %xmm11, %xmm1 pxor %xmm12, %xmm2 pxor %xmm13, %xmm3 movdqu %xmm0, (%rsi) movdqu %xmm1, (16)(%rsi) movdqu %xmm2, (32)(%rsi) movdqu %xmm3, (48)(%rsi) movdqu (64)(%rdi), %xmm10 movdqu (80)(%rdi), %xmm11 movdqu (96)(%rdi), %xmm12 movdqu (112)(%rdi), %xmm13 pxor %xmm10, %xmm6 pxor %xmm11, %xmm7 pxor %xmm12, %xmm8 pxor %xmm13, %xmm9 movdqu %xmm6, (64)(%rsi) movdqu %xmm7, (80)(%rsi) movdqu %xmm8, (96)(%rsi) movdqu %xmm9, (112)(%rsi) movq (8)(%rsp), %rcx movq (%rsp), %rdx movdqa (%r9), %xmm0 movdqa (16)(%r9), %xmm1 movdqa (32)(%r9), %xmm2 movdqa (48)(%r9), %xmm3 movdqa (%rcx), %xmm4 movdqa (16)(%rcx), %xmm5 add $(128), %rdi add $(128), %rsi sub $(128), %r8 jge .Lblk8_loopgas_1 pop %rdx pop %rcx movdqa (%rsp), %xmm10 movdqa (16)(%rsp), %xmm11 movdqa (32)(%rsp), %xmm12 movdqa (48)(%rsp), %xmm13 add $(64), %rsp add $(128), %r8 jz .Lquitgas_1 .p2align 4, 0x90 .Lshort_inputgas_1: cmp $(64), %r8 jl .Lshort123_inputgas_1 mov %rcx, %rbx lea (-2)(%rdx), %r10 .p2align 4, 0x90 .Lcipher_loop4gas_1: add $(32), %rbx sub $(2), %r10 aesenc %xmm4, %xmm0 aesenc %xmm4, %xmm1 aesenc %xmm4, %xmm2 aesenc %xmm4, %xmm3 movdqa (%rbx), %xmm4 aesenc %xmm5, %xmm0 aesenc %xmm5, %xmm1 aesenc %xmm5, %xmm2 aesenc %xmm5, %xmm3 movdqa (16)(%rbx), %xmm5 jnz .Lcipher_loop4gas_1 movdqu (%rdi), %xmm6 movdqu (16)(%rdi), %xmm7 movdqu (32)(%rdi), %xmm8 movdqu (48)(%rdi), %xmm9 add $(64), %rdi aesenc %xmm4, %xmm0 aesenc %xmm4, %xmm1 aesenc %xmm4, %xmm2 aesenc %xmm4, %xmm3 aesenclast %xmm5, %xmm0 aesenclast %xmm5, %xmm1 aesenclast %xmm5, %xmm2 aesenclast %xmm5, %xmm3 pxor %xmm6, %xmm0 movdqu %xmm0, (%rsi) pxor %xmm7, %xmm1 movdqu %xmm1, (16)(%rsi) pxor %xmm8, %xmm2 movdqu %xmm2, (32)(%rsi) pxor %xmm9, %xmm3 movdqu %xmm3, (48)(%rsi) add $(64), %rsi add $(64), %r9 sub $(64), %r8 jz .Lquitgas_1 .Lshort123_inputgas_1: lea (,%rdx,4), %rbx lea (-160)(%rcx,%rbx,4), %rbx .Lsingle_blkgas_1: movdqa (%r9), %xmm0 add $(16), %r9 cmp $(12), %rdx jl .Lkey_128_sgas_1 jz .Lkey_192_sgas_1 .Lkey_256_sgas_1: aesenc (-64)(%rbx), %xmm0 aesenc (-48)(%rbx), %xmm0 .Lkey_192_sgas_1: aesenc (-32)(%rbx), %xmm0 aesenc (-16)(%rbx), %xmm0 .Lkey_128_sgas_1: aesenc (%rbx), %xmm0 aesenc (16)(%rbx), %xmm0 aesenc (32)(%rbx), %xmm0 aesenc (48)(%rbx), %xmm0 aesenc (64)(%rbx), %xmm0 aesenc (80)(%rbx), %xmm0 aesenc (96)(%rbx), %xmm0 aesenc (112)(%rbx), %xmm0 aesenc (128)(%rbx), %xmm0 aesenclast (144)(%rbx), %xmm0 cmp $(16), %r8 jl .Lpartial_blockgas_1 movdqu (%rdi), %xmm1 add $(16), %rdi pxor %xmm1, %xmm0 movdqu %xmm0, (%rsi) add $(16), %rsi sub $(16), %r8 jz .Lquitgas_1 jmp .Lsingle_blkgas_1 .Lpartial_blockgas_1: pextrb $(0), %xmm0, %eax psrldq $(1), %xmm0 movzbl (%rdi), %edx inc %rdi xor %rdx, %rax movb %al, (%rsi) inc %rsi dec %r8 jnz .Lpartial_blockgas_1 .Lquitgas_1: pxor %xmm4, %xmm4 pxor %xmm5, %xmm5 add $(128), %rsp pop %rbx ret
/* * (C) Copyright 1996-2012 ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. * In applying this licence, ECMWF does not waive the privileges and immunities * granted to it by virtue of its status as an intergovernmental organisation nor * does it submit to any jurisdiction. */ #include "eckit/exception/Exceptions.h" #include "eckit/filesystem/PathName.h" #include "eckit/log/Log.h" #include "odc/Comparator.h" #include "odc/Reader.h" #include "odc/Writer.h" #include "odc/tools/CompactTool.h" using namespace std; using namespace eckit; namespace odc { namespace tool { CompactTool::CompactTool (int argc, char *argv[]) : Tool(argc, argv) { } void CompactTool::run() { if (parameters().size() != 3) { Log::error() << "Usage: "; usage(parameters(0), Log::error()); Log::error() << std::endl; std::stringstream ss; ss << "Expected exactly 3 command line parameters"; throw UserError(ss.str()); } PathName inFile = parameters(1); PathName outFile = parameters(2); odc::Reader in(inFile); odc::Writer<> out(outFile); odc::Reader::iterator it(in.begin()); odc::Reader::iterator end(in.end()); odc::Writer<>::iterator writer(out.begin()); writer->pass1(it, end); odc::Reader outReader(outFile); Log::info() << "Verifying." << std::endl; odc::Reader::iterator it1 = in.begin(); odc::Reader::iterator end1 = in.end(); odc::Reader::iterator it2 = outReader.begin(); odc::Reader::iterator end2 = outReader.end(); odc::Comparator comparator; comparator.compare(it1, end1, it2, end2, inFile, outFile); } } // namespace tool } // namespace odc
db 0 ; species ID placeholder db 90, 30, 15, 15, 40, 20 ; hp atk def spd sat sdf db NORMAL, NORMAL ; type db 170 ; catch rate db 39 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F75 ; gender ratio db 100 ; unknown 1 db 10 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/igglybuff/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_FAST ; growth rate dn EGG_NONE, EGG_NONE ; egg groups ; tm/hm learnset tmhm HEADBUTT, CURSE, ROLLOUT, TOXIC, ZAP_CANNON, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, SOLARBEAM, RETURN, PSYCHIC_M, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, FIRE_BLAST, DEFENSE_CURL, DREAM_EATER, DETECT, REST, ATTRACT, NIGHTMARE, FLASH, FLAMETHROWER ; end
start START 0 JSUB stackinit .stack initialized LDA #100 rp COMP #0 SUB #1 STA @stackptr JSUB stackpush JEQ hlt LDA #20 JSUB sie LDA c LDS #400 MULR S, A LDS #1000 ADDR S, A CLEAR S ADDR A, S DIV #4095 MUL #4095 SUBR A, S CLEAR A ADDR S, A CLEAR S STA c CLEAR A CLEAR S CLEAR X CLEAR T LDA @stackptr JSUB stackpop J rp hlt J hlt sie STL @stackptr JSUB stackpush STA @stackptr JSUB stackpush CLEAR A CLEAR S CLEAR T CLEAR X .----SIERPINSKI GASKET beg JSUB stackpop LDA @stackptr COMP #0 SUB #1 STA @stackptr JSUB stackpush JEQ fin .Now lets randomly select one of the .three triangle vertices CLEAR A CLEAR S LDA seed LDS a MULR S, A LDS c ADDR S, A CLEAR S ADDR A, S DIV #4095 MUL #4095 SUBR A, S CLEAR A ADDR S, A CLEAR S STA seed .Now that we have the random number .we check which vertex was selected COMP #1365 JGT two LDX #100 LDT #0 JSUB cal J rep two COMP #2730 JGT thr LDX #0 LDT #200 JSUB cal J rep thr LDX #200 LDT #200 JSUB cal rep CLEAR T CLEAR X .finally we draw the pixel LDA sty LDS stx SUB #1 MUL #200 ADDR A, S LDA screen STA @stackptr JSUB stackpush ADDR S, A STA screen LDA #255 STCH @screen JSUB stackpop LDA @stackptr STA screen CLEAR A CLEAR S J beg .----SIERPINSKI GASKET fin JSUB stackpop JSUB stackpop LDL @stackptr RSUB cal STL @stackptr JSUB stackpush .Calculating x coordinate LDA stx LDS stx SUBR X, A DIV #2 SUBR A, S STS stx LDA sty LDS sty SUBR T, A DIV #2 SUBR A, S STS sty JSUB stackpop LDL @stackptr RSUB stackinit LDA #stck STA stackptr RSUB stackpush STA help LDA stackptr ADD #3 STA stackptr LDA help RSUB stackpop STA help LDA stackptr SUB #3 STA stackptr LDA help RSUB .triangle data stx WORD 100 sty WORD 100 seed WORD 1 a WORD 400 c WORD 1000 m WORD 4095 .STACK DATA .data stackptr RESW 1 stck RESW 60 .a small helpful buffer help WORD 0 .SCREEN ADDRESS screen WORD X'00A000'
; A233820: Period 4: repeat [20, 5, 15, 10]. ; 20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5,15,10,20,5 mov $3,$0 add $0,7 mod $0,2 mov $1,$0 add $1,$0 mov $2,$3 sub $3,$3 add $3,$2 add $3,289 div $3,2 mov $4,$3 gcd $4,2 add $1,$4 mul $1,5
#include "CapacityLinkItem.hpp" #include <graph_analysis/gui/GraphWidget.hpp> #include <graph_analysis/WeightedEdge.hpp> #include <base-logging/Logging.hpp> #include <cmath> #include <iostream> #include <iomanip> #include <QSettings> #include <QFileDialog> #include <QCoreApplication> #include <QtCore/qmath.h> #include <QDebug> #include <moreorg/OrganizationModel.hpp> #include <moreorg/OrganizationModelAsk.hpp> #include <moreorg/ModelPool.hpp> #include "../TemplGui.hpp" #include "../../SpaceTime.hpp" using namespace graph_analysis::gui; namespace templ { namespace gui { namespace edge_items { // kiss: CapacityLinkItem::CapacityLinkItem(graph_analysis::gui::GraphWidget* graphWidget, const graph_analysis::Edge::Ptr& edge, QGraphicsItem* parent) : EdgeItemBase(graphWidget, edge, parent) , mArrowSize(10) , mMarkedAsInvalid(false) { QPen pen(Qt::black); pen.setWidth(3.0); mpFillBar = new QGraphicsRectItem(getEdgePath()->pos().x()-10, getEdgePath()->pos().y()+125, 10, 100, this); mpFillBar->setPen( pen ); mpFillBar->setBrush(QBrush(Qt::white)); double consumptionInPercent = 0; CapacityLink::Ptr capacityLink = dynamic_pointer_cast<CapacityLink>( getEdge() ); if(capacityLink) { consumptionInPercent = capacityLink->getConsumptionLevel(); } RoleInfoWeightedEdge::Ptr weightedEdge = dynamic_pointer_cast<RoleInfoWeightedEdge>(getEdge()); if(weightedEdge) { capacityLink = toCapacityLink(weightedEdge); consumptionInPercent = capacityLink->getConsumptionLevel(); std::set<RoleInfo::Tag> tags = { RoleInfo::INFEASIBLE }; Role::Set transitionRoles = weightedEdge->getRoles(tags); if(!transitionRoles.empty()) { mMarkedAsInvalid = true; } } if(capacityLink) { mpFillStatus = new QGraphicsRectItem(getEdgePath()->pos().x()-10, getEdgePath()->pos().y()+125, 10, consumptionInPercent*100, this); mpFillStatus->setPen(pen); mpFillStatus->setBrush(QBrush(Qt::black)); setFlag(ItemIsMovable, false); mpLabel = new QGraphicsTextItem("", this); // Make sure label is drawn on top of any edge that is might overlap with getEdgePath()->stackBefore(mpLabel); mpFillBar->stackBefore(mpLabel); mpFillStatus->stackBefore(mpLabel); } } CapacityLinkItem::~CapacityLinkItem() { delete mpLabel; } int CapacityLinkItem::type() const { return static_cast<int>(graph_analysis::gui::UserType) + 11; } void CapacityLinkItem::adjustEdgePositioning() { /// Allow setting via widget QSettings settings(QCoreApplication::organizationName(),"GUI"); QVariant v = settings.value("editor/edge/pen/default"); QPen pen; if(v == QVariant()) { pen.setColor(Qt::black); pen.setWidth(3.0); pen.setStyle(Qt::SolidLine); } else { pen = v.value<QPen>(); } if(mMarkedAsInvalid) { QVariant v = settings.value("editor/edge/pen/error"); if(v == QVariant()) { pen.setColor(Qt::red); pen.setWidth(3.0); pen.setStyle(Qt::DashLine); } else { pen = v.value<QPen>(); } } prepareGeometryChange(); drawBezierEdge(); drawArrowHead(mArrowSize*qSqrt(pen.width()), pen.brush(), QPen(pen.brush().color())); mpLabel->setPos(mpEdgePath->boundingRect().center() - mpLabel->boundingRect().center()); mpFillBar->setPos(mpLabel->pos().x(), mpLabel->pos().y() - mpFillBar->rect().height()); mpFillStatus->setPos(mpLabel->pos().x(), mpLabel->pos().y() - mpFillStatus->rect().height()); getEdgePath()->setPen(pen); } void CapacityLinkItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { } QRectF CapacityLinkItem::boundingRect() const { return childrenBoundingRect(); } void CapacityLinkItem::hoverEnterEvent(QGraphicsSceneHoverEvent* event) { QString text(""); CapacityLink::Ptr capacityLink = dynamic_pointer_cast<CapacityLink>( getEdge() ); if(capacityLink) { int consumptionInPercent = capacityLink->getConsumptionLevel()*100; text += "Consumed capacity: " + QString::number(consumptionInPercent) + "%\n"; } text += QString(getEdge()->toString().c_str()); mpLabel->setHtml(QString("<div style=\"background-color:#ffffff; white-space: pre;\">") + text + QString("</div>")); } void CapacityLinkItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* event) { mpLabel->setPlainText(""); } EdgeItemBase* CapacityLinkItem::createNewItem(graph_analysis::gui::GraphWidget* graphWidget, const graph_analysis::Edge::Ptr& edge, QGraphicsItem* parent) const { return new CapacityLinkItem(graphWidget, edge, parent); } CapacityLink::Ptr CapacityLinkItem::toCapacityLink(const RoleInfoWeightedEdge::Ptr& roleInfo) { CapacityLink::Ptr capacityLink = make_shared<CapacityLink>(); SpaceTime::Network::tuple_t::Ptr from = dynamic_pointer_cast<SpaceTime::Network::tuple_t>(roleInfo->getSourceVertex()); SpaceTime::Network::tuple_t::Ptr to = dynamic_pointer_cast<SpaceTime::Network::tuple_t>(roleInfo->getTargetVertex()); if(!from || !to) { return capacityLink; } std::set<RoleInfo::Tag> tags = { RoleInfo::ASSIGNED, RoleInfo::AVAILABLE }; Role::Set fromRoles = from->getRoles(tags); Role::Set toRoles = to->getRoles(tags); Role::List transitionRoles = RoleInfo::getIntersection(fromRoles, toRoles); if(from->first() == to->first()) { capacityLink->addProvider( CapacityLink::getLocalTransitionRole(), std::numeric_limits<uint32_t>::max() ); } moreorg::ModelPool pool; for(const Role& r : transitionRoles) { pool[r.getModel()] = 1; } moreorg::OrganizationModel::Ptr om = TemplGui::getOrganizationModel(); moreorg::OrganizationModelAsk ask = moreorg::OrganizationModelAsk::getInstance(om, pool); for(const Role& r : transitionRoles) { using namespace moreorg::facades; Robot robot = Robot::getInstance(r.getModel(), ask); if(robot.isMobile()) { capacityLink->addProvider(r, robot.getTransportCapacity()); } else { capacityLink->addConsumer(r, robot.getTransportDemand()); } } return capacityLink; } } // end namespace edge_items } // end namespace gui } // end namespace templ
; =============================================================== ; Jan 2014 ; =============================================================== ; ; int putc_unlocked(int c, FILE *stream) ; ; Write char to stream. ; ; =============================================================== SECTION code_stdio PUBLIC asm_putc_unlocked EXTERN asm_fputc_unlocked defc asm_putc_unlocked = asm_fputc_unlocked ; enter : ix = FILE * ; e = char c ; ; exit : ix = FILE * ; ; success ; ; hl = char c ; carry reset ; ; fail ; ; hl = -1 ; carry set, errno set ; ; uses : all except ix
PAGE ,132 TITLE PARSE CODE AND CONTROL BLOCKS FOR ANSI.SYS ;****************** START OF SPECIFICATIONS ************************** ; MODULE NAME: PARSER.ASM ; DESCRIPTIVE NAME: PARSES THE DEVICE= STATEMENT IN CONFIG.SYS FOR ; ANSI.SYS ; FUNCTION: THE COMMAND LINE PASSED TO ANSI.SYS IN THE CONFIG.SYS ; STATEMENT IS PARSED TO CHECK FOR THE /X SWITCH. A FLAG ; IS CLEARED IF NOT FOUND. ; ENTRY POINT: PARSE_PARM ; INPUT: DS:SI POINTS TO EVERYTHING AFTER DEVICE= ; AT EXIT: ; NORMAL: SWITCH FLAGS WILL BE SET IF /X or /L IS FOUND ; ERROR: CARRY SET ; INTERNAL REFERENCES: ; ROUTINES: SYSLOADMSG - MESSAGE RETRIEVER LOADING CODE ; SYSDISPMSG - MESSAGE RETRIEVER DISPLAYING CODE ; PARM_ERROR - DISPLAYS ERROR MESSAGE ; SYSPARSE - PARSING CODE ; DATA AREAS: PARMS - PARSE CONTROL BLOCK FOR SYSPARSE ; EXTERNAL REFERENCES: ; ROUTINES: N/A ; DATA AREAS: SWITCH - BYTE FLAG FOR EXISTENCE OF SWITCH PARAMETER ; NOTES: ; REVISION HISTORY: ; A000 - DOS Version 4.00 ; Label: "DOS ANSI.SYS Device Driver" ; "Version 4.00 (C) Copyright 1988 Microsoft" ; "Licensed Material - Program Property of Microsoft" ;****************** END OF SPECIFICATIONS **************************** ;Modification history********************************************************** ; P1529 ANSI /x /y gives wrong error message 10/8/87 J.K. ; D397 /L option for "Enforcing" the line number 12/17/87 J.K. ; D479 An option to disable the extended keyboard functions 02/12/88 J.K. ;****************************************************************************** INCLUDE ANSI.INC ; ANSI equates and structures .XLIST INCLUDE SYSMSG.INC ; Message retriever code MSG_UTILNAME <ANSI> ; Let message retriever know its ANSI.SYS .LIST PUBLIC PARSE_PARM ; near procedure for parsing DEVICE= statement ; Set assemble switches for parse code that is not required!! DateSW EQU 0 TimeSW EQU 0 CmpxSW EQU 0 DrvSW EQU 0 QusSW EQU 0 NumSW EQU 0 KeySW EQU 0 Val1SW EQU 0 Val2SW EQU 0 Val3SW EQU 0 CODE SEGMENT PUBLIC BYTE ASSUME CS:CODE .XLIST MSG_SERVICES <MSGDATA> MSG_SERVICES <DISPLAYmsg,LOADmsg,CHARmsg> MSG_SERVICES <ANSI.CL1> MSG_SERVICES <ANSI.CL2> MSG_SERVICES <ANSI.CLA> INCLUDE VERSION.INC INCLUDE PARSE.ASM ; Parsing code .LIST EXTRN SWITCH_X:BYTE ; /X switch flag extrn Switch_L:Byte ; /L switch flag extrn Switch_K:Byte ; /K switch flag extrn Switch_S:Byte ; M008 ; /S or /SCREENSIZE switch flag ; PARM control blocks for ANSI ; Parsing DEVICE= statment from CONFIG.SYS ; DEVICE=[d:][path]ANSI.SYS [/X] [/K] [/L] [/S | /SCREENSIZE] ; M008 PARMS LABEL WORD DW PARMSX DB 0 ; no extra delimeters or EOLs. PARMSX LABEL BYTE DB 1,1 ; 1 valid positional operand DW FILENAME ; filename DB 1 ; 1 switche definition in the following DW Switches DB 0 ; no keywords FILENAME LABEL WORD DW 0200H ; file spec DW 0001H ; cap by file table DW RESULT_BUF ; result DW NOVALS ; no value checking done DB 0 ; no switch/keyword synonyms Switches LABEL WORD DW 0 ; switch with no value DW 0 ; no functions DW RESULT_BUF ; result DW NOVALS ; no value checking done DB 5 ;AN003; M008; 5 switch synonym X_SWITCH DB "/X",0 ; /X name L_SWITCH DB "/L",0 ; /L K_SWITCH DB "/K",0 ; /K SSIZE_SWITCH DB "/SCREENSIZE",0 ; M008; /SCREENSIZE S_SWITCH DB "/S",0 ; M008; /S NOVALS LABEL BYTE DB 0 ; no value checking done RESULT_BUF LABEL BYTE DB ? ; type returned (number, string, etc.) DB ? ; matched item tag (if applicable) SYNONYM_PTR DW 0 ; synonym ptr (if applicable) DD ? ; value SUBLIST LABEL DWORD ; list for substitution DB SUB_SIZE DB 0 DD ? DB 1 DB LEFT_ASCIIZ DB UNLIMITED DB 1 DB " " Old_SI dw ? Saved_Chr db 0 Continue_Flag db ON Parse_Err_Flag db OFF ; PROCEDURE_NAME: PARSE_PARM ; FUNCTION: ; THIS PROCEDURE PARSES THE DEVICE= PARAMETERS FROM THE INIT REQUEST ; BLOCK. ERROR MESSAGES ARE DISPLAYED ACCORDINGLY. ; AT ENTRY: DS:SI POINTS TO EVERYTHING AFTER THE DEVICE= STATEMENT ; AT EXIT: ; NORMAL: CARRY CLEAR - SWITCH FLAG BYTE SET TO 1 IF /X FOUND ; ERROR: CARRY SET PARSE_PARM PROC NEAR CALL SYSLOADMSG ; load message jnc plab01 CALL SYSDISPMSG ; display error message STC ; ensure carry still set jmp plab02 plab01: PUSH CS ; establish ES .. POP ES ; addressability to data LEA DI,PARMS ; point to PARMS control block XOR CX,CX ; clear both CX and DX for XOR DX,DX ; SYSPARSE CALL SYSPARSE ; move pointer past file spec mov Switch_L, OFF mov Switch_X, OFF while01: cmp Continue_Flag,ON jz plab_bogus ; M008; bogus label to avoid jmp jmp while01_end ; M008; out of short range. plab_bogus: ; M008 mov Old_SI, SI ;to be use by PARM_ERROR call SysParse cmp ax,RC_EOL jnz plab09 mov Continue_Flag, OFF jmp short while01 plab09: cmp ax,RC_NO_ERROR jz plab07 mov Continue_Flag, OFF mov Switch_X, OFF mov Switch_L, OFF mov Switch_K, OFF call Parm_Error mov Parse_Err_Flag,ON jmp short while01 plab07: cmp Synonym_ptr,offset X_SWITCH jnz plab05 mov Switch_X,ON jmp short plab04 plab05: cmp Synonym_ptr,offset L_SWITCH jnz plab03 mov Switch_L,ON jmp short plab04 plab03: ; M008 cmp Synonym_ptr, offset S_SWITCH ; M008 jnz plab11 ; M008 plab12: ; M008 mov Switch_S,ON ; M008 jmp short plab04 ; M008 plab11: ; M008 cmp Synonym_ptr, offset SSIZE_SWITCH; M008 jz plab12 ; M008 mov Switch_K,ON ; must be /K plab04: clc jmp while01 while01_end: cmp Parse_Err_Flag,ON jnz plab10 stc jmp short plab02 plab10: clc plab02: RET PARSE_PARM ENDP ; PROCEDURE_NAME: PARM_ERROR ; FUNCTION: ; LOADS AND DISPLAYS "Invalid parameter" MESSAGE ; AT ENTRY: ; DS:Old_SI -> parms that is invalid ; AT EXIT: ; NORMAL: ERROR MESSAGE DISPLAYED ; ERROR: N/A PARM_ERROR PROC NEAR PUSH CX PUSH SI PUSH ES PUSH DS ; PUSH CS ; POP DS ; establish addressability ; MOV BX,DX ; LES DX,[BX].RES_PTR ; find offending parameter push ds pop es mov si, cs:Old_SI ;Now es:dx -> offending parms push si ;Save it Get_CR: cmp byte ptr es:[si], 13 ;CR? je Got_CR inc si jmp Get_CR Got_CR: inc si ; The next char. mov al, byte ptr es:[si] mov cs:Saved_Chr, al ; Save the next char mov byte ptr es:[si], 0 ; and make it an ASCIIZ mov cs:Old_SI, si ; Set it again pop dx ; saved SI -> DX push cs pop ds ;for addressability LEA SI,SUBLIST ; ..and place the offset.. MOV [SI].SUB_PTR_O,DX ; ..in the SUBLIST.. MOV [SI].SUB_PTR_S,ES MOV AX,INVALID_PARM ; load 'Invalid parameter' message number MOV BX,STDERR ; to standard error MOV CX,ONE ; 1 substitution XOR DL,DL ; no input MOV DH,UTILITY_MSG_CLASS ; parse error CALL SYSDISPMSG ; display error message mov si, cs:Old_SI ;restore the original char. mov cl, cs:Saved_Chr mov byte ptr es:[si], cl POP DS POP ES POP SI POP CX RET PARM_ERROR ENDP include msgdcl.inc CODE ENDS END 
<% from pwnlib.shellcraft.i386.linux import syscall %> <%page args="n, groups"/> <%docstring> Invokes the syscall setgroups. See 'man 2 setgroups' for more information. Arguments: n(size_t): n groups(gid_t): groups </%docstring> ${syscall('SYS_setgroups', n, groups)}
; float log10(float x) SECTION code_fp_math48 PUBLIC cm48_sdccix_log10 EXTERN cm48_sdccix_log10_fastcall cm48_sdccix_log10: pop af pop hl pop de push de push hl push af jp cm48_sdccix_log10_fastcall
; A179805: a(0) = 1, a(1) = 3, a(2) = 6 and a(n) = 2*a(n-1) - a(n-2) for n > 3. ; 1,3,6,15,24,33,42,51,60,69,78,87,96,105,114,123,132,141,150,159,168,177,186,195,204,213,222,231,240,249,258,267,276,285,294,303,312,321,330,339,348,357,366,375,384,393,402,411,420,429,438,447,456,465,474,483,492,501,510,519,528,537,546,555,564,573,582,591,600,609,618,627,636,645,654,663,672,681,690,699,708,717,726,735,744,753,762,771,780,789,798,807,816,825,834,843,852,861,870,879,888,897,906,915,924,933,942,951,960,969,978,987,996,1005,1014,1023,1032,1041,1050,1059,1068,1077,1086,1095,1104,1113,1122,1131,1140,1149,1158,1167,1176,1185,1194,1203,1212,1221,1230,1239,1248,1257,1266,1275,1284,1293,1302,1311,1320,1329,1338,1347,1356,1365,1374,1383,1392,1401,1410,1419,1428,1437,1446,1455,1464,1473,1482,1491,1500,1509,1518,1527,1536,1545,1554,1563,1572,1581,1590,1599,1608,1617,1626,1635,1644,1653,1662,1671,1680,1689,1698,1707,1716,1725,1734,1743,1752,1761,1770,1779,1788,1797,1806,1815,1824,1833,1842,1851,1860,1869,1878,1887,1896,1905,1914,1923,1932,1941,1950,1959,1968,1977,1986,1995,2004,2013,2022,2031,2040,2049,2058,2067,2076,2085,2094,2103,2112,2121,2130,2139,2148,2157,2166,2175,2184,2193,2202,2211,2220,2229 mov $1,1 lpb $0 sub $0,1 mov $1,$2 mul $1,2 trn $1,6 add $2,3 add $1,$2 lpe
#include <ATen/Functions.h> #include <c10/core/MemoryFormat.h> #include "i_gelu_tpp.hpp" namespace intel_mlperf { at::Tensor i_gelu ( const at::Tensor& input, const at::Scalar& M, const at::Scalar& oscale, const at::Scalar& o_off) { auto sizes = input.sizes(); auto batch = sizes[0] * sizes[1]; auto line = sizes[2]; auto output = at::empty(sizes, at::TensorOptions().dtype<int8_t>() .memory_format(c10::MemoryFormat::Contiguous)); auto *in = input.data_ptr(); auto *out = output.data_ptr(); auto off = o_off.toChar(); # pragma omp parallel for for (auto b = 0; b < batch; ++b) { // Move out will cause Apple Clang crash auto pin = reinterpret_cast<int32_t (*)[line]>(in); auto pout = reinterpret_cast<int8_t (*)[line]>(out); i_gelu_tpp<16>::ref(pout[b], pin[b], M.toFloat(), oscale.toFloat(), off, line); } return output; } at::Tensor i_gelu_ ( at::Tensor& self, const at::Scalar& M, const at::Scalar& oscale, const at::Scalar& o_off) { auto sizes = self.sizes(); auto batch = sizes[0] * sizes[1]; auto line = sizes[2]; auto *in = self.data_ptr(); auto *out = in; auto off = o_off.toChar(); # pragma omp parallel for for (auto b = 0; b < batch; ++b) { // Move out will cause Apple Clang crash auto pin = reinterpret_cast<int32_t (*)[line]>(in); auto pout = reinterpret_cast<int8_t (*)[line]>(out); i_gelu_tpp<16>::ref(pout[b], pin[b], M.toFloat(), oscale.toFloat(), off, line); } return self; } at::Tensor i_identity( const at::Tensor& input, const c10::optional<at::Scalar>& M, const at::Scalar& oscale, const at::Scalar& o_off) { auto sizes = input.sizes(); auto batch = sizes[0] * sizes[1]; auto line = sizes[2]; auto output = at::empty(sizes, at::TensorOptions().dtype<int8_t>() .memory_format(c10::MemoryFormat::Contiguous)); auto *in = input.data_ptr(); auto *out = output.data_ptr(); auto off = o_off.toChar(); auto stype = input.scalar_type(); if (stype == c10::ScalarType::Float) { # pragma omp parallel for for (auto b = 0; b < batch; ++b) { // Move out will cause Apple Clang crash auto pin = reinterpret_cast<float (*)[line]>(in); auto pout = reinterpret_cast<int8_t (*)[line]>(out); i_identity_tpp<16>::ref(pout[b], pin[b], oscale.toFloat(), off, line); } } else if (stype == c10::ScalarType::Char) { # pragma omp parallel for for (auto b = 0; b < batch; ++b) { // Move out will cause Apple Clang crash auto pin = reinterpret_cast<int8_t (*)[line]>(in); auto pout = reinterpret_cast<int8_t (*)[line]>(out); i_identity_tpp<16>::ref(pout[b], pin[b], oscale.toFloat(), off, line); } } return output; } at::Tensor i_identity_cin( const at::Tensor& input, const at::Scalar& oscale) { auto sizes = input.sizes(); auto batch = sizes[0] * sizes[1]; auto line = sizes[2]; auto output = at::empty(sizes, at::TensorOptions().dtype<float>() .memory_format(c10::MemoryFormat::Contiguous)); auto *in = input.data_ptr(); auto *out = output.data_ptr(); # pragma omp parallel for for (auto b = 0; b < batch; ++b) { // Move out will cause Apple Clang crash auto pin = reinterpret_cast<int8_t (*)[line]>(in); auto pout = reinterpret_cast<float (*)[line]>(out); i_identity_tpp<16>::ref_cin(pout[b], pin[b], oscale.toFloat(), line); } return output; } at::Tensor i_identity_( at::Tensor& self, const c10::optional<at::Scalar>& M, const at::Scalar& oscale, const at::Scalar& o_off) { auto sizes = self.sizes(); auto batch = sizes[0] * sizes[1]; auto line = sizes[2]; auto *in = self.data_ptr(); auto type = self.scalar_type(); auto *out = in; auto off = o_off.toChar(); if (type == at::ScalarType::Char) { # pragma omp parallel for for (auto b = 0; b < batch; ++b) { // Move out will cause Apple Clang crash auto pin = reinterpret_cast<int8_t (*)[line]>(in); auto pout = reinterpret_cast<int8_t (*)[line]>(out); i_identity_tpp<16>::ref(pout[b], pin[b], oscale.toFloat(), off, line); } } else { TORCH_CHECK(false, "Integer-8 inplace identity input must be integer-8."); } return self; } }
SECTION code_fp_math16 PUBLIC _f16_mul2 EXTERN cm16_sdcc_mul2 defc _f16_mul2 = cm16_sdcc_mul2
#include "light/platform/opengl/openglvertexarray.hpp" #include "core/logging.hpp" #include "glad/glad.h" namespace Light { GLenum Shader2OpenGLType(ShaderDataType type) { switch (type) { case ShaderDataType::Float: case ShaderDataType::Float2: case ShaderDataType::Float3: case ShaderDataType::Float4: return GL_FLOAT; case ShaderDataType::Int: case ShaderDataType::Int2: case ShaderDataType::Int3: case ShaderDataType::Int4: return GL_INT; case ShaderDataType::Mat3: case ShaderDataType::Mat4: return GL_FLOAT; case ShaderDataType::Bool: return GL_BOOL; default: LIGHT_CORE_ERROR("Unsupported Shader data type"); return -1; } } VertexArray* VertexArray::create() { return new OpenGLVertexArray(); } OpenGLVertexArray::OpenGLVertexArray() { glGenVertexArrays(1, &m_rendererId); } OpenGLVertexArray::~OpenGLVertexArray() = default; void OpenGLVertexArray::bind() const { glBindVertexArray(m_rendererId); } void OpenGLVertexArray::unbind() const { glBindVertexArray(0); } void OpenGLVertexArray::addVertexBuffer(const std::shared_ptr<VertexBuffer>& vbo) { if(vbo->getLayout().getElements().size() == 0) { LIGHT_CORE_ERROR("Buffer Layout not set!"); return; } glBindVertexArray(m_rendererId); vbo->bind(); const auto& layout = vbo->getLayout(); uint32_t index = 0; for(const auto& element: layout) { glEnableVertexAttribArray(index); glVertexAttribPointer(index, element.getComponentCount(), Shader2OpenGLType(element.getType()), element.isNormalized() ? GL_TRUE : GL_FALSE, layout.getStride(), INT2VOIDP(element.getOffset())); index++; } m_vertexBuffers.push_back(vbo); glBindVertexArray(0); } void OpenGLVertexArray::setIndexBuffer(const std::shared_ptr<IndexBuffer>& ibo) { glBindVertexArray(m_rendererId); ibo->bind(); m_indexBuffer = ibo; glBindVertexArray(0); } }
; A006579: Sum of gcd(n,k) for k = 1 to n-1. ; 0,1,2,4,4,9,6,12,12,17,10,28,12,25,30,32,16,45,18,52,44,41,22,76,40,49,54,76,28,105,30,80,72,65,82,132,36,73,86,140,40,153,42,124,144,89,46,192,84,145,114,148,52,189,134,204,128,113,58,300,60,121,210,192,160,249,66,196,156,281,70,348,72,145,250,220,196,297,78,352,216,161,82,436,212,169,198,332,88,477,234,268,212,185,238,464,96,301,342,420,100,393,102,396,480,209,106,540,108,457,254,512,112,441,290,340,408,233,310,780,220,241,282,364,300,693,126,448,296,545,130,708,348,265,594,524,136,537,138,796,324,281,382,864,368,289,518,436,148,825,150,588,540,665,394,844,156,313,366,848,424,729,162,484,780,329,166,1132,312,721,606,508,172,681,670,832,408,353,178,1332,180,793,422,716,472,729,506,556,864,809,190,1088,192,385,930,868,196,1125,198,1100,464,401,538,1116,524,409,738,992,568,1545,210,628,492,425,550,1404,576,433,506,1292,604,873,222,1232,1140,449,226,1252,228,985,1134,908,232,1341,602,700,548,1049,238,1920,240,781,810,724,952,969,678,972,576,1025 lpb $0,1 add $2,1 mov $3,$2 gcd $3,$0 sub $0,1 add $1,$3 lpe
CeladonGym_h: db GYM ; tileset db CELADON_GYM_HEIGHT, CELADON_GYM_WIDTH ; dimensions (y, x) dw CeladonGymBlocks, CeladonGymTextPointers, CeladonGymScript ; blocks, texts, scripts db $00 ; connections dw CeladonGymObject ; objects
global start extern long_mode_start section .text bits 32 start: mov esp, stack_top mov edi, ebx ; Move Multiboot info pointer to edi call check_multiboot call check_cpuid call check_long_mode call set_up_page_tables call enable_paging ; load the 64-bit GDT lgdt [gdt64.pointer] jmp gdt64.code:long_mode_start ; print `OK` to secreen mov dword [0xb8000], 0x2f4b2f4f hlt check_multiboot: cmp eax, 0x36d76289 jne .no_multiboot ret .no_multiboot: mov al, "0" jmp error check_cpuid: ; Check if CPUID is supported by attempting to flip the ID bit (bit 21) ; in the FLAGS register. If we can flip it, CPUID is available. ; Copy FLAGS in to EAX via stack pushfd pop eax ; Copy to ECX as well for comparing later on mov ecx, eax ; Flip the ID bit xor eax, 1 << 21 ; Copy EAX to FLAGS via the stack push eax popfd ; Copy FLAGS back to EAX (with the flipped bit if CPUID is supported) pushfd pop eax ; Restore FLAGS from the old version stored in ECX (i.e. flipping the ; ID bit back if it was ever flipped). push ecx popfd ; Compare EAX and ECX. If they are equal then that means the bit ; wasn't flipped, and CPUID isn't supported. cmp eax, ecx je .no_cpuid ret .no_cpuid: mov al, "1" jmp error check_long_mode: ; test if extended processor info in available mov eax, 0x80000000 ; implicit argument for cpuid cpuid ; get highest supported argument cmp eax, 0x80000001 ; it needs to be at lead 0x80000001 jb .no_long_mode ; if it's less, the CPU is too old for long mode ; use extended info to test if long mode is available mov eax, 0x80000001 ; argument for extended processor info cpuid ; returns various feature bits in ecx and edx test edx, 1 << 29 ; test if the LM-bit is set in the D-register jz .no_long_mode ; If it's not set, there is no long mode ret .no_long_mode: mov al, "2" jmp error set_up_page_tables: mov eax, p4_table or eax, 0b11 ; present + writable mov [p4_table + 511 * 8], eax ; map first P4 entry to P3 table mov eax, p3_table or eax, 0b11 ; present + writable mov [p4_table], eax ; map first P3 entry to p2 mov eax, p2_table or eax, 0b11 mov [p3_table], eax ; map each P2 entry to a huge 2MiB page mov ecx, 0 ; counter variable .map_p2_table: ; map ecx-th P2 entry to a huge page that starts at address 2MiB*ecx mov eax, 0x200000 ; 2MiB mul ecx ; start address of ecx-th page or eax, 0b10000011 ; present + writable + huge mov [p2_table + ecx * 8], eax ; map exc-th entry inc ecx ; increase counter cmp ecx, 512 ; if counter == 512, the whole P2 table is mapped jne .map_p2_table ; else map the next entry ; TODO map each P2 entry to a huge 2MiB page ret enable_paging: ; load P4 to cr3 register (cpu uses this to access the P4 table) mov eax, p4_table mov cr3, eax ; enable PAE-flag in cr4 (Physical Address Extension) mov eax, cr4 or eax, 1 << 5 mov cr4, eax ; set the long mode bit in the EFER MSR (model specific register) mov ecx, 0xC0000080 rdmsr or eax, 1 << 8 wrmsr ; enable pagin in the cr0 register mov eax, cr0 or eax, 1 << 31 mov cr0, eax ret ; Prints `ERR: ` and the given error code to screen and hangs. ; parameter: error code (in ascii) in al error: mov dword [0xb8000], 0x4f524f45 mov dword [0xb8004], 0x4f3a4f52 mov dword [0xb8008], 0x4f204f20 mov byte [0xb800a], al hlt section .bss align 4096 p4_table: resb 4096 p3_table: resb 4096 p2_table: resb 4096 stack_bottom: resb 4096*4 stack_top: section .rodata gdt64: dq 0 ; zero entry .code: equ $ - gdt64 dq (1<<43) | (1<<44) | (1<<47) | (1<<53) ; code segment .pointer: dw $ - gdt64 - 1 dq gdt64
#include "Runtime/MP1/CPlayerVisor.hpp" #include "Runtime/CSimplePool.hpp" #include "Runtime/CStateManager.hpp" #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/Camera/CGameCamera.hpp" #include "Runtime/Graphics/CBooRenderer.hpp" #include "Runtime/Graphics/CModel.hpp" #include "Runtime/GuiSys/CCompoundTargetReticle.hpp" #include "Runtime/GuiSys/CTargetingManager.hpp" #include "Runtime/World/CPlayer.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path namespace urde::MP1 { CPlayerVisor::CPlayerVisor(CStateManager&) : x108_newScanPane(EFilterType::Blend, CGraphics::g_SpareTexture.get()) { x25_24_visorTransitioning = false; x25_25_ = false; xcc_scanFrameCorner = g_SimplePool->GetObj("CMDL_ScanFrameCorner"); xd8_scanFrameCenterSide = g_SimplePool->GetObj("CMDL_ScanFrameCenterSide"); xe4_scanFrameCenterTop = g_SimplePool->GetObj("CMDL_ScanFrameCenterTop"); xf0_scanFrameStretchSide = g_SimplePool->GetObj("CMDL_ScanFrameStretchSide"); xfc_scanFrameStretchTop = g_SimplePool->GetObj("CMDL_ScanFrameStretchTop"); // x108_newScanPane = g_SimplePool->GetObj("CMDL_NewScanPane"); x114_scanShield = g_SimplePool->GetObj("CMDL_ScanShield"); x124_scanIconNoncritical = g_SimplePool->GetObj("CMDL_ScanIconNoncritical"); x130_scanIconCritical = g_SimplePool->GetObj("CMDL_ScanIconCritical"); x13c_scanTargets.resize(64); x540_xrayPalette = g_SimplePool->GetObj("TXTR_XRayPalette"); x0_scanWindowSizes.push_back({}); x0_scanWindowSizes.push_back({g_tweakGui->GetScanWindowIdleWidth(), g_tweakGui->GetScanWindowIdleHeight()}); x0_scanWindowSizes.push_back({g_tweakGui->GetScanWindowActiveWidth(), g_tweakGui->GetScanWindowActiveHeight()}); } CPlayerVisor::~CPlayerVisor() { CSfxManager::SfxStop(x5c_visorLoopSfx); CSfxManager::SfxStop(x60_scanningLoopSfx); } int CPlayerVisor::FindEmptyInactiveScanTarget() const { for (size_t i = 0; i < x13c_scanTargets.size(); ++i) { const SScanTarget& tgt = x13c_scanTargets[i]; if (tgt.x4_timer == 0.f) return i; } return -1; } int CPlayerVisor::FindCachedInactiveScanTarget(TUniqueId uid) const { for (size_t i = 0; i < x13c_scanTargets.size(); ++i) { const SScanTarget& tgt = x13c_scanTargets[i]; if (tgt.x0_objId == uid && tgt.x4_timer > 0.f) return i; } return -1; } bool CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) const { if (!x124_scanIconNoncritical.IsLoaded() || !x130_scanIconCritical.IsLoaded()) return false; if (!x114_scanShield.IsLoaded()) return false; CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); g_Renderer->SetViewportOrtho(true, 0.f, 4096.f); float vpScale = g_Viewport.xc_height / 448.f; CGraphics::SetModelMatrix(zeus::CTransform::Scale(x48_interpWindowDims.x() * 17.f * vpScale, 1.f, x48_interpWindowDims.y() * 17.f * vpScale)); x114_scanShield->Draw(CModelFlags(5, 0, 3, zeus::skClear)); const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); zeus::CTransform camMtx = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr); CGraphics::SetViewPointMatrix(camMtx); zeus::CFrustum frustum; frustum.updatePlanes(camMtx, zeus::CProjection(zeus::SProjPersp( cam->GetFov(), g_Viewport.x8_width / float(g_Viewport.xc_height), 1.f, 100.f))); g_Renderer->SetClippingPlanes(frustum); g_Renderer->SetPerspective(cam->GetFov(), g_Viewport.x8_width, g_Viewport.xc_height, cam->GetNearClipDistance(), cam->GetFarClipDistance()); for (const SScanTarget& tgt : x13c_scanTargets) { if (tgt.x4_timer == 0.f) continue; if (TCastToConstPtr<CActor> act = mgr.GetObjectById(tgt.x0_objId)) { if (!act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable)) continue; const CScannableObjectInfo* scanInfo = act->GetScannableObjectInfo(); const CModel* useModel; const zeus::CColor* useColor; const zeus::CColor* useDimColor; if (scanInfo->IsImportant()) { useModel = x130_scanIconCritical.GetObj(); useColor = &g_tweakGuiColors->GetScanIconCriticalColor(); useDimColor = &g_tweakGuiColors->GetScanIconCriticalDimColor(); } else { useModel = x124_scanIconNoncritical.GetObj(); useColor = &g_tweakGuiColors->GetScanIconNoncriticalColor(); useDimColor = &g_tweakGuiColors->GetScanIconNoncriticalDimColor(); } zeus::CVector3f scanPos = act->GetScanObjectIndicatorPosition(mgr); float scale = CCompoundTargetReticle::CalculateClampedScale( scanPos, 1.f, g_tweakTargeting->GetScanTargetClampMin(), g_tweakTargeting->GetScanTargetClampMax(), mgr); zeus::CTransform xf(zeus::CMatrix3f(scale) * camMtx.basis, scanPos); float scanRange = g_tweakPlayer->GetScanningRange(); float farRange = g_tweakPlayer->GetScanMaxLockDistance() - scanRange; float farT; if (farRange <= 0.f) farT = 1.f; else farT = zeus::clamp(0.f, 1.f - ((scanPos - camMtx.origin).magnitude() - scanRange) / farRange, 1.f); zeus::CColor iconColor = zeus::CColor::lerp(*useColor, *useDimColor, tgt.x8_inRangeTimer); float iconAlpha; if (mgr.GetPlayerState()->GetScanTime(scanInfo->GetScannableObjectId()) == 1.f) { iconAlpha = tgt.x4_timer * 0.25f; } else { float tmp = 1.f; if (mgr.GetPlayer().GetOrbitTargetId() == tgt.x0_objId) tmp = 0.75f * x2c_scanDimInterp + 0.25f; iconAlpha = tgt.x4_timer * tmp; } CGraphics::SetModelMatrix(xf); iconColor.a() *= iconAlpha * farT; useModel->Draw(CModelFlags(7, 0, 1, iconColor)); } } CGraphics::SetDepthRange(DEPTH_SCREEN_ACTORS, DEPTH_GUN); return true; } void CPlayerVisor::UpdateScanObjectIndicators(const CStateManager& mgr, float dt) { bool inBoxExists = false; float dt2 = dt * 2.f; for (SScanTarget& tgt : x13c_scanTargets) { tgt.x4_timer = std::max(0.f, tgt.x4_timer - dt); if (mgr.GetPlayer().ObjectInScanningRange(tgt.x0_objId, mgr)) tgt.x8_inRangeTimer = std::max(0.f, tgt.x8_inRangeTimer - dt2); else tgt.x8_inRangeTimer = std::min(1.f, tgt.x8_inRangeTimer + dt2); if (TCastToConstPtr<CActor> act = mgr.GetObjectById(tgt.x0_objId)) { const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); zeus::CVector3f orbitPos = act->GetOrbitPosition(mgr); orbitPos = cam->ConvertToScreenSpace(orbitPos); orbitPos.x() = orbitPos.x() * g_Viewport.x8_width / 2.f + g_Viewport.x8_width / 2.f; orbitPos.y() = orbitPos.y() * g_Viewport.xc_height / 2.f + g_Viewport.xc_height / 2.f; bool inBox = mgr.GetPlayer().WithinOrbitScreenBox(orbitPos, mgr.GetPlayer().GetOrbitZone(), mgr.GetPlayer().GetOrbitType()); if (inBox != tgt.xc_inBox) { tgt.xc_inBox = inBox; if (inBox) x550_scanFrameColorImpulseInterp = 1.f; } inBoxExists |= inBox; } } if (inBoxExists) x54c_scanFrameColorInterp = std::min(x54c_scanFrameColorInterp + dt2, 1.f); else x54c_scanFrameColorInterp = std::max(0.f, x54c_scanFrameColorInterp - dt2); x550_scanFrameColorImpulseInterp = std::max(0.f, x550_scanFrameColorImpulseInterp - dt); dt += FLT_EPSILON; TAreaId playerArea = mgr.GetPlayer().GetAreaIdAlways(); for (TUniqueId id : mgr.GetPlayer().GetNearbyOrbitObjects()) { if (TCastToConstPtr<CActor> act = mgr.GetObjectById(id)) { if (act->GetAreaIdAlways() != playerArea) continue; if (!act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable)) continue; int target = FindCachedInactiveScanTarget(id); if (target != -1) { SScanTarget& sTarget = x13c_scanTargets[target]; sTarget.x4_timer = std::min(sTarget.x4_timer + dt2, 1.f); continue; } target = FindEmptyInactiveScanTarget(); if (target != -1) { SScanTarget& sTarget = x13c_scanTargets[target]; sTarget.x0_objId = id; sTarget.x4_timer = dt; sTarget.x8_inRangeTimer = 1.f; sTarget.xc_inBox = false; } } } } void CPlayerVisor::UpdateScanWindow(float dt, const CStateManager& mgr) { UpdateScanObjectIndicators(mgr, dt); if (mgr.GetPlayer().GetScanningState() == CPlayer::EPlayerScanState::Scanning) { if (!x60_scanningLoopSfx) x60_scanningLoopSfx = CSfxManager::SfxStart(SFXui_scanning_lp, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId); } else { CSfxManager::SfxStop(x60_scanningLoopSfx); x60_scanningLoopSfx.reset(); } EScanWindowState desiredState = GetDesiredScanWindowState(mgr); switch (x34_nextState) { case EScanWindowState::NotInScanVisor: if (desiredState != EScanWindowState::NotInScanVisor) { if (x30_prevState == EScanWindowState::NotInScanVisor) x48_interpWindowDims = x0_scanWindowSizes[int(desiredState)]; x50_nextWindowDims = x0_scanWindowSizes[int(desiredState)]; x40_prevWindowDims = x48_interpWindowDims; x30_prevState = x34_nextState; x34_nextState = desiredState; x38_windowInterpDuration = (desiredState == EScanWindowState::Scan) ? g_tweakGui->GetScanSidesEndTime() - x3c_windowInterpTimer : 0.f; x3c_windowInterpTimer = x38_windowInterpDuration; } break; case EScanWindowState::Idle: if (desiredState != EScanWindowState::Idle) { x50_nextWindowDims = (desiredState == EScanWindowState::NotInScanVisor) ? x48_interpWindowDims : x0_scanWindowSizes[int(desiredState)]; x40_prevWindowDims = x48_interpWindowDims; x30_prevState = x34_nextState; x34_nextState = desiredState; x38_windowInterpDuration = (desiredState == EScanWindowState::Scan) ? g_tweakGui->GetScanSidesEndTime() - x3c_windowInterpTimer : 0.f; x3c_windowInterpTimer = x38_windowInterpDuration; if (desiredState == EScanWindowState::Scan) CSfxManager::SfxStart(SFXui_into_scan_window, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); } break; case EScanWindowState::Scan: if (desiredState != EScanWindowState::Scan) { x50_nextWindowDims = (desiredState == EScanWindowState::NotInScanVisor) ? x48_interpWindowDims : x0_scanWindowSizes[int(desiredState)]; x40_prevWindowDims = x48_interpWindowDims; x30_prevState = x34_nextState; x34_nextState = desiredState; x38_windowInterpDuration = (desiredState == EScanWindowState::Idle) ? g_tweakGui->GetScanSidesEndTime() - x3c_windowInterpTimer : 0.f; x3c_windowInterpTimer = x38_windowInterpDuration; if (mgr.GetPlayerState()->GetVisorTransitionFactor() == 1.f) CSfxManager::SfxStart(SFXui_outof_scan_window, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); } break; default: break; } if (x30_prevState != x34_nextState) { x3c_windowInterpTimer = std::max(0.f, x3c_windowInterpTimer - dt); if (x3c_windowInterpTimer == 0.f) x30_prevState = x34_nextState; float t = 0.f; if (x38_windowInterpDuration > 0.f) { float scanSidesDuration = g_tweakGui->GetScanSidesDuration(); float scanSidesStart = g_tweakGui->GetScanSidesStartTime(); if (x34_nextState == EScanWindowState::Scan) t = (x3c_windowInterpTimer < scanSidesDuration) ? 0.f : (x3c_windowInterpTimer - scanSidesDuration) / scanSidesStart; else t = (x3c_windowInterpTimer > scanSidesStart) ? 1.f : x3c_windowInterpTimer / scanSidesStart; } x48_interpWindowDims = x50_nextWindowDims * (1.f - t) + x40_prevWindowDims * t; } } CPlayerVisor::EScanWindowState CPlayerVisor::GetDesiredScanWindowState(const CStateManager& mgr) const { if (mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan) { switch (mgr.GetPlayer().GetScanningState()) { case CPlayer::EPlayerScanState::Scanning: case CPlayer::EPlayerScanState::ScanComplete: return EScanWindowState::Scan; default: return EScanWindowState::Idle; } } return EScanWindowState::NotInScanVisor; } void CPlayerVisor::LockUnlockAssets() { #if 0 if (x1c_curVisor == CPlayerState::EPlayerVisor::Scan) x120_assetLockCountdown = 2; else if (x120_assetLockCountdown > 0) --x120_assetLockCountdown; if (x120_assetLockCountdown > 0) { xcc_scanFrameCorner.Lock(); xd8_scanFrameCenterSide.Lock(); xe4_scanFrameCenterTop.Lock(); xf0_scanFrameStretchSide.Lock(); xfc_scanFrameStretchTop.Lock(); //x108_newScanPane.Lock(); x114_scanShield.Lock(); x124_scanIconNoncritical.Lock(); x130_scanIconCritical.Lock(); } else { xcc_scanFrameCorner.Unlock(); xd8_scanFrameCenterSide.Unlock(); xe4_scanFrameCenterTop.Unlock(); xf0_scanFrameStretchSide.Unlock(); xfc_scanFrameStretchTop.Unlock(); //x108_newScanPane.Unlock(); x114_scanShield.Unlock(); x124_scanIconNoncritical.Unlock(); x130_scanIconCritical.Unlock(); } #endif } void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingManager* tgtMgr) const { SCOPED_GRAPHICS_DEBUG_GROUP("CPlayerVisor::DrawScanEffect", zeus::skMagenta); bool indicatorsDrawn = DrawScanObjectIndicators(mgr); if (tgtMgr && indicatorsDrawn) { CGraphics::SetDepthRange(DEPTH_TARGET_MANAGER, DEPTH_TARGET_MANAGER); tgtMgr->Draw(mgr, false); CGraphics::SetDepthRange(DEPTH_SCREEN_ACTORS, DEPTH_GUN); } float transFactor = mgr.GetPlayerState()->GetVisorTransitionFactor(); float scanSidesDuration = g_tweakGui->GetScanSidesDuration(); float scanSidesStart = g_tweakGui->GetScanSidesStartTime(); float t; if (x34_nextState == EScanWindowState::Scan) t = 1.f - ((x3c_windowInterpTimer < scanSidesDuration) ? 0.f : (x3c_windowInterpTimer - scanSidesDuration) / scanSidesStart); else t = (x3c_windowInterpTimer > scanSidesStart) ? 1.f : x3c_windowInterpTimer / scanSidesStart; float vpScale = g_Viewport.xc_height / 448.f; float divisor = (transFactor * ((1.f - t) * x58_scanMagInterp + t * g_tweakGui->GetScanWindowScanningAspect()) + (1.f - transFactor)); divisor = 1.f / divisor; float vpW = 169.218f * x48_interpWindowDims.x() * divisor; vpW = zeus::clamp(0.f, vpW, 640.f) * vpScale; float vpH = 152.218f * x48_interpWindowDims.y() * divisor; vpH = zeus::clamp(0.f, vpH, 448.f) * vpScale; SClipScreenRect rect; rect.x4_left = (g_Viewport.x8_width - vpW) / 2.f; rect.x8_top = (g_Viewport.xc_height - vpH) / 2.f; rect.xc_width = vpW; rect.x10_height = vpH; CGraphics::ResolveSpareTexture(rect); x64_scanDim.Draw(); g_Renderer->SetViewportOrtho(true, -1.f, 1.f); zeus::CTransform windowScale = zeus::CTransform::Scale(x48_interpWindowDims.x(), 1.f, x48_interpWindowDims.y()); zeus::CTransform seventeenScale = zeus::CTransform::Scale(17.f * vpScale, 1.f, 17.f * vpScale); CGraphics::SetModelMatrix(seventeenScale * windowScale); float uvX0 = rect.x4_left / float(g_Viewport.x8_width); float uvX1 = (rect.x4_left + rect.xc_width) / float(g_Viewport.x8_width); float uvY0 = rect.x8_top / float(g_Viewport.xc_height); float uvY1 = (rect.x8_top + rect.x10_height) / float(g_Viewport.xc_height); CTexturedQuadFilter::Vert rttVerts[4] = {{{-5.f, 0.f, 4.45f}, {uvX0, uvY0}}, {{5.f, 0.f, 4.45f}, {uvX1, uvY0}}, {{-5.f, 0.f, -4.45f}, {uvX0, uvY1}}, {{5.f, 0.f, -4.45f}, {uvX1, uvY1}}}; if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::OpenGL) { rttVerts[0].m_uv.y() = uvY1; rttVerts[1].m_uv.y() = uvY1; rttVerts[2].m_uv.y() = uvY0; rttVerts[3].m_uv.y() = uvY0; } const_cast<CTexturedQuadFilter&>(x108_newScanPane).drawVerts(zeus::CColor(1.f, transFactor), rttVerts); // No cull faces zeus::CColor frameColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanFrameInactiveColor(), g_tweakGuiColors->GetScanFrameActiveColor(), x54c_scanFrameColorInterp); frameColor.a() = transFactor; CModelFlags flags(5, 0, 0, frameColor + g_tweakGuiColors->GetScanFrameImpulseColor() * zeus::CColor(x550_scanFrameColorImpulseInterp, x550_scanFrameColorImpulseInterp)); flags.m_noCull = true; zeus::CTransform verticalFlip = zeus::CTransform::Scale(1.f, 1.f, -1.f); zeus::CTransform horizontalFlip = zeus::CTransform::Scale(-1.f, 1.f, 1.f); if (xe4_scanFrameCenterTop.IsLoaded()) { zeus::CTransform modelXf = seventeenScale * zeus::CTransform::Translate(windowScale * zeus::CVector3f(0.f, 0.f, 4.553f)); CGraphics::SetModelMatrix(modelXf); xe4_scanFrameCenterTop->Draw(flags); CGraphics::SetModelMatrix(verticalFlip * modelXf); xe4_scanFrameCenterTop->Draw(flags); } if (xd8_scanFrameCenterSide.IsLoaded()) { zeus::CTransform modelXf = seventeenScale * zeus::CTransform::Translate(windowScale * zeus::CVector3f(-5.f, 0.f, 0.f)); CGraphics::SetModelMatrix(modelXf); xd8_scanFrameCenterSide->Draw(flags); CGraphics::SetModelMatrix(horizontalFlip * modelXf); xd8_scanFrameCenterSide->Draw(flags); } if (xcc_scanFrameCorner.IsLoaded()) { zeus::CTransform modelXf = seventeenScale * zeus::CTransform::Translate(windowScale * zeus::CVector3f(-5.f, 0.f, 4.553f)); CGraphics::SetModelMatrix(modelXf); xcc_scanFrameCorner->Draw(flags); CGraphics::SetModelMatrix(horizontalFlip * modelXf); xcc_scanFrameCorner->Draw(flags); CGraphics::SetModelMatrix(verticalFlip * modelXf); xcc_scanFrameCorner->Draw(flags); CGraphics::SetModelMatrix(verticalFlip * horizontalFlip * modelXf); xcc_scanFrameCorner->Draw(flags); } if (xfc_scanFrameStretchTop.IsLoaded()) { zeus::CTransform modelXf = seventeenScale * zeus::CTransform::Translate(-1.f, 0.f, 4.553f * windowScale.basis[2][2]) * zeus::CTransform::Scale(5.f * windowScale.basis[0][0] - 1.f - 1.884f, 1.f, 1.f); CGraphics::SetModelMatrix(modelXf); xfc_scanFrameStretchTop->Draw(flags); CGraphics::SetModelMatrix(horizontalFlip * modelXf); xfc_scanFrameStretchTop->Draw(flags); CGraphics::SetModelMatrix(verticalFlip * modelXf); xfc_scanFrameStretchTop->Draw(flags); CGraphics::SetModelMatrix(verticalFlip * horizontalFlip * modelXf); xfc_scanFrameStretchTop->Draw(flags); } if (xf0_scanFrameStretchSide.IsLoaded()) { zeus::CTransform modelXf = seventeenScale * zeus::CTransform::Translate(-5.f * windowScale.basis[0][0], 0.f, 1.f) * zeus::CTransform::Scale(1.f, 1.f, 4.553f * windowScale.basis[2][2] - 1.f - 1.886f); CGraphics::SetModelMatrix(modelXf); xf0_scanFrameStretchSide->Draw(flags); CGraphics::SetModelMatrix(horizontalFlip * modelXf); xf0_scanFrameStretchSide->Draw(flags); CGraphics::SetModelMatrix(verticalFlip * modelXf); xf0_scanFrameStretchSide->Draw(flags); CGraphics::SetModelMatrix(verticalFlip * horizontalFlip * modelXf); xf0_scanFrameStretchSide->Draw(flags); } // cull faces } void CPlayerVisor::DrawXRayEffect(const CStateManager&) const { SCOPED_GRAPHICS_DEBUG_GROUP("CPlayerVisor::DrawXRayEffect", zeus::skMagenta); const_cast<CCameraBlurPass&>(x90_xrayBlur).Draw(); } void CPlayerVisor::DrawThermalEffect(const CStateManager&) const { // Empty } void CPlayerVisor::UpdateCurrentVisor(float transFactor) { switch (x1c_curVisor) { case CPlayerState::EPlayerVisor::XRay: x90_xrayBlur.SetBlur(EBlurType::Xray, 36.f * transFactor, 0.f); break; case CPlayerState::EPlayerVisor::Scan: { zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorHudLightMultiply(), zeus::skWhite, 1.f - transFactor); x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, -1); break; } default: break; } } void CPlayerVisor::FinishTransitionIn() { switch (x1c_curVisor) { case CPlayerState::EPlayerVisor::Combat: x90_xrayBlur.DisableBlur(0.f); break; case CPlayerState::EPlayerVisor::XRay: x90_xrayBlur.SetBlur(EBlurType::Xray, 36.f, 0.f); if (!x5c_visorLoopSfx) x5c_visorLoopSfx = CSfxManager::SfxStart(SFXui_visor_xray_lp, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId); break; case CPlayerState::EPlayerVisor::Scan: { zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorScreenDimColor(), g_tweakGuiColors->GetScanVisorHudLightMultiply(), x2c_scanDimInterp); x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, -1); if (!x5c_visorLoopSfx) x5c_visorLoopSfx = CSfxManager::SfxStart(SFXui_visor_scan_lp, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId); break; } case CPlayerState::EPlayerVisor::Thermal: if (!x5c_visorLoopSfx) x5c_visorLoopSfx = CSfxManager::SfxStart(SFXui_visor_thermal_lp, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId); break; default: break; } } void CPlayerVisor::BeginTransitionIn(const CStateManager&) { switch (x1c_curVisor) { case CPlayerState::EPlayerVisor::XRay: x90_xrayBlur.SetBlur(EBlurType::Xray, 0.f, 0.f); // xc4_vpScaleX = 0.9f; // xc8_vpScaleY = 0.9f; CSfxManager::SfxStart(SFXui_into_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); break; case CPlayerState::EPlayerVisor::Scan: CSfxManager::SfxStart(SFXui_into_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, zeus::skWhite, -1); break; case CPlayerState::EPlayerVisor::Thermal: CSfxManager::SfxStart(SFXui_into_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); break; default: break; } } void CPlayerVisor::FinishTransitionOut(const CStateManager&) { switch (x1c_curVisor) { case CPlayerState::EPlayerVisor::XRay: x90_xrayBlur.DisableBlur(0.f); // xc4_vpScaleX = 1.f; // xc8_vpScaleY = 1.f; break; case CPlayerState::EPlayerVisor::Scan: x64_scanDim.DisableFilter(0.f); x34_nextState = EScanWindowState::NotInScanVisor; x30_prevState = EScanWindowState::NotInScanVisor; break; case CPlayerState::EPlayerVisor::Thermal: x90_xrayBlur.DisableBlur(0.f); break; default: break; } } void CPlayerVisor::BeginTransitionOut() { if (x5c_visorLoopSfx) { CSfxManager::SfxStop(x5c_visorLoopSfx); x5c_visorLoopSfx.reset(); } switch (x1c_curVisor) { case CPlayerState::EPlayerVisor::XRay: CSfxManager::SfxStart(SFXui_outof_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); break; case CPlayerState::EPlayerVisor::Scan: if (x60_scanningLoopSfx) { CSfxManager::SfxStop(x60_scanningLoopSfx); x60_scanningLoopSfx.reset(); } CSfxManager::SfxStart(SFXui_outof_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); break; case CPlayerState::EPlayerVisor::Thermal: CSfxManager::SfxStart(SFXui_outof_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); break; default: break; } } void CPlayerVisor::Update(float dt, const CStateManager& mgr) { x90_xrayBlur.Update(dt); CPlayerState& playerState = *mgr.GetPlayerState(); CPlayerState::EPlayerVisor activeVisor = playerState.GetActiveVisor(mgr); CPlayerState::EPlayerVisor curVisor = playerState.GetCurrentVisor(); CPlayerState::EPlayerVisor transVisor = playerState.GetTransitioningVisor(); bool visorTransitioning = playerState.GetIsVisorTransitioning(); UpdateScanWindow(dt, mgr); if (x20_nextVisor != transVisor) x20_nextVisor = transVisor; LockUnlockAssets(); if (mgr.GetPlayer().GetScanningState() == CPlayer::EPlayerScanState::ScanComplete) x2c_scanDimInterp = std::max(0.f, x2c_scanDimInterp - 2.f * dt); else x2c_scanDimInterp = std::min(x2c_scanDimInterp + 2.f * dt, 1.f); if (visorTransitioning) { if (!x25_24_visorTransitioning) BeginTransitionOut(); if (x1c_curVisor != curVisor) { FinishTransitionOut(mgr); x1c_curVisor = curVisor; BeginTransitionIn(mgr); } UpdateCurrentVisor(playerState.GetVisorTransitionFactor()); } else { if (x25_24_visorTransitioning) { FinishTransitionIn(); } else if (curVisor == CPlayerState::EPlayerVisor::Scan) { zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorScreenDimColor(), g_tweakGuiColors->GetScanVisorHudLightMultiply(), x2c_scanDimInterp); x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, -1); } } x25_24_visorTransitioning = visorTransitioning; if (x1c_curVisor != activeVisor) { if (x24_visorSfxVol != 0.f) { x24_visorSfxVol = 0.f; CSfxManager::SfxVolume(x5c_visorLoopSfx, x24_visorSfxVol); CSfxManager::SfxVolume(x60_scanningLoopSfx, x24_visorSfxVol); } } else { if (x24_visorSfxVol != 1.f) { x24_visorSfxVol = 1.f; CSfxManager::SfxVolume(x5c_visorLoopSfx, x24_visorSfxVol); CSfxManager::SfxVolume(x60_scanningLoopSfx, x24_visorSfxVol); } } float scanMag = g_tweakGui->GetScanWindowMagnification(); if (x58_scanMagInterp < scanMag) x58_scanMagInterp = std::min(x58_scanMagInterp + 2.f * dt, scanMag); else x58_scanMagInterp = std::max(x58_scanMagInterp - 2.f * dt, scanMag); } void CPlayerVisor::Draw(const CStateManager& mgr, const CTargetingManager* tgtManager) const { CGraphics::SetAmbientColor(zeus::skWhite); CGraphics::DisableAllLights(); switch (mgr.GetPlayerState()->GetActiveVisor(mgr)) { case CPlayerState::EPlayerVisor::XRay: DrawXRayEffect(mgr); break; case CPlayerState::EPlayerVisor::Thermal: DrawThermalEffect(mgr); break; case CPlayerState::EPlayerVisor::Scan: DrawScanEffect(mgr, tgtManager); break; default: break; } } void CPlayerVisor::Touch() { if (x124_scanIconNoncritical.IsLoaded()) x124_scanIconNoncritical->Touch(0); if (x130_scanIconCritical.IsLoaded()) x130_scanIconCritical->Touch(0); } float CPlayerVisor::GetDesiredViewportScaleX(const CStateManager& mgr) const { return mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Combat ? 1.f : xc4_vpScaleX; } float CPlayerVisor::GetDesiredViewportScaleY(const CStateManager& mgr) const { return mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Combat ? 1.f : xc8_vpScaleY; } } // namespace urde::MP1
@ This file was created from a .asm file @ using the ads2gas.pl script. .equ DO1STROUNDING, 0 .equ ARCH_ARM , 1 .equ ARCH_MIPS , 0 .equ ARCH_X86 , 0 .equ ARCH_X86_64 , 0 .equ ARCH_PPC32 , 0 .equ ARCH_PPC64 , 0 .equ HAVE_EDSP , 1 .equ HAVE_MEDIA , 1 .equ HAVE_NEON , 1 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MMX , 0 .equ HAVE_SSE , 0 .equ HAVE_SSE2 , 0 .equ HAVE_SSE3 , 0 .equ HAVE_SSSE3 , 0 .equ HAVE_SSE4_1 , 0 .equ HAVE_AVX , 0 .equ HAVE_AVX2 , 0 .equ HAVE_ALTIVEC , 0 .equ HAVE_VPX_PORTS , 1 .equ HAVE_STDINT_H , 1 .equ HAVE_ALT_TREE_LAYOUT , 0 .equ HAVE_PTHREAD_H , 1 .equ HAVE_SYS_MMAN_H , 1 .equ HAVE_UNISTD_H , 1 .equ CONFIG_EXTERNAL_BUILD , 1 .equ CONFIG_INSTALL_DOCS , 0 .equ CONFIG_INSTALL_BINS , 1 .equ CONFIG_INSTALL_LIBS , 1 .equ CONFIG_INSTALL_SRCS , 0 .equ CONFIG_USE_X86INC , 1 .equ CONFIG_DEBUG , 0 .equ CONFIG_GPROF , 0 .equ CONFIG_GCOV , 0 .equ CONFIG_RVCT , 0 .equ CONFIG_GCC , 1 .equ CONFIG_MSVS , 0 .equ CONFIG_PIC , 1 .equ CONFIG_BIG_ENDIAN , 0 .equ CONFIG_CODEC_SRCS , 0 .equ CONFIG_DEBUG_LIBS , 0 .equ CONFIG_FAST_UNALIGNED , 1 .equ CONFIG_MEM_MANAGER , 0 .equ CONFIG_MEM_TRACKER , 0 .equ CONFIG_MEM_CHECKS , 0 .equ CONFIG_DEQUANT_TOKENS , 0 .equ CONFIG_DC_RECON , 0 .equ CONFIG_RUNTIME_CPU_DETECT , 1 .equ CONFIG_POSTPROC , 1 .equ CONFIG_VP9_POSTPROC , 0 .equ CONFIG_MULTITHREAD , 1 .equ CONFIG_INTERNAL_STATS , 0 .equ CONFIG_VP8_ENCODER , 1 .equ CONFIG_VP8_DECODER , 1 .equ CONFIG_VP9_ENCODER , 1 .equ CONFIG_VP9_DECODER , 1 .equ CONFIG_VP8 , 1 .equ CONFIG_VP9 , 1 .equ CONFIG_ENCODERS , 1 .equ CONFIG_DECODERS , 1 .equ CONFIG_STATIC_MSVCRT , 0 .equ CONFIG_SPATIAL_RESAMPLING , 1 .equ CONFIG_REALTIME_ONLY , 1 .equ CONFIG_ONTHEFLY_BITPACKING , 0 .equ CONFIG_ERROR_CONCEALMENT , 0 .equ CONFIG_SHARED , 0 .equ CONFIG_STATIC , 1 .equ CONFIG_SMALL , 0 .equ CONFIG_POSTPROC_VISUALIZER , 0 .equ CONFIG_OS_SUPPORT , 1 .equ CONFIG_UNIT_TESTS , 0 .equ CONFIG_WEBM_IO , 1 .equ CONFIG_DECODE_PERF_TESTS , 0 .equ CONFIG_MULTI_RES_ENCODING , 1 .equ CONFIG_TEMPORAL_DENOISING , 1 .equ CONFIG_EXPERIMENTAL , 0 .equ CONFIG_MULTIPLE_ARF , 0 .equ CONFIG_ALPHA , 0 .section .note.GNU-stack,"",%progbits
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
51