max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
theorems/cw/cohomology/CohomologyGroupsTooHigh.agda
mikeshulman/HoTT-Agda
0
5106
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import cohomology.Theory open import cw.CW module cw.cohomology.CohomologyGroupsTooHigh {i} (OT : OrdinaryTheory i) m {n} (n<m : n < m) (G : Group i) (⊙skel : ⊙Skeleton {i} n) (ac : ⊙has-cells-with-choice 0 ⊙skel i) where open OrdinaryTheory OT open import cw.cohomology.Descending OT open import groups.KernelImage {G = G} {H = Lift-group {j = i} Unit-group} {K = Lift-group {j = i} Unit-group} cst-hom cst-hom (snd (Lift-abgroup Unit-abgroup)) open import groups.KernelCstImageCst G (Lift-group {j = i} Unit-group) (Lift-group {j = i} Unit-group) (snd (Lift-abgroup Unit-abgroup)) C-cw-iso-ker/im : C (ℕ-to-ℤ m) ⊙⟦ ⊙skel ⟧ ≃ᴳ Ker/Im C-cw-iso-ker/im = Ker-cst-quot-Im-cst ⁻¹ᴳ ∘eᴳ lift-iso ∘eᴳ trivial-iso-0ᴳ (C-cw-at-higher ⊙skel n<m ac)
AVR/Simon_KeyEnc_OneBlock.asm
openluopworld/simon-speck
2
92807
<filename>AVR/Simon_KeyEnc_OneBlock.asm /* * Simon_Author_OneBlock.asm * * Created: 2015/6/28 21:31:01 * Author: LuoPeng */ .def zero = r17; .def currentRound = r18; .def totalRound = r19; total round, is 40 (in key generation ) or 44 (in encryption) .def currentZ = r20; the current byte value of z, the 62 bits of z is stored in 8 bytes .def remain8 = r21; .def constC0 = r22; the lowest byte const value c .def constC1 = r23; .def constC2 = r24; .def constC3 = r25; the highest byte const value c .DSEG ; RAM( data segment) plainText: .byte 8 ; the 8 bytes of plaintext, from low byte to high byte. cipherText: .byte 8; the 8 bytes of ciphertext, from low byte to high byte keys: .byte 176 ; the 44*4 bytes of round keys .CSEG ; Flash( code segement) /* * the main function */ main: ; load the initial keys from Flash to RAM clr currentRound; ldi r26, low(keys); ldi r27, high(keys); ldi r30, low(initialKeys<<1); ldi r31, high(initialKeys<<1); loadInitialKeys: lpm r0, z+; st x+, r0; inc currentRound; cpi currentRound, 16 brne loadInitialKeys; ; the const value of c ldi constC0, 0xfc; ldi constC1, 0xff; ldi constC2, 0xff; ldi constC3, 0xff; /* * Subroutine: keySchedule * Function: compute the sub keys. */ keySchedule: ldi r26, low(keys); ldi r27, high(keys); ldi r30, low(constZ<<1); ldi r31, high(constZ<<1); lpm currentZ, z+; clr remain8; clr currentRound ; the current round number keysExtend: ; load k(i) ld r2, x+; ld r3, x+; ld r4, x+; ld r5, x+; ; load k(i+1) ld r10, x+; ld r11, x+; ld r12, x+; ld r13, x+; ; S(-3)k(i+3) adiw r26, 4; adiw rd, K ==== rd+1:rd <- rd+1:rd + K ld r6, x+; ld r7, x+; ld r8, x+; ld r9, x+; lsr r9; ror r8; ror r7; bst r6, 0; ror r6; bld r9, 7; lsr r9; ror r8; ror r7; bst r6, 0; ror r6; bld r9, 7; lsr r9; ror r8; ror r7; bst r6, 0; ror r6; bld r9, 7; ;k(i+1) eor S(-3)k(i+3) eor r6, r10; eor r7, r11; eor r8, r12; eor r9, r13; ; k(i) eor [k(i+1) eor S(-3)k(i+3)] eor r2, r6; eor r3, r7; eor r4, r8; eor r5, r9; ; S(-1)[k(i+1) eor S(-3)k(i+3)] lsr r9; ror r8; ror r7; bst r6, 0; ror r6; bld r9, 7; ; k(i) eor [k(i+1) eor S(-3)k(i+3)] eor S(-1)[k(i+1) eor S(-3)k(i+3)] eor r2, r6; eor r3, r7; eor r4, r8; eor r5, r9; ; k(i) eor [k(i+1) eor S(-3)k(i+3)] eor S(-1)[k(i+1) eor S(-3)k(i+3)] + c + z(i) ;bld currentZ, 7; ;bst constC0, 0; bst currentZ, 7; bst Rr, b ==== T <- Rr(b). bst is "bit store from register to T" bld constC0, 0; bld Rr, b ==== Rr(b) <- T. bld is "bit load from T to register" lsl currentZ; eor r2, constC0; eor r3, constC1; eor r4, constC2; eor r5, constC3; ;k(i+4), is just [r3,r2,r1,r0] st x+, r2; st x+, r3; st x+, r4; st x+, r5; ; set x to the position of k(i+1),should sub 16 not 12 sbiw r26, 16; sbiw rd, K ==== rd+1:rd <- rd+1:rd - K ;have finished? inc currentRound; inc remain8; cpi remain8, 8; breq continue;;if the remain8 = 8( the current round is the beisu of 8, such as 8,16,24,32,40) jmp keysExtend; continue: clr remain8; start with 0 again lpm currentZ,z+; cpi currentRound, 40; breq end; jmp keysExtend; end: ;ret; /* * Subroutine: encryption * Function: A minimal RAM Implementation without key schedule of SIMON64/128 * * The sub keys are stored in Flash. The sub keys are transferred to RAM before encryption * Unroll four rounds */ encryption: ldi r26, low(plainText) ; ldi r27, high(plainText) ; ; load the plaintext from RAM to registers [r7,...,r0], X = [r7, r6, r5, r4], Y = [r3, r2, r1, r0] ld r7, x+ ; ld r6, x+ ; ld r5, x+ ; ld r4, x+ ; ld r3, x+ ; ld r2, x+ ; ld r1, x+ ; ld r0, x+ ; clr currentRound ; set 0, have done rounds ; 1 cycle clr zero; 1 cycle ldi r28, low(keys) ; y is the current address of keys ldi r29, high(keys) ; loop: ; get the sub key k ld r8, y+ ; store the 4 bytes of sub key to K = [r11, r10, r9, r8] ld r9, y+ ; ld r10, y+ ; ld r11, y+ ; ; k = k eor y eor r8, r0; eor r9, r1; eor r10, r2; eor r11, r3 ; ; move x to y movw r0, r4; the index must be even ( R1:R0 = R5:R4) movw r2, r6; ( R3:R2 : R7:R6 ) ; rotate x by left with 1 bit lsl r4; logical shift left: bit 0 is cleared, bit 7 is loaded into the C flag of the SREG rol r5; rotate left through carry: the C flag in shifted into bit 0, bit 7 is shifted into the C flag rol r6; rol r7; adc r4, zero; ; move x to t, t stands for [r15, r14, r13, r12] movw r12, r4; movw r14, r6; ; t & S8(y) and r12, r3; and r13, r0; and r14, r1; and r15, r2; ; x = S2(x) lsl r4; rol r5; rol r6; rol r7; adc r4, zero; ; x = x eor t eor r4, r12; eor r5, r13; eor r6, r14; eor r7, r15; ; x = x eor k eor r4, r8; eor r5, r9; eor r6, r10; eor r7, r11; inc currentRound; cpi currentRound, 44; brne loop; storecipher: ; load the ciphertext from registers [r7,...,r0] to RAM st x+, r7; st x+, r6; st x+, r5; st x+, r4; st x+, r3; st x+, r2; st x+, r1; st x+, r0; ret; initialKeys: .db 0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0a, 0x0b, 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1a, 0x1b; ; 1101 1011, 1010 1100, 0110 0101, 1110 0000, 0100 1000, 1010 0111, 0011 0100, 0011 1100 constZ: .db 0xdb, 0xac, 0x65, 0xe0, 0x48, 0xa7, 0x34, 0x3c ;
compiler/ti-cgt-arm_18.12.4.LTS/lib/src/fs_tod32.asm
JosiahCraw/TI-Arm-Docker
0
83131
<gh_stars>0 ;****************************************************************************** ;* FS_TOD32.ASM - 32 BIT STATE - * ;* * ;* Copyright (c) 1996 Texas Instruments Incorporated * ;* http://www.ti.com/ * ;* * ;* Redistribution and use in source and binary forms, with or without * ;* modification, are permitted provided that the following conditions * ;* are met: * ;* * ;* Redistributions of source code must retain the above copyright * ;* notice, this list of conditions and the following disclaimer. * ;* * ;* Redistributions in binary form must reproduce the above copyright * ;* notice, this list of conditions and the following disclaimer in * ;* the documentation and/or other materials provided with the * ;* distribution. * ;* * ;* Neither the name of Texas Instruments Incorporated nor the names * ;* of its contributors may be used to endorse or promote products * ;* derived from this software without specific prior written * ;* permission. * ;* * ;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ;* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * ;* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * ;* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * ;* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * ;* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * ;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * ;* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * ;* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ;* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * ;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ;* * ;****************************************************************************** ;**************************************************************************** ;* FS_TOFD - CONVERT AN IEEE 754 FORMAT SINGLE PRECISION FLOATING ;* POINT NUMBER TO 754 FORMAT DOUBLE PRECISION FLOATING ;**************************************************************************** ;* ;* o INPUT OP IS IN r0 ;* o RESULT IS RETURNED IN r0:r1 ;* ;* o OVERFLOW RETURNS +/- INFINITY ;* (0x7ff00000:00000000) or (0xfff00000:00000000) ;* o DENORMALIZED NUMBERS ARE TREATED AS UNDERFLOWS ;* o UNDERFLOW RETURNS ZERO (0x00000000:00000000) ;* ;**************************************************************************** ;* ;* +------------------------------------------------------------------+ ;* | DOUBLE PRECISION FLOATING POINT FORMAT | ;* | 64-bit representation | ;* | 31 30 20 19 0 | ;* | +-+----------+---------------------+ | ;* | |S| E | M1 | | ;* | +-+----------+---------------------+ | ;* | | ;* | 31 0 | ;* | +----------------------------------+ | ;* | | M2 | | ;* | +----------------------------------+ | ;* | | ;* | <S> SIGN FIELD : 0 - POSITIVE VALUE | ;* | 1 - NEGATIVE VALUE | ;* | | ;* | <E> EXPONENT FIELD: 0000000000 - ZERO IFF M == 0 | ;* | 0000000001..1111111110 - EXPONENT VALUE(1023 BIAS) | ;* | 1111111111 - INFINITY | ;* | | ;* | <M1:M2> MANTISSA FIELDS: FRACTIONAL MAGNITUDE WITH IMPLIED 1 | ;* +------------------------------------------------------------------+ ;* ;**************************************************************************** ;* ;* +--------------------------------------------------------------+ ;* | SINGLE PRECISION FLOATING POINT FORMAT | ;* | 32-bit representation | ;* | 31 30 23 22 0 | ;* | +-+--------+-----------------------+ | ;* | |S| E | M + | ;* | +-+--------+-----------------------+ | ;* | | ;* | <S> SIGN FIELD : 0 - POSITIVE VALUE | ;* | 1 - NEGATIVE VALUE | ;* | | ;* | <E> EXPONENT FIELD: 00 - ZERO IFF M == 0 | ;* | 01...FE - EXPONENT VALUE (127 BIAS) | ;* | FF - INFINITY | ;* | | ;* | <M> MANTISSA FIELD: FRACTIONAL MAGNITUDE WITH IMPLIED 1 | ;* +--------------------------------------------------------------+ ;* ;**************************************************************************** .arm .if __TI_EABI_ASSEMBLER ; ASSIGN EXTERNAL NAMES BASED ON .asg __aeabi_f2d, __TI_FS_TOFD ; RTS BEING BUILT .else .clink .asg FS_TOFD, __TI_FS_TOFD .endif .if __TI_ARM9ABI_ASSEMBLER | __TI_EABI_ASSEMBLER .armfunc __TI_FS_TOFD .endif .if .TMS470_BIG_DOUBLE rhi .set r0 ; High word of regpair 1 rlo .set r1 ; Low word of regpair 1 .else rhi .set r1 ; High word of regpair 1 rlo .set r0 ; Low word of regpair 1 .endif e0 .set lr .global __TI_FS_TOFD __TI_FS_TOFD: .asmfunc stack_usage(4) STMFD sp!, {lr} ; SAVE CONTEXT MOVS e0, r0, LSL #1 ; SETUP EXPONENT IN e0 MOVS e0, e0, LSR #24 ; BEQ unfl ; CHECK FOR UNDERFLOW / ZERO CMP e0, #0xFF ; CHECK FOR INFINITY BEQ ovfl ; AND RETURN OVERFLOW ADD e0, e0, #0x380 ; ADJUST FOR THE BIAS MOV r1, r0, LSR #31 ; ENCODE SIGN WITH EXPONENT ORR e0, e0, r1, LSL #11 ; .if .TMS470_LITTLE_DOUBLE ; IN LITTLE ENDIAN MODE MOV rhi, r0 ; MOVE THE VALUE TO RHI .endif MOV rlo, rhi, LSL #29 ; SETUP LOW PART OF MANTISSA MOV rhi, rhi, LSL #9 ; AND SETUP HIGH PART OF MANTISSA MOV rhi, rhi, LSR #12 ; ORR rhi, rhi, e0, LSL #20 ; OR SIGN AND EXPONENT INTO RESULT .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMFD sp!, {pc} ; .else LDMFD sp!, {lr} BX lr .endif unfl: MOV rhi, #0x0 ; IF UNDERFLOW, RETURN 0 MOV rlo, #0x0 ; .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMFD sp!, {pc} ; .else LDMFD sp!, {lr} BX lr .endif ovfl: ; IF OVERFLOW, RETURN +/- INFINITY / NaN .if .TMS470_LITTLE_DOUBLE ; IN LITTLE ENDIAN MODE MOV rhi, r0 ; MOVE THE VALUE TO RHI .endif MOV rlo, r0, LSL #9 ; KEEP THE MANTISSA FOR NaN VS INFINITY MOV rhi, rhi, LSR #23 ; ISOLATE SIGN AND EXPONENT MOV rhi, rhi, LSL #3 ADD rhi, rhi, #7 MOV rhi, rhi, LSL #20 .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMFD sp!, {pc} ; .else LDMFD sp!, {lr} BX lr .endif .endasmfunc .end
templates/amd64-386/sinks.asm
going-digital/sointu
76
6654
<filename>templates/amd64-386/sinks.asm {{- if .HasOp "out"}} ;------------------------------------------------------------------------------- ; OUT opcode: outputs and pops the signal ;------------------------------------------------------------------------------- {{- if .Mono "out"}} ; Mono: add ST0 to main left port, then pop {{- end}} {{- if .Stereo "out"}} ; Stereo: add ST0 to left out and ST1 to right out, then pop {{- end}} ;------------------------------------------------------------------------------- {{.Func "su_op_out" "Opcode"}} ; l r mov {{.DI}}, [{{.Stack "Synth"}}] ; DI points to the synth object, use DI consistently in sinks/sources presumably to increase compression rate {{- if .StereoAndMono "out" }} jnc su_op_out_mono {{- end }} {{- if .Stereo "out" }} call su_op_out_mono add {{.DI}}, 4 ; shift from left to right channel su_op_out_mono: {{- end}} fmul dword [{{.Input "out" "gain"}}] ; multiply by gain fadd dword [{{.DI}} + su_synthworkspace.left] ; add current value of the output fstp dword [{{.DI}} + su_synthworkspace.left] ; store the new value of the output ret {{end}} {{- if .HasOp "outaux"}} ;------------------------------------------------------------------------------- ; OUTAUX opcode: outputs to main and aux1 outputs and pops the signal ;------------------------------------------------------------------------------- ; Mono: add outgain*ST0 to main left port and auxgain*ST0 to aux1 left ; Stereo: also add outgain*ST1 to main right port and auxgain*ST1 to aux1 right ;------------------------------------------------------------------------------- {{.Func "su_op_outaux" "Opcode"}} ; l r mov {{.DI}}, [{{.Stack "Synth"}}] {{- if .StereoAndMono "outaux" }} jnc su_op_outaux_mono {{- end}} {{- if .Stereo "outaux" }} call su_op_outaux_mono add {{.DI}}, 4 su_op_outaux_mono: {{- end}} fld st0 ; l l fmul dword [{{.Input "outaux" "outgain"}}] ; g*l fadd dword [{{.DI}} + su_synthworkspace.left] ; g*l+o fstp dword [{{.DI}} + su_synthworkspace.left] ; o'=g*l+o fmul dword [{{.Input "outaux" "auxgain"}}] ; h*l fadd dword [{{.DI}} + su_synthworkspace.aux] ; h*l+a fstp dword [{{.DI}} + su_synthworkspace.aux] ; a'=h*l+a ret {{end}} {{- if .HasOp "aux"}} ;------------------------------------------------------------------------------- ; AUX opcode: outputs the signal to aux (or main) port and pops the signal ;------------------------------------------------------------------------------- ; Mono: add gain*ST0 to left port ; Stereo: also add gain*ST1 to right port ;------------------------------------------------------------------------------- {{.Func "su_op_aux" "Opcode"}} ; l r lodsb mov {{.DI}}, [{{.Stack "Synth"}}] {{- if .StereoAndMono "aux" }} jnc su_op_aux_mono {{- end}} {{- if .Stereo "aux" }} call su_op_aux_mono add {{.DI}}, 4 su_op_aux_mono: {{- end}} fmul dword [{{.Input "aux" "gain"}}] ; g*l fadd dword [{{.DI}} + su_synthworkspace.left + {{.AX}}*4] ; g*l+o fstp dword [{{.DI}} + su_synthworkspace.left + {{.AX}}*4] ; o'=g*l+o ret {{end}} {{- if .HasOp "send"}} ;------------------------------------------------------------------------------- ; SEND opcode: adds the signal to a port ;------------------------------------------------------------------------------- ; Mono: adds signal to a memory address, defined by a word in VAL stream ; Stereo: also add right signal to the following address ;------------------------------------------------------------------------------- {{.Func "su_op_send" "Opcode"}} lodsw mov {{.CX}}, [{{.Stack "Voice"}}] ; load pointer to voice {{- if .SupportsGlobalSend}} pushf ; uh ugly: we save the flags just for the stereo carry bit. Doing the .CX loading later crashed the synth for stereo sends as loading the synth address from stack was f'd up by the "call su_op_send_mono" test ah, 0x80 jz su_op_send_skipglobal mov {{.CX}}, [{{.Stack "Synth"}} + {{.PTRSIZE}}] su_op_send_skipglobal: popf {{- end}} {{- if .StereoAndMono "send"}} jnc su_op_send_mono {{- end}} {{- if .Stereo "send"}} mov {{.DI}}, {{.AX}} inc {{.AX}} ; send the right channel first fxch ; r l call su_op_send_mono ; (r) l mov {{.AX}}, {{.DI}} ; move back to original address test al, 0x8 ; if r was not popped and is still in the stack jnz su_op_send_mono fxch ; swap them back: l r su_op_send_mono: {{- end}} test al, 0x8 ; if the SEND_POP bit is not set jnz su_op_send_skippush fld st0 ; duplicate the signal on stack: s s su_op_send_skippush: ; there is signal s, but maybe also another: s (s) fld dword [{{.Input "send" "amount"}}] ; a l (l) {{- .Float 0.5 | .Prepare | indent 4}} fsub dword [{{.Float 0.5 | .Use}}] ; a-.5 l (l) fadd st0 ; g=2*a-1 l (l) and ah, 0x7f ; eax = send address, clear the global bit or al, 0x8 ; set the POP bit always, at the same time shifting to ports instead of wrk fmulp st1, st0 ; g*l (l) fadd dword [{{.CX}} + {{.AX}}*4] ; g*l+L (l),where L is the current value fstp dword [{{.CX}} + {{.AX}}*4] ; (l) ret {{end}}
Read Only/gdb-7.12.1/gdb/testsuite/gdb.ada/access_to_packed_array/pack.ads
samyvic/OS-Project
0
24045
<filename>Read Only/gdb-7.12.1/gdb/testsuite/gdb.ada/access_to_packed_array/pack.ads -- Copyright 2015-2017 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package Pack is type Small is mod 2 ** 6; type Array_Type is array (0 .. 9) of Small with Pack; type Array_Access is access all Array_Type; A : aliased Array_Type := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); AA : constant Array_Access := A'Access; procedure Do_Nothing (A : Array_Access); end Pack;
data/pokemon/dex_entries/grovyle.asm
AtmaBuster/pokeplat-gen2
6
86113
db "WOOD GECKO@" ; species name db "It leaps from tree" next "branch to tree" next "branch quite" page "swiftly. It shows" next "astounding" next "agility.@"
programs/oeis/087/A087349.asm
jmorken/loda
1
20429
<filename>programs/oeis/087/A087349.asm ; A087349: n + (smallest prime-factor of n+1). ; 3,5,5,9,7,13,9,11,11,21,13,25,15,17,17,33,19,37,21,23,23,45,25,29,27,29,29,57,31,61,33,35,35,39,37,73,39,41,41,81,43,85,45,47,47,93,49,55,51,53,53,105,55,59,57,59,59,117,61,121,63,65,65,69,67,133,69,71,71,141,73,145,75,77,77,83,79,157,81,83,83,165,85,89,87,89,89,177,91,97,93,95,95,99,97,193,99,101,101,201,103,205,105,107,107,213,109,217,111,113,113,225,115,119,117,119,119,125,121,131,123,125,125,129,127,253,129,131,131,261,133,139,135,137,137,273,139,277,141,143,143,153,145,149,147,149,149,297,151,301,153,155,155,159,157,313,159,161,161,167,163,325,165,167,167,333,169,181,171,173,173,345,175,179,177,179,179,357,181,361,183,185,185,189,187,197,189,191,191,381,193,385,195,197,197,393,199,397,201,203,203,209,205,209,207,209,209,219,211,421,213,215,215,219,217,223,219,221,221,233,223,445,225,227,227,453,229,457,231,233,233,465,235,239,237,239,239,477,241,481,243,245,245,249,247,259,249,251,251,501 mov $1,1 mov $3,$0 lpb $0 mov $2,$0 sub $0,1 add $1,1 mod $2,$1 mov $5,1 trn $5,$2 add $0,$5 add $4,1 lpe add $1,$4 div $1,2 add $1,3 add $1,$3
ProgramA.asm
barooni/HDBMIPSSim
7
175941
<reponame>barooni/HDBMIPSSim .code addi $a0,$a0,10 test: addi $v0,$zero,20 addi $v1,$zero,3 syscall addi $t0,$zero,10 addi $v0,$zero,10 syscall .data 11 12 13 14 15
core/words/times2.asm
paulscottrobson/nextForth
2
86633
; ; Word: 2* ; Dictionary: (a - a) ; Date: 1st February 2018 ; Macro: Yes ; Notes: ; ex de,hl add hl,hl ex de,hl ret
TankBot_Code_Dev/TankBotTest/asm/src/main.asm
CmdrZin/chips_avr_examples
5
101238
/* * Tank Bot Test Code Project * * org: 11/13/2014 * auth: Nels "Chip" Pearson * * Target: Tank Bot Demo Board, 20MHz, ATmega164P * * */ .nolist .include "m164pdef.inc" .list .ORG $0000 rjmp RESET .ORG $0002 rjmp trap_intr .ORG $0004 rjmp trap_intr .ORG $0006 rjmp trap_intr .ORG $0008 rjmp trap_intr .ORG $000A rjmp trap_intr .ORG PCI2addr ; 0x0c Pin Change Interrupt Request 2 rjmp range_s_intr .ORG $000E rjmp trap_intr .ORG $0010 rjmp trap_intr .ORG OC2Aaddr ; 0x12 Timer/Counter2 Compare Match A rjmp st_tmr2A_intr .ORG $0014 rjmp trap_intr .ORG $0016 rjmp trap_intr .ORG $0018 rjmp trap_intr .ORG OC1Aaddr ; 0x1a Timer/Counter1 Compare Match A rjmp pwm_tmr1A_intr .ORG OC1Baddr ; 0x1c Timer/Counter1 Compare Match B rjmp pwm_tmr1B_intr .ORG $001E rjmp trap_intr .ORG OC0Aaddr ; 0x20 Timer/Counter0 Compare Match A rjmp st_tmr0_intr .ORG $0022 rjmp trap_intr .ORG $0024 rjmp trap_intr .ORG $0026 rjmp trap_intr .ORG $0028 rjmp trap_intr .ORG $002A rjmp trap_intr .ORG $002C rjmp trap_intr .ORG $002E rjmp trap_intr .ORG $0030 rjmp trap_intr .ORG $0032 rjmp trap_intr .ORG TWIaddr ; 0x34 2-wire Serial Interface rjmp i2c_intr .ORG $0036 rjmp trap_intr .ORG $0038 rjmp trap_intr .ORG $003A rjmp trap_intr .ORG $003C rjmp trap_intr .ORG INT_VECTORS_SIZE ; Skip over the rest of them. .CSEG RESET: ; setup SP ldi R16, LOW(RAMEND) out spl, R16 ldi R16, HIGH(RAMEND) out sph, R16 ; JTAG disable ldi R16, $80 out MCUCR, R16 out MCUCR, R16 ; call st_init_tmr0 call st_init_tmr1 call st_init_tmr2 call adc_init_hdwr call pwm_dc_init call tank_demo_init call range_ir_service_init call range_s_service_init call i2c_init_master call serial_init ; sei ; enable intr ; call tbtest_leds ; blink LEDs for awhile. ; main_m: ; m_skip01: ; use only one of these at a time. NOT with demo. Messes up PWM. ;; call tb_ir_range_leds ; checked ;; call tb_sonar_range_leds ; checked ; ;; call tb_logger ; Output a test message every 100ms. checked. ; call tank_demo ; ;;; call range_ir_service ; checked ; call range_sonar_service ; checked ; ;;; call tb_serial ; send 'C' every 100ms ; rjmp main_m trap_intr: call tb_led3_on rjmp trap_intr // Bring in timmer support .include "sys_timers.asm" // PWM DC Motor Lib .include "pwm_dc_motor_lib.asm" // Demo Code .include "demo_service.asm" // Optical Range Service .include "range_ir_service.asm" // ADC Utilities .include "adc_util_triggered.asm" // Sonar Range Service .include "range_sonar_service.asm" // Logger Support .include "logger_i2c_out.asm" // Conversion Utilities .include "conversion_util.asm" // Board Test .include "tankbot_board_test.asm" // I2C Master Support .include "i2c_master.asm" // RS-232 Serial Support .include "serial_lib.asm" // Fifo Support .include "fifo_lib.asm"
CCS/wisp-base/Math/crc16_ccitt.asm
anparks/boot_wisp5
7
102998
<reponame>anparks/boot_wisp5<gh_stars>1-10 ;Taken from SLAA221 app note on look up table methods. ;C callable assembly, file: _crc_algs.s43 ;arg1 > [R13:]R12, arg2 > [R15:]R14, others stack ;result > [R13:]R12 ;R0:R2, system registers ;R3 constant generator ;R4:R5, reserved for ROM monitor mode, else GP ;R6:R11, 6 general purpose registers ;R12:R15, reserved for passing args ;/INCLUDES---------------------------------------------------------------------------------------------------------------------------- .cdecls C,LIST, "../globals.h" .def crc16_ccitt, crc16Bits_ccitt .ref crc16_LUT r_index .set R11 ;[] the register used to first hold &VAL, then VAL. (see PDRD descr) r_crc .set R12 ;[] working register where the CRC is stored. r_dataPtr .set R13 ;[] address of the data to calculate CRC on r_numBytes .set R14 ;[] num of bytes to calculate the CRC on r_numBits .set R15 ;[] num of bits to calculate CRC on ;************************************************************************************************************************************* ; unsigned int crc16_ccitt(unsigned short preload,unsigned char *dataPtr, unsigned int numBytes) * ; TODO: List Steps Here: * ; Assumption: numBits > 0 * ;************************************************************************************************************************************* crc16_ccitt: ;[11] (2+2+2+5)entry into function and setup with vals INV r_crc ;[2] #1. bring CRC preload into working form (inverted) before operation crc16_a_byte: SWPB r_crc ;[1] #4, swap" CRC[i] = (CRClsb[i-1] | CRCmsb[i-1] ) MOV.B r_crc, r_index ;[1] #2. start out VAL[i] = (0x00|CRCmsb[i-1]) XOR.B @r_dataPtr+,r_index ;[2] #2. bring data in VAL[i] ^= (0x00|data[i++]) ADD r_index, r_index ;[1] #2. mult by 2 VAL[i] = 2*VAL[i] ADD #crc16_LUT, r_index ;[2] #2. offst ptr, VAL[i] += &crc16_LUT AND #0xFF00, r_crc ;[2] #2. mask bottByte, CRC[i] &= 0xFF00 XOR @r_index, r_crc ;[2] #3/5. XOR tableVal, CRC[i] ^= *VAL[i] DEC r_numBytes ;[1] #6. continue calculating bytes until all are proc'd JNZ crc16_a_byte ;[2] "" crc16_a_exit: INV r_crc ;[2] #7. restore CRC to working form (invert it) ;r_crc is in proper return register on exit. RETA ;[8] 4 for return, 4 for moving data out to RAM (from R12) ;************************************************************************************************************************************* ; unsigned int crc16Bits_ccitt(unsigned short preload,unsigned char *dataPtr, unsigned int numBytes,unsigned int numBits) * ; TODO: List Steps Here: * ; ASSUMPTION: numBytes & numBits >0 * ;************************************************************************************************************************************* crc16Bits_ccitt: INV r_crc ;[2] #1. bring CRC preload into working form (inverted) before operation crc16Bits_a_byte: SWPB r_crc ;[1] #4, swap" CRC[i] = (CRClsb[i-1] | CRCmsb[i-1] ) MOV.B r_crc, r_index ;[1] #2. start out VAL[i] = (0x00|CRCmsb[i-1]) XOR.B @r_dataPtr+,r_index ;[2] #2. bring data in VAL[i] ^= (0x00|data[i++]) ADD r_index, r_index ;[1] #2. mult by 2 VAL[i] = 2*VAL[i] ADD #crc16_LUT, r_index ;[2] #2. offst ptr, VAL[i] += &crc16_LUT AND #0xFF00, r_crc ;[2] #2. mask bottByte, CRC[i] &= 0xFF00 XOR @r_index, r_crc ;[2] #3/5. XOR tableVal, CRC[i] ^= *VAL[i] DEC r_numBytes ;[1] #6. continue calculating bytes until all are proc'd JNZ crc16Bits_a_byte ;[2] "" ;Load the last byte in prep to shift bits! MOV.B @r_dataPtr, r_index ;[2] load the last message byte, which is where bits get grabbed from (MSB side) crc16Bits_Bits: CLR r_dataPtr ;[1] use dataPtr as the register to store the inbound dataBit into (b15) RLC.B r_index ;[1] shift out b7 of data RRC r_dataPtr ;[1] shift it into b15 or workingRef XOR r_dataPtr, r_crc ;[1] XOR in that dataBit into the CRC RLA r_crc ;[1] Shift CRC left JNC crc16Bits_skipXOR ;[2] if bit shifted out was set, XOR in the poly XOR #CCITT_POLY, r_crc ;[2] b15 was set, so XOR in CRC16-CCITT poly crc16Bits_skipXOR: DEC r_numBits ;[1] continue until all bits are proc'd JNZ crc16Bits_Bits ;[2] "" crc16Bits_a_exit: INV r_crc ;[2] #7. restore CRC to working form (invert it) ;r_crc is in proper return register on exit. RETA ;[8] 4 for return, 4 for moving data out to RAM (from R12) .end
boot.asm
ishrikrishna/_timeshift
0
174612
<filename>boot.asm<gh_stars>0 ; __timeshit ; First Stage (Real Mode) && Second Stage (Protected mode) Bootloader ; ; No license and Warranty - Use at your own risk after studying the code below. ; ; Have a great day, ; Krishna BITS 16 ORG 0x7c00 ; Our code will be loaded here jmp _start ;******************************************* ; Global Descriptor Table (GDT) ;******************************************* GDT: ; null descriptor dd 0 dd 0 ; code descriptor dw 0xFFFF ; limit low dw 0 ; base low db 0 ; base middle db 10011010b ; access db 11001111b ; granularity db 0 ; base high ; data descriptor dw 0xFFFF ; limit low (Same as code)10:56 AM 7/8/2007 dw 0 ; base low db 0 ; base middle db 10010010b ; access db 11001111b ; granularity db 0 ; base high ; code descriptor dw 0xFFFF ; limit low dw 0x0 ; base low db 0x0 ; base middle db 11111010b ; access db 11001111b ; granularity db 0 ; base high ; data descriptor dw 0xFFFF ; limit low (Same as code)10:56 AM 7/8/2007 dw 0x0 ; base low db 0x0 ; base middle db 11110010b ; access db 11001111b ; granularity db 0 ; base high END_GDT: ; GDT Pointer GDT_PTR: dw END_GDT - GDT - 1 ; limit (Size of GDT) dd GDT ; base of GDT ; Location of entries in GDT CODE_SEG equ 0x08 DATA_SEG equ 0x10 ; Calling this enables Protected mode ; Shall be called only after setting up and loading GDT ; Otherwise, Processor will throw exception EnablePM: ; clear interrupts mov eax, cr0 ; set bit 0 in cr0--enter pmode or eax, 1 mov cr0, eax ret Print16: lodsb or al, al jz .done mov ah, 0xe int 0x10 jmp Print16 .done: mov al, 0x0D mov ah, 0xe int 0x10 mov al, 0x0A mov ah, 0xe int 0x10 ret ; DAP (Disk Address Packet) for LBA addressing ; Because we are loading from USB Partition ; ; Little research conclusions ; 1. x86 is little endian ; 2. Therefore, offset shall come first in seg:off pairs ; ;Check Int 13h func 42h section of article on wikipedia. ; https://en.wikipedia.org/wiki/INT_13H#INT_13h_AH=42h:_Extended_Read_Sectors_From_Drive second_stage_dap: db 0x10 db 0 dw 0x2 dw 0x7e00 dw 0x0000 dd 0x1;0x801 dd 0x0 ; Entry point in 16 bit Real Mode ; See the jmp instruction at the top of this file _start: ;-------------------------------; ; Setup segments and stack ; ;-------------------------------; xor ax, ax ; null segments mov ds, ax mov es, ax mov ax, 0x9000 ; stack begins at 0x9000-0xffff mov ss, ax mov sp, 0xffff ; Welcome Message mov si, wel call Print16 ; Loading Protected Mode code mov ah, 0x42 mov dl, 0x80 mov si, second_stage_dap int 0x13 ; Jumping to Protected Mode ; Notifying the user here mov si, pms call Print16 cli ;jmp $ lgdt [GDT_PTR] ; Install GDT ; Enabling PM Mode call EnablePM ; Jump to protected mode routine ; Disabling the interupts because we didn't setup any interuppt handlers ; Interuppts shall be enabled only after setting up and loading IDT table properly jmp CODE_SEG:PmodeEntry ; CS will be Auto-Updated to CODE_SEG jmp $ wel db "Welcome!", 0 pms db "Going into protected mode.", 0 ; Fill remaining bytes with zeros ; and add boot signature times 510-($-$$) db 0 dw 0xaa55 BITS 32 wel32Msg db "Entered Second Stage in Protected Mode.", 0 ; ENTRY Point/subroutine for Protected mode PmodeEntry: ; Reload stack and data segment registers with GDT entry mov ax, DATA_SEG mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax mov ebp, 0xffffff mov esp, ebp mov si, wel32Msg ; Setting PM welcome message to be printed mov eax, 0 mov ebx, 0 call Print32 ; Printing PM Welcome message cli ;Enable A20 Gate to allow 32 bit addressing call EnableA20Gate call RemapPIC call SetTimer call initRTC ;int 33 mov eax, 0x40 mov ebx, 1 mov edi, 0x100000 call readseg ; Kernel code is already loaded in memory during real mode from disk ; via MBR (First Stage) ; ; Fetching kernel entry point ; Kernel is an ELF file ; 4 bytes start from offset 0x18 in ELF Header contains the entry point mov ebx, [0x100400 + 0x18] ; Calculating effective addres to jump to lea ebx, [0x100400 + ebx] ; Jumping to kernel jmp ebx ; Halting the system jmp $ ;jmp hang hang: jmp hang waitdisk: mov edx, 0x1F7 in al, dx and al, 0xC0 cmp al, 0x40 jne waitdisk ret readsect: push eax push ebx push edi call waitdisk mov edx, 0x1f2 mov eax, 1 out dx, al mov edx, 0x1f3 mov eax, ebx out dx, al shr ebx, 8 mov eax, ebx mov edx, 0x1f4 out dx, al shr ebx, 16 mov eax, ebx mov edx, 0x1f5 out dx, al mov eax, ebx shr eax, 24 or eax, 0xE0 mov edx, 0x1f6 out dx, al mov edx, 0x1f7 mov eax, 0x20 out dx, al call waitdisk ;mov edi, 0x100000 mov ecx, 0x80 mov edx, 0x1f0 cld rep insd call waitdisk pop edi pop ebx pop eax ret readseg: push eax push ebx push edi .readseg_r: call readsect add ebx, 1 lea edi, [edi + 0x200] sub eax, 1 cmp al, 0x0 jge .readseg_r pop edi pop ebx pop eax ret ; Sub routine to print message in 32 bit protected mode Print32: ;Print to screen mov ecx, 80 xchg eax, ebx mul ecx add eax, ebx shl eax, 1 mov edi, 0xb8000 add edi, eax mov ah, 0x1b .repeat: lodsb or al, al jz .done mov word [edi], ax add edi, 2 jmp .repeat .done: ret RemapPIC: ;cli mov al, 0x11 out 0x20, al ;restart PIC1 out 0xA0, al ;restart PIC2 mov al, 0x20 out 0x21, al ;PIC1 now starts at 32 mov al, 0x28 out 0xA1, al ;PIC2 now starts at 40 mov al, 0x04 out 0x21, al ;setup cascading mov al, 0x02 out 0xA1, al mov al, 0x01 out 0x21, al out 0xA1, al ;done! ret initRTC: mov al, 0x0b out 0x70, al in al, 0x71 or al, 0x40 out 0x71, al ret SetTimer: ; COUNT = input hz / frequency mov dx, 1193180 / 100 ; 100hz, or 10 milliseconds ; FIRST send the command word to the PIT. Sets binary counting, ; Mode 3, Read or Load LSB first then MSB, Channel 0 mov al, 110110b out 0x43, al ; Now we can write to channel 0. ;Because we set the "Load LSB first then MSB" bit, that is ; the way we send it mov ax, dx out 0x40, al ;LSB xchg ah, al out 0x40, al ;MSB ret EnableA20Gate: ; Check A20 line ; Returns to caller if A20 gate is set. ; Continues to A20_of if A20 line is not set. ; Written by <NAME> pushad mov edi,0x112345 ;odd megabyte address. mov esi,0x012345 ;even megabyte address. mov [esi],esi ;making sure that both addresses contain diffrent values. mov [edi],edi ;(if A20 line is cleared the two pointers would point to ;the address 0x012345 that would contain 0x112345 (edi)) cmpsd ;compare addresses to see if the're equivalent. popad je A20_off ;if equivalent , A20 line is not set. ret ;if not equivalent , the A20 line is set. A20_off: in al, 0x92 or al, 2 out 0x92, al ret times 1534-($-$$) db 0 dw 0xbaad
src/LibraBFT/Impl/Storage/DiemDB/DiemDB.agda
LaudateCorpus1/bft-consensus-agda
0
14334
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} open import LibraBFT.Base.Types import LibraBFT.Impl.OBM.ECP-LBFT-OBM-Diff.ECP-LBFT-OBM-Diff-2 as ECP-LBFT-OBM-Diff-2 import LibraBFT.Impl.Storage.DiemDB.LedgerStore.LedgerStore as LedgerStore open import LibraBFT.ImplShared.Consensus.Types open import LibraBFT.ImplShared.Util.Dijkstra.All open import Optics.All open import Util.Prelude module LibraBFT.Impl.Storage.DiemDB.DiemDB where ------------------------------------------------------------------------------ getEpochEndingLedgerInfosImpl : DiemDB → Epoch → Epoch → Epoch {-Usize-} → Either ErrLog (List LedgerInfoWithSignatures × Bool) getLatestLedgerInfo : DiemDB → Either ErrLog LedgerInfoWithSignatures ------------------------------------------------------------------------------ mAX_NUM_EPOCH_ENDING_LEDGER_INFO : Epoch -- Usize mAX_NUM_EPOCH_ENDING_LEDGER_INFO = 100 ------------------------------------------------------------------------------ -- impl DiemDB -- Returns ledger infos for epoch changes starting with the given epoch. -- If there are less than `MAX_NUM_EPOCH_ENDING_LEDGER_INFO` results, it returns all of them. -- Otherwise the first `MAX_NUM_EPOCH_ENDING_LEDGER_INFO` results are returned -- and a flag is set to True to indicate there are more. getEpochEndingLedgerInfos : DiemDB → Epoch → Epoch → Either ErrLog (List LedgerInfoWithSignatures × Bool) getEpochEndingLedgerInfos self startEpoch endEpoch = getEpochEndingLedgerInfosImpl self startEpoch endEpoch mAX_NUM_EPOCH_ENDING_LEDGER_INFO -- TODO-2: provide EitherD variants before writing proofs about this function; -- TODO-2: then use `whenD` in place of the two `if`s below getEpochEndingLedgerInfosImpl self startEpoch endEpoch limit = do if (not ⌊ (startEpoch ≤? endEpoch) ⌋) then (Left fakeErr {-here ["bad epoch range", lsE startEpoch, lsE endEpoch]-}) else pure unit -- the latest epoch can be the same as the current epoch (in most cases), or -- current_epoch + 1 (when the latest ledger_info carries next validator set) latestEpoch ← getLatestLedgerInfo self >>= pure ∘ (_^∙ liwsLedgerInfo ∙ liNextBlockEpoch) if (not ⌊ (endEpoch ≤? latestEpoch) ⌋) then (Left fakeErr) -- [ "unable to provide epoch change ledger info for still open epoch" -- , "asked upper bound", lsE endEpoch -- , "last sealed epoch", lsE (latestEpoch - 1) ]))) -- -1 is OK because genesis LedgerInfo has .next_block_epoch() == 1 else pure unit let (pagingEpoch , more) = ECP-LBFT-OBM-Diff-2.e_DiemDB_getEpochEndingLedgerInfosImpl_limit startEpoch endEpoch limit lis0 ← LedgerStore.getEpochEndingLedgerInfoIter (self ^∙ ddbLedgerStore) startEpoch pagingEpoch let lis = LedgerStore.obmEELIICollect lis0 if -- genericLength lis /= (pagingEpoch^.eEpoch) - (startEpoch^.eEpoch) length lis + (startEpoch {-^∙ eEpoch-}) /= (pagingEpoch {-^∙ eEpoch-}) -- rewritten to avoid monus then Left fakeErr -- [ "DB corruption: missing epoch ending ledger info" -- , lsE startEpoch, lsE endEpoch, lsE pagingEpoch ] else pure (lis , more) {- where here t = "DiemDB":"getEpochEndingLedgerInfosImpl":t -} ------------------------------------------------------------------------------ -- impl DbReader for DiemDB getLatestLedgerInfo self = maybeS (self ^∙ ddbLedgerStore ∙ lsLatestLedgerInfo) (Left fakeErr {-["DiemDB.Lib", "getLatestLedgerInfo", "Nothing"]-}) pure getEpochEndingLedgerInfo : DiemDB → Version → Either ErrLog LedgerInfoWithSignatures getEpochEndingLedgerInfo = LedgerStore.getEpochEndingLedgerInfo ∘ _ddbLedgerStore ------------------------------------------------------------------------------ -- impl DbWriter for DiemDB -- LBFT-OBM-DIFF : entire impl module saveTransactions (self : DiemDB) {- → [TransactionToCommit] → Version-} (mliws : Maybe LedgerInfoWithSignatures) where VariantFor : ∀ {ℓ} EL → EL-func {ℓ} EL VariantFor EL = EL ErrLog DiemDB step₁ : LedgerInfoWithSignatures → VariantFor EitherD step₀ : VariantFor EitherD step₀ = maybeSD mliws (LeftD fakeErr) step₁ step₁ liws = do -- TODO-2: Make an EitherD variant of putLedgerInfo and make D version default ls ← fromEither $ LedgerStore.putLedgerInfo (self ^∙ ddbLedgerStore) liws RightD (self & ddbLedgerStore ∙~ (ls & lsLatestLedgerInfo ?~ liws)) E : VariantFor Either E = toEither step₀ D : VariantFor EitherD D = fromEither E saveTransactions = saveTransactions.D
parsers/src/main/goslin/Shorthand2020.g4
lifs-tools/jg
0
5262
<filename>parsers/src/main/goslin/Shorthand2020.g4 /* * MIT License * * Copyright (c) the authors (listed in global LICENSE file) * * 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. */ /* This is a BNF / ANTLR4 grammar for lipid subspecies identifiers following * Liebisch et al. Volume 61, Issue 12, December 2020, Pages 1539-1555. */ grammar Shorthand2020; /* first rule is always start rule */ lipid : lipid_eof EOF; lipid_eof : lipid_pure | lipid_pure adduct_info; lipid_pure : gl | pl | sl | sterol | med; /* glycero lipids, phospho lipids, sphingo lipids, sterol lipids, lipid mediators /* adduct information */ adduct_info : adduct_sep | adduct_separator adduct_sep; adduct_sep : '[M' adduct ']' charge_sign | '[M' adduct ']' charge charge_sign; adduct : adduct_set; adduct_set : adduct_element | adduct_element adduct_set; adduct_element : element | element number | number element | plus_minus element | plus_minus element number | plus_minus number element; /* mediators */ med : med_species | med_subspecies; med_species : med_hg_double headgroup_separator fatty_acyl_chain | med_hg_triple headgroup_separator fatty_acyl_chain; med_subspecies : med_hg_single headgroup_separator fatty_acyl_chain | med_hg_double headgroup_separator fatty_acyl_chain2 | med_hg_triple headgroup_separator fatty_acyl_chain3; med_hg_single : 'FA' | 'FOH' | 'FAL' | 'CAR' | 'CoA' | 'NAE' | 'NAT' | 'WD' | 'HC' | 'FAHFA'; med_hg_double : 'WE' | 'NA'; med_hg_triple : 'WD'; /* fatty acyl chain */ lcb : fa_pure | ether fa_pure | fatty_acyl_linkage | fatty_alkyl_linkage; fatty_acyl_chain : fa_pure | ether fa_pure | fatty_acyl_linkage | fatty_alkyl_linkage; fatty_alkyl_linkage : fatty_linkage_number fatty_acyl_linkage_sign ROB fatty_acyl_chain RCB | fatty_acyl_linkage_sign ROB fatty_acyl_chain RCB; fatty_acyl_linkage : fatty_linkage_number fatty_acyl_linkage_sign ROB med RCB | fatty_acyl_linkage_sign ROB med RCB; hydrocarbon_chain : hydrocarbon_number ROB fatty_acyl_chain RCB | ROB fatty_acyl_chain RCB; fatty_acyl_linkage_sign : 'O' | 'N'; fatty_linkage_number : number; hydrocarbon_number : number; fa_pure : fa_pure_structure | fa_pure_structure sn; sn : ROB 'sn-' sn_pos RCB; sn_pos : number; fa_pure_structure : fa_db_only | carbon carbon_db_separator db db_funcgroup_separator func_group | carbon carbon_db_separator db stereo_fa | carbon carbon_db_separator db stereo_fa db_funcgroup_separator func_group; fa_db_only : carbon carbon_db_separator db; ether : ether_num ether_type | ether_type; ether_num : 'm' | 'd' | 't' | 'e'; ether_type: ether_types plasmalogen_separator | ether_types plasmalogen_separator; ether_types: 'O' | 'P'; carbon : number; db : db_count | db_count db_positions; db_count : number; db_positions : ROB db_position RCB; db_position : db_single_position | db_position db_position_separator db_position; db_single_position : db_position_number | db_position_number cistrans; db_position_number : number; cistrans : 'E' | 'Z'; stereo_fa : SOB stereo_type_fa SCB; stereo_type_fa : stereo_number stereo_direction | stereo_direction; func_group : func_group_entity; func_group_entity : func_group_entity funcgroup_separator func_group_entity | func_group_data | func_group_data_repetition; func_group_data_repetition : func_group_data_repetition func_repetition_separator func_group_data_repetition | func_group_data; func_group_data : func_group_name | func_group_cycle | func_group_pos func_group_ext_name | func_group_pos func_group_ext_name stereo_fg | func_group_ext_count_name func_group_count | func_group_ext_name func_group_count stereo_fg | molecular_func_group | fatty_acyl_linkage | fatty_alkyl_linkage | hydrocarbon_chain; func_group_pos : func_group_pos_number | func_group_pos_number ring_stereo; ring_stereo : 'a' | 'b'; func_group_pos_number : number; func_group_count : number; stereo_fg : SOB stereo_type_fg SCB; stereo_type_fg : stereo_number stereo_direction | stereo_direction; stereo_number : number; stereo_direction : 'R' | 'S'; molecular_func_group : molecular_func_group_name | molecular_func_group_name func_group_count; func_group_ext_name : round_open_bracket func_group_name round_close_bracket | func_group_name; func_group_ext_count_name : round_open_bracket func_group_name round_close_bracket | molecular_func_group_name; func_group_name : 'Et' | 'Me' | 'Ac' | 'NO2' | 'My' | 'Ep' | 'OO' | 'dMe' | 'OMe' | 'oxy' | 'NH2' | 'OOH' | 'SH' | 'OH' | 'oxo' | 'CN' | 'Ph' | 'Su' | 'COOH' | 'G' | 'T' | 'COG' | 'COT' | carbohydrate | 'H' | 'Cys' | 'Phe' | 'SGlu' | 'SCys' | 'BOO' | 'MMAs' | 'SMe' | 'NH' | 'SCG' | special_elements; molecular_func_group_name : elements | special_elements; elements : 'O' | 'N' | 'P' | 'S' | 'As'; special_elements: 'Br' | 'Cl' | 'F' | 'I'; func_group_cycle : SOB cycle_base SCB | SOB cycle_base funcgroup_separator cycle_func_group_data SCB; cycle_base : cycle_def | cycle_def carbon_db_separator cycle_db; cycle_def : cycle_start cycle_separator cycle_end cycle_token cycle_number | cycle_start cycle_separator cycle_end cycle_bridge cycle_token cycle_number | cycle_bridge cycle_token cycle_number | cycle_token cycle_number; cycle_bridge : cylce_elements; cylce_elements : cylce_elements cylce_elements | cylce_element; cylce_element : elements; cycle_token : 'cy'; cycle_number : number; cycle_start : number; cycle_end : number; cycle_func_group_data : func_group_entity; cycle_db : cycle_db_cnt | cycle_db_cnt ROB cycle_db_positions RCB; cycle_db_cnt : number; cycle_db_positions : cycle_db_position; cycle_db_position : cycle_db_position db_position_separator cycle_db_position | cycle_db_position_number | cycle_db_position_number cycle_db_position_cis_trans; cycle_db_position_number : number; cycle_db_position_cis_trans : cistrans; fatty_acyl_chain2 : fa2_sorted | fa2_unsorted; fa2_unsorted : fatty_acyl_chain unsorted_fa_separator fatty_acyl_chain; fa2_sorted : fatty_acyl_chain sorted_fa_separator fatty_acyl_chain; fatty_acyl_chain3 : f3_sorted | fa3_unsorted; f3_sorted : fa2_sorted sorted_fa_separator fatty_acyl_chain; fa3_unsorted : fa2_unsorted unsorted_fa_separator fatty_acyl_chain; fatty_acyl_chain4 : f4_sorted | fa4_unsorted; f4_sorted : fa2_sorted sorted_fa_separator fa2_sorted; fa4_unsorted : fa2_unsorted unsorted_fa_separator fa2_unsorted; /* glycero lipids */ gl : gl_species | gl_subpsecies | gl_molecular_species; gl_species : gl_hg_dt headgroup_separator fatty_acyl_chain; gl_molecular_species : gl_hg_double headgroup_separator fa2_unsorted | gl_hg_triple headgroup_separator fa2_unsorted | gl_hg_single headgroup_separator fatty_acyl_chain; gl_subpsecies : gl_hg headgroup_separator fatty_acyl_chain3; gl_hg_dt : gl_hg_double | gl_hg_true_double | gl_hg_triple; gl_hg : gl_hg_single | gl_hg_double | gl_hg_true_double | gl_hg_triple; gl_hg_single : 'MG' | 'MGMG' | 'DGMG' | 'SQMG'; gl_hg_double : 'DG'; gl_hg_true_double : 'MGDG' | 'DGDG' | 'SQDG'; gl_hg_triple : 'TG'; pl : pl_species | pl_subspecies | pl_molecular_species; pl_species : pl_hg headgroup_separator fatty_acyl_chain; pl_subspecies : pl_single | pl_double | pl_quadro; pl_molecular_species : pl_hg_quadro headgroup_separator fa2_unsorted | pl_hg_quadro headgroup_separator fa3_unsorted; pl_single : pl_hg_single headgroup_separator fatty_acyl_chain; pl_full : pl_hg_single headgroup_separator fatty_acyl_chain2; pl_double : pl_full | pl_hg_double_all headgroup_separator fatty_acyl_chain2; pl_quadro : pl_hg_quadro headgroup_separator fatty_acyl_chain4; pl_hg : pl_hg_double_all | pl_hg_quadro; pl_hg_single : 'LPA' | 'LPC' | 'LPE' | 'LPG' | 'LPI' | 'LPS' | hg_lpim | 'CPA' | 'LCDPDAG' | 'LDMPE' | 'LMMPE' | 'LPIMIP' | 'LPIN' | 'PE-isoLG'; pl_hg_double_all : pl_hg_double_fa | pl_hg_double | hg_pip; pl_hg_double_fa : pl_hg_double_fa_hg ROB pl_hg_fa RCB | pl_hg_double_fa_hg ROB pl_hg_alk RCB; pl_hg_double_fa_hg : 'PS-N' | 'PE-N'; pl_hg_double : 'CDP-DAG' | 'DMPE' | 'MMPE' | 'PA' | 'PC' | 'PE' | 'PEt' | 'PG' | 'PI' | 'PS' | 'LBPA' | 'PGP' | 'PPA' | 'Glc-GP' | '6-Ac-Glc-GP' | hg_pim | 'PnC' | 'PnE' | 'PT' | 'PE-NMe2' | 'PE-NMe' | 'PIMIP' | 'CDPDAG' | 'PS-CAP' | 'PS-MDA' | 'PE-CAP' | 'PE-Glc' | 'PE-GlcA' | 'PE-GlcK' | 'PE-CM' | 'PE-CE' | 'PE-FA' | 'PE-CA' | 'PE-MDA' | 'PE-HNE' | pl_hg_species; pl_hg_species : hg_PE_PS ROB hg_PE_PS_type RCB; hg_PE_PS : 'PE-N' | 'PS-N'; hg_PE_PS_type : 'Alk' | 'FA'; pl_hg_quadro : 'BMP' | 'CL' | 'LCL' | 'DLCL'; hg_pip : hg_pip_pure_m | hg_pip_pure_d | hg_pip_pure_t | hg_pip_pure_m ROB hg_pip_m RCB | hg_pip_pure_d ROB hg_pip_d RCB | hg_pip_pure_t ROB hg_pip_t RCB; hg_pip_pure_m : 'PIP'; hg_pip_pure_d : 'PIP2'; hg_pip_pure_t : 'PIP3'; hg_pip_m : '3' APOSTROPH | '4' APOSTROPH | '5' APOSTROPH; hg_pip_d : '3' APOSTROPH COMMA '4' APOSTROPH | '4' APOSTROPH COMMA '5' APOSTROPH | '3' APOSTROPH COMMA '5' APOSTROPH; hg_pip_t : '3' APOSTROPH COMMA '4' APOSTROPH COMMA '5' APOSTROPH; hg_pim : 'PIM' hg_pim_number; hg_pim_number : number; hg_lpim : 'LPIM' hg_lpim_number; hg_lpim_number : number; pl_hg_fa : med; pl_hg_alk : fatty_acyl_chain; carbohydrate : 'Hex' | 'Gal' | 'Glc' | 'Man' | 'Neu' | 'HexNAc' | 'GalNAc' | 'GlcNAc' | 'NeuAc' | 'NeuGc' | 'Kdn' | 'GlcA' | 'Xyl' | 'Fuc' | 'NeuAc2' | 'SHex' | 'S' ROB '3' APOSTROPH RCB 'Hex' | 'NAc' | 'Nac' | 'SGal' | 'S' ROB '3' APOSTROPH RCB 'Gal' | 'HexA' | 'OGlcNAc' | 'OGlc'; sl : sl_species | sl_subspecies; sl_species : sl_hg_double headgroup_separator lcb | acer_species headgroup_separator lcb; sl_subspecies : sl_hg_single headgroup_separator lcb | sl_hg_single sl_hydroxyl headgroup_separator lcb | sl_double; sl_double : sl_hg_double headgroup_separator lcb sorted_fa_separator fatty_acyl_chain | sl_hg_double sl_hydroxyl headgroup_separator lcb sorted_fa_separator fatty_acyl_chain; sl_hydroxyl : ROB sl_hydroxyl_number RCB; sl_hydroxyl_number : number; sl_hg_single : 'SPB' | 'SPBP' | 'LIPC' | 'LSM'; sl_hg_double : acer_hg | sl_hg_double_name | carbohydrate_structural sl_hg_double | carbohydrate_isomeric sl_hg_double; carbohydrate_structural : carbohydrate; carbohydrate_isomeric : carbohydrate carbohydrate_separator; sl_hg_double_name : 'SM' | 'Cer' | 'CerP' | acer_hg | 'HexCer' | 'GlcCer' | 'GalCer' | 'Hex2Cer' | 'LacCer' | 'SHexCer' | 'IPC' | 'PI-Cer' | 'EPC' | 'PE-Cer' | 'GIPC' | 'MIPC' | 'M(IP)2C' | 'Hex3Cer' | 'S' ROB '3' APOSTROPH RCB 'HexCer' | 'S' ROB '3' APOSTROPH RCB 'GalCer'; acer_hg : acer_hg_pure ROB med RCB; acer_species : acer_hg_pure | acer_hg_pure '(FA)'; acer_hg_pure : 'ACer'; /* acer_hg : acer_hg_pure | acer_med '-' acer_hg_pure; acer_med : med; */ /* sterol lipids */ sterol : st | st_ester; st : st_hg headgroup_separator sterol_definition; st_ester : st_hg_ester headgroup_separator sterol_definition sorted_fa_separator fatty_acyl_chain | st_hg_ester headgroup_separator fatty_acyl_chain; sterol_definition : fatty_acyl_chain; st_hg : 'ST' | 'BA' | 'FC' | 'SG' | 'ASG'; st_hg_ester : 'SE' | 'CE'; /* separators */ SPACE : ' '; COLON : ':'; SEMICOLON : ';'; DASH : '-'; UNDERSCORE : '_'; SLASH : '/'; BACKSLASH : '\\'; COMMA: ','; ROB: '('; RCB: ')'; SOB: '['; SCB: ']'; APOSTROPH : '\'' | '′'; sorted_fa_separator : SLASH; adduct_separator : SPACE; unsorted_fa_separator : UNDERSCORE; plasmalogen_separator : DASH; headgroup_separator : SPACE; carbon_db_separator : COLON; cycle_separator: DASH; db_funcgroup_separator : SEMICOLON; db_position_separator : COMMA; carbohydrate_separator : DASH; funcgroup_separator : SEMICOLON; func_repetition_separator : COMMA; round_open_bracket : ROB; round_close_bracket : RCB; number : digit | digit number; digit : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'; element: 'C' | 'H' | 'N' | 'O' | 'P' | 'S' | 'Br' | 'I' | 'F' | 'Cl' | 'As'; charge : '1' | '2' | '3' | '4'; charge_sign : plus_minus; plus_minus : '-' | '+';
programs/oeis/146/A146994.asm
neoneye/loda
22
91145
<filename>programs/oeis/146/A146994.asm ; A146994: a(n) = (n+1)^2/4 + (floor((n+5)/6) - 1/4) * ((n+1) mod 2). ; 1,3,4,7,9,13,16,22,25,32,36,44,49,59,64,75,81,93,100,114,121,136,144,160,169,187,196,215,225,245,256,278,289,312,324,348,361,387,400,427,441,469,484,514,529,560,576,608,625,659,676,711,729,765,784,822,841,880,900,940,961,1003,1024,1067,1089,1133,1156,1202,1225,1272,1296,1344,1369,1419,1444,1495,1521,1573,1600,1654,1681,1736,1764,1820,1849,1907,1936,1995,2025,2085,2116,2178,2209,2272,2304,2368,2401,2467,2500,2567 mov $2,$0 add $2,1 mov $7,$0 lpb $2 mov $0,$7 sub $2,1 sub $0,$2 add $0,1 mov $4,$0 gcd $4,2 mov $6,$0 mul $6,$4 mov $3,$6 add $3,5 mul $3,2 div $3,6 mov $5,$3 sub $5,1 add $1,$5 lpe mov $0,$1
programa.asm
jhonatheberson/MIPS-architecture
0
4652
<filename>programa.asm ADDI $s1, $zero, 10 ADDI $s2, $zero, 2 ADDI $s3, $zero, 8 ADDI $s4, $zero, 6 ADD $t0, $s1, $s2 ADD $t1, $s3, $s4 SUB $s0, $t0, $t1
oeis/118/A118186.asm
neoneye/loda-programs
11
17109
<gh_stars>10-100 ; A118186: Row sums of triangle A118185: a(n) = Sum_{k=0..n} 4^(k*(n-k)) for n>=0. ; 1,2,6,34,386,8706,395266,35659778,6476038146,2336999211010,1697654543745026,2450521284684021762,7120479243447937531906,41112924905741324849774594,477847273163370530909175414786,11036166744566429554093374637604866,513084602679863723846266388208276209666,47399975241115600634318906998788751240462338,8814726354364674606625957876234345428201236332546,3257301495868819508476744972708211171047442778075168770,2422973530571877394760969854918408271749851273923331226599426 mul $0,2 seq $0,117403 ; a(n) = Sum_{k=0..floor(n/2)} 2^((n-2*k)*k) for n>=0.
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1258.asm
ljhsiun2/medusa
9
13160
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r15 push %r8 push %rcx push %rdi push %rsi lea addresses_A_ht+0x10c3b, %r15 nop sub %r12, %r12 mov $0x6162636465666768, %rsi movq %rsi, %xmm7 vmovups %ymm7, (%r15) nop nop nop nop xor $55549, %r8 lea addresses_normal_ht+0x1be3b, %rcx nop nop nop nop xor $5121, %r13 mov $0x6162636465666768, %r14 movq %r14, %xmm6 vmovups %ymm6, (%rcx) dec %rsi lea addresses_normal_ht+0x459b, %rsi lea addresses_A_ht+0x1224b, %rdi nop nop nop mfence mov $97, %rcx rep movsl nop sub %r8, %r8 lea addresses_WT_ht+0x108d3, %rsi nop nop xor $19834, %r14 vmovups (%rsi), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %r8 nop nop nop inc %r14 lea addresses_UC_ht+0x4f9b, %rsi nop nop add %r13, %r13 movups (%rsi), %xmm2 vpextrq $1, %xmm2, %rdi nop nop nop nop nop sub $5327, %r14 lea addresses_normal_ht+0x1bb3, %rsi lea addresses_UC_ht+0xff9b, %rdi nop nop sub %r15, %r15 mov $125, %rcx rep movsb nop nop nop nop inc %r14 lea addresses_normal_ht+0x11f9b, %rsi lea addresses_WC_ht+0x651b, %rdi nop nop nop and %r15, %r15 mov $66, %rcx rep movsq nop nop nop nop lfence pop %rsi pop %rdi pop %rcx pop %r8 pop %r15 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r8 push %rbp push %rdx // Load lea addresses_WT+0x1006b, %r10 nop nop nop nop nop sub %r8, %r8 mov (%r10), %r11 nop nop add %r10, %r10 // Faulty Load lea addresses_RW+0x18f9b, %r10 nop xor $53853, %rbp movups (%r10), %xmm6 vpextrq $0, %xmm6, %r11 lea oracles, %r8 and $0xff, %r11 shlq $12, %r11 mov (%r8,%r11,1), %r11 pop %rdx pop %rbp pop %r8 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_RW', 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT', 'congruent': 1}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_RW', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 1}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 4}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}} {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 3}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 11}} {'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}} {'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 9, 'type': 'addresses_normal_ht'}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
examples/symmetric_encryption/demo_ada.adb
jrmarino/libsodium-ada
10
11318
<filename>examples/symmetric_encryption/demo_ada.adb with Sodium.Functions; use Sodium.Functions; with Ada.Text_IO; use Ada.Text_IO; procedure Demo_Ada is message : constant String := "From Russia with love."; cipherlen : constant Positive := Symmetric_Cipher_Length (message); begin if not initialize_sodium_library then Put_Line ("Initialization failed"); return; end if; declare secret_key : Symmetric_Key := Random_Symmetric_Key; second_key : Symmetric_Key := Random_Symmetric_Key; first_nonce : Symmetric_Nonce := Random_Symmetric_Nonce; cipher_text : Encrypted_Data (1 .. cipherlen); clear_text : String (1 .. message'Length); begin Put_Line ("Secret Key: " & As_Hexidecimal (secret_key)); Put_Line ("Second Key: " & As_Hexidecimal (second_key)); cipher_text := Symmetric_Encrypt (clear_text => message, secret_key => secret_key, unique_nonce => first_nonce); Put_Line ("CipherText: " & As_Hexidecimal (cipher_text)); clear_text := Symmetric_Decrypt (ciphertext => cipher_text, secret_key => secret_key, unique_nonce => first_nonce); Put_Line ("Back again: " & clear_text); Put ("Let another key try to open it ... "); begin clear_text := Symmetric_Decrypt (ciphertext => cipher_text, secret_key => second_key, unique_nonce => first_nonce); exception when others => Put_Line ("That failed as expected."); end; Put_Line ("Now use the original key after slightly altering the cipher text ..."); cipher_text (10) := 'Z'; clear_text := Symmetric_Decrypt (ciphertext => cipher_text, secret_key => secret_key, unique_nonce => first_nonce); end; end Demo_Ada;
test/Succeed/Issue1351.agda
redfish64/autonomic-agda
3
14420
-- NB. This test fail if Agda is called with the --no-sharing option. module Issue1351 where open import Common.Equality open import Common.Prelude f1 : Nat → Nat f1 x = x + x f2 : Nat → Nat f2 x = f1 (f1 x) f4 : Nat → Nat f4 x = f2 (f2 x) f8 : Nat → Nat f8 x = f4 (f4 x) f16 : Nat → Nat f16 x = f8 (f8 x) f32 : Nat → Nat f32 x = f16 (f16 x) thm : f32 1 ≡ 4294967296 thm = refl
cpu/undefined_opcodes/main.asm
AntonioND/gbc-hw-tests
6
89471
<filename>cpu/undefined_opcodes/main.asm INCLUDE "hardware.inc" INCLUDE "header.inc" SECTION "Main",HOME ;-------------------------------------------------------------------------- ;- Main() - ;-------------------------------------------------------------------------- Main: ld a,$80 ld [rNR52],a ld a,$FF ld [rNR51],a ld a,$77 ld [rNR50],a ld a,$C0 ld [rNR11],a ld a,$E0 ld [rNR12],a ld a,$00 ld [rNR13],a ld a,$87 ld [rNR14],a .wait_no_press: call scan_keys ld a,[joy_held] and a,(~PAD_START)&$FF jr z,.wait_no_press ld a,[joy_held] and a,PAD_START jr nz,.start ld a,[joy_held] and a,PAD_A jr z,.pad_a1 DB $D3 .pad_a1: ld a,[joy_held] and a,PAD_B jr z,.pad_b1 DB $DB .pad_b1: ld a,[joy_held] and a,PAD_UP jr z,.pad_up1 DB $DD .pad_up1: ld a,[joy_held] and a,PAD_RIGHT jr z,.pad_ri1 DB $E3 .pad_ri1: ld a,[joy_held] and a,PAD_DOWN jr z,.pad_do1 DB $E4 .pad_do1: ld a,[joy_held] and a,PAD_LEFT jr z,.pad_le1 DB $EB .pad_le1: ld a,[joy_held] and a,PAD_SELECT jr z,.pad_sel1 DB $EC .pad_sel1: jp .end .start: ld a,[joy_held] and a,PAD_UP jr z,.pad_up2 DB $ED .pad_up2: ld a,[joy_held] and a,PAD_RIGHT jr z,.pad_ri2 DB $F4 .pad_ri2: ld a,[joy_held] and a,PAD_DOWN jr z,.pad_do2 DB $FC .pad_do2: ld a,[joy_held] and a,PAD_LEFT jr z,.pad_le2 DB $FD .pad_le2: .end: xor a,a ld [rNR10],a ld [rNR11],a ld [rNR12],a ld [rNR13],a ld [rNR14],a ld [rNR41],a ld [rNR42],a ld [rNR43],a ld [rNR44],a ld a,$C0 ld [rNR11],a ld a,$E0 ld [rNR12],a ld a,$00 ld [rNR13],a ld a,$80 ld [rNR14],a .loop: halt jr .loop
SquareRoot.asm
krawchukd/Square-Root
0
168914
## <NAME> ## 11/18/2013 ## SquareRoots ## ## Function name : sqrt ## This function calculates square roots. The function takes one parameter in register $f0 ## and returns the calculated value in register $f1 when finished. If given a negative ## value then the function will print an error message and then return a value 0 in register $f1. # Data Block # .data # Constant value zero zero: .float 0.0 # Constant value one one: .float 1.0 # Constant value two two: .float 2.0 # Error statement ; used when input value is negative. error_statement: .asciiz "\nInput value is negative!\n" # END Data Block # # Function Body # .globl sqrt .text sqrt: ## Negative Condition Test Block ## # Used Registers : # $f0 = function input # $f31 = zero (const.) l.s $f31, zero # Load register $f31 with value zero constant for comparison to input. c.lt.s $f0, $f31 # Compare input paragmeter with zero constant; if negative set flag to 1 (1 = False). bc1t error # Break to ERROR BLOCK of function if flag value is 1; else continue to Base Calculation Block. ## End N.C.T.B.## ## Base Calculation Block ## # Used registers : # $f30 = one (const.) # $f29 = two (const.) # $f2 = calculated result # $f0 = input parameter l.s $f30, one # Set register $f30 to the float value 1.0. l.s $f29, two # Set register $f29 to the float value 2.0. add.s $f2, $f0, $f30 # Represents (input + 1) div.s $f2, $f2, $f29 # Represents (input + 1) / 2 ## End B.C.B.## ## Approximation Block ## # Used Registers : # $t0 = loop counter # $f3 = result of Xsub(i - 1) / 2 # $f2 = Xsub(i-1) # $f29 = 2 # $f4 = 2 * Xsub(i - 1) # $f5 = input / ($f4) li $t0, 1 # Set counter register $t0 to the value one; used for loop constraint. approximation_loop: beq $t0, 10, end_approximation_loop # Break to end of loop after nine itterations of loop. # Note: first itteration performed in Base Calculation Block. div.s $f3, $f2, $f29 # Calculates Xsub(i - 1) / 2; places results in $f3. mul.s $f4, $f29, $f2 # Calculates 2 * Xsub(i - 1) div.s $f5, $f0, $f4 # Calculates INPUT / $f4 add.s $f2, $f3, $f5 # Calculates $f3 + $f5; Xsub(i-1) / 2 + (2 * Xsub(i - 1) addi $t0, $t0, 1 # Add one to the loop counter. j approximation_loop # Return to the begenning of the approximation_loop. end_approximation_loop: ## End Approximation Block ## mov.s $f1, $f2 # Move calculated contents from appoximation loop from $f2 to return register $f1. jr $ra # Return to caller address. sqrt_end: ## END FUNCTION BODY ## ## ERROR BLOCK ## error: l.s $f0, zero # Set return register $f0 to value 0. li $v0, 4 # Load instruction 4 into $v0; value 4 : print string instruction. la $a0, error_statement # Load address of string statement. syscall # Perform system call. jr $ra # Return to caller address. error_end: ## END ERROR BLOCK ##
oeis/320/A320283.asm
neoneye/loda-programs
11
12309
; A320283: Lexicographical ordering of pure imaginary integers in the base (-1+i) numeral system. ; Submitted by <NAME> ; 0,1,-2,-1,-4,-3,-6,-5,8,9,6,7,4,5,2,3,16,17,14,15,12,13,10,11,24,25,22,23,20,21,18,19,-32,-31,-34,-33,-36,-35,-38,-37,-24,-23,-26,-25,-28,-27,-30,-29,-16,-15,-18,-17,-20,-19,-22,-21,-8,-7,-10,-9,-12,-11,-14,-13,-64,-63,-66,-65,-68,-67,-70,-69,-56,-55,-58,-57,-60,-59,-62,-61,-48,-47,-50,-49,-52,-51,-54,-53,-40,-39,-42,-41,-44,-43,-46,-45,-96,-95,-98,-97 mul $0,2 seq $0,73791 ; Replace 4^k with (-4)^k in base 4 expansion of n. div $0,2
project4.asm
justinba1010/CSCE212
2
83603
<reponame>justinba1010/CSCE212 ### <NAME> ### 00426510 ### Project 4 ### November 8 2018 ### Dr. <NAME> .data FPNum: .word 0x0, 0xff800000, 0x7f800000 # Float-point numbers 0, -Infty and Infty string1: .asciiz "Input a Float-Point #:(0 indicates the end)\n" string2: .asciiz "\n MAX:" string3: .asciiz "\n MIN:" string4: .asciiz "\n SUM:" .text main: la $t0, FPNum lwc1 $f10, ($t0) # $f10=0.0 lwc1 $f4, ($t0) # SUM =0 lwc1 $f5, 4($t0) # MAX=-InftY lwc1 $f6, 8($t0) # MIN=Infty addi $s1, $zero, 0 # FP number counts in array # Input a number InputLoop: addi $v0, $zero, 4 # code for printing string is 4 la $a0, string1 # load address of string to be printed into $a0 syscall # call operating system addi $v0, $zero, 6 # code for reading FP number is 6 syscall # call operating system add.s $f1, $f0, $f10 # move input fp number to $f1 # Tasks: # 1) Add MIPS code to decide whether the input number is 0.0, # which indicates the end of input FP numbers and jump out of the InputLoop #(Currently there is no code to exit the loop) c.eq.s $f1, $f10 # Set flag to 1 if input = 0.0 bc1t Exit # 2) Write MIPS code here to update SUM ($f4), MAX ($f5) and MIN ($f6) add.s $f4, $f4, $f1 # Add to sum jal MAXMIN # MAX CODE addi $s1, $s1, 1 j InputLoop MAXMIN: c.lt.s $f1, $f6 # Mark flag 1 if $f1 < min bc1t MIN # Branch if flag c.lt.s $f1, $f5 # Maerk flag if $f1 < max bc1f MAX # Branch if flag = 0 jr $ra MIN: add.s $f6, $f10, $f1 # Add 0 and $f1 -< MIN jr $ra MAX: add.s $f5, $f10, $f1 # Add 0 and $f1 -> MAX jr $ra # Print out the values of MAX, MIN, and SUM Exit: addi $v0, $zero, 4 # code for printing string is 4 la $a0, string2 # load address of string to be printed into $a0 syscall # call operating system addi $v0, $zero, 2 # code for printing FP number is 2 add.s $f12, $f5, $f10 syscall # call operating system addi $v0, $zero, 4 # code for printing string is 4 la $a0, string3 # load address of string to be printed into $a0 syscall # call operating system addi $v0, $zero, 2 # code for printing FP number is 2 add.s $f12, $f6, $f10 syscall # call operating system addi $v0, $zero, 4 # code for printing string is 4 la $a0, string4 # load address of string to be printed into $a0 syscall # call operating system addi $v0, $zero, 2 # code for printing FP number is 2 add.s $f12, $f4, $f10 syscall # call operating system addi $v0, $zero, 10 syscall
oeis/142/A142648.asm
neoneye/loda-programs
11
160911
; A142648: Primes congruent to 17 mod 56. ; Submitted by <NAME> ; 17,73,241,353,409,521,577,857,1193,1249,1361,1697,1753,2089,2593,3041,3209,3433,3769,3881,4049,4217,4273,4441,4721,4889,5113,5281,5393,5449,5897,5953,6121,6569,6737,6793,6961,7129,7297,7577,8081,8641,8753,9257,9649,9817,9929,10321,10433,10601,10657,10937,10993,11161,11273,11329,11497,11777,11833,12113,12281,12841,12953,13009,13121,13177,13457,13513,13681,14633,14969,15137,15193,15361,15473,15641,15809,16033,16369,16481,16649,17041,17209,17321,17377,17489,17657,17713,17881,18049,18217,18329 mov $2,$0 pow $2,2 mov $4,16 lpb $2 mov $3,$4 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $1,$0 max $1,0 cmp $1,$0 mul $2,$1 sub $2,1 add $4,56 lpe mov $0,$4 add $0,1
bindings/gl.ads
ForYouEyesOnly/Space-Convoy
1
19740
--# - # - # - # ----------------- -- Change log: -- -- GdM : 2011 : using System.Address_To_Access_Conversions instead of Ada.Unchecked_Conversion -- GdM : 2008 : GL 1.5 items moved to GL.Extended ('cause of Windows : - () -- RK : 2007 : added CLAMP_TO_EDGE and CLAMP_TO_BORDER for texturing. -- RK : 2007 : added positive_uInt -- RK : 2007 : renamed 'intPtr' to 'intPointer' and added correct openGL intPtr type (which is a 'ptrdiff_t') -- RK : 2007 : added support for vertex buffer objects -- GdM : 2007 : added BGR, BGRA to PixelFormatEnm and TexFormatEnm (OpenGL 1.2) -- RK : 2007 : conversions to GL.Pointer -- GdM : 2006 : added MULTISAMPLE_ARB, GetString returning a String -- GdM : End 2005 : improved 2002's point 3) -- GdM : 27 - Jan - 2004 : Added Material_Float_vector and Material ( .. .) for it -- GdM : 4 - Jan - 2003 : -- for overloading names, preference is given to GL.Double -- (Gl.Float keeps 'f') and GL.Int (GL.Short keeps 's'), in order to avoid -- confusing compilers i.r.o. arithmetics with universal types. -- GdM : 11 - Apr - 2002 : -- 1) "gl" and "GL_" useless prefixes removed, -- except when conflicting with Ada keywords -- 2) improving the independance from the "pointer" model -- 3) possibility of avoiding useless "4f"- style -- suffixes through overloading --# - # - # - # ----------------- -- Changed by MB for Windows 95, 980529 -- C replaced by Stdcall, 4th parameter starts with _ if present, -- but it is not needed -- -- OpenGL 1.1 Ada binding, package GL -- -- <NAME>, NiEstu, Phoenix AZ, December 1997 -- -- Converted from Brian Paul's Mesa package GL.h header file, version 2, 5. -- As noted below in Brian's original comments, this code is distributed -- under the terms of the GNU Library General Public License. -- -- Version 0.1, 21 December 1997 -- -- -- Here are the original GL.h comments: -- -- Mesa 3 - D graphics library -- Version : 2.5 -- Copyright (C) 1995 - 1997 <NAME> -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public -- License along with this library; if not, write to the Free -- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. with Interfaces.C; with Ada.Unchecked_Conversion; with System.Address_To_Access_Conversions; package GL is package C renames Interfaces.C; ------------------------------------------------------------------------------ MESA_MAJOR_VERSION : constant := 2; MESA_MINOR_VERSION : constant := 5; VERSION_1_1 : constant := 1; EXT_BLEND_COLOR : constant := 1; EXT_BLEND_LOGIC_OP : constant := 1; EXT_BLEND_MINMAX : constant := 1; EXT_BLEND_SUBTRACT : constant := 1; EXT_POLYGON_OFFSET : constant := 1; EXT_VERTEX_ARRAY : constant := 1; EXT_TEXTURE_OBJECT : constant := 1; EXT_TEXTURE3D : constant := 1; EXT_PALETTED_TEXTURE : constant := 1; EXT_SHARED_TEXTURE_PALETTE : constant := 1; EXT_POINT_PARAMETERS : constant := 1; MESA_WINDOW_POS : constant := 1; MESA_RESIZE_BUFFERS : constant := 1; CURRENT_BIT : constant := 16#00000001#; POINT_BIT : constant := 16#00000002#; LINE_BIT : constant := 16#00000004#; POLYGON_BIT : constant := 16#00000008#; POLYGON_STIPPLE_BIT : constant := 16#00000010#; PIXEL_MODE_BIT : constant := 16#00000020#; LIGHTING_BIT : constant := 16#00000040#; FOG_BIT : constant := 16#00000080#; DEPTH_BUFFER_BIT : constant := 16#00000100#; ACCUM_BUFFER_BIT : constant := 16#00000200#; STENCIL_BUFFER_BIT : constant := 16#00000400#; VIEWPORT_BIT : constant := 16#00000800#; TRANSFORM_BIT : constant := 16#00001000#; ENABLE_BIT : constant := 16#00002000#; COLOR_BUFFER_BIT : constant := 16#00004000#; HINT_BIT : constant := 16#00008000#; EVAL_BIT : constant := 16#00010000#; LIST_BIT : constant := 16#00020000#; TEXTURE_BIT : constant := 16#00040000#; SCISSOR_BIT : constant := 16#00080000#; ALL_ATTRIB_BITS : constant := 16#000FFFFF#; CLIENT_PIXEL_STORE_BIT : constant := 16#00000001#; CLIENT_VERTEX_ARRAY_BIT : constant := 16#00000002#; CLIENT_ALL_ATTRIB_BITS : constant := 16#0000FFFF#; ------------------------------------------------------------------------------ -- Base types type Bitfield is new C.unsigned; -- 4 - byte unsigned type GL_Boolean is new C.unsigned_char; -- 1 - byte unsigned in [0, 1] type Byte is new C.char; -- 1 - byte signed type Short is new C.short; -- 2 - byte signed type Int is new C.int; -- 4 - byte signed type Ubyte is new C.unsigned_char; -- 1 - byte unsigned type Ushort is new C.unsigned_short; -- 2 - byte unsigned type Uint is new C.unsigned; -- 4 - byte unsigned type Sizei is new C.int; -- 4 - byte signed type C_Float is new C.C_float; -- single precision float type Clampf is new C.C_float; -- single precision float in [0, 1] type Double is new C.double; -- double precision float type Clampd is new C.double; -- double precision float in [0, 1] type positive_uInt is new GL.Uint range 1 .. GL.Uint'Last; package A2A_double is new System.Address_To_Access_Conversions (Double); -- Pointer types type GL_BooleanPtr is access all GL_Boolean; type bytePtr is access all Byte; type shortPtr is access all Short; type intPointer is access all Int; type ubytePtr is access all Ubyte; type ushortPtr is access all Ushort; type uintPtr is access all Uint; type floatPtr is access all GL.C_Float; type clampfPtr is access all Clampf; subtype doublePtr is A2A_double.Object_Pointer; subtype sizeiPtr is Interfaces.C.ptrdiff_t; -- used for pointer arithmetic subtype intPtr is Interfaces.C.ptrdiff_t; type pointer is access all Ubyte; -- our substitute for "void *" -- Vectors type Light_Float_vector is array (0 .. 3) of aliased GL.C_Float; type Material_Float_vector is array (0 .. 3) of aliased GL.C_Float; type Double_Vector_3D is array (0 .. 2) of aliased GL.Double; type RGB_Color is record Red, Green, Blue : GL.Double; end record; type RGBA_Color is record red, green, blue, alpha : GL.Double; end record; -- conversions to GL.Pointer type color_access is access all GL.RGB_Color; function to_Pointer is new Ada.Unchecked_Conversion (color_access, GL.pointer); subtype double_access is doublePtr; function to_Pointer is new Ada.Unchecked_Conversion (double_access, GL.pointer); type natural_access is access all Natural; function to_Pointer is new Ada.Unchecked_Conversion (natural_access, GL.pointer); function to_Pointer is new Ada.Unchecked_Conversion (uintPtr, GL.pointer); function to_Pointer is new Ada.Unchecked_Conversion (ushortPtr, GL.pointer); ------------------------------------------------------------------------------ -- GL.enum is used only for sizing of the real enumeration types type enum is new C.unsigned; -- The boolean constants GL_False : constant GL_Boolean := GL_Boolean'Val (0); GL_True : constant GL_Boolean := GL_Boolean'Val (1); -- Get pointer values type GetPointerEnm is ( FEEDBACK_BUFFER_POINTER, VERTEX_ARRAY_POINTER, NORMAL_ARRAY_POINTER, COLOR_ARRAY_POINTER, INDEX_ARRAY_POINTER, TEXTURE_COORD_ARRAY_POINTER, EDGE_FLAG_ARRAY_POINTER, SELECTION_BUFFER_POINTER ); for GetPointerEnm use ( FEEDBACK_BUFFER_POINTER => 16#0DF0#, VERTEX_ARRAY_POINTER => 16#808E#, NORMAL_ARRAY_POINTER => 16#808F#, COLOR_ARRAY_POINTER => 16#8090#, INDEX_ARRAY_POINTER => 16#8091#, TEXTURE_COORD_ARRAY_POINTER => 16#8092#, EDGE_FLAG_ARRAY_POINTER => 16#8093#, SELECTION_BUFFER_POINTER => 16#FFFF# -- fixme : Mesa 2.5 does not support!! What's the real value? ); for GetPointerEnm'Size use GL.enum'Size; procedure GetPointerv (pname : GetPointerEnm; params : GL.pointer); -- Alpha, stencil, and depth tests type FuncEnm is ( NEVER, LESS, EQUAL, LEQUAL, GREATER, NOTEQUAL, GEQUAL, ALWAYS ); for FuncEnm use ( NEVER => 16#0200#, LESS => 16#0201#, EQUAL => 16#0202#, LEQUAL => 16#0203#, GREATER => 16#0204#, NOTEQUAL => 16#0205#, GEQUAL => 16#0206#, ALWAYS => 16#0207# ); for FuncEnm'Size use GL.enum'Size; procedure Alpha_Func (func : FuncEnm; ref : GL.Clampf); procedure DepthFunc (func : FuncEnm); procedure StencilFunc (func : FuncEnm; ref : GL.Int; mask : GL.Uint); -- Stencil operations type StencilOpEnm is ( ZERO, INVERT, KEEP, REPLACE, INCR, DECR ); for StencilOpEnm use ( ZERO => 16#0000#, INVERT => 16#150A#, KEEP => 16#1E00#, REPLACE => 16#1E01#, INCR => 16#1E02#, DECR => 16#1E03# ); for StencilOpEnm'Size use GL.enum'Size; procedure StencilOp (fail : StencilOpEnm; zfail : StencilOpEnm; zpass : StencilOpEnm); -- Blending functions type BlendSrcEnm is ( ZERO, ONE, SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, DST_COLOR, ONE_MINUS_DST_COLOR, SRC_ALPHA_SATURATE, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR, CONSTANT_ALPHA, ONE_MINUS_CONSTANT_ALPHA ); for BlendSrcEnm use ( ZERO => 16#0000#, ONE => 16#0001#, SRC_ALPHA => 16#0302#, ONE_MINUS_SRC_ALPHA => 16#0303#, DST_ALPHA => 16#0304#, ONE_MINUS_DST_ALPHA => 16#0305#, DST_COLOR => 16#0306#, ONE_MINUS_DST_COLOR => 16#0307#, SRC_ALPHA_SATURATE => 16#0308#, CONSTANT_COLOR => 16#8001#, -- are these four Mesa - specific? ONE_MINUS_CONSTANT_COLOR => 16#8002#, CONSTANT_ALPHA => 16#8003#, ONE_MINUS_CONSTANT_ALPHA => 16#8004# ); for BlendSrcEnm'Size use GL.enum'Size; type BlendDstEnm is ( ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA ); for BlendDstEnm use ( ZERO => 16#0000#, ONE => 16#0001#, SRC_COLOR => 16#0300#, ONE_MINUS_SRC_COLOR => 16#0301#, SRC_ALPHA => 16#0302#, ONE_MINUS_SRC_ALPHA => 16#0303#, DST_ALPHA => 16#0304#, ONE_MINUS_DST_ALPHA => 16#0305# ); for BlendDstEnm'Size use GL.enum'Size; type BlendEquationEnm is ( LOGIC_OP, FUNC_ADD_EXT, MIN_EXT, MAX_EXT, FUNC_SUBTRACT_EXT, FUNC_REVERSE_SUBTRACT_EXT ); for BlendEquationEnm use ( LOGIC_OP => 16#0BF1#, FUNC_ADD_EXT => 16#8006#, MIN_EXT => 16#8007#, MAX_EXT => 16#8008#, FUNC_SUBTRACT_EXT => 16#800A#, FUNC_REVERSE_SUBTRACT_EXT => 16#800B# ); for BlendEquationEnm'Size use GL.enum'Size; procedure BlendFunc (sfactor : BlendSrcEnm; dfactor : BlendDstEnm); procedure BlendEquationEXT (mode : BlendEquationEnm); procedure BlendColorEXT (red : GL.Clampf; green : GL.Clampf; blue : GL.Clampf; alpha : GL.Clampf); -- Locic operation function type LogicOpEnm is ( CLEAR, GL_AND, AND_REVERSE, COPY, AND_INVERTED, NOOP, GL_XOR, GL_OR, NOR, EQUIV, INVERT, OR_REVERSE, COPY_INVERTED, OR_INVERTED, NAND, SET ); for LogicOpEnm use ( CLEAR => 16#1500#, GL_AND => 16#1501#, AND_REVERSE => 16#1502#, COPY => 16#1503#, AND_INVERTED => 16#1504#, NOOP => 16#1505#, GL_XOR => 16#1506#, GL_OR => 16#1507#, NOR => 16#1508#, EQUIV => 16#1509#, INVERT => 16#150A#, OR_REVERSE => 16#150B#, COPY_INVERTED => 16#150C#, OR_INVERTED => 16#150D#, NAND => 16#150E#, SET => 16#150F# ); for LogicOpEnm'Size use GL.enum'Size; procedure LogicOp (opcode : LogicOpEnm); -- Face culling type FaceEnm is ( FRONT, BACK, FRONT_AND_BACK ); for FaceEnm use ( FRONT => 16#0404#, BACK => 16#0405#, FRONT_AND_BACK => 16#0408# ); for FaceEnm'Size use GL.enum'Size; procedure CullFace (mode : FaceEnm); -- Polygon orientation type OrientationEnm is ( CW, CCW ); for OrientationEnm use ( CW => 16#0900#, CCW => 16#0901# ); for OrientationEnm'Size use GL.enum'Size; procedure FrontFace (mode : OrientationEnm); -- Polygon mode type PolygonModeEnm is ( POINT, LINE, FILL ); for PolygonModeEnm use ( POINT => 16#1B00#, LINE => 16#1B01#, FILL => 16#1B02# ); for PolygonModeEnm'Size use GL.enum'Size; procedure PolygonMode (face : FaceEnm; mode : PolygonModeEnm); -- Clipping plane operations type ClipPlaneEnm is ( CLIP_PLANE0, CLIP_PLANE1, CLIP_PLANE2, CLIP_PLANE3, CLIP_PLANE4, CLIP_PLANE5 ); for ClipPlaneEnm use ( CLIP_PLANE0 => 16#3000#, CLIP_PLANE1 => 16#3001#, CLIP_PLANE2 => 16#3002#, CLIP_PLANE3 => 16#3003#, CLIP_PLANE4 => 16#3004#, CLIP_PLANE5 => 16#3005# ); for ClipPlaneEnm'Size use GL.enum'Size; procedure ClipPlane (plane : ClipPlaneEnm; equation : GL.doublePtr); procedure GetClipPlane (plane : ClipPlaneEnm; equation : GL.doublePtr); -- Buffer selection type DrawBufferEnm is ( NONE, FRONT_LEFT, FRONT_RIGHT, BACK_LEFT, BACK_RIGHT, FRONT, BACK, LEFT, RIGHT, FRONT_AND_BACK, AUX0, AUX1, AUX2, AUX3 ); for DrawBufferEnm use ( NONE => 16#0000#, FRONT_LEFT => 16#0400#, FRONT_RIGHT => 16#0401#, BACK_LEFT => 16#0402#, BACK_RIGHT => 16#0403#, FRONT => 16#0404#, BACK => 16#0405#, LEFT => 16#0406#, RIGHT => 16#0407#, FRONT_AND_BACK => 16#0408#, AUX0 => 16#0409#, AUX1 => 16#040A#, AUX2 => 16#040B#, AUX3 => 16#040C# ); for DrawBufferEnm'Size use GL.enum'Size; procedure DrawBuffer (mode : DrawBufferEnm); type ReadBufferEnm is ( FRONT_LEFT, FRONT_RIGHT, BACK_LEFT, BACK_RIGHT, FRONT, BACK, LEFT, RIGHT, AUX0, AUX1, AUX2, AUX3 ); for ReadBufferEnm use ( FRONT_LEFT => 16#0400#, FRONT_RIGHT => 16#0401#, BACK_LEFT => 16#0402#, BACK_RIGHT => 16#0403#, FRONT => 16#0404#, BACK => 16#0405#, LEFT => 16#0406#, RIGHT => 16#0407#, AUX0 => 16#0409#, AUX1 => 16#040A#, AUX2 => 16#040B#, AUX3 => 16#040C# ); for ReadBufferEnm'Size use GL.enum'Size; procedure ReadBuffer (mode : ReadBufferEnm); -- Server - side capabilities type ServerCapabilityEnm is ( POINT_SMOOTH, LINE_SMOOTH, LINE_STIPPLE, POLYGON_SMOOTH, POLYGON_STIPPLE, CULL_FACE, LIGHTING, COLOR_MATERIAL, FOG, DEPTH_TEST, STENCIL_TEST, NORMALIZE, ALPHA_TEST, DITHER, BLEND, INDEX_LOGIC_OP, COLOR_LOGIC_OP, SCISSOR_TEST, TEXTURE_GEN_S, TEXTURE_GEN_T, TEXTURE_GEN_R, TEXTURE_GEN_Q, AUTO_NORMAL, MAP1_COLOR_4, MAP1_INDEX, MAP1_NORMAL, MAP1_TEXTURE_COORD_1, MAP1_TEXTURE_COORD_2, MAP1_TEXTURE_COORD_3, MAP1_TEXTURE_COORD_4, MAP1_VERTEX_3, MAP1_VERTEX_4, MAP2_COLOR_4, MAP2_INDEX, MAP2_NORMAL, MAP2_TEXTURE_COORD_1, MAP2_TEXTURE_COORD_2, MAP2_TEXTURE_COORD_3, MAP2_TEXTURE_COORD_4, MAP2_VERTEX_3, MAP2_VERTEX_4, TEXTURE_1D, TEXTURE_2D, POLYGON_OFFSET_POINT, POLYGON_OFFSET_LINE, CLIP_PLANE0, CLIP_PLANE1, CLIP_PLANE2, CLIP_PLANE3, CLIP_PLANE4, CLIP_PLANE5, LIGHT0, LIGHT1, LIGHT2, LIGHT3, LIGHT4, LIGHT5, LIGHT6, LIGHT7, POLYGON_OFFSET_FILL, TEXTURE_3D_EXT, -- ARB_multisample: MULTISAMPLE_ARB, SAMPLE_ALPHA_TO_COVERAGE_ARB, SAMPLE_ALPHA_TO_ONE_ARB, SAMPLE_COVERAGE_ARB, SAMPLE_BUFFERS_ARB, SAMPLES_ARB, SAMPLE_COVERAGE_VALUE_ARB, SAMPLE_COVERAGE_INVERT_ARB, MULTISAMPLE_BIT_ARB ); for ServerCapabilityEnm use ( POINT_SMOOTH => 16#0B10#, LINE_SMOOTH => 16#0B20#, LINE_STIPPLE => 16#0B24#, POLYGON_SMOOTH => 16#0B41#, POLYGON_STIPPLE => 16#0B42#, CULL_FACE => 16#0B44#, LIGHTING => 16#0B50#, COLOR_MATERIAL => 16#0B57#, FOG => 16#0B60#, DEPTH_TEST => 16#0B71#, STENCIL_TEST => 16#0B90#, NORMALIZE => 16#0BA1#, ALPHA_TEST => 16#0BC0#, DITHER => 16#0BD0#, BLEND => 16#0BE2#, INDEX_LOGIC_OP => 16#0BF1#, COLOR_LOGIC_OP => 16#0BF2#, SCISSOR_TEST => 16#0C11#, TEXTURE_GEN_S => 16#0C60#, TEXTURE_GEN_T => 16#0C61#, TEXTURE_GEN_R => 16#0C62#, TEXTURE_GEN_Q => 16#0C63#, AUTO_NORMAL => 16#0D80#, MAP1_COLOR_4 => 16#0D90#, MAP1_INDEX => 16#0D91#, MAP1_NORMAL => 16#0D92#, MAP1_TEXTURE_COORD_1 => 16#0D93#, MAP1_TEXTURE_COORD_2 => 16#0D94#, MAP1_TEXTURE_COORD_3 => 16#0D95#, MAP1_TEXTURE_COORD_4 => 16#0D96#, MAP1_VERTEX_3 => 16#0D97#, MAP1_VERTEX_4 => 16#0D98#, MAP2_COLOR_4 => 16#0DB0#, MAP2_INDEX => 16#0DB1#, MAP2_NORMAL => 16#0DB2#, MAP2_TEXTURE_COORD_1 => 16#0DB3#, MAP2_TEXTURE_COORD_2 => 16#0DB4#, MAP2_TEXTURE_COORD_3 => 16#0DB5#, MAP2_TEXTURE_COORD_4 => 16#0DB6#, MAP2_VERTEX_3 => 16#0DB7#, MAP2_VERTEX_4 => 16#0DB8#, TEXTURE_1D => 16#0DE0#, TEXTURE_2D => 16#0DE1#, POLYGON_OFFSET_POINT => 16#2A01#, POLYGON_OFFSET_LINE => 16#2A02#, CLIP_PLANE0 => 16#3000#, CLIP_PLANE1 => 16#3001#, CLIP_PLANE2 => 16#3002#, CLIP_PLANE3 => 16#3003#, CLIP_PLANE4 => 16#3004#, CLIP_PLANE5 => 16#3005#, LIGHT0 => 16#4000#, LIGHT1 => 16#4001#, LIGHT2 => 16#4002#, LIGHT3 => 16#4003#, LIGHT4 => 16#4004#, LIGHT5 => 16#4005#, LIGHT6 => 16#4006#, LIGHT7 => 16#4007#, POLYGON_OFFSET_FILL => 16#8037#, TEXTURE_3D_EXT => 16#806F#, MULTISAMPLE_ARB => 16#809D#, SAMPLE_ALPHA_TO_COVERAGE_ARB => 16#809E#, SAMPLE_ALPHA_TO_ONE_ARB => 16#809F#, SAMPLE_COVERAGE_ARB => 16#80A0#, SAMPLE_BUFFERS_ARB => 16#80A8#, SAMPLES_ARB => 16#80A9#, SAMPLE_COVERAGE_VALUE_ARB => 16#80AA#, SAMPLE_COVERAGE_INVERT_ARB => 16#80AB#, MULTISAMPLE_BIT_ARB => 16#20000000# ); for ServerCapabilityEnm'Size use GL.enum'Size; procedure Enable (cap : ServerCapabilityEnm); procedure Disable (cap : ServerCapabilityEnm); function IsEnabled (cap : ServerCapabilityEnm) return GL_Boolean; -- Client state type ClientCapabilityEnm is ( VERTEX_ARRAY, NORMAL_ARRAY, COLOR_ARRAY, INDEX_ARRAY, TEXTURE_COORD_ARRAY, EDGE_FLAG_ARRAY ); for ClientCapabilityEnm use ( VERTEX_ARRAY => 16#8074#, NORMAL_ARRAY => 16#8075#, COLOR_ARRAY => 16#8076#, INDEX_ARRAY => 16#8077#, TEXTURE_COORD_ARRAY => 16#8078#, EDGE_FLAG_ARRAY => 16#8079# ); for ClientCapabilityEnm'Size use GL.enum'Size; procedure Enable_Client_State (cap : ClientCapabilityEnm); procedure Disable_Client_State (cap : ClientCapabilityEnm); -- Parameter fetches type ParameterNameEnm is ( CURRENT_COLOR, CURRENT_INDEX, CURRENT_NORMAL, CURRENT_TEXTURE_COORDS, CURRENT_RASTER_COLOR, CURRENT_RASTER_INDEX, CURRENT_RASTER_TEXTURE_COORDS, CURRENT_RASTER_POSITION, CURRENT_RASTER_POSITION_VALID, CURRENT_RASTER_DISTANCE, POINT_SMOOTH, POINT_SIZE, POINT_SIZE_RANGE, POINT_SIZE_GRANULARITY, LINE_SMOOTH, LINE_WIDTH, LINE_WIDTH_RANGE, LINE_WIDTH_GRANULARITY, LINE_STIPPLE, LINE_STIPPLE_PATTERN, LINE_STIPPLE_REPEAT, LIST_MODE, MAX_LIST_NESTING, LIST_BASE, LIST_INDEX, POLYGON_MODE, POLYGON_SMOOTH, POLYGON_STIPPLE, EDGE_FLAG, CULL_FACE, CULL_FACE_MODE, FRONT_FACE, LIGHTING, LIGHT_MODEL_LOCAL_VIEWER, LIGHT_MODEL_TWO_SIDE, LIGHT_MODEL_AMBIENT, SHADE_MODEL, COLOR_MATERIAL_FACE, COLOR_MATERIAL_PARAMETER, COLOR_MATERIAL, FOG, FOG_INDEX, FOG_DENSITY, FOG_START, FOG_END, FOG_MODE, FOG_COLOR, DEPTH_RANGE, DEPTH_TEST, DEPTH_WRITEMASK, DEPTH_CLEAR_VALUE, DEPTH_FUNC, ACCUM_CLEAR_VALUE, STENCIL_TEST, STENCIL_CLEAR_VALUE, STENCIL_FUNC, STENCIL_VALUE_MASK, STENCIL_FAIL, STENCIL_PASS_DEPTH_FAIL, STENCIL_PASS_DEPTH_PASS, STENCIL_REF, STENCIL_WRITEMASK, MATRIX_MODE, NORMALIZE, VIEWPORT, MODELVIEW_STACK_DEPTH, PROJECTION_STACK_DEPTH, TEXTURE_STACK_DEPTH, MODELVIEW_MATRIX, PROJECTION_MATRIX, TEXTURE_MATRIX, ATTRIB_STACK_DEPTH, CLIENT_ATTRIB_STACK_DEPTH, ALPHA_TEST, ALPHA_TEST_FUNC, ALPHA_TEST_REF, DITHER, BLEND_DST, BLEND_SRC, BLEND, LOGIC_OP_MODE, INDEX_LOGIC_OP, COLOR_LOGIC_OP, AUX_BUFFERS, DRAW_BUFFER, READ_BUFFER, SCISSOR_BOX, SCISSOR_TEST, INDEX_CLEAR_VALUE, INDEX_WRITEMASK, COLOR_CLEAR_VALUE, COLOR_WRITEMASK, INDEX_MODE, RGBA_MODE, DOUBLEBUFFER, STEREO, RENDER_MODE, PERSPECTIVE_CORRECTION_HINT, POINT_SMOOTH_HINT, LINE_SMOOTH_HINT, POLYGON_SMOOTH_HINT, FOG_HINT, TEXTURE_GEN_S, TEXTURE_GEN_T, TEXTURE_GEN_R, TEXTURE_GEN_Q, PIXEL_MAP_I_TO_I_SIZE, PIXEL_MAP_S_TO_S_SIZE, PIXEL_MAP_I_TO_R_SIZE, PIXEL_MAP_I_TO_G_SIZE, PIXEL_MAP_I_TO_B_SIZE, PIXEL_MAP_I_TO_A_SIZE, PIXEL_MAP_R_TO_R_SIZE, PIXEL_MAP_G_TO_G_SIZE, PIXEL_MAP_B_TO_B_SIZE, PIXEL_MAP_A_TO_A_SIZE, UNPACK_SWAP_BYTES, UNPACK_LSB_FIRST, UNPACK_ROW_LENGTH, UNPACK_SKIP_ROWS, UNPACK_SKIP_PIXELS, UNPACK_ALIGNMENT, PACK_SWAP_BYTES, PACK_LSB_FIRST, PACK_ROW_LENGTH, PACK_SKIP_ROWS, PACK_SKIP_PIXELS, PACK_ALIGNMENT, MAP_COLOR, MAP_STENCIL, INDEX_SHIFT, INDEX_OFFSET, RED_SCALE, RED_BIAS, ZOOM_X, ZOOM_Y, GREEN_SCALE, GREEN_BIAS, BLUE_SCALE, BLUE_BIAS, ALPHA_SCALE, ALPHA_BIAS, DEPTH_SCALE, DEPTH_BIAS, MAX_EVAL_ORDER, MAX_LIGHTS, MAX_CLIP_PLANES, MAX_TEXTURE_SIZE, MAX_PIXEL_MAP_TABLE, MAX_ATTRIB_STACK_DEPTH, MAX_MODELVIEW_STACK_DEPTH, MAX_NAME_STACK_DEPTH, MAX_PROJECTION_STACK_DEPTH, MAX_TEXTURE_STACK_DEPTH, MAX_VIEWPORT_DIMS, MAX_CLIENT_ATTRIB_STACK_DEPTH, SUBPIXEL_BITS, INDEX_BITS, RED_BITS, GREEN_BITS, BLUE_BITS, ALPHA_BITS, DEPTH_BITS, STENCIL_BITS, ACCUM_RED_BITS, ACCUM_GREEN_BITS, ACCUM_BLUE_BITS, ACCUM_ALPHA_BITS, NAME_STACK_DEPTH, AUTO_NORMAL, MAP1_COLOR_4, MAP1_INDEX, MAP1_NORMAL, MAP1_TEXTURE_COORD_1, MAP1_TEXTURE_COORD_2, MAP1_TEXTURE_COORD_3, MAP1_TEXTURE_COORD_4, MAP1_VERTEX_3, MAP1_VERTEX_4, MAP2_COLOR_4, MAP2_INDEX, MAP2_NORMAL, MAP2_TEXTURE_COORD_1, MAP2_TEXTURE_COORD_2, MAP2_TEXTURE_COORD_3, MAP2_TEXTURE_COORD_4, MAP2_VERTEX_3, MAP2_VERTEX_4, MAP1_GRID_DOMAIN, MAP1_GRID_SEGMENTS, MAP2_GRID_DOMAIN, MAP2_GRID_SEGMENTS, TEXTURE_1D, TEXTURE_2D, POLYGON_OFFSET_UNITS, POLYGON_OFFSET_POINT, POLYGON_OFFSET_LINE, POLYGON_OFFSET_FILL, POLYGON_OFFSET_FACTOR, TEXTURE_BINDING_1D, TEXTURE_BINDING_2D, VERTEX_ARRAY, NORMAL_ARRAY, COLOR_ARRAY, INDEX_ARRAY, TEXTURE_COORD_ARRAY, EDGE_FLAG_ARRAY, VERTEX_ARRAY_SIZE, VERTEX_ARRAY_TYPE, VERTEX_ARRAY_STRIDE, NORMAL_ARRAY_TYPE, NORMAL_ARRAY_STRIDE, COLOR_ARRAY_SIZE, COLOR_ARRAY_TYPE, COLOR_ARRAY_STRIDE, INDEX_ARRAY_TYPE, INDEX_ARRAY_STRIDE, TEXTURE_COORD_ARRAY_SIZE, TEXTURE_COORD_ARRAY_TYPE, TEXTURE_COORD_ARRAY_STRIDE, EDGE_FLAG_ARRAY_STRIDE, SAMPLES ); for ParameterNameEnm use ( CURRENT_COLOR => 16#0B00#, CURRENT_INDEX => 16#0B01#, CURRENT_NORMAL => 16#0B02#, CURRENT_TEXTURE_COORDS => 16#0B03#, CURRENT_RASTER_COLOR => 16#0B04#, CURRENT_RASTER_INDEX => 16#0B05#, CURRENT_RASTER_TEXTURE_COORDS => 16#0B06#, CURRENT_RASTER_POSITION => 16#0B07#, CURRENT_RASTER_POSITION_VALID => 16#0B08#, CURRENT_RASTER_DISTANCE => 16#0B09#, POINT_SMOOTH => 16#0B10#, POINT_SIZE => 16#0B11#, POINT_SIZE_RANGE => 16#0B12#, POINT_SIZE_GRANULARITY => 16#0B13#, LINE_SMOOTH => 16#0B20#, LINE_WIDTH => 16#0B21#, LINE_WIDTH_RANGE => 16#0B22#, LINE_WIDTH_GRANULARITY => 16#0B23#, LINE_STIPPLE => 16#0B24#, LINE_STIPPLE_PATTERN => 16#0B25#, LINE_STIPPLE_REPEAT => 16#0B26#, LIST_MODE => 16#0B30#, MAX_LIST_NESTING => 16#0B31#, LIST_BASE => 16#0B32#, LIST_INDEX => 16#0B33#, POLYGON_MODE => 16#0B40#, POLYGON_SMOOTH => 16#0B41#, POLYGON_STIPPLE => 16#0B42#, EDGE_FLAG => 16#0B43#, CULL_FACE => 16#0B44#, CULL_FACE_MODE => 16#0B45#, FRONT_FACE => 16#0B46#, LIGHTING => 16#0B50#, LIGHT_MODEL_LOCAL_VIEWER => 16#0B51#, LIGHT_MODEL_TWO_SIDE => 16#0B52#, LIGHT_MODEL_AMBIENT => 16#0B53#, SHADE_MODEL => 16#0B54#, COLOR_MATERIAL_FACE => 16#0B55#, COLOR_MATERIAL_PARAMETER => 16#0B56#, COLOR_MATERIAL => 16#0B57#, FOG => 16#0B60#, FOG_INDEX => 16#0B61#, FOG_DENSITY => 16#0B62#, FOG_START => 16#0B63#, FOG_END => 16#0B64#, FOG_MODE => 16#0B65#, FOG_COLOR => 16#0B66#, DEPTH_RANGE => 16#0B70#, DEPTH_TEST => 16#0B71#, DEPTH_WRITEMASK => 16#0B72#, DEPTH_CLEAR_VALUE => 16#0B73#, DEPTH_FUNC => 16#0B74#, ACCUM_CLEAR_VALUE => 16#0B80#, STENCIL_TEST => 16#0B90#, STENCIL_CLEAR_VALUE => 16#0B91#, STENCIL_FUNC => 16#0B92#, STENCIL_VALUE_MASK => 16#0B93#, STENCIL_FAIL => 16#0B94#, STENCIL_PASS_DEPTH_FAIL => 16#0B95#, STENCIL_PASS_DEPTH_PASS => 16#0B96#, STENCIL_REF => 16#0B97#, STENCIL_WRITEMASK => 16#0B98#, MATRIX_MODE => 16#0BA0#, NORMALIZE => 16#0BA1#, VIEWPORT => 16#0BA2#, MODELVIEW_STACK_DEPTH => 16#0BA3#, PROJECTION_STACK_DEPTH => 16#0BA4#, TEXTURE_STACK_DEPTH => 16#0BA5#, MODELVIEW_MATRIX => 16#0BA6#, PROJECTION_MATRIX => 16#0BA7#, TEXTURE_MATRIX => 16#0BA8#, ATTRIB_STACK_DEPTH => 16#0BB0#, CLIENT_ATTRIB_STACK_DEPTH => 16#0BB1#, ALPHA_TEST => 16#0BC0#, ALPHA_TEST_FUNC => 16#0BC1#, ALPHA_TEST_REF => 16#0BC2#, DITHER => 16#0BD0#, BLEND_DST => 16#0BE0#, BLEND_SRC => 16#0BE1#, BLEND => 16#0BE2#, LOGIC_OP_MODE => 16#0BF0#, INDEX_LOGIC_OP => 16#0BF1#, COLOR_LOGIC_OP => 16#0BF2#, AUX_BUFFERS => 16#0C00#, DRAW_BUFFER => 16#0C01#, READ_BUFFER => 16#0C02#, SCISSOR_BOX => 16#0C10#, SCISSOR_TEST => 16#0C11#, INDEX_CLEAR_VALUE => 16#0C20#, INDEX_WRITEMASK => 16#0C21#, COLOR_CLEAR_VALUE => 16#0C22#, COLOR_WRITEMASK => 16#0C23#, INDEX_MODE => 16#0C30#, RGBA_MODE => 16#0C31#, DOUBLEBUFFER => 16#0C32#, STEREO => 16#0C33#, RENDER_MODE => 16#0C40#, PERSPECTIVE_CORRECTION_HINT => 16#0C50#, POINT_SMOOTH_HINT => 16#0C51#, LINE_SMOOTH_HINT => 16#0C52#, POLYGON_SMOOTH_HINT => 16#0C53#, FOG_HINT => 16#0C54#, TEXTURE_GEN_S => 16#0C60#, TEXTURE_GEN_T => 16#0C61#, TEXTURE_GEN_R => 16#0C62#, TEXTURE_GEN_Q => 16#0C63#, PIXEL_MAP_I_TO_I_SIZE => 16#0CB0#, PIXEL_MAP_S_TO_S_SIZE => 16#0CB1#, PIXEL_MAP_I_TO_R_SIZE => 16#0CB2#, PIXEL_MAP_I_TO_G_SIZE => 16#0CB3#, PIXEL_MAP_I_TO_B_SIZE => 16#0CB4#, PIXEL_MAP_I_TO_A_SIZE => 16#0CB5#, PIXEL_MAP_R_TO_R_SIZE => 16#0CB6#, PIXEL_MAP_G_TO_G_SIZE => 16#0CB7#, PIXEL_MAP_B_TO_B_SIZE => 16#0CB8#, PIXEL_MAP_A_TO_A_SIZE => 16#0CB9#, UNPACK_SWAP_BYTES => 16#0CF0#, UNPACK_LSB_FIRST => 16#0CF1#, UNPACK_ROW_LENGTH => 16#0CF2#, UNPACK_SKIP_ROWS => 16#0CF3#, UNPACK_SKIP_PIXELS => 16#0CF4#, UNPACK_ALIGNMENT => 16#0CF5#, PACK_SWAP_BYTES => 16#0D00#, PACK_LSB_FIRST => 16#0D01#, PACK_ROW_LENGTH => 16#0D02#, PACK_SKIP_ROWS => 16#0D03#, PACK_SKIP_PIXELS => 16#0D04#, PACK_ALIGNMENT => 16#0D05#, MAP_COLOR => 16#0D10#, MAP_STENCIL => 16#0D11#, INDEX_SHIFT => 16#0D12#, INDEX_OFFSET => 16#0D13#, RED_SCALE => 16#0D14#, RED_BIAS => 16#0D15#, ZOOM_X => 16#0D16#, ZOOM_Y => 16#0D17#, GREEN_SCALE => 16#0D18#, GREEN_BIAS => 16#0D19#, BLUE_SCALE => 16#0D1A#, BLUE_BIAS => 16#0D1B#, ALPHA_SCALE => 16#0D1C#, ALPHA_BIAS => 16#0D1D#, DEPTH_SCALE => 16#0D1E#, DEPTH_BIAS => 16#0D1F#, MAX_EVAL_ORDER => 16#0D30#, MAX_LIGHTS => 16#0D31#, MAX_CLIP_PLANES => 16#0D32#, MAX_TEXTURE_SIZE => 16#0D33#, MAX_PIXEL_MAP_TABLE => 16#0D34#, MAX_ATTRIB_STACK_DEPTH => 16#0D35#, MAX_MODELVIEW_STACK_DEPTH => 16#0D36#, MAX_NAME_STACK_DEPTH => 16#0D37#, MAX_PROJECTION_STACK_DEPTH => 16#0D38#, MAX_TEXTURE_STACK_DEPTH => 16#0D39#, MAX_VIEWPORT_DIMS => 16#0D3A#, MAX_CLIENT_ATTRIB_STACK_DEPTH => 16#0D3B#, SUBPIXEL_BITS => 16#0D50#, INDEX_BITS => 16#0D51#, RED_BITS => 16#0D52#, GREEN_BITS => 16#0D53#, BLUE_BITS => 16#0D54#, ALPHA_BITS => 16#0D55#, DEPTH_BITS => 16#0D56#, STENCIL_BITS => 16#0D57#, ACCUM_RED_BITS => 16#0D58#, ACCUM_GREEN_BITS => 16#0D59#, ACCUM_BLUE_BITS => 16#0D5A#, ACCUM_ALPHA_BITS => 16#0D5B#, NAME_STACK_DEPTH => 16#0D70#, AUTO_NORMAL => 16#0D80#, MAP1_COLOR_4 => 16#0D90#, MAP1_INDEX => 16#0D91#, MAP1_NORMAL => 16#0D92#, MAP1_TEXTURE_COORD_1 => 16#0D93#, MAP1_TEXTURE_COORD_2 => 16#0D94#, MAP1_TEXTURE_COORD_3 => 16#0D95#, MAP1_TEXTURE_COORD_4 => 16#0D96#, MAP1_VERTEX_3 => 16#0D97#, MAP1_VERTEX_4 => 16#0D98#, MAP2_COLOR_4 => 16#0DB0#, MAP2_INDEX => 16#0DB1#, MAP2_NORMAL => 16#0DB2#, MAP2_TEXTURE_COORD_1 => 16#0DB3#, MAP2_TEXTURE_COORD_2 => 16#0DB4#, MAP2_TEXTURE_COORD_3 => 16#0DB5#, MAP2_TEXTURE_COORD_4 => 16#0DB6#, MAP2_VERTEX_3 => 16#0DB7#, MAP2_VERTEX_4 => 16#0DB8#, MAP1_GRID_DOMAIN => 16#0DD0#, MAP1_GRID_SEGMENTS => 16#0DD1#, MAP2_GRID_DOMAIN => 16#0DD2#, MAP2_GRID_SEGMENTS => 16#0DD3#, TEXTURE_1D => 16#0DE0#, TEXTURE_2D => 16#0DE1#, POLYGON_OFFSET_UNITS => 16#2A00#, POLYGON_OFFSET_POINT => 16#2A01#, POLYGON_OFFSET_LINE => 16#2A02#, POLYGON_OFFSET_FILL => 16#8037#, POLYGON_OFFSET_FACTOR => 16#8038#, TEXTURE_BINDING_1D => 16#8068#, TEXTURE_BINDING_2D => 16#8069#, VERTEX_ARRAY => 16#8074#, NORMAL_ARRAY => 16#8075#, COLOR_ARRAY => 16#8076#, INDEX_ARRAY => 16#8077#, TEXTURE_COORD_ARRAY => 16#8078#, EDGE_FLAG_ARRAY => 16#8079#, VERTEX_ARRAY_SIZE => 16#807A#, VERTEX_ARRAY_TYPE => 16#807B#, VERTEX_ARRAY_STRIDE => 16#807C#, NORMAL_ARRAY_TYPE => 16#807E#, NORMAL_ARRAY_STRIDE => 16#807F#, COLOR_ARRAY_SIZE => 16#8081#, COLOR_ARRAY_TYPE => 16#8082#, COLOR_ARRAY_STRIDE => 16#8083#, INDEX_ARRAY_TYPE => 16#8085#, INDEX_ARRAY_STRIDE => 16#8086#, TEXTURE_COORD_ARRAY_SIZE => 16#8088#, TEXTURE_COORD_ARRAY_TYPE => 16#8089#, TEXTURE_COORD_ARRAY_STRIDE => 16#808A#, EDGE_FLAG_ARRAY_STRIDE => 16#808C#, SAMPLES => 16#80A9# ); for ParameterNameEnm'Size use GL.enum'Size; procedure GetBooleanv (pname : ParameterNameEnm; params : GL_BooleanPtr); procedure Get (pname : ParameterNameEnm; params : GL.doublePtr); procedure GetFloatv (pname : ParameterNameEnm; params : floatPtr); procedure GetIntegerv (pname : ParameterNameEnm; params : GL.intPointer); -- Render mode type RenderModeEnm is ( RENDER, FEEDBACK, GL_SELECT ); for RenderModeEnm use ( RENDER => 16#1C00#, FEEDBACK => 16#1C01#, GL_SELECT => 16#1C02# ); for RenderModeEnm'Size use GL.enum'Size; function RenderMode (mode : RenderModeEnm) return GL.Int; -- Error information type ErrorEnm is ( NO_ERROR, INVALID_ENUM, INVALID_VALUE, INVALID_OPERATION, STACK_OVERFLOW, STACK_UNDERFLOW, OUT_OF_MEMORY ); for ErrorEnm use ( NO_ERROR => 16#0000#, INVALID_ENUM => 16#0500#, INVALID_VALUE => 16#0501#, INVALID_OPERATION => 16#0502#, STACK_OVERFLOW => 16#0503#, STACK_UNDERFLOW => 16#0504#, OUT_OF_MEMORY => 16#0505# ); for ErrorEnm'Size use GL.enum'Size; function Get_Error return ErrorEnm; -- Connection description type StringEnm is ( VENDOR, RENDERER, VERSION, EXTENSIONS ); for StringEnm use ( VENDOR => 16#1F00#, RENDERER => 16#1F01#, VERSION => 16#1F02#, EXTENSIONS => 16#1F03# ); for StringEnm'Size use GL.enum'Size; function GetString (name : StringEnm) return ubytePtr; function GetString (name : StringEnm) return String; -- Behavior hints type HintEnm is ( PERSPECTIVE_CORRECTION_HINT, POINT_SMOOTH_HINT, LINE_SMOOTH_HINT, POLYGON_SMOOTH_HINT, FOG_HINT ); for HintEnm use ( PERSPECTIVE_CORRECTION_HINT => 16#0C50#, POINT_SMOOTH_HINT => 16#0C51#, LINE_SMOOTH_HINT => 16#0C52#, POLYGON_SMOOTH_HINT => 16#0C53#, FOG_HINT => 16#0C54# ); for HintEnm'Size use GL.enum'Size; type HintModeEnm is ( DONT_CARE, FASTEST, NICEST ); for HintModeEnm use ( DONT_CARE => 16#1100#, FASTEST => 16#1101#, NICEST => 16#1102# ); for HintModeEnm'Size use GL.enum'Size; procedure Hint (target : HintEnm; mode : HintModeEnm); -- Accumulation buffer type AccumEnm is ( ACCUM, LOAD, GL_RETURN, MULT, ADD ); for AccumEnm use ( ACCUM => 16#0100#, LOAD => 16#0101#, GL_RETURN => 16#0102#, MULT => 16#0103#, ADD => 16#0104# ); for AccumEnm'Size use GL.enum'Size; procedure Accum (op : AccumEnm; value : GL.C_Float); -- Matrix mode type MatrixModeEnm is ( MODELVIEW, PROJECTION, TEXTURE ); for MatrixModeEnm use ( MODELVIEW => 16#1700#, PROJECTION => 16#1701#, TEXTURE => 16#1702# ); for MatrixModeEnm'Size use GL.enum'Size; procedure MatrixMode (mode : MatrixModeEnm); -- Display liststype ListModeEnm is type ListModeEnm is ( COMPILE, COMPILE_AND_EXECUTE ); for ListModeEnm use ( COMPILE => 16#1300#, COMPILE_AND_EXECUTE => 16#1301# ); for ListModeEnm'Size use GL.enum'Size; type OffsetTypeEnm is ( GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT, GL_FLOAT, GL_2_BYTES, GL_3_BYTES, GL_4_BYTES ); for OffsetTypeEnm use ( GL_BYTE => 16#1400#, GL_UNSIGNED_BYTE => 16#1401#, GL_SHORT => 16#1402#, GL_UNSIGNED_SHORT => 16#1403#, GL_INT => 16#1404#, GL_UNSIGNED_INT => 16#1405#, GL_FLOAT => 16#1406#, GL_2_BYTES => 16#1407#, GL_3_BYTES => 16#1408#, GL_4_BYTES => 16#1409# ); for OffsetTypeEnm'Size use GL.enum'Size; function IsList (list : GL.Uint) return GL_Boolean; procedure DeleteLists (list : GL.Uint; c_range : GL.Sizei); function GenLists (c_range : GL.Sizei) return GL.Uint; procedure NewList (list : GL.Uint; mode : ListModeEnm); procedure EndList; procedure CallList (list : GL.Uint); procedure CallLists (n : GL.Sizei; c_type : OffsetTypeEnm; lists : GL.pointer); procedure ListBase (base : GL.Uint); -- Object definition type ObjectTypeEnm is ( POINTS, LINES, LINE_LOOP, LINE_STRIP, TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN, QUADS, QUAD_STRIP, POLYGON ); pragma Ordered (ObjectTypeEnm); for ObjectTypeEnm use ( POINTS => 16#0000#, LINES => 16#0001#, LINE_LOOP => 16#0002#, LINE_STRIP => 16#0003#, TRIANGLES => 16#0004#, TRIANGLE_STRIP => 16#0005#, TRIANGLE_FAN => 16#0006#, QUADS => 16#0007#, QUAD_STRIP => 16#0008#, POLYGON => 16#0009# ); for ObjectTypeEnm'Size use GL.enum'Size; procedure GL_Begin (mode : ObjectTypeEnm); procedure GL_End; -- Vertex arrays and related type VertexTypeEnm is ( GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE ); for VertexTypeEnm use ( GL_SHORT => 16#1402#, GL_INT => 16#1404#, GL_FLOAT => 16#1406#, GL_DOUBLE => 16#140A# ); for VertexTypeEnm'Size use GL.enum'Size; type NormalTypeEnm is ( GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE ); for NormalTypeEnm use ( GL_BYTE => 16#1400#, GL_SHORT => 16#1402#, GL_INT => 16#1404#, GL_FLOAT => 16#1406#, GL_DOUBLE => 16#140A# ); for NormalTypeEnm'Size use GL.enum'Size; type ColorTypeEnm is ( GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT, GL_FLOAT, GL_DOUBLE ); for ColorTypeEnm use ( GL_BYTE => 16#1400#, GL_UNSIGNED_BYTE => 16#1401#, GL_SHORT => 16#1402#, GL_UNSIGNED_SHORT => 16#1403#, GL_INT => 16#1404#, GL_UNSIGNED_INT => 16#1405#, GL_FLOAT => 16#1406#, GL_DOUBLE => 16#140A# ); for ColorTypeEnm'Size use GL.enum'Size; type IndexTypeEnm is ( GL_UNSIGNED_BYTE, GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE ); for IndexTypeEnm use ( GL_UNSIGNED_BYTE => 16#1401#, GL_SHORT => 16#1402#, GL_INT => 16#1404#, GL_FLOAT => 16#1406#, GL_DOUBLE => 16#140A# ); for IndexTypeEnm'Size use GL.enum'Size; type TexCoordTypeEnm is ( GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE ); for TexCoordTypeEnm use ( GL_SHORT => 16#1402#, GL_INT => 16#1404#, GL_FLOAT => 16#1406#, GL_DOUBLE => 16#140A# ); for TexCoordTypeEnm'Size use GL.enum'Size; type ArrayIndexTypeEnm is ( UNSIGNED_BYTE, UNSIGNED_SHORT, UNSIGNED_INT ); for ArrayIndexTypeEnm use ( UNSIGNED_BYTE => 16#1401#, UNSIGNED_SHORT => 16#1403#, UNSIGNED_INT => 16#1405# ); for ArrayIndexTypeEnm'Size use GL.enum'Size; type InterleaveFormatEnm is ( V2F, V3F, C4UB_V2F, C4UB_V3F, C3F_V3F, N3F_V3F, C4F_N3F_V3F, T2F_V3F, T4F_V4F, T2F_C4UB_V3F, T2F_C3F_V3F, T2F_N3F_V3F, T2F_C4F_N3F_V3F, T4F_C4F_N3F_V4F ); for InterleaveFormatEnm use ( V2F => 16#2A20#, V3F => 16#2A21#, C4UB_V2F => 16#2A22#, C4UB_V3F => 16#2A23#, C3F_V3F => 16#2A24#, N3F_V3F => 16#2A25#, C4F_N3F_V3F => 16#2A26#, T2F_V3F => 16#2A27#, T4F_V4F => 16#2A28#, T2F_C4UB_V3F => 16#2A29#, T2F_C3F_V3F => 16#2A2A#, T2F_N3F_V3F => 16#2A2B#, T2F_C4F_N3F_V3F => 16#2A2C#, T4F_C4F_N3F_V4F => 16#2A2D# ); for InterleaveFormatEnm'Size use GL.enum'Size; procedure VertexPointer (size : GL.Int; c_type : VertexTypeEnm; stride : GL.Sizei; ptr : GL.pointer); procedure Normal_Pointer (c_type : NormalTypeEnm; stride : GL.Sizei; ptr : GL.pointer); procedure ColorPointer (size : GL.Int; c_type : ColorTypeEnm; stride : GL.Sizei; ptr : GL.pointer); procedure IndexPointer (c_type : IndexTypeEnm; stride : GL.Sizei; ptr : GL.pointer); procedure Tex_Coord_Pointer (size : GL.Int; c_type : TexCoordTypeEnm; stride : GL.Sizei; ptr : GL.pointer); procedure EdgeFlagPointer (stride : GL.Sizei; ptr : GL_BooleanPtr); procedure ArrayElement (i : GL.Int); procedure DrawArrays (mode : ObjectTypeEnm; first : GL.Int; count : GL.Sizei); procedure DrawElements (mode : ObjectTypeEnm; count : GL.Sizei; c_type : ArrayIndexTypeEnm; indices : GL.pointer); procedure interleavedArrays (format : InterleaveFormatEnm; stride : GL.Sizei; ptr : GL.pointer); -- Shading model type ShadeModeEnm is ( FLAT, SMOOTH ); for ShadeModeEnm use ( FLAT => 16#1D00#, SMOOTH => 16#1D01# ); for ShadeModeEnm'Size use GL.enum'Size; procedure ShadeModel (mode : ShadeModeEnm); -- Lighting type LightIDEnm is ( LIGHT0, LIGHT1, LIGHT2, LIGHT3, LIGHT4, LIGHT5, LIGHT6, LIGHT7 ); for LightIDEnm use ( LIGHT0 => 16#4000#, LIGHT1 => 16#4001#, LIGHT2 => 16#4002#, LIGHT3 => 16#4003#, LIGHT4 => 16#4004#, LIGHT5 => 16#4005#, LIGHT6 => 16#4006#, LIGHT7 => 16#4007# ); for LightIDEnm'Size use GL.enum'Size; type LightParameterEnm is ( SPOT_EXPONENT, SPOT_CUTOFF, CONSTANT_ATTENUATION, LINEAR_ATTENUATION, QUADRATIC_ATTENUATION ); for LightParameterEnm use ( SPOT_EXPONENT => 16#1205#, SPOT_CUTOFF => 16#1206#, CONSTANT_ATTENUATION => 16#1207#, LINEAR_ATTENUATION => 16#1208#, QUADRATIC_ATTENUATION => 16#1209# ); for LightParameterEnm'Size use GL.enum'Size; type LightParameterVEnm is ( AMBIENT, DIFFUSE, SPECULAR, POSITION, SPOT_DIRECTION, SPOT_EXPONENT, SPOT_CUTOFF, CONSTANT_ATTENUATION, LINEAR_ATTENUATION, QUADRATIC_ATTENUATION ); for LightParameterVEnm use ( AMBIENT => 16#1200#, DIFFUSE => 16#1201#, SPECULAR => 16#1202#, POSITION => 16#1203#, SPOT_DIRECTION => 16#1204#, SPOT_EXPONENT => 16#1205#, SPOT_CUTOFF => 16#1206#, CONSTANT_ATTENUATION => 16#1207#, LINEAR_ATTENUATION => 16#1208#, QUADRATIC_ATTENUATION => 16#1209# ); for LightParameterVEnm'Size use GL.enum'Size; type LightModelEnm is ( LIGHT_MODEL_LOCAL_VIEWER, LIGHT_MODEL_TWO_SIDE ); for LightModelEnm use ( LIGHT_MODEL_LOCAL_VIEWER => 16#0B51#, LIGHT_MODEL_TWO_SIDE => 16#0B52# ); for LightModelEnm'Size use GL.enum'Size; type LightModelVEnm is ( LIGHT_MODEL_LOCAL_VIEWER, LIGHT_MODEL_TWO_SIDE, LIGHT_MODEL_AMBIENT ); for LightModelVEnm use ( LIGHT_MODEL_LOCAL_VIEWER => 16#0B51#, LIGHT_MODEL_TWO_SIDE => 16#0B52#, LIGHT_MODEL_AMBIENT => 16#0B53# ); for LightModelVEnm'Size use GL.enum'Size; procedure Light (light_id : LightIDEnm; pname : LightParameterEnm; param : GL.C_Float); procedure Lighti (light_id : LightIDEnm; pname : LightParameterEnm; param : GL.Int); procedure Light (Light_id : LightIDEnm; pname : LightParameterVEnm; params : Light_Float_vector); procedure Lightiv (light_id : LightIDEnm; pname : LightParameterVEnm; params : GL.intPointer); procedure GetLightfv (light_id : LightIDEnm; pname : LightParameterVEnm; params : floatPtr); procedure GetLightiv (light_id : LightIDEnm; pname : LightParameterVEnm; params : GL.intPointer); procedure LightModelf (pname : LightModelEnm; param : GL.C_Float); procedure LightModeli (pname : LightModelEnm; param : GL.Int); procedure LightModelfv (pname : LightModelVEnm; params : floatPtr); procedure LightModeliv (pname : LightModelVEnm; params : GL.intPointer); -- Materials type MaterialParameterEnm is ( SHININESS ); for MaterialParameterEnm use ( SHININESS => 16#1601# ); for MaterialParameterEnm'Size use GL.enum'Size; type MaterialParameterVEnm is ( AMBIENT, DIFFUSE, SPECULAR, EMISSION, SHININESS, AMBIENT_AND_DIFFUSE, COLOR_INDEXES ); for MaterialParameterVEnm use ( AMBIENT => 16#1200#, DIFFUSE => 16#1201#, SPECULAR => 16#1202#, EMISSION => 16#1600#, SHININESS => 16#1601#, AMBIENT_AND_DIFFUSE => 16#1602#, COLOR_INDEXES => 16#1603# ); for MaterialParameterVEnm'Size use GL.enum'Size; type GetMaterialParameterEnm is ( AMBIENT, DIFFUSE, SPECULAR, EMISSION, SHININESS, COLOR_INDEXES ); for GetMaterialParameterEnm use ( AMBIENT => 16#1200#, DIFFUSE => 16#1201#, SPECULAR => 16#1202#, EMISSION => 16#1600#, SHININESS => 16#1601#, COLOR_INDEXES => 16#1603# ); for GetMaterialParameterEnm'Size use GL.enum'Size; type ColorMaterialEnm is ( AMBIENT, DIFFUSE, SPECULAR, EMISSION, AMBIENT_AND_DIFFUSE ); for ColorMaterialEnm use ( AMBIENT => 16#1200#, DIFFUSE => 16#1201#, SPECULAR => 16#1202#, EMISSION => 16#1600#, AMBIENT_AND_DIFFUSE => 16#1602# ); for ColorMaterialEnm'Size use GL.enum'Size; procedure Material (face : FaceEnm; pname : MaterialParameterEnm; param : GL.C_Float); procedure Materiali (face : FaceEnm; pname : MaterialParameterEnm; param : GL.Int); procedure Material (face : FaceEnm; pname : MaterialParameterVEnm; params : Material_Float_vector); procedure Materialiv (face : FaceEnm; pname : MaterialParameterVEnm; params : GL.intPointer); procedure GetMaterialfv (face : FaceEnm; pname : GetMaterialParameterEnm; params : floatPtr); procedure GetMaterialiv (face : FaceEnm; pname : GetMaterialParameterEnm; params : GL.intPointer); procedure ColorMaterial (face : FaceEnm; mode : ColorMaterialEnm); -- Pixel stuff type PixelStorageEnm is ( UNPACK_SWAP_BYTES, UNPACK_LSB_FIRST, UNPACK_ROW_LENGTH, UNPACK_SKIP_ROWS, UNPACK_SKIP_PIXELS, UNPACK_ALIGNMENT, PACK_SWAP_BYTES, PACK_LSB_FIRST, PACK_ROW_LENGTH, PACK_SKIP_ROWS, PACK_SKIP_PIXELS, PACK_ALIGNMENT ); for PixelStorageEnm use ( UNPACK_SWAP_BYTES => 16#0CF0#, UNPACK_LSB_FIRST => 16#0CF1#, UNPACK_ROW_LENGTH => 16#0CF2#, UNPACK_SKIP_ROWS => 16#0CF3#, UNPACK_SKIP_PIXELS => 16#0CF4#, UNPACK_ALIGNMENT => 16#0CF5#, PACK_SWAP_BYTES => 16#0D00#, PACK_LSB_FIRST => 16#0D01#, PACK_ROW_LENGTH => 16#0D02#, PACK_SKIP_ROWS => 16#0D03#, PACK_SKIP_PIXELS => 16#0D04#, PACK_ALIGNMENT => 16#0D05# ); for PixelStorageEnm'Size use GL.enum'Size; type PixelTransferEnm is ( MAP_COLOR, MAP_STENCIL, INDEX_SHIFT, INDEX_OFFSET, RED_SCALE, RED_BIAS, GREEN_SCALE, GREEN_BIAS, BLUE_SCALE, BLUE_BIAS, ALPHA_SCALE, ALPHA_BIAS, DEPTH_SCALE, DEPTH_BIAS ); for PixelTransferEnm use ( MAP_COLOR => 16#0D10#, MAP_STENCIL => 16#0D11#, INDEX_SHIFT => 16#0D12#, INDEX_OFFSET => 16#0D13#, RED_SCALE => 16#0D14#, RED_BIAS => 16#0D15#, GREEN_SCALE => 16#0D18#, GREEN_BIAS => 16#0D19#, BLUE_SCALE => 16#0D1A#, BLUE_BIAS => 16#0D1B#, ALPHA_SCALE => 16#0D1C#, ALPHA_BIAS => 16#0D1D#, DEPTH_SCALE => 16#0D1E#, DEPTH_BIAS => 16#0D1F# ); for PixelTransferEnm'Size use GL.enum'Size; type PixelMapEnm is ( PIXEL_MAP_I_TO_I, PIXEL_MAP_S_TO_S, PIXEL_MAP_I_TO_R, PIXEL_MAP_I_TO_G, PIXEL_MAP_I_TO_B, PIXEL_MAP_I_TO_A, PIXEL_MAP_R_TO_R, PIXEL_MAP_G_TO_G, PIXEL_MAP_B_TO_B, PIXEL_MAP_A_TO_A ); for PixelMapEnm use ( PIXEL_MAP_I_TO_I => 16#0C70#, PIXEL_MAP_S_TO_S => 16#0C71#, PIXEL_MAP_I_TO_R => 16#0C72#, PIXEL_MAP_I_TO_G => 16#0C73#, PIXEL_MAP_I_TO_B => 16#0C74#, PIXEL_MAP_I_TO_A => 16#0C75#, PIXEL_MAP_R_TO_R => 16#0C76#, PIXEL_MAP_G_TO_G => 16#0C77#, PIXEL_MAP_B_TO_B => 16#0C78#, PIXEL_MAP_A_TO_A => 16#0C79# ); for PixelMapEnm'Size use GL.enum'Size; type PixelFormatEnm is ( COLOR_INDEX, STENCIL_INDEX, DEPTH_COMPONENT, Red_Component, Green_Component, Blue_Component, Alpha_Component, RGB, RGBA, LUMINANCE, LUMINANCE_ALPHA, BGR, BGRA ); for PixelFormatEnm use ( COLOR_INDEX => 16#1900#, STENCIL_INDEX => 16#1901#, DEPTH_COMPONENT => 16#1902#, Red_Component => 16#1903#, Green_Component => 16#1904#, Blue_Component => 16#1905#, Alpha_Component => 16#1906#, RGB => 16#1907#, RGBA => 16#1908#, LUMINANCE => 16#1909#, LUMINANCE_ALPHA => 16#190A#, BGR => 16#80E0#, BGRA => 16#80E1# ); for PixelFormatEnm'Size use GL.enum'Size; type PixelDataTypeEnm is ( GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT, GL_FLOAT, GL_BITMAP ); for PixelDataTypeEnm use ( GL_BYTE => 16#1400#, GL_UNSIGNED_BYTE => 16#1401#, GL_SHORT => 16#1402#, GL_UNSIGNED_SHORT => 16#1403#, GL_INT => 16#1404#, GL_UNSIGNED_INT => 16#1405#, GL_FLOAT => 16#1406#, GL_BITMAP => 16#1A00# ); for PixelDataTypeEnm'Size use GL.enum'Size; type PixelCopyTypeEnm is ( COLOR, DEPTH, STENCIL ); for PixelCopyTypeEnm use ( COLOR => 16#1800#, DEPTH => 16#1801#, STENCIL => 16#1802# ); for PixelCopyTypeEnm'Size use GL.enum'Size; procedure PixelZoom (xfactor : GL.C_Float; yfactor : GL.C_Float); procedure PixelStoref (pname : PixelStorageEnm; param : GL.C_Float); procedure PixelStore (pname : PixelStorageEnm; param : GL.Int); procedure PixelTransferf (pname : PixelTransferEnm; param : GL.C_Float); procedure PixelTransferi (pname : PixelTransferEnm; param : GL.Int); procedure PixelMapfv (map : PixelMapEnm; mapsize : GL.Int; values : floatPtr); procedure PixelMapuiv (map : PixelMapEnm; mapsize : GL.Int; values : GL.uintPtr); procedure PixelMapusv (map : PixelMapEnm; mapsize : GL.Int; values : ushortPtr); procedure GetPixelMapfv (map : PixelMapEnm; values : floatPtr); procedure GetPixelMapuiv (map : PixelMapEnm; values : GL.uintPtr); procedure GetPixelMapusv (map : PixelMapEnm; values : ushortPtr); procedure ReadPixels (x : GL.Int; y : GL.Int; width : GL.Sizei; height : GL.Sizei; format : PixelFormatEnm; c_type : PixelDataTypeEnm; pixels : GL.pointer); procedure DrawPixels (width : GL.Sizei; height : GL.Sizei; format : PixelFormatEnm; c_type : PixelDataTypeEnm; pixels : GL.pointer); procedure CopyPixels (x : GL.Int; y : GL.Int; width : GL.Sizei; height : GL.Sizei; c_type : PixelCopyTypeEnm); -- Texturing type TexCoordEnm is ( S, T, R, Q ); for TexCoordEnm use ( S => 16#2000#, T => 16#2001#, R => 16#2002#, Q => 16#2003# ); for TexCoordEnm'Size use GL.enum'Size; type TexParameterEnm is ( TEXTURE_GEN_MODE ); for TexParameterEnm use ( TEXTURE_GEN_MODE => 16#2500# ); for TexParameterEnm'Size use GL.enum'Size; type TexParameterVEnm is ( TEXTURE_GEN_MODE, OBJECT_PLANE, EYE_PLANE ); for TexParameterVEnm use ( TEXTURE_GEN_MODE => 16#2500#, OBJECT_PLANE => 16#2501#, EYE_PLANE => 16#2502# ); for TexParameterVEnm'Size use GL.enum'Size; type TexEnvEnm is ( TEXTURE_ENV ); for TexEnvEnm use ( TEXTURE_ENV => 16#2300# ); for TexEnvEnm'Size use GL.enum'Size; type TexEnvParameterEnm is ( TEXTURE_ENV_MODE ); for TexEnvParameterEnm use ( TEXTURE_ENV_MODE => 16#2200# ); for TexEnvParameterEnm'Size use GL.enum'Size; type TexEnvParameterVEnm is ( TEXTURE_ENV_MODE, TEXTURE_ENV_COLOR ); for TexEnvParameterVEnm use ( TEXTURE_ENV_MODE => 16#2200#, TEXTURE_ENV_COLOR => 16#2201# ); for TexEnvParameterVEnm'Size use GL.enum'Size; type TargetTexEnm is ( TEXTURE_1D, TEXTURE_2D ); for TargetTexEnm use ( TEXTURE_1D => 16#0DE0#, TEXTURE_2D => 16#0DE1# ); for TargetTexEnm'Size use GL.enum'Size; type TexParamEnm is ( TEXTURE_MAG_FILTER, TEXTURE_MIN_FILTER, TEXTURE_WRAP_S, TEXTURE_WRAP_T, TEXTURE_PRIORITY ); for TexParamEnm use ( TEXTURE_MAG_FILTER => 16#2800#, TEXTURE_MIN_FILTER => 16#2801#, TEXTURE_WRAP_S => 16#2802#, TEXTURE_WRAP_T => 16#2803#, TEXTURE_PRIORITY => 16#8066# ); for TexParamEnm'Size use GL.enum'Size; type TexParamVEnm is ( TEXTURE_BORDER_COLOR, TEXTURE_MAG_FILTER, TEXTURE_MIN_FILTER, TEXTURE_WRAP_S, TEXTURE_WRAP_T, TEXTURE_PRIORITY ); for TexParamVEnm use ( TEXTURE_BORDER_COLOR => 16#1004#, TEXTURE_MAG_FILTER => 16#2800#, TEXTURE_MIN_FILTER => 16#2801#, TEXTURE_WRAP_S => 16#2802#, TEXTURE_WRAP_T => 16#2803#, TEXTURE_PRIORITY => 16#8066# ); for TexParamVEnm'Size use GL.enum'Size; type GetTexParamEnm is ( TEXTURE_BORDER_COLOR, TEXTURE_MAG_FILTER, TEXTURE_MIN_FILTER, TEXTURE_WRAP_S, TEXTURE_WRAP_T, TEXTURE_PRIORITY, TEXTURE_RESIDENT ); for GetTexParamEnm use ( TEXTURE_BORDER_COLOR => 16#1004#, TEXTURE_MAG_FILTER => 16#2800#, TEXTURE_MIN_FILTER => 16#2801#, TEXTURE_WRAP_S => 16#2802#, TEXTURE_WRAP_T => 16#2803#, TEXTURE_PRIORITY => 16#8066#, TEXTURE_RESIDENT => 16#8067# ); for GetTexParamEnm'Size use GL.enum'Size; type TargetTexLevelEnm is ( TEXTURE_1D, TEXTURE_2D, PROXY_TEXTURE_1D, PROXY_TEXTURE_2D ); for TargetTexLevelEnm use ( TEXTURE_1D => 16#0DE0#, TEXTURE_2D => 16#0DE1#, PROXY_TEXTURE_1D => 16#8063#, PROXY_TEXTURE_2D => 16#8064# ); for TargetTexLevelEnm'Size use GL.enum'Size; type TexLevelParameterEnm is ( TEXTURE_WIDTH, TEXTURE_HEIGHT, TEXTURE_COMPONENTS, TEXTURE_BORDER, TEXTURE_RED_SIZE, TEXTURE_GREEN_SIZE, TEXTURE_BLUE_SIZE, TEXTURE_ALPHA_SIZE, TEXTURE_LUMINANCE_SIZE, TEXTURE_INTENSITY_SIZE, TEXTURE_INTERNAL_FORMAT ); for TexLevelParameterEnm use ( TEXTURE_WIDTH => 16#1000#, TEXTURE_HEIGHT => 16#1001#, TEXTURE_COMPONENTS => 16#1003#, -- HP docs say to use this in 1.0 instead of INTERNAL_FORMAT??? TEXTURE_BORDER => 16#1005#, TEXTURE_RED_SIZE => 16#805C#, TEXTURE_GREEN_SIZE => 16#805D#, TEXTURE_BLUE_SIZE => 16#805E#, TEXTURE_ALPHA_SIZE => 16#805F#, TEXTURE_LUMINANCE_SIZE => 16#8060#, TEXTURE_INTENSITY_SIZE => 16#8061#, TEXTURE_INTERNAL_FORMAT => 16#FFFF# -- fixme : Mesa 2.5 does not support!! What's the real value? ); for TexLevelParameterEnm'Size use GL.enum'Size; type TargetTex1DEnm is ( TEXTURE_1D, PROXY_TEXTURE_1D ); for TargetTex1DEnm use ( TEXTURE_1D => 16#0DE0#, PROXY_TEXTURE_1D => 16#8063# ); for TargetTex1DEnm'Size use GL.enum'Size; type TexFormatEnm is ( Alpha_Value, RGB, RGBA, LUMINANCE, LUMINANCE_ALPHA, R3_G3_B2, ALPHA4, ALPHA8, ALPHA12, ALPHA16, LUMINANCE4, LUMINANCE8, LUMINANCE12, LUMINANCE16, LUMINANCE4_ALPHA4, LUMINANCE6_ALPHA2, LUMINANCE8_ALPHA8, LUMINANCE12_ALPHA4, LUMINANCE12_ALPHA12, LUMINANCE16_ALPHA16, INTENSITY, INTENSITY4, INTENSITY8, INTENSITY12, INTENSITY16, RGB4, RGB5, RGB8, RGB10, RGB12, RGB16, RGBA2, RGBA4, RGB5_A1, RGBA8, RGB10_A2, RGBA12, RGBA16, BGR, BGRA ); for TexFormatEnm use ( Alpha_Value => 16#1906#, RGB => 16#1907#, RGBA => 16#1908#, LUMINANCE => 16#1909#, LUMINANCE_ALPHA => 16#190A#, R3_G3_B2 => 16#2A10#, ALPHA4 => 16#803B#, ALPHA8 => 16#803C#, ALPHA12 => 16#803D#, ALPHA16 => 16#803E#, LUMINANCE4 => 16#803F#, LUMINANCE8 => 16#8040#, LUMINANCE12 => 16#8041#, LUMINANCE16 => 16#8042#, LUMINANCE4_ALPHA4 => 16#8043#, LUMINANCE6_ALPHA2 => 16#8044#, LUMINANCE8_ALPHA8 => 16#8045#, LUMINANCE12_ALPHA4 => 16#8046#, LUMINANCE12_ALPHA12 => 16#8047#, LUMINANCE16_ALPHA16 => 16#8048#, INTENSITY => 16#8049#, INTENSITY4 => 16#804A#, INTENSITY8 => 16#804B#, INTENSITY12 => 16#804C#, INTENSITY16 => 16#804D#, RGB4 => 16#804F#, RGB5 => 16#8050#, RGB8 => 16#8051#, RGB10 => 16#8052#, RGB12 => 16#8053#, RGB16 => 16#8054#, RGBA2 => 16#8055#, RGBA4 => 16#8056#, RGB5_A1 => 16#8057#, RGBA8 => 16#8058#, RGB10_A2 => 16#8059#, RGBA12 => 16#805A#, RGBA16 => 16#805B#, BGR => 16#80E0#, BGRA => 16#80E1# ); for TexFormatEnm'Size use GL.enum'Size; type TexPixelFormatEnm is ( COLOR_INDEX, Red_Component, Green_Component, Blue_Component, Alpha_Component, RGB, RGBA, LUMINANCE, LUMINANCE_ALPHA ); for TexPixelFormatEnm use ( COLOR_INDEX => 16#1900#, Red_Component => 16#1903#, Green_Component => 16#1904#, Blue_Component => 16#1905#, Alpha_Component => 16#1906#, RGB => 16#1907#, RGBA => 16#1908#, LUMINANCE => 16#1909#, LUMINANCE_ALPHA => 16#190A# ); for TexPixelFormatEnm'Size use GL.enum'Size; type TargetTex2DEnm is ( TEXTURE_2D, PROXY_TEXTURE_2D ); for TargetTex2DEnm use ( TEXTURE_2D => 16#0DE1#, PROXY_TEXTURE_2D => 16#8064# ); for TargetTex2DEnm'Size use GL.enum'Size; type TexImageFormatEnm is ( Red_Component, Green_Component, Blue_Component, Alpha_Component, RGB, RGBA, LUMINANCE, LUMINANCE_ALPHA ); for TexImageFormatEnm use ( Red_Component => 16#1903#, Green_Component => 16#1904#, Blue_Component => 16#1905#, Alpha_Component => 16#1906#, RGB => 16#1907#, RGBA => 16#1908#, LUMINANCE => 16#1909#, LUMINANCE_ALPHA => 16#190A# ); for TexImageFormatEnm'Size use GL.enum'Size; type TargetTex1DOnlyEnm is ( TEXTURE_1D ); for TargetTex1DOnlyEnm use ( TEXTURE_1D => 16#0DE0# ); for TargetTex1DOnlyEnm'Size use GL.enum'Size; type TargetTex2DOnlyEnm is ( TEXTURE_2D ); for TargetTex2DOnlyEnm use ( TEXTURE_2D => 16#0DE1# ); for TargetTex2DOnlyEnm'Size use GL.enum'Size; type TargetTex3DEnm is ( TEXTURE_3D_EXT, PROXY_TEXTURE_3D_EXT ); for TargetTex3DEnm use ( TEXTURE_3D_EXT => 16#806F#, PROXY_TEXTURE_3D_EXT => 16#8070# ); for TargetTex3DEnm'Size use GL.enum'Size; type TargetTex3DOnlyEnm is ( TEXTURE_3D_EXT ); for TargetTex3DOnlyEnm use ( TEXTURE_3D_EXT => 16#806F# ); for TargetTex3DOnlyEnm'Size use GL.enum'Size; -- Texture map parameters OBJECT_LINEAR : constant := 16#2401#; EYE_LINEAR : constant := 16#2400#; SPHERE_MAP : constant := 16#2402#; -- Texture filter parameter values NEAREST_MIPMAP_NEAREST : constant := 16#2700#; NEAREST_MIPMAP_LINEAR : constant := 16#2702#; LINEAR_MIPMAP_NEAREST : constant := 16#2701#; LINEAR_MIPMAP_LINEAR : constant := 16#2703#; DECAL : constant := 16#2101#; MODULATE : constant := 16#2100#; NEAREST : constant := 16#2600#; REPEAT : constant := 16#2901#; CLAMP : constant := 16#2900#; CLAMP_TO_EDGE : constant := 16#812F#; CLAMP_TO_BORDER : constant := 16#812D#; procedure TexGend (coord : TexCoordEnm; pname : TexParameterEnm; param : GL.Double); procedure TexGenf (coord : TexCoordEnm; pname : TexParameterEnm; param : GL.C_Float); procedure TexGeni (coord : TexCoordEnm; pname : TexParameterEnm; param : GL.Int); procedure TexGendv (coord : TexCoordEnm; pname : TexParameterVEnm; params : GL.doublePtr); procedure TexGenfv (coord : TexCoordEnm; pname : TexParameterVEnm; params : floatPtr); procedure TexGeniv (coord : TexCoordEnm; pname : TexParameterVEnm; params : GL.intPointer); procedure GetTexGendv (coord : TexCoordEnm; pname : TexParameterVEnm; params : GL.doublePtr); procedure GetTexGenfv (coord : TexCoordEnm; pname : TexParameterVEnm; params : floatPtr); procedure GetTexGeniv (coord : TexCoordEnm; pname : TexParameterVEnm; params : GL.intPointer); procedure TexEnvf (target : TexEnvEnm; pname : TexEnvParameterEnm; param : GL.C_Float); procedure TexEnv (target : TexEnvEnm; pname : TexEnvParameterEnm; param : GL.Int); procedure TexEnvfv (target : TexEnvEnm; pname : TexEnvParameterVEnm; params : floatPtr); procedure TexEnviv (target : TexEnvEnm; pname : TexEnvParameterVEnm; params : GL.intPointer); procedure GetTexEnvfv (target : TexEnvEnm; pname : TexEnvParameterVEnm; params : floatPtr); procedure GetTexEnviv (target : TexEnvEnm; pname : TexEnvParameterVEnm; params : GL.intPointer); procedure TexParameterf (target : TargetTexEnm; pname : TexParamEnm; param : GL.C_Float); procedure TexParameter (target : TargetTexEnm; pname : TexParamEnm; param : GL.Int); procedure TexParameterfv (target : TargetTexEnm; pname : TexParamVEnm; params : floatPtr); procedure TexParameteriv (target : TargetTexEnm; pname : TexParamVEnm; params : GL.intPointer); procedure GetTexParameterfv (target : TargetTexEnm; pname : GetTexParamEnm; params : floatPtr); procedure GetTexParameteriv (target : TargetTexEnm; pname : GetTexParamEnm; params : GL.intPointer); procedure GetTexLevelParameterfv (target : TargetTexLevelEnm; level : GL.Int; pname : TexLevelParameterEnm; params : floatPtr); procedure GetTexLevelParameteriv (target : TargetTexLevelEnm; level : GL.Int; pname : TexLevelParameterEnm; params : GL.intPointer); procedure TexImage1D (target : TargetTex1DEnm; level : GL.Int; internalFormat : TexFormatEnm; width : GL.Sizei; border : GL.Int; format : TexPixelFormatEnm; c_type : PixelDataTypeEnm; pixels : GL.pointer); procedure TexImage2D (target : TargetTex2DEnm; level : GL.Int; internalFormat : TexFormatEnm; width : GL.Sizei; height : GL.Sizei; border : GL.Int; format : TexPixelFormatEnm; c_type : PixelDataTypeEnm; pixels : GL.pointer); procedure GetTexImage (target : TargetTexEnm; level : GL.Int; format : TexImageFormatEnm; c_type : PixelDataTypeEnm; pixels : GL.pointer); procedure Gen_Textures (n : GL.Sizei; textures : GL.uintPtr); procedure Delete_Textures (n : GL.Sizei; textures : GL.uintPtr); procedure BindTexture (target : TargetTexEnm; texture_ptr : GL.Uint); procedure PrioritizeTextures (n : GL.Sizei; textures : GL.uintPtr; priorities : GL.clampfPtr); function AreTexturesResident (n : GL.Sizei; textures : GL.uintPtr; residences : GL_BooleanPtr) return GL_Boolean; function IsTexture (texture_ptr : GL.Uint) return GL_Boolean; procedure TexSubImage1D (target : TargetTex1DOnlyEnm; level : GL.Int; xoffset : GL.Int; width : GL.Sizei; format : TexPixelFormatEnm; c_type : PixelDataTypeEnm; pixels : GL.pointer); procedure TexSubImage2D (target : TargetTex2DOnlyEnm; level : GL.Int; xoffset : GL.Int; yoffset : GL.Int; width : GL.Sizei; height : GL.Sizei; format : TexPixelFormatEnm; c_type : PixelDataTypeEnm; pixels : GL.pointer); procedure CopyTexImage1D (target : TargetTex1DOnlyEnm; level : GL.Int; internalformat : TexFormatEnm; x : GL.Int; y : GL.Int; width : GL.Sizei; border : GL.Int); procedure CopyTexImage2D (target : TargetTex2DOnlyEnm; level : GL.Int; internalformat : TexFormatEnm; x : GL.Int; y : GL.Int; width : GL.Sizei; height : GL.Sizei; border : GL.Int); procedure CopyTexSubImage1D (target : TargetTex1DOnlyEnm; level : GL.Int; xoffset : GL.Int; x : GL.Int; y : GL.Int; width : GL.Sizei); procedure CopyTexSubImage2D (target : TargetTex2DOnlyEnm; level : GL.Int; xoffset : GL.Int; yoffset : GL.Int; x : GL.Int; y : GL.Int; width : GL.Sizei; height : GL.Sizei); procedure TexImage3DEXT (target : TargetTex3DEnm; level : GL.Int; internalFormat : TexPixelFormatEnm; width_3d : GL.Sizei; height_3d : GL.Sizei; depth_3d : GL.Sizei; border : GL.Int; format : TexPixelFormatEnm; c_type : PixelDataTypeEnm; pixels : GL.pointer); procedure TexSubImage3DEXT (target : TargetTex3DOnlyEnm; level : GL.Int; xoffset : GL.Int; yoffset : GL.Int; zoffset : GL.Int; width_3d : GL.Sizei; height_3d : GL.Sizei; depth_3d : GL.Sizei; format : TexPixelFormatEnm; c_type : PixelDataTypeEnm; pixels : GL.pointer); procedure CopyTexSubImage3DEXT (target : TargetTex3DOnlyEnm; level : GL.Int; xoffset : GL.Int; yoffset : GL.Int; zoffset : GL.Int; x : GL.Int; y : GL.Int; width : GL.Sizei; height : GL.Sizei); -- Evaluators type Map1TargetEnm is ( MAP1_COLOR_4, MAP1_INDEX, MAP1_NORMAL, MAP1_TEXTURE_COORD_1, MAP1_TEXTURE_COORD_2, MAP1_TEXTURE_COORD_3, MAP1_TEXTURE_COORD_4, MAP1_VERTEX_3, MAP1_VERTEX_4 ); for Map1TargetEnm use ( MAP1_COLOR_4 => 16#0D90#, MAP1_INDEX => 16#0D91#, MAP1_NORMAL => 16#0D92#, MAP1_TEXTURE_COORD_1 => 16#0D93#, MAP1_TEXTURE_COORD_2 => 16#0D94#, MAP1_TEXTURE_COORD_3 => 16#0D95#, MAP1_TEXTURE_COORD_4 => 16#0D96#, MAP1_VERTEX_3 => 16#0D97#, MAP1_VERTEX_4 => 16#0D98# ); for Map1TargetEnm'Size use GL.enum'Size; type Map2TargetEnm is ( MAP2_COLOR_4, MAP2_INDEX, MAP2_NORMAL, MAP2_TEXTURE_COORD_1, MAP2_TEXTURE_COORD_2, MAP2_TEXTURE_COORD_3, MAP2_TEXTURE_COORD_4, MAP2_VERTEX_3, MAP2_VERTEX_4 ); for Map2TargetEnm use ( MAP2_COLOR_4 => 16#0DB0#, MAP2_INDEX => 16#0DB1#, MAP2_NORMAL => 16#0DB2#, MAP2_TEXTURE_COORD_1 => 16#0DB3#, MAP2_TEXTURE_COORD_2 => 16#0DB4#, MAP2_TEXTURE_COORD_3 => 16#0DB5#, MAP2_TEXTURE_COORD_4 => 16#0DB6#, MAP2_VERTEX_3 => 16#0DB7#, MAP2_VERTEX_4 => 16#0DB8# ); for Map2TargetEnm'Size use GL.enum'Size; type MapTargetEnm is ( MAP1_COLOR_4, MAP1_INDEX, MAP1_NORMAL, MAP1_TEXTURE_COORD_1, MAP1_TEXTURE_COORD_2, MAP1_TEXTURE_COORD_3, MAP1_TEXTURE_COORD_4, MAP1_VERTEX_3, MAP1_VERTEX_4, MAP2_COLOR_4, MAP2_INDEX, MAP2_NORMAL, MAP2_TEXTURE_COORD_1, MAP2_TEXTURE_COORD_2, MAP2_TEXTURE_COORD_3, MAP2_TEXTURE_COORD_4, MAP2_VERTEX_3, MAP2_VERTEX_4 ); for MapTargetEnm use ( MAP1_COLOR_4 => 16#0D90#, MAP1_INDEX => 16#0D91#, MAP1_NORMAL => 16#0D92#, MAP1_TEXTURE_COORD_1 => 16#0D93#, MAP1_TEXTURE_COORD_2 => 16#0D94#, MAP1_TEXTURE_COORD_3 => 16#0D95#, MAP1_TEXTURE_COORD_4 => 16#0D96#, MAP1_VERTEX_3 => 16#0D97#, MAP1_VERTEX_4 => 16#0D98#, MAP2_COLOR_4 => 16#0DB0#, MAP2_INDEX => 16#0DB1#, MAP2_NORMAL => 16#0DB2#, MAP2_TEXTURE_COORD_1 => 16#0DB3#, MAP2_TEXTURE_COORD_2 => 16#0DB4#, MAP2_TEXTURE_COORD_3 => 16#0DB5#, MAP2_TEXTURE_COORD_4 => 16#0DB6#, MAP2_VERTEX_3 => 16#0DB7#, MAP2_VERTEX_4 => 16#0DB8# ); for MapTargetEnm'Size use GL.enum'Size; type MapQueryEnm is ( COEFF, ORDER, DOMAIN ); for MapQueryEnm use ( COEFF => 16#0A00#, ORDER => 16#0A01#, DOMAIN => 16#0A02# ); for MapQueryEnm'Size use GL.enum'Size; type Mesh1ModeEnm is ( POINT, LINE ); for Mesh1ModeEnm use ( POINT => 16#1B00#, LINE => 16#1B01# ); for Mesh1ModeEnm'Size use GL.enum'Size; type Mesh2ModeEnm is ( POINT, LINE, FILL ); for Mesh2ModeEnm use ( POINT => 16#1B00#, LINE => 16#1B01#, FILL => 16#1B02# ); for Mesh2ModeEnm'Size use GL.enum'Size; procedure Map1d (target : Map1TargetEnm; u1 : GL.Double; u2 : GL.Double; stride : GL.Int; map_order : GL.Int; map_points : GL.doublePtr); procedure Map1f (target : Map1TargetEnm; u1 : GL.C_Float; u2 : GL.C_Float; stride : GL.Int; map_order : GL.Int; map_points : floatPtr); procedure Map2d (target : Map2TargetEnm; u1 : GL.Double; u2 : GL.Double; ustride : GL.Int; uorder : GL.Int; v1 : GL.Double; v2 : GL.Double; vstride : GL.Int; vorder : GL.Int; map_points : GL.doublePtr); procedure Map2f (target : Map2TargetEnm; u1 : GL.C_Float; u2 : GL.C_Float; ustride : GL.Int; uorder : GL.Int; v1 : GL.C_Float; v2 : GL.C_Float; vstride : GL.Int; vorder : GL.Int; map_points : floatPtr); procedure GetMapdv (target : MapTargetEnm; query : MapQueryEnm; v : GL.doublePtr); procedure GetMapfv (target : MapTargetEnm; query : MapQueryEnm; v : floatPtr); procedure GetMapiv (target : MapTargetEnm; query : MapQueryEnm; v : GL.intPointer); procedure EvalPoint1 (i : GL.Int); procedure EvalPoint2 (i : GL.Int; j : GL.Int); procedure EvalMesh1 (mode : Mesh1ModeEnm; i1 : GL.Int; i2 : GL.Int); procedure EvalMesh2 (mode : Mesh2ModeEnm; i1 : GL.Int; i2 : GL.Int; j1 : GL.Int; j2 : GL.Int); procedure EvalCoord1d (u : GL.Double); procedure EvalCoord1f (u : GL.C_Float); procedure EvalCoord1dv (u : GL.doublePtr); procedure EvalCoord1fv (u : floatPtr); procedure EvalCoord2d (u : GL.Double; v : GL.Double); procedure EvalCoord2f (u : GL.C_Float; v : GL.C_Float); procedure EvalCoord2dv (u : GL.doublePtr); procedure EvalCoord2fv (u : floatPtr); procedure MapGrid1d (un : GL.Int; u1 : GL.Double; u2 : GL.Double); procedure MapGrid1f (un : GL.Int; u1 : GL.C_Float; u2 : GL.C_Float); procedure MapGrid2d (un : GL.Int; u1 : GL.Double; u2 : GL.Double; vn : GL.Int; v1 : GL.Double; v2 : GL.Double); procedure MapGrid2f (un : GL.Int; u1 : GL.C_Float; u2 : GL.C_Float; vn : GL.Int; v1 : GL.C_Float; v2 : GL.C_Float); -- Fog type FogParameterEnm is ( FOG_INDEX, FOG_DENSITY, FOG_START, FOG_END, FOG_MODE ); for FogParameterEnm use ( FOG_INDEX => 16#0B61#, FOG_DENSITY => 16#0B62#, FOG_START => 16#0B63#, FOG_END => 16#0B64#, FOG_MODE => 16#0B65# ); for FogParameterEnm'Size use GL.enum'Size; type FogParameterVEnm is ( FOG_INDEX, FOG_DENSITY, FOG_START, FOG_END, FOG_MODE, FOG_COLOR ); for FogParameterVEnm use ( FOG_INDEX => 16#0B61#, FOG_DENSITY => 16#0B62#, FOG_START => 16#0B63#, FOG_END => 16#0B64#, FOG_MODE => 16#0B65#, FOG_COLOR => 16#0B66# ); for FogParameterVEnm'Size use GL.enum'Size; -- Fog attenuation modes LINEAR : constant := 16#2601#; EXP1 : constant := 16#0800#; EXP2 : constant := 16#0801#; -- EXP1 : original was EXP, confused with the Exp function (29 - May - 2006) procedure Fogf (pname : FogParameterEnm; param : GL.C_Float); procedure Fogi (pname : FogParameterEnm; param : GL.Int); procedure Fogfv (pname : FogParameterVEnm; params : floatPtr); procedure Fogiv (pname : FogParameterVEnm; params : GL.intPointer); -- Feedback type FeedbackModeEnm is ( GL_2D, GL_3D, GL_3D_COLOR, GL_3D_COLOR_TEXTURE, GL_4D_COLOR_TEXTURE ); for FeedbackModeEnm use ( GL_2D => 16#0600#, GL_3D => 16#0601#, GL_3D_COLOR => 16#0602#, GL_3D_COLOR_TEXTURE => 16#0603#, GL_4D_COLOR_TEXTURE => 16#0604# ); for FeedbackModeEnm'Size use GL.enum'Size; -- Feedback tokens POINT_TOKEN : constant := 16#0701#; LINE_TOKEN : constant := 16#0702#; LINE_RESET_TOKEN : constant := 16#0707#; POLYGON_TOKEN : constant := 16#0703#; BITMAP_TOKEN : constant := 16#0704#; DRAW_PIXEL_TOKEN : constant := 16#0705#; COPY_PIXEL_TOKEN : constant := 16#0706#; PASS_THROUGH_TOKEN : constant := 16#<PASSWORD>#; FEEDBACK_BUFFER_SIZE : constant := 16#0DF1#; FEEDBACK_BUFFER_TYPE : constant := 16#0DF2#; procedure FeedbackBuffer (size : GL.Sizei; c_type : FeedbackModeEnm; buffer : floatPtr); procedure PassThrough (token : GL.C_Float); -- Color tables (extension) type ColorTableTargetEnm is ( TEXTURE_1D, TEXTURE_2D, PROXY_TEXTURE_1D, PROXY_TEXTURE_2D, TEXTURE_3D_EXT, PROXY_TEXTURE_3D_EXT, SHARED_TEXTURE_PALETTE_EXT ); for ColorTableTargetEnm use ( TEXTURE_1D => 16#0DE0#, TEXTURE_2D => 16#0DE1#, PROXY_TEXTURE_1D => 16#8063#, PROXY_TEXTURE_2D => 16#8064#, TEXTURE_3D_EXT => 16#806F#, PROXY_TEXTURE_3D_EXT => 16#8070#, SHARED_TEXTURE_PALETTE_EXT => 16#81FB# ); for ColorTableTargetEnm'Size use GL.enum'Size; type GetColorTableTargetEnm is ( TEXTURE_1D, TEXTURE_2D, TEXTURE_3D_EXT, SHARED_TEXTURE_PALETTE_EXT ); for GetColorTableTargetEnm use ( TEXTURE_1D => 16#0DE0#, TEXTURE_2D => 16#0DE1#, TEXTURE_3D_EXT => 16#806F#, SHARED_TEXTURE_PALETTE_EXT => 16#81FB# ); for GetColorTableTargetEnm'Size use GL.enum'Size; type ColorTableParameterEnm is ( COLOR_TABLE_FORMAT_EXT, COLOR_TABLE_WIDTH_EXT, COLOR_TABLE_RED_SIZE_EXT, COLOR_TABLE_GREEN_SIZE_EXT, COLOR_TABLE_BLUE_SIZE_EXT, COLOR_TABLE_ALPHA_SIZE_EXT, COLOR_TABLE_LUMINANCE_SIZE_EXT, COLOR_TABLE_INTENSITY_SIZE_EXT ); for ColorTableParameterEnm use ( COLOR_TABLE_FORMAT_EXT => 16#80D8#, COLOR_TABLE_WIDTH_EXT => 16#80D9#, COLOR_TABLE_RED_SIZE_EXT => 16#80DA#, COLOR_TABLE_GREEN_SIZE_EXT => 16#80DB#, COLOR_TABLE_BLUE_SIZE_EXT => 16#80DC#, COLOR_TABLE_ALPHA_SIZE_EXT => 16#80DD#, COLOR_TABLE_LUMINANCE_SIZE_EXT => 16#80DE#, COLOR_TABLE_INTENSITY_SIZE_EXT => 16#80DF# ); for ColorTableParameterEnm'Size use GL.enum'Size; procedure ColorTableEXT (target : ColorTableTargetEnm; internalformat : TexFormatEnm; width : GL.Sizei; format : TexPixelFormatEnm; c_type : PixelDataTypeEnm; table : GL.pointer); procedure ColorSubTableEXT (target : ColorTableTargetEnm; start : GL.Sizei; count : GL.Sizei; format : TexPixelFormatEnm; c_type : PixelDataTypeEnm; data : GL.pointer); procedure GetColorTableEXT (target : GetColorTableTargetEnm; format : TexPixelFormatEnm; c_type : PixelDataTypeEnm; table : GL.pointer); procedure GetColorTableParameterfvEXT (target : GetColorTableTargetEnm; pname : ColorTableParameterEnm; params : floatPtr); procedure GetColorTableParameterivEXT (target : GetColorTableTargetEnm; pname : ColorTableParameterEnm; params : GL.intPointer); -- Point parameters (extension) type PointParameterEnm is ( POINT_SIZE_MIN_EXT, POINT_SIZE_MAX_EXT, POINT_FADE_THRESHOLD_SIZE_EXT ); for PointParameterEnm use ( POINT_SIZE_MIN_EXT => 16#8126#, POINT_SIZE_MAX_EXT => 16#8127#, POINT_FADE_THRESHOLD_SIZE_EXT => 16#8128# ); for PointParameterEnm'Size use GL.enum'Size; type PointParameterVEnm is ( POINT_SIZE_MIN_EXT, POINT_SIZE_MAX_EXT, POINT_FADE_THRESHOLD_SIZE_EXT, DISTANCE_ATTENUATION_EXT ); for PointParameterVEnm use ( POINT_SIZE_MIN_EXT => 16#8126#, POINT_SIZE_MAX_EXT => 16#8127#, POINT_FADE_THRESHOLD_SIZE_EXT => 16#8128#, DISTANCE_ATTENUATION_EXT => 16#8129# ); for PointParameterVEnm'Size use GL.enum'Size; procedure PointParameterfEXT (pname : PointParameterEnm; param : GL.C_Float); procedure PointParameterfvEXT (pname : PointParameterVEnm; params : floatPtr); -- Clears procedure ClearIndex (c : GL.C_Float); procedure ClearColor (red : GL.Clampf; green : GL.Clampf; blue : GL.Clampf; alpha : GL.Clampf); procedure Clear (mask : Bitfield); procedure ClearDepth (clear_depth : GL.Clampd); procedure ClearAccum (red : GL.C_Float; green : GL.C_Float; blue : GL.C_Float; alpha : GL.C_Float); -- Masks procedure IndexMask (mask : GL.Uint); procedure ColorMask (red : GL_Boolean; green : GL_Boolean; blue : GL_Boolean; alpha : GL_Boolean); -- Drawing parameters procedure PointSize (size : GL.C_Float); procedure LineWidth (width : GL.C_Float); procedure LineStipple (factor : GL.Int; pattern : GL.Ushort); procedure PolygonOffset (factor : GL.C_Float; units : GL.C_Float); procedure PolygonStipple (mask : ubytePtr); procedure GetPolygonStipple (mask : ubytePtr); procedure EdgeFlag (flag : GL_Boolean); procedure EdgeFlagv (flag : GL_BooleanPtr); procedure Scissor (x : GL.Int; y : GL.Int; width : GL.Sizei; height : GL.Sizei); -- Atribute stacks procedure PushAttrib (mask : Bitfield); procedure PopAttrib; procedure PushClientAttrib (mask : Bitfield); procedure PopClientAttrib; -- Pipeline control procedure Finish; procedure Flush; procedure Depth_Mask (flag : GL_Boolean); procedure DepthRange (near_val : GL.Clampd; far_val : GL.Clampd); -- Projections procedure Ortho (ortho_left : GL.Double; ortho_right : GL.Double; bottom : GL.Double; top : GL.Double; near_val : GL.Double; far_val : GL.Double); procedure Frustum (frustum_left : GL.Double; frustum_right : GL.Double; bottom : GL.Double; top : GL.Double; near_val : GL.Double; far_val : GL.Double); procedure Viewport (x : GL.Int; y : GL.Int; width : GL.Sizei; height : GL.Sizei); -- Matrix stacks procedure PushMatrix; procedure PopMatrix; procedure LoadIdentity; procedure LoadMatrixd (m : GL.doublePtr); procedure LoadMatrixf (m : floatPtr); procedure MultMatrixd (m : GL.doublePtr); procedure MultMatrixf (m : floatPtr); -- Transformations procedure Rotate (angle : GL.Double; x : GL.Double; y : GL.Double; z : GL.Double); procedure Rotate_f (angle : GL.C_Float; x : GL.C_Float; y : GL.C_Float; z : GL.C_Float); procedure Scale (x, y, z : GL.Double); procedure Scale_f (x, y, z : GL.C_Float); procedure Translate (x, y, z : GL.Double); procedure Translate_f (x, y, z : GL.C_Float); procedure Translate (v : Double_Vector_3D); pragma Inline (Translate); -- Specify vertices procedure Vertex (x, y : GL.Double); procedure Vertex_f (x, y : GL.C_Float); procedure Vertex (x, y : GL.Int); procedure Vertex_s (x, y : GL.Short); procedure Vertex (x, y, z : GL.Double); procedure Vertex_f (x, y, z : GL.C_Float); procedure Vertex (x, y, z : GL.Int); procedure Vertex_s (x, y, z : GL.Short); procedure Vertex (x, y, z, w : GL.Double); procedure Vertex_f (x, y, z, w : GL.C_Float); procedure Vertex (x, y, z, w : GL.Int); procedure Vertex_s (x, y, z, w : GL.Short); procedure Vertex (v : Double_Vector_3D); pragma Inline (Vertex); procedure Vertex2dv (v : GL.doublePtr); procedure Vertex2fv (v : floatPtr); procedure Vertex2iv (v : GL.intPointer); procedure Vertex2sv (v : GL.shortPtr); procedure Vertex3dv (v : GL.doublePtr); procedure Vertex3fv (v : floatPtr); procedure Vertex3iv (v : GL.intPointer); procedure Vertex3sv (v : GL.shortPtr); procedure Vertex4dv (v : GL.doublePtr); procedure Vertex4fv (v : floatPtr); procedure Vertex4iv (v : GL.intPointer); procedure Vertex4sv (v : GL.shortPtr); -- Specify normal vectors procedure Normal (x, y, z : GL.Double); procedure Normal_f (x, y, z : GL.C_Float); procedure Normal (x, y, z : GL.Int); procedure Normal_b (x, y, z : GL.Byte); procedure Normal_s (x, y, z : GL.Short); procedure Normal (v : Double_Vector_3D); pragma Inline (Normal); procedure Normal3bv (v : GL.bytePtr); procedure Normal3dv (v : GL.doublePtr); procedure Normal3fv (v : floatPtr); procedure Normal3iv (v : GL.intPointer); procedure Normal3sv (v : GL.shortPtr); -- Indexed color procedure Indexd (c : GL.Double); procedure Indexf (c : GL.C_Float); procedure Indexi (c : GL.Int); procedure Indexs (c : GL.Short); procedure Indexub (c : GL.Ubyte); procedure Indexdv (c : GL.doublePtr); procedure Indexfv (c : floatPtr); procedure Indexiv (c : GL.intPointer); procedure Indexsv (c : GL.shortPtr); procedure Indexubv (c : ubytePtr); -- Component color procedure Color3b (red : GL.Byte; green : GL.Byte; blue : GL.Byte); procedure Color (red, green, blue : GL.Double); procedure Color_f (red, green, blue : GL.C_Float); procedure Color (red, green, blue : GL.Int); procedure Color_s (red, green, blue : GL.Short); procedure Color3ub (red : GL.Ubyte; green : GL.Ubyte; blue : GL.Ubyte); procedure Color3ui (red : GL.Uint; green : GL.Uint; blue : GL.Uint); procedure Color3us (red : GL.Ushort; green : GL.Ushort; blue : GL.Ushort); procedure Color4b (red : GL.Byte; green : GL.Byte; blue : GL.Byte; alpha : GL.Byte); procedure Color (red, green, blue, alpha : GL.Double); procedure Color_f (red, green, blue, alpha : GL.C_Float); procedure Color (red, green, blue, alpha : GL.Int); procedure Color_s (red, green, blue, alpha : GL.Short); procedure Color4ub (red : GL.Ubyte; green : GL.Ubyte; blue : GL.Ubyte; alpha : GL.Ubyte); procedure Color4ui (red : GL.Uint; green : GL.Uint; blue : GL.Uint; alpha : GL.Uint); procedure Color4us (red : GL.Ushort; green : GL.Ushort; blue : GL.Ushort; alpha : GL.Ushort); procedure Color3bv (v : GL.bytePtr); procedure Color3dv (v : GL.doublePtr); procedure Color (v : RGB_Color); procedure Color3fv (v : GL.floatPtr); procedure Color3iv (v : GL.intPointer); procedure Color3sv (v : GL.shortPtr); procedure Color3ubv (v : GL.ubytePtr); procedure Color3uiv (v : GL.uintPtr); procedure Color3usv (v : GL.ushortPtr); procedure Color4bv (v : GL.bytePtr); procedure Color4dv (v : GL.doublePtr); procedure Color (v : RGBA_Color); procedure Color4fv (v : GL.floatPtr); procedure Color4iv (v : GL.intPointer); procedure Color4sv (v : GL.shortPtr); procedure Color4ubv (v : GL.ubytePtr); procedure Color4uiv (v : GL.uintPtr); procedure Color4usv (v : GL.ushortPtr); -- Texture coordinates procedure TexCoord1d (s : GL.Double); procedure TexCoord1f (s : GL.C_Float); procedure TexCoord1i (s : GL.Int); procedure TexCoord1s (s : GL.Short); procedure TexCoord (s : GL.Double; t : GL.Double); procedure TexCoordf (s : GL.C_Float; t : GL.C_Float); procedure TexCoord2i (s : GL.Int; t : GL.Int); procedure TexCoord2s (s : GL.Short; t : GL.Short); procedure TexCoord3d (s : GL.Double; t : GL.Double; r : GL.Double); procedure TexCoord3f (s : GL.C_Float; t : GL.C_Float; r : GL.C_Float); procedure TexCoord3i (s : GL.Int; t : GL.Int; r : GL.Int); procedure TexCoord3s (s : GL.Short; t : GL.Short; r : GL.Short); procedure TexCoord4d (s : GL.Double; t : GL.Double; r : GL.Double; q : GL.Double); procedure TexCoord4f (s : GL.C_Float; t : GL.C_Float; r : GL.C_Float; q : GL.C_Float); procedure TexCoord4i (s : GL.Int; t : GL.Int; r : GL.Int; q : GL.Int); procedure TexCoord4s (s : GL.Short; t : GL.Short; r : GL.Short; q : GL.Short); procedure TexCoord1dv (v : GL.doublePtr); procedure TexCoord1fv (v : floatPtr); procedure TexCoord1iv (v : GL.intPointer); procedure TexCoord1sv (v : GL.shortPtr); procedure TexCoord2dv (v : GL.doublePtr); procedure TexCoord2fv (v : floatPtr); procedure TexCoord2iv (v : GL.intPointer); procedure TexCoord2sv (v : GL.shortPtr); procedure TexCoord3dv (v : GL.doublePtr); procedure TexCoord3fv (v : floatPtr); procedure TexCoord3iv (v : GL.intPointer); procedure TexCoord3sv (v : GL.shortPtr); procedure TexCoord4dv (v : GL.doublePtr); procedure TexCoord4fv (v : floatPtr); procedure TexCoord4iv (v : GL.intPointer); procedure TexCoord4sv (v : GL.shortPtr); -- Pixel op raster position procedure RasterPos2d (x : GL.Double; y : GL.Double); procedure RasterPos2f (x : GL.C_Float; y : GL.C_Float); procedure RasterPos (x, y : GL.Int); procedure RasterPos2s (x : GL.Short; y : GL.Short); procedure RasterPos3d (x : GL.Double; y : GL.Double; z : GL.Double); procedure RasterPos3f (x : GL.C_Float; y : GL.C_Float; z : GL.C_Float); procedure RasterPos3i (x : GL.Int; y : GL.Int; z : GL.Int); procedure RasterPos3s (x : GL.Short; y : GL.Short; z : GL.Short); procedure RasterPos4d (x : GL.Double; y : GL.Double; z : GL.Double; w : GL.Double); procedure RasterPos4f (x : GL.C_Float; y : GL.C_Float; z : GL.C_Float; w : GL.C_Float); procedure RasterPos4i (x : GL.Int; y : GL.Int; z : GL.Int; w : GL.Int); procedure RasterPos4s (x : GL.Short; y : GL.Short; z : GL.Short; w : GL.Short); procedure RasterPos2dv (v : GL.doublePtr); procedure RasterPos2fv (v : floatPtr); procedure RasterPos2iv (v : GL.intPointer); procedure RasterPos2sv (v : GL.shortPtr); procedure RasterPos3dv (v : GL.doublePtr); procedure RasterPos3fv (v : floatPtr); procedure RasterPos3iv (v : GL.intPointer); procedure RasterPos3sv (v : GL.shortPtr); procedure RasterPos4dv (v : GL.doublePtr); procedure RasterPos4fv (v : floatPtr); procedure RasterPos4iv (v : GL.intPointer); procedure RasterPos4sv (v : GL.shortPtr); -- Rectangles procedure Rectd (x1 : GL.Double; y1 : GL.Double; x2 : GL.Double; y2 : GL.Double); procedure Rectf (x1 : GL.C_Float; y1 : GL.C_Float; x2 : GL.C_Float; y2 : GL.C_Float); procedure Recti (x1 : GL.Int; y1 : GL.Int; x2 : GL.Int; y2 : GL.Int); procedure Rects (x1 : GL.Short; y1 : GL.Short; x2 : GL.Short; y2 : GL.Short); procedure Rectdv (v1 : GL.doublePtr; v2 : GL.doublePtr); procedure Rectfv (v1 : floatPtr; v2 : floatPtr); procedure Rectiv (v1 : GL.intPointer; v2 : GL.intPointer); procedure Rectsv (v1 : GL.shortPtr; v2 : GL.shortPtr); -- Bitmap procedure Bitmap (width : GL.Sizei; height : GL.Sizei; xorig : GL.C_Float; yorig : GL.C_Float; xmove : GL.C_Float; ymove : GL.C_Float; bitmap : ubytePtr); -- Stenciling procedure StencilMask (mask : GL.Uint); procedure ClearStencil (s : GL.Int); -- Selections and name stack procedure SelectBuffer (size : GL.Sizei; buffer : GL.uintPtr); procedure InitNames; procedure LoadName (name : GL.Uint); procedure PushName (name : GL.Uint); procedure PopName; -- Mesa - specific routines procedure WindowPos2iMESA (x : GL.Int; y : GL.Int); procedure WindowPos2sMESA (x : GL.Short; y : GL.Short); procedure WindowPos2fMESA (x : GL.C_Float; y : GL.C_Float); procedure WindowPos2dMESA (x : GL.Double; y : GL.Double); procedure WindowPos2ivMESA (p : GL.intPointer); procedure WindowPos2svMESA (p : GL.shortPtr); procedure WindowPos2fvMESA (p : floatPtr); procedure WindowPos2dvMESA (p : GL.doublePtr); procedure WindowPos3iMESA (x : GL.Int; y : GL.Int; z : GL.Int); procedure WindowPos3sMESA (x : GL.Short; y : GL.Short; z : GL.Short); procedure WindowPos3fMESA (x : GL.C_Float; y : GL.C_Float; z : GL.C_Float); procedure WindowPos3dMESA (x : GL.Double; y : GL.Double; z : GL.Double); procedure WindowPos3ivMESA (p : GL.intPointer); procedure WindowPos3svMESA (p : GL.shortPtr); procedure WindowPos3fvMESA (p : floatPtr); procedure WindowPos3dvMESA (p : GL.doublePtr); procedure WindowPos4iMESA (x : GL.Int; y : GL.Int; z : GL.Int; w : GL.Int); procedure WindowPos4sMESA (x : GL.Short; y : GL.Short; z : GL.Short; w : GL.Short); procedure WindowPos4fMESA (x : GL.C_Float; y : GL.C_Float; z : GL.C_Float; w : GL.C_Float); procedure WindowPos4dMESA (x : GL.Double; y : GL.Double; z : GL.Double; w : GL.Double); procedure WindowPos4ivMESA (p : GL.intPointer); procedure WindowPos4svMESA (p : GL.shortPtr); procedure WindowPos4fvMESA (p : floatPtr); procedure WindowPos4dvMESA (p : GL.doublePtr); procedure ResizeBuffersMESA; -- vertex buffer objects (GL 1.5 extension) -- procedure Gen_Buffers (n : GL.Sizei; buffers : GL.uintPtr); procedure Delete_Buffers (n : GL.Sizei; buffers : GL.uintPtr); type VBO_Target is ( ARRAY_BUFFER, ELEMENT_ARRAY_BUFFER, PIXEL_PACK_BUFFER, PIXEL_UNPACK_BUFFER ); for VBO_Target use ( ARRAY_BUFFER => 16#8892#, ELEMENT_ARRAY_BUFFER => 16#8893#, PIXEL_PACK_BUFFER => 16#88EB#, PIXEL_UNPACK_BUFFER => 16#88EC# ); procedure BindBuffer (target : VBO_Target; buffer : GL.Uint); type VBO_Usage is ( STREAM_DRAW, STREAM_READ, STREAM_COPY, STATIC_DRAW, STATIC_READ, STATIC_COPY, DYNAMIC_DRAW, DYNAMIC_READ, DYNAMIC_COPY ); for VBO_Usage use ( STREAM_DRAW => 16#88E0#, STREAM_READ => 16#88E1#, STREAM_COPY => 16#88E2#, STATIC_DRAW => 16#88E4#, STATIC_READ => 16#88E5#, STATIC_COPY => 16#88E6#, DYNAMIC_DRAW => 16#88E8#, DYNAMIC_READ => 16#88E9#, DYNAMIC_COPY => 16#88EA# ); procedure Buffer_Data (target : GL.VBO_Target; size : GL.sizeiPtr; data : GL.pointer; usage : GL.VBO_Usage); procedure BufferSubData (target : GL.VBO_Target; offset : GL.intPtr; size : GL.sizeiPtr; data : GL.pointer); type Access_Policy is ( READ_ONLY, WRITE_ONLY, READ_WRITE ); for Access_Policy use ( READ_ONLY => 16#88B8#, WRITE_ONLY => 16#88B9#, READ_WRITE => 16#88BA# ); function MapBuffer (target : GL.VBO_Target; Policy : GL.Access_Policy) return GL.pointer; function UnmapBuffer (target : GL.VBO_Target) return GL_Boolean; type Buffer_Parameter is ( BUFFER_SIZE, BUFFER_USAGE, BUFFER_ACCESS, BUFFER_MAPPED ); for Buffer_Parameter use ( BUFFER_SIZE => 16#8764#, BUFFER_USAGE => 16#8765#, BUFFER_ACCESS => 16#88BB#, BUFFER_MAPPED => 16#88BC# ); procedure GetBufferParameter (target : GL.VBO_Target; value : Buffer_Parameter; data : intPointer); ------------------------------------------------------------------------------ private -- Workaround for GNAT 3.15p (OA 7.2.2 OK), when applying pragma Import to all -- functions named GetString: -- - > convention for "GetString" does not permit returning unconstrained array type function glGetString (name : StringEnm) return ubytePtr; function GetString (name : StringEnm) return ubytePtr renames glGetString; -- GdM : renames for getting rid of pointers and " .. .4f"- style suffixes -- The following wrappers are automatically generated by -- the GL_Overloader tool. To generate other wrappers easily, -- look at GL_Overloader.adb . -- Wrapper for color3d procedure color3d (red, green, blue : GL.Double); procedure Color (red, green, blue : GL.Double) renames color3d; -- Wrapper for color3f procedure color3f (red, green, blue : GL.C_Float); procedure Color_f (red, green, blue : GL.C_Float) renames color3f; -- Wrapper for color3i procedure color3i (red, green, blue : GL.Int); procedure Color (red, green, blue : GL.Int) renames color3i; -- Wrapper for color3s procedure color3s (red, green, blue : GL.Short); procedure Color_s (red, green, blue : GL.Short) renames color3s; -- Wrapper for color4d procedure color4d (red, green, blue, alpha : GL.Double); procedure Color (red, green, blue, alpha : GL.Double) renames color4d; -- Wrapper for color4f procedure color4f (red, green, blue, alpha : GL.C_Float); procedure Color_f (red, green, blue, alpha : GL.C_Float) renames color4f; -- Wrapper for color4i procedure color4i (red, green, blue, alpha : GL.Int); procedure Color (red, green, blue, alpha : GL.Int) renames color4i; -- Wrapper for color4s procedure color4s (red, green, blue, alpha : GL.Short); procedure Color_s (red, green, blue, alpha : GL.Short) renames color4s; -- Wrappers for Get procedure GetDoublev (pname : ParameterNameEnm; params : GL.doublePtr); procedure Get (pname : ParameterNameEnm; params : GL.doublePtr) renames GetDoublev; -- Wrappers for Light procedure Lightf (light_id : LightIDEnm; pname : LightParameterEnm; param : GL.C_Float); procedure Light (light_id : LightIDEnm; pname : LightParameterEnm; param : GL.C_Float) renames Lightf; procedure Lightfv (light_id : LightIDEnm; pname : LightParameterVEnm; params : floatPtr); -- Wrappers for Material procedure Materialf (face : FaceEnm; pname : MaterialParameterEnm; param : GL.C_Float); procedure Material (face : FaceEnm; pname : MaterialParameterEnm; param : GL.C_Float) renames Materialf; procedure Materialfv (face : FaceEnm; pname : MaterialParameterVEnm; params : floatPtr); -- Wrapper for Normal3d procedure Normal3d (x, y, z : GL.Double); procedure Normal (x, y, z : GL.Double) renames Normal3d; -- Wrapper for Normal3f procedure Normal3f (x, y, z : GL.C_Float); procedure Normal_f (x, y, z : GL.C_Float) renames Normal3f; -- Wrapper for Normal3i procedure Normal3i (x, y, z : GL.Int); procedure Normal (x, y, z : GL.Int) renames Normal3i; -- Wrapper for Normal3b procedure Normal3b (x, y, z : GL.Byte); procedure Normal_b (x, y, z : GL.Byte) renames Normal3b; -- Wrapper for Normal3s procedure Normal3s (x, y, z : GL.Short); procedure Normal_s (x, y, z : GL.Short) renames Normal3s; procedure PixelStorei (pname : PixelStorageEnm; param : GL.Int); procedure PixelStore (pname : PixelStorageEnm; param : GL.Int) renames PixelStorei; procedure RasterPos2i (x : GL.Int; y : GL.Int); procedure RasterPos (x, y : GL.Int) renames RasterPos2i; procedure Rotated (angle : GL.Double; x : GL.Double; y : GL.Double; z : GL.Double); procedure Rotate (angle : GL.Double; x : GL.Double; y : GL.Double; z : GL.Double) renames Rotated; procedure Rotatef (angle : GL.C_Float; x : GL.C_Float; y : GL.C_Float; z : GL.C_Float); procedure Rotate_f (angle : GL.C_Float; x : GL.C_Float; y : GL.C_Float; z : GL.C_Float) renames Rotatef; -- Wrapper for scaled procedure scaled (x, y, z : GL.Double); procedure Scale (x, y, z : GL.Double) renames scaled; -- Wrapper for scalef procedure scalef (x, y, z : GL.C_Float); procedure Scale_f (x, y, z : GL.C_Float) renames scalef; procedure TexCoord2d (s : GL.Double; t : GL.Double); procedure TexCoord (s : GL.Double; t : GL.Double) renames TexCoord2d; procedure TexCoord2f (s : GL.C_Float; t : GL.C_Float); procedure TexCoordf (s : GL.C_Float; t : GL.C_Float) renames TexCoord2f; procedure TexEnvi (target : TexEnvEnm; pname : TexEnvParameterEnm; param : GL.Int); procedure TexEnv (target : TexEnvEnm; pname : TexEnvParameterEnm; param : GL.Int) renames TexEnvi; procedure TexParameteri (target : TargetTexEnm; pname : TexParamEnm; param : GL.Int); procedure TexParameter (target : TargetTexEnm; pname : TexParamEnm; param : GL.Int) renames TexParameteri; -- Wrapper for translated procedure translated (x, y, z : GL.Double); procedure Translate (x, y, z : GL.Double) renames translated; -- Wrapper for translatef procedure translatef (x, y, z : GL.C_Float); procedure Translate_f (x, y, z : GL.C_Float) renames translatef; -- Wrapper for vertex2d procedure vertex2d (x, y : GL.Double); procedure Vertex (x, y : GL.Double) renames vertex2d; -- Wrapper for vertex2f procedure vertex2f (x, y : GL.C_Float); procedure Vertex_f (x, y : GL.C_Float) renames vertex2f; -- Wrapper for vertex2i procedure vertex2i (x, y : GL.Int); procedure Vertex (x, y : GL.Int) renames vertex2i; -- Wrapper for vertex2s procedure vertex2s (x, y : GL.Short); procedure Vertex_s (x, y : GL.Short) renames vertex2s; -- Wrapper for vertex3d procedure vertex3d (x, y, z : GL.Double); procedure Vertex (x, y, z : GL.Double) renames vertex3d; -- Wrapper for vertex3f procedure vertex3f (x, y, z : GL.C_Float); procedure Vertex_f (x, y, z : GL.C_Float) renames vertex3f; -- Wrapper for vertex3i procedure vertex3i (x, y, z : GL.Int); procedure Vertex (x, y, z : GL.Int) renames vertex3i; -- Wrapper for vertex3s procedure vertex3s (x, y, z : GL.Short); procedure Vertex_s (x, y, z : GL.Short) renames vertex3s; -- Wrapper for vertex4d procedure vertex4d (x, y, z, w : GL.Double); procedure Vertex (x, y, z, w : GL.Double) renames vertex4d; -- Wrapper for vertex4f procedure vertex4f (x, y, z, w : GL.C_Float); procedure Vertex_f (x, y, z, w : GL.C_Float) renames vertex4f; -- Wrapper for vertex4i procedure vertex4i (x, y, z, w : GL.Int); procedure Vertex (x, y, z, w : GL.Int) renames vertex4i; -- Wrapper for vertex4s procedure vertex4s (x, y, z, w : GL.Short); procedure Vertex_s (x, y, z, w : GL.Short) renames vertex4s; -- Some renames due to possible ambiguity with enumerated -- values (Accum, Clear, Viewport) that can be interpreted -- as a parameterless function, confusing then pragma Import -- on the Janus compiler and not GNAT and ObjectAda. -- GM/TM 9 - Sep - 2006 procedure glAccum (op : AccumEnm; value : GL.C_Float); procedure Accum (op : AccumEnm; value : GL.C_Float) renames glAccum; -- procedure glClear (mask : Bitfield); procedure Clear (mask : Bitfield) renames glClear; -- procedure glViewport (x : GL.Int; y : GL.Int; width : GL.Sizei; height : GL.Sizei); procedure Viewport (x : GL.Int; y : GL.Int; width : GL.Sizei; height : GL.Sizei) renames glViewport; ----------------- -- Interfacing -- ----------------- pragma Import (Stdcall, ClearIndex, "glClearIndex"); pragma Import (Stdcall, ClearColor, "glClearColor"); pragma Import (Stdcall, glClear, "glClear"); pragma Import (Stdcall, IndexMask, "glIndexMask"); pragma Import (Stdcall, ColorMask, "glColorMask"); pragma Import (Stdcall, Alpha_Func, "glAlphaFunc"); pragma Import (Stdcall, BlendFunc, "glBlendFunc"); pragma Import (Stdcall, LogicOp, "glLogicOp"); pragma Import (Stdcall, CullFace, "glCullFace"); pragma Import (Stdcall, FrontFace, "glFrontFace"); pragma Import (Stdcall, PointSize, "glPointSize"); pragma Import (Stdcall, LineWidth, "glLineWidth"); pragma Import (Stdcall, LineStipple, "glLineStipple"); pragma Import (Stdcall, PolygonMode, "glPolygonMode"); pragma Import (Stdcall, PolygonOffset, "glPolygonOffset"); pragma Import (Stdcall, PolygonStipple, "glPolygonStipple"); pragma Import (Stdcall, GetPolygonStipple, "glGetPolygonStipple"); pragma Import (Stdcall, EdgeFlag, "glEdgeFlag"); pragma Import (Stdcall, EdgeFlagv, "glEdgeFlagv"); pragma Import (Stdcall, Scissor, "glScissor"); pragma Import (Stdcall, ClipPlane, "glClipPlane"); pragma Import (Stdcall, GetClipPlane, "glGetClipPlane"); pragma Import (Stdcall, DrawBuffer, "glDrawBuffer"); pragma Import (Stdcall, ReadBuffer, "glReadBuffer"); pragma Import (Stdcall, Enable, "glEnable"); pragma Import (Stdcall, Disable, "glDisable"); pragma Import (Stdcall, IsEnabled, "glIsEnabled"); pragma Import (Stdcall, Enable_Client_State, "glEnableClientState"); pragma Import (Stdcall, Disable_Client_State, "glDisableClientState"); pragma Import (Stdcall, GetBooleanv, "glGetBooleanv"); pragma Import (Stdcall, GetDoublev, "glGetDoublev"); pragma Import (Stdcall, GetFloatv, "glGetFloatv"); pragma Import (Stdcall, GetIntegerv, "glGetIntegerv"); pragma Import (Stdcall, PushAttrib, "glPushAttrib"); pragma Import (Stdcall, PopAttrib, "glPopAttrib"); pragma Import (Stdcall, PushClientAttrib, "glPushClientAttrib"); pragma Import (Stdcall, PopClientAttrib, "glPopClientAttrib"); pragma Import (Stdcall, RenderMode, "glRenderMode"); pragma Import (Stdcall, Get_Error, "glGetError"); pragma Import (Stdcall, glGetString, "glGetString"); pragma Import (Stdcall, Finish, "glFinish"); pragma Import (Stdcall, Flush, "glFlush"); pragma Import (Stdcall, Hint, "glHint"); pragma Import (Stdcall, ClearDepth, "glClearDepth"); pragma Import (Stdcall, DepthFunc, "glDepthFunc"); pragma Import (Stdcall, Depth_Mask, "glDepthMask"); pragma Import (Stdcall, DepthRange, "glDepthRange"); pragma Import (Stdcall, ClearAccum, "glClearAccum"); pragma Import (Stdcall, glAccum, "glAccum"); pragma Import (Stdcall, MatrixMode, "glMatrixMode"); pragma Import (Stdcall, Ortho, "glOrtho"); pragma Import (Stdcall, Frustum, "glFrustum"); pragma Import (Stdcall, glViewport, "glViewport"); pragma Import (Stdcall, PushMatrix, "glPushMatrix"); pragma Import (Stdcall, PopMatrix, "glPopMatrix"); pragma Import (Stdcall, LoadIdentity, "glLoadIdentity"); pragma Import (Stdcall, LoadMatrixd, "glLoadMatrixd"); pragma Import (Stdcall, LoadMatrixf, "glLoadMatrixf"); pragma Import (Stdcall, MultMatrixd, "glMultMatrixd"); pragma Import (Stdcall, MultMatrixf, "glMultMatrixf"); pragma Import (Stdcall, Rotated, "glRotated"); pragma Import (Stdcall, Rotatef, "glRotatef"); pragma Import (Stdcall, scaled, "glScaled"); pragma Import (Stdcall, scalef, "glScalef"); pragma Import (Stdcall, translated, "glTranslated"); pragma Import (Stdcall, translatef, "glTranslatef"); pragma Import (Stdcall, IsList, "glIsList"); pragma Import (Stdcall, DeleteLists, "glDeleteLists"); pragma Import (Stdcall, GenLists, "glGenLists"); pragma Import (Stdcall, NewList, "glNewList"); pragma Import (Stdcall, EndList, "glEndList"); pragma Import (Stdcall, CallList, "glCallList"); pragma Import (Stdcall, CallLists, "glCallLists"); pragma Import (Stdcall, ListBase, "glListBase"); pragma Import (Stdcall, GL_Begin, "glBegin"); pragma Import (Stdcall, GL_End, "glEnd"); pragma Import (Stdcall, vertex2d, "glVertex2d"); pragma Import (Stdcall, vertex2f, "glVertex2f"); pragma Import (Stdcall, vertex2i, "glVertex2i"); pragma Import (Stdcall, vertex2s, "glVertex2s"); pragma Import (Stdcall, vertex3d, "glVertex3d"); pragma Import (Stdcall, vertex3f, "glVertex3f"); pragma Import (Stdcall, vertex3i, "glVertex3i"); pragma Import (Stdcall, vertex3s, "glVertex3s"); pragma Import (Stdcall, vertex4d, "glVertex4d"); pragma Import (Stdcall, vertex4f, "glVertex4f"); pragma Import (Stdcall, vertex4i, "glVertex4i"); pragma Import (Stdcall, vertex4s, "glVertex4s"); pragma Import (Stdcall, Vertex2dv, "glVertex2dv"); pragma Import (Stdcall, Vertex2fv, "glVertex2fv"); pragma Import (Stdcall, Vertex2iv, "glVertex2iv"); pragma Import (Stdcall, Vertex2sv, "glVertex2sv"); pragma Import (Stdcall, Vertex3dv, "glVertex3dv"); pragma Import (Stdcall, Vertex3fv, "glVertex3fv"); pragma Import (Stdcall, Vertex3iv, "glVertex3iv"); pragma Import (Stdcall, Vertex3sv, "glVertex3sv"); pragma Import (Stdcall, Vertex4dv, "glVertex4dv"); pragma Import (Stdcall, Vertex4fv, "glVertex4fv"); pragma Import (Stdcall, Vertex4iv, "glVertex4iv"); pragma Import (Stdcall, Vertex4sv, "glVertex4sv"); pragma Import (Stdcall, Normal3b, "glNormal3b"); pragma Import (Stdcall, Normal3d, "glNormal3d"); pragma Import (Stdcall, Normal3f, "glNormal3f"); pragma Import (Stdcall, Normal3i, "glNormal3i"); pragma Import (Stdcall, Normal3s, "glNormal3s"); pragma Import (Stdcall, Normal3bv, "glNormal3bv"); pragma Import (Stdcall, Normal3dv, "glNormal3dv"); pragma Import (Stdcall, Normal3fv, "glNormal3fv"); pragma Import (Stdcall, Normal3iv, "glNormal3iv"); pragma Import (Stdcall, Normal3sv, "glNormal3sv"); pragma Import (Stdcall, Indexd, "glIndexd"); pragma Import (Stdcall, Indexf, "glIndexf"); pragma Import (Stdcall, Indexi, "glIndexi"); pragma Import (Stdcall, Indexs, "glIndexs"); pragma Import (Stdcall, Indexub, "glIndexub"); pragma Import (Stdcall, Indexdv, "glIndexdv"); pragma Import (Stdcall, Indexfv, "glIndexfv"); pragma Import (Stdcall, Indexiv, "glIndexiv"); pragma Import (Stdcall, Indexsv, "glIndexsv"); pragma Import (Stdcall, Indexubv, "glIndexubv"); pragma Import (Stdcall, Color3b, "glColor3b"); pragma Import (Stdcall, color3d, "glColor3d"); pragma Import (Stdcall, color3f, "glColor3f"); pragma Import (Stdcall, color3i, "glColor3i"); pragma Import (Stdcall, color3s, "glColor3s"); pragma Import (Stdcall, Color3ub, "glColor3ub"); pragma Import (Stdcall, Color3ui, "glColor3ui"); pragma Import (Stdcall, Color3us, "glColor3us"); pragma Import (Stdcall, Color4b, "glColor4b"); pragma Import (Stdcall, color4d, "glColor4d"); pragma Import (Stdcall, color4f, "glColor4f"); pragma Import (Stdcall, color4i, "glColor4i"); pragma Import (Stdcall, color4s, "glColor4s"); pragma Import (Stdcall, Color4ub, "glColor4ub"); pragma Import (Stdcall, Color4ui, "glColor4ui"); pragma Import (Stdcall, Color4us, "glColor4us"); pragma Import (Stdcall, Color3bv, "glColor3bv"); pragma Import (Stdcall, Color3dv, "glColor3dv"); pragma Import (Stdcall, Color3fv, "glColor3fv"); pragma Import (Stdcall, Color3iv, "glColor3iv"); pragma Import (Stdcall, Color3sv, "glColor3sv"); pragma Import (Stdcall, Color3ubv, "glColor3ubv"); pragma Import (Stdcall, Color3uiv, "glColor3uiv"); pragma Import (Stdcall, Color3usv, "glColor3usv"); pragma Import (Stdcall, Color4bv, "glColor4bv"); pragma Import (Stdcall, Color4dv, "glColor4dv"); pragma Import (Stdcall, Color4fv, "glColor4fv"); pragma Import (Stdcall, Color4iv, "glColor4iv"); pragma Import (Stdcall, Color4sv, "glColor4sv"); pragma Import (Stdcall, Color4ubv, "glColor4ubv"); pragma Import (Stdcall, Color4uiv, "glColor4uiv"); pragma Import (Stdcall, Color4usv, "glColor4usv"); pragma Import (Stdcall, TexCoord1d, "glTexCoord1d"); pragma Import (Stdcall, TexCoord1f, "glTexCoord1f"); pragma Import (Stdcall, TexCoord1i, "glTexCoord1i"); pragma Import (Stdcall, TexCoord1s, "glTexCoord1s"); pragma Import (Stdcall, TexCoord2d, "glTexCoord2d"); pragma Import (Stdcall, TexCoord2f, "glTexCoord2f"); pragma Import (Stdcall, TexCoord2i, "glTexCoord2i"); pragma Import (Stdcall, TexCoord2s, "glTexCoord2s"); pragma Import (Stdcall, TexCoord3d, "glTexCoord3d"); pragma Import (Stdcall, TexCoord3f, "glTexCoord3f"); pragma Import (Stdcall, TexCoord3i, "glTexCoord3i"); pragma Import (Stdcall, TexCoord3s, "glTexCoord3s"); pragma Import (Stdcall, TexCoord4d, "glTexCoord4d"); pragma Import (Stdcall, TexCoord4f, "glTexCoord4f"); pragma Import (Stdcall, TexCoord4i, "glTexCoord4i"); pragma Import (Stdcall, TexCoord4s, "glTexCoord4s"); pragma Import (Stdcall, TexCoord1dv, "glTexCoord1dv"); pragma Import (Stdcall, TexCoord1fv, "glTexCoord1fv"); pragma Import (Stdcall, TexCoord1iv, "glTexCoord1iv"); pragma Import (Stdcall, TexCoord1sv, "glTexCoord1sv"); pragma Import (Stdcall, TexCoord2dv, "glTexCoord2dv"); pragma Import (Stdcall, TexCoord2fv, "glTexCoord2fv"); pragma Import (Stdcall, TexCoord2iv, "glTexCoord2iv"); pragma Import (Stdcall, TexCoord2sv, "glTexCoord2sv"); pragma Import (Stdcall, TexCoord3dv, "glTexCoord3dv"); pragma Import (Stdcall, TexCoord3fv, "glTexCoord3fv"); pragma Import (Stdcall, TexCoord3iv, "glTexCoord3iv"); pragma Import (Stdcall, TexCoord3sv, "glTexCoord3sv"); pragma Import (Stdcall, TexCoord4dv, "glTexCoord4dv"); pragma Import (Stdcall, TexCoord4fv, "glTexCoord4fv"); pragma Import (Stdcall, TexCoord4iv, "glTexCoord4iv"); pragma Import (Stdcall, TexCoord4sv, "glTexCoord4sv"); pragma Import (Stdcall, RasterPos2d, "glRasterPos2d"); pragma Import (Stdcall, RasterPos2f, "glRasterPos2f"); pragma Import (Stdcall, RasterPos2i, "glRasterPos2i"); pragma Import (Stdcall, RasterPos2s, "glRasterPos2s"); pragma Import (Stdcall, RasterPos3d, "glRasterPos3d"); pragma Import (Stdcall, RasterPos3f, "glRasterPos3f"); pragma Import (Stdcall, RasterPos3i, "glRasterPos3i"); pragma Import (Stdcall, RasterPos3s, "glRasterPos3s"); pragma Import (Stdcall, RasterPos4d, "glRasterPos4d"); pragma Import (Stdcall, RasterPos4f, "glRasterPos4f"); pragma Import (Stdcall, RasterPos4i, "glRasterPos4i"); pragma Import (Stdcall, RasterPos4s, "glRasterPos4s"); pragma Import (Stdcall, RasterPos2dv, "glRasterPos2dv"); pragma Import (Stdcall, RasterPos2fv, "glRasterPos2fv"); pragma Import (Stdcall, RasterPos2iv, "glRasterPos2iv"); pragma Import (Stdcall, RasterPos2sv, "glRasterPos2sv"); pragma Import (Stdcall, RasterPos3dv, "glRasterPos3dv"); pragma Import (Stdcall, RasterPos3fv, "glRasterPos3fv"); pragma Import (Stdcall, RasterPos3iv, "glRasterPos3iv"); pragma Import (Stdcall, RasterPos3sv, "glRasterPos3sv"); pragma Import (Stdcall, RasterPos4dv, "glRasterPos4dv"); pragma Import (Stdcall, RasterPos4fv, "glRasterPos4fv"); pragma Import (Stdcall, RasterPos4iv, "glRasterPos4iv"); pragma Import (Stdcall, RasterPos4sv, "glRasterPos4sv"); pragma Import (Stdcall, Rectd, "glRectd"); pragma Import (Stdcall, Rectf, "glRectf"); pragma Import (Stdcall, Recti, "glRecti"); pragma Import (Stdcall, Rects, "glRects"); pragma Import (Stdcall, Rectdv, "glRectdv"); pragma Import (Stdcall, Rectfv, "glRectfv"); pragma Import (Stdcall, Rectiv, "glRectiv"); pragma Import (Stdcall, Rectsv, "glRectsv"); pragma Import (Stdcall, VertexPointer, "glVertexPointer"); pragma Import (Stdcall, Normal_Pointer, "glNormalPointer"); pragma Import (Stdcall, ColorPointer, "glColorPointer"); pragma Import (Stdcall, IndexPointer, "glIndexPointer"); pragma Import (Stdcall, Tex_Coord_Pointer, "glTexCoordPointer"); pragma Import (Stdcall, EdgeFlagPointer, "glEdgeFlagPointer"); pragma Import (Stdcall, GetPointerv, "glGetPointerv"); pragma Import (Stdcall, ArrayElement, "glArrayElement"); pragma Import (Stdcall, DrawArrays, "glDrawArrays"); pragma Import (Stdcall, DrawElements, "glDrawElements"); pragma Import (Stdcall, interleavedArrays, "GL.interleavedArrays"); pragma Import (Stdcall, ShadeModel, "glShadeModel"); pragma Import (Stdcall, Lightf, "glLightf"); pragma Import (Stdcall, Lighti, "glLighti"); pragma Import (Stdcall, Lightfv, "glLightfv"); pragma Import (Stdcall, Lightiv, "glLightiv"); pragma Import (Stdcall, GetLightfv, "glGetLightfv"); pragma Import (Stdcall, GetLightiv, "glGetLightiv"); pragma Import (Stdcall, LightModelf, "glLightModelf"); pragma Import (Stdcall, LightModeli, "glLightModeli"); pragma Import (Stdcall, LightModelfv, "glLightModelfv"); pragma Import (Stdcall, LightModeliv, "glLightModeliv"); pragma Import (Stdcall, Materialf, "glMaterialf"); pragma Import (Stdcall, Materiali, "glMateriali"); pragma Import (Stdcall, Materialfv, "glMaterialfv"); pragma Import (Stdcall, Materialiv, "glMaterialiv"); pragma Import (Stdcall, GetMaterialfv, "glGetMaterialfv"); pragma Import (Stdcall, GetMaterialiv, "glGetMaterialiv"); pragma Import (Stdcall, ColorMaterial, "glColorMaterial"); pragma Import (Stdcall, PixelZoom, "glPixelZoom"); pragma Import (Stdcall, PixelStoref, "glPixelStoref"); pragma Import (Stdcall, PixelStorei, "glPixelStorei"); pragma Import (Stdcall, PixelTransferf, "glPixelTransferf"); pragma Import (Stdcall, PixelTransferi, "glPixelTransferi"); pragma Import (Stdcall, PixelMapfv, "glPixelMapfv"); pragma Import (Stdcall, PixelMapuiv, "glPixelMapuiv"); pragma Import (Stdcall, PixelMapusv, "glPixelMapusv"); pragma Import (Stdcall, GetPixelMapfv, "glGetPixelMapfv"); pragma Import (Stdcall, GetPixelMapuiv, "glGetPixelMapuiv"); pragma Import (Stdcall, GetPixelMapusv, "glGetPixelMapusv"); pragma Import (Stdcall, Bitmap, "glBitmap"); pragma Import (Stdcall, ReadPixels, "glReadPixels"); pragma Import (Stdcall, DrawPixels, "glDrawPixels"); pragma Import (Stdcall, CopyPixels, "glCopyPixels"); pragma Import (Stdcall, StencilFunc, "glStencilFunc"); pragma Import (Stdcall, StencilMask, "glStencilMask"); pragma Import (Stdcall, StencilOp, "glStencilOp"); pragma Import (Stdcall, ClearStencil, "glClearStencil"); pragma Import (Stdcall, TexGend, "glTexGend"); pragma Import (Stdcall, TexGenf, "glTexGenf"); pragma Import (Stdcall, TexGeni, "glTexGeni"); pragma Import (Stdcall, TexGendv, "glTexGendv"); pragma Import (Stdcall, TexGenfv, "glTexGenfv"); pragma Import (Stdcall, TexGeniv, "glTexGeniv"); pragma Import (Stdcall, GetTexGendv, "glGetTexGendv"); pragma Import (Stdcall, GetTexGenfv, "glGetTexGenfv"); pragma Import (Stdcall, GetTexGeniv, "glGetTexGeniv"); pragma Import (Stdcall, TexEnvf, "glTexEnvf"); pragma Import (Stdcall, TexEnvi, "glTexEnvi"); pragma Import (Stdcall, TexEnvfv, "glTexEnvfv"); pragma Import (Stdcall, TexEnviv, "glTexEnviv"); pragma Import (Stdcall, GetTexEnvfv, "glGetTexEnvfv"); pragma Import (Stdcall, GetTexEnviv, "glGetTexEnviv"); pragma Import (Stdcall, TexParameterf, "glTexParameterf"); pragma Import (Stdcall, TexParameteri, "glTexParameteri"); pragma Import (Stdcall, TexParameterfv, "glTexParameterfv"); pragma Import (Stdcall, TexParameteriv, "glTexParameteriv"); pragma Import (Stdcall, GetTexParameterfv, "glGetTexParameterfv"); pragma Import (Stdcall, GetTexParameteriv, "glGetTexParameteriv"); pragma Import (Stdcall, GetTexLevelParameterfv, "glGetTexLevelParameterfv"); pragma Import (Stdcall, GetTexLevelParameteriv, "glGetTexLevelParameteriv"); pragma Import (Stdcall, TexImage1D, "glTexImage1D"); pragma Import (Stdcall, TexImage2D, "glTexImage2D"); pragma Import (Stdcall, GetTexImage, "glGetTexImage"); pragma Import (Stdcall, Gen_Textures, "glGenTextures"); pragma Import (Stdcall, Delete_Textures, "glDeleteTextures"); pragma Import (Stdcall, BindTexture, "glBindTexture"); pragma Import (Stdcall, PrioritizeTextures, "glPrioritizeTextures"); pragma Import (Stdcall, AreTexturesResident, "glAreTexturesResident"); pragma Import (Stdcall, IsTexture, "glIsTexture"); pragma Import (Stdcall, TexSubImage1D, "glTexSubImage1D"); pragma Import (Stdcall, TexSubImage2D, "glTexSubImage2D"); pragma Import (Stdcall, CopyTexImage1D, "glCopyTexImage1D"); pragma Import (Stdcall, CopyTexImage2D, "glCopyTexImage2D"); pragma Import (Stdcall, CopyTexSubImage1D, "glCopyTexSubImage1D"); pragma Import (Stdcall, CopyTexSubImage2D, "glCopyTexSubImage2D"); pragma Import (Stdcall, Map1d, "glMap1d"); pragma Import (Stdcall, Map1f, "glMap1f"); pragma Import (Stdcall, Map2d, "glMap2d"); pragma Import (Stdcall, Map2f, "glMap2f"); pragma Import (Stdcall, GetMapdv, "glGetMapdv"); pragma Import (Stdcall, GetMapfv, "glGetMapfv"); pragma Import (Stdcall, GetMapiv, "glGetMapiv"); pragma Import (Stdcall, EvalCoord1d, "glEvalCoord1d"); pragma Import (Stdcall, EvalCoord1f, "glEvalCoord1f"); pragma Import (Stdcall, EvalCoord1dv, "glEvalCoord1dv"); pragma Import (Stdcall, EvalCoord1fv, "glEvalCoord1fv"); pragma Import (Stdcall, EvalCoord2d, "glEvalCoord2d"); pragma Import (Stdcall, EvalCoord2f, "glEvalCoord2f"); pragma Import (Stdcall, EvalCoord2dv, "glEvalCoord2dv"); pragma Import (Stdcall, EvalCoord2fv, "glEvalCoord2fv"); pragma Import (Stdcall, MapGrid1d, "glMapGrid1d"); pragma Import (Stdcall, MapGrid1f, "glMapGrid1f"); pragma Import (Stdcall, MapGrid2d, "glMapGrid2d"); pragma Import (Stdcall, MapGrid2f, "glMapGrid2f"); pragma Import (Stdcall, EvalPoint1, "glEvalPoint1"); pragma Import (Stdcall, EvalPoint2, "glEvalPoint2"); pragma Import (Stdcall, EvalMesh1, "glEvalMesh1"); pragma Import (Stdcall, EvalMesh2, "glEvalMesh2"); pragma Import (Stdcall, Fogf, "glFogf"); pragma Import (Stdcall, Fogi, "glFogi"); pragma Import (Stdcall, Fogfv, "glFogfv"); pragma Import (Stdcall, Fogiv, "glFogiv"); pragma Import (Stdcall, FeedbackBuffer, "glFeedbackBuffer"); pragma Import (Stdcall, PassThrough, "glPassThrough"); pragma Import (Stdcall, SelectBuffer, "glSelectBuffer"); pragma Import (Stdcall, InitNames, "glInitNames"); pragma Import (Stdcall, LoadName, "glLoadName"); pragma Import (Stdcall, PushName, "glPushName"); pragma Import (Stdcall, PopName, "glPopName"); pragma Import (Stdcall, BlendEquationEXT, "glBlendEquationEXT"); pragma Import (Stdcall, BlendColorEXT, "glBlendColorEXT"); pragma Import (Stdcall, TexImage3DEXT, "glTexImage3DEXT"); pragma Import (Stdcall, TexSubImage3DEXT, "glTexSubImage3DEXT"); pragma Import (Stdcall, CopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT"); pragma Import (Stdcall, ColorTableEXT, "glColorTableEXT"); pragma Import (Stdcall, ColorSubTableEXT, "glColorSubTableEXT"); pragma Import (Stdcall, GetColorTableEXT, "glGetColorTableEXT"); pragma Import (Stdcall, GetColorTableParameterfvEXT, "glGetColorTableParameterfvEXT"); pragma Import (Stdcall, GetColorTableParameterivEXT, "glGetColorTableParameterivEXT"); pragma Import (Stdcall, PointParameterfEXT, "glPointParameterfEXT"); pragma Import (Stdcall, PointParameterfvEXT, "glPointParameterfvEXT"); pragma Import (Stdcall, WindowPos2iMESA, "glWindowPos2iMESA"); pragma Import (Stdcall, WindowPos2sMESA, "glWindowPos2sMESA"); pragma Import (Stdcall, WindowPos2fMESA, "glWindowPos2fMESA"); pragma Import (Stdcall, WindowPos2dMESA, "glWindowPos2dMESA"); pragma Import (Stdcall, WindowPos2ivMESA, "glWindowPos2ivMESA"); pragma Import (Stdcall, WindowPos2svMESA, "glWindowPos2svMESA"); pragma Import (Stdcall, WindowPos2fvMESA, "glWindowPos2fvMESA"); pragma Import (Stdcall, WindowPos2dvMESA, "glWindowPos2dvMESA"); pragma Import (Stdcall, WindowPos3iMESA, "glWindowPos3iMESA"); pragma Import (Stdcall, WindowPos3sMESA, "glWindowPos3sMESA"); pragma Import (Stdcall, WindowPos3fMESA, "glWindowPos3fMESA"); pragma Import (Stdcall, WindowPos3dMESA, "glWindowPos3dMESA"); pragma Import (Stdcall, WindowPos3ivMESA, "glWindowPos3ivMESA"); pragma Import (Stdcall, WindowPos3svMESA, "glWindowPos3svMESA"); pragma Import (Stdcall, WindowPos3fvMESA, "glWindowPos3fvMESA"); pragma Import (Stdcall, WindowPos3dvMESA, "glWindowPos3dvMESA"); pragma Import (Stdcall, WindowPos4iMESA, "glWindowPos4iMESA"); pragma Import (Stdcall, WindowPos4sMESA, "glWindowPos4sMESA"); pragma Import (Stdcall, WindowPos4fMESA, "glWindowPos4fMESA"); pragma Import (Stdcall, WindowPos4dMESA, "glWindowPos4dMESA"); pragma Import (Stdcall, WindowPos4ivMESA, "glWindowPos4ivMESA"); pragma Import (Stdcall, WindowPos4svMESA, "glWindowPos4svMESA"); pragma Import (Stdcall, WindowPos4fvMESA, "glWindowPos4fvMESA"); pragma Import (Stdcall, WindowPos4dvMESA, "glWindowPos4dvMESA"); pragma Import (Stdcall, ResizeBuffersMESA, "glResizeBuffersMESA"); -- vertex buffer object imports (GL 1.5) -- pragma Convention (Stdcall, Gen_Buffers); pragma Convention (Stdcall, Delete_Buffers); pragma Convention (Stdcall, BindBuffer); pragma Convention (Stdcall, Buffer_Data); pragma Convention (Stdcall, BufferSubData); pragma Convention (Stdcall, MapBuffer); pragma Convention (Stdcall, UnmapBuffer); pragma Convention (Stdcall, GetBufferParameter); end GL;
oeis/041/A041145.asm
neoneye/loda-programs
11
160984
; A041145: Denominators of continued fraction convergents to sqrt(82). ; Submitted by <NAME>(s2) ; 1,18,325,5868,105949,1912950,34539049,623615832,11259624025,203296848282,3670602893101,66274148924100,1196605283526901,21605169252408318,390089651826876625,7043218902136187568,127168029890278252849,2296067756927144738850,41456387654578883552149,748511045539347048677532,13514655207362825759747725,244012304778070210724136582,4405736141212626618794206201,79547262846605349349019848200,1436256467380108914901151473801,25932163675688565817569746376618,468215202629774293631156586252925 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 mul $2,18 lpe mov $0,$1
experiments/test-suite/mutation-based/20/3/fullTree.als
kaiyuanw/AlloyFLCore
1
4214
pred test37 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node1 right = Node0->Node0 + Node0->Node1 + Node1->Node1 } } run test37 for 3 expect 0 pred test42 { some disj Node0: Node { Node = Node0 left = Node0->Node0 right = Node0->Node0 } } run test42 for 3 expect 1 pred test1 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node0->Node1 + Node1->Node1 right = Node0->Node1 + Node1->Node1 } } run test1 for 3 expect 1 pred test23 { some disj Node0, Node1: Node { Node = Node0 + Node1 no left right = Node0->Node1 + Node1->Node0 makeFull[] } } run test23 for 3 expect 0 pred test20 { some disj Node0, Node1, Node2: Node { Node = Node0 + Node1 + Node2 left = Node2->Node1 right = Node0->Node2 Acyclic[] } } run test20 for 3 expect 1 pred test15 { some disj Node0, Node1: Node { Node = Node0 + Node1 no left right = Node0->Node1 + Node1->Node0 Acyclic[] } } run test15 for 3 expect 0 pred test5 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node0->Node0 right = Node0->Node0 } } run test5 for 3 expect 1 pred test34 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 + Node1->Node1 right = Node1->Node1 } } run test34 for 3 expect 0
src/main/antlr/org/hibernate/query/sqm/hql/internal/antlr/HqlLexer.g4
hibernate/hibernate-semantic-query
9
6189
lexer grammar HqlLexer; @header { /* * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ package org.hibernate.sqm.parser.hql.internal.antlr; } WS : ( ' ' | '\t' | '\f' | EOL ) -> skip; fragment EOL : [\r\n]+; INTEGER_LITERAL : INTEGER_NUMBER ; fragment INTEGER_NUMBER : ('0' | '1'..'9' '0'..'9'*) ; LONG_LITERAL : INTEGER_NUMBER ('l'|'L'); BIG_INTEGER_LITERAL : INTEGER_NUMBER ('bi'|'BI') ; HEX_LITERAL : '0' ('x'|'X') HEX_DIGIT+ ('l'|'L')? ; fragment HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ; OCTAL_LITERAL : '0' ('0'..'7')+ ('l'|'L')? ; FLOAT_LITERAL : FLOATING_POINT_NUMBER ('f'|'F')? ; fragment FLOATING_POINT_NUMBER : ('0'..'9')+ '.' ('0'..'9')* EXPONENT? | '.' ('0'..'9')+ EXPONENT? | ('0'..'9')+ EXPONENT | ('0'..'9')+ ; DOUBLE_LITERAL : FLOATING_POINT_NUMBER ('d'|'D') ; BIG_DECIMAL_LITERAL : FLOATING_POINT_NUMBER ('bd'|'BD') ; fragment EXPONENT : ('e'|'E') ('+'|'-')? ('0'..'9')+ ; CHARACTER_LITERAL : '\'' ( ESCAPE_SEQUENCE | ~('\''|'\\') ) '\'' {setText(getText().substring(1, getText().length()-1));} ; STRING_LITERAL : '"' ( ESCAPE_SEQUENCE | ~('\\'|'"') )* '"' {setText(getText().substring(1, getText().length()-1));} | ('\'' ( ESCAPE_SEQUENCE | ~('\\'|'\'') )* '\'')+ {setText(getText().substring(1, getText().length()-1).replace("''", "'"));} ; fragment ESCAPE_SEQUENCE : '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\') | UNICODE_ESCAPE | OCTAL_ESCAPE ; fragment OCTAL_ESCAPE : '\\' ('0'..'3') ('0'..'7') ('0'..'7') | '\\' ('0'..'7') ('0'..'7') | '\\' ('0'..'7') ; fragment UNICODE_ESCAPE : '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ; // ESCAPE start tokens TIMESTAMP_ESCAPE_START : '{ts'; DATE_ESCAPE_START : '{d'; TIME_ESCAPE_START : '{t'; EQUAL : '='; NOT_EQUAL : '!=' | '^=' | '<>'; GREATER : '>'; GREATER_EQUAL : '>='; LESS : '<'; LESS_EQUAL : '<='; COMMA : ','; DOT : '.'; LEFT_PAREN : '('; RIGHT_PAREN : ')'; LEFT_BRACKET : '['; RIGHT_BRACKET : ']'; LEFT_BRACE : '{'; RIGHT_BRACE : '}'; PLUS : '+'; MINUS : '-'; ASTERISK : '*'; SLASH : '/'; PERCENT : '%'; AMPERSAND : '&'; SEMICOLON : ';'; COLON : ':'; PIPE : '|'; DOUBLE_PIPE : '||'; QUESTION_MARK : '?'; ARROW : '->'; // Keywords ABS : [aA] [bB] [sS]; AS : [aA] [sS]; ALL : [aA] [lL] [lL]; AND : [aA] [nN] [dD]; ANY : [aA] [nN] [yY]; ASC : [aA] [sS] [cC]; AVG : [aA] [vV] [gG]; BY : [bB] [yY]; BETWEEN : [bB] [eE] [tT] [wW] [eE] [eE] [nN]; BIT_LENGTH : [bB] [iI] [tT] [_] [lL] [eE] [nN] [gG] [tT] [hH]; BOTH : [bB] [oO] [tT] [hH]; CASE : [cC] [aA] [sS] [eE]; CAST : [cC] [aA] [sS] [tT]; CHARACTER_LENGTH : [cC] [hH] [aA] [rR] [aA] [cC] [tT] [eE] [rR] '_' [lL] [eE] [nN] [gG] [tT] [hH]; COALESCE : [cC] [oO] [aA] [lL] [eE] [sS] [cC] [eE]; COLLATE : [cC] [oO] [lL] [lL] [aA] [tT] [eE]; CONCAT : [cC] [oO] [nN] [cC] [aA] [tT]; COUNT : [cC] [oO] [uU] [nN] [tT]; CURRENT_DATE : [cC] [uU] [rR] [rR] [eE] [nN] [tT] '_' [dD] [aA] [tT] [eE]; CURRENT_TIME : [cC] [uU] [rR] [rR] [eE] [nN] [tT] '_' [tT] [iI] [mM] [eE]; CURRENT_TIMESTAMP : [cC] [uU] [rR] [rR] [eE] [nN] [tT] '_' [tT] [iI] [mM] [eE] [sS] [tT] [aA] [mM] [pP]; CROSS : [cC] [rR] [oO] [sS] [sS]; DAY : [dD] [aA] [yY]; DELETE : [dD] [eE] [lL] [eE] [tT] [eE]; DESC : [dD] [eE] [sS] [cC]; DISTINCT : [dD] [iI] [sS] [tT] [iI] [nN] [cC] [tT]; ELEMENTS : [eE] [lL] [eE] [mM] [eE] [nN] [tT] [sS]; ELSE : [eE] [lL] [sS] [eE]; EMPTY : [eE] [mM] [pP] [tT] [yY]; END : [eE] [nN] [dD]; ENTRY : [eE] [nN] [tT] [rR] [yY]; ESCAPE : [eE] [sS] [cC] [aA] [pP] [eE]; EXISTS : [eE] [xX] [iI] [sS] [tT] [sS]; EXTRACT : [eE] [xX] [tT] [rR] [aA] [cC] [tT]; FETCH : [fF] [eE] [tT] [cC] [hH]; FROM : [fF] [rR] [oO] [mM]; FULL : [fF] [uU] [lL] [lL]; FUNCTION : [fF] [uU] [nN] [cC] [tT] [iI] [oO] [nN]; GROUP : [gG] [rR] [oO] [uU] [pP]; HAVING : [hH] [aA] [vV] [iI] [nN] [gG]; HOUR : [hH] [oO] [uU] [rR]; IN : [iI] [nN]; INDEX : [iI] [nN] [dD] [eE] [xX]; INNER : [iI] [nN] [nN] [eE] [rR]; INSERT : [iI] [nN] [sS] [eE] [rR] [tT]; INTO : [iI] [nN] [tT] [oO]; IS : [iI] [sS]; JOIN : [jJ] [oO] [iI] [nN]; KEY : [kK] [eE] [yY]; LEADING : [lL] [eE] [aA] [dD] [iI] [nN] [gG]; LEFT : [lL] [eE] [fF] [tT]; LENGTH : [lL] [eE] [nN] [gG] [tT] [hH]; LIMIT : [lL] [iI] [mM] [iI] [tT]; LIKE : [lL] [iI] [kK] [eE]; LIST : [lL] [iI] [sS] [tT]; LOCATE : [lL] [oO] [cC] [aA] [tT] [eE]; LOWER : [lL] [oO] [wW] [eE] [rR]; MAP : [mM] [aA] [pP]; MAX : [mM] [aA] [xX]; MAXELEMENT : [mM] [aA] [xX] [eE] [lL] [eE] [mM] [eE] [nN] [tT]; MAXINDEX : [mM] [aA] [xX] [iI] [nN] [dD] [eE] [xX]; MEMBER : [mM] [eE] [mM] [bB] [eE] [rR]; MIN : [mM] [iI] [nN]; MINELEMENT : [mM] [iI] [nN] [eE] [lL] [eE] [mM] [eE] [nN] [tT]; MININDEX : [mM] [iI] [nN] [iI] [nN] [dD] [eE] [xX]; MINUTE : [mM] [iI] [nN] [uU] [tT] [eE]; MOD : [mM] [oO] [dD]; MONTH : [mM] [oO] [nN] [tT] [hH]; NEW : [nN] [eE] [wW]; NOT : [nN] [oO] [tT]; NULLIF : [nN] [uU] [lL] [lL] [iI] [fF]; OBJECT : [oO] [bB] [jJ] [eE] [cC] [tT]; OCTET_LENGTH : [oO] [cC] [tT] [eE] [tT] '_' [lL] [eE] [nN] [gG] [tT] [hH]; OF : [oO] [fF]; OFFSET : [oO] [fF] [fF] [sS] [eE] [tT]; ON : [oO] [nN]; OR : [oO] [rR]; ORDER : [oO] [rR] [dD] [eE] [rR]; OUTER : [oO] [uU] [tT] [eE] [rR]; POSITION : [pP] [oO] [sS] [iI] [tT] [iI] [oO] [nN]; RIGHT : [rR] [iI] [gG] [hH] [tT]; SECOND : [sS] [eE] [cC] [oO] [nN] [dD]; SELECT : [sS] [eE] [lL] [eE] [cC] [tT]; SET : [sS] [eE] [tT]; SIZE : [sS] [iI] [zZ] [eE]; SQRT : [sS] [qQ] [rR] [tT]; SUBSTRING : [sS] [uU] [bB] [sS] [tT] [rR] [iI] [nN] [gG]; SUM : [sS] [uU] [mM]; THEN : [tT] [hH] [eE] [nN]; TIMEZONE_HOUR : [tT] [iI] [mM] [eE] [zZ] [oO] [nN] [eE] '_' [hH] [oO] [uU] [rR]; TIMEZONE_MINUTE : [tT] [iI] [mM] [eE] [zZ] [oO] [nN] [eE] '_' [mM] [iI] [nN] [uU] [tT] [eE]; TRAILING : [tT] [rR] [aA] [iI] [lL] [iI] [nN] [gG]; TREAT : [tT] [rR] [eE] [aA] [tT]; TRIM : [tT] [rR] [iI] [mM]; TYPE : [tT] [yY] [pP] [eE]; UPDATE : [uU] [pP] [dD] [aA] [tT] [eE]; UPPER : [uU] [pP] [pP] [eE] [rR]; VALUE : [vV] [aA] [lL] [uU] [eE]; WHEN : [wW] [hH] [eE] [nN]; WHERE : [wW] [hH] [eE] [rR] [eE]; WITH : [wW] [iI] [tT] [hH]; YEAR : [yY] [eE] [aA] [rR]; // case-insensitive true, false and null recognition (split vote :) TRUE : [tT] [rR] [uU] [eE]; FALSE : [fF] [aA] [lL] [sS] [eE]; NULL : [nN] [uU] [lL] [lL]; // Identifiers IDENTIFIER : ('a'..'z'|'A'..'Z'|'_'|'$'|'\u0080'..'\ufffe')('a'..'z'|'A'..'Z'|'_'|'$'|'0'..'9'|'\u0080'..'\ufffe')* ; QUOTED_IDENTIFIER : '`' ( ESCAPE_SEQUENCE | ~('\\'|'`') )* '`' ;
data/items/rooftop_sale.asm
Dev727/ancientplatinum
28
17269
RooftopSaleMart1: db 5 dbw POKE_BALL, 150 dbw GREAT_BALL, 500 dbw SUPER_POTION, 500 dbw FULL_HEAL, 500 dbw REVIVE, 1200 db -1 RooftopSaleMart2: db 5 dbw HYPER_POTION, 1000 dbw FULL_RESTORE, 2000 dbw FULL_HEAL, 500 dbw ULTRA_BALL, 1000 dbw PROTEIN, 7800 db -1
Vezba 9/break continue/program.asm
KristianKalamin/Programski-Prevodioci-Domaci
1
175964
<filename>Vezba 9/break continue/program.asm<gh_stars>1-10 main: PUSH %14 MOV %15,%14 SUBS %15,$8,%15 @main_body: MOV $1,-4(%14) MOV $2,-8(%14) @while0: CMPS -4(%14),$5 JGES @while_false0 @if1: CMPS -4(%14),-8(%14) JNE @false1 @true1: JMP @while_false0 JMP @exit1 @false1: @exit1: ADDS -4(%14),$1,%0 MOV %0,-4(%14) JMP @while0 @while_false0: MOV -4(%14),%13 JMP @main_exit @main_exit: MOV %14,%15 POP %14 RET
alloy4fun_models/trashltl/models/17/rm8Fz9TKvPzeCTK33.als
Kaixi26/org.alloytools.alloy
0
583
open main pred idrm8Fz9TKvPzeCTK33_prop18 { always (all f:Protected | f not in Protected releases f in Trash) } pred __repair { idrm8Fz9TKvPzeCTK33_prop18 } check __repair { idrm8Fz9TKvPzeCTK33_prop18 <=> prop18o }
lab0/main.asm
wannaphongcom/os-dev
1
104492
org 0x7c00 ; from https://stackoverflow.com/a/32871939 bits 16 cli mov ax,0x0E61 int 0x10 hlt times 510 - ($-$$) db 0 dw 0xaa55
Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_187_2400.asm
ljhsiun2/medusa
9
29791
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %rdx push %rsi // Store lea addresses_D+0x16181, %r15 nop nop cmp $38860, %r8 movw $0x5152, (%r15) nop nop nop and %r13, %r13 // Store mov $0x22c4000000000d71, %r13 clflush (%r13) nop nop nop nop nop and %rdx, %rdx mov $0x5152535455565758, %r8 movq %r8, (%r13) nop nop xor %rsi, %rsi // Faulty Load lea addresses_A+0x16371, %r15 nop nop and $30828, %rdx mov (%r15), %rsi lea oracles, %r15 and $0xff, %rsi shlq $12, %rsi mov (%r15,%rsi,1), %rsi pop %rsi pop %rdx pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_NC', 'same': False, 'size': 8, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_A', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'00': 187} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
programs/oeis/157/A157726.asm
neoneye/loda
22
28319
<reponame>neoneye/loda<gh_stars>10-100 ; A157726: a(n) = Fibonacci(n) + 3. ; 3,4,4,5,6,8,11,16,24,37,58,92,147,236,380,613,990,1600,2587,4184,6768,10949,17714,28660,46371,75028,121396,196421,317814,514232,832043,1346272,2178312,3524581,5702890,9227468,14930355,24157820,39088172,63245989,102334158,165580144,267914299,433494440,701408736,1134903173,1836311906,2971215076,4807526979,7778742052,12586269028,20365011077,32951280102,53316291176,86267571275,139583862448,225851433720,365435296165,591286729882,956722026044,1548008755923,2504730781964,4052739537884,6557470319845,10610209857726,17167680177568,27777890035291,44945570212856,72723460248144,117669030460997,190392490709138,308061521170132,498454011879267,806515533049396,1304969544928660,2111485077978053,3416454622906710,5527939700884760,8944394323791467,14472334024676224,23416728348467688,37889062373143909,61305790721611594,99194853094755500,160500643816367091,259695496911122588,420196140727489676,679891637638612261,1100087778366101934,1779979416004714192,2880067194370816123,4660046610375530312,7540113804746346432,12200160415121876741,19740274219868223170,31940434634990099908,51680708854858323075,83621143489848422980,135301852344706746052,218922995834555169029 mov $2,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 lpe add $1,3 mov $0,$1
programs/oeis/173/A173857.asm
karttu/loda
1
243273
<reponame>karttu/loda ; A173857: Expansion of 3/2 in base phi. ; 1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1 sub $0,1 mod $0,3 pow $0,2 cmp $0,1 mov $1,$0
arch/x86/boot.asm
aufziehvogel/sos
0
81407
<filename>arch/x86/boot.asm section .multiboot align 4 dd 1BADB002h dd 0003h ; set align boot modules to page boundaries, supply memory map dd -(1BADB002h + 0003h) section .bootstrap_stack nobits stack_bottom: resb 16384 ; 16 KiB stack_top: section .text extern kernel_main global _start _start: mov esp, stack_top call kernel_main cli hlt .lhang: jmp .lhang
source/vampire-r3-message_page.ads
ytomino/vampire
1
4178
<gh_stars>1-10 -- The Village of Vampire by YT, このソースコードはNYSLです procedure Vampire.R3.Message_Page ( Output : not null access Ada.Streams.Root_Stream_Type'Class; Form : in Forms.Root_Form_Type'Class; Template : in String; Base_Page : in Forms.Base_Page; Village_Id : in Tabula.Villages.Village_Id := Tabula.Villages.Invalid_Village_Id; Village : access constant Tabula.Villages.Village_Type'Class := null; Message : in String; User_Id : in String; User_Password : in String);
programs/oeis/078/A078371.asm
karttu/loda
1
706
<reponame>karttu/loda ; A078371: a(n) = (2*n+5)*(2*n+1). ; 5,21,45,77,117,165,221,285,357,437,525,621,725,837,957,1085,1221,1365,1517,1677,1845,2021,2205,2397,2597,2805,3021,3245,3477,3717,3965,4221,4485,4757,5037,5325,5621,5925,6237,6557,6885,7221,7565,7917,8277,8645,9021,9405,9797,10197,10605,11021,11445,11877,12317,12765,13221,13685,14157,14637,15125,15621,16125,16637,17157,17685,18221,18765,19317,19877,20445,21021,21605,22197,22797,23405,24021,24645,25277,25917,26565,27221,27885,28557,29237,29925,30621,31325,32037,32757,33485,34221,34965,35717,36477,37245,38021,38805,39597,40397,41205,42021,42845,43677,44517,45365,46221,47085,47957,48837,49725,50621,51525,52437,53357,54285,55221,56165,57117,58077,59045,60021,61005,61997,62997,64005,65021,66045,67077,68117,69165,70221,71285,72357,73437,74525,75621,76725,77837,78957,80085,81221,82365,83517,84677,85845,87021,88205,89397,90597,91805,93021,94245,95477,96717,97965,99221,100485,101757,103037,104325,105621,106925,108237,109557,110885,112221,113565,114917,116277,117645,119021,120405,121797,123197,124605,126021,127445,128877,130317,131765,133221,134685,136157,137637,139125,140621,142125,143637,145157,146685,148221,149765,151317,152877,154445,156021,157605,159197,160797,162405,164021,165645,167277,168917,170565,172221,173885,175557,177237,178925,180621,182325,184037,185757,187485,189221,190965,192717,194477,196245,198021,199805,201597,203397,205205,207021,208845,210677,212517,214365,216221,218085,219957,221837,223725,225621,227525,229437,231357,233285,235221,237165,239117,241077,243045,245021,247005,248997,250997 mov $1,$0 add $0,3 add $1,$0 pow $1,2 sub $1,4
src/scenario_registre.adb
GauBen/Arbre-Genealogique
1
3645
<filename>src/scenario_registre.adb with registre; with text_io; use text_io; with ada.integer_text_io; use ada.integer_text_io; procedure Test_Registre is package Registre_Test is new registre (20, integer); use Registre_Test; mon_reg : t_registre; begin initialiser(mon_reg); if not existe(mon_reg, 42) then put("ca marche"); end if; attribuer(mon_reg, 42, 0); attribuer(mon_reg, 22, 1); attribuer(mon_reg, 42, 2); if existe(mon_reg, 42) then put("ca marche"); end if; if existe(mon_reg, 22) then put("ca marche"); end if; put(acceder(mon_reg, 42)); put(acceder(mon_reg, 22)); --Supprimer(mon_reg, 42); --Supprimer(mon_reg, 22); if not Est_Vide(mon_reg) then put(" c'est bon "); end if; Detruire(mon_reg); if Est_Vide(mon_reg) then put(" c'est bon "); end if; end Test_Registre;
Task/Euler-method/Ada/euler-method-2.ada
LaudateCorpus1/RosettaCodeData
1
22112
package body Euler is function Solve ( F : not null access function (T, Y : Number) return Number; Y0 : Number; T0, T1 : Number; N : Positive ) return Waveform is dT : constant Number := (T1 - T0) / Number (N); begin return Y : Waveform (0..N) do Y (0) := Y0; for I in 1..Y'Last loop Y (I) := Y (I - 1) + dT * F (T0 + dT * Number (I - 1), Y (I - 1)); end loop; end return; end Solve; end Euler;
exercises/ch4/num6.asm
gr0uch0dev/AssemblyExercisesAndNotes
0
21956
<reponame>gr0uch0dev/AssemblyExercisesAndNotes ; 4.6 ; Use a loop with indirect or indexed addressing to reverse the elements of an integer array in ; place. Do not copy the elements to any other array. Use the SIZEOF, TYPE, and LENGTHOF ; operators to make the program as flexible as possible if the array size and type should be ; changed in the future. .386 .model flat, STDCALL option casemap:none ; Case Sensitive include kernel32.inc .data array DWORD 10, 12, 32, 45, 11, 22 arrayType DWORD ? .code main PROC xor edx, edx mov arrayType, TYPE array mov eax, LENGTHOF array mov ebx, 2 div ebx; in order to get always pair to exchange mov ecx, eax; loop counter or edx, edx; it there is a reminder ; ebx is the first on the right ; esi is the first on the left jne odd_len jmp even_len; if no reminder odd_len: mov ebx, eax inc ebx; the first on the right of the middle mov esi, eax dec esi; the first on the left of the middle jmp swipe even_len: mov ebx, eax mov esi, eax dec esi swipe: mov eax, esi mul arrayType mov edx, array[eax] push eax push edx mov eax, ebx mul arrayType pop edx; edx was modified by mul mov edi, array[eax] mov array[eax], edx; move the one got from the left pop eax; old index mov array[eax], edi; move the one got from the right dec esi; go towards the left inc ebx; go towards the right loop swipe mov eax, OFFSET array invoke ExitProcess, 0 main ENDP end main
Appl/Art/Decks/GeoDeck/LMNefertite.asm
steakknife/pcgeos
504
90909
LMNefertite label byte word C_BLACK Bitmap <71,100,0,BMF_MONO> db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04 db 0x00, 0x02, 0x10, 0x22, 0x40, 0x88, 0x88, 0x00, 0x84 db 0x00, 0x81, 0x00, 0x80, 0x00, 0x20, 0x21, 0x04, 0x44 db 0x80, 0x10, 0x00, 0x01, 0x08, 0x00, 0x44, 0x20, 0x0c db 0xa0, 0x00, 0x00, 0x90, 0x00, 0x10, 0x00, 0x40, 0x1f db 0xa2, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xbf db 0x85, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x77 db 0x82, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xbf db 0x95, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x7f db 0x8a, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xbf db 0x95, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x77 db 0x82, 0xaa, 0xaa, 0xaa, 0x80, 0xaa, 0xaa, 0xaa, 0xbf db 0xc5, 0x55, 0x55, 0x54, 0x01, 0x55, 0x55, 0x55, 0x7f db 0x82, 0xaa, 0xaa, 0xa0, 0x00, 0xaa, 0xaa, 0xaa, 0xbf db 0x85, 0x55, 0x55, 0x40, 0x00, 0x55, 0x55, 0x55, 0x7f db 0xc2, 0xaa, 0xaa, 0x80, 0x00, 0x6a, 0xaa, 0xaa, 0xaf db 0x95, 0x55, 0x54, 0x00, 0x00, 0x35, 0x55, 0x55, 0x7f db 0x82, 0xaa, 0xa8, 0x00, 0x00, 0x1a, 0xaa, 0xaa, 0xb7 db 0x95, 0x55, 0x50, 0x00, 0x00, 0x15, 0x55, 0x55, 0x7f db 0x82, 0xaa, 0xa0, 0x00, 0x03, 0xfa, 0xaa, 0xaa, 0xbf db 0x85, 0x55, 0x40, 0x00, 0x1d, 0x55, 0x55, 0x55, 0x7f db 0x8a, 0xaa, 0x80, 0x00, 0x6a, 0xaa, 0xaa, 0xaa, 0xbf db 0x95, 0x55, 0x00, 0x00, 0xd5, 0x03, 0x55, 0x55, 0x7c db 0x82, 0xa8, 0x00, 0x03, 0xa8, 0x02, 0xaa, 0xaa, 0xbf db 0x85, 0x50, 0x00, 0x05, 0x40, 0x01, 0x55, 0x55, 0x7f db 0x82, 0xa0, 0x00, 0x0a, 0x80, 0x00, 0xaa, 0xaa, 0xbf db 0xc5, 0x40, 0x00, 0x35, 0x00, 0x00, 0xd5, 0x55, 0x7f db 0x82, 0x80, 0x00, 0x6a, 0x00, 0x00, 0x6a, 0xaa, 0xb7 db 0xc5, 0x40, 0x00, 0xd4, 0x00, 0x00, 0x55, 0x55, 0x7f db 0x82, 0xa0, 0x01, 0xa0, 0x00, 0x00, 0x2a, 0xaa, 0xbf db 0x95, 0x50, 0x01, 0x40, 0x00, 0x00, 0x75, 0x55, 0x6f db 0x82, 0xa8, 0x02, 0x80, 0x00, 0x01, 0xaa, 0xaa, 0xbf db 0x85, 0x54, 0x05, 0x00, 0x00, 0x03, 0x55, 0x55, 0x7f db 0x82, 0xaa, 0x0a, 0x80, 0x00, 0x0e, 0xaa, 0xaa, 0xb7 db 0xa5, 0x55, 0x0d, 0x00, 0x0c, 0x15, 0x55, 0x55, 0x7f db 0x82, 0xaa, 0x9a, 0x00, 0x78, 0x2a, 0x86, 0xaa, 0xaf db 0x85, 0x55, 0x54, 0x03, 0xd0, 0x15, 0x05, 0x55, 0x7f db 0xa2, 0xaa, 0xab, 0xfe, 0xa8, 0x0a, 0x02, 0xaa, 0xbf db 0xc5, 0x55, 0x55, 0x55, 0x50, 0x0c, 0x03, 0x55, 0x7c db 0x82, 0xaa, 0xaa, 0xaa, 0x00, 0x08, 0x19, 0xaa, 0xbf db 0x85, 0x55, 0x54, 0x00, 0x00, 0x10, 0x65, 0x55, 0x77 db 0x82, 0xaa, 0xaa, 0x00, 0x00, 0xe0, 0x18, 0xaa, 0xbc db 0x85, 0x55, 0x55, 0x00, 0x01, 0x00, 0x28, 0x55, 0x74 db 0x92, 0xaa, 0xaa, 0x80, 0x06, 0x60, 0x00, 0x2a, 0xbc db 0x85, 0x55, 0x55, 0x40, 0x0c, 0x20, 0x00, 0x15, 0x7c db 0x82, 0xaa, 0xaa, 0xa0, 0x1a, 0x40, 0x00, 0x0a, 0xbc db 0x95, 0x55, 0x55, 0x50, 0x34, 0x10, 0x00, 0x0d, 0x74 db 0x82, 0xaa, 0xaa, 0xa8, 0x69, 0x10, 0x00, 0x1a, 0xbc db 0x95, 0x55, 0x55, 0x54, 0xd0, 0x80, 0x00, 0x75, 0x6c db 0x82, 0xaa, 0xaa, 0xaa, 0xa0, 0x88, 0x00, 0x2a, 0xbc db 0xa5, 0x55, 0x55, 0x55, 0x40, 0x70, 0x00, 0x35, 0x7c db 0x82, 0xaa, 0xaa, 0xaa, 0xa0, 0x00, 0x00, 0xea, 0xb4 db 0x85, 0x55, 0x55, 0x55, 0x40, 0x00, 0x00, 0x75, 0x7c db 0x8a, 0xaa, 0xaa, 0xaa, 0x80, 0x00, 0x00, 0x2a, 0xbc db 0x85, 0x55, 0x55, 0x55, 0x40, 0x00, 0x00, 0x35, 0x7c db 0xa2, 0xaa, 0xaa, 0xaa, 0x80, 0x00, 0x00, 0x2a, 0xbc db 0x85, 0x55, 0x55, 0x55, 0x40, 0x00, 0x1f, 0xd5, 0x74 db 0xa2, 0xaa, 0xaa, 0xaa, 0x80, 0x00, 0x2a, 0xaa, 0xbc db 0x85, 0x55, 0x55, 0x55, 0x00, 0x00, 0x35, 0x55, 0x7c db 0xb2, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x6a, 0xaa, 0xbc db 0x85, 0x55, 0x55, 0x54, 0x00, 0x00, 0xd5, 0x55, 0x6c db 0x8a, 0xaa, 0xaa, 0xa8, 0x00, 0x01, 0xaa, 0xaa, 0xbc db 0x85, 0x55, 0x55, 0x50, 0x00, 0x01, 0x55, 0x55, 0x7c db 0x82, 0xaa, 0xaa, 0xa0, 0x00, 0x02, 0xaa, 0xaa, 0xb4 db 0xa5, 0x55, 0x55, 0x40, 0x00, 0x05, 0x55, 0x55, 0x7c db 0x82, 0xaa, 0xaa, 0xa0, 0x00, 0x06, 0xaa, 0xaa, 0xbc db 0x85, 0x55, 0x55, 0x40, 0x00, 0x0d, 0x55, 0x55, 0x7c db 0xca, 0xaa, 0xaa, 0xbe, 0x00, 0x0a, 0xaa, 0xaa, 0xb4 db 0xc5, 0x55, 0x55, 0x55, 0x80, 0x15, 0x55, 0x55, 0x7c db 0x82, 0xaa, 0xaa, 0x01, 0x40, 0x2a, 0xaa, 0xaa, 0xb4 db 0x85, 0x55, 0x54, 0x00, 0x20, 0x35, 0x55, 0x55, 0x7c db 0xe2, 0xaa, 0xa8, 0x00, 0x50, 0x2a, 0xaa, 0xaa, 0xb8 db 0x85, 0x55, 0x50, 0x00, 0x08, 0x35, 0x55, 0x55, 0x6c db 0x82, 0xaa, 0xa8, 0x00, 0x18, 0x2a, 0xaa, 0xaa, 0xbc db 0xc5, 0x55, 0x50, 0x00, 0x0f, 0xd5, 0x55, 0x55, 0x7c db 0x92, 0xaa, 0xa0, 0x00, 0x05, 0x5a, 0xaa, 0xaa, 0xb4 db 0x85, 0x55, 0x50, 0x00, 0x00, 0x15, 0x55, 0x55, 0x7c db 0x82, 0xaa, 0xa0, 0x00, 0x00, 0x1a, 0xaa, 0xaa, 0xbc db 0x95, 0x55, 0x40, 0x00, 0x00, 0x15, 0x55, 0x55, 0x7c db 0xd2, 0xaa, 0xa0, 0x00, 0x00, 0x1a, 0xaa, 0xaa, 0xb4 db 0x85, 0x55, 0x40, 0x00, 0x00, 0x15, 0x55, 0x55, 0x78 db 0xa2, 0xaa, 0x80, 0x00, 0x00, 0x1a, 0xaa, 0xaa, 0xbc db 0x85, 0x55, 0x40, 0x00, 0x00, 0x15, 0x55, 0x55, 0x74 db 0x92, 0xaa, 0x98, 0x00, 0x00, 0x1a, 0xaa, 0xaa, 0xbc db 0x8d, 0x55, 0x57, 0xc0, 0x00, 0xf5, 0x55, 0x55, 0x7c db 0x82, 0xaa, 0xaa, 0xbf, 0xff, 0xaa, 0xaa, 0xaa, 0xac db 0x85, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x7c db 0xa2, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xb8 db 0x85, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x7c db 0x82, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xb4 db 0xa5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x7c db 0x82, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xbc db 0x85, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x6c db 0x82, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xfc db 0x95, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xf8 db 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc db 0x8d, 0xfd, 0xbd, 0x7e, 0xfb, 0xef, 0xed, 0xdf, 0xf8 db 0x17, 0xaf, 0xff, 0xef, 0xff, 0xbd, 0xdf, 0x7f, 0x78 db 0x0f, 0xfb, 0xf7, 0xff, 0xbe, 0xff, 0x7f, 0xdf, 0xe0 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
rp2040_drivers/piezo.ads
JeremyGrosser/sensors
1
28001
-- -- Copyright (C) 2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: BSD-3-Clause -- with RP.GPIO; with RP.PWM; with RP; package Piezo is type Beeper (Point_A : access RP.GPIO.GPIO_Point; Point_B : access RP.GPIO.GPIO_Point) is tagged record Slice : RP.PWM.PWM_Slice := RP.PWM.To_PWM (Point_A.all).Slice; end record; subtype Milliseconds is Natural; -- Timer and PWM must be initialized before this. procedure Beep (This : Beeper; Duration : Milliseconds := 1_000; Frequency : RP.Hertz := 440; Count : Positive := 1); end Piezo;
engine/movie/credits.asm
opiter09/ASM-Machina
1
177112
<reponame>opiter09/ASM-Machina<gh_stars>1-10 HallOfFamePC: farcall AnimateHallOfFame call ClearScreen ld c, 100 call DelayFrames call DisableLCD ld hl, vFont ld bc, ($80 tiles) / 2 call ZeroMemory ld hl, vChars2 tile $60 ld bc, ($20 tiles) / 2 call ZeroMemory ld hl, vChars2 tile $7e ld bc, 1 tiles ld a, $ff ; solid black call FillMemory hlcoord 0, 0 call FillFourRowsWithBlack hlcoord 0, 14 call FillFourRowsWithBlack ld a, %11000000 ldh [rBGP], a call EnableLCD ld a, SFX_STOP_ALL_MUSIC call PlaySoundWaitForCurrent ld c, BANK(Music_Credits) ld a, MUSIC_CREDITS call PlayMusic ld c, 128 call DelayFrames xor a ld [wUnusedCD3D], a ; not read ld [wNumCreditsMonsDisplayed], a jp Credits FadeInCreditsText: ld hl, HoFGBPalettes ld b, 4 .loop ld a, [hli] ldh [rBGP], a ld c, 5 call DelayFrames dec b jr nz, .loop ret DisplayCreditsMon: xor a ldh [hAutoBGTransferEnabled], a call SaveScreenTilesToBuffer1 call FillMiddleOfScreenWithWhite ; display the next monster from CreditsMons ld hl, wNumCreditsMonsDisplayed ld c, [hl] ; how many monsters have we displayed so far? inc [hl] ld b, 0 ld hl, CreditsMons add hl, bc ; go that far in the list of monsters and get the next one ld a, [hl] ld [wcf91], a ld [wd0b5], a hlcoord 8, 6 call GetMonHeader call LoadFrontSpriteByMonIndex ld hl, vBGMap0 + $c call CreditsCopyTileMapToVRAM xor a ldh [hAutoBGTransferEnabled], a call LoadScreenTilesFromBuffer1 ld hl, vBGMap0 call CreditsCopyTileMapToVRAM ld a, $A7 ldh [rWX], a ld hl, vBGMap1 call CreditsCopyTileMapToVRAM call FillMiddleOfScreenWithWhite ld a, %11111100 ; make the mon a black silhouette ldh [rBGP], a ; scroll the mon left by one tile 7 times ld bc, 7 .scrollLoop1 call ScrollCreditsMonLeft dec c jr nz, .scrollLoop1 ; scroll the mon left by one tile 20 times ; This time, we have to move the window left too in order to hide the text that ; is wrapping around to the right side of the screen. ld c, 20 .scrollLoop2 call ScrollCreditsMonLeft ldh a, [rWX] sub 8 ldh [rWX], a dec c jr nz, .scrollLoop2 xor a ldh [hWY], a ld a, %11000000 ldh [rBGP], a ret INCLUDE "data/credits/credits_mons.asm" ScrollCreditsMonLeft: ld h, b ld l, $20 call ScrollCreditsMonLeft_SetSCX ld h, $0 ld l, $70 call ScrollCreditsMonLeft_SetSCX ld a, b add $8 ld b, a ret ScrollCreditsMonLeft_SetSCX: ldh a, [rLY] cp l jr nz, ScrollCreditsMonLeft_SetSCX ld a, h ldh [rSCX], a .loop ldh a, [rLY] cp h jr z, .loop ret HoFGBPalettes: db %11000000 db %11010000 db %11100000 db %11110000 CreditsCopyTileMapToVRAM: ld a, l ldh [hAutoBGTransferDest], a ld a, h ldh [hAutoBGTransferDest + 1], a ld a, 1 ldh [hAutoBGTransferEnabled], a jp Delay3 ZeroMemory: ; zero bc bytes at hl ld [hl], 0 inc hl inc hl dec bc ld a, b or c jr nz, ZeroMemory ret FillFourRowsWithBlack: ld bc, SCREEN_WIDTH * 4 ld a, $7e jp FillMemory FillMiddleOfScreenWithWhite: hlcoord 0, 4 ld bc, SCREEN_WIDTH * 10 ld a, " " jp FillMemory Credits: ld de, CreditsOrder push de .nextCreditsScreen pop de hlcoord 9, 6 push hl call FillMiddleOfScreenWithWhite pop hl .nextCreditsCommand ld a, [de] inc de push de cp CRED_TEXT_FADE_MON jr z, .fadeInTextAndShowMon cp CRED_TEXT_MON jr z, .showTextAndShowMon cp CRED_TEXT_FADE jr z, .fadeInText cp CRED_TEXT jr z, .showText cp CRED_COPYRIGHT jr z, .showCopyrightText cp CRED_THE_END jr z, .showTheEnd push hl push hl ld hl, CreditsTextPointers add a ld c, a ld b, 0 add hl, bc ld e, [hl] inc hl ld d, [hl] ld a, [de] inc de ld c, a ld b, -1 pop hl add hl, bc call PlaceString pop hl ld bc, SCREEN_WIDTH * 2 add hl, bc pop de jr .nextCreditsCommand .fadeInTextAndShowMon call FadeInCreditsText ld c, 90 jr .next1 .showTextAndShowMon ld c, 110 .next1 call DelayFrames call DisplayCreditsMon jr .nextCreditsScreen .fadeInText call FadeInCreditsText ld c, 120 jr .next2 .showText ld c, 140 .next2 call DelayFrames jr .nextCreditsScreen .showCopyrightText push de farcall LoadCopyrightTiles pop de pop de jr .nextCreditsCommand .showTheEnd ld c, 16 call DelayFrames call FillMiddleOfScreenWithWhite pop de ld de, TheEndGfx ld hl, vChars2 tile $60 lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / $10 call CopyVideoData hlcoord 4, 8 ld de, TheEndTextString call PlaceString hlcoord 4, 9 inc de call PlaceString jp FadeInCreditsText TheEndTextString: ; "T H E E N D" db $60," ",$62," ",$64," ",$64," ",$66," ",$68,"@" db $61," ",$63," ",$65," ",$65," ",$67," ",$69,"@" INCLUDE "data/credits/credits_order.asm" INCLUDE "data/credits/credits_text.asm" TheEndGfx: INCBIN "gfx/credits/the_end.2bpp" TheEndGfxEnd:
programs/oeis/015/A015565.asm
karttu/loda
1
82197
<reponame>karttu/loda ; A015565: a(n) = 7*a(n-1) + 8*a(n-2), a(0) = 0, a(1) = 1. ; 0,1,7,57,455,3641,29127,233017,1864135,14913081,119304647,954437177,7635497415,61083979321,488671834567,3909374676537,31274997412295,250199979298361,2001599834386887,16012798675095097 mov $1,8 pow $1,$0 add $1,3 div $1,9
FreeRTOS/Demo/RL78_RL78G23_64p_FPB_Renesas_e2studio_CS+/src/smc_gen/r_bsp/board/generic_rl78_g23/stkinit.asm
NoMaY-jp/FreeRTOS
0
161340
<gh_stars>0 ;;/*********************************************************************************************************************** ;;* DISCLAIMER ;;* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No ;;* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all ;;* applicable laws, including copyright laws. ;;* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING ;;* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, ;;* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM ;;* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES ;;* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS ;;* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ;;* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of ;;* this software. By using this software, you agree to the additional terms and conditions found by accessing the ;;* following link: ;;* http://www.renesas.com/disclaimer ;;* ;;* Copyright (C) 2021 Renesas Electronics Corporation. All rights reserved. ;;***********************************************************************************************************************/ ;;/*********************************************************************************************************************** ;;* File Name : stkinit.asm ;;* H/W Platform : GENERIC_RL78_G23 ;;* Description : ;;***********************************************************************************************************************/ ;;/*********************************************************************************************************************** ;;* History : DD.MM.YYYY Version Description ;;* : 08.03.2021 1.00 First Release ;; ;;***********************************************************************************************************************/ ; _stkinit ; ; void _stkinit(void __near * stackbss); ; ; input: ; stackbss = AX (#LOWW(_stackend)) ; output: ; NONE ;--------------------------------------------------------------------- ; NOTE : THIS IS A TYPICAL EXAMPLE. .PUBLIC _stkinit .textf .CSEG TEXTF _stkinit: MOVW HL,AX ; stack_end_addr MOV [SP+3],#0x00 ; [SP+0]-[SP+2] for return address MOVW AX,SP SUBW AX,HL ; SUBW AX,#LOWW _@STEND BNH $LSTINIT3 ; goto end SHRW AX,5 ; loop count for 32 byte transfer MOVW BC,AX CLRW AX LSTINIT1: CMPW AX,BC BZ $LSTINIT2 MOVW [HL],AX MOVW [HL+2],AX MOVW [HL+4],AX MOVW [HL+6],AX MOVW [HL+8],AX MOVW [HL+10],AX MOVW [HL+12],AX MOVW [HL+14],AX MOVW [HL+16],AX MOVW [HL+18],AX MOVW [HL+20],AX MOVW [HL+22],AX MOVW [HL+24],AX MOVW [HL+26],AX MOVW [HL+28],AX MOVW [HL+30],AX XCHW AX,HL ADDW AX,#0x20 XCHW AX,HL DECW BC BR $LSTINIT1 LSTINIT2: MOVW AX,SP CMPW AX,HL BZ $LSTINIT3 ; goto end CLRW AX MOVW [HL],AX INCW HL INCW HL BR $LSTINIT2 LSTINIT3: RET
projects/08/FunctionCalls/StaticsTest/Sys.asm
nadavWeisler/Nand2Tetris
0
246309
<reponame>nadavWeisler/Nand2Tetris (Sys.init) @0 D=A @i M=D D=M @Sys.init.0 D;JEQ (Sys.init..0) @SP A=M M=0 @SP D=M D=D+1 M=D @i D=M D=D-1 M=D @Sys.init..0 D;JNE (Sys.init.0) @6 D=A @SP A=M M=D @SP M=M+1 @8 D=A @SP A=M M=D @SP M=M+1 @RETURN2 D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @SP D=M @2 D=D-A @5 D=D-A @ARG M=D @SP D=M @LCL M=D @Class1.set 0;JMP (RETURN2) @0 D=A @5 D=D+A @13 M=D @SP M=M-1 A=M D=M @13 A=M M=D @23 D=A @SP A=M M=D @SP M=M+1 @15 D=A @SP A=M M=D @SP M=M+1 @RETURN3 D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @SP D=M @2 D=D-A @5 D=D-A @ARG M=D @SP D=M @LCL M=D @Class2.set 0;JMP (RETURN3) @0 D=A @5 D=D+A @13 M=D @SP M=M-1 A=M D=M @13 A=M M=D @RETURN4 D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @SP D=M @0 D=D-A @5 D=D-A @ARG M=D @SP D=M @LCL M=D @Class1.get 0;JMP (RETURN4) @RETURN5 D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @SP D=M @0 D=D-A @5 D=D-A @ARG M=D @SP D=M @LCL M=D @Class2.get 0;JMP (RETURN5) (WHILE) @WHILE 0;JMP
src/Native/Runtime/arm64/MiscStubs.asm
kouvel/corert
3,223
169069
<gh_stars>1000+ ;; Licensed to the .NET Foundation under one or more agreements. ;; The .NET Foundation licenses this file to you under the MIT license. #include "AsmMacros.h" EXTERN memcpy EXTERN memcpyGCRefs EXTERN memcpyGCRefsWithWriteBarrier EXTERN memcpyAnyWithWriteBarrier EXTERN GetClasslibCCtorCheck TEXTAREA ;; ;; Checks whether the static class constructor for the type indicated by the context structure has been ;; executed yet. If not the classlib is called via their CheckStaticClassConstruction callback which will ;; execute the cctor and update the context to record this fact. ;; ;; Input: ;; x0 : Address of StaticClassConstructionContext structure ;; ;; Output: ;; All volatile registers and the condition codes may be trashed. ;; LEAF_ENTRY RhpCheckCctor ;; Check the m_initialized field of the context. The cctor has been run only if this equals 1 (the ;; initial state is 0 and the remaining values are reserved for classlib use). This check is ;; unsynchronized; if we go down the slow path and call the classlib then it is responsible for ;; synchronizing with other threads and re-checking the value. ldr w12, [x0, #OFFSETOF__StaticClassConstructionContext__m_initialized] cmp w12, #1 bne RhpCheckCctor__SlowPath ret RhpCheckCctor__SlowPath mov x1, x0 b RhpCheckCctor2 ; tail-call the check cctor helper that actually has an implementation to call ; the cctor LEAF_END RhpCheckCctor ;; ;; Checks whether the static class constructor for the type indicated by the context structure has been ;; executed yet. If not the classlib is called via their CheckStaticClassConstruction callback which will ;; execute the cctor and update the context to record this fact. ;; ;; Input: ;; x0 : Value that must be preserved in this register across the cctor check. ;; x1 : Address of StaticClassConstructionContext structure ;; ;; Output: ;; All volatile registers other than x0 may be trashed and the condition codes may also be trashed. ;; LEAF_ENTRY RhpCheckCctor2 ;; Check the m_initialized field of the context. The cctor has been run only if this equals 1 (the ;; initial state is 0 and the remaining values are reserved for classlib use). This check is ;; unsynchronized; if we go down the slow path and call the classlib then it is responsible for ;; synchronizing with other threads and re-checking the value. ldr w12, [x1, #OFFSETOF__StaticClassConstructionContext__m_initialized] cmp w12, #1 bne RhpCheckCctor2__SlowPath ret LEAF_END RhpCheckCctor2 ;; ;; Slow path helper for RhpCheckCctor. ;; ;; Input: ;; x0 : Value that must be preserved in this register across the cctor check. ;; x1 : Address of StaticClassConstructionContext structure ;; ;; Output: ;; All volatile registers other than x0 may be trashed and the condition codes may also be trashed. ;; NESTED_ENTRY RhpCheckCctor2__SlowPath ;; Need to preserve x0, x1 and lr across helper call. fp is also pushed to keep the stack 16 byte aligned. PROLOG_SAVE_REG_PAIR fp, lr, #-0x20! stp x0, x1, [sp, #0x10] ;; Call a C++ helper to retrieve the address of the classlib callback. The caller's return address is ;; passed as the argument to the helper; it's an address in the module and is used by the helper to ;; locate the classlib. mov x0, lr bl GetClasslibCCtorCheck ;; X0 now contains the address of the classlib method to call. The single argument is the context ;; structure address currently in stashed on the stack. Clean up and tail call to the classlib ;; callback so we're not on the stack should a GC occur (so we don't need to worry about transition ;; frames). mov x12, x0 ldp x0, x1, [sp, #0x10] EPILOG_RESTORE_REG_PAIR fp, lr, #0x20! ;; tail-call the class lib cctor check function. This function is required to return its first ;; argument, so that x0 can be preserved. EPILOG_NOP br x12 NESTED_END RhpCheckCctor__SlowPath2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; void* RhpCopyMultibyteNoGCRefs(void*, void*, size_t) ;; ;; The purpose of this wrapper is to hoist the potential null reference exceptions of copying memory up to a place where ;; the stack unwinder and exception dispatch can properly transform the exception into a managed exception and dispatch ;; it to managed code. ;; LEAF_ENTRY RhpCopyMultibyteNoGCRefs ; x0 dest ; x1 src ; x2 count cbz x2, NothingToCopy_NoGCRefs ; check for a zero-length copy ; Now check the dest and src pointers. If they AV, the EH subsystem will recognize the address of the AV, ; unwind the frame, and fixup the stack to make it look like the (managed) caller AV'ed, which will be ; translated to a managed exception as usual. ALTERNATE_ENTRY RhpCopyMultibyteNoGCRefsDestAVLocation ldrb wzr, [x0] ALTERNATE_ENTRY RhpCopyMultibyteNoGCRefsSrcAVLocation ldrb wzr, [x1] ; tail-call to plain-old-memcpy b memcpy NothingToCopy_NoGCRefs ; dest is already in x0 ret LEAF_END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; void* RhpCopyMultibyte(void*, void*, size_t) ;; ;; The purpose of this wrapper is to hoist the potential null reference exceptions of copying memory up to a place where ;; the stack unwinder and exception dispatch can properly transform the exception into a managed exception and dispatch ;; it to managed code. ;; LEAF_ENTRY RhpCopyMultibyte ; x0 dest ; x1 src ; x2 count ; check for a zero-length copy cbz x2, NothingToCopy_RhpCopyMultibyte ; Now check the dest and src pointers. If they AV, the EH subsystem will recognize the address of the AV, ; unwind the frame, and fixup the stack to make it look like the (managed) caller AV'ed, which will be ; translated to a managed exception as usual. ALTERNATE_ENTRY RhpCopyMultibyteDestAVLocation ldrb wzr, [x0] ALTERNATE_ENTRY RhpCopyMultibyteSrcAVLocation ldrb wzr, [x1] ; tail-call to the GC-safe memcpy implementation b memcpyGCRefs NothingToCopy_RhpCopyMultibyte ; dest is already still in x0 ret LEAF_END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; void* RhpCopyMultibyteWithWriteBarrier(void*, void*, size_t) ;; ;; The purpose of this wrapper is to hoist the potential null reference exceptions of copying memory up to a place where ;; the stack unwinder and exception dispatch can properly transform the exception into a managed exception and dispatch ;; it to managed code. ;; Runs a card table update via RhpBulkWriteBarrier after the copy ;; LEAF_ENTRY RhpCopyMultibyteWithWriteBarrier ; x0 dest ; x1 src ; x2 count ; check for a zero-length copy cbz x2, NothingToCopy_RhpCopyMultibyteWithWriteBarrier ; Now check the dest and src pointers. If they AV, the EH subsystem will recognize the address of the AV, ; unwind the frame, and fixup the stack to make it look like the (managed) caller AV'ed, which will be ; translated to a managed exception as usual. ALTERNATE_ENTRY RhpCopyMultibyteWithWriteBarrierDestAVLocation ldrb wzr, [x0] ALTERNATE_ENTRY RhpCopyMultibyteWithWriteBarrierSrcAVLocation ldrb wzr, [x1] ; tail-call to the GC-safe memcpy implementation b memcpyGCRefsWithWriteBarrier NothingToCopy_RhpCopyMultibyteWithWriteBarrier ; dest is already still in x0 ret LEAF_END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; void* RhpCopyAnyWithWriteBarrier(void*, void*, size_t) ;; ;; The purpose of this wrapper is to hoist the potential null reference exceptions of copying memory up to a place where ;; the stack unwinder and exception dispatch can properly transform the exception into a managed exception and dispatch ;; it to managed code. ;; Runs a card table update via RhpBulkWriteBarrier after the copy if it contained GC pointers ;; LEAF_ENTRY RhpCopyAnyWithWriteBarrier ; x0 dest ; x1 src ; x2 count ; check for a zero-length copy cbz x2, NothingToCopy_RhpCopyAnyWithWriteBarrier ; Now check the dest and src pointers. If they AV, the EH subsystem will recognize the address of the AV, ; unwind the frame, and fixup the stack to make it look like the (managed) caller AV'ed, which will be ; translated to a managed exception as usual. ALTERNATE_ENTRY RhpCopyAnyWithWriteBarrierDestAVLocation ldrb wzr, [x0] ALTERNATE_ENTRY RhpCopyAnyWithWriteBarrierSrcAVLocation ldrb wzr, [x1] ; tail-call to the GC-safe memcpy implementation b memcpyAnyWithWriteBarrier NothingToCopy_RhpCopyAnyWithWriteBarrier ; dest is already still in x0 ret LEAF_END end
src/ewok-mpu.adb
PThierry/ewok-kernel
0
28447
-- -- Copyright 2018 The wookey project team <<EMAIL>> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- -- 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. -- -- with ada.unchecked_conversion; with m4.mpu; use m4.mpu; with ewok.mpu.handler; with ewok.layout; with ewok.debug; with soc.layout; with applications; -- generated package body ewok.mpu with spark_mode => on is procedure init (success : out boolean) with spark_mode => off -- handler is not SPARK compatible is -- Layout mapping validation of generated constants pragma assert (applications.txt_kern_size + applications.txt_kern_region_base <= applications.txt_user_region_base); function get_region_size (size : t_region_size) return unsigned_32 is (2**(natural (size) + 1)); begin -- -- Initializing the MPU -- -- Testing if there's an MPU m4.mpu.is_mpu_available (success); if not success then pragma DEBUG (debug.log (debug.ERROR, "No MPU!")); return; end if; -- Register memory fault handler -- Note: unproved because SPARK doesn't allow "'address" attribute ewok.mpu.handler.init; -- not PARK compatible -- Disable MPU m4.mpu.disable; -- Enable privileged software access (PRIVDEFENA) to default memory map -- and enable the memory fault exception. When ENABLE and PRIVDEFENA are -- both set to 1, privileged code can freely access the default memory -- map. Any access by unprivileged software that does not address an -- enabled memory region causes a memory management fault. m4.mpu.init; -- -- Configuring MPU regions -- -- Region: kernel code if get_region_size (REGION_SIZE_64KB) /= ewok.layout.FW1_KERN_SIZE then pragma DEBUG (debug.log (debug.ERROR, "MPU: invalid 'KERNEL CODE' size")); return; end if; set_region (region_number => KERN_CODE_REGION, addr => applications.txt_kern_region_base, size => applications.txt_kern_region_size, region_type => REGION_TYPE_KERN_CODE, subregion_mask => 0); -- Region: devices that may be accessed by the kernel set_region (region_number => KERN_DEVICES_REGION, addr => soc.layout.PERIPH_BASE, size => REGION_SIZE_512MB, region_type => REGION_TYPE_KERN_DEVICES, subregion_mask => 0); -- Region: kernel data + stack if get_region_size (REGION_SIZE_64KB) /= ewok.layout.KERN_DATA_SIZE then pragma DEBUG (debug.log (debug.ERROR, "MPU: invalid 'KERNEL DATA' size")); return; end if; set_region (region_number => KERN_DATA_REGION, addr => ewok.layout.KERN_DATA_BASE, size => REGION_SIZE_64KB, region_type => REGION_TYPE_KERN_DATA, subregion_mask => 0); -- Region: user data -- Note: This is for the whole area. Each task will use only a fixed -- number of sub-regions if get_region_size (REGION_SIZE_128KB) /= ewok.layout.USER_RAM_SIZE then pragma DEBUG (debug.log (debug.ERROR, "MPU: invalid 'USER DATA' size")); return; end if; set_region (region_number => USER_DATA_REGION, addr => ewok.layout.USER_DATA_BASE, size => REGION_SIZE_128KB, region_type => REGION_TYPE_USER_DATA, subregion_mask => 0); -- Region: user code -- Note: This is for the whole area. Each task will use only a fixed -- number of sub-regions if get_region_size (REGION_SIZE_256KB) /= ewok.layout.FW1_USER_SIZE then pragma DEBUG (debug.log (debug.ERROR, "MPU: invalid 'USER CODE' size")); return; end if; set_region (region_number => USER_CODE_REGION, addr => applications.txt_user_region_base, size => applications.txt_user_region_size, region_type => REGION_TYPE_USER_CODE, subregion_mask => 0); pragma DEBUG (debug.log (debug.INFO, "MPU is configured")); m4.mpu.enable; pragma DEBUG (debug.log (debug.INFO, "MPU is enabled")); end init; procedure enable_unrestricted_kernel_access is begin m4.mpu.enable_unrestricted_kernel_access; end enable_unrestricted_kernel_access; procedure disable_unrestricted_kernel_access is begin m4.mpu.disable_unrestricted_kernel_access; end disable_unrestricted_kernel_access; procedure set_region (region_number : in m4.mpu.t_region_number; addr : in system_address; size : in m4.mpu.t_region_size; region_type : in t_region_type; subregion_mask : in unsigned_8) is access_perm : m4.mpu.t_region_perm; xn, b, s : boolean; region_config : m4.mpu.t_region_config; begin -- A memory region must never be mapped RWX case (region_type) is when REGION_TYPE_KERN_CODE => access_perm := REGION_PERM_PRIV_RO_USER_NO; xn := false; b := false; s := false; when REGION_TYPE_KERN_DATA => access_perm := REGION_PERM_PRIV_RW_USER_NO; xn := true; b := false; s := true; when REGION_TYPE_KERN_DEVICES => access_perm := REGION_PERM_PRIV_RW_USER_NO; xn := true; b := true; s := true; when REGION_TYPE_USER_CODE => access_perm := REGION_PERM_PRIV_RO_USER_RO; xn := false; b := false; s := false; when REGION_TYPE_USER_DATA => access_perm := REGION_PERM_PRIV_RW_USER_RW; xn := true; b := false; s := true; when REGION_TYPE_USER_DEV => access_perm := REGION_PERM_PRIV_RW_USER_RW; xn := true; b := true; s := true; when REGION_TYPE_USER_DEV_RO => access_perm := REGION_PERM_PRIV_RW_USER_RO; xn := true; b := true; s := true; when REGION_TYPE_ISR_STACK => access_perm := REGION_PERM_PRIV_RW_USER_RW; xn := true; b := false; s := true; end case; region_config := (region_number => region_number, addr => addr, size => size, access_perm => access_perm, xn => xn, b => b, s => s, subregion_mask => subregion_mask); m4.mpu.configure_region (region_config); end set_region; procedure update_subregions (region_number : in m4.mpu.t_region_number; subregion_mask : in unsigned_8) is begin m4.mpu.update_subregion_mask (region_number, subregion_mask); end update_subregions; procedure bytes_to_region_size (bytes : in unsigned_32; region_size : out m4.mpu.t_region_size; success : out boolean) is begin success := true; case (bytes) is when 32 => region_size := REGION_SIZE_32B; when 64 => region_size := REGION_SIZE_64B; when 128 => region_size := REGION_SIZE_128B; when 256 => region_size := REGION_SIZE_256B; when 512 => region_size := REGION_SIZE_512B; when 1*KBYTE => region_size := REGION_SIZE_1KB; when 2*KBYTE => region_size := REGION_SIZE_2KB; when 4*KBYTE => region_size := REGION_SIZE_4KB; when 8*KBYTE => region_size := REGION_SIZE_8KB; when 16*KBYTE => region_size := REGION_SIZE_16KB; when 32*KBYTE => region_size := REGION_SIZE_32KB; when 64*KBYTE => region_size := REGION_SIZE_64KB; when 128*KBYTE => region_size := REGION_SIZE_128KB; when 256*KBYTE => region_size := REGION_SIZE_256KB; when 512*KBYTE => region_size := REGION_SIZE_512KB; when 1*MBYTE => region_size := REGION_SIZE_1MB; when 2*MBYTE => region_size := REGION_SIZE_2MB; when 4*MBYTE => region_size := REGION_SIZE_4MB; when 8*MBYTE => region_size := REGION_SIZE_8MB; when 16*MBYTE => region_size := REGION_SIZE_16MB; when 32*MBYTE => region_size := REGION_SIZE_32MB; when 64*MBYTE => region_size := REGION_SIZE_64MB; when 128*MBYTE => region_size := REGION_SIZE_128MB; when 256*MBYTE => region_size := REGION_SIZE_256MB; when 512*MBYTE => region_size := REGION_SIZE_512MB; when 1*GBYTE => region_size := REGION_SIZE_1GB; when 2*GBYTE => region_size := REGION_SIZE_2GB; when others => region_size := REGION_SIZE_32B; success := false; end case; end bytes_to_region_size; function can_be_mapped return boolean is begin for region in regions_pool'range loop if not regions_pool(region).used then return true; end if; end loop; return false; end can_be_mapped; procedure map (addr : in system_address; size : in unsigned_32; region_type : in ewok.mpu.t_region_type; subregion_mask : in unsigned_8; success : out boolean) is region_size : m4.mpu.t_region_size; ok : boolean; begin for region in regions_pool'range loop if not regions_pool(region).used then ewok.mpu.bytes_to_region_size (size, region_size, ok); if not ok then raise program_error; end if; regions_pool(region).used := true; regions_pool(region).addr := addr; ewok.mpu.set_region (region, addr, region_size, region_type, subregion_mask); success := true; return; end if; end loop; success := false; end map; procedure unmap (addr : in system_address) is begin for region in regions_pool'range loop if regions_pool(region).addr = addr and then regions_pool(region).used then m4.mpu.disable_region (region); regions_pool(region) := (false, 0); return; end if; end loop; raise program_error; end unmap; procedure unmap_all is begin for region in regions_pool'range loop if regions_pool(region).used then regions_pool(region) := (false, 0); m4.mpu.disable_region (region); end if; end loop; end unmap_all; end ewok.mpu;
llvm-gcc-4.2-2.9/gcc/ada/g-dynhta.adb
vidkidz/crossbridge
1
28947
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . D Y N A M I C _ H T A B L E S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2002-2006, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body GNAT.Dynamic_HTables is ------------------- -- Static_HTable -- ------------------- package body Static_HTable is type Table_Type is array (Header_Num) of Elmt_Ptr; type Instance_Data is record Table : Table_Type; Iterator_Index : Header_Num; Iterator_Ptr : Elmt_Ptr; Iterator_Started : Boolean := False; end record; function Get_Non_Null (T : Instance) return Elmt_Ptr; -- Returns Null_Ptr if Iterator_Started is False or if the Table is -- empty. Returns Iterator_Ptr if non null, or the next non null -- element in table if any. --------- -- Get -- --------- function Get (T : Instance; K : Key) return Elmt_Ptr is Elmt : Elmt_Ptr; begin if T = null then return Null_Ptr; end if; Elmt := T.Table (Hash (K)); loop if Elmt = Null_Ptr then return Null_Ptr; elsif Equal (Get_Key (Elmt), K) then return Elmt; else Elmt := Next (Elmt); end if; end loop; end Get; --------------- -- Get_First -- --------------- function Get_First (T : Instance) return Elmt_Ptr is begin if T = null then return Null_Ptr; end if; T.Iterator_Started := True; T.Iterator_Index := T.Table'First; T.Iterator_Ptr := T.Table (T.Iterator_Index); return Get_Non_Null (T); end Get_First; -------------- -- Get_Next -- -------------- function Get_Next (T : Instance) return Elmt_Ptr is begin if T = null or else not T.Iterator_Started then return Null_Ptr; end if; T.Iterator_Ptr := Next (T.Iterator_Ptr); return Get_Non_Null (T); end Get_Next; ------------------ -- Get_Non_Null -- ------------------ function Get_Non_Null (T : Instance) return Elmt_Ptr is begin if T = null then return Null_Ptr; end if; while T.Iterator_Ptr = Null_Ptr loop if T.Iterator_Index = T.Table'Last then T.Iterator_Started := False; return Null_Ptr; end if; T.Iterator_Index := T.Iterator_Index + 1; T.Iterator_Ptr := T.Table (T.Iterator_Index); end loop; return T.Iterator_Ptr; end Get_Non_Null; ------------ -- Remove -- ------------ procedure Remove (T : Instance; K : Key) is Index : constant Header_Num := Hash (K); Elmt : Elmt_Ptr; Next_Elmt : Elmt_Ptr; begin if T = null then return; end if; Elmt := T.Table (Index); if Elmt = Null_Ptr then return; elsif Equal (Get_Key (Elmt), K) then T.Table (Index) := Next (Elmt); else loop Next_Elmt := Next (Elmt); if Next_Elmt = Null_Ptr then return; elsif Equal (Get_Key (Next_Elmt), K) then Set_Next (Elmt, Next (Next_Elmt)); return; else Elmt := Next_Elmt; end if; end loop; end if; end Remove; ----------- -- Reset -- ----------- procedure Reset (T : in out Instance) is procedure Free is new Ada.Unchecked_Deallocation (Instance_Data, Instance); begin if T = null then return; end if; for J in T.Table'Range loop T.Table (J) := Null_Ptr; end loop; Free (T); end Reset; --------- -- Set -- --------- procedure Set (T : in out Instance; E : Elmt_Ptr) is Index : Header_Num; begin if T = null then T := new Instance_Data; end if; Index := Hash (Get_Key (E)); Set_Next (E, T.Table (Index)); T.Table (Index) := E; end Set; end Static_HTable; ------------------- -- Simple_HTable -- ------------------- package body Simple_HTable is --------- -- Get -- --------- function Get (T : Instance; K : Key) return Element is Tmp : Elmt_Ptr; begin if T = Nil then return No_Element; end if; Tmp := Tab.Get (Tab.Instance (T), K); if Tmp = null then return No_Element; else return Tmp.E; end if; end Get; --------------- -- Get_First -- --------------- function Get_First (T : Instance) return Element is Tmp : constant Elmt_Ptr := Tab.Get_First (Tab.Instance (T)); begin if Tmp = null then return No_Element; else return Tmp.E; end if; end Get_First; ------------- -- Get_Key -- ------------- function Get_Key (E : Elmt_Ptr) return Key is begin return E.K; end Get_Key; -------------- -- Get_Next -- -------------- function Get_Next (T : Instance) return Element is Tmp : constant Elmt_Ptr := Tab.Get_Next (Tab.Instance (T)); begin if Tmp = null then return No_Element; else return Tmp.E; end if; end Get_Next; ---------- -- Next -- ---------- function Next (E : Elmt_Ptr) return Elmt_Ptr is begin return E.Next; end Next; ------------ -- Remove -- ------------ procedure Remove (T : Instance; K : Key) is Tmp : Elmt_Ptr; begin Tmp := Tab.Get (Tab.Instance (T), K); if Tmp /= null then Tab.Remove (Tab.Instance (T), K); Free (Tmp); end if; end Remove; ----------- -- Reset -- ----------- procedure Reset (T : in out Instance) is E1, E2 : Elmt_Ptr; begin E1 := Tab.Get_First (Tab.Instance (T)); while E1 /= null loop E2 := Tab.Get_Next (Tab.Instance (T)); Free (E1); E1 := E2; end loop; Tab.Reset (Tab.Instance (T)); end Reset; --------- -- Set -- --------- procedure Set (T : in out Instance; K : Key; E : Element) is Tmp : constant Elmt_Ptr := Tab.Get (Tab.Instance (T), K); begin if Tmp = null then Tab.Set (Tab.Instance (T), new Element_Wrapper'(K, E, null)); else Tmp.E := E; end if; end Set; -------------- -- Set_Next -- -------------- procedure Set_Next (E : Elmt_Ptr; Next : Elmt_Ptr) is begin E.Next := Next; end Set_Next; end Simple_HTable; end GNAT.Dynamic_HTables;
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1467.asm
ljhsiun2/medusa
9
100212
<reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1467.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0xaf87, %r11 nop nop nop nop nop inc %r14 mov $0x6162636465666768, %rsi movq %rsi, %xmm5 movups %xmm5, (%r11) nop nop nop nop add %r13, %r13 lea addresses_WT_ht+0x1afc1, %rsi lea addresses_D_ht+0x1cc07, %rdi nop nop nop nop add %r11, %r11 mov $104, %rcx rep movsl nop nop nop nop cmp $59176, %rdi lea addresses_A_ht+0x42e9, %rdi nop nop nop cmp $49406, %rax mov $0x6162636465666768, %r11 movq %r11, %xmm6 movups %xmm6, (%rdi) nop nop nop cmp $28282, %rax lea addresses_WC_ht+0x387, %rsi lea addresses_WC_ht+0x12d07, %rdi nop nop nop add %r11, %r11 mov $101, %rcx rep movsq nop add %r14, %r14 lea addresses_WC_ht+0x6507, %rdi nop sub $65328, %r14 vmovups (%rdi), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %rax cmp $44462, %rsi lea addresses_normal_ht+0x4d07, %rsi lea addresses_D_ht+0x34f, %rdi nop nop nop nop xor %r9, %r9 mov $126, %rcx rep movsq nop nop nop dec %rcx lea addresses_WT_ht+0x10f91, %rsi lea addresses_WC_ht+0x1c91d, %rdi nop nop inc %r14 mov $77, %rcx rep movsq nop cmp $64229, %rdi lea addresses_WT_ht+0xcec4, %r13 clflush (%r13) nop nop nop nop sub %rax, %rax vmovups (%r13), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %rsi and $39597, %rax lea addresses_WC_ht+0xa587, %rsi lea addresses_UC_ht+0x675c, %rdi sub %r14, %r14 mov $7, %rcx rep movsw add $14372, %r9 lea addresses_WT_ht+0x11947, %rsi lea addresses_A_ht+0x1ab07, %rdi clflush (%rdi) nop nop sub $23166, %r13 mov $82, %rcx rep movsb nop nop nop add %r11, %r11 lea addresses_A_ht+0xdea7, %rsi lea addresses_WC_ht+0x272b, %rdi clflush (%rsi) nop sub %rax, %rax mov $27, %rcx rep movsq nop nop nop nop dec %rsi pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r8 push %rax push %rbp push %rcx // Faulty Load lea addresses_PSE+0xb507, %r8 nop nop nop cmp $23214, %rax mov (%r8), %r10 lea oracles, %r8 and $0xff, %r10 shlq $12, %r10 mov (%r8,%r10,1), %r10 pop %rcx pop %rbp pop %rax pop %r8 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 9}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 2}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
src/x86/filmgrain16_avx2.asm
feiwei9696/dav1d
0
23032
; Copyright © 2021-2022, VideoLAN and dav1d authors ; Copyright © 2021-2022, Two Orioles, LLC ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; ; 1. Redistributions of source code must retain the above copyright notice, this ; list of conditions and the following disclaimer. ; ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %include "config.asm" %include "ext/x86/x86inc.asm" %include "x86/filmgrain_common.asm" %if ARCH_X86_64 SECTION_RODATA 16 pb_mask: db 0,128,128, 0,128, 0, 0,128,128, 0, 0,128, 0,128,128, 0 gen_shufA: db 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9 gen_shufB: db 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13 next_upperbit_mask: dw 0x100B, 0x2016, 0x402C, 0x8058 pw_27_17_17_27: dw 27, 17, 17, 27 pw_23_22: dw 23, 22, 0, 32 pw_seed_xor: times 2 dw 0xb524 times 2 dw 0x49d8 gen_ar0_shift: times 4 db 128 times 4 db 64 times 4 db 32 times 4 db 16 pd_16: dd 16 pd_m65536: dd -65536 pb_1: times 4 db 1 grain_max: times 2 dw 511 times 2 dw 2047 grain_min: times 2 dw -512 times 2 dw -2048 fg_max: times 2 dw 1023 times 2 dw 4095 times 2 dw 960 times 2 dw 3840 times 2 dw 940 times 2 dw 3760 fg_min: times 2 dw 0 times 2 dw 64 times 2 dw 256 uv_offset_mul: dd 256 dd 1024 hmul_bits: dw 32768, 16384, 8192, 4096 round: dw 2048, 1024, 512 mul_bits: dw 256, 128, 64, 32, 16, 8 round_vals: dw 32, 64, 128, 256, 512, 1024 pb_8_9_0_1: db 8, 9, 0, 1 %macro JMP_TABLE 1-* %xdefine %1_table %%table %xdefine %%base %1_table %xdefine %%prefix mangle(private_prefix %+ _%1) %%table: %rep %0 - 1 dd %%prefix %+ .ar%2 - %%base %rotate 1 %endrep %endmacro JMP_TABLE generate_grain_y_16bpc_avx2, 0, 1, 2, 3 JMP_TABLE generate_grain_uv_420_16bpc_avx2, 0, 1, 2, 3 JMP_TABLE generate_grain_uv_422_16bpc_avx2, 0, 1, 2, 3 JMP_TABLE generate_grain_uv_444_16bpc_avx2, 0, 1, 2, 3 SECTION .text %define m(x) mangle(private_prefix %+ _ %+ x %+ SUFFIX) INIT_YMM avx2 cglobal generate_grain_y_16bpc, 3, 9, 14, buf, fg_data, bdmax %define base r4-generate_grain_y_16bpc_avx2_table lea r4, [generate_grain_y_16bpc_avx2_table] vpbroadcastw xm0, [fg_dataq+FGData.seed] mov r6d, [fg_dataq+FGData.grain_scale_shift] movq xm1, [base+next_upperbit_mask] mov r3, -73*82*2 movsxd r5, [fg_dataq+FGData.ar_coeff_lag] lea r7d, [bdmaxq+1] movq xm4, [base+mul_bits] shr r7d, 11 ; 0 for 10bpc, 2 for 12bpc movq xm5, [base+hmul_bits] sub r6, r7 mova xm6, [base+pb_mask] sub bufq, r3 vpbroadcastw xm7, [base+round+r6*2-2] lea r6, [gaussian_sequence] movsxd r5, [r4+r5*4] .loop: pand xm2, xm0, xm1 psrlw xm3, xm2, 10 por xm2, xm3 ; bits 0xf, 0x1e, 0x3c and 0x78 are set pmullw xm2, xm4 ; bits 0x0f00 are set pmulhuw xm0, xm5 pshufb xm3, xm6, xm2 ; set 15th bit for next 4 seeds psllq xm2, xm3, 30 por xm2, xm3 psllq xm3, xm2, 15 por xm2, xm0 ; aggregate each bit into next seed's high bit por xm3, xm2 ; 4 next output seeds pshuflw xm0, xm3, q3333 psrlw xm3, 5 pand xm2, xm0, xm1 movq r7, xm3 psrlw xm3, xm2, 10 por xm2, xm3 pmullw xm2, xm4 pmulhuw xm0, xm5 movzx r8d, r7w pshufb xm3, xm6, xm2 psllq xm2, xm3, 30 por xm2, xm3 psllq xm3, xm2, 15 por xm0, xm2 movd xm2, [r6+r8*2] rorx r8, r7, 32 por xm3, xm0 shr r7d, 16 pinsrw xm2, [r6+r7*2], 1 pshuflw xm0, xm3, q3333 movzx r7d, r8w psrlw xm3, 5 pinsrw xm2, [r6+r7*2], 2 shr r8d, 16 movq r7, xm3 pinsrw xm2, [r6+r8*2], 3 movzx r8d, r7w pinsrw xm2, [r6+r8*2], 4 rorx r8, r7, 32 shr r7d, 16 pinsrw xm2, [r6+r7*2], 5 movzx r7d, r8w pinsrw xm2, [r6+r7*2], 6 shr r8d, 16 pinsrw xm2, [r6+r8*2], 7 paddw xm2, xm2 ; otherwise bpc=12 w/ grain_scale_shift=0 pmulhrsw xm2, xm7 ; shifts by 0, which pmulhrsw does not support mova [bufq+r3], xm2 add r3, 8*2 jl .loop ; auto-regression code add r5, r4 jmp r5 .ar1: DEFINE_ARGS buf, fg_data, max, shift, val3, min, cf3, x, val0 mov shiftd, [fg_dataq+FGData.ar_coeff_shift] movsx cf3d, byte [fg_dataq+FGData.ar_coeffs_y+3] movd xm4, [fg_dataq+FGData.ar_coeffs_y] DEFINE_ARGS buf, h, max, shift, val3, min, cf3, x, val0 pinsrb xm4, [base+pb_1], 3 pmovsxbw xm4, xm4 pshufd xm5, xm4, q1111 pshufd xm4, xm4, q0000 vpbroadcastw xm3, [base+round_vals+shiftq*2-12] ; rnd sub bufq, 2*(82*73-(82*3+79)) mov hd, 70 sar maxd, 1 mov mind, maxd xor mind, -1 .y_loop_ar1: mov xq, -76 movsx val3d, word [bufq+xq*2-2] .x_loop_ar1: movu xm0, [bufq+xq*2-82*2-2] ; top/left psrldq xm2, xm0, 2 ; top psrldq xm1, xm0, 4 ; top/right punpcklwd xm0, xm2 punpcklwd xm1, xm3 pmaddwd xm0, xm4 pmaddwd xm1, xm5 paddd xm0, xm1 .x_loop_ar1_inner: movd val0d, xm0 psrldq xm0, 4 imul val3d, cf3d add val3d, val0d sarx val3d, val3d, shiftd movsx val0d, word [bufq+xq*2] add val3d, val0d cmp val3d, maxd cmovg val3d, maxd cmp val3d, mind cmovl val3d, mind mov word [bufq+xq*2], val3w ; keep val3d in-place as left for next x iteration inc xq jz .x_loop_ar1_end test xb, 3 jnz .x_loop_ar1_inner jmp .x_loop_ar1 .x_loop_ar1_end: add bufq, 82*2 dec hd jg .y_loop_ar1 .ar0: RET .ar2: DEFINE_ARGS buf, fg_data, bdmax, shift mov shiftd, [fg_dataq+FGData.ar_coeff_shift] movq xm0, [fg_dataq+FGData.ar_coeffs_y+5] ; cf5-11 vinserti128 m0, [fg_dataq+FGData.ar_coeffs_y+0], 1 ; cf0-4 vpbroadcastw xm10, [base+round_vals-12+shiftq*2] pxor m1, m1 punpcklwd xm10, xm1 pcmpgtb m1, m0 punpcklbw m0, m1 ; cf5-11,0-4 vpermq m1, m0, q3333 ; cf4 vbroadcasti128 m11, [base+gen_shufA] pshufd m6, m0, q0000 ; cf[5,6], cf[0-1] vbroadcasti128 m12, [base+gen_shufB] pshufd m7, m0, q1111 ; cf[7,8], cf[2-3] punpckhwd xm1, xm0 pshufhw xm9, xm0, q2121 pshufd xm8, xm1, q0000 ; cf[4,9] sar bdmaxd, 1 punpckhqdq xm9, xm9 ; cf[10,11] movd xm4, bdmaxd ; max_grain pcmpeqd xm5, xm5 sub bufq, 2*(82*73-(82*3+79)) pxor xm5, xm4 ; min_grain DEFINE_ARGS buf, fg_data, h, x mov hd, 70 .y_loop_ar2: mov xq, -76 .x_loop_ar2: vbroadcasti128 m2, [bufq+xq*2-82*4-4] ; y=-2,x=[-2,+5] vinserti128 m1, m2, [bufq+xq*2-82*2-4], 0 ; y=-1,x=[-2,+5] pshufb m0, m1, m11 ; y=-1/-2,x=[-2/-1,-1/+0,+0/+1,+1/+2] pmaddwd m0, m6 punpckhwd xm2, xm1 ; y=-2/-1 interleaved, x=[+2,+5] pshufb m1, m12 ; y=-1/-2,x=[+0/+1,+1/+2,+2/+3,+3/+4] pmaddwd m1, m7 pmaddwd xm2, xm8 paddd m0, m1 vextracti128 xm1, m0, 1 paddd xm0, xm10 paddd xm2, xm0 movu xm0, [bufq+xq*2-4] ; y=0,x=[-2,+5] paddd xm2, xm1 pmovsxwd xm1, [bufq+xq*2] ; in dwords, y=0,x=[0,3] .x_loop_ar2_inner: pmaddwd xm3, xm9, xm0 psrldq xm0, 2 paddd xm3, xm2 psrldq xm2, 4 ; shift top to next pixel psrad xm3, [fg_dataq+FGData.ar_coeff_shift] ; skip packssdw because we only care about one value paddd xm3, xm1 pminsd xm3, xm4 psrldq xm1, 4 pmaxsd xm3, xm5 pextrw [bufq+xq*2], xm3, 0 punpcklwd xm3, xm3 pblendw xm0, xm3, 0010b inc xq jz .x_loop_ar2_end test xb, 3 jnz .x_loop_ar2_inner jmp .x_loop_ar2 .x_loop_ar2_end: add bufq, 82*2 dec hd jg .y_loop_ar2 RET .ar3: DEFINE_ARGS buf, fg_data, bdmax, shift mov shiftd, [fg_dataq+FGData.ar_coeff_shift] sar bdmaxd, 1 movq xm7, [fg_dataq+FGData.ar_coeffs_y+ 0] ; cf0-6 movd xm0, [fg_dataq+FGData.ar_coeffs_y+14] ; cf14-16 pinsrb xm7, [fg_dataq+FGData.ar_coeffs_y+13], 7 ; cf0-6,13 pinsrb xm0, [base+pb_1], 3 ; cf14-16,pb_1 movd xm1, [fg_dataq+FGData.ar_coeffs_y+21] ; cf21-23 vinserti128 m7, [fg_dataq+FGData.ar_coeffs_y+ 7], 1 ; cf7-13 vinserti128 m0, [fg_dataq+FGData.ar_coeffs_y+17], 1 ; cf17-20 vpbroadcastw xm11, [base+round_vals+shiftq*2-12] movd xm12, bdmaxd ; max_grain punpcklbw m7, m7 ; sign-extension punpcklbw m0, m0 ; sign-extension punpcklbw xm1, xm1 REPX {psraw x, 8}, m7, m0, xm1 pshufd m4, m7, q0000 ; cf[0,1] | cf[7,8] pshufd m5, m7, q1111 ; cf[2,3] | cf[9,10] pshufd m6, m7, q2222 ; cf[4,5] | cf[11,12] pshufd xm7, xm7, q3333 ; cf[6,13] pshufd m8, m0, q0000 ; cf[14,15] | cf[17,18] pshufd m9, m0, q1111 ; cf[16],pw_1 | cf[19,20] paddw xm0, xm11, xm11 pcmpeqd xm13, xm13 pblendw xm10, xm1, xm0, 00001000b pxor xm13, xm12 ; min_grain DEFINE_ARGS buf, fg_data, h, x sub bufq, 2*(82*73-(82*3+79)) mov hd, 70 .y_loop_ar3: mov xq, -76 .x_loop_ar3: movu xm0, [bufq+xq*2-82*6-6+ 0] ; y=-3,x=[-3,+4] vinserti128 m0, [bufq+xq*2-82*4-6+ 0], 1 ; y=-3/-2,x=[-3,+4] movq xm1, [bufq+xq*2-82*6-6+16] ; y=-3,x=[+5,+8] vinserti128 m1, [bufq+xq*2-82*4-6+16], 1 ; y=-3/-2,x=[+5,+12] palignr m3, m1, m0, 2 ; y=-3/-2,x=[-2,+5] palignr m1, m0, 12 ; y=-3/-2,x=[+3,+6] punpckhwd m2, m0, m3 ; y=-3/-2,x=[+1/+2,+2/+3,+3/+4,+4/+5] punpcklwd m0, m3 ; y=-3/-2,x=[-3/-2,-2/-1,-1/+0,+0/+1] shufps m3, m0, m2, q1032 ; y=-3/-2,x=[-1/+0,+0/+1,+1/+2,+2/+3] pmaddwd m0, m4 pmaddwd m2, m6 pmaddwd m3, m5 paddd m0, m2 movu xm2, [bufq+xq*2-82*2-6+ 0] ; y=-1,x=[-3,+4] vinserti128 m2, [bufq+xq*2-82*2-6+ 6], 1 ; y=-1,x=[+1,+8] paddd m0, m3 psrldq m3, m2, 2 punpcklwd m3, m2, m3 ; y=-1,x=[-3/-2,-2/-1,-1/+0,+0/+1] pmaddwd m3, m8 ; x=[+0/+1,+1/+2,+2/+3,+3/+4] paddd m0, m3 psrldq m3, m2, 4 psrldq m2, 6 vpblendd m2, m11, 0x0f ; rounding constant punpcklwd m3, m2 ; y=-1,x=[-1/rnd,+0/rnd,+1/rnd,+2/rnd] pmaddwd m3, m9 ; x=[+2/+3,+3/+4,+4/+5,+5,+6] vextracti128 xm2, m1, 1 punpcklwd xm1, xm2 pmaddwd xm1, xm7 ; y=-3/-2 interleaved,x=[+3,+4,+5,+6] paddd m0, m3 vextracti128 xm2, m0, 1 paddd xm0, xm1 movu xm1, [bufq+xq*2-6] ; y=0,x=[-3,+4] paddd xm0, xm2 .x_loop_ar3_inner: pmaddwd xm2, xm1, xm10 pshuflw xm3, xm2, q1032 paddd xm2, xm0 ; add top paddd xm2, xm3 ; left+cur psrldq xm0, 4 psrad xm2, [fg_dataq+FGData.ar_coeff_shift] ; skip packssdw because we only care about one value pminsd xm2, xm12 pmaxsd xm2, xm13 pextrw [bufq+xq*2], xm2, 0 pslldq xm2, 4 psrldq xm1, 2 pblendw xm1, xm2, 0100b inc xq jz .x_loop_ar3_end test xb, 3 jnz .x_loop_ar3_inner jmp .x_loop_ar3 .x_loop_ar3_end: add bufq, 82*2 dec hd jg .y_loop_ar3 RET %macro GEN_GRAIN_UV_FN 3 ; ss_name, ss_x, ss_y INIT_XMM avx2 cglobal generate_grain_uv_%1_16bpc, 4, 11, 8, buf, bufy, fg_data, uv, bdmax %define base r8-generate_grain_uv_%1_16bpc_avx2_table lea r8, [generate_grain_uv_%1_16bpc_avx2_table] movifnidn bdmaxd, bdmaxm vpbroadcastw xm0, [fg_dataq+FGData.seed] mov r5d, [fg_dataq+FGData.grain_scale_shift] movq xm1, [base+next_upperbit_mask] lea r6d, [bdmaxq+1] movq xm4, [base+mul_bits] shr r6d, 11 ; 0 for 10bpc, 2 for 12bpc movq xm5, [base+hmul_bits] sub r5, r6 mova xm6, [base+pb_mask] vpbroadcastd xm2, [base+pw_seed_xor+uvq*4] vpbroadcastw xm7, [base+round+r5*2-2] pxor xm0, xm2 lea r6, [gaussian_sequence] %if %2 mov r7d, 73-35*%3 add bufq, 44*2 .loop_y: mov r5, -44*2 %else mov r5, -82*73*2 sub bufq, r5 %endif .loop_x: pand xm2, xm0, xm1 psrlw xm3, xm2, 10 por xm2, xm3 ; bits 0xf, 0x1e, 0x3c and 0x78 are set pmullw xm2, xm4 ; bits 0x0f00 are set pmulhuw xm0, xm5 pshufb xm3, xm6, xm2 ; set 15th bit for next 4 seeds psllq xm2, xm3, 30 por xm2, xm3 psllq xm3, xm2, 15 por xm2, xm0 ; aggregate each bit into next seed's high bit por xm2, xm3 ; 4 next output seeds pshuflw xm0, xm2, q3333 psrlw xm2, 5 movq r10, xm2 movzx r9d, r10w movd xm2, [r6+r9*2] rorx r9, r10, 32 shr r10d, 16 pinsrw xm2, [r6+r10*2], 1 movzx r10d, r9w pinsrw xm2, [r6+r10*2], 2 shr r9d, 16 pinsrw xm2, [r6+r9*2], 3 paddw xm2, xm2 ; otherwise bpc=12 w/ grain_scale_shift=0 pmulhrsw xm2, xm7 ; shifts by 0, which pmulhrsw does not support movq [bufq+r5], xm2 add r5, 8 jl .loop_x %if %2 add bufq, 82*2 dec r7d jg .loop_y %endif ; auto-regression code movsxd r6, [fg_dataq+FGData.ar_coeff_lag] movsxd r6, [r8+r6*4] add r6, r8 jmp r6 INIT_YMM avx2 .ar0: DEFINE_ARGS buf, bufy, fg_data, uv, bdmax, shift imul uvd, 28 mov shiftd, [fg_dataq+FGData.ar_coeff_shift] vpbroadcastb m0, [fg_dataq+FGData.ar_coeffs_uv+uvq] sar bdmaxd, 1 vpbroadcastd m4, [base+gen_ar0_shift-24+shiftq*4] movd xm6, bdmaxd pcmpeqw m7, m7 pmaddubsw m4, m0 ; ar_coeff << (14 - shift) vpbroadcastw m6, xm6 ; max_gain pxor m7, m6 ; min_grain DEFINE_ARGS buf, bufy, h, x %if %2 vpbroadcastw m5, [base+hmul_bits+2+%3*2] sub bufq, 2*(82*(73-35*%3)+82-(82*3+41)) %else sub bufq, 2*(82*70-3) %endif add bufyq, 2*(3+82*3) mov hd, 70-35*%3 .y_loop_ar0: %if %2 ; first 32 pixels movu xm0, [bufyq+16*0] vinserti128 m0, [bufyq+16*2], 1 movu xm1, [bufyq+16*1] vinserti128 m1, [bufyq+16*3], 1 %if %3 movu xm2, [bufyq+82*2+16*0] vinserti128 m2, [bufyq+82*2+16*2], 1 movu xm3, [bufyq+82*2+16*1] vinserti128 m3, [bufyq+82*2+16*3], 1 paddw m0, m2 paddw m1, m3 %endif phaddw m0, m1 movu xm1, [bufyq+16*4] vinserti128 m1, [bufyq+16*6], 1 movu xm2, [bufyq+16*5] vinserti128 m2, [bufyq+16*7], 1 %if %3 movu xm3, [bufyq+82*2+16*4] vinserti128 m3, [bufyq+82*2+16*6], 1 paddw m1, m3 movu xm3, [bufyq+82*2+16*5] vinserti128 m3, [bufyq+82*2+16*7], 1 paddw m2, m3 %endif phaddw m1, m2 pmulhrsw m0, m5 pmulhrsw m1, m5 %else xor xd, xd .x_loop_ar0: movu m0, [bufyq+xq*2] movu m1, [bufyq+xq*2+32] %endif paddw m0, m0 paddw m1, m1 pmulhrsw m0, m4 pmulhrsw m1, m4 %if %2 paddw m0, [bufq+ 0] paddw m1, [bufq+32] %else paddw m0, [bufq+xq*2+ 0] paddw m1, [bufq+xq*2+32] %endif pminsw m0, m6 pminsw m1, m6 pmaxsw m0, m7 pmaxsw m1, m7 %if %2 movu [bufq+ 0], m0 movu [bufq+32], m1 ; last 6 pixels movu xm0, [bufyq+32*4] movu xm1, [bufyq+32*4+16] %if %3 paddw xm0, [bufyq+32*4+82*2] paddw xm1, [bufyq+32*4+82*2+16] %endif phaddw xm0, xm1 movu xm1, [bufq+32*2] pmulhrsw xm0, xm5 paddw xm0, xm0 pmulhrsw xm0, xm4 paddw xm0, xm1 pminsw xm0, xm6 pmaxsw xm0, xm7 vpblendd xm0, xm1, 0x08 movu [bufq+32*2], xm0 %else movu [bufq+xq*2+ 0], m0 movu [bufq+xq*2+32], m1 add xd, 32 cmp xd, 64 jl .x_loop_ar0 ; last 12 pixels movu m0, [bufyq+64*2] movu m1, [bufq+64*2] paddw m0, m0 pmulhrsw m0, m4 paddw m0, m1 pminsw m0, m6 pmaxsw m0, m7 vpblendd m0, m1, 0xc0 movu [bufq+64*2], m0 %endif add bufq, 82*2 add bufyq, 82*2<<%3 dec hd jg .y_loop_ar0 RET INIT_XMM avx2 .ar1: DEFINE_ARGS buf, bufy, fg_data, uv, max, cf3, min, val3, x, shift imul uvd, 28 mov shiftd, [fg_dataq+FGData.ar_coeff_shift] movsx cf3d, byte [fg_dataq+FGData.ar_coeffs_uv+uvq+3] movd xm4, [fg_dataq+FGData.ar_coeffs_uv+uvq] pinsrb xm4, [fg_dataq+FGData.ar_coeffs_uv+uvq+4], 3 DEFINE_ARGS buf, bufy, h, val0, max, cf3, min, val3, x, shift pmovsxbw xm4, xm4 pshufd xm5, xm4, q1111 pshufd xm4, xm4, q0000 pmovsxwd xm3, [base+round_vals+shiftq*2-12] ; rnd vpbroadcastw xm6, [base+hmul_bits+2+%3*2] vpbroadcastd xm3, xm3 %if %2 sub bufq, 2*(82*(73-35*%3)+44-(82*3+41)) %else sub bufq, 2*(82*69+3) %endif add bufyq, 2*(79+82*3) mov hd, 70-35*%3 sar maxd, 1 mov mind, maxd xor mind, -1 .y_loop_ar1: mov xq, -(76>>%2) movsx val3d, word [bufq+xq*2-2] .x_loop_ar1: movu xm0, [bufq+xq*2-82*2-2] ; top/left %if %2 movu xm2, [bufyq+xq*4] %else movq xm2, [bufyq+xq*2] %endif %if %2 %if %3 phaddw xm2, [bufyq+xq*4+82*2] punpckhqdq xm1, xm2, xm2 paddw xm2, xm1 %else phaddw xm2, xm2 %endif pmulhrsw xm2, xm6 %endif psrldq xm1, xm0, 4 ; top/right punpcklwd xm1, xm2 psrldq xm2, xm0, 2 ; top punpcklwd xm0, xm2 pmaddwd xm1, xm5 pmaddwd xm0, xm4 paddd xm1, xm3 paddd xm0, xm1 .x_loop_ar1_inner: movd val0d, xm0 psrldq xm0, 4 imul val3d, cf3d add val3d, val0d sarx val3d, val3d, shiftd movsx val0d, word [bufq+xq*2] add val3d, val0d cmp val3d, maxd cmovg val3d, maxd cmp val3d, mind cmovl val3d, mind mov word [bufq+xq*2], val3w ; keep val3d in-place as left for next x iteration inc xq jz .x_loop_ar1_end test xb, 3 jnz .x_loop_ar1_inner jmp .x_loop_ar1 .x_loop_ar1_end: add bufq, 82*2 add bufyq, 82*2<<%3 dec hd jg .y_loop_ar1 RET INIT_YMM avx2 .ar2: %if WIN64 ; xmm6 and xmm7 already saved %assign xmm_regs_used 13 + %2 %assign stack_size_padded 136 SUB rsp, stack_size_padded movaps [rsp+16*2], xmm8 movaps [rsp+16*3], xmm9 movaps [rsp+16*4], xmm10 movaps [rsp+16*5], xmm11 movaps [rsp+16*6], xmm12 %if %2 movaps [rsp+16*7], xmm13 %endif %endif DEFINE_ARGS buf, bufy, fg_data, uv, bdmax, shift mov shiftd, [fg_dataq+FGData.ar_coeff_shift] imul uvd, 28 vbroadcasti128 m10, [base+gen_shufA] sar bdmaxd, 1 vbroadcasti128 m11, [base+gen_shufB] movd xm7, [fg_dataq+FGData.ar_coeffs_uv+uvq+ 5] pinsrb xm7, [fg_dataq+FGData.ar_coeffs_uv+uvq+12], 4 pinsrb xm7, [base+pb_1], 5 pinsrw xm7, [fg_dataq+FGData.ar_coeffs_uv+uvq+10], 3 movhps xm7, [fg_dataq+FGData.ar_coeffs_uv+uvq+ 0] pinsrb xm7, [fg_dataq+FGData.ar_coeffs_uv+uvq+ 9], 13 pmovsxbw m7, xm7 movd xm8, bdmaxd ; max_grain pshufd m4, m7, q0000 vpbroadcastw xm12, [base+round_vals-12+shiftq*2] pshufd m5, m7, q1111 pcmpeqd xm9, xm9 pshufd m6, m7, q2222 pxor xm9, xm8 ; min_grain pshufd xm7, xm7, q3333 DEFINE_ARGS buf, bufy, fg_data, h, x %if %2 vpbroadcastw xm13, [base+hmul_bits+2+%3*2] sub bufq, 2*(82*(73-35*%3)+44-(82*3+41)) %else sub bufq, 2*(82*69+3) %endif add bufyq, 2*(79+82*3) mov hd, 70-35*%3 .y_loop_ar2: mov xq, -(76>>%2) .x_loop_ar2: vbroadcasti128 m3, [bufq+xq*2-82*2-4] ; y=-1,x=[-2,+5] vinserti128 m2, m3, [bufq+xq*2-82*4-4], 1 ; y=-2,x=[-2,+5] pshufb m0, m2, m10 ; y=-1/-2,x=[-2/-1,-1/+0,+0/+1,+1/+2] pmaddwd m0, m4 pshufb m1, m2, m11 ; y=-1/-2,x=[+0/+1,+1/+2,+2/+3,+3/+4] pmaddwd m1, m5 punpckhwd m2, m3 ; y=-2/-1 interleaved, x=[+2,+5] %if %2 movu xm3, [bufyq+xq*4] %if %3 paddw xm3, [bufyq+xq*4+82*2] %endif phaddw xm3, xm3 pmulhrsw xm3, xm13 %else movq xm3, [bufyq+xq*2] %endif punpcklwd xm3, xm12 ; luma, round interleaved vpblendd m2, m3, 0x0f pmaddwd m2, m6 paddd m1, m0 movu xm0, [bufq+xq*2-4] ; y=0,x=[-2,+5] paddd m2, m1 vextracti128 xm1, m2, 1 paddd xm2, xm1 pshufd xm1, xm0, q3321 pmovsxwd xm1, xm1 ; y=0,x=[0,3] in dword .x_loop_ar2_inner: pmaddwd xm3, xm7, xm0 paddd xm3, xm2 psrldq xm2, 4 ; shift top to next pixel psrad xm3, [fg_dataq+FGData.ar_coeff_shift] ; we do not need to packssdw since we only care about one value paddd xm3, xm1 psrldq xm1, 4 pminsd xm3, xm8 pmaxsd xm3, xm9 pextrw [bufq+xq*2], xm3, 0 psrldq xm0, 2 pslldq xm3, 2 pblendw xm0, xm3, 00000010b inc xq jz .x_loop_ar2_end test xb, 3 jnz .x_loop_ar2_inner jmp .x_loop_ar2 .x_loop_ar2_end: add bufq, 82*2 add bufyq, 82*2<<%3 dec hd jg .y_loop_ar2 RET .ar3: %if WIN64 ; xmm6 and xmm7 already saved %assign stack_offset 32 %assign xmm_regs_used 14 + %2 %assign stack_size_padded 152 SUB rsp, stack_size_padded movaps [rsp+16*2], xmm8 movaps [rsp+16*3], xmm9 movaps [rsp+16*4], xmm10 movaps [rsp+16*5], xmm11 movaps [rsp+16*6], xmm12 movaps [rsp+16*7], xmm13 %if %2 movaps [rsp+16*8], xmm14 %endif %endif DEFINE_ARGS buf, bufy, fg_data, uv, bdmax, shift mov shiftd, [fg_dataq+FGData.ar_coeff_shift] imul uvd, 28 vpbroadcastw xm11, [base+round_vals-12+shiftq*2] sar bdmaxd, 1 movq xm7, [fg_dataq+FGData.ar_coeffs_uv+uvq+ 0] pinsrb xm7, [fg_dataq+FGData.ar_coeffs_uv+uvq+24], 7 ; luma movhps xm7, [fg_dataq+FGData.ar_coeffs_uv+uvq+ 7] pmovsxbw m7, xm7 %if %2 vpbroadcastw xm14, [base+hmul_bits+2+%3*2] %endif pshufd m4, m7, q0000 pshufd m5, m7, q1111 pshufd m6, m7, q2222 pshufd m7, m7, q3333 movd xm0, [fg_dataq+FGData.ar_coeffs_uv+uvq+14] pinsrb xm0, [base+pb_1], 3 pinsrd xm0, [fg_dataq+FGData.ar_coeffs_uv+uvq+21], 1 pinsrd xm0, [fg_dataq+FGData.ar_coeffs_uv+uvq+17], 2 pmovsxbw m0, xm0 movd xm12, bdmaxd ; max_grain pshufd m8, m0, q0000 pshufd m9, m0, q1111 pcmpeqd xm13, xm13 punpckhqdq xm10, xm0, xm0 pxor xm13, xm12 ; min_grain pinsrw xm10, [base+round_vals-10+shiftq*2], 3 DEFINE_ARGS buf, bufy, fg_data, h, unused, x %if %2 sub bufq, 2*(82*(73-35*%3)+44-(82*3+41)) %else sub bufq, 2*(82*69+3) %endif add bufyq, 2*(79+82*3) mov hd, 70-35*%3 .y_loop_ar3: mov xq, -(76>>%2) .x_loop_ar3: movu xm2, [bufq+xq*2-82*6-6+ 0] ; y=-3,x=[-3,+4] vinserti128 m2, [bufq+xq*2-82*4-6+ 0], 1 ; y=-3/-2,x=[-3,+4] movq xm1, [bufq+xq*2-82*6-6+16] ; y=-3,x=[+5,+8] vinserti128 m1, [bufq+xq*2-82*4-6+16], 1 ; y=-3/-2,x=[+5,+12] palignr m3, m1, m2, 2 ; y=-3/-2,x=[-2,+5] palignr m1, m2, 12 ; y=-3/-2,x=[+3,+6] punpcklwd m0, m2, m3 ; y=-3/-2,x=[-3/-2,-2/-1,-1/+0,+0/+1] punpckhwd m2, m3 ; y=-3/-2,x=[+1/+2,+2/+3,+3/+4,+4/+5] shufps m3, m0, m2, q1032 ; y=-3/-2,x=[-1/+0,+0/+1,+1/+2,+2/+3] pmaddwd m0, m4 pmaddwd m2, m6 pmaddwd m3, m5 paddd m0, m2 paddd m0, m3 movu xm2, [bufq+xq*2-82*2-6+ 0] ; y=-1,x=[-3,+4] vinserti128 m2, [bufq+xq*2-82*2-6+ 6], 1 ; y=-1,x=[+1,+8] %if %2 movu xm3, [bufyq+xq*4] %if %3 paddw xm3, [bufyq+xq*4+82*2] %endif phaddw xm3, xm3 pmulhrsw xm3, xm14 %else movq xm3, [bufyq+xq*2] %endif punpcklwd m1, m3 pmaddwd m1, m7 paddd m0, m1 psrldq m1, m2, 4 psrldq m3, m2, 6 vpblendd m3, m11, 0x0f ; rounding constant punpcklwd m1, m3 ; y=-1,x=[-1/rnd,+0/rnd,+1/rnd,+2/rnd] pmaddwd m1, m9 ; x=[+2/+3,+3/+4,+4/+5,+5,+6] psrldq m3, m2, 2 punpcklwd m2, m3 ; y=-1,x=[-3/-2,-2/-1,-1/+0,+0/+1] pmaddwd m2, m8 ; x=[+0/+1,+1/+2,+2/+3,+3/+4] paddd m0, m1 movu xm1, [bufq+xq*2-6] ; y=0,x=[-3,+4] paddd m0, m2 vextracti128 xm2, m0, 1 paddd xm0, xm2 .x_loop_ar3_inner: pmaddwd xm2, xm1, xm10 pshuflw xm3, xm2, q1032 paddd xm2, xm0 ; add top paddd xm2, xm3 ; left+cur psrldq xm0, 4 psrad xm2, [fg_dataq+FGData.ar_coeff_shift] psrldq xm1, 2 ; no need to packssdw since we only care about one value pminsd xm2, xm12 pmaxsd xm2, xm13 pextrw [bufq+xq*2], xm2, 0 pslldq xm2, 4 pblendw xm1, xm2, 00000100b inc xq jz .x_loop_ar3_end test xb, 3 jnz .x_loop_ar3_inner jmp .x_loop_ar3 .x_loop_ar3_end: add bufq, 82*2 add bufyq, 82*2<<%3 dec hd jg .y_loop_ar3 RET %endmacro cglobal fgy_32x32xn_16bpc, 6, 14, 16, dst, src, stride, fg_data, w, scaling, \ grain_lut, unused, sby, see %define base r11-grain_min lea r11, [grain_min] mov r6d, r9m ; bdmax mov r9d, [fg_dataq+FGData.clip_to_restricted_range] mov r7d, [fg_dataq+FGData.scaling_shift] mov sbyd, sbym vpbroadcastd m8, r9m shr r6d, 11 ; is_12bpc vpbroadcastd m9, [base+grain_min+r6*4] shlx r10d, r9d, r6d vpbroadcastd m10, [base+grain_max+r6*4] lea r9d, [r6+r9*4] vpbroadcastw m11, [base+mul_bits+r7*2-12] vpbroadcastd m12, [base+fg_min+r10*4] vpbroadcastd m13, [base+fg_max+r9*4] test sbyd, sbyd setnz r7b vpbroadcastd m14, [base+pd_16] test r7b, [fg_dataq+FGData.overlap_flag] jnz .vertical_overlap imul seed, sbyd, (173 << 24) | 37 add seed, (105 << 24) | 178 rorx seed, seed, 24 movzx seed, seew xor seed, [fg_dataq+FGData.seed] DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ offx, offy, see, src_bak lea src_bakq, [srcq+wq*2] neg wq sub dstq, srcq .loop_x: rorx r6, seeq, 1 or seed, 0xEFF4 test seeb, seeh lea seed, [r6+0x8000] cmovp seed, r6d ; updated seed rorx offyd, seed, 8 rorx offxq, seeq, 12 and offyd, 0xf imul offyd, 164 lea offyd, [offyq+offxq*2+747] ; offy*stride+offx DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ h, offxy, see, src_bak mov grain_lutq, grain_lutmp mov hd, hm .loop_y: ; scaling[src] mova m0, [srcq+ 0] mova m1, [srcq+32] pand m4, m8, m0 psrld m3, m0, 16 mova m6, m9 vpgatherdd m2, [scalingq+m4-0], m9 pand m3, m8 mova m9, m6 vpgatherdd m4, [scalingq+m3-2], m6 pand m5, m8, m1 mova m6, m9 vpgatherdd m3, [scalingq+m5-0], m9 pblendw m4, m2, 0x55 psrld m2, m1, 16 mova m9, m6 pand m2, m8 vpgatherdd m5, [scalingq+m2-2], m6 pblendw m5, m3, 0x55 ; noise = round2(scaling[src] * grain, scaling_shift) pmaddubsw m4, m11 pmaddubsw m5, m11 paddw m4, m4 paddw m5, m5 pmulhrsw m4, [grain_lutq+offxyq*2] pmulhrsw m5, [grain_lutq+offxyq*2+32] ; dst = clip_pixel(src, noise) paddw m0, m4 paddw m1, m5 pmaxsw m0, m12 pmaxsw m1, m12 pminsw m0, m13 pminsw m1, m13 mova [dstq+srcq+ 0], m0 mova [dstq+srcq+32], m1 add srcq, strideq add grain_lutq, 82*2 dec hd jg .loop_y add wq, 32 jge .end lea srcq, [src_bakq+wq*2] cmp byte [fg_dataq+FGData.overlap_flag], 0 je .loop_x movq xm7, [pw_27_17_17_27] cmp dword r8m, 0 ; sby jne .loop_x_hv_overlap ; horizontal overlap (without vertical overlap) .loop_x_h_overlap: rorx r6, seeq, 1 or seed, 0xEFF4 test seeb, seeh lea seed, [r6+0x8000] cmovp seed, r6d ; updated seed DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ offx, offy, see, src_bak, left_offxy lea left_offxyd, [offyq+32] ; previous column's offy*stride+offx rorx offyd, seed, 8 rorx offxq, seeq, 12 and offyd, 0xf imul offyd, 164 lea offyd, [offyq+offxq*2+747] ; offy*stride+offx DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ h, offxy, see, src_bak, left_offxy mov grain_lutq, grain_lutmp mov hd, hm .loop_y_h_overlap: ; scaling[src] mova m0, [srcq+ 0] mova m1, [srcq+32] pand m4, m8, m0 psrld m3, m0, 16 mova m6, m9 vpgatherdd m2, [scalingq+m4-0], m9 pand m3, m8 mova m9, m6 vpgatherdd m4, [scalingq+m3-2], m6 pand m5, m8, m1 mova m6, m9 vpgatherdd m3, [scalingq+m5-0], m9 pblendw m4, m2, 0x55 psrld m2, m1, 16 mova m9, m6 pand m2, m8 vpgatherdd m5, [scalingq+m2-2], m6 pblendw m5, m3, 0x55 ; grain = grain_lut[offy+y][offx+x] movu m3, [grain_lutq+offxyq*2] movd xm6, [grain_lutq+left_offxyq*2] punpcklwd xm6, xm3 pmaddwd xm6, xm7 paddd xm6, xm14 psrad xm6, 5 packssdw xm6, xm6 pmaxsw xm6, xm9 pminsw xm6, xm10 vpblendd m3, m6, 0x01 ; noise = round2(scaling[src] * grain, scaling_shift) pmaddubsw m4, m11 pmaddubsw m5, m11 paddw m4, m4 paddw m5, m5 pmulhrsw m4, m3 pmulhrsw m5, [grain_lutq+offxyq*2+32] ; dst = clip_pixel(src, noise) paddw m0, m4 paddw m1, m5 pmaxsw m0, m12 pmaxsw m1, m12 pminsw m0, m13 pminsw m1, m13 mova [dstq+srcq+ 0], m0 mova [dstq+srcq+32], m1 add srcq, strideq add grain_lutq, 82*2 dec hd jg .loop_y_h_overlap add wq, 32 jge .end lea srcq, [src_bakq+wq*2] cmp dword r8m, 0 ; sby jne .loop_x_hv_overlap jmp .loop_x_h_overlap .vertical_overlap: DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, unused1, \ sby, see, src_bak movzx sbyd, sbyb imul seed, [fg_dataq+FGData.seed], 0x00010001 imul r7d, sbyd, 173 * 0x00010001 imul sbyd, 37 * 0x01000100 add r7d, (105 << 16) | 188 add sbyd, (178 << 24) | (141 << 8) and r7d, 0x00ff00ff and sbyd, 0xff00ff00 xor seed, r7d xor seed, sbyd ; (cur_seed << 16) | top_seed lea src_bakq, [srcq+wq*2] neg wq sub dstq, srcq .loop_x_v_overlap: vpbroadcastd m15, [pw_27_17_17_27] ; we assume from the block above that bits 8-15 of r7d are zero'ed mov r6d, seed or seed, 0xeff4eff4 test seeb, seeh setp r7b ; parity of top_seed shr seed, 16 shl r7d, 16 test seeb, seeh setp r7b ; parity of cur_seed or r6d, 0x00010001 xor r7d, r6d rorx seed, r7d, 1 ; updated (cur_seed << 16) | top_seed DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ offx, offy, see, src_bak, unused, top_offxy rorx offyd, seed, 8 rorx offxd, seed, 12 and offyd, 0xf000f and offxd, 0xf000f imul offyd, 164 ; offxy=offy*stride+offx, (cur_offxy << 16) | top_offxy lea offyd, [offyq+offxq*2+0x10001*747+32*82] DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ h, offxy, see, src_bak, unused, top_offxy mov grain_lutq, grain_lutmp mov hd, hm movzx top_offxyd, offxyw shr offxyd, 16 .loop_y_v_overlap: ; scaling[src] mova m0, [srcq+ 0] mova m1, [srcq+32] pand m4, m8, m0 psrld m3, m0, 16 mova m6, m9 vpgatherdd m2, [scalingq+m4-0], m9 pand m3, m8 mova m9, m6 vpgatherdd m4, [scalingq+m3-2], m6 pand m5, m8, m1 mova m6, m9 vpgatherdd m3, [scalingq+m5-0], m9 pblendw m2, m4, 0xaa psrld m4, m1, 16 mova m9, m6 pand m4, m8 vpgatherdd m5, [scalingq+m4-2], m6 pblendw m3, m5, 0xaa ; grain = grain_lut[offy+y][offx+x] movu m6, [grain_lutq+offxyq*2] movu m5, [grain_lutq+top_offxyq*2] punpcklwd m4, m5, m6 punpckhwd m5, m6 pmaddwd m4, m15 pmaddwd m5, m15 movu m7, [grain_lutq+offxyq*2+32] movu m6, [grain_lutq+top_offxyq*2+32] paddd m4, m14 paddd m5, m14 psrad m4, 5 psrad m5, 5 packssdw m4, m5 punpcklwd m5, m6, m7 punpckhwd m6, m7 pmaddwd m5, m15 pmaddwd m6, m15 paddd m5, m14 paddd m6, m14 psrad m5, 5 psrad m6, 5 packssdw m5, m6 pmaxsw m4, m9 pmaxsw m5, m9 pminsw m4, m10 pminsw m5, m10 ; noise = round2(scaling[src] * grain, scaling_shift) pmaddubsw m2, m11 pmaddubsw m3, m11 paddw m2, m2 paddw m3, m3 pmulhrsw m4, m2 pmulhrsw m5, m3 ; dst = clip_pixel(src, noise) paddw m0, m4 paddw m1, m5 pmaxsw m0, m12 pmaxsw m1, m12 pminsw m0, m13 pminsw m1, m13 mova [dstq+srcq+ 0], m0 mova [dstq+srcq+32], m1 add srcq, strideq add grain_lutq, 82*2 dec hb jz .end_y_v_overlap vpbroadcastd m15, [pw_27_17_17_27+4] ; swap weights for second v-overlap line ; 2 lines get vertical overlap, then fall back to non-overlap code for ; remaining (up to) 30 lines add hd, 0x80000000 jnc .loop_y_v_overlap jmp .loop_y .end_y_v_overlap: add wq, 32 jge .end lea srcq, [src_bakq+wq*2] ; since fg_dataq.overlap is guaranteed to be set, we never jump ; back to .loop_x_v_overlap, and instead always fall-through to ; h+v overlap .loop_x_hv_overlap: vpbroadcastd m15, [pw_27_17_17_27] ; we assume from the block above that bits 8-15 of r7d are zero'ed mov r6d, seed or seed, 0xeff4eff4 test seeb, seeh setp r7b ; parity of top_seed shr seed, 16 shl r7d, 16 test seeb, seeh setp r7b ; parity of cur_seed or r6d, 0x00010001 xor r7d, r6d rorx seed, r7d, 1 ; updated (cur_seed << 16) | top_seed DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ offx, offy, see, src_bak, left_offxy, top_offxy, topleft_offxy lea topleft_offxyd, [top_offxyq+32] lea left_offxyd, [offyq+32] rorx offyd, seed, 8 rorx offxd, seed, 12 and offyd, 0xf000f and offxd, 0xf000f imul offyd, 164 ; offxy=offy*stride+offx, (cur_offxy << 16) | top_offxy lea offyd, [offyq+offxq*2+0x10001*747+32*82] DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ h, offxy, see, src_bak, left_offxy, top_offxy, topleft_offxy mov grain_lutq, grain_lutmp mov hd, hm movzx top_offxyd, offxyw shr offxyd, 16 .loop_y_hv_overlap: ; scaling[src] mova m0, [srcq+ 0] mova m1, [srcq+32] pand m4, m8, m0 psrld m3, m0, 16 mova m6, m9 vpgatherdd m2, [scalingq+m4-0], m9 pand m3, m8 mova m9, m6 vpgatherdd m4, [scalingq+m3-2], m6 pand m5, m8, m1 mova m6, m9 vpgatherdd m3, [scalingq+m5-0], m9 pblendw m2, m4, 0xaa psrld m4, m1, 16 mova m9, m6 pand m4, m8 vpgatherdd m5, [scalingq+m4-2], m6 pblendw m3, m5, 0xaa ; grain = grain_lut[offy+y][offx+x] movu m7, [grain_lutq+offxyq*2] movd xm6, [grain_lutq+left_offxyq*2] movu m5, [grain_lutq+top_offxyq*2] movd xm4, [grain_lutq+topleft_offxyq*2] ; do h interpolation first (so top | top/left -> top, left | cur -> cur) punpcklwd xm6, xm7 punpcklwd xm4, xm5 punpcklqdq xm6, xm4 movddup xm4, [pw_27_17_17_27] pmaddwd xm6, xm4 paddd xm6, xm14 psrad xm6, 5 packssdw xm6, xm6 pmaxsw xm6, xm9 pminsw xm6, xm10 pshuflw xm4, xm6, q1032 vpblendd m6, m7, 0xfe vpblendd m4, m5, 0xfe ; followed by v interpolation (top | cur -> cur) punpckhwd m5, m7 pmaddwd m5, m15 punpcklwd m4, m6 pmaddwd m4, m15 movu m7, [grain_lutq+offxyq*2+32] movu m6, [grain_lutq+top_offxyq*2+32] paddd m5, m14 paddd m4, m14 psrad m5, 5 psrad m4, 5 packssdw m4, m5 punpcklwd m5, m6, m7 punpckhwd m6, m7 pmaddwd m5, m15 pmaddwd m6, m15 paddd m5, m14 paddd m6, m14 psrad m5, 5 psrad m6, 5 packssdw m5, m6 pmaxsw m4, m9 pmaxsw m5, m9 pminsw m4, m10 pminsw m5, m10 ; noise = round2(scaling[src] * grain, scaling_shift) pmaddubsw m2, m11 pmaddubsw m3, m11 paddw m2, m2 paddw m3, m3 pmulhrsw m4, m2 pmulhrsw m5, m3 ; dst = clip_pixel(src, noise) paddw m0, m4 paddw m1, m5 pmaxsw m0, m12 pmaxsw m1, m12 pminsw m0, m13 pminsw m1, m13 mova [dstq+srcq+ 0], m0 mova [dstq+srcq+32], m1 add srcq, strideq add grain_lutq, 82*2 dec hb jz .end_y_hv_overlap vpbroadcastd m15, [pw_27_17_17_27+4] ; swap weights for second v-overlap line ; 2 lines get vertical overlap, then fall back to non-overlap code for ; remaining (up to) 30 lines add hd, 0x80000000 jnc .loop_y_hv_overlap movq xm7, [pw_27_17_17_27] jmp .loop_y_h_overlap .end_y_hv_overlap: add wq, 32 lea srcq, [src_bakq+wq*2] jl .loop_x_hv_overlap .end: RET %macro FGUV_FN 3 ; name, ss_hor, ss_ver cglobal fguv_32x32xn_i%1_16bpc, 6, 15, 16, dst, src, stride, fg_data, w, scaling, \ grain_lut, h, sby, luma, lstride, uv_pl, is_id %define base r12-grain_min lea r12, [grain_min] mov r9d, r13m ; bdmax mov r7d, [fg_dataq+FGData.scaling_shift] mov r11d, is_idm mov sbyd, sbym vpbroadcastw m11, [base+mul_bits+r7*2-12] mov r6d, [fg_dataq+FGData.clip_to_restricted_range] shr r9d, 11 ; is_12bpc vpbroadcastd m8, [base+grain_min+r9*4] shlx r10d, r6d, r9d vpbroadcastd m9, [base+grain_max+r9*4] vpbroadcastw m10, r13m shlx r6d, r6d, r11d vpbroadcastd m12, [base+fg_min+r10*4] lea r6d, [r9+r6*2] vpbroadcastd m13, [base+fg_max+r6*4] test sbyd, sbyd setnz r7b cmp byte [fg_dataq+FGData.chroma_scaling_from_luma], 0 jne .csfl %macro %%FGUV_32x32xN_LOOP 3 ; not-csfl, ss_hor, ss_ver DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ unused, sby, see, overlap %if %1 mov r6d, r11m vpbroadcastd m0, [base+pb_8_9_0_1] vpbroadcastd m1, [base+uv_offset_mul+r9*4] vbroadcasti128 m14, [fg_dataq+FGData.uv_mult+r6*4] vpbroadcastd m15, [fg_dataq+FGData.uv_offset+r6*4] pshufb m14, m0 ; { uv_luma_mult, uv_mult } pmaddwd m15, m1 %else %if %2 vpbroadcastq m15, [base+pw_23_22] %else vpbroadcastq m15, [base+pw_27_17_17_27] %endif vpbroadcastd m14, [base+pd_16] %endif test r7b, [fg_dataq+FGData.overlap_flag] jnz %%vertical_overlap imul seed, sbyd, (173 << 24) | 37 add seed, (105 << 24) | 178 rorx seed, seed, 24 movzx seed, seew xor seed, [fg_dataq+FGData.seed] DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ unused2, unused3, see, unused4, unused5, unused6, luma, lstride mov lumaq, r9mp mov lstrideq, r10mp lea r10, [srcq+wq*2] lea r11, [dstq+wq*2] lea r12, [lumaq+wq*(2<<%2)] mov r9mp, r10 mov r11mp, r11 mov r12mp, r12 neg wq %%loop_x: rorx r6, seeq, 1 or seed, 0xEFF4 test seeb, seeh lea seed, [r6+0x8000] cmovp seed, r6d ; updated seed DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ offx, offy, see, unused1, unused2, unused3, luma, lstride rorx offyd, seed, 8 rorx offxq, seeq, 12 and offyd, 0xf imul offyd, 164>>%3 lea offyd, [offyq+offxq*(2-%2)+(3+(6>>%3))*82+(3+(6>>%2))] ; offy*stride+offx DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ h, offxy, see, unused1, unused2, unused3, luma, lstride mov grain_lutq, grain_lutmp mov hd, hm %%loop_y: ; luma_src %if %2 mova xm2, [lumaq+lstrideq*0+ 0] vinserti128 m2, [lumaq+lstrideq*0+32], 1 mova xm4, [lumaq+lstrideq*0+16] vinserti128 m4, [lumaq+lstrideq*0+48], 1 mova xm3, [lumaq+lstrideq*(1<<%3)+ 0] vinserti128 m3, [lumaq+lstrideq*(1<<%3)+32], 1 mova xm5, [lumaq+lstrideq*(1<<%3)+16] vinserti128 m5, [lumaq+lstrideq*(1<<%3)+48], 1 phaddw m2, m4 phaddw m3, m5 pxor m4, m4 pavgw m2, m4 pavgw m3, m4 %elif %1 mova m2, [lumaq+ 0] mova m3, [lumaq+32] %endif %if %1 mova m0, [srcq] %if %2 mova m1, [srcq+strideq] %else mova m1, [srcq+32] %endif punpckhwd m4, m2, m0 punpcklwd m2, m0 punpckhwd m5, m3, m1 punpcklwd m3, m1 ; { luma, chroma } REPX {pmaddwd x, m14}, m4, m2, m5, m3 REPX {paddd x, m15}, m4, m2, m5, m3 REPX {psrad x, 6 }, m4, m2, m5, m3 packusdw m2, m4 packusdw m3, m5 pminuw m2, m10 pminuw m3, m10 ; clip_pixel() %elif %2 pand m2, m10 pand m3, m10 %else pand m2, m10, [lumaq+ 0] pand m3, m10, [lumaq+32] %endif ; scaling[luma_src] vpbroadcastd m7, [pd_m65536] pandn m4, m7, m2 mova m6, m7 vpgatherdd m5, [scalingq+m4-0], m7 psrld m2, 16 mova m7, m6 vpgatherdd m4, [scalingq+m2-2], m6 pblendw m4, m5, 0x55 pandn m5, m7, m3 mova m6, m7 vpgatherdd m2, [scalingq+m5-0], m7 psrld m3, 16 vpgatherdd m5, [scalingq+m3-2], m6 pblendw m5, m2, 0x55 ; noise = round2(scaling[luma_src] * grain, scaling_shift) pmaddubsw m4, m11 pmaddubsw m5, m11 paddw m4, m4 paddw m5, m5 pmulhrsw m4, [grain_lutq+offxyq*2] %if %2 pmulhrsw m5, [grain_lutq+offxyq*2+82*2] %else pmulhrsw m5, [grain_lutq+offxyq*2+32] %endif ; dst = clip_pixel(src, noise) %if %1 paddw m0, m4 paddw m1, m5 %else paddw m0, m4, [srcq] %if %2 paddw m1, m5, [srcq+strideq] %else paddw m1, m5, [srcq+32] %endif %endif pmaxsw m0, m12 pmaxsw m1, m12 pminsw m0, m13 pminsw m1, m13 mova [dstq], m0 %if %2 mova [dstq+strideq], m1 lea srcq, [srcq+strideq*2] lea dstq, [dstq+strideq*2] lea lumaq, [lumaq+lstrideq*(2<<%3)] %else mova [dstq+32], m1 add srcq, strideq add dstq, strideq add lumaq, lstrideq %endif add grain_lutq, 82*(2<<%2) %if %2 sub hb, 2 %else dec hb %endif jg %%loop_y add wq, 32>>%2 jge .end mov srcq, r9mp mov dstq, r11mp mov lumaq, r12mp lea srcq, [srcq+wq*2] lea dstq, [dstq+wq*2] lea lumaq, [lumaq+wq*(2<<%2)] cmp byte [fg_dataq+FGData.overlap_flag], 0 je %%loop_x cmp dword r8m, 0 ; sby jne %%loop_x_hv_overlap ; horizontal overlap (without vertical overlap) %%loop_x_h_overlap: rorx r6, seeq, 1 or seed, 0xEFF4 test seeb, seeh lea seed, [r6+0x8000] cmovp seed, r6d ; updated seed DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ offx, offy, see, left_offxy, unused1, unused2, luma, lstride lea left_offxyd, [offyq+(32>>%2)] ; previous column's offy*stride+offx rorx offyd, seed, 8 rorx offxq, seeq, 12 and offyd, 0xf imul offyd, 164>>%3 lea offyd, [offyq+offxq*(2-%2)+(3+(6>>%3))*82+3+(6>>%2)] ; offy*stride+offx DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ h, offxy, see, left_offxy, unused1, unused2, luma, lstride mov grain_lutq, grain_lutmp mov hd, hm %%loop_y_h_overlap: ; luma_src %if %2 mova xm2, [lumaq+lstrideq*0+ 0] vinserti128 m2, [lumaq+lstrideq*0+32], 1 mova xm4, [lumaq+lstrideq*0+16] vinserti128 m4, [lumaq+lstrideq*0+48], 1 mova xm3, [lumaq+lstrideq*(1<<%3)+ 0] vinserti128 m3, [lumaq+lstrideq*(1<<%3)+32], 1 mova xm5, [lumaq+lstrideq*(1<<%3)+16] vinserti128 m5, [lumaq+lstrideq*(1<<%3)+48], 1 phaddw m2, m4 phaddw m3, m5 pxor m4, m4 pavgw m2, m4 pavgw m3, m4 %elif %1 mova m2, [lumaq] mova m3, [lumaq+32] %endif %if %1 mova m0, [srcq] %if %2 mova m1, [srcq+strideq] %else mova m1, [srcq+32] %endif punpckhwd m4, m2, m0 punpcklwd m2, m0 punpckhwd m5, m3, m1 punpcklwd m3, m1 ; { luma, chroma } REPX {pmaddwd x, m14}, m4, m2, m5, m3 REPX {paddd x, m15}, m4, m2, m5, m3 REPX {psrad x, 6 }, m4, m2, m5, m3 packusdw m2, m4 packusdw m3, m5 pminuw m2, m10 ; clip_pixel() pminuw m3, m10 %elif %2 pand m2, m10 pand m3, m10 %else pand m2, m10, [lumaq+ 0] pand m3, m10, [lumaq+32] %endif ; scaling[luma_src] vpbroadcastd m7, [pd_m65536] pandn m4, m7, m2 mova m6, m7 vpgatherdd m5, [scalingq+m4-0], m7 psrld m2, 16 mova m7, m6 vpgatherdd m4, [scalingq+m2-2], m6 pblendw m4, m5, 0x55 pandn m5, m7, m3 mova m6, m7 vpgatherdd m2, [scalingq+m5-0], m7 psrld m3, 16 vpgatherdd m5, [scalingq+m3-2], m6 pblendw m5, m2, 0x55 ; grain = grain_lut[offy+y][offx+x] movu m2, [grain_lutq+offxyq*2] %if %2 movu m3, [grain_lutq+offxyq*2+82*2] %else movu m3, [grain_lutq+offxyq*2+32] %endif movd xm6, [grain_lutq+left_offxyq*2] %if %2 pinsrw xm6, [grain_lutq+left_offxyq*2+82*2], 2 ; {left0, left1} punpckldq xm7, xm2, xm3 ; {cur0, cur1} punpcklwd xm6, xm7 ; {left0, cur0, left1, cur1} %else punpcklwd xm6, xm2 %endif %if %1 %if %2 vpbroadcastq xm7, [pw_23_22] %else movq xm7, [pw_27_17_17_27] %endif pmaddwd xm6, xm7 vpbroadcastd xm7, [pd_16] paddd xm6, xm7 %else pmaddwd xm6, xm15 paddd xm6, xm14 %endif psrad xm6, 5 packssdw xm6, xm6 pmaxsw xm6, xm8 pminsw xm6, xm9 vpblendd m2, m6, 0x01 %if %2 pshuflw xm6, xm6, q1032 vpblendd m3, m6, 0x01 %endif ; noise = round2(scaling[luma_src] * grain, scaling_shift) pmaddubsw m4, m11 pmaddubsw m5, m11 paddw m4, m4 paddw m5, m5 pmulhrsw m2, m4 pmulhrsw m3, m5 ; dst = clip_pixel(src, noise) %if %1 paddw m0, m2 paddw m1, m3 %else paddw m0, m2, [srcq] %if %2 paddw m1, m3, [srcq+strideq] %else paddw m1, m3, [srcq+32] %endif %endif pmaxsw m0, m12 pmaxsw m1, m12 pminsw m0, m13 pminsw m1, m13 mova [dstq], m0 %if %2 mova [dstq+strideq], m1 lea srcq, [srcq+strideq*2] lea dstq, [dstq+strideq*2] lea lumaq, [lumaq+lstrideq*(2<<%3)] %else mova [dstq+32], m1 add srcq, strideq add dstq, strideq add lumaq, r10mp %endif add grain_lutq, 82*(2<<%2) %if %2 sub hb, 2 %else dec hb %endif jg %%loop_y_h_overlap add wq, 32>>%2 jge .end mov srcq, r9mp mov dstq, r11mp mov lumaq, r12mp lea srcq, [srcq+wq*2] lea dstq, [dstq+wq*2] lea lumaq, [lumaq+wq*(2<<%2)] cmp dword r8m, 0 ; sby jne %%loop_x_hv_overlap jmp %%loop_x_h_overlap %%vertical_overlap: DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, unused, \ sby, see, unused1, unused2, unused3, lstride movzx sbyd, sbyb imul seed, [fg_dataq+FGData.seed], 0x00010001 imul r7d, sbyd, 173 * 0x00010001 imul sbyd, 37 * 0x01000100 add r7d, (105 << 16) | 188 add sbyd, (178 << 24) | (141 << 8) and r7d, 0x00ff00ff and sbyd, 0xff00ff00 xor seed, r7d xor seed, sbyd ; (cur_seed << 16) | top_seed DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ offx, offy, see, unused1, top_offxy, unused2, luma, lstride mov lumaq, r9mp mov lstrideq, r10mp lea r10, [srcq+wq*2] lea r11, [dstq+wq*2] lea r12, [lumaq+wq*(2<<%2)] mov r9mp, r10 mov r11mp, r11 mov r12mp, r12 neg wq %%loop_x_v_overlap: ; we assume from the block above that bits 8-15 of r7d are zero'ed mov r6d, seed or seed, 0xeff4eff4 test seeb, seeh setp r7b ; parity of top_seed shr seed, 16 shl r7d, 16 test seeb, seeh setp r7b ; parity of cur_seed or r6d, 0x00010001 xor r7d, r6d rorx seed, r7d, 1 ; updated (cur_seed << 16) | top_seed rorx offyd, seed, 8 rorx offxd, seed, 12 and offyd, 0xf000f and offxd, 0xf000f imul offyd, 164>>%3 ; offxy=offy*stride+offx, (cur_offxy << 16) | top_offxy lea offyd, [offyq+offxq*(2-%2)+0x10001*((3+(6>>%3))*82+3+(6>>%2))+(32>>%3)*82] DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ h, offxy, see, unused1, top_offxy, unused2, luma, lstride mov grain_lutq, grain_lutmp mov hd, hm movzx top_offxyd, offxyw shr offxyd, 16 %if %2 == 0 lea r10, [pw_27_17_17_27] %endif %%loop_y_v_overlap: ; luma_src %if %2 mova xm2, [lumaq+lstrideq*0+ 0] vinserti128 m2, [lumaq+lstrideq*0+32], 1 mova xm4, [lumaq+lstrideq*0+16] vinserti128 m4, [lumaq+lstrideq*0+48], 1 mova xm3, [lumaq+lstrideq*(1<<%3)+ 0] vinserti128 m3, [lumaq+lstrideq*(1<<%3)+32], 1 mova xm5, [lumaq+lstrideq*(1<<%3)+16] vinserti128 m5, [lumaq+lstrideq*(1<<%3)+48], 1 phaddw m2, m4 phaddw m3, m5 pxor m4, m4 pavgw m2, m4 pavgw m3, m4 %elif %1 mova m2, [lumaq] mova m3, [lumaq+32] %endif %if %1 mova m0, [srcq] %if %2 mova m1, [srcq+strideq] %else mova m1, [srcq+32] %endif punpckhwd m4, m2, m0 punpcklwd m2, m0 punpckhwd m5, m3, m1 punpcklwd m3, m1 ; { luma, chroma } REPX {pmaddwd x, m14}, m4, m2, m5, m3 REPX {paddd x, m15}, m4, m2, m5, m3 REPX {psrad x, 6 }, m4, m2, m5, m3 packusdw m2, m4 packusdw m3, m5 pminuw m2, m10 ; clip_pixel() pminuw m3, m10 %elif %2 pand m2, m10 pand m3, m10 %else pand m2, m10, [lumaq+ 0] pand m3, m10, [lumaq+32] %endif ; scaling[luma_src] vpbroadcastd m7, [pd_m65536] pandn m4, m7, m2 mova m6, m7 vpgatherdd m5, [scalingq+m4-0], m7 psrld m2, 16 mova m7, m6 vpgatherdd m4, [scalingq+m2-2], m6 pblendw m4, m5, 0x55 pandn m5, m7, m3 mova m6, m7 vpgatherdd m2, [scalingq+m5-0], m7 psrld m3, 16 vpgatherdd m5, [scalingq+m3-2], m6 pblendw m5, m2, 0x55 ; grain = grain_lut[offy+y][offx+x] movu m6, [grain_lutq+offxyq*2] movu m3, [grain_lutq+top_offxyq*2] punpcklwd m2, m3, m6 punpckhwd m3, m6 ; { top, cur } %if %3 vpbroadcastd m0, [pw_23_22] %elif %2 vpbroadcastd m0, [pw_27_17_17_27] %else vpbroadcastd m0, [r10] %endif REPX {pmaddwd x, m0}, m2, m3 %if %1 vpbroadcastd m1, [pd_16] REPX {paddd x, m1}, m2, m3 %else REPX {paddd x, m14}, m2, m3 %endif REPX {psrad x, 5}, m2, m3 packssdw m2, m3 %if %2 movu m3, [grain_lutq+offxyq*2+82*2] %else movu m3, [grain_lutq+offxyq*2+32] %endif %if %3 pmaxsw m2, m8 pminsw m2, m9 %else %if %2 movu m7, [grain_lutq+top_offxyq*2+82*2] punpckhwd m6, m3, m7 ; { cur, top } punpcklwd m3, m7 %else movu m7, [grain_lutq+top_offxyq*2+32] punpckhwd m6, m7, m3 punpcklwd m3, m7, m3 ; { top, cur } %endif pmaddwd m6, m0 pmaddwd m3, m0 %if %1 paddd m6, m1 paddd m3, m1 %else paddd m6, m14 paddd m3, m14 %endif psrad m6, 5 psrad m3, 5 packssdw m3, m6 pmaxsw m2, m8 pmaxsw m3, m8 pminsw m2, m9 pminsw m3, m9 %endif ; noise = round2(scaling[luma_src] * grain, scaling_shift) pmaddubsw m4, m11 pmaddubsw m5, m11 paddw m4, m4 paddw m5, m5 pmulhrsw m2, m4 pmulhrsw m3, m5 ; dst = clip_pixel(src, noise) paddw m0, m2, [srcq] %if %2 paddw m1, m3, [srcq+strideq] %else paddw m1, m3, [srcq+32] %endif pmaxsw m0, m12 pmaxsw m1, m12 pminsw m0, m13 pminsw m1, m13 mova [dstq], m0 %if %2 mova [dstq+strideq], m1 sub hb, 2 %else mova [dstq+32], m1 dec hb %endif jle %%end_y_v_overlap %if %2 lea srcq, [srcq+strideq*2] lea dstq, [dstq+strideq*2] lea lumaq, [lumaq+lstrideq*(2<<%3)] %else add srcq, strideq add dstq, strideq add lumaq, lstrideq %endif add grain_lutq, 82*(2<<%2) %if %2 jmp %%loop_y %else add hd, 0x80000000 jc %%loop_y add r10, 4 jmp %%loop_y_v_overlap %endif %%end_y_v_overlap: add wq, 32>>%2 jge .end mov srcq, r9mp mov dstq, r11mp mov lumaq, r12mp lea srcq, [srcq+wq*2] lea dstq, [dstq+wq*2] lea lumaq, [lumaq+wq*(2<<%2)] ; since fg_dataq.overlap is guaranteed to be set, we never jump ; back to .loop_x_v_overlap, and instead always fall-through to ; h+v overlap %%loop_x_hv_overlap: ; we assume from the block above that bits 8-15 of r7d are zero'ed mov r6d, seed or seed, 0xeff4eff4 test seeb, seeh setp r7b ; parity of top_seed shr seed, 16 shl r7d, 16 test seeb, seeh setp r7b ; parity of cur_seed or r6d, 0x00010001 xor r7d, r6d rorx seed, r7d, 1 ; updated (cur_seed << 16) | top_seed DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ offx, offy, see, left_offxy, top_offxy, topleft_offxy, luma, lstride %if %2 == 0 lea r14, [pw_27_17_17_27] %endif lea topleft_offxyq, [top_offxyq+(32>>%2)] lea left_offxyq, [offyq+(32>>%2)] rorx offyd, seed, 8 rorx offxd, seed, 12 and offyd, 0xf000f and offxd, 0xf000f imul offyd, 164>>%3 ; offxy=offy*stride+offx, (cur_offxy << 16) | top_offxy lea offyd, [offyq+offxq*(2-%2)+0x10001*((3+(6>>%3))*82+3+(6>>%2))+(32>>%3)*82] DEFINE_ARGS dst, src, stride, fg_data, w, scaling, grain_lut, \ h, offxy, see, left_offxy, top_offxy, topleft_offxy, luma, lstride mov grain_lutq, grain_lutmp mov hd, hm movzx top_offxyd, offxyw shr offxyd, 16 %%loop_y_hv_overlap: ; luma_src %if %2 mova xm2, [lumaq+lstrideq*0+ 0] vinserti128 m2, [lumaq+lstrideq*0+32], 1 mova xm4, [lumaq+lstrideq*0+16] vinserti128 m4, [lumaq+lstrideq*0+48], 1 mova xm3, [lumaq+lstrideq*(1<<%3)+ 0] vinserti128 m3, [lumaq+lstrideq*(1<<%3)+32], 1 mova xm5, [lumaq+lstrideq*(1<<%3)+16] vinserti128 m5, [lumaq+lstrideq*(1<<%3)+48], 1 phaddw m2, m4 phaddw m3, m5 pxor m4, m4 pavgw m2, m4 pavgw m3, m4 %elif %1 mova m2, [lumaq] mova m3, [lumaq+32] %endif %if %1 mova m0, [srcq] %if %2 mova m1, [srcq+strideq] %else mova m1, [srcq+32] %endif punpckhwd m4, m2, m0 punpcklwd m2, m0 punpckhwd m5, m3, m1 punpcklwd m3, m1 ; { luma, chroma } REPX {pmaddwd x, m14}, m4, m2, m5, m3 REPX {paddd x, m15}, m4, m2, m5, m3 REPX {psrad x, 6 }, m4, m2, m5, m3 packusdw m2, m4 packusdw m3, m5 pminuw m2, m10 ; clip_pixel() pminuw m3, m10 %elif %2 pand m2, m10 pand m3, m10 %else pand m2, m10, [lumaq+ 0] pand m3, m10, [lumaq+32] %endif ; scaling[luma_src] vpbroadcastd m7, [pd_m65536] pandn m4, m7, m2 mova m6, m7 vpgatherdd m5, [scalingq+m4-0], m7 psrld m2, 16 mova m7, m6 vpgatherdd m4, [scalingq+m2-2], m6 pblendw m4, m5, 0x55 pandn m5, m7, m3 mova m6, m7 vpgatherdd m2, [scalingq+m5-0], m7 psrld m3, 16 vpgatherdd m5, [scalingq+m3-2], m6 pblendw m5, m2, 0x55 ; grain = grain_lut[offy+y][offx+x] movu m0, [grain_lutq+offxyq*2] movd xm2, [grain_lutq+left_offxyq*2] movu m6, [grain_lutq+top_offxyq*2] %if %2 pinsrw xm2, [grain_lutq+left_offxyq*2+82*2], 2 movu m3, [grain_lutq+offxyq*2+82*2] punpckldq xm1, xm0, xm3 ; { cur0, cur1 } %if %3 vinserti128 m2, [grain_lutq+topleft_offxyq*2], 1 ; { left0, left1, top/left } vinserti128 m1, [grain_lutq+top_offxyq*2], 1 ; { cur0, cur1, top0 } %else vinserti128 m2, [grain_lutq+topleft_offxyq*2+82*2], 1 vpbroadcastd m7, [grain_lutq+topleft_offxyq*2] vpblendd m2, m7, 0x20 movd xm7, [grain_lutq+top_offxyq*2+82*2] punpckldq xm7, xm6 vinserti128 m1, xm7, 1 movu m7, [grain_lutq+top_offxyq*2+82*2] %endif punpcklwd m2, m1 ; { cur, left } %if %1 vpbroadcastq m1, [pw_23_22] pmaddwd m2, m1 vpbroadcastd m1, [pd_16] paddd m2, m1 psrad m2, 5 packssdw m2, m2 vpermq m2, m2, q3120 %else pmaddwd m2, m15 paddd m2, m14 psrad m2, 5 vextracti128 xm1, m2, 1 packssdw xm2, xm1 %endif %else pinsrd xm2, [grain_lutq+topleft_offxyq*2], 1 movu m3, [grain_lutq+offxyq*2+32] movu m7, [grain_lutq+top_offxyq*2+32] punpckldq xm1, xm0, xm6 punpcklwd xm2, xm1 ; { cur, left } %if %1 movddup xm1, [pw_27_17_17_27] pmaddwd xm2, xm1 vpbroadcastd m1, [pd_16] paddd xm2, xm1 %else pmaddwd xm2, xm15 paddd xm2, xm14 %endif psrad xm2, 5 packssdw xm2, xm2 %endif pmaxsw xm2, xm8 pminsw xm2, xm9 vpblendd m0, m2, 0x01 %if %2 pshufd xm2, xm2, q0321 vpblendd m3, m2, 0x01 %if %3 == 0 pshufd xm2, xm2, q0321 vpblendd m7, m2, 0x01 %endif %endif pshuflw xm2, xm2, q1032 vpblendd m2, m6, 0xfe punpckhwd m6, m0 ; { top, cur } punpcklwd m2, m0 %if %3 vpbroadcastd m0, [pw_23_22] %elif %2 vpbroadcastd m0, [pw_27_17_17_27] %else vpbroadcastd m0, [r14] %endif pmaddwd m6, m0 pmaddwd m2, m0 %if %1 paddd m6, m1 paddd m2, m1 %else paddd m6, m14 paddd m2, m14 %endif psrad m6, 5 psrad m2, 5 packssdw m2, m6 %if %3 pmaxsw m2, m8 pminsw m2, m9 %else %if %2 punpckhwd m6, m3, m7 punpcklwd m3, m7 ; { cur, top } %else punpckhwd m6, m7, m3 punpcklwd m3, m7, m3 ; { top, cur } %endif REPX {pmaddwd x, m0}, m6, m3 %if %1 REPX {paddd x, m1}, m6, m3 %else REPX {paddd x, m14}, m6, m3 %endif REPX {psrad x, 5}, m6, m3 packssdw m3, m6 pmaxsw m2, m8 pmaxsw m3, m8 pminsw m2, m9 pminsw m3, m9 %endif ; noise = round2(scaling[luma_src] * grain, scaling_shift) pmaddubsw m4, m11 pmaddubsw m5, m11 paddw m4, m4 paddw m5, m5 pmulhrsw m2, m4 pmulhrsw m3, m5 ; dst = clip_pixel(src, noise) paddw m0, m2, [srcq] %if %2 paddw m1, m3, [srcq+strideq] %else paddw m1, m3, [srcq+32] %endif pmaxsw m0, m12 pmaxsw m1, m12 pminsw m0, m13 pminsw m1, m13 mova [dstq], m0 %if %2 mova [dstq+strideq], m1 lea srcq, [srcq+strideq*2] lea dstq, [dstq+strideq*2] lea lumaq, [lumaq+lstrideq*(2<<%3)] %else mova [dstq+32], m1 add srcq, strideq add dstq, strideq add lumaq, r10mp %endif add grain_lutq, 82*(2<<%2) %if %2 sub hb, 2 jg %%loop_y_h_overlap %else dec hb jle %%end_y_hv_overlap add hd, 0x80000000 jc %%loop_y_h_overlap add r14, 4 jmp %%loop_y_hv_overlap %endif %%end_y_hv_overlap: add wq, 32>>%2 jge .end mov srcq, r9mp mov dstq, r11mp mov lumaq, r12mp lea srcq, [srcq+wq*2] lea dstq, [dstq+wq*2] lea lumaq, [lumaq+wq*(2<<%2)] jmp %%loop_x_hv_overlap %endmacro %%FGUV_32x32xN_LOOP 1, %2, %3 .csfl: %%FGUV_32x32xN_LOOP 0, %2, %3 .end: RET %endmacro GEN_GRAIN_UV_FN 420, 1, 1 FGUV_FN 420, 1, 1 GEN_GRAIN_UV_FN 422, 1, 0 FGUV_FN 422, 1, 0 GEN_GRAIN_UV_FN 444, 0, 0 FGUV_FN 444, 0, 0 %endif ; ARCH_X86_64
Data/Sum.agda
oisdk/agda-playground
6
12937
{-# OPTIONS --without-K --safe #-} module Data.Sum where open import Level open import Data.Bool.Base using (Bool; true; false) open import Function using (const) data _⊎_ (A : Type a) (B : Type b) : Type (a ℓ⊔ b) where inl : A → A ⊎ B inr : B → A ⊎ B either : ∀ {ℓ} {C : A ⊎ B → Type ℓ} → ((a : A) → C (inl a)) → ((b : B) → C (inr b)) → (x : A ⊎ B) → C x either f _ (inl x) = f x either _ g (inr y) = g y ⟦l_,r_⟧ = either either′ : (A → C) → (B → C) → (A ⊎ B) → C either′ = either _▿_ : (A → C) → (B → C) → A ⊎ B → C _▿_ = either is-l : A ⊎ B → Bool is-l = either′ (const true) (const false) map-⊎ : ∀ {a₁ a₂ b₁ b₂} {A₁ : Type a₁} {A₂ : Type a₂} {B₁ : Type b₁} {B₂ : Type b₂} → (A₁ → A₂) → (B₁ → B₂) → (A₁ ⊎ B₁) → (A₂ ⊎ B₂) map-⊎ f g (inl x) = inl (f x) map-⊎ f g (inr x) = inr (g x) mapˡ : (A → B) → A ⊎ C → B ⊎ C mapˡ f (inl x) = inl (f x) mapˡ f (inr x) = inr x mapʳ : (A → B) → C ⊎ A → C ⊎ B mapʳ f (inl x) = inl x mapʳ f (inr x) = inr (f x)
scripts/Route24.asm
opiter09/ASM-Machina
1
17915
Route24_Script: call EnableAutoTextBoxDrawing ld hl, Route24TrainerHeaders ld de, Route24_ScriptPointers ld a, [wRoute24CurScript] call ExecuteCurMapScriptInTable ld [wRoute24CurScript], a ret Route24Script_513c0: xor a ld [wJoyIgnore], a ld [wRoute24CurScript], a ld [wCurMapScript], a ret Route24_ScriptPointers: dw Route24Script0 dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle dw Route24Script3 dw Route24Script4 Route24Script0: CheckEvent EVENT_GOT_NUGGET jp nz, CheckFightingMapTrainers ld hl, CoordsData_5140e call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers xor a ldh [hJoyHeld], a ld a, $1 ldh [hSpriteIndexOrTextID], a call DisplayTextID CheckAndResetEvent EVENT_NUGGET_REWARD_AVAILABLE ret z ld a, D_DOWN ld [wSimulatedJoypadStatesEnd], a ld a, $1 ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $4 ld [wRoute24CurScript], a ld [wCurMapScript], a ret CoordsData_5140e: dbmapcoord 10, 15 db -1 ; end Route24Script4: ld a, [wSimulatedJoypadStatesIndex] and a ret nz call Delay3 ld a, $0 ld [wRoute24CurScript], a ld [wCurMapScript], a ret Route24Script3: ld a, [wIsInBattle] cp $ff jp z, Route24Script_513c0 call UpdateSprites ld a, $f0 ld [wJoyIgnore], a SetEvent EVENT_BEAT_ROUTE24_ROCKET ld a, $1 ldh [hSpriteIndexOrTextID], a call DisplayTextID xor a ld [wJoyIgnore], a ld a, $0 ld [wRoute24CurScript], a ld [wCurMapScript], a ret Route24_TextPointers: dw Route24Text1 dw Route24Text2 dw Route24Text3 dw Route24Text4 dw Route24Text5 dw Route24Text6 dw Route24Text7 dw PickUpItemText Route24TrainerHeaders: def_trainers 2 Route24TrainerHeader0: trainer EVENT_BEAT_ROUTE_24_TRAINER_0, 4, Route24BattleText1, Route24EndBattleText1, Route24AfterBattleText1 Route24TrainerHeader1: trainer EVENT_BEAT_ROUTE_24_TRAINER_1, 1, Route24BattleText2, Route24EndBattleText2, Route24AfterBattleText2 Route24TrainerHeader2: trainer EVENT_BEAT_ROUTE_24_TRAINER_2, 1, Route24BattleText3, Route24EndBattleText3, Route24AfterBattleText3 Route24TrainerHeader3: trainer EVENT_BEAT_ROUTE_24_TRAINER_3, 1, Route24BattleText4, Route24EndBattleText4, Route24AfterBattleText4 Route24TrainerHeader4: trainer EVENT_BEAT_ROUTE_24_TRAINER_4, 1, Route24BattleText5, Route24EndBattleText5, Route24AfterBattleText5 Route24TrainerHeader5: trainer EVENT_BEAT_ROUTE_24_TRAINER_5, 1, Route24BattleText6, Route24EndBattleText6, Route24AfterBattleText6 db -1 ; end Route24Text1: text_asm ResetEvent EVENT_NUGGET_REWARD_AVAILABLE CheckEvent EVENT_GOT_NUGGET jr nz, .got_item ld hl, Route24Text_51510 call PrintText lb bc, NUGGET, 1 call GiveItem jr nc, .bag_full SetEvent EVENT_GOT_NUGGET ld hl, Route24Text_5151a call PrintText ld hl, Route24Text_51526 call PrintText ld hl, wd72d set 6, [hl] set 7, [hl] ld hl, Route24Text_5152b ld de, Route24Text_5152b call SaveEndBattleTextPointers ldh a, [hSpriteIndexOrTextID] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters xor a ldh [hJoyHeld], a ld a, $3 ld [wRoute24CurScript], a ld [wCurMapScript], a jp TextScriptEnd .got_item ld hl, Route24Text_51530 call PrintText jp TextScriptEnd .bag_full ld hl, Route24Text_51521 call PrintText SetEvent EVENT_NUGGET_REWARD_AVAILABLE jp TextScriptEnd Route24Text_51510: text_far _Route24Text_51510 sound_get_item_1 text_far _Route24Text_51515 text_end Route24Text_5151a: text_far _Route24Text_5151a sound_get_item_1 text_promptbutton text_end Route24Text_51521: text_far _Route24Text_51521 text_end Route24Text_51526: text_far _Route24Text_51526 text_end Route24Text_5152b: text_far _Route24Text_5152b text_end Route24Text_51530: text_far _Route24Text_51530 text_end Route24Text2: text_asm ld hl, Route24TrainerHeader0 call TalkToTrainer jp TextScriptEnd Route24Text3: text_asm ld hl, Route24TrainerHeader1 call TalkToTrainer jp TextScriptEnd Route24Text4: text_asm ld hl, Route24TrainerHeader2 call TalkToTrainer jp TextScriptEnd Route24Text5: text_asm ld hl, Route24TrainerHeader3 call TalkToTrainer jp TextScriptEnd Route24Text6: text_asm ld hl, Route24TrainerHeader4 call TalkToTrainer jp TextScriptEnd Route24Text7: text_asm ld hl, Route24TrainerHeader5 call TalkToTrainer jp TextScriptEnd Route24BattleText1: text_far _Route24BattleText1 text_end Route24EndBattleText1: text_far _Route24EndBattleText1 text_end Route24AfterBattleText1: text_far _Route24AfterBattleText1 text_end Route24BattleText2: text_far _Route24BattleText2 text_end Route24EndBattleText2: text_far _Route24EndBattleText2 text_end Route24AfterBattleText2: text_far _Route24AfterBattleText2 text_end Route24BattleText3: text_far _Route24BattleText3 text_end Route24EndBattleText3: text_far _Route24EndBattleText3 text_end Route24AfterBattleText3: text_far _Route24AfterBattleText3 text_end Route24BattleText4: text_far _Route24BattleText4 text_end Route24EndBattleText4: text_far _Route24EndBattleText4 text_end Route24AfterBattleText4: text_far _Route24AfterBattleText4 text_end Route24BattleText5: text_far _Route24BattleText5 text_end Route24EndBattleText5: text_far _Route24EndBattleText5 text_end Route24AfterBattleText5: text_far _Route24AfterBattleText5 text_end Route24BattleText6: text_far _Route24BattleText6 text_end Route24EndBattleText6: text_far _Route24EndBattleText6 text_end Route24AfterBattleText6: text_far _Route24AfterBattleText6 text_end
programs/oeis/091/A091711.asm
karttu/loda
0
92452
; A091711: Exponent of 2 in (n^2)!. ; 0,3,7,15,22,34,46,63,78,97,116,142,165,193,221,255,286,321,356,397,435,479,526,574,620,672,723,781,836,896,956,1023,1086,1153,1220,1293,1363,1439,1514,1597,1676,1758,1842,1931,2017,2113,2205,2302,2396,2495,2596,2700,2801,2910,3018,3133,3243,3359,3474,3596,3715,3839,3963,4095,4222,4353,4484,4621,4755,4895,5034,5181,5323,5470,5616,5771,5922,6077,6236,6397,6555,6719,6881,7050,7218,7389,7562,7739,7912,8092,8276,8461,8643,8832,9020,9214,9404,9599,9795,9995,10192,10399,10602,10812,11019,11228,11441,11658,11873,12093,12317,12541,12762,12990,13217,13451,13680,13917,14153,14396,14634,14878,15121,15371,15618,15870,16122,16383,16638,16897,17156,17421,17683,17951,18218,18493,18763,19038,19312,19595,19873,20157,20440,20733,21020,21310,21602,21898,22192,22491,22795,23099,23400,23709,24015,24329,24644,24959,25275,25597,25915,26238,26560,26891,27217,27548,27880,28218,28552,28893,29233,29577,29920,30269,30616,30971,31321,31675,32032,32392,32748,33119,33483,33853,34218,34590,34963,35340,35714,36095,36475,36862,37244,37631,38019,38411,38800,39198,39593,39995 add $0,1 pow $0,2 lpb $0,1 div $0,2 add $1,$0 lpe
src/firmware-tests/Platform/Lcd/PollAfterLcdDummy.asm
pete-restall/Cluck2Sesame-Prototype
1
177832
#include "Platform.inc" #include "PollChain.inc" radix decimal PollAfterLcdDummy code global POLL_AFTER_LCD POLL_AFTER_LCD: return end
libsrc/_DEVELOPMENT/adt/w_vector/c/sccz80/w_vector_at.asm
teknoplop/z88dk
8
20366
; void *w_vector_at(b_vector_t *v, size_t idx) SECTION code_clib SECTION code_adt_w_vector PUBLIC w_vector_at EXTERN w_array_at defc w_vector_at = w_array_at
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0.log_21829_876.asm
ljhsiun2/medusa
9
179701
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %r9 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0x13290, %rsi nop nop xor %r13, %r13 mov (%rsi), %r9 nop nop nop sub %r14, %r14 lea addresses_A_ht+0x1e56b, %r15 nop add $18695, %rax movb $0x61, (%r15) cmp %r13, %r13 lea addresses_D_ht+0x18850, %rsi lea addresses_normal_ht+0x16e50, %rdi sub $24824, %r14 mov $68, %rcx rep movsl nop nop nop nop nop and %rcx, %rcx lea addresses_A_ht+0xbd68, %rax nop nop nop nop nop cmp %r14, %r14 mov $0x6162636465666768, %rsi movq %rsi, %xmm0 movups %xmm0, (%rax) nop cmp %rcx, %rcx lea addresses_UC_ht+0x1ef50, %rsi lea addresses_A_ht+0x1d10, %rdi nop nop nop xor %r14, %r14 mov $102, %rcx rep movsl nop nop sub %rcx, %rcx lea addresses_UC_ht+0xdf50, %rax nop nop add %rcx, %rcx mov (%rax), %rsi sub %r15, %r15 lea addresses_WT_ht+0x1a7d0, %rsi lea addresses_WT_ht+0x50, %rdi clflush (%rdi) nop nop nop nop nop xor $14311, %rax mov $70, %rcx rep movsb cmp %r14, %r14 lea addresses_UC_ht+0x1e9d8, %rsi lea addresses_D_ht+0xc750, %rdi dec %r15 mov $65, %rcx rep movsq sub %rsi, %rsi lea addresses_normal_ht+0xdf60, %r9 nop nop nop nop cmp %rax, %rax movl $0x61626364, (%r9) nop nop nop nop cmp $53465, %r14 lea addresses_WT_ht+0x6850, %rsi lea addresses_WT_ht+0xcc50, %rdi nop nop nop nop sub $11936, %rbp mov $7, %rcx rep movsw nop nop nop xor $54869, %r13 lea addresses_WC_ht+0x13590, %rdi nop nop nop nop nop and %r15, %r15 movl $0x61626364, (%rdi) nop nop nop dec %rbp lea addresses_WT_ht+0x14050, %rsi xor $10792, %rdi and $0xffffffffffffffc0, %rsi vmovntdqa (%rsi), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %rax nop nop sub %rax, %rax lea addresses_normal_ht+0x1ae50, %rcx nop nop nop add %r14, %r14 movl $0x61626364, (%rcx) nop nop nop nop nop xor $18552, %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r9 push %rax push %rbp push %rbx push %rdx // Load lea addresses_normal+0x18050, %r14 clflush (%r14) nop nop nop xor $60894, %rdx mov (%r14), %eax nop nop nop nop inc %rbx // Store lea addresses_UC+0x8da0, %rbp and %rdx, %rdx mov $0x5152535455565758, %r9 movq %r9, (%rbp) nop nop nop nop and %rbp, %rbp // Faulty Load lea addresses_PSE+0x1e850, %rdx nop add $22766, %r10 movb (%rdx), %al lea oracles, %rbp and $0xff, %rax shlq $12, %rax mov (%rbp,%rax,1), %rax pop %rdx pop %rbx pop %rbp pop %rax pop %r9 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 4, 'type': 'addresses_UC', 'AVXalign': False, 'size': 8}} [Faulty Load] {'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}} {'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}} {'src': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}} {'src': {'NT': True, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WT_ht'}} {'src': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}} {'src': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}} {'src': {'NT': True, 'same': False, 'congruent': 9, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
src/Web/Semantic/DL/Category/Properties/Tensor/RespectsWiring.agda
agda/agda-web-semantic
9
1965
<reponame>agda/agda-web-semantic open import Data.Product using ( proj₁ ; proj₂ ) open import Data.Sum using ( inj₁ ; inj₂ ) open import Relation.Binary.PropositionalEquality using ( _≡_ ; refl ; sym ; cong ) open import Relation.Unary using ( _⊆_ ) open import Web.Semantic.DL.ABox using ( ABox ; ⟨ABox⟩ ; Assertions ) open import Web.Semantic.DL.ABox.Interp using ( ⌊_⌋ ; ind ) open import Web.Semantic.DL.ABox.Model using ( _⊨a_ ; bnodes ; _,_ ) open import Web.Semantic.DL.Category.Object using ( Object ; IN ; fin ; iface ) open import Web.Semantic.DL.Category.Morphism using ( impl ; _≣_ ; _⊑_ ; _,_ ) open import Web.Semantic.DL.Category.Tensor using ( _⊗_ ; _⟨⊗⟩_ ) open import Web.Semantic.DL.Category.Properties.Tensor.Lemmas using ( tensor-up ; tensor-down ; tensor-resp-⊨a ) open import Web.Semantic.DL.Category.Wiring using ( wiring ; wires-≈ ; wires-≈⁻¹ ; identity ; id✓ ) open import Web.Semantic.DL.Signature using ( Signature ) open import Web.Semantic.DL.TBox using ( TBox ) open import Web.Semantic.DL.TBox.Interp using ( Δ ; _⊨_≈_ ; ≈-refl ; ≈-refl′ ; ≈-trans ) open import Web.Semantic.Util using ( id ; _∘_ ; False ; elim ; inj⁻¹ ; _⊕_⊕_ ; inode ; bnode ; enode ) module Web.Semantic.DL.Category.Properties.Tensor.RespectsWiring {Σ : Signature} {S T : TBox Σ} where tensor-resp-wiring : ∀ (A₁ A₂ B₁ B₂ : Object S T) → (f₁ : IN B₁ → IN A₁) → (f₁✓ : Assertions (⟨ABox⟩ f₁ (iface B₁)) ⊆ Assertions (iface A₁)) → (f₂ : IN B₂ → IN A₂) → (f₂✓ : Assertions (⟨ABox⟩ f₂ (iface B₂)) ⊆ Assertions (iface A₂)) → (g : IN (B₁ ⊗ B₂) → IN (A₁ ⊗ A₂)) → (g✓ : Assertions (⟨ABox⟩ g (iface (B₁ ⊗ B₂))) ⊆ Assertions (iface (A₁ ⊗ A₂))) → (∀ x → inj₁ (f₁ x) ≡ g (inj₁ x)) → (∀ x → inj₂ (f₂ x) ≡ g (inj₂ x)) → ((wiring A₁ B₁ f₁ f₁✓ ⟨⊗⟩ wiring A₂ B₂ f₂ f₂✓) ≣ (wiring (A₁ ⊗ A₂) (B₁ ⊗ B₂) g g✓)) tensor-resp-wiring A₁ A₂ B₁ B₂ f₁ f₁✓ f₂ f₂✓ g g✓ f₁≡g₁ f₂≡g₂ = (LHS⊑RHS , RHS⊑LHS) where LHS⊑RHS : wiring A₁ B₁ f₁ f₁✓ ⟨⊗⟩ wiring A₂ B₂ f₂ f₂✓ ⊑ wiring (A₁ ⊗ A₂) (B₁ ⊗ B₂) g g✓ LHS⊑RHS I I⊨STA I⊨F = (elim , I⊨RHS) where lemma : ∀ x → ⌊ I ⌋ ⊨ ind I (inode (g x)) ≈ ind I (enode x) lemma (inj₁ x) = ≈-trans ⌊ I ⌋ (≈-refl′ ⌊ I ⌋ (cong (ind I ∘ inode) (sym (f₁≡g₁ x)))) (wires-≈ f₁ (proj₂ (fin B₁) x) (tensor-up (wiring A₁ B₁ f₁ f₁✓) (wiring A₂ B₂ f₂ f₂✓) I I⊨F)) lemma (inj₂ x) = ≈-trans ⌊ I ⌋ (≈-refl′ ⌊ I ⌋ (cong (ind I ∘ inode) (sym (f₂≡g₂ x)))) (wires-≈ f₂ (proj₂ (fin B₂) x) (tensor-down (wiring A₁ B₁ f₁ f₁✓) (wiring A₂ B₂ f₂ f₂✓) I I⊨F)) I⊨RHS : bnodes I elim ⊨a impl (wiring (A₁ ⊗ A₂) (B₁ ⊗ B₂) g g✓) I⊨RHS = wires-≈⁻¹ g lemma (proj₁ (fin (B₁ ⊗ B₂))) RHS⊑LHS : wiring (A₁ ⊗ A₂) (B₁ ⊗ B₂) g g✓ ⊑ wiring A₁ B₁ f₁ f₁✓ ⟨⊗⟩ wiring A₂ B₂ f₂ f₂✓ RHS⊑LHS I I⊨STA I⊨F = (elim ∘ inj⁻¹ , I⊨LHS) where lemma₁ : ∀ x → ⌊ I ⌋ ⊨ ind I (inode (inj₁ (f₁ x))) ≈ ind I (enode (inj₁ x)) lemma₁ x = ≈-trans ⌊ I ⌋ (≈-refl′ ⌊ I ⌋ (cong (ind I ∘ inode) (f₁≡g₁ x))) (wires-≈ g (proj₂ (fin (B₁ ⊗ B₂)) (inj₁ x)) I⊨F) lemma₂ : ∀ x → ⌊ I ⌋ ⊨ ind I (inode (inj₂ (f₂ x))) ≈ ind I (enode (inj₂ x)) lemma₂ x = ≈-trans ⌊ I ⌋ (≈-refl′ ⌊ I ⌋ (cong (ind I ∘ inode) (f₂≡g₂ x))) (wires-≈ g (proj₂ (fin (B₁ ⊗ B₂)) (inj₂ x)) I⊨F) I⊨LHS : bnodes I (elim ∘ inj⁻¹) ⊨a impl (wiring A₁ B₁ f₁ f₁✓ ⟨⊗⟩ wiring A₂ B₂ f₂ f₂✓) I⊨LHS = tensor-resp-⊨a (wiring A₁ B₁ f₁ f₁✓) (wiring A₂ B₂ f₂ f₂✓) (bnodes I (elim ∘ inj⁻¹)) (wires-≈⁻¹ f₁ lemma₁ (proj₁ (fin B₁))) (wires-≈⁻¹ f₂ lemma₂ (proj₁ (fin B₂)))
programs/oeis/161/A161828.asm
neoneye/loda
22
23774
<gh_stars>10-100 ; A161828: Number of rhombuses in the Y-toothpick structure of A160120 after n rounds. ; 0,0,3,3,9,9,15,21,33,39 pow $0,2 div $0,2 mov $2,-2 bin $2,$0 div $2,2 lpb $2 trn $2,3 add $3,2 lpe mov $4,$3 cmp $4,0 add $3,$4 mov $0,$3 sub $0,1 mul $0,3
src/main.asm
ISSOtm/gb-open-world
8
16743
INCLUDE "defines.asm" SECTION "Main loop", ROM0 Main:: ;; Init engine ; Screen redrawing expects to run over already-loaded palettes; ; Thus, we need to init the dynamic palette array to "all free" ld hl, wBGPaletteIDs ld c, wBGPaletteIDs.end - wBGPaletteIDs - 1 xor a rst MemsetSmall ; Reserve palette #7 for UI (clear bit 1 so it doesn't get faded) ld [hl], $05 ; Temporary var init while I write the code ; Load map 0 xor a ld [wNextMap], a ; Set camera position to $0808 (128.5) ld a, $02 ld [wCameraYPos], a ld [wCameraYPos + 1], a ld [wCameraXPos], a ld [wCameraXPos + 1], a ld [wCameraTargetYPos], a ld [wCameraTargetYPos + 1], a ld [wCameraTargetXPos], a ld [wCameraTargetXPos + 1], a ; Begin the main loop by fading in ld a, STATE_LOADMAP ld [wCurState], a xor a ld [wOBJPaletteMask], a ; Pretend that we just finished fading to white inc a ; ld a, 1 ld [wFadeDelta], a ld a, $FF ld [wFadeAmount], a MainLoop: ;; Run state's init func, if any ld a, [wCurState] assert NB_STATES <= 128 add a, a jr c, .noStateInit assert LOW(StateInitPtrs) == 0 ld l, a ld h, HIGH(StateInitPtrs) ld a, BANK(StateInitPtrs) ldh [hCurROMBank], a ld [rROMB0], a call JumpToPtr ld hl, wCurState ld a, [hl] set 7, a ld [hl], a add a, a .noStateInit ;; Process state's "update" function ld l, a ld h, HIGH(StatePtrs) ld a, BANK(StatePtrs) ldh [hCurROMBank], a ld [rROMB0], a call JumpToPtr ;; Move camera towards focal point ld a, BANK(CameraMovtFuncs) ldh [hCurROMBank], a ld [rROMB0], a ld a, [wCameraMovtType] add a, a add a, LOW(CameraMovtFuncs) ld l, a adc a, HIGH(CameraMovtFuncs) sub l ld h, a ld a, [hli] ld h, [hl] ld l, a rst CallHL ; Do not call the camera movement function if movement is disabled ; This is important, because camera movement alters palette fading parameters, in order ; to load palettes dynamically. (Remember that the palette fader is also the committer!) ; Therefore, when doing palette operations across frames, you will want not to run this ld a, [wCameraMovtType] and a call nz, MoveCamera ;; Move scrolling to new camera position ld a, [wCameraYPos] ld l, a ld a, [wCameraYPos + 1] xor l and $0F xor l swap a ldh [hSCY], a ld a, [wCameraXPos] ld l, a ld a, [wCameraXPos + 1] xor l and $0F xor l swap a ldh [hSCX], a ;; Tick map timers ld hl, wMapTimers .tickMapTimers dec [hl] jr nz, :+ ld [hl], l : inc l jr nz, .tickMapTimers ;; Wait for next frame rst WaitVBlank jp MainLoop SECTION FRAGMENT "State pointers", ROMX StatePtrs: align 8 SECTION FRAGMENT "State init pointers", ROMX StateInitPtrs: align 8 NB_STATES = 0 MACRO register_state SECTION FRAGMENT "State pointers", ROMX dw \1StateUpdate SECTION FRAGMENT "State init pointers", ROMX dw \1StateInit DEF UPPERCASE_NAME equs STRUPR("\1") DEF STATE_{UPPERCASE_NAME} equ NB_STATES REDEF NB_STATES = NB_STATES + 1 PURGE UPPERCASE_NAME SECTION "\1 state", ROM0 ENDM ; State definitions are at the end of this file SECTION "Map timers", WRAM0,ALIGN[8] wMapTimers: ds 256 SECTION "Main loop state variables", WRAM0 ; FIII IIII ; F = If reset, this is the first frame the state is running ; I = ID of the current main loop state ; Do ***NOT*** change this in the init func!!! wCurState:: db ;; State definitions ; Note that each of these files may define more than one state INCLUDE "main/states/normal.asm" INCLUDE "main/states/fade.asm" INCLUDE "main/states/load_map.asm"
source/mpc-generic_c.adb
ytomino/gmp-ada
4
24263
<reponame>ytomino/gmp-ada<gh_stars>1-10 with MPFR.Root_FR; package body MPC.Generic_C is use type Imaginary_FR.MP_Float; function Rounding return MPC.Rounding is begin return Compose ( Real_FR.Rounding, Imaginary_FR.Rounding); end Rounding; function i return MP_Imaginary is begin return To_MP_Float (1.0); end i; function Re (X : MP_Complex) return Real_FR.MP_Float is begin return Real_FR.MP_Float (Root_C.Re (Root_C.MP_Complex (X))); end Re; function Im (X : MP_Complex) return Imaginary_FR.MP_Float is begin return Imaginary_FR.MP_Float (Root_C.Im (Root_C.MP_Complex (X))); end Im; function Compose (Re : Real_FR.MP_Float; Im : Imaginary_FR.MP_Float) return MP_Complex is begin return Compose (MPFR.Root_FR.MP_Float (Re), MPFR.Root_FR.MP_Float (Im)); end Compose; function Image (Value : MP_Complex; Base : Number_Base := 10) return String is begin return Image (Value, Base, Rounding); end Image; function Value (Image : String; Base : Number_Base := 10) return MP_Complex is begin return Value ( Image => Image, Base => Base, Real_Precision => Real_FR.Precision, Imaginary_Precision => Imaginary_FR.Precision, Rounding => Rounding); end Value; function "+" (Right : MP_Complex) return MP_Complex is begin return Copy ( Right, Real_Precision => Real_FR.Precision, Imaginary_Precision => Imaginary_FR.Precision, Rounding => Rounding); end "+"; function "-" (Right : MP_Complex) return MP_Complex is begin return Negative ( Right, Real_Precision => Real_FR.Precision, Imaginary_Precision => Imaginary_FR.Precision, Rounding => Rounding); end "-"; function "+" (Left, Right : MP_Complex) return MP_Complex is begin return Add ( Left, Right, Real_Precision => Real_FR.Precision, Imaginary_Precision => Imaginary_FR.Precision, Rounding => Rounding); end "+"; function "+" (Left : Long_Long_Float; Right : MP_Imaginary) return MP_Complex is begin return Compose (Left, Real_FR.Precision, MPFR.Root_FR.MP_Float (Right)); end "+"; function "-" (Left, Right : MP_Complex) return MP_Complex is begin return Subtract ( Left, Right, Real_Precision => Real_FR.Precision, Imaginary_Precision => Imaginary_FR.Precision, Rounding => Rounding); end "-"; function "-" (Left : Long_Long_Float; Right : MP_Imaginary) return MP_Complex is begin return Compose (Left, Real_FR.Precision, MPFR.Root_FR.MP_Float (-Right)); end "-"; function "*" (Left, Right : MP_Complex) return MP_Complex is begin return Multiply ( Left, Right, Real_Precision => Real_FR.Precision, Imaginary_Precision => Imaginary_FR.Precision, Rounding => Rounding); end "*"; function "/" (Left, Right : MP_Complex) return MP_Complex is begin return Divide ( Left, Right, Real_Precision => Real_FR.Precision, Imaginary_Precision => Imaginary_FR.Precision, Rounding => Rounding); end "/"; function "**" (Left : MP_Complex; Right : Integer) return MP_Complex is begin return Power ( Left, Right, Real_Precision => Real_FR.Precision, Imaginary_Precision => Imaginary_FR.Precision, Rounding => Rounding); end "**"; function "*" (Left : Long_Long_Float; Right : MP_Imaginary) return MP_Imaginary is begin return MP_Imaginary (Left * Imaginary_FR.MP_Float (Right)); end "*"; end MPC.Generic_C;
alloy4fun_models/trashltl/models/1/LmTFfswgGG437yaDL.als
Kaixi26/org.alloytools.alloy
0
3855
open main pred idLmTFfswgGG437yaDL_prop2 { no File implies always after some File } pred __repair { idLmTFfswgGG437yaDL_prop2 } check __repair { idLmTFfswgGG437yaDL_prop2 <=> prop2o }
1998-spring/mp2/mp2.asm
ece291/machine-problems
3
93247
PAGE 75, 132 TITLE ECE291:MP2:MP2-Compress - Your Name - Date COMMENT * Data Compression. For this MP, you will write an interactive program which uses Huffman compression to compress and decompress textual data. By represents the most frequently used letters with the smallest number of bits, Huffman encoding can achieve significant data compression. ECE291: Machine Problem 2 Prof. <NAME> Unversity of Illinois Dept. of Electrical & Computer Engineering Spring 1998 Ver 2.0 * ;====== Constants ========================================================= BEEP EQU 7 BS EQU 8 CR EQU 13 LF EQU 10 ESCKEY EQU 27 SPACE EQU 32 HuffCode STRUCT letter BYTE ? ; Letter to encode DownEncoding WORD ? ; Encoding: MSBit first UpEncoding WORD ? ; Encoding: LSBit first blength BYTE ? ; Bit Encoding Length HuffCode ENDS TextMsgMaxLength EQU 70 ; Bytes ; Limit text messages to one line BufferMaxLengthBits EQU TextMsgMaxLength * 9 ; Worst case: all 9-bit encodes BufferMaxLength EQU 1 + (BufferMaxLengthBits)/8 ; Bytes ;====== Externals ========================================================= ; -- LIB291 Routines (Free) --- extrn kbdine:near, kbdin:near, dspout:near ; LIB291 Routines extrn dspmsg:near, binasc:near, ascbin:near ; (Always Free) extrn PerformanceTest:near ; Measures performance of your code extrn mp2xit:near ; Exit program with a call to this procedure ; -- LIBMP2 Routines (Replace these with your own code) --- extrn PrintBuffer:near ; Print contents of Buffer extrn ReadBuffer:near ; Read Buffer from keyboard extrn ReadTextMsg:near ; Read TextMsg from keyboard extrn PrintTextMsg:near ; Print contents of TxtMsg extrn Encode:near ; Encode ASCII -> 5-bit extrn AppendBufferN:near ; Append N bits to Buffer extrn EncodeHuff:near ; Huffman Encode TextMsg -> Buffer extrn DecodeHuff:near ; Huffman Decode Buffer -> TextMsg ;====== SECTION 3: Define stack segment =================================== stkseg segment stack ; *** STACK SEGMENT *** db 64 dup ('STACK ') ; 64*8 = 512 Bytes of Stack stkseg ends ;====== SECTION 4: Define code segment ==================================== cseg segment public 'CODE' ; *** CODE SEGMENT *** assume cs:cseg, ds:cseg, ss:stkseg, es:nothing ;====== SECTION 5: Variables ============================================== Buffer db BufferMaxLength dup(0) ; Data Buffer for encoded Message TextMsg db TextMsgMaxLength dup('$'), '$' ; Text Message BufferLength dw 0 ; Number of bits in buffer crlf db CR,LF,'$' ; DOS uses carriage return + Linefeed for new line PBuf db 7 dup(?) PUBLIC Buffer, TextMsg, BufferLength, HuffCodes Include huffcode.inc ; Huffman Encoding Table ;====== Procedures ======================================================== ; Your Subroutines go here ! ; ---- ----------- -- ---- ;====== Main procedure ==================================================== MenuMessage db CR,LF, \ '----------- MP2 Menu -----------',CR,LF,\ ' Enter (T)ext (B)inary',CR,LF, \ ' Print (M)essage (R)buffeR',CR,LF, \ ' Huffman (E)ncode (D)ecode',CR,LF, \ '---- [ESC] or (Q)uit = exit ----',CR,LF,'$' main proc far mov ax, cseg mov ds, ax MOV DX, Offset MenuMessage CALL DSPMSG ; Display Menu MainLoop: MOV DX, Offset CRLF CALL DSPMSG MainRead: CALL KBDIN ; Read Input CMP AL,'a' JB MainOpt CMP AL,'z' ; Convert Lowercase to Uppercase JA MainOpt SUB AL,'a'-'A' MainOpt: CMP AL,'T' JNE MainNotT Call ReadTextMsg ; Read in a text message JMP MainLoop MainNotT: CMP AL,'B' JNE MainNotB Call ReadBuffer ; Read in a binary message JMP MainLoop MainNotB: CMP AL,'M' JNE MainNotM Call PrintTextMsg ; Print TextMsg JMP MainLoop MainNotM: CMP AL,'R' JNE MainNotR ; Print Buffer Call PrintBuffer ; (show least significants bit first) JMP MainLoop MainNotR: CMP AL,'E' JNE MainNotE Call EncodeHuff ; Huffman Encode Message Call PrintBuffer ; and print result JMP MainLoop MainNotE: CMP AL,'D' JNE MainNotD Call DecodeHuff ; Huffman Decode Message Call PrintTextMsg ; and show result JMP MainLoop MainNotD: CMP AL,'P' JNE MainNotP ; Performance Test MOV SI, offset EncodeHuff MOV DI, offset DecodeHuff Call PerformanceTest JMP MainLoop MainNotP: CMP AL,ESCKEY JE MainDone ; Quit program CMP AL,'Q' JE MainDone JMP MainRead ; Ignore any other character MainDone: call MP2xit ; Exit to DOS main endp cseg ends end main
src/timestamp.adb
dshadrin/AProxy
1
23786
---------------------------------------- -- Copyright (C) 2019 <NAME> -- -- All rights reserved. -- ---------------------------------------- with Ada.Calendar.Conversions; with Ada.Real_Time; with Formatted_Output; use Formatted_Output; with Formatted_Output.Integer_Output; -------------------------------------------------------------------------------- package body TimeStamp is package Formatter_LongInteger is new Formatted_Output.Integer_Output (Long_Integer); package Formatter_Integer is new Formatted_Output.Integer_Output (Integer); package Formatter_Cint is new Formatted_Output.Integer_Output (Interfaces.C.int); ONE_SECOND_IN_MICROSECONDS : constant Long_Long_Integer := 1000000; procedure SetTimeCorrectValue (val : in Long_Integer) is begin TIME_CORRECT_VALUE := val; end SetTimeCorrectValue; ----------------------------------------------------------------------------- function "<" (lhd : in timespec; rhd : in timespec) return bool is status : bool := lhd.tv_sec < rhd.tv_sec; begin if not status and then lhd.tv_sec = rhd.tv_sec then status := lhd.tv_nsec < rhd.tv_nsec; end if; return status; end; ----------------------------------------------------------------------------- function GetTimestamp return timespec is tmPoint : Ada.Real_Time.Time := Ada.Real_Time.Clock; nsec : Ada.Real_Time.Time_Span; sec : Ada.Real_Time.Seconds_Count; tv : timespec := (0, 0); begin Ada.Real_Time.Split (tmPoint, sec, nsec); Ada.Calendar.Conversions.To_Struct_Timespec (Ada.Real_Time.To_Duration (nsec), tv.tv_sec, tv.tv_nsec); tv.tv_sec := Interfaces.C.long (sec); tv.tv_nsec := Interfaces.C.long (Integer (tv.tv_nsec) / 1000); tv.tv_sec := Interfaces.C.long (Long_Integer (tv.tv_sec) + TIME_CORRECT_VALUE); return tv; end GetTimestamp; ----------------------------------------------------------------------------- procedure TimestampAdjust (tv : in out timespec; deltaMicrosec : Integer) is mcs : Long_Long_Integer; sec : Long_Long_Integer; part : Long_Long_Integer; begin if deltaMicrosec /= 0 then mcs := ((Long_Long_Integer (tv.tv_sec) rem ONE_SECOND_IN_MICROSECONDS) * ONE_SECOND_IN_MICROSECONDS) + Long_Long_Integer (tv.tv_nsec) + Long_Long_Integer (deltaMicrosec); sec := ((Long_Long_Integer (tv.tv_sec) / ONE_SECOND_IN_MICROSECONDS) * ONE_SECOND_IN_MICROSECONDS); tv.tv_sec := Interfaces.C.long (sec + mcs / ONE_SECOND_IN_MICROSECONDS); part := mcs rem ONE_SECOND_IN_MICROSECONDS; if part < 0 then part := part + ONE_SECOND_IN_MICROSECONDS; tv.tv_sec := Interfaces.C.long (Long_Long_Integer (tv.tv_sec) - 1); end if; tv.tv_nsec := Interfaces.C.long (part); end if; end TimestampAdjust; ----------------------------------------------------------------------------- procedure ConvertTimestamp (tv : in timespec; tmStruct : out tm; us : out Long_Integer; deltaMicrosec : Integer := 0) is tv_temp : timespec := tv; dur : Duration; nsec : Ada.Real_Time.Time_Span; sec : Ada.Real_Time.Seconds_Count; tmPoint : Ada.Real_Time.Time; begin TimestampAdjust (tv_temp, deltaMicrosec); dur := Ada.Calendar.Conversions.To_Duration (0, Interfaces.C.long (Long_Integer (tv_temp.tv_nsec) * 1000)); nsec := Ada.Real_Time.To_Time_Span (dur); sec := Ada.Real_Time.Seconds_Count (tv_temp.tv_sec); tmPoint := Ada.Real_Time.Time_Of (sec, nsec); Ada.Calendar.Conversions.To_Struct_Tm (Ada.Calendar.Conversions.To_Ada_Time (Interfaces.C.long (tv_temp.tv_sec)), tmStruct.tm_year, tmStruct.tm_mon, tmStruct.tm_day, tmStruct.tm_hour, tmStruct.tm_min, tmStruct.tm_sec); tmStruct.tm_isdst := 0; us := Long_Integer (tv_temp.tv_nsec); end ConvertTimestamp; ----------------------------------------------------------------------------- function GetTimestampStr (tmStruct : in tm; us : in Long_Integer) return String is begin return FormatDateTime("%H:%M:%S.%06d", tmStruct, us); end GetTimestampStr; ----------------------------------------------------------------------------- function GetTimestampStr (tv : in timespec) return String is tmStruct : tm; us : Long_Integer; begin ConvertTimestamp (tv, tmStruct, us); return GetTimestampStr (tmStruct, us); end GetTimestampStr; ----------------------------------------------------------------------------- function GetTimestampStr return String is begin return GetTimestampStr (GetTimestamp); end GetTimestampStr; ----------------------------------------------------------------------------- function FormatDateTime (fmt : in String; tmStruct : in tm; us : in Long_Integer) return String is use Formatter_LongInteger; aMonth : constant array (Interfaces.C.int(0)..11) of String(1..3) := ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); ufmt : Unbounded_String := To_Unbounded_String(fmt); repl : Unbounded_String; fmtCh : Character; posPersent : Natural := Index (ufmt, "%"); isUs : Boolean := false; begin while posPersent > 0 and then Length (ufmt) > posPersent loop fmtCh := Element (ufmt, posPersent + 1); case fmtCh is when 'Y' => repl := To_Unbounded_String (Integer'Image (Integer (tmStruct.tm_year) + 1900)); when 'y' => repl := To_Unbounded_String (Integer'Image (Integer (tmStruct.tm_year) rem 100)); when 'm' => repl := To_Unbounded_String (aMonth(tmStruct.tm_mon)); when 'd' => repl := To_Unbounded_String (Interfaces.C.int'Image(tmStruct.tm_day)); when 'H' => repl := To_Unbounded_String (Interfaces.C.int'Image(tmStruct.tm_hour)); when 'M' => repl := To_Unbounded_String (Interfaces.C.int'Image(tmStruct.tm_min)); when 'S' => repl := To_Unbounded_String (Interfaces.C.int'Image(tmStruct.tm_sec)); when others => repl := To_Unbounded_String ( To_String (+To_String (ufmt) & us)); isUs := true; end case; if isUs then ufmt := repl; isUs := false; else if Element (repl, 1) = ' ' then if Length (repl) = 2 then Overwrite (repl, 1, "0"); else Trim(repl, Ada.Strings.Left); end if; end if; Replace_Slice (ufmt, posPersent, posPersent + 1, To_String (repl)); end if; posPersent := Index(ufmt, "%"); end loop; return To_String (ufmt); end FormatDateTime; end TimeStamp;
src/Data/Fin/Subset/Dec.agda
tizmd/agda-finitary
0
14410
<filename>src/Data/Fin/Subset/Dec.agda {-# OPTIONS --safe --without-K #-} module Data.Fin.Subset.Dec where open import Data.Nat as ℕ open import Data.Fin as Fin open import Data.Fin.Subset open import Relation.Nullary open import Relation.Unary renaming (Decidable to Decidable₁) using () open import Function using (_∘_) open import Data.Vec using ([]; _∷_) subset : ∀ {n}{p} {P : Fin n → Set p} → Decidable₁ P → Subset n subset {zero} dec = [] subset {suc n} dec with dec (# 0) subset {suc n} dec | yes p0 = inside ∷ subset (dec ∘ Fin.suc) subset {suc n} dec | no ¬p0 = outside ∷ subset (dec ∘ Fin.suc)
data/maps/objects/Route14.asm
opiter09/ASM-Machina
1
82855
<reponame>opiter09/ASM-Machina Route14_Object: db $43 ; border block def_warps def_signs sign 17, 13, 11 ; Route14Text11 def_objects object SPRITE_COOLTRAINER_M, 4, 4, STAY, DOWN, 1, OPP_BIRD_KEEPER, 14 object SPRITE_COOLTRAINER_M, 15, 6, STAY, DOWN, 2, OPP_BIRD_KEEPER, 15 object SPRITE_COOLTRAINER_M, 12, 11, STAY, DOWN, 3, OPP_BIRD_KEEPER, 16 object SPRITE_COOLTRAINER_M, 14, 15, STAY, UP, 4, OPP_BIRD_KEEPER, 17 object SPRITE_COOLTRAINER_M, 15, 31, STAY, LEFT, 5, OPP_BIRD_KEEPER, 4 object SPRITE_COOLTRAINER_M, 6, 49, STAY, UP, 6, OPP_BIRD_KEEPER, 5 object SPRITE_BIKER, 5, 39, STAY, DOWN, 7, OPP_BIKER, 13 object SPRITE_BIKER, 4, 30, STAY, RIGHT, 8, OPP_BIKER, 14 object SPRITE_BIKER, 15, 30, STAY, LEFT, 9, OPP_BIKER, 15 object SPRITE_BIKER, 4, 31, STAY, RIGHT, 10, OPP_BIKER, 2 def_warps_to ROUTE_14
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_1_1750.asm
ljhsiun2/medusa
9
100912
<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_1_1750.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r14 push %r15 push %r8 push %r9 push %rax lea addresses_UC_ht+0x1cce2, %r15 nop nop xor %r9, %r9 mov (%r15), %r10 nop nop nop nop nop and %r10, %r10 lea addresses_A_ht+0x55a3, %r11 nop inc %r8 movups (%r11), %xmm5 vpextrq $1, %xmm5, %rax nop nop nop nop nop cmp %rax, %rax lea addresses_WT_ht+0xc4c3, %r15 nop nop nop nop nop dec %r14 mov (%r15), %r8d nop nop nop sub $48982, %rax lea addresses_WT_ht+0x82c3, %r9 clflush (%r9) sub %rax, %rax mov $0x6162636465666768, %r8 movq %r8, %xmm0 movups %xmm0, (%r9) nop sub %r14, %r14 pop %rax pop %r9 pop %r8 pop %r15 pop %r14 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %r15 push %r9 push %rax push %rsi // Store lea addresses_WC+0xdec3, %r9 nop nop nop nop sub $39735, %rax movw $0x5152, (%r9) nop xor $26364, %rax // Store lea addresses_normal+0xb0c3, %r14 nop nop nop sub $54381, %r11 mov $0x5152535455565758, %r15 movq %r15, %xmm4 movups %xmm4, (%r14) nop cmp $47966, %rsi // Load lea addresses_A+0xf0c3, %rax nop add %r11, %r11 mov (%rax), %r15d nop and %rsi, %rsi // Store mov $0x6eb1a100000008c3, %rsi nop nop xor %r15, %r15 mov $0x5152535455565758, %r11 movq %r11, (%rsi) nop nop cmp %r11, %r11 // Faulty Load lea addresses_normal+0xb0c3, %r10 nop nop nop and $48405, %r11 vmovups (%r10), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %rax lea oracles, %rsi and $0xff, %rax shlq $12, %rax mov (%rsi,%rax,1), %rax pop %rsi pop %rax pop %r9 pop %r15 pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 9}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}} {'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 11}} [Faulty Load] {'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 9}} {'34': 1} 34 */
Appl/Term/Utils/utilsManager.asm
steakknife/pcgeos
504
1719
<gh_stars>100-1000 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1989 -- All Rights Reserved PROJECT: PC GEOS MODULE: Utils FILE: utilsManager.asm AUTHOR: <NAME>, December 13, 1989 REVISION HISTORY: Name Date Description ---- ---- ----------- dc 12/13/89 Initial revision. DESCRIPTION: Manager for this module. $Id: utilsManager.asm,v 1.1 97/04/04 16:56:38 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ _Utils = 1 ;------------------------------------------------------------------------------ ; Include definitions. ;------------------------------------------------------------------------------ include utilsInclude.def ;------------------------------------------------------------------------------ ; Local variables. ;------------------------------------------------------------------------------ idata segment include utilsVariable.def idata ends ;------------------------------------------------------------------------------ ; Here comes the code... ;------------------------------------------------------------------------------ Utils segment resource include utilsMain.asm ; Externally callable routines for this module. include utilsLocal.asm ; Internally callable routines for this module. Utils ends end
Data/Binary/PerformanceTests/Subtraction.agda
oisdk/agda-playground
6
3295
{-# OPTIONS --cubical --safe #-} module Data.Binary.PerformanceTests.Subtraction where open import Prelude open import Data.Binary.Definition open import Data.Binary.Addition using (_+_) open import Data.Binary.Subtraction using (_-_) open import Data.Binary.Multiplication using (_*_) sub-r : 𝔹 → 𝔹 → ℕ → 𝔹 sub-r a x zero = a sub-r a x (suc n) = sub-r a x n - x sub-l : 𝔹 → 𝔹 → ℕ → 𝔹 sub-l a x zero = a sub-l a x (suc n) = sub-r (a - x) x n one-thousand : 𝔹 one-thousand = 2ᵇ 1ᵇ 1ᵇ 2ᵇ 1ᵇ 2ᵇ 2ᵇ 2ᵇ 2ᵇ 0ᵇ f : 𝔹 f = one-thousand * one-thousand * one-thousand n : ℕ n = 99999 -- The actual performance test (uncomment and time how long it takes to type-check) -- _ : sub-l f one-thousand n ≡ sub-r f one-thousand n -- _ = refl
programs/oeis/002/A002232.asm
neoneye/loda
22
17439
; A002232: 8th powers written backwards. ; 0,1,652,1656,63556,526093,6169761,1084675,61277761,12764034,1,188853412,696189924,127037518,6509875741,5260982652,6927694924,1447575796,67506991011,14036538961,652,16395822873,63537857845,18258901387,671413570011,526098785251,675460728802,184635924282,633899108773,169214642005,1656,144730198258,6777261159901,1428168046041,6984093975871,5260935781522,6547099011282,1293549742153,6948312977434,1840629002535,63556,1219225294897,6146991562869,10677200288611,61252632284041,52609352151861,63913221674002,16716668211832,65092408297182,10696503923233,526093,10407544976754,65413582795435,16311409695226,63193316910327,52609873933738,61047511371769,100211751924111,610817180360821,123406734038641,6169761,182799213707191,698485501043812,125762087551842,656017679474182,526098218446813,696962606040063,146655776760604,673356932361754,146824473897315,1084675,167542135357546,637803631402227,180498190064608,677302047491998,5260930519211001,6794547874303111,1867451926375321,6313860734110731,1656099088017151,61277761,1481588810203581,6794568580414402,1409312322922522,6942801198578742,5260930525094272,6585601729712992,1217345176112823,6925508425436953,1802075088856393,12764034,1251516725252074,6165731378812315,1040566908185955,6180145839865906,5260982134024366,6338389875983127,1696734953347387,6587185220367058,1029724496447229 pow $0,8 lpb $0 mul $1,10 mov $2,$0 div $0,10 mod $2,10 add $1,$2 lpe mov $0,$1
programs/oeis/002/A002593.asm
karttu/loda
1
242253
<gh_stars>1-10 ; A002593: a(n) = n^2*(2*n^2 - 1); also Sum_{k=0..n-1} (2k+1)^3. ; 0,1,28,153,496,1225,2556,4753,8128,13041,19900,29161,41328,56953,76636,101025,130816,166753,209628,260281,319600,388521,468028,559153,662976,780625,913276,1062153,1228528,1413721,1619100,1846081,2096128,2370753,2671516,3000025,3357936,3746953,4168828,4625361,5118400,5649841,6221628,6835753,7494256,8199225,8952796,9757153,10614528,11527201,12497500,13527801,14620528,15778153,17003196,18298225,19665856,21108753,22629628,24231241,25916400,27687961,29548828,31501953,33550336,35697025,37945116,40297753,42758128,45329481,48015100,50818321,53742528,56791153,59967676,63275625,66718576,70300153,74024028,77893921,81913600,86086881,90417628,94909753,99567216,104394025,109394236,114571953,119931328,125476561,131211900,137141641,143270128,149601753,156140956,162892225,169860096,177049153,184464028,192109401,199990000,208110601,216476028,225091153,233960896,243090225,252484156,262147753,272086128,282304441,292807900,303601761,314691328,326081953,337779036,349788025,362114416,374763753,387741628,401053681,414705600,428703121,443052028,457758153,472827376,488265625,504078876,520273153,536854528,553829121,571203100,588982681,607174128,625783753,644817916,664283025,684185536,704531953,725328828,746582761,768300400,790488441,813153628,836302753,859942656,884080225,908722396,933876153,959548528,985746601,1012477500,1039748401,1067566528,1095939153,1124873596,1154377225,1184457456,1215121753,1246377628,1278232641,1310694400,1343770561,1377468828,1411796953,1446762736,1482374025,1518638716,1555564753,1593160128,1631432881,1670391100,1710042921,1750396528,1791460153,1833242076,1875750625,1918994176,1962981153,2007720028,2053219321,2099487600,2146533481,2194365628,2242992753,2292423616,2342667025,2393731836,2445626953,2498361328,2551943961,2606383900,2661690241,2717872128,2774938753,2832899356,2891763225,2951539696,3012238153,3073868028,3136438801,3199960000,3264441201,3329892028,3396322153,3463741296,3532159225,3601585756,3672030753,3743504128,3816015841,3889575900,3964194361,4039881328,4116646953,4194501436,4273455025,4353518016,4434700753,4517013628,4600467081,4685071600,4770837721,4857776028,4945897153,5035211776,5125730625,5217464476,5310424153,5404620528,5500064521,5596767100,5694739281,5793992128,5894536753,5996384316,6099546025,6204033136,6309856953,6417028828,6525560161,6635462400,6746747041,6859425628,6973509753,7089011056,7205941225,7324311996,7444135153,7565422528,7688186001 pow $0,2 mul $0,2 bin $0,2 mov $1,$0
libsrc/_DEVELOPMENT/math/float/am9511/c/sdcc/cam32_sdcc_ceil.asm
ahjelm/z88dk
640
5846
<reponame>ahjelm/z88dk<gh_stars>100-1000 SECTION code_fp_am9511 PUBLIC cam32_sdcc_ceil EXTERN cam32_sdcc_read1, asm_am9511_ceil_fastcall .cam32_sdcc_ceil call cam32_sdcc_read1 jp asm_am9511_ceil_fastcall
univ_old.agda
hjorthjort/IdrisToAgda
2
4945
data Li : (a : Set) -> Set where Ni : {a : Set} -> Li a Co : {a : Set} -> a -> Li a -> Li a {-# BUILTIN NATURAL name #-} t : Li (Set 2) -> Set 1 t li = Set 1
examples/storagepool.adb
ytomino/drake
33
8377
<gh_stars>10-100 with Ada.Unchecked_Deallocate_Subpool; with Ada.Unchecked_Deallocation; with Ada.Unchecked_Reallocation; with System.Storage_Elements.Formatting; with System.Storage_Pools.Unbounded; with System.Storage_Pools.Subpools.Unbounded; procedure storagepool is use type System.Address; use type System.Storage_Elements.Storage_Offset; Verbose : constant Boolean := False; begin Global : declare type A is access all Integer; type B is access all Integer; for B'Storage_Pool use A'Storage_Pool; procedure Free is new Ada.Unchecked_Deallocation (Integer, A); procedure Free is new Ada.Unchecked_Deallocation (Integer, B); begin declare X : A := new Integer'(100); Y : B := B (X); begin Free (Y); end; declare X : B := new Integer'(200); Y : A := A (X); begin Free (Y); end; end Global; Reallocation : declare type S is access String; procedure Reallocate is new Ada.Unchecked_Reallocation (Positive, Character, String, S); procedure Free is new Ada.Unchecked_Deallocation (String, S); X : S := new String'(257 => '[', 258 .. 511 => '-', 512 => ']'); begin Reallocate (X, 1, 768); X (1 .. 256) := (others => '.'); X (513 .. 678) := (others => '.'); pragma Assert (X (257) = '['); pragma Assert (X (512) = ']'); Reallocate (X, 257, 512); pragma Assert (X (257) = '['); pragma Assert (X (512) = ']'); Reallocate (X, 129, 257); X (129 .. 256) := (others => '.'); pragma Assert (X (257) = '['); Reallocate (X, 257, 512); X (258 .. 512) := (258 .. 511 => '-', 512 => ']'); pragma Assert (X (257) = '['); Free (X); end Reallocation; Sized_And_Fixed : declare type T is access System.Address; for T'Storage_Size use (Standard'Address_Size / Standard'Storage_Unit) * 25; -- using System.Pool_Size -- Pool_Size => 100 -- Elmt_Size => 4 -- Alignment => 4 procedure Free is new Ada.Unchecked_Deallocation (System.Address, T); A : array (1 .. 25) of T; begin for Trying in 1 .. 2 loop for I in A'Range loop A (I) := new System.Address'(System'To_Address (I)); if Verbose then Ada.Debug.Put (System.Storage_Elements.Formatting.Image (A(I).all'Address)); end if; pragma Assert (A (I).all'Address mod System.Address'Alignment = 0); for J in A'First .. I - 1 loop pragma Assert (A(I) /= A (J)); null; end loop; end loop; begin A (1) := new System.Address; -- error raise Program_Error; exception when Storage_Error => null; end; for I in A'Range loop Free (A(I)); end loop; end loop; end Sized_And_Fixed; Sized_And_Variable : declare type V is access String; for V'Storage_Size use 300; procedure Free is new Ada.Unchecked_Deallocation (String, V); A : array (1 .. 6) of V; First_Address : System.Address; begin A (1) := new String (1 .. 1); First_Address := A (1).all'Address; Free (A (1)); for Trying in 1 .. 2 loop for I in A'Range loop A (I) := new String (1 .. I * 5); if Verbose then Ada.Debug.Put (System.Storage_Elements.Formatting.Image (A (I).all'Address)); end if; for J in A'First .. I - 1 loop pragma Assert (A (J) /= A (I)); null; end loop; end loop; begin A (1) := new String (1 .. 300); -- error raise Program_Error; exception when Storage_Error => null; end; pragma Assert (A (1).all'Address = First_Address); Free (A (6)); Free (A (1)); Free (A (2)); Free (A (4)); Free (A (3)); Free (A (5)); end loop; A (1) := new String (1 .. 100); pragma Assert (A (1).all'Address = First_Address); A (2) := new String (1 .. 1); Free (A (1)); A (3) := new String (1 .. 5); -- reuse the area of A (1) pragma Assert (A (3).all'Address = First_Address); Free (A (3)); A (4) := new String (1 .. 10); -- reuse the area of A (1) pragma Assert (A (4).all'Address = First_Address); A (5) := new String (1 .. 15); -- reuse the split area Free (A (4)); Free (A (5)); Free (A (2)); A (1) := new String (1 .. 150); pragma Assert (A (1).all'Address = First_Address); Free (A (1)); end Sized_And_Variable; Local : declare Pool : System.Storage_Pools.Unbounded.Unbounded_Pool; type T is access all Integer; for T'Storage_Pool use Pool; A : array (1 .. 2) of T; begin A (1) := new Integer'(1); A (2) := new Integer'(2); end Local; -- System.Storage_Pools.Subpools.Unbounded declare use System.Storage_Pools.Subpools.Unbounded; Pool : Unbounded_Pool_With_Subpools; type T is access all Integer; for T'Storage_Pool use Pool; procedure Free is new Ada.Unchecked_Deallocation (Integer, T); H : array (1 .. 2) of System.Storage_Pools.Subpools.Subpool_Handle; A : array (1 .. 2, 1 .. 2) of T; begin for I in H'Range loop H (I) := Create_Subpool (Pool); A (I, 1) := new (H (I)) Integer'(I * 10 + 1); A (I, 2) := new (H (I)) Integer'(I * 10 + 2); Free (A (I, 1)); -- explicit free "11" or "21" end loop; Ada.Unchecked_Deallocate_Subpool (H (1)); -- explicit free "12" -- implicit free "22" end; pragma Debug (Ada.Debug.Put ("OK")); end storagepool;
oeis/021/A021739.asm
neoneye/loda-programs
11
92876
; A021739: Decimal expansion of 1/735. ; 0,0,1,3,6,0,5,4,4,2,1,7,6,8,7,0,7,4,8,2,9,9,3,1,9,7,2,7,8,9,1,1,5,6,4,6,2,5,8,5,0,3,4,0,1,3,6,0,5,4,4,2,1,7,6,8,7,0,7,4,8,2,9,9,3,1,9,7,2,7,8,9,1,1,5,6,4,6,2,5,8,5,0,3,4,0,1,3,6,0,5,4,4,2,1,7,6,8,7 add $0,1 mov $2,10 pow $2,$0 mov $0,$2 div $0,735 mod $0,10
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_1200.asm
ljhsiun2/medusa
9
24051
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r15 push %rax push %rcx push %rdi push %rsi lea addresses_D_ht+0x1bdb7, %rsi lea addresses_WT_ht+0xab75, %rdi nop nop xor %r15, %r15 mov $89, %rcx rep movsq nop nop nop nop nop cmp $47302, %rcx lea addresses_A_ht+0x1bae4, %rsi lea addresses_WT_ht+0x8208, %rdi and %r14, %r14 mov $11, %rcx rep movsl nop nop nop nop nop add %rdi, %rdi lea addresses_normal_ht+0x131c4, %r12 nop nop sub $4457, %r13 mov (%r12), %esi nop nop xor %rcx, %rcx lea addresses_WC_ht+0x5564, %rsi lea addresses_UC_ht+0xab31, %rdi nop and $9401, %rax mov $0, %rcx rep movsq nop and %rax, %rax lea addresses_A_ht+0x7b3c, %rsi lea addresses_normal_ht+0x4724, %rdi nop nop nop xor $46249, %r12 mov $53, %rcx rep movsb add $30214, %r12 pop %rsi pop %rdi pop %rcx pop %rax pop %r15 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r15 push %r9 push %rbx push %rcx // Load lea addresses_D+0x6bc, %r9 nop nop nop nop add $3351, %r15 mov (%r9), %r14w nop nop nop xor $44724, %r15 // Faulty Load lea addresses_UC+0x13724, %rbx sub %r9, %r9 movb (%rbx), %cl lea oracles, %r14 and $0xff, %rcx shlq $12, %rcx mov (%r14,%rcx,1), %rcx pop %rcx pop %rbx pop %r9 pop %r15 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
ATMega328P/09-Play_Tone/09-play_tone.asm
agguro/arduino-project
0
168870
;name: 5161AS-single-digit-led.asm ;assemble: avra 5161AS-single-digit-led.asm ;flash: avrdude -c arduino -p m328p -P /dev/ttyACM0 -b 115200 -U flash:w:5161AS-single-digit-led.hex ;description: small demonstration on how to deal with the 5161AS single digit led. ; the program lits one led at a time with a 05. sec delay between the next state. ; the only registers used is r16 and the carry flag. ; assumed is that the led segments are connected to PORTD with the next configuration: ; led - gate - value in r16 ; A 0 00000001 ; B 1 00000010 ; C 2 00000100 ; D 3 00001000 ; E 4 00010000 ; F 5 00100000 ; G 6 01000000 ; DP 7 10000000 ;remark: not using the delay functions gives the impression that all leds lits as one. ;dec 9, 2021 - agguro - no-license license .device ATmega328P .equ PORTB = 0x05 .equ DDRB = 0x04 .cseg .org 0x00 start: ldi r16,0b00000001 ;r16 = 0xFF all ports as output out DDRB,r16 ;r16 to DDRD (0x0a) controls PORTD's in/out state. out PORTD,r16 ;write r16 to PORTD call delay ;wait a while loop: rjmp loop ;continu rotating and writing ;Assembly code auto-generated by utility from <NAME> ;Delay 7 999 996 cycles - 499ms 999us 750 ns at 16.0 MHz ;http://darcy.rsgc.on.ca/ACES/TEI4M/AVRdelay.html delay: ldi r18, 41 ldi r19, 150 ldi r20, 126 l1: dec r20 brne l1 dec r19 brne l1 dec r18 brne l1 ret
Transynther/x86/_processed/US/_st_zr_un_/i9-9900K_12_0xca.log_6494_1829.asm
ljhsiun2/medusa
9
29790
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r9 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_WT_ht+0x1263e, %rax nop nop nop add $45019, %r9 movups (%rax), %xmm1 vpextrq $0, %xmm1, %rbp nop nop nop sub $26436, %rdi lea addresses_WT_ht+0xe0fe, %rsi nop nop nop nop nop cmp %rax, %rax mov $0x6162636465666768, %r10 movq %r10, (%rsi) nop nop nop add $43328, %rdi lea addresses_A_ht+0xfece, %rbp nop nop nop sub %r9, %r9 movb (%rbp), %al nop add $47115, %rsi lea addresses_A_ht+0x1ce6e, %rdi nop nop nop nop sub %r14, %r14 mov (%rdi), %r9d nop nop and $18476, %rdi lea addresses_A_ht+0x2e66, %rdi add $55259, %rbp movb $0x61, (%rdi) nop nop cmp $27111, %r14 lea addresses_normal_ht+0x1d027, %rsi lea addresses_UC_ht+0xa4ea, %rdi nop nop nop nop nop dec %rbp mov $34, %rcx rep movsb inc %r9 lea addresses_normal_ht+0x18fe, %rsi lea addresses_WC_ht+0x14cfe, %rdi nop nop nop nop nop cmp %r9, %r9 mov $78, %rcx rep movsl nop cmp %rdi, %rdi lea addresses_WC_ht+0x1cb7e, %r9 nop nop nop nop xor %r14, %r14 vmovups (%r9), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %rcx and $45455, %rcx lea addresses_A_ht+0x2e7e, %rsi lea addresses_UC_ht+0x5090, %rdi clflush (%rdi) nop nop nop nop nop dec %rax mov $95, %rcx rep movsq nop sub %r14, %r14 lea addresses_A_ht+0x19fe, %r10 xor $61830, %r14 mov $0x6162636465666768, %rdi movq %rdi, %xmm5 and $0xffffffffffffffc0, %r10 vmovntdq %ymm5, (%r10) nop nop nop nop nop sub %rax, %rax lea addresses_A_ht+0x1b6fe, %rsi lea addresses_D_ht+0x1013e, %rdi nop nop nop xor %r10, %r10 mov $34, %rcx rep movsl nop nop nop nop nop xor $56753, %r10 lea addresses_D_ht+0x57c6, %rbp nop inc %r10 movb (%rbp), %r9b add $64889, %r14 lea addresses_UC_ht+0xa78a, %rsi lea addresses_UC_ht+0x47cc, %rdi nop nop nop nop xor $6122, %rax mov $69, %rcx rep movsb add $41035, %rsi lea addresses_WC_ht+0x1a579, %rsi lea addresses_WT_ht+0x617e, %rdi nop add $19985, %r10 mov $50, %rcx rep movsq nop nop nop add $25313, %rbp lea addresses_UC_ht+0x30e, %rbp xor $2632, %rax mov $0x6162636465666768, %r14 movq %r14, (%rbp) nop nop nop nop nop cmp $9967, %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r9 push %rbx push %rcx push %rdi push %rsi // REPMOV lea addresses_PSE+0x87fe, %rsi lea addresses_PSE+0x84fe, %rdi nop nop nop nop nop and %r12, %r12 mov $19, %rcx rep movsq nop nop nop nop and $16805, %rdi // Faulty Load lea addresses_US+0x1d4fe, %r9 nop nop nop xor %r15, %r15 movb (%r9), %bl lea oracles, %rdi and $0xff, %rbx shlq $12, %rbx mov (%rdi,%rbx,1), %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_PSE', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_PSE', 'congruent': 10}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': True, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': True, 'AVXalign': False, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': True, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 6}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': True, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 6}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'5f': 17, '00': 6112, '33': 365} 00 00 00 00 33 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 33 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 33 00 33 00 00 33 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 33 00 00 00 00 00 33 00 00 00 33 00 00 00 00 00 33 00 00 00 00 00 00 00 33 00 00 00 00 00 33 33 33 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 33 00 00 33 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 33 00 33 00 33 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 33 00 00 00 00 00 00 00 33 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 33 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 33 00 33 00 00 00 00 00 00 00 00 5f 00 00 00 00 00 00 33 00 00 33 00 5f 00 33 33 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 */
software/kernel/console.ads
TUM-EI-RCS/StratoX
12
26348
<filename>software/kernel/console.ads<gh_stars>10-100 -- Institution: Technische Universitaet Muenchen -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- Module: Console -- Authors: <NAME> (<EMAIL>) -- -- ToDo: -- [ ] Implementation -- @summary Command Line Interface for user interactions package Console with SPARK_Mode is type User_Command_Type is ( NONE, RESTART, STATUS, TEST, PROFILE, ARM, DISARM, INC_ELE, DEC_ELE ); procedure read_Command( cmd : out User_Command_Type ); procedure write_Line( message : String ); end Console;
gfx/pokemon/yanma/anim.asm
Dev727/ancientplatinum
28
27996
frame 1, 10 frame 0, 05 frame 3, 05 setrepeat 5 frame 0, 03 frame 2, 03 dorepeat 4 endanim
assembler/tests/t_9331_2/t_9331_2.asm
paulscottrobson/RCA-Cosmac-VIP-III
0
245359
<reponame>paulscottrobson/RCA-Cosmac-VIP-III , , , , , , , , , , , , , , ; jc ,start ,gf0 , , , , , , , ; lda ,mod0 ,15h , , , , ; Initialization lda ,mod1 ,15h , , , , ; LACK of Low: Lch, High: lda ,df0 ,03h , , , , ; Rch are assumed for the lda ,df1 ,02h , , , , ; following comment relative lda ,dp0 ,01h , , , , ; to channel lda ,dp1 ,21h , , , , ; Stupid Toshiba assembler disregards ,gfs ,gf0 , , , , , , , , , ; ';' in first row! start: , , , , , , ,cp+ , , ,x ,si0 , , , ; mads, ,x ,y ,0 , , ,cp+ , , , , , , , ; , , , , ,wf0 , ,cp+ ,dp1 ,+ ,so1 ,w0 , , , ; data output (Lch) wait_edge: jnc ,wait_edge(down),LRF , , , , , , , ; down edge waiting , , , , , , ,cp+ , , ,x ,si0 , , , ; mads, ,x ,y ,0 , , ,cp+ , , , , , , , ; , , , , ,wf0 , , , , ,so1 ,w0 , , , ; data output (Rch) wait_SYNC: jmp0 ,wait_SYNC(up-edge) , , , , , , , ; SYNC reset waiting end
x86_64/src/01-prcess_id.nasm
karng87/nasm_game
0
105473
<filename>x86_64/src/01-prcess_id.nasm ;------------------------------------------------ ; ./a.out & ; cat /proc/pid/maps ; ; address perms offset dev inode pathname ; 00400000-00401000 r--p 00000000 08:02 4064017 /home/jkarng/Proje.. ; r = read ; w = write ; x = execute ; s = shared ; p = private (copy on write) ;------------------------------------------------- section .data correct: dq -1 section .text global main main: jmp main ;------------------------------------------- ; Process and Thread ; https://goodgid.github.io/What-is-Thread/ ;-------------------------------------------
Sources/Globe_3d/glut_2d.adb
ForYouEyesOnly/Space-Convoy
1
19970
with GLUT, System; package body GLUT_2D is GLUT_char : constant array (Font_type) of System.Address := ( Screen_9_by_15 => GLUT.BITMAP_9_BY_15, Screen_8_by_13 => GLUT.BITMAP_8_BY_13, Times_Roman_10 => GLUT.BITMAP_TIMES_ROMAN_10, Times_Roman_24 => GLUT.BITMAP_TIMES_ROMAN_24, Helvetica_10 => GLUT.BITMAP_HELVETICA_10, Helvetica_12 => GLUT.BITMAP_HELVETICA_12, Helvetica_18 => GLUT.BITMAP_HELVETICA_18 ); procedure Text_Output (s : String; font : Font_type) is begin for i in s'Range loop GLUT.BitmapCharacter (GLUT_char (font), Character'Pos (s (i))); end loop; end Text_Output; procedure Push_3D_set_2D (main_size_x, main_size_y : GL.Sizei) is use GL; begin -- Push current matrix mode and viewport attributes. GL.PushAttrib (GL.TRANSFORM_BIT or GL.VIEWPORT_BIT); GL.MatrixMode (GL.PROJECTION); GL.PushMatrix; -- In GL.PROJECTION mode, the stack depth is at least 2 GL.LoadIdentity; GL.Ortho ( 0.0, GL.Double (main_size_x), GL.Double (main_size_y), 0.0, GL.Double'(-1.0), 1.0); GL.MatrixMode (GL.MODELVIEW); GL.PushMatrix; -- In GL.MODELVIEW mode, the stack depth is at least 32 GL.LoadIdentity; end Push_3D_set_2D; procedure Pop_3D is begin GL.MatrixMode (GL.MODELVIEW); GL.PopMatrix; GL.MatrixMode (GL.PROJECTION); GL.PopMatrix; GL.PopAttrib; end Pop_3D; procedure Text_output ( x, y : GL.Int; main_size_x, main_size_y : GL.Sizei; s : String; font : Font_type ) is begin Push_3D_set_2D (main_size_x, main_size_y); GL.RasterPos (x, y); Text_Output (s, font); Pop_3D; end Text_output; procedure Text_output ( p : GL.Double_Vector_3D; s : String; font : Font_type ) is begin GL.PushMatrix; GL.Translate (p); GL.RasterPos (0, 0); Text_Output (s, font); GL.PopMatrix; end Text_output; procedure Put_Image ( Image_ID : Integer; x, y : GL.Int; size_x, size_y : GL.Int; main_size_x, main_size_y : GL.Sizei ) is begin -- fx := GL.Float (size_x) / GL.Float (main_size_x); -- fy := GL.Float (size_y) / GL.Float (main_size_y); Push_3D_set_2D (main_size_x, main_size_y); GL.Translate (GL.Double (x), GL.Double (y), 0.0); -- GL.Enable (GL.TEXTURE_2D); GL.BindTexture (GL.TEXTURE_2D, GL.Uint (Image_ID)); GL.GL_Begin (GL.QUADS); GL.TexCoord (0.0, 0.0); GL.Vertex (0, size_y); GL.TexCoord (1.0, 0.0); GL.Vertex (size_x, size_y); GL.TexCoord (1.0, 1.0); GL.Vertex (size_x, 0); GL.TexCoord (0.0, 1.0); GL.Vertex (0, 0); GL.GL_End; Pop_3D; end Put_Image; end GLUT_2D;
src/draw_circle.asm
tina-hoeflich/pong
2
96514
# Based on CESP lecture # Authors: <NAME>, <NAME>, <NAME> #Function to draw a colored circle with given radius and x- and y-coordinates of center #Uses draw_pixel that has to be included in calling function draw_circle: # Inputs #------------------ # a3: x coordinate # a4: y coordinate # a5: radius in pixels # a7: color # s1: x # s2: y # s3: d addi sp, sp, -44 sw a3, (sp) sw a4, 4(sp) sw a5, 8(sp) sw a7, 12(sp) sw ra, 16(sp) sw s1, 20(sp) sw s2, 24(sp) sw s3, 28(sp) sw a1, 32(sp) sw a2, 36(sp) sw a3, 40(sp) mv s1, a5 # x = r li s2, 0 # y = 0 sub s3, zero, a5 # d = -r _loop0: slli t0, s2, 2 addi t0, t0, 1 add s3, s3, t0 # d = d + 2*y + 1 addi s2, s2, 1 # y = y + 1 ble s3, zero, _lesseq slli t0, s1, 2 sub s3, s3, t0 addi s3, s3, 2 # d = d - 2*x + 2 addi s1, s1, -1 _lesseq: #------------------------ lw a3, (sp) lw a4, 4(sp) lw a5, 8(sp) lw a7, 12(sp) add a3, a3, s1 # xc + x add a4, a4, s2 # yc + y mv a1, a3 mv a2, a4 mv a3, a7 jal draw_pixel #---------------------- lw a3, (sp) lw a4, 4(sp) lw a5, 8(sp) lw a7, 12(sp) sub a3, a3, s1 # xc - x add a4, a4, s2 # yc + y mv a1, a3 mv a2, a4 mv a3, a7 jal draw_pixel #---------------------- lw a3, (sp) lw a4, 4(sp) lw a5, 8(sp) lw a7, 12(sp) add a3, a3, s1 # xc + x sub a4, a4, s2 # yc - y mv a1, a3 mv a2, a4 mv a3, a7 jal draw_pixel #---------------------- lw a3, (sp) lw a4, 4(sp) lw a5, 8(sp) lw a7, 12(sp) sub a3, a3, s1 # xc - x sub a4, a4, s2 # yc - y mv a1, a3 mv a2, a4 mv a3, a7 jal draw_pixel #---------------------- lw a3, (sp) lw a4, 4(sp) lw a5, 8(sp) lw a7, 12(sp) add a3, a3, s2 # xc + y add a4, a4, s1 # yc + x mv a1, a3 mv a2, a4 mv a3, a7 jal draw_pixel #---------------------- lw a3, (sp) lw a4, 4(sp) lw a5, 8(sp) lw a7, 12(sp) sub a3, a3, s2 # xc - y add a4, a4, s1 # yc + x mv a1, a3 mv a2, a4 mv a3, a7 jal draw_pixel #---------------------- lw a3, (sp) lw a4, 4(sp) lw a5, 8(sp) lw a7, 12(sp) add a3, a3, s2 # xc + y sub a4, a4, s1 # yc - x mv a1, a3 mv a2, a4 mv a3, a7 jal draw_pixel #---------------------- lw a3, (sp) lw a4, 4(sp) lw a5, 8(sp) lw a7, 12(sp) sub a3, a3, s2 # xc - y sub a4, a4, s1 # yc - x mv a1, a3 mv a2, a4 mv a3, a7 jal draw_pixel _end_loop: ble s2,s1 _loop0 # Restore the callee-save reisters lw a3, (sp) lw a4, 4(sp) lw a5, 8(sp) lw a7, 12(sp) lw ra, 16(sp) lw s1, 20(sp) lw s2, 24(sp) lw s3, 28(sp) lw a1, 32(sp) lw a2, 36(sp) lw a3, 40(sp) addi sp, sp, 44 ret
vendor/bundle/ruby/2.0.0/gems/pygments.rb-0.6.1/vendor/pygments-main/tests/examplefiles/test.agda
agent010101/agent010101.github.io
23
14685
<filename>vendor/bundle/ruby/2.0.0/gems/pygments.rb-0.6.1/vendor/pygments-main/tests/examplefiles/test.agda -- An Agda example file module test where open import Coinduction open import Data.Bool open import {- pointless comment between import and module name -} Data.Char open import Data.Nat open import Data.Nat.Properties open import Data.String open import Data.List hiding ([_]) open import Data.Vec hiding ([_]) open import Relation.Nullary.Core open import Relation.Binary.PropositionalEquality using (_≡_; refl; cong; trans; inspect; [_]) open SemiringSolver {- this is a {- nested -} comment -} -- Factorial _! : ℕ → ℕ 0 ! = 1 (suc n) ! = (suc n) * n ! -- The binomial coefficient _choose_ : ℕ → ℕ → ℕ _ choose 0 = 1 0 choose _ = 0 (suc n) choose (suc m) = (n choose m) + (n choose (suc m)) -- Pascal's rule choose-too-many : ∀ n m → n ≤ m → n choose (suc m) ≡ 0 choose-too-many .0 m z≤n = refl choose-too-many (suc n) (suc m) (s≤s le) with n choose (suc m) | choose-too-many n m le | n choose (suc (suc m)) | choose-too-many n (suc m) (≤-step le) ... | .0 | refl | .0 | refl = refl _++'_ : ∀ {a n m} {A : Set a} → Vec A n → Vec A m → Vec A (m + n) _++'_ {_} {n} {m} v₁ v₂ rewrite solve 2 (λ a b → b :+ a := a :+ b) refl n m = v₁ Data.Vec.++ v₂ ++'-test : (1 ∷ 2 ∷ 3 ∷ []) ++' (4 ∷ 5 ∷ []) ≡ (1 ∷ 2 ∷ 3 ∷ 4 ∷ 5 ∷ []) ++'-test = refl data Coℕ : Set where co0 : Coℕ cosuc : ∞ Coℕ → Coℕ nanana : Coℕ nanana = let two = ♯ cosuc (♯ (cosuc (♯ co0))) in cosuc two abstract data VacuumCleaner : Set where Roomba : VacuumCleaner pointlessLemmaAboutBoolFunctions : (f : Bool → Bool) → f (f (f true)) ≡ f true pointlessLemmaAboutBoolFunctions f with f true | inspect f true ... | true | [ eq₁ ] = trans (cong f eq₁) eq₁ ... | false | [ eq₁ ] with f false | inspect f false ... | true | _ = eq₁ ... | false | [ eq₂ ] = eq₂ mutual isEven : ℕ → Bool isEven 0 = true isEven (suc n) = not (isOdd n) isOdd : ℕ → Bool isOdd 0 = false isOdd (suc n) = not (isEven n) foo : String foo = "Hello World!" nl : Char nl = '\n' private intersperseString : Char → List String → String intersperseString c [] = "" intersperseString c (x ∷ xs) = Data.List.foldl (λ a b → a Data.String.++ Data.String.fromList (c ∷ []) Data.String.++ b) x xs baz : String baz = intersperseString nl (Data.List.replicate 5 foo) postulate Float : Set {-# BUILTIN FLOAT Float #-} pi : Float pi = 3.141593 -- Astronomical unit au : Float au = 1.496e11 -- m plusFloat : Float → Float → Float plusFloat a b = {! !} record Subset (A : Set) (P : A → Set) : Set where constructor _#_ field elem : A .proof : P elem
tools-src/gnu/gcc/gcc/ada/s-stratt.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
22781
<filename>tools-src/gnu/gcc/gcc/ada/s-stratt.adb ------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- S Y S T E M . S T R E A M _ A T T R I B U T E S -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-1998, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.IO_Exceptions; with Ada.Streams; use Ada.Streams; with Unchecked_Conversion; package body System.Stream_Attributes is Err : exception renames Ada.IO_Exceptions.End_Error; -- Exception raised if insufficient data read (note that the RM implies -- that Data_Error might be the appropriate choice, but AI195-00132 -- decides with a binding interpretation that End_Error is preferred). SU : constant := System.Storage_Unit; subtype SEA is Ada.Streams.Stream_Element_Array; subtype SEO is Ada.Streams.Stream_Element_Offset; generic function UC renames Unchecked_Conversion; -- Subtypes used to define Stream_Element_Array values that map -- into the elementary types, using unchecked conversion. Thin_Pointer_Size : constant := System.Address'Size; Fat_Pointer_Size : constant := System.Address'Size * 2; subtype S_AD is SEA (1 .. (Fat_Pointer_Size + SU - 1) / SU); subtype S_AS is SEA (1 .. (Thin_Pointer_Size + SU - 1) / SU); subtype S_B is SEA (1 .. (Boolean'Size + SU - 1) / SU); subtype S_C is SEA (1 .. (Character'Size + SU - 1) / SU); subtype S_F is SEA (1 .. (Float'Size + SU - 1) / SU); subtype S_I is SEA (1 .. (Integer'Size + SU - 1) / SU); subtype S_LF is SEA (1 .. (Long_Float'Size + SU - 1) / SU); subtype S_LI is SEA (1 .. (Long_Integer'Size + SU - 1) / SU); subtype S_LLF is SEA (1 .. (Long_Long_Float'Size + SU - 1) / SU); subtype S_LLI is SEA (1 .. (Long_Long_Integer'Size + SU - 1) / SU); subtype S_LLU is SEA (1 .. (UST.Long_Long_Unsigned'Size + SU - 1) / SU); subtype S_LU is SEA (1 .. (UST.Long_Unsigned'Size + SU - 1) / SU); subtype S_SF is SEA (1 .. (Short_Float'Size + SU - 1) / SU); subtype S_SI is SEA (1 .. (Short_Integer'Size + SU - 1) / SU); subtype S_SSI is SEA (1 .. (Short_Short_Integer'Size + SU - 1) / SU); subtype S_SSU is SEA (1 .. (UST.Short_Short_Unsigned'Size + SU - 1) / SU); subtype S_SU is SEA (1 .. (UST.Short_Unsigned'Size + SU - 1) / SU); subtype S_U is SEA (1 .. (UST.Unsigned'Size + SU - 1) / SU); subtype S_WC is SEA (1 .. (Wide_Character'Size + SU - 1) / SU); -- Unchecked conversions from the elementary type to the stream type function From_AD is new UC (Fat_Pointer, S_AD); function From_AS is new UC (Thin_Pointer, S_AS); function From_C is new UC (Character, S_C); function From_F is new UC (Float, S_F); function From_I is new UC (Integer, S_I); function From_LF is new UC (Long_Float, S_LF); function From_LI is new UC (Long_Integer, S_LI); function From_LLF is new UC (Long_Long_Float, S_LLF); function From_LLI is new UC (Long_Long_Integer, S_LLI); function From_LLU is new UC (UST.Long_Long_Unsigned, S_LLU); function From_LU is new UC (UST.Long_Unsigned, S_LU); function From_SF is new UC (Short_Float, S_SF); function From_SI is new UC (Short_Integer, S_SI); function From_SSI is new UC (Short_Short_Integer, S_SSI); function From_SSU is new UC (UST.Short_Short_Unsigned, S_SSU); function From_SU is new UC (UST.Short_Unsigned, S_SU); function From_U is new UC (UST.Unsigned, S_U); function From_WC is new UC (Wide_Character, S_WC); -- Unchecked conversions from the stream type to elementary type function To_AD is new UC (S_AD, Fat_Pointer); function To_AS is new UC (S_AS, Thin_Pointer); function To_C is new UC (S_C, Character); function To_F is new UC (S_F, Float); function To_I is new UC (S_I, Integer); function To_LF is new UC (S_LF, Long_Float); function To_LI is new UC (S_LI, Long_Integer); function To_LLF is new UC (S_LLF, Long_Long_Float); function To_LLI is new UC (S_LLI, Long_Long_Integer); function To_LLU is new UC (S_LLU, UST.Long_Long_Unsigned); function To_LU is new UC (S_LU, UST.Long_Unsigned); function To_SF is new UC (S_SF, Short_Float); function To_SI is new UC (S_SI, Short_Integer); function To_SSI is new UC (S_SSI, Short_Short_Integer); function To_SSU is new UC (S_SSU, UST.Short_Short_Unsigned); function To_SU is new UC (S_SU, UST.Short_Unsigned); function To_U is new UC (S_U, UST.Unsigned); function To_WC is new UC (S_WC, Wide_Character); ---------- -- I_AD -- ---------- function I_AD (Stream : access RST) return Fat_Pointer is T : S_AD; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_AD (T); end if; end I_AD; ---------- -- I_AS -- ---------- function I_AS (Stream : access RST) return Thin_Pointer is T : S_AS; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_AS (T); end if; end I_AS; --------- -- I_B -- --------- function I_B (Stream : access RST) return Boolean is T : S_B; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return Boolean'Val (T (1)); end if; end I_B; --------- -- I_C -- --------- function I_C (Stream : access RST) return Character is T : S_C; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_C (T); end if; end I_C; --------- -- I_F -- --------- function I_F (Stream : access RST) return Float is T : S_F; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_F (T); end if; end I_F; --------- -- I_I -- --------- function I_I (Stream : access RST) return Integer is T : S_I; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_I (T); end if; end I_I; ---------- -- I_LF -- ---------- function I_LF (Stream : access RST) return Long_Float is T : S_LF; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LF (T); end if; end I_LF; ---------- -- I_LI -- ---------- function I_LI (Stream : access RST) return Long_Integer is T : S_LI; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LI (T); end if; end I_LI; ----------- -- I_LLF -- ----------- function I_LLF (Stream : access RST) return Long_Long_Float is T : S_LLF; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LLF (T); end if; end I_LLF; ----------- -- I_LLI -- ----------- function I_LLI (Stream : access RST) return Long_Long_Integer is T : S_LLI; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LLI (T); end if; end I_LLI; ----------- -- I_LLU -- ----------- function I_LLU (Stream : access RST) return UST.Long_Long_Unsigned is T : S_LLU; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LLU (T); end if; end I_LLU; ---------- -- I_LU -- ---------- function I_LU (Stream : access RST) return UST.Long_Unsigned is T : S_LU; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LU (T); end if; end I_LU; ---------- -- I_SF -- ---------- function I_SF (Stream : access RST) return Short_Float is T : S_SF; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_SF (T); end if; end I_SF; ---------- -- I_SI -- ---------- function I_SI (Stream : access RST) return Short_Integer is T : S_SI; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_SI (T); end if; end I_SI; ----------- -- I_SSI -- ----------- function I_SSI (Stream : access RST) return Short_Short_Integer is T : S_SSI; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_SSI (T); end if; end I_SSI; ----------- -- I_SSU -- ----------- function I_SSU (Stream : access RST) return UST.Short_Short_Unsigned is T : S_SSU; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_SSU (T); end if; end I_SSU; ---------- -- I_SU -- ---------- function I_SU (Stream : access RST) return UST.Short_Unsigned is T : S_SU; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_SU (T); end if; end I_SU; --------- -- I_U -- --------- function I_U (Stream : access RST) return UST.Unsigned is T : S_U; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_U (T); end if; end I_U; ---------- -- I_WC -- ---------- function I_WC (Stream : access RST) return Wide_Character is T : S_WC; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_WC (T); end if; end I_WC; ---------- -- W_AD -- ---------- procedure W_AD (Stream : access RST; Item : in Fat_Pointer) is T : constant S_AD := From_AD (Item); begin Ada.Streams.Write (Stream.all, T); end W_AD; ---------- -- W_AS -- ---------- procedure W_AS (Stream : access RST; Item : in Thin_Pointer) is T : constant S_AS := From_AS (Item); begin Ada.Streams.Write (Stream.all, T); end W_AS; --------- -- W_B -- --------- procedure W_B (Stream : access RST; Item : in Boolean) is T : S_B; begin T (1) := Boolean'Pos (Item); Ada.Streams.Write (Stream.all, T); end W_B; --------- -- W_C -- --------- procedure W_C (Stream : access RST; Item : in Character) is T : constant S_C := From_C (Item); begin Ada.Streams.Write (Stream.all, T); end W_C; --------- -- W_F -- --------- procedure W_F (Stream : access RST; Item : in Float) is T : constant S_F := From_F (Item); begin Ada.Streams.Write (Stream.all, T); end W_F; --------- -- W_I -- --------- procedure W_I (Stream : access RST; Item : in Integer) is T : constant S_I := From_I (Item); begin Ada.Streams.Write (Stream.all, T); end W_I; ---------- -- W_LF -- ---------- procedure W_LF (Stream : access RST; Item : in Long_Float) is T : constant S_LF := From_LF (Item); begin Ada.Streams.Write (Stream.all, T); end W_LF; ---------- -- W_LI -- ---------- procedure W_LI (Stream : access RST; Item : in Long_Integer) is T : constant S_LI := From_LI (Item); begin Ada.Streams.Write (Stream.all, T); end W_LI; ----------- -- W_LLF -- ----------- procedure W_LLF (Stream : access RST; Item : in Long_Long_Float) is T : constant S_LLF := From_LLF (Item); begin Ada.Streams.Write (Stream.all, T); end W_LLF; ----------- -- W_LLI -- ----------- procedure W_LLI (Stream : access RST; Item : in Long_Long_Integer) is T : constant S_LLI := From_LLI (Item); begin Ada.Streams.Write (Stream.all, T); end W_LLI; ----------- -- W_LLU -- ----------- procedure W_LLU (Stream : access RST; Item : in UST.Long_Long_Unsigned) is T : constant S_LLU := From_LLU (Item); begin Ada.Streams.Write (Stream.all, T); end W_LLU; ---------- -- W_LU -- ---------- procedure W_LU (Stream : access RST; Item : in UST.Long_Unsigned) is T : constant S_LU := From_LU (Item); begin Ada.Streams.Write (Stream.all, T); end W_LU; ---------- -- W_SF -- ---------- procedure W_SF (Stream : access RST; Item : in Short_Float) is T : constant S_SF := From_SF (Item); begin Ada.Streams.Write (Stream.all, T); end W_SF; ---------- -- W_SI -- ---------- procedure W_SI (Stream : access RST; Item : in Short_Integer) is T : constant S_SI := From_SI (Item); begin Ada.Streams.Write (Stream.all, T); end W_SI; ----------- -- W_SSI -- ----------- procedure W_SSI (Stream : access RST; Item : in Short_Short_Integer) is T : constant S_SSI := From_SSI (Item); begin Ada.Streams.Write (Stream.all, T); end W_SSI; ----------- -- W_SSU -- ----------- procedure W_SSU (Stream : access RST; Item : in UST.Short_Short_Unsigned) is T : constant S_SSU := From_SSU (Item); begin Ada.Streams.Write (Stream.all, T); end W_SSU; ---------- -- W_SU -- ---------- procedure W_SU (Stream : access RST; Item : in UST.Short_Unsigned) is T : constant S_SU := From_SU (Item); begin Ada.Streams.Write (Stream.all, T); end W_SU; --------- -- W_U -- --------- procedure W_U (Stream : access RST; Item : in UST.Unsigned) is T : constant S_U := From_U (Item); begin Ada.Streams.Write (Stream.all, T); end W_U; ---------- -- W_WC -- ---------- procedure W_WC (Stream : access RST; Item : in Wide_Character) is T : constant S_WC := From_WC (Item); begin Ada.Streams.Write (Stream.all, T); end W_WC; end System.Stream_Attributes;
prototyping/Properties/Remember.agda
TheGreatSageEqualToHeaven/luau
1
10003
<filename>prototyping/Properties/Remember.agda module Properties.Remember where open import Agda.Builtin.Equality using (_≡_; refl) data Remember {A : Set} (a : A) : Set where _,_ : ∀ b → (a ≡ b) → Remember(a) remember : ∀ {A} (a : A) → Remember(a) remember a = (a , refl)
oeis/289/A289216.asm
neoneye/loda-programs
11
245659
<reponame>neoneye/loda-programs ; A289216: a(n) = n! * Laguerre(n,-10). ; Submitted by <NAME>(s2) ; 1,11,142,2086,34184,616120,12083920,255749840,5801633920,140276126080,3598075308800,97512721964800,2782552712473600,83347512973644800,2613606571616819200,85594543750221568000,2921314815145299968000,103704333851191177216000,3822435041726611283968000,146054242793364788928512000,5776758846811567983984640000,236193004070044051611811840000,9970678564268433254488801280000,434069907064862508016767139840000,19467495742199161765331151093760000,898557982320389739536880041984000000 mov $2,1 mov $3,$0 mov $4,1 lpb $3 mul $1,$3 mul $4,$3 add $1,$4 mul $1,$3 mul $2,10 cmp $4,0 add $5,$4 mov $6,$5 cmp $6,0 add $5,$6 div $1,$5 add $2,$1 sub $3,1 div $4,$5 lpe mov $0,$2
src/Equality/Groupoid.agda
nad/equality
3
14444
<reponame>nad/equality<gh_stars>1-10 ------------------------------------------------------------------------ -- The equality can be turned into a groupoid which is sometimes -- commutative ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} open import Equality module Equality.Groupoid {reflexive} (eq : ∀ {a p} → Equality-with-J a p reflexive) where open import Bijection eq using (_↔_) open Derived-definitions-and-properties eq open import Equality.Tactic eq open import Groupoid eq open import Pointed-type eq open import Prelude hiding (id; _∘_) ------------------------------------------------------------------------ -- _≡_ comes with a groupoid structure groupoid : ∀ {a} (A : Type a) → Groupoid a a groupoid A = record { Object = A ; _∼_ = _≡_ ; id = refl _ ; _∘_ = flip trans ; _⁻¹ = sym ; left-identity = trans-reflʳ ; right-identity = trans-reflˡ ; assoc = λ z≡u y≡z x≡y → trans-assoc x≡y y≡z z≡u ; left-inverse = trans-symʳ ; right-inverse = trans-symˡ } ------------------------------------------------------------------------ -- In some cases transitivity is commutative -- This proof is based on an informal proof due to Thierry Coquand, -- based on a result from homotopy theory. module Transitivity-commutative {a} {A : Type a} (e : A) (_∙_ : A → A → A) (left-identity : ∀ x → (e ∙ x) ≡ x) (right-identity : ∀ x → (x ∙ e) ≡ x) where open Groupoid (groupoid A) hiding (left-identity; right-identity) abstract commutative : (p q : e ≡ e) → p ∘ q ≡ q ∘ p commutative p q = p ∘ q ≡⟨ cong (_∘_ p) (lem₁ _) ⟩ p ∘ (ri ∘ li ⁻¹ ∘ q′ ∘ li ∘ ri ⁻¹) ≡⟨ prove (Trans (Trans (Trans (Trans (Trans (Sym (Lift ri)) (Lift li)) (Lift q′)) (Sym (Lift li))) (Lift ri)) (Lift p)) (Trans (Trans (Sym (Lift ri)) (Trans (Trans (Lift li) (Lift q′)) (Sym (Lift li)))) (Trans (Lift ri) (Lift p))) (refl _) ⟩ (p ∘ ri) ∘ (li ⁻¹ ∘ q′ ∘ li) ∘ ri ⁻¹ ≡⟨ cong₂ (λ p q → p ∘ q ∘ ri ⁻¹) (lem₂ _) (lem₃ _) ⟩ (ri ∘ lc p) ∘ rc q′ ∘ ri ⁻¹ ≡⟨ prove (Trans (Trans (Sym (Lift ri)) (Lift (rc q′))) (Trans (Lift (lc p)) (Lift ri))) (Trans (Trans (Sym (Lift ri)) (Trans (Lift (rc q′)) (Lift (lc p)))) (Lift ri)) (refl _) ⟩ ri ∘ (lc p ∘ rc q′) ∘ ri ⁻¹ ≡⟨ cong (λ p → ri ∘ p ∘ ri ⁻¹) (lem₄ _ _) ⟩ ri ∘ (rc q′ ∘ lc p) ∘ ri ⁻¹ ≡⟨ prove (Trans (Trans (Sym (Lift ri)) (Trans (Lift (lc p)) (Lift (rc q′)))) (Lift ri)) (Trans (Trans (Trans (Sym (Lift ri)) (Lift (lc p))) (Lift (rc q′))) (Lift ri)) (refl _) ⟩ ri ∘ rc q′ ∘ (lc p ∘ ri ⁻¹) ≡⟨ cong₂ (λ p q → ri ∘ p ∘ q) (sym (lem₃ _)) (lem₅ _) ⟩ ri ∘ (li ⁻¹ ∘ q′ ∘ li) ∘ (ri ⁻¹ ∘ p) ≡⟨ prove (Trans (Trans (Trans (Lift p) (Sym (Lift ri))) (Trans (Trans (Lift li) (Lift q′)) (Sym (Lift li)))) (Lift ri)) (Trans (Lift p) (Trans (Trans (Trans (Trans (Sym (Lift ri)) (Lift li)) (Lift q′)) (Sym (Lift li))) (Lift ri))) (refl _) ⟩ (ri ∘ li ⁻¹ ∘ q′ ∘ li ∘ ri ⁻¹) ∘ p ≡⟨ cong (λ q → q ∘ p) (sym (lem₁ _)) ⟩∎ q ∘ p ∎ where -- Abbreviations. li : ∀ {x} → (e ∙ x) ≡ x li = left-identity _ ri : ∀ {x} → (x ∙ e) ≡ x ri = right-identity _ q′ : e ≡ e q′ = li ∘ ri ⁻¹ ∘ q ∘ ri ∘ li ⁻¹ lc : ∀ {x y} → x ≡ y → (x ∙ e) ≡ (y ∙ e) lc = cong (λ x → (x ∙ e)) rc : ∀ {x y} → x ≡ y → (e ∙ x) ≡ (e ∙ y) rc = cong (λ y → (e ∙ y)) -- Lemmas. lem₁ : (p : e ≡ e) → p ≡ ri ∘ li ⁻¹ ∘ (li ∘ ri ⁻¹ ∘ p ∘ ri ∘ li ⁻¹) ∘ li ∘ ri ⁻¹ lem₁ p = p ≡⟨ prove (Lift p) (Trans (Trans Refl (Lift p)) Refl) (refl _) ⟩ refl _ ∘ p ∘ refl _ ≡⟨ sym (cong₂ (λ q r → q ∘ p ∘ r) (right-inverse _) (right-inverse _)) ⟩ (ri ∘ ri ⁻¹) ∘ p ∘ (ri ∘ ri ⁻¹) ≡⟨ prove (Trans (Trans (Trans (Sym (Lift ri)) (Lift ri)) (Lift p)) (Trans (Sym (Lift ri)) (Lift ri))) (Trans (Trans (Trans (Trans (Trans (Trans (Sym (Lift ri)) Refl) (Lift ri)) (Lift p)) (Sym (Lift ri))) Refl) (Lift ri)) (refl _) ⟩ ri ∘ refl _ ∘ ri ⁻¹ ∘ p ∘ ri ∘ refl _ ∘ ri ⁻¹ ≡⟨ sym (cong₂ (λ q r → ri ∘ q ∘ ri ⁻¹ ∘ p ∘ ri ∘ r ∘ ri ⁻¹) (left-inverse _) (left-inverse _)) ⟩ ri ∘ (li ⁻¹ ∘ li) ∘ ri ⁻¹ ∘ p ∘ ri ∘ (li ⁻¹ ∘ li) ∘ ri ⁻¹ ≡⟨ prove (Trans (Trans (Trans (Trans (Trans (Trans (Sym (Lift ri)) (Trans (Lift li) (Sym (Lift li)))) (Lift ri)) (Lift p)) (Sym (Lift ri))) (Trans (Lift li) (Sym (Lift li)))) (Lift ri)) (Trans (Trans (Trans (Trans (Sym (Lift ri)) (Lift li)) (Trans (Trans (Trans (Trans (Sym (Lift li)) (Lift ri)) (Lift p)) (Sym (Lift ri))) (Lift li))) (Sym (Lift li))) (Lift ri)) (refl _) ⟩∎ ri ∘ li ⁻¹ ∘ (li ∘ ri ⁻¹ ∘ p ∘ ri ∘ li ⁻¹) ∘ li ∘ ri ⁻¹ ∎ lem₂ : ∀ {x y} (p : x ≡ y) → p ∘ ri ≡ ri ∘ lc p lem₂ = elim (λ p → p ∘ ri ≡ ri ∘ lc p) λ _ → prove (Trans (Lift ri) Refl) (Trans (Cong (λ x → (x ∙ e)) Refl) (Lift ri)) (refl _) lem₃ : ∀ {x y} (p : x ≡ y) → li ⁻¹ ∘ p ∘ li ≡ rc p lem₃ = elim (λ p → li ⁻¹ ∘ p ∘ li ≡ rc p) λ x → li ⁻¹ ∘ refl x ∘ li ≡⟨ prove (Trans (Trans (Lift li) Refl) (Sym (Lift li))) (Trans (Lift li) (Sym (Lift li))) (refl _) ⟩ li ⁻¹ ∘ li ≡⟨ left-inverse _ ⟩ refl (e ∙ x) ≡⟨ prove Refl (Cong (λ y → (e ∙ y)) Refl) (refl _) ⟩∎ rc (refl x) ∎ lem₄ : (p q : e ≡ e) → lc p ∘ rc q ≡ rc q ∘ lc p lem₄ p q = elim (λ {x y} x≡y → lc x≡y ∘ cong (λ z → (x ∙ z)) q ≡ cong (λ z → (y ∙ z)) q ∘ lc x≡y) (λ x → prove (Trans (Cong (λ z → x ∙ z) (Lift q)) (Cong (λ x → x ∙ e) Refl)) (Trans (Cong (λ x → x ∙ e) Refl) (Cong (λ z → x ∙ z) (Lift q))) (refl _)) p lem₅ : ∀ {x y} (p : x ≡ y) → lc p ∘ ri ⁻¹ ≡ ri ⁻¹ ∘ p lem₅ = elim (λ p → lc p ∘ ri ⁻¹ ≡ ri ⁻¹ ∘ p) λ _ → prove (Trans (Sym (Lift ri)) (Cong (λ x → (x ∙ e)) Refl)) (Trans Refl (Sym (Lift ri))) (refl _) -- In particular, transitivity is commutative for proofs in -- proj₁ (Ω[ 2 + n ] X). Ω[2+n]-commutative : ∀ {x} {X : Pointed-type x} n → (p q : proj₁ (Ω[ 2 + n ] X)) → trans p q ≡ trans q p Ω[2+n]-commutative {X = X} n p q = Transitivity-commutative.commutative id _∘_ left-identity right-identity q p where open Groupoid (groupoid (proj₁ (Ω[ n ] X)))
oeis/183/A183623.asm
neoneye/loda-programs
11
245928
; A183623: Number of (n+1)X(n+1) 0..2 arrays with every 2X2 subblock summing to 4 ; Submitted by <NAME> ; 19,87,355,1383,5299,20247,77635,299463,1162579,4540407 add $0,2 mov $2,4 pow $2,$0 seq $0,101052 ; Number of preferential arrangements of n labeled elements when only k<=3 ranks are allowed. mul $0,2 add $0,$2 sub $0,3
src/Categories/Category/Groupoid/Properties.agda
Trebor-Huang/agda-categories
279
17452
<gh_stars>100-1000 {-# OPTIONS --without-K --safe #-} open import Categories.Category.Groupoid module Categories.Category.Groupoid.Properties {o ℓ e} (G : Groupoid o ℓ e) where import Categories.Morphism as Morphism import Categories.Morphism.Properties as MorphismProps import Categories.Morphism.Reasoning as MR open Groupoid G open Morphism category open MorphismProps category open HomReasoning open MR category private variable A B C : Obj mono : {f : A ⇒ B} → Mono f mono = Iso⇒Mono iso epi : {f : A ⇒ B} → Epi f epi = Iso⇒Epi iso id-inverse : id {A = A} ⁻¹ ≈ id id-inverse = ⟺ identityˡ ○ iso.isoʳ ⁻¹-involutive : {f : A ⇒ B} → f ⁻¹ ⁻¹ ≈ f ⁻¹-involutive {f = f} = begin f ⁻¹ ⁻¹ ≈⟨ introʳ iso.isoˡ ⟩ f ⁻¹ ⁻¹ ∘ f ⁻¹ ∘ f ≈⟨ sym-assoc ○ elimˡ iso.isoˡ ⟩ f ∎ ⁻¹-commute : {f : A ⇒ B} {g : C ⇒ A} → (f ∘ g) ⁻¹ ≈ g ⁻¹ ∘ f ⁻¹ ⁻¹-commute {f = f} {g} = epi _ _ ( begin (f ∘ g) ⁻¹ ∘ f ∘ g ≈⟨ iso.isoˡ ⟩ id ≈˘⟨ iso.isoˡ ⟩ g ⁻¹ ∘ g ≈˘⟨ cancelInner iso.isoˡ ⟩ (g ⁻¹ ∘ f ⁻¹) ∘ f ∘ g ∎ )
dropin/src/yaml-c.ads
robdaemon/AdaYaml
32
19804
-- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" with System; with Interfaces.C.Strings; private with Yaml.Parser; private with Yaml.Presenter; package Yaml.C is -- this is an implementation of libyaml's C interface declared in yaml.h function Get_Version_String return Interfaces.C.Strings.chars_ptr with Export, Convention => C, External_Name => "yaml_get_version_string"; procedure Get_Version (Major, Minor, Patch : out Interfaces.C.int) with Export, Convention => C, External_Name => "yaml_get_version"; type Encoding_Type is (Any, UTF8, UTF16LE, UTF16BE) with Convention => C; type Bool is new Boolean with Convention => C; for Bool'Size use Interfaces.C.int'Size; type Error_Type is (No_Error, Memory_Error, Reader_Error, Scanner_Error, Parser_Error, Composer_Error, Writer_Error, Emitter_Error) with Convention => C; procedure Token_Delete (Token : System.Address) with Export, Convention => C, External_Name => "yaml_token_delete"; type Event_Type is (No_Event, Stream_Start, Stream_End, Document_Start, Document_End, Alias, Scalar, Sequence_Start, Sequence_End, Mapping_Start, Mapping_End, Annotation_Start, Annotation_End) with Convention => C; type Event_Data (T : Event_Type := No_Event) is record case T is when Stream_Start => Encoding : Encoding_Type; when Document_Start => -- TODO: make available from parser Version_Directive, Start_Dir, End_Dir : System.Address; DS_Implicit : Bool; when Document_End => DE_Implicit : Bool; when Alias => Ali_Anchor : Text.Exported; when Scalar => Scalar_Anchor, Scalar_Tag, Value : Text.Exported; Length : Interfaces.C.size_t; Plain_Implicit, Quoted_Implicit : Bool; Scalar_Style : Scalar_Style_Type; when Sequence_Start => Seq_Anchor, Seq_Tag : Text.Exported; Seq_Implicit : Bool; Seq_Style : Collection_Style_Type; when Mapping_Start => Map_Anchor, Map_Tag : Text.Exported; Map_Implicit : Bool; Map_Style : Collection_Style_Type; when Annotation_Start => Ann_Anchor, Ann_Tag : Text.Exported; Ann_Name : Text.Exported; when others => null; end case; end record with Unchecked_Union, Convention => C; type C_Mark is record Index, Line, Column : Interfaces.C.size_t; end record; type Event is record Kind : Event_Type; Data : Event_Data; Start_Mark, End_Mark : C_Mark; end record with Convention => C; type Event_Access is access Event with Convention => C; type Read_Handler is access function (Data, Buffer : System.Address; Size : Interfaces.C.size_t; Size_Read : out Interfaces.C.size_t) return Bool with Convention => C; type Write_Handler is access function (Data, Buffer : System.Address; Size : Interfaces.C.size_t) return Bool with Convention => C; function Stream_Start_Event_Initialize (E : out Event; Encoding : Encoding_Type) return Bool with Export, Convention => C, External_Name => "yaml_stream_start_event_initialize"; function Stream_End_Event_Initialize (E : out Event) return Bool with Export, Convention => C, External_Name => "yaml_stream_end_event_initialize"; function Document_Start_Event_Initialize (E : out Event; Version_Directive, Tag_Directive_Start, Tag_Directive_End : System.Address; Implicit : Bool) return Bool with Export, Convention => C, External_Name => "yaml_document_start_event_initialize"; function Document_End_Event_Initialize (E : out Event; Implicit : Bool) return Bool with Export, Convention => C, External_Name => "yaml_document_end_event_initialize"; function Alias_Event_Initialize (E : out Event; Anchor : Interfaces.C.Strings.chars_ptr) return Bool with Export, Convention => C, External_Name => "yaml_alias_event_initialize"; function Scalar_Event_Initialize (E : out Event; Anchor, Tag, Value : Interfaces.C.Strings.chars_ptr; Plain_Implicit, Quoted_Implicit : Bool; Style : Scalar_Style_Type) return Bool with Export, Convention => C, External_Name => "yaml_scalar_event_initialize"; function Sequence_Start_Event_Initialize (E : out Event; Anchor, Tag : Interfaces.C.Strings.chars_ptr; Implicit : Bool; Style : Collection_Style_Type) return Bool with Export, Convention => C, External_Name => "yaml_sequence_start_event_initialize"; function Sequence_End_Event_Initialize (E : out Event) return Bool with Export, Convention => C, External_Name => "yaml_sequence_end_event_initialize"; function Mapping_Start_Event_Initialize (E : out Event; Anchor, Tag : Interfaces.C.Strings.chars_ptr; Implicit : Bool; Style : Collection_Style_Type) return Bool with Export, Convention => C, External_Name => "yaml_mapping_start_event_initialize"; function Mapping_End_Event_Initialize (E : out Event) return Bool with Export, Convention => C, External_Name => "yaml_mapping_end_event_initialize"; procedure Event_Delete (E : in out Event) with Export, Convention => C, External_Name => "yaml_event_delete"; function Document_Initialize (Document, Version_Directive, Tag_Directives_Start, Tag_Directives_End : System.Address; Start_Implicit, End_Implicit : Bool) return Bool with Export, Convention => C, External_Name => "yaml_document_initialize"; procedure Document_Delete (Document : System.Address) with Export, Convention => C, External_Name => "yaml_document_delete"; function Document_Get_Node (Document : System.Address; Index : Interfaces.C.int) return System.Address with Export, Convention => C, External_Name => "yaml_document_get_node"; function Document_Get_Root_Node (Document : System.Address) return System.Address with Export, Convention => C, External_Name => "yaml_document_get_root_node"; function Document_Add_Scalar (Document : System.Address; Tag, Value : Interfaces.C.Strings.chars_ptr; Length : Interfaces.C.int; Style : Scalar_Style_Type) return Bool with Export, Convention => C, External_Name => "yaml_document_add_scalar"; function Document_Add_Sequence (Document : System.Address; Tag : Interfaces.C.Strings.chars_ptr; Style : Collection_Style_Type) return Bool with Export, Convention => C, External_Name => "yaml_document_add_sequence"; function Document_Add_Mapping (Document : System.Address; Tag : Interfaces.C.Strings.chars_ptr; Style : Collection_Style_Type) return Bool with Export, Convention => C, External_Name => "yaml_document_add_mapping"; function Document_Append_Sequence_Item (Document : System.Address; Sequence, Item : Interfaces.C.int) return Bool with Export, Convention => C, External_Name => "yaml_document_append_sequence_item"; function Document_Append_Mapping_Pair (Document : System.Address; Mapping, Key, Value : Interfaces.C.int) return Bool with Export, Convention => C, External_Name => "yaml_document_append_mapping_pair"; type Parser_Type is limited private; function Parser_Initialize (P : in out Parser_Type) return Bool with Export, Convention => C, External_Name => "yaml_parser_initialize"; procedure Parser_Delete (P : in out Parser_Type) with Export, Convention => C, External_Name => "yaml_parser_delete"; procedure Parser_Set_Input_String (P : in out Parser_Type; Input : Interfaces.C.Strings.chars_ptr; Size : Interfaces.C.size_t) with Export, Convention => C, External_Name => "yaml_parser_set_input_string"; procedure Parser_Set_Input_File (P : in out Parser_Type; File : System.Address) with Export, Convention => C, External_Name => "yaml_parser_set_input_file"; procedure Parser_Set_Input (P : in out Parser_Type; Handler : Read_Handler; Data : System.Address) with Export, Convention => C, External_Name => "yaml_parser_set_input"; procedure Parser_Set_Encoding (P : in out Parser_Type; Encoding : Encoding_Type) with Export, Convention => C, External_Name => "yaml_parser_set_encoding"; function Parser_Scan (P : in out Parser_Type; Token : System.Address) return Bool with Export, Convention => C, External_Name => "yaml_parser_scan"; function Parser_Parse (P : in out Parser_Type; E : out Event) return Bool with Export, Convention => C, External_Name => "yaml_parser_parse"; function Parser_Load (P : in out Parser_Type; Document : System.Address) return Bool with Export, Convention => C, External_Name => "yaml_parser_load"; type Emitter_Type is limited private; function Emitter_Initialize (Emitter : in out Emitter_Type) return Bool with Export, Convention => C, External_Name => "yaml_emitter_initialize"; procedure Emitter_Delete (Emitter : in out Emitter_Type) with Export, Convention => C, External_Name => "yaml_emitter_delete"; procedure Emitter_Set_Output_String (Emitter : in out Emitter_Type; Output : System.Address; Size : Interfaces.C.size_t; Size_Written : access Interfaces.C.size_t) with Export, Convention => C, External_Name => "yaml_emitter_set_output_string"; procedure Emitter_Set_Output_File (Emitter : in out Emitter_Type; File : System.Address) with Export, Convention => C, External_Name => "yaml_emitter_set_output_file"; procedure Emitter_Set_Output (Emitter : in out Emitter_Type; Handler : Write_Handler; Data : System.Address) with Export, Convention => C, External_Name => "yaml_emitter_set_output"; function Emitter_Emit (Emitter : in out Emitter_Type; E : in out Event) return Bool with Export, Convention => C, External_Name => "yaml_emitter_emit"; private type Parser_Pointer is access Parser.Instance; type Parser_Type is limited record Error : Error_Type; Problem : Interfaces.C.Strings.chars_ptr; Ptr : Parser_Pointer; end record with Convention => C; type Presenter_Pointer is access Presenter.Instance; type Emitter_Type is limited record Error : Error_Type; Problem : Interfaces.C.Strings.chars_ptr; Ptr : Presenter_Pointer; end record with Convention => C; end Yaml.C;
Code/CustomControl/SpreadSheet/SprDemo/SprCellFmt.asm
CherryDT/FbEditMOD
11
247620
.const ;SprShtCellFmt.dlg IDC_CHK6 equ 1128 IDC_CHK7 equ 1109 IDC_STC3 equ 1116 IDC_STC4 equ 1117 IDC_STC5 equ 1118 IDC_STC6 equ 1119 IDC_CHK1 equ 1101 IDC_RBN1 equ 1102 IDC_RBN2 equ 1103 IDC_RBN3 equ 1104 IDC_RBN4 equ 1105 IDC_RBN5 equ 1106 IDC_RBN6 equ 1107 IDC_RBN7 equ 1108 IDC_CHK5 equ 1129 IDC_RBN8 equ 1122 IDC_RBN9 equ 1123 IDC_RBN10 equ 1124 IDC_RBN11 equ 1125 IDC_RBN12 equ 1126 IDC_RBN13 equ 1127 IDC_CHK2 equ 1112 IDC_CHK3 equ 1113 IDC_CHK4 equ 1111 IDC_EDT1 equ 1114 IDC_UDN1 equ 1115 ;Font IDC_CHK8 equ 1130 IDC_CBO1 equ 1110 IDC_STC1 equ 1120 IDC_BTN1 equ 1121 ;Size IDC_CHK14 equ 1132 IDC_CHK15 equ 1134 IDC_STC14 equ 1135 IDC_STC18 equ 1136 IDC_EDT9 equ 1131 IDC_EDT10 equ 1133 .data? bckcol dd ? txtcol dd ? txtal db ? imgal db ? decimal db ? cwt dd ? rht dd ? .code SetCState proc uses ebx esi,hWin:DWORD LOCAL fnt:FONT ;Back color invoke IsDlgButtonChecked,hWin,IDC_CHK6 xor eax,1 mov ebx,eax invoke GetDlgItem,hWin,IDC_STC3 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_STC5 invoke EnableWindow,eax,ebx mov eax,spri.fmt.bckcol .if !ebx || eax==-1 mov eax,gfmt.cell.bckcol .endif mov bckcol,eax ;Text color invoke IsDlgButtonChecked,hWin,IDC_CHK7 xor eax,1 mov ebx,eax invoke GetDlgItem,hWin,IDC_STC4 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_STC6 invoke EnableWindow,eax,ebx mov eax,spri.fmt.txtcol .if !ebx || eax==-1 mov eax,gfmt.cell.txtcol .endif mov txtcol,eax ;Text alignment invoke IsDlgButtonChecked,hWin,IDC_CHK1 xor eax,1 mov ebx,eax invoke GetDlgItem,hWin,IDC_RBN1 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN2 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN3 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN4 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN5 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN6 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN7 invoke EnableWindow,eax,ebx mov al,spri.fmt.txtal mov dl,al and dl,FMTA_MASK .if !ebx || dl==FMTA_GLOBAL mov al,gfmt.cell.txtal .endif and al,FMTA_MASK and txtal,FMTD_MASK or txtal,al and al,FMTA_XMASK .if al==FMTA_AUTO invoke CheckRadioButton,hWin,IDC_RBN1,IDC_RBN4,IDC_RBN1 .elseif al==FMTA_LEFT invoke CheckRadioButton,hWin,IDC_RBN1,IDC_RBN4,IDC_RBN2 .elseif al==FMTA_CENTER invoke CheckRadioButton,hWin,IDC_RBN1,IDC_RBN4,IDC_RBN3 .elseif al==FMTA_RIGHT invoke CheckRadioButton,hWin,IDC_RBN1,IDC_RBN4,IDC_RBN4 .endif mov al,txtal and al,FMTA_YMASK .if al==FMTA_TOP invoke CheckRadioButton,hWin,IDC_RBN5,IDC_RBN7,IDC_RBN5 .elseif al==FMTA_MIDDLE invoke CheckRadioButton,hWin,IDC_RBN5,IDC_RBN7,IDC_RBN6 .elseif al==FMTA_BOTTOM invoke CheckRadioButton,hWin,IDC_RBN5,IDC_RBN7,IDC_RBN7 .endif ;Image alignment invoke IsDlgButtonChecked,hWin,IDC_CHK5 xor eax,1 mov ebx,eax invoke GetDlgItem,hWin,IDC_RBN8 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN9 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN10 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN11 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN12 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_RBN13 invoke EnableWindow,eax,ebx mov al,spri.fmt.imgal and al,FMTA_MASK .if !ebx || al==FMTA_GLOBAL mov al,gfmt.cell.imgal .endif mov imgal,al and al,FMTA_XMASK .if al==FMTA_LEFT invoke CheckRadioButton,hWin,IDC_RBN8,IDC_RBN10,IDC_RBN8 .elseif al==FMTA_CENTER invoke CheckRadioButton,hWin,IDC_RBN8,IDC_RBN10,IDC_RBN9 .elseif al==FMTA_RIGHT invoke CheckRadioButton,hWin,IDC_RBN8,IDC_RBN10,IDC_RBN10 .endif mov al,imgal and al,FMTA_YMASK .if al==FMTA_TOP invoke CheckRadioButton,hWin,IDC_RBN11,IDC_RBN13,IDC_RBN11 .elseif al==FMTA_MIDDLE invoke CheckRadioButton,hWin,IDC_RBN11,IDC_RBN13,IDC_RBN12 .elseif al==FMTA_BOTTOM invoke CheckRadioButton,hWin,IDC_RBN11,IDC_RBN13,IDC_RBN13 .endif ;Decimals invoke IsDlgButtonChecked,hWin,IDC_CHK2 xor eax,1 mov ebx,eax invoke GetDlgItem,hWin,IDC_CHK3 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_CHK4 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_EDT1 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_UDN1 invoke EnableWindow,eax,ebx .if ebx invoke IsDlgButtonChecked,hWin,IDC_CHK3 xor eax,1 mov ebx,eax invoke GetDlgItem,hWin,IDC_EDT1 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_UDN1 invoke EnableWindow,eax,ebx .if !ebx and txtal,FMTA_MASK or txtal,FMTD_SCI .endif .endif .if ebx invoke IsDlgButtonChecked,hWin,IDC_CHK4 xor eax,1 mov ebx,eax invoke GetDlgItem,hWin,IDC_EDT1 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_UDN1 invoke EnableWindow,eax,ebx .if !ebx and txtal,FMTA_MASK or txtal,FMTD_ALL .endif .endif ;Font invoke IsDlgButtonChecked,hWin,IDC_CHK8 xor eax,1 mov ebx,eax invoke GetDlgItem,hWin,IDC_CBO1 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_BTN1 invoke EnableWindow,eax,ebx movzx esi,spri.fmt.fnt .if !ebx || esi==0FFh movzx esi,gfmt.cell.fnt .endif invoke SendDlgItemMessage,hWin,IDC_CBO1,CB_SETCURSEL,esi,0 invoke SendMessage,hSht,SPRM_GETFONT,esi,addr fnt mov eax,fnt.hfont invoke SendDlgItemMessage,hWin,IDC_STC1,WM_SETFONT,eax,TRUE ;Size invoke IsDlgButtonChecked,hWin,IDC_CHK14 xor eax,1 mov ebx,eax invoke GetDlgItem,hWin,IDC_STC14 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_EDT9 invoke EnableWindow,eax,ebx mov eax,cwt .if !ebx mov eax,gfmt.gcellwt .endif invoke SetDlgItemInt,hWin,IDC_EDT9,eax,FALSE invoke IsDlgButtonChecked,hWin,IDC_CHK15 xor eax,1 mov ebx,eax invoke GetDlgItem,hWin,IDC_STC18 invoke EnableWindow,eax,ebx invoke GetDlgItem,hWin,IDC_EDT10 invoke EnableWindow,eax,ebx mov eax,rht .if !ebx mov eax,gfmt.gcellht .endif invoke SetDlgItemInt,hWin,IDC_EDT10,eax,FALSE invoke InvalidateRect,hWin,NULL,FALSE ret SetCState endp InitFonts proc uses ebx,hWin:DWORD LOCAL fnt:FONT LOCAL buffer[256]:BYTE LOCAL buffer1[256]:BYTE invoke SendDlgItemMessage,hWin,IDC_CBO1,CB_RESETCONTENT,0,0 xor ecx,ecx .while ecx<16 push ecx invoke SendMessage,hSht,SPRM_GETFONT,ecx,addr fnt mov al,fnt.face .if al invoke lstrcpy,addr buffer,addr fnt.face mov dword ptr buffer1,' ,' invoke wsprintfA,addr buffer1[2],offset fmtStr,fnt.fsize invoke lstrcat,addr buffer,addr buffer1 lea eax,buffer .else mov eax,offset szNONE .endif invoke SendDlgItemMessage,hWin,IDC_CBO1,CB_ADDSTRING,0,eax pop ecx inc ecx .endw ret InitFonts endp GetFont proc hWin:DWORD LOCAL nInx:DWORD LOCAL fnt:FONT LOCAL cf:CHOOSEFONT LOCAL lf:LOGFONT invoke RtlZeroMemory,addr cf,sizeof cf invoke RtlZeroMemory,addr lf,sizeof lf movzx edx,spri.fmt.fnt .if dl==-1 movzx edx,gfmt.cell.fnt .endif invoke SendMessage,hSht,SPRM_GETFONT,edx,addr fnt mov eax,fnt.ht mov lf.lfHeight,eax mov al,fnt.bold mov edx,200 .if al shl edx,1 .endif mov lf.lfWeight,edx invoke lstrcpy,addr lf.lfFaceName,addr fnt.face mov cf.lStructSize,sizeof cf mov eax,hWin mov cf.hwndOwner,eax lea eax,lf mov cf.lpLogFont,eax mov cf.Flags,CF_SCREENFONTS or CF_INITTOLOGFONTSTRUCT invoke ChooseFont,addr cf .if eax invoke lstrcpy,addr fnt.face,addr lf.lfFaceName mov eax,cf.iPointSize xor edx,edx mov ecx,10 div ecx mov fnt.fsize,eax mov eax,lf.lfHeight mov fnt.ht,eax mov eax,lf.lfWeight .if eax>=700 mov fnt.bold,TRUE .endif movzx eax,lf.lfItalic mov fnt.italic,al movzx eax,lf.lfUnderline mov fnt.underline,al movzx eax,lf.lfStrikeOut mov fnt.strikeout,al movzx edx,spri.fmt.fnt .if dl==-1 movzx edx,gfmt.cell.fnt .endif invoke SendMessage,hSht,SPRM_SETFONT,edx,addr fnt invoke InitFonts,hWin .else mov eax,-1 .endif ret GetFont endp CellFmtProc proc uses ebx,hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM LOCAL rect:RECT mov eax,uMsg .if eax==WM_INITDIALOG ;Create a brush invoke CreateSolidBrush,0 mov hBrTmp,eax ;Get global spread sheet data invoke SendMessage,hSht,SPRM_GETGLOBAL,0,offset gfmt ;Get cell data lea ebx,spri invoke SendMessage,hSht,SPRM_GETCURRENTCELL,0,0 mov edx,eax and eax,0FFFFh shr edx,16 mov [ebx].SPR_ITEM.flag,SPRIF_BACKCOLOR or SPRIF_TEXTCOLOR or SPRIF_TEXTALIGN or SPRIF_IMAGEALIGN or SPRIF_FONT or SPRIF_WIDTH or SPRIF_HEIGHT mov [ebx].SPR_ITEM.col,eax mov [ebx].SPR_ITEM.row,edx invoke SendMessage,hSht,SPRM_GETCELLDATA,0,ebx mov eax,[ebx].SPR_ITEM.fmt.bckcol ;Color .if eax==-1 invoke CheckDlgButton,hWin,IDC_CHK6,BST_CHECKED .endif mov eax,[ebx].SPR_ITEM.fmt.txtcol .if eax==-1 invoke CheckDlgButton,hWin,IDC_CHK7,BST_CHECKED .endif ;Alignment mov al,[ebx].SPR_ITEM.fmt.txtal and al,FMTA_MASK .if al==FMTA_GLOBAL invoke CheckDlgButton,hWin,IDC_CHK1,BST_CHECKED .endif mov al,[ebx].SPR_ITEM.fmt.imgal and al,FMTA_MASK .if al==FMTA_GLOBAL invoke CheckDlgButton,hWin,IDC_CHK5,BST_CHECKED .endif ;Decimals invoke SendDlgItemMessage,hWin,IDC_UDN1,UDM_SETRANGE,0,0000000Ch ;Set range movzx eax,[ebx].SPR_ITEM.fmt.txtal and al,FMTD_MASK .if al==FMTD_GLOBAL invoke CheckDlgButton,hWin,IDC_CHK2,BST_CHECKED invoke CheckDlgButton,hWin,IDC_CHK3,BST_UNCHECKED invoke CheckDlgButton,hWin,IDC_CHK4,BST_UNCHECKED movzx eax,gfmt.cell.txtal and al,FMTD_MASK .elseif al==FMTD_SCI invoke CheckDlgButton,hWin,IDC_CHK3,BST_CHECKED invoke CheckDlgButton,hWin,IDC_CHK4,BST_UNCHECKED mov eax,2 .elseif al==FMTD_ALL invoke CheckDlgButton,hWin,IDC_CHK4,BST_CHECKED invoke CheckDlgButton,hWin,IDC_CHK3,BST_UNCHECKED mov eax,2 .endif invoke SendDlgItemMessage,hWin,IDC_UDN1,UDM_SETPOS,0,eax ;Set default value ;Fonts invoke InitFonts,hWin mov al,spri.fmt.fnt .if al==-1 invoke CheckDlgButton,hWin,IDC_CHK8,BST_CHECKED .endif ;Size mov eax,spri.wt .if eax==-1 invoke CheckDlgButton,hWin,IDC_CHK14,BST_CHECKED mov eax,gfmt.gcellwt .endif mov cwt,eax invoke SetDlgItemInt,hWin,IDC_EDT9,eax,FALSE mov eax,spri.ht .if eax==-1 invoke CheckDlgButton,hWin,IDC_CHK15,BST_CHECKED mov eax,gfmt.gcellht .endif mov rht,eax invoke SetDlgItemInt,hWin,IDC_EDT10,eax,FALSE invoke SetCState,hWin .elseif eax==WM_COMMAND mov eax,wParam mov edx,eax shr edx,16 and eax,0FFFFh .if edx==BN_CLICKED .if eax==IDOK ;Back color invoke IsDlgButtonChecked,hWin,IDC_CHK6 .if eax mov spri.fmt.bckcol,-1 .endif ;Text color invoke IsDlgButtonChecked,hWin,IDC_CHK7 .if eax mov spri.fmt.txtcol,-1 .endif ;Text alignment invoke IsDlgButtonChecked,hWin,IDC_CHK1 .if eax mov al,FMTA_GLOBAL .else mov al,txtal .endif and al,FMTA_MASK mov spri.fmt.txtal,al ;Decimals invoke IsDlgButtonChecked,hWin,IDC_CHK2 .if eax mov al,FMTD_GLOBAL .else mov al,txtal .endif and al,FMTD_MASK and spri.fmt.txtal,FMTA_MASK or spri.fmt.txtal,al ;Image alignment invoke IsDlgButtonChecked,hWin,IDC_CHK5 .if eax mov al,FMTA_GLOBAL .else mov al,imgal .endif and al,FMTA_MASK mov spri.fmt.imgal,al ;Image list index mov al,imgal and al,FMTD_MASK or spri.fmt.imgal,al ;Font invoke IsDlgButtonChecked,hWin,IDC_CHK8 .if eax mov spri.fmt.fnt,-1 .endif ;Size invoke IsDlgButtonChecked,hWin,IDC_CHK14 .if eax mov spri.wt,-1 .else mov eax,cwt mov spri.wt,eax .endif invoke IsDlgButtonChecked,hWin,IDC_CHK15 .if eax mov spri.ht,-1 .else mov eax,rht mov spri.ht,eax .endif invoke SendMessage,hSht,SPRM_GETMULTISEL,0,addr rect mov edx,rect.top .while edx<=rect.bottom mov ecx,rect.left .while ecx<=rect.right push ecx push edx mov spri.col,ecx mov spri.row,edx invoke SendMessage,hSht,SPRM_SETCELLDATA,0,offset spri pop edx pop ecx inc ecx .endw inc edx .endw invoke SendMessage,hWin,WM_CLOSE,NULL,NULL .elseif eax==IDCANCEL invoke SendMessage,hWin,WM_CLOSE,NULL,NULL .elseif eax==IDC_CHK6 invoke SetCState,hWin .elseif eax==IDC_CHK7 invoke SetCState,hWin .elseif eax==IDC_STC3 invoke GetColor,hWin,bckcol .if eax!=-1 mov spri.fmt.bckcol,eax invoke SetCState,hWin .endif .elseif eax==IDC_STC4 invoke GetColor,hWin,txtcol .if eax!=-1 mov spri.fmt.txtcol,eax invoke SetCState,hWin .endif .elseif eax==IDC_CHK1 invoke SetCState,hWin .elseif eax>=IDC_RBN1 && eax<=IDC_RBN4 sub eax,IDC_RBN1 shl al,4 mov dl,txtal and dl,FMTA_YMASK or FMTD_MASK or al,dl mov spri.fmt.txtal,al invoke SetCState,hWin .elseif eax>=IDC_RBN5 && eax<=IDC_RBN7 sub eax,IDC_RBN5 shl al,6 mov dl,txtal and dl,FMTA_XMASK or FMTD_MASK or al,dl mov spri.fmt.txtal,al invoke SetCState,hWin .elseif eax==IDC_CHK5 invoke SetCState,hWin .elseif eax==IDC_CHK2 invoke CheckDlgButton,hWin,IDC_CHK3,BST_UNCHECKED invoke CheckDlgButton,hWin,IDC_CHK4,BST_UNCHECKED invoke SetCState,hWin .elseif eax==IDC_CHK3 invoke CheckDlgButton,hWin,IDC_CHK4,BST_UNCHECKED invoke SetCState,hWin .elseif eax==IDC_CHK4 invoke CheckDlgButton,hWin,IDC_CHK3,BST_UNCHECKED invoke SetCState,hWin .elseif eax==IDC_CHK8 invoke SetCState,hWin .elseif eax==IDC_BTN1 invoke GetFont,hWin invoke SetCState,hWin .elseif eax==IDC_CHK14 invoke SetCState,hWin .elseif eax==IDC_CHK15 invoke SetCState,hWin .endif .elseif edx==EN_CHANGE .if eax==IDC_EDT9 invoke IsDlgButtonChecked,hWin,IDC_CHK14 .if !eax invoke GetDlgItemInt,hWin,IDC_EDT9,NULL,FALSE mov cwt,eax .endif .elseif eax==IDC_EDT10 invoke IsDlgButtonChecked,hWin,IDC_CHK15 .if !eax invoke GetDlgItemInt,hWin,IDC_EDT10,NULL,FALSE mov rht,eax .endif .elseif eax==IDC_EDT1 invoke IsDlgButtonChecked,hWin,IDC_CHK2 .if !eax invoke IsDlgButtonChecked,hWin,IDC_CHK3 .if !eax invoke IsDlgButtonChecked,hWin,IDC_CHK4 .if !eax invoke GetDlgItemInt,hWin,IDC_EDT1,NULL,FALSE mov ah,txtal and ah,FMTA_MASK or al,ah mov txtal,al .endif .endif .endif .endif .elseif edx==CBN_SELCHANGE invoke SendDlgItemMessage,hWin,IDC_CBO1,CB_GETCURSEL,0,0 mov spri.fmt.fnt,al invoke SetCState,hWin .endif .elseif eax==WM_CTLCOLORSTATIC invoke GetWindowLong,lParam,GWL_ID .if eax==IDC_STC3 invoke DeleteObject,hBrTmp invoke CreateSolidBrush,bckcol mov hBrTmp,eax ret .elseif eax==IDC_STC4 invoke DeleteObject,hBrTmp invoke CreateSolidBrush,txtcol mov hBrTmp,eax ret .endif .elseif eax==WM_CLOSE invoke DeleteObject,hBrTmp mov hBrTmp,0 invoke EndDialog,hWin,NULL .else mov eax,FALSE ret .endif mov eax,TRUE ret CellFmtProc endp
programs/oeis/075/A075111.asm
neoneye/loda
22
26433
; A075111: a(n)=Sum((-1)^(i+Floor(n/2))T(2i+e),(i=0,..,Floor(n/2))), where T(n) are tribonacci numbers (A000073) and e=(1/2)(1-(-1)^n). ; 0,1,1,1,3,6,10,18,34,63,115,211,389,716,1316,2420,4452,8189,15061,27701,50951,93714,172366,317030,583110,1072507,1972647,3628263,6673417,12274328,22576008,41523752,76374088,140473849,258371689 mov $2,$0 mov $4,2 lpb $4 mov $0,$2 sub $4,1 add $0,$4 trn $0,1 seq $0,301657 ; Number of nX3 0..1 arrays with every element equal to 0, 1 or 4 horizontally or vertically adjacent elements, with upper left element zero. div $0,2 sub $0,1 mov $3,$4 mul $3,$0 add $1,$3 mov $5,$0 lpe min $2,1 mul $2,$5 sub $1,$2 mov $0,$1
symbolinen_konekieli/Ratol_msdos/laske.asm
tkukka/VariousContent
0
1490
<reponame>tkukka/VariousContent ;RaTol Symbolinen konekieli: koetehtävä 2 ;<NAME>ka IY96A ;Tiedosto: laske.asm ;Luotu 26.2.1998 ;Aliohjelma _laske ;Hakee taulukon osoitteen PINOSTA ;Aliohjelmien esittely: public _laske .model small ;muistimalli .stack 00h ;pinon koko .data ;muuttujalohko .code ;ohjelmakoodi alkaa _laske proc ;int _laske(int *taulu); ;rekisterit talteen push bp ;pinossa &taulu, ip, bp push di ;pinossa &taulu, ip, bp, di push ax push bx push cx ;pino: &taulu, ip, bp, di, ax, bx, cx mov bp, sp ;Kopioidaan sp mov di, [bp + 12] ;siirros di-rekisteriin mov ax, [di] ;1. luku mov bx, [di + 2] ;2. luku mov cx, [di + 4] ;3. luku cmp ax, 1 jz SUMMA cmp ax, 2 jz EROTUS cmp ax, 3 jz PIENIN ;MUU mov ax, 0 jmp LOPPU SUMMA: add bx, cx mov ax, bx jmp LOPPU EROTUS: sub bx, cx mov ax, bx jmp LOPPU PIENIN: cmp bx, cx jnc PALAUTA_CX ;hyppy, jos CF=0 mov ax, bx ;bx < cx jmp LOPPU PALAUTA_CX: mov ax, cx LOPPU: pop cx ;rekisterien palautus pop bx pop ax pop di pop bp ret 2 ;2 tavun vapautus paluun jälkeen _laske endp end
sh.asm
briansrls/xv6
0
23584
<filename>sh.asm<gh_stars>0 _sh: file format elf32-i386 Disassembly of section .text: 00000000 <runcmd>: struct cmd *parsecmd(char*); // Execute cmd. Never returns. void runcmd(struct cmd *cmd) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 38 sub $0x38,%esp struct execcmd *ecmd; struct listcmd *lcmd; struct pipecmd *pcmd; struct redircmd *rcmd; if(cmd == 0) 6: 83 7d 08 00 cmpl $0x0,0x8(%ebp) a: 75 05 jne 11 <runcmd+0x11> exit(); c: e8 47 0f 00 00 call f58 <exit> switch(cmd->type){ 11: 8b 45 08 mov 0x8(%ebp),%eax 14: 8b 00 mov (%eax),%eax 16: 83 f8 05 cmp $0x5,%eax 19: 77 09 ja 24 <runcmd+0x24> 1b: 8b 04 85 dc 14 00 00 mov 0x14dc(,%eax,4),%eax 22: ff e0 jmp *%eax default: panic("runcmd"); 24: c7 04 24 b0 14 00 00 movl $0x14b0,(%esp) 2b: e8 21 03 00 00 call 351 <panic> case EXEC: ecmd = (struct execcmd*)cmd; 30: 8b 45 08 mov 0x8(%ebp),%eax 33: 89 45 f4 mov %eax,-0xc(%ebp) if(ecmd->argv[0] == 0) 36: 8b 45 f4 mov -0xc(%ebp),%eax 39: 8b 40 04 mov 0x4(%eax),%eax 3c: 85 c0 test %eax,%eax 3e: 75 05 jne 45 <runcmd+0x45> exit(); 40: e8 13 0f 00 00 call f58 <exit> exec(ecmd->argv[0], ecmd->argv); 45: 8b 45 f4 mov -0xc(%ebp),%eax 48: 8d 50 04 lea 0x4(%eax),%edx 4b: 8b 45 f4 mov -0xc(%ebp),%eax 4e: 8b 40 04 mov 0x4(%eax),%eax 51: 89 54 24 04 mov %edx,0x4(%esp) 55: 89 04 24 mov %eax,(%esp) 58: e8 33 0f 00 00 call f90 <exec> printf(2, "exec %s failed\n", ecmd->argv[0]); 5d: 8b 45 f4 mov -0xc(%ebp),%eax 60: 8b 40 04 mov 0x4(%eax),%eax 63: 89 44 24 08 mov %eax,0x8(%esp) 67: c7 44 24 04 b7 14 00 movl $0x14b7,0x4(%esp) 6e: 00 6f: c7 04 24 02 00 00 00 movl $0x2,(%esp) 76: e8 6d 10 00 00 call 10e8 <printf> break; 7b: e9 84 01 00 00 jmp 204 <runcmd+0x204> case REDIR: rcmd = (struct redircmd*)cmd; 80: 8b 45 08 mov 0x8(%ebp),%eax 83: 89 45 f0 mov %eax,-0x10(%ebp) close(rcmd->fd); 86: 8b 45 f0 mov -0x10(%ebp),%eax 89: 8b 40 14 mov 0x14(%eax),%eax 8c: 89 04 24 mov %eax,(%esp) 8f: e8 ec 0e 00 00 call f80 <close> if(open(rcmd->file, rcmd->mode) < 0){ 94: 8b 45 f0 mov -0x10(%ebp),%eax 97: 8b 50 10 mov 0x10(%eax),%edx 9a: 8b 45 f0 mov -0x10(%ebp),%eax 9d: 8b 40 08 mov 0x8(%eax),%eax a0: 89 54 24 04 mov %edx,0x4(%esp) a4: 89 04 24 mov %eax,(%esp) a7: e8 ec 0e 00 00 call f98 <open> ac: 85 c0 test %eax,%eax ae: 79 23 jns d3 <runcmd+0xd3> printf(2, "open %s failed\n", rcmd->file); b0: 8b 45 f0 mov -0x10(%ebp),%eax b3: 8b 40 08 mov 0x8(%eax),%eax b6: 89 44 24 08 mov %eax,0x8(%esp) ba: c7 44 24 04 c7 14 00 movl $0x14c7,0x4(%esp) c1: 00 c2: c7 04 24 02 00 00 00 movl $0x2,(%esp) c9: e8 1a 10 00 00 call 10e8 <printf> exit(); ce: e8 85 0e 00 00 call f58 <exit> } runcmd(rcmd->cmd); d3: 8b 45 f0 mov -0x10(%ebp),%eax d6: 8b 40 04 mov 0x4(%eax),%eax d9: 89 04 24 mov %eax,(%esp) dc: e8 1f ff ff ff call 0 <runcmd> break; e1: e9 1e 01 00 00 jmp 204 <runcmd+0x204> case LIST: lcmd = (struct listcmd*)cmd; e6: 8b 45 08 mov 0x8(%ebp),%eax e9: 89 45 ec mov %eax,-0x14(%ebp) if(fork1() == 0) ec: e8 86 02 00 00 call 377 <fork1> f1: 85 c0 test %eax,%eax f3: 75 0e jne 103 <runcmd+0x103> runcmd(lcmd->left); f5: 8b 45 ec mov -0x14(%ebp),%eax f8: 8b 40 04 mov 0x4(%eax),%eax fb: 89 04 24 mov %eax,(%esp) fe: e8 fd fe ff ff call 0 <runcmd> wait(); 103: e8 58 0e 00 00 call f60 <wait> runcmd(lcmd->right); 108: 8b 45 ec mov -0x14(%ebp),%eax 10b: 8b 40 08 mov 0x8(%eax),%eax 10e: 89 04 24 mov %eax,(%esp) 111: e8 ea fe ff ff call 0 <runcmd> break; 116: e9 e9 00 00 00 jmp 204 <runcmd+0x204> case PIPE: pcmd = (struct pipecmd*)cmd; 11b: 8b 45 08 mov 0x8(%ebp),%eax 11e: 89 45 e8 mov %eax,-0x18(%ebp) if(pipe(p) < 0) 121: 8d 45 dc lea -0x24(%ebp),%eax 124: 89 04 24 mov %eax,(%esp) 127: e8 3c 0e 00 00 call f68 <pipe> 12c: 85 c0 test %eax,%eax 12e: 79 0c jns 13c <runcmd+0x13c> panic("pipe"); 130: c7 04 24 d7 14 00 00 movl $0x14d7,(%esp) 137: e8 15 02 00 00 call 351 <panic> if(fork1() == 0){ 13c: e8 36 02 00 00 call 377 <fork1> 141: 85 c0 test %eax,%eax 143: 75 3b jne 180 <runcmd+0x180> close(1); 145: c7 04 24 01 00 00 00 movl $0x1,(%esp) 14c: e8 2f 0e 00 00 call f80 <close> dup(p[1]); 151: 8b 45 e0 mov -0x20(%ebp),%eax 154: 89 04 24 mov %eax,(%esp) 157: e8 74 0e 00 00 call fd0 <dup> close(p[0]); 15c: 8b 45 dc mov -0x24(%ebp),%eax 15f: 89 04 24 mov %eax,(%esp) 162: e8 19 0e 00 00 call f80 <close> close(p[1]); 167: 8b 45 e0 mov -0x20(%ebp),%eax 16a: 89 04 24 mov %eax,(%esp) 16d: e8 0e 0e 00 00 call f80 <close> runcmd(pcmd->left); 172: 8b 45 e8 mov -0x18(%ebp),%eax 175: 8b 40 04 mov 0x4(%eax),%eax 178: 89 04 24 mov %eax,(%esp) 17b: e8 80 fe ff ff call 0 <runcmd> } if(fork1() == 0){ 180: e8 f2 01 00 00 call 377 <fork1> 185: 85 c0 test %eax,%eax 187: 75 3b jne 1c4 <runcmd+0x1c4> close(0); 189: c7 04 24 00 00 00 00 movl $0x0,(%esp) 190: e8 eb 0d 00 00 call f80 <close> dup(p[0]); 195: 8b 45 dc mov -0x24(%ebp),%eax 198: 89 04 24 mov %eax,(%esp) 19b: e8 30 0e 00 00 call fd0 <dup> close(p[0]); 1a0: 8b 45 dc mov -0x24(%ebp),%eax 1a3: 89 04 24 mov %eax,(%esp) 1a6: e8 d5 0d 00 00 call f80 <close> close(p[1]); 1ab: 8b 45 e0 mov -0x20(%ebp),%eax 1ae: 89 04 24 mov %eax,(%esp) 1b1: e8 ca 0d 00 00 call f80 <close> runcmd(pcmd->right); 1b6: 8b 45 e8 mov -0x18(%ebp),%eax 1b9: 8b 40 08 mov 0x8(%eax),%eax 1bc: 89 04 24 mov %eax,(%esp) 1bf: e8 3c fe ff ff call 0 <runcmd> } close(p[0]); 1c4: 8b 45 dc mov -0x24(%ebp),%eax 1c7: 89 04 24 mov %eax,(%esp) 1ca: e8 b1 0d 00 00 call f80 <close> close(p[1]); 1cf: 8b 45 e0 mov -0x20(%ebp),%eax 1d2: 89 04 24 mov %eax,(%esp) 1d5: e8 a6 0d 00 00 call f80 <close> wait(); 1da: e8 81 0d 00 00 call f60 <wait> wait(); 1df: e8 7c 0d 00 00 call f60 <wait> break; 1e4: eb 1e jmp 204 <runcmd+0x204> case BACK: bcmd = (struct backcmd*)cmd; 1e6: 8b 45 08 mov 0x8(%ebp),%eax 1e9: 89 45 e4 mov %eax,-0x1c(%ebp) if(fork1() == 0) 1ec: e8 86 01 00 00 call 377 <fork1> 1f1: 85 c0 test %eax,%eax 1f3: 75 0e jne 203 <runcmd+0x203> runcmd(bcmd->cmd); 1f5: 8b 45 e4 mov -0x1c(%ebp),%eax 1f8: 8b 40 04 mov 0x4(%eax),%eax 1fb: 89 04 24 mov %eax,(%esp) 1fe: e8 fd fd ff ff call 0 <runcmd> break; 203: 90 nop } exit(); 204: e8 4f 0d 00 00 call f58 <exit> 00000209 <getcmd>: } int getcmd(char *buf, int nbuf) { 209: 55 push %ebp 20a: 89 e5 mov %esp,%ebp 20c: 83 ec 18 sub $0x18,%esp printf(2, "$ "); 20f: c7 44 24 04 f4 14 00 movl $0x14f4,0x4(%esp) 216: 00 217: c7 04 24 02 00 00 00 movl $0x2,(%esp) 21e: e8 c5 0e 00 00 call 10e8 <printf> memset(buf, 0, nbuf); 223: 8b 45 0c mov 0xc(%ebp),%eax 226: 89 44 24 08 mov %eax,0x8(%esp) 22a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 231: 00 232: 8b 45 08 mov 0x8(%ebp),%eax 235: 89 04 24 mov %eax,(%esp) 238: e8 53 0b 00 00 call d90 <memset> gets(buf, nbuf); 23d: 8b 45 0c mov 0xc(%ebp),%eax 240: 89 44 24 04 mov %eax,0x4(%esp) 244: 8b 45 08 mov 0x8(%ebp),%eax 247: 89 04 24 mov %eax,(%esp) 24a: e8 95 0b 00 00 call de4 <gets> if(buf[0] == 0) // EOF 24f: 8b 45 08 mov 0x8(%ebp),%eax 252: 8a 00 mov (%eax),%al 254: 84 c0 test %al,%al 256: 75 07 jne 25f <getcmd+0x56> return -1; 258: b8 ff ff ff ff mov $0xffffffff,%eax 25d: eb 05 jmp 264 <getcmd+0x5b> return 0; 25f: b8 00 00 00 00 mov $0x0,%eax } 264: c9 leave 265: c3 ret 00000266 <main>: int main(void) { 266: 55 push %ebp 267: 89 e5 mov %esp,%ebp 269: 83 e4 f0 and $0xfffffff0,%esp 26c: 83 ec 20 sub $0x20,%esp static char buf[100]; int fd; // Assumes three file descriptors open. while((fd = open("console", O_RDWR)) >= 0){ 26f: eb 19 jmp 28a <main+0x24> if(fd >= 3){ 271: 83 7c 24 1c 02 cmpl $0x2,0x1c(%esp) 276: 7e 12 jle 28a <main+0x24> close(fd); 278: 8b 44 24 1c mov 0x1c(%esp),%eax 27c: 89 04 24 mov %eax,(%esp) 27f: e8 fc 0c 00 00 call f80 <close> break; 284: 90 nop } } // Read and run input commands. while(getcmd(buf, sizeof(buf)) >= 0){ 285: e9 a6 00 00 00 jmp 330 <main+0xca> { static char buf[100]; int fd; // Assumes three file descriptors open. while((fd = open("console", O_RDWR)) >= 0){ 28a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) 291: 00 292: c7 04 24 f7 14 00 00 movl $0x14f7,(%esp) 299: e8 fa 0c 00 00 call f98 <open> 29e: 89 44 24 1c mov %eax,0x1c(%esp) 2a2: 83 7c 24 1c 00 cmpl $0x0,0x1c(%esp) 2a7: 79 c8 jns 271 <main+0xb> break; } } // Read and run input commands. while(getcmd(buf, sizeof(buf)) >= 0){ 2a9: e9 82 00 00 00 jmp 330 <main+0xca> if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ 2ae: a0 80 1a 00 00 mov 0x1a80,%al 2b3: 3c 63 cmp $0x63,%al 2b5: 75 54 jne 30b <main+0xa5> 2b7: a0 81 1a 00 00 mov 0x1a81,%al 2bc: 3c 64 cmp $0x64,%al 2be: 75 4b jne 30b <main+0xa5> 2c0: a0 82 1a 00 00 mov 0x1a82,%al 2c5: 3c 20 cmp $0x20,%al 2c7: 75 42 jne 30b <main+0xa5> // Clumsy but will have to do for now. // Chdir has no effect on the parent if run in the child. buf[strlen(buf)-1] = 0; // chop \n 2c9: c7 04 24 80 1a 00 00 movl $0x1a80,(%esp) 2d0: e8 96 0a 00 00 call d6b <strlen> 2d5: 48 dec %eax 2d6: c6 80 80 1a 00 00 00 movb $0x0,0x1a80(%eax) if(chdir(buf+3) < 0) 2dd: c7 04 24 83 1a 00 00 movl $0x1a83,(%esp) 2e4: e8 df 0c 00 00 call fc8 <chdir> 2e9: 85 c0 test %eax,%eax 2eb: 79 42 jns 32f <main+0xc9> printf(2, "cannot cd %s\n", buf+3); 2ed: c7 44 24 08 83 1a 00 movl $0x1a83,0x8(%esp) 2f4: 00 2f5: c7 44 24 04 ff 14 00 movl $0x14ff,0x4(%esp) 2fc: 00 2fd: c7 04 24 02 00 00 00 movl $0x2,(%esp) 304: e8 df 0d 00 00 call 10e8 <printf> continue; 309: eb 24 jmp 32f <main+0xc9> } if(fork1() == 0) 30b: e8 67 00 00 00 call 377 <fork1> 310: 85 c0 test %eax,%eax 312: 75 14 jne 328 <main+0xc2> runcmd(parsecmd(buf)); 314: c7 04 24 80 1a 00 00 movl $0x1a80,(%esp) 31b: e8 b4 03 00 00 call 6d4 <parsecmd> 320: 89 04 24 mov %eax,(%esp) 323: e8 d8 fc ff ff call 0 <runcmd> wait(); 328: e8 33 0c 00 00 call f60 <wait> 32d: eb 01 jmp 330 <main+0xca> // Clumsy but will have to do for now. // Chdir has no effect on the parent if run in the child. buf[strlen(buf)-1] = 0; // chop \n if(chdir(buf+3) < 0) printf(2, "cannot cd %s\n", buf+3); continue; 32f: 90 nop break; } } // Read and run input commands. while(getcmd(buf, sizeof(buf)) >= 0){ 330: c7 44 24 04 64 00 00 movl $0x64,0x4(%esp) 337: 00 338: c7 04 24 80 1a 00 00 movl $0x1a80,(%esp) 33f: e8 c5 fe ff ff call 209 <getcmd> 344: 85 c0 test %eax,%eax 346: 0f 89 62 ff ff ff jns 2ae <main+0x48> } if(fork1() == 0) runcmd(parsecmd(buf)); wait(); } exit(); 34c: e8 07 0c 00 00 call f58 <exit> 00000351 <panic>: } void panic(char *s) { 351: 55 push %ebp 352: 89 e5 mov %esp,%ebp 354: 83 ec 18 sub $0x18,%esp printf(2, "%s\n", s); 357: 8b 45 08 mov 0x8(%ebp),%eax 35a: 89 44 24 08 mov %eax,0x8(%esp) 35e: c7 44 24 04 0d 15 00 movl $0x150d,0x4(%esp) 365: 00 366: c7 04 24 02 00 00 00 movl $0x2,(%esp) 36d: e8 76 0d 00 00 call 10e8 <printf> exit(); 372: e8 e1 0b 00 00 call f58 <exit> 00000377 <fork1>: } int fork1(void) { 377: 55 push %ebp 378: 89 e5 mov %esp,%ebp 37a: 83 ec 28 sub $0x28,%esp int pid; pid = fork(); 37d: e8 ce 0b 00 00 call f50 <fork> 382: 89 45 f4 mov %eax,-0xc(%ebp) if(pid == -1) 385: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 389: 75 0c jne 397 <fork1+0x20> panic("fork"); 38b: c7 04 24 11 15 00 00 movl $0x1511,(%esp) 392: e8 ba ff ff ff call 351 <panic> return pid; 397: 8b 45 f4 mov -0xc(%ebp),%eax } 39a: c9 leave 39b: c3 ret 0000039c <execcmd>: //PAGEBREAK! // Constructors struct cmd* execcmd(void) { 39c: 55 push %ebp 39d: 89 e5 mov %esp,%ebp 39f: 83 ec 28 sub $0x28,%esp struct execcmd *cmd; cmd = malloc(sizeof(*cmd)); 3a2: c7 04 24 54 00 00 00 movl $0x54,(%esp) 3a9: e8 23 10 00 00 call 13d1 <malloc> 3ae: 89 45 f4 mov %eax,-0xc(%ebp) memset(cmd, 0, sizeof(*cmd)); 3b1: c7 44 24 08 54 00 00 movl $0x54,0x8(%esp) 3b8: 00 3b9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 3c0: 00 3c1: 8b 45 f4 mov -0xc(%ebp),%eax 3c4: 89 04 24 mov %eax,(%esp) 3c7: e8 c4 09 00 00 call d90 <memset> cmd->type = EXEC; 3cc: 8b 45 f4 mov -0xc(%ebp),%eax 3cf: c7 00 01 00 00 00 movl $0x1,(%eax) return (struct cmd*)cmd; 3d5: 8b 45 f4 mov -0xc(%ebp),%eax } 3d8: c9 leave 3d9: c3 ret 000003da <redircmd>: struct cmd* redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) { 3da: 55 push %ebp 3db: 89 e5 mov %esp,%ebp 3dd: 83 ec 28 sub $0x28,%esp struct redircmd *cmd; cmd = malloc(sizeof(*cmd)); 3e0: c7 04 24 18 00 00 00 movl $0x18,(%esp) 3e7: e8 e5 0f 00 00 call 13d1 <malloc> 3ec: 89 45 f4 mov %eax,-0xc(%ebp) memset(cmd, 0, sizeof(*cmd)); 3ef: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp) 3f6: 00 3f7: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 3fe: 00 3ff: 8b 45 f4 mov -0xc(%ebp),%eax 402: 89 04 24 mov %eax,(%esp) 405: e8 86 09 00 00 call d90 <memset> cmd->type = REDIR; 40a: 8b 45 f4 mov -0xc(%ebp),%eax 40d: c7 00 02 00 00 00 movl $0x2,(%eax) cmd->cmd = subcmd; 413: 8b 45 f4 mov -0xc(%ebp),%eax 416: 8b 55 08 mov 0x8(%ebp),%edx 419: 89 50 04 mov %edx,0x4(%eax) cmd->file = file; 41c: 8b 45 f4 mov -0xc(%ebp),%eax 41f: 8b 55 0c mov 0xc(%ebp),%edx 422: 89 50 08 mov %edx,0x8(%eax) cmd->efile = efile; 425: 8b 45 f4 mov -0xc(%ebp),%eax 428: 8b 55 10 mov 0x10(%ebp),%edx 42b: 89 50 0c mov %edx,0xc(%eax) cmd->mode = mode; 42e: 8b 45 f4 mov -0xc(%ebp),%eax 431: 8b 55 14 mov 0x14(%ebp),%edx 434: 89 50 10 mov %edx,0x10(%eax) cmd->fd = fd; 437: 8b 45 f4 mov -0xc(%ebp),%eax 43a: 8b 55 18 mov 0x18(%ebp),%edx 43d: 89 50 14 mov %edx,0x14(%eax) return (struct cmd*)cmd; 440: 8b 45 f4 mov -0xc(%ebp),%eax } 443: c9 leave 444: c3 ret 00000445 <pipecmd>: struct cmd* pipecmd(struct cmd *left, struct cmd *right) { 445: 55 push %ebp 446: 89 e5 mov %esp,%ebp 448: 83 ec 28 sub $0x28,%esp struct pipecmd *cmd; cmd = malloc(sizeof(*cmd)); 44b: c7 04 24 0c 00 00 00 movl $0xc,(%esp) 452: e8 7a 0f 00 00 call 13d1 <malloc> 457: 89 45 f4 mov %eax,-0xc(%ebp) memset(cmd, 0, sizeof(*cmd)); 45a: c7 44 24 08 0c 00 00 movl $0xc,0x8(%esp) 461: 00 462: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 469: 00 46a: 8b 45 f4 mov -0xc(%ebp),%eax 46d: 89 04 24 mov %eax,(%esp) 470: e8 1b 09 00 00 call d90 <memset> cmd->type = PIPE; 475: 8b 45 f4 mov -0xc(%ebp),%eax 478: c7 00 03 00 00 00 movl $0x3,(%eax) cmd->left = left; 47e: 8b 45 f4 mov -0xc(%ebp),%eax 481: 8b 55 08 mov 0x8(%ebp),%edx 484: 89 50 04 mov %edx,0x4(%eax) cmd->right = right; 487: 8b 45 f4 mov -0xc(%ebp),%eax 48a: 8b 55 0c mov 0xc(%ebp),%edx 48d: 89 50 08 mov %edx,0x8(%eax) return (struct cmd*)cmd; 490: 8b 45 f4 mov -0xc(%ebp),%eax } 493: c9 leave 494: c3 ret 00000495 <listcmd>: struct cmd* listcmd(struct cmd *left, struct cmd *right) { 495: 55 push %ebp 496: 89 e5 mov %esp,%ebp 498: 83 ec 28 sub $0x28,%esp struct listcmd *cmd; cmd = malloc(sizeof(*cmd)); 49b: c7 04 24 0c 00 00 00 movl $0xc,(%esp) 4a2: e8 2a 0f 00 00 call 13d1 <malloc> 4a7: 89 45 f4 mov %eax,-0xc(%ebp) memset(cmd, 0, sizeof(*cmd)); 4aa: c7 44 24 08 0c 00 00 movl $0xc,0x8(%esp) 4b1: 00 4b2: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 4b9: 00 4ba: 8b 45 f4 mov -0xc(%ebp),%eax 4bd: 89 04 24 mov %eax,(%esp) 4c0: e8 cb 08 00 00 call d90 <memset> cmd->type = LIST; 4c5: 8b 45 f4 mov -0xc(%ebp),%eax 4c8: c7 00 04 00 00 00 movl $0x4,(%eax) cmd->left = left; 4ce: 8b 45 f4 mov -0xc(%ebp),%eax 4d1: 8b 55 08 mov 0x8(%ebp),%edx 4d4: 89 50 04 mov %edx,0x4(%eax) cmd->right = right; 4d7: 8b 45 f4 mov -0xc(%ebp),%eax 4da: 8b 55 0c mov 0xc(%ebp),%edx 4dd: 89 50 08 mov %edx,0x8(%eax) return (struct cmd*)cmd; 4e0: 8b 45 f4 mov -0xc(%ebp),%eax } 4e3: c9 leave 4e4: c3 ret 000004e5 <backcmd>: struct cmd* backcmd(struct cmd *subcmd) { 4e5: 55 push %ebp 4e6: 89 e5 mov %esp,%ebp 4e8: 83 ec 28 sub $0x28,%esp struct backcmd *cmd; cmd = malloc(sizeof(*cmd)); 4eb: c7 04 24 08 00 00 00 movl $0x8,(%esp) 4f2: e8 da 0e 00 00 call 13d1 <malloc> 4f7: 89 45 f4 mov %eax,-0xc(%ebp) memset(cmd, 0, sizeof(*cmd)); 4fa: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp) 501: 00 502: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 509: 00 50a: 8b 45 f4 mov -0xc(%ebp),%eax 50d: 89 04 24 mov %eax,(%esp) 510: e8 7b 08 00 00 call d90 <memset> cmd->type = BACK; 515: 8b 45 f4 mov -0xc(%ebp),%eax 518: c7 00 05 00 00 00 movl $0x5,(%eax) cmd->cmd = subcmd; 51e: 8b 45 f4 mov -0xc(%ebp),%eax 521: 8b 55 08 mov 0x8(%ebp),%edx 524: 89 50 04 mov %edx,0x4(%eax) return (struct cmd*)cmd; 527: 8b 45 f4 mov -0xc(%ebp),%eax } 52a: c9 leave 52b: c3 ret 0000052c <gettoken>: char whitespace[] = " \t\r\n\v"; char symbols[] = "<|>&;()"; int gettoken(char **ps, char *es, char **q, char **eq) { 52c: 55 push %ebp 52d: 89 e5 mov %esp,%ebp 52f: 83 ec 28 sub $0x28,%esp char *s; int ret; s = *ps; 532: 8b 45 08 mov 0x8(%ebp),%eax 535: 8b 00 mov (%eax),%eax 537: 89 45 f4 mov %eax,-0xc(%ebp) while(s < es && strchr(whitespace, *s)) 53a: eb 03 jmp 53f <gettoken+0x13> s++; 53c: ff 45 f4 incl -0xc(%ebp) { char *s; int ret; s = *ps; while(s < es && strchr(whitespace, *s)) 53f: 8b 45 f4 mov -0xc(%ebp),%eax 542: 3b 45 0c cmp 0xc(%ebp),%eax 545: 73 1c jae 563 <gettoken+0x37> 547: 8b 45 f4 mov -0xc(%ebp),%eax 54a: 8a 00 mov (%eax),%al 54c: 0f be c0 movsbl %al,%eax 54f: 89 44 24 04 mov %eax,0x4(%esp) 553: c7 04 24 40 1a 00 00 movl $0x1a40,(%esp) 55a: e8 55 08 00 00 call db4 <strchr> 55f: 85 c0 test %eax,%eax 561: 75 d9 jne 53c <gettoken+0x10> s++; if(q) 563: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 567: 74 08 je 571 <gettoken+0x45> *q = s; 569: 8b 45 10 mov 0x10(%ebp),%eax 56c: 8b 55 f4 mov -0xc(%ebp),%edx 56f: 89 10 mov %edx,(%eax) ret = *s; 571: 8b 45 f4 mov -0xc(%ebp),%eax 574: 8a 00 mov (%eax),%al 576: 0f be c0 movsbl %al,%eax 579: 89 45 f0 mov %eax,-0x10(%ebp) switch(*s){ 57c: 8b 45 f4 mov -0xc(%ebp),%eax 57f: 8a 00 mov (%eax),%al 581: 0f be c0 movsbl %al,%eax 584: 83 f8 3c cmp $0x3c,%eax 587: 7f 1a jg 5a3 <gettoken+0x77> 589: 83 f8 3b cmp $0x3b,%eax 58c: 7d 1f jge 5ad <gettoken+0x81> 58e: 83 f8 29 cmp $0x29,%eax 591: 7f 37 jg 5ca <gettoken+0x9e> 593: 83 f8 28 cmp $0x28,%eax 596: 7d 15 jge 5ad <gettoken+0x81> 598: 85 c0 test %eax,%eax 59a: 74 7c je 618 <gettoken+0xec> 59c: 83 f8 26 cmp $0x26,%eax 59f: 74 0c je 5ad <gettoken+0x81> 5a1: eb 27 jmp 5ca <gettoken+0x9e> 5a3: 83 f8 3e cmp $0x3e,%eax 5a6: 74 0a je 5b2 <gettoken+0x86> 5a8: 83 f8 7c cmp $0x7c,%eax 5ab: 75 1d jne 5ca <gettoken+0x9e> case '(': case ')': case ';': case '&': case '<': s++; 5ad: ff 45 f4 incl -0xc(%ebp) break; 5b0: eb 6d jmp 61f <gettoken+0xf3> case '>': s++; 5b2: ff 45 f4 incl -0xc(%ebp) if(*s == '>'){ 5b5: 8b 45 f4 mov -0xc(%ebp),%eax 5b8: 8a 00 mov (%eax),%al 5ba: 3c 3e cmp $0x3e,%al 5bc: 75 5d jne 61b <gettoken+0xef> ret = '+'; 5be: c7 45 f0 2b 00 00 00 movl $0x2b,-0x10(%ebp) s++; 5c5: ff 45 f4 incl -0xc(%ebp) } break; 5c8: eb 51 jmp 61b <gettoken+0xef> default: ret = 'a'; 5ca: c7 45 f0 61 00 00 00 movl $0x61,-0x10(%ebp) while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) 5d1: eb 03 jmp 5d6 <gettoken+0xaa> s++; 5d3: ff 45 f4 incl -0xc(%ebp) s++; } break; default: ret = 'a'; while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) 5d6: 8b 45 f4 mov -0xc(%ebp),%eax 5d9: 3b 45 0c cmp 0xc(%ebp),%eax 5dc: 73 40 jae 61e <gettoken+0xf2> 5de: 8b 45 f4 mov -0xc(%ebp),%eax 5e1: 8a 00 mov (%eax),%al 5e3: 0f be c0 movsbl %al,%eax 5e6: 89 44 24 04 mov %eax,0x4(%esp) 5ea: c7 04 24 40 1a 00 00 movl $0x1a40,(%esp) 5f1: e8 be 07 00 00 call db4 <strchr> 5f6: 85 c0 test %eax,%eax 5f8: 75 24 jne 61e <gettoken+0xf2> 5fa: 8b 45 f4 mov -0xc(%ebp),%eax 5fd: 8a 00 mov (%eax),%al 5ff: 0f be c0 movsbl %al,%eax 602: 89 44 24 04 mov %eax,0x4(%esp) 606: c7 04 24 46 1a 00 00 movl $0x1a46,(%esp) 60d: e8 a2 07 00 00 call db4 <strchr> 612: 85 c0 test %eax,%eax 614: 74 bd je 5d3 <gettoken+0xa7> s++; break; 616: eb 06 jmp 61e <gettoken+0xf2> if(q) *q = s; ret = *s; switch(*s){ case 0: break; 618: 90 nop 619: eb 04 jmp 61f <gettoken+0xf3> s++; if(*s == '>'){ ret = '+'; s++; } break; 61b: 90 nop 61c: eb 01 jmp 61f <gettoken+0xf3> default: ret = 'a'; while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) s++; break; 61e: 90 nop } if(eq) 61f: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 623: 74 0d je 632 <gettoken+0x106> *eq = s; 625: 8b 45 14 mov 0x14(%ebp),%eax 628: 8b 55 f4 mov -0xc(%ebp),%edx 62b: 89 10 mov %edx,(%eax) while(s < es && strchr(whitespace, *s)) 62d: eb 03 jmp 632 <gettoken+0x106> s++; 62f: ff 45 f4 incl -0xc(%ebp) break; } if(eq) *eq = s; while(s < es && strchr(whitespace, *s)) 632: 8b 45 f4 mov -0xc(%ebp),%eax 635: 3b 45 0c cmp 0xc(%ebp),%eax 638: 73 1c jae 656 <gettoken+0x12a> 63a: 8b 45 f4 mov -0xc(%ebp),%eax 63d: 8a 00 mov (%eax),%al 63f: 0f be c0 movsbl %al,%eax 642: 89 44 24 04 mov %eax,0x4(%esp) 646: c7 04 24 40 1a 00 00 movl $0x1a40,(%esp) 64d: e8 62 07 00 00 call db4 <strchr> 652: 85 c0 test %eax,%eax 654: 75 d9 jne 62f <gettoken+0x103> s++; *ps = s; 656: 8b 45 08 mov 0x8(%ebp),%eax 659: 8b 55 f4 mov -0xc(%ebp),%edx 65c: 89 10 mov %edx,(%eax) return ret; 65e: 8b 45 f0 mov -0x10(%ebp),%eax } 661: c9 leave 662: c3 ret 00000663 <peek>: int peek(char **ps, char *es, char *toks) { 663: 55 push %ebp 664: 89 e5 mov %esp,%ebp 666: 83 ec 28 sub $0x28,%esp char *s; s = *ps; 669: 8b 45 08 mov 0x8(%ebp),%eax 66c: 8b 00 mov (%eax),%eax 66e: 89 45 f4 mov %eax,-0xc(%ebp) while(s < es && strchr(whitespace, *s)) 671: eb 03 jmp 676 <peek+0x13> s++; 673: ff 45 f4 incl -0xc(%ebp) peek(char **ps, char *es, char *toks) { char *s; s = *ps; while(s < es && strchr(whitespace, *s)) 676: 8b 45 f4 mov -0xc(%ebp),%eax 679: 3b 45 0c cmp 0xc(%ebp),%eax 67c: 73 1c jae 69a <peek+0x37> 67e: 8b 45 f4 mov -0xc(%ebp),%eax 681: 8a 00 mov (%eax),%al 683: 0f be c0 movsbl %al,%eax 686: 89 44 24 04 mov %eax,0x4(%esp) 68a: c7 04 24 40 1a 00 00 movl $0x1a40,(%esp) 691: e8 1e 07 00 00 call db4 <strchr> 696: 85 c0 test %eax,%eax 698: 75 d9 jne 673 <peek+0x10> s++; *ps = s; 69a: 8b 45 08 mov 0x8(%ebp),%eax 69d: 8b 55 f4 mov -0xc(%ebp),%edx 6a0: 89 10 mov %edx,(%eax) return *s && strchr(toks, *s); 6a2: 8b 45 f4 mov -0xc(%ebp),%eax 6a5: 8a 00 mov (%eax),%al 6a7: 84 c0 test %al,%al 6a9: 74 22 je 6cd <peek+0x6a> 6ab: 8b 45 f4 mov -0xc(%ebp),%eax 6ae: 8a 00 mov (%eax),%al 6b0: 0f be c0 movsbl %al,%eax 6b3: 89 44 24 04 mov %eax,0x4(%esp) 6b7: 8b 45 10 mov 0x10(%ebp),%eax 6ba: 89 04 24 mov %eax,(%esp) 6bd: e8 f2 06 00 00 call db4 <strchr> 6c2: 85 c0 test %eax,%eax 6c4: 74 07 je 6cd <peek+0x6a> 6c6: b8 01 00 00 00 mov $0x1,%eax 6cb: eb 05 jmp 6d2 <peek+0x6f> 6cd: b8 00 00 00 00 mov $0x0,%eax } 6d2: c9 leave 6d3: c3 ret 000006d4 <parsecmd>: struct cmd *parseexec(char**, char*); struct cmd *nulterminate(struct cmd*); struct cmd* parsecmd(char *s) { 6d4: 55 push %ebp 6d5: 89 e5 mov %esp,%ebp 6d7: 53 push %ebx 6d8: 83 ec 24 sub $0x24,%esp char *es; struct cmd *cmd; es = s + strlen(s); 6db: 8b 5d 08 mov 0x8(%ebp),%ebx 6de: 8b 45 08 mov 0x8(%ebp),%eax 6e1: 89 04 24 mov %eax,(%esp) 6e4: e8 82 06 00 00 call d6b <strlen> 6e9: 01 d8 add %ebx,%eax 6eb: 89 45 f4 mov %eax,-0xc(%ebp) cmd = parseline(&s, es); 6ee: 8b 45 f4 mov -0xc(%ebp),%eax 6f1: 89 44 24 04 mov %eax,0x4(%esp) 6f5: 8d 45 08 lea 0x8(%ebp),%eax 6f8: 89 04 24 mov %eax,(%esp) 6fb: e8 60 00 00 00 call 760 <parseline> 700: 89 45 f0 mov %eax,-0x10(%ebp) peek(&s, es, ""); 703: c7 44 24 08 16 15 00 movl $0x1516,0x8(%esp) 70a: 00 70b: 8b 45 f4 mov -0xc(%ebp),%eax 70e: 89 44 24 04 mov %eax,0x4(%esp) 712: 8d 45 08 lea 0x8(%ebp),%eax 715: 89 04 24 mov %eax,(%esp) 718: e8 46 ff ff ff call 663 <peek> if(s != es){ 71d: 8b 45 08 mov 0x8(%ebp),%eax 720: 3b 45 f4 cmp -0xc(%ebp),%eax 723: 74 27 je 74c <parsecmd+0x78> printf(2, "leftovers: %s\n", s); 725: 8b 45 08 mov 0x8(%ebp),%eax 728: 89 44 24 08 mov %eax,0x8(%esp) 72c: c7 44 24 04 17 15 00 movl $0x1517,0x4(%esp) 733: 00 734: c7 04 24 02 00 00 00 movl $0x2,(%esp) 73b: e8 a8 09 00 00 call 10e8 <printf> panic("syntax"); 740: c7 04 24 26 15 00 00 movl $0x1526,(%esp) 747: e8 05 fc ff ff call 351 <panic> } nulterminate(cmd); 74c: 8b 45 f0 mov -0x10(%ebp),%eax 74f: 89 04 24 mov %eax,(%esp) 752: e8 a4 04 00 00 call bfb <nulterminate> return cmd; 757: 8b 45 f0 mov -0x10(%ebp),%eax } 75a: 83 c4 24 add $0x24,%esp 75d: 5b pop %ebx 75e: 5d pop %ebp 75f: c3 ret 00000760 <parseline>: struct cmd* parseline(char **ps, char *es) { 760: 55 push %ebp 761: 89 e5 mov %esp,%ebp 763: 83 ec 28 sub $0x28,%esp struct cmd *cmd; cmd = parsepipe(ps, es); 766: 8b 45 0c mov 0xc(%ebp),%eax 769: 89 44 24 04 mov %eax,0x4(%esp) 76d: 8b 45 08 mov 0x8(%ebp),%eax 770: 89 04 24 mov %eax,(%esp) 773: e8 bc 00 00 00 call 834 <parsepipe> 778: 89 45 f4 mov %eax,-0xc(%ebp) while(peek(ps, es, "&")){ 77b: eb 30 jmp 7ad <parseline+0x4d> gettoken(ps, es, 0, 0); 77d: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 784: 00 785: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 78c: 00 78d: 8b 45 0c mov 0xc(%ebp),%eax 790: 89 44 24 04 mov %eax,0x4(%esp) 794: 8b 45 08 mov 0x8(%ebp),%eax 797: 89 04 24 mov %eax,(%esp) 79a: e8 8d fd ff ff call 52c <gettoken> cmd = backcmd(cmd); 79f: 8b 45 f4 mov -0xc(%ebp),%eax 7a2: 89 04 24 mov %eax,(%esp) 7a5: e8 3b fd ff ff call 4e5 <backcmd> 7aa: 89 45 f4 mov %eax,-0xc(%ebp) parseline(char **ps, char *es) { struct cmd *cmd; cmd = parsepipe(ps, es); while(peek(ps, es, "&")){ 7ad: c7 44 24 08 2d 15 00 movl $0x152d,0x8(%esp) 7b4: 00 7b5: 8b 45 0c mov 0xc(%ebp),%eax 7b8: 89 44 24 04 mov %eax,0x4(%esp) 7bc: 8b 45 08 mov 0x8(%ebp),%eax 7bf: 89 04 24 mov %eax,(%esp) 7c2: e8 9c fe ff ff call 663 <peek> 7c7: 85 c0 test %eax,%eax 7c9: 75 b2 jne 77d <parseline+0x1d> gettoken(ps, es, 0, 0); cmd = backcmd(cmd); } if(peek(ps, es, ";")){ 7cb: c7 44 24 08 2f 15 00 movl $0x152f,0x8(%esp) 7d2: 00 7d3: 8b 45 0c mov 0xc(%ebp),%eax 7d6: 89 44 24 04 mov %eax,0x4(%esp) 7da: 8b 45 08 mov 0x8(%ebp),%eax 7dd: 89 04 24 mov %eax,(%esp) 7e0: e8 7e fe ff ff call 663 <peek> 7e5: 85 c0 test %eax,%eax 7e7: 74 46 je 82f <parseline+0xcf> gettoken(ps, es, 0, 0); 7e9: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 7f0: 00 7f1: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 7f8: 00 7f9: 8b 45 0c mov 0xc(%ebp),%eax 7fc: 89 44 24 04 mov %eax,0x4(%esp) 800: 8b 45 08 mov 0x8(%ebp),%eax 803: 89 04 24 mov %eax,(%esp) 806: e8 21 fd ff ff call 52c <gettoken> cmd = listcmd(cmd, parseline(ps, es)); 80b: 8b 45 0c mov 0xc(%ebp),%eax 80e: 89 44 24 04 mov %eax,0x4(%esp) 812: 8b 45 08 mov 0x8(%ebp),%eax 815: 89 04 24 mov %eax,(%esp) 818: e8 43 ff ff ff call 760 <parseline> 81d: 89 44 24 04 mov %eax,0x4(%esp) 821: 8b 45 f4 mov -0xc(%ebp),%eax 824: 89 04 24 mov %eax,(%esp) 827: e8 69 fc ff ff call 495 <listcmd> 82c: 89 45 f4 mov %eax,-0xc(%ebp) } return cmd; 82f: 8b 45 f4 mov -0xc(%ebp),%eax } 832: c9 leave 833: c3 ret 00000834 <parsepipe>: struct cmd* parsepipe(char **ps, char *es) { 834: 55 push %ebp 835: 89 e5 mov %esp,%ebp 837: 83 ec 28 sub $0x28,%esp struct cmd *cmd; cmd = parseexec(ps, es); 83a: 8b 45 0c mov 0xc(%ebp),%eax 83d: 89 44 24 04 mov %eax,0x4(%esp) 841: 8b 45 08 mov 0x8(%ebp),%eax 844: 89 04 24 mov %eax,(%esp) 847: e8 68 02 00 00 call ab4 <parseexec> 84c: 89 45 f4 mov %eax,-0xc(%ebp) if(peek(ps, es, "|")){ 84f: c7 44 24 08 31 15 00 movl $0x1531,0x8(%esp) 856: 00 857: 8b 45 0c mov 0xc(%ebp),%eax 85a: 89 44 24 04 mov %eax,0x4(%esp) 85e: 8b 45 08 mov 0x8(%ebp),%eax 861: 89 04 24 mov %eax,(%esp) 864: e8 fa fd ff ff call 663 <peek> 869: 85 c0 test %eax,%eax 86b: 74 46 je 8b3 <parsepipe+0x7f> gettoken(ps, es, 0, 0); 86d: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 874: 00 875: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 87c: 00 87d: 8b 45 0c mov 0xc(%ebp),%eax 880: 89 44 24 04 mov %eax,0x4(%esp) 884: 8b 45 08 mov 0x8(%ebp),%eax 887: 89 04 24 mov %eax,(%esp) 88a: e8 9d fc ff ff call 52c <gettoken> cmd = pipecmd(cmd, parsepipe(ps, es)); 88f: 8b 45 0c mov 0xc(%ebp),%eax 892: 89 44 24 04 mov %eax,0x4(%esp) 896: 8b 45 08 mov 0x8(%ebp),%eax 899: 89 04 24 mov %eax,(%esp) 89c: e8 93 ff ff ff call 834 <parsepipe> 8a1: 89 44 24 04 mov %eax,0x4(%esp) 8a5: 8b 45 f4 mov -0xc(%ebp),%eax 8a8: 89 04 24 mov %eax,(%esp) 8ab: e8 95 fb ff ff call 445 <pipecmd> 8b0: 89 45 f4 mov %eax,-0xc(%ebp) } return cmd; 8b3: 8b 45 f4 mov -0xc(%ebp),%eax } 8b6: c9 leave 8b7: c3 ret 000008b8 <parseredirs>: struct cmd* parseredirs(struct cmd *cmd, char **ps, char *es) { 8b8: 55 push %ebp 8b9: 89 e5 mov %esp,%ebp 8bb: 83 ec 38 sub $0x38,%esp int tok; char *q, *eq; while(peek(ps, es, "<>")){ 8be: e9 f6 00 00 00 jmp 9b9 <parseredirs+0x101> tok = gettoken(ps, es, 0, 0); 8c3: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 8ca: 00 8cb: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 8d2: 00 8d3: 8b 45 10 mov 0x10(%ebp),%eax 8d6: 89 44 24 04 mov %eax,0x4(%esp) 8da: 8b 45 0c mov 0xc(%ebp),%eax 8dd: 89 04 24 mov %eax,(%esp) 8e0: e8 47 fc ff ff call 52c <gettoken> 8e5: 89 45 f4 mov %eax,-0xc(%ebp) if(gettoken(ps, es, &q, &eq) != 'a') 8e8: 8d 45 ec lea -0x14(%ebp),%eax 8eb: 89 44 24 0c mov %eax,0xc(%esp) 8ef: 8d 45 f0 lea -0x10(%ebp),%eax 8f2: 89 44 24 08 mov %eax,0x8(%esp) 8f6: 8b 45 10 mov 0x10(%ebp),%eax 8f9: 89 44 24 04 mov %eax,0x4(%esp) 8fd: 8b 45 0c mov 0xc(%ebp),%eax 900: 89 04 24 mov %eax,(%esp) 903: e8 24 fc ff ff call 52c <gettoken> 908: 83 f8 61 cmp $0x61,%eax 90b: 74 0c je 919 <parseredirs+0x61> panic("missing file for redirection"); 90d: c7 04 24 33 15 00 00 movl $0x1533,(%esp) 914: e8 38 fa ff ff call 351 <panic> switch(tok){ 919: 8b 45 f4 mov -0xc(%ebp),%eax 91c: 83 f8 3c cmp $0x3c,%eax 91f: 74 0f je 930 <parseredirs+0x78> 921: 83 f8 3e cmp $0x3e,%eax 924: 74 38 je 95e <parseredirs+0xa6> 926: 83 f8 2b cmp $0x2b,%eax 929: 74 61 je 98c <parseredirs+0xd4> 92b: e9 89 00 00 00 jmp 9b9 <parseredirs+0x101> case '<': cmd = redircmd(cmd, q, eq, O_RDONLY, 0); 930: 8b 55 ec mov -0x14(%ebp),%edx 933: 8b 45 f0 mov -0x10(%ebp),%eax 936: c7 44 24 10 00 00 00 movl $0x0,0x10(%esp) 93d: 00 93e: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 945: 00 946: 89 54 24 08 mov %edx,0x8(%esp) 94a: 89 44 24 04 mov %eax,0x4(%esp) 94e: 8b 45 08 mov 0x8(%ebp),%eax 951: 89 04 24 mov %eax,(%esp) 954: e8 81 fa ff ff call 3da <redircmd> 959: 89 45 08 mov %eax,0x8(%ebp) break; 95c: eb 5b jmp 9b9 <parseredirs+0x101> case '>': cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); 95e: 8b 55 ec mov -0x14(%ebp),%edx 961: 8b 45 f0 mov -0x10(%ebp),%eax 964: c7 44 24 10 01 00 00 movl $0x1,0x10(%esp) 96b: 00 96c: c7 44 24 0c 01 02 00 movl $0x201,0xc(%esp) 973: 00 974: 89 54 24 08 mov %edx,0x8(%esp) 978: 89 44 24 04 mov %eax,0x4(%esp) 97c: 8b 45 08 mov 0x8(%ebp),%eax 97f: 89 04 24 mov %eax,(%esp) 982: e8 53 fa ff ff call 3da <redircmd> 987: 89 45 08 mov %eax,0x8(%ebp) break; 98a: eb 2d jmp 9b9 <parseredirs+0x101> case '+': // >> cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); 98c: 8b 55 ec mov -0x14(%ebp),%edx 98f: 8b 45 f0 mov -0x10(%ebp),%eax 992: c7 44 24 10 01 00 00 movl $0x1,0x10(%esp) 999: 00 99a: c7 44 24 0c 01 02 00 movl $0x201,0xc(%esp) 9a1: 00 9a2: 89 54 24 08 mov %edx,0x8(%esp) 9a6: 89 44 24 04 mov %eax,0x4(%esp) 9aa: 8b 45 08 mov 0x8(%ebp),%eax 9ad: 89 04 24 mov %eax,(%esp) 9b0: e8 25 fa ff ff call 3da <redircmd> 9b5: 89 45 08 mov %eax,0x8(%ebp) break; 9b8: 90 nop parseredirs(struct cmd *cmd, char **ps, char *es) { int tok; char *q, *eq; while(peek(ps, es, "<>")){ 9b9: c7 44 24 08 50 15 00 movl $0x1550,0x8(%esp) 9c0: 00 9c1: 8b 45 10 mov 0x10(%ebp),%eax 9c4: 89 44 24 04 mov %eax,0x4(%esp) 9c8: 8b 45 0c mov 0xc(%ebp),%eax 9cb: 89 04 24 mov %eax,(%esp) 9ce: e8 90 fc ff ff call 663 <peek> 9d3: 85 c0 test %eax,%eax 9d5: 0f 85 e8 fe ff ff jne 8c3 <parseredirs+0xb> case '+': // >> cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); break; } } return cmd; 9db: 8b 45 08 mov 0x8(%ebp),%eax } 9de: c9 leave 9df: c3 ret 000009e0 <parseblock>: struct cmd* parseblock(char **ps, char *es) { 9e0: 55 push %ebp 9e1: 89 e5 mov %esp,%ebp 9e3: 83 ec 28 sub $0x28,%esp struct cmd *cmd; if(!peek(ps, es, "(")) 9e6: c7 44 24 08 53 15 00 movl $0x1553,0x8(%esp) 9ed: 00 9ee: 8b 45 0c mov 0xc(%ebp),%eax 9f1: 89 44 24 04 mov %eax,0x4(%esp) 9f5: 8b 45 08 mov 0x8(%ebp),%eax 9f8: 89 04 24 mov %eax,(%esp) 9fb: e8 63 fc ff ff call 663 <peek> a00: 85 c0 test %eax,%eax a02: 75 0c jne a10 <parseblock+0x30> panic("parseblock"); a04: c7 04 24 55 15 00 00 movl $0x1555,(%esp) a0b: e8 41 f9 ff ff call 351 <panic> gettoken(ps, es, 0, 0); a10: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) a17: 00 a18: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) a1f: 00 a20: 8b 45 0c mov 0xc(%ebp),%eax a23: 89 44 24 04 mov %eax,0x4(%esp) a27: 8b 45 08 mov 0x8(%ebp),%eax a2a: 89 04 24 mov %eax,(%esp) a2d: e8 fa fa ff ff call 52c <gettoken> cmd = parseline(ps, es); a32: 8b 45 0c mov 0xc(%ebp),%eax a35: 89 44 24 04 mov %eax,0x4(%esp) a39: 8b 45 08 mov 0x8(%ebp),%eax a3c: 89 04 24 mov %eax,(%esp) a3f: e8 1c fd ff ff call 760 <parseline> a44: 89 45 f4 mov %eax,-0xc(%ebp) if(!peek(ps, es, ")")) a47: c7 44 24 08 60 15 00 movl $0x1560,0x8(%esp) a4e: 00 a4f: 8b 45 0c mov 0xc(%ebp),%eax a52: 89 44 24 04 mov %eax,0x4(%esp) a56: 8b 45 08 mov 0x8(%ebp),%eax a59: 89 04 24 mov %eax,(%esp) a5c: e8 02 fc ff ff call 663 <peek> a61: 85 c0 test %eax,%eax a63: 75 0c jne a71 <parseblock+0x91> panic("syntax - missing )"); a65: c7 04 24 62 15 00 00 movl $0x1562,(%esp) a6c: e8 e0 f8 ff ff call 351 <panic> gettoken(ps, es, 0, 0); a71: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) a78: 00 a79: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) a80: 00 a81: 8b 45 0c mov 0xc(%ebp),%eax a84: 89 44 24 04 mov %eax,0x4(%esp) a88: 8b 45 08 mov 0x8(%ebp),%eax a8b: 89 04 24 mov %eax,(%esp) a8e: e8 99 fa ff ff call 52c <gettoken> cmd = parseredirs(cmd, ps, es); a93: 8b 45 0c mov 0xc(%ebp),%eax a96: 89 44 24 08 mov %eax,0x8(%esp) a9a: 8b 45 08 mov 0x8(%ebp),%eax a9d: 89 44 24 04 mov %eax,0x4(%esp) aa1: 8b 45 f4 mov -0xc(%ebp),%eax aa4: 89 04 24 mov %eax,(%esp) aa7: e8 0c fe ff ff call 8b8 <parseredirs> aac: 89 45 f4 mov %eax,-0xc(%ebp) return cmd; aaf: 8b 45 f4 mov -0xc(%ebp),%eax } ab2: c9 leave ab3: c3 ret 00000ab4 <parseexec>: struct cmd* parseexec(char **ps, char *es) { ab4: 55 push %ebp ab5: 89 e5 mov %esp,%ebp ab7: 83 ec 38 sub $0x38,%esp char *q, *eq; int tok, argc; struct execcmd *cmd; struct cmd *ret; if(peek(ps, es, "(")) aba: c7 44 24 08 53 15 00 movl $0x1553,0x8(%esp) ac1: 00 ac2: 8b 45 0c mov 0xc(%ebp),%eax ac5: 89 44 24 04 mov %eax,0x4(%esp) ac9: 8b 45 08 mov 0x8(%ebp),%eax acc: 89 04 24 mov %eax,(%esp) acf: e8 8f fb ff ff call 663 <peek> ad4: 85 c0 test %eax,%eax ad6: 74 17 je aef <parseexec+0x3b> return parseblock(ps, es); ad8: 8b 45 0c mov 0xc(%ebp),%eax adb: 89 44 24 04 mov %eax,0x4(%esp) adf: 8b 45 08 mov 0x8(%ebp),%eax ae2: 89 04 24 mov %eax,(%esp) ae5: e8 f6 fe ff ff call 9e0 <parseblock> aea: e9 0a 01 00 00 jmp bf9 <parseexec+0x145> ret = execcmd(); aef: e8 a8 f8 ff ff call 39c <execcmd> af4: 89 45 f0 mov %eax,-0x10(%ebp) cmd = (struct execcmd*)ret; af7: 8b 45 f0 mov -0x10(%ebp),%eax afa: 89 45 ec mov %eax,-0x14(%ebp) argc = 0; afd: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) ret = parseredirs(ret, ps, es); b04: 8b 45 0c mov 0xc(%ebp),%eax b07: 89 44 24 08 mov %eax,0x8(%esp) b0b: 8b 45 08 mov 0x8(%ebp),%eax b0e: 89 44 24 04 mov %eax,0x4(%esp) b12: 8b 45 f0 mov -0x10(%ebp),%eax b15: 89 04 24 mov %eax,(%esp) b18: e8 9b fd ff ff call 8b8 <parseredirs> b1d: 89 45 f0 mov %eax,-0x10(%ebp) while(!peek(ps, es, "|)&;")){ b20: e9 8d 00 00 00 jmp bb2 <parseexec+0xfe> if((tok=gettoken(ps, es, &q, &eq)) == 0) b25: 8d 45 e0 lea -0x20(%ebp),%eax b28: 89 44 24 0c mov %eax,0xc(%esp) b2c: 8d 45 e4 lea -0x1c(%ebp),%eax b2f: 89 44 24 08 mov %eax,0x8(%esp) b33: 8b 45 0c mov 0xc(%ebp),%eax b36: 89 44 24 04 mov %eax,0x4(%esp) b3a: 8b 45 08 mov 0x8(%ebp),%eax b3d: 89 04 24 mov %eax,(%esp) b40: e8 e7 f9 ff ff call 52c <gettoken> b45: 89 45 e8 mov %eax,-0x18(%ebp) b48: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) b4c: 0f 84 84 00 00 00 je bd6 <parseexec+0x122> break; if(tok != 'a') b52: 83 7d e8 61 cmpl $0x61,-0x18(%ebp) b56: 74 0c je b64 <parseexec+0xb0> panic("syntax"); b58: c7 04 24 26 15 00 00 movl $0x1526,(%esp) b5f: e8 ed f7 ff ff call 351 <panic> cmd->argv[argc] = q; b64: 8b 4d e4 mov -0x1c(%ebp),%ecx b67: 8b 45 ec mov -0x14(%ebp),%eax b6a: 8b 55 f4 mov -0xc(%ebp),%edx b6d: 89 4c 90 04 mov %ecx,0x4(%eax,%edx,4) cmd->eargv[argc] = eq; b71: 8b 55 e0 mov -0x20(%ebp),%edx b74: 8b 45 ec mov -0x14(%ebp),%eax b77: 8b 4d f4 mov -0xc(%ebp),%ecx b7a: 83 c1 08 add $0x8,%ecx b7d: 89 54 88 0c mov %edx,0xc(%eax,%ecx,4) argc++; b81: ff 45 f4 incl -0xc(%ebp) if(argc >= MAXARGS) b84: 83 7d f4 09 cmpl $0x9,-0xc(%ebp) b88: 7e 0c jle b96 <parseexec+0xe2> panic("too many args"); b8a: c7 04 24 75 15 00 00 movl $0x1575,(%esp) b91: e8 bb f7 ff ff call 351 <panic> ret = parseredirs(ret, ps, es); b96: 8b 45 0c mov 0xc(%ebp),%eax b99: 89 44 24 08 mov %eax,0x8(%esp) b9d: 8b 45 08 mov 0x8(%ebp),%eax ba0: 89 44 24 04 mov %eax,0x4(%esp) ba4: 8b 45 f0 mov -0x10(%ebp),%eax ba7: 89 04 24 mov %eax,(%esp) baa: e8 09 fd ff ff call 8b8 <parseredirs> baf: 89 45 f0 mov %eax,-0x10(%ebp) ret = execcmd(); cmd = (struct execcmd*)ret; argc = 0; ret = parseredirs(ret, ps, es); while(!peek(ps, es, "|)&;")){ bb2: c7 44 24 08 83 15 00 movl $0x1583,0x8(%esp) bb9: 00 bba: 8b 45 0c mov 0xc(%ebp),%eax bbd: 89 44 24 04 mov %eax,0x4(%esp) bc1: 8b 45 08 mov 0x8(%ebp),%eax bc4: 89 04 24 mov %eax,(%esp) bc7: e8 97 fa ff ff call 663 <peek> bcc: 85 c0 test %eax,%eax bce: 0f 84 51 ff ff ff je b25 <parseexec+0x71> bd4: eb 01 jmp bd7 <parseexec+0x123> if((tok=gettoken(ps, es, &q, &eq)) == 0) break; bd6: 90 nop argc++; if(argc >= MAXARGS) panic("too many args"); ret = parseredirs(ret, ps, es); } cmd->argv[argc] = 0; bd7: 8b 45 ec mov -0x14(%ebp),%eax bda: 8b 55 f4 mov -0xc(%ebp),%edx bdd: c7 44 90 04 00 00 00 movl $0x0,0x4(%eax,%edx,4) be4: 00 cmd->eargv[argc] = 0; be5: 8b 45 ec mov -0x14(%ebp),%eax be8: 8b 55 f4 mov -0xc(%ebp),%edx beb: 83 c2 08 add $0x8,%edx bee: c7 44 90 0c 00 00 00 movl $0x0,0xc(%eax,%edx,4) bf5: 00 return ret; bf6: 8b 45 f0 mov -0x10(%ebp),%eax } bf9: c9 leave bfa: c3 ret 00000bfb <nulterminate>: // NUL-terminate all the counted strings. struct cmd* nulterminate(struct cmd *cmd) { bfb: 55 push %ebp bfc: 89 e5 mov %esp,%ebp bfe: 83 ec 38 sub $0x38,%esp struct execcmd *ecmd; struct listcmd *lcmd; struct pipecmd *pcmd; struct redircmd *rcmd; if(cmd == 0) c01: 83 7d 08 00 cmpl $0x0,0x8(%ebp) c05: 75 0a jne c11 <nulterminate+0x16> return 0; c07: b8 00 00 00 00 mov $0x0,%eax c0c: e9 c8 00 00 00 jmp cd9 <nulterminate+0xde> switch(cmd->type){ c11: 8b 45 08 mov 0x8(%ebp),%eax c14: 8b 00 mov (%eax),%eax c16: 83 f8 05 cmp $0x5,%eax c19: 0f 87 b7 00 00 00 ja cd6 <nulterminate+0xdb> c1f: 8b 04 85 88 15 00 00 mov 0x1588(,%eax,4),%eax c26: ff e0 jmp *%eax case EXEC: ecmd = (struct execcmd*)cmd; c28: 8b 45 08 mov 0x8(%ebp),%eax c2b: 89 45 f0 mov %eax,-0x10(%ebp) for(i=0; ecmd->argv[i]; i++) c2e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) c35: eb 13 jmp c4a <nulterminate+0x4f> *ecmd->eargv[i] = 0; c37: 8b 45 f0 mov -0x10(%ebp),%eax c3a: 8b 55 f4 mov -0xc(%ebp),%edx c3d: 83 c2 08 add $0x8,%edx c40: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax c44: c6 00 00 movb $0x0,(%eax) return 0; switch(cmd->type){ case EXEC: ecmd = (struct execcmd*)cmd; for(i=0; ecmd->argv[i]; i++) c47: ff 45 f4 incl -0xc(%ebp) c4a: 8b 45 f0 mov -0x10(%ebp),%eax c4d: 8b 55 f4 mov -0xc(%ebp),%edx c50: 8b 44 90 04 mov 0x4(%eax,%edx,4),%eax c54: 85 c0 test %eax,%eax c56: 75 df jne c37 <nulterminate+0x3c> *ecmd->eargv[i] = 0; break; c58: eb 7c jmp cd6 <nulterminate+0xdb> case REDIR: rcmd = (struct redircmd*)cmd; c5a: 8b 45 08 mov 0x8(%ebp),%eax c5d: 89 45 ec mov %eax,-0x14(%ebp) nulterminate(rcmd->cmd); c60: 8b 45 ec mov -0x14(%ebp),%eax c63: 8b 40 04 mov 0x4(%eax),%eax c66: 89 04 24 mov %eax,(%esp) c69: e8 8d ff ff ff call bfb <nulterminate> *rcmd->efile = 0; c6e: 8b 45 ec mov -0x14(%ebp),%eax c71: 8b 40 0c mov 0xc(%eax),%eax c74: c6 00 00 movb $0x0,(%eax) break; c77: eb 5d jmp cd6 <nulterminate+0xdb> case PIPE: pcmd = (struct pipecmd*)cmd; c79: 8b 45 08 mov 0x8(%ebp),%eax c7c: 89 45 e8 mov %eax,-0x18(%ebp) nulterminate(pcmd->left); c7f: 8b 45 e8 mov -0x18(%ebp),%eax c82: 8b 40 04 mov 0x4(%eax),%eax c85: 89 04 24 mov %eax,(%esp) c88: e8 6e ff ff ff call bfb <nulterminate> nulterminate(pcmd->right); c8d: 8b 45 e8 mov -0x18(%ebp),%eax c90: 8b 40 08 mov 0x8(%eax),%eax c93: 89 04 24 mov %eax,(%esp) c96: e8 60 ff ff ff call bfb <nulterminate> break; c9b: eb 39 jmp cd6 <nulterminate+0xdb> case LIST: lcmd = (struct listcmd*)cmd; c9d: 8b 45 08 mov 0x8(%ebp),%eax ca0: 89 45 e4 mov %eax,-0x1c(%ebp) nulterminate(lcmd->left); ca3: 8b 45 e4 mov -0x1c(%ebp),%eax ca6: 8b 40 04 mov 0x4(%eax),%eax ca9: 89 04 24 mov %eax,(%esp) cac: e8 4a ff ff ff call bfb <nulterminate> nulterminate(lcmd->right); cb1: 8b 45 e4 mov -0x1c(%ebp),%eax cb4: 8b 40 08 mov 0x8(%eax),%eax cb7: 89 04 24 mov %eax,(%esp) cba: e8 3c ff ff ff call bfb <nulterminate> break; cbf: eb 15 jmp cd6 <nulterminate+0xdb> case BACK: bcmd = (struct backcmd*)cmd; cc1: 8b 45 08 mov 0x8(%ebp),%eax cc4: 89 45 e0 mov %eax,-0x20(%ebp) nulterminate(bcmd->cmd); cc7: 8b 45 e0 mov -0x20(%ebp),%eax cca: 8b 40 04 mov 0x4(%eax),%eax ccd: 89 04 24 mov %eax,(%esp) cd0: e8 26 ff ff ff call bfb <nulterminate> break; cd5: 90 nop } return cmd; cd6: 8b 45 08 mov 0x8(%ebp),%eax } cd9: c9 leave cda: c3 ret cdb: 90 nop 00000cdc <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { cdc: 55 push %ebp cdd: 89 e5 mov %esp,%ebp cdf: 57 push %edi ce0: 53 push %ebx asm volatile("cld; rep stosb" : ce1: 8b 4d 08 mov 0x8(%ebp),%ecx ce4: 8b 55 10 mov 0x10(%ebp),%edx ce7: 8b 45 0c mov 0xc(%ebp),%eax cea: 89 cb mov %ecx,%ebx cec: 89 df mov %ebx,%edi cee: 89 d1 mov %edx,%ecx cf0: fc cld cf1: f3 aa rep stos %al,%es:(%edi) cf3: 89 ca mov %ecx,%edx cf5: 89 fb mov %edi,%ebx cf7: 89 5d 08 mov %ebx,0x8(%ebp) cfa: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } cfd: 5b pop %ebx cfe: 5f pop %edi cff: 5d pop %ebp d00: c3 ret 00000d01 <strcpy>: #include "x86.h" #include "signal.h" char* strcpy(char *s, char *t) { d01: 55 push %ebp d02: 89 e5 mov %esp,%ebp d04: 83 ec 10 sub $0x10,%esp char *os; os = s; d07: 8b 45 08 mov 0x8(%ebp),%eax d0a: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) d0d: 90 nop d0e: 8b 45 0c mov 0xc(%ebp),%eax d11: 8a 10 mov (%eax),%dl d13: 8b 45 08 mov 0x8(%ebp),%eax d16: 88 10 mov %dl,(%eax) d18: 8b 45 08 mov 0x8(%ebp),%eax d1b: 8a 00 mov (%eax),%al d1d: 84 c0 test %al,%al d1f: 0f 95 c0 setne %al d22: ff 45 08 incl 0x8(%ebp) d25: ff 45 0c incl 0xc(%ebp) d28: 84 c0 test %al,%al d2a: 75 e2 jne d0e <strcpy+0xd> ; return os; d2c: 8b 45 fc mov -0x4(%ebp),%eax } d2f: c9 leave d30: c3 ret 00000d31 <strcmp>: int strcmp(const char *p, const char *q) { d31: 55 push %ebp d32: 89 e5 mov %esp,%ebp while(*p && *p == *q) d34: eb 06 jmp d3c <strcmp+0xb> p++, q++; d36: ff 45 08 incl 0x8(%ebp) d39: ff 45 0c incl 0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) d3c: 8b 45 08 mov 0x8(%ebp),%eax d3f: 8a 00 mov (%eax),%al d41: 84 c0 test %al,%al d43: 74 0e je d53 <strcmp+0x22> d45: 8b 45 08 mov 0x8(%ebp),%eax d48: 8a 10 mov (%eax),%dl d4a: 8b 45 0c mov 0xc(%ebp),%eax d4d: 8a 00 mov (%eax),%al d4f: 38 c2 cmp %al,%dl d51: 74 e3 je d36 <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; d53: 8b 45 08 mov 0x8(%ebp),%eax d56: 8a 00 mov (%eax),%al d58: 0f b6 d0 movzbl %al,%edx d5b: 8b 45 0c mov 0xc(%ebp),%eax d5e: 8a 00 mov (%eax),%al d60: 0f b6 c0 movzbl %al,%eax d63: 89 d1 mov %edx,%ecx d65: 29 c1 sub %eax,%ecx d67: 89 c8 mov %ecx,%eax } d69: 5d pop %ebp d6a: c3 ret 00000d6b <strlen>: uint strlen(char *s) { d6b: 55 push %ebp d6c: 89 e5 mov %esp,%ebp d6e: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) d71: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) d78: eb 03 jmp d7d <strlen+0x12> d7a: ff 45 fc incl -0x4(%ebp) d7d: 8b 55 fc mov -0x4(%ebp),%edx d80: 8b 45 08 mov 0x8(%ebp),%eax d83: 01 d0 add %edx,%eax d85: 8a 00 mov (%eax),%al d87: 84 c0 test %al,%al d89: 75 ef jne d7a <strlen+0xf> ; return n; d8b: 8b 45 fc mov -0x4(%ebp),%eax } d8e: c9 leave d8f: c3 ret 00000d90 <memset>: void* memset(void *dst, int c, uint n) { d90: 55 push %ebp d91: 89 e5 mov %esp,%ebp d93: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); d96: 8b 45 10 mov 0x10(%ebp),%eax d99: 89 44 24 08 mov %eax,0x8(%esp) d9d: 8b 45 0c mov 0xc(%ebp),%eax da0: 89 44 24 04 mov %eax,0x4(%esp) da4: 8b 45 08 mov 0x8(%ebp),%eax da7: 89 04 24 mov %eax,(%esp) daa: e8 2d ff ff ff call cdc <stosb> return dst; daf: 8b 45 08 mov 0x8(%ebp),%eax } db2: c9 leave db3: c3 ret 00000db4 <strchr>: char* strchr(const char *s, char c) { db4: 55 push %ebp db5: 89 e5 mov %esp,%ebp db7: 83 ec 04 sub $0x4,%esp dba: 8b 45 0c mov 0xc(%ebp),%eax dbd: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) dc0: eb 12 jmp dd4 <strchr+0x20> if(*s == c) dc2: 8b 45 08 mov 0x8(%ebp),%eax dc5: 8a 00 mov (%eax),%al dc7: 3a 45 fc cmp -0x4(%ebp),%al dca: 75 05 jne dd1 <strchr+0x1d> return (char*)s; dcc: 8b 45 08 mov 0x8(%ebp),%eax dcf: eb 11 jmp de2 <strchr+0x2e> } char* strchr(const char *s, char c) { for(; *s; s++) dd1: ff 45 08 incl 0x8(%ebp) dd4: 8b 45 08 mov 0x8(%ebp),%eax dd7: 8a 00 mov (%eax),%al dd9: 84 c0 test %al,%al ddb: 75 e5 jne dc2 <strchr+0xe> if(*s == c) return (char*)s; return 0; ddd: b8 00 00 00 00 mov $0x0,%eax } de2: c9 leave de3: c3 ret 00000de4 <gets>: char* gets(char *buf, int max) { de4: 55 push %ebp de5: 89 e5 mov %esp,%ebp de7: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ dea: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) df1: eb 42 jmp e35 <gets+0x51> cc = read(0, &c, 1); df3: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) dfa: 00 dfb: 8d 45 ef lea -0x11(%ebp),%eax dfe: 89 44 24 04 mov %eax,0x4(%esp) e02: c7 04 24 00 00 00 00 movl $0x0,(%esp) e09: e8 62 01 00 00 call f70 <read> e0e: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) e11: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) e15: 7e 29 jle e40 <gets+0x5c> break; buf[i++] = c; e17: 8b 55 f4 mov -0xc(%ebp),%edx e1a: 8b 45 08 mov 0x8(%ebp),%eax e1d: 01 c2 add %eax,%edx e1f: 8a 45 ef mov -0x11(%ebp),%al e22: 88 02 mov %al,(%edx) e24: ff 45 f4 incl -0xc(%ebp) if(c == '\n' || c == '\r') e27: 8a 45 ef mov -0x11(%ebp),%al e2a: 3c 0a cmp $0xa,%al e2c: 74 13 je e41 <gets+0x5d> e2e: 8a 45 ef mov -0x11(%ebp),%al e31: 3c 0d cmp $0xd,%al e33: 74 0c je e41 <gets+0x5d> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ e35: 8b 45 f4 mov -0xc(%ebp),%eax e38: 40 inc %eax e39: 3b 45 0c cmp 0xc(%ebp),%eax e3c: 7c b5 jl df3 <gets+0xf> e3e: eb 01 jmp e41 <gets+0x5d> cc = read(0, &c, 1); if(cc < 1) break; e40: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; e41: 8b 55 f4 mov -0xc(%ebp),%edx e44: 8b 45 08 mov 0x8(%ebp),%eax e47: 01 d0 add %edx,%eax e49: c6 00 00 movb $0x0,(%eax) return buf; e4c: 8b 45 08 mov 0x8(%ebp),%eax } e4f: c9 leave e50: c3 ret 00000e51 <stat>: int stat(char *n, struct stat *st) { e51: 55 push %ebp e52: 89 e5 mov %esp,%ebp e54: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); e57: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) e5e: 00 e5f: 8b 45 08 mov 0x8(%ebp),%eax e62: 89 04 24 mov %eax,(%esp) e65: e8 2e 01 00 00 call f98 <open> e6a: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) e6d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) e71: 79 07 jns e7a <stat+0x29> return -1; e73: b8 ff ff ff ff mov $0xffffffff,%eax e78: eb 23 jmp e9d <stat+0x4c> r = fstat(fd, st); e7a: 8b 45 0c mov 0xc(%ebp),%eax e7d: 89 44 24 04 mov %eax,0x4(%esp) e81: 8b 45 f4 mov -0xc(%ebp),%eax e84: 89 04 24 mov %eax,(%esp) e87: e8 24 01 00 00 call fb0 <fstat> e8c: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); e8f: 8b 45 f4 mov -0xc(%ebp),%eax e92: 89 04 24 mov %eax,(%esp) e95: e8 e6 00 00 00 call f80 <close> return r; e9a: 8b 45 f0 mov -0x10(%ebp),%eax } e9d: c9 leave e9e: c3 ret 00000e9f <atoi>: int atoi(const char *s) { e9f: 55 push %ebp ea0: 89 e5 mov %esp,%ebp ea2: 83 ec 10 sub $0x10,%esp int n; n = 0; ea5: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') eac: eb 21 jmp ecf <atoi+0x30> n = n*10 + *s++ - '0'; eae: 8b 55 fc mov -0x4(%ebp),%edx eb1: 89 d0 mov %edx,%eax eb3: c1 e0 02 shl $0x2,%eax eb6: 01 d0 add %edx,%eax eb8: d1 e0 shl %eax eba: 89 c2 mov %eax,%edx ebc: 8b 45 08 mov 0x8(%ebp),%eax ebf: 8a 00 mov (%eax),%al ec1: 0f be c0 movsbl %al,%eax ec4: 01 d0 add %edx,%eax ec6: 83 e8 30 sub $0x30,%eax ec9: 89 45 fc mov %eax,-0x4(%ebp) ecc: ff 45 08 incl 0x8(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') ecf: 8b 45 08 mov 0x8(%ebp),%eax ed2: 8a 00 mov (%eax),%al ed4: 3c 2f cmp $0x2f,%al ed6: 7e 09 jle ee1 <atoi+0x42> ed8: 8b 45 08 mov 0x8(%ebp),%eax edb: 8a 00 mov (%eax),%al edd: 3c 39 cmp $0x39,%al edf: 7e cd jle eae <atoi+0xf> n = n*10 + *s++ - '0'; return n; ee1: 8b 45 fc mov -0x4(%ebp),%eax } ee4: c9 leave ee5: c3 ret 00000ee6 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { ee6: 55 push %ebp ee7: 89 e5 mov %esp,%ebp ee9: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; eec: 8b 45 08 mov 0x8(%ebp),%eax eef: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; ef2: 8b 45 0c mov 0xc(%ebp),%eax ef5: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) ef8: eb 10 jmp f0a <memmove+0x24> *dst++ = *src++; efa: 8b 45 f8 mov -0x8(%ebp),%eax efd: 8a 10 mov (%eax),%dl eff: 8b 45 fc mov -0x4(%ebp),%eax f02: 88 10 mov %dl,(%eax) f04: ff 45 fc incl -0x4(%ebp) f07: ff 45 f8 incl -0x8(%ebp) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) f0a: 83 7d 10 00 cmpl $0x0,0x10(%ebp) f0e: 0f 9f c0 setg %al f11: ff 4d 10 decl 0x10(%ebp) f14: 84 c0 test %al,%al f16: 75 e2 jne efa <memmove+0x14> *dst++ = *src++; return vdst; f18: 8b 45 08 mov 0x8(%ebp),%eax } f1b: c9 leave f1c: c3 ret 00000f1d <trampoline>: f1d: 5a pop %edx f1e: 59 pop %ecx f1f: 58 pop %eax f20: 03 25 04 00 00 00 add 0x4,%esp f26: c9 leave f27: c3 ret 00000f28 <signal>: "addl 4, %esp\n\t" "leave\n\t" "ret\n\t" ); int signal(int signum, sighandler_t handler) { f28: 55 push %ebp f29: 89 e5 mov %esp,%ebp f2b: 83 ec 18 sub $0x18,%esp register_signal_handler(signum, handler, trampoline); f2e: c7 44 24 08 1d 0f 00 movl $0xf1d,0x8(%esp) f35: 00 f36: 8b 45 0c mov 0xc(%ebp),%eax f39: 89 44 24 04 mov %eax,0x4(%esp) f3d: 8b 45 08 mov 0x8(%ebp),%eax f40: 89 04 24 mov %eax,(%esp) f43: e8 b8 00 00 00 call 1000 <register_signal_handler> return 0; f48: b8 00 00 00 00 mov $0x0,%eax } f4d: c9 leave f4e: c3 ret f4f: 90 nop 00000f50 <fork>: f50: b8 01 00 00 00 mov $0x1,%eax f55: cd 40 int $0x40 f57: c3 ret 00000f58 <exit>: f58: b8 02 00 00 00 mov $0x2,%eax f5d: cd 40 int $0x40 f5f: c3 ret 00000f60 <wait>: f60: b8 03 00 00 00 mov $0x3,%eax f65: cd 40 int $0x40 f67: c3 ret 00000f68 <pipe>: f68: b8 04 00 00 00 mov $0x4,%eax f6d: cd 40 int $0x40 f6f: c3 ret 00000f70 <read>: f70: b8 05 00 00 00 mov $0x5,%eax f75: cd 40 int $0x40 f77: c3 ret 00000f78 <write>: f78: b8 10 00 00 00 mov $0x10,%eax f7d: cd 40 int $0x40 f7f: c3 ret 00000f80 <close>: f80: b8 15 00 00 00 mov $0x15,%eax f85: cd 40 int $0x40 f87: c3 ret 00000f88 <kill>: f88: b8 06 00 00 00 mov $0x6,%eax f8d: cd 40 int $0x40 f8f: c3 ret 00000f90 <exec>: f90: b8 07 00 00 00 mov $0x7,%eax f95: cd 40 int $0x40 f97: c3 ret 00000f98 <open>: f98: b8 0f 00 00 00 mov $0xf,%eax f9d: cd 40 int $0x40 f9f: c3 ret 00000fa0 <mknod>: fa0: b8 11 00 00 00 mov $0x11,%eax fa5: cd 40 int $0x40 fa7: c3 ret 00000fa8 <unlink>: fa8: b8 12 00 00 00 mov $0x12,%eax fad: cd 40 int $0x40 faf: c3 ret 00000fb0 <fstat>: fb0: b8 08 00 00 00 mov $0x8,%eax fb5: cd 40 int $0x40 fb7: c3 ret 00000fb8 <link>: fb8: b8 13 00 00 00 mov $0x13,%eax fbd: cd 40 int $0x40 fbf: c3 ret 00000fc0 <mkdir>: fc0: b8 14 00 00 00 mov $0x14,%eax fc5: cd 40 int $0x40 fc7: c3 ret 00000fc8 <chdir>: fc8: b8 09 00 00 00 mov $0x9,%eax fcd: cd 40 int $0x40 fcf: c3 ret 00000fd0 <dup>: fd0: b8 0a 00 00 00 mov $0xa,%eax fd5: cd 40 int $0x40 fd7: c3 ret 00000fd8 <getpid>: fd8: b8 0b 00 00 00 mov $0xb,%eax fdd: cd 40 int $0x40 fdf: c3 ret 00000fe0 <sbrk>: fe0: b8 0c 00 00 00 mov $0xc,%eax fe5: cd 40 int $0x40 fe7: c3 ret 00000fe8 <sleep>: fe8: b8 0d 00 00 00 mov $0xd,%eax fed: cd 40 int $0x40 fef: c3 ret 00000ff0 <uptime>: ff0: b8 0e 00 00 00 mov $0xe,%eax ff5: cd 40 int $0x40 ff7: c3 ret 00000ff8 <halt>: ff8: b8 16 00 00 00 mov $0x16,%eax ffd: cd 40 int $0x40 fff: c3 ret 00001000 <register_signal_handler>: 1000: b8 17 00 00 00 mov $0x17,%eax 1005: cd 40 int $0x40 1007: c3 ret 00001008 <alarm>: 1008: b8 18 00 00 00 mov $0x18,%eax 100d: cd 40 int $0x40 100f: c3 ret 00001010 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 1010: 55 push %ebp 1011: 89 e5 mov %esp,%ebp 1013: 83 ec 28 sub $0x28,%esp 1016: 8b 45 0c mov 0xc(%ebp),%eax 1019: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 101c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 1023: 00 1024: 8d 45 f4 lea -0xc(%ebp),%eax 1027: 89 44 24 04 mov %eax,0x4(%esp) 102b: 8b 45 08 mov 0x8(%ebp),%eax 102e: 89 04 24 mov %eax,(%esp) 1031: e8 42 ff ff ff call f78 <write> } 1036: c9 leave 1037: c3 ret 00001038 <printint>: static void printint(int fd, int xx, int base, int sgn) { 1038: 55 push %ebp 1039: 89 e5 mov %esp,%ebp 103b: 83 ec 48 sub $0x48,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 103e: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 1045: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 1049: 74 17 je 1062 <printint+0x2a> 104b: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 104f: 79 11 jns 1062 <printint+0x2a> neg = 1; 1051: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 1058: 8b 45 0c mov 0xc(%ebp),%eax 105b: f7 d8 neg %eax 105d: 89 45 ec mov %eax,-0x14(%ebp) 1060: eb 06 jmp 1068 <printint+0x30> } else { x = xx; 1062: 8b 45 0c mov 0xc(%ebp),%eax 1065: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 1068: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 106f: 8b 4d 10 mov 0x10(%ebp),%ecx 1072: 8b 45 ec mov -0x14(%ebp),%eax 1075: ba 00 00 00 00 mov $0x0,%edx 107a: f7 f1 div %ecx 107c: 89 d0 mov %edx,%eax 107e: 8a 80 50 1a 00 00 mov 0x1a50(%eax),%al 1084: 8d 4d dc lea -0x24(%ebp),%ecx 1087: 8b 55 f4 mov -0xc(%ebp),%edx 108a: 01 ca add %ecx,%edx 108c: 88 02 mov %al,(%edx) 108e: ff 45 f4 incl -0xc(%ebp) }while((x /= base) != 0); 1091: 8b 55 10 mov 0x10(%ebp),%edx 1094: 89 55 d4 mov %edx,-0x2c(%ebp) 1097: 8b 45 ec mov -0x14(%ebp),%eax 109a: ba 00 00 00 00 mov $0x0,%edx 109f: f7 75 d4 divl -0x2c(%ebp) 10a2: 89 45 ec mov %eax,-0x14(%ebp) 10a5: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 10a9: 75 c4 jne 106f <printint+0x37> if(neg) 10ab: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 10af: 74 2c je 10dd <printint+0xa5> buf[i++] = '-'; 10b1: 8d 55 dc lea -0x24(%ebp),%edx 10b4: 8b 45 f4 mov -0xc(%ebp),%eax 10b7: 01 d0 add %edx,%eax 10b9: c6 00 2d movb $0x2d,(%eax) 10bc: ff 45 f4 incl -0xc(%ebp) while(--i >= 0) 10bf: eb 1c jmp 10dd <printint+0xa5> putc(fd, buf[i]); 10c1: 8d 55 dc lea -0x24(%ebp),%edx 10c4: 8b 45 f4 mov -0xc(%ebp),%eax 10c7: 01 d0 add %edx,%eax 10c9: 8a 00 mov (%eax),%al 10cb: 0f be c0 movsbl %al,%eax 10ce: 89 44 24 04 mov %eax,0x4(%esp) 10d2: 8b 45 08 mov 0x8(%ebp),%eax 10d5: 89 04 24 mov %eax,(%esp) 10d8: e8 33 ff ff ff call 1010 <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 10dd: ff 4d f4 decl -0xc(%ebp) 10e0: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 10e4: 79 db jns 10c1 <printint+0x89> putc(fd, buf[i]); } 10e6: c9 leave 10e7: c3 ret 000010e8 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 10e8: 55 push %ebp 10e9: 89 e5 mov %esp,%ebp 10eb: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 10ee: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 10f5: 8d 45 0c lea 0xc(%ebp),%eax 10f8: 83 c0 04 add $0x4,%eax 10fb: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 10fe: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 1105: e9 78 01 00 00 jmp 1282 <printf+0x19a> c = fmt[i] & 0xff; 110a: 8b 55 0c mov 0xc(%ebp),%edx 110d: 8b 45 f0 mov -0x10(%ebp),%eax 1110: 01 d0 add %edx,%eax 1112: 8a 00 mov (%eax),%al 1114: 0f be c0 movsbl %al,%eax 1117: 25 ff 00 00 00 and $0xff,%eax 111c: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 111f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1123: 75 2c jne 1151 <printf+0x69> if(c == '%'){ 1125: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 1129: 75 0c jne 1137 <printf+0x4f> state = '%'; 112b: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 1132: e9 48 01 00 00 jmp 127f <printf+0x197> } else { putc(fd, c); 1137: 8b 45 e4 mov -0x1c(%ebp),%eax 113a: 0f be c0 movsbl %al,%eax 113d: 89 44 24 04 mov %eax,0x4(%esp) 1141: 8b 45 08 mov 0x8(%ebp),%eax 1144: 89 04 24 mov %eax,(%esp) 1147: e8 c4 fe ff ff call 1010 <putc> 114c: e9 2e 01 00 00 jmp 127f <printf+0x197> } } else if(state == '%'){ 1151: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 1155: 0f 85 24 01 00 00 jne 127f <printf+0x197> if(c == 'd'){ 115b: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 115f: 75 2d jne 118e <printf+0xa6> printint(fd, *ap, 10, 1); 1161: 8b 45 e8 mov -0x18(%ebp),%eax 1164: 8b 00 mov (%eax),%eax 1166: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 116d: 00 116e: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 1175: 00 1176: 89 44 24 04 mov %eax,0x4(%esp) 117a: 8b 45 08 mov 0x8(%ebp),%eax 117d: 89 04 24 mov %eax,(%esp) 1180: e8 b3 fe ff ff call 1038 <printint> ap++; 1185: 83 45 e8 04 addl $0x4,-0x18(%ebp) 1189: e9 ea 00 00 00 jmp 1278 <printf+0x190> } else if(c == 'x' || c == 'p'){ 118e: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 1192: 74 06 je 119a <printf+0xb2> 1194: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 1198: 75 2d jne 11c7 <printf+0xdf> printint(fd, *ap, 16, 0); 119a: 8b 45 e8 mov -0x18(%ebp),%eax 119d: 8b 00 mov (%eax),%eax 119f: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 11a6: 00 11a7: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 11ae: 00 11af: 89 44 24 04 mov %eax,0x4(%esp) 11b3: 8b 45 08 mov 0x8(%ebp),%eax 11b6: 89 04 24 mov %eax,(%esp) 11b9: e8 7a fe ff ff call 1038 <printint> ap++; 11be: 83 45 e8 04 addl $0x4,-0x18(%ebp) 11c2: e9 b1 00 00 00 jmp 1278 <printf+0x190> } else if(c == 's'){ 11c7: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 11cb: 75 43 jne 1210 <printf+0x128> s = (char*)*ap; 11cd: 8b 45 e8 mov -0x18(%ebp),%eax 11d0: 8b 00 mov (%eax),%eax 11d2: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 11d5: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 11d9: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 11dd: 75 25 jne 1204 <printf+0x11c> s = "(null)"; 11df: c7 45 f4 a0 15 00 00 movl $0x15a0,-0xc(%ebp) while(*s != 0){ 11e6: eb 1c jmp 1204 <printf+0x11c> putc(fd, *s); 11e8: 8b 45 f4 mov -0xc(%ebp),%eax 11eb: 8a 00 mov (%eax),%al 11ed: 0f be c0 movsbl %al,%eax 11f0: 89 44 24 04 mov %eax,0x4(%esp) 11f4: 8b 45 08 mov 0x8(%ebp),%eax 11f7: 89 04 24 mov %eax,(%esp) 11fa: e8 11 fe ff ff call 1010 <putc> s++; 11ff: ff 45 f4 incl -0xc(%ebp) 1202: eb 01 jmp 1205 <printf+0x11d> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 1204: 90 nop 1205: 8b 45 f4 mov -0xc(%ebp),%eax 1208: 8a 00 mov (%eax),%al 120a: 84 c0 test %al,%al 120c: 75 da jne 11e8 <printf+0x100> 120e: eb 68 jmp 1278 <printf+0x190> putc(fd, *s); s++; } } else if(c == 'c'){ 1210: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 1214: 75 1d jne 1233 <printf+0x14b> putc(fd, *ap); 1216: 8b 45 e8 mov -0x18(%ebp),%eax 1219: 8b 00 mov (%eax),%eax 121b: 0f be c0 movsbl %al,%eax 121e: 89 44 24 04 mov %eax,0x4(%esp) 1222: 8b 45 08 mov 0x8(%ebp),%eax 1225: 89 04 24 mov %eax,(%esp) 1228: e8 e3 fd ff ff call 1010 <putc> ap++; 122d: 83 45 e8 04 addl $0x4,-0x18(%ebp) 1231: eb 45 jmp 1278 <printf+0x190> } else if(c == '%'){ 1233: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 1237: 75 17 jne 1250 <printf+0x168> putc(fd, c); 1239: 8b 45 e4 mov -0x1c(%ebp),%eax 123c: 0f be c0 movsbl %al,%eax 123f: 89 44 24 04 mov %eax,0x4(%esp) 1243: 8b 45 08 mov 0x8(%ebp),%eax 1246: 89 04 24 mov %eax,(%esp) 1249: e8 c2 fd ff ff call 1010 <putc> 124e: eb 28 jmp 1278 <printf+0x190> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 1250: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 1257: 00 1258: 8b 45 08 mov 0x8(%ebp),%eax 125b: 89 04 24 mov %eax,(%esp) 125e: e8 ad fd ff ff call 1010 <putc> putc(fd, c); 1263: 8b 45 e4 mov -0x1c(%ebp),%eax 1266: 0f be c0 movsbl %al,%eax 1269: 89 44 24 04 mov %eax,0x4(%esp) 126d: 8b 45 08 mov 0x8(%ebp),%eax 1270: 89 04 24 mov %eax,(%esp) 1273: e8 98 fd ff ff call 1010 <putc> } state = 0; 1278: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 127f: ff 45 f0 incl -0x10(%ebp) 1282: 8b 55 0c mov 0xc(%ebp),%edx 1285: 8b 45 f0 mov -0x10(%ebp),%eax 1288: 01 d0 add %edx,%eax 128a: 8a 00 mov (%eax),%al 128c: 84 c0 test %al,%al 128e: 0f 85 76 fe ff ff jne 110a <printf+0x22> putc(fd, c); } state = 0; } } } 1294: c9 leave 1295: c3 ret 1296: 66 90 xchg %ax,%ax 00001298 <free>: static Header base; static Header *freep; void free(void *ap) { 1298: 55 push %ebp 1299: 89 e5 mov %esp,%ebp 129b: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 129e: 8b 45 08 mov 0x8(%ebp),%eax 12a1: 83 e8 08 sub $0x8,%eax 12a4: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 12a7: a1 ec 1a 00 00 mov 0x1aec,%eax 12ac: 89 45 fc mov %eax,-0x4(%ebp) 12af: eb 24 jmp 12d5 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 12b1: 8b 45 fc mov -0x4(%ebp),%eax 12b4: 8b 00 mov (%eax),%eax 12b6: 3b 45 fc cmp -0x4(%ebp),%eax 12b9: 77 12 ja 12cd <free+0x35> 12bb: 8b 45 f8 mov -0x8(%ebp),%eax 12be: 3b 45 fc cmp -0x4(%ebp),%eax 12c1: 77 24 ja 12e7 <free+0x4f> 12c3: 8b 45 fc mov -0x4(%ebp),%eax 12c6: 8b 00 mov (%eax),%eax 12c8: 3b 45 f8 cmp -0x8(%ebp),%eax 12cb: 77 1a ja 12e7 <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 12cd: 8b 45 fc mov -0x4(%ebp),%eax 12d0: 8b 00 mov (%eax),%eax 12d2: 89 45 fc mov %eax,-0x4(%ebp) 12d5: 8b 45 f8 mov -0x8(%ebp),%eax 12d8: 3b 45 fc cmp -0x4(%ebp),%eax 12db: 76 d4 jbe 12b1 <free+0x19> 12dd: 8b 45 fc mov -0x4(%ebp),%eax 12e0: 8b 00 mov (%eax),%eax 12e2: 3b 45 f8 cmp -0x8(%ebp),%eax 12e5: 76 ca jbe 12b1 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 12e7: 8b 45 f8 mov -0x8(%ebp),%eax 12ea: 8b 40 04 mov 0x4(%eax),%eax 12ed: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 12f4: 8b 45 f8 mov -0x8(%ebp),%eax 12f7: 01 c2 add %eax,%edx 12f9: 8b 45 fc mov -0x4(%ebp),%eax 12fc: 8b 00 mov (%eax),%eax 12fe: 39 c2 cmp %eax,%edx 1300: 75 24 jne 1326 <free+0x8e> bp->s.size += p->s.ptr->s.size; 1302: 8b 45 f8 mov -0x8(%ebp),%eax 1305: 8b 50 04 mov 0x4(%eax),%edx 1308: 8b 45 fc mov -0x4(%ebp),%eax 130b: 8b 00 mov (%eax),%eax 130d: 8b 40 04 mov 0x4(%eax),%eax 1310: 01 c2 add %eax,%edx 1312: 8b 45 f8 mov -0x8(%ebp),%eax 1315: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 1318: 8b 45 fc mov -0x4(%ebp),%eax 131b: 8b 00 mov (%eax),%eax 131d: 8b 10 mov (%eax),%edx 131f: 8b 45 f8 mov -0x8(%ebp),%eax 1322: 89 10 mov %edx,(%eax) 1324: eb 0a jmp 1330 <free+0x98> } else bp->s.ptr = p->s.ptr; 1326: 8b 45 fc mov -0x4(%ebp),%eax 1329: 8b 10 mov (%eax),%edx 132b: 8b 45 f8 mov -0x8(%ebp),%eax 132e: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 1330: 8b 45 fc mov -0x4(%ebp),%eax 1333: 8b 40 04 mov 0x4(%eax),%eax 1336: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 133d: 8b 45 fc mov -0x4(%ebp),%eax 1340: 01 d0 add %edx,%eax 1342: 3b 45 f8 cmp -0x8(%ebp),%eax 1345: 75 20 jne 1367 <free+0xcf> p->s.size += bp->s.size; 1347: 8b 45 fc mov -0x4(%ebp),%eax 134a: 8b 50 04 mov 0x4(%eax),%edx 134d: 8b 45 f8 mov -0x8(%ebp),%eax 1350: 8b 40 04 mov 0x4(%eax),%eax 1353: 01 c2 add %eax,%edx 1355: 8b 45 fc mov -0x4(%ebp),%eax 1358: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 135b: 8b 45 f8 mov -0x8(%ebp),%eax 135e: 8b 10 mov (%eax),%edx 1360: 8b 45 fc mov -0x4(%ebp),%eax 1363: 89 10 mov %edx,(%eax) 1365: eb 08 jmp 136f <free+0xd7> } else p->s.ptr = bp; 1367: 8b 45 fc mov -0x4(%ebp),%eax 136a: 8b 55 f8 mov -0x8(%ebp),%edx 136d: 89 10 mov %edx,(%eax) freep = p; 136f: 8b 45 fc mov -0x4(%ebp),%eax 1372: a3 ec 1a 00 00 mov %eax,0x1aec } 1377: c9 leave 1378: c3 ret 00001379 <morecore>: static Header* morecore(uint nu) { 1379: 55 push %ebp 137a: 89 e5 mov %esp,%ebp 137c: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) 137f: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 1386: 77 07 ja 138f <morecore+0x16> nu = 4096; 1388: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 138f: 8b 45 08 mov 0x8(%ebp),%eax 1392: c1 e0 03 shl $0x3,%eax 1395: 89 04 24 mov %eax,(%esp) 1398: e8 43 fc ff ff call fe0 <sbrk> 139d: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 13a0: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 13a4: 75 07 jne 13ad <morecore+0x34> return 0; 13a6: b8 00 00 00 00 mov $0x0,%eax 13ab: eb 22 jmp 13cf <morecore+0x56> hp = (Header*)p; 13ad: 8b 45 f4 mov -0xc(%ebp),%eax 13b0: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 13b3: 8b 45 f0 mov -0x10(%ebp),%eax 13b6: 8b 55 08 mov 0x8(%ebp),%edx 13b9: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 13bc: 8b 45 f0 mov -0x10(%ebp),%eax 13bf: 83 c0 08 add $0x8,%eax 13c2: 89 04 24 mov %eax,(%esp) 13c5: e8 ce fe ff ff call 1298 <free> return freep; 13ca: a1 ec 1a 00 00 mov 0x1aec,%eax } 13cf: c9 leave 13d0: c3 ret 000013d1 <malloc>: void* malloc(uint nbytes) { 13d1: 55 push %ebp 13d2: 89 e5 mov %esp,%ebp 13d4: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 13d7: 8b 45 08 mov 0x8(%ebp),%eax 13da: 83 c0 07 add $0x7,%eax 13dd: c1 e8 03 shr $0x3,%eax 13e0: 40 inc %eax 13e1: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 13e4: a1 ec 1a 00 00 mov 0x1aec,%eax 13e9: 89 45 f0 mov %eax,-0x10(%ebp) 13ec: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 13f0: 75 23 jne 1415 <malloc+0x44> base.s.ptr = freep = prevp = &base; 13f2: c7 45 f0 e4 1a 00 00 movl $0x1ae4,-0x10(%ebp) 13f9: 8b 45 f0 mov -0x10(%ebp),%eax 13fc: a3 ec 1a 00 00 mov %eax,0x1aec 1401: a1 ec 1a 00 00 mov 0x1aec,%eax 1406: a3 e4 1a 00 00 mov %eax,0x1ae4 base.s.size = 0; 140b: c7 05 e8 1a 00 00 00 movl $0x0,0x1ae8 1412: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1415: 8b 45 f0 mov -0x10(%ebp),%eax 1418: 8b 00 mov (%eax),%eax 141a: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 141d: 8b 45 f4 mov -0xc(%ebp),%eax 1420: 8b 40 04 mov 0x4(%eax),%eax 1423: 3b 45 ec cmp -0x14(%ebp),%eax 1426: 72 4d jb 1475 <malloc+0xa4> if(p->s.size == nunits) 1428: 8b 45 f4 mov -0xc(%ebp),%eax 142b: 8b 40 04 mov 0x4(%eax),%eax 142e: 3b 45 ec cmp -0x14(%ebp),%eax 1431: 75 0c jne 143f <malloc+0x6e> prevp->s.ptr = p->s.ptr; 1433: 8b 45 f4 mov -0xc(%ebp),%eax 1436: 8b 10 mov (%eax),%edx 1438: 8b 45 f0 mov -0x10(%ebp),%eax 143b: 89 10 mov %edx,(%eax) 143d: eb 26 jmp 1465 <malloc+0x94> else { p->s.size -= nunits; 143f: 8b 45 f4 mov -0xc(%ebp),%eax 1442: 8b 40 04 mov 0x4(%eax),%eax 1445: 89 c2 mov %eax,%edx 1447: 2b 55 ec sub -0x14(%ebp),%edx 144a: 8b 45 f4 mov -0xc(%ebp),%eax 144d: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 1450: 8b 45 f4 mov -0xc(%ebp),%eax 1453: 8b 40 04 mov 0x4(%eax),%eax 1456: c1 e0 03 shl $0x3,%eax 1459: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 145c: 8b 45 f4 mov -0xc(%ebp),%eax 145f: 8b 55 ec mov -0x14(%ebp),%edx 1462: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 1465: 8b 45 f0 mov -0x10(%ebp),%eax 1468: a3 ec 1a 00 00 mov %eax,0x1aec return (void*)(p + 1); 146d: 8b 45 f4 mov -0xc(%ebp),%eax 1470: 83 c0 08 add $0x8,%eax 1473: eb 38 jmp 14ad <malloc+0xdc> } if(p == freep) 1475: a1 ec 1a 00 00 mov 0x1aec,%eax 147a: 39 45 f4 cmp %eax,-0xc(%ebp) 147d: 75 1b jne 149a <malloc+0xc9> if((p = morecore(nunits)) == 0) 147f: 8b 45 ec mov -0x14(%ebp),%eax 1482: 89 04 24 mov %eax,(%esp) 1485: e8 ef fe ff ff call 1379 <morecore> 148a: 89 45 f4 mov %eax,-0xc(%ebp) 148d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1491: 75 07 jne 149a <malloc+0xc9> return 0; 1493: b8 00 00 00 00 mov $0x0,%eax 1498: eb 13 jmp 14ad <malloc+0xdc> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 149a: 8b 45 f4 mov -0xc(%ebp),%eax 149d: 89 45 f0 mov %eax,-0x10(%ebp) 14a0: 8b 45 f4 mov -0xc(%ebp),%eax 14a3: 8b 00 mov (%eax),%eax 14a5: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 14a8: e9 70 ff ff ff jmp 141d <malloc+0x4c> } 14ad: c9 leave 14ae: c3 ret
oeis/075/A075417.asm
neoneye/loda-programs
11
101354
<filename>oeis/075/A075417.asm ; A075417: Squares of A002282: a(n) = (8*(10^n - 1)/9)^2. ; 0,64,7744,788544,78996544,7901076544,790121876544,79012329876544,7901234409876544,790123455209876544,79012345663209876544,7901234567743209876544,790123456788543209876544,79012345678996543209876544,7901234567901076543209876544,790123456790121876543209876544,79012345679012329876543209876544,7901234567901234409876543209876544,790123456790123455209876543209876544,79012345679012345663209876543209876544,7901234567901234567743209876543209876544,790123456790123456788543209876543209876544 mov $1,10 pow $1,$0 sub $1,1 pow $1,2 div $1,81 mul $1,64 mov $0,$1
Transynther/x86/_processed/NONE/_st_/i7-7700_9_0x48.log_7280_269.asm
ljhsiun2/medusa
9
83800
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %r8 push %rcx push %rdi push %rsi lea addresses_WT_ht+0x5ee0, %rsi lea addresses_D_ht+0x14d54, %rdi nop nop nop nop nop sub $12947, %r13 mov $43, %rcx rep movsl nop nop nop xor $23153, %r15 lea addresses_D_ht+0x41d0, %r8 nop add %r10, %r10 mov $0x6162636465666768, %r15 movq %r15, %xmm3 vmovups %ymm3, (%r8) nop nop nop nop nop xor $57328, %rdi lea addresses_A_ht+0x154d0, %r13 nop nop nop nop nop inc %rsi mov (%r13), %ecx nop dec %rdi lea addresses_D_ht+0x19f38, %r15 nop add $60810, %r13 mov $0x6162636465666768, %r10 movq %r10, (%r15) sub %r15, %r15 pop %rsi pop %rdi pop %rcx pop %r8 pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r14 push %rbp push %rcx push %rdx // Store mov $0x8f0, %r14 nop nop sub $36359, %r12 mov $0x5152535455565758, %rbp movq %rbp, %xmm0 vmovups %ymm0, (%r14) nop nop nop cmp $13250, %r14 // Store lea addresses_US+0x26d0, %rcx add %r10, %r10 mov $0x5152535455565758, %r11 movq %r11, (%rcx) nop nop nop nop add $28494, %r14 // Store lea addresses_WC+0x190d0, %r12 nop nop cmp $11677, %r11 mov $0x5152535455565758, %rcx movq %rcx, %xmm7 vmovntdq %ymm7, (%r12) nop nop nop sub %rcx, %rcx // Load lea addresses_normal+0x102d0, %rbp nop inc %r12 vmovups (%rbp), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %rcx nop nop nop nop nop inc %r11 // Store lea addresses_D+0x17ba0, %r11 nop and %rcx, %rcx mov $0x5152535455565758, %r10 movq %r10, %xmm6 movaps %xmm6, (%r11) nop and %r12, %r12 // Load lea addresses_WT+0x158d0, %rbp nop nop nop inc %r11 mov (%rbp), %r10 nop nop nop inc %r14 // Store lea addresses_A+0xf990, %rbp sub $54081, %rdx mov $0x5152535455565758, %r12 movq %r12, %xmm0 movaps %xmm0, (%rbp) nop nop nop nop nop cmp %rcx, %rcx // Load lea addresses_WC+0xe8f8, %rbp nop and %rdx, %rdx movb (%rbp), %r10b nop nop nop nop nop and $56085, %r10 // Load lea addresses_RW+0x19710, %rcx dec %rdx mov (%rcx), %r12w add $47571, %r14 // Store lea addresses_UC+0xdaf6, %r14 nop cmp $24852, %rbp movw $0x5152, (%r14) nop nop cmp %rbp, %rbp // Load lea addresses_WT+0x15ed0, %r14 nop nop nop nop nop cmp %r10, %r10 movb (%r14), %cl xor $27684, %rdx // Faulty Load lea addresses_A+0x86d0, %rdx nop nop nop nop nop and $36919, %rcx movups (%rdx), %xmm5 vpextrq $0, %xmm5, %rbp lea oracles, %r10 and $0xff, %rbp shlq $12, %rbp mov (%r10,%rbp,1), %rbp pop %rdx pop %rcx pop %rbp pop %r14 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 7, 'size': 32, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': True, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': True, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 3, 'size': 1, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': False, 'NT': False}} {'58': 7280} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */