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
programs/oeis/159/A159938.asm
karttu/loda
0
102762
<reponame>karttu/loda ; A159938: The number of homogeneous trisubstituted linear alkanes. ; 2,6,16,36,70,122,196,296,426,590,792,1036,1326,1666,2060,2512,3026,3606,4256,4980,5782,6666,7636,8696,9850,11102,12456,13916,15486,17170,18972,20896,22946,25126,27440,29892,32486 mul $0,2 mov $1,2 mov $2,2 lpb $0,1 add $2,$0 sub $0,2 add $1,$2 lpe
src/giza-widget-composite.adb
Fabien-Chouteau/Giza
7
29438
<filename>src/giza-widget-composite.adb<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- Giza -- -- -- -- Copyright (C) 2015 <NAME> (<EMAIL>) -- -- -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder 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 -- -- HOLDER 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. -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with Giza.Widget.Background; use Giza.Widget.Background; package body Giza.Widget.Composite is procedure Free is new Ada.Unchecked_Deallocation (Wrapper, Wrapper_Ref); --------------- -- Set_Dirty -- --------------- overriding procedure Set_Dirty (This : in out Instance; Dirty : Boolean := True) is Ref : Wrapper_Ref := This.List; begin Set_Dirty (Parent (This), Dirty); while Ref /= null loop Ref.Widg.Set_Dirty (Dirty); Ref := Ref.Next; end loop; end Set_Dirty; ---------- -- Draw -- ---------- overriding procedure Draw (This : in out Instance; Ctx : in out Context.Class; Force : Boolean := True) is Ref : Wrapper_Ref := This.List; begin Draw (Parent (This), Ctx, Force); while Ref /= null loop Ctx.Save; Ctx.Translate (Ref.Pos); Ctx.Set_Bounds (((0, 0), Ref.Widg.Get_Size)); Ctx.Set_Position ((0, 0)); Draw (Ref.Widg.all, Ctx, Force); Ctx.Restore; Ref := Ref.Next; end loop; end Draw; ----------------------- -- On_Position_Event -- ----------------------- overriding function On_Position_Event (This : in out Instance; Evt : Position_Event_Ref; Pos : Point_T) return Boolean is Ref : Wrapper_Ref := This.List; Handled : Boolean := False; begin while Ref /= null loop -- Check if event is within the Widget if Pos.X in Ref.Pos.X .. Ref.Pos.X + Ref.Widg.Size.W and then Pos.Y in Ref.Pos.Y .. Ref.Pos.Y + Ref.Widg.Size.H then -- Translate position into child coordinates and propagate Handled := Handled or Ref.Widg.On_Position_Event (Evt, Pos - Ref.Pos); end if; Ref := Ref.Next; end loop; return Handled; end On_Position_Event; -------------- -- On_Event -- -------------- overriding function On_Event (This : in out Instance; Evt : Event_Not_Null_Ref) return Boolean is Ref : Wrapper_Ref := This.List; Handled : Boolean := False; begin while Ref /= null loop Handled := Handled or Ref.Widg.On_Event (Evt); Ref := Ref.Next; end loop; return Handled; end On_Event; --------------- -- Add_Child -- --------------- procedure Add_Child (This : in out Instance; Child : not null Widget.Reference; Pos : Point_T) is begin if Pos.X not in 0 .. This.Get_Size.W or else Pos.Y not in 0 .. This.Get_Size.H or else Pos.X + Child.Size.W not in 0 .. This.Get_Size.W or else Pos.Y + Child.Size.H not in 0 .. This.Get_Size.H then -- Doesn't fit return; end if; This.List := new Wrapper'(Pos => Pos, Widg => Child, Next => This.List); end Add_Child; ------------------ -- Remove_Child -- ------------------ procedure Remove_Child (This : in out Instance; Child : not null Widget.Reference) is Curr, Prev : Wrapper_Ref := null; begin Curr := This.List; while Curr /= null and then Curr.Widg /= Child loop Prev := Curr; Curr := Curr.Next; end loop; if Curr /= null then if Prev = null then This.List := Curr.Next; else Prev.Next := Curr.Next; end if; Free (Curr); end if; end Remove_Child; end Giza.Widget.Composite;
tests/typing/bad/testfile-return-5.adb
xuedong/mini-ada
0
6106
<reponame>xuedong/mini-ada<filename>tests/typing/bad/testfile-return-5.adb with Ada.Text_IO; use Ada.Text_IO; procedure Test is begin return 0; end;
libsrc/abc80/abc_inv.asm
andydansby/z88dk-mk2
1
93142
<filename>libsrc/abc80/abc_inv.asm ; ; ABC80 Graphics Functions ; ; xorg () -- invert graphics on screen ; ; routine found in "grafik.asm" ; by <NAME> - 1986-03-13 22.58.30 ; ; imported by <NAME> - 29/12/2006 :o) ; ; ; $Id: abc_inv.asm,v 1.1 2007/10/31 16:15:36 stefano Exp $ ; XLIB abc_inv .abc_inv ld ix,884 ld b,24 .xorloop push bc ld l,(ix+0) ld h,(ix+1) ld a,(590) ld b,a .xorloop1 ld a,(hl) bit 5,a jr z,nograf xor 95 ld (hl),a .nograf inc hl djnz xorloop1 inc ix inc ix pop bc djnz xorloop ret
Examples/ch07/Multiply.asm
satadriver/LiunuxOS
0
91126
<gh_stars>0 TITLE Multiplication Examples (Multiply.asm) ; Exmples of both signed and unsigned multiplication. INCLUDE Irvine16.inc .code main PROC mov ax,@data mov ds,ax mov ax,255 mov bx,255 imul bx ;Example 1 mov al,5h mov bl,10h mul bl ; CF = 0 ;Example 2 .data val1 WORD 2000h val2 WORD 0100h .code mov ax,val1 mul val2 ; CF = 1 ;Example 3: mov eax,12345h mov ebx,1000h mul ebx ; CF = 1 ; IMUL Examples: ; Example 4: .data val3 SDWORD ? .code mov eax,+4823424 mov ebx,-423 imul ebx ; EDX=FFFFFFFFh, EAX=86635D80h mov val3,eax exit main ENDP END main
Validation/pyFrame3DD-master/gcc-master/gcc/ada/exp_dist.ads
djamal2727/Main-Bearing-Analytical-Model
0
23560
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ D I S T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2020, 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 3, 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 COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains utility routines used for the generation of the -- stubs relevant to the distribution annex. with Namet; use Namet; with Snames; use Snames; with Types; use Types; package Exp_Dist is PCS_Version_Number : constant array (PCS_Names) of Int := (Name_No_DSA => 1, Name_GARLIC_DSA => 1, Name_PolyORB_DSA => 6); -- PCS interface version. This is used to check for consistency between the -- compiler used to generate distribution stubs and the PCS implementation. -- It must be incremented whenever a change is made to the generated code -- for distribution stubs that would result in the compiler being -- incompatible with an older version of the PCS, or vice versa. procedure Add_RAST_Features (Vis_Decl : Node_Id); -- Build and add bodies for dereference and 'Access subprograms for a -- remote access to subprogram type. Vis_Decl is the declaration node for -- the RAS type. procedure Add_RACW_Features (RACW_Type : Entity_Id); -- Add RACW features. If the RACW and the designated type are not in the -- same scope, then Add_RACW_Primitive_Declarations_And_Bodies is called -- automatically since we do know the primitive list already. procedure Add_RACW_Primitive_Declarations_And_Bodies (Designated_Type : Entity_Id; Insertion_Node : Node_Id; Body_Decls : List_Id); -- Add primitive for the stub type, and the RPC receiver. The declarations -- are inserted after Insertion_Node, while the bodies are appended at the -- end of Body_Decls. procedure Remote_Types_Tagged_Full_View_Encountered (Full_View : Entity_Id); -- When a full view with a private view is encountered in a Remote_Types -- package and corresponds to a tagged type, then this procedure is called -- to generate the needed RACW features if it is needed. procedure RACW_Type_Is_Asynchronous (RACW_Type : Entity_Id); -- This subprogram must be called when it is detected that the RACW type -- is asynchronous. procedure Expand_Calling_Stubs_Bodies (Unit_Node : Node_Id); -- Call the expansion phase for the calling stubs. The code will be added -- at the end of the compilation unit, which is a package spec. procedure Expand_Receiving_Stubs_Bodies (Unit_Node : Node_Id); -- Call the expansion phase for the receiving stubs. The code will be added -- at the end of the compilation unit, which may be either a package spec -- or a package body. procedure Expand_All_Calls_Remote_Subprogram_Call (N : Node_Id); -- Rewrite a call to a subprogram located in a Remote_Call_Interface -- package to which the pragma All_Calls_Remote applies so that it -- goes through the PCS. N is either an N_Procedure_Call_Statement -- or an N_Function_Call node. procedure Build_Passive_Partition_Stub (U : Node_Id); -- Build stub for a shared passive package. U is the analyzed -- compilation unit for a package declaration. function Build_Subprogram_Id (Loc : Source_Ptr; E : Entity_Id) return Node_Id; -- Build a literal representing the remote subprogram identifier of E function Copy_Specification (Loc : Source_Ptr; Spec : Node_Id; Ctrl_Type : Entity_Id := Empty; New_Name : Name_Id := No_Name) return Node_Id; -- Build a subprogram specification from another one, or from an -- access-to-subprogram definition. If Ctrl_Type is not Empty, and any -- controlling formal of an anonymous access type is found, then it is -- replaced by an access to Ctrl_Type. If New_Name is given, then it will -- be used as the name for the newly created spec. -- -- Possibly factor this wrt Exp_Ch9.Build_Private_Protected_Declaration??? function Corresponding_Stub_Type (RACW_Type : Entity_Id) return Entity_Id; -- Return the stub type associated with the given RACW type function Underlying_RACW_Type (RAS_Typ : Entity_Id) return Entity_Id; -- Given a remote access-to-subprogram type or its equivalent -- record type, return the RACW type generated to implement it. procedure Append_RACW_Bodies (Decls : List_Id; Spec_Id : Entity_Id); -- Append the unanalyzed subprogram bodies generated to support RACWs -- declared in the given package spec (RACW stream subprograms, calling -- stubs primitive operations) to the given list (which is expected to be -- the declarations list for the corresponding package body, if there is -- one). In the case where a body is present, the subprogram bodies must -- not be generated in the package spec because this would cause an -- incorrect attempt to freeze Taft amendment types declared in the spec. function Make_Transportable_Check (Loc : Source_Ptr; Expr : Node_Id) return Node_Id; -- Generate a check that the given expression (an actual in a remote -- subprogram call, or the return value of a function in the context of -- a remote call) satisfies the requirements for being transportable -- across partitions, raising Program_Error if it does not. ---------------------------------------------------------------- -- Functions for expansion of PolyORB/DSA specific attributes -- ---------------------------------------------------------------- function Build_From_Any_Call (Typ : Entity_Id; N : Node_Id; Decls : List_Id) return Node_Id; -- Build call to From_Any attribute function of type Typ with expression -- N as actual parameter. Decls is the declarations list for an appropriate -- enclosing scope of the point where the call will be inserted; if the -- From_Any attribute for Typ needs to be generated at this point, its -- declaration is appended to Decls. function Build_To_Any_Call (Loc : Source_Ptr; N : Node_Id; Decls : List_Id; Constrained : Boolean := False) return Node_Id; -- Build call to To_Any attribute function with expression as actual -- parameter. Loc is the reference location for generated nodes, Decls is -- the declarations list for an appropriate enclosing scope of the point -- where the call will be inserted; if the To_Any attribute for Typ needs -- to be generated at this point, its declaration is appended to Decls. -- For limited types, if Constrained is True then use 'Write else use -- 'Output. function Build_TypeCode_Call (Loc : Source_Ptr; Typ : Entity_Id; Decls : List_Id) return Node_Id; -- Build call to TypeCode attribute function for Typ. Decls is the -- declarations list for an appropriate enclosing scope of the point -- where the call will be inserted; if the To_Any attribute for Typ -- needs to be generated at this point, its declaration is appended -- to Decls. end Exp_Dist;
mgblib/src/serial/SerialSendByte.asm
jbshelton/CGB_APU_Tester
2
6980
IF !DEF(INC_SerialSendByte) INC_SerialSendByte = 1 ; Send a byte over the serial connection as master. ; Waits until the send has completed. ; ; @param a the value to send ; @destroys af SerialSendByte:: ldh [rSB], a ld a, $81 ldh [rSC],a .loop: ldh a, [rSC] bit 7, a jr nz, .loop ret ENDC
audio/sfx/super_effective.asm
AmateurPanda92/pokemon-rby-dx
9
103026
<gh_stars>1-10 SFX_Super_Effective_Ch7: noisenote 4, 15, 1, 52 noisenote 15, 15, 2, 100 endchannel
Task/Pick-random-element/AppleScript/pick-random-element.applescript
LaudateCorpus1/RosettaCodeData
1
1639
<reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Pick-random-element/AppleScript/pick-random-element.applescript get some item of [1, "two", pi, "4", 5 > 4, 5 + 1, Sunday]
test/Fail/Issue3007.agda
cruhland/agda
1,989
9505
-- Andreas, 2018-03-23: issue #3007, reported by Fabian -- An broken identifier followed by a comment and then the end of the file -- caused an internal error during error reporting. -- -- Should fail without internal error. postulate _-- This is the end of the file!
data/mapHeaders/ssanne8.asm
adhi-thirumala/EvoYellow
16
170886
<filename>data/mapHeaders/ssanne8.asm SSAnne8_h: db SHIP ; tileset db SS_ANNE_8_HEIGHT, SS_ANNE_8_WIDTH ; dimensions (y, x) dw SSAnne8Blocks, SSAnne8TextPointers, SSAnne8Script ; blocks, texts, scripts db $00 ; connections dw SSAnne8Object ; objects
src/main/antlr/Generators.g4
definiti/definiti-test
0
4286
<filename>src/main/antlr/Generators.g4 grammar Generators; BOOLEAN : 'true' | 'false'; NUMBER : [0-9]+('.'[0-9]+)?; STRING : '"' ( '\\"' | . )*? '"'; GENERATOR : 'generator'; IDENTIFIER : [a-zA-Z0-9]+; generators: generator*; generator: GENERATOR name=IDENTIFIER generics? parameters ':' type; generics: '[' (IDENTIFIER ',')* IDENTIFIER ']'; parameters : '(' ')' | '(' (parameter ',')* parameter ')' ; parameter: IDENTIFIER ':' type (genSymbol = '?')? (restSymbol = '*')?; type: IDENTIFIER genericTypes?; genericTypes: '[' (type ',')* type ']'; DOC_COMMENT : '/**' .*? '*/'; BLOCK_COMMENT : '/*' .*? '*/' -> skip; LINE_COMMENT : '//' ~[\r\n]* -> skip; WS : [ \r\n\t]+ -> skip;
audio/sfx/ss_anne_horn_3.asm
opiter09/ASM-Machina
1
105564
<gh_stars>1-10 SFX_SS_Anne_Horn_3_Ch5: duty_cycle 2 square_note 15, 15, 0, 1280 square_note 4, 0, 0, 0 square_note 15, 15, 0, 1280 square_note 15, 15, 0, 1280 square_note 15, 15, 0, 1280 square_note 15, 15, 0, 1280 square_note 15, 15, 2, 1280 sound_ret SFX_SS_Anne_Horn_3_Ch6: duty_cycle 3 square_note 15, 15, 0, 1154 square_note 4, 0, 0, 0 square_note 15, 15, 0, 1154 square_note 15, 15, 0, 1154 square_note 15, 15, 0, 1154 square_note 15, 15, 0, 1154 square_note 15, 15, 2, 1154 sound_ret
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/loop_optimization1_pkg.adb
best08618/asylo
7
27373
package body Loop_Optimization1_Pkg is type Unconstrained_Array_Type is array (Index_Type range <>) of Element_Type; procedure Local (UA : in out Unconstrained_Array_Type) is begin null; end; procedure Proc (CA : in out Constrained_Array_Type) is begin Local (Unconstrained_Array_Type (CA)); end; end Loop_Optimization1_Pkg;
src/zmq-sockets-typed_generic.ads
persan/zeromq-Ada
33
20656
<filename>src/zmq-sockets-typed_generic.ads ------------------------------------------------------------------------------- -- -- -- 0MQ Ada-binding -- -- -- -- Z M Q . S O C K E T S . T Y P E D _ G E N E R I C -- -- -- -- B o d y -- -- -- -- Copyright (C) 2020-2030, <EMAIL> -- -- -- -- 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. -- ------------------------------------------------------------------------------- generic type Element_Type is private; pragma Compile_Time_Error (Element_Type'Has_Access_Values, "No access values allowed in Element"); package ZMQ.Sockets.Typed_Generic is type Typed_Socket is new ZMQ.Sockets.Socket with private; not overriding procedure Send (This : in out Typed_Socket; Msg : Element_Type; Flags : Socket_Flags := No_Flags); not overriding function Recv (This : in Typed_Socket; Flags : Socket_Flags := No_Flags) return Element_Type; not overriding procedure Recv (This : in Typed_Socket; Msg : out Element_Type; Flags : Socket_Flags := No_Flags); private type Typed_Socket is new ZMQ.Sockets.Socket with null record; end ZMQ.Sockets.Typed_Generic;
libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_dfix32u.asm
jpoikela/z88dk
640
103136
SECTION code_clib SECTION code_fp_math48 PUBLIC asm_dfix32u EXTERN am48_dfix32u defc asm_dfix32u = am48_dfix32u
Data/Boolean/Proofs.agda
Lolirofle/stuff-in-agda
6
14207
<filename>Data/Boolean/Proofs.agda module Data.Boolean.Proofs where import Lvl open import Data open import Data.Boolean import Data.Boolean.Operators open Data.Boolean.Operators.Logic using (_⊼_ ; _⊽_ ; _⊕_) open Data.Boolean.Operators.Programming open import Data.Either as Either using (_‖_ ; Left ; Right) open import Functional open import Logic.IntroInstances open import Logic.Propositional as Logic using (_∨_ ; _∧_ ; ¬_ ; _↔_ ; [⊤]-intro ; [↔]-intro ; [⊥]-elim ; [↔]-to-[←] ; [↔]-to-[→]) open import Logic.Predicate open import Relator.Equals open import Relator.Equals.Proofs.Equiv open import Structure.Operator.Monoid import Structure.Operator.Names as Names open import Structure.Operator.Properties open import Type private variable ℓ : Lvl.Level private variable T : Type{ℓ} private variable P : Bool → Type{ℓ} private variable a b c t f : Bool private variable x y : Bool private variable pt pf : ∀{b} → P(b) --------------------------------------------- -- Eliminator module _ {pt pf : T} where elim-nested : (elim pt pf (elim t f b) ≡ elim{T = const T} (elim pt pf t) (elim pt pf f) b) elim-nested{t = t}{f = f}{b = b} = elim{T = b ↦ (elim pt pf (elim t f b) ≡ elim(elim pt pf t) (elim pt pf f) b)} [≡]-intro [≡]-intro b module _ {x : T} where elim-redundant : (elim{T = const T} x x b ≡ x) elim-redundant{b = b} = elim{T = b ↦ elim x x b ≡ x} [≡]-intro [≡]-intro b elim-inverse : (elim 𝑇 𝐹 b ≡ b) elim-inverse{b = b} = elim{T = b ↦ elim 𝑇 𝐹 b ≡ b} [≡]-intro [≡]-intro b elim-anti-inverse : (elim 𝐹 𝑇 b ≡ ! b) elim-anti-inverse {𝑇} = [≡]-intro elim-anti-inverse {𝐹} = [≡]-intro --------------------------------------------- -- Negation [!]-no-fixpoints : ∀{b} → (! b ≢ b) [!]-no-fixpoints {𝑇} () [!]-no-fixpoints {𝐹} () [!!]-elim : ∀{a} → (!(! a) ≡ a) [!!]-elim {𝑇} = [≡]-intro [!!]-elim {𝐹} = [≡]-intro {-# REWRITE [!!]-elim #-} --------------------------------------------- -- Idempotence [&&]-idempotence-raw : ∀{a} → (a && a ≡ a) [&&]-idempotence-raw {𝑇} = [≡]-intro [&&]-idempotence-raw {𝐹} = [≡]-intro {-# REWRITE [&&]-idempotence-raw #-} instance [&&]-idempotence : Idempotence(_&&_) Idempotence.proof([&&]-idempotence) = [&&]-idempotence-raw [||]-idempotence-raw : ∀{a} → (a || a ≡ a) [||]-idempotence-raw {𝑇} = [≡]-intro [||]-idempotence-raw {𝐹} = [≡]-intro {-# REWRITE [||]-idempotence-raw #-} instance [||]-idempotence : Idempotence(_||_) Idempotence.proof([||]-idempotence) = [||]-idempotence-raw --------------------------------------------- -- Left anti-identities [==]-anti-identityₗ : ∀{a} → (𝐹 == a ≡ ! a) [==]-anti-identityₗ {𝑇} = [≡]-intro [==]-anti-identityₗ {𝐹} = [≡]-intro {-# REWRITE [==]-anti-identityₗ #-} [!=]-anti-identityₗ : ∀{a} → (𝑇 != a ≡ ! a) [!=]-anti-identityₗ {𝑇} = [≡]-intro [!=]-anti-identityₗ {𝐹} = [≡]-intro {-# REWRITE [!=]-anti-identityₗ #-} --------------------------------------------- -- Right anti-identities [==]-anti-identityᵣ : ∀{a} → (a == 𝐹 ≡ ! a) [==]-anti-identityᵣ {𝑇} = [≡]-intro [==]-anti-identityᵣ {𝐹} = [≡]-intro {-# REWRITE [==]-anti-identityᵣ #-} [!=]-anti-identityᵣ : ∀{a} → (a != 𝑇 ≡ ! a) [!=]-anti-identityᵣ {𝑇} = [≡]-intro [!=]-anti-identityᵣ {𝐹} = [≡]-intro {-# REWRITE [!=]-anti-identityᵣ #-} --------------------------------------------- -- Left identities [||]-identityₗ-raw : ∀{a} → (𝐹 || a ≡ a) [||]-identityₗ-raw {𝑇} = [≡]-intro [||]-identityₗ-raw {𝐹} = [≡]-intro {-# REWRITE [||]-identityₗ-raw #-} instance [||]-identityₗ : Identityₗ(_||_)(𝐹) Identityₗ.proof([||]-identityₗ) = [||]-identityₗ-raw [&&]-identityₗ-raw : ∀{a} → (𝑇 && a ≡ a) [&&]-identityₗ-raw {𝑇} = [≡]-intro [&&]-identityₗ-raw {𝐹} = [≡]-intro {-# REWRITE [&&]-identityₗ-raw #-} instance [&&]-identityₗ : Identityₗ(_&&_)(𝑇) Identityₗ.proof([&&]-identityₗ) = [&&]-identityₗ-raw [==]-identityₗ-raw : ∀{a} → (𝑇 == a ≡ a) [==]-identityₗ-raw {𝑇} = [≡]-intro [==]-identityₗ-raw {𝐹} = [≡]-intro {-# REWRITE [==]-identityₗ-raw #-} instance [==]-identityₗ : Identityₗ(_==_)(𝑇) Identityₗ.proof([==]-identityₗ) = [==]-identityₗ-raw [!=]-identityₗ-raw : ∀{a} → (𝐹 != a ≡ a) [!=]-identityₗ-raw {𝑇} = [≡]-intro [!=]-identityₗ-raw {𝐹} = [≡]-intro {-# REWRITE [!=]-identityₗ-raw #-} instance [!=]-identityₗ : Identityₗ(_!=_)(𝐹) Identityₗ.proof([!=]-identityₗ) = [!=]-identityₗ-raw --------------------------------------------- -- Left absorbers [||]-absorberₗ-raw : ∀{a} → (𝑇 || a ≡ 𝑇) [||]-absorberₗ-raw {𝑇} = [≡]-intro [||]-absorberₗ-raw {𝐹} = [≡]-intro {-# REWRITE [||]-absorberₗ-raw #-} instance [||]-absorberₗ : Absorberₗ(_||_)(𝑇) Absorberₗ.proof([||]-absorberₗ) {a} = [||]-absorberₗ-raw {a} [&&]-absorberₗ-raw : ∀{a} → (𝐹 && a ≡ 𝐹) [&&]-absorberₗ-raw {𝑇} = [≡]-intro [&&]-absorberₗ-raw {𝐹} = [≡]-intro {-# REWRITE [&&]-absorberₗ-raw #-} instance [&&]-absorberₗ : Absorberₗ(_&&_)(𝐹) Absorberₗ.proof([&&]-absorberₗ) {a} = [&&]-absorberₗ-raw {a} --------------------------------------------- -- Right identities [||]-identityᵣ-raw : ∀{a} → (a || 𝐹 ≡ a) [||]-identityᵣ-raw {𝑇} = [≡]-intro [||]-identityᵣ-raw {𝐹} = [≡]-intro {-# REWRITE [||]-identityᵣ-raw #-} instance [||]-identityᵣ : Identityᵣ(_||_)(𝐹) Identityᵣ.proof([||]-identityᵣ) = [||]-identityᵣ-raw [&&]-identityᵣ-raw : ∀{a} → (a && 𝑇 ≡ a) [&&]-identityᵣ-raw {𝑇} = [≡]-intro [&&]-identityᵣ-raw {𝐹} = [≡]-intro {-# REWRITE [&&]-identityᵣ-raw #-} instance [&&]-identityᵣ : Identityᵣ(_&&_)(𝑇) Identityᵣ.proof([&&]-identityᵣ) = [&&]-identityᵣ-raw [==]-identityᵣ-raw : ∀{a} → (a == 𝑇 ≡ a) [==]-identityᵣ-raw {𝑇} = [≡]-intro [==]-identityᵣ-raw {𝐹} = [≡]-intro {-# REWRITE [==]-identityᵣ-raw #-} instance [==]-identityᵣ : Identityᵣ(_==_)(𝑇) Identityᵣ.proof([==]-identityᵣ) = [==]-identityᵣ-raw [!=]-identityᵣ-raw : ∀{a} → (a != 𝐹 ≡ a) [!=]-identityᵣ-raw {𝑇} = [≡]-intro [!=]-identityᵣ-raw {𝐹} = [≡]-intro {-# REWRITE [!=]-identityᵣ-raw #-} instance [!=]-identityᵣ : Identityᵣ(_!=_)(𝐹) Identityᵣ.proof([!=]-identityᵣ) = [!=]-identityᵣ-raw --------------------------------------------- -- Identities instance [||]-identity : Identity(_||_)(𝐹) [||]-identity = record{} instance [&&]-identity : Identity(_&&_)(𝑇) [&&]-identity = record{} instance [==]-identity : Identity(_==_)(𝑇) [==]-identity = record{} instance [!=]-identity : Identity(_!=_)(𝐹) [!=]-identity = record{} --------------------------------------------- -- Right absorbers [||]-absorberᵣ-raw : ∀{a} → (a || 𝑇 ≡ 𝑇) [||]-absorberᵣ-raw {𝑇} = [≡]-intro [||]-absorberᵣ-raw {𝐹} = [≡]-intro {-# REWRITE [||]-absorberᵣ-raw #-} instance [||]-absorberᵣ : Absorberᵣ(_||_)(𝑇) Absorberᵣ.proof([||]-absorberᵣ) {a} = [||]-absorberᵣ-raw {a} [&&]-absorberᵣ-raw : ∀{a} → (a && 𝐹 ≡ 𝐹) [&&]-absorberᵣ-raw {𝑇} = [≡]-intro [&&]-absorberᵣ-raw {𝐹} = [≡]-intro {-# REWRITE [&&]-absorberᵣ-raw #-} instance [&&]-absorberᵣ : Absorberᵣ(_&&_)(𝐹) Absorberᵣ.proof([&&]-absorberᵣ) {a} = [&&]-absorberᵣ-raw {a} --------------------------------------------- -- Associativity instance [||]-associativity : Associativity(_||_) Associativity.proof([||]-associativity) = proof where proof : Names.Associativity(_||_) proof {𝑇}{𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝑇}{𝐹} = [≡]-intro proof {𝑇}{𝐹}{𝑇} = [≡]-intro proof {𝑇}{𝐹}{𝐹} = [≡]-intro proof {𝐹}{𝑇}{𝑇} = [≡]-intro proof {𝐹}{𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹}{𝐹} = [≡]-intro instance [&&]-associativity : Associativity(_&&_) Associativity.proof([&&]-associativity) = proof where proof : Names.Associativity(_&&_) proof {𝑇}{𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝑇}{𝐹} = [≡]-intro proof {𝑇}{𝐹}{𝑇} = [≡]-intro proof {𝑇}{𝐹}{𝐹} = [≡]-intro proof {𝐹}{𝑇}{𝑇} = [≡]-intro proof {𝐹}{𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹}{𝐹} = [≡]-intro instance [==]-associativity : Associativity(_==_) Associativity.proof([==]-associativity) = proof where proof : Names.Associativity(_==_) proof {𝑇}{𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝑇}{𝐹} = [≡]-intro proof {𝑇}{𝐹}{𝑇} = [≡]-intro proof {𝑇}{𝐹}{𝐹} = [≡]-intro proof {𝐹}{𝑇}{𝑇} = [≡]-intro proof {𝐹}{𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹}{𝐹} = [≡]-intro instance [!=]-associativity : Associativity(_!=_) Associativity.proof([!=]-associativity) = proof where proof : Names.Associativity(_!=_) proof {𝑇}{𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝑇}{𝐹} = [≡]-intro proof {𝑇}{𝐹}{𝑇} = [≡]-intro proof {𝑇}{𝐹}{𝐹} = [≡]-intro proof {𝐹}{𝑇}{𝑇} = [≡]-intro proof {𝐹}{𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹}{𝐹} = [≡]-intro --------------------------------------------- -- Other [⊼]-pseudo-associativity : (!(a ⊼ b) ⊼ c ≡ a ⊼ !(b ⊼ c)) [⊼]-pseudo-associativity {𝑇} {𝑇} {𝑇} = [≡]-intro [⊼]-pseudo-associativity {𝑇} {𝑇} {𝐹} = [≡]-intro [⊼]-pseudo-associativity {𝑇} {𝐹} {𝑇} = [≡]-intro [⊼]-pseudo-associativity {𝑇} {𝐹} {𝐹} = [≡]-intro [⊼]-pseudo-associativity {𝐹} {𝑇} {𝑇} = [≡]-intro [⊼]-pseudo-associativity {𝐹} {𝑇} {𝐹} = [≡]-intro [⊼]-pseudo-associativity {𝐹} {𝐹} {𝑇} = [≡]-intro [⊼]-pseudo-associativity {𝐹} {𝐹} {𝐹} = [≡]-intro [⊼]-to-conjunction : (!(a ⊼ b) ≡ a && b) [⊼]-to-conjunction {𝑇} {𝑇} = [≡]-intro [⊼]-to-conjunction {𝑇} {𝐹} = [≡]-intro [⊼]-to-conjunction {𝐹} {𝑇} = [≡]-intro [⊼]-to-conjunction {𝐹} {𝐹} = [≡]-intro [⊼]-to-negation : (b ⊼ b ≡ ! b) [⊼]-to-negation {𝑇} = [≡]-intro [⊼]-to-negation {𝐹} = [≡]-intro [⊼]-pseudo-absorptionₗ : (a ⊼ (a ⊼ b) ≡ a ⊼ (! b)) [⊼]-pseudo-absorptionₗ {𝑇} {𝑇} = [≡]-intro [⊼]-pseudo-absorptionₗ {𝑇} {𝐹} = [≡]-intro [⊼]-pseudo-absorptionₗ {𝐹} {𝑇} = [≡]-intro [⊼]-pseudo-absorptionₗ {𝐹} {𝐹} = [≡]-intro [⊼]-pseudo-absorptionᵣ : ((a ⊼ b) ⊼ b ≡ (! a) ⊼ b) [⊼]-pseudo-absorptionᵣ {𝑇} {𝑇} = [≡]-intro [⊼]-pseudo-absorptionᵣ {𝑇} {𝐹} = [≡]-intro [⊼]-pseudo-absorptionᵣ {𝐹} {𝑇} = [≡]-intro [⊼]-pseudo-absorptionᵣ {𝐹} {𝐹} = [≡]-intro [⊼]-pseudo-pseudo-absorptionₗ : (((! a) ⊼ b) ⊼ (a ⊼ b) ≡ b) [⊼]-pseudo-pseudo-absorptionₗ {𝑇} {𝑇} = [≡]-intro [⊼]-pseudo-pseudo-absorptionₗ {𝑇} {𝐹} = [≡]-intro [⊼]-pseudo-pseudo-absorptionₗ {𝐹} {𝑇} = [≡]-intro [⊼]-pseudo-pseudo-absorptionₗ {𝐹} {𝐹} = [≡]-intro [⊼]-pseudo-pseudo-absorptionᵣ : ((a ⊼ (! b)) ⊼ (a ⊼ b) ≡ a) [⊼]-pseudo-pseudo-absorptionᵣ {𝑇} {𝑇} = [≡]-intro [⊼]-pseudo-pseudo-absorptionᵣ {𝑇} {𝐹} = [≡]-intro [⊼]-pseudo-pseudo-absorptionᵣ {𝐹} {𝑇} = [≡]-intro [⊼]-pseudo-pseudo-absorptionᵣ {𝐹} {𝐹} = [≡]-intro [⊽]-pseudo-associativity : (!(a ⊽ b) ⊽ c ≡ a ⊽ !(b ⊽ c)) [⊽]-pseudo-associativity {𝑇} {𝑇} {𝑇} = [≡]-intro [⊽]-pseudo-associativity {𝑇} {𝑇} {𝐹} = [≡]-intro [⊽]-pseudo-associativity {𝑇} {𝐹} {𝑇} = [≡]-intro [⊽]-pseudo-associativity {𝑇} {𝐹} {𝐹} = [≡]-intro [⊽]-pseudo-associativity {𝐹} {𝑇} {𝑇} = [≡]-intro [⊽]-pseudo-associativity {𝐹} {𝑇} {𝐹} = [≡]-intro [⊽]-pseudo-associativity {𝐹} {𝐹} {𝑇} = [≡]-intro [⊽]-pseudo-associativity {𝐹} {𝐹} {𝐹} = [≡]-intro [⊽]-to-disjunction : (!(a ⊽ b) ≡ a || b) [⊽]-to-disjunction {𝑇} {𝑇} = [≡]-intro [⊽]-to-disjunction {𝑇} {𝐹} = [≡]-intro [⊽]-to-disjunction {𝐹} {𝑇} = [≡]-intro [⊽]-to-disjunction {𝐹} {𝐹} = [≡]-intro [⊽]-to-negation : (b ⊽ b ≡ ! b) [⊽]-to-negation {𝑇} = [≡]-intro [⊽]-to-negation {𝐹} = [≡]-intro [⊽]-pseudo-absorptionₗ : (a ⊽ (a ⊽ b) ≡ a ⊽ (! b)) [⊽]-pseudo-absorptionₗ {𝑇} {𝑇} = [≡]-intro [⊽]-pseudo-absorptionₗ {𝑇} {𝐹} = [≡]-intro [⊽]-pseudo-absorptionₗ {𝐹} {𝑇} = [≡]-intro [⊽]-pseudo-absorptionₗ {𝐹} {𝐹} = [≡]-intro [⊽]-pseudo-absorptionᵣ : ((a ⊽ b) ⊽ b ≡ (! a) ⊽ b) [⊽]-pseudo-absorptionᵣ {𝑇} {𝑇} = [≡]-intro [⊽]-pseudo-absorptionᵣ {𝑇} {𝐹} = [≡]-intro [⊽]-pseudo-absorptionᵣ {𝐹} {𝑇} = [≡]-intro [⊽]-pseudo-absorptionᵣ {𝐹} {𝐹} = [≡]-intro [⊽]-pseudo-pseudo-absorptionₗ : (((! a) ⊽ b) ⊽ (a ⊽ b) ≡ b) [⊽]-pseudo-pseudo-absorptionₗ {𝑇} {𝑇} = [≡]-intro [⊽]-pseudo-pseudo-absorptionₗ {𝑇} {𝐹} = [≡]-intro [⊽]-pseudo-pseudo-absorptionₗ {𝐹} {𝑇} = [≡]-intro [⊽]-pseudo-pseudo-absorptionₗ {𝐹} {𝐹} = [≡]-intro [⊽]-pseudo-pseudo-absorptionᵣ : ((a ⊽ (! b)) ⊽ (a ⊽ b) ≡ a) [⊽]-pseudo-pseudo-absorptionᵣ {𝑇} {𝑇} = [≡]-intro [⊽]-pseudo-pseudo-absorptionᵣ {𝑇} {𝐹} = [≡]-intro [⊽]-pseudo-pseudo-absorptionᵣ {𝐹} {𝑇} = [≡]-intro [⊽]-pseudo-pseudo-absorptionᵣ {𝐹} {𝐹} = [≡]-intro --------------------------------------------- -- Commutativity instance [||]-commutativity : Commutativity(_||_) Commutativity.proof([||]-commutativity) = proof where proof : Names.Commutativity(_||_) proof {𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹} = [≡]-intro instance [&&]-commutativity : Commutativity(_&&_) Commutativity.proof([&&]-commutativity) = proof where proof : Names.Commutativity(_&&_) proof {𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹} = [≡]-intro instance [==]-commutativity : Commutativity(_==_) Commutativity.proof([==]-commutativity) = proof where proof : Names.Commutativity(_==_) proof {𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹} = [≡]-intro instance [!=]-commutativity : Commutativity(_!=_) Commutativity.proof([!=]-commutativity) = proof where proof : Names.Commutativity(_!=_) proof {𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹} = [≡]-intro instance [⊼]-commutativity : Commutativity(_⊼_) Commutativity.proof([⊼]-commutativity) = proof where proof : Names.Commutativity(_⊼_) proof {𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹} = [≡]-intro instance [⊽]-commutativity : Commutativity(_⊽_) Commutativity.proof([⊽]-commutativity) = proof where proof : Names.Commutativity(_⊽_) proof {𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹} = [≡]-intro instance [⊕]-commutativity : Commutativity(_⊕_) Commutativity.proof([⊕]-commutativity) = proof where proof : Names.Commutativity(_⊕_) proof {𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹} = [≡]-intro instance [&&][||]-distributivityₗ : Distributivityₗ(_&&_)(_||_) Distributivityₗ.proof([&&][||]-distributivityₗ) = proof where proof : Names.Distributivityₗ(_&&_)(_||_) proof {𝑇}{𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝑇}{𝐹} = [≡]-intro proof {𝑇}{𝐹}{𝑇} = [≡]-intro proof {𝑇}{𝐹}{𝐹} = [≡]-intro proof {𝐹}{𝑇}{𝑇} = [≡]-intro proof {𝐹}{𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹}{𝐹} = [≡]-intro instance [||][&&]-distributivityₗ : Distributivityₗ(_||_)(_&&_) Distributivityₗ.proof([||][&&]-distributivityₗ) = proof where proof : Names.Distributivityₗ(_||_)(_&&_) proof {𝑇}{𝑇}{𝑇} = [≡]-intro proof {𝑇}{𝑇}{𝐹} = [≡]-intro proof {𝑇}{𝐹}{𝑇} = [≡]-intro proof {𝑇}{𝐹}{𝐹} = [≡]-intro proof {𝐹}{𝑇}{𝑇} = [≡]-intro proof {𝐹}{𝑇}{𝐹} = [≡]-intro proof {𝐹}{𝐹}{𝑇} = [≡]-intro proof {𝐹}{𝐹}{𝐹} = [≡]-intro instance [||]-oppositeFunctionₗ : ComplementFunctionₗ(_||_)(!) ComplementFunctionₗ.proof([||]-oppositeFunctionₗ) = proof where proof : Names.InverseFunctionₗ(_||_)(𝑇)(!) proof {𝑇} = [≡]-intro proof {𝐹} = [≡]-intro instance [||]-oppositeFunctionᵣ : ComplementFunctionᵣ(_||_)(!) ComplementFunctionᵣ.proof([||]-oppositeFunctionᵣ) = proof where proof : Names.InverseFunctionᵣ(_||_)(𝑇)(!) proof {𝑇} = [≡]-intro proof {𝐹} = [≡]-intro instance [&&]-oppositeFunctionₗ : ComplementFunctionₗ(_&&_)(!) ComplementFunctionₗ.proof([&&]-oppositeFunctionₗ) = proof where proof : Names.InverseFunctionₗ(_&&_)(𝐹)(!) proof {𝑇} = [≡]-intro proof {𝐹} = [≡]-intro instance [&&]-oppositeFunctionᵣ : ComplementFunctionᵣ(_&&_)(!) ComplementFunctionᵣ.proof([&&]-oppositeFunctionᵣ) = proof where proof : Names.InverseFunctionᵣ(_&&_)(𝐹)(!) proof {𝑇} = [≡]-intro proof {𝐹} = [≡]-intro --------------------------------------------- -- Algebraic structures instance [&&]-monoid : Monoid(_&&_) [&&]-monoid = record{} instance [||]-monoid : Monoid(_||_) [||]-monoid = record{} instance [==]-monoid : Monoid(_==_) [==]-monoid = record{} instance [!=]-monoid : Monoid(_!=_) [!=]-monoid = record{} -- TODO: Set algebra --------------------------------------------- -- Inverting inverted-[==][!=] : ∀{a b} → (!(a == b) ≡ (a != b)) inverted-[==][!=] {𝑇}{𝑇} = [≡]-intro inverted-[==][!=] {𝑇}{𝐹} = [≡]-intro inverted-[==][!=] {𝐹}{𝑇} = [≡]-intro inverted-[==][!=] {𝐹}{𝐹} = [≡]-intro inverted-[!=][==] : ∀{a b} → (!(a != b) ≡ (a == b)) inverted-[!=][==] {𝑇}{𝑇} = [≡]-intro inverted-[!=][==] {𝑇}{𝐹} = [≡]-intro inverted-[!=][==] {𝐹}{𝑇} = [≡]-intro inverted-[!=][==] {𝐹}{𝐹} = [≡]-intro --------------------------------------------- -- Rules of classical logic -- A boolean operation is either true or false bivalence : ∀{a} → ((a ≡ 𝑇) ∨ (a ≡ 𝐹)) bivalence {𝑇} = Logic.[∨]-introₗ [≡]-intro bivalence {𝐹} = Logic.[∨]-introᵣ [≡]-intro -- A boolean operation is not both true and false at the same time disjointness : ∀{a} → ¬((a ≡ 𝑇) ∧ (a ≡ 𝐹)) disjointness {𝑇} (Logic.[∧]-intro [≡]-intro ()) disjointness {𝐹} (Logic.[∧]-intro () [≡]-intro) [→?]-disjunctive-form : ∀{a b} → ((a →? b) ≡ ((! a) || b)) [→?]-disjunctive-form {𝑇} {𝑇} = [≡]-intro [→?]-disjunctive-form {𝑇} {𝐹} = [≡]-intro [→?]-disjunctive-form {𝐹} {𝑇} = [≡]-intro [→?]-disjunctive-form {𝐹} {𝐹} = [≡]-intro [==]-disjunctive-form : ∀{a b} → ((a == b) ≡ ((a && b) || ((! a) && (! b)))) [==]-disjunctive-form {𝑇} {𝑇} = [≡]-intro [==]-disjunctive-form {𝑇} {𝐹} = [≡]-intro [==]-disjunctive-form {𝐹} {𝑇} = [≡]-intro [==]-disjunctive-form {𝐹} {𝐹} = [≡]-intro module 𝑇 where [∧]-intro : ∀{a b} → (a ≡ 𝑇) → (b ≡ 𝑇) → ((a && b) ≡ 𝑇) [∧]-intro [≡]-intro [≡]-intro = [≡]-intro [∨]-introₗ : ∀{a b} → (a ≡ 𝑇) → ((a || b) ≡ 𝑇) [∨]-introₗ {_}{𝑇} [≡]-intro = [≡]-intro [∨]-introₗ {_}{𝐹} [≡]-intro = [≡]-intro [∨]-introᵣ : ∀{a b} → (b ≡ 𝑇) → ((a || b) ≡ 𝑇) [∨]-introᵣ {𝑇}{_} [≡]-intro = [≡]-intro [∨]-introᵣ {𝐹}{_} [≡]-intro = [≡]-intro [∧]-elimₗ : ∀{a b} → ((a && b) ≡ 𝑇) → (a ≡ 𝑇) [∧]-elimₗ {𝑇}{𝑇} [≡]-intro = [≡]-intro [∧]-elimₗ {𝑇}{𝐹} () [∧]-elimₗ {𝐹}{𝑇} () [∧]-elimₗ {𝐹}{𝐹} () [∧]-elimᵣ : ∀{a b} → ((a && b) ≡ 𝑇) → (b ≡ 𝑇) [∧]-elimᵣ {𝑇}{𝑇} [≡]-intro = [≡]-intro [∧]-elimᵣ {𝑇}{𝐹} () [∧]-elimᵣ {𝐹}{𝑇} () [∧]-elimᵣ {𝐹}{𝐹} () [∨]-elim : ∀{a b}{ℓ₂}{φ : Type{ℓ₂}} → ((a ≡ 𝑇) → φ) → ((b ≡ 𝑇) → φ) → ((a || b) ≡ 𝑇) → φ [∨]-elim {𝑇}{𝑇}{_} f _ [≡]-intro = f [≡]-intro [∨]-elim {𝑇}{𝐹}{_} f _ [≡]-intro = f [≡]-intro [∨]-elim {𝐹}{𝑇}{_} _ f [≡]-intro = f [≡]-intro [∨]-elim {𝐹}{𝐹}{_} _ f () [¬]-intro : ∀{a} → (a ≡ 𝐹) → (! a ≡ 𝑇) [¬]-intro [≡]-intro = [≡]-intro [¬]-elim : ∀{a} → (! a ≡ 𝑇) → (a ≡ 𝐹) [¬]-elim {𝑇} () [¬]-elim {𝐹} [≡]-intro = [≡]-intro [¬¬]-elim : ∀{a} → (!(! a) ≡ 𝑇) → (a ≡ 𝑇) [¬¬]-elim {𝑇} [≡]-intro = [≡]-intro [¬¬]-elim {𝐹} () preserves-[&&][∧] : ∀{a b} → ((a && b) ≡ 𝑇) ↔ (a ≡ 𝑇)∧(b ≡ 𝑇) preserves-[&&][∧] = [↔]-intro (\{(Logic.[∧]-intro l r) → [∧]-intro l r}) (proof ↦ Logic.[∧]-intro ([∧]-elimₗ proof) ([∧]-elimᵣ proof)) preserves-[||][∨] : ∀{a b} → ((a || b) ≡ 𝑇) ↔ (a ≡ 𝑇)∨(b ≡ 𝑇) preserves-[||][∨] = [↔]-intro (Logic.[∨]-elim [∨]-introₗ [∨]-introᵣ) ([∨]-elim Logic.[∨]-introₗ Logic.[∨]-introᵣ) preserves-[!][¬] : ∀{a} → (! a ≡ 𝑇) ↔ ¬(a ≡ 𝑇) preserves-[!][¬] {a} = [↔]-intro (l{a}) (r{a}) where l : ∀{a} → (! a ≡ 𝑇) ← ¬(a ≡ 𝑇) l {𝐹} _ = [≡]-intro l {𝑇} f = [⊥]-elim (f [≡]-intro) r : ∀{a} → (! a ≡ 𝑇) → ¬(a ≡ 𝑇) r {𝑇} () _ r {𝐹} _ () [≡]-transfer : ∀{a b} → ((a == b) ≡ 𝑇) ↔ (a ≡ b) [≡]-transfer {𝑇}{𝑇} = [↔]-intro (_ ↦ [≡]-intro) (_ ↦ [≡]-intro) [≡]-transfer {𝐹}{𝑇} = [↔]-intro (\()) (\()) [≡]-transfer {𝑇}{𝐹} = [↔]-intro (\()) (\()) [≡]-transfer {𝐹}{𝐹} = [↔]-intro (_ ↦ [≡]-intro) (_ ↦ [≡]-intro) [≢]-transfer : ∀{a b} → ((a != b) ≡ 𝑇) ↔ (a ≢ b) [≢]-transfer {𝑇}{𝑇} = [↔]-intro (ab ↦ [⊥]-elim(ab [≡]-intro)) (\()) [≢]-transfer {𝐹}{𝑇} = [↔]-intro (_ ↦ [≡]-intro) (_ ↦ \()) [≢]-transfer {𝑇}{𝐹} = [↔]-intro (_ ↦ [≡]-intro) (_ ↦ \()) [≢]-transfer {𝐹}{𝐹} = [↔]-intro (ab ↦ [⊥]-elim(ab [≡]-intro)) (\()) module 𝐹 where [∧]-introₗ : ∀{a b} → (a ≡ 𝐹) → ((a && b) ≡ 𝐹) [∧]-introₗ {_}{𝑇} [≡]-intro = [≡]-intro [∧]-introₗ {_}{𝐹} [≡]-intro = [≡]-intro [∧]-introᵣ : ∀{a b} → (b ≡ 𝐹) → ((a && b) ≡ 𝐹) [∧]-introᵣ {𝑇}{_} [≡]-intro = [≡]-intro [∧]-introᵣ {𝐹}{_} [≡]-intro = [≡]-intro [∨]-intro : ∀{a b} → (a ≡ 𝐹) → (b ≡ 𝐹) → ((a || b) ≡ 𝐹) [∨]-intro [≡]-intro [≡]-intro = [≡]-intro [¬]-intro : ∀{a} → (! a ≡ 𝑇) → (a ≡ 𝐹) [¬]-intro = 𝑇.[¬]-elim [¬]-elim : ∀{a} → (a ≡ 𝐹) → (! a ≡ 𝑇) [¬]-elim = 𝑇.[¬]-intro [≢][𝑇]-is-[𝐹] : ∀{a} → (a ≢ 𝑇) ↔ (a ≡ 𝐹) [≢][𝑇]-is-[𝐹] {a} = [↔]-intro (l{a}) (r{a}) where r : ∀{a} → (a ≢ 𝑇) → (a ≡ 𝐹) r {𝑇} (a≢𝑇) = [⊥]-elim ((a≢𝑇) ([≡]-intro)) r {𝐹} (a≢𝑇) = [≡]-intro l : ∀{a} → (a ≢ 𝑇) ← (a ≡ 𝐹) l {𝑇} () l {𝐹} (a≡𝐹) () [≢][𝐹]-is-[𝑇] : ∀{a} → (a ≢ 𝐹) ↔ (a ≡ 𝑇) [≢][𝐹]-is-[𝑇] {a} = [↔]-intro (l{a}) (r{a}) where r : ∀{a} → (a ≢ 𝐹) → (a ≡ 𝑇) r {𝑇} (a≢𝐹) = [≡]-intro r {𝐹} (a≢𝐹) = [⊥]-elim ((a≢𝐹) ([≡]-intro)) l : ∀{a} → (a ≢ 𝐹) ← (a ≡ 𝑇) l {𝑇} (a≡𝑇) () l {𝐹} () --------------------------------------------- -- If-statements module _ {ℓ₁ ℓ₂} {T : Type{ℓ₁}} {x y : T} {P : T → Type{ℓ₂}} where if-intro : ∀{B} → ((B ≡ 𝑇) → P(x)) → ((B ≡ 𝐹) → P(y)) → P(if B then x else y) if-intro {𝑇} px py = px [≡]-intro if-intro {𝐹} px py = py [≡]-intro module _ {ℓ₁ ℓ₂ ℓ₃} {T : Type{ℓ₁}} {x y : T} {P : T → Type{ℓ₂}} {Q : Bool → Type{ℓ₃}} where if-elim : ∀{B} → P(if B then x else y) → (P(x) → Q(𝑇)) → (P(y) → Q(𝐹)) → Q(B) if-elim{𝑇} p pxq pyq = pxq p if-elim{𝐹} p pxq pyq = pyq p module _ {ℓ₁ ℓ₂ ℓ₃} {T : Type{ℓ₁}} {x y : T} {P : T → Type{ℓ₂}} {Q : Type{ℓ₃}} where if-bool-elim : ∀{B} → P(if B then x else y) → (P(x) → (B ≡ 𝑇) → Q) → (P(y) → (B ≡ 𝐹) → Q) → Q if-bool-elim{𝑇} p pxq pyq = pxq p [≡]-intro if-bool-elim{𝐹} p pxq pyq = pyq p [≡]-intro module _ {ℓ₁ ℓ₂ ℓ₃ ℓ₄} {T : Type{ℓ₁}} {P : T → Type{ℓ₂}} {X : Type{ℓ₃}} {Y : Type{ℓ₄}} (nxy : X → Y → Logic.⊥) where either-bool-left : (xy : (X ∨ Y)) → (X ↔ (Either.isRight(xy) ≡ 𝐹)) either-bool-left xy with bivalence{Either.isRight(xy)} either-bool-left (Left x) | Right f = [↔]-intro (const x) (const f) either-bool-left (Right y) | Left t = [↔]-intro (\()) (x ↦ empty(nxy x y)) either-bool-right : (xy : (X ∨ Y)) → (Y ↔ (Either.isRight(xy) ≡ 𝑇)) either-bool-right xy with bivalence{Either.isRight(xy)} either-bool-right (Left x) | Right f = [↔]-intro (\()) (y ↦ empty(nxy x y)) either-bool-right (Right y) | Left t = [↔]-intro (const y) (const t) module _ {ℓ₁ ℓ₂ ℓ₃ ℓ₄} {T : Type{ℓ₁}} {P : T → Type{ℓ₂}} {X : Type{ℓ₃}} {Y : Type{ℓ₄}} where either-bool-leftₗ : (xy : (X ∨ Y)) → (X ← (Either.isRight(xy) ≡ 𝐹)) either-bool-leftₗ xy with bivalence{Either.isRight(xy)} either-bool-leftₗ (Left x) | Right f = const x either-bool-leftₗ (Right y) | Left t = \() either-bool-rightₗ : (xy : (X ∨ Y)) → (Y ← (Either.isRight(xy) ≡ 𝑇)) either-bool-rightₗ xy with bivalence{Either.isRight(xy)} either-bool-rightₗ (Left x) | Right f = \() either-bool-rightₗ (Right y) | Left t = const y if-not-either-bool-intro : ∀{x y : T} → (X → P(x)) → (Y → P(y)) → (xy : (X ∨ Y)) → P(if not(Either.isRight(xy)) then x else y) if-not-either-bool-intro {x}{y} xp yp xy = if-intro {x = x}{y = y} (xp ∘ either-bool-leftₗ xy ∘ 𝑇.[¬]-elim) (yp ∘ either-bool-rightₗ xy ∘ 𝑇.[¬¬]-elim ∘ 𝐹.[¬]-elim) module _ {ℓ₁ ℓ₂ ℓ₃ ℓ₄} {T : Type{ℓ₁}} {P : T → Type{ℓ₂}} {X : Type{ℓ₃}} {Y : Type{ℓ₄}} where if-either-bool-intro : ∀{x y : T} → (X → P(x)) → (Y → P(y)) → (xy : (X ∨ Y)) → P(if Either.isRight(xy) then y else x) if-either-bool-intro {x}{y} xp yp xy = if-intro {x = y}{y = x} (yp ∘ either-bool-rightₗ {P = P} xy) (xp ∘ either-bool-leftₗ {P = P} xy) --------------------------------------------- -- The predicate of if-statements module _ {ℓ} {T : Type{ℓ}} {x y : T} where if-and : ∀{B₁ B₂} → (if (B₁ && B₂) then x else y ≡ if B₁ then (if B₂ then x else y) else y) if-and {𝐹}{𝐹} = [≡]-intro if-and {𝐹}{𝑇} = [≡]-intro if-and {𝑇}{𝐹} = [≡]-intro if-and {𝑇}{𝑇} = [≡]-intro if-or : ∀{B₁ B₂} → (if (B₁ || B₂) then x else y ≡ if B₁ then x else if B₂ then x else y) if-or {𝐹}{𝐹} = [≡]-intro if-or {𝐹}{𝑇} = [≡]-intro if-or {𝑇}{𝐹} = [≡]-intro if-or {𝑇}{𝑇} = [≡]-intro if-not : ∀{B} → (if (! B) then x else y ≡ if B then y else x) if-not {𝐹} = [≡]-intro if-not {𝑇} = [≡]-intro --------------------------------------------- -- The results of if-statements module _ {ℓ} {T : Type{ℓ}} {x : T} {B} where if-then-redundant : (if B then x else x ≡ x) if-then-redundant = elim-redundant{b = B} module _ {ℓ} {T : Type{ℓ}} {B} where if-then-bool-inverse : (if B then 𝑇 else 𝐹 ≡ B) if-then-bool-inverse = elim-inverse{b = B} if-then-bool-anti-inverse : (if B then 𝐹 else 𝑇 ≡ ! B) if-then-bool-anti-inverse = elim-anti-inverse{b = B}
src/texaco.adb
zenharris/ada-bbs
2
10523
<filename>src/texaco.adb package body Texaco is -- c :Key_Code; -- Ch : Character; -- Current_Char : Column_Position := 1; function GetKey (win1 : Window := Standard_Window) return Key_Code is Inkey : Key_Code; begin Inkey := Get_Keystroke(win1); return (Inkey); exception when CONSTRAINT_ERROR => return (c); end GetKey; procedure Password_Editor (Win1 : Window; StartLine : Line_Position; StartColumn :Column_Position; Edline : in out Unbounded_String; MaxLength : Integer) is Current_Char : Column_Position := 1; c :Key_Code; Ch : Character; begin Move_Cursor(Win => win1,Line => StartLine,Column => StartColumn); Clear_To_End_Of_Line(win1); Refresh(win1); loop Move_Cursor(Win => win1, Line => StartLine, Column => StartColumn + Current_Char -1); Refresh(win1); c := GetKey; if c in Special_Key_Code'Range then case c is when Key_Backspace => if Current_Char > 1 then Current_Char := Current_Char -1; Add (win1,Ch => ' ', Line => StartLine, Column => StartColumn + Current_Char -1 ); Ada.Strings.Unbounded.Delete(Source => Edline, From => Integer(Current_Char), Through => Integer(Current_Char)); end if; when others => null; end case; elsif c in Real_Key_Code'Range then Ch := Character'Val (c); case Ch is when CR | LF => exit; when ESC => exit; when DEL => if Current_Char > 1 then Current_Char := Current_Char -1; Add (win1,Ch => ' ', Line => StartLine, Column => StartColumn + Current_Char -1 ); Ada.Strings.Unbounded.Delete(Source => Edline, From => Integer(Current_Char), Through => Integer(Current_Char)); end if; when others => if Length(Edline) < MaxLength then if Ch /= ' ' then Add (win1,Ch => '*', Line => StartLine, Column => StartColumn + Current_Char -1 ); Refresh(win1); Ada.Strings.Unbounded.Insert (Source => Edline, Before => Integer(Current_Char), New_Item => ("" & Ch)); Current_Char := Current_Char +1; end if; end if; end case; end if; end loop; end Password_Editor; procedure Line_Editor (win1 : Window; StartLine : Line_Position; StartColumn :Column_Position; EditLength : Column_Position; -- make this an integer Edline : in out Unbounded_String; MaxLength : Integer; TextEditMode : Boolean := False; SuppressSpaces : Boolean := False; Number :Boolean := False ) is -- Lines : Line_Position; Columns : Column_Position := StartColumn+EditLength; ScreenOffset, endpoint : Integer := 0; procedure Clear_Field is padstr : Unbounded_String; begin for i in 1..EditLength loop padstr := padstr & " "; end loop; Move_Cursor(Win => win1,Line => StartLine,Column => StartColumn); Add (win1,Column => StartColumn,Line => StartLine, Str => To_String(padstr)); Move_Cursor(Win => win1,Line => StartLine,Column => StartColumn); end Clear_Field; begin -- Get_Size(Number_Of_Lines => Lines,Number_Of_Columns => Columns); Clear_Field; Refresh(win1); if TextEditMode = False then Current_Char := 1; end if; loop Clear_Field; if Length(Edline) > ScreenOffset + Integer(Columns-StartColumn) then endpoint := ScreenOffset + Integer(Columns-StartColumn); else endpoint := Length(Edline); end if; if endpoint > 0 then Add (win1,Column => StartColumn,Line => StartLine, Str => Slice(Edline,ScreenOffset+1,endpoint)); end if; -- Refresh(win1); Move_Cursor(Win => win1, Line => StartLine, Column => StartColumn + (Current_Char-Column_Position(ScreenOffset)) -1); Refresh(win1); c := GetKey; if c in Special_Key_Code'Range then case c is when Key_Backspace => if Current_Char > 1 then Current_Char := Current_Char -1; Ada.Strings.Unbounded.Delete(Source => Edline, From => Integer(Current_Char), Through => Integer(Current_Char)); end if; if Integer(Current_Char)-ScreenOffset = 0 then if ScreenOffset > Integer(Columns-StartColumn) -1 then ScreenOffset := ScreenOffset -(Integer(Columns-StartColumn) -1); else ScreenOffset := 0; end if; end if; when Key_Delete_Char => if Integer(Current_Char) <= Length(Edline) then Ada.Strings.Unbounded.Delete(Source => Edline, From => Integer(Current_Char), Through => Integer(Current_Char)); end if; when Key_Cursor_Left => if Current_Char > 1 then Current_Char := Current_Char - 1; end if; if Integer(Current_Char)-ScreenOffset = 0 then if ScreenOffset > Integer(Columns-StartColumn) -1 then ScreenOffset := ScreenOffset -(Integer(Columns-StartColumn) -1); else ScreenOffset := 0; end if; end if; when Key_Cursor_Right => if Integer(Current_Char) <= Length(Edline) then Current_Char := Current_Char + 1; end if; if Integer(Current_Char)-ScreenOffset = Integer(Columns-StartColumn)+1 then ScreenOffset := ScreenOffset +(Integer(Columns-StartColumn) -1); end if; when Key_Cursor_Up | Key_Cursor_Down | Key_Shift_Delete_Char | Key_F1 | Key_F2 | Key_F3 | Key_F4 | Key_F5 | Key_F6 | Key_F7 | Key_F8 => exit; when others => exit; --null; end case; elsif c in Real_Key_Code'Range then Ch := Character'Val (c); case Ch is when CR | LF => exit; when DEL => -- This is a copy of the Backspace code from above -- ncurses has decided Backspace is not Special_Key_Code key anymore -- and should rather return DEL if Current_Char > 1 then Current_Char := Current_Char -1; Ada.Strings.Unbounded.Delete(Source => Edline, From => Integer(Current_Char), Through => Integer(Current_Char)); end if; if Integer(Current_Char)-ScreenOffset = 0 then if ScreenOffset > Integer(Columns-StartColumn) -1 then ScreenOffset := ScreenOffset -(Integer(Columns-StartColumn) -1); else ScreenOffset := 0; end if; end if; when Apostrophe => null; when HT => exit; when ESC => exit; when others => if Length(Edline) < MaxLength then if (not Number) or else (Number and then (Ch in '0'..'9' or else (Ch = Full_Stop and then SU.Index(Edline,".") = 0) or else (Current_Char=1 and then (Ch = Minus_Sign and then SU.Index(Edline,"-") /= 1)))) then if (not SuppressSpaces) or else (SuppressSpaces and then Ch /= ' ') then Add (win1,Ch => Ch, Line => StartLine, Column => StartColumn + Current_Char-Column_Position(ScreenOffset)-1 ); Refresh(win1); if TextEditMode then -- if the character position is greater than length then pad it while Integer(Current_Char) > SU.Length(Edline)+1 loop SU.Insert(Edline,SU.Length(Edline)+1," "); end loop; end if; Ada.Strings.Unbounded.Insert (Source => Edline, Before => Integer(Current_Char), New_Item => ("" & Ch)); Current_Char := Current_Char +1; if Integer(Current_Char)-ScreenOffset = Integer(Columns-StartColumn)+1 then ScreenOffset := ScreenOffset + (Integer(Columns-StartColumn)-1); end if; end if; end if; end if; end case; end if; end loop; end Line_Editor; procedure Text_Editor (win1 : Window; TopLine : Line_Position; BottomLine :Line_Position; MaxLines : Integer) is curs,TempCurs : Cursor; CurrentLine : Line_Position := 0; TermLnth : Line_Position; TermWdth : Column_Position; EditBuffer,CarryOver,Remainder : Unbounded_String; endpoint : Integer; Cancelled : Boolean := False; procedure Scroll_Up is begin Move_Cursor(win1,Line => TopLine,Column => 0); Delete_Line(win1); Move_Cursor(win1,Line => BottomLine,Column => 0); Insert_Line(win1); Refresh(win1); end Scroll_Up; procedure Scroll_Down is begin Move_Cursor(win1,Line => BottomLine,Column => 0); Delete_Line(win1); Move_Cursor(win1,Line => TopLine,Column => 0); Insert_Line(win1); Refresh(win1); end Scroll_Down; procedure Redraw_Screen is curs2 : Cursor; LineNum : Line_Position := 0; begin -- curs := Text_Buffer.First; curs2 := curs; for i in 1 .. CurrentLine loop if curs2 /= Text_Buffer.First then String_List.Previous(curs2); end if; end loop; loop if Length(Element(curs2)) > Integer(TermWdth)-1 then endpoint := Integer(TermWdth)-1; else endpoint := Length(Element(curs2)); end if; if endpoint > 0 then Add(win1, Column => 0,Line => LineNum + TopLine, Str => Slice(Element(curs2),1,endpoint) ); else Move_Cursor(win1,Line => LineNum + TopLine,Column => 0); end if; Clear_To_End_Of_Line(win1); LineNum := LineNum +1; if LineNum+ TopLine > BottomLine then exit; elsif curs2 = Text_Buffer.Last then exit; else String_List.Next(curs2); end if; end loop; Refresh; end Redraw_Screen; begin Get_Size(Number_Of_Lines => TermLnth,Number_Of_Columns => TermWdth); -- Text_Buffer.Clear; Text_Buffer.Append(To_Unbounded_String("")); curs := Text_Buffer.First; Current_Char := 1; loop Get_Size(Number_Of_Lines => TermLnth,Number_Of_Columns => TermWdth); Redraw_Screen; EditBuffer := Element(curs); Line_Editor(win1,StartLine => TopLine + CurrentLine, StartColumn => 0, EditLength => TermWdth-1,MaxLength => 1000, -- Integer(Wdth-1), Edline => EditBuffer,TextEditMode => True); Text_Buffer.Replace_Element(curs,New_Item => EditBuffer); if c in Special_Key_Code'Range then case c is when Key_Cursor_Down => if curs /= Text_Buffer.Last then String_List.Next(curs); if CurrentLine < BottomLine-TopLine then CurrentLine := CurrentLine + 1; else Scroll_Up; end if; end if; -- Avoids cursor being beyond edge of screen crash on Down Arrow for long lines if Texaco.Current_Char > TermWdth-1 then Texaco.Current_Char := TermWdth-1; end if; when Key_Cursor_Up => if curs /= Text_Buffer.First then String_List.Previous(curs); if CurrentLine > 0 then CurrentLine := CurrentLine - 1; else Scroll_Down; end if; end if; -- Avoids cursor being beyond edge of screen crash on Up Arrow for long lines if Texaco.Current_Char > TermWdth-1 then Texaco.Current_Char := TermWdth-1; end if; when Key_Shift_Delete_Char => TempCurs := curs; if TempCurs /= Text_Buffer.Last then String_List.Next(curs); Text_Buffer.Delete(TempCurs); Delete_Line(win1); Move_Cursor(win1,Line => BottomLine,Column => 0); Insert_Line(win1); elsif TempCurs /= Text_Buffer.First then String_List.Previous(curs); if CurrentLine > 0 then CurrentLine := CurrentLine - 1; else Scroll_Down; end if; Text_Buffer.Delete(TempCurs); Delete_Line(win1); Move_Cursor(win1,Line => BottomLine,Column => 0); Insert_Line(win1); end if; Refresh(win1); when others => null; end case; elsif c in Real_Key_Code'Range then case Character'Val (c) is when CR | LF => -- Avoids cursor being beyond the end of the line crash on Caridge return for long lines if Integer(Current_Char) > SU.Length(Element(curs)) then Current_Char := Column_Position(SU.Length(Element(curs))+1); end if; CarryOver :=To_Unbounded_String( SU.Slice(Source => Element(curs), Low => Integer(Current_Char), High => SU.Length(Element(curs)))); Remainder :=To_Unbounded_String( SU.Slice(Source => Element(curs), Low => 1, High => Integer(Current_Char)-1 )); if curs = Text_Buffer.Last then Text_Buffer.Replace_Element(curs,New_Item => Remainder); Text_Buffer.Append(CarryOver); curs := Text_Buffer.Last; else Text_Buffer.Replace_Element(curs,New_Item => Remainder); String_List.Next(curs); Text_Buffer.Insert(Before => curs,New_Item => CarryOver); String_List.Previous(curs); end if; Current_Char := 1; if CurrentLine < BottomLine-TopLine then CurrentLine := CurrentLine + 1; else Scroll_Up; end if; when ESC => Save := Display_Warning.GetYN("Save & exit(Y) Discard & exit(N)"); if not Display_Warning.Cancel then exit; end if; when others => null; end case; end if; end loop; end Text_Editor; procedure Dump_List is LineNum : Line_Position := 0; TermLnth : Line_Position; TermWdth : Column_Position; procedure Print(Position : Cursor) is begin Add(Standard_Window, Column => 0,Line => LineNum, Str => To_String(Element(Position))); Refresh; if LineNum < TermLnth-1 then LineNum := LineNum + 1; else Move_Cursor(Line => 0,Column => 0); Delete_Line; Refresh; end if; end Print; begin Get_Size(Number_Of_Lines => TermLnth,Number_Of_Columns => TermWdth); Text_Buffer.Iterate(Print'access); end Dump_List; end Texaco;
applet/aide/source/editors/aide-editor-of_record_type.adb
charlie5/aIDE
3
30772
<filename>applet/aide/source/editors/aide-editor-of_record_type.adb with aIDE.Editor.of_record_component, aIDE.GUI, AdaM.record_Component, glib.Error, gtk.Builder, gtk.Handlers; with Ada.Text_IO; use Ada.Text_IO; package body aIDE.Editor.of_record_type is use Gtk.Builder, Glib, glib.Error; -- procedure on_index_type_Button_clicked (the_Entry : access Gtk_Button_Record'Class; -- the_Editor : in aIDE.Editor.of_record_type.view) -- is -- begin -- aIDE.GUI.show_types_Palette (Invoked_by => the_Entry.all'Access, -- Target => the_Editor.Target.main_Type); -- end on_index_type_Button_clicked; procedure on_rid_Button_clicked (the_Button : access Gtk_Button_Record'Class; the_Editor : in aIDE.Editor.of_record_type.view) is pragma Unreferenced (the_Editor); begin the_Button.get_Parent.destroy; end on_rid_Button_clicked; package Entry_return_Callbacks is new Gtk.Handlers.User_Return_Callback (Gtk_Entry_Record, Boolean, AdaM.a_Type.record_type.view); package Button_Callbacks is new Gtk.Handlers.User_Callback (Gtk_Button_Record, aIDE.Editor.of_record_type.view); function on_unconstrained_Label_clicked (the_Label : access Gtk_Label_Record'Class; Self : in aIDE.Editor.of_record_type.view) return Boolean is pragma Unreferenced (the_Label); begin -- Self.Target.is_Constrained; Self.freshen; return False; end on_unconstrained_Label_clicked; function on_constrained_Label_clicked (the_Label : access Gtk_Label_Record'Class; Self : in aIDE.Editor.of_record_type.view) return Boolean is pragma Unreferenced (the_Label); begin -- Self.Target.is_Constrained (Now => False); Self.freshen; return False; end on_constrained_Label_clicked; package Label_return_Callbacks is new Gtk.Handlers.User_Return_Callback (Gtk_Label_Record, Boolean, aIDE.Editor.of_record_type.view); package body Forge is function to_Editor (the_Target : in AdaM.a_Type.record_type.view) return View is use AdaM, Glib; Self : constant Editor.of_record_type.view := new Editor.of_record_type.item; the_Builder : Gtk_Builder; Error : aliased GError; Result : Guint; pragma Unreferenced (Result); begin Self.Target := the_Target; Gtk_New (the_Builder); Result := the_Builder.Add_From_File ("glade/editor/record_type_editor.glade", Error'Access); if Error /= null then raise Program_Error with "Error: adam.Editor.of_record_type ~ " & Get_Message (Error); end if; Self.top_Box := gtk_Box (the_Builder.get_Object ("top_Box")); Self.name_Entry := Gtk_Entry (the_Builder.get_Object ("name_Entry")); Self.is_Label := Gtk_Label (the_Builder.get_Object ("is_Label")); Self.record_Label := Gtk_Label (the_Builder.get_Object ("record_Label")); Self.components_Box := gtk_Box (the_Builder.get_Object ("components_Box")); Self.null_Label := Gtk_Label (the_Builder.get_Object ("null_Label")); Self.end_record_Label := Gtk_Label (the_Builder.get_Object ("end_record_Label")); Self.rid_Button := gtk_Button (the_Builder.get_Object ("rid_Button")); Self.name_Entry.set_Text (String (Self.Target.Name)); -- Entry_return_Callbacks.connect (Self.first_Entry, -- "focus-out-event", -- on_first_Entry_leave'Access, -- the_Target); -- -- Self.last_Entry.set_Text (Self.Target.Last); -- -- Entry_return_Callbacks.connect (Self.last_Entry, -- "focus-out-event", -- on_last_Entry_leave'Access, -- the_Target); -- Self.type_Button.set_Label (+Self.Target.main_Type.Name); -- -- button_Callbacks.connect (Self.type_Button, -- "clicked", -- on_index_type_Button_clicked'Access, -- Self); -- Button_Callbacks.Connect (Self.rid_Button, -- "clicked", -- on_rid_Button_clicked'Access, -- Self); -- Label_return_Callbacks.Connect (Self.unconstrained_Label, -- "button-release-event", -- on_unconstrained_Label_clicked'Access, -- Self); -- -- Label_return_Callbacks.Connect (Self.constrained_Label, -- "button-release-event", -- on_constrained_Label_clicked'Access, -- Self); Self.freshen; return Self; end to_Editor; end Forge; procedure destroy_Callback (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class) is begin Widget.destroy; end destroy_Callback; overriding procedure freshen (Self : in out Item) is use gtk.Widget; -- the_Literals : AdaM.a_Type.enumeration_literal.vector renames Self.Target.Literals; -- literal_Editor : aIDE.Editor.of_enumeration_literal.view; Children : AdaM.Entity.Entities renames Self.Target.Children.all; begin if Children.is_Empty then Self.null_Label.show; else Self.null_Label.hide; end if; for Each of Children loop declare Child : constant AdaM.record_Component.view := AdaM.record_Component.view (Each); new_Editor : constant aIDE.Editor.of_record_component.view := Editor.of_record_component.Forge.new_Editor (the_target => Child); begin Self.components_Box.pack_Start (new_Editor.top_Widget); end; end loop; -- if Self.is_in_unconstrained_Array -- then -- Self.unconstrained_Label.show; -- -- Self.first_Entry.hide; -- Self.last_Entry.hide; -- Self.range_Label.show; -- Self. constrained_Label.hide; -- else -- Self.unconstrained_Label.hide; -- end if; -- if Self.is_in_unconstrained_Array -- then -- Self.unconstrained_Label.show; -- -- Self.first_Entry.hide; -- Self.last_Entry.hide; -- Self.range_Label.show; -- Self. constrained_Label.hide; -- else -- Self.unconstrained_Label.hide; -- -- if Self.Target.is_Constrained -- then -- Self.range_Label.show; -- Self. constrained_Label.show; -- Self.first_Entry.show; -- Self.last_Entry.show; -- else -- Self.range_Label.hide; -- Self.first_Entry.hide; -- Self.last_Entry.hide; -- Self. constrained_Label.hide; -- Self.unconstrained_Label.hide; -- end if; -- end if; -- Self.first_Entry.set_Text (Self.Target.First); -- Self.last_Entry .set_Text (Self.Target.Last); -- Self.literals_Box.Foreach (destroy_Callback'Access); -- for Each of the_Literals -- loop -- literal_Editor := Editor.of_enumeration_literal.Forge.to_Editor (Each, -- targets_Parent => Self.Target.all'Access); -- Self.literals_Box.pack_Start (literal_Editor.top_Widget); -- end loop; end freshen; overriding function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget is begin return gtk.Widget.Gtk_Widget (Self.top_Box); end top_Widget; end aIDE.Editor.of_record_type;
libsrc/target/z88/sendmail.asm
jpoikela/z88dk
640
21451
; ; Small C+ Runtime Library ; ; Z88 Application functions ; ; *** Z88 SPECIFIC FUNCTION - probably no equiv for your machine! *** ; ; 11/4/99 ; ; Send Mail ; ; int sendmail(char *type, char *info, int length) ; ; Returns 0 on failure, number of bytes present on success SECTION code_clib PUBLIC sendmail PUBLIC _sendmail INCLUDE "saverst.def" .sendmail ._sendmail ld hl,2 add hl,sp ;point to length parameter ld c,(hl) inc hl inc hl ld e,(hl) inc hl ld d,(hl) ; lower 16 of info ld b,0 ; keep it near inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl holds name of info type ex de,hl ; get parameters the right way round ld a,SR_WPD call_oz(os_sr) ld hl,0 ret c ld l,c ret
experiments/test-suite/mutation-based/10/10/balancedBST.als
kaiyuanw/AlloyFLCore
1
735
pred test85 { some disj BinaryTree0: BinaryTree {some disj Node0, Node1, Node2: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node2 Node = Node0 + Node1 + Node2 left = Node0->Node1 + Node2->Node0 right = Node2->Node1 elem = Node0->7 + Node1->6 + Node2->5 }} } run test85 for 4 expect 0 pred test14 { some disj BinaryTree0: BinaryTree {some disj Node0, Node1, Node2: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node2 Node = Node0 + Node1 + Node2 left = Node0->Node1 right = Node2->Node0 elem = Node0->7 + Node1->0 + Node2->-5 Sorted[] }} } run test14 for 4 expect 1 pred test87 { some disj BinaryTree0: BinaryTree {some disj Node0, Node1, Node2: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node2 Node = Node0 + Node1 + Node2 left = Node0->Node1 + Node2->Node2 right = Node2->Node0 elem = Node0->7 + Node1->6 + Node2->4 }} } run test87 for 4 expect 0 pred test22 { some disj BinaryTree0: BinaryTree {some disj Node0, Node1: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node1 Node = Node0 + Node1 left = Node1->Node0 no right elem = Node0->1 + Node1->4 Sorted[] }} } run test22 for 4 expect 1 pred test21 { some disj BinaryTree0: BinaryTree {some disj Node0, Node1: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node1 Node = Node0 + Node1 left = Node1->Node0 no right elem = Node0->3 + Node1->2 Sorted[] }} } run test21 for 4 expect 0 pred test96 { some disj BinaryTree0: BinaryTree {some disj Node0, Node1: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node1 Node = Node0 + Node1 left = Node1->Node0 no right elem = Node0->7 + Node1->5 }} } run test96 for 4 expect 1 pred test71 { some disj BinaryTree0: BinaryTree {some disj Node0, Node1: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node1 Node = Node0 + Node1 left = Node1->Node0 no right elem = Node0->7 + Node1->-4 RepOk[] }} } run test71 for 4 expect 0 pred test43 { some disj BinaryTree0: BinaryTree {some disj Node0, Node1, Node2, Node3: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node3 Node = Node0 + Node1 + Node2 + Node3 no left right = Node1->Node2 + Node2->Node0 + Node3->Node1 elem = Node0->7 + Node1->3 + Node2->2 + Node3->-2 Sorted[] }} } run test43 for 4 expect 0 pred test93 { some disj BinaryTree0: BinaryTree {some disj Node0, Node1, Node2: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node2 Node = Node0 + Node1 + Node2 left = Node0->Node2 right = Node0->Node1 + Node2->Node0 elem = Node0->7 + Node1->5 + Node2->5 }} } run test93 for 4 expect 0 pred test88 { some disj BinaryTree0: BinaryTree {some disj Node0: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node0 Node = Node0 no left no right elem = Node0->-1 }} } run test88 for 4 expect 1 pred test106 { some disj BinaryTree0: BinaryTree {some disj Node0: Node { BinaryTree = BinaryTree0 root = BinaryTree0->Node0 Node = Node0 no left no right elem = Node0->-5 }} } run test106 for 4 expect 1
test/Succeed/Issue3399.agda
caryoscelus/agda
0
3447
<gh_stars>0 {-# OPTIONS --cubical #-} module _ where open import Agda.Primitive.Cubical renaming (primINeg to ~_; primIMax to _∨_; primIMin to _∧_) open import Agda.Builtin.Cubical.Path open import Agda.Builtin.Cubical.Sub open import Agda.Builtin.Cubical.Sub using () renaming (Sub to _[_↦_]; primSubOut to ouc) open import Agda.Primitive renaming (_⊔_ to ℓ-max) open import Agda.Builtin.Sigma transpFill : ∀ {ℓ} {A' : Set ℓ} (φ : I) (A : (i : I) → Set ℓ [ φ ↦ (\ _ → A') ]) → (u0 : ouc (A i0)) → PathP (λ i → ouc (A i)) u0 (primTransp (λ i → ouc (A i)) φ u0) transpFill φ A u0 i = primTransp (\ j → ouc (A (i ∧ j))) (~ i ∨ φ) u0 -- private -- internalFiber : ∀ {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} (f : A → B) (y : B) → Set (ℓ-max ℓ ℓ') -- internalFiber {A = A} f y = Σ A \ x → y ≡ f x -- infix 4 _≃_ -- postulate -- _≃_ : ∀ {ℓ ℓ'} (A : Set ℓ) (B : Set ℓ') → Set (ℓ-max ℓ ℓ') -- equivFun : ∀ {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} → A ≃ B → A → B -- equivProof : ∀ {la lt} (T : Set la) (A : Set lt) → (w : T ≃ A) → (a : A) -- → ∀ ψ → (Partial ψ (internalFiber (equivFun w) a)) → internalFiber (equivFun w) a -- {-# BUILTIN EQUIV _≃_ #-} -- {-# BUILTIN EQUIVFUN equivFun #-} -- {-# BUILTIN EQUIVPROOF equivProof #-} -- -- This is a module so we can easily rename the primitives. -- module GluePrims where -- primitive -- primGlue : ∀ {ℓ ℓ'} (A : Set ℓ) {φ : I} -- → (T : Partial φ (Set ℓ')) → (e : PartialP φ (λ o → T o ≃ A)) -- → Set ℓ' -- prim^glue : ∀ {ℓ ℓ'} {A : Set ℓ} {φ : I} -- → {T : Partial φ (Set ℓ')} → {e : PartialP φ (λ o → T o ≃ A)} -- → PartialP φ T → A → primGlue A T e -- prim^unglue : ∀ {ℓ ℓ'} {A : Set ℓ} {φ : I} -- → {T : Partial φ (Set ℓ')} → {e : PartialP φ (λ o → T o ≃ A)} -- → primGlue A T e → A -- -- Needed for transp in Glue. -- primFaceForall : (I → I) → I open import Agda.Builtin.Cubical.Glue public renaming ( prim^glue to glue ; prim^unglue to unglue) -- We uncurry Glue to make it a bit more pleasant to use Glue : ∀ {ℓ ℓ'} (A : Set ℓ) {φ : I} → (Te : Partial φ (Σ (Set ℓ') \ T → T ≃ A)) → Set ℓ' Glue A Te = primGlue A (λ x → Te x .fst) (λ x → Te x .snd) module TestHComp {ℓ ℓ'} (A : Set ℓ) {φ : I} (Te : Partial φ (Σ (Set ℓ') \ T → T ≃ A)) (ψ : I) (u : I → Partial ψ (Glue A Te)) (u0 : Sub (Glue A Te) ψ (u i0) ) where result : Glue A Te result = glue {φ = φ} (\ { (φ = i1) → primHComp {A = Te itIsOne .fst} u (primSubOut u0) }) (primHComp {A = A} (\ i → \ { (ψ = i1) → unglue {φ = φ} (u i itIsOne) ; (φ = i1) → equivFun (Te itIsOne .snd) (primHComp (\ j → \ { (ψ = i1) → u (i ∧ j) itIsOne ; (i = i0) → primSubOut u0 }) (primSubOut u0)) }) (unglue {φ = φ} (primSubOut u0))) test : primHComp {A = Glue A Te} {ψ} u (primSubOut u0) ≡ result test i = primHComp {A = Glue A Te} {ψ} u (primSubOut u0) module TestTransp {ℓ ℓ'} (A : Set ℓ) {φ : I} (Te : Partial φ (Σ (Set ℓ') \ T → T ≃ A)) (u0 : (Glue A Te)) where ψ = i0 a0 = unglue {φ = φ} u0 a1 = primComp (\ _ → A) φ (\ { i (φ = i1) → equivFun (Te itIsOne .snd) (transpFill {A' = Te itIsOne .fst} ψ (\ i → inc (Te itIsOne .fst)) u0 i) }) a0 pair : PartialP φ λ o → Helpers.fiber (Te o .snd .fst) a1 pair o = equivProof (Te o .fst) A (Te o .snd) a1 φ \ { (φ = i1) → _ , Helpers.refl } result : Glue A Te result = glue {φ = φ} (λ o → pair o .fst) (primHComp (\ { j (φ = i1) → pair itIsOne .snd j}) a1) test : primTransp (\ _ → Glue A Te) ψ u0 ≡ result test = Helpers.refl
test/Fail/Issue1209-3.agda
shlevy/agda
1,989
3149
<filename>test/Fail/Issue1209-3.agda -- This combination should not be allowed: {-# OPTIONS --safe --guardedness --sized-types #-} -- note that `--safe` turns off `--guardedness` and `--sized-types`, -- hence `--guardedness --sized-types --safe` works, but does not -- mean the above combination
src/siphash.adb
jhumphry/SPARK_SipHash
5
4878
<filename>src/siphash.adb -- SipHash -- an Ada implementation of the algorithm described in -- "SipHash: a fast short-input PRF" -- by <NAME> and <NAME> -- Copyright (c) 2015, <NAME> - see LICENSE file for details with System; package body SipHash with SPARK_Mode, Refined_State => (Initial_Hash_State => Initial_State) is -- Short names for fundamental machine types subtype Storage_Offset is System.Storage_Elements.Storage_Offset; -- The initial state from the key passed as generic formal parameters is -- stored here, so that static elaboration followed by a call of SetKey -- can be used in situations where dynamic elaboration might be a problem. -- This could really be in the private part of the package, but SPARK GPL -- 2015 doesn't seem to like Part_Of in the private part of a package, -- regardless of what the SPARK RM says... Initial_State : SipHash_State := (k0 xor 16#736f6d6570736575#, k1 xor 16#646f72616e646f6d#, k0 xor 16#6c7967656e657261#, k1 xor 16#7465646279746573#); ----------------------- -- Get_Initial_State -- ----------------------- function Get_Initial_State return SipHash_State is (Initial_State); ----------------------- -- SArray8_to_U64_LE -- ----------------------- function SArray8_to_U64_LE (S : in SArray_8) return U64 is (U64(S(0)) or Shift_Left(U64(S(1)), 8) or Shift_Left(U64(S(2)), 16) or Shift_Left(U64(S(3)), 24) or Shift_Left(U64(S(4)), 32) or Shift_Left(U64(S(5)), 40) or Shift_Left(U64(S(6)), 48) or Shift_Left(U64(S(7)), 56)); --------------------------- -- SArray_Tail_to_U64_LE -- --------------------------- function SArray_Tail_to_U64_LE (S : in SArray) return U64 is R : U64 := 0; Shift : Natural := 0; begin for I in 0..(S'Length-1) loop pragma Loop_Invariant (Shift = I * 8); R := R or Shift_Left(U64(S(S'First + Storage_Offset(I))), Shift); Shift := Shift + 8; end loop; return R; end SArray_Tail_to_U64_LE; --------------- -- Sip_Round -- --------------- procedure Sip_Round (v : in out SipHash_State) is begin v(0) := v(0) + v(1); v(2) := v(2) + v(3); v(1) := Rotate_Left(v(1), 13); v(3) := Rotate_Left(v(3), 16); v(1) := v(1) xor v(0); v(3) := v(3) xor v(2); v(0) := Rotate_Left(v(0), 32); v(2) := v(2) + v(1); v(0) := v(0) + v(3); v(1) := Rotate_Left(v(1), 17); v(3) := Rotate_Left(v(3), 21); v(1) := v(1) xor v(2); v(3) := v(3) xor v(0); v(2) := Rotate_Left(v(2), 32); end Sip_Round; ---------------------- -- Sip_Finalization -- ---------------------- function Sip_Finalization (v : in SipHash_State) return U64 is vv : SipHash_State := v; begin vv(2) := vv(2) xor 16#ff#; for I in 1..d_rounds loop Sip_Round(vv); end loop; return (vv(0) xor vv(1) xor vv(2) xor vv(3)); end Sip_Finalization; ------------- -- Set_Key -- ------------- procedure Set_Key (k0, k1 : U64) is begin Initial_State := (k0 xor 16#736f6d6570736575#, k1 xor 16#646f72616e646f6d#, k0 xor 16#6c7967656e657261#, k1 xor 16#7465646279746573#); end Set_Key; procedure Set_Key (k : SipHash_Key) is k0, k1 : U64; begin k0 := SArray8_to_U64_LE(k(k'First..k'First+7)); k1 := SArray8_to_U64_LE(k(k'First+8..k'Last)); Set_Key(k0, k1); end Set_Key; ------------- -- SipHash -- ------------- function SipHash (m : System.Storage_Elements.Storage_Array) return U64 is m_pos : Storage_Offset := 0; m_i : U64; v : SipHash_State := Initial_State; w : constant Storage_Offset := (m'Length / 8) + 1; begin -- This compile-time check is useful for GNAT but in GNATprove it -- currently just generates a warning that it can not yet prove -- them correct. pragma Warnings (GNATprove, Off, "Compile_Time_Error"); pragma Compile_Time_Error (System.Storage_Elements.Storage_Element'Size /= 8, "This implementation of SipHash cannot work " & "with Storage_Element'Size /= 8."); pragma Warnings (GNATprove, On, "Compile_Time_Error"); for I in 1..w-1 loop pragma Loop_Invariant (m_pos = (I - 1) * 8); m_i := SArray8_to_U64_LE(m(m'First + m_pos..m'First + m_pos + 7)); v(3) := v(3) xor m_i; for J in 1..c_rounds loop Sip_Round(v); end loop; v(0) := v(0) xor m_i; m_pos := m_pos + 8; end loop; if m_pos < m'Length then m_i := SArray_Tail_to_U64_LE(m(m'First + m_pos .. m'Last)); else m_i := 0; end if; m_i := m_i or Shift_Left(U64(m'Length mod 256), 56); v(3) := v(3) xor m_i; for J in 1..c_rounds loop Sip_Round(v); end loop; v(0) := v(0) xor m_i; return Sip_Finalization(v); end SipHash; end SipHash;
test/asset/agda-stdlib-1.0/Data/AVL/Sets.agda
omega12345/agda-mode
0
16948
<filename>test/asset/agda-stdlib-1.0/Data/AVL/Sets.agda ------------------------------------------------------------------------ -- The Agda standard library -- -- Finite sets, based on AVL trees ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} open import Relation.Binary using (StrictTotalOrder) module Data.AVL.Sets {a ℓ₁ ℓ₂} (strictTotalOrder : StrictTotalOrder a ℓ₁ ℓ₂) where open import Data.Bool open import Data.List.Base as List using (List) open import Data.Maybe.Base as Maybe open import Data.Product as Prod using (_×_; _,_; proj₁) open import Data.Unit open import Function open import Level import Data.AVL strictTotalOrder as AVL open StrictTotalOrder strictTotalOrder renaming (Carrier to A) ------------------------------------------------------------------------ -- The set type (note that Set is a reserved word) ⟨Set⟩ : Set (a ⊔ ℓ₂) ⟨Set⟩ = AVL.Tree (AVL.const ⊤) ------------------------------------------------------------------------ -- Repackaged functions empty : ⟨Set⟩ empty = AVL.empty singleton : A → ⟨Set⟩ singleton k = AVL.singleton k _ insert : A → ⟨Set⟩ → ⟨Set⟩ insert k = AVL.insert k _ delete : A → ⟨Set⟩ → ⟨Set⟩ delete = AVL.delete infix 4 _∈?_ _∈?_ : A → ⟨Set⟩ → Bool _∈?_ = AVL._∈?_ headTail : ⟨Set⟩ → Maybe (A × ⟨Set⟩) headTail s = Maybe.map (Prod.map₁ proj₁) (AVL.headTail s) initLast : ⟨Set⟩ → Maybe (⟨Set⟩ × A) initLast s = Maybe.map (Prod.map₂ proj₁) (AVL.initLast s) fromList : List A → ⟨Set⟩ fromList = AVL.fromList ∘ List.map (_, _) toList : ⟨Set⟩ → List A toList = List.map proj₁ ∘ AVL.toList
oeis/081/A081518.asm
neoneye/loda-programs
11
2600
<filename>oeis/081/A081518.asm<gh_stars>10-100 ; A081518: Final term in row n of A081520. ; Submitted by <NAME> ; 1,2,6,6,20,8,42,14,24,15,110,16,156,22,30,30,272,26,342,32,48,38,506,34,120,46,78,48,812,39,930,62,81,62,110,52,1332,70,99,65,1640,57,1806,78,95,86,2162,70,336,82,135,94,2756,80,198,96,152,110,3422,81,3660,118,144,126,245,93,4422,126,186,105,4970,106,5256,142,159,142,343,111,6162,132,240,158,6806,117,340,166,240,160,7832,122,429,174,258,182,390,142,9312,170,249,165 mov $1,1 add $1,$0 mov $2,1 lpb $0 mov $3,$2 mul $3,$0 lpb $3 add $2,1 mov $4,$1 gcd $4,$2 cmp $4,1 sub $3,$4 lpe sub $0,1 add $2,1 lpe mov $0,$2
src/main/fragment/mos6502-common/vwsm1_ge_vwsc1_then_la1.asm
jbrandwood/kickc
2
5100
<filename>src/main/fragment/mos6502-common/vwsm1_ge_vwsc1_then_la1.asm lda {m1} cmp #<{c1} lda {m1}+1 sbc #>{c1} bvc !+ eor #$80 !: bpl {la1}
thesisExamples/Bias.agda
JoeyEremondi/lambda-pi-constraint
16
7758
{-# OPTIONS --type-in-type #-} module Bias where open import AgdaPrelude myFun : (a : Set) -> a -> a -> a -> a myFun a x y z = x --myApp1 = myFun _ Zero Zero (Nil Nat) myApp2 = myFun _ (Nil Nat) Zero Zero
source/amf/uml/amf-internals-uml_includes.ads
svn2github/matreshka
24
19369
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE 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 -- -- HOLDER 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. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Internals.UML_Named_Elements; with AMF.UML.Dependencies.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Includes; with AMF.UML.Named_Elements; with AMF.UML.Namespaces; with AMF.UML.Packages.Collections; with AMF.UML.String_Expressions; with AMF.UML.Use_Cases; with AMF.Visitors; package AMF.Internals.UML_Includes is type UML_Include_Proxy is limited new AMF.Internals.UML_Named_Elements.UML_Named_Element_Proxy and AMF.UML.Includes.UML_Include with null record; overriding function Get_Addition (Self : not null access constant UML_Include_Proxy) return AMF.UML.Use_Cases.UML_Use_Case_Access; -- Getter of Include::addition. -- -- References the use case that is to be included. overriding procedure Set_Addition (Self : not null access UML_Include_Proxy; To : AMF.UML.Use_Cases.UML_Use_Case_Access); -- Setter of Include::addition. -- -- References the use case that is to be included. overriding function Get_Including_Case (Self : not null access constant UML_Include_Proxy) return AMF.UML.Use_Cases.UML_Use_Case_Access; -- Getter of Include::includingCase. -- -- References the use case which will include the addition and owns the -- include relationship. overriding procedure Set_Including_Case (Self : not null access UML_Include_Proxy; To : AMF.UML.Use_Cases.UML_Use_Case_Access); -- Setter of Include::includingCase. -- -- References the use case which will include the addition and owns the -- include relationship. overriding function Get_Source (Self : not null access constant UML_Include_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of DirectedRelationship::source. -- -- Specifies the sources of the DirectedRelationship. overriding function Get_Target (Self : not null access constant UML_Include_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of DirectedRelationship::target. -- -- Specifies the targets of the DirectedRelationship. overriding function Get_Related_Element (Self : not null access constant UML_Include_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Relationship::relatedElement. -- -- Specifies the elements related by the Relationship. overriding function Get_Client_Dependency (Self : not null access constant UML_Include_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name_Expression (Self : not null access constant UML_Include_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access UML_Include_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant UML_Include_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant UML_Include_Proxy) return AMF.Optional_String; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. overriding function All_Owning_Packages (Self : not null access constant UML_Include_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant UML_Include_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant UML_Include_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding procedure Enter_Element (Self : not null access constant UML_Include_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Element (Self : not null access constant UML_Include_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Element (Self : not null access constant UML_Include_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end AMF.Internals.UML_Includes;
test/interaction/Issue2051.agda
cruhland/agda
1,989
10827
<reponame>cruhland/agda<filename>test/interaction/Issue2051.agda -- Andreas, 2016-06-20 issue #2051 -- Try to preserve rhs when splitting a clause data D : Set where d : D c : D → D -- A simple RHS that should be preserved by splitting: con : (x : D) → D con x = c {!x!} -- C-c C-c -- More delicate, a meta variable applied to something: -- This means the hole is not at the rightmost position. app : (x : D) → D app x = {!x!} x -- A let-binding (not represented in internal syntax): test : (x : D) → D test x = let y = c in {!x!} -- C-c C-c -- Case splitting replaces entire RHS by hole -- test c = ?
Codes/Chapter05/P06/P05-06.asm
ar-ekt/Dandamudi-Assembly-Solutions
8
163975
%INCLUDE "lib.h" global _start section .data prompt_msg db "Please input a string: ", 10, 0 reverse_msg db "String in reverse order: ", 10, 0 endl db 10, 0 section .bss string resb 41 section .code _start: puts prompt_msg fgets string, 41 push string ; push pointer to string onto stack call reverse puts reverse_msg puts string ; display string that it is in reverse order now puts endl mov eax, 1 mov ebx, 0 int 0x80 %DEFINE STRING [EBP + 8] ;-----------------------proc reverse-------------------------; ; reverse procedure receives a pointer to a character string ; ; (terminated by a NULL character) and reverses the string. ; ;------------------------------------------------------------; reverse: enter 0, 0 push eax push ebx mov ebx, STRING push_characters: cmp [ebx], byte 0 ; check if we reached end of string je push_done xor ax, ax mov al, [ebx] ; load AL with current character push ax ; push character onto stack to be recived later inc ebx ; increase pointer to point to next character jmp push_characters push_done: mov ebx, STRING pop_characters: cmp [ebx], byte 0 ; check if we reached end of string je reverse_done pop ax ; recive characters in backward order mov [ebx], al ; and place them in original string in forward order ; its logic: string[0] <- string[last_index + 0], string[1] <- string[last_index - 1] and so on ... inc ebx ; increase pointer to point to next character jmp pop_characters reverse_done: pop ebx pop eax leave ret 4
oeis/142/A142792.asm
neoneye/loda-programs
11
27038
<filename>oeis/142/A142792.asm ; A142792: Primes congruent to 31 mod 60. ; Submitted by <NAME>(s3) ; 31,151,211,271,331,571,631,691,751,811,991,1051,1171,1231,1291,1471,1531,1831,1951,2011,2131,2251,2311,2371,2551,2671,2731,2791,2851,2971,3271,3331,3391,3511,3571,3631,3691,3931,4051,4111,4231,4591,4651,4831,4951,5011,5431,5791,5851,6091,6151,6211,6271,6451,6571,6691,6871,6991,7351,7411,7591,7951,8011,8191,8311,8431,8731,8971,9091,9151,9391,9511,9631,9811,9871,9931,10111,10531,10651,10711,10771,10831,10891,11071,11131,11251,11311,11491,11551,11731,11971,12211,12391,12451,12511,13171,13291,13411 mov $1,6 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $2,1 mov $3,$1 mul $3,5 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,12 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 sub $0,17 mul $0,5 add $0,26
source/gameFlow.asm
lvcabral/retaliate64
65
173426
<reponame>lvcabral/retaliate64 ;=============================================================================== ; gameFlow.asm - Game Flow Control ; ; Copyright (C) 2017,2018 <NAME> - <https://lvcabral.com> ; ; Distributed under the MIT software license, see the accompanying ; file LICENSE or https://opensource.org/licenses/MIT ; ;=============================================================================== ; Constants FlowNumLives = 1 FlowStateMenu = 0 FlowStateAlive = 1 FlowStateDying = 2 JoyStickDelay = 10 BarCharacter = $50 OneCharacter = $31 ;=============================================================================== ; Variables flowScoreX byte 7 flowScoreNumX byte 0 flowScoreY byte 0 score1 byte 0 score2 byte 0 score3 byte 0 time1 byte 0 time2 byte 0 lives byte 0 flowHiScoreX byte 24 flowHiScoreNumX byte 0 flowHiScoreY byte 0 hiscore1 byte 0 hiscore2 byte 0 hiscore3 byte 0 statsHiScore byte 0 flowGaugeX byte 1 flowGaugeOneX byte 2 flowGaugePctX byte 4 flowGaugeBarX byte 5 flowGaugeY byte 24 energy byte 0 lastEnergy byte 0 flowGaugeCnt byte 0 flowGaugeClr byte 0 flowAmmoX byte 32 flowAmmoNumX byte 0 flowAmmoY byte 24 bullets byte 0 bullets1 byte 0 bullets2 byte 0 aliens1 byte 0 aliens2 byte 0 flowJoystick byte 0 flowScoreText text 'score:' byte 0 flowHiScoreText text 'hi:' byte 0 flowAmmoText text 'ammo:' byte 0 flowAmmoClear dcb 8, SpaceCharacter byte 0 flowGaugeTxt byte $31, $00 flowGaugePct byte $25, $00 flowGaugeBar dcb 15, SpaceCharacter byte 0 flowGaugeClear dcb 19, SpaceCharacter byte 0 flowPaused byte 0 flowState byte FlowStateMenu ;=============================================================================== ; Jump Tables gameFlowJumpTableLow byte <gameFlowUpdateMenu byte <gameFlowUpdateAlive byte <gameFlowUpdateDying gameFlowJumpTableHigh byte >gameFlowUpdateMenu byte >gameFlowUpdateAlive byte >gameFlowUpdateDying ;=============================================================================== ; Macros/Subroutines gameFlowInit LIBSCREEN_DRAWTEXT_AAAV flowScoreX, flowScoreY, flowScoreText, White jsr gameFlowScoreDisplay LIBSCREEN_DRAWTEXT_AAAV flowHiScoreX, flowHiScoreY, flowHiScoreText, White jsr gameFlowHiScoreDisplay rts ;=============================================================================== gameFlowUpdateMenu lda menuDisplayed bne gFUMCheckFire jsr gameMenuShowLogo jsr gameMenuShowText gFUMCheckFire LIBINPUT_GETFIREPRESSED beq gFUMStartGame lda screenColumn cmp #MenuStory beq gFUMStoryKeys cmp #MenuHangar beq gFUMHangarKeys jmp gFUMDecScreenTimer gFUMStoryKeys jsr SCNKEY jsr GETIN cmp #KEY_F1 beq gFUMShowInfo cmp #KEY_F3 beq gFUMShowHangar cmp #KEY_F5 beq gFUMShowCredits jmp gFUMEnd gFUMStartGame jmp gameFlowStartGame gFUMShowHangar lda #MenuHangar sta screenColumn jsr gameMenuShowHangar jsr gameMenuShowText jsr gameMenuLevelDisplay jsr gameMenuMusicDisplay jsr gameMenuSfxDisplay jsr gameMenuModelReset jmp gFHModelDisplay gFUMDecScreenTimer jsr gameFlowDecreaseTime lda time2 beq gFUMShowStory jmp gFUMEnd gFUMShowStory lda #MenuStory sta screenColumn jsr gameMenuModelHide jsr gameMenuShowLogo jmp gameMenuShowText gFUMShowInfo jsr gameFlowResetScreenTime lda #MenuInfo sta screenColumn jmp gameMenuShowText gFUMHangarKeys jmp gameFlowHangar gFUMShowCredits jsr gameFlowResetScreenTime lda #MenuCredits sta screenColumn jsr gameMenuShowText gFUMEnd rts ;=============================================================================== gameFlowHangar lda messageFlag bne gFHDecMsgTimer lda flowJoystick bne gFHCheckKeys lda #JoyStickDelay sta flowJoystick jmp gFHJoyLeft gFHDecMsgTimer jsr gameFlowDecreaseTime lda time2 beq gFHRestoreMenu jmp gFHEnd gFHRestoreMenu jsr gameMenuRestore jmp gameMenuLevelDisplay gFHJoyLeft LIBINPUT_GETHELD GameportLeftMask bne gFHJoyRight jmp gFHPrevModel gFHJoyRight LIBINPUT_GETHELD GameportRightMask bne gFHJoyDown jmp gFHNextModel gFHJoyDown LIBINPUT_GETHELD GameportDownMask bne gFHHideShield jsr gameMenuShieldDisplay jmp gFHCheckKeys gFHHideShield LIBSPRITE_ENABLE_AV shieldSprite, False gFHCheckKeys dec flowJoystick ; Hangar Menu Key handling jsr SCNKEY jsr GETIN cmp #KEY_LEFT beq gFHPrevModel cmp #KEY_RIGHT beq gFHNextModel cmp #KEY_DOWN beq gFHPrevModel cmp #KEY_UP beq gFHNextModel cmp #KEY_F1 beq gFHShipColor cmp #KEY_F3 beq gFHShieldColor cmp #KEY_F5 beq gFHLevel cmp #KEY_M beq gFHMusicSwitch cmp #KEY_S beq gFHSfxSwitch cmp #KEY_F7 beq gFHSaveData cmp #KEY_BACK bne gFHEnd jmp gFUMShowStory gFHPrevModel jsr gameMenuModelPrevious jmp gFHModelDisplay gFHNextModel jsr gameMenuModelNext jmp gFHModelDisplay gFHShowShield jmp gameMenuShieldDisplay gFHShipColor jsr gameMenuShipColorNext jmp gFHModelDisplay gFHShieldColor jsr gameMenuShieldColorNext jmp gameMenuColorDisplay gFHLevel jsr gameMenuLevelChange jmp gameMenuLevelDisplay gFHMusicSwitch jsr gameMenuMusicSwitch jmp gameMenuMusicDisplay gFHSfxSwitch jsr gameMenuSfxSwitch jmp gameMenuSfxDisplay gFHSaveData jsr gameDataSave jsr gameMenuSaveDisplay jmp gameFlowResetMsgTime gFHModelDisplay jsr gameMenuColorDisplay jsr gameMenuModelDisplay gFHEnd rts ;=============================================================================== gameFlowStartGame jsr gameMenuClearText jsr gameFlowShowGameStatus ; reset lda #MenuGameOver sta screenColumn lda #False sta flowPaused jsr gameFlowResetScore jsr gameFlowResetLives jsr gameAliensReset jsr gamePlayerReset jsr libMusicInit ; set difficulty level ldx levelNum lda bulletSpeedArray,X sta bulletSpeed lda shieldSpeedArray,X sta shieldSpeed lda aliensSpeedArray,X sta aliensSpeed ; change state lda #FlowStateAlive sta flowState rts ;=============================================================================== gameFlowShowGameStatus jsr gameflowShieldGaugeDisplay LIBSCREEN_DRAWTEXT_AAAV flowAmmoX, flowAmmoY, flowAmmoText, White jsr gameflowBulletsDisplay rts ;=============================================================================== gameFlowUpdateAlive jsr SCNKEY jsr GETIN cmp #0 beq gFUAReturn cmp #KEY_SPACE beq gFUAPause cmp #KEY_M beq gFUAMusic cmp #KEY_S jsr gameMenuSfxSwitch lda soundDisabled beq gFUAReturn jmp gFUADisable gFUAPause lda flowPaused beq gFUAPlay inc flowPaused jmp gFUAReturn gFUAPlay dec flowPaused jmp gFUAReturn gFUAMusic jsr gameMenuMusicSwitch lda sidDisabled beq gFUAReturn gFUADisable jsr libSoundInit gFUAReturn rts ;=============================================================================== gameFlowUpdateDying LIBSPRITE_ISANIMPLAYING_A playerSprite bne gFUDEnd lda lives bne gFUDHasLives jsr gameAliensWaveReset jsr gameFlowClearStatusLine jsr gameFlowResetGameOverTime ; change state lda #FlowStateMenu sta flowState jsr gameMenuShowText jsr gameMenuShowStats jmp gFUDEnd gFUDHasLives LIBINPUT_GETFIREPRESSED bne gFUDEnd ; reset jsr gamePlayerReset ; change state lda #FlowStateAlive sta flowState gFUDEnd rts ;=============================================================================== gameFlowClearStatusLine LIBSCREEN_DRAWTEXT_AAAV flowGaugeX, flowGaugeY, flowGaugeClear, White LIBSCREEN_DRAWTEXT_AAAV flowAmmoX, flowAmmoY, flowAmmoClear, White rts ;=============================================================================== gameFlowUpdate ; get the current state ldy flowState ; write the subroutine address to a zeropage location lda gameFlowJumpTableLow,y sta ZeroPageLow lda gameFlowJumpTableHigh,y sta ZeroPageHigh ; jump to the subroutine the zeropage location points to jmp (ZeroPageLow) ;=============================================================================== gameFlowIncreaseScore sed ;set decimal mode clc lda aliensScore ;points scored adc score1 ;ones and tens sta score1 lda score2 ;hundreds and thousands adc #00 sta score2 lda score3 ;ten-thousands and hundred-thousands adc #00 sta score3 clc lda #1 ;alien destroyed adc aliens1 ;ones and tens sta aliens1 lda aliens2 ;hundreds and thousands adc #00 sta aliens2 cld ;clear decimal mode jsr gameFlowScoreDisplay rts ;=============================================================================== gameFlowResetScore lda #0 sta score1 sta score2 sta score3 sta statsHiScore jsr gameFlowScoreDisplay rts ;=============================================================================== gameFlowResetScreenTime lda #$60 sta time1 lda #ScreenTime sta time2 rts ;=============================================================================== gameFlowResetGameOverTime lda #$60 sta time1 lda #GameOverTime sta time2 rts ;=============================================================================== gameFlowResetMsgTime lda #$60 sta time1 lda #MessageTime sta time2 rts ;=============================================================================== gameFlowDecreaseTime lda time2 beq gFDTDone sed ;set decimal mode sec ; sec is the same as clear borrow lda time1 ; Get first number sbc #1 ; Subtract 1 sta time1 ; Store in first number lda time2 ; Get 2nd first number sbc #0 ; Subtract borrow sta time2 ; Store 2nd number cld ;clear decimal mode gFDTDone rts ;=============================================================================== gameFlowAddBullet ; Check if Ammo reached 99 (maximum) lda bullets cmp #$99 beq gFABDone sed ;set decimal mode clc lda #1 ;1 bullet added adc bullets sta bullets clc lda #1 ;add to statistics adc bullets1 ;ones and tens sta bullets1 lda bullets2 ;hundreds and thousands adc #00 sta bullets2 cld ;clear decimal mode jsr gameflowBulletsDisplay gFABDone rts ;=============================================================================== gameFlowUseBullet sed ;set decimal mode sec lda bullets sbc #1 ;1 bullet used sta bullets cld ;clear decimal mode jsr gameflowBulletsDisplay rts ;=============================================================================== gameFlowUpdateGauge sed ;set decimal mode clc lda #0 adc shieldEnergy sta energy cld ;clear decimal mode cmp lastEnergy beq gFUGDone sta lastEnergy jsr gameflowShieldGaugeDisplay gFUGDone rts ;=============================================================================== gameFlowResetLives lda #FlowNumLives sta lives lda #0 sta bullets sta bullets1 sta bullets2 sta aliens1 sta aliens2 jsr gameflowBulletsDisplay rts ;=============================================================================== gameFlowPlayerDied jsr gameBulletsReset ; stops in flight bullets from scoring dec lives bne gFPDHasLivesLeft jsr gameFlowUpdateHiScore gFPDHasLivesLeft jsr gameflowBulletsDisplay ; change state lda #FlowStateDying sta flowState rts ;=============================================================================== gameFlowUpdateHiScore ; Do not update if same score lda score1 cmp hiscore1 bne gFUCheckHi lda score2 cmp hiscore2 bne gFUCheckHi lda score3 cmp hiscore3 beq gFUHNotHi gFUCheckHi ; http://6502.org/tutorials/decimal_mode.html#4.2 ; a common technique for comparing multi-byte numbers lda score1 cmp hiscore1 lda score2 sbc hiscore2 lda score3 sbc hiscore3 bcc gFUHNotHi lda score1 sta hiscore1 lda score2 sta hiscore2 lda score3 sta hiscore3 lda #True sta statsHiScore jsr gameFlowHiScoreDisplay gFUHNotHi rts ;=============================================================================== gameFlowScoreDisplay LIBMATH_ADD8BIT_AVA flowScoreX, 6, flowScoreNumX LIBSCREEN_DRAWDECIMAL_AAAV flowScoreNumX, flowScoreY, score3, White LIBMATH_ADD8BIT_AVA flowScoreX, 8, flowScoreNumX LIBSCREEN_DRAWDECIMAL_AAAV flowScoreNumX, flowScoreY, score2, White LIBMATH_ADD8BIT_AVA flowScoreX, 10, flowScoreNumX LIBSCREEN_DRAWDECIMAL_AAAV flowScoreNumX, flowScoreY, score1, White rts ;=============================================================================== gameFlowHiScoreDisplay LIBMATH_ADD8BIT_AVA flowHiScoreX, 3, flowHiScoreNumX LIBSCREEN_DRAWDECIMAL_AAAV flowHiScoreNumX, flowHiScoreY, hiscore3, White LIBMATH_ADD8BIT_AVA flowHiScoreX, 5, flowHiScoreNumX LIBSCREEN_DRAWDECIMAL_AAAV flowHiScoreNumX, flowHiScoreY, hiscore2, White LIBMATH_ADD8BIT_AVA flowHiScoreX, 7, flowHiScoreNumX LIBSCREEN_DRAWDECIMAL_AAAV flowHiScoreNumX, flowHiScoreY, hiscore1, White rts ;=============================================================================== gameflowBulletsDisplay LIBMATH_ADD8BIT_AVA flowAmmoX, 5, flowAmmoNumX LIBSCREEN_DRAWDECIMAL_AAAV flowAmmoNumX, flowAmmoY, bullets, White rts ;=============================================================================== gameflowShieldGaugeDisplay lda shieldEnergy cmp #ShieldMaxEnergy bne gFSGDNoHundred lda #OneCharacter jmp gFSGDGauge gFSGDNoHundred lda #SpaceCharacter gFSGDGauge sta flowGaugeTxt LIBSCREEN_DRAWTEXT_AAAV flowGaugeX, flowGaugeY, flowGaugeTxt, White LIBSCREEN_DRAWDECIMAL_AAAV flowGaugeOneX, flowGaugeY, energy, White LIBSCREEN_DRAWTEXT_AAAV flowGaugePctX, flowGaugeY, flowGaugePct, White ldx #0 gFSGDLoop stx flowGaugeCnt inc flowGaugeCnt lda flowGaugeCnt jsr gameflowMultiplyByTen cmp shieldEnergy bcc gFSGDBar lda #SpaceCharacter jmp gFSGDDraw gFSGDBar lda #BarCharacter gFSGDDraw sta flowGaugeBar,X inx cpx #15 bne gFSGDLoop jsr gameflowSelectGaugeColor LIBSCREEN_DRAWTEXT_AAAA flowGaugeBarX, flowGaugeY, flowGaugeBar, flowGaugeClr rts ;=============================================================================== gameflowSelectGaugeColor ldy shieldEnergy cpy #45 ; if shield is critically low change color to red bcc gFSGCRed lda shieldColor sta flowGaugeClr jmp gFSGCDone gFSGCRed lda #Red sta flowGaugeClr gFSGCDone rts ;=============================================================================== gameflowMultiplyByTen ; Code from: http://codebase64.org/doku.php?id=base:multiplication_with_a_constant sta ZeroPageTemp asl ; Shifting something left three times multiplies it by eight asl asl asl ZeroPageTemp ; Shifting something left one time multiplies it by two clc ; Clear carry adc ZeroPageTemp ; Add the two results together rts
src/Sym_Expr/test/test-solving.adb
fintatarta/eugen
0
6873
with Test_Report; use Test_Report; with Symbolic_Expressions.Solving; with Ada.Strings.Unbounded; procedure Test.Solving is use Ada.Strings.Unbounded; function "+" (X : String) return Unbounded_String renames To_Unbounded_String; function "+" (X : Unbounded_String) return String renames To_String; type Equation_Type is record Var : Unbounded_String; Expr : Unbounded_String; end record; -- Type representing an equation <var> = <expr> type System is array (Positive range <>) of Equation_Type; -- System of many equations type System_Access is access System; type Var_Value_Pair is record Var : Unbounded_String; Value : Integer; end record; type Solution is array (Positive range <>) of Var_Value_Pair; type Solution_Access is access Solution; type Test_Case is record Equations : System_Access; Result : Solution_Access; -- Set Result to null if the system is supposed to be not solvable end record; type Test_Case_Array is array (Positive range <>) of Test_Case; Test_Cases : constant Test_Case_Array := ((Equations => new System' ((+"y", +"x*u-3"), (+"u", +"42"), (+"x", +"u/2")), Result => new Solution' ((+"u", 42), (+"x", 21), (+"y", 879))), (Equations => new System' ((+"y", +"x*u-3"), (+"u", +"42")), Result => null)); package Solving is new Int_Expr.Solving; function Check (This : Test_Case) return Boolean is use Int_Expr.Variable_Tables; use Int_Expr; Equations : Solving.Equation_Tables.Map; Result : Int_Expr.Variable_Tables.Map; Success : Boolean; Pos : Int_Expr.Variable_Tables.Cursor; Expected : Int_Expr.Variable_Tables.Map; begin for I in This.Equations'Range loop Equations.Insert (Key => +This.Equations (I).Var, New_Item => Parse (+This.Equations (I).Expr)); end loop; if This.Result /= null then for I in This.Result'Range loop Expected.Insert (Key => +This.Result (I).Var, New_Item => This.Result (I).Value); end loop; end if; Solving.Triangular_Solve (What => Equations, Result => Result, Success => Success); if not Success then -- Return true if and only if we expected that the system was not -- solvable return This.Result = null; end if; if This.Result = null then -- Here Success=True, but we expected a non-solvable system return False; end if; pragma Assert (Success and This.Result /= null); Pos := Expected.First; while Pos /= No_Element loop if not Result.Contains (Key (Pos)) then return False; end if; if Result.Element (Key (Pos)) /= Element (Pos) then return False; end if; Next (Pos); end loop; Pos := Result.First; while Pos /= No_Element loop if not Expected.Contains (Key (Pos)) then return False; end if; Next (Pos); end loop; return True; end Check; procedure Do_Solving_Checks is new Do_Suite (Test_Case => Test_Case, Test_Case_Array => Test_Case_Array, Check => Check); Reporter : Reporter_Type; begin Do_Solving_Checks (Reporter, Test_Cases); Final (Reporter); end Test.Solving;
Old Programmes/8085/Memory Copy/memcpy.asm
illuminati-inc-2020/school
0
175769
<filename>Old Programmes/8085/Memory Copy/memcpy.asm LXI H,0100H ;0100H<-INPUT MOV C,M ;C<-COUNTER INX H LXI D,0200H ;0200H<-OUTPUT LOOP: MOV A,M XCHG MOV M,A XCHG INX H INX D DCR C JNZ LOOP HLT
stringtemplate/STLexer.g4
ChristianWulf/grammars-v4
4
6893
/* [The "BSD license"] * Copyright (c) 2011-2014 <NAME> * Copyright (c) 2015 <NAME> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ /* Antlr grammar for StringTemplate v4. * * Modified 2015.06.16 gbr * -- update for compatibility with Antlr v4.5 * -- use imported standard fragments */ lexer grammar STLexer; options { superClass = LexerAdaptor ; } import LexBasic; // Standard set of fragments channels { OFF_CHANNEL // non-default channel for whitespace and comments } // ----------------------------------- // default mode = Outside DOC_COMMENT : DocComment -> channel(OFF_CHANNEL) ; BLOCK_COMMENT : BlockComment -> channel(OFF_CHANNEL) ; LINE_COMMENT : LineComment -> channel(OFF_CHANNEL) ; TMPL_COMMENT : TmplComment -> channel(OFF_CHANNEL) ; HORZ_WS : Hws+ -> channel(OFF_CHANNEL) ; VERT_WS : Vws+ -> channel(OFF_CHANNEL) ; ESCAPE : . { isLDelim() }? EscSeq . { isRDelim() }? ; // self contained LDELIM : . { isLDelim() }? -> mode(Inside) ; // switch mode to inside RBRACE : RBrace { endsSubTemplate(); } ; // conditional switch to inside TEXT : . { adjText(); } ; // have to handle weird terminals // ----------------------------------- mode Inside ; INS_HORZ_WS : Hws+ -> type(HORZ_WS), channel(OFF_CHANNEL) ; INS_VERT_WS : Vws+ -> type(VERT_WS), channel(OFF_CHANNEL) ; LBRACE : LBrace { startsSubTemplate() }? -> mode(SubTemplate) ; RDELIM : . { isRDelim() }? -> mode(DEFAULT_MODE) ; STRING : DQuoteLiteral ; IF : 'if' ; ELSEIF : 'elseif' ; ELSE : 'else' ; ENDIF : 'endif' ; SUPER : 'super' ; END : '@end' ; TRUE : True ; FALSE : False ; AT : At ; ELLIPSIS : Ellipsis ; DOT : Dot ; COMMA : Comma ; COLON : Colon ; SEMI : Semi ; AND : And ; OR : Or ; LPAREN : LParen ; RPAREN : RParen ; LBRACK : LBrack ; RBRACK : RBrack ; EQUALS : Equal ; BANG : Bang ; // ----------------------------------- // Unknown content in mode Inside ERR_CHAR : . -> skip ; // ----------------------------------- mode SubTemplate ; SUB_HORZ_WS : Hws+ -> type(HORZ_WS), channel(OFF_CHANNEL) ; SUB_VERT_WS : Vws+ -> type(VERT_WS), channel(OFF_CHANNEL) ; ID : NameStartChar NameChar* ; SUB_COMMA : Comma -> type(COMMA) ; PIPE : Pipe -> mode(DEFAULT_MODE) ; // ----------------------------------- // Grammar specific fragments fragment TmplComment : LTmplMark .*? RTmplMark ; fragment LTmplMark : . { isLTmplComment() }? Bang ; fragment RTmplMark : Bang . { isRTmplComment() }? ;
oeis/017/A017260.asm
neoneye/loda-programs
11
97524
; A017260: a(n) = (9*n + 8)^4. ; 4096,83521,456976,1500625,3748096,7890481,14776336,25411681,40960000,62742241,92236816,131079601,181063936,244140625,322417936,418161601,533794816,671898241,835210000,1026625681,1249198336,1506138481,1800814096,2136750625,2517630976,2947295521,3429742096,3969126001,4569760000,5236114321,5972816656,6784652161,7676563456,8653650625,9721171216,10884540241,12149330176,13521270961,15006250000,16610312161,18339659776,20200652641,22199808016,24343800625,26639462656,29093783761,31713911056,34507149121 mul $0,9 add $0,8 pow $0,4
src/Categories/Enriched/Category.agda
MirceaS/agda-categories
0
8078
<filename>src/Categories/Enriched/Category.agda {-# OPTIONS --without-K --safe #-} -- Enriched category over a Monoidal category V open import Categories.Category using (categoryHelper) renaming (Category to Setoid-Category) open import Categories.Category.Monoidal using (Monoidal) module Categories.Enriched.Category {o ℓ e} {V : Setoid-Category o ℓ e} (M : Monoidal V) where open import Level open import Function using (_$_) open import Categories.Category.Monoidal.Properties M using (module Kelly's) open import Categories.Category.Monoidal.Reasoning M open import Categories.Category.Monoidal.Utilities M using (module Shorthands) open import Categories.Functor using (Functor) open import Categories.Morphism.Reasoning V import Categories.Morphism.IsoEquiv V as IsoEquiv open Setoid-Category V renaming (Obj to ObjV; id to idV) open Commutation open Monoidal M open Shorthands open IsoEquiv._≃_ record Category v : Set (o ⊔ ℓ ⊔ e ⊔ suc v) where field Obj : Set v hom : (A B : Obj) → ObjV id : {A : Obj} → unit ⇒ hom A A ⊚ : {A B C : Obj} → hom B C ⊗₀ hom A B ⇒ hom A C ⊚-assoc : {A B C D : Obj} → [ (hom C D ⊗₀ hom B C) ⊗₀ hom A B ⇒ hom A D ]⟨ ⊚ ⊗₁ idV ⇒⟨ hom B D ⊗₀ hom A B ⟩ ⊚ ≈ associator.from ⇒⟨ hom C D ⊗₀ (hom B C ⊗₀ hom A B) ⟩ idV ⊗₁ ⊚ ⇒⟨ hom C D ⊗₀ hom A C ⟩ ⊚ ⟩ unitˡ : {A B : Obj} → [ unit ⊗₀ hom A B ⇒ hom A B ]⟨ id ⊗₁ idV ⇒⟨ hom B B ⊗₀ hom A B ⟩ ⊚ ≈ unitorˡ.from ⟩ unitʳ : {A B : Obj} → [ hom A B ⊗₀ unit ⇒ hom A B ]⟨ idV ⊗₁ id ⇒⟨ hom A B ⊗₀ hom A A ⟩ ⊚ ≈ unitorʳ.from ⟩ -- A version of ⊚-assoc using generalized hom-variables. -- -- In this version of associativity, the generalized variables f, g -- and h represent V-morphisms, or rather, morphism-valued maps, -- such as V-natural transofrmations or V-functorial actions. This -- version is therefore well-suited for proving derived equations, -- such as functorial laws or commuting diagrams, that involve such -- maps. For examples, see Underlying.assoc below, or the modules -- Enriched.Functor and Enriched.NaturalTransformation. ⊚-assoc-var : {X Y Z : ObjV} {A B C D : Obj} {f : X ⇒ hom C D} {g : Y ⇒ hom B C} {h : Z ⇒ hom A B} → [ (X ⊗₀ Y) ⊗₀ Z ⇒ hom A D ]⟨ (⊚ ∘ f ⊗₁ g) ⊗₁ h ⇒⟨ hom B D ⊗₀ hom A B ⟩ ⊚ ≈ associator.from ⇒⟨ X ⊗₀ (Y ⊗₀ Z) ⟩ f ⊗₁ (⊚ ∘ g ⊗₁ h) ⇒⟨ hom C D ⊗₀ hom A C ⟩ ⊚ ⟩ ⊚-assoc-var {f = f} {g} {h} = begin ⊚ ∘ (⊚ ∘ f ⊗₁ g) ⊗₁ h ≈⟨ refl⟩∘⟨ split₁ˡ ⟩ ⊚ ∘ ⊚ ⊗₁ idV ∘ (f ⊗₁ g) ⊗₁ h ≈⟨ pullˡ ⊚-assoc ⟩ (⊚ ∘ idV ⊗₁ ⊚ ∘ α⇒) ∘ (f ⊗₁ g) ⊗₁ h ≈⟨ pullʳ (pullʳ assoc-commute-from) ⟩ ⊚ ∘ idV ⊗₁ ⊚ ∘ f ⊗₁ (g ⊗₁ h) ∘ α⇒ ≈˘⟨ refl⟩∘⟨ pushˡ split₂ˡ ⟩ ⊚ ∘ f ⊗₁ (⊚ ∘ g ⊗₁ h) ∘ α⇒ ∎ -- The usual shorthand for hom-objects of an arbitrary category. infix 15 _[_,_] _[_,_] : ∀ {c} (C : Category c) (X Y : Category.Obj C) → ObjV _[_,_] = Category.hom -- A V-category C does not have morphisms of its own, but the -- collection of V-morphisms from the monoidal unit into the -- hom-objects of C forms a setoid. This induces the *underlying* -- category of C. Underlying : ∀ {c} (C : Category c) → Setoid-Category c ℓ e Underlying C = categoryHelper (record { Obj = Obj ; _⇒_ = λ A B → unit ⇒ hom A B ; _≈_ = λ f g → f ≈ g ; id = id ; _∘_ = λ f g → ⊚ ∘ f ⊗₁ g ∘ λ⇐ ; assoc = λ {_} {_} {_} {_} {f} {g} {h} → begin ⊚ ∘ (⊚ ∘ h ⊗₁ g ∘ λ⇐) ⊗₁ f ∘ λ⇐ ≈˘⟨ refl⟩∘⟨ assoc ⟩⊗⟨refl ⟩∘⟨refl ⟩ ⊚ ∘ ((⊚ ∘ h ⊗₁ g) ∘ λ⇐) ⊗₁ f ∘ λ⇐ ≈⟨ refl⟩∘⟨ pushˡ split₁ʳ ⟩ ⊚ ∘ (⊚ ∘ h ⊗₁ g) ⊗₁ f ∘ (λ⇐ ⊗₁ idV) ∘ λ⇐ ≈⟨ pullˡ ⊚-assoc-var ⟩ (⊚ ∘ h ⊗₁ (⊚ ∘ g ⊗₁ f) ∘ α⇒) ∘ (λ⇐ ⊗₁ idV) ∘ λ⇐ ≈˘⟨ pushˡ (pushʳ (pushʳ (switch-tofromˡ associator (to-≈ Kelly's.coherence-iso₁)))) ⟩ (⊚ ∘ h ⊗₁ (⊚ ∘ g ⊗₁ f) ∘ λ⇐) ∘ λ⇐ ≈⟨ pullʳ (pullʳ unitorˡ-commute-to) ⟩ ⊚ ∘ h ⊗₁ (⊚ ∘ g ⊗₁ f) ∘ idV ⊗₁ λ⇐ ∘ λ⇐ ≈˘⟨ refl⟩∘⟨ pushˡ split₂ʳ ⟩ ⊚ ∘ h ⊗₁ ((⊚ ∘ g ⊗₁ f) ∘ λ⇐) ∘ λ⇐ ≈⟨ refl⟩∘⟨ refl⟩⊗⟨ assoc ⟩∘⟨refl ⟩ ⊚ ∘ h ⊗₁ (⊚ ∘ g ⊗₁ f ∘ λ⇐) ∘ λ⇐ ∎ ; identityˡ = λ {_} {_} {f} → begin ⊚ ∘ id ⊗₁ f ∘ λ⇐ ≈⟨ refl⟩∘⟨ serialize₁₂ ⟩∘⟨refl ⟩ ⊚ ∘ (id ⊗₁ idV ∘ idV ⊗₁ f) ∘ λ⇐ ≈˘⟨ refl⟩∘⟨ pushʳ unitorˡ-commute-to ⟩ ⊚ ∘ id ⊗₁ idV ∘ λ⇐ ∘ f ≈⟨ pullˡ unitˡ ⟩ λ⇒ ∘ λ⇐ ∘ f ≈⟨ cancelˡ unitorˡ.isoʳ ⟩ f ∎ ; identityʳ = λ {_} {_} {f} → begin ⊚ ∘ f ⊗₁ id ∘ λ⇐ ≈⟨ refl⟩∘⟨ serialize₂₁ ⟩∘⟨refl ⟩ ⊚ ∘ (idV ⊗₁ id ∘ f ⊗₁ idV) ∘ λ⇐ ≈⟨ pullˡ (pullˡ unitʳ) ⟩ (unitorʳ.from ∘ f ⊗₁ idV) ∘ λ⇐ ≈⟨ unitorʳ-commute-from ⟩∘⟨refl ⟩ (f ∘ unitorʳ.from) ∘ λ⇐ ≈˘⟨ (refl⟩∘⟨ Kelly's.coherence₃) ⟩∘⟨refl ⟩ (f ∘ λ⇒) ∘ λ⇐ ≈⟨ cancelʳ unitorˡ.isoʳ ⟩ f ∎ ; equiv = equiv ; ∘-resp-≈ = λ eq₁ eq₂ → ∘-resp-≈ʳ $ ∘-resp-≈ˡ $ ⊗-resp-≈ eq₁ eq₂ }) where open Category C module Underlying {c} (C : Category c) = Setoid-Category (Underlying C)
Cubical/Categories/TypesOfCategories/TypeCategory.agda
Edlyr/cubical
0
7015
{-# OPTIONS --cubical --no-import-sorts --postfix-projections --safe #-} module Cubical.Categories.TypesOfCategories.TypeCategory where open import Cubical.Foundations.Prelude open import Cubical.Foundations.HLevels open import Cubical.Foundations.Equiv open import Cubical.Data.Sigma import Cubical.Functions.Fibration as Fibration open import Cubical.Categories.Category open import Cubical.Categories.Functor open import Cubical.Categories.Presheaf open import Cubical.Categories.Limits.Pullback open import Cubical.Categories.NaturalTransformation open import Cubical.Categories.Instances.Sets open Fibration.ForSets record isTypeCategory {ℓ ℓ' ℓ''} (C : Precategory ℓ ℓ') : Type (ℓ-max ℓ (ℓ-max ℓ' (ℓ-suc ℓ''))) where open Precategory C open Cospan open PullbackLegs open isPullback field -- a Type of types over a context Ty[_] : ob → Type ℓ'' -- extend a context with a type cext : ∀ (Γ : _) → (A : Ty[ Γ ]) → Σ[ ΓA ∈ ob ] (C [ ΓA , Γ ]) -- the new object from a context extension _⍮_ : (Γ : _) → (A : Ty[ Γ ]) → ob Γ ⍮ A = fst (cext Γ A) -- the projection from the extended context to the original π : (Γ : _) → (A : Ty[ Γ ]) → C [ Γ ⍮ A , Γ ] π Γ A = snd (cext Γ A) field -- pullback over context extentions reindex : ∀ {Γ' Γ} → C [ Γ' , Γ ] → (Ty[ Γ ] → Ty[ Γ' ]) q⟨_,_⟩ : ∀ {Γ' Γ} → (f : C [ Γ' , Γ ]) → (A : Ty[ Γ ]) → C [ Γ' ⍮ (reindex f A) , Γ ⍮ A ] isPB : ∀ {Γ' Γ : ob} (f : C [ Γ' , Γ ]) (A : Ty[ Γ ]) → isPullback {C = C} (cospan Γ' Γ (Γ ⍮ A) f (π Γ A)) (pblegs (π Γ' (reindex f A)) q⟨ f , A ⟩) -- presheaves are type contexts module _ {ℓ ℓ' ℓ'' : Level} (C : Precategory ℓ ℓ') where open isTypeCategory open Precategory open Functor open NatTrans open isPullback private -- types over Γ are types with a "projection" (aka surjection) to Γ PSTy[_] : PreShv C ℓ'' .ob → Type _ PSTy[ Γ ] = Σ[ ΓA ∈ PreShv C ℓ'' .ob ] Σ[ π ∈ ΓA ⇒ Γ ] (∀ (c : C .ob) → isSurjSET {A = ΓA ⟅ c ⟆} {Γ ⟅ c ⟆} (π ⟦ c ⟧)) -- just directly use types from above as context extensions PSCext : (Γ : _) → PSTy[ Γ ] → Σ[ ΓA ∈ PreShv C ℓ'' .ob ] ΓA ⇒ Γ PSCext Γ (ΓA , π , _) = ΓA , π -- the pullback or reindexed set is the disjoint union of the fibers -- from the projection module _ {Δ Γ : PreShv C ℓ'' .ob} (γ : Δ ⇒ Γ) (A'@(ΓA , π , isSurjπ) : PSTy[ Γ ]) where ΔA : PreShv C ℓ'' .ob ΔA .F-ob c = ΔATy , isSetΔA where ΔATy = (Σ[ x ∈ fst (Δ ⟅ c ⟆) ] fiber (π ⟦ c ⟧) ((γ ⟦ c ⟧) x)) isSetΔA : isSet ΔATy isSetΔA = isOfHLevelΣ 2 (snd (Δ ⟅ c ⟆)) λ Γc → isOfHLevelΣ 2 (snd (ΓA ⟅ c ⟆)) λ ΓAc → isProp→isSet (snd (Γ ⟅ c ⟆) _ _) -- for morphisms, we apply Δ ⟪ f ⟫ to the first component -- and ΓA ⟪ f ⟫ to the second -- the fiber rule ΔA .F-hom {c} {d} f (δax , γax , eq) = ((Δ ⟪ f ⟫) δax) , (((ΓA ⟪ f ⟫) γax) , ((π ⟦ d ⟧) ((ΓA ⟪ f ⟫) γax) ≡[ i ]⟨ π .N-hom f i γax ⟩ (Γ ⟪ f ⟫) ((π ⟦ c ⟧) γax) ≡[ i ]⟨ (Γ ⟪ f ⟫) (eq i) ⟩ (Γ ⟪ f ⟫) ((γ ⟦ c ⟧) δax) ≡[ i ]⟨ γ .N-hom f (~ i) δax ⟩ (γ ⟦ d ⟧) ((Δ ⟪ f ⟫) δax) ∎)) ΔA .F-id {x = c} = funExt λ (δax , γax , eq) → ΣPathP ((λ i → Δ .F-id i δax) , fibersEqIfRepsEq {isSetB = snd (Γ ⟅ c ⟆)} _ (λ i → ΓA .F-id i γax)) ΔA .F-seq {a} {b} {c} f g = funExt λ (δax , γax , eq) → ΣPathP ((λ i → Δ .F-seq f g i δax) , fibersEqIfRepsEq {isSetB = snd (Γ ⟅ c ⟆)} _ λ i → ΓA .F-seq f g i γax) π' : ΔA ⇒ Δ π' .N-ob c (x , snd) = x π' .N-hom f = refl PSReindex : PSTy[ Δ ] PSReindex = ΔA , (π' , isSurj) where isSurj : ∀ (c : C .ob) → isSurjSET {A = ΔA ⟅ c ⟆} {B = Δ ⟅ c ⟆} (π' ⟦ c ⟧) isSurj c δx = (δx , isSurjπ c ((γ ⟦ c ⟧) δx)) , refl PSq : ΔA ⇒ ΓA PSq .N-ob c (δax , γax , eq) = γax PSq .N-hom {c} {d} f = funExt λ (δax , γax , eq) → refl PSIsPB : isPullback {C = PreShv C ℓ''} (cospan Δ Γ (fst (PSCext Γ A')) γ (snd (PSCext Γ A'))) (pblegs (snd (PSCext Δ PSReindex)) (PSq)) PSIsPB .sq = makeNatTransPath (funExt sqExt) where sqExt : ∀ (c : C .ob) → _ sqExt c = funExt λ (δax , γax , eq) → sym eq PSIsPB .up {Θ} (cone (pblegs p₁ p₂) sq) = ((α , eq) , unique) where α : Θ ⇒ ΔA α .N-ob c t = ((p₁ ⟦ c ⟧) t) , (((p₂ ⟦ c ⟧) t) , (λ i → (sq (~ i) ⟦ c ⟧) t)) α .N-hom {d} {c} f = funExt αHomExt where αHomExt : ∀ (t : fst (Θ ⟅ d ⟆)) → ((p₁ ⟦ c ⟧) ((Θ ⟪ f ⟫) t) , (p₂ ⟦ c ⟧) ((Θ ⟪ f ⟫) t), _) ≡ ((Δ ⟪ f ⟫) ((p₁ ⟦ d ⟧) t) , (ΓA ⟪ f ⟫) ((p₂ ⟦ d ⟧) t) , _) αHomExt t = ΣPathP ((λ i → p₁ .N-hom f i t) , fibersEqIfRepsEq {isSetB = snd (Γ ⟅ c ⟆)} _ (λ i → p₂ .N-hom f i t)) eq : _ eq = makeNatTransPath (funExt (λ _ → funExt λ _ → refl)) , makeNatTransPath (funExt (λ _ → funExt λ _ → refl)) unique : ∀ (βeq : Σ[ β ∈ Θ ⇒ ΔA ] _) → (α , eq) ≡ βeq unique (β , eqβ) = ΣPathP (α≡β , eq≡eqβ) where α≡β : α ≡ β α≡β = makeNatTransPath (funExt λ c → funExt λ t → eqExt c t) where eqβ1 = eqβ .fst eqβ2 = eqβ .snd eqExt : ∀ (c : C .ob) → (t : fst (Θ ⟅ c ⟆)) → (α ⟦ c ⟧) t ≡ (β ⟦ c ⟧) t eqExt c t = ΣPathP ((λ i → (eqβ1 i ⟦ c ⟧) t) , fibersEqIfRepsEq {isSetB = snd (Γ ⟅ c ⟆)} _ (λ i → (eqβ2 i ⟦ c ⟧) t)) eq≡eqβ : PathP (λ i → (p₁ ≡ (α≡β i) ●ᵛ π') × (p₂ ≡ (α≡β i) ●ᵛ PSq)) eq eqβ eq≡eqβ = ΣPathP ( isPropNatP1 (eq .fst) (eqβ .fst) α≡β , isPropNatP2 (eq .snd) (eqβ .snd) α≡β) where isPropNatP1 : isOfHLevelDep 1 (λ γ → p₁ ≡ γ ●ᵛ π') isPropNatP1 = isOfHLevel→isOfHLevelDep 1 (λ _ → isSetNat _ _) isPropNatP2 : isOfHLevelDep 1 (λ γ → p₂ ≡ γ ●ᵛ PSq) isPropNatP2 = isOfHLevel→isOfHLevelDep 1 (λ _ → isSetNat _ _) -- putting everything together isTypeCategoryPresheaf : isTypeCategory (PreShv C ℓ'') isTypeCategoryPresheaf .Ty[_] Γ = PSTy[ Γ ] isTypeCategoryPresheaf .cext = PSCext isTypeCategoryPresheaf .reindex = PSReindex isTypeCategoryPresheaf .q⟨_,_⟩ = PSq isTypeCategoryPresheaf .isPB = PSIsPB
libsrc/_DEVELOPMENT/l/z80/longlong/l_inc_64_dehldehl.asm
jpoikela/z88dk
640
94281
<reponame>jpoikela/z88dk SECTION code_clib SECTION code_l PUBLIC l_inc_64_dehldehl, l0_inc_64_dehldehl l_inc_64_dehldehl: ; increment 64-bit value ; ; enter : dehl'dehl = 32 bit number ; ; exit : dehl'dehl += 1 ; ; uses : f, de, hl, de', hl' inc l ret nz l0_inc_64_dehldehl: inc h ret nz inc e ret nz inc d ret nz exx inc l jr nz, exx_ret inc h jr nz, exx_ret inc e ; need z flag set correctly so no 'inc de' jr nz, exx_ret inc d exx_ret: exx ret
source/macros.adb
jquorning/CELLE
0
19015
<filename>source/macros.adb -- -- The author disclaims copyright to this source code. In place of -- a legal notice, here is a blessing: -- -- May you do good and not evil. -- May you find forgiveness for yourself and forgive others. -- May you share freely, not taking more than you give. -- with Ada.Containers.Vectors; with Ada.Strings.Unbounded; with Ada.Characters.Latin_1; with Ada.Text_IO; package body Macros is function Is_Space (C : in Character) return Boolean; -- True when C is a white space use Ada.Strings.Unbounded; package Macro_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Unbounded_String); Macro_List : Macro_Vectors.Vector := Macro_Vectors.Empty_Vector; procedure Append (Name : in String) is begin Macro_List.Append (To_Unbounded_String (Name)); end Append; procedure Preprocess (Buffer : in out String; Success : out Boolean) is use Ada.Characters; -- Preproc_Ifdef : constant String := "%ifdef"; -- Preproc_Ifndef : constant String := "%ifndef"; -- Preproc_Endif : constant String := "%endif"; I, J, N : Integer; Exclude : Integer := 0; Start : Integer := 0; Lineno : Integer := 1; Start_Lineno : Integer := 1; begin Success := False; I := Buffer'First; while Buffer (I) /= Latin_1.NUL loop if Buffer (I) = Latin_1.LF then Lineno := Lineno + 1; end if; if Buffer (I) /= '%' or (I > Buffer'First and then Buffer (I - 1) /= Latin_1.LF) then goto Continue; end if; if Buffer (I .. I + 5) = "%endif" and Is_Space (Buffer (I + 6)) then if Exclude /= 0 then Exclude := Exclude - 1; if Exclude = 0 then for M in Start .. I - 1 loop if Buffer (M) /= Latin_1.LF then Buffer (M) := ' '; end if; end loop; end if; end if; J := I; while Buffer (J) /= Latin_1.NUL and Buffer (J) /= Latin_1.LF loop Buffer (J) := ' '; J := J + 1; end loop; elsif (Buffer (I .. I + 5) = "%ifdef" and Is_Space (Buffer (I + 6))) or (Buffer (I .. I + 6) = "%ifndef" and Is_Space (Buffer (I + 7))) then if Exclude = 0 then J := I + 7; while Is_Space (Buffer (J)) loop J := J + 1; end loop; -- Find lenght of macro name N := 0; while Buffer (J + N) /= Latin_1.NUL and not Is_Space (Buffer (J + N)) loop N := N + 1; end loop; -- Find macro name in list of appended macro names Exclude := 1; for Macro of Macro_List loop if Buffer (J .. J + N) = Macro then Exclude := 0; exit; end if; end loop; if Buffer (I + 3) = 'n' then if Exclude = 0 then Exclude := 1; else Exclude := 0; end if; end if; if Exclude /= 0 then Start := I; Start_Lineno := Lineno; end if; else Exclude := Exclude + 1; end if; J := I; while Buffer (J) /= Latin_1.NUL and Buffer (J) /= Latin_1.LF loop Buffer (J) := ' '; J := J + 1; end loop; end if; <<Continue>> I := I + 1; end loop; if Exclude /= 0 then Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error, "unterminated %%ifdef starting on line " & Integer'Image (Start_Lineno)); Success := False; return; end if; Success := True; end Preprocess; function Is_Space (C : in Character) return Boolean is begin return C = Ada.Characters.Latin_1.Space or C = Ada.Characters.Latin_1.HT or C = Ada.Characters.Latin_1.LF; end Is_Space; end Macros;
HW3/fibonacci.asm
CodyKelly-UCD/CSCI-2525
0
160838
TITLE fibonacci.asm COMMENT ! Completes the following: a. fib(n) for n = 2, 3, ..., 10 using an array of the appropriate size and type. Declares a value for fib(0) and fib(1), but all remaining elements are calculated by the program. b. After the array is filled with required values, the program stores fib(3) through fib(6) in consecutive bytes of the ebx register starting from the lowest byte ! INCLUDE Irvine32.inc .data clearECX TEXTEQU <mov ecx, 0> clearEAX TEXTEQU <mov eax, 0> fibArray BYTE 10 DUP(0) sizeFibArray = ($ - fibArray) .data? .code main PROC clearECX clearEAX mov [fibArray + 1], 1 ; Set the second element equal to fib(1) mov ecx, sizeFibArray - 2 ; Set the loop counter to length of fibArray minus ; two because we know the values of the first two elements mov esi, OFFSET fibArray fibLoop: mov al, [esi] ; al = fib(n - 2) inc esi mov ah, [esi] ; ah = fib(n - 1) inc esi mov [esi], al add [esi], ah ; fibArray(n) = fib(n-2) + fib(n-1) dec esi loop fibLoop mov ebx, DWORD PTR fibArray + 3 ; set ebx equal to fib(3) through fib(6) call DumpRegs exit main ENDP END main
ch10/RowSum.asm
William0Friend/my_masm
0
98633
TITLE Row Sum Calculation (RowSumMacro.asm) Comment ! Tests the mCalc_row_sum macro. ! INCLUDE Irvine32.inc ;------------------------------------------------------------ mCalc_row_sum MACRO index, arrayOffset, rowSize, eltType ; Calculates the sum of a row in a two-dimensional array. ; ; Receives: row index, offset of the array, number of bytes ; in each table row, and the array type (BYTE, WORD, or DWORD). ; Returns: EAX = sum. ;------------------------------------------------------------- LOCAL L1 push ebx ; save changed regs push ecx push esi ; set up the required registers mov eax,index mov ebx,arrayOffset mov ecx,rowSize ; calculate the row offset. mul ecx ; row index * row size add ebx,eax ; row offset ; prepare the loop counter. shr ecx,(TYPE eltType / 2) ; byte=0, word=1, dword=2 ; initialize the accumulator and column indexes mov eax,0 ; accumulator mov esi,0 ; column index L1: IFIDNI <eltType>, <DWORD> mov edx,eltType PTR[ebx + esi*(TYPE eltType)] ELSE movzx edx,eltType PTR[ebx + esi*(TYPE eltType)] ENDIF add eax,edx ; add to accumulator inc esi loop L1 pop esi ; restore changed regs pop ecx pop ebx ENDM .data tableB BYTE 10h, 20h, 30h, 40h, 50h RowSizeB = ($ - tableB) DWORD 60h, 70h, 80h, 90h, 0A0h DWORD 0B0h, 0C0h, 0D0h, 0E0h, 0F0h tableW WORD 10h, 20h, 30h, 40h, 50h RowSizeW = ($ - tableW) DWORD 60h, 70h, 80h, 90h, 0A0h DWORD 0B0h, 0C0h, 0D0h, 0E0h, 0F0h tableD DWORD 10h, 20h, 30h, 40h, 50h RowSizeD = ($ - tableD) DWORD 60h, 70h, 80h, 90h, 0A0h DWORD 0B0h, 0C0h, 0D0h, 0E0h, 0F0h index DWORD ? .code main PROC ; Demonstrate Base-Index mode: mCalc_row_sum index, OFFSET tableB, RowSizeB, BYTE call WriteHex call Crlf mCalc_row_sum index, OFFSET tableW, RowSizeW, WORD call WriteHex call Crlf mCalc_row_sum index, OFFSET tableD, RowSizeD, DWORD call WriteHex call Crlf exit main ENDP END main
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c34009a.ada
best08618/asylo
7
28862
<reponame>best08618/asylo -- C34009A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT THE REQUIRED PREDEFINED OPERATIONS ARE DECLARED -- (IMPLICITLY) FOR DERIVED NON-LIMITED PRIVATE TYPES WITHOUT -- DISCRIMINANTS. -- HISTORY: -- JRK 08/28/87 CREATED ORIGINAL TEST. -- BCB 09/26/88 REMOVED COMPARISON INVOLVING OBJECT SIZE. -- PWN 11/30/94 REMOVED 'BASE USE ILLEGAL IN ADA 9X. -- PWN 01/31/95 REMOVED INCONSISTENCIES WITH ADA 9X. WITH SYSTEM; USE SYSTEM; WITH REPORT; USE REPORT; PROCEDURE C34009A IS PACKAGE PKG IS TYPE PARENT IS PRIVATE; FUNCTION CREATE (X : INTEGER) RETURN PARENT; FUNCTION CON (X : INTEGER) RETURN PARENT; PRIVATE TYPE PARENT IS NEW INTEGER; END PKG; USE PKG; TYPE T IS NEW PARENT; X : T; K : INTEGER := X'SIZE; W : PARENT; B : BOOLEAN := FALSE; PROCEDURE A (X : ADDRESS) IS BEGIN B := IDENT_BOOL (TRUE); END A; PACKAGE BODY PKG IS FUNCTION CREATE (X : INTEGER) RETURN PARENT IS BEGIN RETURN PARENT (IDENT_INT (X)); END CREATE; FUNCTION CON (X : INTEGER) RETURN PARENT IS BEGIN RETURN PARENT (X); END CON; END PKG; BEGIN TEST ("C34009A", "CHECK THAT THE REQUIRED PREDEFINED OPERATIONS " & "ARE DECLARED (IMPLICITLY) FOR DERIVED " & "NON-LIMITED PRIVATE TYPES WITHOUT " & "DISCRIMINANTS"); X := CREATE (30); IF X /= CON (30) THEN FAILED ("INCORRECT :="); END IF; IF T'(X) /= CON (30) THEN FAILED ("INCORRECT QUALIFICATION"); END IF; IF T (X) /= CON (30) THEN FAILED ("INCORRECT SELF CONVERSION"); END IF; W := CREATE (-30); IF T (W) /= CON (-30) THEN FAILED ("INCORRECT CONVERSION FROM PARENT"); END IF; IF PARENT (X) /= CON (30) THEN FAILED ("INCORRECT CONVERSION TO PARENT"); END IF; IF X = CON (0) THEN FAILED ("INCORRECT ="); END IF; IF X /= CON (30) THEN FAILED ("INCORRECT /="); END IF; IF NOT (X IN T) THEN FAILED ("INCORRECT ""IN"""); END IF; IF X NOT IN T THEN FAILED ("INCORRECT ""NOT IN"""); END IF; B := FALSE; A (X'ADDRESS); IF NOT B THEN FAILED ("INCORRECT 'ADDRESS"); END IF; RESULT; END C34009A;
programs/oeis/213/A213480.asm
neoneye/loda
22
170177
<filename>programs/oeis/213/A213480.asm<gh_stars>10-100 ; A213480: Number of (w,x,y) with all terms in {0,...,n} and |w-x|+|x-y| != w+x+y. ; 0,4,16,46,95,175,285,439,634,886,1190,1564,2001,2521,3115,3805,4580,5464,6444,7546,8755,10099,11561,13171,14910,16810,18850,21064,23429,25981,28695,31609,34696,37996,41480,45190,49095,53239,57589 mov $1,7 mul $1,$0 mov $3,7 mov $4,4 mov $6,$1 add $6,1 div $6,2 mov $7,$0 lpb $0 sub $0,1 trn $6,$3 add $4,$6 lpe mov $1,$4 sub $1,4 mov $2,$7 mul $2,2 add $1,$2 mov $5,$7 mul $5,$7 add $1,$5 mul $5,$7 add $1,$5 mov $0,$1
dino/lcs/enemy/3.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
240050
copyright zengfr site:http://github.com/zengfr/romhack 0359A4 move.b #$e, ($3,A6) 0359AA move.w #$38, ($84,A6) [enemy+ 3, enemy+3] 03DE20 move.b #$13, ($3,A6) 03DE26 move.w #$4c, ($84,A6) [enemy+ 3, enemy+3] 03DE38 move.b #$12, ($3,A6) 03DE3E move.w #$48, ($84,A6) [enemy+ 3, enemy+3] 045800 move.b #$9, ($3,A6) 045806 move.w #$24, ($84,A6) [enemy+ 3, enemy+3] 0512B2 move.b #$17, ($3,A6) 0512B8 move.w #$5c, ($84,A6) [enemy+ 3, enemy+3] 053436 move.b #$11, ($3,A6) [enemy+ 1] 05343C move.w #$44, ($84,A6) [enemy+ 3, enemy+3] copyright zengfr site:http://github.com/zengfr/romhack
projects/07/MemoryAccess/PointerTest/PointerTest.asm
skatsuta/nand2tetris
1
12104
// ../MemoryAccess/PointerTest/PointerTest.vm @3030 D=A @SP A=M M=D @SP AM=M+1 @0 D=A @R3 AD=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @3040 D=A @SP A=M M=D @SP AM=M+1 @1 D=A @R3 AD=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @32 D=A @SP A=M M=D @SP AM=M+1 @2 D=A @THIS AD=D+M @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @46 D=A @SP A=M M=D @SP AM=M+1 @6 D=A @THAT AD=D+M @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @0 D=A @R3 AD=D+A D=M @SP A=M M=D @SP AM=M+1 @1 D=A @R3 AD=D+A D=M @SP A=M M=D @SP AM=M+1 @SP AM=M-1 D=M @SP AM=M-1 M=D+M @SP AM=M+1 @2 D=A @THIS AD=D+M D=M @SP A=M M=D @SP AM=M+1 @SP AM=M-1 D=M @SP AM=M-1 M=M-D @SP AM=M+1 @6 D=A @THAT AD=D+M D=M @SP A=M M=D @SP AM=M+1 @SP AM=M-1 D=M @SP AM=M-1 M=D+M @SP AM=M+1 (END) @END 0;JMP
aula_14/semaforo/semaforo.asm
Descomplica-ADS/ACS-XXI
9
5844
Start: MOV AL, 84; OUT 01; MOV CL, 3 L1: DEC CL JNZ L1 MOV AL, 88; OUT 01; MOV AL, 30; OUT 01; MOV CL, 3 L2: DEC CL JNZ L2 MOV AL, 50; OUT 01; JMP Start END
programs/oeis/261/A261424.asm
neoneye/loda
22
245508
<reponame>neoneye/loda ; A261424: Difference between n and the largest palindrome <= n. ; 0,0,0,0,0,0,0,0,0,0,1,0,1,2,3,4,5,6,7,8,9,10,0,1,2,3,4,5,6,7,8,9,10,0,1,2,3,4,5,6,7,8,9,10,0,1,2,3,4,5,6,7,8,9,10,0,1,2,3,4,5,6,7,8,9,10,0,1,2,3,4,5,6,7,8,9,10,0,1,2,3,4,5,6,7,8,9,10,0,1,2,3,4,5,6,7,8,9,10,0 mov $1,$0 seq $1,261423 ; Largest palindrome <= n. sub $0,$1
data/moves/always_hit.asm
AtmaBuster/pokeplat-gen2
6
240064
AlwaysHitEffects: db EFFECT_ALWAYS_HIT db EFFECT_VITAL_THROW db EFFECT_TRUMP_CARD db -1
euler2.adb
kimtg/euler-ada
7
28577
<filename>euler2.adb with ada.text_io; use ada.text_io; procedure euler2 is a, b : integer := 1; s : integer := 0; begin loop declare c : integer := a + b; begin exit when c > 4000000; if c mod 2 = 0 then s := s + c; end if; a := b; b := c; end; end loop; put_line(integer'image(s)); end euler2;
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/package_with_body.adb
sourceryinstitute/rose-sourcery-institute
1
5859
<filename>tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/package_with_body.adb package body Package_With_Body is procedure Procedure_To_Require_Body is begin null; end Procedure_To_Require_Body; end Package_With_Body;
drivers/mspgd-drivers.ads
ekoeppen/MSP430_Generic_Ada_Drivers
0
17820
package MSPGD.Drivers is pragma Pure; end MSPGD.Drivers;
Firmware/Libraries/STM8_SelfTest_Library/src/stm8_stl_fullRam_IAR.asm
SergeiSOficial/AESTOUS_STM8
0
27171
<reponame>SergeiSOficial/AESTOUS_STM8<filename>Firmware/Libraries/STM8_SelfTest_Library/src/stm8_stl_fullRam_IAR.asm<gh_stars>0 ;******************* (C) COPYRIGHT 2017 STMicroelectronics ******************** ; File Name : stm8_stl_fullRam_IAR.s ; Description : This file contains the RAM functional test to be done at ; start-up. This test is destructive and will initialize ; the whole RAM to zero. ; Author : STMicroelectronics - MCD Application Team ; Version : V2.0.0 ; Date : Dec-2017 ;***************************************************************************** ; Redistribution and use in source and binary forms, with or without modification, ; are permitted provided that the following conditions are met: ; 1. Redistributions of source code must retain the above copyright notice, ; this list of conditions and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; 3. Neither the name of STMicroelectronics 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 HOLDER 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. ;***************************************************************************** ; name RamMarchCcode public STL_FullRamMarchC extern CtrlFlowCntInv ; !!! CONSTANT FROM ICF FILE TO DEFINE END OF THE RAM REGION !!! extern __ICFEDIT_region_RAM_end__ section .text:code ; ;****************************************************************************** ;* Function Name : STL_FullRamMarchC ;* Description : This function verifies that RAM is functional, ;* using the March C- algorithm. ;* Input : None ;* Output : The whole RAM is initialized with 0 when exiting this fct, ;* at the exception of CtrlFlowCntInv, set to 0xFFFFFFFF. ;* Return : {ERROR=0; FULL_RAM_SUCCESS=1} ;****************************************************************************** STL_FullRamMarchC: POPW Y ; Trick: save stacked return adress into Y ; ; Step 1: Write background with addresses increasing CLRW X ; p = RAM_START step1: ; do { CLR (X) ; *p = BCKGRND INCW X ; } while (++p <= RAM_END) CPW X,#__ICFEDIT_region_RAM_end__ JRULE step1 ; ; Step 2: Verify background and write inv background with addresses increasing CLRW X ; p = RAM_START step2: ; do { LD A,(X) ; if (*p != BCKGRND) JRNE Error ; test fail termination LD A,#255 ; *p = INV_BCKGRND LD (X),A INCW X ; } while (++p <= RAM_END) CPW X,#__ICFEDIT_region_RAM_end__ JRULE step2 ; ; Step 3: Verify inv background and write background with addresses increasing CLRW X ; p = RAM_START step3: ; do { LD A,(X) ; if (*p != INV_BCKGRND) CP A,#255 JRNE Error ; test fail termination CLR (X) ; *p = BCKGRND INCW X ; } while (++p <= RAM_END) CPW X,#__ICFEDIT_region_RAM_end__ JRULE step3 ; ; Step 4: Verify background and write inv background with addresses decreasing LDW X,#__ICFEDIT_region_RAM_end__; p = RAM_END step4: ; do { LD A,(X) ; if (*p != BCKGRND) JRNE Error ; Early test termination LD A,#255 LD (X),A ; *p = INV_BCKGRND DECW X JRPL step4 ; } while (++p >= RAM_START) ; ; Step 5: Verify inv background and write background with addresses decreasing LDW X,#__ICFEDIT_region_RAM_end__ ; p = RAM_END step5: ; do { LD A,(X) ; if (*p != INV_BCKGRND) CP A,#255 JRNE Error ; Early test termination CLR (X) ; *p = BCKGRND DECW X JRPL step5 ; } while (++p >= RAM_START) ; ; Step 6: Verify background with addresses increasing CLRW X ; p = RAM_START step6: ; do { LD A,(X) ; if (*p != BCKGRND) JRNE Error ; Early test termination INCW X ; } while (++p <= RAM_END) CPW X,#__ICFEDIT_region_RAM_end__ JRULE step6 ; LD A,#1 ; RAM is OK! JP Exit Error: CLR A ; error at test found in RAM Exit: LDW X,#0ffffH ; reinit control flow variables LDW CtrlFlowCntInv,X ; (non inversed variable keeps 0!) ; PUSHW Y ; Trick: restore stacked return adress from Y CLRW X ; copy result in A to X TNZ A JREQ Exitrt INCW X Exitrt: RET ; END ; ;******************* (C) COPYRIGHT STMicroelectronics *****END OF FILE****
data/pokemon/base_stats/elekid.asm
AtmaBuster/pokeplat-gen2
6
83973
db 0 ; species ID placeholder db 45, 63, 37, 95, 65, 55 ; hp atk def spd sat sdf db ELECTRIC, ELECTRIC ; type db 45 ; catch rate db 106 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F25 ; gender ratio db 25 ; step cycles to hatch INCBIN "gfx/pokemon/elekid/front.dimensions" db GROWTH_MEDIUM_FAST ; growth rate dn EGG_NONE, EGG_NONE ; egg groups db 70 ; happiness ; tm/hm learnset tmhm FOCUS_PUNCH, TOXIC, HIDDEN_POWER, LIGHT_SCREEN, PROTECT, RAIN_DANCE, FRUSTRATION, THUNDERBOLT, THUNDER, RETURN, PSYCHIC_M, BRICK_BREAK, DOUBLE_TEAM, SHOCK_WAVE, FACADE, SECRET_POWER, REST, ATTRACT, THIEF, FLING, CHARGE_BEAM, ENDURE, FLASH, THUNDER_WAVE, CAPTIVATE, SLEEP_TALK, NATURAL_GIFT, SWAGGER, SUBSTITUTE, ROCK_SMASH, FIRE_PUNCH, HELPING_HAND, ICE_PUNCH, MAGNET_RISE, MUD_SLAP, SIGNAL_BEAM, SNORE, SWIFT, THUNDERPUNCH, UPROAR ; end
Assembly Works 2/TASK_1_Lab_2.asm
AhmadVakil/Assembly-C_Micro-Controller
0
10794
<gh_stars>0 ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ; 1DT301, Computer Technology I ; Date: 2016-09-29 ; Author: ; <NAME> ; ; ; Lab number: 2 ; Title: How to use the PORTs. Digital input/output. Subroutine call. ; ; Hardware: STK600, CPU ATmega2560 ; ; Function: Switch between ring counter and johnson counter with SW0. ; ; Input ports: When SW0 is pressed the subroutines will be changed(SW0==PORTA) ; ; Output ports: PORTB ; ; Subroutines: If applicable. ; Included files: m2560def.inc ; ; Other information: ; ; Changes in program: (Description and date) ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< .include "m2560def.inc" ; Initialize SP, Stack Pointer ldi r20, HIGH(RAMEND) ; R20 = high part of RAMEND address out SPH,R20 ; SPH = high part of RAMEND address ldi R20, low(RAMEND) ; R20 = low part of RAMEND address out SPL,R20 ; SPL = low part of RAMEND address ldi r16,0b11111111 ; ALL pins will be available to use as output out DDRB, r16 ldi r21,0b00000000; A is input out DDRA, r21 johnson_loop: in r21,PINA ; Get the value from PINA and register it on r21 cpi r21,0b11111110 ; if Switch one pressed go to Ring_Counter breq ring_counter out PORTB, r16 ; Show the value of r16 on PORTB call delay ; Call the delay subroutine com r16 ; Reverse r16 lsl r16 ; Shift r16 to left inc r16 ; increase r16 com r16 ; Reverse r16 again cpi r16,0x00 ; compare if all LEDs are ON brne johnson_loop ; If all LEDs are on then go back to johnson_loop cpi r16,0x00 ; compare r16 with 0 breq off_all_leds ; If all ON then ==> off_all_leds one by one and go backward off_all_leds: ldi r16,0b00000000 out PORTB,r16 ; Going backward in johnson counter backward_loop: in r21,PINA cpi r21,0b11111110 breq ring_counter out PORTB, r16 call delay com r16 dec r16 lsr r16 com r16 cpi r16,0xFF breq johnson_loop cpi r16,0x00 brne backward_loop ; Delay subroutine delay: push r18 push r19 push r20 ldi r18, 3 ldi r19, 138 ldi r20, 86 L1: dec r20 brne L1 dec r19 brne L1 dec r18 brne L1 rjmp PC+1 pop r20 pop r19 pop r18 ret ring_counter: ring_loop: in r22,PINA cpi r22,0b11111110 breq change_to_johnson out PORTB, r16 call delay lsl r16 inc r16 cpi r16,0xFF brne ring_loop end: ldi r16,0b11111110 rjmp ring_loop rjmp ring_counter change_to_johnson: ldi r16,0b11111111 rjmp johnson_loop change_to_ring: ldi r16,0b11111110; A is input rjmp ring_counter
source/tabula-users.adb
ytomino/vampire
1
5484
-- The Village of Vampire by YT, このソースコードはNYSLです with Crypto.MD5; package body Tabula.Users is pragma Compile_Time_Error ( Password_Digest'Length /= Crypto.MD5.Fingerprint'Length, "length of MD5 /= 16"); pragma Compile_Time_Error ( Password_Digest_Image'Length /= Crypto.MD5.Message_Digest'Length, "image length of MD5 /= 32"); function Valid_Id_String (Id : String) return Boolean is begin if Id'Length = 0 then return False; end if; for I in Id'Range loop case Id (I) is when 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '-' => null; when others => return False; end case; end loop; return True; end Valid_Id_String; function Digest (Password : String) return Password_Digest is begin return Result : Password_Digest do declare MD5 : Crypto.MD5.Context := Crypto.MD5.Initial; begin Crypto.MD5.Update (MD5, Password); Crypto.MD5.Final (MD5, Crypto.MD5.Fingerprint (Result)); end; end return; end Digest; function Image (Digest : Password_Digest) return Password_Digest_Image is begin return Crypto.MD5.Image (Crypto.MD5.Fingerprint (Digest)); end Image; function Value (Image : Password_Digest_Image) return Password_Digest is begin return Password_Digest (Crypto.MD5.Value (Image)); end Value; end Tabula.Users;
oeis/026/A026033.asm
neoneye/loda-programs
11
20334
; A026033: C(4n,n) - C(4n,n-4). ; Submitted by <NAME> ; 1,4,28,220,1819,15484,134320,1180764,10482340,93766288,843822148,7631018564,69291185474,631334484200,5769124912320,52851389067420,485242722376524,4463782855666480,41133265444555120 mov $2,4 mul $2,$0 mov $1,$2 bin $1,$0 sub $0,4 bin $2,$0 sub $1,$2 mov $0,$1
src/firmware/Platform/Lcd/Initialise.asm
pete-restall/Cluck2Sesame-Prototype
1
16233
#define __CLUCK2SESAME_PLATFORM_LCD_INITIALISE_ASM #include "Platform.inc" #include "TailCalls.inc" #include "InitialisationChain.inc" #include "Lcd.inc" #include "States.inc" radix decimal extern INITIALISE_AFTER_LCD Lcd code global initialiseLcd initialiseLcd: .safelySetBankFor enableLcdCount clrf enableLcdCount movlw DEFAULT_LCD_CONTRAST movwf lcdContrast clrf lcdFlags .setBankFor LCD_CONTRAST_ANSEL bcf LCD_CONTRAST_ANSEL, LCD_CONTRAST_PIN_ANSEL .setBankFor LCD_CONTRAST_TRIS bcf LCD_CONTRAST_TRIS, LCD_CONTRAST_PIN_TRIS .setBankFor LCD_CONTRAST_PORT bcf LCD_CONTRAST_PORT, LCD_CONTRAST_PIN setLcdState LCD_STATE_DISABLED tcall INITIALISE_AFTER_LCD end
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca_notsx.log_21829_227.asm
ljhsiun2/medusa
9
241787
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %rbp push %rcx push %rdi push %rsi lea addresses_WC_ht+0xfc10, %r12 nop nop nop nop sub $53296, %rbp mov $0x6162636465666768, %rcx movq %rcx, %xmm6 vmovups %ymm6, (%r12) nop nop and %r12, %r12 lea addresses_normal_ht+0x1ebf0, %rsi lea addresses_WC_ht+0x1acf0, %rdi nop nop nop sub $32987, %r13 mov $21, %rcx rep movsl sub %r12, %r12 lea addresses_D_ht+0x122d0, %r13 nop nop nop inc %rsi mov (%r13), %cx nop nop nop add %r12, %r12 lea addresses_normal_ht+0x14ad0, %rsi nop and %rcx, %rcx mov (%rsi), %edi nop nop nop nop nop and $26199, %rsi lea addresses_WT_ht+0x1b698, %r12 nop nop nop nop nop and $16826, %r14 mov (%r12), %cx nop nop cmp $55956, %r13 lea addresses_A_ht+0x1ba4e, %rdi nop nop nop nop xor %r14, %r14 movb $0x61, (%rdi) nop nop cmp $39127, %rcx lea addresses_D_ht+0x498a, %r13 nop nop nop nop add %r14, %r14 movb $0x61, (%r13) add %r14, %r14 pop %rsi pop %rdi pop %rcx pop %rbp pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r8 push %rax push %rcx push %rdi push %rsi // Store lea addresses_RW+0x13bd0, %rsi nop nop nop xor %r12, %r12 movw $0x5152, (%rsi) nop add %rdi, %rdi // Store lea addresses_RW+0x7fd0, %rsi nop nop nop nop xor %rcx, %rcx mov $0x5152535455565758, %r13 movq %r13, %xmm5 vmovups %ymm5, (%rsi) nop nop nop nop xor %rsi, %rsi // Store lea addresses_US+0xded0, %r8 nop nop nop nop cmp $53390, %rax mov $0x5152535455565758, %rdi movq %rdi, %xmm2 movaps %xmm2, (%r8) nop nop nop nop sub $37129, %rdi // Store lea addresses_WC+0x1c370, %rdi nop nop sub %r8, %r8 mov $0x5152535455565758, %r12 movq %r12, %xmm7 vmovups %ymm7, (%rdi) nop nop nop nop nop cmp %rdi, %rdi // Store lea addresses_normal+0xcdd0, %r8 sub $7701, %rax movl $0x51525354, (%r8) nop nop sub $16962, %r8 // Store mov $0x905900000000dd0, %r8 nop nop xor %rdi, %rdi mov $0x5152535455565758, %rsi movq %rsi, %xmm0 vmovups %ymm0, (%r8) nop nop xor $35203, %rcx // Store lea addresses_RW+0xdad0, %r13 nop nop xor %rdi, %rdi mov $0x5152535455565758, %r8 movq %r8, %xmm3 vmovntdq %ymm3, (%r13) nop nop nop nop dec %r12 // Store lea addresses_RW+0xdad0, %r8 nop xor $45073, %rdi mov $0x5152535455565758, %rcx movq %rcx, (%r8) nop cmp $61876, %rdi // Faulty Load lea addresses_RW+0xdad0, %rsi clflush (%rsi) nop nop nop sub %r12, %r12 mov (%rsi), %ecx lea oracles, %rdi and $0xff, %rcx shlq $12, %rcx mov (%rdi,%rcx,1), %rcx pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_US'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'} {'dst': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
data/pokemon/base_stats/hippopotas.asm
TastySnax12/pokecrystal16-493-plus
2
14156
<filename>data/pokemon/base_stats/hippopotas.asm db 0 ; species ID placeholder db 68, 72, 78, 32, 38, 42 ; hp atk def spd sat sdf db GROUND, GROUND ; type db 140 ; catch rate db 66 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F50 ; gender ratio db 100 ; unknown 1 db 30 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/hippopotas/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_SLOW ; growth rate dn EGG_GROUND, EGG_GROUND ; egg groups ; tm/hm learnset tmhm HEADBUTT, CURSE, ROAR, TOXIC, ROCK_SMASH, HIDDEN_POWER, SUNNY_DAY, SNORE, PROTECT, ENDURE, FRUSTRATION, IRON_TAIL, EARTHQUAKE, RETURN, DIG, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, SANDSTORM, REST, ATTRACT, STRENGTH ; end
src/Data/PropFormula/Theorems/Classical.agda
jonaprieto/agda-prop
13
10007
<reponame>jonaprieto/agda-prop<filename>src/Data/PropFormula/Theorems/Classical.agda ------------------------------------------------------------------------------ -- Agda-Prop Library. -- Classical Propositional Logic. ------------------------------------------------------------------------------ open import Data.Nat using ( ℕ ) module Data.PropFormula.Theorems.Classical ( n : ℕ ) where ------------------------------------------------------------------------------ open import Data.PropFormula.Syntax n ------------------------------------------------------------------------------ postulate PEM : ∀ {Γ} {φ} → Γ ⊢ φ ∨ ¬ φ -- Theorem. RAA : ∀ {Γ} {φ} → Γ , ¬ φ ⊢ ⊥ → Γ ⊢ φ -- Proof. RAA {φ = φ} Γ¬φ⊢⊥ = ⊃-elim (⊃-intro (∨-elim (assume φ) (⊥-elim φ Γ¬φ⊢⊥))) PEM -------------------------------------------------------------------------- ∎
computer-architecture/labs/exam-petru.asm
vampy/university
6
21002
; Read from the keyboard a number composed of multiple digits ; and do the sum of all the digits and write the result into a file assume cs:code, ds:data data segment msg db 'Name of the file: $' mnr db 'Enter the number: $' mNrLen db 12 lNr db ? nr db 12 dup (?) maxFileName db 12 lFileName db ? fileName db 12 dup (?) maxRezLen db 12 rezLen db ? rez db 12 dup(?) openErrorMsg db 'File does not exist.$' writeErrorMsg db 'Can t write to file.$' lgsum dw ? data ends code segment start: mov ax, data mov ds, ax ; print the string "mnr" on the screen mov ah, 09h mov dx, offset mnr int 21h ; read the number mov ah, 0ah mov dx, offset mNrLen int 21h mov cl, lNr mov ch, 0 mov si, offset nr aici: LODSB sub al, '0' add bl, al adc bh, 0 loop aici ; put the inverted sum into rez mov ax, bx mov bx, 0 inv: mov cx, 16 div cl cmp ah, 9 ja litera add ah, '0' jmp addddd litera: add ah, 'A'-10 addddd: mov rez[bx], ah mov ah, 0 add bx, 1 cmp ax, 0 jne inv mov rez[bx], '$' mov lgsum, bx sub bx, 1 mov bp, 0 ; invert rez cmp bp, bx jae qwerty inve: ; swap rez[bp], rez[bx] mov dl, rez[bp] mov al, rez[bx] mov rez[bx], dl mov rez[bp], al add bp, 1 sub bx, 1 cmp bp, bx jb inve ; print the string "msg" on the screen qwerty: mov ah, 09h mov dx, offset msg int 21h ; read from the keyboard the name of the file using interrupt 21, function 0ah mov ah, 0ah mov dx, offset maxFileName int 21h ; we transform the filename into an ASCIIZ string (put zero at the end) mov al, lFileName xor ah, ah mov si, ax mov fileName[si], 0 ; open the file using function 3dh of the interrupt 21h mov ah, 3dh mov al, 1 mov dx, offset fileName int 21h jc openError ; CF will be set by the CPU if an error occured mov bx, ax ; write to file mov ah, 40h mov cx, lgsum mov dx, offset rez int 21h jc writeError jmp endprg openError: ; print the openErrorMsg string using function 09h of interrupt 21h mov ah, 09h mov dx, offset openErrorMsg int 21h jmp endPrg writeError: ; print the readErrorMsg string using function 09h of interrupt 21h mov ah, 09h mov dx, offset writeErrorMsg int 21h endprg: mov ax, 4c00h int 21h code ends end start
programs/oeis/066/A066604.asm
neoneye/loda
22
164852
; A066604: a(n) = 6^n mod n. ; 0,0,0,0,1,0,6,0,0,6,6,0,6,8,6,0,6,0,6,16,6,14,6,0,1,10,0,8,6,6,6,0,18,2,6,0,6,36,21,16,6,36,6,20,36,36,6,0,48,26,12,48,6,0,21,8,45,36,6,36,6,36,27,0,41,60,6,4,9,36,6,0,6,36,51,4,41,12,6,16,0,36,6,36,41,36,42,48,6,36,20,8,30,36,81,0,6,50,90,76 add $0,1 mov $1,1 mov $2,$0 lpb $0 sub $0,1 mul $1,6 mod $1,$2 lpe mov $0,$1
commands/system/move-downloads-to-trash.applescript
tanaynistala/script-commands
3,305
791
#!/usr/bin/osascript # Required parameters: # @raycast.author Jax0rz # @authorURL https://github.com/Jax0rz # @raycast.schemaVersion 1 # @raycast.title Move Downloads to Trash # @raycast.mode silent # @raycast.packageName System # @raycast.needsConfirmation true # Optional parameters: # @raycast.icon images/move-downloads-to-trash.png tell application "Finder" set allDownloads to every item of folder (path to downloads folder as text) move allDownloads to trash log "" end tell
Data/Boolean/Operators.agda
Lolirofle/stuff-in-agda
6
12849
module Data.Boolean.Operators where open import Data.Boolean -- Definition of boolean operators with conventions from logic module Logic where infixl 1005 _∧_ infixl 1004 _∨_ _⊕_ infixl 1003 _⟵_ _⟷_ _⟶_ _∧_ : Bool → Bool → Bool _∧_ 𝑇 𝑇 = 𝑇 _∧_ 𝐹 𝑇 = 𝐹 _∧_ 𝑇 𝐹 = 𝐹 _∧_ 𝐹 𝐹 = 𝐹 _∨_ : Bool → Bool → Bool _∨_ 𝑇 𝑇 = 𝑇 _∨_ 𝐹 𝑇 = 𝑇 _∨_ 𝑇 𝐹 = 𝑇 _∨_ 𝐹 𝐹 = 𝐹 open Data.Boolean using () renaming (not to ¬) public _⊕_ : Bool → Bool → Bool _⊕_ 𝑇 𝑇 = 𝐹 _⊕_ 𝐹 𝑇 = 𝑇 _⊕_ 𝑇 𝐹 = 𝑇 _⊕_ 𝐹 𝐹 = 𝐹 _⟶_ : Bool → Bool → Bool _⟶_ 𝑇 𝑇 = 𝑇 _⟶_ 𝐹 𝑇 = 𝑇 _⟶_ 𝑇 𝐹 = 𝐹 _⟶_ 𝐹 𝐹 = 𝑇 _⟵_ : Bool → Bool → Bool _⟵_ 𝑇 𝑇 = 𝑇 _⟵_ 𝐹 𝑇 = 𝐹 _⟵_ 𝑇 𝐹 = 𝑇 _⟵_ 𝐹 𝐹 = 𝑇 _⟷_ : Bool → Bool → Bool _⟷_ 𝑇 𝑇 = 𝑇 _⟷_ 𝐹 𝑇 = 𝐹 _⟷_ 𝑇 𝐹 = 𝐹 _⟷_ 𝐹 𝐹 = 𝑇 _⊼_ : Bool → Bool → Bool _⊼_ 𝑇 𝑇 = 𝐹 _⊼_ 𝐹 𝑇 = 𝑇 _⊼_ 𝑇 𝐹 = 𝑇 _⊼_ 𝐹 𝐹 = 𝑇 _⊽_ : Bool → Bool → Bool _⊽_ 𝑇 𝑇 = 𝐹 _⊽_ 𝐹 𝑇 = 𝐹 _⊽_ 𝑇 𝐹 = 𝐹 _⊽_ 𝐹 𝐹 = 𝑇 ⊤ : Bool ⊤ = 𝑇 ⊥ : Bool ⊥ = 𝐹 -- Definition of boolean operators with conventions from typical programming languages module Programming where open Logic using () renaming (_∧_ to _&&_ ; _∨_ to _||_ ; ¬ to ! ; _⟷_ to _==_ ; _⊕_ to _!=_ ; _⟶_ to _→?_ ; _⟵_ to _←?_ ) public
src/vc-compat-entry.asm
mumurik/xyzzy
7
89664
.model flat .data VCVER = PLATVER / 10 ; ; VC10 + Windows 2000 SP4 Update Rollup 1 ; EXTRN _xyzzySetDllDirectoryA@4:PROC EXTRN _xyzzyGetNativeSystemInfo@4:PROC EXTERNDEF __imp__SetDllDirectoryA@4:DWORD EXTERNDEF __imp__GetNativeSystemInfo@4:DWORD __imp__SetDllDirectoryA@4 dd _xyzzySetDllDirectoryA@4 __imp__GetNativeSystemInfo@4 dd _xyzzyGetNativeSystemInfo@4 ifdef VCVER if VCVER ge 10 EXTRN _xyzzyEncodePointer@4:PROC EXTRN _xyzzyDecodePointer@4:PROC EXTERNDEF __imp__EncodePointer@4:DWORD EXTERNDEF __imp__DecodePointer@4:DWORD __imp__EncodePointer@4 dd _xyzzyEncodePointer@4 __imp__DecodePointer@4 dd _xyzzyDecodePointer@4 endif ; VCVER ge 10 endif ; VCVER ; ; VC11 + Windows 2000 SP4 Update Rollup 1 ; ifdef VCVER if VCVER ge 11 EXTRN _xyzzyGetModuleHandleExW@12:PROC EXTERNDEF __imp__GetModuleHandleExW@12:DWORD __imp__GetModuleHandleExW@12 dd _xyzzyGetModuleHandleExW@12 endif ; VCVER ge 11 endif ; VCVER ; ; VC11 + Windows XP ; ifdef VCVER if VCVER ge 11 EXTRN _xyzzyFlsAlloc@4:PROC EXTRN _xyzzyFlsFree@4:PROC EXTRN _xyzzyFlsGetValue@4:PROC EXTRN _xyzzyFlsSetValue@8:PROC EXTRN _xyzzyGetTickCount64@0:PROC EXTRN _xyzzyLCMapStringEx@36:PROC EXTERNDEF __imp__FlsAlloc@4:DWORD EXTERNDEF __imp__FlsFree@4:DWORD EXTERNDEF __imp__FlsGetValue@4:DWORD EXTERNDEF __imp__FlsSetValue@8:DWORD EXTERNDEF __imp__GetTickCount64@0:DWORD EXTERNDEF __imp__LCMapStringEx@36:DWORD __imp__FlsAlloc@4 dd _xyzzyFlsAlloc@4 __imp__FlsFree@4 dd _xyzzyFlsFree@4 __imp__FlsGetValue@4 dd _xyzzyFlsGetValue@4 __imp__FlsSetValue@8 dd _xyzzyFlsSetValue@8 __imp__GetTickCount64@0 dd _xyzzyGetTickCount64@0 __imp__LCMapStringEx@36 dd _xyzzyLCMapStringEx@36 endif ; VCVER ge 11 endif ; VCVER end
libsrc/target/micro8085/drv/uart_putc.asm
UnivEngineer/z88dk
4
104340
;------------------------------------------------------------------------- ; Native terminal i/o functionality for micro8085_cilb ; Functions below assumes support for INTEL 8085 "undocumented" opcodes SECTION code_clib EXTERN puartd EXTERN puartc PUBLIC _uart_putc ;------------------------------------------------------------------------- ; extern void uart_putc(uint8 data); _uart_putc: in a,(puartc) ;uart status reg and 01H ;tx data ready bit jp z,_uart_putc ;wait for ready ld de,sp+2 ;retreive the argument ld a,(de) ;from behind return addr out (puartd),a ;write to uart ret
programs/oeis/033/A033627.asm
neoneye/loda
22
12273
; A033627: 0-additive sequence: not the sum of any previous pair. ; 1,2,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70,73,76,79,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,127,130,133,136,139,142,145,148,151,154,157,160,163,166,169,172,175,178,181,184,187,190,193,196,199,202,205,208,211,214,217,220,223,226,229,232,235,238,241,244,247,250,253,256,259,262,265,268,271,274,277,280,283,286,289,292,295 mov $1,$0 mul $0,2 trn $0,3 add $1,1 add $0,$1
middle.asm
hamedmiir/Synchronized-xv6
0
247067
_middle: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #define O_CREATE 0x200 int main(int argc, char* argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 57 push %edi e: 56 push %esi f: 53 push %ebx 10: 51 push %ecx 11: 81 ec f8 07 00 00 sub $0x7f8,%esp if(argc != 8) { 17: 83 39 08 cmpl $0x8,(%ecx) #define O_CREATE 0x200 int main(int argc, char* argv[]) { 1a: 8b 71 04 mov 0x4(%ecx),%esi if(argc != 8) { 1d: 74 13 je 32 <main+0x32> printf(1, "please insert exactly 7 numbers \n"); 1f: 57 push %edi 20: 57 push %edi 21: 68 60 08 00 00 push $0x860 26: 6a 01 push $0x1 28: e8 13 05 00 00 call 540 <printf> exit(); 2d: e8 b0 03 00 00 call 3e2 <exit> 32: 31 db xor %ebx,%ebx 34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } int array[7], i, j, temp, num = 7; for(i = 0; i < 7; i++){ array[i] = atoi(argv[i+1]); 38: 83 ec 0c sub $0xc,%esp 3b: ff 74 9e 04 pushl 0x4(%esi,%ebx,4) 3f: e8 2c 03 00 00 call 370 <atoi> 44: 89 84 9d fc f7 ff ff mov %eax,-0x804(%ebp,%ebx,4) printf(1, "please insert exactly 7 numbers \n"); exit(); } int array[7], i, j, temp, num = 7; for(i = 0; i < 7; i++){ 4b: 83 c3 01 add $0x1,%ebx 4e: 83 c4 10 add $0x10,%esp 51: 83 fb 07 cmp $0x7,%ebx 54: 75 e2 jne 38 <main+0x38> 56: bb 06 00 00 00 mov $0x6,%ebx 5b: 90 nop 5c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 60: 31 c0 xor %eax,%eax array[i] = atoi(argv[i+1]); } for (i = 0; i < num; i++) { for (j = 0; j < (num - i - 1); j++) 62: 39 d8 cmp %ebx,%eax 64: 7d 27 jge 8d <main+0x8d> { if (array[j] > array[j + 1]) 66: 8b 94 85 fc f7 ff ff mov -0x804(%ebp,%eax,4),%edx 6d: 83 c0 01 add $0x1,%eax 70: 8b 8c 85 fc f7 ff ff mov -0x804(%ebp,%eax,4),%ecx 77: 39 ca cmp %ecx,%edx 79: 7e e7 jle 62 <main+0x62> array[i] = atoi(argv[i+1]); } for (i = 0; i < num; i++) { for (j = 0; j < (num - i - 1); j++) 7b: 39 d8 cmp %ebx,%eax { if (array[j] > array[j + 1]) { temp = array[j]; array[j] = array[j + 1]; 7d: 89 8c 85 f8 f7 ff ff mov %ecx,-0x808(%ebp,%eax,4) array[j + 1] = temp; 84: 89 94 85 fc f7 ff ff mov %edx,-0x804(%ebp,%eax,4) array[i] = atoi(argv[i+1]); } for (i = 0; i < num; i++) { for (j = 0; j < (num - i - 1); j++) 8b: 7c d9 jl 66 <main+0x66> 8d: 83 eb 01 sub $0x1,%ebx int array[7], i, j, temp, num = 7; for(i = 0; i < 7; i++){ array[i] = atoi(argv[i+1]); } for (i = 0; i < num; i++) 90: 83 fb ff cmp $0xffffffff,%ebx 93: 75 cb jne 60 <main+0x60> } } } char t, midInverse[1000]; int cnt = 0, mid = array[3]; 95: 8b 8d 08 f8 ff ff mov -0x7f8(%ebp),%ecx while(mid != 0) { 9b: 85 c9 test %ecx,%ecx 9d: 0f 84 e8 00 00 00 je 18b <main+0x18b> a3: 31 db xor %ebx,%ebx t = (mid % 10) + '0'; midInverse[cnt] = t; a5: be 67 66 66 66 mov $0x66666667,%esi aa: eb 06 jmp b2 <main+0xb2> ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi mid = mid / 10; cnt ++; b0: 89 fb mov %edi,%ebx char t, midInverse[1000]; int cnt = 0, mid = array[3]; while(mid != 0) { t = (mid % 10) + '0'; midInverse[cnt] = t; b2: 89 c8 mov %ecx,%eax mid = mid / 10; cnt ++; b4: 8d 7b 01 lea 0x1(%ebx),%edi char t, midInverse[1000]; int cnt = 0, mid = array[3]; while(mid != 0) { t = (mid % 10) + '0'; midInverse[cnt] = t; b7: f7 ee imul %esi b9: 89 c8 mov %ecx,%eax bb: c1 f8 1f sar $0x1f,%eax be: c1 fa 02 sar $0x2,%edx c1: 29 c2 sub %eax,%edx c3: 8d 04 92 lea (%edx,%edx,4),%eax c6: 01 c0 add %eax,%eax c8: 29 c1 sub %eax,%ecx ca: 83 c1 30 add $0x30,%ecx } } char t, midInverse[1000]; int cnt = 0, mid = array[3]; while(mid != 0) { cd: 85 d2 test %edx,%edx t = (mid % 10) + '0'; midInverse[cnt] = t; cf: 88 8c 1d 18 f8 ff ff mov %cl,-0x7e8(%ebp,%ebx,1) mid = mid / 10; d6: 89 d1 mov %edx,%ecx } } char t, midInverse[1000]; int cnt = 0, mid = array[3]; while(mid != 0) { d8: 75 d6 jne b0 <main+0xb0> da: 8d 85 18 f8 ff ff lea -0x7e8(%ebp),%eax e0: 8d 95 00 fc ff ff lea -0x400(%ebp),%edx e6: 01 d8 add %ebx,%eax e8: 8d 9d 17 f8 ff ff lea -0x7e9(%ebp),%ebx ee: 66 90 xchg %ax,%ax } int n = 0; char middle[1000]; for(i = cnt-1; i >= 0; i--) { middle[n] = midInverse[i]; f0: 0f b6 08 movzbl (%eax),%ecx f3: 83 e8 01 sub $0x1,%eax f6: 83 c2 01 add $0x1,%edx f9: 88 4a ff mov %cl,-0x1(%edx) cnt ++; } int n = 0; char middle[1000]; for(i = cnt-1; i >= 0; i--) { fc: 39 d8 cmp %ebx,%eax fe: 75 f0 jne f0 <main+0xf0> middle[n] = midInverse[i]; n++; } middle[n] = '\n'; 100: c6 84 3d 00 fc ff ff movb $0xa,-0x400(%ebp,%edi,1) 107: 0a printf(1, "proccess Id is %d \n", getpid()); 108: e8 55 03 00 00 call 462 <getpid> 10d: 51 push %ecx 10e: 50 push %eax 10f: 68 a4 08 00 00 push $0x8a4 114: 6a 01 push $0x1 116: e8 25 04 00 00 call 540 <printf> int fileDesc; if( (fileDesc = open("result.txt", O_CREATE | O_WRONLY)) < 0) { 11b: 5b pop %ebx 11c: 5e pop %esi 11d: 68 01 02 00 00 push $0x201 122: 68 c8 08 00 00 push $0x8c8 127: e8 f6 02 00 00 call 422 <open> 12c: 83 c4 10 add $0x10,%esp 12f: 85 c0 test %eax,%eax 131: 89 c6 mov %eax,%esi 133: 78 3e js 173 <main+0x173> printf(1, "can't open file result.txt"); exit(); } if(write(fileDesc, middle, strlen(middle)) != strlen(middle)) { 135: 8d 9d 00 fc ff ff lea -0x400(%ebp),%ebx 13b: 83 ec 0c sub $0xc,%esp 13e: 53 push %ebx 13f: e8 dc 00 00 00 call 220 <strlen> 144: 83 c4 0c add $0xc,%esp 147: 50 push %eax 148: 53 push %ebx 149: 56 push %esi 14a: e8 b3 02 00 00 call 402 <write> 14f: 89 c6 mov %eax,%esi 151: 89 1c 24 mov %ebx,(%esp) 154: e8 c7 00 00 00 call 220 <strlen> 159: 83 c4 10 add $0x10,%esp 15c: 39 c6 cmp %eax,%esi 15e: 74 26 je 186 <main+0x186> printf(1, "Eror when writing in result.txt"); 160: 50 push %eax 161: 50 push %eax 162: 68 84 08 00 00 push $0x884 167: 6a 01 push $0x1 169: e8 d2 03 00 00 call 540 <printf> exit(); 16e: e8 6f 02 00 00 call 3e2 <exit> middle[n] = '\n'; printf(1, "proccess Id is %d \n", getpid()); int fileDesc; if( (fileDesc = open("result.txt", O_CREATE | O_WRONLY)) < 0) { printf(1, "can't open file result.txt"); 173: 52 push %edx 174: 52 push %edx 175: 68 b8 08 00 00 push $0x8b8 17a: 6a 01 push $0x1 17c: e8 bf 03 00 00 call 540 <printf> exit(); 181: e8 5c 02 00 00 call 3e2 <exit> if(write(fileDesc, middle, strlen(middle)) != strlen(middle)) { printf(1, "Eror when writing in result.txt"); exit(); } exit(); 186: e8 57 02 00 00 call 3e2 <exit> midInverse[cnt] = t; mid = mid / 10; cnt ++; } int n = 0; 18b: 31 ff xor %edi,%edi 18d: e9 6e ff ff ff jmp 100 <main+0x100> 192: 66 90 xchg %ax,%ax 194: 66 90 xchg %ax,%ax 196: 66 90 xchg %ax,%ax 198: 66 90 xchg %ax,%ax 19a: 66 90 xchg %ax,%ax 19c: 66 90 xchg %ax,%ax 19e: 66 90 xchg %ax,%ax 000001a0 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 1a0: 55 push %ebp 1a1: 89 e5 mov %esp,%ebp 1a3: 53 push %ebx 1a4: 8b 45 08 mov 0x8(%ebp),%eax 1a7: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 1aa: 89 c2 mov %eax,%edx 1ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1b0: 83 c1 01 add $0x1,%ecx 1b3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 1b7: 83 c2 01 add $0x1,%edx 1ba: 84 db test %bl,%bl 1bc: 88 5a ff mov %bl,-0x1(%edx) 1bf: 75 ef jne 1b0 <strcpy+0x10> ; return os; } 1c1: 5b pop %ebx 1c2: 5d pop %ebp 1c3: c3 ret 1c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000001d0 <strcmp>: int strcmp(const char *p, const char *q) { 1d0: 55 push %ebp 1d1: 89 e5 mov %esp,%ebp 1d3: 56 push %esi 1d4: 53 push %ebx 1d5: 8b 55 08 mov 0x8(%ebp),%edx 1d8: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 1db: 0f b6 02 movzbl (%edx),%eax 1de: 0f b6 19 movzbl (%ecx),%ebx 1e1: 84 c0 test %al,%al 1e3: 75 1e jne 203 <strcmp+0x33> 1e5: eb 29 jmp 210 <strcmp+0x40> 1e7: 89 f6 mov %esi,%esi 1e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 1f0: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1f3: 0f b6 02 movzbl (%edx),%eax p++, q++; 1f6: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1f9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx 1fd: 84 c0 test %al,%al 1ff: 74 0f je 210 <strcmp+0x40> 201: 89 f1 mov %esi,%ecx 203: 38 d8 cmp %bl,%al 205: 74 e9 je 1f0 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; 207: 29 d8 sub %ebx,%eax } 209: 5b pop %ebx 20a: 5e pop %esi 20b: 5d pop %ebp 20c: c3 ret 20d: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 210: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 212: 29 d8 sub %ebx,%eax } 214: 5b pop %ebx 215: 5e pop %esi 216: 5d pop %ebp 217: c3 ret 218: 90 nop 219: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000220 <strlen>: uint strlen(const char *s) { 220: 55 push %ebp 221: 89 e5 mov %esp,%ebp 223: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 226: 80 39 00 cmpb $0x0,(%ecx) 229: 74 12 je 23d <strlen+0x1d> 22b: 31 d2 xor %edx,%edx 22d: 8d 76 00 lea 0x0(%esi),%esi 230: 83 c2 01 add $0x1,%edx 233: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 237: 89 d0 mov %edx,%eax 239: 75 f5 jne 230 <strlen+0x10> ; return n; } 23b: 5d pop %ebp 23c: c3 ret uint strlen(const char *s) { int n; for(n = 0; s[n]; n++) 23d: 31 c0 xor %eax,%eax ; return n; } 23f: 5d pop %ebp 240: c3 ret 241: eb 0d jmp 250 <memset> 243: 90 nop 244: 90 nop 245: 90 nop 246: 90 nop 247: 90 nop 248: 90 nop 249: 90 nop 24a: 90 nop 24b: 90 nop 24c: 90 nop 24d: 90 nop 24e: 90 nop 24f: 90 nop 00000250 <memset>: void* memset(void *dst, int c, uint n) { 250: 55 push %ebp 251: 89 e5 mov %esp,%ebp 253: 57 push %edi 254: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 257: 8b 4d 10 mov 0x10(%ebp),%ecx 25a: 8b 45 0c mov 0xc(%ebp),%eax 25d: 89 d7 mov %edx,%edi 25f: fc cld 260: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 262: 89 d0 mov %edx,%eax 264: 5f pop %edi 265: 5d pop %ebp 266: c3 ret 267: 89 f6 mov %esi,%esi 269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000270 <strchr>: char* strchr(const char *s, char c) { 270: 55 push %ebp 271: 89 e5 mov %esp,%ebp 273: 53 push %ebx 274: 8b 45 08 mov 0x8(%ebp),%eax 277: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 27a: 0f b6 10 movzbl (%eax),%edx 27d: 84 d2 test %dl,%dl 27f: 74 1d je 29e <strchr+0x2e> if(*s == c) 281: 38 d3 cmp %dl,%bl 283: 89 d9 mov %ebx,%ecx 285: 75 0d jne 294 <strchr+0x24> 287: eb 17 jmp 2a0 <strchr+0x30> 289: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 290: 38 ca cmp %cl,%dl 292: 74 0c je 2a0 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 294: 83 c0 01 add $0x1,%eax 297: 0f b6 10 movzbl (%eax),%edx 29a: 84 d2 test %dl,%dl 29c: 75 f2 jne 290 <strchr+0x20> if(*s == c) return (char*)s; return 0; 29e: 31 c0 xor %eax,%eax } 2a0: 5b pop %ebx 2a1: 5d pop %ebp 2a2: c3 ret 2a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 2a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000002b0 <gets>: char* gets(char *buf, int max) { 2b0: 55 push %ebp 2b1: 89 e5 mov %esp,%ebp 2b3: 57 push %edi 2b4: 56 push %esi 2b5: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 2b6: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 2b8: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 2bb: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 2be: eb 29 jmp 2e9 <gets+0x39> cc = read(0, &c, 1); 2c0: 83 ec 04 sub $0x4,%esp 2c3: 6a 01 push $0x1 2c5: 57 push %edi 2c6: 6a 00 push $0x0 2c8: e8 2d 01 00 00 call 3fa <read> if(cc < 1) 2cd: 83 c4 10 add $0x10,%esp 2d0: 85 c0 test %eax,%eax 2d2: 7e 1d jle 2f1 <gets+0x41> break; buf[i++] = c; 2d4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 2d8: 8b 55 08 mov 0x8(%ebp),%edx 2db: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 2dd: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 2df: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 2e3: 74 1b je 300 <gets+0x50> 2e5: 3c 0d cmp $0xd,%al 2e7: 74 17 je 300 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 2e9: 8d 5e 01 lea 0x1(%esi),%ebx 2ec: 3b 5d 0c cmp 0xc(%ebp),%ebx 2ef: 7c cf jl 2c0 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 2f1: 8b 45 08 mov 0x8(%ebp),%eax 2f4: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 2f8: 8d 65 f4 lea -0xc(%ebp),%esp 2fb: 5b pop %ebx 2fc: 5e pop %esi 2fd: 5f pop %edi 2fe: 5d pop %ebp 2ff: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 300: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 303: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 305: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 309: 8d 65 f4 lea -0xc(%ebp),%esp 30c: 5b pop %ebx 30d: 5e pop %esi 30e: 5f pop %edi 30f: 5d pop %ebp 310: c3 ret 311: eb 0d jmp 320 <stat> 313: 90 nop 314: 90 nop 315: 90 nop 316: 90 nop 317: 90 nop 318: 90 nop 319: 90 nop 31a: 90 nop 31b: 90 nop 31c: 90 nop 31d: 90 nop 31e: 90 nop 31f: 90 nop 00000320 <stat>: int stat(const char *n, struct stat *st) { 320: 55 push %ebp 321: 89 e5 mov %esp,%ebp 323: 56 push %esi 324: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 325: 83 ec 08 sub $0x8,%esp 328: 6a 00 push $0x0 32a: ff 75 08 pushl 0x8(%ebp) 32d: e8 f0 00 00 00 call 422 <open> if(fd < 0) 332: 83 c4 10 add $0x10,%esp 335: 85 c0 test %eax,%eax 337: 78 27 js 360 <stat+0x40> return -1; r = fstat(fd, st); 339: 83 ec 08 sub $0x8,%esp 33c: ff 75 0c pushl 0xc(%ebp) 33f: 89 c3 mov %eax,%ebx 341: 50 push %eax 342: e8 f3 00 00 00 call 43a <fstat> 347: 89 c6 mov %eax,%esi close(fd); 349: 89 1c 24 mov %ebx,(%esp) 34c: e8 b9 00 00 00 call 40a <close> return r; 351: 83 c4 10 add $0x10,%esp 354: 89 f0 mov %esi,%eax } 356: 8d 65 f8 lea -0x8(%ebp),%esp 359: 5b pop %ebx 35a: 5e pop %esi 35b: 5d pop %ebp 35c: c3 ret 35d: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 360: b8 ff ff ff ff mov $0xffffffff,%eax 365: eb ef jmp 356 <stat+0x36> 367: 89 f6 mov %esi,%esi 369: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000370 <atoi>: return r; } int atoi(const char *s) { 370: 55 push %ebp 371: 89 e5 mov %esp,%ebp 373: 53 push %ebx 374: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 377: 0f be 11 movsbl (%ecx),%edx 37a: 8d 42 d0 lea -0x30(%edx),%eax 37d: 3c 09 cmp $0x9,%al 37f: b8 00 00 00 00 mov $0x0,%eax 384: 77 1f ja 3a5 <atoi+0x35> 386: 8d 76 00 lea 0x0(%esi),%esi 389: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 390: 8d 04 80 lea (%eax,%eax,4),%eax 393: 83 c1 01 add $0x1,%ecx 396: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 39a: 0f be 11 movsbl (%ecx),%edx 39d: 8d 5a d0 lea -0x30(%edx),%ebx 3a0: 80 fb 09 cmp $0x9,%bl 3a3: 76 eb jbe 390 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 3a5: 5b pop %ebx 3a6: 5d pop %ebp 3a7: c3 ret 3a8: 90 nop 3a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000003b0 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 3b0: 55 push %ebp 3b1: 89 e5 mov %esp,%ebp 3b3: 56 push %esi 3b4: 53 push %ebx 3b5: 8b 5d 10 mov 0x10(%ebp),%ebx 3b8: 8b 45 08 mov 0x8(%ebp),%eax 3bb: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 3be: 85 db test %ebx,%ebx 3c0: 7e 14 jle 3d6 <memmove+0x26> 3c2: 31 d2 xor %edx,%edx 3c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 3c8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 3cc: 88 0c 10 mov %cl,(%eax,%edx,1) 3cf: 83 c2 01 add $0x1,%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 3d2: 39 da cmp %ebx,%edx 3d4: 75 f2 jne 3c8 <memmove+0x18> *dst++ = *src++; return vdst; } 3d6: 5b pop %ebx 3d7: 5e pop %esi 3d8: 5d pop %ebp 3d9: c3 ret 000003da <fork>: 3da: b8 01 00 00 00 mov $0x1,%eax 3df: cd 40 int $0x40 3e1: c3 ret 000003e2 <exit>: 3e2: b8 02 00 00 00 mov $0x2,%eax 3e7: cd 40 int $0x40 3e9: c3 ret 000003ea <wait>: 3ea: b8 03 00 00 00 mov $0x3,%eax 3ef: cd 40 int $0x40 3f1: c3 ret 000003f2 <pipe>: 3f2: b8 04 00 00 00 mov $0x4,%eax 3f7: cd 40 int $0x40 3f9: c3 ret 000003fa <read>: 3fa: b8 05 00 00 00 mov $0x5,%eax 3ff: cd 40 int $0x40 401: c3 ret 00000402 <write>: 402: b8 10 00 00 00 mov $0x10,%eax 407: cd 40 int $0x40 409: c3 ret 0000040a <close>: 40a: b8 15 00 00 00 mov $0x15,%eax 40f: cd 40 int $0x40 411: c3 ret 00000412 <kill>: 412: b8 06 00 00 00 mov $0x6,%eax 417: cd 40 int $0x40 419: c3 ret 0000041a <exec>: 41a: b8 07 00 00 00 mov $0x7,%eax 41f: cd 40 int $0x40 421: c3 ret 00000422 <open>: 422: b8 0f 00 00 00 mov $0xf,%eax 427: cd 40 int $0x40 429: c3 ret 0000042a <mknod>: 42a: b8 11 00 00 00 mov $0x11,%eax 42f: cd 40 int $0x40 431: c3 ret 00000432 <unlink>: 432: b8 12 00 00 00 mov $0x12,%eax 437: cd 40 int $0x40 439: c3 ret 0000043a <fstat>: 43a: b8 08 00 00 00 mov $0x8,%eax 43f: cd 40 int $0x40 441: c3 ret 00000442 <link>: 442: b8 13 00 00 00 mov $0x13,%eax 447: cd 40 int $0x40 449: c3 ret 0000044a <mkdir>: 44a: b8 14 00 00 00 mov $0x14,%eax 44f: cd 40 int $0x40 451: c3 ret 00000452 <chdir>: 452: b8 09 00 00 00 mov $0x9,%eax 457: cd 40 int $0x40 459: c3 ret 0000045a <dup>: 45a: b8 0a 00 00 00 mov $0xa,%eax 45f: cd 40 int $0x40 461: c3 ret 00000462 <getpid>: 462: b8 0b 00 00 00 mov $0xb,%eax 467: cd 40 int $0x40 469: c3 ret 0000046a <sbrk>: 46a: b8 0c 00 00 00 mov $0xc,%eax 46f: cd 40 int $0x40 471: c3 ret 00000472 <sleep>: 472: b8 0d 00 00 00 mov $0xd,%eax 477: cd 40 int $0x40 479: c3 ret 0000047a <uptime>: 47a: b8 0e 00 00 00 mov $0xe,%eax 47f: cd 40 int $0x40 481: c3 ret 00000482 <incNum>: 482: b8 16 00 00 00 mov $0x16,%eax 487: cd 40 int $0x40 489: c3 ret 0000048a <getprocs>: 48a: b8 17 00 00 00 mov $0x17,%eax 48f: cd 40 int $0x40 491: c3 ret 00000492 <printstack>: 492: b8 18 00 00 00 mov $0x18,%eax 497: cd 40 int $0x40 499: c3 ret 49a: 66 90 xchg %ax,%ax 49c: 66 90 xchg %ax,%ax 49e: 66 90 xchg %ax,%ax 000004a0 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 4a0: 55 push %ebp 4a1: 89 e5 mov %esp,%ebp 4a3: 57 push %edi 4a4: 56 push %esi 4a5: 53 push %ebx 4a6: 89 c6 mov %eax,%esi 4a8: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 4ab: 8b 5d 08 mov 0x8(%ebp),%ebx 4ae: 85 db test %ebx,%ebx 4b0: 74 7e je 530 <printint+0x90> 4b2: 89 d0 mov %edx,%eax 4b4: c1 e8 1f shr $0x1f,%eax 4b7: 84 c0 test %al,%al 4b9: 74 75 je 530 <printint+0x90> neg = 1; x = -xx; 4bb: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 4bd: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 4c4: f7 d8 neg %eax 4c6: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 4c9: 31 ff xor %edi,%edi 4cb: 8d 5d d7 lea -0x29(%ebp),%ebx 4ce: 89 ce mov %ecx,%esi 4d0: eb 08 jmp 4da <printint+0x3a> 4d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 4d8: 89 cf mov %ecx,%edi 4da: 31 d2 xor %edx,%edx 4dc: 8d 4f 01 lea 0x1(%edi),%ecx 4df: f7 f6 div %esi 4e1: 0f b6 92 dc 08 00 00 movzbl 0x8dc(%edx),%edx }while((x /= base) != 0); 4e8: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 4ea: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 4ed: 75 e9 jne 4d8 <printint+0x38> if(neg) 4ef: 8b 45 c4 mov -0x3c(%ebp),%eax 4f2: 8b 75 c0 mov -0x40(%ebp),%esi 4f5: 85 c0 test %eax,%eax 4f7: 74 08 je 501 <printint+0x61> buf[i++] = '-'; 4f9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 4fe: 8d 4f 02 lea 0x2(%edi),%ecx 501: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 505: 8d 76 00 lea 0x0(%esi),%esi 508: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 50b: 83 ec 04 sub $0x4,%esp 50e: 83 ef 01 sub $0x1,%edi 511: 6a 01 push $0x1 513: 53 push %ebx 514: 56 push %esi 515: 88 45 d7 mov %al,-0x29(%ebp) 518: e8 e5 fe ff ff call 402 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 51d: 83 c4 10 add $0x10,%esp 520: 39 df cmp %ebx,%edi 522: 75 e4 jne 508 <printint+0x68> putc(fd, buf[i]); } 524: 8d 65 f4 lea -0xc(%ebp),%esp 527: 5b pop %ebx 528: 5e pop %esi 529: 5f pop %edi 52a: 5d pop %ebp 52b: c3 ret 52c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 530: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 532: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 539: eb 8b jmp 4c6 <printint+0x26> 53b: 90 nop 53c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000540 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 540: 55 push %ebp 541: 89 e5 mov %esp,%ebp 543: 57 push %edi 544: 56 push %esi 545: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 546: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 549: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 54c: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 54f: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 552: 89 45 d0 mov %eax,-0x30(%ebp) 555: 0f b6 1e movzbl (%esi),%ebx 558: 83 c6 01 add $0x1,%esi 55b: 84 db test %bl,%bl 55d: 0f 84 b0 00 00 00 je 613 <printf+0xd3> 563: 31 d2 xor %edx,%edx 565: eb 39 jmp 5a0 <printf+0x60> 567: 89 f6 mov %esi,%esi 569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 570: 83 f8 25 cmp $0x25,%eax 573: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 576: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 57b: 74 18 je 595 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 57d: 8d 45 e2 lea -0x1e(%ebp),%eax 580: 83 ec 04 sub $0x4,%esp 583: 88 5d e2 mov %bl,-0x1e(%ebp) 586: 6a 01 push $0x1 588: 50 push %eax 589: 57 push %edi 58a: e8 73 fe ff ff call 402 <write> 58f: 8b 55 d4 mov -0x2c(%ebp),%edx 592: 83 c4 10 add $0x10,%esp 595: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 598: 0f b6 5e ff movzbl -0x1(%esi),%ebx 59c: 84 db test %bl,%bl 59e: 74 73 je 613 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 5a0: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 5a2: 0f be cb movsbl %bl,%ecx 5a5: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 5a8: 74 c6 je 570 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 5aa: 83 fa 25 cmp $0x25,%edx 5ad: 75 e6 jne 595 <printf+0x55> if(c == 'd'){ 5af: 83 f8 64 cmp $0x64,%eax 5b2: 0f 84 f8 00 00 00 je 6b0 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 5b8: 81 e1 f7 00 00 00 and $0xf7,%ecx 5be: 83 f9 70 cmp $0x70,%ecx 5c1: 74 5d je 620 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 5c3: 83 f8 73 cmp $0x73,%eax 5c6: 0f 84 84 00 00 00 je 650 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 5cc: 83 f8 63 cmp $0x63,%eax 5cf: 0f 84 ea 00 00 00 je 6bf <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 5d5: 83 f8 25 cmp $0x25,%eax 5d8: 0f 84 c2 00 00 00 je 6a0 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5de: 8d 45 e7 lea -0x19(%ebp),%eax 5e1: 83 ec 04 sub $0x4,%esp 5e4: c6 45 e7 25 movb $0x25,-0x19(%ebp) 5e8: 6a 01 push $0x1 5ea: 50 push %eax 5eb: 57 push %edi 5ec: e8 11 fe ff ff call 402 <write> 5f1: 83 c4 0c add $0xc,%esp 5f4: 8d 45 e6 lea -0x1a(%ebp),%eax 5f7: 88 5d e6 mov %bl,-0x1a(%ebp) 5fa: 6a 01 push $0x1 5fc: 50 push %eax 5fd: 57 push %edi 5fe: 83 c6 01 add $0x1,%esi 601: e8 fc fd ff ff call 402 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 606: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 60a: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 60d: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 60f: 84 db test %bl,%bl 611: 75 8d jne 5a0 <printf+0x60> putc(fd, c); } state = 0; } } } 613: 8d 65 f4 lea -0xc(%ebp),%esp 616: 5b pop %ebx 617: 5e pop %esi 618: 5f pop %edi 619: 5d pop %ebp 61a: c3 ret 61b: 90 nop 61c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 620: 83 ec 0c sub $0xc,%esp 623: b9 10 00 00 00 mov $0x10,%ecx 628: 6a 00 push $0x0 62a: 8b 5d d0 mov -0x30(%ebp),%ebx 62d: 89 f8 mov %edi,%eax 62f: 8b 13 mov (%ebx),%edx 631: e8 6a fe ff ff call 4a0 <printint> ap++; 636: 89 d8 mov %ebx,%eax 638: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 63b: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; 63d: 83 c0 04 add $0x4,%eax 640: 89 45 d0 mov %eax,-0x30(%ebp) 643: e9 4d ff ff ff jmp 595 <printf+0x55> 648: 90 nop 649: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 650: 8b 45 d0 mov -0x30(%ebp),%eax 653: 8b 18 mov (%eax),%ebx ap++; 655: 83 c0 04 add $0x4,%eax 658: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 65b: b8 d3 08 00 00 mov $0x8d3,%eax 660: 85 db test %ebx,%ebx 662: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 665: 0f b6 03 movzbl (%ebx),%eax 668: 84 c0 test %al,%al 66a: 74 23 je 68f <printf+0x14f> 66c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 670: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 673: 8d 45 e3 lea -0x1d(%ebp),%eax 676: 83 ec 04 sub $0x4,%esp 679: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 67b: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 67e: 50 push %eax 67f: 57 push %edi 680: e8 7d fd ff ff call 402 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 685: 0f b6 03 movzbl (%ebx),%eax 688: 83 c4 10 add $0x10,%esp 68b: 84 c0 test %al,%al 68d: 75 e1 jne 670 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 68f: 31 d2 xor %edx,%edx 691: e9 ff fe ff ff jmp 595 <printf+0x55> 696: 8d 76 00 lea 0x0(%esi),%esi 699: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 6a0: 83 ec 04 sub $0x4,%esp 6a3: 88 5d e5 mov %bl,-0x1b(%ebp) 6a6: 8d 45 e5 lea -0x1b(%ebp),%eax 6a9: 6a 01 push $0x1 6ab: e9 4c ff ff ff jmp 5fc <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 6b0: 83 ec 0c sub $0xc,%esp 6b3: b9 0a 00 00 00 mov $0xa,%ecx 6b8: 6a 01 push $0x1 6ba: e9 6b ff ff ff jmp 62a <printf+0xea> 6bf: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 6c2: 83 ec 04 sub $0x4,%esp 6c5: 8b 03 mov (%ebx),%eax 6c7: 6a 01 push $0x1 6c9: 88 45 e4 mov %al,-0x1c(%ebp) 6cc: 8d 45 e4 lea -0x1c(%ebp),%eax 6cf: 50 push %eax 6d0: 57 push %edi 6d1: e8 2c fd ff ff call 402 <write> 6d6: e9 5b ff ff ff jmp 636 <printf+0xf6> 6db: 66 90 xchg %ax,%ax 6dd: 66 90 xchg %ax,%ax 6df: 90 nop 000006e0 <free>: static Header base; static Header *freep; void free(void *ap) { 6e0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 6e1: a1 80 0b 00 00 mov 0xb80,%eax static Header base; static Header *freep; void free(void *ap) { 6e6: 89 e5 mov %esp,%ebp 6e8: 57 push %edi 6e9: 56 push %esi 6ea: 53 push %ebx 6eb: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 6ee: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 6f0: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 6f3: 39 c8 cmp %ecx,%eax 6f5: 73 19 jae 710 <free+0x30> 6f7: 89 f6 mov %esi,%esi 6f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 700: 39 d1 cmp %edx,%ecx 702: 72 1c jb 720 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 704: 39 d0 cmp %edx,%eax 706: 73 18 jae 720 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 708: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 70a: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 70c: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 70e: 72 f0 jb 700 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 710: 39 d0 cmp %edx,%eax 712: 72 f4 jb 708 <free+0x28> 714: 39 d1 cmp %edx,%ecx 716: 73 f0 jae 708 <free+0x28> 718: 90 nop 719: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 720: 8b 73 fc mov -0x4(%ebx),%esi 723: 8d 3c f1 lea (%ecx,%esi,8),%edi 726: 39 d7 cmp %edx,%edi 728: 74 19 je 743 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 72a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 72d: 8b 50 04 mov 0x4(%eax),%edx 730: 8d 34 d0 lea (%eax,%edx,8),%esi 733: 39 f1 cmp %esi,%ecx 735: 74 23 je 75a <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 737: 89 08 mov %ecx,(%eax) freep = p; 739: a3 80 0b 00 00 mov %eax,0xb80 } 73e: 5b pop %ebx 73f: 5e pop %esi 740: 5f pop %edi 741: 5d pop %ebp 742: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 743: 03 72 04 add 0x4(%edx),%esi 746: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 749: 8b 10 mov (%eax),%edx 74b: 8b 12 mov (%edx),%edx 74d: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 750: 8b 50 04 mov 0x4(%eax),%edx 753: 8d 34 d0 lea (%eax,%edx,8),%esi 756: 39 f1 cmp %esi,%ecx 758: 75 dd jne 737 <free+0x57> p->s.size += bp->s.size; 75a: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 75d: a3 80 0b 00 00 mov %eax,0xb80 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 762: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 765: 8b 53 f8 mov -0x8(%ebx),%edx 768: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 76a: 5b pop %ebx 76b: 5e pop %esi 76c: 5f pop %edi 76d: 5d pop %ebp 76e: c3 ret 76f: 90 nop 00000770 <malloc>: return freep; } void* malloc(uint nbytes) { 770: 55 push %ebp 771: 89 e5 mov %esp,%ebp 773: 57 push %edi 774: 56 push %esi 775: 53 push %ebx 776: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 779: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 77c: 8b 15 80 0b 00 00 mov 0xb80,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 782: 8d 78 07 lea 0x7(%eax),%edi 785: c1 ef 03 shr $0x3,%edi 788: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 78b: 85 d2 test %edx,%edx 78d: 0f 84 a3 00 00 00 je 836 <malloc+0xc6> 793: 8b 02 mov (%edx),%eax 795: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 798: 39 cf cmp %ecx,%edi 79a: 76 74 jbe 810 <malloc+0xa0> 79c: 81 ff 00 10 00 00 cmp $0x1000,%edi 7a2: be 00 10 00 00 mov $0x1000,%esi 7a7: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 7ae: 0f 43 f7 cmovae %edi,%esi 7b1: ba 00 80 00 00 mov $0x8000,%edx 7b6: 81 ff ff 0f 00 00 cmp $0xfff,%edi 7bc: 0f 46 da cmovbe %edx,%ebx 7bf: eb 10 jmp 7d1 <malloc+0x61> 7c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 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){ 7c8: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 7ca: 8b 48 04 mov 0x4(%eax),%ecx 7cd: 39 cf cmp %ecx,%edi 7cf: 76 3f jbe 810 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 7d1: 39 05 80 0b 00 00 cmp %eax,0xb80 7d7: 89 c2 mov %eax,%edx 7d9: 75 ed jne 7c8 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 7db: 83 ec 0c sub $0xc,%esp 7de: 53 push %ebx 7df: e8 86 fc ff ff call 46a <sbrk> if(p == (char*)-1) 7e4: 83 c4 10 add $0x10,%esp 7e7: 83 f8 ff cmp $0xffffffff,%eax 7ea: 74 1c je 808 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 7ec: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 7ef: 83 ec 0c sub $0xc,%esp 7f2: 83 c0 08 add $0x8,%eax 7f5: 50 push %eax 7f6: e8 e5 fe ff ff call 6e0 <free> return freep; 7fb: 8b 15 80 0b 00 00 mov 0xb80,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 801: 83 c4 10 add $0x10,%esp 804: 85 d2 test %edx,%edx 806: 75 c0 jne 7c8 <malloc+0x58> return 0; 808: 31 c0 xor %eax,%eax 80a: eb 1c jmp 828 <malloc+0xb8> 80c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) 810: 39 cf cmp %ecx,%edi 812: 74 1c je 830 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 814: 29 f9 sub %edi,%ecx 816: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 819: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 81c: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 81f: 89 15 80 0b 00 00 mov %edx,0xb80 return (void*)(p + 1); 825: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 828: 8d 65 f4 lea -0xc(%ebp),%esp 82b: 5b pop %ebx 82c: 5e pop %esi 82d: 5f pop %edi 82e: 5d pop %ebp 82f: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 830: 8b 08 mov (%eax),%ecx 832: 89 0a mov %ecx,(%edx) 834: eb e9 jmp 81f <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 836: c7 05 80 0b 00 00 84 movl $0xb84,0xb80 83d: 0b 00 00 840: c7 05 84 0b 00 00 84 movl $0xb84,0xb84 847: 0b 00 00 base.s.size = 0; 84a: b8 84 0b 00 00 mov $0xb84,%eax 84f: c7 05 88 0b 00 00 00 movl $0x0,0xb88 856: 00 00 00 859: e9 3e ff ff ff jmp 79c <malloc+0x2c>
oeis/295/A295725.asm
neoneye/loda-programs
11
24725
; A295725: a(n) = a(n-1) + 3*a(n-2) -2*a(n-3) - 2*a(n-4), where a(0) = 0, a(1) = 0, a(2) = -1, a(3) = 1. ; Submitted by <NAME> ; 0,0,-1,1,-2,3,-3,8,-3,21,2,55,25,144,105,377,354,987,1085,2584,3157,6765,8898,17711,24561,46368,66833,121393,180034,317811,481461,832040,1280733,2178309,3393506,5702887,8965321,14930352,23633529,39088169,62197410,102334155,163482989,267914296,429300133,701408733,1126514562,1836311903,2954437857,4807526976,7745187617,12586269025,20297902210,32951280099,53182073445,86267571272,139315426989,225851433717,364898425250,591286729879,955648284217,1548008755920,2502583298313,4052739537881,6553175352546 lpb $0 sub $0,1 sub $3,$4 add $1,$3 sub $1,$2 add $4,1 add $4,$2 mov $5,$4 mov $4,$2 mov $2,$3 mul $2,2 add $4,$1 add $5,$4 mov $3,$5 add $4,2 lpe mov $0,$2 div $0,2
source/amf/uml/amf-uml-interface_realizations.ads
svn2github/matreshka
24
24556
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE 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 -- -- HOLDER 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. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- An interface realization is a specialized realization relationship between -- a classifier and an interface. This relationship signifies that the -- realizing classifier conforms to the contract specified by the interface. ------------------------------------------------------------------------------ limited with AMF.UML.Behaviored_Classifiers; limited with AMF.UML.Interfaces; with AMF.UML.Realizations; package AMF.UML.Interface_Realizations is pragma Preelaborate; type UML_Interface_Realization is limited interface and AMF.UML.Realizations.UML_Realization; type UML_Interface_Realization_Access is access all UML_Interface_Realization'Class; for UML_Interface_Realization_Access'Storage_Size use 0; not overriding function Get_Contract (Self : not null access constant UML_Interface_Realization) return AMF.UML.Interfaces.UML_Interface_Access is abstract; -- Getter of InterfaceRealization::contract. -- -- References the Interface specifying the conformance contract. not overriding procedure Set_Contract (Self : not null access UML_Interface_Realization; To : AMF.UML.Interfaces.UML_Interface_Access) is abstract; -- Setter of InterfaceRealization::contract. -- -- References the Interface specifying the conformance contract. not overriding function Get_Implementing_Classifier (Self : not null access constant UML_Interface_Realization) return AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access is abstract; -- Getter of InterfaceRealization::implementingClassifier. -- -- References the BehavioredClassifier that owns this Interfacerealization -- (i.e., the classifier that realizes the Interface to which it points). not overriding procedure Set_Implementing_Classifier (Self : not null access UML_Interface_Realization; To : AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access) is abstract; -- Setter of InterfaceRealization::implementingClassifier. -- -- References the BehavioredClassifier that owns this Interfacerealization -- (i.e., the classifier that realizes the Interface to which it points). end AMF.UML.Interface_Realizations;
src/test/resources/data/potests/test43.asm
cpcitor/mdlz80optimizer
36
81302
; test to check potential optimizations EXPTBL: equ $fcc1 org $4000 ld hl, EXPTBL inc l inc l inc l inc l ld a, (hl) push af inc sp inc l ld (hl), a ld hl, 0 ld a,1 ret
Cubical/Algebra/NatSolver/Solver.agda
FernandoLarrain/cubical
1
853
<filename>Cubical/Algebra/NatSolver/Solver.agda {-# OPTIONS --safe #-} module Cubical.Algebra.NatSolver.Solver where open import Cubical.Foundations.Prelude open import Cubical.Data.FinData open import Cubical.Data.Nat open import Cubical.Data.Nat.Order using (zero-≤) open import Cubical.Data.Vec.Base open import Cubical.Algebra.NatSolver.NatExpression open import Cubical.Algebra.NatSolver.HornerForms open import Cubical.Algebra.NatSolver.EvalHom private variable ℓ : Level module EqualityToNormalform where open Eval open IteratedHornerOperations open HomomorphismProperties normalize : {n : ℕ} → Expr n → IteratedHornerForms n normalize {n = n} (K r) = Constant n r normalize {n = n} (∣ k) = Variable n k normalize (x +' y) = (normalize x) +ₕ (normalize y) normalize (x ·' y) = (normalize x) ·ₕ (normalize y) isEqualToNormalform : {n : ℕ} (e : Expr n) (xs : Vec ℕ n) → eval (normalize e) xs ≡ ⟦ e ⟧ xs isEqualToNormalform (K r) [] = refl isEqualToNormalform {n = ℕ.suc n} (K r) (x ∷ xs) = eval (Constant (ℕ.suc n) r) (x ∷ xs) ≡⟨ refl ⟩ eval (0ₕ ·X+ Constant n r) (x ∷ xs) ≡⟨ refl ⟩ eval 0ₕ (x ∷ xs) · x + eval (Constant n r) xs ≡⟨ cong (λ u → u · x + eval (Constant n r) xs) (eval0H (x ∷ xs)) ⟩ 0 · x + eval (Constant n r) xs ≡⟨ refl ⟩ eval (Constant n r) xs ≡⟨ isEqualToNormalform (K r) xs ⟩ r ∎ isEqualToNormalform (∣ zero) (x ∷ xs) = eval (1ₕ ·X+ 0ₕ) (x ∷ xs) ≡⟨ refl ⟩ eval 1ₕ (x ∷ xs) · x + eval 0ₕ xs ≡⟨ cong (λ u → u · x + eval 0ₕ xs) (eval1ₕ (x ∷ xs)) ⟩ 1 · x + eval 0ₕ xs ≡⟨ cong (λ u → 1 · x + u ) (eval0H xs) ⟩ 1 · x + 0 ≡⟨ +-zero _ ⟩ 1 · x ≡⟨ ·-identityˡ _ ⟩ x ∎ isEqualToNormalform {n = ℕ.suc n} (∣ (suc k)) (x ∷ xs) = eval (0ₕ ·X+ Variable n k) (x ∷ xs) ≡⟨ refl ⟩ eval 0ₕ (x ∷ xs) · x + eval (Variable n k) xs ≡⟨ cong (λ u → u · x + eval (Variable n k) xs) (eval0H (x ∷ xs)) ⟩ 0 · x + eval (Variable n k) xs ≡⟨ refl ⟩ eval (Variable n k) xs ≡⟨ isEqualToNormalform (∣ k) xs ⟩ ⟦ ∣ (suc k) ⟧ (x ∷ xs) ∎ isEqualToNormalform (e +' e₁) [] = eval (normalize e +ₕ normalize e₁) [] ≡⟨ +Homeval (normalize e) _ [] ⟩ eval (normalize e) [] + eval (normalize e₁) [] ≡⟨ cong (λ u → u + eval (normalize e₁) []) (isEqualToNormalform e []) ⟩ ⟦ e ⟧ [] + eval (normalize e₁) [] ≡⟨ cong (λ u → ⟦ e ⟧ [] + u) (isEqualToNormalform e₁ []) ⟩ ⟦ e ⟧ [] + ⟦ e₁ ⟧ [] ∎ isEqualToNormalform (e +' e₁) (x ∷ xs) = eval (normalize e +ₕ normalize e₁) (x ∷ xs) ≡⟨ +Homeval (normalize e) _ (x ∷ xs) ⟩ eval (normalize e) (x ∷ xs) + eval (normalize e₁) (x ∷ xs) ≡⟨ cong (λ u → u + eval (normalize e₁) (x ∷ xs)) (isEqualToNormalform e (x ∷ xs)) ⟩ ⟦ e ⟧ (x ∷ xs) + eval (normalize e₁) (x ∷ xs) ≡⟨ cong (λ u → ⟦ e ⟧ (x ∷ xs) + u) (isEqualToNormalform e₁ (x ∷ xs)) ⟩ ⟦ e ⟧ (x ∷ xs) + ⟦ e₁ ⟧ (x ∷ xs) ∎ isEqualToNormalform (e ·' e₁) [] = eval (normalize e ·ₕ normalize e₁) [] ≡⟨ ·Homeval (normalize e) _ [] ⟩ eval (normalize e) [] · eval (normalize e₁) [] ≡⟨ cong (λ u → u · eval (normalize e₁) []) (isEqualToNormalform e []) ⟩ ⟦ e ⟧ [] · eval (normalize e₁) [] ≡⟨ cong (λ u → ⟦ e ⟧ [] · u) (isEqualToNormalform e₁ []) ⟩ ⟦ e ⟧ [] · ⟦ e₁ ⟧ [] ∎ isEqualToNormalform (e ·' e₁) (x ∷ xs) = eval (normalize e ·ₕ normalize e₁) (x ∷ xs) ≡⟨ ·Homeval (normalize e) _ (x ∷ xs) ⟩ eval (normalize e) (x ∷ xs) · eval (normalize e₁) (x ∷ xs) ≡⟨ cong (λ u → u · eval (normalize e₁) (x ∷ xs)) (isEqualToNormalform e (x ∷ xs)) ⟩ ⟦ e ⟧ (x ∷ xs) · eval (normalize e₁) (x ∷ xs) ≡⟨ cong (λ u → ⟦ e ⟧ (x ∷ xs) · u) (isEqualToNormalform e₁ (x ∷ xs)) ⟩ ⟦ e ⟧ (x ∷ xs) · ⟦ e₁ ⟧ (x ∷ xs) ∎ solve : {n : ℕ} (e₁ e₂ : Expr n) (xs : Vec ℕ n) (p : eval (normalize e₁) xs ≡ eval (normalize e₂) xs) → ⟦ e₁ ⟧ xs ≡ ⟦ e₂ ⟧ xs solve e₁ e₂ xs p = ⟦ e₁ ⟧ xs ≡⟨ sym (isEqualToNormalform e₁ xs) ⟩ eval (normalize e₁) xs ≡⟨ p ⟩ eval (normalize e₂) xs ≡⟨ isEqualToNormalform e₂ xs ⟩ ⟦ e₂ ⟧ xs ∎
Cubical/Homotopy/Loopspace.agda
rnarkk/cubical
0
16277
<reponame>rnarkk/cubical {-# OPTIONS --safe #-} module Cubical.Homotopy.Loopspace where open import Cubical.Core.Everything open import Cubical.Data.Nat open import Cubical.Foundations.Prelude open import Cubical.Foundations.Pointed open import Cubical.Foundations.HLevels open import Cubical.Foundations.GroupoidLaws open import Cubical.HITs.SetTruncation open import Cubical.HITs.Truncation hiding (elim2) renaming (rec to trRec) open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Transport open import Cubical.Foundations.Equiv.HalfAdjoint open import Cubical.Foundations.Function open import Cubical.Foundations.Path open import Cubical.Foundations.Equiv.HalfAdjoint open import Cubical.Foundations.Equiv open import Cubical.Functions.Morphism open import Cubical.Data.Sigma open Iso {- loop space of a pointed type -} Ω : {ℓ : Level} → Pointed ℓ → Pointed ℓ Ω (_ , a) = ((a ≡ a) , refl) {- n-fold loop space of a pointed type -} Ω^_ : ∀ {ℓ} → ℕ → Pointed ℓ → Pointed ℓ (Ω^ 0) p = p (Ω^ (suc n)) p = Ω ((Ω^ n) p) {- loop space map -} Ω→ : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Pointed ℓ'} → (A →∙ B) → (Ω A →∙ Ω B) fst (Ω→ {A = A} {B = B} (f , p)) q = sym p ∙∙ cong f q ∙∙ p snd (Ω→ {A = A} {B = B} (f , p)) = ∙∙lCancel p Ω^→ : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Pointed ℓ'} (n : ℕ) → (A →∙ B) → ((Ω^ n) A →∙ (Ω^ n) B) Ω^→ zero f = f Ω^→ (suc n) f = Ω→ (Ω^→ n f) {- loop space map functoriality (missing pointedness proof) -} Ω→∘ : ∀ {ℓ ℓ' ℓ''} {A : Pointed ℓ} {B : Pointed ℓ'} {C : Pointed ℓ''} (g : B →∙ C) (f : A →∙ B) → ∀ p → Ω→ (g ∘∙ f) .fst p ≡ (Ω→ g ∘∙ Ω→ f) .fst p Ω→∘ g f p k i = hcomp (λ j → λ { (i = i0) → compPath-filler' (cong (g .fst) (f .snd)) (g .snd) (~ k) j ; (i = i1) → compPath-filler' (cong (g .fst) (f .snd)) (g .snd) (~ k) j }) (g .fst (doubleCompPath-filler (sym (f .snd)) (cong (f .fst) p) (f .snd) k i)) {- Ω→ is a homomorphism -} Ω→pres∙ : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Pointed ℓ'} (f : A →∙ B) → (p q : typ (Ω A)) → fst (Ω→ f) (p ∙ q) ≡ fst (Ω→ f) p ∙ fst (Ω→ f) q Ω→pres∙ f p q i j = hcomp (λ k → λ { (i = i1) → (doubleCompPath-filler (sym (snd f)) (cong (fst f) p) (snd f) k ∙ doubleCompPath-filler (sym (snd f)) (cong (fst f) q) (snd f) k) j ; (j = i0) → snd f k ; (j = i1) → snd f k}) (cong-∙ (fst f) p q i j) isEquivΩ→ : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Pointed ℓ'} → (f : (A →∙ B)) → isEquiv (fst f) → isEquiv (Ω→ f .fst) isEquivΩ→ {B = (B , b)} = uncurry λ f → J (λ b y → isEquiv f → isEquiv (λ q → (λ i → y (~ i)) ∙∙ (λ i → f (q i)) ∙∙ y)) λ eqf → subst isEquiv (funExt (rUnit ∘ cong f)) (isoToIsEquiv (congIso (equivToIso (f , eqf)))) ΩfunExtIso : ∀ {ℓ ℓ'} (A : Pointed ℓ) (B : Pointed ℓ') → Iso (typ (Ω (A →∙ B ∙))) (A →∙ Ω B) fst (fun (ΩfunExtIso A B) p) x = funExt⁻ (cong fst p) x snd (fun (ΩfunExtIso A B) p) i j = snd (p j) i fst (inv (ΩfunExtIso A B) (f , p) i) x = f x i snd (inv (ΩfunExtIso A B) (f , p) i) j = p j i rightInv (ΩfunExtIso A B) _ = refl leftInv (ΩfunExtIso A B) _ = refl {- Commutativity of loop spaces -} isComm∙ : ∀ {ℓ} (A : Pointed ℓ) → Type ℓ isComm∙ A = (p q : typ (Ω A)) → p ∙ q ≡ q ∙ p private mainPath : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → (α β : typ ((Ω^ (2 + n)) A)) → (λ i → α i ∙ refl) ∙ (λ i → refl ∙ β i) ≡ (λ i → refl ∙ β i) ∙ (λ i → α i ∙ refl) mainPath n α β i = (λ j → α (j ∧ ~ i) ∙ β (j ∧ i)) ∙ λ j → α (~ i ∨ j) ∙ β (i ∨ j) EH-filler : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → typ ((Ω^ (2 + n)) A) → typ ((Ω^ (2 + n)) A) → I → I → I → _ EH-filler {A = A} n α β i j z = hfill (λ k → λ { (i = i0) → ((cong (λ x → rUnit x (~ k)) α) ∙ cong (λ x → lUnit x (~ k)) β) j ; (i = i1) → ((cong (λ x → lUnit x (~ k)) β) ∙ cong (λ x → rUnit x (~ k)) α) j ; (j = i0) → rUnit refl (~ k) ; (j = i1) → rUnit refl (~ k)}) (inS (mainPath n α β i j)) z {- Eckmann-Hilton -} EH : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → isComm∙ ((Ω^ (suc n)) A) EH {A = A} n α β i j = EH-filler n α β i j i1 {- Lemmas for the syllepsis : EH α β ≡ (EH β α) ⁻¹ -} EH-refl-refl : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → EH {A = A} n refl refl ≡ refl EH-refl-refl {A = A} n k i j = hcomp (λ r → λ { (k = i1) → (refl ∙ (λ _ → basep)) j ; (j = i0) → rUnit basep (~ r ∧ ~ k) ; (j = i1) → rUnit basep (~ r ∧ ~ k) ; (i = i0) → (refl ∙ (λ _ → lUnit basep (~ r ∧ ~ k))) j ; (i = i1) → (refl ∙ (λ _ → lUnit basep (~ r ∧ ~ k))) j}) (((cong (λ x → rUnit x (~ k)) (λ _ → basep)) ∙ cong (λ x → lUnit x (~ k)) (λ _ → basep)) j) where basep = snd (Ω ((Ω^ n) A)) {- Generalisations of EH α β when α or β is refl -} EH-gen-l : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → {x y : typ ((Ω^ (suc n)) A)} (α : x ≡ y) → α ∙ refl ≡ refl ∙ α EH-gen-l {ℓ = ℓ} {A = A} n {x = x} {y = y} α i j z = hcomp (λ k → λ { (i = i0) → ((cong (λ x → rUnit x (~ k)) α) ∙ refl) j z ; (i = i1) → (refl ∙ cong (λ x → rUnit x (~ k)) α) j z ; (j = i0) → rUnit (refl {x = x z}) (~ k) z ; (j = i1) → rUnit (refl {x = y z}) (~ k) z ; (z = i0) → x i1 ; (z = i1) → y i1}) (((λ j → α (j ∧ ~ i) ∙ refl) ∙ λ j → α (~ i ∨ j) ∙ refl) j z) EH-gen-r : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → {x y : typ ((Ω^ (suc n)) A)} (β : x ≡ y) → refl ∙ β ≡ β ∙ refl EH-gen-r {A = A} n {x = x} {y = y} β i j z = hcomp (λ k → λ { (i = i0) → (refl ∙ cong (λ x → lUnit x (~ k)) β) j z ; (i = i1) → ((cong (λ x → lUnit x (~ k)) β) ∙ refl) j z ; (j = i0) → lUnit (λ k → x (k ∧ z)) (~ k) z ; (j = i1) → lUnit (λ k → y (k ∧ z)) (~ k) z ; (z = i0) → x i1 ; (z = i1) → y i1}) (((λ j → refl ∙ β (j ∧ i)) ∙ λ j → refl ∙ β (i ∨ j)) j z) {- characterisations of EH α β when α or β is refl -} EH-α-refl : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → (α : typ ((Ω^ (2 + n)) A)) → EH n α refl ≡ sym (rUnit α) ∙ lUnit α EH-α-refl {A = A} n α i j k = hcomp (λ r → λ { (i = i0) → EH-gen-l n (λ i → α (i ∧ r)) j k ; (i = i1) → (sym (rUnit λ i → α (i ∧ r)) ∙ lUnit λ i → α (i ∧ r)) j k ; (j = i0) → ((λ i → α (i ∧ r)) ∙ refl) k ; (j = i1) → (refl ∙ (λ i → α (i ∧ r))) k ; (k = i0) → refl ; (k = i1) → α r}) ((EH-refl-refl n ∙ sym (lCancel (rUnit refl))) i j k) EH-refl-β : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → (β : typ ((Ω^ (2 + n)) A)) → EH n refl β ≡ sym (lUnit β) ∙ rUnit β EH-refl-β {A = A} n β i j k = hcomp (λ r → λ { (i = i0) → EH-gen-r n (λ i → β (i ∧ r)) j k ; (i = i1) → (sym (lUnit λ i → β (i ∧ r)) ∙ rUnit λ i → β (i ∧ r)) j k ; (j = i0) → (refl ∙ (λ i → β (i ∧ r))) k ; (j = i1) → ((λ i → β (i ∧ r)) ∙ refl) k ; (k = i0) → refl ; (k = i1) → β r}) ((EH-refl-refl n ∙ sym (lCancel (rUnit refl))) i j k) syllepsis : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) (α β : typ ((Ω^ 3) A)) → EH 0 α β ≡ sym (EH 0 β α) syllepsis {A = A} n α β k i j = hcomp (λ r → λ { (i = i0) → i=i0 r j k ; (i = i1) → i=i1 r j k ; (j = i0) → j-filler r j k ; (j = i1) → j-filler r j k ; (k = i0) → EH-filler 1 α β i j r ; (k = i1) → EH-filler 1 β α (~ i) j r}) (btm-filler (~ k) i j) where guy = snd (Ω (Ω A)) btm-filler : I → I → I → typ (Ω (Ω A)) btm-filler j i k = hcomp (λ r → λ {(j = i0) → mainPath 1 β α (~ i) k ; (j = i1) → mainPath 1 α β i k ; (i = i0) → (cong (λ x → EH-α-refl 0 x r (~ j)) α ∙ cong (λ x → EH-refl-β 0 x r (~ j)) β) k ; (i = i1) → (cong (λ x → EH-refl-β 0 x r (~ j)) β ∙ cong (λ x → EH-α-refl 0 x r (~ j)) α) k ; (k = i0) → EH-α-refl 0 guy r (~ j) ; (k = i1) → EH-α-refl 0 guy r (~ j)}) (((λ l → EH 0 (α (l ∧ ~ i)) (β (l ∧ i)) (~ j)) ∙ λ l → EH 0 (α (l ∨ ~ i)) (β (l ∨ i)) (~ j)) k) link : I → I → I → _ link z i j = hfill (λ k → λ { (i = i1) → refl ; (j = i0) → rUnit refl (~ i) ; (j = i1) → lUnit guy (~ i ∧ k)}) (inS (rUnit refl (~ i ∧ ~ j))) z i=i1 : I → I → I → typ (Ω (Ω A)) i=i1 r j k = hcomp (λ i → λ { (r = i0) → (cong (λ x → compPath-filler (sym (lUnit x)) (rUnit x) i k) β ∙ cong (λ x → compPath-filler (sym (rUnit x)) (lUnit x) i k) α) j ; (r = i1) → (β ∙ α) j ; (k = i0) → (cong (λ x → lUnit x (~ r)) β ∙ cong (λ x → rUnit x (~ r)) α) j ; (k = i1) → (cong (λ x → rUnit x (~ r ∧ i)) β ∙ cong (λ x → lUnit x (~ r ∧ i)) α) j ; (j = i0) → link i r k ; (j = i1) → link i r k}) (((cong (λ x → lUnit x (~ r ∧ ~ k)) β ∙ cong (λ x → rUnit x (~ r ∧ ~ k)) α)) j) i=i0 : I → I → I → typ (Ω (Ω A)) i=i0 r j k = hcomp (λ i → λ { (r = i0) → (cong (λ x → compPath-filler (sym (rUnit x)) (lUnit x) i k) α ∙ cong (λ x → compPath-filler (sym (lUnit x)) (rUnit x) i k) β) j ; (r = i1) → (α ∙ β) j ; (k = i0) → (cong (λ x → rUnit x (~ r)) α ∙ cong (λ x → lUnit x (~ r)) β) j ; (k = i1) → (cong (λ x → lUnit x (~ r ∧ i)) α ∙ cong (λ x → rUnit x (~ r ∧ i)) β) j ; (j = i0) → link i r k ; (j = i1) → link i r k}) ((cong (λ x → rUnit x (~ r ∧ ~ k)) α ∙ cong (λ x → lUnit x (~ r ∧ ~ k)) β) j) j-filler : I → I → I → typ (Ω (Ω A)) j-filler r i k = hcomp (λ j → λ { (i = i0) → link j r k ; (i = i1) → link j r k ; (r = i0) → compPath-filler (sym (rUnit guy)) (lUnit guy) j k ; (r = i1) → refl ; (k = i0) → rUnit guy (~ r) ; (k = i1) → rUnit guy (j ∧ ~ r)}) (rUnit guy (~ r ∧ ~ k)) ------ Ωⁿ⁺¹ A ≃ Ωⁿ(Ω A) ------ flipΩPath : {ℓ : Level} {A : Pointed ℓ} (n : ℕ) → ((Ω^ (suc n)) A) ≡ (Ω^ n) (Ω A) flipΩPath {A = A} zero = refl flipΩPath {A = A} (suc n) = cong Ω (flipΩPath {A = A} n) flipΩIso : {ℓ : Level} {A : Pointed ℓ} (n : ℕ) → Iso (fst ((Ω^ (suc n)) A)) (fst ((Ω^ n) (Ω A))) flipΩIso {A = A} n = pathToIso (cong fst (flipΩPath n)) flipΩIso⁻pres· : {ℓ : Level} {A : Pointed ℓ} (n : ℕ) → (f g : fst ((Ω^ (suc n)) (Ω A))) → inv (flipΩIso (suc n)) (f ∙ g) ≡ (inv (flipΩIso (suc n)) f) ∙ (inv (flipΩIso (suc n)) g) flipΩIso⁻pres· {A = A} n f g i = transp (λ j → flipΩPath {A = A} n (~ i ∧ ~ j) .snd ≡ flipΩPath n (~ i ∧ ~ j) .snd) i (transp (λ j → flipΩPath {A = A} n (~ i ∨ ~ j) .snd ≡ flipΩPath n (~ i ∨ ~ j) .snd) (~ i) f ∙ transp (λ j → flipΩPath {A = A} n (~ i ∨ ~ j) .snd ≡ flipΩPath n (~ i ∨ ~ j) .snd) (~ i) g) flipΩIsopres· : {ℓ : Level} {A : Pointed ℓ} (n : ℕ) → (f g : fst (Ω ((Ω^ (suc n)) A))) → fun (flipΩIso (suc n)) (f ∙ g) ≡ (fun (flipΩIso (suc n)) f) ∙ (fun (flipΩIso (suc n)) g) flipΩIsopres· n = morphLemmas.isMorphInv _∙_ _∙_ (inv (flipΩIso (suc n))) (flipΩIso⁻pres· n) (fun (flipΩIso (suc n))) (Iso.leftInv (flipΩIso (suc n))) (Iso.rightInv (flipΩIso (suc n))) flipΩrefl : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → fun (flipΩIso {A = A} (suc n)) refl ≡ refl flipΩrefl {A = A} n j = transp (λ i₁ → fst (Ω (flipΩPath {A = A} n ((i₁ ∨ j))))) j (snd (Ω (flipΩPath n j))) ---- Misc. ---- isCommA→isCommTrunc : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → isComm∙ A → isOfHLevel (suc n) (typ A) → isComm∙ (∥ typ A ∥ (suc n) , ∣ pt A ∣) isCommA→isCommTrunc {A = (A , a)} n comm hlev p q = ((λ i j → (leftInv (truncIdempotentIso (suc n) hlev) ((p ∙ q) j) (~ i))) ∙∙ (λ i → cong {B = λ _ → ∥ A ∥ (suc n) } (λ x → ∣ x ∣) (cong (trRec hlev (λ x → x)) (p ∙ q))) ∙∙ (λ i → cong {B = λ _ → ∥ A ∥ (suc n) } (λ x → ∣ x ∣) (congFunct {A = ∥ A ∥ (suc n)} {B = A} (trRec hlev (λ x → x)) p q i))) ∙ ((λ i → cong {B = λ _ → ∥ A ∥ (suc n) } (λ x → ∣ x ∣) (comm (cong (trRec hlev (λ x → x)) p) (cong (trRec hlev (λ x → x)) q) i)) ∙∙ (λ i → cong {B = λ _ → ∥ A ∥ (suc n) } (λ x → ∣ x ∣) (congFunct {A = ∥ A ∥ (suc n)} {B = A} (trRec hlev (λ x → x)) q p (~ i))) ∙∙ (λ i j → (leftInv (truncIdempotentIso (suc n) hlev) ((q ∙ p) j) i))) ptdIso→comm : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Type ℓ'} (e : Iso (typ A) B) → isComm∙ A → isComm∙ (B , fun e (pt A)) ptdIso→comm {A = (A , a)} {B = B} e comm p q = sym (rightInv (congIso e) (p ∙ q)) ∙∙ (cong (fun (congIso e)) ((invCongFunct e p q) ∙∙ (comm (inv (congIso e) p) (inv (congIso e) q)) ∙∙ (sym (invCongFunct e q p)))) ∙∙ rightInv (congIso e) (q ∙ p) {- Homotopy group version -} π-comp : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → ∥ typ ((Ω^ (suc n)) A) ∥₂ → ∥ typ ((Ω^ (suc n)) A) ∥₂ → ∥ typ ((Ω^ (suc n)) A) ∥₂ π-comp n = elim2 (λ _ _ → isSetSetTrunc) λ p q → ∣ p ∙ q ∣₂ EH-π : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) (p q : ∥ typ ((Ω^ (2 + n)) A) ∥₂) → π-comp (1 + n) p q ≡ π-comp (1 + n) q p EH-π n = elim2 (λ x y → isOfHLevelPath 2 isSetSetTrunc _ _) λ p q → cong ∣_∣₂ (EH n p q)
programs/oeis/298/A298360.asm
neoneye/loda
22
92467
<filename>programs/oeis/298/A298360.asm ; A298360: Numbers congruent to {3, 7, 13, 27} mod 30. ; 3,7,13,27,33,37,43,57,63,67,73,87,93,97,103,117,123,127,133,147,153,157,163,177,183,187,193,207,213,217,223,237,243,247,253,267,273,277,283,297,303,307,313,327,333,337,343,357,363,367,373,387,393,397,403 seq $0,112652 ; a(n) squared is congruent to a(n) (mod 12). seq $0,90771 ; Numbers that are congruent to {1, 9} mod 10. div $0,2 add $0,3
examples/tts_example_a.ads
rocher/TTS-Runtime-Ravenscar
2
3551
<reponame>rocher/TTS-Runtime-Ravenscar package TTS_Example_A is procedure Main; end TTS_Example_A;
runtime/ravenscar-sfp-stm32f427/bsp/setup_pll.adb
TUM-EI-RCS/StratoX
12
19608
<reponame>TUM-EI-RCS/StratoX ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- Copyright (C) 2012-2016, 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 3, 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. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ pragma Ada_2012; -- To work around pre-commit check? pragma Restrictions (No_Elaboration_Code); pragma Suppress (All_Checks); -- This initialization procedure mainly initializes the PLLs and -- all derived clocks. with Ada.Unchecked_Conversion; with Interfaces.Bit_Types; use Interfaces, Interfaces.Bit_Types; with Interfaces.STM32.FLASH; use Interfaces.STM32.FLASH; with Interfaces.STM32.PWR; use Interfaces.STM32.PWR; with Interfaces.STM32.RCC; use Interfaces.STM32.RCC; with System.BB.Parameters; use System.BB.Parameters; with System.BB.MCU_Parameters; with System.STM32; use System.STM32; procedure Setup_Pll is procedure Initialize_Clocks; procedure Reset_Clocks; ------------------------------ -- Clock Tree Configuration -- ------------------------------ HSE_Enabled : constant Boolean := True; -- use high-speed ext. clock HSE_Bypass : constant Boolean := False; -- don't bypass ext. resonator LSI_Enabled : constant Boolean := True; -- use low-speed internal clock Activate_PLL : constant Boolean := True; Activate_Overdrive : constant Boolean := True; Activate_PLLI2S : constant Boolean := False; pragma Assert ((if Activate_PLL then HSE_Enabled), "PLL only supported with external clock"); pragma Assert (not Activate_PLLI2S, "not yet implemented"); ----------------------- -- Initialize_Clocks -- ----------------------- procedure Initialize_Clocks is ------------------------------- -- Compute Clock Frequencies -- ------------------------------- PLLP_Value : constant PLLP_Range := 2; -- Arbitrary fixed to a convenient value PLLCLKIN : constant Integer := 1_000_000; PLLM_Value : constant Integer := HSE_Clock / PLLCLKIN; -- First divider M is set to produce a 1Mhz clock PLLN_Value : constant Integer := (PLLP_Value * Clock_Frequency) / PLLCLKIN; -- Compute N to to generate the required frequency PLLVC0 : constant Integer := PLLCLKIN * PLLN_Value; PLLCLKOUT : constant Integer := PLLVC0 / PLLP_Value; PLLQ_Value : constant PLLQ_Range := 7; -- Arbitrary fixed PLLM : constant UInt6 := UInt6 (PLLM_Value); PLLN : constant UInt9 := UInt9 (PLLN_Value); PLLP : constant UInt2 := UInt2 (PLLP_Value / 2 - 1); PLLQ : constant UInt4 := UInt4 (PLLQ_Value); SW : constant SYSCLK_Source := (if Activate_PLL then SYSCLK_SRC_PLL else (if HSE_Enabled then SYSCLK_SRC_HSE else SYSCLK_SRC_HSI)); SW_Value : constant CFGR_SW_Field := SYSCLK_Source'Enum_Rep (SW); SYSCLK : constant Integer := (if Activate_PLL then PLLCLKOUT else HSICLK); HCLK : constant Integer := (if not AHB_PRE.Enabled then SYSCLK else (case AHB_PRE.Value is when DIV2 => SYSCLK / 2, when DIV4 => SYSCLK / 4, when DIV8 => SYSCLK / 8, when DIV16 => SYSCLK / 16, when DIV64 => SYSCLK / 64, when DIV128 => SYSCLK / 128, when DIV256 => SYSCLK / 256, when DIV512 => SYSCLK / 512)); PCLK1 : constant Integer := (if not APB1_PRE.Enabled then HCLK else (case APB1_PRE.Value is when DIV2 => HCLK / 2, when DIV4 => HCLK / 4, when DIV8 => HCLK / 8, when DIV16 => HCLK / 16)); PCLK2 : constant Integer := (if not APB2_PRE.Enabled then HCLK else (case APB2_PRE.Value is when DIV2 => HCLK / 2, when DIV4 => HCLK / 4, when DIV8 => HCLK / 8, when DIV16 => HCLK / 16)); function To_AHB is new Ada.Unchecked_Conversion (AHB_Prescaler, UInt4); function To_APB is new Ada.Unchecked_Conversion (APB_Prescaler, UInt3); begin -- Check configuration pragma Warnings (Off, "condition is always False"); if PLLVC0 not in PLLVC0_Range or else PLLCLKOUT not in PLLOUT_Range then raise Program_Error with "Invalid clock configuration"; end if; if SYSCLK /= Clock_Frequency then raise Program_Error with "Cannot generate requested clock"; end if; if HCLK not in HCLK_Range or else PCLK1 not in PCLK1_Range or else PCLK2 not in PCLK2_Range then raise Program_Error with "Invalid AHB/APB prescalers configuration"; end if; pragma Warnings (On, "condition is always False"); -- PWR clock enable RCC_Periph.APB1ENR.PWREN := 1; -- Reset the power interface RCC_Periph.APB1RSTR.PWRRST := 1; RCC_Periph.APB1RSTR.PWRRST := 0; -- PWR initialization -- Select higher supply power for stable operation at max. freq. -- See table "General operating conditions" of the STM32 datasheets -- to obtain the maximal operating frequency depending on the power -- scaling mode and the over-drive mode System.BB.MCU_Parameters.PWR_Initialize; if not HSE_Enabled then -- Setup internal clock and wait for HSI stabilisation. RCC_Periph.CR.HSION := 1; loop exit when RCC_Periph.CR.HSIRDY = 1; end loop; else -- Configure high-speed external clock, if enabled RCC_Periph.CR.HSEON := 1; RCC_Periph.CR.HSEBYP := (if HSE_Bypass then 1 else 0); loop exit when RCC_Periph.CR.HSERDY = 1; end loop; end if; -- Configure low-speed internal clock if enabled if LSI_Enabled then RCC_Periph.CSR.LSION := 1; loop exit when RCC_Periph.CSR.LSIRDY = 1; end loop; end if; -- Activate PLL if enabled if Activate_PLL then -- Disable the main PLL before configuring it RCC_Periph.CR.PLLON := 0; -- Configure the PLL clock source, multiplication and division -- factors RCC_Periph.PLLCFGR := (PLLM => PLLM, PLLN => PLLN, PLLP => PLLP, PLLQ => PLLQ, PLLSRC => (if HSE_Enabled then PLL_Source'Enum_Rep (PLL_SRC_HSE) else PLL_Source'Enum_Rep (PLL_SRC_HSI)), others => <>); RCC_Periph.CR.PLLON := 1; loop exit when RCC_Periph.CR.PLLRDY = 1; end loop; end if; -- Configure OverDrive mode if Activate_Overdrive then System.BB.MCU_Parameters.PWR_Overdrive_Enable; end if; -- Configure flash -- Must be done before increasing the frequency, otherwise the CPU -- won't be able to fetch new instructions. FLASH_Periph.ACR.ICEN := 0; FLASH_Periph.ACR.DCEN := 0; FLASH_Periph.ACR.ICRST := 1; FLASH_Periph.ACR.DCRST := 1; FLASH_Periph.ACR := (LATENCY => 5, ICEN => 1, DCEN => 1, PRFTEN => 1, others => <>); -- Configure derived clocks RCC_Periph.CFGR := (SW => SW_Value, HPRE => To_AHB (AHB_PRE), PPRE => (As_Array => True, Arr => (1 => To_APB (APB1_PRE), 2 => To_APB (APB2_PRE))), RTCPRE => 16#0#, I2SSRC => I2S_Clock_Selection'Enum_Rep (I2SSEL_PLL), MCO1 => MC01_Clock_Selection'Enum_Rep (MC01SEL_HSI), MCO1PRE => MC0x_Prescaler'Enum_Rep (MC0xPRE_DIV1), MCO2 => MC02_Clock_Selection'Enum_Rep (MC02SEL_SYSCLK), MCO2PRE => MC0x_Prescaler'Enum_Rep (MC0xPRE_DIV5), others => <>); if Activate_PLL then loop exit when RCC_Periph.CFGR.SWS = SYSCLK_Source'Enum_Rep (SYSCLK_SRC_PLL); end loop; -- Wait until voltage supply scaling has completed loop exit when System.BB.MCU_Parameters.Is_PWR_Stabilized; end loop; end if; end Initialize_Clocks; ------------------ -- Reset_Clocks -- ------------------ procedure Reset_Clocks is begin -- Switch on high speed internal clock RCC_Periph.CR.HSION := 1; -- Reset CFGR regiser RCC_Periph.CFGR := (others => <>); -- Reset HSEON, CSSON and PLLON bits RCC_Periph.CR.HSEON := 0; RCC_Periph.CR.CSSON := 0; RCC_Periph.CR.PLLON := 0; -- Reset PLL configuration register RCC_Periph.PLLCFGR := (others => <>); -- Reset HSE bypass bit RCC_Periph.CR.HSEBYP := 0; -- Disable all interrupts RCC_Periph.CIR := (others => <>); end Reset_Clocks; begin Reset_Clocks; Initialize_Clocks; end Setup_Pll;
tests/exec/syracuse.adb
xuedong/mini-ada
0
22142
with Ada.Text_IO; use Ada.Text_IO; procedure Syracuse is procedure PrintInt(N: Integer) is C: Integer := N rem 10; begin if N > 9 then PrintInt(N / 10); end if; Put(Character'Val(48 + C)); end; procedure syracuse(max : integer) is i : integer; procedure length is v,j : integer; procedure step is begin v := v+1; if j = 2*(j/2) then j := j/2; else j := 3*j+1; end if; end; begin v := 0; j := i; while j /= 1 loop step; end loop; printint(v); New_Line; end; begin i := 1; while i <= max loop length; i := i+1; end loop; end; begin syracuse(10); end;
src/data/lib/prim/Agda/Builtin/Sigma.agda
bennn/agda
0
13974
{-# OPTIONS --without-K #-} module Agda.Builtin.Sigma where open import Agda.Primitive record Σ {a b} (A : Set a) (B : A → Set b) : Set (a ⊔ b) where constructor _,_ field fst : A snd : B fst open Σ public infixr 4 _,_ {-# BUILTIN SIGMA Σ #-}
grammar/WebIDLLexer.g4
raefko/idl2js
6
6804
<reponame>raefko/idl2js<filename>grammar/WebIDLLexer.g4 lexer grammar WebIDLLexer; channels { ERROR } WHITESPACE: [\t\n\r ]+ -> channel(HIDDEN); COMMENT: ('//'~[\n\r]*|'/*'(.|'\n')*?'*/')+ -> channel(HIDDEN); EQUAL_SYMBOL: '='; QUESTION_SYMBOL: '?'; LEFT_PAREN: '('; RIGHT_PAREN: ')'; LEFT_BRACKET: '['; RIGHT_BRACKET: ']'; LEFT_BRACE: '{'; RIGHT_BRACE: '}'; LEFT_ANGLE: '<'; RIGHT_ANGLE: '>'; COMMA: ','; SEMI: ';'; COLON: ':'; MINUS: '-'; ELLIPSIS: '...'; DOT: '.'; // Keywords ANY: 'any'; ASYNC: 'async'; ATTRIBUTE: 'attribute'; BOOLEAN: 'boolean'; BYTE: 'byte'; BYTE_STRING: 'ByteString'; CALLBACK: 'callback'; CONST: 'const'; CONSTRUCTOR: 'constructor'; DELETER: 'deleter'; DICTIONARY: 'dictionary'; DOM_STRING: 'DOMString'; DOUBLE: 'double'; ENUM: 'enum'; FALSE: 'false'; FLOAT: 'float'; FROZEN_ARRAY: 'FrozenArray'; GETTER: 'getter'; INFINITY: 'Infinity'; INCLUDES: 'includes'; INHERIT: 'inherit'; INTERFACE: 'interface'; ITERABLE: 'iterable'; LONG: 'long'; MAPLIKE: 'maplike'; MINUS_INFINITY: '-Infinity'; MIXIN: 'mixin'; NAMESPACE: 'namespace'; NAN: 'NaN'; NULL: 'null'; OBJECT: 'object'; OBSERVABLE_ARRAY: 'ObservableArray'; OCTET: 'octet'; OPTIONAL: 'optional'; OR: 'or'; PARTIAL: 'partial'; PROMISE: 'Promise'; READONLY: 'readonly'; RECORD: 'record'; REQUIRED: 'required'; SEQUENCE: 'sequence'; SETLIKE: 'setlike'; SETTER: 'setter'; SHORT: 'short'; STATIC: 'static'; STRINGIFIER: 'stringifier'; SYMBOL: 'symbol'; TRUE: 'true'; TYPEDEF: 'typedef'; UNRESTRICTED: 'unrestricted'; UNSIGNED: 'unsigned'; USV_STRING: 'USVString'; VOID: 'void'; // bufferRelatedType ARRAY_BUFFER: 'ArrayBuffer'; DATA_VIEW: 'DataView'; INT_8_ARRAY: 'Int8Array'; INT_16_ARRAY: 'Int16Array'; INT_32_ARRAY: 'Int32Array'; UINT_8_ARRAY: 'Uint8Array'; UINT_16_ARRAY: 'Uint16Array'; UINT_32_ARRAY: 'Uint32Array'; UINT_8_CLAMPED_ARRAY: 'Uint8ClampedArray'; FLOAT_32_ARRAY: 'Float32Array'; FLOAT_64_ARRAY: 'Float64Array'; IntegerLiteral : '-'? HexIntegerLiteral | '-'? OctalIntegerLiteral | '-'? DecimalIntegerLiteral ; DecimalLiteral : '-'? [0-9]+ '.' [0-9]* ExponentPart? | '-'? '.' [0-9]+ ExponentPart? | '-'? [0-9]+ ExponentPart ; StringLiteral: '"' DoubleStringCharacter* '"'; HexIntegerLiteral: '0' [xX] HexDigit+; OctalIntegerLiteral: '0' [0-7]+; DecimalIntegerLiteral : '0' | [1-9] [0-9]* ; IDENTIFIER : [_-]?[A-Za-z][0-9A-Z_a-z-]* ; OTHER : ~[\t\n\r 0-9A-Z_a-z] ; // Fragment rules fragment DoubleStringCharacter : ~["\\\r\n] ; fragment HexDigit : [0-9a-fA-F] ; fragment ExponentPart : [eE] [+-]? [0-9]+ ;
programs/oeis/255/A255744.asm
jmorken/loda
1
98979
; A255744: a(1) = 1; for n > 1, a(n) = 10*9^(A000120(n-1)-1). ; 1,10,10,90,10,90,90,810,10,90,90,810,90,810,810,7290,10,90,90,810,90,810,810,7290,90,810,810,7290,810,7290,7290,65610,10,90,90,810,90,810,810,7290,90,810,810,7290,810,7290,7290,65610,90,810,810,7290,810,7290,7290,65610,810,7290,7290,65610,7290,65610,65610,590490,10,90,90,810,90,810,810,7290,90,810,810,7290,810,7290,7290,65610,90,810,810,7290,810,7290,7290,65610,810,7290,7290,65610,7290,65610,65610,590490,90,810,810,7290,810,7290,7290,65610,810,7290,7290,65610,7290,65610,65610,590490,810,7290,7290,65610,7290,65610,65610,590490,7290,65610,65610,590490,65610,590490,590490,5314410,10,90,90,810,90,810,810,7290,90,810,810,7290,810,7290,7290,65610,90,810,810,7290,810,7290,7290,65610,810,7290,7290,65610,7290,65610,65610,590490,90,810,810,7290,810,7290,7290,65610,810,7290,7290,65610,7290,65610,65610,590490,810,7290,7290,65610,7290,65610,65610,590490,7290,65610,65610,590490,65610,590490,590490,5314410,90,810,810,7290,810,7290,7290,65610,810,7290,7290,65610,7290,65610,65610,590490,810,7290,7290,65610,7290,65610,65610,590490,7290,65610,65610,590490,65610,590490,590490,5314410,810,7290,7290,65610,7290,65610,65610,590490,7290,65610,65610,590490,65610,590490,590490,5314410,7290,65610,65610,590490,65610,590490,590490,5314410,65610,590490 mov $8,$0 mov $10,2 lpb $10 clr $0,8 mov $0,$8 sub $10,1 add $0,$10 sub $0,1 mov $5,$0 mov $7,$0 lpb $7 mov $0,$5 sub $7,1 sub $0,$7 mul $0,2 mov $3,$0 lpb $0 div $3,2 sub $0,$3 mov $4,9 lpe pow $4,$0 add $6,$4 lpe mov $1,$6 div $1,9 mul $1,10 add $1,1 mov $11,$10 lpb $11 mov $9,$1 sub $11,1 lpe lpe lpb $8 mov $8,0 sub $9,$1 lpe mov $1,$9
oeis/106/A106270.asm
neoneye/loda-programs
11
520
<reponame>neoneye/loda-programs ; A106270: Inverse of number triangle A106268; triangle T(n,k), 0 <= k <= n. ; Submitted by <NAME>(w1) ; 1,-1,1,-2,-1,1,-5,-2,-1,1,-14,-5,-2,-1,1,-42,-14,-5,-2,-1,1,-132,-42,-14,-5,-2,-1,1,-429,-132,-42,-14,-5,-2,-1,1,-1430,-429,-132,-42,-14,-5,-2,-1,1,-4862,-1430,-429,-132,-42,-14,-5,-2,-1,1,-16796,-4862,-1430,-429,-132,-42,-14,-5,-2,-1,1,-58786,-16796 lpb $0 add $1,1 sub $0,$1 mov $2,$1 sub $2,$0 lpe mov $0,2 mul $0,$2 bin $0,$2 cmp $1,0 bin $1,$2 mul $1,2 sub $1,1 add $2,1 div $0,$2 mul $1,$0 mov $0,$1
programs/oeis/157/A157786.asm
karttu/loda
1
104462
; A157786: a(n) = 27225*n^2 - 15248*n + 2135. ; 14112,80539,201416,376743,606520,890747,1229424,1622551,2070128,2572155,3128632,3739559,4404936,5124763,5899040,6727767,7610944,8548571,9540648,10587175,11688152,12843579,14053456,15317783,16636560,18009787,19437464,20919591,22456168,24047195,25692672,27392599,29146976,30955803,32819080,34736807,36708984,38735611,40816688,42952215,45142192,47386619,49685496,52038823,54446600,56908827,59425504,61996631,64622208,67302235,70036712,72825639,75669016,78566843,81519120,84525847,87587024,90702651,93872728,97097255,100376232,103709659,107097536,110539863,114036640,117587867,121193544,124853671,128568248,132337275,136160752,140038679,143971056,147957883,151999160,156094887,160245064,164449691,168708768,173022295,177390272,181812699,186289576,190820903,195406680,200046907,204741584,209490711,214294288,219152315,224064792,229031719,234053096,239128923,244259200,249443927,254683104,259976731,265324808,270727335,276184312,281695739,287261616,292881943,298556720,304285947,310069624,315907751,321800328,327747355,333748832,339804759,345915136,352079963,358299240,364572967,370901144,377283771,383720848,390212375,396758352,403358779,410013656,416722983,423486760,430304987,437177664,444104791,451086368,458122395,465212872,472357799,479557176,486811003,494119280,501482007,508899184,516370811,523896888,531477415,539112392,546801819,554545696,562344023,570196800,578104027,586065704,594081831,602152408,610277435,618456912,626690839,634979216,643322043,651719320,660171047,668677224,677237851,685852928,694522455,703246432,712024859,720857736,729745063,738686840,747683067,756733744,765838871,774998448,784212475,793480952,802803879,812181256,821613083,831099360,840640087,850235264,859884891,869588968,879347495,889160472,899027899,908949776,918926103,928956880,939042107,949181784,959375911,969624488,979927515,990284992,1000696919,1011163296,1021684123,1032259400,1042889127,1053573304,1064311931,1075105008,1085952535,1096854512,1107810939,1118821816,1129887143,1141006920,1152181147,1163409824,1174692951,1186030528,1197422555,1208869032,1220369959,1231925336,1243535163,1255199440,1266918167,1278691344,1290518971,1302401048,1314337575,1326328552,1338373979,1350473856,1362628183,1374836960,1387100187,1399417864,1411789991,1424216568,1436697595,1449233072,1461822999,1474467376,1487166203,1499919480,1512727207,1525589384,1538506011,1551477088,1564502615,1577582592,1590717019,1603905896,1617149223,1630447000,1643799227,1657205904,1670667031,1684182608,1697752635 cal $0,157787 ; 8984250n - 2515920. mov $1,$0 pow $1,2 sub $1,41839292988900 div $1,2964802500 add $1,14112
NULLTerminatingBytes/nullTerminatingBytes.asm
slowy07/learnAsm
1
14928
; compile ; nasm -f elf nullTerminatingBytes.asm ; link (64 bit system require elf_i386) ld -m elf_i386 nullTerminatingBytes.o -o nullTerminatingBytes %include 'function.asm' SECTION .data msg1 db 'this print will be output', 0Ah, 0h msg2 db 'this is how recycle in nasm', 0Ah. 0h SECTION .text global _start _start: mov eax, msg1 call sprint mov eax, msg2 call sprint call quit
Task/Knuths-algorithm-S/Ada/knuths-algorithm-s-3.ada
LaudateCorpus1/RosettaCodeData
1
20331
<reponame>LaudateCorpus1/RosettaCodeData<gh_stars>1-10 with S_Of_N_Creator, Ada.Text_IO; procedure Test_S_Of_N is Repetitions: constant Positive := 100_000; type D_10 is range 0 .. 9; -- the instantiation of the generic package S_Of_N_Creator generates -- a package with the desired functionality package S_Of_3 is new S_Of_N_Creator(Sample_Size => 3, Item_Type => D_10); Sample: S_Of_3.Item_Array; Result: array(D_10) of Natural := (others => 0); begin for J in 1 .. Repetitions loop -- get Sample for Dig in D_10 loop S_Of_3.Update(Dig); end loop; Sample := S_Of_3.Result; -- update current Result for Item in Sample'Range loop Result(Sample(Item)) := Result(Sample(Item)) + 1; end loop; end loop; -- finally: output Result for Dig in Result'Range loop Ada.Text_IO.Put(D_10'Image(Dig) & ":" & Natural'Image(Result(Dig)) & "; "); end loop; end Test_S_Of_N;
Task/Numeric-error-propagation/Ada/numeric-error-propagation-1.ada
LaudateCorpus1/RosettaCodeData
1
23217
generic type Real is digits <>; with function Sqrt(X: Real) return Real; with function "**"(X: Real; Y: Real) return Real; package Approximation is type Number is private; -- create an approximation function Approx(Value: Real; Sigma: Real) return Number; -- unary operations and conversion Real to Number function "+"(X: Real) return Number; function "-"(X: Real) return Number; function "+"(X: Number) return Number; function "-"(X: Number) return Number; -- addition / subtraction function "+"(X: Number; Y: Number) return Number; function "-"(X: Number; Y: Number) return Number; -- multiplication / division function "*"(X: Number; Y: Number) return Number; function "/"(X: Number; Y: Number) return Number; -- exponentiation function "**"(X: Number; Y: Positive) return Number; function "**"(X: Number; Y: Real) return Number; -- Output to Standard IO (wrapper for Ada.Text_IO and Ada.Text_IO.Float_IO) procedure Put_Line(Message: String; Item: Number; Value_Fore: Natural := 7; Sigma_Fore: Natural := 4; Aft: Natural := 2; Exp: Natural := 0); procedure Put(Item: Number; Value_Fore: Natural := 7; Sigma_Fore: Natural := 3; Aft: Natural := 2; Exp: Natural := 0); private type Number is record Value: Real; Sigma: Real; end record; end Approximation;
Chapter 3/3.1 - The IDT/bootloader/protected_mode/gdt.asm
gmarino2048/64bit-os-tutorial
87
84231
; ; Long Mode ; ; gdt.asm ; ; ; Define the Flat Mode Configuration Global Descriptor Table (GDT) ; The flat mode table allows us to read and write code anywhere, without restriction ; align 4 gdt_64_start: ; Define the null sector for the 64 bit gdt ; Null sector is required for memory integrity check gdt_64_null: dd 0x00000000 ; All values in null entry are 0 dd 0x00000000 ; All values in null entry are 0 ; Define the code sector for the 64 bit gdt gdt_64_code: ; Base: 0x00000 ; Limit: 0xFFFFF ; 1st Flags: 0b1001 ; Present: 1 ; Privelege: 00 ; Descriptor: 1 ; Type Flags: 0b1010 ; Code: 1 ; Conforming: 0 ; Readable: 1 ; Accessed: 0 ; 2nd Flags: 0b1100 ; Granularity: 1 ; 32-bit Default: 0 ; 64-bit Segment: 1 ; AVL: 0 dw 0xFFFF ; Limit (bits 0-15) dw 0x0000 ; Base (bits 0-15) db 0x00 ; Base (bits 16-23) db 0b10011010 ; 1st Flags, Type flags db 0b10101111 ; 2nd Flags, Limit (bits 16-19) db 0x00 ; Base (bits 24-31) ; Define the data sector for the 64 bit gdt gdt_64_data: ; Base: 0x00000 ; Limit: 0x00000 ; 1st Flags: 0b1001 ; Present: 1 ; Privelege: 00 ; Descriptor: 1 ; Type Flags: 0b0010 ; Code: 0 ; Expand Down: 0 ; Writeable: 1 ; Accessed: 0 ; 2nd Flags: 0b1100 ; Granularity: 1 ; 32-bit Default: 0 ; 64-bit Segment: 1 ; AVL: 0 dw 0x0000 ; Limit (bits 0-15) dw 0x0000 ; Base (bits 0-15) db 0x00 ; Base (bits 16-23) db 0b10010010 ; 1st Flags, Type flags db 0b10100000 ; 2nd Flags, Limit (bits 16-19) db 0x00 ; Base (bits 24-31) gdt_64_end: ; Define the gdt descriptor ; This data structure gives cpu length and start address of gdt ; We will feed this structure to the CPU in order to set the protected mode GDT gdt_64_descriptor: dw gdt_64_end - gdt_64_start - 1 ; Size of GDT, one byte less than true size dd gdt_64_start ; Start of the 64 bit gdt ; Define helpers to find pointers to Code and Data segments code_seg_64: equ gdt_64_code - gdt_64_start data_seg_64: equ gdt_64_data - gdt_64_start
Exemplos ADA/Fatorial/Fatorial.adb
wildeee/safADA
0
28387
With Ada.Text_IO; Use Ada.Text_IO; Procedure Fatorial is numero: Integer; fatorial: Integer := 1; -- Leitura String function Get_String return String is Line : String (1 .. 1_000); Last : Natural; begin Get_Line (Line, Last); return Line (1 .. Last); end Get_String; -- Leitura Integer function Get_Integer return Integer is S : constant String := Get_String; begin return Integer'Value (S); end Get_Integer; begin numero := Get_Integer; for I in Integer range 1 .. numero loop fatorial := fatorial * I; end loop; Put_Line(Integer'Image(fatorial)); end Fatorial;
programs/oeis/164/A164090.asm
neoneye/loda
22
103845
<filename>programs/oeis/164/A164090.asm ; A164090: a(n) = 2*a(n-2) for n > 2; a(1) = 2, a(2) = 3. ; 2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576,32768,49152,65536,98304,131072,196608,262144,393216,524288,786432,1048576,1572864,2097152,3145728,4194304,6291456,8388608,12582912,16777216,25165824,33554432,50331648,67108864,100663296,134217728,201326592,268435456,402653184,536870912,805306368,1073741824,1610612736,2147483648,3221225472,4294967296,6442450944,8589934592,12884901888,17179869184,25769803776,34359738368,51539607552,68719476736,103079215104,137438953472,206158430208,274877906944,412316860416,549755813888,824633720832,1099511627776,1649267441664,2199023255552,3298534883328,4398046511104,6597069766656,8796093022208,13194139533312,17592186044416,26388279066624,35184372088832,52776558133248,70368744177664,105553116266496,140737488355328,211106232532992,281474976710656,422212465065984,562949953421312,844424930131968,1125899906842624,1688849860263936 mov $1,$0 mod $0,2 lpb $1 mul $0,2 add $0,2 sub $1,2 lpe add $0,2
bits/src/shift/axiom/logic_left/bitoperations-shift-axiom-logic_left.adb
vasil-sd/ada-tlsf
3
7428
<reponame>vasil-sd/ada-tlsf<gh_stars>1-10 package body BitOperations.Shift.Axiom.Logic_Left with SPARK_Mode => Off is ----------------------------------------------------- -- Axiom_Shift_Left_Is_Eq_Multiplying_By_Power_Of2 -- ----------------------------------------------------- procedure Equal_Mult_By_Power_2 (Value : Modular; Amount : Natural) is null; end BitOperations.Shift.Axiom.Logic_Left;
oeis/133/A133443.asm
neoneye/loda-programs
11
84758
<reponame>neoneye/loda-programs<filename>oeis/133/A133443.asm ; A133443: a(n) = Sum_{k=0..n} C(n,floor(k/2))*(-1)^k*3^(n-k). ; Submitted by <NAME> ; 1,2,8,24,84,272,920,3040,10180,33840,112968,376224,1254696,4181088,13939248,46459584,154873860,516229040,1720795880,5735921440,19119861304,63732624672,212442552528,708140901184,2360471473384,7868234639072,26227455730640,87424838568000,291416155304400,971387130859200,3237957206275680,10793190480762240,35977302003261060,119924339209429680,399747798920503080,1332492659956868640,4441642205906319000,14805474007587549600,49351580048855341200,164505266782390785600,548350889366533637880 mov $2,$0 add $2,1 mov $4,$0 lpb $2 mov $0,$4 mul $1,3 sub $1,$3 sub $2,1 sub $0,$2 div $0,2 sub $0,$3 mov $3,$4 bin $3,$0 add $1,$3 lpe mov $0,$1
intro/intro.agda
KMx404/selfev.agda
2
10358
<reponame>KMx404/selfev.agda<filename>intro/intro.agda<gh_stars>1-10 -- Let's play with agda. -- Am i having fun doing this? @KMx404 module intro where --load the file with C-c - like that data Bool: Set where true : Bool false : Bool data Empty: Set Empty Empty : Empty -- I'm gonna leave this here. Moving to tests
gcc-gcc-7_3_0-release/gcc/ada/get_targ.ads
best08618/asylo
7
14034
<reponame>best08618/asylo<filename>gcc-gcc-7_3_0-release/gcc/ada/get_targ.ads ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G E T _ T A R G -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2014, 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 3, 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 COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides an Import to the C functions which provide -- values related to types on the target system. It is only needed for -- exp_dbug and the elaboration of ttypes, via the Set_Targs package. -- It also contains the routine for registering floating-point types. -- NOTE: Any changes in this package must be reflected in aa_getta.adb -- and any other version in the various back ends. -- Note that all these values return sizes of C types with corresponding -- names. This allows GNAT to define the corresponding Ada types to have -- the same representation. There is one exception to this general rule: -- the Wide_Character_Type uses twice the size of a C char, instead of the -- size of wchar_t. with Einfo; use Einfo; with Types; use Types; package Get_Targ is -- Functions returning individual runtime values function Get_Bits_Per_Unit return Pos; -- System.Storage_Unit function Get_Bits_Per_Word return Pos; -- System.Word_Size function Get_Char_Size return Pos; -- Size of Standard.Character function Get_Wchar_T_Size return Pos; -- Size of Interfaces.C.wchar_t function Get_Short_Size return Pos; -- Size of Standard.Short_Integer function Get_Int_Size return Pos; -- Size of Standard.Integer function Get_Long_Size return Pos; -- Size of Standard.Long_Integer function Get_Long_Long_Size return Pos; -- Size of Standard.Long_Long_Integer function Get_Pointer_Size return Pos; -- Size of System.Address function Get_Maximum_Alignment return Pos; -- Maximum supported alignment function Get_Float_Words_BE return Nat; -- Non-zero iff float words big endian function Get_Words_BE return Nat; -- Non-zero iff integer words big endian function Get_Bytes_BE return Nat; -- Non-zero iff bytes big-endian function Get_Bits_BE return Nat; -- Non-zero iff bit order big endian function Get_Strict_Alignment return Nat; -- Non-zero if target requires strict alignent function Get_System_Allocator_Alignment return Nat; -- Alignment guaranteed by malloc falls function Get_Double_Float_Alignment return Nat; -- Alignment required for Long_Float or 0 if no special requirement function Get_Double_Scalar_Alignment return Nat; -- Alignment required for Long_Long_Integer or larger integer types -- or 0 if no special requirement. function Get_Short_Enums return Int; -- Returns non-zero if we are in short enums mode, where foreign convention -- (in particular C and C++) enumeration types will be sized as in Ada, -- using the shortest possibility from 8,16,32 bits, signed or unsigned. -- A zero value means Short_Enums are not in use, and in this case all -- foreign convention enumeration types are given the same size as c int. -- Other subprograms function Get_Max_Unaligned_Field return Pos; -- Returns the maximum supported size in bits for a field that is -- not aligned on a storage unit boundary. function Width_From_Size (Size : Pos) return Pos; function Digits_From_Size (Size : Pos) return Pos; -- Calculate values for 'Width or 'Digits from 'Size type C_String is array (0 .. 255) of aliased Character; pragma Convention (C, C_String); type Register_Type_Proc is access procedure (C_Name : C_String; -- Nul-terminated string with name of type Digs : Natural; -- Digits for floating point, 0 otherwise Complex : Boolean; -- True iff type has real and imaginary parts Count : Natural; -- Number of elements in vector, 0 otherwise Float_Rep : Float_Rep_Kind; -- Representation used for fpt type Precision : Positive; -- Precision of representation in bits Size : Positive; -- Size of representation in bits Alignment : Natural); -- Required alignment in bits pragma Convention (C, Register_Type_Proc); -- Call back procedure for Register_Back_End_Types. This is to be used by -- Create_Standard to create predefined types for all types supported by -- the back end. procedure Register_Back_End_Types (Call_Back : Register_Type_Proc); -- Calls the Call_Back function with information for each supported type function Get_Back_End_Config_File return String_Ptr; -- Return the back end configuration file, or null if none. If non-null, -- this file should be used instead of calling the various Get_xxx -- functions in this package. end Get_Targ;
Soundness/agda/Prelude.agda
halfaya/Music
1
9199
{-# OPTIONS --without-K --safe --erased-cubical --no-import-sorts #-} module Prelude where open import Agda.Primitive renaming (Set to Type) public open import Agda.Builtin.Reflection hiding (Type) renaming (primQNameEquality to _==_) public open import Reflection using (_>>=_) public open import Agda.Builtin.String public open import Agda.Builtin.Sigma public open import Data.Bool using (Bool; not; true; false; if_then_else_) public open import Data.List using (List; []; _∷_; map; concat; concatMap; _++_; foldr; zip; length; take) public open import Data.Maybe using (Maybe; just; nothing) public open import Data.Fin.Base using (Fin; toℕ) renaming (zero to fz) public open import Data.Integer.Base using (ℤ; +_; -[1+_]) public open import Data.Nat.Base using (ℕ; zero; suc; _^_) public open import Data.Nat.DivMod using (_%_; _mod_) public open import Data.Product using (_×_; _,_) public open import Data.Unit using (⊤) public open import Data.Vec using (Vec; []; _∷_; updateAt) public open import Function using (id; _∘_; flip) public open import Definition.Conversion.Soundness public open import Interval public open import Note public open import Pitch using (Pitch; a; b; b♭; c; c♯; d; d♯; e; f; f♯; g; g♯) public open import Transformation public open import MidiEvent using (InstrumentNumber-1; maxChannels; MidiTrack) public open import FarmCanon using () renaming (subject to canonsubject) public open import FarmFugue using (b1; b2; b3; b4; b5; b6; b7; b8; b9; b10; b11; b12; b13; subject; countersubject; extra) public
src/Tactic/Reflection/Quote/Class.agda
L-TChen/agda-prelude
111
4365
<reponame>L-TChen/agda-prelude<gh_stars>100-1000 module Tactic.Reflection.Quote.Class where open import Builtin.Reflection record Quotable {a} (A : Set a) : Set a where field ` : A → Term open Quotable {{...}} public
src/kernel/entry.asm
martinszeltins/vertex
0
103603
; Some constants used for multiboot header ; No need to understand, they are just a bunch of flags and magic values for the bootloader to find and recognize it as a multibootkernel MBALIGN equ 1<<0 MEMINFO equ 1<<1 FLAGS equ MBALIGN | MEMINFO MAGIC equ 0x1BADB002 CHECKSUM equ -(MAGIC + FLAGS) ; Some constants for loading higher half kernel VM_BASE equ 0xC0000000 PDE_INDEX equ (VM_BASE >> 22) PSE_BIT equ 0x00000010 PG_BIT equ 0x80000000 section .multiboot align 4 dd MAGIC dd FLAGS dd CHECKSUM section .data align 4096 global TEMP_PAGE_DIRECTORY TEMP_PAGE_DIRECTORY: ; Map the first 4mb physical memory to first 4mb virtual memory. Otherwise, when paging is enabled, eip points to, 0x100004 for example, and MMU is not gonna know how to translate ; this address into phsyical mem address, because our PDE doesn't tell MMU how to find it. dd 0x00000083 times(PDE_INDEX - 1) dd 0 dd 0x00000083 times(1024 - PDE_INDEX - 1) dd 0 ; Our initial stack section .initial_stack, nobits align 4 stack_bottom: ; 1mb of uninitialized data(1024*1024=104856) resb 104856 stack_top: ; Kernel entry section .text global kernel_entry global low_kernel_entry low_kernel_entry equ (kernel_entry - VM_BASE) kernel_entry: ; update page directory address, since eax and ebx is in use, have to use ecx or other register mov ecx, (TEMP_PAGE_DIRECTORY - VM_BASE) mov cr3, ecx ; Enable 4mb pages mov ecx, cr4; or ecx, PSE_BIT mov cr4, ecx ; Set PG bit, enable paging mov ecx, cr0 or ecx, PG_BIT mov cr0, ecx ; Why not just jmp higher_half ? If you do that, that will be a relative jmp, so u r jumping to virtual memory around 0x100000, which is fine since we have identity mapped earlier ; but we also want to change the eip(now point to somewhere around 0x100000) to somewhere around 0xc0100000, so we need to get the absolute address of higher half into ecx, and jmp ecx lea ecx, [higher_half] jmp ecx higher_half: ; Unmap the first 4mb physical mem, because we don't need it anymore. Flush the tlb too mov dword[TEMP_PAGE_DIRECTORY], 0 invlpg[0] mov esp, stack_top extern kmain ; Upon entry to the os, the bootloader has put a pointer to multiboot information structure in ebx, we can pass it into our kmain(), but we may or may not need to use it push ebx ; When control is transfer to the c code, we can throw away the old pageing directory structure and use our own, remember to clear pse bit in cr4 though :) call kmain ; If kmain return, just keep looping... loop: jmp loop
libsrc/_DEVELOPMENT/l/sccz80/8-8080/l_div_u.asm
ahjelm/z88dk
640
176465
SECTION code_clib SECTION code_l_sccz80 PUBLIC l_div_u ; HL = DE / HL, DE = DE % HL l_div_u: LD bc,hl ; store divisor to bc LD hl,0 ; clear remainder XOR a ; clear carry LD a,17 ; load loop counter PUSH af ccduv1: LD a,e ; left shift dividend into carry RLA LD e,a LD a,d RLA LD d,a JP C,ccduv2 ; we have to keep carry -> calling else branch POP af ; decrement loop counter DEC a JP Z,ccduv5 PUSH af XOR a ; clear carry JP ccduv3 ccduv2: POP af ; decrement loop counter DEC a JP Z,ccduv5 PUSH af SCF ; set carry ccduv3: LD a,l ; left shift carry into remainder RLA LD l,a LD a,h RLA LD h,a LD a,l ; substract divisor from remainder sub c LD l,a LD a,h SBC b LD h,a JP NC,ccduv4 ; if result negative, add back divisor, clear carry LD a,l ; add back divisor ADD a,c LD l,a LD a,h ADC a,b LD h,a XOR a ; clear carry JP ccduv1 ccduv4: SCF ; set carry JP ccduv1 ccduv5: EX de,hl ret
Cubical/Algebra/Polynomials/Multivariate/EquivCarac/Polyn-nPoly.agda
guilhermehas/cubical
1
1388
<filename>Cubical/Algebra/Polynomials/Multivariate/EquivCarac/Polyn-nPoly.agda {-# OPTIONS --safe --experimental-lossy-unification #-} module Cubical.Algebra.Polynomials.Multivariate.EquivCarac.Polyn-nPoly where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Data.Nat renaming (_+_ to _+n_; _·_ to _·n_) open import Cubical.Data.Vec open import Cubical.Data.Sigma open import Cubical.Algebra.Ring open import Cubical.Algebra.CommRing open import Cubical.Algebra.CommRing.Instances.UnivariatePoly open import Cubical.Algebra.CommRing.Instances.MultivariatePoly open import Cubical.Algebra.Polynomials.Multivariate.EquivCarac.Poly0-A open import Cubical.Algebra.Polynomials.Multivariate.EquivCarac.Poly1-1Poly open import Cubical.Algebra.Polynomials.Multivariate.EquivCarac.An[Am[X]]-Anm[X] open import Cubical.Algebra.Polynomials.Multivariate.EquivCarac.AB-An[X]Bn[X] open CommRingEquivs renaming (compCommRingEquiv to _∘-ecr_ ; invCommRingEquiv to inv-ecr) private variable ℓ : Level ----------------------------------------------------------------------------- -- Definition Equiv-Polyn-nPoly : (A' : CommRing ℓ) → (n : ℕ) → CommRingEquiv (PolyCommRing A' n) (nUnivariatePoly A' n) Equiv-Polyn-nPoly A' zero = CRE-Poly0-A A' Equiv-Polyn-nPoly A' (suc n) = inv-ecr _ _ (CRE-PolyN∘M-PolyN+M A' 1 n) ∘-ecr (lift-equiv-poly _ _ (Equiv-Polyn-nPoly A' n) 1 ∘-ecr CRE-Poly1-Poly: (nUnivariatePoly A' n))
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca.log_21829_115.asm
ljhsiun2/medusa
9
21397
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r15 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x11ec2, %r12 nop nop nop xor %rax, %rax movw $0x6162, (%r12) xor $10219, %r12 lea addresses_WT_ht+0x1ac30, %r13 nop nop nop sub %rbx, %rbx movb (%r13), %r10b nop cmp %rax, %rax lea addresses_A_ht+0x9416, %rcx dec %rbx movb $0x61, (%rcx) nop nop and $43637, %r12 lea addresses_A_ht+0x18c56, %rcx nop nop nop dec %r15 movl $0x61626364, (%rcx) nop nop nop sub $36630, %rcx lea addresses_WC_ht+0x14e16, %rsi lea addresses_UC_ht+0xe3e4, %rdi nop sub %r15, %r15 mov $71, %rcx rep movsb nop nop nop nop nop and %r12, %r12 lea addresses_WC_ht+0x19c96, %rsi lea addresses_A_ht+0x1c39e, %rdi cmp $48907, %r10 mov $35, %rcx rep movsw nop nop nop dec %rsi lea addresses_normal_ht+0x616, %r10 nop nop nop nop nop xor %rbx, %rbx mov (%r10), %esi nop and $52481, %rcx lea addresses_D_ht+0x65ba, %rsi lea addresses_A_ht+0x133d, %rdi nop nop xor $28146, %r15 mov $20, %rcx rep movsb nop nop nop and %rbx, %rbx lea addresses_UC_ht+0xa16, %rbx nop nop sub $15918, %r13 mov (%rbx), %edi nop nop add %rax, %rax lea addresses_WC_ht+0x14816, %rdi nop dec %rcx mov (%rdi), %ebx nop inc %rbx lea addresses_UC_ht+0xd696, %rsi lea addresses_UC_ht+0x12ce6, %rdi nop nop add $53831, %r10 mov $37, %rcx rep movsl nop nop nop add %rbx, %rbx lea addresses_WT_ht+0x15a16, %r15 nop nop nop sub %r13, %r13 vmovups (%r15), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %rsi nop nop cmp $24741, %rsi lea addresses_D_ht+0x11416, %rcx clflush (%rcx) nop nop nop and %r13, %r13 movb $0x61, (%rcx) nop nop nop nop xor $10804, %r12 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r15 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r14 push %r8 push %r9 push %rdi // Store lea addresses_RW+0x9916, %rdi nop xor $21419, %r13 movb $0x51, (%rdi) nop nop nop cmp %r14, %r14 // Store lea addresses_US+0x1b16, %r9 nop sub %r11, %r11 movw $0x5152, (%r9) inc %r11 // Load lea addresses_D+0x6816, %r9 and %r13, %r13 mov (%r9), %rdi xor $55566, %r9 // Faulty Load lea addresses_PSE+0x11016, %r11 nop nop nop xor %r10, %r10 mov (%r11), %r13w lea oracles, %r14 and $0xff, %r13 shlq $12, %r13 mov (%r14,%r13,1), %r13 pop %rdi pop %r9 pop %r8 pop %r14 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_RW'}} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_US'}} {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 1, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': True, 'type': 'addresses_A_ht'}} {'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 9, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_D_ht'}} {'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 */