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 |
|---|---|---|---|---|
oeis/046/A046715.asm | neoneye/loda-programs | 11 | 94445 | ; A046715: Secondary root edges in doubly rooted tree maps with n edges.
; Submitted by <NAME>
; 0,1,10,105,1176,13860,169884,2147145,27810640,367479684,4936848280,67255063876,927192688800,12914469594000,181497968832600,2570903476583625,36671501616314400,526348636137670500,7597019633665077000,110205019733436728100,1605995229471545484000,23501486711749023104400,345223702318549314546000,5088911211904797395784900,75257337927599187066173376,1116263577166846916419558800,16602914640451146580345767904,247580977032343215537346279440,3700750645193544054468838894720,55441337661104573118307596142144
mov $2,$0
add $0,1
seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!).
mul $0,$2
seq $2,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!).
mul $0,$2
div $0,2
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-cofuma.ads | djamal2727/Main-Bearing-Analytical-Model | 0 | 15271 | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.FUNCTIONAL_MAPS --
-- --
-- S p e c --
-- --
-- Copyright (C) 2016-2020, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- 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/>. --
------------------------------------------------------------------------------
pragma Ada_2012;
private with Ada.Containers.Functional_Base;
generic
type Key_Type (<>) is private;
type Element_Type (<>) is private;
with function Equivalent_Keys
(Left : Key_Type;
Right : Key_Type) return Boolean is "=";
with function "=" (Left, Right : Element_Type) return Boolean is <>;
Enable_Handling_Of_Equivalence : Boolean := True;
-- This constant should only be set to False when no particular handling
-- of equivalence over keys is needed, that is, Equivalent_Keys defines a
-- key uniquely.
package Ada.Containers.Functional_Maps with SPARK_Mode is
type Map is private with
Default_Initial_Condition => Is_Empty (Map) and Length (Map) = 0,
Iterable => (First => Iter_First,
Next => Iter_Next,
Has_Element => Iter_Has_Element,
Element => Iter_Element);
-- Maps are empty when default initialized.
-- "For in" quantification over maps should not be used.
-- "For of" quantification over maps iterates over keys.
-- Note that, for proof, "for of" quantification is understood modulo
-- equivalence (the range of quantification comprises all the keys that are
-- equivalent to any key of the map).
-----------------------
-- Basic operations --
-----------------------
-- Maps are axiomatized using Has_Key and Get, encoding respectively the
-- presence of a key in a map and an accessor to elements associated with
-- its keys. The length of a map is also added to protect Add against
-- overflows but it is not actually modeled.
function Has_Key (Container : Map; Key : Key_Type) return Boolean with
-- Return True if Key is present in Container
Global => null,
Post =>
(if Enable_Handling_Of_Equivalence then
-- Has_Key returns the same result on all equivalent keys
(if (for some K of Container => Equivalent_Keys (K, Key)) then
Has_Key'Result));
function Get (Container : Map; Key : Key_Type) return Element_Type with
-- Return the element associated with Key in Container
Global => null,
Pre => Has_Key (Container, Key),
Post =>
(if Enable_Handling_Of_Equivalence then
-- Get returns the same result on all equivalent keys
Get'Result = W_Get (Container, Witness (Container, Key))
and (for all K of Container =>
(Equivalent_Keys (K, Key) =
(Witness (Container, Key) = Witness (Container, K)))));
function Length (Container : Map) return Count_Type with
Global => null;
-- Return the number of mappings in Container
------------------------
-- Property Functions --
------------------------
function "<=" (Left : Map; Right : Map) return Boolean with
-- Map inclusion
Global => null,
Post =>
"<="'Result =
(for all Key of Left =>
Has_Key (Right, Key) and then Get (Right, Key) = Get (Left, Key));
function "=" (Left : Map; Right : Map) return Boolean with
-- Extensional equality over maps
Global => null,
Post =>
"="'Result =
((for all Key of Left =>
Has_Key (Right, Key)
and then Get (Right, Key) = Get (Left, Key))
and (for all Key of Right => Has_Key (Left, Key)));
pragma Warnings (Off, "unused variable ""Key""");
function Is_Empty (Container : Map) return Boolean with
-- A map is empty if it contains no key
Global => null,
Post => Is_Empty'Result = (for all Key of Container => False);
pragma Warnings (On, "unused variable ""Key""");
function Keys_Included (Left : Map; Right : Map) return Boolean
-- Returns True if every Key of Left is in Right
with
Global => null,
Post =>
Keys_Included'Result = (for all Key of Left => Has_Key (Right, Key));
function Same_Keys (Left : Map; Right : Map) return Boolean
-- Returns True if Left and Right have the same keys
with
Global => null,
Post =>
Same_Keys'Result =
(Keys_Included (Left, Right)
and Keys_Included (Left => Right, Right => Left));
pragma Annotate (GNATprove, Inline_For_Proof, Same_Keys);
function Keys_Included_Except
(Left : Map;
Right : Map;
New_Key : Key_Type) return Boolean
-- Returns True if Left contains only keys of Right and possibly New_Key
with
Global => null,
Post =>
Keys_Included_Except'Result =
(for all Key of Left =>
(if not Equivalent_Keys (Key, New_Key) then
Has_Key (Right, Key)));
function Keys_Included_Except
(Left : Map;
Right : Map;
X : Key_Type;
Y : Key_Type) return Boolean
-- Returns True if Left contains only keys of Right and possibly X and Y
with
Global => null,
Post =>
Keys_Included_Except'Result =
(for all Key of Left =>
(if not Equivalent_Keys (Key, X)
and not Equivalent_Keys (Key, Y)
then
Has_Key (Right, Key)));
function Elements_Equal_Except
(Left : Map;
Right : Map;
New_Key : Key_Type) return Boolean
-- Returns True if all the keys of Left are mapped to the same elements in
-- Left and Right except New_Key.
with
Global => null,
Post =>
Elements_Equal_Except'Result =
(for all Key of Left =>
(if not Equivalent_Keys (Key, New_Key) then
Has_Key (Right, Key)
and then Get (Left, Key) = Get (Right, Key)));
function Elements_Equal_Except
(Left : Map;
Right : Map;
X : Key_Type;
Y : Key_Type) return Boolean
-- Returns True if all the keys of Left are mapped to the same elements in
-- Left and Right except X and Y.
with
Global => null,
Post =>
Elements_Equal_Except'Result =
(for all Key of Left =>
(if not Equivalent_Keys (Key, X)
and not Equivalent_Keys (Key, Y)
then
Has_Key (Right, Key)
and then Get (Left, Key) = Get (Right, Key)));
----------------------------
-- Construction Functions --
----------------------------
-- For better efficiency of both proofs and execution, avoid using
-- construction functions in annotations and rather use property functions.
function Add
(Container : Map;
New_Key : Key_Type;
New_Item : Element_Type) return Map
-- Returns Container augmented with the mapping Key -> New_Item
with
Global => null,
Pre =>
not Has_Key (Container, New_Key)
and Length (Container) < Count_Type'Last,
Post =>
Length (Container) + 1 = Length (Add'Result)
and Has_Key (Add'Result, New_Key)
and Get (Add'Result, New_Key) = New_Item
and Container <= Add'Result
and Keys_Included_Except (Add'Result, Container, New_Key);
function Remove
(Container : Map;
Key : Key_Type) return Map
-- Returns Container without any mapping for Key
with
Global => null,
Pre => Has_Key (Container, Key),
Post =>
Length (Container) = Length (Remove'Result) + 1
and not Has_Key (Remove'Result, Key)
and Remove'Result <= Container
and Keys_Included_Except (Container, Remove'Result, Key);
function Set
(Container : Map;
Key : Key_Type;
New_Item : Element_Type) return Map
-- Returns Container, where the element associated with Key has been
-- replaced by New_Item.
with
Global => null,
Pre => Has_Key (Container, Key),
Post =>
Length (Container) = Length (Set'Result)
and Get (Set'Result, Key) = New_Item
and Same_Keys (Container, Set'Result)
and Elements_Equal_Except (Container, Set'Result, Key);
------------------------------
-- Handling of Equivalence --
------------------------------
-- These functions are used to specify that Get returns the same value on
-- equivalent keys. They should not be used directly in user code.
function Has_Witness (Container : Map; Witness : Count_Type) return Boolean
with
Ghost,
Global => null;
-- Returns True if there is a key with witness Witness in Container
function Witness (Container : Map; Key : Key_Type) return Count_Type with
-- Returns the witness of Key in Container
Ghost,
Global => null,
Pre => Has_Key (Container, Key),
Post => Has_Witness (Container, Witness'Result);
function W_Get (Container : Map; Witness : Count_Type) return Element_Type
with
-- Returns the element associated with a witness in Container
Ghost,
Global => null,
Pre => Has_Witness (Container, Witness);
---------------------------
-- Iteration Primitives --
---------------------------
type Private_Key is private;
function Iter_First (Container : Map) return Private_Key with
Global => null;
function Iter_Has_Element
(Container : Map;
Key : Private_Key) return Boolean
with
Global => null;
function Iter_Next (Container : Map; Key : Private_Key) return Private_Key
with
Global => null,
Pre => Iter_Has_Element (Container, Key);
function Iter_Element (Container : Map; Key : Private_Key) return Key_Type
with
Global => null,
Pre => Iter_Has_Element (Container, Key);
pragma Annotate (GNATprove, Iterable_For_Proof, "Contains", Has_Key);
private
pragma SPARK_Mode (Off);
function "="
(Left : Key_Type;
Right : Key_Type) return Boolean renames Equivalent_Keys;
subtype Positive_Count_Type is Count_Type range 1 .. Count_Type'Last;
package Element_Containers is new Ada.Containers.Functional_Base
(Element_Type => Element_Type,
Index_Type => Positive_Count_Type);
package Key_Containers is new Ada.Containers.Functional_Base
(Element_Type => Key_Type,
Index_Type => Positive_Count_Type);
type Map is record
Keys : Key_Containers.Container;
Elements : Element_Containers.Container;
end record;
type Private_Key is new Count_Type;
function Iter_First (Container : Map) return Private_Key is (1);
function Iter_Has_Element
(Container : Map;
Key : Private_Key) return Boolean
is
(Count_Type (Key) in 1 .. Key_Containers.Length (Container.Keys));
function Iter_Next
(Container : Map;
Key : Private_Key) return Private_Key
is
(if Key = Private_Key'Last then 0 else Key + 1);
function Iter_Element
(Container : Map;
Key : Private_Key) return Key_Type
is
(Key_Containers.Get (Container.Keys, Count_Type (Key)));
end Ada.Containers.Functional_Maps;
|
node_modules/ibm-design-icons/lib/export.scpt | Jamesm4/Cognitive-Computing-P1 | 210 | 1450 | <reponame>Jamesm4/Cognitive-Computing-P1<filename>node_modules/ibm-design-icons/lib/export.scpt
on run argv
with timeout of (30 * 60) seconds
tell application "Adobe Illustrator"
set jsLocation to item 1 of argv
set js to "#include '" & jsLocation & "';" & return
set js to js & "main(arguments);" & return
do javascript js with arguments argv
end tell
end timeout
end run
|
oeis/199/A199084.asm | neoneye/loda-programs | 11 | 175698 | ; A199084: a(n) = Sum_{k=1..n} (-1)^(k+1) gcd(k,n).
; Submitted by <NAME>
; 1,-1,3,-4,5,-5,7,-12,9,-9,11,-20,13,-13,15,-32,17,-21,19,-36,21,-21,23,-60,25,-25,27,-52,29,-45,31,-80,33,-33,35,-84,37,-37,39,-108,41,-65,43,-84,45,-45,47,-160,49,-65,51,-100,53,-81,55,-156,57,-57,59,-180,61,-61,63,-192,65,-105,67,-132,69,-117,71,-252,73,-73,75,-148,77,-125,79,-288,81,-81,83,-260,85,-85,87,-252,89,-189,91,-180,93,-93,95,-400,97,-133,99,-260
add $0,1
mov $3,$0
lpb $3
mov $1,$3
gcd $1,$0
mul $2,-1
add $2,$1
sub $3,1
lpe
mov $0,$2
|
proofs/AKS/Algebra/Morphism/Structures.agda | mckeankylej/thesis | 1 | 2317 | <filename>proofs/AKS/Algebra/Morphism/Structures.agda
open import Level using () renaming (_⊔_ to _⊔ˡ_)
open import Relation.Binary.Morphism.Structures using (IsRelHomomorphism)
open import Algebra.Bundles using (RawMonoid; RawGroup; RawRing)
open import Algebra.Morphism.Structures using (IsMonoidHomomorphism; IsMonoidMonomorphism)
module AKS.Algebra.Morphism.Structures where
module GroupMorphisms {c₁ c₂ ℓ₁ ℓ₂} (G₁ : RawGroup c₁ ℓ₁) (G₂ : RawGroup c₂ ℓ₂) where
open RawGroup G₁ using () renaming (Carrier to C₁; _∙_ to _+₁_; _⁻¹ to -₁_; ε to ε₁; _≈_ to _≈₁_; rawMonoid to +₁-rawMonoid)
open RawGroup G₂ using () renaming (Carrier to C₂; _∙_ to _+₂_; _⁻¹ to -₂_; ε to ε₂; _≈_ to _≈₂_; rawMonoid to +₂-rawMonoid)
open import Algebra.Morphism.Definitions C₁ C₂ _≈₂_ using (Homomorphic₂; Homomorphic₁; Homomorphic₀)
open import Function.Definitions _≈₁_ _≈₂_ using (Injective)
record IsGroupHomomorphism (⟦_⟧ : C₁ → C₂) : Set (c₁ ⊔ˡ ℓ₁ ⊔ˡ ℓ₂) where
field
isRelHomomorphism : IsRelHomomorphism _≈₁_ _≈₂_ ⟦_⟧
+-homo : Homomorphic₂ ⟦_⟧ _+₁_ _+₂_
-‿homo : Homomorphic₁ ⟦_⟧ -₁_ -₂_
ε-homo : Homomorphic₀ ⟦_⟧ ε₁ ε₂
open IsRelHomomorphism isRelHomomorphism public renaming (cong to ⟦⟧-cong)
+-isMonoidHomomorphism : IsMonoidHomomorphism +₁-rawMonoid +₂-rawMonoid ⟦_⟧
+-isMonoidHomomorphism = record
{ isMagmaHomomorphism = record
{ isRelHomomorphism = isRelHomomorphism
; homo = +-homo
}
; ε-homo = ε-homo
}
record IsGroupMonomorphism (⟦_⟧ : C₁ → C₂) : Set (c₁ ⊔ˡ ℓ₁ ⊔ˡ ℓ₂) where
field
isGroupHomomorphism : IsGroupHomomorphism ⟦_⟧
injective : Injective ⟦_⟧
open IsGroupHomomorphism isGroupHomomorphism public
+-isMonoidMonomorphism : IsMonoidMonomorphism +₁-rawMonoid +₂-rawMonoid ⟦_⟧
+-isMonoidMonomorphism = record
{ isMonoidHomomorphism = +-isMonoidHomomorphism
; injective = injective
}
open GroupMorphisms public
module RingMorphisms {c₁ c₂ ℓ₁ ℓ₂} (R₁ : RawRing c₁ ℓ₁) (R₂ : RawRing c₂ ℓ₂) where
open RawRing R₁ using () renaming (Carrier to C₁; _+_ to _+₁_; _*_ to _*₁_; -_ to -₁_; 0# to 0#₁; 1# to 1#₁; _≈_ to _≈₁_)
open RawRing R₂ using () renaming (Carrier to C₂; _+_ to _+₂_; _*_ to _*₂_; -_ to -₂_; 0# to 0#₂; 1# to 1#₂; _≈_ to _≈₂_)
open import Algebra.Morphism.Definitions C₁ C₂ _≈₂_ using (Homomorphic₂; Homomorphic₁; Homomorphic₀)
open import Function.Definitions _≈₁_ _≈₂_ using (Injective)
+₁-rawGroup : RawGroup c₁ ℓ₁
+₁-rawGroup = record { Carrier = C₁ ; _≈_ = _≈₁_ ; _∙_ = _+₁_ ; _⁻¹ = -₁_ ; ε = 0#₁ }
+₂-rawGroup : RawGroup c₂ ℓ₂
+₂-rawGroup = record { Carrier = C₂ ; _≈_ = _≈₂_ ; _∙_ = _+₂_ ; _⁻¹ = -₂_ ; ε = 0#₂ }
*₁-rawMonoid : RawMonoid c₁ ℓ₁
*₁-rawMonoid = record { Carrier = C₁ ; _≈_ = _≈₁_ ; _∙_ = _*₁_ ; ε = 1#₁ }
*₂-rawMonoid : RawMonoid c₂ ℓ₂
*₂-rawMonoid = record { Carrier = C₂ ; _≈_ = _≈₂_ ; _∙_ = _*₂_ ; ε = 1#₂ }
record IsRingHomomorphism (⟦_⟧ : C₁ → C₂) : Set (c₁ ⊔ˡ ℓ₁ ⊔ˡ ℓ₂) where
field
isRelHomomorphism : IsRelHomomorphism _≈₁_ _≈₂_ ⟦_⟧
+-homo : Homomorphic₂ ⟦_⟧ _+₁_ _+₂_
*-homo : Homomorphic₂ ⟦_⟧ _*₁_ _*₂_
-‿homo : Homomorphic₁ ⟦_⟧ -₁_ -₂_
0#-homo : Homomorphic₀ ⟦_⟧ 0#₁ 0#₂
1#-homo : Homomorphic₀ ⟦_⟧ 1#₁ 1#₂
open IsRelHomomorphism isRelHomomorphism public renaming (cong to ⟦⟧-cong)
+-isGroupHomomorphism : IsGroupHomomorphism +₁-rawGroup +₂-rawGroup ⟦_⟧
+-isGroupHomomorphism = record
{ isRelHomomorphism = isRelHomomorphism
; +-homo = +-homo
; -‿homo = -‿homo
; ε-homo = 0#-homo
}
*-isMonoidHomomorphism : IsMonoidHomomorphism *₁-rawMonoid *₂-rawMonoid ⟦_⟧
*-isMonoidHomomorphism = record
{ isMagmaHomomorphism = record
{ isRelHomomorphism = isRelHomomorphism
; homo = *-homo
}
; ε-homo = 1#-homo
}
record IsRingMonomorphism (⟦_⟧ : C₁ → C₂) : Set (c₁ ⊔ˡ ℓ₁ ⊔ˡ ℓ₂) where
field
isRingHomomorphism : IsRingHomomorphism ⟦_⟧
injective : Injective ⟦_⟧
open IsRingHomomorphism isRingHomomorphism public
+-isGroupMonomorphism : IsGroupMonomorphism +₁-rawGroup +₂-rawGroup ⟦_⟧
+-isGroupMonomorphism = record
{ isGroupHomomorphism = +-isGroupHomomorphism
; injective = injective
}
*-isMonoidMonomorphism : IsMonoidMonomorphism *₁-rawMonoid *₂-rawMonoid ⟦_⟧
*-isMonoidMonomorphism = record
{ isMonoidHomomorphism = *-isMonoidHomomorphism
; injective = injective
}
open RingMorphisms public
|
src/bintoasc.ads | jhumphry/Ada_BinToAsc | 0 | 7073 | -- BinToAsc
-- Binary data to ASCII codecs
-- Copyright (c) 2015, <NAME>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
-- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-- CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
generic
type Bin is mod <>;
type Bin_Array_Index is range <>;
type Bin_Array is array (Bin_Array_Index range <>) of Bin;
package BinToAsc is
type Codec_State is (Ready, Completed, Failed);
type Codec is abstract tagged record
State : Codec_State := Ready;
end record;
procedure Reset (C : out Codec) is abstract
with Post'Class => (C.State = Ready);
-- Reset a Codec to its initial state
function Input_Group_Size (C : in Codec) return Positive is abstract;
function Output_Group_Size (C : in Codec) return Positive is abstract;
type Codec_To_String is abstract new Codec with null record;
not overriding
procedure Process (C : in out Codec_To_String;
Input : in Bin;
Output : out String;
Output_Length : out Natural) is abstract
with Pre'Class => (C.State = Ready and
Output'Length >= Output_Group_Size(C));
not overriding
procedure Process (C : in out Codec_To_String;
Input : in Bin_Array;
Output : out String;
Output_Length : out Natural) is abstract
with Pre'Class => (C.State = Ready and
Output'Length / Output_Group_Size(C) >=
Input'Length / Input_Group_Size(C) + 1);
not overriding
procedure Complete (C : in out Codec_To_String;
Output : out String;
Output_Length : out Natural) is abstract
with Pre'Class => (C.State = Ready and
Output'Length >= Output_Group_Size(C)),
Post'Class => C.State in Completed | Failed;
type Codec_To_Bin is abstract new Codec with null record;
not overriding
procedure Process (C : in out Codec_To_Bin;
Input : in Character;
Output : out Bin_Array;
Output_Length : out Bin_Array_Index) is abstract
with Pre'Class => (C.State = Ready and
Output'Length >= Output_Group_Size(C));
not overriding
procedure Process (C : in out Codec_To_Bin;
Input : in String;
Output : out Bin_Array;
Output_Length : out Bin_Array_Index) is abstract
with Pre'Class => (C.State = Ready and
Output'Length / Output_Group_Size(C) >=
Input'Length / Input_Group_Size(C) + 1);
not overriding
procedure Complete (C : in out Codec_To_Bin;
Output : out Bin_Array;
Output_Length : out Bin_Array_Index) is abstract
with Pre'Class => (C.State = Ready and
Output'Length >= Output_Group_Size(C)),
Post'Class => C.State in Completed | Failed;
-- Helper functions
generic
type Codec is new Codec_To_String with private;
function To_String (Input : in Bin_Array) return String;
Invalid_Data_Encoding : exception;
generic
type Codec is new Codec_To_Bin with private;
function To_Bin (Input : in String) return Bin_Array;
-- Define Alphabet types
subtype Alphabet_Index is Bin range 0..Bin'Last - 1;
type Alphabet is array (Alphabet_Index range <>) of Character;
function Valid_Alphabet (A : in Alphabet;
Case_Sensitive : in Boolean) return Boolean
with Pre => (A'First = 0);
subtype Alphabet_16 is Alphabet(0..15);
subtype Alphabet_32 is Alphabet(0..31);
subtype Alphabet_64 is Alphabet(0..63);
subtype Alphabet_85 is Alphabet(0..84);
private
type Reverse_Alphabet_Lookup is array (Character) of Bin;
Invalid_Character_Input : constant Bin := 255;
-- Any useful BinToAsc codec cannot map all Bin values to a Character value
-- else there would be no benefit over simply using the Bin data directly.
function Make_Reverse_Alphabet (A : in Alphabet;
Case_Sensitive : in Boolean)
return Reverse_Alphabet_Lookup
with Pre => (Valid_Alphabet(A, Case_Sensitive));
-- This compile-time check is useful for GNAT, but in GNATprove it currently
-- just generates a warning that it can not yet be proved correct.
pragma Warnings (GNATprove, Off, "Compile_Time_Error");
pragma Compile_Time_Error ((Bin'Size /= 8 or
Bin'Modulus /= 256 or
Bin'Last /= 255 or
Bin'First /= 0),
"BinToAsc only works where the binary type" &
"specified is a regular 8-bit byte.");
pragma Warnings (GNATprove, On, "Compile_Time_Error");
end BinToAsc;
|
vbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-CpuDetect.asm | Nurzamal/rest_api_docker | 0 | 247480 | ; $Id: bs3-mode-CpuDetect.asm 69111 2017-10-17 14:26:02Z vboxsync $
;; @file
; BS3Kit - Bs3CpuDetect
;
;
; Copyright (C) 2007-2017 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
; VirtualBox OSE distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
%include "bs3kit-template-header.mac"
BS3_EXTERN_DATA16 g_uBs3CpuDetected
;;
; Rough CPU detection, mainly for detecting really old CPUs.
;
; A Bs3CpuDetectEx can be added if this is insufficient.
;
; @returns BS3CPU_xxx in xAX.
; @cproto BS3_DECL(BS3CPU) Bs3CpuDetect(void);
;
; @uses xAX.
;
; @remarks ASSUMES we're in ring-0 when not in some kind of real mode.
;
; @note We put the real mode version of this code in the RMTEXT16 segment
; to save space elsewhere. We generate a far call stub that goes
; to the right segment.
;
%if TMPL_MODE == BS3_MODE_RM
BS3_BEGIN_RMTEXT16
BS3_PROC_BEGIN_MODE Bs3CpuDetect, BS3_PBC_FAR
%else
TMPL_BEGIN_TEXT
BS3_PROC_BEGIN_MODE Bs3CpuDetect, BS3_PBC_HYBRID
%endif
CPU 8086
push xBP
mov xBP, xSP
pushf ; xBP - xCB*1
push xCX ; xBP - xCB*2
push xDX ; xBP - xCB*3
push xBX ; xBP - xCB*4
sub xSP, 20h ; xBP - xCB*4 - 20h
%ifndef TMPL_CMN_PAGING
%ifdef TMPL_RM
%if 1 ; this is simpler
;
; FLAGS bits 15:12 are always set on 8086, 8088, V20, V30, 80186, and
; 80188. FLAGS bit 15 is always zero on 286+, whereas bit 14 is NT and
; bits 13:12 are IOPL.
;
test byte [xBP - xCB + 1], 80h ; Top byte of saved flags.
jz .286plus
%else
;
; When executing 'PUSH SP' the 8086, 8088, V20, V30, 80186, and 80188
; should be pushing the updated SP value instead of the initial one.
;
push xSP
pop xAX
cmp xAX, xSP
je .286plus
%endif
;
; Older than 286.
;
; Detect 8086/8088/V20/V30 vs. 80186/80188 by checking for pre 80186
; shift behavior. the 80186/188 and later will mask the CL value according
; to the width of the destination register, whereas 8086/88 and V20/30 will
; perform the exact number of shifts specified.
;
mov cl, 20h ; Shift count; 80186/88 and later will mask this by 0x1f (or 0xf)?
mov dx, 7fh
shl dx, cl
cmp dx, 7fh ; If no change, this is a 80186/88.
mov xAX, BS3CPU_80186
je .return
;
; Detect 8086/88 vs V20/30 by exploiting undocumented POP CS encoding
; that was redefined on V20/30 to SET1.
;
xor ax, ax ; clear
push cs
db 0fh ; 8086/88: pop cs V20/30: set1 bl,cl
db 14h, 3ch ; 8086/88: add al, 3ch
; 8086/88: al = 3ch V20/30: al = 0, cs on stack, bl modified.
cmp al, 3ch
jne .is_v20_or_v30
mov xAX, BS3CPU_8086
jmp .return
.is_v20_or_v30:
pop xCX ; unclaimed CS
mov xAX, BS3CPU_V20
jmp .return
%endif ; TMPL_RM
CPU 286
.286plus:
;
; The 4th bit of the machine status word / CR0 indicates the precense
; of a 80387 or later co-processor (a 80287+80386 => ET=0). 486 and
; later should be hardcoding this to 1, according to the documentation
; (need to test on 486SX). The initial idea here then would be to
; assume 386+ if ET=1.
;
; The second idea was to check whether any reserved bits are set,
; because the 286 here has bits 4 thru 15 all set. Unfortunately, it
; turned out the 386SX and AMD 486DX-40 also sets bits 4 thru 15 when
; using SMSW. So, nothing conclusive to distinguish 386 from 286, but
; we've probably got a safe 486+ detection here.
;
;; @todo check if LOADALL can set any of the reserved bits on a 286 or 386.
smsw ax
test ax, ~(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS | X86_CR0_ET | X86_CR0_NE)
jz .486plus
;
; The 286 stores 0xff in the high byte of the SIDT and SGDT base
; address (since it only did 24-bit addressing and the top 8-bit was
; reserved for the 386). ASSUMES low IDT (which is the case for BS3Kit).
;
sidt [xBP - xCB*4 - 20h]
cmp byte [xBP - xCB*4 - 20h + 2 + 3], 0ffh
jne .386plus
%if 0
;
; Detect 80286 by checking whether the IOPL and NT bits of EFLAGS can be
; modified or not. There are different accounts of these bits. Dr.Dobb's
; (http://www.drdobbs.com/embedded-systems/processor-detection-schemes/184409011)
; say they are undefined on 286es and will always be zero. Whereas Intel
; iAPX 286 Programmer's Reference Manual (both order #210498-001 and
; #210498-003) documents both IOPL and NT, but with comment 4 on page
; C-43 stating that they cannot be POPFed in real mode and will both
; remain 0. This is different from the 386+, where the NT flag isn't
; privileged according to page 3-37 in #230985-003. Later Intel docs
; (#235383-052US, page 4-192) documents real mode as taking both NT and
; IOPL from what POPF reads off the stack - which is the behavior
; observed a 386SX here.
;
test al, X86_CR0_PE ; This flag test doesn't work in protected mode, ...
jnz .386plus ; ... so ASSUME 386plus if in PE for now.
pushf ; Save a copy of the original flags for restoring IF.
pushf
pop ax
xor ax, X86_EFL_IOPL | X86_EFL_NT ; Try modify IOPL and NT.
and ax, ~X86_EFL_IF ; Try clear IF.
push ax ; Load modified flags.
popf
pushf ; Get actual flags.
pop dx
popf ; Restore IF, IOPL and NT.
cmp ax, dx
je .386plus ; If any of the flags are set, we're on 386+.
; While we could in theory be in v8086 mode at this point and be fooled
; by a flaky POPF implementation, we assume this isn't the case in our
; execution environment.
%endif
.is_286:
mov ax, BS3CPU_80286
jmp .return
%endif ; !TMPL_CMN_PAGING
CPU 386
.386plus:
.486plus:
;
; Check for CPUID and AC. The former flag indicates CPUID support, the
; latter was introduced with the 486.
;
mov ebx, esp ; Save esp.
and esp, 0fffch ; Clear high word and don't trigger ACs.
pushfd
mov eax, [esp] ; eax = original EFLAGS.
xor dword [esp], X86_EFL_ID | X86_EFL_AC ; Flip the ID and AC flags.
popfd ; Load modified flags.
pushfd ; Save actual flags.
xchg eax, [esp] ; Switch, so the stack has the original flags.
xor eax, [esp] ; Calc changed flags.
popf ; Restore EFLAGS.
mov esp, ebx ; Restore possibly unaligned ESP.
test eax, X86_EFL_ID
jnz .have_cpuid ; If ID changed, we've got CPUID.
test eax, X86_EFL_AC
mov xAX, BS3CPU_80486
jnz .return ; If AC changed, we've got a 486 without CPUID (or similar).
mov xAX, BS3CPU_80386
jmp .return
CPU 586
.have_cpuid:
;
; Do a very simple minded check here using the (standard) family field.
; While here, we also check for PAE.
;
mov eax, 1
cpuid
; Calc the extended family and model values before we mess up EAX.
mov cl, ah
and cl, 0fh
cmp cl, 0fh
jnz .not_extended_family
mov ecx, eax
shr ecx, 20
and cl, 7fh
add cl, 0fh
.not_extended_family: ; cl = family
mov ch, al
shr ch, 4
cmp cl, 0fh
jae .extended_model
cmp cl, 06h ; actually only intel, but we'll let this slip for now.
jne .done_model
.extended_model:
shr eax, 12
and al, 0f0h
or ch, al
.done_model: ; ch = model
; Start assembling return flags, checking for PSE + PAE.
mov eax, X86_CPUID_FEATURE_EDX_PSE | X86_CPUID_FEATURE_EDX_PAE
and eax, edx
mov ah, al
AssertCompile(X86_CPUID_FEATURE_EDX_PAE_BIT > BS3CPU_F_PAE_BIT - 8) ; 6 vs 10-8=2
and al, X86_CPUID_FEATURE_EDX_PAE
shr al, X86_CPUID_FEATURE_EDX_PAE_BIT - (BS3CPU_F_PAE_BIT - 8)
AssertCompile(X86_CPUID_FEATURE_EDX_PSE_BIT == BS3CPU_F_PSE_BIT - 8) ; 3 vs 11-8=3
and ah, X86_CPUID_FEATURE_EDX_PSE
or ah, al
or ah, (BS3CPU_F_CPUID >> 8)
; Add the CPU type based on the family and model values.
cmp cl, 6
jne .not_family_06h
mov al, BS3CPU_PPro
cmp ch, 1
jbe .return
mov al, BS3CPU_PProOrNewer
jmp .NewerThanPPro
.not_family_06h:
mov al, BS3CPU_PProOrNewer
ja .NewerThanPPro
cmp cl, 5
mov al, BS3CPU_Pentium
je .return
cmp cl, 4
mov al, BS3CPU_80486
je .return
cmp cl, 3
mov al, BS3CPU_80386
je .return
.NewerThanPPro:
; Check for extended leaves and long mode.
push xAX ; save PAE+PProOrNewer
mov eax, 0x80000000
cpuid
sub eax, 0x80000001 ; Minimum leaf 0x80000001
cmp eax, 0x00010000 ; At most 0x10000 leaves.
ja .no_ext_leaves
mov eax, 0x80000001
cpuid
pop xAX ; restore PAE+PProOrNewer
test edx, X86_CPUID_EXT_FEATURE_EDX_LONG_MODE
jz .no_long_mode
or ah, ((BS3CPU_F_CPUID_EXT_LEAVES | BS3CPU_F_LONG_MODE) >> 8)
jmp .no_check_for_nx
.no_long_mode:
or ah, (BS3CPU_F_CPUID_EXT_LEAVES >> 8)
.no_check_for_nx:
test edx, X86_CPUID_EXT_FEATURE_EDX_NX
jz .return
or ax, BS3CPU_F_NX
jmp .return
.no_ext_leaves:
pop xAX ; restore PAE+PProOrNewer
CPU 8086
.return:
;
; Save the return value.
;
mov [BS3_DATA16_WRT(g_uBs3CpuDetected)], ax
;
; Epilogue.
;
add xSP, 20h
pop xBX
pop xDX
pop xCX
popf
pop xBP
BS3_HYBRID_RET
BS3_PROC_END_MODE Bs3CpuDetect
%if TMPL_MODE == BS3_MODE_RM
BS3_BEGIN_TEXT16_NEARSTUBS
BS3_PROC_BEGIN_MODE Bs3CpuDetect, BS3_PBC_NEAR
call far TMPL_FAR_NM(Bs3CpuDetect)
ret
BS3_PROC_END_MODE Bs3CpuDetect
%endif
|
src/fot/LTC-PCF/Program/GCD/Total/CorrectnessProof.agda | asr/fotc | 11 | 1898 | ------------------------------------------------------------------------------
-- The gcd program is correct
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- This module proves the correctness of the gcd program using
-- the Euclid's algorithm.
module LTC-PCF.Program.GCD.Total.CorrectnessProof where
open import LTC-PCF.Base
open import LTC-PCF.Data.Nat.Type
open import LTC-PCF.Program.GCD.Total.CommonDivisor using ( gcdCD )
open import LTC-PCF.Program.GCD.Total.Definitions using ( gcdSpec )
open import LTC-PCF.Program.GCD.Total.Divisible using ( gcdDivisible )
open import LTC-PCF.Program.GCD.Total.GCD using ( gcd )
------------------------------------------------------------------------------
-- The gcd is correct.
gcdCorrect : ∀ {m n} → N m → N n → gcdSpec m n (gcd m n)
gcdCorrect Nm Nn = gcdCD Nm Nn , gcdDivisible Nm Nn
|
src/rotables/shot_acc.asm | battlelinegames/nesteroids | 6 | 247090 | .segment "CODE"
x_shot_acc_table_hi: .byte $FC, $FC, $FD, $FE
.byte $00, $01, $02, $03
.byte $03, $03, $02, $01
.byte $00, $FE, $FD, $FC
x_shot_acc_table_lo: .byte $A0, $E8, $C0, $E
.byte $00, $20, $40, $18
.byte $60, $18, $40, $20
.byte $00, $E0, $C0, $E8
y_shot_acc_table_hi: .byte $00, $01, $02, $03
.byte $03, $03, $02, $01
.byte $00, $FE, $FD, $FC
.byte $FC, $FC, $FD, $FE
y_shot_acc_table_lo: .byte $00, $20, $40, $18
.byte $60, $18, $40, $20
.byte $00, $E0, $C0, $E8
.byte $A0, $E8, $C0, $E0
|
modules/parsers/parser-hdbview/com.sap.xsk.parser.hdbview/src/main/antlr4/com/sap/xsk/parser/hdbview/core/Hdbview.g4 | dspenchev/xsk | 0 | 1725 | <gh_stars>0
grammar Hdbview;
hdbviewDefinition: property+;
property: schemaProp | publicProp | queryProp | dependsOnProp | dependsOnTable | dependsOnView;
schemaProp: 'schema' EQ STRING SEMICOLON;
publicProp: 'public' EQ BOOLEAN SEMICOLON;
queryProp: 'query' EQ STRING SEMICOLON;
dependsOnProp: 'depends_on' EQ '[' (STRING (',' STRING)*)? ']' SEMICOLON ;
dependsOnTable: 'depends_on_table' EQ '[' (STRING (',' STRING)*)? ']' SEMICOLON ;
dependsOnView: 'depends_on_view' EQ '[' (STRING (',' STRING)*)? ']' SEMICOLON ;
BOOLEAN: 'true' | 'false' ;
STRING: '"' (ESC|.)*? '"';
EQ : '=' ;
SEMICOLON : ';' ;
COMMA : ',' ;
WS : [ \t\r\n\u000C]+ -> skip; // toss out whitespace
ESC : '\\"' | '\\\\'; // 2-char sequences \" and \\ |
hello.adb | BKambic/HelloAda | 0 | 4420 | with Ada.Text_IO;
With Ada.Integer_Text_IO;
procedure Hello is
use Ada.Text_IO;
use Ada.Integer_Text_IO;
Input: integer; -- integer for i/o statement
begin
Put_Line ("Enter 1 for Hello and 2 for Goodbye: ");
get (Input);
if Input = 1 then -- input for hello statement
Put_Line ("Hello Ada!");
elseif Input = 2 then -- input for goodbye statement
Put_Line ("Goodbye Ada!");
else
Put_Line ("Invalid input!"); -- error statement
end if;
end Hello;
|
src/x86writer.ads | patrickf2000/ada-asm | 0 | 5963 | <filename>src/x86writer.ads
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
with X86Parser; use X86Parser;
package X86Writer is
procedure assemble(instr_list : Instr_Vector.Vector; writer : Stream_Access);
end X86Writer;
|
commands/media/apple-tv/apple-tv-play.applescript | jdmcd/script-commands | 0 | 4618 | #!/usr/bin/osascript
# @raycast.schemaVersion 1
# @raycast.title Play
# @raycast.mode silent
# @raycast.author <NAME>
# @raycast.authorURL https://github.com/crstauf
# @raycast.description Play TV
# @raycast.packageName TV
# @raycast.icon images/apple-tv-logo.png
tell application "TV"
if player state is paused then
play
do shell script "echo Playing TV"
end if
end tell |
programs/pong.asm | mynameispyo/InpyoOS | 0 | 88360 | ;=================================================
; Filename: pong.asm
; Edit by <NAME>
;
; Date: 11/03/2021
;
; Retro Pong Game...
;
; Play against the computer using
; the up down arrows to control your paddle on the
; left side of screen.
; It takes 7 points to win game and the more
; points you score the better the computer gets.
;
;=================================================
BITS 16 ; use 16 bit code when assembling
;-------- CONSTANTS -----------
VIDEO_MEM equ 0xb800 ; Color text mode memory location
ROW_LENGTH equ 160 ; 80 Character row * 2 bytes each(color/char)
PLAYER_COLUMN equ 4 ; Player column position
CPU_COLUMN equ 154 ; CPU column position
KEY_UP equ 0x48 ; move player paddle up
KEY_DOWN equ 0x50 ; move player paddle down
KEY_Y equ 0x15 ; reset game
KEY_Q equ 0x10
ESC equ 0x1B
SCREEN_WIDTH equ 80
SCREEN_HEIGHT equ 23
PADDLE_HEIGHT equ 5
BALL_START_COLUMN equ 78 ; Ball column position for start of round
CPU_INTELLIGENCE equ 10
GAME_WON equ 0x37 ; Score needed to end game ascii 7
section .text
;-----Load Program-----
%include "osdev.inc"
org 100h
;-----------------Game Start-------------------
start_game:
call os_hide_cursor
call os_clear_screen
mov ax, welcome_msg
mov bx, line1
mov cx, line2
xor dx, dx
call os_dialog_box
;Set up video memory
mov ax, VIDEO_MEM
mov es, ax ; ES:DI = B800:0000
;---Draw court sides---;
mov ax, 0x023d
xor di, di
mov cx, 79
rep stosw
mov ax, 0x023D
mov di, 3840
mov cx, 79
rep stosw
;---------Main Game loop---------;
game_loop:
; Clear Screen to black every loop
xor ax, ax
mov di, 161 ; clear only from 2nd row to 24 row
mov cx, 80*25-160
rep stosw
;---Draw middle separating line---;
mov ax, 0x2020 ; green background, black foregroundg
mov di, 238;398 ; Start at middle of 80 character row
mov cl, 12 ; draw net
.draw_net_loop:
stosw ; inc's di by word
add di, 2*ROW_LENGTH-2 ; next row sub 2 to bring back to screen center
loop .draw_net_loop ; Loops until cx is zero
;--Draw player and CPU paddles---;
imul di, [player_row], ROW_LENGTH ; row of paddle * row length
imul bx, [cpu_row], ROW_LENGTH ; row of cpu paddle * row length
mov cl, PADDLE_HEIGHT ; loop with height of paddles
.draw_paddles_loop:
mov [es:di+PLAYER_COLUMN], ax ; ax holds background/foreground color
mov [es:bx+CPU_COLUMN], ax
add di, ROW_LENGTH ; move down 1 row to draw player paddle
add bx, ROW_LENGTH ; same for cpu paddle
loop .draw_paddles_loop
;----------------Scores----------------;
;--poke player score--;
mov ah, 0x02
mov al, byte [player_score]
mov di, ROW_LENGTH+66 ; Player score
stosw
;--poke cpu score--;
mov al, byte [cpu_score]
mov di, ROW_LENGTH+90
stosw
;--get keyboard input--;
;; Get Player input
call os_check_for_key
cmp ax, 0
je move_cpu_up ; No key entered, don't check, move on
cmp ah, KEY_UP ; Check what key user entered...
je move_paddle_up
cmp ah, KEY_DOWN
je move_paddle_down
cmp al, ESC
je end_game
jmp move_cpu_up ; unmapped key pressed
;--Move player paddle up--;
move_paddle_up:
; empty keyboard buffer if arrow key held down
.empty_buffer:
call os_check_for_key
cmp ax, 0
jne .empty_buffer
cmp word [player_row], 1; check if player paddle is at top
je move_cpu_up
dec word [player_row] ; Move 1 row up
jmp move_cpu_up
;--Move player paddle down--;
move_paddle_down:
; empty keyboard buffer if arrow key held down
.empty_buffer:
call os_check_for_key
cmp ax, 0
jne .empty_buffer
;--check if player paddle is at bottom of screen
cmp word [player_row], SCREEN_HEIGHT - PADDLE_HEIGHT
jg move_cpu_up ; Yes, don't move
inc word [player_row] ; No, can move 1 row down
jmp move_cpu_up
;--Move CPU paddle--;
move_cpu_up:
;; CPU AI, Only move cpu every cpu_ai # of game loop cycles
mov bl, [cpu_ai] ; get cpu itelligence level
cmp [cpu_delay], bl ; Did we reach the itelligence level of cycles?
jl inc_cpu_delay
mov byte [cpu_delay], 0
jmp move_ball
inc_cpu_delay:
inc byte [cpu_delay]
mov bx, [cpu_row]
cmp bx, [ball_row] ; Is top of CPU paddle at or above the ball?
jl move_cpu_down ; Yes, move on
cmp word [cpu_row], 1
je move_ball
dec word [cpu_row] ; No, move cpu up
jmp move_ball
move_cpu_down:
add bx, PADDLE_HEIGHT-1
cmp bx, [ball_row] ; Is bottom of CPU paddle at or below the ball?
jg move_ball ; Yes, move on
cmp bx, 23 ; No, is bottom of cpu at bottom of screen?
je move_ball ; Yes, move on
inc word [cpu_row] ; No, move cpu down one row
;--Move Ball--;
move_ball:
;--poke ball to screen memory--;
imul di, [ball_row], ROW_LENGTH
add di, [ball_column]
mov word [es:di], 0xE020 ; Green bg, black fg
mov bl, [ball_dir_column] ; Ball column position change
add [ball_column], bl
mov bl, [ball_dir_row] ; Ball row position change
add [ball_row], bl
;--Check if ball hits paddles or screen limits--;
check_hit_top_or_bottom:
mov cx, [ball_row]
cmp cx, 1
jle reverse_ball_row ; If ball hit top of screen
cmp cx, 23 ; Did ball hit bottom of screen
jne check_hit_player
reverse_ball_row:
neg byte [ball_dir_row]
jmp end_hit_checks
check_hit_player:
cmp word [ball_column], PLAYER_COLUMN+2 ; Is ball at same position as player paddle?
jne check_hit_cpu ; No, move on
mov bx, [player_row]
cmp bx, [ball_row] ; Is top of player paddle at or above the ball?
jg check_hit_cpu ; No player did not hit ball
add bx, PADDLE_HEIGHT ; Check if hit bottom of player paddle
cmp bx, [ball_row]
jl check_hit_cpu ; Bottom of paddle is above ball no hit
jmp reverse_ball_column ; Otherwise hit ball, reverse column direction
check_hit_cpu:
cmp word [ball_column], CPU_COLUMN-2 ; Is ball at same position as CPU paddle?
jne check_hit_left ; No see if ball hit screen limit
mov bx, [cpu_row]
cmp bx, [ball_row] ; Is top of cpu paddle <= the ball
jg check_hit_left ; No see if ball hit screen limit
add bx, PADDLE_HEIGHT
cmp bx, [ball_row] ; Is bottom of cpu paddle >= the ball
jl check_hit_left ; No check screen limit
reverse_ball_column:
neg byte [ball_dir_column] ; Yes, hit player/cpu,reverse column direction
check_hit_left:
cmp word [ball_column], 0 ; Did ball hit/pass left side of screen?
jg check_hit_right ; No, move on
inc byte [cpu_score]
;mov bx, PLAYERBALLSTARTX ; No, reset ball for next round
jmp reset_ball
check_hit_right:
cmp word [ball_column], ROW_LENGTH ; Did ball hit/pass right side of screen?
jl end_hit_checks ; No, move on
inc byte [player_score]
inc byte [intelligence]
mov bx, BALL_START_COLUMN ; No, reset ball for next round
;--Reset Ball for next play--;
reset_ball:
cmp byte [cpu_score], GAME_WON ; Did CPU win the game?
je game_lost
cmp byte [player_score], GAME_WON ; Did player win game?
je game_won
;--Check/Change cpu intelligence for every player point scored
imul cx, [intelligence], CPU_INTELLIGENCE
jcxz reset_ball_random
mov [cpu_ai], cx
reset_ball_random:
mov ax, 4
mov bx, 22
call os_get_random
mov word [ball_row], cx
mov word [ball_column], BALL_START_COLUMN
end_hit_checks:
mov ax, 1 ; slow game play down
call os_pause
jmp game_loop
reset_game:
mov word [player_row], 10
mov word [cpu_row], 10
mov word [ball_column], 66
mov word [ball_row], 7
mov word [ball_dir_column], -2
mov word [ball_dir_row], 1
mov byte [player_score], 0x30
mov byte [cpu_score], 0x30
mov byte [intelligence], 0
mov byte [cpu_ai], 1
jmp game_loop
game_won:
;--poke player score--;
mov ah, 0x02
mov al, byte [player_score]
mov di, ROW_LENGTH+66 ; Player score
stosw
mov cx, 4
mov si, win_msg ; move addr of message into ds:si
mov di, 162 ; move screen into es:di
rep movsw ; move word from si to di inc both by word
jmp play_again
game_lost:
;--poke cpu score--;
mov ah, 0x02
mov al, byte [cpu_score]
mov di, ROW_LENGTH+90
stosw
mov cx, 4
mov si, lose_msg ; move addr of message into ds:si
mov di, 162 ; move screen into es:di
rep movsw ; move word from si to di inc both by word
play_again:
mov cx, 25
mov si, play_msg
mov di, 322
rep movsw
call os_wait_for_key
cmp al, ESC
je end_game
cmp ah, KEY_Y
je reset_game
cmp ah, KEY_Q
je end_game
jmp play_again
end_game:
;---restore ES----
mov ax, 0x2000
mov es, ax
call os_clear_screen
call os_show_cursor
ret
;-----END PROGRAM-----
;==============================================;
;------------DATA------------;
;----------VARIABLES---------;
section .data
screen_color: dw 0xF020
player_row: dw 10 ; Start player row position
cpu_row: dw 10 ; Start cpu row position
ball_column: dw 78 ; Starting ball column position
ball_row: dw 12 ; Starting ball row position
ball_dir_column: db -2 ; Ball column direction
ball_dir_row: db 1 ; Ball row direction
player_score: db 0x30 ; 0 in ascii
cpu_score: db 0x30 ; 0 in ascii
cpu_delay: db 0 ; # of cycles before CPU allowed to move
cpu_ai: db 1 ; CPU AI level
intelligence: db 0 ;
;---------------------MESSAGES----------------------;
win_msg dw 0x0257,0x0249,0x024E,0x0221 ; WIN!
lose_msg dw 0x044C,0x044F,0x0453,0x0445 ; LOSE
play_msg dw 0x0250,0x024C,0x0241,0x0259,0x0220 ; PLAY
dw 0x0241,0x0247,0x0241,0x0249,0x024E ; AGAIN
dw 0x0228,0x0279,0x023D,0x0259,0x0245 ; ( y=YES
dw 0x0253,0x0220,0x0271,0x023D,0x0251 ; q=QUIT)?
dw 0x0255,0x0249,0x0254,0x0229,0x023F
welcome_msg db '***Welcome to Pong Game for InpyoOS***',0
line1 db 'Play against the computer using the up',0
line2 db 'down arrow keys, score 7 points to win!',0
|
gcc-gcc-7_3_0-release/gcc/ada/s-stusta.adb | best08618/asylo | 7 | 10960 | <gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . S T A C K _ U S A G E . T A S K I N G --
-- --
-- B o d y --
-- --
-- Copyright (C) 2009-2011, 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- 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/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
with System.Stack_Usage;
-- This is why this package is part of GNARL:
with System.Tasking.Debug;
with System.Task_Primitives.Operations;
with System.IO;
package body System.Stack_Usage.Tasking is
use System.IO;
procedure Report_For_Task (Id : System.Tasking.Task_Id);
-- A generic procedure calculating stack usage for a given task
procedure Compute_All_Tasks;
-- Compute the stack usage for all tasks and saves it in
-- System.Stack_Usage.Result_Array
procedure Compute_Current_Task;
-- Compute the stack usage for a given task and saves it in the precise
-- slot in System.Stack_Usage.Result_Array;
procedure Report_Impl (All_Tasks : Boolean; Do_Print : Boolean);
-- Report the stack usage of either all tasks (All_Tasks = True) or of the
-- current task (All_Task = False). If Print is True, then results are
-- printed on stderr
procedure Convert
(TS : System.Stack_Usage.Task_Result;
Res : out Stack_Usage_Result);
-- Convert an object of type System.Stack_Usage in a Stack_Usage_Result
-------------
-- Convert --
-------------
procedure Convert
(TS : System.Stack_Usage.Task_Result;
Res : out Stack_Usage_Result) is
begin
Res := TS;
end Convert;
---------------------
-- Report_For_Task --
---------------------
procedure Report_For_Task (Id : System.Tasking.Task_Id) is
begin
System.Stack_Usage.Compute_Result (Id.Common.Analyzer);
System.Stack_Usage.Report_Result (Id.Common.Analyzer);
end Report_For_Task;
-----------------------
-- Compute_All_Tasks --
-----------------------
procedure Compute_All_Tasks is
Id : System.Tasking.Task_Id;
use type System.Tasking.Task_Id;
begin
if not System.Stack_Usage.Is_Enabled then
Put_Line ("Stack Usage not enabled: bind with -uNNN switch");
else
-- Loop over all tasks
for J in System.Tasking.Debug.Known_Tasks'First + 1
.. System.Tasking.Debug.Known_Tasks'Last
loop
Id := System.Tasking.Debug.Known_Tasks (J);
exit when Id = null;
-- Calculate the task usage for a given task
Report_For_Task (Id);
end loop;
end if;
end Compute_All_Tasks;
--------------------------
-- Compute_Current_Task --
--------------------------
procedure Compute_Current_Task is
begin
if not System.Stack_Usage.Is_Enabled then
Put_Line ("Stack Usage not enabled: bind with -uNNN switch");
else
-- The current task
Report_For_Task (System.Tasking.Self);
end if;
end Compute_Current_Task;
-----------------
-- Report_Impl --
-----------------
procedure Report_Impl (All_Tasks : Boolean; Do_Print : Boolean) is
begin
-- Lock the runtime
System.Task_Primitives.Operations.Lock_RTS;
-- Calculate results
if All_Tasks then
Compute_All_Tasks;
else
Compute_Current_Task;
end if;
-- Output results
if Do_Print then
System.Stack_Usage.Output_Results;
end if;
-- Unlock the runtime
System.Task_Primitives.Operations.Unlock_RTS;
end Report_Impl;
---------------------
-- Report_All_Task --
---------------------
procedure Report_All_Tasks is
begin
Report_Impl (True, True);
end Report_All_Tasks;
-------------------------
-- Report_Current_Task --
-------------------------
procedure Report_Current_Task is
Res : Stack_Usage_Result;
begin
Res := Get_Current_Task_Usage;
Print (Res);
end Report_Current_Task;
-------------------------
-- Get_All_Tasks_Usage --
-------------------------
function Get_All_Tasks_Usage return Stack_Usage_Result_Array is
Res : Stack_Usage_Result_Array
(1 .. System.Stack_Usage.Result_Array'Length);
begin
Report_Impl (True, False);
for J in Res'Range loop
Convert (System.Stack_Usage.Result_Array (J), Res (J));
end loop;
return Res;
end Get_All_Tasks_Usage;
----------------------------
-- Get_Current_Task_Usage --
----------------------------
function Get_Current_Task_Usage return Stack_Usage_Result is
Res : Stack_Usage_Result;
Original : System.Stack_Usage.Task_Result;
Found : Boolean := False;
begin
Report_Impl (False, False);
-- Look for the task info in System.Stack_Usage.Result_Array;
-- the search is based on task name
for T in System.Stack_Usage.Result_Array'Range loop
if System.Stack_Usage.Result_Array (T).Task_Name =
System.Tasking.Self.Common.Analyzer.Task_Name
then
Original := System.Stack_Usage.Result_Array (T);
Found := True;
exit;
end if;
end loop;
-- Be sure a task has been found
pragma Assert (Found);
Convert (Original, Res);
return Res;
end Get_Current_Task_Usage;
-----------
-- Print --
-----------
procedure Print (Obj : Stack_Usage_Result) is
Pos : Positive := Obj.Task_Name'Last;
begin
-- Simply trim the string containing the task name
for S in Obj.Task_Name'Range loop
if Obj.Task_Name (S) = ' ' then
Pos := S;
exit;
end if;
end loop;
declare
T_Name : constant String :=
Obj.Task_Name (Obj.Task_Name'First .. Pos);
begin
Put_Line
("| " & T_Name & " | " & Natural'Image (Obj.Stack_Size) &
Natural'Image (Obj.Value));
end;
end Print;
end System.Stack_Usage.Tasking;
|
m3-sys/m3cc/gcc-apple/gcc/config/i386/lib1funcs.asm | jaykrell/cm3 | 105 | 3455 | <gh_stars>100-1000
# APPLE LOCAL file 4099000
#ifndef __x86_64__
#define THUNK(REG) \
.private_extern ___i686.get_pc_thunk.REG ;\
___i686.get_pc_thunk.REG: ;\
movl (%esp,1),%REG ;\
ret ;
#ifdef L_get_pc_thunk_ax
THUNK(eax)
#endif
#ifdef L_get_pc_thunk_dx
THUNK(edx)
#endif
#ifdef L_get_pc_thunk_cx
THUNK(ecx)
#endif
#ifdef L_get_pc_thunk_bx
THUNK(ebx)
#endif
#ifdef L_get_pc_thunk_si
THUNK(esi)
#endif
#ifdef L_get_pc_thunk_di
THUNK(edi)
#endif
#ifdef L_get_pc_thunk_bp
THUNK(ebp)
#endif
#endif
|
programs/oeis/317/A317335.asm | neoneye/loda | 22 | 179613 | ; A317335: a(n) = A317332(n) - 8*n.
; 1,1,-2,1,1,-2,-2,1,1,1,-2,-2,1,-2,-2,1,1,1,-2,1,1,-2,-2,-2,1,1,-2,-2,1,-2,-2,1,1,1,-2,1,1,-2,-2,1,1,1,-2,-2,1,-2,-2,-2,1,1,-2,1,1,-2,-2,-2,1,1,-2,-2,1,-2,-2,1,1,1,-2,1,1,-2,-2,1,1,1,-2,-2,1,-2,-2,1,1,1,-2,1,1,-2,-2,-2,1,1,-2,-2,1,-2,-2,-2,1,1,-2,1
seq $0,34947 ; Jacobi (or Kronecker) symbol (-1/n).
mul $0,2
min $0,1
|
Definition/LogicalRelation/Substitution/Introductions/IdRefl.agda | CoqHott/logrel-mltt | 2 | 4079 | {-# OPTIONS --safe #-}
open import Definition.Typed.EqualityRelation
module Definition.LogicalRelation.Substitution.Introductions.IdRefl {{eqrel : EqRelSet}} where
open EqRelSet {{...}}
open import Definition.Untyped
open import Definition.Untyped.Properties
open import Definition.Typed
open import Definition.Typed.Properties
open import Definition.LogicalRelation
open import Definition.LogicalRelation.Irrelevance
open import Definition.LogicalRelation.Properties
open import Definition.LogicalRelation.Substitution
open import Definition.LogicalRelation.Substitution.Properties
open import Definition.LogicalRelation.Substitution.Conversion
open import Definition.LogicalRelation.Substitution.Reduction
open import Definition.LogicalRelation.Substitution.Reflexivity
open import Definition.LogicalRelation.Substitution.ProofIrrelevance
open import Definition.LogicalRelation.Substitution.MaybeEmbed
open import Definition.LogicalRelation.Substitution.Introductions.Nat
open import Definition.LogicalRelation.Substitution.Introductions.Natrec
open import Definition.LogicalRelation.Substitution.Introductions.Empty
open import Definition.LogicalRelation.Substitution.Introductions.Emptyrec
open import Definition.LogicalRelation.Substitution.Introductions.Universe
open import Definition.LogicalRelation.Substitution.Introductions.Pi
open import Definition.LogicalRelation.Substitution.Introductions.Sigma
open import Definition.LogicalRelation.Substitution.Introductions.Id
open import Definition.LogicalRelation.Substitution.Introductions.IdUPiPi
open import Definition.LogicalRelation.Substitution.Introductions.Cast
open import Definition.LogicalRelation.Substitution.Introductions.CastPi
open import Definition.LogicalRelation.Substitution.Introductions.Lambda
open import Definition.LogicalRelation.Substitution.Introductions.Application
open import Definition.LogicalRelation.Substitution.Introductions.Pair
open import Definition.LogicalRelation.Substitution.Introductions.Fst
open import Definition.LogicalRelation.Substitution.Introductions.Snd
open import Definition.LogicalRelation.Substitution.Introductions.SingleSubst
open import Definition.LogicalRelation.Substitution.Introductions.Transp
open import Definition.LogicalRelation.Fundamental.Variable
import Definition.LogicalRelation.Substitution.ProofIrrelevance as PI
import Definition.LogicalRelation.Substitution.Irrelevance as S
open import Definition.LogicalRelation.Substitution.Weakening
open import Tools.Product
open import Tools.Unit
open import Tools.Nat
import Tools.PropositionalEquality as PE
Idreflᵛ : ∀{Γ A l t}
→ ([Γ] : ⊩ᵛ Γ)
→ ([A] : Γ ⊩ᵛ⟨ ∞ ⟩ A ^ [ ! , ι l ] / [Γ])
→ ([t] : Γ ⊩ᵛ⟨ ∞ ⟩ t ∷ A ^ [ ! , ι l ] / [Γ] / [A])
→ let [Id] = Idᵛ {A = A} {t = t} {u = t } [Γ] [A] [t] [t]
in Γ ⊩ᵛ⟨ ∞ ⟩ Idrefl A t ∷ Id A t t ^ [ % , ι l ] / [Γ] / [Id]
Idreflᵛ {Γ} {A} {l} {t} [Γ] [A] [t] =
let [Id] = Idᵛ {A = A} {t = t} {u = t } [Γ] [A] [t] [t]
in validityIrr {A = Id A t t} {t = Idrefl A t} [Γ] [Id] λ ⊢Δ [σ] → Idreflⱼ (escapeTerm (proj₁ ([A] ⊢Δ [σ])) (proj₁ ([t] ⊢Δ [σ])))
castreflᵛ : ∀{Γ A t}
→ ([Γ] : ⊩ᵛ Γ)
→ ([UA] : Γ ⊩ᵛ⟨ ∞ ⟩ U ⁰ ^ [ ! , next ⁰ ] / [Γ])
→ ([A]ₜ : Γ ⊩ᵛ⟨ ∞ ⟩ A ∷ U ⁰ ^ [ ! , next ⁰ ] / [Γ] / [UA] )
→ ([A] : Γ ⊩ᵛ⟨ ∞ ⟩ A ^ [ ! , ι ⁰ ] / [Γ])
→ ([t]ₜ : Γ ⊩ᵛ⟨ ∞ ⟩ t ∷ A ^ [ ! , ι ⁰ ] / [Γ] / [A])
→ let [Id] : Γ ⊩ᵛ⟨ ∞ ⟩ Id A t (cast ⁰ A A (Idrefl (U ⁰) A) t) ^ [ % , ι ⁰ ] / [Γ]
[Id] = Idᵛ {A = A} {t = t} {u = cast ⁰ A A (Idrefl (U ⁰) A) t} [Γ] [A] [t]ₜ
(castᵗᵛ {A = A} {B = A} {t = t} {e = Idrefl (U ⁰) A} [Γ] [UA] [A]ₜ [A]ₜ [A] [A] [t]ₜ
(Idᵛ {A = U _} {t = A} {u = A} [Γ] [UA] [A]ₜ [A]ₜ)
(Idreflᵛ {A = U _} {t = A} [Γ] [UA] [A]ₜ))
in Γ ⊩ᵛ⟨ ∞ ⟩ castrefl A t ∷ Id A t (cast ⁰ A A (Idrefl (U ⁰) A) t) ^ [ % , ι ⁰ ] / [Γ] / [Id]
castreflᵛ {Γ} {A} {t} [Γ] [UA] [A]ₜ [A] [t]ₜ =
let [Id] : Γ ⊩ᵛ⟨ ∞ ⟩ Id A t (cast ⁰ A A (Idrefl (U ⁰) A) t) ^ [ % , ι ⁰ ] / [Γ]
[Id] = Idᵛ {A = A} {t = t} {u = cast ⁰ A A (Idrefl (U ⁰) A) t} [Γ] [A] [t]ₜ
(castᵗᵛ {A = A} {B = A} {t = t} {e = Idrefl (U ⁰) A} [Γ] [UA] [A]ₜ [A]ₜ [A] [A] [t]ₜ
(Idᵛ {A = U _} {t = A} {u = A} [Γ] [UA] [A]ₜ [A]ₜ)
(Idreflᵛ {A = U _} {t = A} [Γ] [UA] [A]ₜ))
in validityIrr {A = Id A t (cast ⁰ A A (Idrefl (U ⁰) A) t)} {t = castrefl A t}
[Γ] [Id] λ ⊢Δ [σ] → castreflⱼ (escapeTerm (proj₁ ([UA] ⊢Δ [σ])) (proj₁ ([A]ₜ ⊢Δ [σ]))) (escapeTerm (proj₁ ([A] ⊢Δ [σ])) (proj₁ ([t]ₜ ⊢Δ [σ])))
|
vendor/stdlib/src/Algebra/Props/DistributiveLattice.agda | isabella232/Lemmachine | 56 | 1022 | <filename>vendor/stdlib/src/Algebra/Props/DistributiveLattice.agda
------------------------------------------------------------------------
-- Some derivable properties
------------------------------------------------------------------------
open import Algebra
module Algebra.Props.DistributiveLattice
(dl : DistributiveLattice)
where
open DistributiveLattice dl
import Algebra.Props.Lattice as L; open L lattice public
open import Algebra.Structures
import Algebra.FunctionProperties as P; open P _≈_
import Relation.Binary.EqReasoning as EqR; open EqR setoid
open import Data.Function
open import Data.Product
∨-∧-distrib : _∨_ DistributesOver _∧_
∨-∧-distrib = ∨-∧-distribˡ , ∨-∧-distribʳ
where
∨-∧-distribˡ : _∨_ DistributesOverˡ _∧_
∨-∧-distribˡ x y z = begin
x ∨ y ∧ z ≈⟨ ∨-comm _ _ ⟩
y ∧ z ∨ x ≈⟨ ∨-∧-distribʳ _ _ _ ⟩
(y ∨ x) ∧ (z ∨ x) ≈⟨ ∨-comm _ _ ⟨ ∧-pres-≈ ⟩ ∨-comm _ _ ⟩
(x ∨ y) ∧ (x ∨ z) ∎
∧-∨-distrib : _∧_ DistributesOver _∨_
∧-∨-distrib = ∧-∨-distribˡ , ∧-∨-distribʳ
where
∧-∨-distribˡ : _∧_ DistributesOverˡ _∨_
∧-∨-distribˡ x y z = begin
x ∧ (y ∨ z) ≈⟨ sym (proj₂ absorptive _ _) ⟨ ∧-pres-≈ ⟩ refl ⟩
(x ∧ (x ∨ y)) ∧ (y ∨ z) ≈⟨ (refl ⟨ ∧-pres-≈ ⟩ ∨-comm _ _) ⟨ ∧-pres-≈ ⟩ refl ⟩
(x ∧ (y ∨ x)) ∧ (y ∨ z) ≈⟨ ∧-assoc _ _ _ ⟩
x ∧ ((y ∨ x) ∧ (y ∨ z)) ≈⟨ refl ⟨ ∧-pres-≈ ⟩ sym (proj₁ ∨-∧-distrib _ _ _) ⟩
x ∧ (y ∨ x ∧ z) ≈⟨ sym (proj₁ absorptive _ _) ⟨ ∧-pres-≈ ⟩ refl ⟩
(x ∨ x ∧ z) ∧ (y ∨ x ∧ z) ≈⟨ sym $ proj₂ ∨-∧-distrib _ _ _ ⟩
x ∧ y ∨ x ∧ z ∎
∧-∨-distribʳ : _∧_ DistributesOverʳ _∨_
∧-∨-distribʳ x y z = begin
(y ∨ z) ∧ x ≈⟨ ∧-comm _ _ ⟩
x ∧ (y ∨ z) ≈⟨ ∧-∨-distribˡ _ _ _ ⟩
x ∧ y ∨ x ∧ z ≈⟨ ∧-comm _ _ ⟨ ∨-pres-≈ ⟩ ∧-comm _ _ ⟩
y ∧ x ∨ z ∧ x ∎
-- The dual construction is also a distributive lattice.
∧-∨-isDistributiveLattice : IsDistributiveLattice _≈_ _∧_ _∨_
∧-∨-isDistributiveLattice = record
{ isLattice = ∧-∨-isLattice
; ∨-∧-distribʳ = proj₂ ∧-∨-distrib
}
∧-∨-distributiveLattice : DistributiveLattice
∧-∨-distributiveLattice = record
{ _∧_ = _∨_
; _∨_ = _∧_
; isDistributiveLattice = ∧-∨-isDistributiveLattice
}
|
libsrc/target/sms/load_tiles.asm | jpoikela/z88dk | 640 | 175581 | <reponame>jpoikela/z88dk
SECTION code_clib
PUBLIC load_tiles
PUBLIC _load_tiles
;==============================================================
; load_tiles(unsigned char *data, int index, int count, int bpp)
;==============================================================
; Loads the specified tileset into VRAM
;==============================================================
.load_tiles
._load_tiles
push ix ; save callers ix
ld hl, 4
add hl, sp
ld a, (hl) ; bits per pixel
inc hl
inc hl
ld c, (hl) ; number of tiles to load
inc hl
ld b, (hl)
inc hl
ld e, (hl) ; initial tile index
inc hl
ld d, (hl)
inc hl
push de
ld e, (hl) ; location of tile data
inc hl
ld d, (hl)
inc hl
push de
pop ix ; tile data
pop hl ; initial index
ld d, a ; bpp
; falls through to LoadTiles
;==============================================================
; Tile loader
;==============================================================
; Parameters:
; hl = tile number to start at
; ix = location of tile data
; bc = No. of tiles to load
; d = bits per pixel
;==============================================================
LoadTiles:
push af
push bc
push de
push hl
push ix
; Tell VDP where I want to write (hl<<5)
sla l
rl h
sla l
rl h
sla l
rl h
sla l
rl h
sla l
rl h
ld a,l
out ($bf),a
ld a,h
or $40
out ($bf),a
; I need to output bc*8 bytes so I need to modify bc (<<3)
sla c
rl b
sla c
rl b
sla c
rl b
; Write data
_Loop:
; Restore counter
ld e,d
_DataLoop:
; Write byte
ld a,(ix+0) ;19
out ($be),a
dec e ;4
inc ix ;10
jp nz,_DataLoop ;10
; Restore counter
ld e,d
_BlankLoop:
; Write blank data to fill up the rest of the tile definition
inc e
ld a,e
cp 5
jp z,_NoMoreBlanks
ld a,0
out ($be),a
jp _BlankLoop
_NoMoreBlanks:
dec bc
ld a,b
or c
jp nz,_Loop
pop ix
pop hl
pop de
pop bc
pop af
pop ix ;restore callers ix
ret
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/g-dirope.adb | orb-zhuchen/Orb | 0 | 14184 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . D I R E C T O R Y _ O P E R A T I O N S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1998-2019, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with Ada.IO_Exceptions;
with Ada.Characters.Handling;
with Ada.Strings.Fixed;
with Ada.Unchecked_Deallocation;
with Ada.Unchecked_Conversion;
with System; use System;
with System.CRTL; use System.CRTL;
with GNAT.OS_Lib;
package body GNAT.Directory_Operations is
use Ada;
Filename_Max : constant Integer := 1024;
-- 1024 is the value of FILENAME_MAX in stdio.h
procedure Free is new
Ada.Unchecked_Deallocation (Dir_Type_Value, Dir_Type);
On_Windows : constant Boolean := GNAT.OS_Lib.Directory_Separator = '\';
-- An indication that we are on Windows. Used in Get_Current_Dir, to
-- deal with drive letters in the beginning of absolute paths.
---------------
-- Base_Name --
---------------
function Base_Name
(Path : Path_Name;
Suffix : String := "") return String
is
function Get_File_Names_Case_Sensitive return Integer;
pragma Import
(C, Get_File_Names_Case_Sensitive,
"__gnat_get_file_names_case_sensitive");
Case_Sensitive_File_Name : constant Boolean :=
Get_File_Names_Case_Sensitive = 1;
function Basename
(Path : Path_Name;
Suffix : String := "") return String;
-- This function does the job. The only difference between Basename
-- and Base_Name (the parent function) is that the former is case
-- sensitive, while the latter is not. Path and Suffix are adjusted
-- appropriately before calling Basename under platforms where the
-- file system is not case sensitive.
--------------
-- Basename --
--------------
function Basename
(Path : Path_Name;
Suffix : String := "") return String
is
Cut_Start : Natural :=
Strings.Fixed.Index
(Path, Dir_Seps, Going => Strings.Backward);
Cut_End : Natural;
begin
-- Cut_Start point to the first basename character
Cut_Start := (if Cut_Start = 0 then Path'First else Cut_Start + 1);
-- Cut_End point to the last basename character
Cut_End := Path'Last;
-- If basename ends with Suffix, adjust Cut_End
if Suffix /= ""
and then Path (Path'Last - Suffix'Length + 1 .. Cut_End) = Suffix
then
Cut_End := Path'Last - Suffix'Length;
end if;
Check_For_Standard_Dirs : declare
Offset : constant Integer := Path'First - Base_Name.Path'First;
BN : constant String :=
Base_Name.Path (Cut_Start - Offset .. Cut_End - Offset);
-- Here we use Base_Name.Path to keep the original casing
Has_Drive_Letter : constant Boolean :=
OS_Lib.Path_Separator /= ':';
-- If Path separator is not ':' then we are on a DOS based OS
-- where this character is used as a drive letter separator.
begin
if BN = "." or else BN = ".." then
return "";
elsif Has_Drive_Letter
and then BN'Length > 2
and then Characters.Handling.Is_Letter (BN (BN'First))
and then BN (BN'First + 1) = ':'
then
-- We have a DOS drive letter prefix, remove it
return BN (BN'First + 2 .. BN'Last);
else
return BN;
end if;
end Check_For_Standard_Dirs;
end Basename;
-- Start of processing for Base_Name
begin
if Path'Length <= Suffix'Length then
return Path;
end if;
if Case_Sensitive_File_Name then
return Basename (Path, Suffix);
else
return Basename
(Characters.Handling.To_Lower (Path),
Characters.Handling.To_Lower (Suffix));
end if;
end Base_Name;
----------------
-- Change_Dir --
----------------
procedure Change_Dir (Dir_Name : Dir_Name_Str) is
C_Dir_Name : constant String := Dir_Name & ASCII.NUL;
begin
if chdir (C_Dir_Name) /= 0 then
raise Directory_Error;
end if;
end Change_Dir;
-----------
-- Close --
-----------
procedure Close (Dir : in out Dir_Type) is
Discard : Integer;
pragma Warnings (Off, Discard);
function closedir (directory : DIRs) return Integer;
pragma Import (C, closedir, "__gnat_closedir");
begin
if not Is_Open (Dir) then
raise Directory_Error;
end if;
Discard := closedir (DIRs (Dir.all));
Free (Dir);
end Close;
--------------
-- Dir_Name --
--------------
function Dir_Name (Path : Path_Name) return Dir_Name_Str is
Last_DS : constant Natural :=
Strings.Fixed.Index
(Path, Dir_Seps, Going => Strings.Backward);
begin
if Last_DS = 0 then
-- There is no directory separator, returns current working directory
return "." & Dir_Separator;
else
return Path (Path'First .. Last_DS);
end if;
end Dir_Name;
-----------------
-- Expand_Path --
-----------------
function Expand_Path
(Path : Path_Name;
Mode : Environment_Style := System_Default) return Path_Name
is
Environment_Variable_Char : Character;
pragma Import (C, Environment_Variable_Char, "__gnat_environment_char");
Result : OS_Lib.String_Access := new String (1 .. 200);
Result_Last : Natural := 0;
procedure Append (C : Character);
procedure Append (S : String);
-- Append to Result
procedure Double_Result_Size;
-- Reallocate Result, doubling its size
function Is_Var_Prefix (C : Character) return Boolean;
pragma Inline (Is_Var_Prefix);
procedure Read (K : in out Positive);
-- Update Result while reading current Path starting at position K. If
-- a variable is found, call Var below.
procedure Var (K : in out Positive);
-- Translate variable name starting at position K with the associated
-- environment value.
------------
-- Append --
------------
procedure Append (C : Character) is
begin
if Result_Last = Result'Last then
Double_Result_Size;
end if;
Result_Last := Result_Last + 1;
Result (Result_Last) := C;
end Append;
procedure Append (S : String) is
begin
while Result_Last + S'Length - 1 > Result'Last loop
Double_Result_Size;
end loop;
Result (Result_Last + 1 .. Result_Last + S'Length) := S;
Result_Last := Result_Last + S'Length;
end Append;
------------------------
-- Double_Result_Size --
------------------------
procedure Double_Result_Size is
New_Result : constant OS_Lib.String_Access :=
new String (1 .. 2 * Result'Last);
begin
New_Result (1 .. Result_Last) := Result (1 .. Result_Last);
OS_Lib.Free (Result);
Result := New_Result;
end Double_Result_Size;
-------------------
-- Is_Var_Prefix --
-------------------
function Is_Var_Prefix (C : Character) return Boolean is
begin
return (C = Environment_Variable_Char and then Mode = System_Default)
or else
(C = '$' and then (Mode = UNIX or else Mode = Both))
or else
(C = '%' and then (Mode = DOS or else Mode = Both));
end Is_Var_Prefix;
----------
-- Read --
----------
procedure Read (K : in out Positive) is
P : Character;
begin
For_All_Characters : loop
if Is_Var_Prefix (Path (K)) then
P := Path (K);
-- Could be a variable
if K < Path'Last then
if Path (K + 1) = P then
-- Not a variable after all, this is a double $ or %,
-- just insert one in the result string.
Append (P);
K := K + 1;
else
-- Let's parse the variable
Var (K);
end if;
else
-- We have an ending $ or % sign
Append (P);
end if;
else
-- This is a standard character, just add it to the result
Append (Path (K));
end if;
-- Skip to next character
K := K + 1;
exit For_All_Characters when K > Path'Last;
end loop For_All_Characters;
end Read;
---------
-- Var --
---------
procedure Var (K : in out Positive) is
P : constant Character := Path (K);
T : Character;
E : Positive;
begin
K := K + 1;
if P = '%' or else Path (K) = '{' then
-- Set terminator character
if P = '%' then
T := '%';
else
T := '}';
K := K + 1;
end if;
-- Look for terminator character, k point to the first character
-- for the variable name.
E := K;
loop
E := E + 1;
exit when Path (E) = T or else E = Path'Last;
end loop;
if Path (E) = T then
-- OK found, translate with environment value
declare
Env : OS_Lib.String_Access :=
OS_Lib.Getenv (Path (K .. E - 1));
begin
Append (Env.all);
OS_Lib.Free (Env);
end;
else
-- No terminator character, not a variable after all or a
-- syntax error, ignore it, insert string as-is.
Append (P); -- Add prefix character
if T = '}' then -- If we were looking for curly bracket
Append ('{'); -- terminator, add the curly bracket
end if;
Append (Path (K .. E));
end if;
else
-- The variable name is everything from current position to first
-- non letter/digit character.
E := K;
-- Check that first character is a letter
if Characters.Handling.Is_Letter (Path (E)) then
E := E + 1;
Var_Name : loop
exit Var_Name when E > Path'Last;
if Characters.Handling.Is_Letter (Path (E))
or else Characters.Handling.Is_Digit (Path (E))
then
E := E + 1;
else
exit Var_Name;
end if;
end loop Var_Name;
E := E - 1;
declare
Env : OS_Lib.String_Access := OS_Lib.Getenv (Path (K .. E));
begin
Append (Env.all);
OS_Lib.Free (Env);
end;
else
-- This is not a variable after all
Append ('$');
Append (Path (E));
end if;
end if;
K := E;
end Var;
-- Start of processing for Expand_Path
begin
declare
K : Positive := Path'First;
begin
Read (K);
declare
Returned_Value : constant String := Result (1 .. Result_Last);
begin
OS_Lib.Free (Result);
return Returned_Value;
end;
end;
end Expand_Path;
--------------------
-- File_Extension --
--------------------
function File_Extension (Path : Path_Name) return String is
First : Natural :=
Strings.Fixed.Index
(Path, Dir_Seps, Going => Strings.Backward);
Dot : Natural;
begin
if First = 0 then
First := Path'First;
end if;
Dot := Strings.Fixed.Index (Path (First .. Path'Last),
".",
Going => Strings.Backward);
if Dot = 0 or else Dot = Path'Last then
return "";
else
return Path (Dot .. Path'Last);
end if;
end File_Extension;
---------------
-- File_Name --
---------------
function File_Name (Path : Path_Name) return String is
begin
return Base_Name (Path);
end File_Name;
---------------------
-- Format_Pathname --
---------------------
function Format_Pathname
(Path : Path_Name;
Style : Path_Style := System_Default) return String
is
N_Path : String := Path;
K : Positive := N_Path'First;
Prev_Dirsep : Boolean := False;
begin
if Dir_Separator = '\'
and then Path'Length > 1
and then Path (K .. K + 1) = "\\"
then
if Style = UNIX then
N_Path (K .. K + 1) := "//";
end if;
K := K + 2;
end if;
for J in K .. Path'Last loop
if Strings.Maps.Is_In (Path (J), Dir_Seps) then
if not Prev_Dirsep then
case Style is
when UNIX => N_Path (K) := '/';
when DOS => N_Path (K) := '\';
when System_Default => N_Path (K) := Dir_Separator;
end case;
K := K + 1;
end if;
Prev_Dirsep := True;
else
N_Path (K) := Path (J);
K := K + 1;
Prev_Dirsep := False;
end if;
end loop;
return N_Path (N_Path'First .. K - 1);
end Format_Pathname;
---------------------
-- Get_Current_Dir --
---------------------
Max_Path : Integer;
pragma Import (C, Max_Path, "__gnat_max_path_len");
function Get_Current_Dir return Dir_Name_Str is
Current_Dir : String (1 .. Max_Path + 1);
Last : Natural;
begin
Get_Current_Dir (Current_Dir, Last);
return Current_Dir (1 .. Last);
end Get_Current_Dir;
procedure Get_Current_Dir (Dir : out Dir_Name_Str; Last : out Natural) is
Path_Len : Natural := Max_Path;
Buffer : String (Dir'First .. Dir'First + Max_Path + 1);
procedure Local_Get_Current_Dir
(Dir : System.Address;
Length : System.Address);
pragma Import (C, Local_Get_Current_Dir, "__gnat_get_current_dir");
begin
Local_Get_Current_Dir (Buffer'Address, Path_Len'Address);
if Path_Len = 0 then
raise Ada.IO_Exceptions.Use_Error
with "current directory does not exist";
end if;
Last :=
(if Dir'Length > Path_Len then Dir'First + Path_Len - 1 else Dir'Last);
Dir (Buffer'First .. Last) := Buffer (Buffer'First .. Last);
-- By default, the drive letter on Windows is in upper case
if On_Windows and then Last > Dir'First and then
Dir (Dir'First + 1) = ':'
then
Dir (Dir'First) :=
Ada.Characters.Handling.To_Upper (Dir (Dir'First));
end if;
end Get_Current_Dir;
-------------
-- Is_Open --
-------------
function Is_Open (Dir : Dir_Type) return Boolean is
begin
return Dir /= Null_Dir
and then System.Address (Dir.all) /= System.Null_Address;
end Is_Open;
--------------
-- Make_Dir --
--------------
procedure Make_Dir (Dir_Name : Dir_Name_Str) is
C_Dir_Name : constant String := Dir_Name & ASCII.NUL;
begin
if CRTL.mkdir (C_Dir_Name, Unspecified) /= 0 then
raise Directory_Error;
end if;
end Make_Dir;
----------
-- Open --
----------
procedure Open
(Dir : out Dir_Type;
Dir_Name : Dir_Name_Str)
is
function opendir (file_name : String) return DIRs;
pragma Import (C, opendir, "__gnat_opendir");
C_File_Name : constant String := Dir_Name & ASCII.NUL;
begin
Dir := new Dir_Type_Value'(Dir_Type_Value (opendir (C_File_Name)));
if not Is_Open (Dir) then
Free (Dir);
Dir := Null_Dir;
raise Directory_Error;
end if;
end Open;
----------
-- Read --
----------
procedure Read
(Dir : Dir_Type;
Str : out String;
Last : out Natural)
is
Filename_Addr : Address;
Filename_Len : aliased Integer;
Buffer : array (0 .. Filename_Max + 12) of Character;
-- 12 is the size of the dirent structure (see dirent.h), without the
-- field for the filename.
function readdir_gnat
(Directory : System.Address;
Buffer : System.Address;
Last : not null access Integer) return System.Address;
pragma Import (C, readdir_gnat, "__gnat_readdir");
begin
if not Is_Open (Dir) then
raise Directory_Error;
end if;
Filename_Addr :=
readdir_gnat
(System.Address (Dir.all), Buffer'Address, Filename_Len'Access);
if Filename_Addr = System.Null_Address then
Last := 0;
return;
end if;
Last :=
(if Str'Length > Filename_Len then Str'First + Filename_Len - 1
else Str'Last);
declare
subtype Path_String is String (1 .. Filename_Len);
type Path_String_Access is access Path_String;
function Address_To_Access is new
Ada.Unchecked_Conversion
(Source => Address,
Target => Path_String_Access);
Path_Access : constant Path_String_Access :=
Address_To_Access (Filename_Addr);
begin
for J in Str'First .. Last loop
Str (J) := Path_Access (J - Str'First + 1);
end loop;
end;
end Read;
-------------------------
-- Read_Is_Thread_Safe --
-------------------------
function Read_Is_Thread_Safe return Boolean is
function readdir_is_thread_safe return Integer;
pragma Import
(C, readdir_is_thread_safe, "__gnat_readdir_is_thread_safe");
begin
return (readdir_is_thread_safe /= 0);
end Read_Is_Thread_Safe;
----------------
-- Remove_Dir --
----------------
procedure Remove_Dir
(Dir_Name : Dir_Name_Str;
Recursive : Boolean := False)
is
C_Dir_Name : constant String := Dir_Name & ASCII.NUL;
Last : Integer;
Str : String (1 .. Filename_Max);
Success : Boolean;
Current_Dir : Dir_Type;
begin
-- Remove the directory only if it is empty
if not Recursive then
if rmdir (C_Dir_Name) /= 0 then
raise Directory_Error;
end if;
-- Remove directory and all files and directories that it may contain
else
Open (Current_Dir, Dir_Name);
loop
Read (Current_Dir, Str, Last);
exit when Last = 0;
if GNAT.OS_Lib.Is_Directory
(Dir_Name & Dir_Separator & Str (1 .. Last))
then
if Str (1 .. Last) /= "."
and then
Str (1 .. Last) /= ".."
then
-- Recursive call to remove a subdirectory and all its
-- files.
Remove_Dir
(Dir_Name & Dir_Separator & Str (1 .. Last),
True);
end if;
else
GNAT.OS_Lib.Delete_File
(Dir_Name & Dir_Separator & Str (1 .. Last),
Success);
if not Success then
raise Directory_Error;
end if;
end if;
end loop;
Close (Current_Dir);
Remove_Dir (Dir_Name);
end if;
end Remove_Dir;
end GNAT.Directory_Operations;
|
tools/scitools/conf/understand/ada/ada05/a-wtenio.ads | brucegua/moocos | 1 | 12488 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ T E X T _ I O . E N U M E R A T I O N _ I O --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
--
--
--
--
--
--
--
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- In Ada 95, the package Ada.Wide_Text_IO.Enumeration_IO is a subpackage
-- of Wide_Text_IO. In GNAT we make it a child package to avoid loading the
-- necessary code if Enumeration_IO is not instantiated. See the routine
-- Rtsfind.Text_IO_Kludge for a description of how we patch up the difference
-- in semantics so that it is invisible to the Ada programmer.
private generic
type Enum is (<>);
package Ada.Wide_Text_IO.Enumeration_IO is
Default_Width : Field := 0;
Default_Setting : Type_Set := Upper_Case;
procedure Get (File : File_Type; Item : out Enum);
procedure Get (Item : out Enum);
procedure Put
(File : File_Type;
Item : Enum;
Width : Field := Default_Width;
Set : Type_Set := Default_Setting);
procedure Put
(Item : Enum;
Width : Field := Default_Width;
Set : Type_Set := Default_Setting);
procedure Get
(From : Wide_String;
Item : out Enum;
Last : out Positive);
procedure Put
(To : out Wide_String;
Item : Enum;
Set : Type_Set := Default_Setting);
end Ada.Wide_Text_IO.Enumeration_IO;
|
oeis/022/A022316.asm | neoneye/loda-programs | 11 | 9826 | ; A022316: a(n) = a(n-1) + a(n-2) + 1, with a(0) = 0 and a(1) = 11.
; Submitted by <NAME>(s4)
; 0,11,12,24,37,62,100,163,264,428,693,1122,1816,2939,4756,7696,12453,20150,32604,52755,85360,138116,223477,361594,585072,946667,1531740,2478408,4010149,6488558,10498708,16987267,27485976,44473244,71959221,116432466,188391688,304824155,493215844,798040000,1291255845,2089295846,3380551692,5469847539,8850399232,14320246772,23170646005,37490892778,60661538784,98152431563,158813970348,256966401912,415780372261,672746774174,1088527146436,1761273920611,2849801067048,4611074987660,7460876054709
mov $1,1
mov $2,11
lpb $0
sub $0,1
mov $3,$2
mov $2,$1
add $1,$3
lpe
mov $0,$1
sub $0,1
|
msp430x2/msp430g2452/svd/msp430_svd-watchdog_timer.ads | ekoeppen/MSP430_Generic_Ada_Drivers | 0 | 15308 | <gh_stars>0
-- This spec has been automatically generated from out.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
-- Watchdog Timer
package MSP430_SVD.WATCHDOG_TIMER is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- WDTCTL_WDTIS array
type WDTCTL_WDTIS_Field_Array is array (0 .. 1) of MSP430_SVD.Bit
with Component_Size => 1, Size => 2;
-- Type definition for WDTCTL_WDTIS
type WDTCTL_WDTIS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WDTIS as a value
Val : MSP430_SVD.UInt2;
when True =>
-- WDTIS as an array
Arr : WDTCTL_WDTIS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for WDTCTL_WDTIS_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Watchdog Timer Control
type WDTCTL_Register is record
-- WDTIS0
WDTIS : WDTCTL_WDTIS_Field := (As_Array => False, Val => 16#0#);
-- WDTSSEL
WDTSSEL : MSP430_SVD.Bit := 16#0#;
-- WDTCNTCL
WDTCNTCL : MSP430_SVD.Bit := 16#0#;
-- WDTTMSEL
WDTTMSEL : MSP430_SVD.Bit := 16#0#;
-- WDTNMI
WDTNMI : MSP430_SVD.Bit := 16#0#;
-- WDTNMIES
WDTNMIES : MSP430_SVD.Bit := 16#0#;
-- WDTHOLD
WDTHOLD : MSP430_SVD.Bit := 16#0#;
-- unspecified
Reserved_8_15 : MSP430_SVD.Byte := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 16,
Bit_Order => System.Low_Order_First;
for WDTCTL_Register use record
WDTIS at 0 range 0 .. 1;
WDTSSEL at 0 range 2 .. 2;
WDTCNTCL at 0 range 3 .. 3;
WDTTMSEL at 0 range 4 .. 4;
WDTNMI at 0 range 5 .. 5;
WDTNMIES at 0 range 6 .. 6;
WDTHOLD at 0 range 7 .. 7;
Reserved_8_15 at 0 range 8 .. 15;
end record;
-----------------
-- Peripherals --
-----------------
-- Watchdog Timer
type WATCHDOG_TIMER_Peripheral is record
-- Watchdog Timer Control
WDTCTL : aliased WDTCTL_Register;
end record
with Volatile;
for WATCHDOG_TIMER_Peripheral use record
WDTCTL at 0 range 0 .. 15;
end record;
-- Watchdog Timer
WATCHDOG_TIMER_Periph : aliased WATCHDOG_TIMER_Peripheral
with Import, Address => WATCHDOG_TIMER_Base;
end MSP430_SVD.WATCHDOG_TIMER;
|
lab5/upper_case_word_letter/upper_case_word.asm | samdsk/lab_arch2 | 0 | 27341 | <filename>lab5/upper_case_word_letter/upper_case_word.asm
# procedura che converte in maiuscolo una stringa di byte (assumiamo solo caratteri minuscoli)
# conversione inplace -> sovrascrive il vettore in argomento
# $a0 <- indirizzo del vettore
.data
.text
.globl upper_case_word
upper_case_word:
#preambolo
move $t0 $fp #copio fp addr attuale
addi $fp $sp -4 #inizializzo il mio stack frame
sw $t0 0($fp) #salvo vecchio frame addr nello stack
sw $s0 -4($fp) #salvo $s0 e $s1
sw $s1 -8($fp)
sw $ra -12($fp) #salvo return addr
addi $sp $fp -12 #aggiorno la posizione del stack pointer
#codice
move $s0 $a0 #in $s0 ho l'indirizzo dell'elemento corrente del vettore
# "abc" -> abc\0
loop:
lb $s1 0($s0) #in $s1 il valore dell'elemento corrent del vettore
beq $s1 $0 end
move $a0 $s1
jal upper_case_letter
sb $v0 0($s0)
addiu $s0 $s0 1
j loop
end:
#epilogo
lw $t0 0($fp) #salvo temp fram addr iniziale
lw $s0 -4($fp) #ripristino registri $s0...
lw $s1 -8($fp)
lw $ra -12($fp) #ripristino return addr
move $fp $t0 #setto frame addr iniziale
jr $ra
|
base/mvdm/wow16/kernel31/ld.asm | npocmaka/Windows-Server-2003 | 17 | 6756 | <reponame>npocmaka/Windows-Server-2003
.xlist
include kernel.inc
include newexe.inc
include tdb.inc
include pdb.inc
include protect.inc
.list
NEWEPME = NEPRIVLIB ; flag saying Call WEP on exit
externW pLocalHeap
externW pStackTop
DataBegin
externB num_tasks
externB graphics
externB fBooting
externB Kernel_flags
externD Dos_Flag_Addr
externB WOAName
externW fLMdepth
externW headPDB
externW curTDB
externW loadTDB
externW Win_PDB
externW topPDB
externW hExeHead
;externW EMS_calc_swap_line
externW WinFlags
externW hGDI
externW hUser
ifdef WOW
externW OFContinueSearch
endif
externD pMBoxProc
externD pGetFreeSystemResources
externD dressed_for_success
externD lpGPChain
;** Diagnostic mode stuff
externW fDiagMode
externB szLoadStart
externB szCRLF
externB szLoadSuccess
externB szLoadFail
externB szFailCode
externB szCodeString
; Look for module in Module Compatibilty section of win.ini
szModuleCompatibility DB 'ModuleCompatibility',0
DataEnd
externFP Yield
externFP CreateTask
externFP GlobalAlloc
externFP GlobalSize
externFP GlobalLock
externFP GlobalUnlock
externFP GlobalFree
externFP LocalAlloc
externFP LocalFree
externFP LocalCountFree
externFP LoadModule
externFP lstrlen
externFP _lclose
externFP FreeModule
externFP GetModuleHandle
externFP LoadExeHeader
externFP GetExePtr
externFP GetProcAddress
externFP MyOpenFile
externFP FarGetCachedFileHandle
externFP FarEntProcAddress
externFP FlushCachedFileHandle
externFP FarMyLock
externFP FarMyFree
externFP FarMyUpper
externFP FarLoadSegment
externFP FarDeleteTask
externFP FarUnlinkObject
externFP Far_genter
externFP AllocSelector
externFP FreeSelector
externFP LongPtrAdd
externFP GetProfileInt
ifdef WOW
externFP StartWOWTask
externFP WowIsKnownDLL
externFP LongPtrAddWOW
externFP AllocSelectorWOW
externFP WOWLoadModule
externFP WowShutdownTimer
externB fShutdownTimerStarted
externB fExitOnLastApp
externFP WowSyncTask
endif
ifdef FE_SB
externFP FarMyIsDBCSLeadByte
endif
externFP FreeTDB
;** Diagnostic mode
externFP DiagOutput
sBegin CODE
assumes CS,CODE
assumes DS,NOTHING
assumes ES,NOTHING
sEnd CODE
sBegin NRESCODE
assumes CS,NRESCODE
assumes DS,NOTHING
assumes ES,NOTHING
externB szProtectCap
externB msgRealModeApp1
externB msgRealModeApp2
externNP MapDStoDATA
externNP FindExeFile
externNP FindExeInfo
externNP AddModule
externNP DelModule
externNP GetInstance
externNP IncExeUsage
externNP DecExeUsage
externNP AllocAllSegs
externNP PreloadResources
externNP StartProcAddress
externNP StartLibrary
externNP GetStackPtr
externNP StartTask
IFNDEF NO_APPLOADER
externNP BootAppl
ENDIF ;!NO_APPLOADER
DOS_FLAG_EXEC_OPEN equ 1
SET_DOS_FLAG_EXEC_OPEN macro
push es
push bx
mov es, Dos_Flag_Addr.sel
mov bx, Dos_Flag_Addr.off
or BYTE PTR es:[bx], DOS_FLAG_EXEC_OPEN
pop bx
pop es
endm
RESET_DOS_FLAG_EXEC_OPEN macro
push es
push bx
mov es, Dos_Flag_Addr.sel
mov bx, Dos_Flag_Addr.off
and BYTE PTR es:[bx], NOT DOS_FLAG_EXEC_OPEN
pop bx
pop es
endm
;-----------------------------------------------------------------------;
; OpenApplEnv ;
; Calls CreateTask ;
; Allocates temporary stack ;
; Arguments: ;
; ;
; Returns: ;
; ax = selector of load-time stack ;
; Error Returns: ;
; ax = 0 ;
; Registers Preserved: ;
; ;
; Registers Destroyed: ;
; ;
; Calls: ;
; ;
; History: ;
; ;
; Tue 16-Jan-1990 21:13:51 -by- <NAME> [davidw] ;
; Ya know, it seems to me that most of the below ain't necessary ;
; for small frame EMS. But it's too late to change it now. ;
; ;
; Fri 07-Apr-1989 23:15:42 -by- <NAME> [davidw] ;
; Added support for task ExeHeaders above The Line in Large ;
; Frame EMS. ;
; ;
; Tue Oct 20, 1987 07:48:51p -by- <NAME> [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
LOADSTACKSIZE = 2048
assumes ds,nothing
assumes es,nothing
cProc OpenApplEnv,<PUBLIC,NEAR>,<ds,si,di>
parmD lpPBlock
parmW pExe
parmW fWOA
; localW myCodeDS
; localW myCurTDB
; localW myLoadTDB
cBegin
ReSetKernelDS ; Assume DS:KRNLDS
cCall CreateTask,<lpPBlock,pExe,fWOA>
or ax,ax
jz oae_done
test kernel_flags,KF_pUID ; All done booting?
jz oae_done
xor ax,ax
mov bx,LOADSTACKSIZE
mov cx,(GA_ALLOC_LOW or GA_SHAREABLE) shl 8 or GA_ZEROINIT or GA_MOVEABLE
cCall GlobalAlloc,<cx,ax,bx>
or ax,ax
jz oae_done
cCall GlobalLock,<ax>
mov ax,dx
push es ; added 13 feb 1990
mov es,loadTDB
mov es:[TDB_LibInitSeg],ax
mov es:[TDB_LibInitOff],10h
mov es,dx
mov es:[pStackTop],12h
pop es
oae_done:
cEnd
;-----------------------------------------------------------------------;
; CloseApplEnv ;
; ;
; ;
; Arguments: ;
; ;
; Returns: ;
; AX = hExe ;
; BX = ? ;
; DX = TDB ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; ;
; Registers Destroyed: ;
; ..., ES, ... ;
; ;
; Calls: ;
; ;
; History: ;
; ;
; Fri 07-Apr-1989 23:15:42 -by- <NAME> [davidw] ;
; Added support for task ExeHeaders above The Line in Large ;
; Frame EMS. ;
; ;
; Tue Oct 20, 1987 07:48:51p -by- <NAME> [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc CloseApplEnv,<PUBLIC,NEAR>,<ds,si,di>
parmW hResult
parmW hExe
localW myCurTDB
localW cae_temp
localW myLoadTDB
cBegin
ReSetKernelDS
; Copy DS variables to stack, since we may need DS
mov cx,curTDB
mov myCurTDB,cx
mov cx,loadTDB
mov myLoadTDB,cx
mov cae_temp, si
mov ax, myLoadTDB
or ax, ax ; Not set if LMCheckHeap failed
jz cae_done
mov ds, ax
mov ax, ds:[TDB_LibInitSeg]
or ax, ax
jz cae_free_stack1
mov ds, ax
cmp ds:[pStackTop], 12h
jne cae_free_stack1
mov ds,myLoadTDB
push ax
cCall GlobalUnlock,<ax>
call GlobalFree ; parameter pushed above
cae_free_stack1:
mov ds,myLoadTDB
mov ds:[TDB_LibInitSeg],ax
mov ds:[TDB_LibInitOff],10h
; Copy correct return address
cae_done:
SetKernelDSNRES
xor dx,dx
xchg loadTDB,dx ; Done loading this guy
mov ax,hResult ; if hResult < 32, it's not a real
cmp ax,LME_MAXERR ; handle, and in fact is the invalid
jb cae_cleanup ; format return code. (11).
mov es,dx
; Start this guy up! TDB_nEvents must be set here, and not before
; because message boxes may be put up if we can't find libraries,
; which would have caused this app to prematurely start.
push es
ifdef WOW
cmp num_tasks, 1 ; First task? (except wowexec)
jne @F ; branch if not first task
cmp fExitOnLastApp, 0 ; Shared WOW?
jne @F ; branch if not shared WOW
cmp fShutdownTimerStarted, 1; Is the timer running?
jne @F ; branch if not running
cCall WowShutdownTimer, <0> ; stop shutdown timer
mov fShutdownTimerStarted, 0
@@:
endif
mov es:[TDB_nEvents],1
inc num_tasks ; Do this here or get it wrong.
test es:[TDB_flags],TDBF_OS2APP
jz @F
cmp dressed_for_success.sel,0
jz @F
call dressed_for_success
ifdef WOW
; Start Up the New Task
@@: cCall StartWOWTask,<es,es:[TDB_taskSS],es:[TDB_taskSP]>
or ax,ax ; Success ?
jnz @f ; Yes
mov hResult,ax ; No - Fake Out of Memory Error 0
; No error matches failed to create thread
pop dx ; restore TDB
dec num_tasks ;
jmps cae_cleanup ;
endif; WOW
@@: test kernel_flags,KF_pUID ; All done booting?
jz @F ; If booting then don't yield.
cCall WowSyncTask
@@:
assumes ds,nothing
pop dx ; return TDB
jmps cae_exit
; Failure case - undo the damage
cae_cleanup:
or dx,dx ; Did we even get a TDB?
jz cae_exit ; No.
mov ds,dx
assumes ds,nothing
mov ds:[TDB_sig],ax ; mark TDB as invalid
cCall FarDeleteTask,<ds>
mov es,ds:[TDB_PDB]
mov dx,PDB_Chain
mov bx,dataOffset HeadPDB ; Kernel PDB
cCall FarUnlinkObject
cCall FreeTDB
cae_exit:
xor ax,ax
mov es,ax ; to avoid GP faults in pmode
.386
mov fs, ax
mov gs, ax
.286
mov ax,hResult
mov bx, cae_temp
cEnd
;-----------------------------------------------------------------------;
; StartModule ;
; ;
; ;
; Arguments: ;
; ;
; Returns: ;
; AX = hExe or StartLibrary ;
; ;
; Error Returns: ;
; AX = 0 ;
; ;
; Registers Preserved: ;
; BX,DI,SI,DS ;
; ;
; Registers Destroyed: ;
; ;
; Calls: ;
; FarLoadSegment ;
; StartProcAddress ;
; StartLibrary ;
; ;
; History: ;
; ;
; Tue Jan 01, 1980 03:04:49p -by- <NAME> [davidw] ;
; ReWrote it from C into assembly and added this nifty comment block. ;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc StartModule,<PUBLIC,NEAR>,<di,si>
parmW hPrev
parmD lpPBlock
parmW hExe
parmW fh
localD pf
cBegin
mov ax,hExe
mov es,ax
assumes es,nothing
cmp es:[ne_csip].sel,0
jz start_it_up
; Make sure DGROUP loaded before we need to load the start segment.
mov cx,es:[ne_autodata]
jcxz start_it_up ; no automatic data segment
cCall FarLoadSegment,<es,cx,fh,fh>
or ax,ax
jnz start_it_up ; auto DS loaded OK
mov ax,fh
inc ax
jz sm_ret1 ; return NULL
dec ax
cCall _lclose,<ax>
xor ax,ax
sm_ret1:
jmps sm_ret ; return NULL
start_it_up:
cCall StartProcAddress,<hExe,fh> ; just because it's preloaded
mov pf.sel,dx ; doesn't mean it's still around!
mov pf.off,ax
or dx,ax
push dx
mov ax,fh
cmp ax,-1
jz sm_nothing_to_close
cCall _lclose,<ax>
sm_nothing_to_close:
pop dx
mov es,hExe
assumes es,nothing
test es:[ne_flags],NENOTP
jnz start_library
or dx,dx
jz nothing_to_start
cCall GetStackPtr,<es>
cCall StartTask,<hPrev,hExe,dx,ax,pf>
jmps sm_ret
start_library:
mov es, hExe
or es:[ne_flags], NEWEPME ; Need to call my WEP on exit
cCall StartLibrary,<hExe,lpPBlock,pf>
jmps sm_ret
nothing_to_start:
mov ax,hExe
test es:[ne_flags],NENOTP
jnz sm_ret
xor ax,ax
sm_ret:
cEnd
if 0 ; too late to include in 3.1, add for next Windows release (donc)
cProc GetProcAddressRes, <PUBLIC, FAR>, <ds, si, di>
parmW hExe
parmD pname ; pass in Pascal string
cBegin
les di, [pname] ; ES:DI = name to find
mov cx, 255 ; CH = 0
xor ax, ax
push di
repne scasb
pop di
jnz GPAR_fail
not cl
dec cl
mov al, cl ; AX = length of name
mov ds, [hExe] ; DS:SI = res name table
mov bx, ds:[ne_restab] ; (actually DS:BX first time through)
GPAR_nextsym:
mov si, bx ; next entry to check
mov cl, [si] ; string length
jcxz GPAR_fail
lea bx, [si+3]
add bx, cx ; BX points to next (last + len + 3)
cmp cx, ax
jnz GPAR_nextsym ; length diff - no match
inc si ; skip length byte
push di
rep cmpsb
pop di
jnz GPAR_nextsym
lodsw ; get ordinal number
;if KDEBUG
; cCall FarEntProcAddress,<ds,ax,1>
;else
cCall FarEntProcAddress,<ds,ax> ; I hate conditional assembly....
;endif
mov cx, ax
or cx, dx
jmps GPAR_exit
GPAR_fail:
xor ax, ax
cwd
GPAR_exit:
cEnd
endif
;-----------------------------------------------------------------------;
; CallWEP ;
; ;
; Call WEP of DLL if appropriate ;
; ;
; Arguments: ;
; HANDLE hExe = HEXE of module about to close ;
; WORD WEPVal = 0, 1 pass to WEP, 2 check for WEP ;
; ;
; Returns: ;
; AX = status ;
; ;
; Error Returns: ;
; AX = Not a DLL ;
; AX = No WEP ;
; AX = Module not started ;
;-----------------------------------------------------------------------;
cProc CallWEP, <PUBLIC,FAR>, <ds>
parmW hExe
parmW WEPVal
localV szExitProc,4
localD pExitProc
localW bogusIBMAppSp
cBegin
mov ds, hExe ; Robustify this!
CWErr = 1
mov ax, 1 ; exit code
cmp ds:[ne_expver], 300h ; 3.0 libraries only
jb CW_noWEP
CWErr = CWErr+1
inc ax
test ds:[ne_flags], NENOTP ; is it a DLL?
jz CW_noWEP
CWErr = CWErr+1
inc ax ; Font, etc
cmp ds:[ne_cseg],0
jz CW_noWEP
CWErr = CWErr+1
inc ax
mov bx, ds:[ne_pautodata] ; Make sure auto data loaded
or bx, bx
jz @F
test ds:[bx].ns_flags, NSLOADED
jz CW_noWEP
@@:
CWErr = CWErr+1
inc ax
NoWepErr = CWErr
mov [szExitProc].lo, 'EW' ; If the module has a procedure
mov [szExitProc].hi, 'P' ; named 'WEP', call it.
lea bx, szExitProc
push ax
cCall GetProcAddress, <ds, ss, bx>
mov [pExitProc].off, ax
mov [pExitProc].sel, dx
or ax, dx
pop ax
jnz CW_WEP
CW_noWEP:
jmps CW_noWEP1
CW_WEP:
cmp WEPVAL,2 ; If I'm just looking for WEP
jz CW_OK ; return 0
inc ax
test ds:[ne_flags], NEWEPME ; don't call wep if libmain
jz CW_noWEP ; wasn't called
and ds:[ne_flags], NOT NEWEPME ; only call WEP once
SetKernelDSNRES ; Save old GP chaine
pusha
push lpGPChain.sel
push lpGPChain.off
push cs
push offset cw_BlowChunks
mov lpGPChain.sel, ss ; and insert self in the chain
mov lpGPChain.off, sp
UnSetKernelDS
mov ax, ss
mov ds, ax
mov es, ax
mov bogusIBMAppSP,sp ; Save sp cause some apps (Hollywood)
; don't retf 2 correctly when we
; call their wep
cCall pExitProc, <WEPVal> ; fSystemExit
mov sp,bogusIBMAppSp
add sp, 4 ; remove the CS:IP for error handler
cw_BlowChunks:
SetKernelDSNRES
pop lpGPChain.off ; restore GPChain
pop lpGPChain.sel
popa
UnSetKernelDS
CW_OK:
xor ax, ax
CW_noWEP1:
cmp WEPVAL, 2 ; if we checked for whining
jnz CW_done
or ax, ax ; if we found, then OK
jz CW_done
cmp ax, NoWepErr ; anything other than NoWep is OK
jz CW_done
xor ax, ax
CW_done:
cEnd
;-----------------------------------------------------------------------;
; LoadModule ;
; ;
; Loads a module or creates a new instance of an existing module. ;
; ;
; Arguments: ;
; FARP p = name of module or handle of existing module ;
; FARP lpPBlock = Parameter Block to pass to CreateTask ;
; ;
; Returns: ;
; AX = instance handle or module handle ;
; ;
; Error Returns: ;
;LME_MEM = 0 ; Out of memory ;
;LME_FNF = 2 ; File not found
;LME_LINKTASK = 5 ; can't link to task ;
;LME_LIBMDS = 6 ; lib can't have multiple data segments ;
;LME_VERS = 10 ; Wrong windows version ;
;LME_INVEXE = 11 ; Invalid exe ;
;LME_OS2 = 12 ; OS/2 app ;
;LME_DOS4 = 13 ; DOS 4 app ;
;LME_EXETYPE = 14 ; unknown exe type ;
;LME_RMODE = 15 ; not a pmode windows app ;
;LME_APPMDS = 16 ; multiple data segments in app ;
;LME_EMS = 17 ; scum app in l-frame EMS ;
;LME_PMODE = 18 ; not an rmode windows app ;
;LME_INVCOMP = 20 ; invalid DLL caused fail of EXE load ;
;LME_PE32 = 21 ; Windows Portable EXE app - let them load it ;
;LME_MAXERR = 32 ; for comparisons ;
; ;
; Registers Preserved: ;
; DI, SI, DS ;
; Registers Destroyed: ;
; BX, CX, DX, ES ;
; ;
; Calls: ;
; AllocAllSegs ;
; CreateInsider ;
; DecExeUsage ;
; DelModule ;
; FindExeFile ;
; FindExeInfo ;
; FreeModule ;
; GetExePtr ;
; GetInstance ;
; GetStringPtr ;
; IncExeUsage ;
; LoadExeHeader ;
; LoadModule ;
; FarLoadSegment ;
; lstrlen ;
; FarMyFree ;
; MyOpenFile ;
; PreloadResources ;
; StartModule ;
; _lclose ;
; ;
; History: ;
; Sun 12-Nov-1989 14:19:04 -by- <NAME> [davidw] ;
; Added the check for win87em. ;
; ;
; Fri 07-Apr-1989 23:15:42 -by- <NAME> [davidw] ;
; Added support for task ExeHeaders above The Line in Large ;
; Frame EMS. ;
; ;
; Tue Oct 13, 1987 05:00:00p -by- <NAME> [davidhab] ;
; Added check for FAPI applications. ;
; ;
; Sat Jul 18, 1987 12:04:15p -by- <NAME> [davidw] ;
; Added support for multiple instances in different EMS banks. ;
; ;
; Tue Jan 01, 1980 06:57:01p -by- <NAME> [davidw] ;
; ReWrote it from C into assembly. ;
; ;
; Wed Sep 17, 1986 03:31:06p -by- <NAME> [chuckwh] ;
; Modified the original LoadModule code to only allow INSIDERs to ;
; allocate segments for a new process. An INSIDER is a new process ;
; stub which bootstraps up a new instance of an application. ;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc ILoadLibrary,<PUBLIC,FAR>
parmD pLibName
localV szExitProc,4
cBegin
mov ax,-1
cCall <far ptr LoadModule>,<pLibName,ax,ax>
cmp ax, LME_INVEXE ; Invalid format?
jnz @F
mov ax, LME_INVCOMP ; Invalid component
@@:
if KDEBUG
SetKernelDSNRes
cmp fBooting, 0
jne ll_fail ; No check while booting
cmp ax, LME_MAXERR
jb ll_fail ; No library, so no WEP()
push ax ; Now check for WEP
cCall GetExePtr,<ax>
mov es, ax
test es:[ne_flags],NEPROT ; ignore for OS/2 apps
jnz ll_noWhine
cmp es:[ne_usage], 0
jne ll_noWhine ; Only check on first load!
push dx
push ax
cCall CallWEP,<ax,2> ; Just check for WEP, don't call it
or ax, ax
pop ax
pop dx
jz ll_noWhine
trace_out "No WEP in library - > %AX0 %AX1"
; fkerror 0,<No WEP in library - >,ax,dx
ll_noWhine:
pop ax ; return value of LoadModule
ll_fail:
endif ; KDEBUG
cEnd
os2calls DB 'DOSCALLS' ; Used for FAPI detection
mgxlib DB 'MGXLIB' ; Used for lib large entry table detection
win87em DB 'WIN87EM.DLL',0 ; Used for win87em.exe detection
assumes ds,nothing
assumes es,nothing
?SAV5 = ?DOS5 ; Adobe Type Manager check the LoadModule
?DOS5 = 0 ; prolog and expects to see INC BP there...
public LMAlreadyLoaded, LMLoadExeFile, LMCheckHeader, LMRamNMods
public LMImports, LMSegs, LMLetsGo, LMPrevInstance, LMCleanUp
cProc ILoadModule,<PUBLIC,FAR>,<di,si>
parmD lpModuleName
parmD lpPBlock
localW fh ; close if failed
localW pExe ; point to NE header in RAM
; localW hExe ; prev module if already loaded
localW hResult ; temp return value
localW hDepFail ; return of implicit link loads
localW abortresult ; temp return value
localW ffont ; flag if loading a *.fon
localW fexe ; flag if loading a *.exe
ifdef notyet
localW dll ; flag if loading a *.dll
endif
localW hBlock ; fastload block from LoadExeHeader
localW AllocAllSegsRet
localW exe_type ; from LoadExeHeader
localW hTDB ; dx from CloseApplEnv
localW SavePDB ; save caller's pdb, switch to krnl's
localW fWOA ; save flag if we're loading WOA
ifdef WOW
LocalD pszKnownDLLPath
LocalW fKnownDLLOverride
localW RefSelector
localW LMHadPEDLL
localW hPrevInstance ; previous 16-bit module handel with the same name
endif
localD FileOffset ; offset to start of ExeHdr
localW OnHardDisk ; don't cache FH if on floppy
localV namebuf,136 ; SIZE OPENSTRUC + 127
localW fModCompatFlags ; used by LMRamNMods
cBegin
SetKernelDSNRES
mov al,Kernel_Flags[1] ; solve re-entrancy #10759
and ax,KF1_WINOLDAP
mov fWOA,ax
and Kernel_Flags[1],NOT KF1_WINOLDAP
inc fLMdepth ; # current invocations
;** Log this entry only if in diagnostic mode
mov ax, fDiagMode ; Only log if booting and diag mode
and al, fBooting
jz @F
;** Write out the string
mov ax,dataOFFSET szLoadStart ; Write the string
cCall DiagOutput, <ds,ax>
push WORD PTR lpModuleName[2]
push WORD PTR lpModuleName[0]
cCall DiagOutput
mov ax,dataOFFSET szCRLF
cCall DiagOutput, <ds,ax>
; Zero out flags and handles
@@:
ifdef WOW
mov LMHadPEDLL,0
mov hPrevInstance,0
lm_restart:
endif
xor ax,ax
; mov hExe,ax
mov pExe,ax
mov abortresult,ax ; default 0 == out of memory
mov ffont,ax
mov fexe,ax
ifdef notyet
mov dll,ax
endif
mov hBlock,ax
mov hTDB,ax
; Set DOS_FLAG to EXEC_OPEN
SET_DOS_FLAG_EXEC_OPEN
; Some flags are default -1
dec ax
mov fh, ax
mov SavePDB, ax
; First, see if we were passed in a handle in the filename
les si,lpModuleName ; point to the file name
mov ax,es
or ax,ax ; Was a handle passed in low word?
jnz @F
cCall GetExePtr,<si> ; Valid handle?
or ax, ax
jnz prev_instance
mov al, LME_FNF ; call this file not found??
jmp ilm_ret
; No handle, see if filename is already loaded
@@: call LMAlreadyLoaded ; es:si -> modname on stack
cmp ax, LME_MAXERR
jb @F ; Not found, try to load it
; a 16-bit module with the same name is loaded
; if module is being loaded is a dll, use the loaded instance
; else if module is being loaded is a task
; if it is a 32-bit task then load it from disk
; else use the loaded instance
ifdef WOW
mov hPrevInstance, ax ; store previous instance handle
mov ax,lpPBlock.off ; check if this is a dll or a task
and ax,lpPBlock.sel
inc ax
jnz @F ; non-zero means it is a task
; so check first if it is a 16-bit task
prev_instance_16task:
mov ax, hPrevInstance
endif
prev_instance:
call LMPrevInstance
jmp ilm_ret
; Wasn't loaded, see if we can load it
@@: call LMLoadExeFile ; fh in DI, AX = 0 or error code
or ax, ax
jz @F
jmp ilm_ret ; can't find it - return error
@@:
; Here to deal with a new library or task module.
; We found the file, now load and scan the header
@@: lea si,namebuf
cCall LoadExeHeader,<di,di,ss,si>
ifdef WOW
cmp ax,LME_PE
jne @F
; If we find the module is a Win32 binary (PE), check to see
; if we're trying to load a task or DLL. If it's a DLL
; we will continue searching for a Win16 copy of this DLL
; on the path. If we're unsuccessful we'll eventually
; munge the file not found error code back to LME_PE.
mov ax,lpPBlock.off
and ax,lpPBlock.sel
inc ax
mov ax,LME_PE
jnz @F ; have a PBlock, must be doing LoadModule
cmp LMHadPEDLL,0
je lm_retry_pe
mov LMHadPEDLL,0
mov OFContinueSearch,0
KernelLogError <DBF_WARNING>,ERR_LOADMODULE,"Found Win32 DLL again after continuing search."
jmps ilm_ret
@@: jmps @F
lm_retry_pe:
; Tell OpenFile to restart last search at next search location.
mov OFContinueSearch,1
mov LMHadPEDLL,1
KernelLogError <DBF_WARNING>,ERR_LOADMODULE,"Found Win32 DLL, continuing search for Win16 copy."
; Close open Win32 DLL file handle
cCall My_lclose,<fh>
; Switch back to caller's PDB
mov si, -1
xchg si, SavePDB
mov Win_PDB, si
or fh, -1
jmp lm_restart
@@:
endif
cmp ax,LME_MAXERR
jb ilm_ret
ifdef WOW
cmp hPrevInstance, 0 ; if there is a previous 16-bit task
je @F ;
cCall My_lclose,<fh> ; close opened file before invoking previous instance
jmp prev_instance_16task
endif
; Header is loaded, now see if valid for Windows
@@: call LMCheckHeader
cmp ax, LME_MAXERR
jb ilm_ret
; Now allocate segs, check for special modules, etc
@@: call LMRamNMods
cmp ax, LME_MAXERR
jb ilm_ret
; Load import libraries (scary code here)
@@: call LMImports
cmp ax, LME_MAXERR
jb ilm_ret
; Load and relocate segments
@@: call LMSegs
cmp ax, LME_MAXERR
jb ilm_ret
; Load resources, schedule execution
@@: call LMLetsGo
; Everyone comes through ILM_RET - we free the fastload block, etc
ilm_ret:
call LMCleanUp
jmp LoadModuleEnd
abort_load0:
pop fLMdepth
abort_load:
cmp fLMdepth, 1 ; If a recursive call, nothing
jne abort_load_A ; has been incremented!
cCall DecExeUsage,<pExe>
abort_load_A:
cCall My_lclose,<fh>
mov es,pExe
push es:[ne_flags]
cCall DelModule,<es>
mov pExe, 0
pop bx
abort_load_B: ; If app, close environment
test bx,NENOTP
jnz lm_ab
mov si, -1
xchg si, SavePDB ; Saved PDB?
inc si
jz @F ; nope.
dec si
mov Win_PDB, si ; yes, restore it
@@:
mov si, fLMdepth
mov fLMdepth, 0
cCall CloseApplEnv,<abortresult,es>
mov fLMdepth, bx
lm_ab: mov ax, abortresult
retn
; add sp, 2
; jmps ilm_ret ; ax = abortresult. (0 normal, 11 fapi)
ifdef WOW
winspool db "WINSPOOL.EXE" ; Trying to Load Winspool ?
size_winspool equ $-winspool
db 0h ; NULL Terminate
endif ;WOW
;----------------------------------------------------------------------
;
; LMAlreadyLoaded - internal routine for LoadModule
; See if a module is already loaded by looking for the file name
; or the module name.
; Entry:
; ES:SI points to filename
; Exit:
; AX = handle of previous instance
; SS:SI -> uppercase filename
; Error:
; AX = error value < LME_MAXERR
;
;-----------------------------------------------------------------------
LMAlreadyLoaded:
; We check if this Module is already loaded. To do so we get the
; name off of the end of the string, omitting the extension.
krDebugOut <DEB_TRACE OR DEB_KrLoadMod>, "Loading @ES:SI"
cCall lstrlen,<es,si> ; Get the length of the string.
or ax,ax ; NULL string?
jnz @F
mov al,LME_FNF ; return file not found error
retn
ifdef FE_SB
;
; Backword search '\' or ':' is prohibited for DBCS version of
; Windows. Some DBCS 2nd byte may have '\' or ':'. So we search
; these characters from beginning of string.
;
@@:
cld
mov bx,si
delinator_loop_DBC:
lods byte ptr es:[si] ; fetch a character
test al,al
jz found_end_DBC
cmp al,"\"
jz found_delinator_DBC
cmp al,'/'
jz found_delinator_DBC
cmp al,":"
jz found_delinator_DBC
call FarMyIsDBCSLeadByte ; see if char is DBC...
jc delinator_loop_DBC
inc si ; skip 2nd byte of DBC
jmp delinator_loop_DBC
found_delinator_DBC:
mov bx,si ; update delinator pointer
jmp delinator_loop_DBC
found_end_DBC:
mov si, bx ; ES:SI -> beginning of name..
else
@@: mov cx,ax
add si,ax
dec si ; ES:SI -> end of string
std
delineator_loop: ; look for beginning of name
lods byte ptr es:[si]
cmp al,"\"
jz found_delineator
cmp al,'/'
jz found_delineator
cmp al,":"
jz found_delineator
loop delineator_loop
dec si
found_delineator: ; ES:SI -> before name
cld
inc si
inc si ; ES:SI -> beginning of name
endif
xor di,di
xor bx,bx
copy_name_loop:
lods byte ptr es:[si] ; Copy and capitalize to temp buffer.
or al,al
jz got_EXE_name
cmp al,"."
jne @F
lea bx,namebuf[di]
ifdef notyet
cmp dll, 0 ; Was it .DLL and failed to open it?
jz @F ; no, no hacking
mov byte ptr es:[si], 'E' ; yes, change it to .EXE
mov word ptr es:[si+1],'EX'
mov dll, 0
endif
@@:
ifdef FE_SB
;
; Do not capitalize if a character is DBC.
;
call FarMyIsDBCSLeadByte
jnc @F
call FarMyUpper ; capitalize if SBC..
jmps is_a_SBC
@@:
mov namebuf[di],al
inc di
lods byte ptr es:[si] ; copy 2nd byte also
is_a_SBC:
mov namebuf[di],al
else
call FarMyUpper
mov namebuf[di],al
endif
inc di
jmps copy_name_loop
; Finally call FindExeInfo to see if it's already loaded!
got_EXE_name:
cmp namebuf[di][-2],'NO' ; .fons are allowed to be
jnz @F ; non protect mode
cmp namebuf[di][-4],'F.'
jnz @F
mov ffont,bp ; make non-zero
@@:
cmp namebuf[di][-2],'EX' ; .exes will not get
jnz @F ; prompted
cmp namebuf[di][-4],'E.'
jnz @F
mov fexe,bp ; make non-zero
@@:
ifdef NOTYET
cmp namebuf[di][-2],'LL'
jne @F
cmp namebuf[di][-4],'D.'
jne @F
mov dll, di
@@:
endif
ifdef WOW
; apps will expect to find WINSPOOL.DRV, which is a 32-bit driver.
; we need to intercept this and change it WINSPOOL.EXE, which is our 16-bit
; stub that contains a few entrypoints.
if 0
; Bitstreams's MakeUp extracts the printer driver from the [devices]
; section of win.ini the line looks like this:
; HP Laserjet Series II=winspool,FILE:
; and then it calls LoadLibrary(drivername) ie LoadLibrary("winspool")
; so we need to allow no extension when checking for "winspool"
endif
cmp namebuf[di][-2],'VR'
jne checkfornoext
cmp namebuf[di][-4],'D.'
jne @f
jmp short gotadrv
checkfornoext:
; int 3
cmp di,8
jc @f
cmp namebuf[di][-2],'LO'
jne @f
cmp namebuf[di][-4],'OP'
jne @f
cmp namebuf[di][-6],'SN'
jne @f
cmp namebuf[di][-8],'IW'
jne @f
; the last 8 characters are 'WINSPOOL'. tack on '.EXE' and proceed.
add di,4
mov namebuf[di][-2],'EX' ; Changed Uppercased String
mov namebuf[di][-4],'E.'
push cx
mov lpModuleName.hi,cs
lea cx,winspool ;
mov lpModuleName.lo,cx
pop cx
jmp short @f
gotadrv:
push es
push ds
push si
push cx
push di
smov es,ss
lea di,namebuf[di][-(size_winspool)]
smov ds,cs
lea si,winspool
mov cx,size_winspool-4 ; match WINSPOOL?
rep cmpsb
pop di
jnz not_winspool
mov namebuf[di][-2],'EX' ; Changed Uppercased String
mov namebuf[di][-4],'E.'
mov lpModuleName.hi,cs ; Used by Myopenfile below
lea cx,winspool ;
mov lpModuleName.lo,cx
not_winspool:
pop cx
pop si
pop ds
pop es
@@:
endif; WOW
mov namebuf[di],al ; Null terminate file name
lea si,namebuf
push bx
cCall FindExeFile,<ss,si>
pop bx
or ax,ax
jnz al_end
or bx,bx ; extension specified?
jz @F ; No, DI correct then
sub bx,si ; DI = length of name portion
mov di,bx
@@:
cCall FindExeInfo,<ss,si,di>
al_end:
retn
;----------------------------------------------------------------------
;
; LMLoadExeFile - internal routine for LoadModule
; Try to open an EXE file
; Enter:
; SS:SI -> uppercase filename
; Exit:
; AX=0
; DI = fh = handle of open EXE file
; Error:
; AX = error code
; Effects:
; Set Win_PDB to kernel PDB to open the file
;
;-----------------------------------------------------------------------
; if here then not yet loaded, see if we can open the file
LMLoadExeFile:
mov ax, topPDB
xchg Win_PDB, ax ; Switch to Kernel's PDB,
mov SavePDB, ax ; saving current PDB
xor ax,ax
ifdef notyet
cmp dll, ax ; Don't prompt for .DLL, if it fails we
jnz @F ; try for .EXE which we will prompt for
endif
cmp fexe,ax ; Don't prompt for EXE file
jnz @F
mov ax,OF_CANCEL ; If DLL, let them cancel
mov es,curTDB
test es:[TDB_ErrMode],08000h ; did app say not to prompt??
jnz @F
mov ax,OF_CANCEL or OF_PROMPT
@@:
if SHARE_AWARE
or ax, OF_NO_INHERIT or OF_SHARE_DENY_WRITE
else
or ax, OF_NO_INHERIT
endif
ifdef WOW
; Ask WOW32 to check the filename to see if it is
; a Known DLL,
;
; If it is, WowIsKnownDLL will point pszKnownDLLPath
; at a just-allocated buffer with the full path to
; the DLL in the system32 directory and return with
; AX nonzero. This buffer must be freed with a
; call to WowIsKnownDLL with the filename pointer
; zero, and pszKnownDLLPath as it was left by the
; first call to WowIsKnownDLL.
;
; If it's not a known DLL, pszKnownDLLPath will be
; NULL and AX will be zero.
push ax
cmp fBooting,0 ; Known DLLs take effect
je lef_look_for_known_dll ; after booting is complete.
mov fKnownDLLOverride,0 ; We're booting, make sure
jmps lef_dll_not_known ; we know not to call
; WowIsKnownDLL the second time.
lef_look_for_known_dll:
push si
smov es,ss
lea bx,pszKnownDLLPath
cCall WowIsKnownDLL,<lpModuleName,esbx>
mov fKnownDLLOverride,ax
cmp ax,0
pop si
je lef_dll_not_known
pop ax
cCall MyOpenFile,<pszKnownDLLPath,ss,si,ax>
jmps @f
lef_dll_not_known:
pop ax
cCall MyOpenFile,<lpModuleName,ss,si,ax>
@@:
else
cCall MyOpenFile,<lpModuleName,ss,si,ax>
endif
ifdef notyet
mov di, dll
or di, di
jz no_second_chance
cmp ax, -1
jne no_second_chance ; open succeeded
xchg ax, SavePDB ; Restore original PDB (AX == -1)
mov Win_PDB, ax
les si, lpModuleName
pop ax
jmp pointer_to_name ; Start again!
no_second_chance:
endif
xor dh, dh
mov dl, ss:[si].opDisk
mov OnHardDisk, dx
mov fh,ax
mov di,ax ; DI gets preserved, AX doesn't!
inc ax ; -1 means error or invalid parsed file
mov ax, 0
jnz @F ; OK, return 0
; MyOpenFile failed
mov ax,ss:[si].[opXtra] ; SI = &namebuf
or ax,ax ; What is the error value?
jnz @F
mov ax,LME_FNF ; unknown, call it file not found
@@:
ifdef WOW
push ax
mov ax,fKnownDLLOverride
cmp ax,0
je lef_no_need_to_free
push bx
push dx
push di
smov es,ss
lea bx,pszKnownDLLPath
cCall WowIsKnownDLL, <0,0,esbx>
pop di
pop dx
pop bx
lef_no_need_to_free:
pop ax
endif
retn
;----------------------------------------------------------------------
;
; LMCheckHeader - internal routine for LoadModule
; Loading new module - see if header values are OK
; Enter:
; ax = exeheader in RAM
; bx = 0 or FastLoad ram block selector
; cx = file offset of header
; dx = exe_type
; Exit:
;
;
;-----------------------------------------------------------------------
LMCheckHeader:
mov exe_type,dx
mov hBlock,bx ; fast-load block
mov pExe,ax ; exeheader in RAM
mov es,ax
mov ax, cx ; file offset of header
mov cx, es:[ne_align]
mov bx, ax ; BX:AX <= AX shl CL
shl ax, cl
neg cl
add cl, 16
shr bx, cl
mov FileOffset.sel, bx
mov FileOffset.off, ax
; Is this module PMode-compatible?
cmp es:[ne_expver],300h ; by definition
jae @F
test dh,NEINPROT ; by flag
jnz @F
cmp ffont,0 ; are we loading a font?
jnz @F
mov cx,ss
lea bx,namebuf
call WarnRealMode
cmp ax,IDCANCEL
jnz @F ; yes, user says so
mov ax, LME_RMODE ; no, die you pig
retn
ifdef WOW
@@:
;
; if WOA invoked by app (not fWOA) fail it
;
cmp fWOA,0 ; fWOA
jnz @F
cld
push si
push di
mov di, es:[ne_restab]
inc di
mov si, dataOffset WOAName
mov cx, 4
repe cmpsw
pop di
pop si
jnz @F
mov ax, LME_WOAWOW32
retn
endif
; Are we dynalinking to a task?
@@:
test es:[ne_flags],NENOTP
jnz ch_not_a_process
or es:[ne_flags],NEINST ; for safety sake
mov ax,lpPBlock.off
and ax,lpPBlock.sel
inc ax
jnz ch_new_application ; not linking
mov ax, LME_LINKTASK
retn
; Error if multiple instance EXE is a library module.
ch_not_a_process:
mov ax, 33 ; Any value > 32
test es:[ne_flags],NEPROT ; is it an OS/2 exe?
jnz ch_ok ; windows doesn't do this right
test es:[ne_flags],NEINST
jz ch_ok
mov ax, LME_LIBMDS ; I think this error code is wrong
ch_ok:
retn
; Create environment for new application task.
ch_new_application:
call LMCheckHeap
or ax,ax
jz @F
cCall OpenApplEnv,<lpPBlock,pExe,fWOA>
mov es,pExe
or ax,ax ; AX is a selector, therefor > 32
jnz ch_ok
@@:
jmp abort_load_A
;----------------------------------------------------------------------
;
; LMRamNMods - internal routine for LoadModule
; Load segments, check for special modules
; Enter:
; EX = pexe
; Exit:
; CX = number of import modules
; AX = status
;
;
;-----------------------------------------------------------------------
LMRamNMods:
push es
cCall AddModule,<pExe>
pop es
or ax,ax
jnz @F
push es:[ne_flags] ; AddModule failed - out of memory
mov dx,ne_pnextexe
mov bx,dataOffset hExeHead
call FarUnlinkObject
pop bx
jmp abort_load_B ; clean this up
@@:
cmp es:[ne_expver],400h
jae rm_skip_modulecompat
; Look for Module in ModuleCompatibilty section
; and get its compat flags
push es ; save es
push ds
push dataoffset szModuleCompatibility
push es
mov bx,es:[ne_restab] ; module name is 1st rsrc
inc bx ; Skip length byte
push bx
xor ax, ax
push ax ; default = 0
call GetProfileInt
@@:
pop es ; restore es
; Set the module's patch bit if the INI file says to.
if KDEBUG
test es:[ne_flagsothers], NEHASPATCH
jz @F
push ax
mov ax, es:[ne_restab]
inc ax
krDebugOut DEB_TRACE,"ILoadModule: module patch bit for @es:ax already set, clearing it"
pop ax
@@:
endif
and es:[ne_flagsothers], not NEHASPATCH ; clear module patch bit
ifdef WOW_x86
test ax, MCF_MODPATCH + MCF_MODPATCH_X86
else
test ax, MCF_MODPATCH + MCF_MODPATCH_RISC
endif
jz rm_after_modpatch
if KDEBUG
push ax
mov ax, es:[ne_restab]
inc ax
krDebugOut DEB_WARN,"ILoadModule: setting module patch bit for @es:ax"
pop ax
endif
or es:[ne_flagsothers], NEHASPATCH
rm_after_modpatch:
; See if we need to make the module's segments not discardable
test ax, MCF_NODISCARD
jz rm_after_nodiscard
mov cx, es:[ne_cseg] ; cx = number of segs
jcxz rm_after_nodiscard
mov bx, es:[ne_segtab] ; es:bx = seg table start
rm_loop:
and es:[bx].ns_flags, not NSDISCARD ; clear the discard flag
add bx, SIZE NEW_SEG1 ; es:bx = seg table next entry
loop rm_loop
rm_after_nodiscard:
rm_skip_modulecompat:
mov bx, -1
cCall FarGetCachedFileHandle,<es,bx,fh> ; Set file handle cache up
mov fh, bx ; Use cached file handle from now
xchg SavePDB, bx ; Back to original PDB (BX == -1)
mov Win_PDB, bx
@@: xor bx,bx
mov hDepFail,-1 ; Assume success
mov cx,es:[bx].ne_cmod
jcxz @F
test kernel_flags,KF_pUID ; All done booting?
jnz @F ; Yes
or es:[bx].ne_flags,NEALLOCHIGH ; No, GDI and USER are party
; dynlinks that can alloc high
@@: xor ax,ax
IFNDEF NO_APPLOADER
test es:[ne_flags],NEAPPLOADER
jnz rm_no_segs_to_alloc
ENDIF
cmp ax,es:[ne_cseg]
jz rm_no_segs_to_alloc
push es
mov es:[ne_usage],1
cCall AllocAllSegs,<es> ; AX is count of segs
pop es
mov es:[ne_usage],8000h
inc ax
jnz @F
jmp abort_load
@@:
dec ax
rm_no_segs_to_alloc:
mov AllocAllSegsRet, ax
xor bx, bx
mov di,es:[bx].ne_modtab ; ES:DI = pModIdx
mov cx,es:[bx].ne_cmod
or cx,cx
jz lm_ret_ok
; this small chunk of code goes thru the imported names table
; and looks for DOSCALLS. if DOSCALLS is found, then the app
; is an FAPI "bound" application and not a windows app, and
; loadmodule should return an error for "invalid format".
; This will force it to run in a DOS box
; coming in:
; cx = cmod
; di = modtab
test es:[bx].ne_flags,NENOTP ; only test apps, not libraries.
jnz lm_ret_ok
mov ax,exe_type ; UNKNOWN may be OS/2 in disguise.
cmp al,NE_UNKNOWN
jnz @F
push ds
smov ds,cs
mov ax,8
mov si,NRESCODEoffset os2calls ; DS:SI = "DOSCALLS"
call search_mod_dep_list
pop ds
jnc @F
mov abortresult,LME_INVEXE ; store invalid format code for return
jmp abort_load
; In order to make it easier on our ISV to migrate to pmode
; we must deal with win87em specially because the win 2.x
; version gp faults. Since we have never shipped them a clean
; one to ship with their apps we must compensate here.
; If we are loading a win 2.x app in pmode we force the load
; of win87em.dll. For compatibility in real mode we just load
; the one they would have gotten anyway.
@@: cmp es:[bx].ne_expver,300h ; no special casing win3.0 apps
jae rm_no_win87em_here
push ds
smov ds,cs
mov ax,7
mov si,NRESCODEoffset win87em ; DS:SI = "WIN87EM"
call search_mod_dep_list
pop ds
jnc rm_no_win87em_here
push bx ; Load Win87em.dll
push es
cCall ILoadLibrary,<cs,si>
cmp ax,LME_MAXERR
jae @F
mov hDepFail,ax
@@: pop es
pop bx
rm_no_win87em_here:
lm_ret_ok:
mov di,es:[bx].ne_modtab ; ES:DI = pModIdx
mov cx,es:[bx].ne_cmod ; What is AX?
mov ax, es
retn
;----------------------------------------------------------------------
;
; LMImports - internal routine for LoadModule
;
;-----------------------------------------------------------------------
LMImports:
or cx, cx
jnz im_inc_dependencies_loop
jmp im_end_dependency_loop
im_inc_dependencies_loop:
push cx
mov si,es:[di]
push es
or si,si
jz im_next_dependencyj
add si,es:[ne_imptab] ; ES:SI = pname
xor ax,ax
mov al,es:[si] ; get length of name
inc si
mov cx, ax
mov bx, es ; pExe
;;;; Load the imported library.
push ds ; Copy the name and .EXE to namebuf
push di
smov es,ss
mov ds,bx
UnSetKernelDS
lea di,namebuf
mov bx,di
cld
rep movsb
mov byte ptr es:[di], 0 ; Null terminate
push bx
push es
cCall GetModuleHandle,<es,bx>
pop es
pop bx
or ax, ax
jz @F
pop di
pop ds
jmps im_imported_exe_already_loaded
@@: cmp ds:[ne_expver], 300h ; USE .DLL for 3.0, .EXE for lower
jae im_use_dll
mov es:[di][0],"E."
mov es:[di][2],"EX"
jmps im_done_extension
im_use_dll:
mov word ptr ss:[di][0],"D."
mov word ptr ss:[di][2],"LL"
im_done_extension:
mov byte ptr es:[di][4],0
pop di
pop ds
ResetKernelDS
cCall ILoadLibrary,<ss,bx>
cmp ax,LME_MAXERR
jae im_imported_exe_loaded
mov hDepFail,ax
xor ax,ax
im_next_dependencyj:
jmps im_next_dependency
im_imported_exe_already_loaded:
;;; push ax
;;; cCall IncExeUsage,<ax>
;;; pop ax
im_imported_exe_loaded:
cCall GetExePtr,<ax>
mov es,ax
assumes es,nothing ; assume that dep libraries
or es:[ne_flags],NEALLOCHIGH ; are smart
im_next_dependency:
pop es
assumes es,nothing
mov es:[di],ax
inc di
inc di
pop cx
dec cx
jz im_end_dependency_loop
jmp im_inc_dependencies_loop
im_end_dependency_loop:
mov es:[ne_usage], 0
cmp fLMdepth, 1
jne @F
push es ; Now set usage count of this
cCall IncExeUsage,<es> ; module and dependants
pop es
@@:
mov cx,hDepFail
inc cx
jz im_libs_ok
dec cx
mov abortresult,cx
im_abort_loadj:
jmp abort_load
im_libs_ok:
retn
;----------------------------------------------------------------------
;
; LMSegs - internal routine for LoadModule
;
;-----------------------------------------------------------------------
LMSegs:
; Do something about all those segments in the module.
IFNDEF NO_APPLOADER
test es:[ne_flags],NEAPPLOADER
jz @F
;* * special boot for AppLoader
push Win_PDB
push fLMdepth
mov fLMdepth, 0
mov ax, -1
cCall FarGetCachedFileHandle,<es,ax,ax>
Save <es>
cCall BootAppl,<es, ax> ;* returns BOOL
cCall FlushCachedFileHandle,<es>
pop fLMdepth
pop Win_PDB
or ax,ax
jnz lms_done
jmp abort_load
; retn
@@:
ENDIF ;!NO_APPLOADER
mov cx, AllocAllSegsRet
jcxz lms_done
lms_preload_segments:
mov si,es:[ne_segtab] ; ES:SI = pSeg
mov cx,es:[ne_cseg]
xor di,di
lms_ps_loop:
inc di
test es:[si].ns_flags,NSPRELOAD
jz lms_next_segment
cmp es:[ne_align], 4 ; Must be at least paragraph aligned
jb lms_ReadFromFile
cmp hBlock, 0
jne lms_ReadFromMemory
jmps lms_ReadFromFile
lms_next_segment:
add si,SIZE new_seg1
loop lms_ps_loop
lms_done:
retn
lms_ReadFromFile:
push cx
push es
cCall FarLoadSegment,<es,di,fh,fh>
jmps lms_DoneLoad
lms_ReadFromMemory:
push cx
push es
cCall GlobalLock,<hBlock>
or dx, dx
jnz lms_still_here
cCall GlobalFree,<hBlock>
mov hBlock, 0
pop es
pop cx
jmps lms_ReadFromFile
lms_still_here:
ifdef WOW
cCall AllocSelectorWOW,<dx> ; same as allocselector. but the
mov RefSelector, dx ; new descriptor is not set.
else
cCall AllocSelector,<dx>
endif
pop es
mov bx, es:[si].ns_sector
xor dx, dx
mov cx, es:[ne_align]
push es
@@:
shl bx, 1
rcl dx, 1
loop @B
sub bx, off_FileOffset
sbb dx, seg_FileOffset
push ax
push es
ifdef WOW
; same as longptradd. but the descriptor 'RefSelector' is used
; to set the descriptor of 'ax'
cCall LongPtrAddWOW,<ax,cx,dx,bx, RefSelector, 1> ; (cx is 0)
else
cCall LongPtrAdd,<ax,cx,dx,bx> ; (cx is 0)
endif
pop es
dec cx
cCall FarLoadSegment,<es,di,dx,cx>
pop cx
push ax
cCall FreeSelector,<cx>
cCall GlobalUnlock,<hBlock>
pop ax
lms_DoneLoad:
pop es
pop cx
or ax,ax
jz lms_abort_load1
jmp lms_next_segment
lms_abort_load1:
jmp abort_load
;-----------------------------------------------------------------------
;
; LMLetsGo -
;
;-----------------------------------------------------------------------
LMLetsGo:
push es
push Win_PDB ; Save current PDB
push topPDB ; Set it to Kernel's
pop Win_PDB
mov ax, -1
cCall FarGetCachedFileHandle,<es,ax,ax>
cmp hBlock,0
je lg_resFromFile
cCall PreloadResources,<es,ax,hBlock,FileOffset>
jmps lg_gotRes
lg_resFromFile:
xor dx, dx
cCall PreloadResources,<es,ax,dx,dx,dx>
lg_gotRes:
pop Win_PDB ; Restore PDB
pop es
mov ax,lpPBlock.off
mov dx,lpPBlock.sel
and ax,dx
inc ax
jnz lg_huh
mov lpPBlock.off,ax
mov lpPBlock.sel,ax
lg_huh: xor ax,ax ; free 0
push fLMdepth
mov fLMdepth, 0
push es
cCall StartModule,<ax,lpPBlock,es,fh>
pop es
mov hResult,ax
or ax,ax
jnz @F
jmp abort_load0
@@: test es:[ne_flags],NENOTP
jnz lg_not_a_process2
pop si
cCall CloseApplEnv,<hResult,pExe>
push bx
mov hResult,ax
mov hTDB,dx
lg_not_a_process2:
pop fLMdepth
retn
;----------------------------------------------------------------------
;
; LMPrevInstance - internal routine for LoadModule
; Load an app/dll if a previous instance in memory
; Entry:
; ax = handle of previous instance
; Exit:
; ax = status to return
; dx = hTDB = TDB
; Error:
; ax < LME_MAXERR
;
;-----------------------------------------------------------------------
LMPrevInstance:
mov es,ax
mov dx,es:[ne_flags]
mov si,ax
mov pExe,ax ; why store in pExe and hExe?
mov hResult,0
; Error if dynamically linking to non-library module.
mov ax,lpPBlock.off
and ax,lpPBlock.sel
inc ax
jnz pi_app
test dx,NENOTP
jnz @F
mov ax, LME_LINKTASK ; can't dynalink to a task
retn
@@: mov lpPBlock.off,ax ; AX == 0
mov lpPBlock.sel,ax
pi_app:
test dx,NEINST
jnz @F
jmp pi_not_inst
@@: call LMCheckHeap
or ax, ax
jnz @F
mov ax, LME_MEM ; Out of (gdi/user) memory
retn
@@:
ifdef WOW
;
; if WOA invoked by app (not fWOA) fail it
;
cmp fWOA,0 ; fWOA
jnz pi_not_multiple_data
cld
push si
push di
mov di, es:[ne_restab]
inc di
mov si, dataOffset WOAName
mov cx, 4
repe cmpsw
pop di
pop si
jnz @F
mov ax, LME_WOAWOW32
retn
@@:
endif
; We refuse to load multiple instances of apps that have
; multiple data segments. This is because we cannot do
; fixups to these other data segments. What happens is
; that the second copy of the app gets fixed up to the
; data segments of the first application. For the case
; of read-only data segments we make an exception since
; what does it matter who the segments belong to?
mov ax, 2 ; if we have >= 2 dsegs we die
mov es,si
mov cx,es:[ne_cseg]
mov bx,es:[ne_segtab]
pi_next_seg:
test es:[bx].ns_flags,NSDATA ; scum! this barely works!
jz @F
test es:[bx].ns_flags,NSERONLY
jnz @F
dec ax
jnz @F ; two data segments is one too many!
pi_mds: mov ax, LME_APPMDS
retn
@@: add bx,SIZE NEW_SEG1
loop pi_next_seg
pi_not_multiple_data: ; Prepare the application
cCall OpenApplEnv,<lpPBlock,si,fWOA>
cCall GetInstance,<si> ; Why do we call this?
mov di,ax
cCall IncExeUsage,<si>
cCall AllocAllSegs,<si> ; Can we get memory?
inc ax
jnz @F
cCall DecExeUsage,<si> ; AllocAllSegs failed, Dec Usage
jmps pi_mem ; Must have failed from no memory
@@: mov ax,-1
cCall StartModule,<di,lpPBlock,si,ax>
; mov hResult,ax
or ax,ax
jnz @F
mov es,si ; StartModule failed, FreeModule
mov si,es:[ne_pautodata]
cCall FreeModule,<es:[si].ns_handle>
pi_mem: mov ax, LME_MEM
retn
@@: mov si, fLMdepth
mov fLMdepth, 0
cCall CloseApplEnv,<ax,pExe>
mov fLMdepth, bx
mov hTDB,dx
retn
pi_not_inst:
mov ax,es:[ne_autodata] ; Make sure data segment is loaded.
or ax,ax
jz @F
or bx,-1
push es
cCall FarLoadSegment,<es,ax,bx,bx>
pop es
or ax,ax
jz pi_end ; yes, AX is already 0, but ...
@@:
push es ; for GetInstance
cCall IncExeUsage,<es>
cCall GetInstance ; ,<pExe>
pi_end:
retn
;----------------------------------------------------------------------
;
; LMCleanUp - internal routine for LoadModule
;
;-----------------------------------------------------------------------
LMCleanUp:
ifdef WOW
cmp LMHadPEDLL,0
je @F
cmp ax, LME_MAXERR
jae @F
mov ax,LME_PE ; Reflect real error we tried to mask
KernelLogError <DBF_WARNING>,ERR_LOADMODULE,"Could not find Win16 copy of Win32 DLL, returning LME_PE."
@@:
endif
push ax ; save status for future
cmp ax, LME_MAXERR
jae @F
cCall my_lclose,<fh>
or fh, -1
; Restore PDB if needed
@@: mov ax, -1
xchg SavePDB, ax
inc ax
jz @F
dec ax
mov Win_PDB, ax
; Free FastLoad block if allocated
@@: cmp hBlock,0
je @F
cCall GlobalFree,<hBlock>
mov hBlock,0
; Free app environment if failure and this was an app
@@:
pop ax
cmp ax,LME_MAXERR
jae @F
if KDEBUG
cmp ax, LME_INVEXE ; invalid format (WinOldAp)
jz cu_fred
cmp ax, LME_PE ; Win32 Portable Exe - try to load it
jz cu_fred
push ax
push bx
push es
les bx, lpModuleName
KernelLogError <DBF_WARNING>,ERR_LOADMODULE,"Error 0x#ax loading @ES:BX"
pop es
pop bx
pop ax
endif
cu_fred:
cmp loadTDB,0
je @F
mov bx,pExe
cmp bx,LME_MAXERR ; Did we load an ExeHeader?
jbe @F
mov es,bx
test es:[ne_flags],NENOTP
jnz @F
mov si, fLMdepth
mov fLMdepth, 0
cCall CloseApplEnv,<ax,es>
mov fLMdepth, bx
; shouldn't cache file handles on removable devices cause it
; makes share barf when the user swaps disks. this kills some
; install apps. CraigC 8/8/91
@@:
push ax
cmp ax, LME_MAXERR ; real?
jbe @F
cmp OnHardDisk, 0 ; is it on a removable device?
jne @F
cCall GetExePtr, <ax> ; get module handle
cCall FlushCachedFileHandle, <ax> ; blow it off
;** Log this entry only if in diagnostic mode
@@:
cmp fDiagMode,0 ; Only log if in diag mode
je LM_NoDiagExit
cmp fBooting,0 ; Only log if booting
je LM_NoDiagExit
pop ax ; Get the return code early
push ax
pusha ; Save all the registers
push ds
push es
;** Write out the appropriate string
mov si,ax ; Save the return value
cmp ax,LME_MAXERR
jae LM_DiagSuccess
mov ax,dataOFFSET szLoadFail ; Write the string
jmp SHORT LM_DiagOutput
LM_DiagSuccess:
mov ax,dataOFFSET szLoadSuccess ; Write the string
LM_DiagOutput:
cCall DiagOutput, <ds,ax>
cCall DiagOutput, <lpModuleName>
cmp si,LME_MAXERR ; Don't do this on success
jae SHORT LM_DiagSuccessSkip
;** Log a message complete with the failure code
mov ax,si ; Get the failure code
shr al, 4
mov bx,dataOFFSET szCodeString ; Point to the second digit
push NREScodeOffset afterHex
call toHex
mov ax, si
inc bx
toHex:
and al,0fh ; Get low hex digit
add al,'0' ; Convert to ASCII
cmp al,'9' ; Letter?
jbe @F ; Yes
add al,'A' - '0' ; Make it a letter
@@: mov [bx],al ; Save the digit
retn
afterHex:
mov ax,dataOFFSET szFailCode ; Get the string 'Failure code is '
cCall DiagOutput, <ds,ax>
LM_DiagSuccessSkip:
mov ax,dataOFFSET szCRLF
cCall DiagOutput, <ds,ax>
pop es
pop ds
popa
LM_NoDiagExit:
pop ax
dec fLMdepth
mov dx,hTDB
retn
;@@end
;shl_ax16: ; shift AX into DX:AX by cl bits
; mov dx, ax
; shl ax, cl
; neg cl
; add cl, 16 ; cl = 16 - cl
; shr dx, cl
; retn
LoadModuleEnd: ; jmp here to clean up stack and RET
ifdef WOW
cmp ax, LME_MAXERR
jb @F
lmntex:
jmp LoadModuleExit
@@:
;
; Exec For Non 16 Bit Windows Apps
;
;
; WIN 32S App ? yes -> let NT load it
;
cmp ax,LME_PE
je LM_NTLoadModule
;
; if an app is spawning WOA (NOT our internal load-fWOA),
; Patch lpModuleName to -1 let NT load it
;
cmp ax,LME_WOAWOW32
jne @F
mov word ptr lpModuleName[2], -1 ; patch lpModuleName
mov word ptr lpModuleName[0], -1
jmp short LM_NTLoadModule
@@:
; Errors 11-15 -> let NT load it
cmp ax,LME_RMODE
jae lmntex
cmp ax,LME_VERS
jbe lmntex
public LM_NTLoadModule
LM_NTLoadModule:
;
; WOW Execs non-windows apps using WINOLDAP.
;
; First check for loading of a 32bit DLL. lpPBlock will be -1
; in such a case.
push ax
mov ax,lpPBlock.off
and ax,lpPBlock.sel
inc ax
pop ax
jz LoadModuleExit
;
; This is an EXE, but the LME_PE failure code might have come from
; an implicitly linked DLL. If so, we don't want to try having
; Win32 lauch the win16 EXE, as it will just come back to us.
;
cmp ax,LME_PE
jne @F
cmp ax,hDepFail
je short LoadModuleExit
@@:
sub sp, 80 ; alloc space for cmdline
mov di, sp
smov es, ss
mov word ptr es:[di], 0 ; set WindOldApp CmdLine to NULL
regptr esdi,es,di
cCall WowLoadModule,<lpModuleName, lpPBlock, esdi>
;
; if ax < 33 an error occurred
;
cmp ax, 33
jb ex8
or Kernel_flags[1],KF1_WINOLDAP
mov ax, ss
les si,lpPBlock
mov es:[si].lpcmdline.off,di
mov es:[si].lpcmdline.sel,ax
mov si,dataOffset WOAName
regptr dssi,ds,si
cCall LoadModule,<dssi, lpPBlock>
cmp ax,32 ; check for error...
jae ex8
;
; LoadModule of WinOldApp failed
; Call WowLoadModule to clean up process handle
;
push ax
mov ax, ss
regptr axdi,ax,di
cCall WowLoadModule,<0, lpPBlock, axdi>
pop ax
cmp ax,2 ; file not found?
jnz ex7 ; no, return error
mov al, LME_WOAWOW32 ; flag WINOLDAP error
ex7:
or ax,ax ; out of memory?
jnz ex8
mov ax,8h ; yes, return proper error code
ex8:
add sp,80 ; free space for cmdline
endif; WOW
LoadModuleExit:
RESET_DOS_FLAG_EXEC_OPEN
cEnd
?DOS5 = ?SAV5
;-----------------------------------------------------------------------;
; My_lclose
;
; Close file handle if it isn't -1.
;
; Entry:
;
; Returns:
;
; Registers Destroyed:
;
; History:
;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc My_lclose,<PUBLIC,NEAR>
parmW fh
cBegin
mov ax,fh
inc ax
jz mlc_exit
cCall _lclose,<fh>
mlc_exit:
cEnd
;-----------------------------------------------------------------------;
; WarnRealMode
;
; Trayf for files in the form "Insert WIN.EXE disk in drive A:"
;
; Entry:
;
; Returns:
;
; Registers Destroyed:
;
; History:
; Sat 07-Oct-1989 17:12:43 -by- <NAME> [davidw]
; Wrote it! A month or so ago.
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc WarnRealMode,<PUBLIC,NEAR>
cBegin nogen
ReSetKernelDS
push Win_PDB
push fLMDepth
cld
mov ax,IDCANCEL ; assume booting
test fBooting,1
jnz promptly_done
cmp pMBoxProc.sel,0 ; is there a USER around yet?
jz promptly_done
push di
push si
push es
mov es,cx
ifdef FE_SB
;Japan and Korea declare that they need more space for DBCS msg.
;It sounds like this is one of common requirement for DBCS enabling
;although Taiwan doesn't claim she has the same requirement.
;I enclosed this code fragment under DBCS and it can be removed
;if somebody thinks it is not necessary.
sub sp, 530
else
sub sp,512
endif
mov di,sp
mov si,offset msgRealModeApp1
push ds
smov ds,cs
UnSetKernelDS
call StartString
smov ds,cs
mov si,offset msgRealModeApp2
call Append
pop ds
ReSetKernelDS
mov bx,sp
xor ax,ax
push ax ; Null hwnd
push ss
push bx ; (lpstr)text
push cs
mov ax,offset szProtectCap
push ax ; (lpstr)caption
mov ax,MB_OKCANCEL or MB_ICONEXCLAMATION or MB_DEFBUTTON2 or MB_SYSTEMMODAL
push ax ; wType
call [pMBoxProc] ; Call USER.MessageBox
ifdef FE_SB
add sp, 530
else
add sp,512
endif
pop es
pop si
pop di
promptly_done:
pop fLMDepth
pop Win_PDB
ret
cEnd nogen
assumes ds,nothing
assumes es,nothing
StartString:
call Append ; append first string
; Now append the file name
push di
lea di,[bx].opFile ; skip past length, date, time
call NResGetPureName ; strip off drive and directory
smov ds,es
mov si,di
pop di
; Append ASCIIZ string to output buffer, DS:DX points to string
assumes ds,nothing
assumes es,nothing
Append: lodsb
stosb
or al,al
jnz Append
dec di
ret
assumes ds,nothing
assumes es,nothing
;-----------------------------------------------------------------------;
; NResGetPureName
;
; Returns a pointer the the filename off the end of a path
;
; Entry:
; ES:DI => path\filename
; Returns:
; ES:DI => filename
; Registers Destroyed:
;
; History:
; Wed 18-Oct-1989 20:01:25 -by- <NAME> [davidw]
;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc NResGetPureName,<PUBLIC,NEAR>
cBegin nogen
ifdef FE_SB
;
; It is not possible to search filename delimiter by backword search
; in case of DBCS version. so we use forword search instead.
;
mov bx,di
iup0:
mov al,es:[di]
test al,al ; end of string?
jz iup2 ; jump if so
inc di
cmp al,'\'
jz iup1
cmp al,'/'
jz iup1
cmp al,':'
jz iup1
call FarMyIsDBCSLeadByte ; see if char is DBC
jc iup0 ; jump if not a DBC
inc di ; skip to detemine 2nd byte of DBC
jmp iup0
iup1:
mov bx,di ; update purename candidate
jmp iup0
iup2:
mov di,bx ; di points purename pointer
ret
else
cld
xor al,al
mov cx,-1
mov bx,di
repne scasb
inc cx
inc cx
neg cx
iup0: cmp bx,di ; back to beginning of string?
jz iup1 ; yes, di points to name
mov al,es:[di-1] ; get next char
cmp al,'\' ; next char a '\'?
jz iup1 ; yes, di points to name
cmp al,'/' ; next char a '/'
jz iup1
cmp al,':' ; next char a ':'
jz iup1 ; yes, di points to name
dec di ; back up one
jmp iup0
iup1: ret
endif
cEnd nogen
;-----------------------------------------------------------------------;
; search_mod_dep_list
;
; Searches the dependent module list for the passed in name.
;
; Entry:
; AX = length of name to search for
; CX = count of modules
; DS:SI => module name to search for
; ES:DI => module table
; Returns:
;
; Registers Preserved:
; AX,BX,CX,DI,SI,ES
;
; Registers Destroyed:
;
; History:
; Sat 07-Oct-1989 17:12:43 -by- <NAME> [davidw]
;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc search_mod_dep_list,<PUBLIC,NEAR>
cBegin nogen
push bx
push cx
push di
mov bx,di
search_mod_loop:
mov di,es:[bx] ; es:di = offset into imptable
add di,es:[ne_imptab]
cmp es:[di],al ; does len of entry = sizeof(doscalls)
jnz get_next_entry
push cx ; cx holds count of module entries.
push si
inc di ; es:di = import module name
mov cx,ax
rep cmpsb
pop si
pop cx
stc
jz got_it
get_next_entry:
inc bx
inc bx
loop search_mod_loop
clc
got_it: pop di
pop cx
pop bx
ret
cEnd nogen
;-----------------------------------------------------------------------;
; LMCheckHeap
;
; This checks for 4K free space in both USER's and GDI's data
; segments. If this space does not exist then we will not load
; the app. This is better than the hose-bag way we did things
; under win 1 and 2.
;
; Entry:
; nothing
;
; Returns:
; AX != 0 lots o'space
;
; Registers Destroyed:
; BX,CX
;
; History:
; Sat 28-Oct-1989 17:49:09 -by- <NAME> [davidw]
; Wrote it!
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
MIN_RSC = 10
cProc LMCheckHeap,<PUBLIC,NEAR>,<ds>
cBegin
SetKernelDSNRES
ifdef WOW
; USER32 and GDI32 can deal with memory alloc no need check heaps on WOW
mov ax,-1 ; WOW doesn't have GDI or User heaps
else ; so don't check them.
mov ax, MIN_RSC
cmp word ptr pGetFreeSystemResources[2],0
jz @F
cCall pGetFreeSystemResources,<0>
cmp ax, MIN_RSC
jae @F
if kdebug ; test low memory code if DEBUG
krDebugOut DEB_WARN, "Resources #ax% - this tests your error handling code"
or al, 1
else
xor ax, ax ; you failed - g'bye
endif
@@:
endif ; WOW
ReSetKernelDS
cEnd
if 0
cProc check_gdi_user_heap_space,<PUBLIC,NEAR>
cBegin nogen
ReSetKernelDS
ifdef WOW
; USER32 and GDI32 can deal with memory alloc no need check heaps on WOW
mov ax,-1 ; WOW doesn't have GDI or User heaps
else ; so don't check them.
cmp graphics,0
jz c_ret
push dx
push es
push ds
mov ds,hGDI
UnSetKernelDS
call checkit_bvakasha
or ax,ax
jz c_exit
pop ds
ReSetKernelDS
push ds
mov ds,hUser
UnSetKernelDS
call checkit_bvakasha
c_exit: pop ds
pop es
pop dx
c_ret: ret
public checkit_bvakasha
checkit_bvakasha:
mov bx,ds:[ne_pautodata]
cCall FarMyLock,<ds:[bx].ns_handle>
mov ds,ax
call LocalCountFree
sub ax,4095
ja cguhs_exit
neg ax
mov bx,LA_MOVEABLE
cCall LocalAlloc,<bx,ax>
or ax,ax
jz cguhs_exit
free_User_piece:
cCall LocalFree,<ax>
mov ax,sp ; return non-zero
cguhs_exit:
endif ;WOW
ret
cEnd nogen
endif
;-----------------------------------------------------------------------;
; GetHeapSpaces
;
;
; Entry:
; nothing
;
; Returns:
; AX = free space (bytes) of User heap assuming heap can grow to 64K
; DX = free space (bytes) of GDI heap assuming heap can grow to 64K
; Registers Destroyed:
;
; History:
; Wed 10-Jan-1990 22:27:38 -by- <NAME> [davidw]
; Wrote it!
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc GetHeapSpaces,<PUBLIC,FAR>,<di,si>
parmW hInstance
cBegin
call MapDStoDATA
ReSetKernelDS
cCall FarMyLock,<hInstance>
or ax,ax
jz ghs_exit
mov ds,ax
cmp ds:[ne_magic],NEMAGIC
jnz ghs_must_be_data
mov bx,ds:[ne_pautodata]
cCall FarMyLock,<ds:[bx].ns_handle>
mov ds,ax
ghs_must_be_data:
call LocalCountFree
mov si,ax
cCall GlobalSize,<ds>
neg ax
add ax,si ; AX = size of free assuming 64K
mov cx,si ; CX = size of free
mov dx,-1
sub dx,ds:[pLocalHeap] ; DX = size of heap
ghs_exit:
cEnd
;-----------------------------------------------------------------------;
; IsROMModule
;
; Determines if an app with a given name is a ROM application
;
; Entry:
; Returns:
; Registers Destroyed:
;
; History:
; Wed 01-May-1991 13:11:38 -by- <NAME> [craigc]
; Wrote it!
;-----------------------------------------------------------------------;
cProc IsROMModule, <FAR, PUBLIC>
cBegin <nogen>
xor ax, ax
retf 6
cEnd <nogen>
;-----------------------------------------------------------------------;
; IsROMFile
;
; Determines if a file is in ROM
;
; Entry:
; Returns:
; Registers Destroyed:
;
; History:
; 8/8/91 -- vatsanp -- adapted this for true-type files in ROM
; from IsROMModule [ craigc]
; Wed 01-May-1991 13:11:38 -by- <NAME> [craigc]
; Wrote it!
;-----------------------------------------------------------------------;
cProc IsROMFile, <FAR, PUBLIC>
cBegin <nogen>
xor ax, ax
retf 6
cEnd <nogen>
sEnd NRESCODE
end
|
ffmpeg-subtree/libswscale/x86/scale_avx2.asm | TROISIDesign/ffevc | 0 | 174068 | ;******************************************************************************
;* x86-optimized horizontal line scaling functions
;* Copyright 2020 Google LLC
;* Copyright (c) 2011 <NAME> <<EMAIL>>
;*
;* This file is part of FFmpeg.
;*
;* FFmpeg is free software; you can redistribute it and/or
;* modify it under the terms of the GNU Lesser General Public
;* License as published by the Free Software Foundation; either
;* version 2.1 of the License, or (at your option) any later version.
;*
;* FFmpeg is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;* Lesser General Public License for more details.
;*
;* You should have received a copy of the GNU Lesser General Public
;* License along with FFmpeg; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "libavutil/x86/x86util.asm"
SECTION_RODATA 32
swizzle: dd 0, 4, 1, 5, 2, 6, 3, 7
four: times 8 dd 4
SECTION .text
;-----------------------------------------------------------------------------
; horizontal line scaling
;
; void hscale8to15_<filterSize>_<opt>
; (SwsContext *c, int16_t *dst,
; int dstW, const uint8_t *src,
; const int16_t *filter,
; const int32_t *filterPos, int filterSize);
;
; Scale one horizontal line. Input is 8-bit width Filter is 14 bits. Output is
; 15 bits (in int16_t). Each output pixel is generated from $filterSize input
; pixels, the position of the first pixel is given in filterPos[nOutputPixel].
;-----------------------------------------------------------------------------
%macro SCALE_FUNC 1
cglobal hscale8to15_%1, 7, 9, 16, pos0, dst, w, srcmem, filter, fltpos, fltsize, count, inner
pxor m0, m0
mova m15, [swizzle]
xor countq, countq
movsxd wq, wd
%ifidn %1, X4
mova m14, [four]
shr fltsized, 2
%endif
.loop:
movu m1, [fltposq]
movu m2, [fltposq+32]
%ifidn %1, X4
pxor m9, m9
pxor m10, m10
pxor m11, m11
pxor m12, m12
xor innerq, innerq
.innerloop:
%endif
vpcmpeqd m13, m13
vpgatherdd m3,[srcmemq + m1], m13
vpcmpeqd m13, m13
vpgatherdd m4,[srcmemq + m2], m13
vpunpcklbw m5, m3, m0
vpunpckhbw m6, m3, m0
vpunpcklbw m7, m4, m0
vpunpckhbw m8, m4, m0
vpmaddwd m5, m5, [filterq]
vpmaddwd m6, m6, [filterq + 32]
vpmaddwd m7, m7, [filterq + 64]
vpmaddwd m8, m8, [filterq + 96]
add filterq, 0x80
%ifidn %1, X4
paddd m9, m5
paddd m10, m6
paddd m11, m7
paddd m12, m8
paddd m1, m14
paddd m2, m14
add innerq, 1
cmp innerq, fltsizeq
jl .innerloop
vphaddd m5, m9, m10
vphaddd m6, m11, m12
%else
vphaddd m5, m5, m6
vphaddd m6, m7, m8
%endif
vpsrad m5, 7
vpsrad m6, 7
vpackssdw m5, m5, m6
vpermd m5, m15, m5
vmovdqu [dstq + countq * 2], m5
add fltposq, 0x40
add countq, 0x10
cmp countq, wq
jl .loop
REP_RET
%endmacro
%if ARCH_X86_64
%if HAVE_AVX2_EXTERNAL
INIT_YMM avx2
SCALE_FUNC 4
SCALE_FUNC X4
%endif
%endif
|
libsrc/_DEVELOPMENT/adt/p_stack/c/sdcc_iy/p_stack_push.asm | jpoikela/z88dk | 640 | 102783 |
; void p_stack_push(p_stack_t *s, void *item)
SECTION code_clib
SECTION code_adt_p_stack
PUBLIC _p_stack_push
EXTERN _p_forward_list_insert_after
defc _p_stack_push = _p_forward_list_insert_after
|
src/state-ending.asm | santiontanon/triton | 41 | 101793 | <gh_stars>10-100
game_ending_text:
db TEXT_E_CUTSCENE_1_BANK, TEXT_E_CUTSCENE_1_IDX
db TEXT_E_CUTSCENE_2_BANK, TEXT_E_CUTSCENE_2_IDX
db TEXT_E_CUTSCENE_3_BANK, TEXT_E_CUTSCENE_3_IDX
db TEXT_E_CUTSCENE_4_BANK, TEXT_E_CUTSCENE_4_IDX
db TEXT_E_CUTSCENE_5_BANK, TEXT_E_CUTSCENE_5_IDX
db TEXT_E_CUTSCENE_6_BANK, TEXT_E_CUTSCENE_6_IDX
db TEXT_E_CUTSCENE_7_BANK, TEXT_E_CUTSCENE_7_IDX
db TEXT_E_CUTSCENE_8_BANK, TEXT_E_CUTSCENE_8_IDX
db TEXT_E_CUTSCENE_9_BANK, TEXT_E_CUTSCENE_9_IDX
db TEXT_E_CUTSCENE_7_BANK, TEXT_E_CUTSCENE_7_IDX
db TEXT_E_CUTSCENE_10_BANK, TEXT_E_CUTSCENE_10_IDX
db TEXT_E_CUTSCENE_11_BANK, TEXT_E_CUTSCENE_11_IDX
db TEXT_E_CUTSCENE_12_BANK, TEXT_E_CUTSCENE_12_IDX
;-----------------------------------------------
state_game_ending:
; reset the stack:
ld sp,#F380
call StopMusic
call disable_VDP_output
call clearAllTheSprites
call set_bitmap_mode
; load UI tiles into bank 0:
ld hl,ui_tiles_plt
ld de,buffer
call unpack_compressed
call load_groupped_tile_data_into_vdp_bank0
ld a,31
ld hl,NAMTBL2
ld bc,256
call fast_FILVRM
; set vertical bitmap mode in bank 1:
call set_vertical_bitmap_name_table_bank1
; bank 2 was already cleared by set_bitmap_mode above
; render all the text lines in a buffer:
ld hl,buffer
ld bc,16*8*14-1 ; we clear 13 lines (one more than needed, to have an empty line at the end)
call clear_memory
ld b,13
ld hl,game_ending_text
ld de,buffer
state_game_ending_pre_render_text_loop:
push bc
ld c,(hl)
inc hl
ld a,(hl)
inc hl
push hl
push de
; ld de,text_buffer
call get_text_from_bank
call clear_text_rendering_buffer
ld hl,text_buffer
ld bc,16*8
call draw_sentence_pre_render
pop de
push de
; copy to buffer:
ld hl,text_draw_buffer
ld bc,16*8
ldir
pop hl
ld bc,16*8
add hl,bc
ex de,hl
pop hl
pop bc
djnz state_game_ending_pre_render_text_loop
; set the attributes for the scroll area:
ld a,#f0
ld hl,CLRTBL2+256*8
ld bc,256*8
call fast_FILVRM
; load name tables:
ld hl,cutscene_gfx_plt
ld de,cutscene_gfx_buffer
call unpack_compressed
call enable_VDP_output
; play music:
ld ix,decompress_ending_song_from_page1
call call_from_page1
ld a,(isComputer50HzOr60Hz)
add a,a
add a,10 ; 10 if 50Hz, 12 if 60Hz
call PlayMusic
ld hl,0
ld (ending_timer),hl
state_game_ending_loop:
halt
call update_keyboard_buffers
ld a,(keyboard_line_clicks)
bit 0,a
jp nz,state_gameover_screen
ld a,(interrupt_cycle)
and #07
jr nz,state_game_ending_loop
; scroll the middle of page 1 pixel up:
call ending_scroll_bank1_up
; draw one line of text at the bottom:
; call ending_draw_next_text_line ; already called from the previous function
; at certain times draw/delete the cutscene images in bank 0:
ld a,(ending_timer)
cp 8
call z,ending_scroll_draw_image1
cp 96
call z,ending_scroll_clear_image
cp 104
call z,ending_scroll_draw_image2
cp 192
call z,ending_scroll_clear_image
; jp state_braingames_screen
jr state_game_ending_loop
;-----------------------------------------------
ending_scroll_clear_image:
ld a,31
ld hl,NAMTBL2
ld bc,256
jp fast_FILVRM
ending_scroll_draw_image1:
ld hl,cutscene_gfx_buffer+12*6*3
ending_scroll_draw_image1_entry_point:
ld de,NAMTBL2+32+10
ld b,6
ending_scroll_draw_image1_loop:
push bc
push hl
push de
ld bc,10
call fast_LDIRVM
pop hl
ld bc,32
add hl,bc
ex de,hl
pop hl
ld c,12
add hl,bc
pop bc
djnz ending_scroll_draw_image1_loop
ret
ending_scroll_draw_image2:
ld hl,cutscene_gfx_buffer+12*6*4
jr ending_scroll_draw_image1_entry_point
;-----------------------------------------------
ending_scroll_bank1_up:
ld hl,CHRTBL2+256*8+8*8*8+1
ld b,16
ending_scroll_bank1_up_loop:
push bc
ld de,buffer5
ld bc,8*8-1
push hl
push de
push bc
call fast_LDIRMV
pop bc
pop hl ; notice we are swapping hl and de
pop de
dec de
; hl = buffer5
; de = CHRTBL2+...
push de
call fast_LDIRVM
pop hl
ld bc,8*8+1
add hl,bc
pop bc
djnz ending_scroll_bank1_up_loop
; ret
;-----------------------------------------------
ending_draw_next_text_line:
ld hl,(ending_timer)
inc hl
ld (ending_timer),hl
bit 3,l
jr z,ending_draw_next_text_line_text
ending_draw_next_text_line_intertext:
ld de,buffer+16*8*8 ; select the empty line
jr ending_draw_next_text_line_ptr_set
ending_draw_next_text_line_text:
ex de,hl
ld a,e
and #07
ld hl,buffer
ld b,l ; buffer ix 256 aligned, so l == 0
ld c,a
add hl,bc
ld bc,16*8
ld a,e
srl d ; we take the lsb of d, so that the counter is 9 bit
rr a
rrca
rrca
rrca
and #1f ; line
jr z,ending_draw_next_text_line_text_loop_end
cp 1
jr c,ending_draw_next_text_line_text_loop
jr z,ending_draw_next_text_line_intertext
dec a
cp 5
jr c,ending_draw_next_text_line_text_loop
jr z,ending_draw_next_text_line_intertext
dec a
cp 7
jr c,ending_draw_next_text_line_text_loop
jr z,ending_draw_next_text_line_intertext
dec a
cp 9
jr c,ending_draw_next_text_line_text_loop
jr z,ending_draw_next_text_line_intertext
dec a
cp 12
jr c,ending_draw_next_text_line_text_loop
jr z,ending_draw_next_text_line_intertext
dec a
cp 13
jr nc,ending_draw_next_text_line_intertext
ending_draw_next_text_line_text_loop:
add hl,bc
dec a
jr nz,ending_draw_next_text_line_text_loop
ending_draw_next_text_line_text_loop_end:
ex de,hl
ending_draw_next_text_line_ptr_set:
ld hl,CHRTBL2+256*8+71*8+7
ld b,16
ending_draw_next_text_line_loop:
push bc
push hl
push de
ld a,(de)
call writeByteToVDP
pop hl
ld bc,8
add hl,bc
ex de,hl
pop hl
ld c,8*8
add hl,bc
pop bc
djnz ending_draw_next_text_line_loop
ret
;-----------------------------------------------
load_groupped_tile_data_into_vdp_bank0:
ld hl,buffer
ld de,CHRTBL2
ld b,11*16
load_groupped_tile_data_into_vdp_bank0_loop:
push bc
push hl
push de
ld bc,8
call fast_LDIRVM
pop hl
ld bc,CLRTBL2-CHRTBL2
add hl,bc
ex de,hl
pop hl
ld bc,8
add hl,bc
push hl
push de
; ld bc,8
call fast_LDIRVM
pop hl
ld bc,CHRTBL2+8-CLRTBL2
add hl,bc
ex de,hl
pop hl
; ld bc,8
ld b,0 ; assuming c == 8
add hl,bc
pop bc
djnz load_groupped_tile_data_into_vdp_bank0_loop
ret
|
test/Succeed/Issue533.agda | cruhland/agda | 1,989 | 2538 | <reponame>cruhland/agda
module Issue533 where
data Empty : Set where
empty : {A B : Set} → (B → Empty) → B → A
empty f x with f x
... | ()
fail : ∀ {A : Set} → Empty → A
fail {A} = empty absurd
where
absurd : _ → Empty
absurd ()
-- should check (due to postponed emptyness constraint, see issue 479)
|
build/win64/mulq_mont_384-x86_64.asm | huitseeker/blst | 231 | 8861 | OPTION DOTNAME
.text$ SEGMENT ALIGN(256) 'CODE'
ALIGN 32
__sub_mod_384x384 PROC PRIVATE
DB 243,15,30,250
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov r14,QWORD PTR[48+rsi]
sub r8,QWORD PTR[rdx]
mov r15,QWORD PTR[56+rsi]
sbb r9,QWORD PTR[8+rdx]
mov rax,QWORD PTR[64+rsi]
sbb r10,QWORD PTR[16+rdx]
mov rbx,QWORD PTR[72+rsi]
sbb r11,QWORD PTR[24+rdx]
mov rbp,QWORD PTR[80+rsi]
sbb r12,QWORD PTR[32+rdx]
mov rsi,QWORD PTR[88+rsi]
sbb r13,QWORD PTR[40+rdx]
mov QWORD PTR[rdi],r8
sbb r14,QWORD PTR[48+rdx]
mov r8,QWORD PTR[rcx]
mov QWORD PTR[8+rdi],r9
sbb r15,QWORD PTR[56+rdx]
mov r9,QWORD PTR[8+rcx]
mov QWORD PTR[16+rdi],r10
sbb rax,QWORD PTR[64+rdx]
mov r10,QWORD PTR[16+rcx]
mov QWORD PTR[24+rdi],r11
sbb rbx,QWORD PTR[72+rdx]
mov r11,QWORD PTR[24+rcx]
mov QWORD PTR[32+rdi],r12
sbb rbp,QWORD PTR[80+rdx]
mov r12,QWORD PTR[32+rcx]
mov QWORD PTR[40+rdi],r13
sbb rsi,QWORD PTR[88+rdx]
mov r13,QWORD PTR[40+rcx]
sbb rdx,rdx
and r8,rdx
and r9,rdx
and r10,rdx
and r11,rdx
and r12,rdx
and r13,rdx
add r14,r8
adc r15,r9
mov QWORD PTR[48+rdi],r14
adc rax,r10
mov QWORD PTR[56+rdi],r15
adc rbx,r11
mov QWORD PTR[64+rdi],rax
adc rbp,r12
mov QWORD PTR[72+rdi],rbx
adc rsi,r13
mov QWORD PTR[80+rdi],rbp
mov QWORD PTR[88+rdi],rsi
DB 0F3h,0C3h ;repret
__sub_mod_384x384 ENDP
ALIGN 32
__add_mod_384 PROC PRIVATE
DB 243,15,30,250
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
add r8,QWORD PTR[rdx]
adc r9,QWORD PTR[8+rdx]
adc r10,QWORD PTR[16+rdx]
mov r14,r8
adc r11,QWORD PTR[24+rdx]
mov r15,r9
adc r12,QWORD PTR[32+rdx]
mov rax,r10
adc r13,QWORD PTR[40+rdx]
mov rbx,r11
sbb rdx,rdx
sub r8,QWORD PTR[rcx]
sbb r9,QWORD PTR[8+rcx]
mov rbp,r12
sbb r10,QWORD PTR[16+rcx]
sbb r11,QWORD PTR[24+rcx]
sbb r12,QWORD PTR[32+rcx]
mov rsi,r13
sbb r13,QWORD PTR[40+rcx]
sbb rdx,0
cmovc r8,r14
cmovc r9,r15
cmovc r10,rax
mov QWORD PTR[rdi],r8
cmovc r11,rbx
mov QWORD PTR[8+rdi],r9
cmovc r12,rbp
mov QWORD PTR[16+rdi],r10
cmovc r13,rsi
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
DB 0F3h,0C3h ;repret
__add_mod_384 ENDP
ALIGN 32
__sub_mod_384 PROC PRIVATE
DB 243,15,30,250
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
__sub_mod_384_a_is_loaded::
sub r8,QWORD PTR[rdx]
mov r14,QWORD PTR[rcx]
sbb r9,QWORD PTR[8+rdx]
mov r15,QWORD PTR[8+rcx]
sbb r10,QWORD PTR[16+rdx]
mov rax,QWORD PTR[16+rcx]
sbb r11,QWORD PTR[24+rdx]
mov rbx,QWORD PTR[24+rcx]
sbb r12,QWORD PTR[32+rdx]
mov rbp,QWORD PTR[32+rcx]
sbb r13,QWORD PTR[40+rdx]
mov rsi,QWORD PTR[40+rcx]
sbb rdx,rdx
and r14,rdx
and r15,rdx
and rax,rdx
and rbx,rdx
and rbp,rdx
and rsi,rdx
add r8,r14
adc r9,r15
mov QWORD PTR[rdi],r8
adc r10,rax
mov QWORD PTR[8+rdi],r9
adc r11,rbx
mov QWORD PTR[16+rdi],r10
adc r12,rbp
mov QWORD PTR[24+rdi],r11
adc r13,rsi
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
DB 0F3h,0C3h ;repret
__sub_mod_384 ENDP
PUBLIC mul_mont_384x
ALIGN 32
mul_mont_384x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_mont_384x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
mov r8,QWORD PTR[40+rsp]
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,328
$L$SEH_body_mul_mont_384x::
mov rbx,rdx
mov QWORD PTR[32+rsp],rdi
mov QWORD PTR[24+rsp],rsi
mov QWORD PTR[16+rsp],rdx
mov QWORD PTR[8+rsp],rcx
mov QWORD PTR[rsp],r8
lea rdi,QWORD PTR[40+rsp]
call __mulq_384
lea rbx,QWORD PTR[48+rbx]
lea rsi,QWORD PTR[48+rsi]
lea rdi,QWORD PTR[((40+96))+rsp]
call __mulq_384
mov rcx,QWORD PTR[8+rsp]
lea rdx,QWORD PTR[((-48))+rsi]
lea rdi,QWORD PTR[((40+192+48))+rsp]
call __add_mod_384
mov rsi,QWORD PTR[16+rsp]
lea rdx,QWORD PTR[48+rsi]
lea rdi,QWORD PTR[((-48))+rdi]
call __add_mod_384
lea rbx,QWORD PTR[rdi]
lea rsi,QWORD PTR[48+rdi]
call __mulq_384
lea rsi,QWORD PTR[rdi]
lea rdx,QWORD PTR[40+rsp]
mov rcx,QWORD PTR[8+rsp]
call __sub_mod_384x384
lea rsi,QWORD PTR[rdi]
lea rdx,QWORD PTR[((-96))+rdi]
call __sub_mod_384x384
lea rsi,QWORD PTR[40+rsp]
lea rdx,QWORD PTR[((40+96))+rsp]
lea rdi,QWORD PTR[40+rsp]
call __sub_mod_384x384
mov rbx,rcx
lea rsi,QWORD PTR[40+rsp]
mov rcx,QWORD PTR[rsp]
mov rdi,QWORD PTR[32+rsp]
call __mulq_by_1_mont_384
call __redc_tail_mont_384
lea rsi,QWORD PTR[((40+192))+rsp]
mov rcx,QWORD PTR[rsp]
lea rdi,QWORD PTR[48+rdi]
call __mulq_by_1_mont_384
call __redc_tail_mont_384
lea r8,QWORD PTR[328+rsp]
mov r15,QWORD PTR[r8]
mov r14,QWORD PTR[8+r8]
mov r13,QWORD PTR[16+r8]
mov r12,QWORD PTR[24+r8]
mov rbx,QWORD PTR[32+r8]
mov rbp,QWORD PTR[40+r8]
lea rsp,QWORD PTR[48+r8]
$L$SEH_epilogue_mul_mont_384x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_mont_384x::
mul_mont_384x ENDP
PUBLIC sqr_mont_384x
ALIGN 32
sqr_mont_384x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sqr_mont_384x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,136
$L$SEH_body_sqr_mont_384x::
mov QWORD PTR[rsp],rcx
mov rcx,rdx
mov QWORD PTR[8+rsp],rdi
mov QWORD PTR[16+rsp],rsi
lea rdx,QWORD PTR[48+rsi]
lea rdi,QWORD PTR[32+rsp]
call __add_mod_384
mov rsi,QWORD PTR[16+rsp]
lea rdx,QWORD PTR[48+rsi]
lea rdi,QWORD PTR[((32+48))+rsp]
call __sub_mod_384
mov rsi,QWORD PTR[16+rsp]
lea rbx,QWORD PTR[48+rsi]
mov rax,QWORD PTR[48+rsi]
mov r14,QWORD PTR[rsi]
mov r15,QWORD PTR[8+rsi]
mov r12,QWORD PTR[16+rsi]
mov r13,QWORD PTR[24+rsi]
call __mulq_mont_384
add r14,r14
adc r15,r15
adc r8,r8
mov r12,r14
adc r9,r9
mov r13,r15
adc r10,r10
mov rax,r8
adc r11,r11
mov rbx,r9
sbb rdx,rdx
sub r14,QWORD PTR[rcx]
sbb r15,QWORD PTR[8+rcx]
mov rbp,r10
sbb r8,QWORD PTR[16+rcx]
sbb r9,QWORD PTR[24+rcx]
sbb r10,QWORD PTR[32+rcx]
mov rsi,r11
sbb r11,QWORD PTR[40+rcx]
sbb rdx,0
cmovc r14,r12
cmovc r15,r13
cmovc r8,rax
mov QWORD PTR[48+rdi],r14
cmovc r9,rbx
mov QWORD PTR[56+rdi],r15
cmovc r10,rbp
mov QWORD PTR[64+rdi],r8
cmovc r11,rsi
mov QWORD PTR[72+rdi],r9
mov QWORD PTR[80+rdi],r10
mov QWORD PTR[88+rdi],r11
lea rsi,QWORD PTR[32+rsp]
lea rbx,QWORD PTR[((32+48))+rsp]
mov rax,QWORD PTR[((32+48))+rsp]
mov r14,QWORD PTR[((32+0))+rsp]
mov r15,QWORD PTR[((32+8))+rsp]
mov r12,QWORD PTR[((32+16))+rsp]
mov r13,QWORD PTR[((32+24))+rsp]
call __mulq_mont_384
lea r8,QWORD PTR[136+rsp]
mov r15,QWORD PTR[r8]
mov r14,QWORD PTR[8+r8]
mov r13,QWORD PTR[16+r8]
mov r12,QWORD PTR[24+r8]
mov rbx,QWORD PTR[32+r8]
mov rbp,QWORD PTR[40+r8]
lea rsp,QWORD PTR[48+r8]
$L$SEH_epilogue_sqr_mont_384x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sqr_mont_384x::
sqr_mont_384x ENDP
PUBLIC mul_382x
ALIGN 32
mul_382x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_382x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,136
$L$SEH_body_mul_382x::
lea rdi,QWORD PTR[96+rdi]
mov QWORD PTR[rsp],rsi
mov QWORD PTR[8+rsp],rdx
mov QWORD PTR[16+rsp],rdi
mov QWORD PTR[24+rsp],rcx
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
add r8,QWORD PTR[48+rsi]
adc r9,QWORD PTR[56+rsi]
adc r10,QWORD PTR[64+rsi]
adc r11,QWORD PTR[72+rsi]
adc r12,QWORD PTR[80+rsi]
adc r13,QWORD PTR[88+rsi]
mov QWORD PTR[((32+0))+rsp],r8
mov QWORD PTR[((32+8))+rsp],r9
mov QWORD PTR[((32+16))+rsp],r10
mov QWORD PTR[((32+24))+rsp],r11
mov QWORD PTR[((32+32))+rsp],r12
mov QWORD PTR[((32+40))+rsp],r13
mov r8,QWORD PTR[rdx]
mov r9,QWORD PTR[8+rdx]
mov r10,QWORD PTR[16+rdx]
mov r11,QWORD PTR[24+rdx]
mov r12,QWORD PTR[32+rdx]
mov r13,QWORD PTR[40+rdx]
add r8,QWORD PTR[48+rdx]
adc r9,QWORD PTR[56+rdx]
adc r10,QWORD PTR[64+rdx]
adc r11,QWORD PTR[72+rdx]
adc r12,QWORD PTR[80+rdx]
adc r13,QWORD PTR[88+rdx]
mov QWORD PTR[((32+48))+rsp],r8
mov QWORD PTR[((32+56))+rsp],r9
mov QWORD PTR[((32+64))+rsp],r10
mov QWORD PTR[((32+72))+rsp],r11
mov QWORD PTR[((32+80))+rsp],r12
mov QWORD PTR[((32+88))+rsp],r13
lea rsi,QWORD PTR[((32+0))+rsp]
lea rbx,QWORD PTR[((32+48))+rsp]
call __mulq_384
mov rsi,QWORD PTR[rsp]
mov rbx,QWORD PTR[8+rsp]
lea rdi,QWORD PTR[((-96))+rdi]
call __mulq_384
lea rsi,QWORD PTR[48+rsi]
lea rbx,QWORD PTR[48+rbx]
lea rdi,QWORD PTR[32+rsp]
call __mulq_384
mov rsi,QWORD PTR[16+rsp]
lea rdx,QWORD PTR[32+rsp]
mov rcx,QWORD PTR[24+rsp]
mov rdi,rsi
call __sub_mod_384x384
lea rsi,QWORD PTR[rdi]
lea rdx,QWORD PTR[((-96))+rdi]
call __sub_mod_384x384
lea rsi,QWORD PTR[((-96))+rdi]
lea rdx,QWORD PTR[32+rsp]
lea rdi,QWORD PTR[((-96))+rdi]
call __sub_mod_384x384
lea r8,QWORD PTR[136+rsp]
mov r15,QWORD PTR[r8]
mov r14,QWORD PTR[8+r8]
mov r13,QWORD PTR[16+r8]
mov r12,QWORD PTR[24+r8]
mov rbx,QWORD PTR[32+r8]
mov rbp,QWORD PTR[40+r8]
lea rsp,QWORD PTR[48+r8]
$L$SEH_epilogue_mul_382x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_382x::
mul_382x ENDP
PUBLIC sqr_382x
ALIGN 32
sqr_382x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sqr_382x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
push rbp
push rbx
push r12
push r13
push r14
push r15
push rsi
$L$SEH_body_sqr_382x::
mov rcx,rdx
mov r14,QWORD PTR[rsi]
mov r15,QWORD PTR[8+rsi]
mov rax,QWORD PTR[16+rsi]
mov rbx,QWORD PTR[24+rsi]
mov rbp,QWORD PTR[32+rsi]
mov rdx,QWORD PTR[40+rsi]
mov r8,r14
add r14,QWORD PTR[48+rsi]
mov r9,r15
adc r15,QWORD PTR[56+rsi]
mov r10,rax
adc rax,QWORD PTR[64+rsi]
mov r11,rbx
adc rbx,QWORD PTR[72+rsi]
mov r12,rbp
adc rbp,QWORD PTR[80+rsi]
mov r13,rdx
adc rdx,QWORD PTR[88+rsi]
mov QWORD PTR[rdi],r14
mov QWORD PTR[8+rdi],r15
mov QWORD PTR[16+rdi],rax
mov QWORD PTR[24+rdi],rbx
mov QWORD PTR[32+rdi],rbp
mov QWORD PTR[40+rdi],rdx
lea rdx,QWORD PTR[48+rsi]
lea rdi,QWORD PTR[48+rdi]
call __sub_mod_384_a_is_loaded
lea rsi,QWORD PTR[rdi]
lea rbx,QWORD PTR[((-48))+rdi]
lea rdi,QWORD PTR[((-48))+rdi]
call __mulq_384
mov rsi,QWORD PTR[rsp]
lea rbx,QWORD PTR[48+rsi]
lea rdi,QWORD PTR[96+rdi]
call __mulq_384
mov r8,QWORD PTR[rdi]
mov r9,QWORD PTR[8+rdi]
mov r10,QWORD PTR[16+rdi]
mov r11,QWORD PTR[24+rdi]
mov r12,QWORD PTR[32+rdi]
mov r13,QWORD PTR[40+rdi]
mov r14,QWORD PTR[48+rdi]
mov r15,QWORD PTR[56+rdi]
mov rax,QWORD PTR[64+rdi]
mov rbx,QWORD PTR[72+rdi]
mov rbp,QWORD PTR[80+rdi]
add r8,r8
mov rdx,QWORD PTR[88+rdi]
adc r9,r9
mov QWORD PTR[rdi],r8
adc r10,r10
mov QWORD PTR[8+rdi],r9
adc r11,r11
mov QWORD PTR[16+rdi],r10
adc r12,r12
mov QWORD PTR[24+rdi],r11
adc r13,r13
mov QWORD PTR[32+rdi],r12
adc r14,r14
mov QWORD PTR[40+rdi],r13
adc r15,r15
mov QWORD PTR[48+rdi],r14
adc rax,rax
mov QWORD PTR[56+rdi],r15
adc rbx,rbx
mov QWORD PTR[64+rdi],rax
adc rbp,rbp
mov QWORD PTR[72+rdi],rbx
adc rdx,rdx
mov QWORD PTR[80+rdi],rbp
mov QWORD PTR[88+rdi],rdx
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_sqr_382x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sqr_382x::
sqr_382x ENDP
PUBLIC mul_384
ALIGN 32
mul_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
push rbp
push rbx
push r12
$L$SEH_body_mul_384::
mov rbx,rdx
call __mulq_384
mov r12,QWORD PTR[rsp]
mov rbx,QWORD PTR[8+rsp]
mov rbp,QWORD PTR[16+rsp]
lea rsp,QWORD PTR[24+rsp]
$L$SEH_epilogue_mul_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_384::
mul_384 ENDP
ALIGN 32
__mulq_384 PROC PRIVATE
DB 243,15,30,250
mov rax,QWORD PTR[rbx]
mov rbp,rax
mul QWORD PTR[rsi]
mov QWORD PTR[rdi],rax
mov rax,rbp
mov rcx,rdx
mul QWORD PTR[8+rsi]
add rcx,rax
mov rax,rbp
adc rdx,0
mov r8,rdx
mul QWORD PTR[16+rsi]
add r8,rax
mov rax,rbp
adc rdx,0
mov r9,rdx
mul QWORD PTR[24+rsi]
add r9,rax
mov rax,rbp
adc rdx,0
mov r10,rdx
mul QWORD PTR[32+rsi]
add r10,rax
mov rax,rbp
adc rdx,0
mov r11,rdx
mul QWORD PTR[40+rsi]
add r11,rax
mov rax,QWORD PTR[8+rbx]
adc rdx,0
mov r12,rdx
mov rbp,rax
mul QWORD PTR[rsi]
add rcx,rax
mov rax,rbp
adc rdx,0
mov QWORD PTR[8+rdi],rcx
mov rcx,rdx
mul QWORD PTR[8+rsi]
add r8,rax
mov rax,rbp
adc rdx,0
add rcx,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[16+rsi]
add r9,rax
mov rax,rbp
adc rdx,0
add r8,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[24+rsi]
add r10,rax
mov rax,rbp
adc rdx,0
add r9,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[32+rsi]
add r11,rax
mov rax,rbp
adc rdx,0
add r10,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[40+rsi]
add r12,rax
mov rax,QWORD PTR[16+rbx]
adc rdx,0
add r11,r12
adc rdx,0
mov r12,rdx
mov rbp,rax
mul QWORD PTR[rsi]
add rcx,rax
mov rax,rbp
adc rdx,0
mov QWORD PTR[16+rdi],rcx
mov rcx,rdx
mul QWORD PTR[8+rsi]
add r8,rax
mov rax,rbp
adc rdx,0
add rcx,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[16+rsi]
add r9,rax
mov rax,rbp
adc rdx,0
add r8,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[24+rsi]
add r10,rax
mov rax,rbp
adc rdx,0
add r9,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[32+rsi]
add r11,rax
mov rax,rbp
adc rdx,0
add r10,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[40+rsi]
add r12,rax
mov rax,QWORD PTR[24+rbx]
adc rdx,0
add r11,r12
adc rdx,0
mov r12,rdx
mov rbp,rax
mul QWORD PTR[rsi]
add rcx,rax
mov rax,rbp
adc rdx,0
mov QWORD PTR[24+rdi],rcx
mov rcx,rdx
mul QWORD PTR[8+rsi]
add r8,rax
mov rax,rbp
adc rdx,0
add rcx,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[16+rsi]
add r9,rax
mov rax,rbp
adc rdx,0
add r8,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[24+rsi]
add r10,rax
mov rax,rbp
adc rdx,0
add r9,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[32+rsi]
add r11,rax
mov rax,rbp
adc rdx,0
add r10,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[40+rsi]
add r12,rax
mov rax,QWORD PTR[32+rbx]
adc rdx,0
add r11,r12
adc rdx,0
mov r12,rdx
mov rbp,rax
mul QWORD PTR[rsi]
add rcx,rax
mov rax,rbp
adc rdx,0
mov QWORD PTR[32+rdi],rcx
mov rcx,rdx
mul QWORD PTR[8+rsi]
add r8,rax
mov rax,rbp
adc rdx,0
add rcx,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[16+rsi]
add r9,rax
mov rax,rbp
adc rdx,0
add r8,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[24+rsi]
add r10,rax
mov rax,rbp
adc rdx,0
add r9,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[32+rsi]
add r11,rax
mov rax,rbp
adc rdx,0
add r10,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[40+rsi]
add r12,rax
mov rax,QWORD PTR[40+rbx]
adc rdx,0
add r11,r12
adc rdx,0
mov r12,rdx
mov rbp,rax
mul QWORD PTR[rsi]
add rcx,rax
mov rax,rbp
adc rdx,0
mov QWORD PTR[40+rdi],rcx
mov rcx,rdx
mul QWORD PTR[8+rsi]
add r8,rax
mov rax,rbp
adc rdx,0
add rcx,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[16+rsi]
add r9,rax
mov rax,rbp
adc rdx,0
add r8,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[24+rsi]
add r10,rax
mov rax,rbp
adc rdx,0
add r9,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[32+rsi]
add r11,rax
mov rax,rbp
adc rdx,0
add r10,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[40+rsi]
add r12,rax
mov rax,rax
adc rdx,0
add r11,r12
adc rdx,0
mov r12,rdx
mov QWORD PTR[48+rdi],rcx
mov QWORD PTR[56+rdi],r8
mov QWORD PTR[64+rdi],r9
mov QWORD PTR[72+rdi],r10
mov QWORD PTR[80+rdi],r11
mov QWORD PTR[88+rdi],r12
DB 0F3h,0C3h ;repret
__mulq_384 ENDP
PUBLIC sqr_384
ALIGN 32
sqr_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sqr_384::
mov rdi,rcx
mov rsi,rdx
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8
$L$SEH_body_sqr_384::
call __sqrq_384
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_sqr_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sqr_384::
sqr_384 ENDP
ALIGN 32
__sqrq_384 PROC PRIVATE
DB 243,15,30,250
mov rax,QWORD PTR[rsi]
mov r15,QWORD PTR[8+rsi]
mov rcx,QWORD PTR[16+rsi]
mov rbx,QWORD PTR[24+rsi]
mov r14,rax
mul r15
mov r9,rax
mov rax,r14
mov rbp,QWORD PTR[32+rsi]
mov r10,rdx
mul rcx
add r10,rax
mov rax,r14
adc rdx,0
mov rsi,QWORD PTR[40+rsi]
mov r11,rdx
mul rbx
add r11,rax
mov rax,r14
adc rdx,0
mov r12,rdx
mul rbp
add r12,rax
mov rax,r14
adc rdx,0
mov r13,rdx
mul rsi
add r13,rax
mov rax,r14
adc rdx,0
mov r14,rdx
mul rax
xor r8,r8
mov QWORD PTR[rdi],rax
mov rax,r15
add r9,r9
adc r8,0
add r9,rdx
adc r8,0
mov QWORD PTR[8+rdi],r9
mul rcx
add r11,rax
mov rax,r15
adc rdx,0
mov r9,rdx
mul rbx
add r12,rax
mov rax,r15
adc rdx,0
add r12,r9
adc rdx,0
mov r9,rdx
mul rbp
add r13,rax
mov rax,r15
adc rdx,0
add r13,r9
adc rdx,0
mov r9,rdx
mul rsi
add r14,rax
mov rax,r15
adc rdx,0
add r14,r9
adc rdx,0
mov r15,rdx
mul rax
xor r9,r9
add r8,rax
mov rax,rcx
add r10,r10
adc r11,r11
adc r9,0
add r10,r8
adc r11,rdx
adc r9,0
mov QWORD PTR[16+rdi],r10
mul rbx
add r13,rax
mov rax,rcx
adc rdx,0
mov QWORD PTR[24+rdi],r11
mov r8,rdx
mul rbp
add r14,rax
mov rax,rcx
adc rdx,0
add r14,r8
adc rdx,0
mov r8,rdx
mul rsi
add r15,rax
mov rax,rcx
adc rdx,0
add r15,r8
adc rdx,0
mov rcx,rdx
mul rax
xor r11,r11
add r9,rax
mov rax,rbx
add r12,r12
adc r13,r13
adc r11,0
add r12,r9
adc r13,rdx
adc r11,0
mov QWORD PTR[32+rdi],r12
mul rbp
add r15,rax
mov rax,rbx
adc rdx,0
mov QWORD PTR[40+rdi],r13
mov r8,rdx
mul rsi
add rcx,rax
mov rax,rbx
adc rdx,0
add rcx,r8
adc rdx,0
mov rbx,rdx
mul rax
xor r12,r12
add r11,rax
mov rax,rbp
add r14,r14
adc r15,r15
adc r12,0
add r14,r11
adc r15,rdx
mov QWORD PTR[48+rdi],r14
adc r12,0
mov QWORD PTR[56+rdi],r15
mul rsi
add rbx,rax
mov rax,rbp
adc rdx,0
mov rbp,rdx
mul rax
xor r13,r13
add r12,rax
mov rax,rsi
add rcx,rcx
adc rbx,rbx
adc r13,0
add rcx,r12
adc rbx,rdx
mov QWORD PTR[64+rdi],rcx
adc r13,0
mov QWORD PTR[72+rdi],rbx
mul rax
add rax,r13
add rbp,rbp
adc rdx,0
add rax,rbp
adc rdx,0
mov QWORD PTR[80+rdi],rax
mov QWORD PTR[88+rdi],rdx
DB 0F3h,0C3h ;repret
__sqrq_384 ENDP
PUBLIC sqr_mont_384
ALIGN 32
sqr_mont_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sqr_mont_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8*15
$L$SEH_body_sqr_mont_384::
mov QWORD PTR[96+rsp],rcx
mov QWORD PTR[104+rsp],rdx
mov QWORD PTR[112+rsp],rdi
mov rdi,rsp
call __sqrq_384
lea rsi,QWORD PTR[rsp]
mov rcx,QWORD PTR[96+rsp]
mov rbx,QWORD PTR[104+rsp]
mov rdi,QWORD PTR[112+rsp]
call __mulq_by_1_mont_384
call __redc_tail_mont_384
lea r8,QWORD PTR[120+rsp]
mov r15,QWORD PTR[120+rsp]
mov r14,QWORD PTR[8+r8]
mov r13,QWORD PTR[16+r8]
mov r12,QWORD PTR[24+r8]
mov rbx,QWORD PTR[32+r8]
mov rbp,QWORD PTR[40+r8]
lea rsp,QWORD PTR[48+r8]
$L$SEH_epilogue_sqr_mont_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sqr_mont_384::
sqr_mont_384 ENDP
PUBLIC redc_mont_384
ALIGN 32
redc_mont_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_redc_mont_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8
$L$SEH_body_redc_mont_384::
mov rbx,rdx
call __mulq_by_1_mont_384
call __redc_tail_mont_384
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_redc_mont_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_redc_mont_384::
redc_mont_384 ENDP
PUBLIC from_mont_384
ALIGN 32
from_mont_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_from_mont_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8
$L$SEH_body_from_mont_384::
mov rbx,rdx
call __mulq_by_1_mont_384
mov rcx,r15
mov rdx,r8
mov rbp,r9
sub r14,QWORD PTR[rbx]
sbb r15,QWORD PTR[8+rbx]
mov r13,r10
sbb r8,QWORD PTR[16+rbx]
sbb r9,QWORD PTR[24+rbx]
sbb r10,QWORD PTR[32+rbx]
mov rsi,r11
sbb r11,QWORD PTR[40+rbx]
cmovc r14,rax
cmovc r15,rcx
cmovc r8,rdx
mov QWORD PTR[rdi],r14
cmovc r9,rbp
mov QWORD PTR[8+rdi],r15
cmovc r10,r13
mov QWORD PTR[16+rdi],r8
cmovc r11,rsi
mov QWORD PTR[24+rdi],r9
mov QWORD PTR[32+rdi],r10
mov QWORD PTR[40+rdi],r11
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_from_mont_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_from_mont_384::
from_mont_384 ENDP
ALIGN 32
__mulq_by_1_mont_384 PROC PRIVATE
DB 243,15,30,250
mov rax,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov r14,rax
imul rax,rcx
mov r8,rax
mul QWORD PTR[rbx]
add r14,rax
mov rax,r8
adc r14,rdx
mul QWORD PTR[8+rbx]
add r9,rax
mov rax,r8
adc rdx,0
add r9,r14
adc rdx,0
mov r14,rdx
mul QWORD PTR[16+rbx]
add r10,rax
mov rax,r8
adc rdx,0
add r10,r14
adc rdx,0
mov r14,rdx
mul QWORD PTR[24+rbx]
add r11,rax
mov rax,r8
adc rdx,0
mov r15,r9
imul r9,rcx
add r11,r14
adc rdx,0
mov r14,rdx
mul QWORD PTR[32+rbx]
add r12,rax
mov rax,r8
adc rdx,0
add r12,r14
adc rdx,0
mov r14,rdx
mul QWORD PTR[40+rbx]
add r13,rax
mov rax,r9
adc rdx,0
add r13,r14
adc rdx,0
mov r14,rdx
mul QWORD PTR[rbx]
add r15,rax
mov rax,r9
adc r15,rdx
mul QWORD PTR[8+rbx]
add r10,rax
mov rax,r9
adc rdx,0
add r10,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[16+rbx]
add r11,rax
mov rax,r9
adc rdx,0
add r11,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[24+rbx]
add r12,rax
mov rax,r9
adc rdx,0
mov r8,r10
imul r10,rcx
add r12,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[32+rbx]
add r13,rax
mov rax,r9
adc rdx,0
add r13,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[40+rbx]
add r14,rax
mov rax,r10
adc rdx,0
add r14,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[rbx]
add r8,rax
mov rax,r10
adc r8,rdx
mul QWORD PTR[8+rbx]
add r11,rax
mov rax,r10
adc rdx,0
add r11,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[16+rbx]
add r12,rax
mov rax,r10
adc rdx,0
add r12,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[24+rbx]
add r13,rax
mov rax,r10
adc rdx,0
mov r9,r11
imul r11,rcx
add r13,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[32+rbx]
add r14,rax
mov rax,r10
adc rdx,0
add r14,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[40+rbx]
add r15,rax
mov rax,r11
adc rdx,0
add r15,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[rbx]
add r9,rax
mov rax,r11
adc r9,rdx
mul QWORD PTR[8+rbx]
add r12,rax
mov rax,r11
adc rdx,0
add r12,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[16+rbx]
add r13,rax
mov rax,r11
adc rdx,0
add r13,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[24+rbx]
add r14,rax
mov rax,r11
adc rdx,0
mov r10,r12
imul r12,rcx
add r14,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[32+rbx]
add r15,rax
mov rax,r11
adc rdx,0
add r15,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[40+rbx]
add r8,rax
mov rax,r12
adc rdx,0
add r8,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[rbx]
add r10,rax
mov rax,r12
adc r10,rdx
mul QWORD PTR[8+rbx]
add r13,rax
mov rax,r12
adc rdx,0
add r13,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[16+rbx]
add r14,rax
mov rax,r12
adc rdx,0
add r14,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[24+rbx]
add r15,rax
mov rax,r12
adc rdx,0
mov r11,r13
imul r13,rcx
add r15,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[32+rbx]
add r8,rax
mov rax,r12
adc rdx,0
add r8,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[40+rbx]
add r9,rax
mov rax,r13
adc rdx,0
add r9,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[rbx]
add r11,rax
mov rax,r13
adc r11,rdx
mul QWORD PTR[8+rbx]
add r14,rax
mov rax,r13
adc rdx,0
add r14,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[16+rbx]
add r15,rax
mov rax,r13
adc rdx,0
add r15,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[24+rbx]
add r8,rax
mov rax,r13
adc rdx,0
add r8,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[32+rbx]
add r9,rax
mov rax,r13
adc rdx,0
add r9,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[40+rbx]
add r10,rax
mov rax,r14
adc rdx,0
add r10,r11
adc rdx,0
mov r11,rdx
DB 0F3h,0C3h ;repret
__mulq_by_1_mont_384 ENDP
ALIGN 32
__redc_tail_mont_384 PROC PRIVATE
DB 243,15,30,250
add r14,QWORD PTR[48+rsi]
mov rax,r14
adc r15,QWORD PTR[56+rsi]
adc r8,QWORD PTR[64+rsi]
adc r9,QWORD PTR[72+rsi]
mov rcx,r15
adc r10,QWORD PTR[80+rsi]
adc r11,QWORD PTR[88+rsi]
sbb r12,r12
mov rdx,r8
mov rbp,r9
sub r14,QWORD PTR[rbx]
sbb r15,QWORD PTR[8+rbx]
mov r13,r10
sbb r8,QWORD PTR[16+rbx]
sbb r9,QWORD PTR[24+rbx]
sbb r10,QWORD PTR[32+rbx]
mov rsi,r11
sbb r11,QWORD PTR[40+rbx]
sbb r12,0
cmovc r14,rax
cmovc r15,rcx
cmovc r8,rdx
mov QWORD PTR[rdi],r14
cmovc r9,rbp
mov QWORD PTR[8+rdi],r15
cmovc r10,r13
mov QWORD PTR[16+rdi],r8
cmovc r11,rsi
mov QWORD PTR[24+rdi],r9
mov QWORD PTR[32+rdi],r10
mov QWORD PTR[40+rdi],r11
DB 0F3h,0C3h ;repret
__redc_tail_mont_384 ENDP
PUBLIC sgn0_pty_mont_384
ALIGN 32
sgn0_pty_mont_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sgn0_pty_mont_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8
$L$SEH_body_sgn0_pty_mont_384::
mov rbx,rsi
lea rsi,QWORD PTR[rdi]
mov rcx,rdx
call __mulq_by_1_mont_384
xor rax,rax
mov r13,r14
add r14,r14
adc r15,r15
adc r8,r8
adc r9,r9
adc r10,r10
adc r11,r11
adc rax,0
sub r14,QWORD PTR[rbx]
sbb r15,QWORD PTR[8+rbx]
sbb r8,QWORD PTR[16+rbx]
sbb r9,QWORD PTR[24+rbx]
sbb r10,QWORD PTR[32+rbx]
sbb r11,QWORD PTR[40+rbx]
sbb rax,0
not rax
and r13,1
and rax,2
or rax,r13
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_sgn0_pty_mont_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sgn0_pty_mont_384::
sgn0_pty_mont_384 ENDP
PUBLIC sgn0_pty_mont_384x
ALIGN 32
sgn0_pty_mont_384x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sgn0_pty_mont_384x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8
$L$SEH_body_sgn0_pty_mont_384x::
mov rbx,rsi
lea rsi,QWORD PTR[48+rdi]
mov rcx,rdx
call __mulq_by_1_mont_384
mov r12,r14
or r14,r15
or r14,r8
or r14,r9
or r14,r10
or r14,r11
lea rsi,QWORD PTR[rdi]
xor rdi,rdi
mov r13,r12
add r12,r12
adc r15,r15
adc r8,r8
adc r9,r9
adc r10,r10
adc r11,r11
adc rdi,0
sub r12,QWORD PTR[rbx]
sbb r15,QWORD PTR[8+rbx]
sbb r8,QWORD PTR[16+rbx]
sbb r9,QWORD PTR[24+rbx]
sbb r10,QWORD PTR[32+rbx]
sbb r11,QWORD PTR[40+rbx]
sbb rdi,0
mov QWORD PTR[rsp],r14
not rdi
and r13,1
and rdi,2
or rdi,r13
call __mulq_by_1_mont_384
mov r12,r14
or r14,r15
or r14,r8
or r14,r9
or r14,r10
or r14,r11
xor rax,rax
mov r13,r12
add r12,r12
adc r15,r15
adc r8,r8
adc r9,r9
adc r10,r10
adc r11,r11
adc rax,0
sub r12,QWORD PTR[rbx]
sbb r15,QWORD PTR[8+rbx]
sbb r8,QWORD PTR[16+rbx]
sbb r9,QWORD PTR[24+rbx]
sbb r10,QWORD PTR[32+rbx]
sbb r11,QWORD PTR[40+rbx]
sbb rax,0
mov r12,QWORD PTR[rsp]
not rax
test r14,r14
cmovz r13,rdi
test r12,r12
cmovnz rax,rdi
and r13,1
and rax,2
or rax,r13
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_sgn0_pty_mont_384x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sgn0_pty_mont_384x::
sgn0_pty_mont_384x ENDP
PUBLIC mul_mont_384
ALIGN 32
mul_mont_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_mont_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
mov r8,QWORD PTR[40+rsp]
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8*3
$L$SEH_body_mul_mont_384::
mov rax,QWORD PTR[rdx]
mov r14,QWORD PTR[rsi]
mov r15,QWORD PTR[8+rsi]
mov r12,QWORD PTR[16+rsi]
mov r13,QWORD PTR[24+rsi]
mov rbx,rdx
mov QWORD PTR[rsp],r8
mov QWORD PTR[8+rsp],rdi
call __mulq_mont_384
mov r15,QWORD PTR[24+rsp]
mov r14,QWORD PTR[32+rsp]
mov r13,QWORD PTR[40+rsp]
mov r12,QWORD PTR[48+rsp]
mov rbx,QWORD PTR[56+rsp]
mov rbp,QWORD PTR[64+rsp]
lea rsp,QWORD PTR[72+rsp]
$L$SEH_epilogue_mul_mont_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_mont_384::
mul_mont_384 ENDP
ALIGN 32
__mulq_mont_384 PROC PRIVATE
DB 243,15,30,250
mov rdi,rax
mul r14
mov r8,rax
mov rax,rdi
mov r9,rdx
mul r15
add r9,rax
mov rax,rdi
adc rdx,0
mov r10,rdx
mul r12
add r10,rax
mov rax,rdi
adc rdx,0
mov r11,rdx
mov rbp,r8
imul r8,QWORD PTR[8+rsp]
mul r13
add r11,rax
mov rax,rdi
adc rdx,0
mov r12,rdx
mul QWORD PTR[32+rsi]
add r12,rax
mov rax,rdi
adc rdx,0
mov r13,rdx
mul QWORD PTR[40+rsi]
add r13,rax
mov rax,r8
adc rdx,0
xor r15,r15
mov r14,rdx
mul QWORD PTR[rcx]
add rbp,rax
mov rax,r8
adc rbp,rdx
mul QWORD PTR[8+rcx]
add r9,rax
mov rax,r8
adc rdx,0
add r9,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[16+rcx]
add r10,rax
mov rax,r8
adc rdx,0
add r10,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[24+rcx]
add r11,rbp
adc rdx,0
add r11,rax
mov rax,r8
adc rdx,0
mov rbp,rdx
mul QWORD PTR[32+rcx]
add r12,rax
mov rax,r8
adc rdx,0
add r12,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[40+rcx]
add r13,rax
mov rax,QWORD PTR[8+rbx]
adc rdx,0
add r13,rbp
adc r14,rdx
adc r15,0
mov rdi,rax
mul QWORD PTR[rsi]
add r9,rax
mov rax,rdi
adc rdx,0
mov r8,rdx
mul QWORD PTR[8+rsi]
add r10,rax
mov rax,rdi
adc rdx,0
add r10,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[16+rsi]
add r11,rax
mov rax,rdi
adc rdx,0
add r11,r8
adc rdx,0
mov r8,rdx
mov rbp,r9
imul r9,QWORD PTR[8+rsp]
mul QWORD PTR[24+rsi]
add r12,rax
mov rax,rdi
adc rdx,0
add r12,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[32+rsi]
add r13,rax
mov rax,rdi
adc rdx,0
add r13,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[40+rsi]
add r14,r8
adc rdx,0
xor r8,r8
add r14,rax
mov rax,r9
adc r15,rdx
adc r8,0
mul QWORD PTR[rcx]
add rbp,rax
mov rax,r9
adc rbp,rdx
mul QWORD PTR[8+rcx]
add r10,rax
mov rax,r9
adc rdx,0
add r10,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[16+rcx]
add r11,rax
mov rax,r9
adc rdx,0
add r11,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[24+rcx]
add r12,rbp
adc rdx,0
add r12,rax
mov rax,r9
adc rdx,0
mov rbp,rdx
mul QWORD PTR[32+rcx]
add r13,rax
mov rax,r9
adc rdx,0
add r13,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[40+rcx]
add r14,rax
mov rax,QWORD PTR[16+rbx]
adc rdx,0
add r14,rbp
adc r15,rdx
adc r8,0
mov rdi,rax
mul QWORD PTR[rsi]
add r10,rax
mov rax,rdi
adc rdx,0
mov r9,rdx
mul QWORD PTR[8+rsi]
add r11,rax
mov rax,rdi
adc rdx,0
add r11,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[16+rsi]
add r12,rax
mov rax,rdi
adc rdx,0
add r12,r9
adc rdx,0
mov r9,rdx
mov rbp,r10
imul r10,QWORD PTR[8+rsp]
mul QWORD PTR[24+rsi]
add r13,rax
mov rax,rdi
adc rdx,0
add r13,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[32+rsi]
add r14,rax
mov rax,rdi
adc rdx,0
add r14,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[40+rsi]
add r15,r9
adc rdx,0
xor r9,r9
add r15,rax
mov rax,r10
adc r8,rdx
adc r9,0
mul QWORD PTR[rcx]
add rbp,rax
mov rax,r10
adc rbp,rdx
mul QWORD PTR[8+rcx]
add r11,rax
mov rax,r10
adc rdx,0
add r11,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[16+rcx]
add r12,rax
mov rax,r10
adc rdx,0
add r12,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[24+rcx]
add r13,rbp
adc rdx,0
add r13,rax
mov rax,r10
adc rdx,0
mov rbp,rdx
mul QWORD PTR[32+rcx]
add r14,rax
mov rax,r10
adc rdx,0
add r14,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[40+rcx]
add r15,rax
mov rax,QWORD PTR[24+rbx]
adc rdx,0
add r15,rbp
adc r8,rdx
adc r9,0
mov rdi,rax
mul QWORD PTR[rsi]
add r11,rax
mov rax,rdi
adc rdx,0
mov r10,rdx
mul QWORD PTR[8+rsi]
add r12,rax
mov rax,rdi
adc rdx,0
add r12,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[16+rsi]
add r13,rax
mov rax,rdi
adc rdx,0
add r13,r10
adc rdx,0
mov r10,rdx
mov rbp,r11
imul r11,QWORD PTR[8+rsp]
mul QWORD PTR[24+rsi]
add r14,rax
mov rax,rdi
adc rdx,0
add r14,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[32+rsi]
add r15,rax
mov rax,rdi
adc rdx,0
add r15,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[40+rsi]
add r8,r10
adc rdx,0
xor r10,r10
add r8,rax
mov rax,r11
adc r9,rdx
adc r10,0
mul QWORD PTR[rcx]
add rbp,rax
mov rax,r11
adc rbp,rdx
mul QWORD PTR[8+rcx]
add r12,rax
mov rax,r11
adc rdx,0
add r12,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[16+rcx]
add r13,rax
mov rax,r11
adc rdx,0
add r13,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[24+rcx]
add r14,rbp
adc rdx,0
add r14,rax
mov rax,r11
adc rdx,0
mov rbp,rdx
mul QWORD PTR[32+rcx]
add r15,rax
mov rax,r11
adc rdx,0
add r15,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[40+rcx]
add r8,rax
mov rax,QWORD PTR[32+rbx]
adc rdx,0
add r8,rbp
adc r9,rdx
adc r10,0
mov rdi,rax
mul QWORD PTR[rsi]
add r12,rax
mov rax,rdi
adc rdx,0
mov r11,rdx
mul QWORD PTR[8+rsi]
add r13,rax
mov rax,rdi
adc rdx,0
add r13,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[16+rsi]
add r14,rax
mov rax,rdi
adc rdx,0
add r14,r11
adc rdx,0
mov r11,rdx
mov rbp,r12
imul r12,QWORD PTR[8+rsp]
mul QWORD PTR[24+rsi]
add r15,rax
mov rax,rdi
adc rdx,0
add r15,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[32+rsi]
add r8,rax
mov rax,rdi
adc rdx,0
add r8,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[40+rsi]
add r9,r11
adc rdx,0
xor r11,r11
add r9,rax
mov rax,r12
adc r10,rdx
adc r11,0
mul QWORD PTR[rcx]
add rbp,rax
mov rax,r12
adc rbp,rdx
mul QWORD PTR[8+rcx]
add r13,rax
mov rax,r12
adc rdx,0
add r13,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[16+rcx]
add r14,rax
mov rax,r12
adc rdx,0
add r14,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[24+rcx]
add r15,rbp
adc rdx,0
add r15,rax
mov rax,r12
adc rdx,0
mov rbp,rdx
mul QWORD PTR[32+rcx]
add r8,rax
mov rax,r12
adc rdx,0
add r8,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[40+rcx]
add r9,rax
mov rax,QWORD PTR[40+rbx]
adc rdx,0
add r9,rbp
adc r10,rdx
adc r11,0
mov rdi,rax
mul QWORD PTR[rsi]
add r13,rax
mov rax,rdi
adc rdx,0
mov r12,rdx
mul QWORD PTR[8+rsi]
add r14,rax
mov rax,rdi
adc rdx,0
add r14,r12
adc rdx,0
mov r12,rdx
mul QWORD PTR[16+rsi]
add r15,rax
mov rax,rdi
adc rdx,0
add r15,r12
adc rdx,0
mov r12,rdx
mov rbp,r13
imul r13,QWORD PTR[8+rsp]
mul QWORD PTR[24+rsi]
add r8,rax
mov rax,rdi
adc rdx,0
add r8,r12
adc rdx,0
mov r12,rdx
mul QWORD PTR[32+rsi]
add r9,rax
mov rax,rdi
adc rdx,0
add r9,r12
adc rdx,0
mov r12,rdx
mul QWORD PTR[40+rsi]
add r10,r12
adc rdx,0
xor r12,r12
add r10,rax
mov rax,r13
adc r11,rdx
adc r12,0
mul QWORD PTR[rcx]
add rbp,rax
mov rax,r13
adc rbp,rdx
mul QWORD PTR[8+rcx]
add r14,rax
mov rax,r13
adc rdx,0
add r14,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[16+rcx]
add r15,rax
mov rax,r13
adc rdx,0
add r15,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[24+rcx]
add r8,rbp
adc rdx,0
add r8,rax
mov rax,r13
adc rdx,0
mov rbp,rdx
mul QWORD PTR[32+rcx]
add r9,rax
mov rax,r13
adc rdx,0
add r9,rbp
adc rdx,0
mov rbp,rdx
mul QWORD PTR[40+rcx]
add r10,rax
mov rax,r14
adc rdx,0
add r10,rbp
adc r11,rdx
adc r12,0
mov rdi,QWORD PTR[16+rsp]
sub r14,QWORD PTR[rcx]
mov rdx,r15
sbb r15,QWORD PTR[8+rcx]
mov rbx,r8
sbb r8,QWORD PTR[16+rcx]
mov rsi,r9
sbb r9,QWORD PTR[24+rcx]
mov rbp,r10
sbb r10,QWORD PTR[32+rcx]
mov r13,r11
sbb r11,QWORD PTR[40+rcx]
sbb r12,0
cmovc r14,rax
cmovc r15,rdx
cmovc r8,rbx
mov QWORD PTR[rdi],r14
cmovc r9,rsi
mov QWORD PTR[8+rdi],r15
cmovc r10,rbp
mov QWORD PTR[16+rdi],r8
cmovc r11,r13
mov QWORD PTR[24+rdi],r9
mov QWORD PTR[32+rdi],r10
mov QWORD PTR[40+rdi],r11
DB 0F3h,0C3h ;repret
__mulq_mont_384 ENDP
PUBLIC sqr_n_mul_mont_384
ALIGN 32
sqr_n_mul_mont_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sqr_n_mul_mont_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
mov r8,QWORD PTR[40+rsp]
mov r9,QWORD PTR[48+rsp]
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8*17
$L$SEH_body_sqr_n_mul_mont_384::
mov QWORD PTR[rsp],r8
mov QWORD PTR[8+rsp],rdi
mov QWORD PTR[16+rsp],rcx
lea rdi,QWORD PTR[32+rsp]
mov QWORD PTR[24+rsp],r9
movq xmm2,QWORD PTR[r9]
$L$oop_sqr_384::
movd xmm1,edx
call __sqrq_384
lea rsi,QWORD PTR[rdi]
mov rcx,QWORD PTR[rsp]
mov rbx,QWORD PTR[16+rsp]
call __mulq_by_1_mont_384
call __redc_tail_mont_384
movd edx,xmm1
lea rsi,QWORD PTR[rdi]
dec edx
jnz $L$oop_sqr_384
DB 102,72,15,126,208
mov rcx,rbx
mov rbx,QWORD PTR[24+rsp]
mov r12,r8
mov r13,r9
call __mulq_mont_384
lea r8,QWORD PTR[136+rsp]
mov r15,QWORD PTR[136+rsp]
mov r14,QWORD PTR[8+r8]
mov r13,QWORD PTR[16+r8]
mov r12,QWORD PTR[24+r8]
mov rbx,QWORD PTR[32+r8]
mov rbp,QWORD PTR[40+r8]
lea rsp,QWORD PTR[48+r8]
$L$SEH_epilogue_sqr_n_mul_mont_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sqr_n_mul_mont_384::
sqr_n_mul_mont_384 ENDP
PUBLIC sqr_n_mul_mont_383
ALIGN 32
sqr_n_mul_mont_383 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sqr_n_mul_mont_383::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
mov r8,QWORD PTR[40+rsp]
mov r9,QWORD PTR[48+rsp]
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8*17
$L$SEH_body_sqr_n_mul_mont_383::
mov QWORD PTR[rsp],r8
mov QWORD PTR[8+rsp],rdi
mov QWORD PTR[16+rsp],rcx
lea rdi,QWORD PTR[32+rsp]
mov QWORD PTR[24+rsp],r9
movq xmm2,QWORD PTR[r9]
$L$oop_sqr_383::
movd xmm1,edx
call __sqrq_384
lea rsi,QWORD PTR[rdi]
mov rcx,QWORD PTR[rsp]
mov rbx,QWORD PTR[16+rsp]
call __mulq_by_1_mont_384
movd edx,xmm1
add r14,QWORD PTR[48+rsi]
adc r15,QWORD PTR[56+rsi]
adc r8,QWORD PTR[64+rsi]
adc r9,QWORD PTR[72+rsi]
adc r10,QWORD PTR[80+rsi]
adc r11,QWORD PTR[88+rsi]
lea rsi,QWORD PTR[rdi]
mov QWORD PTR[rdi],r14
mov QWORD PTR[8+rdi],r15
mov QWORD PTR[16+rdi],r8
mov QWORD PTR[24+rdi],r9
mov QWORD PTR[32+rdi],r10
mov QWORD PTR[40+rdi],r11
dec edx
jnz $L$oop_sqr_383
DB 102,72,15,126,208
mov rcx,rbx
mov rbx,QWORD PTR[24+rsp]
mov r12,r8
mov r13,r9
call __mulq_mont_384
lea r8,QWORD PTR[136+rsp]
mov r15,QWORD PTR[136+rsp]
mov r14,QWORD PTR[8+r8]
mov r13,QWORD PTR[16+r8]
mov r12,QWORD PTR[24+r8]
mov rbx,QWORD PTR[32+r8]
mov rbp,QWORD PTR[40+r8]
lea rsp,QWORD PTR[48+r8]
$L$SEH_epilogue_sqr_n_mul_mont_383::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sqr_n_mul_mont_383::
sqr_n_mul_mont_383 ENDP
ALIGN 32
__mulq_mont_383_nonred PROC PRIVATE
DB 243,15,30,250
mov rbp,rax
mul r14
mov r8,rax
mov rax,rbp
mov r9,rdx
mul r15
add r9,rax
mov rax,rbp
adc rdx,0
mov r10,rdx
mul r12
add r10,rax
mov rax,rbp
adc rdx,0
mov r11,rdx
mov r15,r8
imul r8,QWORD PTR[8+rsp]
mul r13
add r11,rax
mov rax,rbp
adc rdx,0
mov r12,rdx
mul QWORD PTR[32+rsi]
add r12,rax
mov rax,rbp
adc rdx,0
mov r13,rdx
mul QWORD PTR[40+rsi]
add r13,rax
mov rax,r8
adc rdx,0
mov r14,rdx
mul QWORD PTR[rcx]
add r15,rax
mov rax,r8
adc r15,rdx
mul QWORD PTR[8+rcx]
add r9,rax
mov rax,r8
adc rdx,0
add r9,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[16+rcx]
add r10,rax
mov rax,r8
adc rdx,0
add r10,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[24+rcx]
add r11,r15
adc rdx,0
add r11,rax
mov rax,r8
adc rdx,0
mov r15,rdx
mul QWORD PTR[32+rcx]
add r12,rax
mov rax,r8
adc rdx,0
add r12,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[40+rcx]
add r13,rax
mov rax,QWORD PTR[8+rbx]
adc rdx,0
add r13,r15
adc r14,rdx
mov rbp,rax
mul QWORD PTR[rsi]
add r9,rax
mov rax,rbp
adc rdx,0
mov r15,rdx
mul QWORD PTR[8+rsi]
add r10,rax
mov rax,rbp
adc rdx,0
add r10,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[16+rsi]
add r11,rax
mov rax,rbp
adc rdx,0
add r11,r15
adc rdx,0
mov r15,rdx
mov r8,r9
imul r9,QWORD PTR[8+rsp]
mul QWORD PTR[24+rsi]
add r12,rax
mov rax,rbp
adc rdx,0
add r12,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[32+rsi]
add r13,rax
mov rax,rbp
adc rdx,0
add r13,r15
adc rdx,0
mov r15,rdx
mul QWORD PTR[40+rsi]
add r14,r15
adc rdx,0
add r14,rax
mov rax,r9
adc rdx,0
mov r15,rdx
mul QWORD PTR[rcx]
add r8,rax
mov rax,r9
adc r8,rdx
mul QWORD PTR[8+rcx]
add r10,rax
mov rax,r9
adc rdx,0
add r10,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[16+rcx]
add r11,rax
mov rax,r9
adc rdx,0
add r11,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[24+rcx]
add r12,r8
adc rdx,0
add r12,rax
mov rax,r9
adc rdx,0
mov r8,rdx
mul QWORD PTR[32+rcx]
add r13,rax
mov rax,r9
adc rdx,0
add r13,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[40+rcx]
add r14,rax
mov rax,QWORD PTR[16+rbx]
adc rdx,0
add r14,r8
adc r15,rdx
mov rbp,rax
mul QWORD PTR[rsi]
add r10,rax
mov rax,rbp
adc rdx,0
mov r8,rdx
mul QWORD PTR[8+rsi]
add r11,rax
mov rax,rbp
adc rdx,0
add r11,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[16+rsi]
add r12,rax
mov rax,rbp
adc rdx,0
add r12,r8
adc rdx,0
mov r8,rdx
mov r9,r10
imul r10,QWORD PTR[8+rsp]
mul QWORD PTR[24+rsi]
add r13,rax
mov rax,rbp
adc rdx,0
add r13,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[32+rsi]
add r14,rax
mov rax,rbp
adc rdx,0
add r14,r8
adc rdx,0
mov r8,rdx
mul QWORD PTR[40+rsi]
add r15,r8
adc rdx,0
add r15,rax
mov rax,r10
adc rdx,0
mov r8,rdx
mul QWORD PTR[rcx]
add r9,rax
mov rax,r10
adc r9,rdx
mul QWORD PTR[8+rcx]
add r11,rax
mov rax,r10
adc rdx,0
add r11,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[16+rcx]
add r12,rax
mov rax,r10
adc rdx,0
add r12,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[24+rcx]
add r13,r9
adc rdx,0
add r13,rax
mov rax,r10
adc rdx,0
mov r9,rdx
mul QWORD PTR[32+rcx]
add r14,rax
mov rax,r10
adc rdx,0
add r14,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[40+rcx]
add r15,rax
mov rax,QWORD PTR[24+rbx]
adc rdx,0
add r15,r9
adc r8,rdx
mov rbp,rax
mul QWORD PTR[rsi]
add r11,rax
mov rax,rbp
adc rdx,0
mov r9,rdx
mul QWORD PTR[8+rsi]
add r12,rax
mov rax,rbp
adc rdx,0
add r12,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[16+rsi]
add r13,rax
mov rax,rbp
adc rdx,0
add r13,r9
adc rdx,0
mov r9,rdx
mov r10,r11
imul r11,QWORD PTR[8+rsp]
mul QWORD PTR[24+rsi]
add r14,rax
mov rax,rbp
adc rdx,0
add r14,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[32+rsi]
add r15,rax
mov rax,rbp
adc rdx,0
add r15,r9
adc rdx,0
mov r9,rdx
mul QWORD PTR[40+rsi]
add r8,r9
adc rdx,0
add r8,rax
mov rax,r11
adc rdx,0
mov r9,rdx
mul QWORD PTR[rcx]
add r10,rax
mov rax,r11
adc r10,rdx
mul QWORD PTR[8+rcx]
add r12,rax
mov rax,r11
adc rdx,0
add r12,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[16+rcx]
add r13,rax
mov rax,r11
adc rdx,0
add r13,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[24+rcx]
add r14,r10
adc rdx,0
add r14,rax
mov rax,r11
adc rdx,0
mov r10,rdx
mul QWORD PTR[32+rcx]
add r15,rax
mov rax,r11
adc rdx,0
add r15,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[40+rcx]
add r8,rax
mov rax,QWORD PTR[32+rbx]
adc rdx,0
add r8,r10
adc r9,rdx
mov rbp,rax
mul QWORD PTR[rsi]
add r12,rax
mov rax,rbp
adc rdx,0
mov r10,rdx
mul QWORD PTR[8+rsi]
add r13,rax
mov rax,rbp
adc rdx,0
add r13,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[16+rsi]
add r14,rax
mov rax,rbp
adc rdx,0
add r14,r10
adc rdx,0
mov r10,rdx
mov r11,r12
imul r12,QWORD PTR[8+rsp]
mul QWORD PTR[24+rsi]
add r15,rax
mov rax,rbp
adc rdx,0
add r15,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[32+rsi]
add r8,rax
mov rax,rbp
adc rdx,0
add r8,r10
adc rdx,0
mov r10,rdx
mul QWORD PTR[40+rsi]
add r9,r10
adc rdx,0
add r9,rax
mov rax,r12
adc rdx,0
mov r10,rdx
mul QWORD PTR[rcx]
add r11,rax
mov rax,r12
adc r11,rdx
mul QWORD PTR[8+rcx]
add r13,rax
mov rax,r12
adc rdx,0
add r13,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[16+rcx]
add r14,rax
mov rax,r12
adc rdx,0
add r14,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[24+rcx]
add r15,r11
adc rdx,0
add r15,rax
mov rax,r12
adc rdx,0
mov r11,rdx
mul QWORD PTR[32+rcx]
add r8,rax
mov rax,r12
adc rdx,0
add r8,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[40+rcx]
add r9,rax
mov rax,QWORD PTR[40+rbx]
adc rdx,0
add r9,r11
adc r10,rdx
mov rbp,rax
mul QWORD PTR[rsi]
add r13,rax
mov rax,rbp
adc rdx,0
mov r11,rdx
mul QWORD PTR[8+rsi]
add r14,rax
mov rax,rbp
adc rdx,0
add r14,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[16+rsi]
add r15,rax
mov rax,rbp
adc rdx,0
add r15,r11
adc rdx,0
mov r11,rdx
mov r12,r13
imul r13,QWORD PTR[8+rsp]
mul QWORD PTR[24+rsi]
add r8,rax
mov rax,rbp
adc rdx,0
add r8,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[32+rsi]
add r9,rax
mov rax,rbp
adc rdx,0
add r9,r11
adc rdx,0
mov r11,rdx
mul QWORD PTR[40+rsi]
add r10,r11
adc rdx,0
add r10,rax
mov rax,r13
adc rdx,0
mov r11,rdx
mul QWORD PTR[rcx]
add r12,rax
mov rax,r13
adc r12,rdx
mul QWORD PTR[8+rcx]
add r14,rax
mov rax,r13
adc rdx,0
add r14,r12
adc rdx,0
mov r12,rdx
mul QWORD PTR[16+rcx]
add r15,rax
mov rax,r13
adc rdx,0
add r15,r12
adc rdx,0
mov r12,rdx
mul QWORD PTR[24+rcx]
add r8,r12
adc rdx,0
add r8,rax
mov rax,r13
adc rdx,0
mov r12,rdx
mul QWORD PTR[32+rcx]
add r9,rax
mov rax,r13
adc rdx,0
add r9,r12
adc rdx,0
mov r12,rdx
mul QWORD PTR[40+rcx]
add r10,rax
mov rax,r14
adc rdx,0
add r10,r12
adc r11,rdx
DB 0F3h,0C3h ;repret
__mulq_mont_383_nonred ENDP
PUBLIC sqr_mont_382x
ALIGN 32
sqr_mont_382x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sqr_mont_382x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,136
$L$SEH_body_sqr_mont_382x::
mov QWORD PTR[rsp],rcx
mov rcx,rdx
mov QWORD PTR[16+rsp],rsi
mov QWORD PTR[24+rsp],rdi
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov r14,r8
add r8,QWORD PTR[48+rsi]
mov r15,r9
adc r9,QWORD PTR[56+rsi]
mov rax,r10
adc r10,QWORD PTR[64+rsi]
mov rdx,r11
adc r11,QWORD PTR[72+rsi]
mov rbx,r12
adc r12,QWORD PTR[80+rsi]
mov rbp,r13
adc r13,QWORD PTR[88+rsi]
sub r14,QWORD PTR[48+rsi]
sbb r15,QWORD PTR[56+rsi]
sbb rax,QWORD PTR[64+rsi]
sbb rdx,QWORD PTR[72+rsi]
sbb rbx,QWORD PTR[80+rsi]
sbb rbp,QWORD PTR[88+rsi]
sbb rdi,rdi
mov QWORD PTR[((32+0))+rsp],r8
mov QWORD PTR[((32+8))+rsp],r9
mov QWORD PTR[((32+16))+rsp],r10
mov QWORD PTR[((32+24))+rsp],r11
mov QWORD PTR[((32+32))+rsp],r12
mov QWORD PTR[((32+40))+rsp],r13
mov QWORD PTR[((32+48))+rsp],r14
mov QWORD PTR[((32+56))+rsp],r15
mov QWORD PTR[((32+64))+rsp],rax
mov QWORD PTR[((32+72))+rsp],rdx
mov QWORD PTR[((32+80))+rsp],rbx
mov QWORD PTR[((32+88))+rsp],rbp
mov QWORD PTR[((32+96))+rsp],rdi
lea rbx,QWORD PTR[48+rsi]
mov rax,QWORD PTR[48+rsi]
mov r14,QWORD PTR[rsi]
mov r15,QWORD PTR[8+rsi]
mov r12,QWORD PTR[16+rsi]
mov r13,QWORD PTR[24+rsi]
mov rdi,QWORD PTR[24+rsp]
call __mulq_mont_383_nonred
add r14,r14
adc r15,r15
adc r8,r8
adc r9,r9
adc r10,r10
adc r11,r11
mov QWORD PTR[48+rdi],r14
mov QWORD PTR[56+rdi],r15
mov QWORD PTR[64+rdi],r8
mov QWORD PTR[72+rdi],r9
mov QWORD PTR[80+rdi],r10
mov QWORD PTR[88+rdi],r11
lea rsi,QWORD PTR[32+rsp]
lea rbx,QWORD PTR[((32+48))+rsp]
mov rax,QWORD PTR[((32+48))+rsp]
mov r14,QWORD PTR[((32+0))+rsp]
mov r15,QWORD PTR[((32+8))+rsp]
mov r12,QWORD PTR[((32+16))+rsp]
mov r13,QWORD PTR[((32+24))+rsp]
call __mulq_mont_383_nonred
mov rsi,QWORD PTR[((32+96))+rsp]
mov r12,QWORD PTR[((32+0))+rsp]
mov r13,QWORD PTR[((32+8))+rsp]
and r12,rsi
mov rax,QWORD PTR[((32+16))+rsp]
and r13,rsi
mov rbx,QWORD PTR[((32+24))+rsp]
and rax,rsi
mov rbp,QWORD PTR[((32+32))+rsp]
and rbx,rsi
and rbp,rsi
and rsi,QWORD PTR[((32+40))+rsp]
sub r14,r12
mov r12,QWORD PTR[rcx]
sbb r15,r13
mov r13,QWORD PTR[8+rcx]
sbb r8,rax
mov rax,QWORD PTR[16+rcx]
sbb r9,rbx
mov rbx,QWORD PTR[24+rcx]
sbb r10,rbp
mov rbp,QWORD PTR[32+rcx]
sbb r11,rsi
sbb rsi,rsi
and r12,rsi
and r13,rsi
and rax,rsi
and rbx,rsi
and rbp,rsi
and rsi,QWORD PTR[40+rcx]
add r14,r12
adc r15,r13
adc r8,rax
adc r9,rbx
adc r10,rbp
adc r11,rsi
mov QWORD PTR[rdi],r14
mov QWORD PTR[8+rdi],r15
mov QWORD PTR[16+rdi],r8
mov QWORD PTR[24+rdi],r9
mov QWORD PTR[32+rdi],r10
mov QWORD PTR[40+rdi],r11
lea r8,QWORD PTR[136+rsp]
mov r15,QWORD PTR[r8]
mov r14,QWORD PTR[8+r8]
mov r13,QWORD PTR[16+r8]
mov r12,QWORD PTR[24+r8]
mov rbx,QWORD PTR[32+r8]
mov rbp,QWORD PTR[40+r8]
lea rsp,QWORD PTR[48+r8]
$L$SEH_epilogue_sqr_mont_382x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sqr_mont_382x::
sqr_mont_382x ENDP
.text$ ENDS
.pdata SEGMENT READONLY ALIGN(4)
ALIGN 4
DD imagerel $L$SEH_begin_mul_mont_384x
DD imagerel $L$SEH_body_mul_mont_384x
DD imagerel $L$SEH_info_mul_mont_384x_prologue
DD imagerel $L$SEH_body_mul_mont_384x
DD imagerel $L$SEH_epilogue_mul_mont_384x
DD imagerel $L$SEH_info_mul_mont_384x_body
DD imagerel $L$SEH_epilogue_mul_mont_384x
DD imagerel $L$SEH_end_mul_mont_384x
DD imagerel $L$SEH_info_mul_mont_384x_epilogue
DD imagerel $L$SEH_begin_sqr_mont_384x
DD imagerel $L$SEH_body_sqr_mont_384x
DD imagerel $L$SEH_info_sqr_mont_384x_prologue
DD imagerel $L$SEH_body_sqr_mont_384x
DD imagerel $L$SEH_epilogue_sqr_mont_384x
DD imagerel $L$SEH_info_sqr_mont_384x_body
DD imagerel $L$SEH_epilogue_sqr_mont_384x
DD imagerel $L$SEH_end_sqr_mont_384x
DD imagerel $L$SEH_info_sqr_mont_384x_epilogue
DD imagerel $L$SEH_begin_mul_382x
DD imagerel $L$SEH_body_mul_382x
DD imagerel $L$SEH_info_mul_382x_prologue
DD imagerel $L$SEH_body_mul_382x
DD imagerel $L$SEH_epilogue_mul_382x
DD imagerel $L$SEH_info_mul_382x_body
DD imagerel $L$SEH_epilogue_mul_382x
DD imagerel $L$SEH_end_mul_382x
DD imagerel $L$SEH_info_mul_382x_epilogue
DD imagerel $L$SEH_begin_sqr_382x
DD imagerel $L$SEH_body_sqr_382x
DD imagerel $L$SEH_info_sqr_382x_prologue
DD imagerel $L$SEH_body_sqr_382x
DD imagerel $L$SEH_epilogue_sqr_382x
DD imagerel $L$SEH_info_sqr_382x_body
DD imagerel $L$SEH_epilogue_sqr_382x
DD imagerel $L$SEH_end_sqr_382x
DD imagerel $L$SEH_info_sqr_382x_epilogue
DD imagerel $L$SEH_begin_mul_384
DD imagerel $L$SEH_body_mul_384
DD imagerel $L$SEH_info_mul_384_prologue
DD imagerel $L$SEH_body_mul_384
DD imagerel $L$SEH_epilogue_mul_384
DD imagerel $L$SEH_info_mul_384_body
DD imagerel $L$SEH_epilogue_mul_384
DD imagerel $L$SEH_end_mul_384
DD imagerel $L$SEH_info_mul_384_epilogue
DD imagerel $L$SEH_begin_sqr_384
DD imagerel $L$SEH_body_sqr_384
DD imagerel $L$SEH_info_sqr_384_prologue
DD imagerel $L$SEH_body_sqr_384
DD imagerel $L$SEH_epilogue_sqr_384
DD imagerel $L$SEH_info_sqr_384_body
DD imagerel $L$SEH_epilogue_sqr_384
DD imagerel $L$SEH_end_sqr_384
DD imagerel $L$SEH_info_sqr_384_epilogue
DD imagerel $L$SEH_begin_sqr_mont_384
DD imagerel $L$SEH_body_sqr_mont_384
DD imagerel $L$SEH_info_sqr_mont_384_prologue
DD imagerel $L$SEH_body_sqr_mont_384
DD imagerel $L$SEH_epilogue_sqr_mont_384
DD imagerel $L$SEH_info_sqr_mont_384_body
DD imagerel $L$SEH_epilogue_sqr_mont_384
DD imagerel $L$SEH_end_sqr_mont_384
DD imagerel $L$SEH_info_sqr_mont_384_epilogue
DD imagerel $L$SEH_begin_redc_mont_384
DD imagerel $L$SEH_body_redc_mont_384
DD imagerel $L$SEH_info_redc_mont_384_prologue
DD imagerel $L$SEH_body_redc_mont_384
DD imagerel $L$SEH_epilogue_redc_mont_384
DD imagerel $L$SEH_info_redc_mont_384_body
DD imagerel $L$SEH_epilogue_redc_mont_384
DD imagerel $L$SEH_end_redc_mont_384
DD imagerel $L$SEH_info_redc_mont_384_epilogue
DD imagerel $L$SEH_begin_from_mont_384
DD imagerel $L$SEH_body_from_mont_384
DD imagerel $L$SEH_info_from_mont_384_prologue
DD imagerel $L$SEH_body_from_mont_384
DD imagerel $L$SEH_epilogue_from_mont_384
DD imagerel $L$SEH_info_from_mont_384_body
DD imagerel $L$SEH_epilogue_from_mont_384
DD imagerel $L$SEH_end_from_mont_384
DD imagerel $L$SEH_info_from_mont_384_epilogue
DD imagerel $L$SEH_begin_sgn0_pty_mont_384
DD imagerel $L$SEH_body_sgn0_pty_mont_384
DD imagerel $L$SEH_info_sgn0_pty_mont_384_prologue
DD imagerel $L$SEH_body_sgn0_pty_mont_384
DD imagerel $L$SEH_epilogue_sgn0_pty_mont_384
DD imagerel $L$SEH_info_sgn0_pty_mont_384_body
DD imagerel $L$SEH_epilogue_sgn0_pty_mont_384
DD imagerel $L$SEH_end_sgn0_pty_mont_384
DD imagerel $L$SEH_info_sgn0_pty_mont_384_epilogue
DD imagerel $L$SEH_begin_sgn0_pty_mont_384x
DD imagerel $L$SEH_body_sgn0_pty_mont_384x
DD imagerel $L$SEH_info_sgn0_pty_mont_384x_prologue
DD imagerel $L$SEH_body_sgn0_pty_mont_384x
DD imagerel $L$SEH_epilogue_sgn0_pty_mont_384x
DD imagerel $L$SEH_info_sgn0_pty_mont_384x_body
DD imagerel $L$SEH_epilogue_sgn0_pty_mont_384x
DD imagerel $L$SEH_end_sgn0_pty_mont_384x
DD imagerel $L$SEH_info_sgn0_pty_mont_384x_epilogue
DD imagerel $L$SEH_begin_mul_mont_384
DD imagerel $L$SEH_body_mul_mont_384
DD imagerel $L$SEH_info_mul_mont_384_prologue
DD imagerel $L$SEH_body_mul_mont_384
DD imagerel $L$SEH_epilogue_mul_mont_384
DD imagerel $L$SEH_info_mul_mont_384_body
DD imagerel $L$SEH_epilogue_mul_mont_384
DD imagerel $L$SEH_end_mul_mont_384
DD imagerel $L$SEH_info_mul_mont_384_epilogue
DD imagerel $L$SEH_begin_sqr_n_mul_mont_384
DD imagerel $L$SEH_body_sqr_n_mul_mont_384
DD imagerel $L$SEH_info_sqr_n_mul_mont_384_prologue
DD imagerel $L$SEH_body_sqr_n_mul_mont_384
DD imagerel $L$SEH_epilogue_sqr_n_mul_mont_384
DD imagerel $L$SEH_info_sqr_n_mul_mont_384_body
DD imagerel $L$SEH_epilogue_sqr_n_mul_mont_384
DD imagerel $L$SEH_end_sqr_n_mul_mont_384
DD imagerel $L$SEH_info_sqr_n_mul_mont_384_epilogue
DD imagerel $L$SEH_begin_sqr_n_mul_mont_383
DD imagerel $L$SEH_body_sqr_n_mul_mont_383
DD imagerel $L$SEH_info_sqr_n_mul_mont_383_prologue
DD imagerel $L$SEH_body_sqr_n_mul_mont_383
DD imagerel $L$SEH_epilogue_sqr_n_mul_mont_383
DD imagerel $L$SEH_info_sqr_n_mul_mont_383_body
DD imagerel $L$SEH_epilogue_sqr_n_mul_mont_383
DD imagerel $L$SEH_end_sqr_n_mul_mont_383
DD imagerel $L$SEH_info_sqr_n_mul_mont_383_epilogue
DD imagerel $L$SEH_begin_sqr_mont_382x
DD imagerel $L$SEH_body_sqr_mont_382x
DD imagerel $L$SEH_info_sqr_mont_382x_prologue
DD imagerel $L$SEH_body_sqr_mont_382x
DD imagerel $L$SEH_epilogue_sqr_mont_382x
DD imagerel $L$SEH_info_sqr_mont_382x_body
DD imagerel $L$SEH_epilogue_sqr_mont_382x
DD imagerel $L$SEH_end_sqr_mont_382x
DD imagerel $L$SEH_info_sqr_mont_382x_epilogue
.pdata ENDS
.xdata SEGMENT READONLY ALIGN(8)
ALIGN 8
$L$SEH_info_mul_mont_384x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_mont_384x_body::
DB 1,0,18,0
DB 000h,0f4h,029h,000h
DB 000h,0e4h,02ah,000h
DB 000h,0d4h,02bh,000h
DB 000h,0c4h,02ch,000h
DB 000h,034h,02dh,000h
DB 000h,054h,02eh,000h
DB 000h,074h,030h,000h
DB 000h,064h,031h,000h
DB 000h,001h,02fh,000h
$L$SEH_info_mul_mont_384x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sqr_mont_384x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sqr_mont_384x_body::
DB 1,0,18,0
DB 000h,0f4h,011h,000h
DB 000h,0e4h,012h,000h
DB 000h,0d4h,013h,000h
DB 000h,0c4h,014h,000h
DB 000h,034h,015h,000h
DB 000h,054h,016h,000h
DB 000h,074h,018h,000h
DB 000h,064h,019h,000h
DB 000h,001h,017h,000h
$L$SEH_info_sqr_mont_384x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_382x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_382x_body::
DB 1,0,18,0
DB 000h,0f4h,011h,000h
DB 000h,0e4h,012h,000h
DB 000h,0d4h,013h,000h
DB 000h,0c4h,014h,000h
DB 000h,034h,015h,000h
DB 000h,054h,016h,000h
DB 000h,074h,018h,000h
DB 000h,064h,019h,000h
DB 000h,001h,017h,000h
$L$SEH_info_mul_382x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sqr_382x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sqr_382x_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_sqr_382x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_384_body::
DB 1,0,11,0
DB 000h,0c4h,000h,000h
DB 000h,034h,001h,000h
DB 000h,054h,002h,000h
DB 000h,074h,004h,000h
DB 000h,064h,005h,000h
DB 000h,022h
DB 000h,000h,000h,000h,000h,000h
$L$SEH_info_mul_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sqr_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sqr_384_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_sqr_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sqr_mont_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sqr_mont_384_body::
DB 1,0,18,0
DB 000h,0f4h,00fh,000h
DB 000h,0e4h,010h,000h
DB 000h,0d4h,011h,000h
DB 000h,0c4h,012h,000h
DB 000h,034h,013h,000h
DB 000h,054h,014h,000h
DB 000h,074h,016h,000h
DB 000h,064h,017h,000h
DB 000h,001h,015h,000h
$L$SEH_info_sqr_mont_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_redc_mont_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_redc_mont_384_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_redc_mont_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_from_mont_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_from_mont_384_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_from_mont_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sgn0_pty_mont_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sgn0_pty_mont_384_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_sgn0_pty_mont_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sgn0_pty_mont_384x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sgn0_pty_mont_384x_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_sgn0_pty_mont_384x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_mont_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_mont_384_body::
DB 1,0,17,0
DB 000h,0f4h,003h,000h
DB 000h,0e4h,004h,000h
DB 000h,0d4h,005h,000h
DB 000h,0c4h,006h,000h
DB 000h,034h,007h,000h
DB 000h,054h,008h,000h
DB 000h,074h,00ah,000h
DB 000h,064h,00bh,000h
DB 000h,082h
DB 000h,000h
$L$SEH_info_mul_mont_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sqr_n_mul_mont_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sqr_n_mul_mont_384_body::
DB 1,0,18,0
DB 000h,0f4h,011h,000h
DB 000h,0e4h,012h,000h
DB 000h,0d4h,013h,000h
DB 000h,0c4h,014h,000h
DB 000h,034h,015h,000h
DB 000h,054h,016h,000h
DB 000h,074h,018h,000h
DB 000h,064h,019h,000h
DB 000h,001h,017h,000h
$L$SEH_info_sqr_n_mul_mont_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sqr_n_mul_mont_383_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sqr_n_mul_mont_383_body::
DB 1,0,18,0
DB 000h,0f4h,011h,000h
DB 000h,0e4h,012h,000h
DB 000h,0d4h,013h,000h
DB 000h,0c4h,014h,000h
DB 000h,034h,015h,000h
DB 000h,054h,016h,000h
DB 000h,074h,018h,000h
DB 000h,064h,019h,000h
DB 000h,001h,017h,000h
$L$SEH_info_sqr_n_mul_mont_383_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sqr_mont_382x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sqr_mont_382x_body::
DB 1,0,18,0
DB 000h,0f4h,011h,000h
DB 000h,0e4h,012h,000h
DB 000h,0d4h,013h,000h
DB 000h,0c4h,014h,000h
DB 000h,034h,015h,000h
DB 000h,054h,016h,000h
DB 000h,074h,018h,000h
DB 000h,064h,019h,000h
DB 000h,001h,017h,000h
$L$SEH_info_sqr_mont_382x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
.xdata ENDS
END
|
_incObj/88 Ending Sequence Emeralds.asm | kodishmediacenter/msu-md-sonic | 9 | 4111 | ; ---------------------------------------------------------------------------
; Object 88 - chaos emeralds on the ending sequence
; ---------------------------------------------------------------------------
EndChaos:
moveq #0,d0
move.b obRoutine(a0),d0
move.w ECha_Index(pc,d0.w),d1
jsr ECha_Index(pc,d1.w)
jmp (DisplaySprite).l
; ===========================================================================
ECha_Index: dc.w ECha_Main-ECha_Index
dc.w ECha_Move-ECha_Index
echa_origX: equ $38 ; x-axis centre of emerald circle (2 bytes)
echa_origY: equ $3A ; y-axis centre of emerald circle (2 bytes)
echa_radius: equ $3C ; radius (2 bytes)
echa_angle: equ $3E ; angle for rotation (2 bytes)
; ===========================================================================
ECha_Main: ; Routine 0
cmpi.b #2,(v_player+obFrame).w ; this isn't `fr_Wait1`: `v_player` is Object 88, which has its own frames
beq.s ECha_CreateEms
addq.l #4,sp
rts
; ===========================================================================
ECha_CreateEms:
move.w (v_player+obX).w,obX(a0) ; match X position with Sonic
move.w (v_player+obY).w,obY(a0) ; match Y position with Sonic
movea.l a0,a1
moveq #0,d3
moveq #1,d2
moveq #5,d1
ECha_LoadLoop:
move.b #id_EndChaos,(a1) ; load chaos emerald object
addq.b #2,obRoutine(a1)
move.l #Map_ECha,obMap(a1)
move.w #$3C5,obGfx(a1)
move.b #4,obRender(a1)
move.b #1,obPriority(a1)
move.w obX(a0),echa_origX(a1)
move.w obY(a0),echa_origY(a1)
move.b d2,obAnim(a1)
move.b d2,obFrame(a1)
addq.b #1,d2
move.b d3,obAngle(a1)
addi.b #$100/6,d3 ; angle between each emerald
lea $40(a1),a1
dbf d1,ECha_LoadLoop ; repeat 5 more times
ECha_Move: ; Routine 2
move.w echa_angle(a0),d0
add.w d0,obAngle(a0)
move.b obAngle(a0),d0
jsr (CalcSine).l
moveq #0,d4
move.b echa_radius(a0),d4
muls.w d4,d1
asr.l #8,d1
muls.w d4,d0
asr.l #8,d0
add.w echa_origX(a0),d1
add.w echa_origY(a0),d0
move.w d1,obX(a0)
move.w d0,obY(a0)
ECha_Expand:
cmpi.w #$2000,echa_radius(a0)
beq.s ECha_Rotate
addi.w #$20,echa_radius(a0) ; expand circle of emeralds
ECha_Rotate:
cmpi.w #$2000,echa_angle(a0)
beq.s ECha_Rise
addi.w #$20,echa_angle(a0) ; move emeralds around the centre
ECha_Rise:
cmpi.w #$140,echa_origY(a0)
beq.s ECha_End
subq.w #1,echa_origY(a0) ; make circle rise
ECha_End:
rts
|
programs/oeis/070/A070377.asm | jmorken/loda | 1 | 28852 | ; A070377: a(n) = 5^n mod 27.
; 1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8,13,11,1,5,25,17,4,20,19,14,16,26,22,2,10,23,7,8
mov $1,1
mov $2,$0
lpb $2
mul $1,5
mod $1,27
sub $2,1
lpe
|
libsrc/_DEVELOPMENT/math/float/am9511/c/sccz80/cam32_sccz80_fmul10u.asm | dikdom/z88dk | 1 | 245512 |
SECTION code_fp_am9511
PUBLIC cam32_sccz80_fmul10u
EXTERN asm_sccz80_read1, asm_am9511_fmul10u_fastcall
.cam32_sccz80_fmul10u
call asm_sccz80_read1
jp asm_am9511_fmul10u_fastcall
|
asm/edges.asm | zig-for/ALttPDoorRandomizer | 0 | 174456 | HorzEdge:
cpy #$ff : beq +
jsr DetectWestEdge : bra ++
+ jsr DetectEastEdge
++ cmp #$ff : beq +
sta $00 : asl : !add $00 : tax
cpy #$ff : beq ++
jsr LoadWestData : bra .main
++ jsr LoadEastData
.main
jsr LoadEdgeRoomHorz
sec : rts
+ clc : rts
VertEdge:
cpy #$ff : beq +
jsr DetectNorthEdge : bra ++
+ jsr DetectSouthEdge
++ cmp #$ff : beq +
sta $00 : asl : !add $00 : tax
cpy #$ff : beq ++
jsr LoadNorthData : bra .main
++ jsr LoadSouthData
.main
jsr LoadEdgeRoomVert
sec : rts
+ clc : rts
LoadEdgeRoomHorz:
lda $03 : sta $a0
sty $09
and.b #$0f : asl a : !sub $23 : !add $09 : sta $02
ldy #$00 : jsr ShiftVariablesMainDir
lda $a0 : and.b #$F0 : lsr #3 : sta $0603 : inc : sta $0607
lda $aa : asl : tax ; current quad as 0/4
lda $04 : and #$40 : bne +
lda $603 : sta $00 : stz $01 : bra ++
+ lda $607 : sta $00 : lda #$02 : sta $01
++ ; $01 now contains 0 or 2
lda $00 : sta $21 : sta $0601 : sta $0605
lda $01 : sta $aa : lsr : sta $01 : stz $00
lda $0a : sta $20
stz $0e
rep #$30
lda $e8 : and #$01ff : sta $02
lda $0a : and #$00ff : !add $00 : sta $00
cmp #$006c : !bge +
lda #$0077 : bra ++
+ cmp #$017c : !blt +
lda #$0187 : bra ++
+ !add #$000b
++ sta $0618 : inc #2 : sta $061a
lda $00 : cmp #$0078 : !bge +
lda #$0000 : bra ++
+ cmp #$0178 : !blt +
lda #$0100 : bra ++
+ !sub #$0078
++ sta $00
; figures out scroll amt
cmp $02 : bne +
lda #$0000 : bra .done
+ !blt +
!sub $02 : inc $0e : bra .done
+ lda $02 : !sub $00
.done sta $ab : sep #$30
lda $0e : asl : ora $ac : sta $ac
lda $0603, x : sta $e9
lda $04 : and #$80 : lsr #4 : sta $ee ; layer stuff
rts
LoadEdgeRoomVert:
lda $03 : sta $a0
sty $09
and.b #$f0 : lsr #3 : !sub $21 : !add $09 : sta $02
ldy #$01 : jsr ShiftVariablesMainDir
lda $a0 : and.b #$0f : asl : sta $060b : inc : sta $060f
lda $a9 : asl #2 : tax ; current quad as 0/4
lda $04 : and #$20 : bne +
lda $60b : sta $00 : stz $01 : bra ++
+ lda $60f : sta $00 : lda #$01 : sta $01
++ ; $01 now contains 0 or 1
lda $00 : sta $23 : sta $0609 : sta $060d
lda $01 : sta $a9 : stz $00 ; setup for 16 bit ops
lda $0a : sta $22
stz $0e ; pos/neg indicator
rep #$30
lda $e2 : and #$01ff : sta $02
lda $0a : and #$00ff : !add $00 : sta $00
cmp #$0078 : !bge +
lda #$007f : bra ++
+ cmp #$0178 : !blt +
lda #$017f : bra ++
+ !add #$0007
++ sta $061c : inc #2 : sta $061e
lda $00 : cmp #$0078 : !bge +
lda #$0000 : bra ++
+ cmp #$0178 : !blt +
lda #$0100 : bra ++
+ !sub #$0078
++ sta $00
; figures out scroll amt
cmp $02 : bne +
lda #$0000 : bra .done
+ !blt +
!sub $02 : inc $0e : bra .done
+ lda $02 : !sub $00
.done sta $ab : sep #$30
lda $0e : asl : ora $ac : sta $ac
lda $060b, x : sta $e3
lda $04 : and #$10 : lsr #4 : sta $ee ; layer stuff
rts
LoadNorthData:
lda NorthEdgeInfo, x : sta $06 ; not needed I think
lda NorthOpenEdge, x : sta $03 : inx
lda NorthEdgeInfo, x : sta $07 ;probably needed for maths - unsure
lda NorthOpenEdge, x : sta $04 : inx
lda NorthEdgeInfo, x : sta $08 ; needed for maths
lda NorthOpenEdge, x : sta $05
lda $04 : and #$0f : sta $00 : asl : !add $00 : tax
lda SouthEdgeInfo, x : sta $0a : inx ; needed now, and for nrml transition
lda SouthEdgeInfo, x : sta $0b : inx ; probably not needed - unsure
lda SouthEdgeInfo, x : sta $0c ; needed for maths
rts
LoadSouthData:
lda SouthEdgeInfo, x : sta $06
lda SouthOpenEdge, x : sta $03 : inx
lda SouthEdgeInfo, x : sta $07
lda SouthOpenEdge, x : sta $04 : inx
lda SouthEdgeInfo, x : sta $08
lda SouthOpenEdge, x : sta $05
lda $04 : and #$0f : sta $00 : asl : !add $00 : tax
lda NorthEdgeInfo, x : sta $0a : inx
lda NorthEdgeInfo, x : sta $0b : inx
lda NorthEdgeInfo, x : sta $0c
rts
LoadWestData:
lda WestEdgeInfo, x : sta $06
lda WestOpenEdge, x : sta $03 : inx
lda WestEdgeInfo, x : sta $07
lda WestOpenEdge, x : sta $04 : inx
lda WestEdgeInfo, x : sta $08
lda WestOpenEdge, x : sta $05
lda $04 : and #$0f : sta $00 : asl : !add $00 : tax
lda EastEdgeInfo, x : sta $0a : inx
lda EastEdgeInfo, x : sta $0b : inx
lda EastEdgeInfo, x : sta $0c
rts
LoadEastData:
lda EastEdgeInfo, x : sta $06
lda EastOpenEdge, x : sta $03 : inx
lda EastEdgeInfo, x : sta $07
lda EastOpenEdge, x : sta $04 : inx
lda EastEdgeInfo, x : sta $08
lda EastOpenEdge, x : sta $05
lda $04 : and #$0f : sta $00 : asl : !add $00 : tax
lda WestEdgeInfo, x : sta $0a : inx
lda WestEdgeInfo, x : sta $0b : inx
lda WestEdgeInfo, x : sta $0c
rts
DetectNorthEdge:
ldx #$ff
lda $a2
cmp #$82 : bne +
lda $22 : cmp #$50 : bcs ++
ldx #$01 : bra .end
++ ldx #$00 : bra .end
+ cmp #$83 : bne +
ldx #$02 : bra .end
+ cmp #$84 : bne +
lda $a9 : beq ++
lda $22 : cmp #$78 : bcs +++
ldx #$04 : bra .end
+++ ldx #$05 : bra .end
++ lda $22 : cmp #$78 : bcs ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$85 : bne +
ldx #$06 : bra .end
+ cmp #$db : bne +
lda $a9 : beq ++
lda $22 : beq ++
ldx #$08 : bra .end
++ ldx #$07 : bra .end
+ cmp #$dc : bne .end
lda $a9 : bne ++
lda $22 : cmp #$b0 : bcs ++
ldx #$09 : bra .end
++ ldx #$0a
.end txa : rts
DetectSouthEdge:
ldx #$ff
lda $a2
cmp #$72 : bne +
lda $22 : cmp #$50 : bcs ++
ldx #$01 : bra .end
++ ldx #$00 : bra .end
+ cmp #$73 : bne +
ldx #$02 : bra .end
+ cmp #$74 : bne +
lda $a9 : beq ++
lda $22 : cmp #$78 : bcs +++
ldx #$04 : bra .end
+++ ldx #$05 : bra .end
++ lda $22 : cmp #$78 : bcs ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$75 : bne +
ldx #$06 : bra .end
+ cmp #$cb : bne +
lda $a9 : beq ++
lda $22 : beq ++
ldx #$08 : bra .end
++ ldx #$07 : bra .end
+ cmp #$cc : bne .end
lda $a9 : bne ++
lda $22 : cmp #$b0 : bcs ++
ldx #$09 : bra .end
++ ldx #$0a
.end txa : rts
DetectWestEdge:
ldx #$ff
lda $a2
cmp #$65 : bne +
ldx #$00 : bra .end
+ cmp #$74 : bne +
ldx #$01 : bra .end
+ cmp #$75 : bne +
ldx #$02 : bra .end
+ cmp #$82 : bne +
lda $aa : beq ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$85 : bne +
ldx #$05 : bra .end
+ cmp #$cc : bne +
lda $aa : beq ++
ldx #$07 : bra .end
++ ldx #$06 : bra .end
+ cmp #$dc : bne .end
ldx #$08
.end txa : rts
DetectEastEdge:
ldx #$ff
lda $a2
cmp #$64 : bne +
ldx #$00 : bra .end
+ cmp #$73 : bne +
ldx #$01 : bra .end
+ cmp #$74 : bne +
ldx #$02 : bra .end
+ cmp #$81 : bne +
lda $aa : beq ++
ldx #$04 : bra .end
++ ldx #$03 : bra .end
+ cmp #$84 : bne +
ldx #$05 : bra .end
+ cmp #$cb : bne +
lda $aa : beq ++
ldx #$07 : bra .end
++ ldx #$06 : bra .end
+ cmp #$db : bne .end
ldx #$08
.end txa : rts
|
test/Succeed/Issue3175.agda | cruhland/agda | 1,989 | 8898 | open import Agda.Builtin.List
map : ∀ {a b} {A : Set a} {B : Set b} → (A → B) → List A → List B
map f [] = []
map f (x ∷ xs) = f x ∷ map f xs
foldr : ∀ {a b} {A : Set a} {B : Set b} → (A → B → B) → B → List A → B
foldr c n [] = n
foldr c n (x ∷ xs) = c x (foldr c n xs)
data Rose (A : Set) : Set where
leaf : (a : A) → Rose A
node : (rs : List (Rose A)) → Rose A
record IsSeq (A S : Set) : Set where
field
nil : S
sg : (a : A) → S
_∙_ : (s t : S) → S
concat : (ss : List S) → S
concat = foldr _∙_ nil
open IsSeq {{...}}
{-# TERMINATING #-}
flatten : ∀{A S} {{_ : IsSeq A S}} → Rose A → S
flatten (leaf a) = sg a
flatten (node rs) = concat (map flatten rs)
|
sound/sfxasm/A1.asm | NatsumiFox/Sonic-3-93-Nov-03 | 7 | 172872 | A1_Header:
sHeaderInit ; Z80 offset is $D337
sHeaderPatch A1_Patches
sHeaderTick $01
sHeaderCh $01
sHeaderSFX $80, $A0, A1_PSG2, $FB, $02
A1_PSG2:
dc.b nD4, $05
sStop
A1_Patches:
|
cppcrypto/3rdparty/serpent-waite.asm | crashdemons/kerukuro-cppcrypto | 0 | 94457 | <filename>cppcrypto/3rdparty/serpent-waite.asm
;
;Copyright (c) 2007 <NAME> <<EMAIL>>
;
;Permission to use, copy, modify, and distribute this software for any
;purpose with or without fee is hereby granted, provided that the above
;copyright notice and this permission notice appear in all copies.
;
;THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;The novel method of using sboxes used in this code is entirely not
;my idea. I borrowed the sboxes from <NAME>. I will put his
;paper in the documentation in the not too distant future.
; Modified by kerukuro for use in cppcrypto.
%macro xorKey 4
xor %1, [ebp]
xor %2, [ebp+4]
xor %3, [ebp+8]
xor %4, [ebp+12]
add ebp, 16
%endmacro
%macro xorKeyInverse 4
xor %1, [ebp]
xor %2, [ebp+4]
xor %3, [ebp+8]
xor %4, [ebp+12]
sub ebp, 16
%endmacro
%macro sbox0 5
mov %5, %4
or %4, %1
xor %1, %5
xor %5, %3
not %5
xor %4, %2
and %2, %1
xor %2, %5
xor %3, %1
xor %1, %4
or %5, %1
xor %1, %3
and %3, %2
xor %4, %3
not %2
xor %3, %5
xor %2, %3
%endmacro
%macro sbox0Inverse 5
mov %5, %4
xor %2, %1
or %4, %2
xor %5, %2
not %1
xor %3, %4
xor %4, %1
and %1, %2
xor %1, %3
and %3, %4
xor %4, %5
xor %3, %4
xor %2, %4
and %4, %1
xor %2, %1
xor %1, %3
xor %5, %4
%endmacro
%macro sbox1 5
mov %5, %2
xor %2, %1
xor %1, %4
not %4
and %5, %2
or %1, %2
xor %4, %3
xor %1, %4
xor %2, %4
xor %4, %5
or %2, %5
xor %5, %3
and %3, %1
xor %3, %2
or %2, %1
not %1
xor %1, %3
xor %5, %2
%endmacro
%macro sbox1Inverse 5
xor %2, %4
mov %5, %1
xor %1, %3
not %3
or %5, %2
xor %5, %4
and %4, %2
xor %2, %3
and %3, %5
xor %5, %2
or %2, %4
xor %4, %1
xor %3, %1
or %1, %5
xor %3, %5
xor %2, %1
xor %5, %2
%endmacro
%macro sbox2 5
not %4
xor %2, %1
mov %5, %1
and %1, %3
xor %1, %4
or %4, %5
xor %3, %2
xor %4, %2
and %2, %1
xor %1, %3
and %3, %4
or %4, %2
not %1
xor %4, %1
xor %5, %1
xor %1, %3
or %2, %3
%endmacro
%macro sbox2Inverse 5
xor %3, %2
mov %5, %4
not %4
or %4, %3
xor %3, %5
xor %5, %1
xor %4, %2
or %2, %3
xor %3, %1
xor %2, %5
or %5, %4
xor %3, %4
xor %5, %3
and %3, %2
xor %3, %4
xor %4, %5
xor %5, %1
%endmacro
%macro sbox3 5
mov %5, %2
xor %2, %4
or %4, %1
and %5, %1
xor %1, %3
xor %3, %2
and %2, %4
xor %3, %4
or %1, %5
xor %5, %4
xor %2, %1
and %1, %4
and %4, %5
xor %4, %3
or %5, %2
and %3, %2
xor %5, %4
xor %1, %4
xor %4, %3
%endmacro
%macro sbox3Inverse 5
xor %3, %2
mov %5, %2
and %2, %3
xor %2, %1
or %1, %5
xor %5, %4
xor %1, %4
or %4, %2
xor %2, %3
xor %2, %4
xor %1, %3
xor %3, %4
and %4, %2
xor %2, %1
and %1, %3
xor %5, %4
xor %4, %1
xor %1, %2
%endmacro
%macro sbox4 5
mov %5, %4
and %4, %1
xor %1, %5
xor %4, %3
or %3, %5
xor %1, %2
xor %5, %4
or %3, %1
xor %3, %2
and %2, %1
xor %2, %5
and %5, %3
xor %3, %4
xor %5, %1
or %4, %2
not %2
xor %4, %1
%endmacro
%macro sbox4Inverse 5
xor %3, %4
mov %5, %1
and %1, %2
xor %1, %3
or %3, %4
not %5
xor %2, %1
xor %1, %3
and %3, %5
xor %3, %1
or %1, %5
xor %1, %4
and %4, %3
xor %5, %4
xor %4, %2
and %2, %1
xor %5, %2
xor %1, %4
%endmacro
%macro sbox5 5
mov %5, %2
or %2, %1
xor %3, %2
not %4
xor %5, %1
xor %1, %3
and %2, %5
or %5, %4
xor %5, %1
and %1, %4
xor %2, %4
xor %4, %3
xor %1, %2
and %3, %5
xor %2, %3
and %3, %1
xor %4, %3
%endmacro
%macro sbox5Inverse 5
mov %5, %2
or %2, %3
xor %3, %5
xor %2, %4
and %4, %5
xor %3, %4
or %4, %1
not %1
xor %4, %3
or %3, %1
xor %5, %2
xor %3, %5
and %5, %1
xor %1, %2
xor %2, %4
and %1, %3
xor %3, %4
xor %1, %3
xor %3, %5
xor %5, %4
%endmacro
%macro sbox6 5
mov %5, %2
xor %4, %1
xor %2, %3
xor %3, %1
and %1, %4
or %2, %4
not %5
xor %1, %2
xor %2, %3
xor %4, %5
xor %5, %1
and %3, %1
xor %5, %2
xor %3, %4
and %4, %2
xor %4, %1
xor %2, %3
%endmacro
%macro sbox6Inverse 5
xor %1, %3
mov %5, %1
and %1, %4
xor %3, %4
xor %1, %3
xor %4, %2
or %3, %5
xor %3, %4
and %4, %1
not %1
xor %4, %2
and %2, %3
xor %5, %1
xor %4, %5
xor %5, %3
xor %1, %2
xor %3, %1
%endmacro
%macro sbox7 5
not %2
mov %5, %2
not %1
and %2, %3
xor %2, %4
or %4, %5
xor %5, %3
xor %3, %4
xor %4, %1
or %1, %2
and %3, %1
xor %1, %5
xor %5, %4
and %4, %1
xor %5, %2
xor %3, %5
xor %4, %2
or %5, %1
xor %5, %2
%endmacro
%macro sbox7Inverse 5
mov %5, %4
and %4, %1
xor %1, %3
or %3, %5
xor %5, %2
not %1
or %2, %4
xor %5, %1
and %1, %3
xor %1, %2
and %2, %3
xor %4, %3
xor %5, %4
and %3, %4
or %4, %1
xor %2, %5
xor %4, %5
and %5, %1
xor %5, %3
%endmacro
%macro linearTrans 5
rol %1, 13
rol %3, 3
xor %2, %1
xor %2, %3
mov %5, %1
sal %5, 3
xor %4, %5
xor %4, %3
rol %2, 1
rol %4, 7
xor %1, %2
xor %1, %4
mov %5, %2
sal %5, 7
xor %3, %5
xor %3, %4
rol %1, 5
rol %3, 22
%endmacro
%macro linearTransInverse 5
ror %3, 22
ror %1, 5
mov %5, %2
xor %3, %4
xor %1, %4
sal %5, 7
xor %1, %2
ror %2, 1
xor %3, %5
ror %4, 7
mov %5, %1
sal %5, 3
xor %2, %1
xor %4, %5
xor %2, %3
xor %4, %3
ror %3, 3
ror %1, 13
%endmacro
%macro firstKeyRound 0
mov eax, [esp]
mov ebx, [esp+12]
mov ecx, [esp+20]
mov edx, [esp+28]
xor eax, ebx
xor eax, ecx
xor eax, edx
xor eax, 0x9e3779b9
xor eax, 0
rol eax, 11
mov [esp], eax
mov edi, [esp+4]
mov esi, [esp+16]
mov ebp, [esp+24]
xor edi, esi
xor edi, ebp
xor edi, eax
xor edi, 0x9e3779b9
xor edi, 1
rol edi, 11
mov [esp+4], edi
mov ebx, [esp+8]
xor ebx, ecx
xor ebx, edx
xor ebx, edi
xor ebx, 0x9e3779b9
xor ebx, 2
rol ebx, 11
mov [esp+8], ebx
mov esi, [esp+12]
xor esi, ebp
xor esi, eax
xor esi, ebx
xor esi, 0x9e3779b9
xor esi, 3
rol esi, 11
mov [esp+12], esi
mov ecx, [esp+16]
xor ecx, edx
xor ecx, edi
xor ecx, esi
xor ecx, 0x9e3779b9
xor ecx, 4
rol ecx, 11
mov [esp+16], ecx
mov ebp, [esp+20]
xor ebp, eax
xor ebp, ebx
xor ebp, ecx
xor ebp, 0x9e3779b9
xor ebp, 5
rol ebp, 11
mov [esp+20], ebp
mov edx, [esp+24]
xor edx, edi
xor edx, esi
xor edx, ebp
xor edx, 0x9e3779b9
xor edx, 6
rol edx, 11
mov [esp+24], edx
mov eax, [esp+28]
xor eax, ebx
xor eax, ecx
xor eax, edx
xor eax, 0x9e3779b9
xor eax, 7
rol eax, 11
mov [esp+28], eax
mov edi, [esp]
%endmacro
%macro normalKeyRound 3
%assign rnd %1
%assign inky %2
%assign outky %3
xor edi, esi
xor edi, ebp
xor edi, eax
xor edi, 0x9e3779b9
xor edi, rnd
rol edi, 11
mov [esp+outky], edi
mov ebx, [esp+inky]
%assign rnd rnd+1
%assign inky inky+4
%assign outky outky+4
xor ebx, ecx
xor ebx, edx
xor ebx, edi
xor ebx, 0x9e3779b9
xor ebx, rnd
rol ebx, 11
mov [esp+outky], ebx
mov esi, [esp+inky]
%assign rnd rnd+1
%assign inky inky+4
%assign outky outky+4
xor esi, ebp
xor esi, eax
xor esi, ebx
xor esi, 0x9e3779b9
xor esi, rnd
rol esi, 11
mov [esp+outky], esi
mov ecx, [esp+inky]
%assign rnd rnd+1
%assign inky inky+4
%assign outky outky+4
xor ecx, edx
xor ecx, edi
xor ecx, esi
xor ecx, 0x9e3779b9
xor ecx, rnd
rol ecx, 11
mov [esp+outky], ecx
mov ebp, [esp+inky]
%assign rnd rnd+1
%assign inky inky+4
%assign outky outky+4
xor ebp, eax
xor ebp, ebx
xor ebp, ecx
xor ebp, 0x9e3779b9
xor ebp, rnd
rol ebp, 11
mov [esp+outky], ebp
mov edx, [esp+inky]
%assign rnd rnd+1
%assign inky inky+4
%assign outky outky+4
xor edx, edi
xor edx, esi
xor edx, ebp
xor edx, 0x9e3779b9
xor edx, rnd
rol edx, 11
mov [esp+outky], edx
mov eax, [esp+inky]
%assign rnd rnd+1
%assign inky inky+4
%assign outky outky+4
xor eax, ebx
xor eax, ecx
xor eax, edx
xor eax, 0x9e3779b9
xor eax, rnd
rol eax, 11
mov [esp+outky], eax
mov edi, [esp+inky]
%endmacro
%macro finalKeyRound 3
%assign rnd %1
%assign inky %2
%assign outky %3
xor edi, esi
xor edi, ebp
xor edi, eax
xor edi, 0x9e3779b9
xor edi, rnd
rol edi, 11
mov [esp+outky], edi
mov ebx, [esp+inky]
%assign rnd rnd+1
%assign inky inky+4
%assign outky outky+4
xor ebx, ecx
xor ebx, edx
xor ebx, edi
xor ebx, 0x9e3779b9
xor ebx, rnd
rol ebx, 11
mov [esp+outky], ebx
mov esi, [esp+inky]
%assign rnd rnd+1
%assign inky inky+4
%assign outky outky+4
xor esi, ebp
xor esi, eax
xor esi, ebx
xor esi, 0x9e3779b9
xor esi, rnd
rol esi, 11
mov [esp+outky], esi
mov ecx, [esp+inky]
%assign rnd rnd+1
%assign inky inky+4
%assign outky outky+4
xor ecx, edx
xor ecx, edi
xor ecx, esi
xor ecx, 0x9e3779b9
xor ecx, rnd
rol ecx, 11
mov [esp+outky], ecx
mov ebp, [esp+inky]
%assign rnd rnd+1
%assign inky inky+4
%assign outky outky+4
xor ebp, eax
xor ebp, ebx
xor ebp, ecx
xor ebp, 0x9e3779b9
xor ebp, rnd
rol ebp, 11
mov [esp+outky], ebp
mov edx, [esp+inky]
%endmacro
%macro sboxKeyRound 6
%assign w %1
%assign x w+4
%assign y w+8
%assign z w+12
mov eax, [esp+w]
mov ebx, [esp+x]
mov ecx, [esp+y]
mov edx, [esp+z]
%6 eax, ebx, ecx, edx, edi
mov [ebp+w], %2
mov [ebp+x], %3
mov [ebp+y], %4
mov [ebp+z], %5
%endmacro
section .text
global _serpentEncrypt
global _serpentDecrypt
global _serpentGenKeyAsm
global serpentEncrypt
global serpentDecrypt
global serpentGenKeyAsm
_serpentEncrypt:
serpentEncrypt:
push ebp ;save value of registers, we use them all
push ebx ;save register
push esi ;save register
push edi ;save register
mov esi, [esp+20] ;move pointer to plaintext (first arg of function) to ESI
mov eax, [esi+12] ;put first int in EAX
mov ebx, [esi+8] ;second int in EBX
mov ecx, [esi+4] ;third in ECX
mov edx, [esi] ;fourth in EDX
mov ebp, [esp+24] ;move pointer to key (second arg of function) to EBP
xorKey eax, ebx, ecx, edx
sbox0 eax, ebx, ecx, edx, edi
linearTrans ecx, ebx, edx, eax, edi
xorKey ecx, ebx, edx, eax
sbox1 ecx, ebx, edx, eax, edi
linearTrans edi, edx, eax, ecx, ebx
xorKey edi, edx, eax, ecx
sbox2 edi, edx, eax, ecx, ebx
linearTrans ebx, edx, edi, ecx, eax
xorKey ebx, edx, edi, ecx
sbox3 ebx, edx, edi, ecx, eax
linearTrans ecx, eax, edx, ebx, edi
xorKey ecx, eax, edx, ebx
sbox4 ecx, eax, edx, ebx, edi
linearTrans eax, edx, ebx, edi, ecx
xorKey eax, edx, ebx, edi
sbox5 eax, edx, ebx, edi, ecx
linearTrans ecx, eax, edx, edi, ebx
xorKey ecx, eax, edx, edi
sbox6 ecx, eax, edx, edi, ebx
linearTrans edx, ebx, eax, edi, ecx
xorKey edx, ebx, eax, edi
sbox7 edx, ebx, eax, edi, ecx
linearTrans ecx, eax, edi, edx, ebx
xorKey ecx, eax, edi, edx
sbox0 ecx, eax, edi, edx, ebx
linearTrans edi, eax, edx, ecx, ebx
xorKey edi, eax, edx, ecx
sbox1 edi, eax, edx, ecx, ebx
linearTrans ebx, edx, ecx, edi, eax
xorKey ebx, edx, ecx, edi
sbox2 ebx, edx, ecx, edi, eax
linearTrans eax, edx, ebx, edi, ecx
xorKey eax, edx, ebx, edi
sbox3 eax, edx, ebx, edi, ecx
linearTrans edi, ecx, edx, eax, ebx
xorKey edi, ecx, edx, eax
sbox4 edi, ecx, edx, eax, ebx
linearTrans ecx, edx, eax, ebx, edi
xorKey ecx, edx, eax, ebx
sbox5 ecx, edx, eax, ebx, edi
linearTrans edi, ecx, edx, ebx, eax
xorKey edi, ecx, edx, ebx
sbox6 edi, ecx, edx, ebx, eax
linearTrans edx, eax, ecx, ebx, edi
xorKey edx, eax, ecx, ebx
sbox7 edx, eax, ecx, ebx, edi
linearTrans edi, ecx, ebx, edx, eax
xorKey edi, ecx, ebx, edx
sbox0 edi, ecx, ebx, edx, eax
linearTrans ebx, ecx, edx, edi, eax
xorKey ebx, ecx, edx, edi
sbox1 ebx, ecx, edx, edi, eax
linearTrans eax, edx, edi, ebx, ecx
xorKey eax, edx, edi, ebx
sbox2 eax, edx, edi, ebx, ecx
linearTrans ecx, edx, eax, ebx, edi
xorKey ecx, edx, eax, ebx
sbox3 ecx, edx, eax, ebx, edi
linearTrans ebx, edi, edx, ecx, eax
xorKey ebx, edi, edx, ecx
sbox4 ebx, edi, edx, ecx, eax
linearTrans edi, edx, ecx, eax, ebx
xorKey edi, edx, ecx, eax
sbox5 edi, edx, ecx, eax, ebx
linearTrans ebx, edi, edx, eax, ecx
xorKey ebx, edi, edx, eax
sbox6 ebx, edi, edx, eax, ecx
linearTrans edx, ecx, edi, eax, ebx
xorKey edx, ecx, edi, eax
sbox7 edx, ecx, edi, eax, ebx
linearTrans ebx, edi, eax, edx, ecx
xorKey ebx, edi, eax, edx
sbox0 ebx, edi, eax, edx, ecx
linearTrans eax, edi, edx, ebx, ecx
xorKey eax, edi, edx, ebx
sbox1 eax, edi, edx, ebx, ecx
linearTrans ecx, edx, ebx, eax, edi
xorKey ecx, edx, ebx, eax
sbox2 ecx, edx, ebx, eax, edi
linearTrans edi, edx, ecx, eax, ebx
xorKey edi, edx, ecx, eax
sbox3 edi, edx, ecx, eax, ebx
linearTrans eax, ebx, edx, edi, ecx
xorKey eax, ebx, edx, edi
sbox4 eax, ebx, edx, edi, ecx
linearTrans ebx, edx, edi, ecx, eax
xorKey ebx, edx, edi, ecx
sbox5 ebx, edx, edi, ecx, eax
linearTrans eax, ebx, edx, ecx, edi
xorKey eax, ebx, edx, ecx
sbox6 eax, ebx, edx, ecx, edi
linearTrans edx, edi, ebx, ecx, eax
xorKey edx, edi, ebx, ecx
sbox7 edx, edi, ebx, ecx, eax
xorKey eax, ebx, ecx, edx
mov esi, [esp+20] ;save values of columns
mov [esi+12], eax
mov [esi+8], ebx
mov [esi+4], ecx
mov [esi], edx
pop edi ;restore registers to their values before the call
pop esi
pop ebx
pop ebp
ret
_serpentDecrypt:
serpentDecrypt:
push ebp ;save value of registers, we use them all
push ebx ;save register
push esi ;save register
push edi ;save register
mov esi, [esp+20] ;move pointer to data (first arg of function) to ESI
mov eax, [esi+12] ;put first int in EAX
mov ebx, [esi+8] ;second int in EBX
mov ecx, [esi+4] ;third in ECX
mov edx, [esi] ;fourth in EDX
mov ebp, [esp+24] ;move pointer to key (second arg of function) to EBP
add ebp, 512 ;move to end of key since we are decrypting
xorKeyInverse eax, ebx, ecx, edx
sbox7Inverse eax, ebx, ecx, edx, edi
xorKeyInverse ebx, edx, eax, edi
linearTransInverse ebx, edx, eax, edi, ecx
sbox6Inverse ebx, edx, eax, edi, ecx
xorKeyInverse eax, ecx, edi, ebx
linearTransInverse eax, ecx, edi, ebx, edx
sbox5Inverse eax, ecx, edi, ebx, edx
xorKeyInverse ecx, edx, eax, edi
linearTransInverse ecx, edx, eax, edi, ebx
sbox4Inverse ecx, edx, eax, edi, ebx
xorKeyInverse ecx, eax, ebx, edi
linearTransInverse ecx, eax, ebx, edi, edx
sbox3Inverse ecx, eax, ebx, edi, edx
xorKeyInverse ebx, ecx, edx, edi
linearTransInverse ebx, ecx, edx, edi, eax
sbox2Inverse ebx, ecx, edx, edi, eax
xorKeyInverse ecx, eax, edi, edx
linearTransInverse ecx, eax, edi, edx, ebx
sbox1Inverse ecx, eax, edi, edx, ebx
xorKeyInverse ebx, eax, edi, edx
linearTransInverse ebx, eax, edi, edx, ecx
sbox0Inverse ebx, eax, edi, edx, ecx
xorKeyInverse edi, ecx, eax, ebx
linearTransInverse edi, ecx, eax, ebx, edx
sbox7Inverse edi, ecx, eax, ebx, edx
xorKeyInverse ecx, ebx, edi, edx
linearTransInverse ecx, ebx, edi, edx, eax
sbox6Inverse ecx, ebx, edi, edx, eax
xorKeyInverse edi, eax, edx, ecx
linearTransInverse edi, eax, edx, ecx, ebx
sbox5Inverse edi, eax, edx, ecx, ebx
xorKeyInverse eax, ebx, edi, edx
linearTransInverse eax, ebx, edi, edx, ecx
sbox4Inverse eax, ebx, edi, edx, ecx
xorKeyInverse eax, edi, ecx, edx
linearTransInverse eax, edi, ecx, edx, ebx
sbox3Inverse eax, edi, ecx, edx, ebx
xorKeyInverse ecx, eax, ebx, edx
linearTransInverse ecx, eax, ebx, edx, edi
sbox2Inverse ecx, eax, ebx, edx, edi
xorKeyInverse eax, edi, edx, ebx
linearTransInverse eax, edi, edx, ebx, ecx
sbox1Inverse eax, edi, edx, ebx, ecx
xorKeyInverse ecx, edi, edx, ebx
linearTransInverse ecx, edi, edx, ebx, eax
sbox0Inverse ecx, edi, edx, ebx, eax
xorKeyInverse edx, eax, edi, ecx
linearTransInverse edx, eax, edi, ecx, ebx
sbox7Inverse edx, eax, edi, ecx, ebx
xorKeyInverse eax, ecx, edx, ebx
linearTransInverse eax, ecx, edx, ebx, edi
sbox6Inverse eax, ecx, edx, ebx, edi
xorKeyInverse edx, edi, ebx, eax
linearTransInverse edx, edi, ebx, eax, ecx
sbox5Inverse edx, edi, ebx, eax, ecx
xorKeyInverse edi, ecx, edx, ebx
linearTransInverse edi, ecx, edx, ebx, eax
sbox4Inverse edi, ecx, edx, ebx, eax
xorKeyInverse edi, edx, eax, ebx
linearTransInverse edi, edx, eax, ebx, ecx
sbox3Inverse edi, edx, eax, ebx, ecx
xorKeyInverse eax, edi, ecx, ebx
linearTransInverse eax, edi, ecx, ebx, edx
sbox2Inverse eax, edi, ecx, ebx, edx
xorKeyInverse edi, edx, ebx, ecx
linearTransInverse edi, edx, ebx, ecx, eax
sbox1Inverse edi, edx, ebx, ecx, eax
xorKeyInverse eax, edx, ebx, ecx
linearTransInverse eax, edx, ebx, ecx, edi
sbox0Inverse eax, edx, ebx, ecx, edi
xorKeyInverse ebx, edi, edx, eax
linearTransInverse ebx, edi, edx, eax, ecx
sbox7Inverse ebx, edi, edx, eax, ecx
xorKeyInverse edi, eax, ebx, ecx
linearTransInverse edi, eax, ebx, ecx, edx
sbox6Inverse edi, eax, ebx, ecx, edx
xorKeyInverse ebx, edx, ecx, edi
linearTransInverse ebx, edx, ecx, edi, eax
sbox5Inverse ebx, edx, ecx, edi, eax
xorKeyInverse edx, eax, ebx, ecx
linearTransInverse edx, eax, ebx, ecx, edi
sbox4Inverse edx, eax, ebx, ecx, edi
xorKeyInverse edx, ebx, edi, ecx
linearTransInverse edx, ebx, edi, ecx, eax
sbox3Inverse edx, ebx, edi, ecx, eax
xorKeyInverse edi, edx, eax, ecx
linearTransInverse edi, edx, eax, ecx, ebx
sbox2Inverse edi, edx, eax, ecx, ebx
xorKeyInverse edx, ebx, ecx, eax
linearTransInverse edx, ebx, ecx, eax, edi
sbox1Inverse edx, ebx, ecx, eax, edi
xorKeyInverse edi, ebx, ecx, eax
linearTransInverse edi, ebx, ecx, eax, edx
sbox0Inverse edi, ebx, ecx, eax, edx
xorKeyInverse ecx, edx, ebx, edi
mov esi, [esp+20] ;save values of columns
mov [esi+12], ecx
mov [esi+8], edx
mov [esi+4], ebx
mov [esi], edi
pop edi ;restore registers to their values before the call
pop esi
pop ebx
pop ebp
ret
_serpentGenKeyAsm:
serpentGenKeyAsm:
push ebp ;save value of registers, we use them all
push ebx ;save register
push esi ;save register
push edi ;save register
mov esi, [esp+20] ;pntr to input key
sub esp, 528 ;pntr to bottom of local stack
mov edi, [esi] ;load key into local stack, to free a register
mov [esp], edi
mov edi, [esi+4]
mov [esp+4], edi
mov edi, [esi+8]
mov [esp+8], edi
mov edi, [esi+12]
mov [esp+12], edi
mov edi, [esi+16]
mov [esp+16], edi
mov edi, [esi+20]
mov [esp+20], edi
mov edi, [esi+24]
mov [esp+24], edi
mov edi, [esi+28]
mov [esp+28], edi
firstKeyRound
normalKeyRound 8, 4, 32
normalKeyRound 15, 32, 60
normalKeyRound 22, 60, 88
normalKeyRound 29, 88, 116
normalKeyRound 36, 116, 144
normalKeyRound 43, 144, 172
normalKeyRound 50, 172, 200
normalKeyRound 57, 200, 228
normalKeyRound 64, 228, 256
normalKeyRound 71, 256, 284
normalKeyRound 78, 284, 312
normalKeyRound 85, 312, 340
normalKeyRound 92, 340, 368
normalKeyRound 99, 368, 396
normalKeyRound 106, 396, 424
normalKeyRound 113, 424, 452
normalKeyRound 120, 452, 480
finalKeyRound 127, 480, 508
mov ebp, [esp+552] ;mov pointer to output key into EBX
sboxKeyRound 0, edx, edi, ebx, eax, sbox3
sboxKeyRound 16, edi, ebx, eax, edx, sbox2
sboxKeyRound 32, edi, ecx, edx, eax, sbox1
sboxKeyRound 48, ecx, ebx, edx, eax, sbox0
sboxKeyRound 64, edi, ecx, edx, eax, sbox7
sboxKeyRound 80, ecx, edi, ebx, edx, sbox6
sboxKeyRound 96, edi, eax, ebx, edx, sbox5
sboxKeyRound 112, ebx, ecx, edx, edi, sbox4
sboxKeyRound 128, edx, edi, ebx, eax, sbox3
sboxKeyRound 144, edi, ebx, eax, edx, sbox2
sboxKeyRound 160, edi, ecx, edx, eax, sbox1
sboxKeyRound 176, ecx, ebx, edx, eax, sbox0
sboxKeyRound 192, edi, ecx, edx, eax, sbox7
sboxKeyRound 208, ecx, edi, ebx, edx, sbox6
sboxKeyRound 224, edi, eax, ebx, edx, sbox5
sboxKeyRound 240, ebx, ecx, edx, edi, sbox4
sboxKeyRound 256, edx, edi, ebx, eax, sbox3
sboxKeyRound 272, edi, ebx, eax, edx, sbox2
sboxKeyRound 288, edi, ecx, edx, eax, sbox1
sboxKeyRound 304, ecx, ebx, edx, eax, sbox0
sboxKeyRound 320, edi, ecx, edx, eax, sbox7
sboxKeyRound 336, ecx, edi, ebx, edx, sbox6
sboxKeyRound 352, edi, eax, ebx, edx, sbox5
sboxKeyRound 368, ebx, ecx, edx, edi, sbox4
sboxKeyRound 384, edx, edi, ebx, eax, sbox3
sboxKeyRound 400, edi, ebx, eax, edx, sbox2
sboxKeyRound 416, edi, ecx, edx, eax, sbox1
sboxKeyRound 432, ecx, ebx, edx, eax, sbox0
sboxKeyRound 448, edi, ecx, edx, eax, sbox7
sboxKeyRound 464, ecx, edi, ebx, edx, sbox6
sboxKeyRound 480, edi, eax, ebx, edx, sbox5
sboxKeyRound 496, ebx, ecx, edx, edi, sbox4
sboxKeyRound 512, edx, edi, ebx, eax, sbox3
add esp, 528 ;destroy local stack
pop edi ;restore registers to their values before the call
pop esi
pop ebx
pop ebp
ret
|
src/communication-util.agda | mudathirmahgoub/cedille | 328 | 8377 | <reponame>mudathirmahgoub/cedille
import cedille-options
module communication-util (options : cedille-options.options) where
open import general-util
open import toplevel-state options {IO}
logRopeh : filepath → rope → IO ⊤
logRopeh logFilePath r with cedille-options.options.generate-logs options
...| ff = return triv
...| tt = getCurrentTime >>= λ time →
withFile logFilePath AppendMode λ hdl →
hPutRope hdl ([[ "([" ^ utcToString time ^ "] " ]] ⊹⊹ r ⊹⊹ [[ ")\n" ]])
logRope : toplevel-state → rope → IO ⊤
logRope s = logRopeh (toplevel-state.logFilePath s)
logMsg : toplevel-state → (message : string) → IO ⊤
logMsg s msg = logRope s [[ msg ]]
logMsg' : filepath → (message : string) → IO ⊤
logMsg' logFilePath msg = logRopeh logFilePath [[ msg ]]
sendProgressUpdate : string → IO ⊤
sendProgressUpdate msg = putStr "progress: " >> putStr msg >> putStr "\n"
progressUpdate : (filename : string) → {-(do-check : 𝔹) → -} IO ⊤
progressUpdate filename {-do-check-} =
if cedille-options.options.show-progress-updates options then
sendProgressUpdate ((if {-do-check-} tt then "Checking " else "Skipping ") ^ filename)
else
return triv
|
tests+regs/testbit.asm | danielncc/MIPS-Game | 0 | 81101 | .macro wait(%tempo)
li $a0,%tempo
li $v0,32
syscall
.end_macro
.macro topo(%x)
li $t3,0
add $t1,$t1,4
loop1:
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 28
add $t3,$t3,1
bne $t3,7, loop1
nop
.end_macro
.macro subtopo(%x)
li $t3,0
loop1:
sw $t4, inicio($t1)
move $t4,%x
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
li $t4, 0x001A4471
sw $t4, inicio($t1)
add $t1, $t1, 20
add $t3,$t3,1
bne $t3,7, loop1
nop
.end_macro
.macro lado(%x)
li $t3,0
loop1:
sw $t4, inicio($t1)
#altern
move $t4,%x
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
li $t4, 0x001A4471
#add $t1, $t1, 24#mudar cor
sw $t4, inicio($t1)
add $t1, $t1, 12
add $t3,$t3,1
bne $t3,7, loop1
nop
.end_macro
.macro change1(%x)
move $t4,%x
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 244
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 240
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 240
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 244
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
add $t1, $t1, 4
sw $t4, inicio($t1)
nop
.end_macro
.macro adicionar(%linha,%coluna,%cor)
#2060+lin*2816 +col*36
#li $t8,%linha
#li $t9,%coluna
li $t8,%linha
li $t9,%coluna
li $t2,2816
li $t3,36
li $t1,524
mult $t9,$t3 #t8(linha)#t9coluna
mflo $t3
add $t1,$t1,$t3
mult $t8,$t2 #t8(linha)#t9coluna
mflo $t3
add $t1,$t1,$t3
change1(%cor)
.end_macro
.macro Termino
li $v0, 10
syscall
.end_macro
.macro fundo
li $t3,0
# li $t4, 0x00F7E2C2 #CEAD70 #73A9F1 #423C3E #FFFFFF #F7E2C2
loop:
add $t3,$t3,1
sw $t4, inicio($t1)
add $t1, $t1, 4
li $t4, 0x00431521
sw $t4, inicio($t1)
li $t4, 0x00CEADf9
add $t1, $t1, -4
add $t1, $t1, 256
#add $t4,$t4,4090 #linha#1312 #3161#quadriculado24121
bne $t3, 64, loop
nop
.end_macro
.data
a: .asciiz "<NAME>"
inicio:.space 16384
.text
main:
li $t3, 16384
li $t6,0
li $t4, 0x00CEADf9 #CEAD70 #73A9F1 #423C3E #FFFFFF #F7E2C2
loope: li $t1,0
add $t1,$t8,$t1
add $t8,$t8,4
li $t4, 0x00431521
fundo
li $t4, 0x00CEADf9
fundo
#add $t4,$t4,$t6 #linha#1312 #3161#quadriculado24121
add $t6,$t6,1
bne $t6,64,loope
nop
li $t4, 0x00CEADf9 #CEAD70 #73A9F1 #423C3E #FFFFFF #F7E2C2
fundo
circulo:
li $t4, 0x001A4471
li $t1,-764
li $t2,0
li $t5, 0x00B99A73 #000000(black)#ffffffwhite#A7ACC1(gray)#0001FE(otherblue)3080D7(blue) F00500red FFF001(grito)
loop1:
add $t1,$t1,1024
add $t1,$t1,4
topo($t5)
subtopo($t5)
lado($t5)
add $t1,$t1,4
lado($t5)
add $t1,$t1,4
lado($t5)
add $t1,$t1,8
subtopo($t5)
add $t1,$t1,4
topo($t5)
add $t1,$t1,-4
add $t2,$t2,1
add $t5,$t5,-10
#add $t4,$t4,15
bne $t2,6,loop1
nop
li $t5,0x003080d7#cor do jogador 3080D7(blue) F00500 (red) FFF001(grito)000000(black) ffffff (white)
adicionar(2,2,$t5)
Termino
|
corpus-for-codebuff/Fuzzy.g4 | studentmain/AntlrVSIX | 67 | 7588 | grammar Fuzzy;
options {
tokenVocab=JavaLR;
}
scan
: (pattern|.)* EOF
;
pattern
: a=Identifier '=' b=Identifier ';'
{System.out.printf("assign %s=%s", $a.text, $b.text);}
;
|
alloy4fun_models/trashltl/models/19/Wuk6WZDRN7BgR3bnF.als | Kaixi26/org.alloytools.alloy | 0 | 1097 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idWuk6WZDRN7BgR3bnF_prop20 {
always all t: Trash | t in Protected since t in Protected
}
pred __repair { idWuk6WZDRN7BgR3bnF_prop20 }
check __repair { idWuk6WZDRN7BgR3bnF_prop20 <=> prop20o } |
programs/oeis/037/A037225.asm | neoneye/loda | 22 | 3951 | ; A037225: a(n) = phi(2n+1).
; 1,2,4,6,6,10,12,8,16,18,12,22,20,18,28,30,20,24,36,24,40,42,24,46,42,32,52,40,36,58,60,36,48,66,44,70,72,40,60,78,54,82,64,56,88,72,60,72,96,60,100,102,48,106,108,72,112,88,72,96,110,80,100,126,84,130,108,72,136,138,92,120,112,84,148,150,96,120,156,104,132,162,80,166,156,108,172,120,116,178,180,120,144,160,108,190,192,96,196,198
mul $0,2
seq $0,10 ; Euler totient function phi(n): count numbers <= n and prime to n.
|
scriptClick.scpt | dunkelstern/ShinyDroplets | 1 | 3452 | <filename>scriptClick.scpt
tell application "Finder"
if selection is {} then
tell application "APP"
activate
end tell
else
set finderSelection to selection as alias list
tell application "APP"
open finderSelection
activate
end tell
end if
end tell
|
Binding_Sodium/sodium-thin_binding.ads | jrmarino/libsodium-ada | 10 | 2663 | <reponame>jrmarino/libsodium-ada
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with System;
with Interfaces.C.Strings;
package Sodium.Thin_Binding is
package IC renames Interfaces.C;
package ICS renames Interfaces.C.Strings;
------------------
-- Data Types --
------------------
type NaCl_uint64 is mod 2 ** 64;
type NaCl_uint32 is mod 2 ** 32;
type NaCl_uint8 is mod 2 ** 8;
type NaCl_block64 is array (Natural range <>) of NaCl_uint64;
type NaCl_block8 is array (Natural range <>) of NaCl_uint8;
pragma Pack (NaCl_block64);
pragma Pack (NaCl_block8);
type crypto_generichash_blake2b_state is record
h : NaCl_block64 (0 .. 7);
t : NaCl_block64 (0 .. 1);
f : NaCl_block64 (0 .. 1);
buf : NaCl_block8 (0 .. 255);
buflen : IC.size_t;
last_node : NaCl_uint8;
end record;
for crypto_generichash_blake2b_state'Alignment use 64;
pragma Pack (crypto_generichash_blake2b_state);
subtype crypto_generichash_state is crypto_generichash_blake2b_state;
type crypto_generichash_state_Access is access all crypto_generichash_state;
pragma Convention (C, crypto_generichash_state_Access);
type crypto_aead_aes256gcm_state is record
state : NaCl_block8 (0 .. 511);
end record;
for crypto_aead_aes256gcm_state'Alignment use 16;
type crypto_aead_aes256gcm_state_Access is access all crypto_aead_aes256gcm_state;
pragma Convention (C, crypto_aead_aes256gcm_state_Access);
type NaCl_uint64_Access is access all NaCl_uint64;
pragma Convention (C, NaCl_uint64_Access);
-----------------
-- Constants --
-----------------
crypto_generichash_blake2b_BYTES_MIN : constant NaCl_uint8 := 16;
crypto_generichash_blake2b_BYTES : constant NaCl_uint8 := 32;
crypto_generichash_blake2b_BYTES_MAX : constant NaCl_uint8 := 64;
crypto_generichash_blake2b_KEYBYTES_MIN : constant NaCl_uint8 := 16;
crypto_generichash_blake2b_KEYBYTES : constant NaCl_uint8 := 32;
crypto_generichash_blake2b_KEYBYTES_MAX : constant NaCl_uint8 := 64;
crypto_generichash_blake2b_SALTBYTES : constant NaCl_uint8 := 16;
crypto_generichash_blake2b_PERSONALBYTES : constant NaCl_uint8 := 16;
crypto_generichash_BYTES_MIN : NaCl_uint8 renames crypto_generichash_blake2b_BYTES_MIN;
crypto_generichash_BYTES : NaCl_uint8 renames crypto_generichash_blake2b_BYTES;
crypto_generichash_BYTES_MAX : NaCl_uint8 renames crypto_generichash_blake2b_BYTES_MAX;
crypto_generichash_KEYBYTES_MIN : NaCl_uint8 renames crypto_generichash_blake2b_KEYBYTES_MIN;
crypto_generichash_KEYBYTES : NaCl_uint8 renames crypto_generichash_blake2b_KEYBYTES;
crypto_generichash_KEYBYTES_MAX : NaCl_uint8 renames crypto_generichash_blake2b_KEYBYTES_MAX;
crypto_shorthash_siphash24_BYTES : constant NaCl_uint8 := 8;
crypto_shorthash_siphash24_KEYBYTES : constant NaCl_uint8 := 16;
crypto_shorthash_BYTES : NaCl_uint8 renames crypto_shorthash_siphash24_BYTES;
crypto_shorthash_KEYBYTES : NaCl_uint8 renames crypto_shorthash_siphash24_KEYBYTES;
crypto_pwhash_argon2i_ALG_ARGON2I13 : constant IC.int := 1;
crypto_pwhash_argon2i_SALTBYTES : constant NaCl_uint8 := 16;
crypto_pwhash_argon2i_STRBYTES : constant NaCl_uint8 := 128;
crypto_pwhash_argon2i_STRPREFIX : constant String := "$argon2i$";
crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE : constant NaCl_uint64 := 4;
crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE : constant IC.size_t := 33554432;
crypto_pwhash_argon2i_OPSLIMIT_MODERATE : constant NaCl_uint64 := 6;
crypto_pwhash_argon2i_MEMLIMIT_MODERATE : constant IC.size_t := 134217728;
crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE : constant NaCl_uint64 := 8;
crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE : constant IC.size_t := 536870912;
crypto_pwhash_ALG_DEFAULT : IC.int renames crypto_pwhash_argon2i_ALG_ARGON2I13;
crypto_pwhash_SALTBYTES : NaCl_uint8 renames crypto_pwhash_argon2i_SALTBYTES;
crypto_pwhash_STRBYTES : NaCl_uint8 renames crypto_pwhash_argon2i_STRBYTES;
crypto_pwhash_STRPREFIX : String renames crypto_pwhash_argon2i_STRPREFIX;
crypto_pwhash_OPSLIMIT_MODERATE : NaCl_uint64 renames crypto_pwhash_argon2i_OPSLIMIT_MODERATE;
crypto_pwhash_MEMLIMIT_MODERATE : IC.size_t renames crypto_pwhash_argon2i_MEMLIMIT_MODERATE;
crypto_pwhash_OPSLIMIT_SENSITIVE : NaCl_uint64 renames crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE;
crypto_pwhash_MEMLIMIT_SENSITIVE : IC.size_t renames crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE;
crypto_pwhash_OPSLIMIT_INTERACTIVE : NaCl_uint64
renames crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE;
crypto_pwhash_MEMLIMIT_INTERACTIVE : IC.size_t
renames crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE;
crypto_box_curve25519xsalsa20poly1305_SEEDBYTES : constant NaCl_uint8 := 32;
crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES : constant NaCl_uint8 := 32;
crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES : constant NaCl_uint8 := 32;
crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES : constant NaCl_uint8 := 32;
crypto_box_curve25519xsalsa20poly1305_NONCEBYTES : constant NaCl_uint8 := 24;
crypto_box_curve25519xsalsa20poly1305_MACBYTES : constant NaCl_uint8 := 16;
crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES : constant NaCl_uint8 := 16;
crypto_box_curve25519xsalsa20poly1305_ZEROBYTES : constant NaCl_uint8 :=
crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES +
crypto_box_curve25519xsalsa20poly1305_MACBYTES;
crypto_box_SEEDBYTES : NaCl_uint8 renames crypto_box_curve25519xsalsa20poly1305_SEEDBYTES;
crypto_box_NONCEBYTES : NaCl_uint8 renames crypto_box_curve25519xsalsa20poly1305_NONCEBYTES;
crypto_box_MACBYTES : NaCl_uint8 renames crypto_box_curve25519xsalsa20poly1305_MACBYTES;
crypto_box_ZEROBYTES : NaCl_uint8 renames crypto_box_curve25519xsalsa20poly1305_ZEROBYTES;
crypto_box_BOXZEROBYTES : NaCl_uint8 renames crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES;
crypto_box_BEFORENMBYTES : NaCl_uint8
renames crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES;
crypto_box_PUBLICKEYBYTES : NaCl_uint8
renames crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES;
crypto_box_SECRETKEYBYTES : NaCl_uint8
renames crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES;
crypto_box_SEALBYTES : constant NaCl_uint8 := crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES;
crypto_sign_ed25519_BYTES : constant NaCl_uint8 := 64;
crypto_sign_ed25519_SEEDBYTES : constant NaCl_uint8 := 32;
crypto_sign_ed25519_PUBLICKEYBYTES : constant NaCl_uint8 := 32;
crypto_sign_ed25519_SECRETKEYBYTES : constant NaCl_uint8 := 32 + 32;
crypto_sign_BYTES : NaCl_uint8 renames crypto_sign_ed25519_BYTES;
crypto_sign_SEEDBYTES : NaCl_uint8 renames crypto_sign_ed25519_SEEDBYTES;
crypto_sign_PUBLICKEYBYTES : NaCl_uint8 renames crypto_sign_ed25519_PUBLICKEYBYTES;
crypto_sign_SECRETKEYBYTES : NaCl_uint8 renames crypto_sign_ed25519_SECRETKEYBYTES;
crypto_secretbox_xsalsa20poly1305_KEYBYTES : constant NaCl_uint8 := 32;
crypto_secretbox_xsalsa20poly1305_NONCEBYTES : constant NaCl_uint8 := 24;
crypto_secretbox_xsalsa20poly1305_MACBYTES : constant NaCl_uint8 := 16;
crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES : constant NaCl_uint8 := 16;
crypto_secretbox_xsalsa20poly1305_ZEROBYTES : constant NaCl_uint8 :=
crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES +
crypto_secretbox_xsalsa20poly1305_MACBYTES;
crypto_secretbox_KEYBYTES : NaCl_uint8 renames crypto_secretbox_xsalsa20poly1305_KEYBYTES;
crypto_secretbox_MACBYTES : NaCl_uint8 renames crypto_secretbox_xsalsa20poly1305_MACBYTES;
crypto_secretbox_NONCEBYTES : NaCl_uint8 renames crypto_secretbox_xsalsa20poly1305_NONCEBYTES;
crypto_secretbox_ZEROBYTES : NaCl_uint8 renames crypto_secretbox_xsalsa20poly1305_ZEROBYTES;
crypto_secretbox_BOXZEROBYTES : NaCl_uint8
renames crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES;
crypto_auth_hmacsha512256_BYTES : constant NaCl_uint8 := 32;
crypto_auth_hmacsha512256_KEYBYTES : constant NaCl_uint8 := 32;
crypto_auth_BYTES : NaCl_uint8 renames crypto_auth_hmacsha512256_BYTES;
crypto_auth_KEYBYTES : NaCl_uint8 renames crypto_auth_hmacsha512256_KEYBYTES;
crypto_aead_chacha20poly1305_ietf_KEYBYTES : constant NaCl_uint8 := 32;
crypto_aead_chacha20poly1305_ietf_NPUBBYTES : constant NaCl_uint8 := 12;
crypto_aead_chacha20poly1305_ietf_ABYTES : constant NaCl_uint8 := 16;
crypto_aead_chacha20poly1305_KEYBYTES : constant NaCl_uint8 := 32;
crypto_aead_chacha20poly1305_NPUBBYTES : constant NaCl_uint8 := 8;
crypto_aead_chacha20poly1305_ABYTES : constant NaCl_uint8 := 16;
crypto_aead_aes256gcm_KEYBYTES : constant NaCl_uint8 := 32;
crypto_aead_aes256gcm_NPUBBYTES : constant NaCl_uint8 := 12;
crypto_aead_aes256gcm_ABYTES : constant NaCl_uint8 := 16;
------------------------
-- New C Data Types --
------------------------
type Password_Hash_Container is array (1 .. Positive (crypto_pwhash_STRBYTES)) of IC.char;
pragma Convention (C, Password_Hash_Container);
-----------------
-- Important --
-----------------
function sodium_init return IC.int;
pragma Import (C, sodium_init);
---------------
-- Hashing --
---------------
function crypto_generichash
(text_out : ICS.chars_ptr;
outlen : IC.size_t;
text_in : ICS.chars_ptr;
inlen : NaCl_uint64;
key : ICS.chars_ptr;
keylen : IC.size_t) return IC.int;
pragma Import (C, crypto_generichash);
function crypto_generichash_init
(state : crypto_generichash_state_Access;
key : ICS.chars_ptr;
keylen : IC.size_t;
outlen : IC.size_t) return IC.int;
pragma Import (C, crypto_generichash_init);
function crypto_generichash_update
(state : crypto_generichash_state_Access;
text_in : ICS.chars_ptr;
inlen : NaCl_uint64) return IC.int;
pragma Import (C, crypto_generichash_update);
function crypto_generichash_final
(state : crypto_generichash_state_Access;
text_out : ICS.chars_ptr;
outlen : IC.size_t) return IC.int;
pragma Import (C, crypto_generichash_final);
function crypto_shorthash
(text_out : ICS.chars_ptr;
text_in : ICS.chars_ptr;
inlen : NaCl_uint64;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_shorthash);
function crypto_pwhash
(text_out : ICS.chars_ptr;
outlen : NaCl_uint64;
passwd : ICS.chars_ptr;
passwdlen : NaCl_uint64;
salt : ICS.chars_ptr;
opslimit : NaCl_uint64;
memlimit : IC.size_t;
alg : IC.int) return IC.int;
pragma Import (C, crypto_pwhash);
function crypto_pwhash_str
(text_out : out Password_Hash_Container;
passwd : ICS.chars_ptr;
passwdlen : NaCl_uint64;
opslimit : NaCl_uint64;
memlimit : IC.size_t) return IC.int;
pragma Import (C, crypto_pwhash_str);
function crypto_pwhash_str_verify
(text_str : Password_Hash_Container;
passwd : ICS.chars_ptr;
passwdlen : NaCl_uint64) return IC.int;
pragma Import (C, crypto_pwhash_str_verify);
---------------------
-- Random Things --
---------------------
procedure randombytes_buf
(buf : System.Address;
size : IC.size_t);
pragma Import (C, randombytes_buf);
function randombytes_random return NaCl_uint32;
pragma Import (C, randombytes_random);
function randombytes_uniform (upper_bound : NaCl_uint32) return NaCl_uint32;
pragma Import (C, randombytes_uniform);
-----------------------------
-- Public Key Signatures --
-----------------------------
function crypto_sign_keypair
(pk : ICS.chars_ptr;
sk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_sign_keypair);
function crypto_sign_seed_keypair
(pk : ICS.chars_ptr;
sk : ICS.chars_ptr;
seed : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_sign_seed_keypair);
function crypto_sign
(sm : ICS.chars_ptr; smlen : NaCl_uint64;
m : ICS.chars_ptr; mlen : NaCl_uint64;
sk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_sign);
function crypto_sign_open
(m : ICS.chars_ptr; mlen : NaCl_uint64;
sm : ICS.chars_ptr; smlen : NaCl_uint64;
pk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_sign_open);
function crypto_sign_detached
(sig : ICS.chars_ptr; siglen : ICS.chars_ptr;
m : ICS.chars_ptr; mlen : NaCl_uint64;
sk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_sign_detached);
function crypto_sign_verify_detached
(sig : ICS.chars_ptr;
m : ICS.chars_ptr; mlen : NaCl_uint64;
pk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_sign_verify_detached);
-----------------------------
-- Public Key Encryption --
-----------------------------
function crypto_box_keypair
(pk : ICS.chars_ptr;
sk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_keypair);
function crypto_box_seed_keypair
(pk : ICS.chars_ptr;
sk : ICS.chars_ptr;
seed : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_seed_keypair);
function crypto_scalarmult_base
(q : ICS.chars_ptr;
n : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_scalarmult_base);
function crypto_box_easy
(c : ICS.chars_ptr;
m : ICS.chars_ptr; mlen : NaCl_uint64;
n : ICS.chars_ptr;
pk : ICS.chars_ptr;
sk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_easy);
function crypto_box_open_easy
(m : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
n : ICS.chars_ptr;
pk : ICS.chars_ptr;
sk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_open_easy);
function crypto_box_detached
(c : ICS.chars_ptr;
mac : ICS.chars_ptr;
m : ICS.chars_ptr; mlen : NaCl_uint64;
n : ICS.chars_ptr;
pk : ICS.chars_ptr;
sk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_detached);
function crypto_box_open_detached
(m : ICS.chars_ptr;
c : ICS.chars_ptr;
mac : ICS.chars_ptr;
clen : NaCl_uint64;
n : ICS.chars_ptr;
pk : ICS.chars_ptr;
sk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_open_detached);
function crypto_box_beforenm
(k : ICS.chars_ptr;
pk : ICS.chars_ptr;
sk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_beforenm);
function crypto_box_easy_afternm
(c : ICS.chars_ptr;
m : ICS.chars_ptr; mlen : NaCl_uint64;
n : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_easy_afternm);
function crypto_box_open_easy_afternm
(m : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
n : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_open_easy_afternm);
function crypto_box_detached_afternm
(c : ICS.chars_ptr;
mac : ICS.chars_ptr;
m : ICS.chars_ptr; mlen : NaCl_uint64;
n : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_detached_afternm);
function crypto_box_open_detached_afternm
(m : ICS.chars_ptr;
c : ICS.chars_ptr;
mac : ICS.chars_ptr;
clen : NaCl_uint64;
n : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_open_detached_afternm);
----------------------------------
-- Anonymous Private Messages --
----------------------------------
function crypto_box_seal
(c : ICS.chars_ptr;
m : ICS.chars_ptr; mlen : NaCl_uint64;
pk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_seal);
function crypto_box_seal_open
(m : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
pk : ICS.chars_ptr;
sk : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_box_seal_open);
----------------------------
-- Symmetric Encryption --
----------------------------
function crypto_secretbox_easy
(c : ICS.chars_ptr;
m : ICS.chars_ptr; mlen : NaCl_uint64;
n : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_secretbox_easy);
function crypto_secretbox_open_easy
(m : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
n : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_secretbox_open_easy);
function crypto_secretbox_detached
(c : ICS.chars_ptr;
mac : ICS.chars_ptr;
m : ICS.chars_ptr; mlen : NaCl_uint64;
n : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_secretbox_detached);
function crypto_secretbox_open_detached
(m : ICS.chars_ptr;
c : ICS.chars_ptr;
mac : ICS.chars_ptr;
clen : NaCl_uint64;
n : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_secretbox_open_detached);
------------------------------
-- Message Authentication --
------------------------------
function crypto_auth
(tag : ICS.chars_ptr;
text_in : ICS.chars_ptr;
inlen : NaCl_uint64;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_auth);
function crypto_auth_verify
(tag : ICS.chars_ptr;
text_in : ICS.chars_ptr;
inlen : NaCl_uint64;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_auth_verify);
----------------------------------
-- original ChaCha20-Poly1305 --
----------------------------------
function crypto_aead_chacha20poly1305_encrypt
(c : ICS.chars_ptr; clen_p : NaCl_uint64_Access;
m : ICS.chars_ptr; mlen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
nsec : ICS.chars_ptr;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_chacha20poly1305_encrypt);
function crypto_aead_chacha20poly1305_decrypt
(m : ICS.chars_ptr; mlen_p : NaCl_uint64_Access;
nsec : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_chacha20poly1305_decrypt);
function crypto_aead_chacha20poly1305_encrypt_detached
(c : ICS.chars_ptr;
mac : ICS.chars_ptr; maclen_p : NaCl_uint64_Access;
m : ICS.chars_ptr; mlen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
nsec : ICS.chars_ptr;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_chacha20poly1305_encrypt_detached);
function crypto_aead_chacha20poly1305_decrypt_detached
(m : ICS.chars_ptr;
nsec : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
mac : ICS.chars_ptr;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_chacha20poly1305_decrypt_detached);
------------------------------
-- IETF ChaCha20-Poly1305 --
------------------------------
function crypto_aead_chacha20poly1305_ietf_encrypt
(c : ICS.chars_ptr; clen_p : NaCl_uint64_Access;
m : ICS.chars_ptr; mlen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
nsec : ICS.chars_ptr;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_chacha20poly1305_ietf_encrypt);
function crypto_aead_chacha20poly1305_ietf_decrypt
(m : ICS.chars_ptr; mlen_p : NaCl_uint64_Access;
nsec : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_chacha20poly1305_ietf_decrypt);
function crypto_aead_chacha20poly1305_ietf_encrypt_detached
(c : ICS.chars_ptr;
mac : ICS.chars_ptr; maclen_p : NaCl_uint64_Access;
m : ICS.chars_ptr; mlen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
nsec : ICS.chars_ptr;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_chacha20poly1305_ietf_encrypt_detached);
function crypto_aead_chacha20poly1305_ietf_decrypt_detached
(m : ICS.chars_ptr;
nsec : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
mac : ICS.chars_ptr;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_chacha20poly1305_ietf_decrypt_detached);
---------------
-- AES-GCM --
---------------
function crypto_aead_aes256gcm_encrypt
(c : ICS.chars_ptr; clen_p : NaCl_uint64_Access;
m : ICS.chars_ptr; mlen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
nsec : ICS.chars_ptr;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_aes256gcm_encrypt);
function crypto_aead_aes256gcm_decrypt
(m : ICS.chars_ptr; mlen_p : NaCl_uint64_Access;
nsec : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_aes256gcm_decrypt);
function crypto_aead_aes256gcm_encrypt_detached
(c : ICS.chars_ptr;
mac : ICS.chars_ptr; maclen_p : NaCl_uint64_Access;
m : ICS.chars_ptr; mlen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
nsec : ICS.chars_ptr;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_aes256gcm_encrypt_detached);
function crypto_aead_aes256gcm_decrypt_detached
(m : ICS.chars_ptr;
nsec : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
mac : ICS.chars_ptr;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
npub : ICS.chars_ptr;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_aes256gcm_decrypt_detached);
-----------------------------------
-- AES-GCM with Precalculation --
-----------------------------------
function crypto_aead_aes256gcm_beforenm
(ctx : crypto_aead_aes256gcm_state_Access;
k : ICS.chars_ptr) return IC.int;
pragma Import (C, crypto_aead_aes256gcm_beforenm);
function crypto_aead_aes256gcm_encrypt_afternm
(c : ICS.chars_ptr; clen_p : NaCl_uint64_Access;
m : ICS.chars_ptr; mlen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
nsec : ICS.chars_ptr;
npub : ICS.chars_ptr;
ctx : crypto_aead_aes256gcm_state_Access) return IC.int;
pragma Import (C, crypto_aead_aes256gcm_encrypt_afternm);
function crypto_aead_aes256gcm_decrypt_afternm
(m : ICS.chars_ptr; mlen_p : NaCl_uint64_Access;
nsec : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
npub : ICS.chars_ptr;
ctx : crypto_aead_aes256gcm_state_Access) return IC.int;
pragma Import (C, crypto_aead_aes256gcm_decrypt_afternm);
function crypto_aead_aes256gcm_encrypt_detached_afternm
(c : ICS.chars_ptr;
mac : ICS.chars_ptr; maclen_p : NaCl_uint64_Access;
m : ICS.chars_ptr; mlen : NaCl_uint64;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
nsec : ICS.chars_ptr;
npub : ICS.chars_ptr;
ctx : crypto_aead_aes256gcm_state_Access) return IC.int;
pragma Import (C, crypto_aead_aes256gcm_encrypt_detached_afternm);
function crypto_aead_aes256gcm_decrypt_detached_afternm
(m : ICS.chars_ptr;
nsec : ICS.chars_ptr;
c : ICS.chars_ptr; clen : NaCl_uint64;
mac : ICS.chars_ptr;
ad : ICS.chars_ptr; adlen : NaCl_uint64;
npub : ICS.chars_ptr;
ctx : crypto_aead_aes256gcm_state_Access) return IC.int;
pragma Import (C, crypto_aead_aes256gcm_decrypt_detached_afternm);
------------------------
-- AES Availability --
------------------------
function crypto_aead_aes256gcm_is_available return IC.int;
pragma Import (C, crypto_aead_aes256gcm_is_available);
end Sodium.Thin_Binding;
|
Palmtree.Math.Core.Sint/vs_build/x86_Debug/TEST_op_ParseX.asm | rougemeilland/Palmtree.Math.Core.Sint | 0 | 17837 | <reponame>rougemeilland/Palmtree.Math.Core.Sint<gh_stars>0
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1
TITLE Z:\Sources\Lunor\Repos\rougemeilland\Palmtree.Math.Core.Sint\Palmtree.Math.Core.Sint\TEST_op_ParseX.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES
_DATA SEGMENT
COMM _uint_number_zero:DWORD
COMM _uint_number_one:DWORD
_DATA ENDS
msvcjmc SEGMENT
__7B7A869E_ctype@h DB 01H
__457DD326_basetsd@h DB 01H
__4384A2D9_corecrt_memcpy_s@h DB 01H
__4E51A221_corecrt_wstring@h DB 01H
__2140C079_string@h DB 01H
__1887E595_winnt@h DB 01H
__9FC7C64B_processthreadsapi@h DB 01H
__FA470AEC_memoryapi@h DB 01H
__F37DAFF1_winerror@h DB 01H
__7A450CCC_winbase@h DB 01H
__B4B40122_winioctl@h DB 01H
__86261D59_stralign@h DB 01H
__059414E1_pmc_sint_debug@h DB 01H
__01E814D2_test_op_parsex@c DB 01H
msvcjmc ENDS
PUBLIC _TEST_ParseX
PUBLIC __JustMyCode_Default
PUBLIC ??_C@_1DI@IKFBJCFO@?$AAT?$AAr?$AAy?$AAP?$AAa?$AAr?$AAs?$AAe?$AAn?$PP?$KJ?$AA0?$PP?$LD?$PP?$PM?$PP?I?$AAL@ ; `string'
PUBLIC ??_C@_1BO@HCNCHDIP@?$AAP?$AAa?$AAr?$AAs?$AAe?$AAX?$AA?5?$AA?$CI?$AA?$CF?$AAd?$AA?4?$AA?$CF?$AAd?$AA?$CJ@ ; `string'
PUBLIC ??_C@_1EG@MCOLJMDD@?$AAP?$AAM?$AAC?$AA_?$AAT?$AAo?$AAB?$AAy?$AAt?$AAe?$AAA?$AAr?$AAr?$AAa?$AAy@ ; `string'
PUBLIC ??_C@_1BK@CBDJCOBM@?$PP?G?$PP?$PM?$PP?$LP?$AAn?$PP?$IF?$PP?$LJ?$AAL?$AA?$AA?$PP?t?$AAW?$AAj?$AAD@ ; `string'
EXTRN _TEST_Assert:PROC
EXTRN _FormatTestLabel:PROC
EXTRN _FormatTestMesssage:PROC
EXTRN @_RTC_CheckStackVars@8:PROC
EXTRN @__CheckForDebuggerJustMyCode@4:PROC
EXTRN @__security_check_cookie@4:PROC
EXTRN __RTC_CheckEsp:PROC
EXTRN __RTC_InitBase:PROC
EXTRN __RTC_Shutdown:PROC
EXTRN ___security_cookie:DWORD
_BSS SEGMENT
?actual_buf@?1??TEST_ParseX@@9@9 DB 0100H DUP (?) ; `TEST_ParseX'::`2'::actual_buf
?actual_buf_size@?1??TEST_ParseX@@9@9 DD 01H DUP (?) ; `TEST_ParseX'::`2'::actual_buf_size
_BSS ENDS
; COMDAT rtc$TMZ
rtc$TMZ SEGMENT
__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
rtc$IMZ ENDS
; COMDAT ??_C@_1BK@CBDJCOBM@?$PP?G?$PP?$PM?$PP?$LP?$AAn?$PP?$IF?$PP?$LJ?$AAL?$AA?$AA?$PP?t?$AAW?$AAj?$AAD@
CONST SEGMENT
??_C@_1BK@CBDJCOBM@?$PP?G?$PP?$PM?$PP?$LP?$AAn?$PP?$IF?$PP?$LJ?$AAL?$AA?$AA?$PP?t?$AAW?$AAj?$AAD@ DB 0c7H
DB '0', 0fcH, '0', 0bfH, '0n0', 085H, 'Q', 0b9H, '[L0', 00H, 'N', 0f4H
DB 081H, 'W0j0D0', 00H, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_1EG@MCOLJMDD@?$AAP?$AAM?$AAC?$AA_?$AAT?$AAo?$AAB?$AAy?$AAt?$AAe?$AAA?$AAr?$AAr?$AAa?$AAy@
CONST SEGMENT
??_C@_1EG@MCOLJMDD@?$AAP?$AAM?$AAC?$AA_?$AAT?$AAo?$AAB?$AAy?$AAt?$AAe?$AAA?$AAr?$AAr?$AAa?$AAy@ DB 'P'
DB 00H, 'M', 00H, 'C', 00H, '_', 00H, 'T', 00H, 'o', 00H, 'B', 00H
DB 'y', 00H, 't', 00H, 'e', 00H, 'A', 00H, 'r', 00H, 'r', 00H, 'a'
DB 00H, 'y', 00H, 'n0', 0a9H, '_0^', 0b3H, '0', 0fcH, '0', 0c9H, '0'
DB 'L0', 01fH, 'g', 085H, '_', 01aH, 090H, 08aH, '0g0o0j0D0(', 00H
DB '%', 00H, 'd', 00H, ')', 00H, 00H, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_1BO@HCNCHDIP@?$AAP?$AAa?$AAr?$AAs?$AAe?$AAX?$AA?5?$AA?$CI?$AA?$CF?$AAd?$AA?4?$AA?$CF?$AAd?$AA?$CJ@
CONST SEGMENT
??_C@_1BO@HCNCHDIP@?$AAP?$AAa?$AAr?$AAs?$AAe?$AAX?$AA?5?$AA?$CI?$AA?$CF?$AAd?$AA?4?$AA?$CF?$AAd?$AA?$CJ@ DB 'P'
DB 00H, 'a', 00H, 'r', 00H, 's', 00H, 'e', 00H, 'X', 00H, ' ', 00H
DB '(', 00H, '%', 00H, 'd', 00H, '.', 00H, '%', 00H, 'd', 00H, ')'
DB 00H, 00H, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_1DI@IKFBJCFO@?$AAT?$AAr?$AAy?$AAP?$AAa?$AAr?$AAs?$AAe?$AAn?$PP?$KJ?$AA0?$PP?$LD?$PP?$PM?$PP?I?$AAL@
CONST SEGMENT
??_C@_1DI@IKFBJCFO@?$AAT?$AAr?$AAy?$AAP?$AAa?$AAr?$AAs?$AAe?$AAn?$PP?$KJ?$AA0?$PP?$LD?$PP?$PM?$PP?I?$AAL@ DB 'T'
DB 00H, 'r', 00H, 'y', 00H, 'P', 00H, 'a', 00H, 'r', 00H, 's', 00H
DB 'e', 00H, 'n0', 0a9H, '_0^', 0b3H, '0', 0fcH, '0', 0c9H, '0L0', 01fH
DB 'g', 085H, '_', 01aH, 090H, 08aH, '0g0o0j0D0(', 00H, '%', 00H, 'd'
DB 00H, ')', 00H, 00H, 00H ; `string'
CONST ENDS
; Function compile flags: /Odt
; COMDAT __JustMyCode_Default
_TEXT SEGMENT
__JustMyCode_Default PROC ; COMDAT
push ebp
mov ebp, esp
pop ebp
ret 0
__JustMyCode_Default ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.sint\palmtree.math.core.sint\pmc_sint_debug.h
; COMDAT __EQUALS_MEMORY
_TEXT SEGMENT
_buffer1$ = 8 ; size = 4
_count1$ = 12 ; size = 4
_buffer2$ = 16 ; size = 4
_count2$ = 20 ; size = 4
__EQUALS_MEMORY PROC ; COMDAT
; 140 : {
push ebp
mov ebp, esp
sub esp, 192 ; 000000c0H
push ebx
push esi
push edi
lea edi, DWORD PTR [ebp-192]
mov ecx, 48 ; 00000030H
mov eax, -858993460 ; ccccccccH
rep stosd
mov ecx, OFFSET __059414E1_pmc_sint_debug@h
call @__CheckForDebuggerJustMyCode@4
; 141 : if (count1 != count2)
mov eax, DWORD PTR _count1$[ebp]
cmp eax, DWORD PTR _count2$[ebp]
je SHORT $LN2@EQUALS_MEM
; 142 : return (-1);
or eax, -1
jmp SHORT $LN1@EQUALS_MEM
$LN2@EQUALS_MEM:
; 143 : while (count1 > 0)
cmp DWORD PTR _count1$[ebp], 0
jbe SHORT $LN3@EQUALS_MEM
; 144 : {
; 145 : if (*buffer1 != *buffer2)
mov eax, DWORD PTR _buffer1$[ebp]
movzx ecx, BYTE PTR [eax]
mov edx, DWORD PTR _buffer2$[ebp]
movzx eax, BYTE PTR [edx]
cmp ecx, eax
je SHORT $LN5@EQUALS_MEM
; 146 : return (-1);
or eax, -1
jmp SHORT $LN1@EQUALS_MEM
$LN5@EQUALS_MEM:
; 147 : ++buffer1;
mov eax, DWORD PTR _buffer1$[ebp]
add eax, 1
mov DWORD PTR _buffer1$[ebp], eax
; 148 : ++buffer2;
mov eax, DWORD PTR _buffer2$[ebp]
add eax, 1
mov DWORD PTR _buffer2$[ebp], eax
; 149 : --count1;
mov eax, DWORD PTR _count1$[ebp]
sub eax, 1
mov DWORD PTR _count1$[ebp], eax
; 150 : }
jmp SHORT $LN2@EQUALS_MEM
$LN3@EQUALS_MEM:
; 151 : return (0);
xor eax, eax
$LN1@EQUALS_MEM:
; 152 : }
pop edi
pop esi
pop ebx
add esp, 192 ; 000000c0H
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 0
__EQUALS_MEMORY ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.sint\palmtree.math.core.sint\test_op_parsex.c
; COMDAT _TEST_ParseX
_TEXT SEGMENT
tv144 = -436 ; size = 4
tv129 = -436 ; size = 4
tv77 = -436 ; size = 4
_opt$ = -236 ; size = 192
_x_result$ = -36 ; size = 4
_result$ = -24 ; size = 4
_x$ = -12 ; size = 4
__$ArrayPad$ = -4 ; size = 4
_env$ = 8 ; size = 4
_ep$ = 12 ; size = 4
_no$ = 16 ; size = 4
_str$ = 20 ; size = 4
_styles$ = 24 ; size = 4
_desired_result_code$ = 28 ; size = 4
_desired_buf$ = 32 ; size = 4
_desired_buf_size$ = 36 ; size = 4
_TEST_ParseX PROC ; COMDAT
; 32 : {
push ebp
mov ebp, esp
sub esp, 436 ; 000001b4H
push ebx
push esi
push edi
lea edi, DWORD PTR [ebp-436]
mov ecx, 109 ; 0000006dH
mov eax, -858993460 ; ccccccccH
rep stosd
mov eax, DWORD PTR ___security_cookie
xor eax, ebp
mov DWORD PTR __$ArrayPad$[ebp], eax
mov ecx, OFFSET __01E814D2_test_op_parsex@c
call @__CheckForDebuggerJustMyCode@4
; 33 : PMC_HANDLE_SINT x;
; 34 : static unsigned char actual_buf[256];
; 35 : static size_t actual_buf_size;
; 36 : PMC_STATUS_CODE result;
; 37 : PMC_STATUS_CODE x_result;
; 38 : PMC_NUMBER_FORMAT_INFO opt;
; 39 : ep->UINT_ENTRY_POINTS.InitializeNumberFormatInfo(&opt);
mov esi, esp
lea eax, DWORD PTR _opt$[ebp]
push eax
mov ecx, DWORD PTR _ep$[ebp]
mov edx, DWORD PTR [ecx+44]
call edx
cmp esi, esp
call __RTC_CheckEsp
; 40 : TEST_Assert(env, FormatTestLabel(L"ParseX (%d.%d)", no, 1), (x_result = ep->TryParse(str, styles, &opt, &x)) == desired_result_code, FormatTestMesssage(L"TryParseの復帰コードが期待通りではない(%d)", x_result));
mov esi, esp
lea eax, DWORD PTR _x$[ebp]
push eax
lea ecx, DWORD PTR _opt$[ebp]
push ecx
mov edx, DWORD PTR _styles$[ebp]
push edx
mov eax, DWORD PTR _str$[ebp]
push eax
mov ecx, DWORD PTR _ep$[ebp]
mov edx, DWORD PTR [ecx+328]
call edx
cmp esi, esp
call __RTC_CheckEsp
mov DWORD PTR _x_result$[ebp], eax
mov eax, DWORD PTR _x_result$[ebp]
cmp eax, DWORD PTR _desired_result_code$[ebp]
jne SHORT $LN5@TEST_Parse
mov DWORD PTR tv77[ebp], 1
jmp SHORT $LN6@TEST_Parse
$LN5@TEST_Parse:
mov DWORD PTR tv77[ebp], 0
$LN6@TEST_Parse:
mov ecx, DWORD PTR _x_result$[ebp]
push ecx
push OFFSET ??_C@_1DI@IKFBJCFO@?$AAT?$AAr?$AAy?$AAP?$AAa?$AAr?$AAs?$AAe?$AAn?$PP?$KJ?$AA0?$PP?$LD?$PP?$PM?$PP?I?$AAL@
call _FormatTestMesssage
add esp, 8
push eax
mov edx, DWORD PTR tv77[ebp]
push edx
push 1
mov eax, DWORD PTR _no$[ebp]
push eax
push OFFSET ??_C@_1BO@HCNCHDIP@?$AAP?$AAa?$AAr?$AAs?$AAe?$AAX?$AA?5?$AA?$CI?$AA?$CF?$AAd?$AA?4?$AA?$CF?$AAd?$AA?$CJ@
call _FormatTestLabel
add esp, 12 ; 0000000cH
push eax
mov ecx, DWORD PTR _env$[ebp]
push ecx
call _TEST_Assert
add esp, 16 ; 00000010H
; 41 : if (desired_result_code == PMC_STATUS_OK)
cmp DWORD PTR _desired_result_code$[ebp], 0
jne $LN2@TEST_Parse
; 42 : {
; 43 : TEST_Assert(env, FormatTestLabel(L"ParseX (%d.%d)", no, 2), (result = ep->ToByteArray(x, actual_buf, sizeof(actual_buf), &actual_buf_size)) == PMC_STATUS_OK, FormatTestMesssage(L"PMC_ToByteArrayの復帰コードが期待通りではない(%d)", result));
mov esi, esp
push OFFSET ?actual_buf_size@?1??TEST_ParseX@@9@9
push 256 ; 00000100H
push OFFSET ?actual_buf@?1??TEST_ParseX@@9@9
mov eax, DWORD PTR _x$[ebp]
push eax
mov ecx, DWORD PTR _ep$[ebp]
mov edx, DWORD PTR [ecx+308]
call edx
cmp esi, esp
call __RTC_CheckEsp
mov DWORD PTR _result$[ebp], eax
cmp DWORD PTR _result$[ebp], 0
jne SHORT $LN7@TEST_Parse
mov DWORD PTR tv129[ebp], 1
jmp SHORT $LN8@TEST_Parse
$LN7@TEST_Parse:
mov DWORD PTR tv129[ebp], 0
$LN8@TEST_Parse:
mov eax, DWORD PTR _result$[ebp]
push eax
push OFFSET ??_C@_1EG@MCOLJMDD@?$AAP?$AAM?$AAC?$AA_?$AAT?$AAo?$AAB?$AAy?$AAt?$AAe?$AAA?$AAr?$AAr?$AAa?$AAy@
call _FormatTestMesssage
add esp, 8
push eax
mov ecx, DWORD PTR tv129[ebp]
push ecx
push 2
mov edx, DWORD PTR _no$[ebp]
push edx
push OFFSET ??_C@_1BO@HCNCHDIP@?$AAP?$AAa?$AAr?$AAs?$AAe?$AAX?$AA?5?$AA?$CI?$AA?$CF?$AAd?$AA?4?$AA?$CF?$AAd?$AA?$CJ@
call _FormatTestLabel
add esp, 12 ; 0000000cH
push eax
mov eax, DWORD PTR _env$[ebp]
push eax
call _TEST_Assert
add esp, 16 ; 00000010H
; 44 : TEST_Assert(env, FormatTestLabel(L"ParseX (%d.%d)", no, 3), _EQUALS_MEMORY(actual_buf, actual_buf_size, desired_buf, desired_buf_size) == 0, L"データの内容が一致しない");
mov eax, DWORD PTR _desired_buf_size$[ebp]
push eax
mov ecx, DWORD PTR _desired_buf$[ebp]
push ecx
mov edx, DWORD PTR ?actual_buf_size@?1??TEST_ParseX@@9@9
push edx
push OFFSET ?actual_buf@?1??TEST_ParseX@@9@9
call __EQUALS_MEMORY
add esp, 16 ; 00000010H
test eax, eax
jne SHORT $LN9@TEST_Parse
mov DWORD PTR tv144[ebp], 1
jmp SHORT $LN10@TEST_Parse
$LN9@TEST_Parse:
mov DWORD PTR tv144[ebp], 0
$LN10@TEST_Parse:
push OFFSET ??_C@_1BK@CBDJCOBM@?$PP?G?$PP?$PM?$PP?$LP?$AAn?$PP?$IF?$PP?$LJ?$AAL?$AA?$AA?$PP?t?$AAW?$AAj?$AAD@
mov eax, DWORD PTR tv144[ebp]
push eax
push 3
mov ecx, DWORD PTR _no$[ebp]
push ecx
push OFFSET ??_C@_1BO@HCNCHDIP@?$AAP?$AAa?$AAr?$AAs?$AAe?$AAX?$AA?5?$AA?$CI?$AA?$CF?$AAd?$AA?4?$AA?$CF?$AAd?$AA?$CJ@
call _FormatTestLabel
add esp, 12 ; 0000000cH
push eax
mov edx, DWORD PTR _env$[ebp]
push edx
call _TEST_Assert
add esp, 16 ; 00000010H
$LN2@TEST_Parse:
; 45 : }
; 46 : if (x_result == PMC_STATUS_OK)
cmp DWORD PTR _x_result$[ebp], 0
jne SHORT $LN1@TEST_Parse
; 47 : ep->Dispose(x);
mov esi, esp
mov eax, DWORD PTR _x$[ebp]
push eax
mov ecx, DWORD PTR _ep$[ebp]
mov edx, DWORD PTR [ecx+296]
call edx
cmp esi, esp
call __RTC_CheckEsp
$LN1@TEST_Parse:
; 48 : }
push edx
mov ecx, ebp
push eax
lea edx, DWORD PTR $LN14@TEST_Parse
call @_RTC_CheckStackVars@8
pop eax
pop edx
pop edi
pop esi
pop ebx
mov ecx, DWORD PTR __$ArrayPad$[ebp]
xor ecx, ebp
call @__security_check_cookie@4
add esp, 436 ; 000001b4H
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 0
npad 1
$LN14@TEST_Parse:
DD 2
DD $LN13@TEST_Parse
$LN13@TEST_Parse:
DD -12 ; fffffff4H
DD 4
DD $LN11@TEST_Parse
DD -236 ; ffffff14H
DD 192 ; 000000c0H
DD $LN12@TEST_Parse
$LN12@TEST_Parse:
DB 111 ; 0000006fH
DB 112 ; 00000070H
DB 116 ; 00000074H
DB 0
$LN11@TEST_Parse:
DB 120 ; 00000078H
DB 0
_TEST_ParseX ENDP
_TEXT ENDS
END
|
oeis/084/A084175.asm | neoneye/loda-programs | 11 | 178654 | ; A084175: Jacobsthal oblong numbers.
; 0,1,3,15,55,231,903,3655,14535,58311,232903,932295,3727815,14913991,59650503,238612935,954429895,3817763271,15270965703,61084037575,244335800775,977343902151,3909374210503,15637499638215,62549992960455,250199983026631,1000799909736903,4003199683686855,16012798645268935,64051194760032711,256204778682216903,1024819115444695495,4099276460347126215,16397105844251816391,65588423371280642503,262353693496575816135,1049414773963396772295,4197659095899400073671,16790636383505974325703
add $0,2
mov $3,-2
pow $3,$0
sub $3,1
mov $1,$3
mov $2,$3
add $2,$3
mul $1,$2
div $1,144
mov $0,$1
|
programs/oeis/246/A246416.asm | neoneye/loda | 22 | 244024 | ; A246416: A permutation of essentially the duplicate nonnegative numbers: a(4n) = n + 1/2 - (-1)^n/2, a(2n+1) = a(4n+2) = 2n+1.
; 0,1,1,3,2,5,3,7,2,9,5,11,4,13,7,15,4,17,9,19,6,21,11,23,6,25,13,27,8,29,15,31,8,33,17,35,10,37,19,39,10,41,21,43,12,45,23,47,12,49,25,51,14,53,27,55,14,57,29,59,16,61,31,63,16,65,33,67,18,69,35,71,18,73,37,75,20,77,39,79,20,81,41,83,22,85,43,87,22,89,45,91,24,93,47,95,24,97,49,99
dif $0,2
seq $0,212831 ; a(4*n) = 2*n, a(2*n+1) = 2*n+1, a(4*n+2) = 2*n+2.
|
oeis/077/A077939.asm | neoneye/loda-programs | 11 | 4182 | <gh_stars>10-100
; A077939: Expansion of 1/(1 - 2*x - x^2 - x^3).
; Submitted by <NAME>(s4)
; 1,2,5,13,33,84,214,545,1388,3535,9003,22929,58396,148724,378773,964666,2456829,6257097,15935689,40585304,103363394,263247781,670444260,1707499695,4348691431,11075326817,28206844760,71837707768,182957587113,465959726754,1186714748389,3022346810645,7697368096433,19603797751900,49927310410878,127155786670089,323842681502956,824768460086879,2100535388346803,5349681918283441,13624667685000564,34699552676631372,88373454956546749,225071130274725434,573215268182628989,1459875121596530161
mov $1,1
lpb $0
sub $0,1
add $2,$1
add $2,$3
mov $4,$2
mov $2,$3
mov $3,$1
add $1,$4
lpe
mov $0,$1
|
src/gl/interface/gl-matrices.ads | Roldak/OpenGLAda | 79 | 27303 | -- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
generic
type Index_Type is (<>);
type Element_Type is private;
with function "+" (Left, Right : Element_Type) return Element_Type is <>;
with function "-" (Left, Right : Element_Type) return Element_Type is <>;
with function "-" (Left : Element_Type) return Element_Type is <>;
with function "*" (Left, Right : Element_Type) return Element_Type is <>;
-- not needed currently
--with function "/" (Left, Right : Element_Type) return Element_Type is <>;
type Vector_Type is array (Index_Type) of aliased Element_Type;
package GL.Matrices is
pragma Preelaborate;
-- this matrix is column-major (i.e. the first index defines the column,
-- the second index defines the row).
-- this is important for interoperability with GLSL.
type Matrix is array (Index_Type, Index_Type) of aliased Element_Type;
function "+" (Left, Right : Matrix) return Matrix;
function "-" (Left, Right : Matrix) return Matrix;
function "-" (Left : Matrix) return Matrix;
-- This is not element-wise but mathematical matrix multiplication.
function "*" (Left, Right : Matrix) return Matrix;
function "*" (Left : Matrix; Right : Vector_Type) return Vector_Type;
function "*" (Left : Matrix; Right : Element_Type) return Matrix;
function "*" (Left : Element_Type; Right : Matrix) return Matrix;
function Transpose (Subject : Matrix) return Matrix;
pragma Inline ("+");
pragma Inline ("-");
pragma Inline ("*");
pragma Inline (Transpose);
pragma Convention (C, Matrix);
end GL.Matrices;
|
old/lo-rez-video/sms/aplib/Example code/test-data.asm | haroldo-ok/bad-apple-sms | 1 | 164746 | <filename>old/lo-rez-video/sms/aplib/Example code/test-data.asm
;==============================================================
; WLA-DX banking setup
;==============================================================
.memorymap
defaultslot 0
slotsize $4000
slot 0 $0000
slot 1 $4000
slot 2 $8000
slotsize $2000
slot 3 $c000
.endme
.rombankmap
bankstotal 2
banksize $4000
banks 2
.endro
;==============================================================
; SDSC tag and SMS rom header
;==============================================================
.sdsctag 0.2,"aPLib unpacker test 1","","Maxim"
.bank 0 slot 0
.org $0000
.include "Useful functions.inc"
.include "..\aplib-z80.asm"
;==============================================================
; RAM
;==============================================================
.ramsection "Memory" slot 3
aPLibMemory instanceof aPLibMemoryStruct
data: dsb 1024
.ends
;==============================================================
; Boot section
;==============================================================
.org $0000
.section "Boot section" force
di ; disable interrupts
im 1 ; Interrupt mode 1
jp main ; jump to main program
.ends
;==============================================================
; Pause button handler
;==============================================================
.org $0066
.section "Pause button handler" force
; Do nothing
retn
.ends
;==============================================================
; Main program
;==============================================================
.section "Main program" free
main:
ld sp, $dff0
call DefaultInitialiseVDP
call ClearVRAM
; Load palette
ld hl,PaletteData ; data
ld b,PaletteDataEnd-PaletteData ; size
ld c,$00 ; index to load at
call LoadPalette
; Load font
ld hl,0 ; tile index to load at
ld ix,FontData ; data
ld bc,96 ; number of tiles
ld d,1 ; bits per pixel
call LoadTiles
; initialise data
ld a,$00
ld b,32
ld hl,data
ldir
;==============================================================
; Write text to name table
;==============================================================
ld hl,Message
ld iy,NameTableAddress
call WriteASCII
;==============================================================
; Decompress text
;==============================================================
ld hl,ComprData
ld de,data
call depack
;==============================================================
; Write decompressed text to name table
;==============================================================
ld hl,data
ld iy,NameTableAddress+32*2*4
call WriteASCII
; Turn screen on
ld a,%11000100
; ||||| |`- Zoomed sprites -> 16x16 pixels
; ||||| `-- Doubled sprites -> 2 tiles per sprite, 8x16
; ||||`---- 30 row/240 line mode
; |||`----- 28 row/224 line mode
; ||`------ VBlank interrupts
; |`------- Enable display
; `-------- Must be set (VRAM size bit)
out ($bf),a
ld a,$81
out ($bf),a
-:jp -
.ends
;==============================================================
; Data
;==============================================================
.section "Data" FREE
PaletteData:
.db $00,$3f ; Black, White
PaletteDataEnd:
FontData:
.include "BBC Micro font (1bpp).inc"
Message:
.db "Decompressed data:",0
ComprData:
.incbin "message.compr.bin"
.ends
|
gfx/pokemon/arbok/anim_idle.asm | Dev727/ancientplatinum | 28 | 14716 | frame 0, 08
frame 4, 06
frame 5, 04
frame 6, 04
frame 5, 04
frame 4, 06
endanim
|
src/alloc.asm | Clinery1/asmGLFW | 1 | 104964 | ; TODO: redo this and make it much better.
; Definitions of what happens. Used for the `prot` and `flags` variables in the mmap syscall
%define PROT_READ 0x1 ; Page can be read.
%define PROT_WRITE 0x2 ; Page can be written.
%define PROT_EXEC 0x4 ; Page can be executed.
%define PROT_NONE 0x0 ; Page can not be accessed.
%define MAP_PRIVATE 0x02 ; Other programs CAN'T read this memory
%define MAP_SHARED 0x01 ; Other programs CAN read this memory
%define MAP_ANONYMOUS 0x20 ; Dont use a file
%define MEM_MAP 9 ; The syscall number for mmap
%define MEM_UNMAP 11 ; The syscall number for munmap
%define MEM_REMAP 25 ; The syscall number for mremap
global myAlloc
global myAlloc_executable
global myFree
section .text
;;;;;;;;;;;;;;;;;;;;;;;;
; MEMORY ALLOC/DEALLOC ;
;;;;;;;;;;;;;;;;;;;;;;;;
; IN: byte amount:rdi
; OUT: address or error code:rax
myAlloc:
mov rax,rdi
mov rcx,rbx
push rbx
xor rbx,rbx
call __alloc
pop rbx
ret
; IN: byte amount:rax,address:rbx
; OUT: address or error code:rax
myAlloc_executable:
mov rcx,rbx
push rbx
mov rbx,3
call __alloc
pop rbx
ret
; IN: byte amount:rax,my flags:rbx,address:rcx
; my flags: 0x3:executable
; OUT: address or error code:rax
; if executable, !writable; if no address is to be supplied, rcx should be zero
__alloc:
push rdx
push rdi
push rsi
push r8
push r9
push r10
xor rdx,rdx
and rbx,3
shr rbx,1
or rdx,PROT_READ|PROT_WRITE
xor rdx,rbx ; Sets PROT_EXE and removes PROT_WRITE if rbx is 3
xor r8,r8
xor r9,r9
mov rsi,rax
mov rdi,rcx
mov r10,0x22 ; MAP_PRIVATE|MAP_ANONYMOUS
mov rax,9
syscall ; this calls the function to allocate the memory, after this instruction we have the pointer in rax
pop r10
pop r9
pop r8
pop rsi
pop rdi
pop rdx
ret
; IN: address:rdi,amount:rsi
; OUT: error code:rax
myFree:
mov rax,11
syscall
ret
;;;;;;;;;;;;;;;;;;;;;;;
; MEMORY REMAP/CHANGE ;
;;;;;;;;;;;;;;;;;;;;;;;
; IN: addr:rax,old_len:rbx,new_len:rcx
; OUT: error code:rax
; Error codes: -1: new_len<=old_len please use mem_shrink to shrink memory
mem_extend:
cmp rbx,rcx
jle return
push rdx
push rdi
push rsi
push r8
push r9
push r10
mov rdi,rax ; set the old_address
mov rsi,rbx ; set the old_len
mov rdx,rcx ; set the new_len
mov r10,0x22 ; set the flags (same as before)
mov r8,rdi ; set the new_address (same as old_address)
syscall
pop r10
pop r9
pop r8
pop rsi
pop rdi
pop rdx
xor rax,rax
ret
; IN: addr:rax,old_len:rbx,new_len:rcx
; OUT: error code:rax
; Error codes: -1: new_len>=old_len please use mem_extend to extend memory
mem_shrink:
cmp rbx,rcx
jge return
push rdx
push rdi
push rsi
push r8
push r9
push r10
mov rdi,rax ; set the old_address
mov rsi,rbx ; set the old_len
mov rdx,rcx ; set the new_len
mov r10,0x22 ; set the flags (same as before)
mov r8,rdi ; set the new_address (same as old_address)
syscall
pop r10
pop r9
pop r8
pop rsi
pop rdi
pop rdx
xor rax,rax
ret
; IN: addr:rax,len:rbx,executable(3):rcx
; If executable then rcx should be 3 otherwise, rcx=0
mem_set_executable:
push rdx
push rdi
push rsi
mov rdi,rax
mov rsi,rbx
mov rdx,PROT_READ|PROT_WRITE
xor rdx,rcx
mov rax,10
syscall
pop rsi
pop rdi
pop rdx
ret
; Helper function, returns rax=-1
return:
mov rax,-1
ret
|
programs/oeis/178/A178676.asm | karttu/loda | 1 | 86524 | ; A178676: a(n) = 5^n + 5.
; 6,10,30,130,630,3130,15630,78130,390630,1953130,9765630,48828130,244140630,1220703130,6103515630,30517578130,152587890630,762939453130,3814697265630,19073486328130,95367431640630,476837158203130,2384185791015630,11920928955078130
mov $1,5
pow $1,$0
add $1,5
|
l3337 codes/x.asm/very dangerous.asm | pankace/SICP-robably | 0 | 12110 | <filename>l3337 codes/x.asm/very dangerous.asm
stdcall ProcesarTecla,"1"
jmp siguienteHook
.endif
|
test/Fail/Issue329.agda | cruhland/agda | 1,989 | 9416 | {-# OPTIONS --warning=error #-}
module Issue329 where
mutual
infixl 0 D Undeclared
data D : Set where
|
alloy4fun_models/trashltl/models/19/nBrqiXabtgbvKCt2k.als | Kaixi26/org.alloytools.alloy | 0 | 4523 | <filename>alloy4fun_models/trashltl/models/19/nBrqiXabtgbvKCt2k.als<gh_stars>0
open main
pred idnBrqiXabtgbvKCt2k_prop20 {
always all f : File | f in Trash since f not in Protected
}
pred __repair { idnBrqiXabtgbvKCt2k_prop20 }
check __repair { idnBrqiXabtgbvKCt2k_prop20 <=> prop20o } |
lib/target/pv2000/classic/pv2000_crt0.asm | bahmanrafatjoo/z88dk | 0 | 241880 | <reponame>bahmanrafatjoo/z88dk<filename>lib/target/pv2000/classic/pv2000_crt0.asm
; Casio PV-2000 CRT0
;
MODULE pv2000_crt0
;--------
; Include zcc_opt.def to find out some info
;--------
defc crt0 = 1
INCLUDE "zcc_opt.def"
;--------
; Some scope definitions
;--------
EXTERN _main ; main() is always external to crt0 code
PUBLIC cleanup ; jp'd to by exit()
PUBLIC l_dcal ; jp(hl)
; VDP specific
PUBLIC msxbios
EXTERN msx_set_mode
;--------
; Set an origin for the application (-zorg=) default to 32768
;--------
defc CRT_ORG_CODE = 0xc000
defc CRT_ORG_BSS = 0x7565
defc CONSOLE_ROWS = 24
defc CONSOLE_COLUMNS = 32
defc TAR__fputc_cons_generic = 1
defc TAR__clib_exit_stack_size = 0
defc TAR__register_sp = 0x7fff
defc __CPU_CLOCK = 3579000
INCLUDE "crt/classic/crt_rules.inc"
org CRT_ORG_CODE
jp start
start:
di
; Hook the interrupt
ld a,0xc3
ld ($7498),a ;jp
ld hl,nmi_int
ld ($7499),hl
ld a,0xc3
ld ($749b),a ;jp
ld hl,mask_int
ld ($749c),hl
INCLUDE "crt/classic/crt_init_sp.asm"
INCLUDE "crt/classic/crt_init_atexit.asm"
ld (start1+1),sp ; Save entry stack
call crt0_init_bss
ld (exitsp),sp
ld hl,2
call msx_set_mode
ei
; Optional definition for auto MALLOC init
; it assumes we have free space between the end of
; the compiled program and the stack pointer
IF DEFINED_USING_amalloc
INCLUDE "crt/classic/crt_init_amalloc.asm"
ENDIF
call _main ; Call user program
cleanup:
;
; Deallocate memory which has been allocated here!
;
push hl ; return code
IF CRT_ENABLE_STDIO = 1
EXTERN closeall
call closeall
ENDIF
cleanup_exit:
pop bc ; return code (still not sure it is teh right one !)
start1: ld sp,0 ;Restore stack to entry value
ret
l_dcal: jp (hl) ;Used for function pointer calls
nmi_int:
push af
push hl
; Flow into int_VBL
INCLUDE "crt/classic/tms9118/interrupt_handler.asm"
; Not sure when this is called, but don't do anything
mask_int:
ex (sp),hl
pop hl
ei
reti
; ---------------
; MSX specific stuff
; ---------------
; Safe BIOS call
msxbios:
push ix
ret
INCLUDE "crt/classic/crt_runtime_selection.asm"
defc __crt_org_bss = CRT_ORG_BSS
IF DEFINED_CRT_MODEL
defc __crt_model = CRT_MODEL
ELSE
defc __crt_model = 1
ENDIF
INCLUDE "crt/classic/crt_section.asm"
SECTION bss_crt
PUBLIC raster_procs ;Raster interrupt handlers
PUBLIC pause_procs ;Pause interrupt handlers
PUBLIC timer ;This is incremented every time a VBL/HBL interrupt happens
PUBLIC _pause_flag ;This alternates between 0 and 1 every time pause is pressed
PUBLIC RG0SAV ;keeping track of VDP register values
PUBLIC RG1SAV
PUBLIC RG2SAV
PUBLIC RG3SAV
PUBLIC RG4SAV
PUBLIC RG5SAV
PUBLIC RG6SAV
PUBLIC RG7SAV
raster_procs: defw 0 ;Raster interrupt handlers
pause_procs: defs 8 ;Pause interrupt handlers
timer: defw 0 ;This is incremented every time a VBL/HBL interrupt happens
_pause_flag: defb 0 ;This alternates between 0 and 1 every time pause is pressed
RG0SAV: defb 0 ;keeping track of VDP register values
RG1SAV: defb 0
RG2SAV: defb 0
RG3SAV: defb 0
RG4SAV: defb 0
RG5SAV: defb 0
RG6SAV: defb 0
RG7SAV: defb 0
|
src/implementation/yaml-presenter-analysis.adb | robdaemon/AdaYaml | 32 | 29984 | -- part of AdaYaml, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "copying.txt"
package body Yaml.Presenter.Analysis is
function Features (S : String) return Scalar_Features is
Pos : Positive := S'First;
Cur : Character;
Cur_Word_Length : Natural := 0;
Cur_Line_Length : Natural := 0;
-- states
procedure Read_Beginning (Ret : out Scalar_Features) is
begin
if S'Length = 0 then
Ret := (Max_Word_Length => 0, Max_Line_Length => 0,
Single_Line_Length => 0, Quoting_Needed => Single,
Unquoted_Single_Line => True, Folding_Possible => True,
Contains_Non_Printable => False,
Leading_Spaces => 0, Trailing_Linefeeds => 0);
else
Ret := (Max_Word_Length => 0,
Max_Line_Length => 0,
Single_Line_Length => 0,
Quoting_Needed => None,
Unquoted_Single_Line => True,
Folding_Possible => True,
Contains_Non_Printable => False,
Leading_Spaces => 0,
Trailing_Linefeeds => 0);
Cur := S (Pos);
if Cur = ' ' then
Ret.Quoting_Needed := Single;
loop
Ret.Leading_Spaces := Ret.Leading_Spaces + 1;
Cur_Word_Length := Cur_Word_Length + 1;
Cur_Line_Length := Cur_Line_Length + 1;
Pos := Pos + 1;
exit when Pos > S'Last;
Cur := S (Pos);
exit when Cur /= ' ';
end loop;
end if;
end if;
end Read_Beginning;
procedure Read_Word (Ret : in out Scalar_Features) is
begin
if Cur = '#' then
Ret.Quoting_Needed :=
Necessary_Quoting'Max (Ret.Quoting_Needed, Single);
Ret.Unquoted_Single_Line := False;
end if;
loop
case Cur is
when ':' =>
Ret.Single_Line_Length := Ret.Single_Line_Length + 1;
if Pos < S'Last and then S (Pos + 1) = ' ' then
Ret.Quoting_Needed :=
Necessary_Quoting'Max (Ret.Quoting_Needed, Single);
Ret.Unquoted_Single_Line := False;
Pos := Pos + 1;
return;
end if;
when Character'Val (7) .. Character'Val (9) =>
Ret.Quoting_Needed := Double;
Ret.Single_Line_Length := Ret.Single_Line_Length + 2;
Ret.Contains_Non_Printable := True;
when '"' =>
if Pos = S'First then
Ret.Quoting_Needed :=
Necessary_Quoting'Max (Ret.Quoting_Needed, Single);
Ret.Single_Line_Length := Ret.Single_Line_Length + 2;
Ret.Unquoted_Single_Line := False;
else
Ret.Single_Line_Length := Ret.Single_Line_Length + 1;
end if;
when others =>
Ret.Single_Line_Length := Ret.Single_Line_Length + 1;
end case;
Pos := Pos + 1;
exit when Pos > S'Last;
Cur := S (Pos);
exit when Cur in ' ' | Character'Val (10);
Cur_Word_Length := Cur_Word_Length + 1;
Cur_Line_Length := Cur_Line_Length + 1;
end loop;
end Read_Word;
procedure Read_Newlines (Ret : in out Scalar_Features) is
begin
Ret.Max_Line_Length :=
Natural'Max (Ret.Max_Line_Length, Cur_Line_Length);
Cur_Line_Length := 0;
Ret.Max_Word_Length :=
Natural'Max (Ret.Max_Word_Length, Cur_Word_Length);
Cur_Word_Length := 0;
loop
Ret.Trailing_Linefeeds := Ret.Trailing_Linefeeds + 1;
Pos := Pos + 1;
exit when Pos > S'Last;
Cur := S (Pos);
exit when Cur /= Character'Val (10);
end loop;
if Pos <= S'Last then
Ret.Trailing_Linefeeds := 0;
end if;
end Read_Newlines;
procedure Read_Space_After_Word (Ret : in out Scalar_Features) is
begin
Cur_Line_Length := Cur_Line_Length + 1;
Ret.Single_Line_Length := Ret.Single_Line_Length + 1;
Pos := Pos + 1;
if Pos > S'Last then
Ret.Quoting_Needed :=
Necessary_Quoting'Max (Ret.Quoting_Needed, Single);
Ret.Unquoted_Single_Line := False;
Cur_Word_Length := Cur_Word_Length + 1;
Cur_Line_Length := Cur_Line_Length + 1;
return;
end if;
Cur := S (Pos);
if Cur in ' ' | Character'Val (10) then
Cur_Word_Length := Cur_Word_Length + 1;
while Cur = ' ' loop
Cur_Word_Length := Cur_Word_Length + 1;
Cur_Line_Length := Cur_Line_Length + 1;
Ret.Single_Line_Length := Ret.Single_Line_Length + 1;
Pos := Pos + 1;
exit when Pos > S'Last;
end loop;
else
Ret.Max_Word_Length :=
Natural'Max (Ret.Max_Word_Length, Cur_Word_Length);
Cur_Word_Length := 0;
end if;
end Read_Space_After_Word;
begin
return Ret : Scalar_Features do
Read_Beginning (Ret);
if Pos <= S'Last then
loop
Read_Word (Ret);
exit when Pos > S'Last;
loop
case Cur is
when ' ' => Read_Space_After_Word (Ret);
when Character'Val (10) => Read_Newlines (Ret);
when others => null; -- never happens
end case;
exit when Pos > S'Last or else
not (Cur in ' ' | Character'Val (10));
end loop;
exit when Pos > S'Last;
end loop;
end if;
end return;
end Features;
end Yaml.Presenter.Analysis;
|
oeis/159/A159058.asm | neoneye/loda-programs | 11 | 7192 | ; A159058: A102370(n) modulo 8 .
; 0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5,4,7,2,1,0,3,6,5
mov $1,$0
mod $1,2
mov $2,$0
add $0,$1
pow $2,2
add $0,$2
mod $0,8
|
test/Succeed/BlockOnFreshMeta.agda | redfish64/autonomic-agda | 0 | 11592 | <filename>test/Succeed/BlockOnFreshMeta.agda
module _ where
open import Common.Prelude hiding (_>>=_)
open import Common.Reflection
open import Common.Equality
infix 0 case_of_
case_of_ : ∀ {a b} {A : Set a} {B : Set b} → A → (A → B) → B
case x of f = f x
blockOnFresh : TC ⊤
blockOnFresh =
checkType unknown unknown >>= λ
{ (meta m _) → blockOnMeta m
; _ → typeError (strErr "impossible" ∷ []) }
macro
weirdButShouldWork : Tactic
weirdButShouldWork hole =
inferType hole >>= λ goal →
case goal of λ
{ (meta _ _) → blockOnFresh
; _ → unify hole (lit (nat 42))
}
-- When the goal is a meta the tactic will block on a different, fresh, meta.
-- That's silly, but should still work. Once the goal is resolved the tactic
-- doesn't block any more so everything should be fine.
thing : _
solves : Nat
thing = weirdButShouldWork
solves = thing
check : thing ≡ 42
check = refl
|
asm/codes/normal/timer_centiseconds.asm | brikr/practice-rom-patcher | 2 | 3842 | // Centisecond
origin 0x09DAB8
base 0x802E2AB8
addiu at, r0, 0x0A
origin 0x09DAF0
base 0x802E2AF0
mult t9, at
mflo t1
addiu at, r0, 0x03
div t1, at
mflo t2
sh t2, 0x24 (sp)
origin 0x09DB50
base 0x802E2B50
addiu a2, a2, 0x71D4
// Move Timer Slightly Left
origin 0x09DB12
base 0x802E2B12
dh 0x009E // Time Text X
origin 0x09DB26
base 0x802E2B26
dh 0x00D9 // Minutes X
origin 0x09DB3E
base 0x802E2B3E
dh 0x00ED // Seconds X
origin 0x09DB56
base 0x802E2B56
dh 0x010F // Tenths X
origin 0x09DB9E
base 0x802E2B9E
dh 0x00E3 // ' Separator X
origin 0x09DBB2
base 0x802E2BB2
dh 0x0106 // " Separator X
|
rom/src/protocol.asm | Gegel85/GBCGoogleMaps | 0 | 85361 | ; Sends a command to the micro controller
; Params:
; a -> Opecode
; hl -> Command data buffer
; bc -> Data size
; Return:
; None
; Registers:
; af -> Not preserved
; bc -> Not preserved
; de -> Not preserved
; hl -> Not preserved
sendCommand: MACRO
ld de, $A001
call copyMemory
ld a, \1
ld [$A000], a
ENDM
; Fetch the current tilemap to display from the server
; Params:
; b -> scrollX
; c -> scrollY
; Return:
; [tileMap - tileMap + $3FF] -> Loaded tilemap
; Registers:
; af -> Not preserved
; bc -> Not preserved
; de -> Not preserved
; hl -> Not preserved
getTileMap:
; Prepare the command
ld hl, myCmdBuffer
ld a, SERVER_REQU
ld [hli], a
ld a, 4
ld [hli], a
xor a
ld [hli], a
inc a
ld [hli], a
ld a, b
;sub $30
ld [hli], a
ld a, c
;sub $38
ld [hli], a
ld a, [zoomLevel]
ld [hli], a
xor a
ld [cartIntTrigger], a
ret
handlePacket::
ld hl, cartCmdBuffer
.loop:
ld a, [hli]
or a
jr z, .end
dec a
jr z, .wifi ; 1 WiFi status
dec a
jr z, .srvResp ; 2 Server Response
dec a
jr z, .err ; 3 Error
;dec a
;jr z, .queueFull ; 4 Data queue is full
.end:
xor a
ld [cartCmdBuffer], a
ret
.wifi:
ld a, [hli]
ld [wifiLevel], a
jr .loop
.srvResp:
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
push bc
push hl
call handleServerPacket
pop hl
pop bc
add hl, bc
jr .loop
.err:
ld de, VRAMBgStart
.errLoop:
ld a, [hli]
or a
jr z, .loop
ld [de], a
inc de
jr .errLoop
handleServerPacket::
ld a, [hli]
or a
ret z
dec a
jr z, .tilemap ; 1 Map data
dec a
jr z, .err ; 2 Error
ret
.err:
call waitVBLANK
reset lcdCtrl
ld de, VRAMBgStart
call copyMemory
reg lcdCtrl, LCD_BASE_CONTROL_BYTE
ret
.tilemap:
call waitVBLANK
reset lcdCtrl
ld bc, 32 * 32
ld de, VRAMBgStart
call fillMemory
ld bc, 32 * 18
ld de, VRAMBgStart
call copyMemory
reg lcdCtrl, LCD_MAP_CONTROL_BYTE
ret |
oeis/049/A049076.asm | neoneye/loda-programs | 11 | 177715 | <gh_stars>10-100
; A049076: Number of steps in the prime index chain for the n-th prime.
; 1,2,3,1,4,1,2,1,1,1,5,1,2,1,1,1,3,1,2,1,1,1,2,1,1,1,1,1,2,1,6,1,1,1,1,1,2,1,1,1,3,1,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,4,1,2,1,1,1,1,1,3,1,1,1,2,1,2,1,1,1,1,1,2,1,1,1,3,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1
mov $2,$0
mov $4,2
lpb $4
mov $0,$2
sub $4,1
add $0,$4
trn $0,1
seq $0,101184 ; a(n) = n + pi(n) + pi(pi(n)) + pi(pi(pi(n))) + pi(pi(pi(pi(n)))) + ...
mov $3,$4
mul $3,$0
add $5,$3
lpe
min $2,1
mul $2,$0
mov $0,$5
sub $0,$2
|
Assembly/Project/Chr.asm | Myself086/Project-Nested | 338 | 82088 | <filename>Assembly/Project/Chr.asm
// ---------------------------------------------------------------------------
.mx 0x00
.func Chr__LoadInitialBank
Chr__LoadInitialBank:
// Ingore this if we are using CHR RAM
lda $=RomInfo_ChrBankLut_lo
ora $=RomInfo_ChrBankLut_hi
bne $+b_1
return
b_1:
sep #0x20
.mx 0x20
.macro Chr__LoadInitialBank_Mac VramAddress
// Set Vram address
stz $0x2115
ldy #_Zero+{0}
sty $0x2116
// Set the DMA
ldy #0x1800
sty $0x4300
stz $0x4302
lda $=RomInfo_ChrBankLut_lo
sta $0x4303
lda $=RomInfo_ChrBankLut_hi
sta $0x4304
ldy #0x2000
sty $0x4305
lda #0x01
sta $0x420b
.endm
Chr__LoadInitialBank_Mac 0x0000
Chr__LoadInitialBank_Mac 0x4000
Chr__LoadInitialBank_Mac 0x6000
rep #0x20
.mx 0x00
return
// ---------------------------------------------------------------------------
.mx 0x00
.func Chr__Initialize
Chr__Initialize:
// Are we using CHR RAM?
lda $=RomInfo_ChrBankLut
ora $=RomInfo_ChrBankLut+0x100
bne $+b_1
// Are we cloning CHR RAM?
lda $=RomInfo_ChrRamClone-1
bpl $+b_2
// Allocate memory for the CHR RAM clone
lda #_ChrRam_CONSTBANK/0x10000
ldx #0x2000
call Memory__AllocInBank
// Return: A = Bank number, X = Memory address, Y = HeapStack pointer
txa
smx #0x20
ora #0
trapne
xba
sta $_ChrRam_Page
// Copy code to RAM
ldx #6
b_loop:
lda $=IO__r2007_ChrRamReadCode,x
sta $_ChrRam_Read,x
lda $=IO__r2007_ChrRamWriteCode,x
sta $_ChrRam_Write,x
// Next
dex
bpl $-b_loop
smx #0x00
b_2:
return
b_1:
// Load list of CHR bank sizes
.local =list, .vramPage
ldx $_Mapper_x2
lda $=Chr__Initialize_Switch,x
sta $.list
sep #0x21
.mx 0x20
lda #.Chr__Initialize_Switch/0x10000
sta $.list+2
.local .chrPageSize
lda $=RomInfo_ChrBankLut_lo+1
sbc $=RomInfo_ChrBankLut_lo+0
bne $+b_1
// Default size in case they both point to the same page
lda #0x20
b_1:
sta $.chrPageSize
ldy #0
stz $.vramPage
b_loop:
// Store VRAM address
lda $.vramPage
sta $_CHR_0_VramPage,y
// Store default banks (using software division)
//lda $.vramPage
ldx #0xffff
sec
b_loop2:
inx
sbc $.chrPageSize
bcs $-b_loop2
txa
sta $_CHR_SetsActive_0,y
sta $_CHR_SetsActive_1,y
sta $_CHR_SetsActive_2,y
// Store VRAM size
lda [$.list],y
sta $_CHR_0_PageLength,y
// Is this mapper supporting CHR changes? If not, exit out of this loop
beq $+b_exit
// Move VRAM address to next available page
clc
adc $.vramPage
sta $.vramPage
// Next
iny
cmp #0x20
bcc $-b_loop
b_exit:
// Erorr out if we have too many banks
cpy #9
trapcs
Exception "Too Many CHR Ranges{}{}{}Chr.Initialize attempted to allocate too many CHR ranges for bank switching."
// Store number of CHR banks for this mapper
tya
sta $_CHR_BanksInUse
asl a
sta $_CHR_BanksInUse_x2
// Return
rep #0x30
.mx 0x00
return
Chr__Initialize_Switch:
switch 0x100, Chr__Initialize_Switch_Default, Chr__Initialize_Switch_Default
Chr__Initialize_Switch_Default:
case 0
.data8 0x20
case 1
.data8 0x10, 0x10
case 4
.data8 0x08, 0x08, 0x04, 0x04, 0x04, 0x04
// ---------------------------------------------------------------------------
|
programs/oeis/337/A337985.asm | neoneye/loda | 22 | 22358 | <gh_stars>10-100
; A337985: a(n) is the exponent of the highest power of 2 dividing the n-th Bell number.
; 0,1,0,0,2,0,0,2,0,0,1,0,0,1,0,0,2,0,0,2,0,0,1,0,0,1,0,0,2,0,0,2,0,0,1,0,0,1,0,0,2,0,0,2,0,0,1,0,0,1,0,0,2,0,0,2,0,0,1,0,0,1,0,0,2,0,0,2,0,0,1,0,0,1,0,0,2,0,0,2,0,0,1,0,0,1,0
add $0,1
bin $0,2
dif $0,2
mod $0,3
|
examples/racing/src/player.adb | Fabien-Chouteau/GESTE | 13 | 9608 | with GESTE;
with GESTE.Tile_Bank;
with GESTE.Sprite.Rotated;
with GESTE_Config; use GESTE_Config;
with GESTE.Maths; use GESTE.Maths;
with GESTE.Physics;
with GESTE.Text;
with GESTE_Fonts.FreeMono6pt7b;
with Game_Assets.track_1;
with Game_Assets.Tileset;
with Interfaces; use Interfaces;
package body Player is
type Player_Type (Bank : not null GESTE.Tile_Bank.Const_Ref;
Init_Frame : GESTE_Config.Tile_Index)
is limited new GESTE.Physics.Object with record
Sprite : aliased GESTE.Sprite.Rotated.Instance (Bank, Init_Frame);
end record;
Tile_Bank : aliased GESTE.Tile_Bank.Instance
(Game_Assets.Tileset.Tiles'Access,
GESTE.No_Collisions,
Game_Assets.Palette'Access);
subtype Stat_Text is GESTE.Text.Instance
(Da_Font => GESTE_Fonts.FreeMono6pt7b.Font,
Number_Of_Columns => 15,
Number_Of_Lines => 1,
Foreground => 1,
Background => GESTE_Config.Transparent);
Next_Gate_Text : aliased Stat_Text;
Lap_Text : aliased Stat_Text;
Best_Text : aliased Stat_Text;
Current_Text : aliased Stat_Text;
Frame_Count : Unsigned_32 := 0;
Start : Game_Assets.Object renames
Game_Assets.track_1.Start.Objects (Game_Assets.track_1.Start.Objects'First);
P : aliased Player_Type (Tile_Bank'Access, 105);
Next_Gate : Natural := Game_Assets.track_1.gates.Objects'First;
Laps_Cnt : Natural := 0;
Best_Lap : Value := 0.0;
Current_Lap : Value := 0.0;
Do_Throttle : Boolean := False;
Do_Brake : Boolean := False;
Going_Left : Boolean := False;
Going_Right : Boolean := False;
function Inside_Gate (Obj : Game_Assets.Object) return Boolean;
-----------------
-- Inside_Gate --
-----------------
function Inside_Gate (Obj : Game_Assets.Object) return Boolean
is (P.Position.X in Obj.X .. Obj.X + Obj.Width
and then
P.Position.Y in Obj.Y .. Obj.Y + Obj.Height);
----------
-- Move --
----------
procedure Move (Pt : GESTE.Pix_Point) is
begin
P.Set_Position ((Value (Pt.X), Value (Pt.Y)));
end Move;
--------------
-- Position --
--------------
function Position return GESTE.Pix_Point
is ((Integer (P.Position.X), Integer (P.Position.Y)));
------------
-- Update --
------------
procedure Update (Elapsed : Value) is
Old : constant Point := P.Position;
Brake_Coef : Value;
Dir : constant Vect := P.Direction;
Traction : constant Vect := Dir * 10_000.0;
C_Drag : constant Value := 0.5 * 0.3 * 2.2 * 1.29;
VX : constant Value := P.Speed.X;
VY : constant Value := P.Speed.Y;
function Drag return Vect;
function Friction return Vect;
----------
-- Drag --
----------
function Drag return Vect is
Speed : constant Value := Magnitude (P.Speed);
begin
return (-(Value (C_Drag * VX) * Speed),
-(Value (C_Drag * VY) * Speed));
end Drag;
--------------
-- Friction --
--------------
function Friction return Vect is
C_TT : Value := 30.0 * C_Drag;
begin
if not GESTE.Collides ((Integer (Old.X), Integer (Old.Y))) then
-- Off track
C_TT := C_TT * 100;
end if;
return (-C_TT * VX, -C_TT * VY);
end Friction;
begin
Frame_Count := Frame_Count + 1;
if Going_Right then
P.Set_Angle (P.Angle - 0.060);
end if;
if Going_Left then
P.Set_Angle (P.Angle + 0.060);
end if;
if Do_Throttle then
P.Apply_Force (Traction);
end if;
if Do_Brake then
Brake_Coef := -120.0;
else
Brake_Coef := -90.0;
end if;
P.Apply_Force ((P.Speed.X * Brake_Coef, P.Speed.Y * Brake_Coef));
P.Apply_Force (Drag);
P.Apply_Force (Friction);
P.Step (Elapsed);
P.Set_Angle (P.Angle);
P.Sprite.Move ((Integer (P.Position.X) - 8,
Integer (P.Position.Y) - 8));
P.Sprite.Angle (P.Angle);
if Frame_Count mod 10 = 0 then
-- Update the current time every 10 frames
Current_Text.Clear;
Current_Text.Cursor (1, 1);
Current_Text.Put (Current_Lap'Img);
end if;
Current_Lap := Current_Lap + Elapsed;
if Inside_Gate (Game_Assets.track_1.gates.Objects (Next_Gate)) then
if Next_Gate = Game_Assets.track_1.gates.Objects'Last then
Next_Gate := Game_Assets.track_1.gates.Objects'First;
Laps_Cnt := Laps_Cnt + 1;
Lap_Text.Clear;
Lap_Text.Cursor (1, 1);
Lap_Text.Put ("Lap:" & Laps_Cnt'Img);
if Best_Lap = 0.0 or else Current_Lap < Best_Lap then
Best_Lap := Current_Lap;
Best_Text.Clear;
Best_Text.Cursor (1, 1);
Best_Text.Put ("Best:" & Best_Lap'Img);
end if;
Current_Lap := 0.0;
else
Next_Gate := Next_Gate + 1;
end if;
Next_Gate_Text.Clear;
Next_Gate_Text.Cursor (1, 1);
Next_Gate_Text.Put ("Next Gate:" & Next_Gate'Img);
end if;
Do_Throttle := False;
Do_Brake := False;
Going_Left := False;
Going_Right := False;
end Update;
--------------
-- Throttle --
--------------
procedure Throttle is
begin
Do_Throttle := True;
end Throttle;
-----------
-- Brake --
-----------
procedure Brake is
begin
Do_Brake := True;
end Brake;
---------------
-- Move_Left --
---------------
procedure Move_Left is
begin
Going_Left := True;
end Move_Left;
----------------
-- Move_Right --
----------------
procedure Move_Right is
begin
Going_Right := True;
end Move_Right;
begin
P.Set_Position ((Value (Start.X), Value (Start.Y)));
P.Set_Angle (Pi);
P.Set_Mass (90.0);
GESTE.Add (P.Sprite'Access, 3);
Next_Gate_Text.Move ((220, 0));
Next_Gate_Text.Put ("Next Gate: 0");
GESTE.Add (Next_Gate_Text'Access, 4);
Lap_Text.Move ((220, 10));
Lap_Text.Put ("Lap: 0");
GESTE.Add (Lap_Text'Access, 5);
Best_Text.Move ((220, 20));
Best_Text.Put ("Best: 0.0");
GESTE.Add (Best_Text'Access, 6);
Current_Text.Move ((260, 30));
GESTE.Add (Current_Text'Access, 7);
end Player;
|
src/gl/interface/gl-window.ads | Roldak/OpenGLAda | 79 | 23489 | <gh_stars>10-100
-- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
with GL.Types;
package GL.Window is
use GL.Types;
procedure Set_Viewport (X, Y : Int; Width, Height : Size);
procedure Get_Viewport (X, Y : out Int; Width, Height : out Size);
procedure Set_Depth_Range (Near, Far : Double);
procedure Get_Depth_Range (Near, Far : out Double);
end GL.Window;
|
programs/oeis/263/A263086.asm | neoneye/loda | 22 | 29763 | ; A263086: Partial sums of A099777, where A099777(n) gives the number of divisors of n-th even number.
; 2,5,9,13,17,23,27,32,38,44,48,56,60,66,74,80,84,93,97,105,113,119,123,133,139,145,153,161,165,177,181,188,196,202,210,222,226,232,240,250,254,266,270,278,290,296,300,312,318,327,335,343,347,359,367,377,385,391,395,411,415,421,433,441,449,461,465,473,481,493,497,512,516,522,534,542,550,562,566,578,588,594,598,614,622,628,636,646,650,668,676,684,692,698,706,720,724,733,745,757
lpb $0
mov $2,$0
sub $0,1
seq $2,99777 ; Number of divisors of 2n.
add $1,$2
lpe
add $1,2
mov $0,$1
|
alloy4fun_models/trashltl/models/11/ywtXcN7cGgN2uFhRL.als | Kaixi26/org.alloytools.alloy | 0 | 4780 | open main
pred idywtXcN7cGgN2uFhRL_prop12 {
eventually some f:File | f in Trash implies after f in Trash
}
pred __repair { idywtXcN7cGgN2uFhRL_prop12 }
check __repair { idywtXcN7cGgN2uFhRL_prop12 <=> prop12o } |
programs/oeis/335/A335807.asm | karttu/loda | 0 | 242058 | ; A335807: Number of vertices in the n-th simplex graph of the complete graph on three vertices (K_3).
; 3,8,21,54,140,365,954,2496,6533,17102,44772,117213,306866,803384,2103285,5506470,14416124,37741901,98809578,258686832,677250917,1773065918,4641946836,12152774589,31816376930,83296356200,218072691669,570921718806,1494692464748,3913155675437
mov $1,6
mov $3,1
lpb $0,1
sub $0,1
mov $2,2
add $3,$1
add $1,$3
mov $4,$3
lpe
sub $4,$2
add $0,$4
mul $0,3
mov $1,$0
div $1,3
add $1,3
|
Ada/inc/Problem_69.ads | Tim-Tom/project-euler | 0 | 3773 | <reponame>Tim-Tom/project-euler
package Problem_69 is
-- Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the
-- number of numbers less than n which are relatively prime to n. For example, as 1, 2, 4, 5, 7,
-- and 8, are all less than nine and relatively prime to nine, φ(9)=6.
--
-- It can be seen that n=6 produces a maximum n/φ(n) for n ≤ 10.
--
-- Find the value of n ≤ 1,000,000 for which n/φ(n) is a maximum.
procedure Solve;
end Problem_69;
|
hammerspoon/connect_sony.applescript | casjay-forks/rkalis-dotfiles | 0 | 2439 | <filename>hammerspoon/connect_sony.applescript
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth")
tell btMenu
click
try
tell (menu item "Rosco's Headphones" of menu 1)
click
if exists menu item "Connect" of menu 1 then
click menu item "Connect" of menu 1
return "Connecting..."
else if exists menu item "Disconnect" of menu 1 then
click menu item "Disconnect" of menu 1
return "Disconnecting..."
end if
end tell
end try
end tell
end tell
key code 53
return "Device not found or Bluetooth turned off"
end tell
|
oeis/227/A227152.asm | neoneye/loda-programs | 11 | 178814 | ; A227152: Nonnegative solutions of the Pell equation x^2 - 101*y^2 = +1. Solutions x = a(n).
; Submitted by <NAME>
; 1,201,80801,32481801,13057603201,5249124005001,2110134792407201,848268937423689801,341002002709530892801,137081956820293995216201,55106605639755476546020001,22152718385224881277504824201
mul $0,2
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,10
add $3,$2
lpe
mov $0,$3
|
programs/oeis/215/A215097.asm | jmorken/loda | 1 | 242553 | <gh_stars>1-10
; A215097: a(n) = n^3 - a(n-2) for n >= 2 and a(0)=0, a(1)=1.
; 0,1,8,26,56,99,160,244,352,485,648,846,1080,1351,1664,2024,2432,2889,3400,3970,4600,5291,6048,6876,7776,8749,9800,10934,12152,13455,14848,16336,17920,19601,21384,23274,25272,27379,29600,31940,34400,36981,39688,42526
mov $15,$0
mov $17,$0
lpb $17
clr $0,15
mov $0,$15
sub $17,1
sub $0,$17
mov $12,$0
mov $14,$0
lpb $14
clr $0,12
mov $0,$12
sub $14,1
sub $0,$14
mov $9,$0
mov $11,$0
lpb $11
mov $0,$9
sub $11,1
sub $0,$11
mul $0,2
mov $6,7
add $6,$0
lpb $0
mod $0,2
pow $6,2
mov $8,5
mul $8,$6
mov $1,$8
div $1,2
mod $1,8
mul $1,4
lpe
div $1,4
sub $1,1
add $10,$1
lpe
add $13,$10
lpe
add $16,$13
lpe
mov $1,$16
|
subs/tptrvptr.asm | DigitalMars/optlink | 28 | 94863 | <gh_stars>10-100
TITLE TPTRVPTR
INCLUDE MACROS
PUBLIC MAKE_TPTR_LINDEX
.DATA
EXTERNDEF SYM_HASH_MOD:DWORD
EXTERNDEF LNAME_LARRAY:LARRAY_STRUCT
.CODE ROOT_TEXT
EXTERNDEF ALLOC_LOCAL:PROC
MAKE_TPTR_LINDEX PROC
;
;CONVERT EAX TO LINDEX
;
PUSH ESI
MOV ESI,EAX
ASSUME ESI:PTR TPTR_STRUCT
MOV EAX,[EAX].TPTR_STRUCT._TP_LENGTH
PUSH EDI
ADD EAX,SIZE TPTR_STRUCT+SIZE PRETEXT_PTR_STRUCT-3 ;
CALL ALLOC_LOCAL ;ES:DI IS PHYS, AX LOG
LEA EDX,[EAX+4]
LEA EAX,[EAX+4]
INSTALL_POINTER_LINDEX LNAME_LARRAY
XOR ECX,ECX ;PTR TO MYCOMDAT STRUCTURE
MOV EAX,SYM_HASH_MOD ;MODULE # IF LOCAL
MOV [EDX-4],ECX
MOV ECX,[ESI]._TP_LENGTH
ASSUME EDX:PTR TPTR_STRUCT
MOV [EDX]._TP_FLAGS,EAX
MOV [EDX]._TP_LENGTH,ECX
SHR ECX,2
MOV EAX,[ESI]._TP_HASH
INC ECX
MOV [EDX]._TP_HASH,EAX
LEA ESI,[ESI]._TP_TEXT
LEA EDI,[EDX]._TP_TEXT
OPTI_MOVSD
POPM EDI,ESI
MOV EAX,LNAME_LARRAY._LARRAY_LIMIT
RET
MAKE_TPTR_LINDEX ENDP
END
|
bundler/AlfredBundler.applescript | shawnrice/alfred-bundler | 9 | 1963 | (* ///
GLOBAL PROPERTIES/VARIABLES
/// *)
--# Current Alfred-Bundler version
property BUNDLER_VERSION : "devel"
--# Path to Alfred-Bundler's root directory
on get_bundler_dir()
return (POSIX path of (path to home folder as text)) & "Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-" & BUNDLER_VERSION
end get_bundler_dir
--# Path to Alfred-Bundler's data directory
on get_data_dir()
return (my get_bundler_dir()) & "/data"
end get_data_dir
--# Path to main Applescript Bundler
on get_as_bundler()
return (my get_bundler_dir()) & "/bundler/AlfredBundler.scpt"
end get_as_bundler
--# Path to applescript libraries directory
on get_as_dir()
return (my get_data_dir()) & "/assets/applescript"
end get_as_dir
--# Path to utilities directory
on get_utils_dir()
return (my get_data_dir()) & "/assets/utility"
end get_utils_dir
--# Path to icons directory
on get_icons_dir()
return (my get_data_dir()) & "/assets/icons"
end get_icons_dir
--# Path to bundler log file
on get_logfile()
set unformatted_path to (my get_data_dir()) & "/logs/bundler-{}.log"
set BUNDLER_LOGFILE to my formatter(unformatted_path, BUNDLER_VERSION)
end get_logfile
(* ///
USER API
/// *)
on library(_name, _version, _json_path)
(* Get path to specified AppleScript library, installing it first if necessary.
Use this method to access AppleScript libraries with functions for common commands.
This function will return script object of the appropriate library
(installing it first if necessary), which grants you access to all the
functions within that library.
You can easily add your own utilities by means of JSON configuration
files specified with the ``json_path`` argument. Please see
`the Alfred Bundler documentation <http://shawnrice.github.io/alfred-bundler/>`_
for details of the JSON file format.
:param _name: Name of the utility/asset to install
:type _name: ``string``
:param _version: (optional) Desired version of the utility/asset.
:type _version: ``string``
:param _json_path: (optional) Path to bundler configuration file
:type _json_path: ``string`` (POSIX path)
:returns: Path to utility
:rtype: ``script object``
*)
--# partial support for "optional" args in Applescript
if my is_empty(_version) then
set _version to "latest"
end if
if my is_empty(_json_path) then
set _json to ""
end if
--# path to specific utility
set _library to my joiner({my get_as_dir(), _name, _version}, "/")
if my folder_exists(_library) = false then
--# if utility isn't already installed
set bash_bundlet to (my dirname(my get_as_bundler())) & "bundlets/alfred.bundler.sh"
if my file_exists(bash_bundlet) = true then
set bash_bundlet_cmd to quoted form of bash_bundlet
set cmd to my joiner({bash_bundlet_cmd, "applescript", _name, _version, _json_path}, space)
set cmd to my prepare_cmd(cmd)
my logger("library", "89", "INFO", my formatter("Running shell command: `{}`...", cmd))
set full_path to (do shell script cmd)
return load script full_path
else
set error_msg to my logger("library", "93", "ERROR", my formatter("Internal bash bundlet `{}` does not exist.", bash_bundlet))
error error_msg number 1
end if
else
--# if utility is already installed
my logger("library", "98", "INFO", my formatter("Library at `{}` found...", _library))
--# read utilities invoke file
set invoke_file to _library & "/invoke"
if my file_exists(invoke_file) = true then
set invoke_path to my read_file(invoke_file)
--# combine utility path with invoke path
set full_path to _library & "/" & invoke_path
return load script full_path
else
set error_msg to my logger("library", "107", "ERROR", my formatter("Internal invoke file `{}` does not exist.", invoke_file))
error error_msg number 1
end if
end if
end library
on utility(_name, _version, _json_path)
(* Get path to specified utility or asset, installing it first if necessary.
Use this method to access common command line utilities, such as
`cocaoDialog <http://mstratman.github.io/cocoadialog/>`_ or
`Terminal-Notifier <https://github.com/alloy/terminal-notifier>`_.
This function will return the path to the appropriate executable
(installing it first if necessary), which you can then utilise via
:command:`do shell script`.
You can easily add your own utilities by means of JSON configuration
files specified with the ``json_path`` argument. Please see
`the Alfred Bundler documentation <http://shawnrice.github.io/alfred-bundler/>`_
for details of the JSON file format.
:param _name: Name of the utility/asset to install
:type _name: ``string``
:param _version: (optional) Desired version of the utility/asset.
:type _version: ``string``
:param _json_path: (optional) Path to bundler configuration file
:type _json_path: ``string`` (POSIX path)
:returns: Path to utility
:rtype: ``string`` (POSIX path)
*)
--# partial support for "optional" args in Applescript
if my is_empty(_version) then
set _version to "latest"
end if
if my is_empty(_json_path) then
set _json to ""
end if
--# path to specific utility
set _utility to my joiner({my get_utils_dir(), _name, _version}, "/")
if my folder_exists(_utility) = false then
--# if utility isn't already installed
set bash_bundlet to (my dirname(my get_as_bundler())) & "bundlets/alfred.bundler.sh"
if my file_exists(bash_bundlet) = true then
set bash_bundlet_cmd to quoted form of bash_bundlet
set cmd to my joiner({bash_bundlet_cmd, "utility", _name, _version, _json_path}, space)
set cmd to my prepare_cmd(cmd)
my logger("utility", "156", "INFO", my formatter("Running shell command: `{}`...", cmd))
set full_path to (do shell script cmd)
return full_path
else
set error_msg to my logger("utility", "160", "ERROR", my formatter("Internal bash bundlet `{}` does not exist.", bash_bundlet))
error error_msg number 1
--##TODO: need a stable error number schema
end if
else
--# if utility is already installed
my logger("utility", "166", "INFO", my formatter("Utility at `{}` found...", _utility))
--# read utilities invoke file
set invoke_file to _utility & "/invoke"
if my file_exists(invoke_file) = true then
set invoke_path to my read_file(invoke_file)
--# combine utility path with invoke path
set full_path to _utility & "/" & invoke_path
return full_path
else
set error_msg to my logger("utility", "175", "ERROR", my formatter("Internal invoke file `{}` does not exist.", invoke_file))
error error_msg number 1
--##TODO: need a stable error number schema
end if
end if
end utility
on icon(_font, _name, _color, _alter)
(* Get path to specified icon, downloading it first if necessary.
``_font``, ``_icon`` and ``_color`` are normalised to lowercase. In
addition, ``_color`` is expanded to 6 characters if only 3 are passed.
:param _font: name of the font
:type _font: ``string``
:param _icon: name of the font character
:type _icon: ``string``
:param _color: (optional) CSS colour in format "xxxxxx" (no preceding #)
:type _color: ``string``
:param _alter: (optional) Automatically adjust icon colour to light/dark theme background
:type _alter: ``Boolean``
:returns: path to icon file
:rtype: ``string``
See http://icons.deanishe.net to view available icons.
*)
--# partial support for "optional" args in Applescript
if my is_empty(_color) then
set _color to "000000"
if my is_empty(_alter) then
set _alter to true
end if
end if
if my is_empty(_alter) then
set _alter to false
end if
--# path to specific icon
set _icon to my joiner({my get_icons_dir(), _font, _color, _name}, "/")
if my folder_exists(_icon) = false then
--# if icon isn't already installed
set bash_bundlet to (my dirname(my get_as_bundler())) & "bundlets/alfred.bundler.sh"
if my file_exists(bash_bundlet) = true then
set bash_bundlet_cmd to quoted form of bash_bundlet
set cmd to my joiner({bash_bundlet_cmd, "icon", _font, _name, _color, _alter}, space)
set cmd to my prepare_cmd(cmd)
my logger("icon", "222", "INFO", my formatter("Running shell command: `{}`...", cmd))
set full_path to (do shell script cmd)
else
set error_msg to my logger("icon", "225", "ERROR", my formatter("Internal bash bundlet `{}` does not exist.", bash_bundlet))
error error_msg number 1
end if
else
--# if icon is already installed
my logger("icon", "230", "INFO", my formatter("Icon at `{}` found...", _icon))
return _icon
end if
end icon
(* ///
LOGGING HANDLER
/// *)
on logger(_handler, line_num, _level, _message)
(* Log information in the standard Alfred-Bundler log file.
This AppleScript logger will save the `_message` with appropriate information
in this format:
'[%(asctime)s] [%(filename)s:%(lineno)s] '
'[%(levelname)s] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
It will then return the information in this format:
'[%(asctime)s] [%(filename)s:%(lineno)s] '
'[%(levelname)s] %(message)s',
datefmt='%H:%M:%S'
:param: _handler: name of the function where the script it running
:type _handler: ``string``
:param: line_num: number of the line of action for logging
:type line_num: ``string``
:param _level: type of logging information (INFO or DEBUG)
:type _level: ``string``
:param _message: message to be logged
:type _message: ``string``
:returns: a properly formatted log message
:rtype: ``string``
do shell script "echo " & theLine & " >> ~/Library/Logs/AppleScript-events.log"
*)
--# Ensure log file exists, with checking for scope of global var
try
my check_file(my get_logfile())
on error
set my get_logfile() to my formatter((my get_data_dir() & "/logs/bundler-{}.log"), BUNDLER_VERSION)
my check_file(my get_logfile())
end try
--# delay to ensure IO action is completed
delay 0.1
--# Prepare time string format %Y-%m-%d %H:%M:%S
set log_time to "[" & (my date_formatter()) & "]"
set formatterted_time to text items 1 thru -4 of (time string of (current date)) as string
set error_time to "[" & formatterted_time & "]"
--# Prepare location message
set _location to "[bundler.scpt:" & _handler & ":" & line_num & "]"
--# Prepare level message
set _level to "[" & _level & "]"
--# Generate full error message for logging
set log_msg to (my joiner({log_time, _location, _level, _message}, space)) & (ASCII character 10)
my write_to_file(log_msg, my get_logfile(), true)
--# Generate regular error message for returning to user
set error_msg to error_time & space & _location & space & _level & space & _message
return error_msg
end logger
(* ///
SUB-ACTION HANDLERS
/// *)
on date_formatter()
(* Format current date and time into %Y-%m-%d %H:%M:%S string format.
:returns: Formatted date-time stamp
:rtype: ``string``
*)
set {year:y, month:m, day:d} to current date
set date_num to (y * 10000 + m * 100 + d) as string
set formatterted_date to ((text 1 thru 4 of date_num) & "-" & (text 5 thru 6 of date_num) & "-" & (text 7 thru 8 of date_num))
set formatterted_time to text items 1 thru -4 of (time string of (current date)) as string
return formatterted_date & space & formatterted_time
end date_formatter
on prepare_cmd(cmd)
(* Ensure shell `_cmd` is working from the proper directory.
:param _cmd: Shell command to be run in `do shell script`
:type _cmd: ``string``
:returns: Shell command with `pwd` set properly
:returns: ``string``
*)
set pwd to quoted form of (my pwd())
return "cd " & pwd & "; bash " & cmd
end prepare_cmd
(* ///
IO HELPER FUNCTIONS
/// *)
on write_to_file(this_data, target_file, append_data)
(* Write or append `this_data` to `target_file`.
:param this_data: The text to be written to the file
:type this_data: ``string``
:param target_file: Full path to the file to be written to
:type target_file: ``string`` (POSIX path)
:param append_data: Overwrite or append text to file?
:type append_data: ``Boolean``
:returns: Was the write successful?
:rtype: ``Boolean``
*)
try
set the target_file to the target_file as string
set the open_target_file to open for access POSIX file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
on read_file(target_file)
(* Read data from `target_file`.
:param target_file: Full path to the file to be written to
:type target_file: ``string`` (POSIX path)
:returns: Data contained in `target_file`
:rtype: ``string``
*)
open for access POSIX file target_file
set _contents to (read target_file)
close access target_file
return _contents
end read_file
on pwd()
(* Get path to "present working directory", i.e. the workflow's root directory.
:returns: Path to this script's parent directory
:rtype: ``string`` (POSIX path)
*)
set {ASTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
set _path to (text items 1 thru -2 of (POSIX path of (path to me)) as string) & "/"
set AppleScript's text item delimiters to ASTID
return _path
end pwd
on dirname(_file)
(* Get name of directory containing `_file`.
:param _file: Full path to existing file
:type _file: ``string`` (POSIX path)
:returns: Full path to `_file`'s parent directory
:rtype: ``string`` (POSIX path)
*)
set {ASTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
set _path to (text items 1 thru -2 of _file as string) & "/"
set AppleScript's text item delimiters to ASTID
return _path
end dirname
on check_dir(_folder)
(* Check if `_folder` exists, and if not create it and any sub-directories.
:returns: POSIX path to `_folder`
:rtype: ``string`` (POSIX path)
*)
if not my folder_exists(_folder) then
do shell script "mkdir -p " & (quoted form of _folder)
end if
return _folder
end check_dir
on check_file(_path)
(* Check if `_path` exists, and if not create it and its directory tree.
:returns: POSIX path to `_path`
:rtype: ``string`` (POSIX path)
*)
if not my file_exists(_path) then
set _dir to dirname(_path)
my check_dir(_dir)
delay 0.1
do shell script "touch " & (quoted form of _path)
end if
end check_file
on folder_exists(_folder)
(* Return ``true`` if `_folder` exists, else ``false``
:param _folder: Full path to directory
:type _folder: ``string`` (POSIX path)
:returns: ``Boolean``
*)
if my path_exists(_folder) then
tell application "System Events"
return (class of (disk item _folder) is folder)
end tell
end if
return false
end folder_exists
on file_exists(_file)
(* Return ``true`` if `_file` exists, else ``false``
:param _file: Full path to file
:type _file: ``string`` (POSIX path)
:returns: ``Boolean``
*)
if my path_exists(_file) then
tell application "System Events"
return (class of (disk item _file) is file)
end tell
end if
return false
end file_exists
on path_exists(_path)
(* Return ``true`` if `_path` exists, else ``false``
:param _path: Any POSIX path (file or folder)
:type _path: ``string`` (POSIX path)
:returns: ``Boolean``
*)
if _path is missing value or my is_empty(_path) then return false
try
if class of _path is alias then return true
if _path contains ":" then
alias _path
return true
else if _path contains "/" then
POSIX file _path as alias
return true
else
return false
end if
on error msg
return false
end try
end path_exists
(* ///
TEXT HELPER FUNCTIONS
/// *)
on split(str, delim)
(* Split a string into a list
:param str: A text string
:type str: ``string``
:param delim: Where to split `str` into pieces
:type delim: ``string``
:returns: the split list
:rtype: ``list``
*)
local delim, str, ASTID
set ASTID to AppleScript's text item delimiters
try
set AppleScript's text item delimiters to delim
set str to text items of str
set AppleScript's text item delimiters to ASTID
return str --> list
on error msg number num
set AppleScript's text item delimiters to ASTID
error "Can't explode: " & msg number num
end try
end split
on formatter(str, arg)
(* Replace `{}` in `str` with `arg`
:param str: A text string with one instance of `{}`
:type str: ``string``
:param arg: The text to replace `{}`
:type arg: ``string``
:returns: trimmed string
:rtype: ``string``
*)
local ASTID, str, arg, lst
set ASTID to AppleScript's text item delimiters
try
considering case
set AppleScript's text item delimiters to "{}"
set lst to every text item of str
set AppleScript's text item delimiters to arg
set str to lst as string
end considering
set AppleScript's text item delimiters to ASTID
return str
on error msg number num
set AppleScript's text item delimiters to ASTID
error "Can't replaceString: " & msg number num
end try
end formatter
on trim(_str)
(* Remove white space from beginning and end of `_str`
:param _str: A text string
:type _str: ``string``
:returns: trimmed string
:rtype: ``string``
*)
if class of _str is not text or class of _str is not string or _str is missing value then return _str
if _str is "" then return _str
repeat while _str begins with " "
try
set _str to items 2 thru -1 of _str as text
on error msg
return ""
end try
end repeat
repeat while _str ends with " "
try
set _str to items 1 thru -2 of _str as text
on error
return ""
end try
end repeat
return _str
end trim
on joiner(pieces, delim)
(* Join list of `pieces` into a string delimted by `delim`.
:param pieces: A list of objects
:type pieces: ``list``
:param delim: The text item by which to join the list items
:type delim: ``string``
:returns: trimmed string
:rtype: ``string``
*)
local delim, pieces, ASTID
set ASTID to AppleScript's text item delimiters
try
set AppleScript's text item delimiters to delim
set pieces to "" & pieces
set AppleScript's text item delimiters to ASTID
return pieces --> text
on error emsg number eNum
set AppleScript's text item delimiters to ASTID
error "Can't implode: " & emsg number eNum
end try
end joiner
(* ///
LOWER LEVEL HELPER FUNCTIONS
/// *)
on is_empty(_obj)
(* Return ``true`` if `_obj ` is empty, else ``false``
:param _obj: Any Applescript type
:type _obj: (optional)
:rtype: ``Boolean``
*)
if {true, false} contains _obj then return false
if _obj is missing value then return true
return length of (my trim(_obj)) is 0
end is_empty |
programs/oeis/192/A192746.asm | karttu/loda | 0 | 80110 | ; A192746: Constant term of the reduction by x^2 -> x+1 of the polynomial p(n,x) defined below in Comments.
; 1,5,9,17,29,49,81,133,217,353,573,929,1505,2437,3945,6385,10333,16721,27057,43781,70841,114625,185469,300097,485569,785669,1271241,2056913,3328157,5385073,8713233,14098309,22811545,36909857,59721405,96631265
mov $1,1
mov $3,2
lpb $0,1
sub $0,1
mov $2,$1
mov $1,$3
add $3,$2
lpe
sub $1,1
mul $1,4
add $1,1
|
unittests/ASM/Primary/Primary_AE_REPNE_down.asm | cobalt2727/FEX | 628 | 102475 | %ifdef CONFIG
{
"RegData": {
"RCX": "5",
"RDI": "0xE000000D"
},
"MemoryRegions": {
"0x100000000": "4096"
}
}
%endif
mov rdx, 0xe0000000
mov rax, 0x4142434445464748
mov [rdx + 8 * 0], rax
mov rax, 0x5161535455565758
mov [rdx + 8 * 1], rax
mov rax, 0x0
mov [rdx + 8 * 2], rax
lea rdi, [rdx + 8 * 2]
std
mov rax, 0x61
mov rcx, 8
cmp rax, 0
repne scasb
hlt
|
sources/ippcp/asm_intel64/pcppurgeblkm7as.asm | idesai/ipp-crypto | 1 | 24546 | ;===============================================================================
; Copyright 2014-2018 Intel Corporation
; All Rights Reserved.
;
; If this software was obtained under the Intel Simplified Software License,
; the following terms apply:
;
; The source code, information and material ("Material") contained herein is
; owned by Intel Corporation or its suppliers or licensors, and title to such
; Material remains with Intel Corporation or its suppliers or licensors. The
; Material contains proprietary information of Intel or its suppliers and
; licensors. The Material is protected by worldwide copyright laws and treaty
; provisions. No part of the Material may be used, copied, reproduced,
; modified, published, uploaded, posted, transmitted, distributed or disclosed
; in any way without Intel's prior express written permission. No license under
; any patent, copyright or other intellectual property rights in the Material
; is granted to or conferred upon you, either expressly, by implication,
; inducement, estoppel or otherwise. Any license under such intellectual
; property rights must be express and approved by Intel in writing.
;
; Unless otherwise agreed by Intel in writing, you may not remove or alter this
; notice or any other notice embedded in Materials by Intel or Intel's
; suppliers or licensors in any way.
;
;
; If this software was obtained under the Apache License, Version 2.0 (the
; "License"), the following terms apply:
;
; You may not use this file except in compliance with the License. You may
; obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
;
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;
; See the License for the specific language governing permissions and
; limitations under the License.
;===============================================================================
;
;
; Purpose: Cryptography Primitive.
; Purge block
;
;
;
include asmdefs.inc
include ia_32e.inc
IF _IPP32E GE _IPP32E_M7
IPPCODE SEGMENT 'CODE' ALIGN (IPP_ALIGN_FACTOR)
;***************************************************************
;* Purpose: Clear memory block
;*
;* void PurgeBlock(Ipp8u *pDst, int len)
;*
;***************************************************************
;;
;; Lib = M7
;;
ALIGN IPP_ALIGN_FACTOR
IPPASM PurgeBlock PROC PUBLIC FRAME
USES_GPR rsi,rdi
USES_XMM
COMP_ABI 2
;; rdi: pDst: PTR BYTE, ; mem being clear
;; rsi: len: DWORD ; length
movsxd rcx, esi ; store stream length
xor rax, rax
sub rcx, sizeof(qword)
jl test_purge
purge8:
mov qword ptr[rdi], rax ; clear
add rdi, sizeof(qword)
sub rcx, sizeof(qword)
jge purge8
test_purge:
add rcx, sizeof(qword)
jz quit
purge1:
mov byte ptr[rdi], al
add rdi, sizeof(byte)
sub rcx, sizeof(byte)
jg purge1
quit:
REST_XMM
REST_GPR
ret
IPPASM PurgeBlock ENDP
ENDIF
END
|
programs/oeis/047/A047809.asm | neoneye/loda | 22 | 26040 | <reponame>neoneye/loda
; A047809: a(n) counts different values of i^2+j^2+k^2 <= n^2 or number of distances from the origin to all integer points inside a sphere of radius n.
; 1,2,5,9,15,23,32,43,55,70,86,103,122,143,166,190,215,243,273,304,336,371,406,443,482,523,566,611,656,704,753,803,855,910,966,1024,1083,1145,1207,1270,1336,1404,1474,1544,1616,1690,1766,1843,1922,2004,2086,2170,2256,2344,2434,2524,2616,2711,2807,2905,3003,3104,3206,3310,3415,3523,3633,3744,3856,3971,4087,4205,4323,4445,4568,4691,4817,4944,5073,5204,5336,5471,5607,5745,5884,6024,6167,6311,6456,6604,6753,6904,7056,7210,7366,7524,7682,7844,8007,8171
pow $0,2
seq $0,71377 ; Number of positive integers <= n which are the sum of 3 squares.
|
SOAS/Families/Core.agda | JoeyEremondi/agda-soas | 39 | 7957 | <reponame>JoeyEremondi/agda-soas
-- Category of indexed families
module SOAS.Families.Core {T : Set} where
open import SOAS.Common
open import SOAS.Context {T}
open import SOAS.Sorting {T}
-- | Unsorted
-- Sets indexed by a context
Family : Set₁
Family = Ctx → Set
-- Indexed functions between families
_⇾_ : Family → Family → Set
X ⇾ Y = ∀{Γ : Ctx} → X Γ → Y Γ
infixr 10 _⇾_
-- Category of indexed families of sets and indexed functions between them
𝔽amilies : Category 1ℓ 0ℓ 0ℓ
𝔽amilies = categoryHelper record
{ Obj = Family
; _⇒_ = _⇾_
; _≈_ = λ {X}{Y} f g → ∀{Γ : Ctx}{x : X Γ} → f x ≡ g x
; id = id
; _∘_ = λ g f → g ∘ f
; assoc = refl
; identityˡ = refl
; identityʳ = refl
; equiv = record { refl = refl ; sym = λ p → sym p ; trans = λ p q → trans p q }
; ∘-resp-≈ = λ where {f = f} p q → trans (cong f q) p
}
module 𝔽am = Category 𝔽amilies
-- | Sorted
-- Category of sorted families
𝔽amiliesₛ : Category 1ℓ 0ℓ 0ℓ
𝔽amiliesₛ = 𝕊orted 𝔽amilies
module 𝔽amₛ = Category 𝔽amiliesₛ
-- Type of sorted families
Familyₛ : Set₁
Familyₛ = 𝔽amₛ.Obj
-- Maps between sorted families
_⇾̣_ : Familyₛ → Familyₛ → Set
_⇾̣_ = 𝔽amₛ._⇒_
infixr 10 _⇾̣_
-- Turn sorted family into unsorted by internally quantifying over the sort
∀[_] : Familyₛ → Family
∀[ 𝒳 ] Γ = {τ : T} → 𝒳 τ Γ
-- Maps between Familyₛ functors
_⇾̣₂_ : (Familyₛ → Familyₛ) → (Familyₛ → Familyₛ) → Set₁
(𝓧 ⇾̣₂ 𝓨) = {𝒵 : Familyₛ} → 𝓧 𝒵 ⇾̣ 𝓨 𝒵
|
src/linux/helios-monitor-cpu.ads | stcarrez/helios | 1 | 10855 | <filename>src/linux/helios-monitor-cpu.ads
-----------------------------------------------------------------------
-- helios-monitor-cpu -- Linux CPU monitor
-- Copyright (C) 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package Helios.Monitor.CPU is
type Agent_Type is new Helios.Monitor.Agent_Type with record
User_Time : Schemas.Definition_Type_Access;
Nice_Time : Schemas.Definition_Type_Access;
Sys_Time : Schemas.Definition_Type_Access;
Idle_Time : Schemas.Definition_Type_Access;
Iowait_Time : Schemas.Definition_Type_Access;
Irq_Time : Schemas.Definition_Type_Access;
Softirq_Time : Schemas.Definition_Type_Access;
Steal_Time : Schemas.Definition_Type_Access;
Guest_Time : Schemas.Definition_Type_Access;
Guest_Nice_Time : Schemas.Definition_Type_Access;
Ctx_Count : Schemas.Definition_Type_Access;
Softirq_Count : Schemas.Definition_Type_Access;
Processes_Count : Schemas.Definition_Type_Access;
Running_Count : Schemas.Definition_Type_Access;
Blocked_Count : Schemas.Definition_Type_Access;
Intr_Count : Schemas.Definition_Type_Access;
end record;
-- Start the agent and build the definition tree.
overriding
procedure Start (Agent : in out Agent_Type;
Config : in Util.Properties.Manager);
-- Collect the values in the snapshot.
overriding
procedure Collect (Agent : in out Agent_Type;
Values : in out Datas.Snapshot_Type);
end Helios.Monitor.CPU;
|
books_and_notes/professional_courses/Assembly_language_and_programming/sources/汇编语言程序设计教程第四版/codes/4_19.asm | gxw1/review_the_national_post-graduate_entrance_examination | 640 | 19389 | CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 100H
START: JMP BEGIN
A DW 3CC8H
DW ?
BEGIN: MOV AX,CS
MOV DS,AX
LEA BX,A
MOV AX,[BX]
AND AX,0FF0H
INC BX
INC BX
MOV [BX],AX
MOV AH,4CH
INT 21H
CODE ENDS
END START
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_430.asm | ljhsiun2/medusa | 9 | 167505 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x19989, %rsi
lea addresses_normal_ht+0x7b2b, %rdi
nop
nop
nop
nop
sub $49333, %rax
mov $30, %rcx
rep movsb
nop
nop
cmp %r14, %r14
lea addresses_D_ht+0x1013, %r8
nop
cmp $34497, %r11
mov $0x6162636465666768, %rdi
movq %rdi, (%r8)
xor %r14, %r14
lea addresses_UC_ht+0x1802b, %r14
nop
nop
sub $10509, %rcx
mov $0x6162636465666768, %r11
movq %r11, %xmm3
movups %xmm3, (%r14)
nop
nop
nop
nop
nop
and $10802, %rcx
lea addresses_normal_ht+0xbd87, %rsi
nop
xor $33611, %rax
movl $0x61626364, (%rsi)
xor $44037, %r8
lea addresses_WC_ht+0x1560b, %rax
nop
nop
nop
nop
nop
add %r14, %r14
movw $0x6162, (%rax)
nop
nop
nop
nop
dec %rsi
lea addresses_normal_ht+0xd4ab, %r11
clflush (%r11)
nop
nop
add $12443, %r14
mov (%r11), %r8d
nop
nop
nop
nop
inc %r14
lea addresses_A_ht+0x14b2b, %rsi
lea addresses_normal_ht+0x3eab, %rdi
nop
nop
nop
nop
and %r10, %r10
mov $93, %rcx
rep movsw
nop
nop
dec %r11
lea addresses_WC_ht+0xc36b, %r11
inc %r10
mov $0x6162636465666768, %rcx
movq %rcx, (%r11)
nop
xor $16615, %rsi
lea addresses_WC_ht+0x1552b, %rax
nop
add %rdi, %rdi
movw $0x6162, (%rax)
nop
nop
cmp $7116, %rax
lea addresses_D_ht+0x1b43b, %rax
nop
nop
nop
nop
inc %rsi
movl $0x61626364, (%rax)
nop
nop
sub $47958, %rsi
lea addresses_A_ht+0xc92b, %rcx
nop
cmp $15522, %r14
movb (%rcx), %r8b
nop
nop
cmp $60593, %r10
lea addresses_normal_ht+0x657b, %rsi
lea addresses_normal_ht+0x2669, %rdi
nop
nop
lfence
mov $68, %rcx
rep movsw
nop
nop
nop
xor $48806, %rsi
lea addresses_normal_ht+0x89e9, %r11
dec %r8
mov (%r11), %rsi
nop
cmp $32923, %r8
lea addresses_D_ht+0x11b60, %r8
nop
nop
nop
nop
nop
sub %rsi, %rsi
movw $0x6162, (%r8)
nop
nop
nop
inc %r11
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %rdi
push %rdx
// Faulty Load
lea addresses_RW+0x1852b, %r13
dec %rdi
movntdqa (%r13), %xmm6
vpextrq $0, %xmm6, %r15
lea oracles, %rdi
and $0xff, %r15
shlq $12, %r15
mov (%rdi,%r15,1), %r15
pop %rdx
pop %rdi
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': True, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 6, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
part1/relations/Relations.agda | akiomik/plfa-solutions | 1 | 2307 | <reponame>akiomik/plfa-solutions
module Relations where
-- Imports
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; cong)
open import Data.Nat using (ℕ; zero; suc; _+_)
open import Data.Nat.Properties using (+-comm)
-- Defining relations
data _≤_ : ℕ → ℕ → Set where
z≤n : ∀ {n : ℕ}
--------
→ zero ≤ n
s≤s : ∀ {m n : ℕ}
→ m ≤ n
-------------
→ suc m ≤ suc n
_ : 2 ≤ 4
_ = s≤s (s≤s z≤n)
-- Implicit arguments
_ : 2 ≤ 4
_ = s≤s {1} {3} (s≤s {0} {2} (z≤n {2}))
_ : 2 ≤ 4
_ = s≤s {m = 1} {n = 3} (s≤s {m = 0} {n = 2} (z≤n {n = 2}))
_ : 2 ≤ 4
_ = s≤s {n = 3} (s≤s {n = 2} z≤n)
-- Precedence
infix 4 _≤_
-- Inversion
inv-s≤s : ∀ {m n : ℕ}
→ suc m ≤ suc n
-------------
→ m ≤ n
inv-s≤s (s≤s m≤n) = m≤n
inv-z≤n : ∀ {m : ℕ}
→ m ≤ zero
--------
→ m ≡ zero
inv-z≤n z≤n = refl
-- Reflexivity (反射律)
≤-refl : ∀ {n : ℕ}
-----
→ n ≤ n
≤-refl {zero} = z≤n
≤-refl {suc n} = s≤s ≤-refl
-- Transitivity (推移律)
≤-trans : ∀ {m n p : ℕ}
→ m ≤ n
→ n ≤ p
-----
→ m ≤ p
≤-trans z≤n _ = z≤n
≤-trans (s≤s m≤n) (s≤s n≤p) = s≤s (≤-trans m≤n n≤p)
≤-trans′ : ∀ (m n p : ℕ)
→ m ≤ n
→ n ≤ p
-----
→ m ≤ p
≤-trans′ zero _ _ z≤n _ = z≤n
≤-trans′ (suc m) (suc n) (suc p) (s≤s m≤n) (s≤s n≤p) = s≤s (≤-trans′ m n p m≤n n≤p)
-- Anti-symmetry (非対称律)
≤-antisym : ∀ {m n : ℕ}
→ m ≤ n
→ n ≤ m
-----
→ m ≡ n
≤-antisym z≤n z≤n = refl
≤-antisym (s≤s m≤n) (s≤s n≤m) = cong suc (≤-antisym m≤n n≤m)
-- Total (全順序)
data Total (m n : ℕ) : Set where
forward :
m ≤ n
---------
→ Total m n
flipped :
n ≤ m
---------
→ Total m n
data Total′ : ℕ → ℕ → Set where
forward′ : ∀ {m n : ℕ}
→ m ≤ n
----------
→ Total′ m n
flipped′ : ∀ {m n : ℕ}
→ n ≤ m
----------
→ Total′ m n
≤-total : ∀ (m n : ℕ) → Total m n
≤-total zero n = forward z≤n
≤-total (suc m) zero = flipped z≤n
≤-total (suc m) (suc n) with ≤-total m n
... | forward m≤n = forward (s≤s m≤n)
... | flipped n≤m = flipped (s≤s n≤m)
≤-total′ : ∀ (m n : ℕ) → Total m n
≤-total′ zero n = forward z≤n
≤-total′ (suc m) zero = flipped z≤n
≤-total′ (suc m) (suc n) = helper (≤-total′ m n)
where
helper : Total m n → Total (suc m) (suc n)
helper (forward m≤n) = forward (s≤s m≤n)
helper (flipped n≤m) = flipped (s≤s n≤m)
≤-total″ : ∀ (m n : ℕ) → Total m n
≤-total″ m zero = flipped z≤n
≤-total″ zero (suc n) = forward z≤n
≤-total″ (suc m) (suc n) with ≤-total″ m n
... | forward m≤n = forward (s≤s m≤n)
... | flipped n≤m = flipped (s≤s n≤m)
-- Monotonicity (単調性)
+-monoʳ-≤ : ∀ (n p q : ℕ)
→ p ≤ q
-------------
→ n + p ≤ n + q
+-monoʳ-≤ zero p q p≤q = p≤q
+-monoʳ-≤ (suc n) p q p≤q = s≤s (+-monoʳ-≤ n p q p≤q)
+-monoˡ-≤ : ∀ (m n p : ℕ)
→ m ≤ n
-------------
→ m + p ≤ n + p
+-monoˡ-≤ m n p m≤n rewrite +-comm m p | +-comm n p = +-monoʳ-≤ p m n m≤n
+-mono-≤ : ∀ (m n p q : ℕ)
→ m ≤ n
→ p ≤ q
-------------
→ m + p ≤ n + q
+-mono-≤ m n p q m≤n p≤q = ≤-trans (+-monoˡ-≤ m n p m≤n) (+-monoʳ-≤ n p q p≤q)
-- Strict inequality
infix 4 _<_
data _<_ : ℕ → ℕ → Set where
z<s : ∀ {n : ℕ}
------------
→ zero < suc n
s<s : ∀ {m n : ℕ}
→ m < n
-------------
→ suc m < suc n
-- Even and odd
data even : ℕ → Set
data odd : ℕ → Set
data even where
zero :
---------
even zero
suc : ∀ {n : ℕ}
→ odd n
------------
→ even (suc n)
data odd where
suc : ∀ {n : ℕ}
→ even n
-----------
→ odd (suc n)
e+e≡e : ∀ {m n : ℕ}
→ even m
→ even n
------------
→ even (m + n)
o+e≡o : ∀ {m n : ℕ}
→ odd m
→ even n
-----------
→ odd (m + n)
e+e≡e zero en = en
e+e≡e (suc om) en = suc (o+e≡o om en)
o+e≡o (suc em) en = suc (e+e≡e em en)
|
asm-step-by-step/src/hexdump.asm | jsanders/work-throughs | 5 | 101342 | <filename>asm-step-by-step/src/hexdump.asm<gh_stars>1-10
; Dump file as 16-bytes of hex per line
; hexdump < <input file>
SECTION .bss
SECTION .data
SECTION .text
EXTERN ReadBuf, WriteBuf, PrintCurrentOffset
GLOBAL _start
_start:
ReadLine:
call ReadBuf
cmp esi, 0 ; Have we reached the end of the file?
je Exit ; If so, exit
xor ecx, ecx ; Clear ecx
ScanLine:
call PrintCurrentOffset
; Go to next character and see if we're done
inc ecx ; Increment line string pointer
cmp ecx, esi ; Compare with number of chars
jb ScanLine ; Loop back if ecx is <= number of chars
call WriteBuf
jmp ReadLine ; Get another buffer
Exit:
mov eax, 1 ; `exit` syscall
mov ebx, 0 ; Exit code 0
int 0x80 ; Exit
|
BasicIS4/Syntax/DyadicGentzenSpinalNormalForm.agda | mietek/hilbert-gentzen | 29 | 1303 | <filename>BasicIS4/Syntax/DyadicGentzenSpinalNormalForm.agda
-- Basic intuitionistic modal logic S4, without ∨, ⊥, or ◇.
-- Gentzen-style formalisation of syntax with context pairs, after Pfenning-Davies.
-- Normal forms, neutrals, and spines.
module BasicIS4.Syntax.DyadicGentzenSpinalNormalForm where
open import BasicIS4.Syntax.DyadicGentzen public
-- Commuting propositions for neutrals.
data Tyⁿᵉ : Ty → Set where
α_ : (P : Atom) → Tyⁿᵉ (α P)
□_ : (A : Ty) → Tyⁿᵉ (□ A)
-- Derivations.
mutual
-- Normal forms, or introductions.
infix 3 _⊢ⁿᶠ_
data _⊢ⁿᶠ_ : Cx² Ty Ty → Ty → Set where
neⁿᶠ : ∀ {A Γ Δ} → Γ ⁏ Δ ⊢ⁿᵉ A → {{_ : Tyⁿᵉ A}} → Γ ⁏ Δ ⊢ⁿᶠ A
lamⁿᶠ : ∀ {A B Γ Δ} → Γ , A ⁏ Δ ⊢ⁿᶠ B → Γ ⁏ Δ ⊢ⁿᶠ A ▻ B
boxⁿᶠ : ∀ {A Γ Δ} → ∅ ⁏ Δ ⊢ⁿᶠ A → Γ ⁏ Δ ⊢ⁿᶠ □ A
pairⁿᶠ : ∀ {A B Γ Δ} → Γ ⁏ Δ ⊢ⁿᶠ A → Γ ⁏ Δ ⊢ⁿᶠ B → Γ ⁏ Δ ⊢ⁿᶠ A ∧ B
unitⁿᶠ : ∀ {Γ Δ} → Γ ⁏ Δ ⊢ⁿᶠ ⊤
-- Neutrals, or eliminations.
infix 3 _⊢ⁿᵉ_
data _⊢ⁿᵉ_ : Cx² Ty Ty → Ty → Set where
spⁿᵉ : ∀ {A B C Γ Δ} → A ∈ Γ → Γ ⁏ Δ ⊢ˢᵖ A ⦙ B → Γ ⁏ Δ ⊢ᵗᵖ B ⦙ C → Γ ⁏ Δ ⊢ⁿᵉ C
mspⁿᵉ : ∀ {A B C Γ Δ} → A ∈ Δ → Γ ⁏ Δ ⊢ˢᵖ A ⦙ B → Γ ⁏ Δ ⊢ᵗᵖ B ⦙ C → Γ ⁏ Δ ⊢ⁿᵉ C
-- Spines.
infix 3 _⊢ˢᵖ_⦙_
data _⊢ˢᵖ_⦙_ : Cx² Ty Ty → Ty → Ty → Set where
nilˢᵖ : ∀ {C Γ Δ} → Γ ⁏ Δ ⊢ˢᵖ C ⦙ C
appˢᵖ : ∀ {A B C Γ Δ} → Γ ⁏ Δ ⊢ˢᵖ B ⦙ C → Γ ⁏ Δ ⊢ⁿᶠ A → Γ ⁏ Δ ⊢ˢᵖ A ▻ B ⦙ C
fstˢᵖ : ∀ {A B C Γ Δ} → Γ ⁏ Δ ⊢ˢᵖ A ⦙ C → Γ ⁏ Δ ⊢ˢᵖ A ∧ B ⦙ C
sndˢᵖ : ∀ {A B C Γ Δ} → Γ ⁏ Δ ⊢ˢᵖ B ⦙ C → Γ ⁏ Δ ⊢ˢᵖ A ∧ B ⦙ C
-- Spine tips.
infix 3 _⊢ᵗᵖ_⦙_
data _⊢ᵗᵖ_⦙_ : Cx² Ty Ty → Ty → Ty → Set where
nilᵗᵖ : ∀ {C Γ Δ} → Γ ⁏ Δ ⊢ᵗᵖ C ⦙ C
unboxᵗᵖ : ∀ {A C Γ Δ} → Γ ⁏ Δ , A ⊢ⁿᶠ C → Γ ⁏ Δ ⊢ᵗᵖ □ A ⦙ C
-- Translation to simple terms.
mutual
nf→tm : ∀ {A Γ Δ} → Γ ⁏ Δ ⊢ⁿᶠ A → Γ ⁏ Δ ⊢ A
nf→tm (neⁿᶠ t) = ne→tm t
nf→tm (lamⁿᶠ t) = lam (nf→tm t)
nf→tm (boxⁿᶠ t) = box (nf→tm t)
nf→tm (pairⁿᶠ t u) = pair (nf→tm t) (nf→tm u)
nf→tm unitⁿᶠ = unit
ne→tm : ∀ {A Γ Δ} → Γ ⁏ Δ ⊢ⁿᵉ A → Γ ⁏ Δ ⊢ A
ne→tm (spⁿᵉ i xs y) = tp→tm (var i) xs y
ne→tm (mspⁿᵉ i xs y) = tp→tm (mvar i) xs y
sp→tm : ∀ {A C Γ Δ} → Γ ⁏ Δ ⊢ A → Γ ⁏ Δ ⊢ˢᵖ A ⦙ C → Γ ⁏ Δ ⊢ C
sp→tm t nilˢᵖ = t
sp→tm t (appˢᵖ xs u) = sp→tm (app t (nf→tm u)) xs
sp→tm t (fstˢᵖ xs) = sp→tm (fst t) xs
sp→tm t (sndˢᵖ xs) = sp→tm (snd t) xs
tp→tm : ∀ {A B C Γ Δ} → Γ ⁏ Δ ⊢ A → Γ ⁏ Δ ⊢ˢᵖ A ⦙ B → Γ ⁏ Δ ⊢ᵗᵖ B ⦙ C → Γ ⁏ Δ ⊢ C
tp→tm t xs nilᵗᵖ = sp→tm t xs
tp→tm t xs (unboxᵗᵖ u) = unbox (sp→tm t xs) (nf→tm u)
-- Monotonicity with respect to context inclusion.
mutual
mono⊢ⁿᶠ : ∀ {A Γ Γ′ Δ} → Γ ⊆ Γ′ → Γ ⁏ Δ ⊢ⁿᶠ A → Γ′ ⁏ Δ ⊢ⁿᶠ A
mono⊢ⁿᶠ η (neⁿᶠ t) = neⁿᶠ (mono⊢ⁿᵉ η t)
mono⊢ⁿᶠ η (lamⁿᶠ t) = lamⁿᶠ (mono⊢ⁿᶠ (keep η) t)
mono⊢ⁿᶠ η (boxⁿᶠ t) = boxⁿᶠ t
mono⊢ⁿᶠ η (pairⁿᶠ t u) = pairⁿᶠ (mono⊢ⁿᶠ η t) (mono⊢ⁿᶠ η u)
mono⊢ⁿᶠ η unitⁿᶠ = unitⁿᶠ
mono⊢ⁿᵉ : ∀ {A Γ Γ′ Δ} → Γ ⊆ Γ′ → Γ ⁏ Δ ⊢ⁿᵉ A → Γ′ ⁏ Δ ⊢ⁿᵉ A
mono⊢ⁿᵉ η (spⁿᵉ i xs y) = spⁿᵉ (mono∈ η i) (mono⊢ˢᵖ η xs) (mono⊢ᵗᵖ η y)
mono⊢ⁿᵉ η (mspⁿᵉ i xs y) = mspⁿᵉ i (mono⊢ˢᵖ η xs) (mono⊢ᵗᵖ η y)
mono⊢ˢᵖ : ∀ {A C Γ Γ′ Δ} → Γ ⊆ Γ′ → Γ ⁏ Δ ⊢ˢᵖ A ⦙ C → Γ′ ⁏ Δ ⊢ˢᵖ A ⦙ C
mono⊢ˢᵖ η nilˢᵖ = nilˢᵖ
mono⊢ˢᵖ η (appˢᵖ xs u) = appˢᵖ (mono⊢ˢᵖ η xs) (mono⊢ⁿᶠ η u)
mono⊢ˢᵖ η (fstˢᵖ xs) = fstˢᵖ (mono⊢ˢᵖ η xs)
mono⊢ˢᵖ η (sndˢᵖ xs) = sndˢᵖ (mono⊢ˢᵖ η xs)
mono⊢ᵗᵖ : ∀ {A C Γ Γ′ Δ} → Γ ⊆ Γ′ → Γ ⁏ Δ ⊢ᵗᵖ A ⦙ C → Γ′ ⁏ Δ ⊢ᵗᵖ A ⦙ C
mono⊢ᵗᵖ η nilᵗᵖ = nilᵗᵖ
mono⊢ᵗᵖ η (unboxᵗᵖ u) = unboxᵗᵖ (mono⊢ⁿᶠ η u)
-- Monotonicity with respect to modal context inclusion.
mutual
mmono⊢ⁿᶠ : ∀ {A Γ Δ Δ′} → Δ ⊆ Δ′ → Γ ⁏ Δ ⊢ⁿᶠ A → Γ ⁏ Δ′ ⊢ⁿᶠ A
mmono⊢ⁿᶠ θ (neⁿᶠ t) = neⁿᶠ (mmono⊢ⁿᵉ θ t)
mmono⊢ⁿᶠ θ (lamⁿᶠ t) = lamⁿᶠ (mmono⊢ⁿᶠ θ t)
mmono⊢ⁿᶠ θ (boxⁿᶠ t) = boxⁿᶠ (mmono⊢ⁿᶠ θ t)
mmono⊢ⁿᶠ θ (pairⁿᶠ t u) = pairⁿᶠ (mmono⊢ⁿᶠ θ t) (mmono⊢ⁿᶠ θ u)
mmono⊢ⁿᶠ θ unitⁿᶠ = unitⁿᶠ
mmono⊢ⁿᵉ : ∀ {A Γ Δ Δ′} → Δ ⊆ Δ′ → Γ ⁏ Δ ⊢ⁿᵉ A → Γ ⁏ Δ′ ⊢ⁿᵉ A
mmono⊢ⁿᵉ θ (spⁿᵉ i xs y) = spⁿᵉ i (mmono⊢ˢᵖ θ xs) (mmono⊢ᵗᵖ θ y)
mmono⊢ⁿᵉ θ (mspⁿᵉ i xs y) = mspⁿᵉ (mono∈ θ i) (mmono⊢ˢᵖ θ xs) (mmono⊢ᵗᵖ θ y)
mmono⊢ˢᵖ : ∀ {A C Γ Δ Δ′} → Δ ⊆ Δ′ → Γ ⁏ Δ ⊢ˢᵖ A ⦙ C → Γ ⁏ Δ′ ⊢ˢᵖ A ⦙ C
mmono⊢ˢᵖ θ nilˢᵖ = nilˢᵖ
mmono⊢ˢᵖ θ (appˢᵖ xs u) = appˢᵖ (mmono⊢ˢᵖ θ xs) (mmono⊢ⁿᶠ θ u)
mmono⊢ˢᵖ θ (fstˢᵖ xs) = fstˢᵖ (mmono⊢ˢᵖ θ xs)
mmono⊢ˢᵖ θ (sndˢᵖ xs) = sndˢᵖ (mmono⊢ˢᵖ θ xs)
mmono⊢ᵗᵖ : ∀ {A C Γ Δ Δ′} → Δ ⊆ Δ′ → Γ ⁏ Δ ⊢ᵗᵖ A ⦙ C → Γ ⁏ Δ′ ⊢ᵗᵖ A ⦙ C
mmono⊢ᵗᵖ θ nilᵗᵖ = nilᵗᵖ
mmono⊢ᵗᵖ θ (unboxᵗᵖ u) = unboxᵗᵖ (mmono⊢ⁿᶠ (keep θ) u)
-- Monotonicity using context pairs.
mono²⊢ⁿᶠ : ∀ {A Π Π′} → Π ⊆² Π′ → Π ⊢ⁿᶠ A → Π′ ⊢ⁿᶠ A
mono²⊢ⁿᶠ (η , θ) = mono⊢ⁿᶠ η ∘ mmono⊢ⁿᶠ θ
mono²⊢ⁿᵉ : ∀ {A Π Π′} → Π ⊆² Π′ → Π ⊢ⁿᵉ A → Π′ ⊢ⁿᵉ A
mono²⊢ⁿᵉ (η , θ) = mono⊢ⁿᵉ η ∘ mmono⊢ⁿᵉ θ
mono²⊢ˢᵖ : ∀ {A C Π Π′} → Π ⊆² Π′ → Π ⊢ˢᵖ A ⦙ C → Π′ ⊢ˢᵖ A ⦙ C
mono²⊢ˢᵖ (η , θ) = mono⊢ˢᵖ η ∘ mmono⊢ˢᵖ θ
mono²⊢ᵗᵖ : ∀ {A C Π Π′} → Π ⊆² Π′ → Π ⊢ᵗᵖ A ⦙ C → Π′ ⊢ᵗᵖ A ⦙ C
mono²⊢ᵗᵖ (η , θ) = mono⊢ᵗᵖ η ∘ mmono⊢ᵗᵖ θ
|
test/Succeed/Issue5470/Import.agda | cruhland/agda | 1,989 | 6205 | <reponame>cruhland/agda
{-# OPTIONS --rewriting #-}
module Issue5470.Import where
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
open import Agda.Builtin.Equality.Rewrite
private
postulate
foo : Nat → Nat
bar : Nat → Nat
bar n = foo n
private
postulate
lemma : ∀ n → foo n ≡ n
{-# REWRITE lemma #-}
|
Usermode/Libraries/libc.so_src/arch/native.asm | thepowersgang/acess2 | 58 | 163647 | ;
; Acess2 C Library
; - By <NAME> (thePowersGang)
;
; arch/x86.asm
; - x86 specific code
[bits 32]
[section .text]
unused_code:
jmp $
|
test/interaction/Issue2273.agda | cruhland/agda | 1,989 | 8395 | <filename>test/interaction/Issue2273.agda
-- Jesper, 2018-10-16: When solving constraints, unsolved metas should
-- be turned into interaction holes. Metas that refer to an existing
-- interaction hole should be printed as _ instead.
postulate
_==_ : {A : Set} (a b : A) → Set
P : Set → Set
f : {A : Set} {a : A} {b : A} → P (a == b)
x : P {!!}
x = f
y : P {!!}
y = f {a = {!!}} {b = {!!}}
|
libsrc/graphics/retrofit/xordrawb_callee.asm | ahjelm/z88dk | 640 | 240339 | ;
; Generic trick to adapt a classic function to the CALLEE mode
;
; ----- void __CALLEE__ xordrawb(int x, int y, int x2, int y2)
;
;
; $Id: xordrawb_callee.asm $
;
SECTION smc_clib
PUBLIC xordrawb_callee
PUBLIC _xordrawb_callee
EXTERN xordrawb
.xordrawb_callee
._xordrawb_callee
ld hl,retaddr
ex (sp),hl
ld (retaddr0+1),hl
ld hl,xordrawb
jp (hl)
.retaddr
pop bc
pop bc
pop bc
pop bc
.retaddr0
ld hl,0
jp (hl)
|
oeis/007/A007004.asm | neoneye/loda-programs | 11 | 20910 | <filename>oeis/007/A007004.asm<gh_stars>10-100
; A007004: a(n) = (3*n)! / ((n+1)*(n!)^3).
; Submitted by <NAME>
; 1,3,30,420,6930,126126,2450448,49884120,1051723530,22787343150,504636071940,11377249621920,260363981732400,6034149862347600,141371511060715200,3343436236585914480,79726203788589122490,1914992149823954412750,46295775130831740013500,1125718321602329678223000,27515772118022658277707900,675744481495855153287605700,16666583259028206152231856000,412679094174633191465045304000,10255075490239634807906375804400,255682697530497725687585732747856,6394252760463558507366460290771168
mov $1,$0
add $1,$0
mov $2,$0
add $2,$1
bin $1,$0
bin $2,$0
add $0,1
div $1,$0
mul $1,$2
mov $0,$1
|
src/svd/sam_svd-aes.ads | Fabien-Chouteau/samd51-hal | 1 | 2845 | <gh_stars>1-10
pragma Style_Checks (Off);
-- This spec has been automatically generated from ATSAMD51G19A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAM_SVD.AES is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- AES Modes of operation
type CTRLA_AESMODESelect is
(-- Electronic code book mode
ECB,
-- Cipher block chaining mode
CBC,
-- Output feedback mode
OFB,
-- Cipher feedback mode
CFB,
-- Counter mode
COUNTER,
-- CCM mode
CCM,
-- Galois counter mode
GCM)
with Size => 3;
for CTRLA_AESMODESelect use
(ECB => 0,
CBC => 1,
OFB => 2,
CFB => 3,
COUNTER => 4,
CCM => 5,
GCM => 6);
-- Cipher Feedback Block Size
type CTRLA_CFBSSelect is
(-- 128-bit Input data block for Encryption/Decryption in Cipher Feedback mode
Val_128BIT,
-- 64-bit Input data block for Encryption/Decryption in Cipher Feedback mode
Val_64BIT,
-- 32-bit Input data block for Encryption/Decryption in Cipher Feedback mode
Val_32BIT,
-- 16-bit Input data block for Encryption/Decryption in Cipher Feedback mode
Val_16BIT,
-- 8-bit Input data block for Encryption/Decryption in Cipher Feedback mode
Val_8BIT)
with Size => 3;
for CTRLA_CFBSSelect use
(Val_128BIT => 0,
Val_64BIT => 1,
Val_32BIT => 2,
Val_16BIT => 3,
Val_8BIT => 4);
-- Encryption Key Size
type CTRLA_KEYSIZESelect is
(-- 128-bit Key for Encryption / Decryption
Val_128BIT,
-- 192-bit Key for Encryption / Decryption
Val_192BIT,
-- 256-bit Key for Encryption / Decryption
Val_256BIT)
with Size => 2;
for CTRLA_KEYSIZESelect use
(Val_128BIT => 0,
Val_192BIT => 1,
Val_256BIT => 2);
-- Cipher Mode
type CTRLA_CIPHERSelect is
(-- Decryption
DEC,
-- Encryption
ENC)
with Size => 1;
for CTRLA_CIPHERSelect use
(DEC => 0,
ENC => 1);
-- Start Mode Select
type CTRLA_STARTMODESelect is
(-- Start Encryption / Decryption in Manual mode
MANUAL,
-- Start Encryption / Decryption in Auto mode
AUTO)
with Size => 1;
for CTRLA_STARTMODESelect use
(MANUAL => 0,
AUTO => 1);
-- Last Output Data Mode
type CTRLA_LODSelect is
(-- No effect
NONE,
-- Start encryption in Last Output Data mode
LAST)
with Size => 1;
for CTRLA_LODSelect use
(NONE => 0,
LAST => 1);
-- Last Key Generation
type CTRLA_KEYGENSelect is
(-- No effect
NONE,
-- Start Computation of the last NK words of the expanded key
LAST)
with Size => 1;
for CTRLA_KEYGENSelect use
(NONE => 0,
LAST => 1);
-- XOR Key Operation
type CTRLA_XORKEYSelect is
(-- No effect
NONE,
-- The user keyword gets XORed with the previous keyword register content.
XOR_k)
with Size => 1;
for CTRLA_XORKEYSelect use
(NONE => 0,
XOR_k => 1);
subtype AES_CTRLA_CTYPE_Field is HAL.UInt4;
-- Control A
type AES_CTRLA_Register is record
-- Software Reset
SWRST : Boolean := False;
-- Enable
ENABLE : Boolean := False;
-- AES Modes of operation
AESMODE : CTRLA_AESMODESelect := SAM_SVD.AES.ECB;
-- Cipher Feedback Block Size
CFBS : CTRLA_CFBSSelect := SAM_SVD.AES.Val_128BIT;
-- Encryption Key Size
KEYSIZE : CTRLA_KEYSIZESelect := SAM_SVD.AES.Val_128BIT;
-- Cipher Mode
CIPHER : CTRLA_CIPHERSelect := SAM_SVD.AES.DEC;
-- Start Mode Select
STARTMODE : CTRLA_STARTMODESelect := SAM_SVD.AES.MANUAL;
-- Last Output Data Mode
LOD : CTRLA_LODSelect := SAM_SVD.AES.NONE;
-- Last Key Generation
KEYGEN : CTRLA_KEYGENSelect := SAM_SVD.AES.NONE;
-- XOR Key Operation
XORKEY : CTRLA_XORKEYSelect := SAM_SVD.AES.NONE;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- Counter Measure Type
CTYPE : AES_CTRLA_CTYPE_Field := 16#0#;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AES_CTRLA_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
AESMODE at 0 range 2 .. 4;
CFBS at 0 range 5 .. 7;
KEYSIZE at 0 range 8 .. 9;
CIPHER at 0 range 10 .. 10;
STARTMODE at 0 range 11 .. 11;
LOD at 0 range 12 .. 12;
KEYGEN at 0 range 13 .. 13;
XORKEY at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
CTYPE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Control B
type AES_CTRLB_Register is record
-- Start Encryption/Decryption
START : Boolean := False;
-- New message
NEWMSG : Boolean := False;
-- End of message
EOM : Boolean := False;
-- GF Multiplication
GFMUL : Boolean := False;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AES_CTRLB_Register use record
START at 0 range 0 .. 0;
NEWMSG at 0 range 1 .. 1;
EOM at 0 range 2 .. 2;
GFMUL at 0 range 3 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
end record;
-- Interrupt Enable Clear
type AES_INTENCLR_Register is record
-- Encryption Complete Interrupt Enable
ENCCMP : Boolean := False;
-- GF Multiplication Complete Interrupt Enable
GFMCMP : Boolean := False;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AES_INTENCLR_Register use record
ENCCMP at 0 range 0 .. 0;
GFMCMP at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- Interrupt Enable Set
type AES_INTENSET_Register is record
-- Encryption Complete Interrupt Enable
ENCCMP : Boolean := False;
-- GF Multiplication Complete Interrupt Enable
GFMCMP : Boolean := False;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AES_INTENSET_Register use record
ENCCMP at 0 range 0 .. 0;
GFMCMP at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- Interrupt Flag Status
type AES_INTFLAG_Register is record
-- Encryption Complete
ENCCMP : Boolean := False;
-- GF Multiplication Complete
GFMCMP : Boolean := False;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AES_INTFLAG_Register use record
ENCCMP at 0 range 0 .. 0;
GFMCMP at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
subtype AES_DATABUFPTR_INDATAPTR_Field is HAL.UInt2;
-- Data buffer pointer
type AES_DATABUFPTR_Register is record
-- Input Data Pointer
INDATAPTR : AES_DATABUFPTR_INDATAPTR_Field := 16#0#;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AES_DATABUFPTR_Register use record
INDATAPTR at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- Debug control
type AES_DBGCTRL_Register is record
-- Debug Run
DBGRUN : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AES_DBGCTRL_Register use record
DBGRUN at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- Keyword n
-- Keyword n
type AES_KEYWORD_Registers is array (0 .. 7) of HAL.UInt32;
-- Initialisation Vector n
-- Initialisation Vector n
type AES_INTVECTV_Registers is array (0 .. 3) of HAL.UInt32;
-- Hash key n
-- Hash key n
type AES_HASHKEY_Registers is array (0 .. 3) of HAL.UInt32;
-- Galois Hash n
-- Galois Hash n
type AES_GHASH_Registers is array (0 .. 3) of HAL.UInt32;
-----------------
-- Peripherals --
-----------------
-- Advanced Encryption Standard
type AES_Peripheral is record
-- Control A
CTRLA : aliased AES_CTRLA_Register;
-- Control B
CTRLB : aliased AES_CTRLB_Register;
-- Interrupt Enable Clear
INTENCLR : aliased AES_INTENCLR_Register;
-- Interrupt Enable Set
INTENSET : aliased AES_INTENSET_Register;
-- Interrupt Flag Status
INTFLAG : aliased AES_INTFLAG_Register;
-- Data buffer pointer
DATABUFPTR : aliased AES_DATABUFPTR_Register;
-- Debug control
DBGCTRL : aliased AES_DBGCTRL_Register;
-- Keyword n
KEYWORD : aliased AES_KEYWORD_Registers;
-- Indata
INDATA : aliased HAL.UInt32;
-- Initialisation Vector n
INTVECTV : aliased AES_INTVECTV_Registers;
-- Hash key n
HASHKEY : aliased AES_HASHKEY_Registers;
-- Galois Hash n
GHASH : aliased AES_GHASH_Registers;
-- Cipher Length
CIPLEN : aliased HAL.UInt32;
-- Random Seed
RANDSEED : aliased HAL.UInt32;
end record
with Volatile;
for AES_Peripheral use record
CTRLA at 16#0# range 0 .. 31;
CTRLB at 16#4# range 0 .. 7;
INTENCLR at 16#5# range 0 .. 7;
INTENSET at 16#6# range 0 .. 7;
INTFLAG at 16#7# range 0 .. 7;
DATABUFPTR at 16#8# range 0 .. 7;
DBGCTRL at 16#9# range 0 .. 7;
KEYWORD at 16#C# range 0 .. 255;
INDATA at 16#38# range 0 .. 31;
INTVECTV at 16#3C# range 0 .. 127;
HASHKEY at 16#5C# range 0 .. 127;
GHASH at 16#6C# range 0 .. 127;
CIPLEN at 16#80# range 0 .. 31;
RANDSEED at 16#84# range 0 .. 31;
end record;
-- Advanced Encryption Standard
AES_Periph : aliased AES_Peripheral
with Import, Address => AES_Base;
end SAM_SVD.AES;
|
src-antlr/TemporalLogic.g4 | xue-xy/Mediator_origin | 1 | 5897 | grammar TemporalLogic;
import TermAndType;
pathFormulae:
term # atomicPathFormulae
| '!' pathFormulae # notPathFormulae
| 'A' stateFormulae # allPathFormulae
| 'E' stateFormulae # existsPathFormulae
| left=pathFormulae opr='->' right=pathFormulae # binaryPathFormulae
| left=pathFormulae opr='<-' right=pathFormulae # binaryPathFormulae
| left=pathFormulae opr='<->' right=pathFormulae # binaryPathFormulae
| left=pathFormulae opr='&&' right=pathFormulae # binaryPathFormulae
| left=pathFormulae opr='||' right=pathFormulae # binaryPathFormulae
| '(' pathFormulae ')' # bracketPathFormulae
;
stateFormulae:
pathFormulae # pathStateFormulae
| '!' stateFormulae # notStateFormulae
| left=stateFormulae opr='->' right=stateFormulae # binaryStateFormulae
| left=stateFormulae opr='<-' right=stateFormulae # binaryStateFormulae
| left=stateFormulae opr='<->' right=stateFormulae # binaryStateFormulae
| left=stateFormulae opr='&&' right=stateFormulae # binaryStateFormulae
| left=stateFormulae opr='||' right=stateFormulae # binaryStateFormulae
| 'X' stateFormulae # nextStateFormulae
| 'F' stateFormulae # finallyStateFormulae
| 'G' stateFormulae # globallyStateFormulae
| '[' keep=stateFormulae 'U' until=stateFormulae ']' # untilStateFormulae
| '(' stateFormulae ')' # bracketStateFormulae
; |
programs/oeis/305/A305728.asm | neoneye/loda | 22 | 162550 | <reponame>neoneye/loda
; A305728: Numbers of the form 216*p^3, where p is a Pythagorean prime (A002144).
; 27000,474552,1061208,5268024,10941048,14886936,32157432,49027896,84027672,152273304,197137368,222545016,279726264,311665752,555412248,714516984,835896888,1118386872,1280824056,1552836312,1651400568,2593941624,2732256792,3023464536,3666512088,4204463544,4590849528,4792616856,5433211512,6623488152,6880682808,8266914648,9181846584,9501187032,11209345272,12714595704,13515286968,13927939416,14778272664,16117587576,17535471192,19552071384,20615902488,21161991096,28484401464,30546884376,34201530936,37326677688,39791521944,41493607128,45042017112,46889669016,49754821752,50735184408,56888939736,60144136632,62381832696,65841382872,67022366328,74405973816,76982579064,85067892792,93700388088,95193593496,98227427544,99768222072,109352499768,114366627864,119531734776,123060122424,134060503032,135955323288,145697644728,147700333656,173181259224,177693901848,179979326136,186953006232,201436163928,214061826168,221884645464,224533986552,229895768376,238097434392,249333260184,257988235896,263868085944,282042293112,285150169368,294610614264,301032420408,310839052824,331086652632,355797952056,366754188312,374181897816,385510448952,389336827608,400967709624,408848915448
seq $0,2144 ; Pythagorean primes: primes of form 4*k + 1.
pow $0,3
mul $0,216
|
programs/oeis/143/A143274.asm | neoneye/loda | 22 | 12970 | <filename>programs/oeis/143/A143274.asm
; A143274: a(n) = n * A006218(n).
; 1,6,15,32,50,84,112,160,207,270,319,420,481,574,675,800,884,1044,1140,1320,1470,1628,1748,2016,2175,2366,2565,2828,2987,3330,3503,3808,4059,4318,4585,5040,5254,5548,5850,6320,6560,7056,7310,7744,8190,8556,8836
add $0,1
lpb $0
mov $1,$0
mov $2,$0
mov $0,0
seq $2,6218 ; a(n) = Sum_{k=1..n} floor(n/k); also Sum_{k=1..n} d(k), where d = number of divisors (A000005); also number of solutions to x*y = z with 1 <= x,y,z <= n.
mul $1,$2
lpe
mov $0,$1
|
Projects/Arbre_Genealogique/livrables/arbre_foret.adb | faicaltoubali/ENSEEIHT | 0 | 12000 | <filename>Projects/Arbre_Genealogique/livrables/arbre_foret.adb
with Ada.integer_Text_IO; use Ada.integer_Text_IO;
with Ada.Text_IO ; use Ada.Text_IO;
package body Arbre_Foret is
procedure Initialiser(Abr : out T_Abr_Foret) is
begin
Abr := New T_Cellule;
Abr.all.Tableau_Compagnons.Taille := 0;
end Initialiser;
------------------------------------------------------------------------------------------------------
function Vide (Abr : in T_Abr_Foret ) return Boolean is
begin
return Abr = null;
end Vide;
-------------------------------------------------------------------------------------------------------
procedure Creer_Minimal (Abr : out T_Abr_Foret ; Cle : in integer) is
begin
Abr := New T_Cellule;
Abr.all.Cle := Cle;
Abr.all.Tableau_Compagnons.Taille := 0;
end Creer_Minimal;
-------------------------------------------------------------------------------------------------------
Procedure Ajouter_Pere (Abr : in out T_Abr_Foret ; Cle : in integer; Cle_Pere : in integer) is
Curseur : T_Abr_Foret ;
begin
Avoir_Arbre (Abr, Cle, Curseur);
if Vide(Curseur.all.Pere) then
Creer_Minimal(Curseur.all.Pere,Cle_Pere);
else
raise Pere_Existe;
end if;
end Ajouter_Pere;
--------------------------------------------------------------------------------------------------------
Procedure Ajouter_Mere ( Abr : in out T_Abr_Foret ; Cle : in integer ; Cle_Mere : in integer) is
Curseur : T_Abr_Foret;
begin
Avoir_Arbre(Abr , Cle, Curseur);
if Vide(Curseur.all.Mere) then
Creer_Minimal(Curseur.all.Mere, Cle_Mere);
else
Raise Mere_Existe;
end if;
end Ajouter_Mere;
--------------------------------------------------------------------------------------------------------
procedure Ajouter_Epoux ( Abr : in out T_Abr_Foret ; Cle : in integer; Cle_Epoux : in integer) is
Curseur : T_Abr_Foret;
begin
Avoir_Arbre(Abr,Cle,Curseur);
if Vide(Curseur.all.Epoux) then
Creer_Minimal(Curseur.all.Epoux,Cle_Epoux);
else
Raise Epoux_Existe;
end if;
end Ajouter_Epoux;
--------------------------------------------------------------------------------------------------------
procedure Ajouter_Compagnon( Abr : in out T_Abr_Foret ; Cle : in integer; Cle_Compagnon : in integer) is
Curseur : T_Abr_Foret;
I : Integer := 1 ;
begin
Avoir_Arbre(Abr,Cle,Curseur);
if Existe_Compagnon (Curseur.All.Tableau_Compagnons,Cle_Compagnon) then
raise Compagnon_Existe;
end if;
While not Vide ( Curseur.all.Tableau_Compagnons.Tableau(I) ) and I <= Capacite loop
I := I+1;
end loop;
Curseur.all.Tableau_Compagnons.Taille := Curseur.all.Tableau_Compagnons.Taille + 1;
Creer_Minimal (Curseur.All.Tableau_Compagnons.Tableau(I), Cle_Compagnon);
end Ajouter_Compagnon;
-------------------------------------------------------------------------------------------------------
function Existe_Compagnon (TableauCompagnon : in T_Tableau; Cle_Compagnon : in integer) return Boolean is
I : integer := 1;
begin
while I <= TableauCompagnon.Taille and then TableauCompagnon.Tableau(I).All.Cle /= Cle_Compagnon loop
I := I + 1;
end loop;
return (I <= TableauCompagnon.Taille);
end Existe_Compagnon;
-------------------------------------------------------------------------------------------------------
function Existe (Abr : in T_Abr_Foret ; Cle : in integer) return Boolean is
S : Boolean := False;
I : integer :=1;
begin
if Abr = null then
return False;
elsif Abr.all.Cle = Cle then
return True;
else
while I <= Abr.all.Tableau_Compagnons.Taille loop
S := S or Existe(Abr.all.Tableau_Compagnons.Tableau(I),Cle);
I := I + 1 ;
end loop;
return Existe(Abr.all.Pere, Cle) or Existe(Abr.all.Mere,Cle) or Existe(Abr.all.Epoux,Cle) or S;
end if;
end Existe;
-----------------------------------------------------------------------------------------------------
Procedure Avoir_Arbre (Abr : in T_Abr_Foret ; Cle : in integer; Curseur : in out T_Abr_Foret) is
I : integer := 1;
begin
if Vide(Abr) then
null;
elsif Abr.all.Cle = Cle then
Curseur := Abr;
elsif Existe (Abr.All.Pere , Cle ) then
Avoir_Arbre ( Abr.All.Pere, Cle , Curseur );
elsif Existe (Abr.All.Mere , Cle) then
Avoir_Arbre ( Abr.All.Mere, Cle , Curseur );
elsif Existe (Abr.All.Epoux ,Cle) then
Avoir_Arbre ( Abr.All.Epoux, Cle , Curseur );
end if;
while I <= Abr.All.Tableau_Compagnons.Taille loop
if not Vide(Abr.All.Tableau_Compagnons.Tableau(i)) then
Avoir_Arbre(Abr.All.Tableau_Compagnons.Tableau(I),Cle,Curseur);
I := I + 1 ;
end if;
end loop;
end Avoir_Arbre;
----------------------------------------------------------------------------------------------------
Procedure Demis_Soeurs_Freres_Pere (Abr : in T_Abr_Foret ) is
I_1 : integer := 1;
I_2 : integer := 1;
I_3 : integer := 1;
s : boolean := false ;
begin
if Vide(Abr) then
null;
else
while I_1 <= Abr.all.Tableau_Compagnons.Taille loop
s := s or Existe (Abr.all.Tableau_Compagnons.Tableau(I_1),Abr.all.Pere.Cle);
I_1 := I_1 + 1;
end loop;
if s = True then
Put ( " => Les demis freres de l'individu :" & Integer'Image(Abr.All.Cle) & " de la part de son pere sont : ");
while I_2 <= Abr.all.Tableau_Compagnons.Taille loop
Afficher_Fils_Pere(Abr.all.Tableau_Compagnons.Tableau(I_2),Abr.all.Pere.Cle,Abr.all.Mere.Cle);
I_2 := I_2 +1;
end loop;
end if;
while I_3 <= Abr.all.Tableau_Compagnons.Taille loop
Demis_Soeurs_Freres_Pere(Abr.all.Tableau_Compagnons.Tableau(I_3));
I_3 := I_3 + 1;
end loop;
end if;
end Demis_Soeurs_Freres_Pere;
---------------------------------------------------------------------------------------------
procedure Afficher_Fils_Pere (Abr : in T_Abr_Foret ; Cle_Pere : in integer; Cle_Mere : in integer) is
I : Integer := 1 ;
begin
if Vide(Abr) then
null;
else
if not Vide(Abr.All.Pere) and then Abr.All.Pere.Cle = Cle_Pere then
if not Vide(Abr.all.Mere) and then Abr.all.Mere.Cle /= Cle_Mere then
Put(Abr.all.Cle,width => 2);Put (" - " );
else
null;
end if;
end if;
while I <= Abr.all.Tableau_Compagnons.Taille loop
Afficher_Fils_Pere(Abr.all.Tableau_Compagnons.Tableau(I),Cle_Pere,Cle_Mere);
I := I + 1;
end loop;
end if;
end Afficher_Fils_Pere;
----------------------------------------------------------------------------------------------------
Procedure Demis_Soeurs_Freres_Mere (Abr : in T_Abr_Foret ) is
I_1 : integer := 1;
I_2 : integer := 1;
I_3 : integer := 1;
s : boolean := false ;
begin
if Vide(Abr) then
null;
else
while I_1 <= Abr.all.Tableau_Compagnons.Taille loop
s := s or Existe (Abr.all.Tableau_Compagnons.Tableau(I_1),Abr.all.Mere.Cle);
I_1 := I_1 + 1;
end loop;
if s = True then
Put ( " => Les demis freres de l'individu :" & Integer'Image(Abr.All.Cle) & " de la part de sa mere sont : ");
while I_2 <= Abr.all.Tableau_Compagnons.Taille loop
Afficher_Fils_Mere(Abr.all.Tableau_Compagnons.Tableau(I_2),Abr.all.Mere.Cle,Abr.all.Pere.Cle);
I_2 := I_2 +1;
end loop;
else
while I_3 <= Abr.all.Tableau_Compagnons.Taille loop
Demis_Soeurs_Freres_Mere(Abr.all.Tableau_Compagnons.Tableau(I_3));
I_3 := I_3 + 1;
end loop;
end if;
end if;
end Demis_Soeurs_Freres_Mere;
---------------------------------------------------------------------------------------------
procedure Afficher_Fils_Mere (Abr : in T_Abr_Foret ; Cle_Mere : in integer; Cle_Pere : in integer) is
I : Integer := 1 ;
begin
if Vide(Abr) then
null;
else
if not Vide(Abr.All.Mere) and then Abr.All.Mere.Cle = Cle_Mere then
if not Vide(Abr.all.Pere) and then Abr.all.Pere.Cle /= Cle_Pere then
Put(Abr.all.Cle,width => 2);Put (" - " );
else
null;
end if;
end if;
while I <= Abr.all.Tableau_Compagnons.Taille loop
Afficher_Fils_Mere(Abr.all.Tableau_Compagnons.Tableau(I),Cle_Mere,Cle_Pere);
I := I + 1;
end loop;
end if;
end Afficher_Fils_Mere;
---------------------------------------------------------------------------------------------
end Arbre_Foret;
|
FormalAnalyzer/models/apps/KeyFobControl.als | Mohannadcse/IoTCOM_BehavioralRuleExtractor | 0 | 3655 | module app_KeyFobControl
open IoTBottomUp as base
open cap_runIn
open cap_now
open cap_button
open cap_switch
open cap_location
one sig app_KeyFobControl extends IoTApp {
location : one cap_location,
button : one cap_button,
switchOn : some cap_switch,
switchOff : some cap_switch,
heldSwitchOn : some cap_switch,
heldSwitchOff : some cap_switch,
state : one cap_state,
} {
rules = r
//capabilities = button + switchOn + switchOff + heldSwitchOn + heldSwitchOff + state
}
one sig cap_location_attr_mode_val_newMode extends cap_location_attr_mode_val {}{}
one sig cap_state extends cap_runIn {} {
attributes = cap_state_attr + cap_runIn_attr
}
abstract sig cap_state_attr extends Attribute {}
abstract sig r extends Rule {}
one sig r0 extends r {}{
triggers = r0_trig
conditions = r0_cond
commands = r0_comm
}
abstract sig r0_trig extends Trigger {}
one sig r0_trig0 extends r0_trig {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_button
value = cap_button_attr_button_val_pushed
}
abstract sig r0_cond extends Condition {}
/*
one sig r0_cond0 extends r0_cond {} {
capabilities = app_KeyFobControl.switchOn
attribute = cap_switch_attr_any
value = cap_switch_attr_any_val_no_value
}
one sig r0_cond1 extends r0_cond {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_pushed
value = cap_button_attr_pushed_val_no_value
}
*/
abstract sig r0_comm extends Command {}
one sig r0_comm0 extends r0_comm {} {
capability = app_KeyFobControl.switchOn
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
one sig r0_comm1 extends r0_comm {} {
capability = app_KeyFobControl.switchOff
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r1 extends r {}{
triggers = r1_trig
conditions = r1_cond
commands = r1_comm
}
abstract sig r1_trig extends Trigger {}
one sig r1_trig0 extends r1_trig {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_button
value = cap_button_attr_button_val_held
}
abstract sig r1_cond extends Condition {}
/*
one sig r1_cond0 extends r1_cond {} {
capabilities = app_KeyFobControl.heldSwitchOn
attribute = cap_switch_attr_any
value = cap_switch_attr_any_val_no_value
}
one sig r1_cond1 extends r1_cond {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_held
value = cap_button_attr_held_val_no_value
}
*/
abstract sig r1_comm extends Command {}
one sig r1_comm0 extends r1_comm {} {
capability = app_KeyFobControl.heldSwitchOn
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
one sig r1_comm1 extends r1_comm {} {
capability = app_KeyFobControl.heldSwitchOff
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r2 extends r {}{
triggers = r2_trig
conditions = r2_cond
commands = r2_comm
}
abstract sig r2_trig extends Trigger {}
one sig r2_trig0 extends r2_trig {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_button
value = cap_button_attr_button_val_held
}
abstract sig r2_cond extends Condition {}
/*
one sig r2_cond0 extends r2_cond {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_button
value = cap_button_attr_button_val_no_value
}
*/
one sig r2_cond1 extends r2_cond {} {
capabilities = app_KeyFobControl.location
attribute = cap_location_attr_mode
value = cap_location_attr_mode_val - cap_location_attr_mode_val_newMode
}
abstract sig r2_comm extends Command {}
one sig r2_comm0 extends r2_comm {} {
capability = app_KeyFobControl.location
attribute = cap_location_attr_mode
value = cap_location_attr_mode_val_newMode
}
/*
one sig r3 extends r {}{
triggers = r3_trig
conditions = r3_cond
commands = r3_comm
}
abstract sig r3_trig extends Trigger {}
one sig r3_trig0 extends r3_trig {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_button
value = cap_button_attr_button_val_pushed
}
abstract sig r3_cond extends Condition {}
one sig r3_cond0 extends r3_cond {} {
capabilities = app_KeyFobControl.switchOn
attribute = cap_switch_attr_any
value = cap_switch_attr_any_val_no_value
}
one sig r3_cond1 extends r3_cond {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_pushed
value = cap_button_attr_pushed_val_no_value
}
one sig r3_cond2 extends r3_cond {} {
capabilities = app_KeyFobControl.switchOff
attribute = cap_switch_attr_any
value = cap_switch_attr_any_val_no_value
}
abstract sig r3_comm extends Command {}
one sig r3_comm0 extends r3_comm {} {
capability = app_KeyFobControl.switchOff
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r4 extends r {}{
triggers = r4_trig
conditions = r4_cond
commands = r4_comm
}
abstract sig r4_trig extends Trigger {}
one sig r4_trig0 extends r4_trig {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_button
value = cap_button_attr_button_val_held
}
abstract sig r4_cond extends Condition {}
one sig r4_cond0 extends r4_cond {} {
capabilities = app_KeyFobControl.heldSwitchOn
attribute = cap_switch_attr_any
value = cap_switch_attr_any_val_no_value
}
one sig r4_cond1 extends r4_cond {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_held
value = cap_button_attr_held_val_no_value
}
one sig r4_cond2 extends r4_cond {} {
capabilities = app_KeyFobControl.heldSwitchOff
attribute = cap_switch_attr_any
value = cap_switch_attr_any_val_no_value
}
abstract sig r4_comm extends Command {}
one sig r4_comm0 extends r4_comm {} {
capability = app_KeyFobControl.heldSwitchOff
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
*/
one sig r5 extends r {}{
triggers = r5_trig
conditions = r5_cond
commands = r5_comm
}
abstract sig r5_trig extends Trigger {}
one sig r5_trig0 extends r5_trig {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_button
value = cap_button_attr_button_val_pushed
}
abstract sig r5_cond extends Condition {}
/*
one sig r5_cond0 extends r5_cond {} {
capabilities = app_KeyFobControl.button
attribute = cap_button_attr_pushed
value = cap_button_attr_pushed_val_no_value
}
*/
one sig r5_cond1 extends r5_cond {} {
capabilities = app_KeyFobControl.location
attribute = cap_location_attr_mode
value = cap_location_attr_mode_val - cap_location_attr_mode_val_newMode
}
abstract sig r5_comm extends Command {}
one sig r5_comm0 extends r5_comm {} {
capability = app_KeyFobControl.location
attribute = cap_location_attr_mode
value = cap_location_attr_mode_val_newMode
}
|
oeis/181/A181442.asm | neoneye/loda-programs | 11 | 95357 | <gh_stars>10-100
; A181442: Solutions a(n) to (r(n)-2)*(r(n)-3) = 6*a(n)*(a(n)-1).
; Submitted by <NAME>
; 1,2,4,15,35,144,342,1421,3381,14062,33464,139195,331255,1377884,3279082,13639641,32459561,135018522,321316524,1336545575,3180705675,13230437224,31485740222,130967826661,311676696541,1296447829382,3085281225184,12833510467155,30541135555295,127038656842164,302326074327762,1257553057954481,2992719607722321,12448491922702642,29624870002895444,123227366169071935,293255980421232115,1219825169768016704,2902934934209425702,12075024331511095101,28736093361673024901,119530418145342934302
mov $3,1
lpb $0
sub $0,$3
add $4,1
add $4,$2
mov $1,$4
dif $1,2
add $2,$1
add $4,$2
lpe
mov $0,$2
add $0,1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.