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
etude/etude12.als
nishio/learning_alloy
1
447
<gh_stars>1-10 // puzzle enum Truth {T, F} abstract sig Pred { } sig X_IS_LIER extends Pred { who: Person } sig X_IS_LIE extends Pred { x: Pred } sig Person { said: Pred } fact { } run { one {truth: Pred -> Truth | (all p: X_IS_LIE {p.truth = T => p.x.truth = F}) and (all p: X_IS_LIER {p.truth = T => p.who.said.truth = F}) } }
programs/oeis/133/A133632.asm
jmorken/loda
1
160642
<reponame>jmorken/loda<filename>programs/oeis/133/A133632.asm ; A133632: a(1)=1, a(n)=(p-1)*a(n-1), if n is even, else a(n)=p*a(n-2), where p=5. ; 1,4,5,20,25,100,125,500,625,2500,3125,12500,15625,62500,78125,312500,390625,1562500,1953125,7812500,9765625,39062500,48828125,195312500,244140625,976562500,1220703125,4882812500,6103515625,24414062500 add $0,6 mov $2,2 lpb $0 sub $0,1 add $1,3 mov $3,1 add $3,$2 mov $2,$1 mov $1,5 mul $1,$3 lpe div $1,625 add $1,1
Functors.agda
jmchapman/Relative-Monads
21
9124
module Functors where open import Library open import Categories open Cat record Fun {a b c d} (C : Cat {a}{b})(D : Cat {c}{d}) : Set (a ⊔ b ⊔ c ⊔ d) where constructor functor field OMap : Obj C → Obj D HMap : ∀{X Y} → Hom C X Y → Hom D (OMap X) (OMap Y) fid : ∀{X} → HMap (iden C {X}) ≅ iden D {OMap X} fcomp : ∀{X Y Z}{f : Hom C Y Z}{g : Hom C X Y} → HMap (comp C f g) ≅ comp D (HMap f) (HMap g) open Fun IdF : ∀{a b}(C : Cat {a}{b}) → Fun C C IdF C = record{OMap = id;HMap = id;fid = refl;fcomp = refl} _○_ : ∀{a b c d e f}{C : Cat {a}{b}}{D : Cat {c}{d}}{E : Cat {e}{f}} → Fun D E → Fun C D → Fun C E _○_ {C = C}{D}{E} F G = record{ OMap = OMap F ∘ OMap G; HMap = HMap F ∘ HMap G; fid = proof HMap F (HMap G (iden C)) ≅⟨ cong (HMap F) (fid G) ⟩ HMap F (iden D) ≅⟨ fid F ⟩ iden E ∎; fcomp = λ {_}{_}{_}{f}{g} → proof HMap F (HMap G (comp C f g)) ≅⟨ cong (HMap F) (fcomp G) ⟩ HMap F (comp D (HMap G f) (HMap G g)) ≅⟨ fcomp F ⟩ comp E (HMap F (HMap G f)) (HMap F (HMap G g)) ∎} infix 10 _○_ FunctorEq : ∀{a b c d}{C : Cat {a}{b}}{D : Cat {c}{d}}(F G : Fun C D) → OMap F ≅ OMap G → (λ {X Y} → HMap F {X}{Y}) ≅ (λ {X}{Y} → HMap G {X}{Y}) → F ≅ G FunctorEq (functor fo fh _ _) (functor .fo .fh _ _) refl refl = cong₂ (functor fo fh) (iext λ _ → ir _ _) (iext λ _ → iext λ _ → iext λ _ → iext λ _ → iext λ _ → ir _ _)
LAB06/TASK03.asm
PrabalChowdhury/CSE-341-MICROPROCESSOR
0
17438
.MODEL SMALL .STACK 100H .DATA A DB 5 dup(?) Y dw $-A .CODE MAIN PROC MOV AX,@DATA MOV DS,AX mov ax,data mov ds,ax mov si,0 INPUT: cmp si,5 je CHECKIN mov ah,1 int 21h sub al,30h mov a[si],al add si,1 loop INPUT CHECKIN: mov si,0 mov dl,0ah mov ah,2 int 21h mov dl,0dh mov ah,2 int 21h mov cx,Y-1 mov si,0 AA: lea si,A mov bx,0 AB: add bx,1 mov al,a[si] add si,1 cmp al,A[si] jb AC xchg al,A[si] mov A[si-1],al AC: cmp bx,cx jl AB loop AA mov si,0 print_: cmp si,5h je EXIT mov dl,A[si] add dl,30h mov ah,2 int 21h add si,1 loop print_ EXIT: MOV AX,4C00H INT 21H MAIN ENDP END MAIN
Data/List/Relation/Permutation.agda
Lolirofle/stuff-in-agda
6
2861
<filename>Data/List/Relation/Permutation.agda module Data.List.Relation.Permutation where import Data open import Data.Boolean open import Data.List open import Data.List.Functions renaming (module LongOper to List) open import Data.List.Relation open import Functional using (id ; _∘_ ; const) open import Logic.Propositional open import Logic import Lvl open import Numeral.Finite open import Syntax.Function open import Type private variable ℓ : Lvl.Level private variable T A B : Type{ℓ} private variable l l₁ l₂ l₃ l₄ : List(T) private variable x y z : T private variable f : A → B private variable P : T → Bool -- The relation for two lists that are permutations of each other. -- This means that they contain the same elements and the same number of them but possibly in a different order. -- Or in other words, the first list is a reordered list of the second. data _permutes_ {ℓ} : List{ℓ}(T) → List{ℓ}(T) → Stmt{Lvl.𝐒(ℓ)} where empty : ∅ permutes (∅ {T = T}) prepend : (l₁ permutes l₂) → ((x ⊰ l₁) permutes (x ⊰ l₂)) swap : (x ⊰ y ⊰ l) permutes (y ⊰ x ⊰ l) trans : (l₁ permutes l₂) → (l₂ permutes l₃) → (l₁ permutes l₃) trans-swap : (l₁ permutes l₂) → ((x ⊰ y ⊰ l₁) permutes (y ⊰ x ⊰ l₂)) trans-swap p = trans swap (prepend (prepend p)) -- TODO -- _partition-of_ : List(List(T)) → List(T) → Stmt -- p partition-of l = (foldᵣ (x ↦ ¬ Empty(x) ∧_) Data.Unit p) ∧ (concat(p) permutes l) -- The permutation as a function between the permutated elements' indices. -- Example: -- p : [a,b,c,d,e,f] permutes [a,f,e,d,b,c] -- map(permutation-mapping(p)) [0,1,2,3,4,5] = [0,4,5,3,2,1] permutation-mapping : (l₁ permutes l₂) → (𝕟(length(l₁)) → 𝕟(length(l₂))) permutation-mapping empty = id permutation-mapping (prepend p) 𝟎 = 𝟎 permutation-mapping (prepend p) (𝐒 n) = 𝐒(permutation-mapping p n) permutation-mapping swap 𝟎 = 𝐒(𝟎) permutation-mapping swap (𝐒 𝟎) = 𝟎 permutation-mapping swap (𝐒(𝐒 n)) = 𝐒 (𝐒 n) permutation-mapping (trans p q) = permutation-mapping q ∘ permutation-mapping p -- TODO: It should be possible to make (_permutes_) the morphism of a category with some correct notion of equivalence (maybe trans swap swap ≡ refl for example?). Then permutation-mapping would be an instance of Functor(length) for the ((_→_) on₂ 𝕟) category? module Proofs where open import Data.List.Proofs open import Data.List.Equiv.Id open import Lang.Inspect open import Logic.Predicate open import Numeral.Natural open import Numeral.Finite.Proofs open import Relator.Equals open import Relator.Equals.Proofs open import Structure.Function.Domain open import Structure.Function.Domain.Proofs import Structure.Function.Names as Names open import Structure.Function.Proofs open import Structure.Function import Structure.Operator.Names as Names open import Structure.Operator.Properties open import Structure.Operator import Structure.Relator.Names as Names open import Structure.Relator.Equivalence open import Structure.Relator.Properties open import Structure.Setoid using (Equiv) open import Syntax.Function open import Syntax.Transitivity instance permutes-reflexivity : Reflexivity(_permutes_ {T = T}) permutes-reflexivity = intro proof where proof : Names.Reflexivity(_permutes_) proof {∅} = empty proof {_ ⊰ _} = prepend proof instance permutes-symmetry : Symmetry(_permutes_ {T = T}) permutes-symmetry = intro proof where proof : Names.Symmetry(_permutes_) proof empty = empty proof (prepend p) = prepend (proof p) proof swap = swap proof (trans p q) = trans (proof q) (proof p) instance permutes-transitivity : Transitivity(_permutes_ {T = T}) permutes-transitivity = intro trans instance permutes-equivalence : Equivalence(_permutes_ {T = T}) permutes-equivalence = intro permutes-equiv : Equiv(List(T)) Equiv._≡_ permutes-equiv = _permutes_ Equiv.equivalence permutes-equiv = permutes-equivalence -- If permutation relation had empty, prepend and trans-swap module _ where swap-from-trans-swap : (x ⊰ y ⊰ l) permutes (y ⊰ x ⊰ l) swap-from-trans-swap = trans-swap(reflexivity(_permutes_)) PermutationMappingCorrectness : (l₁ l₂ : List(T)) → (𝕟(length(l₁)) → 𝕟(length(l₂))) → Stmt PermutationMappingCorrectness l₁ l₂ mapping = ∀{i} → (index l₁(i) ≡ index l₂(mapping i)) permutation-mapping-correctness : (p : (l₁ permutes l₂)) → PermutationMappingCorrectness l₁ l₂ (permutation-mapping p) permutation-mapping-correctness empty = reflexivity(_≡_) permutation-mapping-correctness (prepend p) {𝟎} = reflexivity(_≡_) permutation-mapping-correctness (prepend p) {𝐒 i} = permutation-mapping-correctness p {i} permutation-mapping-correctness swap {𝟎} = reflexivity(_≡_) permutation-mapping-correctness swap {𝐒 𝟎} = reflexivity(_≡_) permutation-mapping-correctness swap {𝐒 (𝐒 i)} = reflexivity(_≡_) permutation-mapping-correctness (trans p q) = permutation-mapping-correctness p 🝖 permutation-mapping-correctness q instance permutation-mapping-injective : ∀{p : (l₁ permutes l₂)} → Injective(permutation-mapping p) permutation-mapping-injective {p = p} = intro(proof p) where proof : (p : (l₁ permutes l₂)) → Names.Injective(permutation-mapping p) proof (prepend p) {𝟎} {𝟎} eq = [≡]-intro proof (prepend p) {𝐒 x} {𝐒 y} eq = congruence₁(𝐒) (proof p (injective(𝐒) ⦃ [𝐒]-injective ⦄ eq)) proof swap {𝟎} {𝟎} eq = [≡]-intro proof swap {𝟎} {𝐒 (𝐒 y)} () proof swap {𝐒 (𝐒 x)} {𝟎} () proof swap {𝐒 𝟎} {𝐒 𝟎} eq = [≡]-intro proof swap {𝐒 (𝐒 x)} {𝐒 (𝐒 y)} eq = eq proof (trans p q) = proof p ∘ proof q instance permutation-mapping-surjective : ∀{p : (l₁ permutes l₂)} → Surjective(permutation-mapping p) permutation-mapping-surjective {p = p} = intro(proof p) where proof : (p : (l₁ permutes l₂)) → Names.Surjective(permutation-mapping p) ∃.witness (proof p {y}) = permutation-mapping(symmetry(_permutes_) p) y ∃.proof (proof (prepend p) {𝟎}) = [≡]-intro ∃.proof (proof (prepend p) {𝐒 y}) = congruence₁(𝐒) (∃.proof (proof p {y})) ∃.proof (proof swap {𝟎}) = [≡]-intro ∃.proof (proof swap {𝐒 𝟎}) = [≡]-intro ∃.proof (proof swap {𝐒 (𝐒 y)}) = [≡]-intro ∃.proof (proof (trans p q) {y}) = permutation-mapping (trans p q) (∃.witness (proof (trans p q))) 🝖[ _≡_ ]-[] (permutation-mapping (trans p q) ∘ permutation-mapping(symmetry(_permutes_) p) ∘ permutation-mapping (symmetry(_permutes_) q)) y 🝖[ _≡_ ]-[] (permutation-mapping q ∘ permutation-mapping p ∘ permutation-mapping(symmetry(_permutes_) p) ∘ permutation-mapping (symmetry(_permutes_) q)) y 🝖[ _≡_ ]-[ congruence₁(permutation-mapping q) (∃.proof (proof p {_})) ] (permutation-mapping q ∘ permutation-mapping (symmetry(_permutes_) q)) y 🝖[ _≡_ ]-[ ∃.proof (proof q {y}) ] y 🝖[ _≡_ ]-end permutation-mapping-bijective : ∀{p : (l₁ permutes l₂)} → Bijective(permutation-mapping p) permutation-mapping-bijective {p = p} = injective-surjective-to-bijective(permutation-mapping p) ⦃ permutation-mapping-injective {p = p} ⦄ ⦃ permutation-mapping-surjective {p = p} ⦄ {- permutation-from-mapping : (p : 𝕟(length(l₁)) → 𝕟(length(l₂))) ⦃ bij : Bijective(p) ⦄ (correctness : PermutationMappingCorrectness l₁ l₂ p) → (l₁ permutes l₂) permutation-from-mapping {l₁ = ∅} {l₂ = ∅} p _ = empty permutation-from-mapping {l₁ = ∅} {l₂ = x₂ ⊰ l₂} p _ = {!!} permutation-from-mapping {l₁ = x₁ ⊰ l₁} {l₂ = ∅} p _ = {!!} permutation-from-mapping {l₁ = x₁ ⊰ l₁} {l₂ = x₂ ⊰ l₂} p correctness with p(𝟎) | correctness{𝟎} ... | 𝟎 | [≡]-intro = prepend (permutation-from-mapping (forgetFirstCutoffOfBij p) ⦃ forgetFirstCutoffOfBij-bijective ⦄ {!!}) where bijective-equinumerous : ∀{a b}{f : 𝕟(a) → 𝕟(b)} → Bijective(f) → (a ≡ b) forgetFirstCutoff : ∀{a} → (𝕟(𝐒(a)) → 𝕟(𝐒(a))) → (𝕟(a) → 𝕟(a)) forgetFirstCutoff {𝐒(a)} f(x) with f(𝐒(x)) ... | 𝟎 = 𝟎 ... | 𝐒(y) = y forgetFirstCutoffOfBij : ∀{a b} → (f : 𝕟(𝐒(a)) → 𝕟(𝐒(b))) ⦃ bij : Bijective(f) ⦄ → (𝕟(a) → 𝕟(b)) forgetFirstCutoffOfBij {𝐒 a} f ⦃ bij ⦄ with [≡]-intro ← bijective-equinumerous bij = forgetFirstCutoff f forgetFirstCutoffOfBij-bijective : ∀{a b}{f : 𝕟(𝐒(a)) → 𝕟(𝐒(b))} ⦃ bij : Bijective(f) ⦄ → Bijective(forgetFirstCutoffOfBij f) -- proof : ∀{l₁ l₂ : List(T)}{p : 𝕟(length(l₁)) → 𝕟(length(l₂))} → PermutationMappingCorrectness l₁ l₂ (forgetFirstCutoffOfBij p) proof : PermutationMappingCorrectness l₁ l₂ (forgetFirstCutoffOfBij p) proof {i} = index l₁ i 🝖[ _≡_ ]-[ {!correctness!} ] index l₂ (forgetFirstCutoffOfBij p i) 🝖-end ... | 𝐒 w | _ = {!!} -} permutes-prepend-function : Function ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (List.prepend x) permutes-prepend-function = intro prepend permutes-postpend-function : Function ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (postpend x) permutes-postpend-function = intro proof where proof : (l₁ permutes l₂) → (postpend x l₁) permutes (postpend x l₂) proof empty = prepend empty proof (prepend x) = prepend (proof x) proof swap = swap proof (trans x y) = trans (proof x) (proof y) postpend-prepend-permutes : (postpend x l) permutes (List.prepend x l) postpend-prepend-permutes {l = ∅} = prepend empty postpend-prepend-permutes {l = x ⊰ l} = trans (prepend postpend-prepend-permutes) swap permutes-reverse : (reverse l) permutes l permutes-reverse {l = ∅} = empty permutes-reverse {l = x ⊰ l} = trans (Function.congruence ⦃ _ ⦄ ⦃ _ ⦄ permutes-postpend-function(permutes-reverse {l = l})) postpend-prepend-permutes permutes-length-function : Function ⦃ permutes-equiv {T = T} ⦄ (length) permutes-length-function = intro proof where proof : (l₁ permutes l₂) → (length l₁ ≡ length l₂) proof empty = [≡]-intro proof (prepend p) = congruence₁(𝐒) (proof p) proof swap = [≡]-intro proof (trans p q) = transitivity(_≡_) (proof p) (proof q) permutes-countᵣ-function : Function ⦃ permutes-equiv ⦄ (count P) permutes-countᵣ-function = intro proof where proof : (l₁ permutes l₂) → (count P l₁ ≡ count P l₂) proof empty = [≡]-intro proof {l₁ = x₁ ⊰ l₁} {P = P} (prepend {x = x} p) with P(x) ... | 𝑇 = [≡]-with 𝐒(proof {l₁ = l₁} {P = P} p) ... | 𝐹 = proof {l₁ = l₁} {P = P} p proof {P = P} (swap {x = x} {y = y}) with P(x) | P(y) ... | 𝑇 | 𝑇 = [≡]-intro ... | 𝑇 | 𝐹 = [≡]-intro ... | 𝐹 | 𝑇 = [≡]-intro ... | 𝐹 | 𝐹 = [≡]-intro proof (trans p q) = proof p 🝖 proof q permutes-satisfiesAny-functionᵣ : Function ⦃ permutes-equiv ⦄ (satisfiesAny f) permutes-satisfiesAny-functionᵣ = intro proof where proof : (l₁ permutes l₂) → (satisfiesAny f l₁ ≡ satisfiesAny f l₂) proof empty = [≡]-intro proof {f = f} (prepend{x = x} p) with f(x) ... | 𝑇 = [≡]-intro ... | 𝐹 = proof p proof {l₁ = x ⊰ y ⊰ l₁}{y ⊰ x ⊰ l₂}{f = f} (swap{x = x}{y = y}) with f(x) | f(y) | inspect f(x) | inspect f(y) ... | 𝑇 | 𝑇 | intro _ | intro _ = [≡]-intro ... | 𝑇 | 𝐹 | intro _ | intro _ with 𝑇 ← f(x) = [≡]-intro ... | 𝐹 | 𝑇 | intro _ | intro _ with 𝑇 ← f(y) = [≡]-intro ... | 𝐹 | 𝐹 | intro _ | intro _ with 𝐹 ← f(x) | 𝐹 ← f(y)= reflexivity(_≡_) proof (trans p q) = proof p 🝖 proof q {- TODO permutes-countₗ : (∀{P} → count P l₁ ≡ count P l₂) → (l₁ permutes l₂) permutes-countₗ {l₁ = ∅} {l₂ = ∅} p = empty permutes-countₗ {l₁ = ∅} {l₂ = x ⊰ l₂} p with () ← p{const 𝑇} permutes-countₗ {l₁ = x ⊰ l₁} {l₂ = ∅} p with () ← p{const 𝑇} permutes-countₗ {l₁ = x ⊰ l₁} {l₂ = x₁ ⊰ l₂} p = {!!} -- TODO: The rest of the cases from _permutes_. Maybe decidable equality on the items are required? -} permutes-[++]-function : BinaryOperator ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (_++_ {T = T}) permutes-[++]-function = binaryOperator-from-function ⦃ _ ⦄ ⦃ _ ⦄ ⦃ _ ⦄ ⦃ \{l} → intro(R{l = l}) ⦄ ⦃ intro L ⦄ where L : Names.Congruence₁ ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (_++ l) L {l = l} empty = reflexivity(_permutes_) L {l = l} (prepend l12) = prepend (L {l = l} l12) L {l = l} swap = swap L {l = l} (trans l13 l32) = transitivity(_permutes_) (L {l = l} l13) (L {l = l} l32) R : Names.Congruence₁ ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (l ++_) R {l = ∅} l12 = l12 R {l = x ⊰ l} l12 = prepend (R {l = l} l12) permutes-[++]-commutativity : Commutativity ⦃ permutes-equiv {T = T} ⦄ (_++_) permutes-[++]-commutativity = intro(\{l₁}{l₂} → proof{l₁}{l₂}) where proof : Names.Commutativity ⦃ permutes-equiv ⦄ (_++_) proof {∅} {l₂} rewrite identityᵣ(_++_)(∅) {l₂} = reflexivity(_permutes_) proof {x ⊰ l₁} {l₂} = (x ⊰ l₁) ++ l₂ 🝖[ _permutes_ ]-[] x ⊰ (l₁ ++ l₂) 🝖[ _permutes_ ]-[ prepend (proof {l₁} {l₂}) ] x ⊰ (l₂ ++ l₁) 🝖[ _permutes_ ]-[] (x ⊰ l₂) ++ l₁ 🝖[ _permutes_ ]-[ BinaryOperator.congruence ⦃ _ ⦄ ⦃ _ ⦄ ⦃ _ ⦄ permutes-[++]-function (postpend-prepend-permutes {l = l₂}) (reflexivity(_permutes_)) ]-sym (postpend x l₂) ++ l₁ 🝖[ _permutes_ ]-[ sub₂(_≡_)(_permutes_) ([++]-middle-prepend-postpend {l₁ = l₂}{l₂ = l₁}) ] l₂ ++ (x ⊰ l₁) 🝖[ _permutes_ ]-end permutes-empty-not-empty : ¬(∅ permutes (x ⊰ l)) permutes-empty-not-empty (trans {l₂ = ∅} p q) = permutes-empty-not-empty q permutes-empty-not-empty (trans {l₂ = _ ⊰ _} p q) = permutes-empty-not-empty p permutes-map : ∀{f : A → B} → Function ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (map f) permutes-map {f = f} = intro proof where proof : Names.Congruence₁ ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (map f) proof empty = empty proof (prepend p) = prepend (proof p) proof swap = swap proof (trans p q) = trans(proof p) (proof q) permutes-on-empty : (l permutes ∅) → (l ≡ ∅) permutes-on-empty empty = [≡]-intro permutes-on-empty (trans p q) rewrite permutes-on-empty q rewrite permutes-on-empty p = [≡]-intro permutes-on-singleton : (l permutes (singleton x)) → (l ≡ singleton x) permutes-on-singleton (prepend empty) = [≡]-intro permutes-on-singleton (prepend (trans p q)) rewrite permutes-on-empty q rewrite permutes-on-empty p = [≡]-intro permutes-on-singleton (trans p q) rewrite permutes-on-singleton q rewrite permutes-on-singleton p = [≡]-intro permutes-insertIn : ∀{n} → ((insertIn x l n) permutes (x ⊰ l)) permutes-insertIn {n = 𝟎} = reflexivity(_permutes_) permutes-insertIn {l = x ⊰ l} {n = 𝐒 n} = trans (prepend (permutes-insertIn {n = n})) swap module InsertionPermutation where data _insertion-permutes_ {ℓ} : List{ℓ}(T) → List{ℓ}(T) → Stmt{Lvl.𝐒(ℓ)} where empty : ∅ insertion-permutes (∅ {T = T}) ins : (n : 𝕟₌(length l₁)) → (l₁ insertion-permutes l₂) → ((insertIn x l₁ n) insertion-permutes (x ⊰ l₂)) open import Data.List.Proofs.Length open import Relator.Equals.Proofs open import Structure.Relator insertion-permutation-mapping : (l₁ insertion-permutes l₂) → (𝕟(length(l₁)) → 𝕟(length(l₂))) insertion-permutation-mapping empty () insertion-permutation-mapping (ins 𝟎 p) 𝟎 = 𝟎 insertion-permutation-mapping (ins 𝟎 p) (𝐒 i) = 𝐒(insertion-permutation-mapping p i) insertion-permutation-mapping (ins {l₁ = x ⊰ l₁} (𝐒 n) p) 𝟎 = 𝟎 insertion-permutation-mapping (ins {l₁ = x ⊰ l₁} (𝐒 n) p) (𝐒 i) = 𝐒(insertion-permutation-mapping p (substitute₁(𝕟) (length-insertIn {l = l₁} {n = n}) i)) open import Data using () open import Numeral.Natural open import Relator.Equals open import Syntax.Number insertion-permutes-prepend : (l₁ insertion-permutes l₂) → ((x ⊰ l₁) insertion-permutes (x ⊰ l₂)) insertion-permutes-prepend p = ins 𝟎 p insertion-permutes-refl : l insertion-permutes l insertion-permutes-refl {l = ∅} = empty insertion-permutes-refl {l = x ⊰ l} = insertion-permutes-prepend insertion-permutes-refl insertion-permutes-swap : (x ⊰ y ⊰ l) insertion-permutes (y ⊰ x ⊰ l) insertion-permutes-swap = ins 1 (insertion-permutes-prepend insertion-permutes-refl) insertion-permutes-to-permutes : (l₁ insertion-permutes l₂) → (l₁ permutes l₂) insertion-permutes-to-permutes empty = empty insertion-permutes-to-permutes (ins n p) = trans Proofs.permutes-insertIn (prepend (insertion-permutes-to-permutes p)) insertion-permutes-flipped-ins : ∀{n} → (l₁ insertion-permutes l₂) → ((x ⊰ l₁) insertion-permutes (insertIn x l₂ n)) insertion-permutes-flipped-ins {n = 𝟎} empty = insertion-permutes-refl insertion-permutes-flipped-ins {n = 𝟎} (ins k p) = insertion-permutes-prepend (ins k p) insertion-permutes-flipped-ins {n = 𝐒 n} (ins k p) = ins (𝐒 k) (insertion-permutes-flipped-ins {n = n} p) insertion-permutes-sym : (l₁ insertion-permutes l₂) → (l₂ insertion-permutes l₁) insertion-permutes-sym empty = empty insertion-permutes-sym (ins n p) = insertion-permutes-flipped-ins(insertion-permutes-sym p) {- insertion-permutes-trans : (l₁ insertion-permutes l₂) → (l₃ insertion-permutes l₂) → (l₁ insertion-permutes l₃) ins2 : ∀{n₁ n₂} → (l₁ insertion-permutes l₂) → ((insertIn x l₁ n₁) insertion-permutes (insertIn x l₂ n₂)) ins2 {l₁ = l₁} {l₂} {n₁ = n₁} {𝟎} p = ins n₁ p ins2 {l₁ = .(insertIn x _ n)} {x ⊰ l₂} {n₁ = 𝟎} {𝐒 n₂} (ins n p) = insertion-permutes-trans (insertion-permutes-prepend (ins n p)) (ins(𝐒 n₂) insertion-permutes-refl) ins2 {l₁ = .(insertIn x _ n)} {x ⊰ l₂} {n₁ = 𝐒 n₁} {𝐒 n₂} (ins n p) = {!!} insertion-permutes-trans empty empty = empty insertion-permutes-trans (ins m p) (ins n q) = {!!} -- ins2(insertion-permutes-trans p q) -} {- insertion-permutation-mapping-correctness : (p : (l₁ insertion-permutes l₂)) → Proofs.PermutationMappingCorrectness l₁ l₂ (insertion-permutation-mapping p) insertion-permutation-mapping-correctness (ins {l₁ = ∅} 𝟎 p) {𝟎} = [≡]-intro insertion-permutation-mapping-correctness (ins {l₁ = x ⊰ l₁} 𝟎 p) {𝟎} = [≡]-intro insertion-permutation-mapping-correctness (ins {l₁ = x ⊰ l₁} 𝟎 p) {𝐒 i} = insertion-permutation-mapping-correctness p insertion-permutation-mapping-correctness (ins {l₁ = x ⊰ l₁} (𝐒 n) p) {𝟎} = {!!} insertion-permutation-mapping-correctness (ins {l₁ = x ⊰ l₁} (𝐒 n) p) {𝐒 i} = {!!} -} -- test : (p : (l₁ insertion-permutes l₂)) → (∀{i} → (index l₁(insertion-permutation-mapping p i) ≡ index l₂(i))) -- test p = ? {- open import Data.Boolean.Stmt open import Numeral.Finite.Oper.Comparisons test : ∀{l : List(T)}{n₁ : 𝕟(𝐒(length l))}{n₂ : 𝕟(𝐒(length (insertIn y l n₁)))} → IsTrue(n₁ >? n₂) → (insertIn y (insertIn x l n₁) n₂ ≡ insertIn x (insertIn y l n₁) n₂) test p = {!!} -} {- ins2 : ∀{n₁ n₂} → (l₁ insertion-permutes l₂) → ((insertIn x l₁ n₁) insertion-permutes (insertIn x l₂ n₂)) ins2 {n₁ = 𝟎} {𝟎} empty = insertion-permutes-refl ins2 {n₁ = n₁} {𝟎} (ins n p) = ins n₁ (ins n p) ins2 {x = x} {n₁ = n₁} {𝐒 n₂} (ins {x = y} n p) = {!(ins2 {x = x}{n₁ = n}{n₂ = n₂} p)!} insertion-permutes-trans : (l₁ insertion-permutes l₂) → (l₃ insertion-permutes l₂) → (l₁ insertion-permutes l₃) insertion-permutes-trans empty empty = empty insertion-permutes-trans (ins m p) (ins n q) = {!!} -} {- test : ∀{n} → (l₁ insertion-permutes (y ⊰ insertIn x l₂ n)) → (l₁ insertion-permutes (x ⊰ insertIn y l₂ n)) test {l₂ = l₂} (ins {l₁ = l₁} n p) = {!!} ins2 : ∀{n₁ n₂} → (l₁ insertion-permutes l₂) → ((insertIn x l₁ n₁) insertion-permutes (insertIn x l₂ n₂)) ins2 {n₁ = n₁} {𝟎} p = ins n₁ p ins2 {n₁ = n₁} {𝐒 n₂} (ins {x = x} n p) = test(ins n₁ (ins2{x = x}{n}{n₂} p)) -- insertIn x₁ (insertIn x l₁ n) n₁ -- x ⊰ insertIn x₁ l₂ n₂ tr : (l₁ insertion-permutes l₂) → (l₃ insertion-permutes l₂) → (l₁ insertion-permutes l₃) tr {l₂ = ∅} empty empty = empty tr {l₂ = x₂ ⊰ l₂} (ins n₁ p) (ins n₂ q) = ins2(tr p q) sym : (l₁ insertion-permutes l₂) → (l₂ insertion-permutes l₁) sym = tr insertion-permutes-refl -}
src/main/antlr/de/up/ling/irtg/codec/bottomup_treeautomaton/BottomUpTreeAutomaton.g4
akoehn/alto
10
3348
grammar BottomUpTreeAutomaton; @header{ package de.up.ling.irtg.codec.bottomup_treeautomaton; } ARROW : '->'; OPBK : '('; CLBK : ')'; COMMA: ','; ANGLE_IDENTIFIER: '<' (~[>])* '>'; DOUBLE_QUOTED_NAME: ["] (~["])* ["]; QUOTED_NAME: ['] (~['])* [']; NAME: ~('<' | '(' | ')' | '"' | '\'' | ','| '\t' | ' ' | '\r' | '\n'| '\u000C' ) ((~( '(' | ')' | ',' | '\t' | ' ' | '\r' | '\n'| '\u000C' ))*); WS: [ \n\t\r]+ -> skip; COMMENT : ( '#' ~[\r\n]* '\r'? '\n' ) -> skip ; fta : state+ auto_rule+; auto_rule : name state_list ARROW state weight?; state_list : ('(' (state ',')* state ')')?; weight: ANGLE_IDENTIFIER; name : NAME #RAW | DOUBLE_QUOTED_NAME #QUOTED | QUOTED_NAME #QUOTED | ANGLE_IDENTIFIER #ANGLE; state : name;
libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_fzx_tty_z88dk/zx_01_output_fzx_tty_z88dk_21_foreground_attr.asm
jpoikela/z88dk
640
3377
<reponame>jpoikela/z88dk SECTION code_driver SECTION code_driver_terminal_output PUBLIC zx_01_output_fzx_tty_z88dk_21_foreground_attr zx_01_output_fzx_tty_z88dk_21_foreground_attr: ; change foreground colour ; de = parameters * ld a,(de) ld (ix+52),a ret
boards/msp_exp430g2/mspgd-board.ads
ekoeppen/MSP430_Generic_Ada_Drivers
0
15489
with Startup; with MSPGD.GPIO; use MSPGD.GPIO; with MSPGD.GPIO.Pin; with MSPGD.UART.Peripheral; with MSPGD.SPI.Peripheral; with MSPGD.Clock; use MSPGD.Clock; with MSPGD.Clock.Source; package MSPGD.Board is pragma Preelaborate; package Clock is new MSPGD.Clock.Source (Source => SMCLK, Input => DCO, Frequency => 8_000_000); package LED_RED is new MSPGD.GPIO.Pin (Port => 1, Pin => 0, Direction => Output); package LED_GREEN is new MSPGD.GPIO.Pin (Port => 1, Pin => 6, Direction => Output); package RX is new MSPGD.GPIO.Pin (Port => 1, Pin => 1, Alt_Func => Secondary); package TX is new MSPGD.GPIO.Pin (Port => 1, Pin => 2, Alt_Func => Secondary); package SCLK is new MSPGD.GPIO.Pin (Port => 1, Pin => 5, Alt_Func => Secondary); package MISO is new MSPGD.GPIO.Pin (Port => 1, Pin => 6, Alt_Func => Secondary); package MOSI is new MSPGD.GPIO.Pin (Port => 1, Pin => 7, Alt_Func => Secondary); package SSEL is new MSPGD.GPIO.Pin (Port => 2, Pin => 1, Direction => Output); package BUTTON is new MSPGD.GPIO.Pin (Port => 1, Pin => 3, Pull_Resistor => Up); package UART is new MSPGD.UART.Peripheral (Speed => 9600, Clock => Clock); package SPI is new MSPGD.SPI.Peripheral (Module => MSPGD.SPI.USCI_B, Speed => 4_000_000, Clock => Clock); procedure Init; end MSPGD.Board;
test-ok-NAS-84.asm
acastrauss/compiler_project
0
100022
main: PUSH %14 MOV %15,%14 SUBS %15,$8,%15 SUBS %15,$16,%15 SUBS %15,$4,%15 @main_body: MOV $1,-4(%14) MOV $2,-8(%14) MOV -4(%14),%0 ADDS $1,-4(%14),-4(%14) MOV %0,-12(%14) MOV $0,-16(%14) MOV $12,-20(%14) MOV $2,-24(%14) MOV $2,-28(%14) @main_exit: MOV %14,%15 POP %14 RET
agda-stdlib/src/Algebra/Core.agda
DreamLinuxer/popl21-artifact
5
15901
<filename>agda-stdlib/src/Algebra/Core.agda ------------------------------------------------------------------------ -- The Agda standard library -- -- Core algebraic definitions ------------------------------------------------------------------------ -- The contents of this module should be accessed via `Algebra`. {-# OPTIONS --without-K --safe #-} module Algebra.Core where open import Level using (_⊔_) ------------------------------------------------------------------------ -- Unary and binary operations Op₁ : ∀ {ℓ} → Set ℓ → Set ℓ Op₁ A = A → A Op₂ : ∀ {ℓ} → Set ℓ → Set ℓ Op₂ A = A → A → A ------------------------------------------------------------------------ -- Left and right actions Opₗ : ∀ {a b} → Set a → Set b → Set (a ⊔ b) Opₗ A B = A → B → B Opᵣ : ∀ {a b} → Set a → Set b → Set (a ⊔ b) Opᵣ A B = B → A → B
benchmark/byte_reader.adb
skill-lang/skillAdaTestSuite
1
8699
<gh_stars>1-10 -- ___ _ ___ _ _ -- -- / __| |/ (_) | | Your SKilL Ada Binding -- -- \__ \ ' <| | | |__ <<debug>> -- -- |___/_|\_\_|_|____| by: <<some developer>> -- -- -- package body Byte_Reader is procedure Read_Buffer (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : out Buffer) is use Ada.Streams; Buffer : Stream_Element_Array (1 .. Stream_Element_Offset (Buffer_Size)); Last : Stream_Element_Offset; begin Stream.Read (Buffer, Last); Buffer_Last := Positive (Last); for I in 1 .. Last loop Item (Integer (I)) := Byte (Buffer (I)); end loop; end Read_Buffer; procedure Reset_Buffer is begin Byte_Reader.Buffer_Index := Byte_Reader.Buffer_Size; end Reset_Buffer; function End_Of_Buffer return Boolean is (Byte_Reader.Buffer_Index >= Byte_Reader.Buffer_Last); function Read_Byte (Input_Stream : ASS_IO.Stream_Access) return Byte is begin if Buffer_Size = Buffer_Index then Buffer'Read (Input_Stream, Buffer_Array); Buffer_Index := 0; end if; Buffer_Index := Buffer_Index + 1; declare Next : Byte := Buffer_Array (Buffer_Index); begin return Next; end; end Read_Byte; -- Short_Short_Integer function Read_i8 (Input_Stream : ASS_IO.Stream_Access) return i8 is function Convert is new Ada.Unchecked_Conversion (Byte, i8); begin return Convert (Read_Byte (Input_Stream)); end Read_i8; -- Short_Integer (Short) function Read_i16 (Input_Stream : ASS_IO.Stream_Access) return i16 is A : i16 := i16 (Read_Byte (Input_Stream)); B : i16 := i16 (Read_Byte (Input_Stream)); begin return A * (2**8) + B; end Read_i16; -- Integer function Read_i32 (Input_Stream : ASS_IO.Stream_Access) return i32 is A : i32 := i32 (Read_Byte (Input_Stream)); B : i32 := i32 (Read_Byte (Input_Stream)); C : i32 := i32 (Read_Byte (Input_Stream)); D : i32 := i32 (Read_Byte (Input_Stream)); begin return A * (2 ** 24) + B * (2 ** 16) + C * (2 ** 8) + D; end Read_i32; -- Long_Integer (Long) function Read_i64 (Input_Stream : ASS_IO.Stream_Access) return i64 is A : i64 := i64 (Read_Byte (Input_Stream)); B : i64 := i64 (Read_Byte (Input_Stream)); C : i64 := i64 (Read_Byte (Input_Stream)); D : i64 := i64 (Read_Byte (Input_Stream)); E : i64 := i64 (Read_Byte (Input_Stream)); F : i64 := i64 (Read_Byte (Input_Stream)); G : i64 := i64 (Read_Byte (Input_Stream)); H : i64 := i64 (Read_Byte (Input_Stream)); begin return A * (2 ** 56) + B * (2 ** 48) + C * (2 ** 40) + D * (2 ** 32) + E * (2 ** 24) + F * (2 ** 16) + G * (2 ** 8) + H; end Read_i64; function Read_v64 (Input_Stream : ASS_IO.Stream_Access) return v64 is type Result is new Interfaces.Unsigned_64; function Convert is new Ada.Unchecked_Conversion (Source => Result, Target => v64); Count : Natural := 0; rval : Result := 0; Bucket : Result := Result (Read_Byte (Input_Stream)); begin while (Count < 8 and then 0 /= (Bucket and 16#80#)) loop rval := rval or ((Bucket and 16#7f#) * (2 ** (7 * Count))); Count := Count + 1; Bucket := Result (Read_Byte (Input_Stream)); end loop; case Count is when 8 => rval := rval or (Bucket * (2 ** (7 * Count))); when others => rval := rval or ((Bucket and 16#7f#) * (2 ** (7 * Count))); end case; return Convert (rval); end Read_v64; function Read_Boolean (Input_Stream : ASS_IO.Stream_Access) return Boolean is Unexcepted_Value : exception; begin case Read_Byte (Input_Stream) is when 16#ff# => return True; when 16#00# => return False; when others => raise Unexcepted_Value; end case; end Read_Boolean; function Read_String (Input_Stream : ASS_IO.Stream_Access; Length : i32) return String is New_String : String (1 .. Integer (Length)); begin for I in Integer range 1 .. Integer (Length) loop New_String (I) := Character'Val (Read_Byte (Input_Stream)); end loop; return New_String; end Read_String; procedure Skip_Bytes (Input_Stream : ASS_IO.Stream_Access; Length : Long) is begin for I in 1 .. Length loop declare Skip : Byte := Read_Byte (Input_Stream); begin null; end; end loop; end Skip_Bytes; end Byte_Reader;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/prot2.ads
best08618/asylo
7
7441
package Prot2 is procedure Dummy; end Prot2;
programs/oeis/053/A053565.asm
jmorken/loda
1
243845
; A053565: a(n) = 2^(n-1)*(3*n-4). ; -2,-1,4,20,64,176,448,1088,2560,5888,13312,29696,65536,143360,311296,671744,1441792,3080192,6553600,13893632,29360128,61865984,130023424,272629760,570425344,1191182336,2483027968,5167382528,10737418240,22280142848,46170898432,95563022336,197568495616,408021893120,841813590016,1735166787584,3573412790272,7352984010752,15118284881920,31061203484672,63771674411008,130841883705344,268280837177344,549755813888000,1125899906842624,2304576371818496,4714705859903488 mov $1,$0 sub $0,1 lpb $0 add $1,$0 sub $0,1 mul $1,2 lpe sub $1,2 mov $0,$1 add $0,$1 mul $0,2 mov $1,$0 div $1,4
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_21829_1667.asm
ljhsiun2/medusa
9
18138
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x1d93e, %rsi lea addresses_D_ht+0x77fe, %rdi nop nop nop nop xor $43829, %r9 mov $43, %rcx rep movsb nop nop add %r11, %r11 lea addresses_A_ht+0x140ee, %rsi lea addresses_D_ht+0x159d0, %rdi nop nop nop nop inc %rbp mov $64, %rcx rep movsw nop nop nop xor %rsi, %rsi lea addresses_WT_ht+0x191fe, %rcx cmp %r8, %r8 movb (%rcx), %r11b nop add $61605, %r9 lea addresses_WC_ht+0x7a4e, %r9 nop nop nop cmp $29641, %r11 mov (%r9), %ebp nop nop nop nop xor $33796, %rbp lea addresses_D_ht+0x83fe, %rcx and %r8, %r8 mov $0x6162636465666768, %r11 movq %r11, (%rcx) sub $37126, %r11 lea addresses_UC_ht+0x8eae, %rsi add %rbp, %rbp vmovups (%rsi), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %r9 nop nop nop and $4068, %rdi lea addresses_UC_ht+0x14773, %rcx clflush (%rcx) nop nop nop nop nop xor %rbp, %rbp mov (%rcx), %si nop nop nop sub %r8, %r8 lea addresses_WT_ht+0x1dfb2, %rsi nop nop nop nop nop sub %r8, %r8 mov $0x6162636465666768, %rcx movq %rcx, %xmm7 vmovups %ymm7, (%rsi) nop nop nop nop nop dec %rsi lea addresses_UC_ht+0x143fe, %rdi xor $53872, %rsi movw $0x6162, (%rdi) nop add %rdi, %rdi lea addresses_WC_ht+0x157fe, %rsi nop xor $38870, %r9 movw $0x6162, (%rsi) nop nop nop nop nop add $14751, %r11 lea addresses_WT_ht+0x41fe, %rsi lea addresses_D_ht+0x11dfe, %rdi nop nop nop dec %rdx mov $96, %rcx rep movsq nop nop dec %rdx lea addresses_A_ht+0x132be, %rsi nop nop nop nop cmp $58295, %rbp mov $0x6162636465666768, %rcx movq %rcx, (%rsi) nop nop sub %r9, %r9 lea addresses_D_ht+0x19bfe, %rdx nop nop nop nop nop and $971, %rdi mov (%rdx), %cx nop add %r9, %r9 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %r15 push %rbx push %rcx push %rsi // Store lea addresses_D+0xfe16, %rsi nop nop nop nop and $48546, %rcx movl $0x51525354, (%rsi) nop nop inc %rsi // Store lea addresses_WC+0x705e, %r14 nop nop nop nop nop and %r13, %r13 movl $0x51525354, (%r14) nop nop nop nop nop sub %rcx, %rcx // Load mov $0x6006a100000008fe, %rcx nop nop nop nop inc %r10 vmovups (%rcx), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %r14 nop cmp $40842, %r15 // Faulty Load lea addresses_WC+0x193fe, %r10 nop sub $42646, %r15 mov (%r10), %r13w lea oracles, %r10 and $0xff, %r13 shlq $12, %r13 mov (%r10,%r13,1), %r13 pop %rsi pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 3, 'type': 'addresses_D', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WC', 'AVXalign': False, 'size': 4}} {'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_NC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': True, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 10, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}} {'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}} {'src': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}} {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_D_ht', 'AVXalign': True, 'size': 2}, 'OP': 'LOAD'} {'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 */
Data/List/Kleene/AsList.agda
oisdk/agda-kleene-lists
0
15738
{-# OPTIONS --without-K --safe #-} ------------------------------------------------------------------------ -- Re-exports of the Data.List.Kleene module, renamed to duplicate the -- Data.List API. module Data.List.Kleene.AsList where import Data.List.Kleene.Base as Kleene open import Data.List.Kleene.Base using ( [] ) renaming ( _⋆ to List ; foldr⋆ to foldr ; foldl⋆ to foldl ; _⋆++⋆_ to _++_ ; map⋆ to map ; pure⋆ to pure ; _⋆<*>⋆_ to _<*>_ ; _⋆>>=⋆_ to _>>=_ ; mapAccumL⋆ to mapAccumL ; _[_]⋆ to _[_] ; applyUpTo⋆ to applyUpTo ; upTo⋆ to upTo ; intersperse⋆ to intersperse ; _⋆<|>⋆_ to _<|>_ ; ⋆zipWith⋆ to zipWith ; unzipWith⋆ to unzipWith ; partitionSumsWith⋆ to partitionSumsWith ; ⋆transpose⋆ to transpose ; reverse⋆ to reverse ) public infixr 5 _∷_ pattern _∷_ x xs = Kleene.∹ x Kleene.& xs scanr : ∀ {a b} {A : Set a} {B : Set b} → (A → B → B) → B → List A → List B scanr f b xs = Kleene.∹ Kleene.scanr⋆ f b xs scanl : ∀ {a b} {A : Set a} {B : Set b} → (B → A → B) → B → List A → List B scanl f b xs = Kleene.∹ Kleene.scanl⋆ f b xs tails : ∀ {a} {A : Set a} → List A → List (List A) tails xs = foldr (λ x xs → (Kleene.∹ x) ∷ xs) ([] ∷ []) (Kleene.tails⋆ xs) import Data.List.Kleene.Syntax module Syntax = Data.List.Kleene.Syntax using (_]; _,_) renaming (⋆[_ to [_)
oeis/051/A051885.asm
neoneye/loda-programs
11
17898
; A051885: Smallest number whose sum of digits is n. ; 0,1,2,3,4,5,6,7,8,9,19,29,39,49,59,69,79,89,99,199,299,399,499,599,699,799,899,999,1999,2999,3999,4999,5999,6999,7999,8999,9999,19999,29999,39999,49999,59999,69999,79999,89999,99999,199999,299999,399999,499999,599999,699999,799999,899999,999999,1999999,2999999,3999999,4999999,5999999,6999999,7999999,8999999,9999999,19999999,29999999,39999999,49999999,59999999,69999999,79999999,89999999,99999999,199999999,299999999,399999999,499999999,599999999,699999999,799999999,899999999,999999999,1999999999 seq $0,71061 ; Abjad values of the Arabic letters in the traditional order for abjad calculations. sub $0,1
source/textio/a-teioed.adb
ytomino/drake
33
12755
pragma Check_Policy (Trace => Ignore); with Ada.Exception_Identification.From_Here; with Ada.Text_IO.Formatting; with System.Formatting.Decimal; with System.Formatting.Literals; with System.Long_Long_Integer_Types; package body Ada.Text_IO.Editing is use Exception_Identification.From_Here; use type System.Long_Long_Integer_Types.Word_Unsigned; subtype Word_Unsigned is System.Long_Long_Integer_Types.Word_Unsigned; procedure To_Picture ( Pic_String : String; Result : out Picture; Blank_When_Zero : Boolean := False; Error : out Boolean); procedure To_Picture ( Pic_String : String; Result : out Picture; Blank_When_Zero : Boolean := False; Error : out Boolean) is type Currency_State is (None, Dollar, Sharp); pragma Discard_Names (Currency_State); Currency : Currency_State := None; type Paren_State is (None, Opened, Closed); pragma Discard_Names (Paren_State); Paren : Paren_State := None; type Sign_State is (None, Plus, Minus); pragma Discard_Names (Sign_State); Sign : Sign_State := None; type Suppression_State is (None, Z, Asterisk); pragma Discard_Names (Suppression_State); Suppression : Suppression_State := None; type State_Type is ( Start, Any_Sign, B_After_Sign, Any_Suppression, Nine, Radix, Fraction); pragma Discard_Names (State_Type); State : State_Type := Start; I : Positive := Pic_String'First; begin Result.Length := 0; Result.Has_V := False; Result.Has_Dollar := None; Result.Blank_When_Zero := Blank_When_Zero; Result.Real_Blank_When_Zero := True; Result.First_Sign_Position := 0; Result.Aft := 0; while I <= Pic_String'Last loop case Pic_String (I) is when '(' => declare Count_First : Positive; Count_Last : Natural; Count : Natural; begin Formatting.Get_Tail ( Pic_String (I + 1 .. Pic_String'Last), First => Count_First); declare Count_U : Word_Unsigned; begin System.Formatting.Literals.Get_Literal ( Pic_String (Count_First .. Pic_String'Last), Count_Last, Count_U, Error => Error); if Error or else Count_U > Word_Unsigned (Natural'Last) then return; -- Picture_Error end if; Count := Natural (Count_U); end; if Count = 0 or else I = Pic_String'First or else I + Count - 1 > Pic_String'Last then Error := True; return; -- Picture_Error end if; System.Formatting.Fill_Padding ( Result.Expanded ( Result.Length + 1 .. Result.Length + Count - 1), Pic_String (I - 1)); Result.Length := Result.Length + Count - 1; I := Count_Last + 1; end; when ')' => Error := True; return; -- Picture_Error when others => Result.Length := Result.Length + 1; if Result.Length > Result.Expanded'Last then Error := True; return; -- Picture_Error end if; Result.Expanded (Result.Length) := Pic_String (I); case Pic_String (I) is when '$' => if Currency = Sharp then Error := True; return; -- Picture_Error end if; Currency := Dollar; if State >= Radix then if Result.Has_Dollar = None then Error := True; return; -- Picture_Error end if; Result.Aft := Result.Aft + 1; else Result.Has_Dollar := Previous; end if; when '#' => if Currency = Dollar then Error := True; return; -- Picture_Error end if; Currency := Sharp; when '<' => if Paren = Closed then Error := True; return; -- Picture_Error end if; Paren := Opened; if Result.First_Sign_Position = 0 then Result.First_Sign_Position := Result.Length; end if; if State >= Radix then State := Fraction; Result.Aft := Result.Aft + 1; end if; when '>' => if Paren /= Opened then Error := True; return; -- Picture_Error end if; Paren := Closed; when '+' => if Sign = Minus or else State >= Radix then Error := True; return; -- Picture_Error end if; if Result.First_Sign_Position = 0 then Result.First_Sign_Position := Result.Length; end if; Sign := Plus; if State < Any_Sign then State := Any_Sign; end if; when '-' => if Sign = Plus or else State >= Radix then Error := True; return; -- Picture_Error end if; if Result.First_Sign_Position = 0 then Result.First_Sign_Position := Result.Length; end if; Sign := Minus; if State < Any_Sign then State := Any_Sign; end if; when '*' => if Blank_When_Zero then Error := True; return; -- Picture_Error end if; Result.Real_Blank_When_Zero := False; if State >= Radix then State := Fraction; Result.Aft := Result.Aft + 1; elsif Suppression = Z or else State > Any_Suppression then Error := True; return; -- Picture_Error else Suppression := Asterisk; State := Any_Suppression; end if; when 'Z' | 'z' => Result.Expanded (Result.Length) := 'Z'; if State >= Radix then State := Fraction; Result.Aft := Result.Aft + 1; elsif Suppression = Asterisk or else State > Any_Suppression then Error := True; return; -- Picture_Error else Suppression := Z; State := Any_Suppression; end if; when '9' => Result.Real_Blank_When_Zero := False; if State >= Radix then State := Fraction; Result.Aft := Result.Aft + 1; elsif State > Nine then Error := True; return; -- Picture_Error else State := Nine; end if; when '.' => if State > Radix or else ( State <= Any_Sign and then Currency = None and then Paren = None) then Error := True; return; -- Picture_Error end if; State := Radix; Result.Radix_Position := Result.Length; when 'V' | 'v' => Result.Expanded (Result.Length) := 'V'; if State > Radix or else ( State <= Any_Sign and then Currency = None and then Paren = None) then Error := True; return; -- Picture_Error end if; State := Radix; Result.Radix_Position := Result.Length; Result.Has_V := True; when 'B' | 'b' => Result.Expanded (Result.Length) := 'B'; if State = Any_Sign then State := B_After_Sign; end if; when '_' | '/' | '0' => null; when others => Error := True; return; -- Picture_Error end case; I := I + 1; end case; end loop; if Paren = Opened or else ( State < Any_Sign and then Currency = None and then Paren = None) or else State = B_After_Sign -- CXF3A01 then Error := True; return; -- Picture_Error end if; if State < Radix then Result.Radix_Position := Result.Length + 1; end if; Result.Real_Blank_When_Zero := (Result.Real_Blank_When_Zero and then State > Any_Suppression) or else Blank_When_Zero; Error := False; end To_Picture; function Length (Pic : Picture; Currency : String := Default_Currency) return Natural; function Length (Pic : Picture; Currency : String := Default_Currency) return Natural is Result : Natural := Pic.Length; begin if Pic.Has_V then Result := Result - 1; end if; if Pic.Has_Dollar /= None then Result := Result + Currency'Length - 1; end if; return Result; end Length; procedure Image ( Item : Long_Long_Integer; Result : out String; Scale : Integer; Fore : Integer; Pic : Picture; Currency : String := Default_Currency; Fill : Character := Default_Fill; Separator : Character := Default_Separator; Radix_Mark : Character := Default_Radix_Mark; Error : out Boolean); procedure Image ( Item : Long_Long_Integer; Result : out String; Scale : Integer; Fore : Integer; Pic : Picture; Currency : String := Default_Currency; Fill : Character := Default_Fill; Separator : Character := Default_Separator; Radix_Mark : Character := Default_Radix_Mark; Error : out Boolean) is begin if Pic.Real_Blank_When_Zero and then Item = 0 then System.Formatting.Fill_Padding (Result, ' '); else declare Currency_Length : constant Natural := Currency'Length; Aft : constant Natural := Pic.Aft; Item_Image : String (1 .. Fore + Aft + 2); -- sign and '.' Item_Fore_Last, Item_Last : Natural; Radix_Position : Integer := Pic.Radix_Position; begin if Pic.Has_Dollar = Previous then Radix_Position := Radix_Position + Currency_Length - 1; end if; System.Formatting.Decimal.Image ( Item, Item_Image, Item_Fore_Last, Item_Last, Scale, Signs => (' ', ' ', ' '), -- for skipping Fore_Digits_Width => Fore, Fore_Digits_Fill => ' ', Aft_Width => Aft); -- skip single zero before decimal point if Item_Image (Item_Image'First + Fore - 1) = ' ' -- sign is blank and then Item_Image (Item_Image'First + Fore) = '0' then Item_Image (Item_Image'First + Fore) := ' '; end if; -- before decimal point declare Result_Index : Natural := Result'First + Radix_Position - 2; Pic_Index : Natural := Pic.Radix_Position - 1; Pic_Leading_Index : Natural := Pic_Index; Sign_Filled : Boolean := False; Paren_Filled : Boolean := False; Currency_Filled : Boolean := False; Dollar_Used : Boolean := False; begin for I in reverse Item_Image'First .. Item_Image'First + Fore loop exit when Item_Image (I) = ' '; loop if Pic_Index < Pic.Expanded'First then Error := True; -- overflow return; -- Layout_Error end if; pragma Assert (Result_Index >= Result'First); if Pic.Expanded (Pic_Index) = '>' then if Item < 0 then Result (Result_Index) := ')'; else Result (Result_Index) := ' '; end if; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; elsif Pic.Expanded (Pic_Index) = '_' then Result (Result_Index) := Separator; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; elsif Pic.Expanded (Pic_Index) = '-' and then Pic_Index = Pic.First_Sign_Position and then Item < 0 then Result (Result_Index) := '-'; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; Sign_Filled := True; else exit; end if; end loop; pragma Assert (Item_Image (I) /= ' '); Result (Result_Index) := Item_Image (I); Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; end loop; loop if Pic_Leading_Index > Pic_Index then Pic_Leading_Index := Pic_Index; end if; exit when Pic_Leading_Index < Pic.Expanded'First; pragma Assert (Result_Index >= Result'First); case Pic.Expanded (Pic_Leading_Index) is when '$' => if Currency_Filled then Result (Result_Index) := ' '; Result_Index := Result_Index - 1; else Result ( Result_Index - Currency_Length + 1 .. Result_Index) := Currency; Result_Index := Result_Index - Currency_Length; Currency_Filled := True; Dollar_Used := True; end if; Pic_Index := Pic_Index - 1; when '#' => if Currency_Filled then Result (Result_Index) := ' '; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; else declare N : Natural := Currency_Length; begin while N > 0 loop if Pic_Index <= Pic_Leading_Index and then ( Pic_Index < Pic.Expanded'First or else ( Pic.Expanded (Pic_Index) /= '#' and then Pic.Expanded (Pic_Index) /= '_')) then Error := True; return; -- Layout_Error end if; Pic_Index := Pic_Index - 1; N := N - 1; end loop; end; Result ( Result_Index - Currency_Length + 1 .. Result_Index) := Currency; Result_Index := Result_Index - Currency_Length; Currency_Filled := True; Pic_Leading_Index := Pic_Index; end if; when '+' => if Sign_Filled then Result (Result_Index) := ' '; elsif Item < 0 then Result (Result_Index) := '-'; Sign_Filled := True; else Result (Result_Index) := '+'; Sign_Filled := True; end if; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; when '-' => if Sign_Filled then Result (Result_Index) := ' '; elsif Item < 0 then Result (Result_Index) := '-'; Sign_Filled := True; else Result (Result_Index) := ' '; end if; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; when '<' => if not Paren_Filled and then Item < 0 then Result (Result_Index) := '('; Paren_Filled := True; else Result (Result_Index) := ' '; end if; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; when '9' => Result (Result_Index) := '0'; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; when '*' => Result (Result_Index) := Fill; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; when '_' => if Pic_Leading_Index > Pic.Expanded'First and then Pic.Expanded (Pic_Leading_Index - 1) = Pic.Expanded (Pic_Leading_Index + 1) then Pic_Leading_Index := Pic_Leading_Index - 1; else Result (Result_Index) := ' '; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; end if; when others => Result (Result_Index) := ' '; Result_Index := Result_Index - 1; Pic_Index := Pic_Index - 1; end case; end loop; if (Item < 0 and then not Sign_Filled and then not Paren_Filled) -- minus is not presented or else ( Pic.Has_Dollar = Previous and then not Dollar_Used) -- all $ used for item then Error := True; return; -- Layout_Error end if; pragma Assert (Result_Index = Result'First - 1); end; -- after decimal point declare Result_Index : Positive := Result'First + Radix_Position - 1; Pic_Index : Natural := Pic.Radix_Position + 1; Paren_Filled : Boolean := False; Currency_Filled : Boolean := False; begin if Pic.Radix_Position <= Pic.Length and then Pic.Expanded (Pic.Radix_Position) = '.' then Result (Result_Index) := Radix_Mark; Result_Index := Result_Index + 1; end if; for I in Item_Image'First + Fore + 2 .. Item_Image'Last loop exit when Pic_Index > Pic.Length; if Pic.Expanded (Pic_Index) = '_' then pragma Assert (Result_Index <= Result'Last); Result (Result_Index) := Separator; Result_Index := Result_Index + 1; Pic_Index := Pic_Index + 1; end if; pragma Assert (Result_Index <= Result'Last); Result (Result_Index) := Item_Image (I); Result_Index := Result_Index + 1; Pic_Index := Pic_Index + 1; end loop; while Pic_Index <= Pic.Length loop pragma Assert (Result_Index <= Result'Last); case Pic.Expanded (Pic_Index) is when '#' => if Currency_Filled then Result (Result_Index) := ' '; Result_Index := Result_Index + 1; Pic_Index := Pic_Index + 1; else declare N : Natural := Currency_Length; begin while N > 0 loop if Pic_Index > Pic.Length or else Pic.Expanded (Pic_Index) /= '#' then Error := True; return; -- Layout_Error end if; Pic_Index := Pic_Index + 1; N := N - 1; end loop; end; Result ( Result_Index .. Result_Index + Currency_Length - 1) := Currency; Result_Index := Result_Index + Currency_Length; Currency_Filled := True; end if; when '>' => if not Paren_Filled and then Item < 0 then Result (Result_Index) := ')'; Paren_Filled := True; else Result (Result_Index) := ' '; end if; Result_Index := Result_Index + 1; Pic_Index := Pic_Index + 1; when '_' => Result (Result_Index) := Separator; Result_Index := Result_Index + 1; Pic_Index := Pic_Index + 1; when others => Result (Result_Index) := ' '; Result_Index := Result_Index + 1; Pic_Index := Pic_Index + 1; end case; end loop; pragma Assert (Result_Index = Result'Last + 1); end; end; end if; Error := False; end Image; -- implementation function Valid ( Pic_String : String; Blank_When_Zero : Boolean := False) return Boolean is Dummy : Picture; Error : Boolean; begin To_Picture ( Pic_String, Dummy, Blank_When_Zero => Blank_When_Zero, Error => Error); return not Error; end Valid; function To_Picture ( Pic_String : String; Blank_When_Zero : Boolean := False) return Picture is Error : Boolean; begin return Result : Picture do To_Picture ( Pic_String, Result, Blank_When_Zero => Blank_When_Zero, Error => Error); if Error then Raise_Exception (Picture_Error'Identity); end if; end return; end To_Picture; function Pic_String (Pic : Picture) return String is begin return Pic.Expanded (1 .. Pic.Length); end Pic_String; function Blank_When_Zero (Pic : Picture) return Boolean is begin return Pic.Blank_When_Zero; end Blank_When_Zero; package body Decimal_Output is function Overloaded_Length (Pic : Picture; Currency : String) return Natural renames Editing.Length; function Overloaded_Length (Pic : Picture; Currency : Wide_String) return Natural is begin return Overloaded_Length ( Pic, Currency => String'(1 .. Currency'Length => '$')); end Overloaded_Length; function Overloaded_Length (Pic : Picture; Currency : Wide_Wide_String) return Natural is begin return Overloaded_Length ( Pic, Currency => String'(1 .. Currency'Length => '$')); end Overloaded_Length; function Overloaded_Valid ( Item : Num; Pic : Picture; Currency : String) return Boolean is Error : Boolean; Dummy : String (1 .. Length (Pic, Currency)); begin Editing.Image ( Long_Long_Integer'Integer_Value (Item), Dummy, Num'Scale, Num'Fore, Pic, Currency => Currency, Fill => Default_Fill, Separator => Default_Separator, Radix_Mark => Default_Radix_Mark, Error => Error); return not Error; end Overloaded_Valid; function Overloaded_Valid ( Item : Num; Pic : Picture; Currency : Wide_String) return Boolean is begin return Overloaded_Valid ( Item, Pic, Currency => String'(1 .. Currency'Length => '$')); end Overloaded_Valid; function Overloaded_Valid ( Item : Num; Pic : Picture; Currency : Wide_Wide_String) return Boolean is begin return Overloaded_Valid ( Item, Pic, Currency => String'(1 .. Currency'Length => '$')); end Overloaded_Valid; function Overloaded_Image ( Item : Num; Pic : Picture; Currency : String; Fill : Character; Separator : Character; Radix_Mark : Character) return String is Error : Boolean; begin return Result : String (1 .. Length (Pic, Currency)) do Editing.Image ( Long_Long_Integer'Integer_Value (Item), Result, Num'Scale, Num'Fore, Pic, Currency => Currency, Fill => Fill, Separator => Separator, Radix_Mark => Radix_Mark, Error => Error); if Error then raise Layout_Error; end if; end return; end Overloaded_Image; function Overloaded_Image ( Item : Num; Pic : Picture; Currency : Wide_String; Fill : Wide_Character; Separator : Wide_Character; Radix_Mark : Wide_Character) return Wide_String is Currency_Length : constant Natural := Currency'Length; Image : constant String := Overloaded_Image ( Item, Pic, Currency => String'(1 .. Currency_Length => '$'), Fill => '*', -- Editing.Default_Fill Separator => ',', -- Editing.Default_Separator Radix_Mark => '.'); -- Editing.Default_Radix_Mark begin return Result : Wide_String (Image'Range) do declare I : Positive := Result'First; begin while I <= Result'Last loop case Image (I) is when '$' => Result (I .. I + Currency_Length - 1) := Currency; I := I + Currency_Length; when '*' => Result (I) := Fill; I := I + 1; when ',' => Result (I) := Separator; I := I + 1; when '.' => Result (I) := Radix_Mark; I := I + 1; when others => Result (I) := Wide_Character'Val (Character'Pos (Image (I))); I := I + 1; end case; end loop; end; end return; end Overloaded_Image; function Overloaded_Image ( Item : Num; Pic : Picture; Currency : Wide_Wide_String; Fill : Wide_Wide_Character; Separator : Wide_Wide_Character; Radix_Mark : Wide_Wide_Character) return Wide_Wide_String is Currency_Length : constant Natural := Currency'Length; Image : constant String := Overloaded_Image ( Item, Pic, Currency => String'(1 .. Currency_Length => '$'), Fill => '*', -- Editing.Default_Fill Separator => ',', -- Editing.Default_Separator Radix_Mark => '.'); -- Editing.Default_Radix_Mark begin return Result : Wide_Wide_String (Image'Range) do declare I : Positive := Result'First; begin while I <= Result'Last loop case Image (I) is when '$' => Result (I .. I + Currency_Length - 1) := Currency; I := I + Currency_Length; when '*' => Result (I) := Fill; I := I + 1; when ',' => Result (I) := Separator; I := I + 1; when '.' => Result (I) := Radix_Mark; I := I + 1; when others => Result (I) := Wide_Wide_Character'Val (Character'Pos (Image (I))); I := I + 1; end case; end loop; end; end return; end Overloaded_Image; procedure Overloaded_Put ( File : File_Type; Item : Num; Pic : Picture; Currency : String; Fill : Character; Separator : Character; Radix_Mark : Character) is begin Overloaded_Put ( File, -- checking the predicate Overloaded_Image ( Item, Pic, Currency => Currency, Fill => Fill, Separator => Separator, Radix_Mark => Radix_Mark)); end Overloaded_Put; procedure Overloaded_Put ( File : File_Type; Item : Num; Pic : Picture; Currency : Wide_String; Fill : Wide_Character; Separator : Wide_Character; Radix_Mark : Wide_Character) is begin Overloaded_Put ( File, -- checking the predicate Overloaded_Image ( Item, Pic, Currency => Currency, Fill => Fill, Separator => Separator, Radix_Mark => Radix_Mark)); end Overloaded_Put; procedure Overloaded_Put ( File : File_Type; Item : Num; Pic : Picture; Currency : Wide_Wide_String; Fill : Wide_Wide_Character; Separator : Wide_Wide_Character; Radix_Mark : Wide_Wide_Character) is begin Overloaded_Put ( File, -- checking the predicate Overloaded_Image ( Item, Pic, Currency => Currency, Fill => Fill, Separator => Separator, Radix_Mark => Radix_Mark)); end Overloaded_Put; procedure Overloaded_Put ( Item : Num; Pic : Picture; Currency : String; Fill : Character; Separator : Character; Radix_Mark : Character) is begin Overloaded_Put ( Current_Output.all, Overloaded_Image ( Item, Pic, Currency => Currency, Fill => Fill, Separator => Separator, Radix_Mark => Radix_Mark)); end Overloaded_Put; procedure Overloaded_Put ( Item : Num; Pic : Picture; Currency : Wide_String; Fill : Wide_Character; Separator : Wide_Character; Radix_Mark : Wide_Character) is begin Overloaded_Put ( Current_Output.all, Overloaded_Image ( Item, Pic, Currency => Currency, Fill => Fill, Separator => Separator, Radix_Mark => Radix_Mark)); end Overloaded_Put; procedure Overloaded_Put ( Item : Num; Pic : Picture; Currency : Wide_Wide_String; Fill : Wide_Wide_Character; Separator : Wide_Wide_Character; Radix_Mark : Wide_Wide_Character) is begin Overloaded_Put ( Current_Output.all, Overloaded_Image ( Item, Pic, Currency => Currency, Fill => Fill, Separator => Separator, Radix_Mark => Radix_Mark)); end Overloaded_Put; procedure Overloaded_Put ( To : out String; Item : Num; Pic : Picture; Currency : String; Fill : Character; Separator : Character; Radix_Mark : Character) is begin Formatting.Tail ( To, Overloaded_Image ( Item, Pic, Currency => Currency, Fill => Fill, Separator => Separator, Radix_Mark => Radix_Mark)); end Overloaded_Put; procedure Overloaded_Put ( To : out Wide_String; Item : Num; Pic : Picture; Currency : Wide_String; Fill : Wide_Character; Separator : Wide_Character; Radix_Mark : Wide_Character) is begin Formatting.Tail ( To, Overloaded_Image ( Item, Pic, Currency => Currency, Fill => Fill, Separator => Separator, Radix_Mark => Radix_Mark)); end Overloaded_Put; procedure Overloaded_Put ( To : out Wide_Wide_String; Item : Num; Pic : Picture; Currency : Wide_Wide_String; Fill : Wide_Wide_Character; Separator : Wide_Wide_Character; Radix_Mark : Wide_Wide_Character) is begin Formatting.Tail ( To, Overloaded_Image ( Item, Pic, Currency => Currency, Fill => Fill, Separator => Separator, Radix_Mark => Radix_Mark)); end Overloaded_Put; end Decimal_Output; end Ada.Text_IO.Editing;
src/ada/src/services/arv/uxas-comms-lmcp_net_client-service-automation_request_validation.ads
VVCAS-Sean/OpenUxAS
88
22467
-- see OpenUxAS\src\Services\AutomationRequestValidatorService.h with DOM.Core; with Automation_Request_Validator; use Automation_Request_Validator; with Automation_Request_Validator_Communication; use Automation_Request_Validator_Communication; package UxAS.Comms.LMCP_Net_Client.Service.Automation_Request_Validation is type Automation_Request_Validator_Service is new Service_Base with private; type Automation_Request_Validator_Service_Ref is access all Automation_Request_Validator_Service; Type_Name : constant String := "AutomationRequestValidatorService"; Directory_Name : constant String := ""; -- static const std::vector<std::string> -- s_registryServiceTypeNames() function Registry_Service_Type_Names return Service_Type_Names_List; -- static ServiceBase* -- create() function Create return Any_Service; private -- static -- ServiceBase::CreationRegistrar<AutomationRequestValidatorService> s_registrar; -- see the package body executable part type Automation_Request_Validator_Service is new Service_Base with record -- TODO: implement these timers, maybe using Timing_Events, but maybe using -- tasks because their purpose is to call send outgoing messages at the -- desired rate -- -- this timer is used to track time for the system to respond to automation requests */ -- uint64_t m_responseTimerId{0}; -- -- this timer is used to track time for the system to wait for task initialization */ -- uint64_t m_taskInitTimerId{0}; -- the maximum time to wait for a response (in ms)*/ -- uint32_t m_maxResponseTime_ms = {5000}; // default: 5000 ms Max_Response_Time : UInt32 := 5000; -- milliseconds Config : Automation_Request_Validator_Configuration_Data; Mailbox : Automation_Request_Validator_Mailbox; State : Automation_Request_Validator_State; end record; overriding procedure Configure (This : in out Automation_Request_Validator_Service; XML_Node : DOM.Core.Element; Result : out Boolean); overriding procedure Initialize (This : in out Automation_Request_Validator_Service; Result : out Boolean); overriding procedure Process_Received_LMCP_Message (This : in out Automation_Request_Validator_Service; Received_Message : not null Any_LMCP_Message; Should_Terminate : out Boolean); -- TODO: TIMER CALLBACKS -- this function gets called when the response timer expires -- void OnResponseTimeout(); -- this function gets called when the tasks involved have not reported initialization in time -- void OnTasksReadyTimeout(); end UxAS.Comms.LMCP_Net_Client.Service.Automation_Request_Validation;
bootloader.asm
hackbacc/disassembler
6
23192
<filename>bootloader.asm org 0x7C00 bits 16 ; reset system mov al, 0x00 int 0x13 ; read certain length of code from 0x8000 into RAM ; each sector is of 512B sector 0 is boot loader at 0x7C00, sector 1 is the rest of the 512B and usable space starts at 0x8000ie sector 2 mov cl, 0x02 ; each sec mov ch, 0x00 ; cylinder number (first cylinder) ;mov dl, xxx ; drive number is auto filled upon reset in dl mov dh, 0x00 ; head number (first head) mov al, 0x10 ; n of sectors to read mov ah, 0x02 ; read disk sectors from drive into memory. mov bx, 0x8000; address of the available user space int 0x13 jmp 0x8000 ; fill up the entire 512B and put last bytes as magic number times 510 - ($-$$) db 0 db 0x55 ; magic byte 1 db 0xAA ; magic byte 2
ioctl/IodRedetermine.asm
osfree-project/FamilyAPI
1
7052
<reponame>osfree-project/FamilyAPI ;-------------------------------------------------------- ; Category 8 Function 02H Redetermine Media - not supported for versions below DOS 3.2 ;-------------------------------------------------------- ; ; ; IODREDETERMINE PROC NEAR RET IODREDETERMINE ENDP
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_1480.asm
ljhsiun2/medusa
9
20652
<filename>Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_1480.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x7b09, %rsi nop nop add $26867, %rbp vmovups (%rsi), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $1, %xmm0, %r13 nop sub $24815, %r13 lea addresses_D_ht+0x14b61, %rdx nop nop nop and %rdi, %rdi vmovups (%rdx), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %r10 nop xor $18874, %rsi lea addresses_normal_ht+0x3281, %rbp nop nop and $50750, %rax mov $0x6162636465666768, %rdi movq %rdi, %xmm1 movups %xmm1, (%rbp) and %r10, %r10 lea addresses_D_ht+0x19a1, %rsi lea addresses_UC_ht+0x10b1f, %rdi nop nop nop and %rdx, %rdx mov $87, %rcx rep movsl nop nop nop nop and %rcx, %rcx lea addresses_UC_ht+0xbbe1, %rcx nop inc %rdx mov (%rcx), %rsi nop nop nop nop xor %rdx, %rdx lea addresses_UC_ht+0x8061, %rsi nop add $43978, %r10 mov (%rsi), %dx nop nop nop nop add %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %rax push %rbx push %rdx // Store lea addresses_WT+0x1761, %r12 nop nop and %r10, %r10 mov $0x5152535455565758, %rax movq %rax, %xmm2 and $0xffffffffffffffc0, %r12 movntdq %xmm2, (%r12) nop nop nop nop nop dec %rax // Load lea addresses_WC+0x13861, %r10 nop nop nop inc %rdx mov (%r10), %rax nop nop nop nop sub %r10, %r10 // Faulty Load lea addresses_WC+0x13861, %rbx nop nop nop nop nop sub %r12, %r12 movups (%rbx), %xmm6 vpextrq $0, %xmm6, %rax lea oracles, %r12 and $0xff, %rax shlq $12, %rax mov (%r12,%rax,1), %rax pop %rdx pop %rbx pop %rax pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_WT'}} {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'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 */
src/lab-code/ravenspark_racecond/account.adb
hannesb0/rtpl18
0
3842
<reponame>hannesb0/rtpl18 package body Account with SPARK_Mode is task body Account_Management is begin loop --Get_Next_Account_Created; Num_Accounts := Num_Accounts + 1; end loop; end Account_Management; end Account;
03/write/write.asm
DaviNakamuraCardoso/assembly
0
102158
section .data filename db "hello.txt", 0x00 hello db "Hello, World", 0x0a len equ $ - hello section .text global _start _start: ; Open a new file called hello mov rax, 0x02 mov rdi, filename mov rsi, 64+1 mov rdx, 0644o syscall ; Write "Hello, World" to the file mov rdi, rax mov rax, 0x01 mov rsi, hello mov rdx, len syscall ; Close the file mov rax, 0x03 pop rdi syscall ; Exit mov rax, 0x3c mov rsi, 0x00 syscall
programs/oeis/017/A017281.asm
karttu/loda
0
2351
<reponame>karttu/loda ; A017281: a(n) = 10*n + 1. ; 1,11,21,31,41,51,61,71,81,91,101,111,121,131,141,151,161,171,181,191,201,211,221,231,241,251,261,271,281,291,301,311,321,331,341,351,361,371,381,391,401,411,421,431,441,451,461,471,481,491,501,511,521,531 mov $1,$0 mul $1,10 add $1,1
out/Empty/Syntax.agda
JoeyEremondi/agda-soas
39
14548
{- This second-order term syntax was created from the following second-order syntax description: syntax Empty | E type 𝟘 : 0-ary term abort : 𝟘 -> α theory (𝟘η) e : 𝟘 c : α |> abort(e) = c -} module Empty.Syntax where open import SOAS.Common open import SOAS.Context open import SOAS.Variable open import SOAS.Families.Core open import SOAS.Construction.Structure open import SOAS.ContextMaps.Inductive open import SOAS.Metatheory.Syntax open import Empty.Signature private variable Γ Δ Π : Ctx α : ET 𝔛 : Familyₛ -- Inductive term declaration module E:Terms (𝔛 : Familyₛ) where data E : Familyₛ where var : ℐ ⇾̣ E mvar : 𝔛 α Π → Sub E Π Γ → E α Γ abort : E 𝟘 Γ → E α Γ open import SOAS.Metatheory.MetaAlgebra ⅀F 𝔛 Eᵃ : MetaAlg E Eᵃ = record { 𝑎𝑙𝑔 = λ where (abortₒ ⋮ a) → abort a ; 𝑣𝑎𝑟 = var ; 𝑚𝑣𝑎𝑟 = λ 𝔪 mε → mvar 𝔪 (tabulate mε) } module Eᵃ = MetaAlg Eᵃ module _ {𝒜 : Familyₛ}(𝒜ᵃ : MetaAlg 𝒜) where open MetaAlg 𝒜ᵃ 𝕤𝕖𝕞 : E ⇾̣ 𝒜 𝕊 : Sub E Π Γ → Π ~[ 𝒜 ]↝ Γ 𝕊 (t ◂ σ) new = 𝕤𝕖𝕞 t 𝕊 (t ◂ σ) (old v) = 𝕊 σ v 𝕤𝕖𝕞 (mvar 𝔪 mε) = 𝑚𝑣𝑎𝑟 𝔪 (𝕊 mε) 𝕤𝕖𝕞 (var v) = 𝑣𝑎𝑟 v 𝕤𝕖𝕞 (abort a) = 𝑎𝑙𝑔 (abortₒ ⋮ 𝕤𝕖𝕞 a) 𝕤𝕖𝕞ᵃ⇒ : MetaAlg⇒ Eᵃ 𝒜ᵃ 𝕤𝕖𝕞 𝕤𝕖𝕞ᵃ⇒ = record { ⟨𝑎𝑙𝑔⟩ = λ{ {t = t} → ⟨𝑎𝑙𝑔⟩ t } ; ⟨𝑣𝑎𝑟⟩ = refl ; ⟨𝑚𝑣𝑎𝑟⟩ = λ{ {𝔪 = 𝔪}{mε} → cong (𝑚𝑣𝑎𝑟 𝔪) (dext (𝕊-tab mε)) } } where open ≡-Reasoning ⟨𝑎𝑙𝑔⟩ : (t : ⅀ E α Γ) → 𝕤𝕖𝕞 (Eᵃ.𝑎𝑙𝑔 t) ≡ 𝑎𝑙𝑔 (⅀₁ 𝕤𝕖𝕞 t) ⟨𝑎𝑙𝑔⟩ (abortₒ ⋮ _) = refl 𝕊-tab : (mε : Π ~[ E ]↝ Γ)(v : ℐ α Π) → 𝕊 (tabulate mε) v ≡ 𝕤𝕖𝕞 (mε v) 𝕊-tab mε new = refl 𝕊-tab mε (old v) = 𝕊-tab (mε ∘ old) v module _ (g : E ⇾̣ 𝒜)(gᵃ⇒ : MetaAlg⇒ Eᵃ 𝒜ᵃ g) where open MetaAlg⇒ gᵃ⇒ 𝕤𝕖𝕞! : (t : E α Γ) → 𝕤𝕖𝕞 t ≡ g t 𝕊-ix : (mε : Sub E Π Γ)(v : ℐ α Π) → 𝕊 mε v ≡ g (index mε v) 𝕊-ix (x ◂ mε) new = 𝕤𝕖𝕞! x 𝕊-ix (x ◂ mε) (old v) = 𝕊-ix mε v 𝕤𝕖𝕞! (mvar 𝔪 mε) rewrite cong (𝑚𝑣𝑎𝑟 𝔪) (dext (𝕊-ix mε)) = trans (sym ⟨𝑚𝑣𝑎𝑟⟩) (cong (g ∘ mvar 𝔪) (tab∘ix≈id mε)) 𝕤𝕖𝕞! (var v) = sym ⟨𝑣𝑎𝑟⟩ 𝕤𝕖𝕞! (abort a) rewrite 𝕤𝕖𝕞! a = sym ⟨𝑎𝑙𝑔⟩ -- Syntax instance for the signature E:Syn : Syntax E:Syn = record { ⅀F = ⅀F ; ⅀:CS = ⅀:CompatStr ; mvarᵢ = E:Terms.mvar ; 𝕋:Init = λ 𝔛 → let open E:Terms 𝔛 in record { ⊥ = E ⋉ Eᵃ ; ⊥-is-initial = record { ! = λ{ {𝒜 ⋉ 𝒜ᵃ} → 𝕤𝕖𝕞 𝒜ᵃ ⋉ 𝕤𝕖𝕞ᵃ⇒ 𝒜ᵃ } ; !-unique = λ{ {𝒜 ⋉ 𝒜ᵃ} (f ⋉ fᵃ⇒) {x = t} → 𝕤𝕖𝕞! 𝒜ᵃ f fᵃ⇒ t } } } } -- Instantiation of the syntax and metatheory open Syntax E:Syn public open E:Terms public open import SOAS.Families.Build public open import SOAS.Syntax.Shorthands Eᵃ public open import SOAS.Metatheory E:Syn public
test/Fail/Issue586.agda
cruhland/agda
1,989
6112
<filename>test/Fail/Issue586.agda -- ASR (31 December 2015). The error message for this test was changed -- by fixing Issue 1763. module Issue586 where {-# NO_TERMINATION_CHECK #-} Foo : Set Foo = Foo
Ada/src/Problem_38.adb
Tim-Tom/project-euler
0
27794
with Ada.Text_IO; with Ada.Integer_Text_IO; package body Problem_38 is package IO renames Ada.Text_IO; package I_IO renames Ada.Integer_Text_IO; procedure Solve is subtype Digit is Integer range 1 .. 9; type Seen_Array is Array(Digit) of Boolean; seen : Seen_Array; current_number : Integer; function Check_2(num : Integer) return Boolean is seen2 : Seen_Array := seen; num_times_two : Integer := num*2; good : Boolean := True; begin while num_times_two > 0 loop declare d : constant Integer := num_times_two mod 10; begin num_times_two := num_times_two / 10; if d = 0 or else seen2(d) then good := False; exit; end if; seen2(d) := True; end; end loop; return good; end Check_2; begin for index in seen'Range loop seen(index) := False; end loop; seen(9) := True; -- If we do better than their sample, it has to come from a 4 digit -- number. It has to start with a 9 and the most that the second digit can -- be is a 4 because otherwise it would make the 18 that *2 makes into a -- 19 which isn't kosher. We know that the first number we get to is the -- best because the first thing we hit is the *1 which is just a copy of -- our number. for hundreds in reverse 2 .. 4 loop seen(hundreds) := True; current_number := 9000 + hundreds*100; for tens in reverse 2 .. 7 loop if not seen(tens) then seen(tens) := True; current_number := current_number + tens*10; for ones in reverse 2 .. 7 loop if not seen(ones) then seen(ones) := True; current_number := current_number + ones; if Check_2(current_number) then goto Have_Solution; end if; current_number := current_number - ones; seen(ones) := False; end if; end loop; current_number := current_number - tens*10; seen(tens) := False; end if; end loop; seen(hundreds) := False; end loop; <<Have_Solution>> I_IO.Put(current_number); IO.New_Line; end Solve; end Problem_38;
assets/assembly/ours/ultimate.asm
edassis/SB-Tradutor
1
81573
E1: EQU 5 E2: EQU 10 E3: EQU Q @@@@@@ SECTION TEXT INPUT *** label_inexistente ; adfasdfasd OLD_DATA LOAD 2 LOAD OLD_DATA L22222222222222222222222222222222222222222222222222222222222222222: ADD DOIS 1ABC: ADD QUATRO L1: DIV DOIS ; 3 = OLD_DATA / 2 STORE NEW_DATA ; new_data = 3 MULT DOIS ; 6 = 3 * 2 STORE TMP_DATA ; TMP_DATA = acc (6) LOAD OLD_DATA ; acc = OLD_DATA SUB TMP_DATA ; OLD_DATA - TMP_DATA STORE TMP_DATA ; TMP_DATA = acc (3) OUTPUT TMP_DATA ; "0" COPY NEW_DATA, OLD_DATA ; OLD_DATA = NEW_DATA (3) IF E3 COPY TMP_DATA, DOIS LOAD OLD_DATA ; acc = 3 JMPP L1 ; if acc > 0 JMPZ L2: OUTPUT TMP_DATA fon 123 STOP SECTION DATA 312312321 DOIS: CONST 2 QUATRO: CONST 4 OLD_DATA: SPACE NEW_DATA: SPACE TMP_DATA: SPACE
vic-20/vic.asm
SvenMichaelKlose/bender
2
178355
<gh_stars>1-10 ; Bender – Copyright (c) 2015 <NAME> <<EMAIL>> vicreg_interlace_horigin = $9000 vicreg_vorigin = $9001 vicreg_screenlo_columns = $9002 vicreg_rasterlo_rows_charsize = $9003 vicreg_rasterhi = $9004 vicreg_screenhi_charset = $9005 vicreg_hpen = $9006 vicreg_vpen = $9007 vicreg_paddle1 = $9008 vicreg_paddle2 = $9009 vicreg_bass = $900a vicreg_alto = $900b vicreg_soprano = $900c vicreg_noise = $900d vicreg_auxcol_volume = $900e vicreg_screencol_reverse_border = $900f vic_screen_1000 = %11000000 vic_screen_1200 = %11000000 vic_screen_1400 = %11010000 vic_screen_1600 = %11010000 vic_screen_1800 = %11100000 vic_screen_1a00 = %11100000 vic_screen_1c00 = %11110000 vic_screen_1e00 = %11110000 charset_upcase = $8000 charset_upcase_reversed = $8400 charset_locase = $8800 charset_locase_reversed = $8c00 vic_charset_upcase = %0000 vic_charset_8000 = %0000 vic_charset_upcase_reversed = %0001 vic_charset_8400 = %0001 vic_charset_locase = %0010 vic_charset_8800 = %0010 vic_charset_locase_reversed = %0011 vic_charset_8c00 = %0011 vic_charset_1000 = %1100 vic_charset_1400 = %1101 vic_charset_1800 = %1110 vic_charset_1c00_up = %1111 vic_charset_1c00 = %1111 reverse = 8 multicolor = 8 ; Character/border colors. black = 0 white = 1 red = 2 cyan = 3 purple = 4 green = 5 blue = 6 yellow = 7 ; Additional screen and auxiliary colors. orange = 8 light_orange = 9 pink = 10 light_cyan = 11 light_purple = 12 light_green = 13 light_blue = 14 light_yellow = 15 ; Sound channel clocks ; f = clk / (127 - x) ; x = 127 - (clk / f) clk_bass_pal = 4329 clk_alto_pal = 8659 clk_soprano_pal = 17320 clk_noise_pal = 34640 clk_bass_ntsc = 3995 clk_alto_ntsc = 7990 clk_soprano_ntsc = 15980 clk_noise_ntsc = 31960 joy_fire = %00100000 joy_up = %00000100 joy_down = %00001000 joy_left = %00010000
tools/scitools/conf/understand/ada/ada95/a-wtiopi.ads
brucegua/moocos
1
867
------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- A D A . W I D E _ T E X T _ I O . P I C T U R E S -- -- -- -- S p e c -- -- -- -- $Revision: 2 $ -- -- -- -- Copyright (c) 1992,1993,1994 NYU, All Rights Reserved -- -- -- -- 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, 675 Mass Ave, Cambridge, MA 02139, USA. -- -- -- ------------------------------------------------------------------------------ package Ada.Wide_Text_IO.Pictures is type Picture is private; function Valid (Item : in String) return Boolean; function To_Picture (Item : in String) return Picture; function To_String (Item : in Picture) return String; Max_Picture_Length : constant := 30; Picture_Error : exception; -- Localization features: Max_Currency_Length : constant := 10; subtype Currency_Length_Range is Integer range 1 .. Max_Currency_Length; type Locale (Length : Currency_Length_Range := 1) is record Currency : Wide_String (1 .. Length) := "$"; Fill : Wide_Character := '*'; Separator : Wide_Character := ','; Radix_Mark : Wide_Character := '.'; end record; generic type Num is delta <> digits <>; package Edited_Output is Default_Locale : Locale; function Length (Pic : in Picture; Symbols : in Locale := Default_Locale) return Natural; function Image (Item : in Num; Pic : in Picture; Symbols : in Locale := Default_Locale) return Wide_String; procedure Put (File : in File_Type; Item : in Num; Pic : in Picture; Symbols : in Locale := Default_Locale); procedure Put (Item : in Num; Pic : in Picture; Symbols : in Locale := Default_Locale); procedure Put (To : out Wide_String; Item : in Num; Pic : in Picture; Symbols : in Locale := Default_Locale); end Edited_Output; private type Picture is record Length : Natural; Data : String (1 .. 30); end record; end Ada.Wide_Text_IO.Pictures;
libsrc/_DEVELOPMENT/temp/sp1/zx/c/sdcc_ix/sp1_DrawUpdateStructIfVal_fastcall.asm
jpoikela/z88dk
640
22359
<filename>libsrc/_DEVELOPMENT/temp/sp1/zx/c/sdcc_ix/sp1_DrawUpdateStructIfVal_fastcall.asm ; sp1_DrawUpdateStructIfVal(struct sp1_update *u) SECTION code_clib SECTION code_temp_sp1 PUBLIC _sp1_DrawUpdateStructIfVal_fastcall EXTERN asm_sp1_DrawUpdateStructIfVal _sp1_DrawUpdateStructIfVal_fastcall: push ix call asm_sp1_DrawUpdateStructIfVal pop ix ret
src/aco-nodes-remotes.ads
jonashaggstrom/ada-canopen
6
18204
<filename>src/aco-nodes-remotes.ads with ACO.SDO_Sessions; private with Ada.Synchronous_Task_Control; private with ACO.Protocols.Network_Management.Masters; private with ACO.Protocols.Error_Control.Slaves; private with ACO.Protocols.Service_Data.Clients; package ACO.Nodes.Remotes is type Remote (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new Node_Base with private; overriding procedure Set_State (This : in out Remote; State : in ACO.States.State); overriding function Get_State (This : Remote) return ACO.States.State; overriding procedure Start (This : in out Remote); type SDO_Request (Node : not null access Remote) is abstract tagged private; subtype SDO_Status is ACO.SDO_Sessions.SDO_Status; subtype SDO_Result is ACO.SDO_Sessions.SDO_Result; function Is_Complete (This : SDO_Request) return Boolean; procedure Suspend_Until_Result (This : in out SDO_Request; Result : out SDO_Result); function Status (This : SDO_Request) return SDO_Status; type SDO_Read_Request (Node : not null access Remote; To_Entry : not null access ACO.OD_Types.Entry_Base'Class) is new SDO_Request with private; procedure Suspend_Until_Result (This : in out SDO_Read_Request; Result : out SDO_Result); procedure Get_Entry (This : in out SDO_Read_Request) with Pre => This.Is_Complete; type SDO_Write_Request (Node : not null access Remote) is new SDO_Request with private; overriding procedure Write (This : in out Remote; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; An_Entry : in ACO.OD_Types.Entry_Base'Class) with Pre => This.Od.Entry_Exist (Index, Subindex) and then This.Od.Is_Entry_Compatible (An_Entry, Index, Subindex); procedure Write (This : in out Remote; Request : in out SDO_Write_Request'Class; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; An_Entry : in ACO.OD_Types.Entry_Base'Class); overriding procedure Read (This : in out Remote; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; To_Entry : out ACO.OD_Types.Entry_Base'Class) with Pre => This.Od.Entry_Exist (Index, Subindex) and then This.Od.Is_Entry_Compatible (To_Entry, Index, Subindex); procedure Read (This : in out Remote; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; Result : out ACO.Nodes.Remotes.SDO_Result; To_Entry : out ACO.OD_Types.Entry_Base'Class) with Pre => This.Od.Entry_Exist (Index, Subindex) and then This.Od.Is_Entry_Compatible (To_Entry, Index, Subindex); procedure Read (This : in out Remote; Request : in out SDO_Read_Request'Class; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex); generic type Entry_T is new ACO.OD_Types.Entry_Base with private; function Generic_Read (This : in out Remote; Index : ACO.OD_Types.Object_Index; Subindex : ACO.OD_Types.Object_Subindex) return Entry_T; -- with Pre => This.Od.Entry_Exist (Index, Subindex); -- Above precondition causes compiler error during instantiation. Bug? procedure Set_Heartbeat_Timeout (This : in out Remote; Timeout : in Natural); Failed_To_Read_Entry_Of_Node : exception; private type Request_Type is (Write, Read); type SDO_Request (Node : not null access Remote) is abstract tagged record Id : ACO.SDO_Sessions.Endpoint_Nr := ACO.SDO_Sessions.No_Endpoint_Id; end record; type SDO_Read_Request (Node : not null access Remote; To_Entry : not null access ACO.OD_Types.Entry_Base'Class) is new SDO_Request (Node) with null record; type SDO_Write_Request (Node : not null access Remote) is new SDO_Request (Node) with null record; type Request_Data is record Suspension : Ada.Synchronous_Task_Control.Suspension_Object; Status : ACO.SDO_Sessions.SDO_Status := ACO.SDO_Sessions.Pending; Operation : Request_Type; end record; type SDO_Request_Array is array (ACO.SDO_Sessions.Valid_Endpoint_Nr) of Request_Data; procedure On_Message_Dispatch (This : in out Remote; Msg : in ACO.Messages.Message); procedure Periodic_Actions (This : in out Remote; T_Now : in Ada.Real_Time.Time); type Remote_Client (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new ACO.Protocols.Service_Data.Clients.Client (Handler, Od) with record Requests : SDO_Request_Array; end record; overriding procedure Result_Callback (This : in out Remote_Client; Session : in ACO.SDO_Sessions.SDO_Session; Result : in ACO.SDO_Sessions.SDO_Result); overriding function Tx_CAN_Id (This : Remote_Client; Parameter : ACO.SDO_Sessions.SDO_Parameters) return ACO.Messages.Id_Type; overriding function Rx_CAN_Id (This : Remote_Client; Parameter : ACO.SDO_Sessions.SDO_Parameters) return ACO.Messages.Id_Type; overriding function Get_Endpoint (This : Remote_Client; Rx_CAN_Id : ACO.Messages.Id_Type) return ACO.SDO_Sessions.Endpoint_Type; overriding function Get_Endpoint (This : Remote_Client; Server_Node : ACO.Messages.Node_Nr) return ACO.SDO_Sessions.Endpoint_Type; type Remote (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new Node_Base (Id, Handler, Od) with record NMT : ACO.Protocols.Network_Management.Masters.Master (Id, Handler, Od); EC : ACO.Protocols.Error_Control.Slaves.Slave (Id, Od); SDO : Remote_Client (Id, Handler, Od); end record; end ACO.Nodes.Remotes;
programs/oeis/211/A211266.asm
neoneye/loda
22
3750
; A211266: Number of integer pairs (x,y) such that 0<x<y<=n and x*y<=2n. ; 0,1,3,5,7,10,12,15,18,21,24,28,30,34,38,41,44,49,51,56,60,63,67,72,75,79,83,88,91,97,99,104,109,112,117,123,125,130,135,140,143,149,152,157,163,167,170,177,180,186,190,194,199,205,209,215,219,223 mov $2,$0 mov $5,$0 lpb $2 mov $0,$5 sub $2,1 sub $0,$2 mov $3,$0 mul $3,2 seq $3,92405 ; a(n) = tau(n) + tau(n+1), where tau(n) = A000005(n), the number of divisors of n. div $3,2 mov $4,$3 sub $4,1 add $1,$4 lpe mov $0,$1
Library/Kernel/DBase/dbaseC.asm
steakknife/pcgeos
504
177209
<gh_stars>100-1000 COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: Kernel/DBase FILE: dbaseC.asm REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version DESCRIPTION: This file contains C interface routines for the lmem routines $Id: dbaseC.asm,v 1.1 97/04/05 01:17:39 newdeal Exp $ ------------------------------------------------------------------------------@ SetGeosConvention C_Common segment resource COMMENT @---------------------------------------------------------------------- C FUNCTION: DBGetMap C DECLARATION: extern DBGroupAndItem _pascal DBGetMap(DBFileHandle file); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBGETMAP proc far C_GetOneWordArg bx, ax,cx ;bx = file push di call DBGetMap mov_trash dx, ax ;dx = group mov_trash ax, di ;ax = item pop di ret DBGETMAP endp COMMENT @---------------------------------------------------------------------- C FUNCTION: DBLockGetRefUngrouped C DECLARATION: extern void * _pascal DBLockGetRefUngrouped(DBFileHandle file, DBGroup group, DBItem item optr *refPtr); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBLOCKGETREFUNGROUPED proc far file:word, dbgroup:word, item:word, refPtr:fptr uses di, es .enter mov ax, dbgroup mov bx, file mov di, item call DBLock mov dx, es mov cx, es:[di] ;save offset mov_tr ax, di mov bx, es:[LMBH_handle] les di, refPtr stosw ;store chunk mov_tr ax, bx stosw ;store handle mov_tr ax, cx ; ax <- offset (dx:ax <- fptr) .leave ret DBLOCKGETREFUNGROUPED endp COMMENT @---------------------------------------------------------------------- C FUNCTION: DBRawAlloc C DECLARATION: extern DBGroupAndItem _pascal DBRawAlloc(DBFileHandle file, DBGroup group, word size); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBRAWALLOC proc far C_GetThreeWordArgs bx, ax, cx, dx ;bx = file, ax = grp, cx = sz push di call DBAlloc mov_trash dx, ax ;dx = group mov_trash ax, di ;ax = item pop di ret DBRAWALLOC endp COMMENT @---------------------------------------------------------------------- C FUNCTION: DBReAllocUngrouped C DECLARATION: extern void _pascal DBReAllocUngrouped(DBFileHandle file, DBGroupAndItem id, word size); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBREALLOCUNGROUPED proc far file:word, id:DBGroupAndItem, sz:word uses di .enter mov bx, file mov ax, id.DBGI_group mov di, id.DBGI_item mov cx, sz call DBReAlloc .leave ret DBREALLOCUNGROUPED endp COMMENT @---------------------------------------------------------------------- C FUNCTION: DBFreeUngrouped C DECLARATION: extern void _pascal DBFreeUngrouped(DBFileHandle file, DBGroupAndItem id); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBFREEUNGROUPED proc far C_GetThreeWordArgs bx, ax, cx, dx ;bx = file, ax = grp, cx = it xchg cx, di call DBFree xchg cx, di ret DBFREEUNGROUPED endp COMMENT @---------------------------------------------------------------------- C FUNCTION: DBGroupAlloc C DECLARATION: extern DBGroup _pascal DBGroupAlloc(DBFileHandle file); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBGROUPALLOC proc far C_GetOneWordArg bx, ax,cx ;bx = file call DBGroupAlloc ret DBGROUPALLOC endp COMMENT @---------------------------------------------------------------------- C FUNCTION: DBGroupFree C DECLARATION: extern void _pascal DBGroupFree(DBFileHandle file, DBGroup group); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBGROUPFREE proc far C_GetTwoWordArgs bx, ax, cx,dx ;bx = file, ax = group call DBGroupFree ret DBGROUPFREE endp COMMENT @---------------------------------------------------------------------- C FUNCTION: DBInsertAtUngrouped C DECLARATION: extern void _pascal DBInsertAtUngrouped(DBFileHandle file, DBGroupAndItem id, word insertOffset, word insertCount); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBINSERTATUNGROUPED proc far file:word, id:DBGroupAndItem, insertOffset:word, insertCount:word uses di .enter mov bx, file mov ax, id.DBGI_group mov di, id.DBGI_item mov dx, insertOffset mov cx, insertCount call DBInsertAt .leave ret DBINSERTATUNGROUPED endp COMMENT @---------------------------------------------------------------------- C FUNCTION: DBDeleteAtUngrouped C DECLARATION: extern void _pascal DBDeleteAtUngrouped(DBFileHandle file, DBGroupAndItem id, word deleteOffset, word deleteCount); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBDELETEATUNGROUPED proc far file:word, id:DBGroupAndItem, deleteOffset:word, deleteCount:word uses di .enter mov bx, file mov ax, id.DBGI_group mov di, id.DBGI_item mov dx, deleteOffset mov cx, deleteCount call DBDeleteAt .leave ret DBDELETEATUNGROUPED endp COMMENT @---------------------------------------------------------------------- C FUNCTION: DBRawCopyDBItem C DECLARATION: extern DBGroupAndItem _pascal DBRawCopyDBItem(VMFileHandle srcFile, DBGroupAndItem srcID, VMFileHandle destFile DBGroup destGroup); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBRAWCOPYDBITEM proc far srcFile:hptr, srcID:DBGroupAndItem, destFile:hptr, destGroup:word uses di .enter mov bx, srcFile mov ax, srcID.DBGI_group mov di, srcID.DBGI_item mov bp, destFile ; (no local vars, so nuking BP is ok) mov cx, destGroup call DBCopyDBItem mov_tr dx, ax ; dxax <- item created mov_tr ax, di .leave ret DBRAWCOPYDBITEM endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DBINFOUNGROUPED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% C FUNCTION: DBInfoUngrouped C DECLARATION: extern Boolean _pascal DBInfoUngrouped(VMFileHandle file, DBGroupAndItem grpAndItem, word *sizePtr) RETURN: TRUE if group & item are fine (*sizePtr == item size) FALSE if group/item is invalid (*sizePtr unchanged) SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/27/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DBINFOUNGROUPED proc far file:hptr, grpAndItem:DBGroupAndItem, sizePtr:fptr.word uses di, ds .enter mov bx, ss:[file] mov ax, ss:[grpAndItem].DBGI_group mov di, ss:[grpAndItem].DBGI_item call DBInfo mov ax, 0 ; assume bad jc done lds di, ss:[sizePtr] mov ds:[di], cx dec ax done: .leave ret DBINFOUNGROUPED endp C_Common ends ;- C_System segment resource COMMENT @---------------------------------------------------------------------- C FUNCTION: DBSetMapUngrouped C DECLARATION: extern void _pascal DBSetMapUngrouped(DBFileHandle file, DBGroup group, DBItem item); KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/91 Initial version ------------------------------------------------------------------------------@ DBSETMAPUNGROUPED proc far C_GetThreeWordArgs bx, ax, cx, dx ;bx = file, ax = grp, cx = it xchg cx, di call DBSetMap xchg cx, di ret DBSETMAPUNGROUPED endp C_System ends SetDefaultConvention
disk/disk.asm
Luzzle/LuzOS
0
85666
<filename>disk/disk.asm<gh_stars>0 reset_disk: xor ax, ax int 13h jc disk_error mov bx, DISK_RESET_SUCCESS call print call print_nl ret disk_error: mov bx, DISK_RESET_ERROR call print call print_nl jmp $
ada-containers-bounded_vectors.ads
mgrojo/adalib
15
14970
<filename>ada-containers-bounded_vectors.ads -- Standard Ada library specification -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with Ada.Iterator_Interfaces; generic type Index_Type is range <>; type Element_Type is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Bounded_Vectors is pragma Pure(Bounded_Vectors); pragma Remote_Types(Bounded_Vectors); subtype Extended_Index is Index_Type'Base range Index_Type'First-1 .. Index_Type'Min (Index_Type'Base'Last - 1, Index_Type'Last) + 1; No_Index : constant Extended_Index := Extended_Index'First; type Vector (Capacity : Count_Type) is tagged private with Constant_Indexing => Constant_Reference, Variable_Indexing => Reference, Default_Iterator => Iterate, Iterator_Element => Element_Type; pragma Preelaborable_Initialization(Vector); type Cursor is private; pragma Preelaborable_Initialization(Cursor); Empty_Vector : constant Vector; No_Element : constant Cursor; function Has_Element (Position : Cursor) return Boolean; package Vector_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element); function "=" (Left, Right : Vector) return Boolean; function To_Vector (Length : Count_Type) return Vector; function To_Vector (New_Item : Element_Type; Length : Count_Type) return Vector; function "&" (Left, Right : Vector) return Vector; function "&" (Left : Vector; Right : Element_Type) return Vector; function "&" (Left : Element_Type; Right : Vector) return Vector; function "&" (Left, Right : Element_Type) return Vector; function Capacity (Container : Vector) return Count_Type; procedure Reserve_Capacity (Container : in out Vector; Capacity : in Count_Type); function Length (Container : Vector) return Count_Type; procedure Set_Length (Container : in out Vector; Length : in Count_Type); function Is_Empty (Container : Vector) return Boolean; procedure Clear (Container : in out Vector); function To_Cursor (Container : Vector; Index : Extended_Index) return Cursor; function To_Index (Position : Cursor) return Extended_Index; function Element (Container : Vector; Index : Index_Type) return Element_Type; function Element (Position : Cursor) return Element_Type; procedure Replace_Element (Container : in out Vector; Index : in Index_Type; New_Item : in Element_Type); procedure Replace_Element (Container : in out Vector; Position : in Cursor; New_item : in Element_Type); procedure Query_Element (Container : in Vector; Index : in Index_Type; Process : not null access procedure (Element : in Element_Type)); procedure Query_Element (Position : in Cursor; Process : not null access procedure (Element : in Element_Type)); procedure Update_Element (Container : in out Vector; Index : in Index_Type; Process : not null access procedure (Element : in out Element_Type)); procedure Update_Element (Container : in out Vector; Position : in Cursor; Process : not null access procedure (Element : in out Element_Type)); type Constant_Reference_Type (Element : not null access constant Element_Type) is private with Implicit_Dereference => Element; type Reference_Type (Element : not null access Element_Type) is private with Implicit_Dereference => Element; function Constant_Reference (Container : aliased in Vector; Index : in Index_Type) return Constant_Reference_Type; function Reference (Container : aliased in out Vector; Index : in Index_Type) return Reference_Type; function Constant_Reference (Container : aliased in Vector; Position : in Cursor) return Constant_Reference_Type; function Reference (Container : aliased in out Vector; Position : in Cursor) return Reference_Type; procedure Assign (Target : in out Vector; Source : in Vector); function Copy (Source : Vector; Capacity : Count_Type := 0) return Vector; procedure Move (Target : in out Vector; Source : in out Vector); procedure Insert (Container : in out Vector; Before : in Extended_Index; New_Item : in Vector); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Vector); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Vector; Position : out Cursor); procedure Insert (Container : in out Vector; Before : in Extended_Index; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Element_Type; Position : out Cursor; Count : in Count_Type := 1); procedure Insert (Container : in out Vector; Before : in Extended_Index; Count : in Count_Type := 1); procedure Insert (Container : in out Vector; Before : in Cursor; Position : out Cursor; Count : in Count_Type := 1); procedure Prepend (Container : in out Vector; New_Item : in Vector); procedure Prepend (Container : in out Vector; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Append (Container : in out Vector; New_Item : in Vector); procedure Append (Container : in out Vector; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Insert_Space (Container : in out Vector; Before : in Extended_Index; Count : in Count_Type := 1); procedure Insert_Space (Container : in out Vector; Before : in Cursor; Position : out Cursor; Count : in Count_Type := 1); procedure Delete (Container : in out Vector; Index : in Extended_Index; Count : in Count_Type := 1); procedure Delete (Container : in out Vector; Position : in out Cursor; Count : in Count_Type := 1); procedure Delete_First (Container : in out Vector; Count : in Count_Type := 1); procedure Delete_Last (Container : in out Vector; Count : in Count_Type := 1); procedure Reverse_Elements (Container : in out Vector); procedure Swap (Container : in out Vector; I, J : in Index_Type); procedure Swap (Container : in out Vector; I, J : in Cursor); function First_Index (Container : Vector) return Index_Type; function First (Container : Vector) return Cursor; function First_Element (Container : Vector) return Element_Type; function Last_Index (Container : Vector) return Extended_Index; function Last (Container : Vector) return Cursor; function Last_Element (Container : Vector) return Element_Type; function Next (Position : Cursor) return Cursor; procedure Next (Position : in out Cursor); function Previous (Position : Cursor) return Cursor; procedure Previous (Position : in out Cursor); function Find_Index (Container : Vector; Item : Element_Type; Index : Index_Type := Index_Type'First) return Extended_Index; function Find (Container : Vector; Item : Element_Type; Position : Cursor := No_Element) return Cursor; function Reverse_Find_Index (Container : Vector; Item : Element_Type; Index : Index_Type := Index_Type'Last) return Extended_Index; function Reverse_Find (Container : Vector; Item : Element_Type; Position : Cursor := No_Element) return Cursor; function Contains (Container : Vector; Item : Element_Type) return Boolean; procedure Iterate (Container : in Vector; Process : not null access procedure (Position : in Cursor)); procedure Reverse_Iterate (Container : in Vector; Process : not null access procedure (Position : in Cursor)); function Iterate (Container : in Vector) return Vector_Iterator_Interfaces.Reversible_Iterator'Class; function Iterate (Container : in Vector; Start : in Cursor) return Vector_Iterator_Interfaces.Reversible_Iterator'Class; generic with function "<" (Left, Right : Element_Type) return Boolean is <>; package Generic_Sorting is function Is_Sorted (Container : Vector) return Boolean; procedure Sort (Container : in out Vector); procedure Merge (Target : in out Vector; Source : in out Vector); end Generic_Sorting; private -- not specified by the language end Ada.Containers.Bounded_Vectors;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_267.asm
ljhsiun2/medusa
9
28754
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x5a6e, %rdi nop nop add $28180, %r13 movb (%rdi), %r12b nop dec %rdi lea addresses_normal_ht+0xb52e, %rsi lea addresses_normal_ht+0x6bee, %rdi clflush (%rdi) and $54116, %r11 mov $23, %rcx rep movsq nop nop nop sub $59233, %rcx lea addresses_D_ht+0x1014e, %rsi lea addresses_A_ht+0x1386e, %rdi nop nop sub $344, %rax mov $6, %rcx rep movsb nop nop nop nop nop dec %rax lea addresses_A_ht+0x1046e, %r13 nop nop nop nop nop add %r12, %r12 mov (%r13), %ecx nop nop add $62191, %r12 lea addresses_D_ht+0xd06e, %r12 nop add %rsi, %rsi movups (%r12), %xmm2 vpextrq $0, %xmm2, %r11 nop nop and %rax, %rax lea addresses_normal_ht+0xc8c2, %r11 nop nop nop nop sub %rdi, %rdi movl $0x61626364, (%r11) nop nop nop nop cmp %rax, %rax lea addresses_WT_ht+0xbc6e, %rsi lea addresses_UC_ht+0x5d6e, %rdi nop nop nop nop nop add %rax, %rax mov $77, %rcx rep movsq nop xor %r11, %r11 lea addresses_D_ht+0x46e, %r11 nop nop nop nop nop dec %rdi mov (%r11), %ecx nop nop nop nop sub $38252, %r11 lea addresses_D_ht+0x107de, %rdi nop and %r12, %r12 movw $0x6162, (%rdi) nop nop nop nop add $3195, %r12 lea addresses_A_ht+0x246e, %rdi nop nop nop nop nop sub $11487, %r11 movw $0x6162, (%rdi) nop nop nop nop nop sub $29507, %rsi lea addresses_WC_ht+0x246e, %r11 nop nop xor %rdi, %rdi movl $0x61626364, (%r11) nop nop nop nop nop and %rsi, %rsi lea addresses_WC_ht+0xc6e, %rsi lea addresses_WC_ht+0x1a7e2, %rdi nop nop nop nop nop cmp %rdx, %rdx mov $4, %rcx rep movsq nop nop nop nop nop xor %rax, %rax lea addresses_normal_ht+0x5c6e, %rsi lea addresses_WT_ht+0x7e6e, %rdi clflush (%rsi) nop sub $54398, %rax mov $51, %rcx rep movsl nop nop nop cmp $20037, %rsi lea addresses_UC_ht+0x10491, %rdx nop nop nop nop nop sub $35638, %r11 mov $0x6162636465666768, %rsi movq %rsi, %xmm4 movups %xmm4, (%rdx) nop mfence pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r8 push %rax push %rbx push %rcx push %rdi // Store lea addresses_WT+0xfdae, %r8 nop nop cmp $51937, %r10 mov $0x5152535455565758, %rax movq %rax, %xmm1 movntdq %xmm1, (%r8) nop nop inc %r10 // Faulty Load lea addresses_PSE+0x1946e, %rbx nop nop nop nop sub $44878, %rcx movups (%rbx), %xmm7 vpextrq $0, %xmm7, %rdi lea oracles, %r8 and $0xff, %rdi shlq $12, %rdi mov (%r8,%rdi,1), %rdi pop %rdi pop %rcx pop %rbx pop %rax pop %r8 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_WT'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': True, 'type': 'addresses_A_ht'}} {'src': {'congruent': 10, 'AVXalign': True, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': True, 'size': 4, 'NT': True, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_UC_ht'}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
src/intel/tools/tests/gen7.5/bfi1.asm
SoftReaper/Mesa-Renoir-deb
0
7144
<reponame>SoftReaper/Mesa-Renoir-deb bfi1(8) g22<1>UD g20<4>.xD g19<4>.xD { align16 1Q }; bfi1(8) g12<1>UD g11<8,8,1>D g10<8,8,1>D { align1 1Q }; bfi1(8) g17<1>UD g15<8,8,1>D g21<8,8,1>D { align1 2Q };
library/fmGUI_ManageLayouts/fmGUI_ManageLayouts_Open.applescript
NYHTC/applescript-fm-helper
1
4427
-- fmGUI_ManageLayouts_Open({}) -- <NAME>, NYHTC -- open Manage Layouts (* HISTORY: 1.0 - 2017-11-06 ( eshagdar ): created REQUIRES: fmGUI_Menu_OpenLayouts *) on run fmGUI_ManageLayouts_Open({}) end run -------------------- -- START OF CODE -------------------- on fmGUI_ManageLayouts_Open(prefs) -- version 1.0 try return fmGUI_Menu_OpenLayouts({}) on error errMsg number errNum error "unable to fmGUI_ManageLayouts_Open - " & errMsg number errNum end try end fmGUI_ManageLayouts_Open -------------------- -- END OF CODE -------------------- on fmGUI_Menu_OpenLayouts(prefs) tell application "htcLib" to fmGUI_Menu_OpenLayouts(prefs) end fmGUI_Menu_OpenLayouts
oeis/245/A245325.asm
neoneye/loda-programs
11
88162
<gh_stars>10-100 ; A245325: Numerators of an enumeration system of the reduced nonnegative rational numbers ; Submitted by <NAME>(s1) ; 1,1,2,2,1,3,3,3,3,2,1,5,4,5,4,5,4,5,4,3,3,2,1,8,7,7,5,8,7,7,5,8,7,7,5,8,7,7,5,5,4,5,4,3,3,2,1,13,11,12,9,11,10,9,6,13,11,12,9,11,10,9,6,13,11,12,9,11,10,9,6,13,11,12,9,11,10,9,6,8,7,7,5,8,7,7,5,5,4,5,4,3,3,2,1,21,18,19,14,19 mul $0,2 mov $1,2 mov $2,2 lpb $0 div $0,2 add $3,$0 sub $0,1 mod $3,2 mov $4,$2 add $2,$1 mul $3,$4 add $1,$3 sub $2,$3 lpe mov $0,$2 div $0,2
day18/lang.g4
TheUnlocked/advent-of-code-2020
0
3364
grammar lang; expr : expr op=(MUL | ADD) atom | atom ; expr2 : expr2 MUL add | add ; add : add ADD atom2 | atom2 ; atom : '(' expr ')' | NUMBER ; atom2 : '(' expr2 ')' | NUMBER ; NUMBER: [0-9]+ ; MUL: '*'; ADD: '+'; WS: ' ' -> skip;
src/main/antlr/DeltaDescriptorParser.g4
fossabot/confort
1
6318
//package de.mlessmann.confort.antlr //Not packaged due to gradle/gradle#2565 parser grammar DeltaDescriptorParser; options { tokenVocab = DeltaDescriptorLexer; } deltaDescriptor : commandBlock* EOF; commandBlock : assignment | TAG_DESCRIPTOR command ; command : metaCommand | descriptor ; metaCommand : navigateTo ; assignment : IDENTIFIER (OP_EQ|OP_WEAK_EQ) QUOTED_STRING ; navigateTo : OP_NAVIGATE QUOTED_STRING? ; descriptor : operationArgument reversableOP operationArgument?; node_location : META_RELATIVE? QUOTED_STRING ; operationArgument : method_identifier | node_location ; method_identifier : IDENTIFIER ; reversableOP : OP_MOVE | OP_MERGE_APPEND | OP_MERGE_PREPEND | OP_DROP | OP_GENERATE ;
apple_scripts/likedislike.applescript
PLDaily/tmux-NeteaseMusic
0
89
<reponame>PLDaily/tmux-NeteaseMusic<filename>apple_scripts/likedislike.applescript tell application "System Events" to tell process "NeteaseMusic" set menuList to name of menu item of menu 1 of menu bar item "Controls" of menu bar 1 if menuList contains "Like" then click menu item "Like" of menu 1 of menu bar item "controls" of menu bar 1 else click menu item "Dislike" of menu 1 of menu bar item "controls" of menu bar 1 end if end tell
old/Spaces/Spheres.agda
timjb/HoTT-Agda
294
2775
<reponame>timjb/HoTT-Agda<filename>old/Spaces/Spheres.agda {-# OPTIONS --without-K #-} module Spaces.Spheres where open import Base open import Spaces.Suspension public -- [Sⁿ n] is the sphere of dimension n Sⁿ : ℕ → Set Sⁿ 0 = bool Sⁿ (S n) = suspension (Sⁿ n) ⋆Sⁿ : (n : ℕ) → Sⁿ n ⋆Sⁿ 0 = true ⋆Sⁿ (S n) = north (Sⁿ n)
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1085.asm
ljhsiun2/medusa
9
5995
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0xb5bd, %rdx nop sub $37667, %r13 vmovups (%rdx), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %rdi nop nop and $10242, %rsi lea addresses_D_ht+0xb01d, %rbx nop nop nop nop nop xor $25253, %r15 mov $0x6162636465666768, %r14 movq %r14, (%rbx) nop nop nop add $54851, %rdx lea addresses_A_ht+0xd2bd, %rsi lea addresses_WT_ht+0x1dcbd, %rdi and $21731, %r15 mov $55, %rcx rep movsl cmp $38387, %r14 lea addresses_UC_ht+0x165f, %r14 nop nop nop nop nop sub %rdi, %rdi movl $0x61626364, (%r14) nop nop cmp %rbx, %rbx lea addresses_WC_ht+0x1e485, %rsi lea addresses_D_ht+0x3213, %rdi nop nop nop cmp %rdx, %rdx mov $75, %rcx rep movsw nop inc %rsi lea addresses_UC_ht+0x413d, %rdi nop nop add %r15, %r15 movb $0x61, (%rdi) nop nop nop nop add %rbx, %rbx lea addresses_D_ht+0xdd75, %rcx clflush (%rcx) nop xor %rsi, %rsi mov $0x6162636465666768, %r15 movq %r15, %xmm5 vmovups %ymm5, (%rcx) nop nop nop xor $27735, %r15 lea addresses_UC_ht+0xcd9d, %rdx nop nop nop dec %r15 mov (%rdx), %esi nop nop sub $37019, %rcx lea addresses_normal_ht+0x813d, %r15 nop and %rsi, %rsi mov (%r15), %r14w nop nop nop dec %rdi lea addresses_WT_ht+0x5f51, %r15 nop nop nop nop add %rsi, %rsi mov (%r15), %ecx nop sub %r14, %r14 lea addresses_D_ht+0x50ad, %rbx nop nop nop and $42029, %rsi movl $0x61626364, (%rbx) nop nop nop nop nop and %r15, %r15 lea addresses_WC_ht+0x1189d, %rbx nop nop nop nop add %rsi, %rsi vmovups (%rbx), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %rdi nop cmp %r13, %r13 lea addresses_D_ht+0x12f85, %rcx nop nop and $46609, %rdi movl $0x61626364, (%rcx) nop add %r15, %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %rax push %rbx push %rcx push %rdx // Store lea addresses_normal+0x8dbd, %r15 clflush (%r15) nop cmp %rbx, %rbx mov $0x5152535455565758, %r12 movq %r12, %xmm6 vmovntdq %ymm6, (%r15) nop nop sub %rbx, %rbx // Store lea addresses_WT+0x489d, %rcx nop sub %r11, %r11 movb $0x51, (%rcx) nop nop nop nop nop inc %rcx // Store lea addresses_WT+0x15dbd, %r11 nop nop nop nop and $3964, %rdx mov $0x5152535455565758, %rax movq %rax, %xmm6 movups %xmm6, (%r11) cmp $19647, %rdx // Faulty Load mov $0x70f38d0000000cbd, %r11 nop nop and %r15, %r15 mov (%r11), %rax lea oracles, %rcx and $0xff, %rax shlq $12, %rax mov (%rcx,%rax,1), %rax pop %rdx pop %rcx pop %rbx pop %rax pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}} [Faulty Load] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 5}} {'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 1}} {'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 7}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 3}} {'src': {'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 4, 'NT': False, 'same': True, 'congruent': 5}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 3}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 3}} {'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 */
mshal/asm/hook.asm
BertoldVdb/ms-tools
11
17152
hookRun: MOV A, HID XRL A, R0 JNZ hookRet LCALL hookWork MOV HID+1, A MOV HID+2, R2 MOV HID+3, R3 MOV HID+4, R4 MOV HID+5, R5 MOV HID+6, R6 MOV HID+7, R7 MOV A, #0xFF RLC A MOV HID, A hookRet: RET hookWork: MOV DPH, HID+3 MOV DPL, HID+4 MOV R3, HID+3 MOV R4, HID+4 MOV R5, HID+5 MOV R6, HID+6 MOV R7, HID+7 MOV A, R7 RRC A MOV A, R7 PUSH HID+2 PUSH HID+1 RET ;Call address in HID+1
alloy4fun_models/trashltl/models/4/vh8BXeRonuZkGZu5S.als
Kaixi26/org.alloytools.alloy
0
2342
<reponame>Kaixi26/org.alloytools.alloy open main pred idvh8BXeRonuZkGZu5S_prop5 { some f : File | eventually f in Trash } pred __repair { idvh8BXeRonuZkGZu5S_prop5 } check __repair { idvh8BXeRonuZkGZu5S_prop5 <=> prop5o }
oeis/272/A272266.asm
neoneye/loda-programs
11
1140
<gh_stars>10-100 ; A272266: The union of squares (A000290) and 10-gonal numbers (A001107). ; Submitted by <NAME> ; 1,4,9,10,16,25,27,36,49,52,64,81,85,100,121,126,144,169,175,196,225,232,256,289,297,324,361,370,400,441,451,484,529,540,576,625,637,676,729,742,784,841,855,900,961,976,1024,1089,1105,1156,1225,1242,1296,1369,1387,1444,1521,1540,1600,1681,1701,1764,1849,1870,1936,2025,2047,2116,2209,2232,2304,2401,2425,2500,2601,2626,2704,2809,2835,2916,3025,3052,3136,3249,3277,3364,3481,3510,3600,3721,3751,3844,3969,4000,4096,4225,4257,4356,4489,4522 add $0,1 mov $1,$0 div $1,3 add $1,$0 add $1,2 mov $0,$1 div $0,2 mul $0,$1 div $0,2
tests/syntax/bad/testfile-end-3.adb
xuedong/mini-ada
0
4121
with Ada.Text_IO; use Ada.Text_IO; procedure Test is function F return integer is begin return 0; end G; begin Put('a'); end;
programs/oeis/183/A183345.asm
neoneye/loda
22
247159
; A183345: Number of n X 3 binary arrays with each 1 adjacent to exactly one 0 vertically and one 0 horizontally. ; 1,9,16,25,64,144,289,625,1369,2916,6241,13456,28900,62001,133225,286225,614656,1320201,2835856,6091024,13082689,28100601,60357361,129640996,278455969,598095936,1284648964,2759295841,5926690225,12729931929,27342606736,58729160281,126144308224,270945234576,581963008225,1249997789089,2684869042249,5766827622084,12386563497025,26605087792144,57145042400356,122741781474321,263636954083801,566265559432225,1216281249050176,2612449322015625,5611277379571600,12052457272611856,25887461353764481,55603653278624361,119431033258730209,256525801169672644,550991520965856961,1183474156563968256,2541982999665184516,5459922833759041729,11727362989653585121,25189191656836619049,54103840469902688656,116209586773229952025,249606459369871856704,536129473386233866896,1151551978899208064161,2473417385041548145489,5312650816226197026361,11411037565208501422500,24509756582702445225889,52644482529345643941904,113075033259959034252004,242873754901352770122225,521668303950616482976969,1120490847013281053148721,2406701209815866791576576,5169351207793045385584521,11103244474438060015210000,23848648099840017575573776,51224488256509183002988225,110025028930627278165051225,236322653543485661732809681,507597199661249401081604836,1090267535678848002721772641,2341784588544832466588295744,5029916859563777873119653124,10803753572332290809057010721,23205371880004679021848909201,49842795884233038513049797561,107057293216574687365879323664,229948256865045443413824910681,493905639182427856658525872384,1060859446129093430852132631696,2278618981358994587583113853025,4894243512799609305945719891329,10512340921646691911964053277481,22579446928604905111438896576516,48498372284697898241312564876929,104169607063554400376154094692496,223745798561555101970218568832100,480583384973361800963839481563089,1032244589160026405280429949495609,2217157157668305109178327770794049 add $0,1 seq $0,196382 ; Number of sequences of n coin flips, that win on the last flip, if the sequence of flips ends with (1,1,0) or (1,0,1). add $0,1 pow $0,2
oeis/052/A052604.asm
neoneye/loda-programs
11
99337
; A052604: E.g.f. (1-x)/(1-2x-x^3+x^4). ; Submitted by <NAME> ; 1,1,4,30,240,2520,32400,478800,8104320,154586880,3273177600,76241088000,1937561472000,53340660172800,1581414202368000,50234310846720000,1702089880178688000,61276407362666496000 mov $2,$0 seq $0,52540 ; Expansion of (1-x)/(1-2*x-x^3+x^4). lpb $2 mul $0,$2 sub $2,1 lpe
programs/oeis/073/A073123.asm
neoneye/loda
22
98652
<reponame>neoneye/loda ; A073123: a(n) is the largest number such that pi(a(n)) = prime(n). ; 4,6,12,18,36,42,60,70,88,112,130,162,180,192,222,250,280,292,336,358,372,408,432,462,520,556,568,592,600,618,718,742,786,808,862,880,928,970,996,1032,1068,1090,1162,1180,1212,1222,1300,1422,1438,1450,1480,1510,1530,1600,1626,1692,1732,1746,1788,1830,1860,1930,2028,2068,2082,2110,2236,2272,2346,2356,2382,2422,2502,2550,2616,2656,2686,2728,2752,2818,2902,2916,3010,3022,3078,3118,3180,3250,3270,3300,3322,3412,3490,3526,3570,3606,3642,3738,3766,3916 seq $0,40 ; The prime numbers. sub $0,1 seq $0,98090 ; Numbers k such that 2k-3 is prime. sub $0,2 mul $0,2
MODULE1/4-stack_usage/weasel.asm
wetw0rk/SLAE
18
12873
; Executable name : weasel ; Designed OS : Linux (32-bit) ; Author : wetw0rk ; Version : 1.0 ; Created Following : SLAE ; Description : A simple program that shows how the stack ; functions. This program is meant to be ran ; under the GNU debugger. ; ; Build using these commands: ; nasm -f elf32 -o weasel.o weasel.asm ; ld -o weasel weasel.o ; ; How to run and use this program (intention): ; gdb -q ./weasel ; SECTION .data PopGoes: db 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x10, 0x11 SECTION .text global _start _start: mov eax,0xdeadbeef ; MOV 0xdeadbeef into EAX ; Here is were the weasel begins to pop push ax ; PUSH AX (2 bytes) onto the stack (0xefbe) pop bx ; POP BX (2 bytes) from the stack onto BX (0xbeef) push eax ; PUSH EAX (4 bytes) onto the stack (0xefbeadde) pop ecx ; POP ECX (4 bytes) from stack onto ECX (0xdeadbeef) ; Example of memory push and pop push word [PopGoes] ; PUSH 2 bytes (0xAA, 0xBB) onto the stack from [PopGoes] pop ecx ; POP 4 bytes from the stack onto ECX push dword [PopGoes] ; PUSH 4 bytes from [PopGoes] (0xAA,0xBB,0xCC,0xDD) onto stack pop edx ; POP 4 bytes from the stack onto EDX ; Example of popad and pushad pushad ; PUSH all GP registers onto the stack xor eax,eax ; this is the same as MOV EAX,0 xor ebx,ebx ; ^ xor ecx,ecx ; | zero-ing out xor edx,edx ; | popad ; POP saved values from the stack back to GP registers ; The following registers should contain: EAX = 0xdeadbeef, ; EBX = 0xbeef, ECX = 0x1bbaa, EDX = 0xddccbbaa. This is ; awesome :) ; This should be second nature by now mov eax,1 ; syscall for exit() mov ebx,0 ; exit cleanly or 0 int 80h ; call dat kernel
old/Algebra/FreeGroupAsReducedWords.agda
timjb/HoTT-Agda
294
16097
<reponame>timjb/HoTT-Agda<gh_stars>100-1000 {-# OPTIONS --without-K #-} open import Base module Algebra.FreeGroupAsReducedWords {i} (A : Set i) (eq : has-dec-eq A) where A-is-set : is-set A A-is-set = dec-eq-is-set eq data word : Set i where ε : word _∷_ : A → word → word _′∷_ : A → word → word is-reduced : word → Set i is-reduced ε = unit is-reduced (x ∷ ε) = unit is-reduced (x ∷ (y ∷ w)) = is-reduced (y ∷ w) is-reduced (x ∷ (y ′∷ w)) = (x ≢ y) × is-reduced (y ′∷ w) is-reduced (x ′∷ ε) = unit is-reduced (x ′∷ (y ∷ w)) = (x ≢ y) × is-reduced (y ∷ w) is-reduced (x ′∷ (y ′∷ w)) = is-reduced (y ′∷ w) is-reduced-is-prop : (w : word) → is-prop (is-reduced w) is-reduced-is-prop ε = unit-is-prop is-reduced-is-prop (x ∷ ε) = unit-is-prop is-reduced-is-prop (x ∷ (y ∷ w)) = is-reduced-is-prop (y ∷ w) is-reduced-is-prop (x ∷ (y ′∷ w)) = ×-is-truncated _ (Π-is-truncated _ (λ _ → λ ())) (is-reduced-is-prop (y ′∷ w)) is-reduced-is-prop (x ′∷ ε) = unit-is-prop is-reduced-is-prop (x ′∷ (y ∷ w)) = ×-is-truncated _ (Π-is-truncated _ (λ _ → λ ())) (is-reduced-is-prop (y ∷ w)) is-reduced-is-prop (x ′∷ (y ′∷ w)) = is-reduced-is-prop (y ′∷ w) reduced-word : Set i reduced-word = Σ word is-reduced word-total-path : {x y : A} (p : x ≡ y) {v w : word} (q : v ≡ w) → (x ∷ v ≡ y ∷ w) word-total-path refl refl = refl word'-total-path : {x y : A} (p : x ≡ y) {v w : word} (q : v ≡ w) → (x ′∷ v ≡ y ′∷ w) word'-total-path refl refl = refl -- The following six functions prove things like if [x ∷ v ≡ y ∷ w], -- then [x ≡ y]. -- This is not as easy as it sounds, you cannot directly induct on the equality -- (because [x ∷ v] is not a general element of type word), so you have to -- extract the head, but it’s not always possible… word-comp-path-type : (v w : word) → Set i word-comp-path-type ε ε = unit word-comp-path-type ε (y ∷ w) = ⊥ word-comp-path-type ε (y ′∷ w) = ⊥ word-comp-path-type (x ∷ v) ε = ⊥ word-comp-path-type (x ∷ v) (y ∷ w) = (x ≡ y) × (v ≡ w) word-comp-path-type (x ∷ v) (y ′∷ w) = ⊥ word-comp-path-type (x ′∷ v) ε = ⊥ word-comp-path-type (x ′∷ v) (y ∷ w) = ⊥ word-comp-path-type (x ′∷ v) (y ′∷ w) = (x ≡ y) × (v ≡ w) word-comp-path : {v w : word} (p : v ≡ w) → word-comp-path-type v w word-comp-path {v = ε} refl = tt word-comp-path {v = x ∷ v} refl = (refl , refl) word-comp-path {v = x ′∷ v} refl = (refl , refl) word-base-path : {x y : A} {v w : word} (p : x ∷ v ≡ y ∷ w) → x ≡ y word-base-path p = π₁ (word-comp-path p) word-fiber-path : {x y : A} {v w : word} (p : x ∷ v ≡ y ∷ w) → v ≡ w word-fiber-path p = π₂ (word-comp-path p) word'-base-path : {x y : A} {v w : word} (p : x ′∷ v ≡ y ′∷ w) → x ≡ y word'-base-path p = π₁ (word-comp-path p) word'-fiber-path : {x y : A} {v w : word} (p : x ′∷ v ≡ y ′∷ w) → v ≡ w word'-fiber-path p = π₂ (word-comp-path p) -- This one goes to Set and is used to prove that the constructors of [word] are -- disjoint word-cst-dis : (v w : word) → Set word-cst-dis ε ε = unit word-cst-dis ε (y ∷ w) = ⊥ word-cst-dis ε (y ′∷ w) = ⊥ word-cst-dis (x ∷ v) ε = ⊥ word-cst-dis (x ∷ v) (y ∷ w) = unit word-cst-dis (x ∷ v) (y ′∷ w) = ⊥ word-cst-dis (x ′∷ v) ε = ⊥ word-cst-dis (x ′∷ v) (y ∷ w) = ⊥ word-cst-dis (x ′∷ v) (y ′∷ w) = unit word-has-dec-eq : has-dec-eq word word-has-dec-eq ε ε = inl refl word-has-dec-eq ε (x ∷ w) = inr (λ p → transport (word-cst-dis ε) p tt) word-has-dec-eq ε (x ′∷ w) = inr (λ p → transport (word-cst-dis ε) p tt) word-has-dec-eq (x ∷ v) ε = inr (λ p → transport (word-cst-dis (x ∷ v)) p tt) word-has-dec-eq (x ∷ v) (y ∷ w) with (eq x y) word-has-dec-eq (x ∷ v) (y ∷ w) | inl x≡y with (word-has-dec-eq v w) word-has-dec-eq (x ∷ v) (y ∷ w) | inl x≡y | inl v≡w = inl (word-total-path x≡y v≡w) word-has-dec-eq (x ∷ v) (y ∷ w) | inl x≡y | inr v≢w = inr (λ p → v≢w (word-fiber-path p)) word-has-dec-eq (x ∷ v) (y ∷ w) | inr x≢y = inr (λ p → x≢y (word-base-path p)) word-has-dec-eq (x ∷ v) (y ′∷ w) = inr (λ p → transport (word-cst-dis (x ∷ v)) p tt) word-has-dec-eq (x ′∷ v) ε = inr (λ p → transport (word-cst-dis (x ′∷ v)) p tt) word-has-dec-eq (x ′∷ v) (y ∷ w) = inr (λ p → transport (word-cst-dis (x ′∷ v)) p tt) word-has-dec-eq (x ′∷ v) (y ′∷ w) with (eq x y) word-has-dec-eq (x ′∷ v) (y ′∷ w) | inl x≡y with (word-has-dec-eq v w) word-has-dec-eq (x ′∷ v) (y ′∷ w) | inl x≡y | inl v≡w = inl (word'-total-path x≡y v≡w) word-has-dec-eq (x ′∷ v) (y ′∷ w) | inl x≡y | inr v≢w = inr (λ p → v≢w (word'-fiber-path p)) word-has-dec-eq (x ′∷ v) (y ′∷ w) | inr x≢y = inr (λ p → x≢y (word'-base-path p)) word-is-set : is-set word word-is-set = dec-eq-is-set word-has-dec-eq abstract reduced-is-set : is-set reduced-word reduced-is-set = subtype-truncated-S-is-truncated-S _ word-is-set is-reduced-is-prop tail-is-reduced : (x : A) (w : word) (r : is-reduced (x ∷ w)) → is-reduced w tail-is-reduced x ε red = tt tail-is-reduced x (y ∷ w) red = red tail-is-reduced x (y ′∷ w) red = π₂ red tail'-is-reduced : (x : A) (w : word) (r : is-reduced (x ′∷ w)) → is-reduced w tail'-is-reduced x ε red = tt tail'-is-reduced x (y ∷ w) red = π₂ red tail'-is-reduced x (y ′∷ w) red = red import Algebra.FreeGroup as F open F A import Algebra.FreeGroupProps as Fp open Fp A reduced-to-freegroup : reduced-word → freegroup reduced-to-freegroup (ε , _) = e reduced-to-freegroup ((x ∷ w) , r) = x · reduced-to-freegroup (w , tail-is-reduced x w r) reduced-to-freegroup ((x ′∷ w) , r) = x ⁻¹· reduced-to-freegroup (w , tail'-is-reduced x w r) mul-reduce : A → reduced-word → reduced-word mul-reduce x (ε , red) = ((x ∷ ε) , tt) mul-reduce x ((y ∷ w) , red) = ((x ∷ (y ∷ w)) , red) mul-reduce x ((y ′∷ w) , red) with (eq x y) mul-reduce x ((y ′∷ w) , red) | inl equal = (w , tail'-is-reduced y w red) mul-reduce x ((y ′∷ w) , red) | inr different = ((x ∷ (y ′∷ w)) , (different , red)) mul'-reduce : A → reduced-word → reduced-word mul'-reduce x (ε , red) = ((x ′∷ ε) , tt) mul'-reduce x ((y ∷ w) , red) with (eq x y) mul'-reduce x ((y ∷ w) , red) | inl equal = (w , tail-is-reduced y w red) mul'-reduce x ((y ∷ w) , red) | inr different = ((x ′∷ (y ∷ w)) , (different , red)) mul'-reduce x ((y ′∷ w) , red) = (x ′∷ (y ′∷ w)) , red abstract mul-mul'-reduce : (x : A) (w : reduced-word) → mul-reduce x (mul'-reduce x w) ≡ w mul-mul'-reduce x (ε , red) with (eq x x) mul-mul'-reduce x (ε , red) | inl obvious = refl mul-mul'-reduce x (ε , red) | inr absurd = abort-nondep (absurd refl) mul-mul'-reduce x ((y ∷ w) , red) with (eq x y) mul-mul'-reduce x ((y ∷ ε) , red) | inl equal = ap _ equal mul-mul'-reduce x ((y ∷ (z ∷ w)) , red) | inl equal = ap _ equal mul-mul'-reduce x ((y ∷ (z ′∷ w)) , red) | inl equal with (eq x z) mul-mul'-reduce x ((y ∷ (z ′∷ w)) , red) | inl equal | inl absurd = abort-nondep (π₁ red (! equal ∘ absurd)) mul-mul'-reduce x ((y ∷ (z ′∷ w)) , red) | inl equal | inr obvious = Σ-eq (ap _ equal) (π₁ (is-reduced-is-prop (y ∷ (z ′∷ w)) _ _)) mul-mul'-reduce x ((y ∷ w) , red) | inr different with (eq x x) mul-mul'-reduce x ((y ∷ w) , red) | inr different | inl obvious = refl mul-mul'-reduce x ((y ∷ w) , red) | inr different | inr absurd = abort-nondep (absurd refl) mul-mul'-reduce x ((y ′∷ w) , red) with (eq x x) mul-mul'-reduce x ((y ′∷ w) , red) | inl obvious = refl mul-mul'-reduce x ((y ′∷ w) , red) | inr absurd = abort-nondep (absurd refl) abstract mul'-mul-reduce : (x : A) (w : reduced-word) → mul'-reduce x (mul-reduce x w) ≡ w mul'-mul-reduce x (ε , red) with (eq x x) mul'-mul-reduce x (ε , red) | inl obvious = refl mul'-mul-reduce x (ε , red) | inr absurd = abort-nondep (absurd refl) mul'-mul-reduce x ((y ′∷ w) , red) with (eq x y) mul'-mul-reduce x ((y ′∷ ε) , red) | inl equal = ap _ equal mul'-mul-reduce x ((y ′∷ (z ′∷ w)) , red) | inl equal = ap _ equal mul'-mul-reduce x ((y ′∷ (z ∷ w)) , red) | inl equal with (eq x z) mul'-mul-reduce x ((y ′∷ (z ∷ w)) , red) | inl equal | inl absurd = abort-nondep (π₁ red (! equal ∘ absurd)) mul'-mul-reduce x ((y ′∷ (z ∷ w)) , red) | inl equal | inr obvious = Σ-eq (ap _ equal) (π₁ (is-reduced-is-prop (y ′∷ (z ∷ w)) _ _)) mul'-mul-reduce x ((y ′∷ w) , red) | inr different with (eq x x) mul'-mul-reduce x ((y ′∷ w) , red) | inr different | inl obvious = refl mul'-mul-reduce x ((y ′∷ w) , red) | inr different | inr absurd = abort-nondep (absurd refl) mul'-mul-reduce x ((y ∷ w) , red) with (eq x x) mul'-mul-reduce x ((y ∷ w) , red) | inl obvious = refl mul'-mul-reduce x ((y ∷ w) , red) | inr absurd = abort-nondep (absurd refl) freegroup-to-reduced : freegroup → reduced-word freegroup-to-reduced = freegroup-rec-nondep reduced-word (ε , tt) mul-reduce mul'-reduce mul-mul'-reduce mul'-mul-reduce reduced-is-set abstract mul-reduce-reduced : (x : A) (w : word) (red : is-reduced (x ∷ w)) → mul-reduce x (w , tail-is-reduced x w red) ≡ ((x ∷ w) , red) mul-reduce-reduced x ε red = refl mul-reduce-reduced x (y ∷ w) red = refl mul-reduce-reduced x (y ′∷ w) red with (eq x y) mul-reduce-reduced x (y ′∷ w) red | inl absurd = abort-nondep (π₁ red absurd) mul-reduce-reduced x (y ′∷ w) red | inr obvious = Σ-eq refl (π₁ (is-reduced-is-prop (x ∷ (y ′∷ w)) _ _)) abstract mul'-reduce-reduced : (x : A) (w : word) (red : is-reduced (x ′∷ w)) → mul'-reduce x (w , tail'-is-reduced x w red) ≡ ((x ′∷ w) , red) mul'-reduce-reduced x ε red = refl mul'-reduce-reduced x (y ∷ w) red with (eq x y) mul'-reduce-reduced x (y ∷ w) red | inl absurd = abort-nondep (π₁ red absurd) mul'-reduce-reduced x (y ∷ w) red | inr obvious = Σ-eq refl (π₁ (is-reduced-is-prop (x ′∷ (y ∷ w)) _ _)) mul'-reduce-reduced x (y ′∷ w) red = refl inv₁ : (w : reduced-word) → freegroup-to-reduced (reduced-to-freegroup w) ≡ w inv₁ (ε , red) = refl inv₁ ((x ∷ w) , red) = ap (mul-reduce x) (inv₁ (w , tail-is-reduced x w red)) ∘ mul-reduce-reduced x w red inv₁ ((x ′∷ w) , red) = ap (mul'-reduce x) (inv₁ (w , tail'-is-reduced x w red)) ∘ mul'-reduce-reduced x w red reduced-to-freegroup-mul-reduce : (x : A) (v : reduced-word) → reduced-to-freegroup (mul-reduce x v) ≡ x · (reduced-to-freegroup v) reduced-to-freegroup-mul-reduce x (ε , red) = refl reduced-to-freegroup-mul-reduce x ((y ∷ v) , red) = refl reduced-to-freegroup-mul-reduce x ((y ′∷ v) , red) with (eq x y) reduced-to-freegroup-mul-reduce x ((.x ′∷ v) , red) | inl refl = ! (right-inverse-· x (reduced-to-freegroup (v , tail'-is-reduced x v red))) reduced-to-freegroup-mul-reduce x ((y ′∷ v) , red) | inr different = refl reduced-to-freegroup-mul'-reduce : (x : A) (v : reduced-word) → reduced-to-freegroup (mul'-reduce x v) ≡ x ⁻¹· (reduced-to-freegroup v) reduced-to-freegroup-mul'-reduce x (ε , red) = refl reduced-to-freegroup-mul'-reduce x ((y ∷ v) , red) with (eq x y) reduced-to-freegroup-mul'-reduce x ((.x ∷ v) , red) | inl refl = ! (left-inverse-· x (reduced-to-freegroup (v , tail-is-reduced x v red))) reduced-to-freegroup-mul'-reduce x ((y ∷ v) , red) | inr different = refl reduced-to-freegroup-mul'-reduce x ((y ′∷ v) , red) = refl inv₂ : (a : freegroup) → reduced-to-freegroup (freegroup-to-reduced a) ≡ a inv₂ = freegroup-rec _ refl (λ x u p → reduced-to-freegroup-mul-reduce x (freegroup-to-reduced u) ∘ ap (λ t → x · t) {y = u} p) (λ x u p → reduced-to-freegroup-mul'-reduce x (freegroup-to-reduced u) ∘ ap (λ t → x ⁻¹· t) {y = u} p) (λ x u t → π₁ (freegroup-is-set _ _ _ _)) (λ x u t → π₁ (freegroup-is-set _ _ _ _)) (λ u → truncated-is-truncated-S _ (freegroup-is-set _ _)) freegroup-equiv-reduced : freegroup ≃ reduced-word freegroup-equiv-reduced = (freegroup-to-reduced , iso-is-eq _ reduced-to-freegroup inv₁ inv₂)
test/Succeed/Issue4259.agda
cruhland/agda
1,989
14647
module _ where postulate I : Set data P (i : I) : Set where p : P i → P i data Q (i : I) : P i → Set where q : (x : P i) → Q i (p x) module _ (i : I) (x : P i) where g : Q _ x → Set₁ g (q y) = Set
c_projects/project1/ch1-ch3/boot_sector_10.asm
darbinreyes/subparprogrammer
0
19556
<reponame>darbinreyes/subparprogrammer<filename>c_projects/project1/ch1-ch3/boot_sector_10.asm ; Section 3.6.4 Putting it all Together. ; Read some sectors from the boot disk using our disk_read function. [org 0x7c00] ; For convenience, tell the assembler where BIOS will load us into ; memory, otherwise we have to explicitly use 0x7c00 as a base address for every ; memory access we make. mov [BOOT_DRIVE], dl ; By convention the BIOS stores the boot disk device number ; in DL. Save that value in memory. (Notice that we are storing a single byte ; here in a single instruction, even though we are in 16 bit real mode.) mov bp, 0x8000 ; Initialize our stack base pointer to a safe location. The ; disk_load function uses the stack a little bit, so does ; print_string and print_hex. mov sp, bp ; Stack is always initially empty. mov bx, 0x9000 ; By convention, the BIOS int 0x13 routine uses [ES:BX] as the ; destination address in memory for the disk read. ES is 0 by default, so we ; don't need to set it explicitly. mov dh, 2 ; Argument to disk_load function = number of sectors to read. mov dl, [BOOT_DRIVE] ; Argument to disk_load function = disk drive number. call disk_load ; Our function: Read from a disk into memory! This function will ; print a message and hang if an error occurs. ; Test if memory contains what we expect, viz. 0xdada and 0xface. mov dx, [0x9000] ; print_hex function expects its argument to be in DX. call print_hex mov dx, [0x9000 + 512] call print_hex jmp $ ; Infinite loop. ; Include helper functions. %include "print_string.asm" %include "print_hex.asm" %include "disk_load.asm" ; Global variables BOOT_DRIVE: db 0 ; Stores the boot disk device number that the BIOS gave us in ; DL. ; 0 padding and BIOS magic number. times 510-($-$$) db 0 dw 0xaa55 ; Add a 2 additional sectors in addition to our boot sector above so we can use ; them to verify that our disk read worked as expected. times 256 dw 0xdada times 256 dw 0xface
grep.asm
akhilsinghal1234/xv6-OS
1
86887
_grep: file format elf32-i386 Disassembly of section .text: 00000000 <grep>: char buf[1024]; int match(char*, char*); void grep(char *pattern, int fd) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 18 sub $0x18,%esp int n, m; char *p, *q; m = 0; 6: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ d: e9 b6 00 00 00 jmp c8 <grep+0xc8> m += n; 12: 8b 45 ec mov -0x14(%ebp),%eax 15: 01 45 f4 add %eax,-0xc(%ebp) buf[m] = '\0'; 18: 8b 45 f4 mov -0xc(%ebp),%eax 1b: 05 20 0e 00 00 add $0xe20,%eax 20: c6 00 00 movb $0x0,(%eax) p = buf; 23: c7 45 f0 20 0e 00 00 movl $0xe20,-0x10(%ebp) while((q = strchr(p, '\n')) != 0){ 2a: eb 4a jmp 76 <grep+0x76> *q = 0; 2c: 8b 45 e8 mov -0x18(%ebp),%eax 2f: c6 00 00 movb $0x0,(%eax) if(match(pattern, p)){ 32: 83 ec 08 sub $0x8,%esp 35: ff 75 f0 pushl -0x10(%ebp) 38: ff 75 08 pushl 0x8(%ebp) 3b: e8 9a 01 00 00 call 1da <match> 40: 83 c4 10 add $0x10,%esp 43: 85 c0 test %eax,%eax 45: 74 26 je 6d <grep+0x6d> *q = '\n'; 47: 8b 45 e8 mov -0x18(%ebp),%eax 4a: c6 00 0a movb $0xa,(%eax) write(1, p, q+1 - p); 4d: 8b 45 e8 mov -0x18(%ebp),%eax 50: 83 c0 01 add $0x1,%eax 53: 89 c2 mov %eax,%edx 55: 8b 45 f0 mov -0x10(%ebp),%eax 58: 29 c2 sub %eax,%edx 5a: 89 d0 mov %edx,%eax 5c: 83 ec 04 sub $0x4,%esp 5f: 50 push %eax 60: ff 75 f0 pushl -0x10(%ebp) 63: 6a 01 push $0x1 65: e8 43 05 00 00 call 5ad <write> 6a: 83 c4 10 add $0x10,%esp } p = q+1; 6d: 8b 45 e8 mov -0x18(%ebp),%eax 70: 83 c0 01 add $0x1,%eax 73: 89 45 f0 mov %eax,-0x10(%ebp) m = 0; while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ m += n; buf[m] = '\0'; p = buf; while((q = strchr(p, '\n')) != 0){ 76: 83 ec 08 sub $0x8,%esp 79: 6a 0a push $0xa 7b: ff 75 f0 pushl -0x10(%ebp) 7e: e8 89 03 00 00 call 40c <strchr> 83: 83 c4 10 add $0x10,%esp 86: 89 45 e8 mov %eax,-0x18(%ebp) 89: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 8d: 75 9d jne 2c <grep+0x2c> *q = '\n'; write(1, p, q+1 - p); } p = q+1; } if(p == buf) 8f: 81 7d f0 20 0e 00 00 cmpl $0xe20,-0x10(%ebp) 96: 75 07 jne 9f <grep+0x9f> m = 0; 98: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if(m > 0){ 9f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) a3: 7e 23 jle c8 <grep+0xc8> m -= p - buf; a5: 8b 45 f0 mov -0x10(%ebp),%eax a8: ba 20 0e 00 00 mov $0xe20,%edx ad: 29 d0 sub %edx,%eax af: 29 45 f4 sub %eax,-0xc(%ebp) memmove(buf, p, m); b2: 83 ec 04 sub $0x4,%esp b5: ff 75 f4 pushl -0xc(%ebp) b8: ff 75 f0 pushl -0x10(%ebp) bb: 68 20 0e 00 00 push $0xe20 c0: e8 83 04 00 00 call 548 <memmove> c5: 83 c4 10 add $0x10,%esp { int n, m; char *p, *q; m = 0; while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ c8: 8b 45 f4 mov -0xc(%ebp),%eax cb: ba ff 03 00 00 mov $0x3ff,%edx d0: 29 c2 sub %eax,%edx d2: 89 d0 mov %edx,%eax d4: 89 c2 mov %eax,%edx d6: 8b 45 f4 mov -0xc(%ebp),%eax d9: 05 20 0e 00 00 add $0xe20,%eax de: 83 ec 04 sub $0x4,%esp e1: 52 push %edx e2: 50 push %eax e3: ff 75 0c pushl 0xc(%ebp) e6: e8 ba 04 00 00 call 5a5 <read> eb: 83 c4 10 add $0x10,%esp ee: 89 45 ec mov %eax,-0x14(%ebp) f1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) f5: 0f 8f 17 ff ff ff jg 12 <grep+0x12> if(m > 0){ m -= p - buf; memmove(buf, p, m); } } } fb: 90 nop fc: c9 leave fd: c3 ret 000000fe <main>: int main(int argc, char *argv[]) { fe: 8d 4c 24 04 lea 0x4(%esp),%ecx 102: 83 e4 f0 and $0xfffffff0,%esp 105: ff 71 fc pushl -0x4(%ecx) 108: 55 push %ebp 109: 89 e5 mov %esp,%ebp 10b: 53 push %ebx 10c: 51 push %ecx 10d: 83 ec 10 sub $0x10,%esp 110: 89 cb mov %ecx,%ebx int fd, i; char *pattern; if(argc <= 1){ 112: 83 3b 01 cmpl $0x1,(%ebx) 115: 7f 17 jg 12e <main+0x30> printf(2, "usage: grep pattern [file ...]\n"); 117: 83 ec 08 sub $0x8,%esp 11a: 68 dc 0a 00 00 push $0xadc 11f: 6a 02 push $0x2 121: e8 fe 05 00 00 call 724 <printf> 126: 83 c4 10 add $0x10,%esp exit(); 129: e8 5f 04 00 00 call 58d <exit> } pattern = argv[1]; 12e: 8b 43 04 mov 0x4(%ebx),%eax 131: 8b 40 04 mov 0x4(%eax),%eax 134: 89 45 f0 mov %eax,-0x10(%ebp) if(argc <= 2){ 137: 83 3b 02 cmpl $0x2,(%ebx) 13a: 7f 15 jg 151 <main+0x53> grep(pattern, 0); 13c: 83 ec 08 sub $0x8,%esp 13f: 6a 00 push $0x0 141: ff 75 f0 pushl -0x10(%ebp) 144: e8 b7 fe ff ff call 0 <grep> 149: 83 c4 10 add $0x10,%esp exit(); 14c: e8 3c 04 00 00 call 58d <exit> } for(i = 2; i < argc; i++){ 151: c7 45 f4 02 00 00 00 movl $0x2,-0xc(%ebp) 158: eb 74 jmp 1ce <main+0xd0> if((fd = open(argv[i], 0)) < 0){ 15a: 8b 45 f4 mov -0xc(%ebp),%eax 15d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 164: 8b 43 04 mov 0x4(%ebx),%eax 167: 01 d0 add %edx,%eax 169: 8b 00 mov (%eax),%eax 16b: 83 ec 08 sub $0x8,%esp 16e: 6a 00 push $0x0 170: 50 push %eax 171: e8 57 04 00 00 call 5cd <open> 176: 83 c4 10 add $0x10,%esp 179: 89 45 ec mov %eax,-0x14(%ebp) 17c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 180: 79 29 jns 1ab <main+0xad> printf(1, "grep: cannot open %s\n", argv[i]); 182: 8b 45 f4 mov -0xc(%ebp),%eax 185: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 18c: 8b 43 04 mov 0x4(%ebx),%eax 18f: 01 d0 add %edx,%eax 191: 8b 00 mov (%eax),%eax 193: 83 ec 04 sub $0x4,%esp 196: 50 push %eax 197: 68 fc 0a 00 00 push $0xafc 19c: 6a 01 push $0x1 19e: e8 81 05 00 00 call 724 <printf> 1a3: 83 c4 10 add $0x10,%esp exit(); 1a6: e8 e2 03 00 00 call 58d <exit> } grep(pattern, fd); 1ab: 83 ec 08 sub $0x8,%esp 1ae: ff 75 ec pushl -0x14(%ebp) 1b1: ff 75 f0 pushl -0x10(%ebp) 1b4: e8 47 fe ff ff call 0 <grep> 1b9: 83 c4 10 add $0x10,%esp close(fd); 1bc: 83 ec 0c sub $0xc,%esp 1bf: ff 75 ec pushl -0x14(%ebp) 1c2: e8 ee 03 00 00 call 5b5 <close> 1c7: 83 c4 10 add $0x10,%esp if(argc <= 2){ grep(pattern, 0); exit(); } for(i = 2; i < argc; i++){ 1ca: 83 45 f4 01 addl $0x1,-0xc(%ebp) 1ce: 8b 45 f4 mov -0xc(%ebp),%eax 1d1: 3b 03 cmp (%ebx),%eax 1d3: 7c 85 jl 15a <main+0x5c> exit(); } grep(pattern, fd); close(fd); } exit(); 1d5: e8 b3 03 00 00 call 58d <exit> 000001da <match>: int matchhere(char*, char*); int matchstar(int, char*, char*); int match(char *re, char *text) { 1da: 55 push %ebp 1db: 89 e5 mov %esp,%ebp 1dd: 83 ec 08 sub $0x8,%esp if(re[0] == '^') 1e0: 8b 45 08 mov 0x8(%ebp),%eax 1e3: 0f b6 00 movzbl (%eax),%eax 1e6: 3c 5e cmp $0x5e,%al 1e8: 75 17 jne 201 <match+0x27> return matchhere(re+1, text); 1ea: 8b 45 08 mov 0x8(%ebp),%eax 1ed: 83 c0 01 add $0x1,%eax 1f0: 83 ec 08 sub $0x8,%esp 1f3: ff 75 0c pushl 0xc(%ebp) 1f6: 50 push %eax 1f7: e8 38 00 00 00 call 234 <matchhere> 1fc: 83 c4 10 add $0x10,%esp 1ff: eb 31 jmp 232 <match+0x58> do{ // must look at empty string if(matchhere(re, text)) 201: 83 ec 08 sub $0x8,%esp 204: ff 75 0c pushl 0xc(%ebp) 207: ff 75 08 pushl 0x8(%ebp) 20a: e8 25 00 00 00 call 234 <matchhere> 20f: 83 c4 10 add $0x10,%esp 212: 85 c0 test %eax,%eax 214: 74 07 je 21d <match+0x43> return 1; 216: b8 01 00 00 00 mov $0x1,%eax 21b: eb 15 jmp 232 <match+0x58> }while(*text++ != '\0'); 21d: 8b 45 0c mov 0xc(%ebp),%eax 220: 8d 50 01 lea 0x1(%eax),%edx 223: 89 55 0c mov %edx,0xc(%ebp) 226: 0f b6 00 movzbl (%eax),%eax 229: 84 c0 test %al,%al 22b: 75 d4 jne 201 <match+0x27> return 0; 22d: b8 00 00 00 00 mov $0x0,%eax } 232: c9 leave 233: c3 ret 00000234 <matchhere>: // matchhere: search for re at beginning of text int matchhere(char *re, char *text) { 234: 55 push %ebp 235: 89 e5 mov %esp,%ebp 237: 83 ec 08 sub $0x8,%esp if(re[0] == '\0') 23a: 8b 45 08 mov 0x8(%ebp),%eax 23d: 0f b6 00 movzbl (%eax),%eax 240: 84 c0 test %al,%al 242: 75 0a jne 24e <matchhere+0x1a> return 1; 244: b8 01 00 00 00 mov $0x1,%eax 249: e9 99 00 00 00 jmp 2e7 <matchhere+0xb3> if(re[1] == '*') 24e: 8b 45 08 mov 0x8(%ebp),%eax 251: 83 c0 01 add $0x1,%eax 254: 0f b6 00 movzbl (%eax),%eax 257: 3c 2a cmp $0x2a,%al 259: 75 21 jne 27c <matchhere+0x48> return matchstar(re[0], re+2, text); 25b: 8b 45 08 mov 0x8(%ebp),%eax 25e: 8d 50 02 lea 0x2(%eax),%edx 261: 8b 45 08 mov 0x8(%ebp),%eax 264: 0f b6 00 movzbl (%eax),%eax 267: 0f be c0 movsbl %al,%eax 26a: 83 ec 04 sub $0x4,%esp 26d: ff 75 0c pushl 0xc(%ebp) 270: 52 push %edx 271: 50 push %eax 272: e8 72 00 00 00 call 2e9 <matchstar> 277: 83 c4 10 add $0x10,%esp 27a: eb 6b jmp 2e7 <matchhere+0xb3> if(re[0] == '$' && re[1] == '\0') 27c: 8b 45 08 mov 0x8(%ebp),%eax 27f: 0f b6 00 movzbl (%eax),%eax 282: 3c 24 cmp $0x24,%al 284: 75 1d jne 2a3 <matchhere+0x6f> 286: 8b 45 08 mov 0x8(%ebp),%eax 289: 83 c0 01 add $0x1,%eax 28c: 0f b6 00 movzbl (%eax),%eax 28f: 84 c0 test %al,%al 291: 75 10 jne 2a3 <matchhere+0x6f> return *text == '\0'; 293: 8b 45 0c mov 0xc(%ebp),%eax 296: 0f b6 00 movzbl (%eax),%eax 299: 84 c0 test %al,%al 29b: 0f 94 c0 sete %al 29e: 0f b6 c0 movzbl %al,%eax 2a1: eb 44 jmp 2e7 <matchhere+0xb3> if(*text!='\0' && (re[0]=='.' || re[0]==*text)) 2a3: 8b 45 0c mov 0xc(%ebp),%eax 2a6: 0f b6 00 movzbl (%eax),%eax 2a9: 84 c0 test %al,%al 2ab: 74 35 je 2e2 <matchhere+0xae> 2ad: 8b 45 08 mov 0x8(%ebp),%eax 2b0: 0f b6 00 movzbl (%eax),%eax 2b3: 3c 2e cmp $0x2e,%al 2b5: 74 10 je 2c7 <matchhere+0x93> 2b7: 8b 45 08 mov 0x8(%ebp),%eax 2ba: 0f b6 10 movzbl (%eax),%edx 2bd: 8b 45 0c mov 0xc(%ebp),%eax 2c0: 0f b6 00 movzbl (%eax),%eax 2c3: 38 c2 cmp %al,%dl 2c5: 75 1b jne 2e2 <matchhere+0xae> return matchhere(re+1, text+1); 2c7: 8b 45 0c mov 0xc(%ebp),%eax 2ca: 8d 50 01 lea 0x1(%eax),%edx 2cd: 8b 45 08 mov 0x8(%ebp),%eax 2d0: 83 c0 01 add $0x1,%eax 2d3: 83 ec 08 sub $0x8,%esp 2d6: 52 push %edx 2d7: 50 push %eax 2d8: e8 57 ff ff ff call 234 <matchhere> 2dd: 83 c4 10 add $0x10,%esp 2e0: eb 05 jmp 2e7 <matchhere+0xb3> return 0; 2e2: b8 00 00 00 00 mov $0x0,%eax } 2e7: c9 leave 2e8: c3 ret 000002e9 <matchstar>: // matchstar: search for c*re at beginning of text int matchstar(int c, char *re, char *text) { 2e9: 55 push %ebp 2ea: 89 e5 mov %esp,%ebp 2ec: 83 ec 08 sub $0x8,%esp do{ // a * matches zero or more instances if(matchhere(re, text)) 2ef: 83 ec 08 sub $0x8,%esp 2f2: ff 75 10 pushl 0x10(%ebp) 2f5: ff 75 0c pushl 0xc(%ebp) 2f8: e8 37 ff ff ff call 234 <matchhere> 2fd: 83 c4 10 add $0x10,%esp 300: 85 c0 test %eax,%eax 302: 74 07 je 30b <matchstar+0x22> return 1; 304: b8 01 00 00 00 mov $0x1,%eax 309: eb 29 jmp 334 <matchstar+0x4b> }while(*text!='\0' && (*text++==c || c=='.')); 30b: 8b 45 10 mov 0x10(%ebp),%eax 30e: 0f b6 00 movzbl (%eax),%eax 311: 84 c0 test %al,%al 313: 74 1a je 32f <matchstar+0x46> 315: 8b 45 10 mov 0x10(%ebp),%eax 318: 8d 50 01 lea 0x1(%eax),%edx 31b: 89 55 10 mov %edx,0x10(%ebp) 31e: 0f b6 00 movzbl (%eax),%eax 321: 0f be c0 movsbl %al,%eax 324: 3b 45 08 cmp 0x8(%ebp),%eax 327: 74 c6 je 2ef <matchstar+0x6> 329: 83 7d 08 2e cmpl $0x2e,0x8(%ebp) 32d: 74 c0 je 2ef <matchstar+0x6> return 0; 32f: b8 00 00 00 00 mov $0x0,%eax } 334: c9 leave 335: c3 ret 00000336 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 336: 55 push %ebp 337: 89 e5 mov %esp,%ebp 339: 57 push %edi 33a: 53 push %ebx asm volatile("cld; rep stosb" : 33b: 8b 4d 08 mov 0x8(%ebp),%ecx 33e: 8b 55 10 mov 0x10(%ebp),%edx 341: 8b 45 0c mov 0xc(%ebp),%eax 344: 89 cb mov %ecx,%ebx 346: 89 df mov %ebx,%edi 348: 89 d1 mov %edx,%ecx 34a: fc cld 34b: f3 aa rep stos %al,%es:(%edi) 34d: 89 ca mov %ecx,%edx 34f: 89 fb mov %edi,%ebx 351: 89 5d 08 mov %ebx,0x8(%ebp) 354: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 357: 90 nop 358: 5b pop %ebx 359: 5f pop %edi 35a: 5d pop %ebp 35b: c3 ret 0000035c <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 35c: 55 push %ebp 35d: 89 e5 mov %esp,%ebp 35f: 83 ec 10 sub $0x10,%esp char *os; os = s; 362: 8b 45 08 mov 0x8(%ebp),%eax 365: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 368: 90 nop 369: 8b 45 08 mov 0x8(%ebp),%eax 36c: 8d 50 01 lea 0x1(%eax),%edx 36f: 89 55 08 mov %edx,0x8(%ebp) 372: 8b 55 0c mov 0xc(%ebp),%edx 375: 8d 4a 01 lea 0x1(%edx),%ecx 378: 89 4d 0c mov %ecx,0xc(%ebp) 37b: 0f b6 12 movzbl (%edx),%edx 37e: 88 10 mov %dl,(%eax) 380: 0f b6 00 movzbl (%eax),%eax 383: 84 c0 test %al,%al 385: 75 e2 jne 369 <strcpy+0xd> ; return os; 387: 8b 45 fc mov -0x4(%ebp),%eax } 38a: c9 leave 38b: c3 ret 0000038c <strcmp>: int strcmp(const char *p, const char *q) { 38c: 55 push %ebp 38d: 89 e5 mov %esp,%ebp while(*p && *p == *q) 38f: eb 08 jmp 399 <strcmp+0xd> p++, q++; 391: 83 45 08 01 addl $0x1,0x8(%ebp) 395: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 399: 8b 45 08 mov 0x8(%ebp),%eax 39c: 0f b6 00 movzbl (%eax),%eax 39f: 84 c0 test %al,%al 3a1: 74 10 je 3b3 <strcmp+0x27> 3a3: 8b 45 08 mov 0x8(%ebp),%eax 3a6: 0f b6 10 movzbl (%eax),%edx 3a9: 8b 45 0c mov 0xc(%ebp),%eax 3ac: 0f b6 00 movzbl (%eax),%eax 3af: 38 c2 cmp %al,%dl 3b1: 74 de je 391 <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 3b3: 8b 45 08 mov 0x8(%ebp),%eax 3b6: 0f b6 00 movzbl (%eax),%eax 3b9: 0f b6 d0 movzbl %al,%edx 3bc: 8b 45 0c mov 0xc(%ebp),%eax 3bf: 0f b6 00 movzbl (%eax),%eax 3c2: 0f b6 c0 movzbl %al,%eax 3c5: 29 c2 sub %eax,%edx 3c7: 89 d0 mov %edx,%eax } 3c9: 5d pop %ebp 3ca: c3 ret 000003cb <strlen>: uint strlen(char *s) { 3cb: 55 push %ebp 3cc: 89 e5 mov %esp,%ebp 3ce: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 3d1: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 3d8: eb 04 jmp 3de <strlen+0x13> 3da: 83 45 fc 01 addl $0x1,-0x4(%ebp) 3de: 8b 55 fc mov -0x4(%ebp),%edx 3e1: 8b 45 08 mov 0x8(%ebp),%eax 3e4: 01 d0 add %edx,%eax 3e6: 0f b6 00 movzbl (%eax),%eax 3e9: 84 c0 test %al,%al 3eb: 75 ed jne 3da <strlen+0xf> ; return n; 3ed: 8b 45 fc mov -0x4(%ebp),%eax } 3f0: c9 leave 3f1: c3 ret 000003f2 <memset>: void* memset(void *dst, int c, uint n) { 3f2: 55 push %ebp 3f3: 89 e5 mov %esp,%ebp stosb(dst, c, n); 3f5: 8b 45 10 mov 0x10(%ebp),%eax 3f8: 50 push %eax 3f9: ff 75 0c pushl 0xc(%ebp) 3fc: ff 75 08 pushl 0x8(%ebp) 3ff: e8 32 ff ff ff call 336 <stosb> 404: 83 c4 0c add $0xc,%esp return dst; 407: 8b 45 08 mov 0x8(%ebp),%eax } 40a: c9 leave 40b: c3 ret 0000040c <strchr>: char* strchr(const char *s, char c) { 40c: 55 push %ebp 40d: 89 e5 mov %esp,%ebp 40f: 83 ec 04 sub $0x4,%esp 412: 8b 45 0c mov 0xc(%ebp),%eax 415: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 418: eb 14 jmp 42e <strchr+0x22> if(*s == c) 41a: 8b 45 08 mov 0x8(%ebp),%eax 41d: 0f b6 00 movzbl (%eax),%eax 420: 3a 45 fc cmp -0x4(%ebp),%al 423: 75 05 jne 42a <strchr+0x1e> return (char*)s; 425: 8b 45 08 mov 0x8(%ebp),%eax 428: eb 13 jmp 43d <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 42a: 83 45 08 01 addl $0x1,0x8(%ebp) 42e: 8b 45 08 mov 0x8(%ebp),%eax 431: 0f b6 00 movzbl (%eax),%eax 434: 84 c0 test %al,%al 436: 75 e2 jne 41a <strchr+0xe> if(*s == c) return (char*)s; return 0; 438: b8 00 00 00 00 mov $0x0,%eax } 43d: c9 leave 43e: c3 ret 0000043f <gets>: char* gets(char *buf, int max) { 43f: 55 push %ebp 440: 89 e5 mov %esp,%ebp 442: 83 ec 18 sub $0x18,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 445: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 44c: eb 42 jmp 490 <gets+0x51> cc = read(0, &c, 1); 44e: 83 ec 04 sub $0x4,%esp 451: 6a 01 push $0x1 453: 8d 45 ef lea -0x11(%ebp),%eax 456: 50 push %eax 457: 6a 00 push $0x0 459: e8 47 01 00 00 call 5a5 <read> 45e: 83 c4 10 add $0x10,%esp 461: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 464: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 468: 7e 33 jle 49d <gets+0x5e> break; buf[i++] = c; 46a: 8b 45 f4 mov -0xc(%ebp),%eax 46d: 8d 50 01 lea 0x1(%eax),%edx 470: 89 55 f4 mov %edx,-0xc(%ebp) 473: 89 c2 mov %eax,%edx 475: 8b 45 08 mov 0x8(%ebp),%eax 478: 01 c2 add %eax,%edx 47a: 0f b6 45 ef movzbl -0x11(%ebp),%eax 47e: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 480: 0f b6 45 ef movzbl -0x11(%ebp),%eax 484: 3c 0a cmp $0xa,%al 486: 74 16 je 49e <gets+0x5f> 488: 0f b6 45 ef movzbl -0x11(%ebp),%eax 48c: 3c 0d cmp $0xd,%al 48e: 74 0e je 49e <gets+0x5f> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 490: 8b 45 f4 mov -0xc(%ebp),%eax 493: 83 c0 01 add $0x1,%eax 496: 3b 45 0c cmp 0xc(%ebp),%eax 499: 7c b3 jl 44e <gets+0xf> 49b: eb 01 jmp 49e <gets+0x5f> cc = read(0, &c, 1); if(cc < 1) break; 49d: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 49e: 8b 55 f4 mov -0xc(%ebp),%edx 4a1: 8b 45 08 mov 0x8(%ebp),%eax 4a4: 01 d0 add %edx,%eax 4a6: c6 00 00 movb $0x0,(%eax) return buf; 4a9: 8b 45 08 mov 0x8(%ebp),%eax } 4ac: c9 leave 4ad: c3 ret 000004ae <stat>: int stat(char *n, struct stat *st) { 4ae: 55 push %ebp 4af: 89 e5 mov %esp,%ebp 4b1: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 4b4: 83 ec 08 sub $0x8,%esp 4b7: 6a 00 push $0x0 4b9: ff 75 08 pushl 0x8(%ebp) 4bc: e8 0c 01 00 00 call 5cd <open> 4c1: 83 c4 10 add $0x10,%esp 4c4: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 4c7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 4cb: 79 07 jns 4d4 <stat+0x26> return -1; 4cd: b8 ff ff ff ff mov $0xffffffff,%eax 4d2: eb 25 jmp 4f9 <stat+0x4b> r = fstat(fd, st); 4d4: 83 ec 08 sub $0x8,%esp 4d7: ff 75 0c pushl 0xc(%ebp) 4da: ff 75 f4 pushl -0xc(%ebp) 4dd: e8 03 01 00 00 call 5e5 <fstat> 4e2: 83 c4 10 add $0x10,%esp 4e5: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 4e8: 83 ec 0c sub $0xc,%esp 4eb: ff 75 f4 pushl -0xc(%ebp) 4ee: e8 c2 00 00 00 call 5b5 <close> 4f3: 83 c4 10 add $0x10,%esp return r; 4f6: 8b 45 f0 mov -0x10(%ebp),%eax } 4f9: c9 leave 4fa: c3 ret 000004fb <atoi>: int atoi(const char *s) { 4fb: 55 push %ebp 4fc: 89 e5 mov %esp,%ebp 4fe: 83 ec 10 sub $0x10,%esp int n; n = 0; 501: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 508: eb 25 jmp 52f <atoi+0x34> n = n*10 + *s++ - '0'; 50a: 8b 55 fc mov -0x4(%ebp),%edx 50d: 89 d0 mov %edx,%eax 50f: c1 e0 02 shl $0x2,%eax 512: 01 d0 add %edx,%eax 514: 01 c0 add %eax,%eax 516: 89 c1 mov %eax,%ecx 518: 8b 45 08 mov 0x8(%ebp),%eax 51b: 8d 50 01 lea 0x1(%eax),%edx 51e: 89 55 08 mov %edx,0x8(%ebp) 521: 0f b6 00 movzbl (%eax),%eax 524: 0f be c0 movsbl %al,%eax 527: 01 c8 add %ecx,%eax 529: 83 e8 30 sub $0x30,%eax 52c: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 52f: 8b 45 08 mov 0x8(%ebp),%eax 532: 0f b6 00 movzbl (%eax),%eax 535: 3c 2f cmp $0x2f,%al 537: 7e 0a jle 543 <atoi+0x48> 539: 8b 45 08 mov 0x8(%ebp),%eax 53c: 0f b6 00 movzbl (%eax),%eax 53f: 3c 39 cmp $0x39,%al 541: 7e c7 jle 50a <atoi+0xf> n = n*10 + *s++ - '0'; return n; 543: 8b 45 fc mov -0x4(%ebp),%eax } 546: c9 leave 547: c3 ret 00000548 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 548: 55 push %ebp 549: 89 e5 mov %esp,%ebp 54b: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 54e: 8b 45 08 mov 0x8(%ebp),%eax 551: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 554: 8b 45 0c mov 0xc(%ebp),%eax 557: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 55a: eb 17 jmp 573 <memmove+0x2b> *dst++ = *src++; 55c: 8b 45 fc mov -0x4(%ebp),%eax 55f: 8d 50 01 lea 0x1(%eax),%edx 562: 89 55 fc mov %edx,-0x4(%ebp) 565: 8b 55 f8 mov -0x8(%ebp),%edx 568: 8d 4a 01 lea 0x1(%edx),%ecx 56b: 89 4d f8 mov %ecx,-0x8(%ebp) 56e: 0f b6 12 movzbl (%edx),%edx 571: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 573: 8b 45 10 mov 0x10(%ebp),%eax 576: 8d 50 ff lea -0x1(%eax),%edx 579: 89 55 10 mov %edx,0x10(%ebp) 57c: 85 c0 test %eax,%eax 57e: 7f dc jg 55c <memmove+0x14> *dst++ = *src++; return vdst; 580: 8b 45 08 mov 0x8(%ebp),%eax } 583: c9 leave 584: c3 ret 00000585 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 585: b8 01 00 00 00 mov $0x1,%eax 58a: cd 40 int $0x40 58c: c3 ret 0000058d <exit>: SYSCALL(exit) 58d: b8 02 00 00 00 mov $0x2,%eax 592: cd 40 int $0x40 594: c3 ret 00000595 <wait>: SYSCALL(wait) 595: b8 03 00 00 00 mov $0x3,%eax 59a: cd 40 int $0x40 59c: c3 ret 0000059d <pipe>: SYSCALL(pipe) 59d: b8 04 00 00 00 mov $0x4,%eax 5a2: cd 40 int $0x40 5a4: c3 ret 000005a5 <read>: SYSCALL(read) 5a5: b8 05 00 00 00 mov $0x5,%eax 5aa: cd 40 int $0x40 5ac: c3 ret 000005ad <write>: SYSCALL(write) 5ad: b8 10 00 00 00 mov $0x10,%eax 5b2: cd 40 int $0x40 5b4: c3 ret 000005b5 <close>: SYSCALL(close) 5b5: b8 15 00 00 00 mov $0x15,%eax 5ba: cd 40 int $0x40 5bc: c3 ret 000005bd <kill>: SYSCALL(kill) 5bd: b8 06 00 00 00 mov $0x6,%eax 5c2: cd 40 int $0x40 5c4: c3 ret 000005c5 <exec>: SYSCALL(exec) 5c5: b8 07 00 00 00 mov $0x7,%eax 5ca: cd 40 int $0x40 5cc: c3 ret 000005cd <open>: SYSCALL(open) 5cd: b8 0f 00 00 00 mov $0xf,%eax 5d2: cd 40 int $0x40 5d4: c3 ret 000005d5 <mknod>: SYSCALL(mknod) 5d5: b8 11 00 00 00 mov $0x11,%eax 5da: cd 40 int $0x40 5dc: c3 ret 000005dd <unlink>: SYSCALL(unlink) 5dd: b8 12 00 00 00 mov $0x12,%eax 5e2: cd 40 int $0x40 5e4: c3 ret 000005e5 <fstat>: SYSCALL(fstat) 5e5: b8 08 00 00 00 mov $0x8,%eax 5ea: cd 40 int $0x40 5ec: c3 ret 000005ed <link>: SYSCALL(link) 5ed: b8 13 00 00 00 mov $0x13,%eax 5f2: cd 40 int $0x40 5f4: c3 ret 000005f5 <mkdir>: SYSCALL(mkdir) 5f5: b8 14 00 00 00 mov $0x14,%eax 5fa: cd 40 int $0x40 5fc: c3 ret 000005fd <chdir>: SYSCALL(chdir) 5fd: b8 09 00 00 00 mov $0x9,%eax 602: cd 40 int $0x40 604: c3 ret 00000605 <dup>: SYSCALL(dup) 605: b8 0a 00 00 00 mov $0xa,%eax 60a: cd 40 int $0x40 60c: c3 ret 0000060d <getpid>: SYSCALL(getpid) 60d: b8 0b 00 00 00 mov $0xb,%eax 612: cd 40 int $0x40 614: c3 ret 00000615 <getppid>: SYSCALL(getppid) 615: b8 18 00 00 00 mov $0x18,%eax 61a: cd 40 int $0x40 61c: c3 ret 0000061d <getsyscallinfo>: SYSCALL(getsyscallinfo) 61d: b8 19 00 00 00 mov $0x19,%eax 622: cd 40 int $0x40 624: c3 ret 00000625 <getAllPids>: SYSCALL(getAllPids) 625: b8 16 00 00 00 mov $0x16,%eax 62a: cd 40 int $0x40 62c: c3 ret 0000062d <shutdown>: SYSCALL(shutdown) 62d: b8 17 00 00 00 mov $0x17,%eax 632: cd 40 int $0x40 634: c3 ret 00000635 <sbrk>: SYSCALL(sbrk) 635: b8 0c 00 00 00 mov $0xc,%eax 63a: cd 40 int $0x40 63c: c3 ret 0000063d <sleep>: SYSCALL(sleep) 63d: b8 0d 00 00 00 mov $0xd,%eax 642: cd 40 int $0x40 644: c3 ret 00000645 <uptime>: SYSCALL(uptime) 645: b8 0e 00 00 00 mov $0xe,%eax 64a: cd 40 int $0x40 64c: c3 ret 0000064d <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 64d: 55 push %ebp 64e: 89 e5 mov %esp,%ebp 650: 83 ec 18 sub $0x18,%esp 653: 8b 45 0c mov 0xc(%ebp),%eax 656: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 659: 83 ec 04 sub $0x4,%esp 65c: 6a 01 push $0x1 65e: 8d 45 f4 lea -0xc(%ebp),%eax 661: 50 push %eax 662: ff 75 08 pushl 0x8(%ebp) 665: e8 43 ff ff ff call 5ad <write> 66a: 83 c4 10 add $0x10,%esp } 66d: 90 nop 66e: c9 leave 66f: c3 ret 00000670 <printint>: static void printint(int fd, int xx, int base, int sgn) { 670: 55 push %ebp 671: 89 e5 mov %esp,%ebp 673: 53 push %ebx 674: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 677: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 67e: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 682: 74 17 je 69b <printint+0x2b> 684: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 688: 79 11 jns 69b <printint+0x2b> neg = 1; 68a: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 691: 8b 45 0c mov 0xc(%ebp),%eax 694: f7 d8 neg %eax 696: 89 45 ec mov %eax,-0x14(%ebp) 699: eb 06 jmp 6a1 <printint+0x31> } else { x = xx; 69b: 8b 45 0c mov 0xc(%ebp),%eax 69e: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 6a1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 6a8: 8b 4d f4 mov -0xc(%ebp),%ecx 6ab: 8d 41 01 lea 0x1(%ecx),%eax 6ae: 89 45 f4 mov %eax,-0xc(%ebp) 6b1: 8b 5d 10 mov 0x10(%ebp),%ebx 6b4: 8b 45 ec mov -0x14(%ebp),%eax 6b7: ba 00 00 00 00 mov $0x0,%edx 6bc: f7 f3 div %ebx 6be: 89 d0 mov %edx,%eax 6c0: 0f b6 80 e8 0d 00 00 movzbl 0xde8(%eax),%eax 6c7: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 6cb: 8b 5d 10 mov 0x10(%ebp),%ebx 6ce: 8b 45 ec mov -0x14(%ebp),%eax 6d1: ba 00 00 00 00 mov $0x0,%edx 6d6: f7 f3 div %ebx 6d8: 89 45 ec mov %eax,-0x14(%ebp) 6db: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 6df: 75 c7 jne 6a8 <printint+0x38> if(neg) 6e1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 6e5: 74 2d je 714 <printint+0xa4> buf[i++] = '-'; 6e7: 8b 45 f4 mov -0xc(%ebp),%eax 6ea: 8d 50 01 lea 0x1(%eax),%edx 6ed: 89 55 f4 mov %edx,-0xc(%ebp) 6f0: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 6f5: eb 1d jmp 714 <printint+0xa4> putc(fd, buf[i]); 6f7: 8d 55 dc lea -0x24(%ebp),%edx 6fa: 8b 45 f4 mov -0xc(%ebp),%eax 6fd: 01 d0 add %edx,%eax 6ff: 0f b6 00 movzbl (%eax),%eax 702: 0f be c0 movsbl %al,%eax 705: 83 ec 08 sub $0x8,%esp 708: 50 push %eax 709: ff 75 08 pushl 0x8(%ebp) 70c: e8 3c ff ff ff call 64d <putc> 711: 83 c4 10 add $0x10,%esp buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 714: 83 6d f4 01 subl $0x1,-0xc(%ebp) 718: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 71c: 79 d9 jns 6f7 <printint+0x87> putc(fd, buf[i]); } 71e: 90 nop 71f: 8b 5d fc mov -0x4(%ebp),%ebx 722: c9 leave 723: c3 ret 00000724 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 724: 55 push %ebp 725: 89 e5 mov %esp,%ebp 727: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 72a: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 731: 8d 45 0c lea 0xc(%ebp),%eax 734: 83 c0 04 add $0x4,%eax 737: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 73a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 741: e9 59 01 00 00 jmp 89f <printf+0x17b> c = fmt[i] & 0xff; 746: 8b 55 0c mov 0xc(%ebp),%edx 749: 8b 45 f0 mov -0x10(%ebp),%eax 74c: 01 d0 add %edx,%eax 74e: 0f b6 00 movzbl (%eax),%eax 751: 0f be c0 movsbl %al,%eax 754: 25 ff 00 00 00 and $0xff,%eax 759: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 75c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 760: 75 2c jne 78e <printf+0x6a> if(c == '%'){ 762: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 766: 75 0c jne 774 <printf+0x50> state = '%'; 768: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 76f: e9 27 01 00 00 jmp 89b <printf+0x177> } else { putc(fd, c); 774: 8b 45 e4 mov -0x1c(%ebp),%eax 777: 0f be c0 movsbl %al,%eax 77a: 83 ec 08 sub $0x8,%esp 77d: 50 push %eax 77e: ff 75 08 pushl 0x8(%ebp) 781: e8 c7 fe ff ff call 64d <putc> 786: 83 c4 10 add $0x10,%esp 789: e9 0d 01 00 00 jmp 89b <printf+0x177> } } else if(state == '%'){ 78e: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 792: 0f 85 03 01 00 00 jne 89b <printf+0x177> if(c == 'd'){ 798: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 79c: 75 1e jne 7bc <printf+0x98> printint(fd, *ap, 10, 1); 79e: 8b 45 e8 mov -0x18(%ebp),%eax 7a1: 8b 00 mov (%eax),%eax 7a3: 6a 01 push $0x1 7a5: 6a 0a push $0xa 7a7: 50 push %eax 7a8: ff 75 08 pushl 0x8(%ebp) 7ab: e8 c0 fe ff ff call 670 <printint> 7b0: 83 c4 10 add $0x10,%esp ap++; 7b3: 83 45 e8 04 addl $0x4,-0x18(%ebp) 7b7: e9 d8 00 00 00 jmp 894 <printf+0x170> } else if(c == 'x' || c == 'p'){ 7bc: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 7c0: 74 06 je 7c8 <printf+0xa4> 7c2: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 7c6: 75 1e jne 7e6 <printf+0xc2> printint(fd, *ap, 16, 0); 7c8: 8b 45 e8 mov -0x18(%ebp),%eax 7cb: 8b 00 mov (%eax),%eax 7cd: 6a 00 push $0x0 7cf: 6a 10 push $0x10 7d1: 50 push %eax 7d2: ff 75 08 pushl 0x8(%ebp) 7d5: e8 96 fe ff ff call 670 <printint> 7da: 83 c4 10 add $0x10,%esp ap++; 7dd: 83 45 e8 04 addl $0x4,-0x18(%ebp) 7e1: e9 ae 00 00 00 jmp 894 <printf+0x170> } else if(c == 's'){ 7e6: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 7ea: 75 43 jne 82f <printf+0x10b> s = (char*)*ap; 7ec: 8b 45 e8 mov -0x18(%ebp),%eax 7ef: 8b 00 mov (%eax),%eax 7f1: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 7f4: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 7f8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 7fc: 75 25 jne 823 <printf+0xff> s = "(null)"; 7fe: c7 45 f4 12 0b 00 00 movl $0xb12,-0xc(%ebp) while(*s != 0){ 805: eb 1c jmp 823 <printf+0xff> putc(fd, *s); 807: 8b 45 f4 mov -0xc(%ebp),%eax 80a: 0f b6 00 movzbl (%eax),%eax 80d: 0f be c0 movsbl %al,%eax 810: 83 ec 08 sub $0x8,%esp 813: 50 push %eax 814: ff 75 08 pushl 0x8(%ebp) 817: e8 31 fe ff ff call 64d <putc> 81c: 83 c4 10 add $0x10,%esp s++; 81f: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 823: 8b 45 f4 mov -0xc(%ebp),%eax 826: 0f b6 00 movzbl (%eax),%eax 829: 84 c0 test %al,%al 82b: 75 da jne 807 <printf+0xe3> 82d: eb 65 jmp 894 <printf+0x170> putc(fd, *s); s++; } } else if(c == 'c'){ 82f: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 833: 75 1d jne 852 <printf+0x12e> putc(fd, *ap); 835: 8b 45 e8 mov -0x18(%ebp),%eax 838: 8b 00 mov (%eax),%eax 83a: 0f be c0 movsbl %al,%eax 83d: 83 ec 08 sub $0x8,%esp 840: 50 push %eax 841: ff 75 08 pushl 0x8(%ebp) 844: e8 04 fe ff ff call 64d <putc> 849: 83 c4 10 add $0x10,%esp ap++; 84c: 83 45 e8 04 addl $0x4,-0x18(%ebp) 850: eb 42 jmp 894 <printf+0x170> } else if(c == '%'){ 852: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 856: 75 17 jne 86f <printf+0x14b> putc(fd, c); 858: 8b 45 e4 mov -0x1c(%ebp),%eax 85b: 0f be c0 movsbl %al,%eax 85e: 83 ec 08 sub $0x8,%esp 861: 50 push %eax 862: ff 75 08 pushl 0x8(%ebp) 865: e8 e3 fd ff ff call 64d <putc> 86a: 83 c4 10 add $0x10,%esp 86d: eb 25 jmp 894 <printf+0x170> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 86f: 83 ec 08 sub $0x8,%esp 872: 6a 25 push $0x25 874: ff 75 08 pushl 0x8(%ebp) 877: e8 d1 fd ff ff call 64d <putc> 87c: 83 c4 10 add $0x10,%esp putc(fd, c); 87f: 8b 45 e4 mov -0x1c(%ebp),%eax 882: 0f be c0 movsbl %al,%eax 885: 83 ec 08 sub $0x8,%esp 888: 50 push %eax 889: ff 75 08 pushl 0x8(%ebp) 88c: e8 bc fd ff ff call 64d <putc> 891: 83 c4 10 add $0x10,%esp } state = 0; 894: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 89b: 83 45 f0 01 addl $0x1,-0x10(%ebp) 89f: 8b 55 0c mov 0xc(%ebp),%edx 8a2: 8b 45 f0 mov -0x10(%ebp),%eax 8a5: 01 d0 add %edx,%eax 8a7: 0f b6 00 movzbl (%eax),%eax 8aa: 84 c0 test %al,%al 8ac: 0f 85 94 fe ff ff jne 746 <printf+0x22> putc(fd, c); } state = 0; } } } 8b2: 90 nop 8b3: c9 leave 8b4: c3 ret 000008b5 <free>: static Header base; static Header *freep; void free(void *ap) { 8b5: 55 push %ebp 8b6: 89 e5 mov %esp,%ebp 8b8: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 8bb: 8b 45 08 mov 0x8(%ebp),%eax 8be: 83 e8 08 sub $0x8,%eax 8c1: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 8c4: a1 08 0e 00 00 mov 0xe08,%eax 8c9: 89 45 fc mov %eax,-0x4(%ebp) 8cc: eb 24 jmp 8f2 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 8ce: 8b 45 fc mov -0x4(%ebp),%eax 8d1: 8b 00 mov (%eax),%eax 8d3: 3b 45 fc cmp -0x4(%ebp),%eax 8d6: 77 12 ja 8ea <free+0x35> 8d8: 8b 45 f8 mov -0x8(%ebp),%eax 8db: 3b 45 fc cmp -0x4(%ebp),%eax 8de: 77 24 ja 904 <free+0x4f> 8e0: 8b 45 fc mov -0x4(%ebp),%eax 8e3: 8b 00 mov (%eax),%eax 8e5: 3b 45 f8 cmp -0x8(%ebp),%eax 8e8: 77 1a ja 904 <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 8ea: 8b 45 fc mov -0x4(%ebp),%eax 8ed: 8b 00 mov (%eax),%eax 8ef: 89 45 fc mov %eax,-0x4(%ebp) 8f2: 8b 45 f8 mov -0x8(%ebp),%eax 8f5: 3b 45 fc cmp -0x4(%ebp),%eax 8f8: 76 d4 jbe 8ce <free+0x19> 8fa: 8b 45 fc mov -0x4(%ebp),%eax 8fd: 8b 00 mov (%eax),%eax 8ff: 3b 45 f8 cmp -0x8(%ebp),%eax 902: 76 ca jbe 8ce <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 904: 8b 45 f8 mov -0x8(%ebp),%eax 907: 8b 40 04 mov 0x4(%eax),%eax 90a: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 911: 8b 45 f8 mov -0x8(%ebp),%eax 914: 01 c2 add %eax,%edx 916: 8b 45 fc mov -0x4(%ebp),%eax 919: 8b 00 mov (%eax),%eax 91b: 39 c2 cmp %eax,%edx 91d: 75 24 jne 943 <free+0x8e> bp->s.size += p->s.ptr->s.size; 91f: 8b 45 f8 mov -0x8(%ebp),%eax 922: 8b 50 04 mov 0x4(%eax),%edx 925: 8b 45 fc mov -0x4(%ebp),%eax 928: 8b 00 mov (%eax),%eax 92a: 8b 40 04 mov 0x4(%eax),%eax 92d: 01 c2 add %eax,%edx 92f: 8b 45 f8 mov -0x8(%ebp),%eax 932: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 935: 8b 45 fc mov -0x4(%ebp),%eax 938: 8b 00 mov (%eax),%eax 93a: 8b 10 mov (%eax),%edx 93c: 8b 45 f8 mov -0x8(%ebp),%eax 93f: 89 10 mov %edx,(%eax) 941: eb 0a jmp 94d <free+0x98> } else bp->s.ptr = p->s.ptr; 943: 8b 45 fc mov -0x4(%ebp),%eax 946: 8b 10 mov (%eax),%edx 948: 8b 45 f8 mov -0x8(%ebp),%eax 94b: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 94d: 8b 45 fc mov -0x4(%ebp),%eax 950: 8b 40 04 mov 0x4(%eax),%eax 953: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 95a: 8b 45 fc mov -0x4(%ebp),%eax 95d: 01 d0 add %edx,%eax 95f: 3b 45 f8 cmp -0x8(%ebp),%eax 962: 75 20 jne 984 <free+0xcf> p->s.size += bp->s.size; 964: 8b 45 fc mov -0x4(%ebp),%eax 967: 8b 50 04 mov 0x4(%eax),%edx 96a: 8b 45 f8 mov -0x8(%ebp),%eax 96d: 8b 40 04 mov 0x4(%eax),%eax 970: 01 c2 add %eax,%edx 972: 8b 45 fc mov -0x4(%ebp),%eax 975: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 978: 8b 45 f8 mov -0x8(%ebp),%eax 97b: 8b 10 mov (%eax),%edx 97d: 8b 45 fc mov -0x4(%ebp),%eax 980: 89 10 mov %edx,(%eax) 982: eb 08 jmp 98c <free+0xd7> } else p->s.ptr = bp; 984: 8b 45 fc mov -0x4(%ebp),%eax 987: 8b 55 f8 mov -0x8(%ebp),%edx 98a: 89 10 mov %edx,(%eax) freep = p; 98c: 8b 45 fc mov -0x4(%ebp),%eax 98f: a3 08 0e 00 00 mov %eax,0xe08 } 994: 90 nop 995: c9 leave 996: c3 ret 00000997 <morecore>: static Header* morecore(uint nu) { 997: 55 push %ebp 998: 89 e5 mov %esp,%ebp 99a: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if(nu < 4096) 99d: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 9a4: 77 07 ja 9ad <morecore+0x16> nu = 4096; 9a6: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 9ad: 8b 45 08 mov 0x8(%ebp),%eax 9b0: c1 e0 03 shl $0x3,%eax 9b3: 83 ec 0c sub $0xc,%esp 9b6: 50 push %eax 9b7: e8 79 fc ff ff call 635 <sbrk> 9bc: 83 c4 10 add $0x10,%esp 9bf: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 9c2: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 9c6: 75 07 jne 9cf <morecore+0x38> return 0; 9c8: b8 00 00 00 00 mov $0x0,%eax 9cd: eb 26 jmp 9f5 <morecore+0x5e> hp = (Header*)p; 9cf: 8b 45 f4 mov -0xc(%ebp),%eax 9d2: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 9d5: 8b 45 f0 mov -0x10(%ebp),%eax 9d8: 8b 55 08 mov 0x8(%ebp),%edx 9db: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 9de: 8b 45 f0 mov -0x10(%ebp),%eax 9e1: 83 c0 08 add $0x8,%eax 9e4: 83 ec 0c sub $0xc,%esp 9e7: 50 push %eax 9e8: e8 c8 fe ff ff call 8b5 <free> 9ed: 83 c4 10 add $0x10,%esp return freep; 9f0: a1 08 0e 00 00 mov 0xe08,%eax } 9f5: c9 leave 9f6: c3 ret 000009f7 <malloc>: void* malloc(uint nbytes) { 9f7: 55 push %ebp 9f8: 89 e5 mov %esp,%ebp 9fa: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 9fd: 8b 45 08 mov 0x8(%ebp),%eax a00: 83 c0 07 add $0x7,%eax a03: c1 e8 03 shr $0x3,%eax a06: 83 c0 01 add $0x1,%eax a09: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ a0c: a1 08 0e 00 00 mov 0xe08,%eax a11: 89 45 f0 mov %eax,-0x10(%ebp) a14: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) a18: 75 23 jne a3d <malloc+0x46> base.s.ptr = freep = prevp = &base; a1a: c7 45 f0 00 0e 00 00 movl $0xe00,-0x10(%ebp) a21: 8b 45 f0 mov -0x10(%ebp),%eax a24: a3 08 0e 00 00 mov %eax,0xe08 a29: a1 08 0e 00 00 mov 0xe08,%eax a2e: a3 00 0e 00 00 mov %eax,0xe00 base.s.size = 0; a33: c7 05 04 0e 00 00 00 movl $0x0,0xe04 a3a: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ a3d: 8b 45 f0 mov -0x10(%ebp),%eax a40: 8b 00 mov (%eax),%eax a42: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ a45: 8b 45 f4 mov -0xc(%ebp),%eax a48: 8b 40 04 mov 0x4(%eax),%eax a4b: 3b 45 ec cmp -0x14(%ebp),%eax a4e: 72 4d jb a9d <malloc+0xa6> if(p->s.size == nunits) a50: 8b 45 f4 mov -0xc(%ebp),%eax a53: 8b 40 04 mov 0x4(%eax),%eax a56: 3b 45 ec cmp -0x14(%ebp),%eax a59: 75 0c jne a67 <malloc+0x70> prevp->s.ptr = p->s.ptr; a5b: 8b 45 f4 mov -0xc(%ebp),%eax a5e: 8b 10 mov (%eax),%edx a60: 8b 45 f0 mov -0x10(%ebp),%eax a63: 89 10 mov %edx,(%eax) a65: eb 26 jmp a8d <malloc+0x96> else { p->s.size -= nunits; a67: 8b 45 f4 mov -0xc(%ebp),%eax a6a: 8b 40 04 mov 0x4(%eax),%eax a6d: 2b 45 ec sub -0x14(%ebp),%eax a70: 89 c2 mov %eax,%edx a72: 8b 45 f4 mov -0xc(%ebp),%eax a75: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; a78: 8b 45 f4 mov -0xc(%ebp),%eax a7b: 8b 40 04 mov 0x4(%eax),%eax a7e: c1 e0 03 shl $0x3,%eax a81: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; a84: 8b 45 f4 mov -0xc(%ebp),%eax a87: 8b 55 ec mov -0x14(%ebp),%edx a8a: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; a8d: 8b 45 f0 mov -0x10(%ebp),%eax a90: a3 08 0e 00 00 mov %eax,0xe08 return (void*)(p + 1); a95: 8b 45 f4 mov -0xc(%ebp),%eax a98: 83 c0 08 add $0x8,%eax a9b: eb 3b jmp ad8 <malloc+0xe1> } if(p == freep) a9d: a1 08 0e 00 00 mov 0xe08,%eax aa2: 39 45 f4 cmp %eax,-0xc(%ebp) aa5: 75 1e jne ac5 <malloc+0xce> if((p = morecore(nunits)) == 0) aa7: 83 ec 0c sub $0xc,%esp aaa: ff 75 ec pushl -0x14(%ebp) aad: e8 e5 fe ff ff call 997 <morecore> ab2: 83 c4 10 add $0x10,%esp ab5: 89 45 f4 mov %eax,-0xc(%ebp) ab8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) abc: 75 07 jne ac5 <malloc+0xce> return 0; abe: b8 00 00 00 00 mov $0x0,%eax ac3: eb 13 jmp ad8 <malloc+0xe1> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ ac5: 8b 45 f4 mov -0xc(%ebp),%eax ac8: 89 45 f0 mov %eax,-0x10(%ebp) acb: 8b 45 f4 mov -0xc(%ebp),%eax ace: 8b 00 mov (%eax),%eax ad0: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } ad3: e9 6d ff ff ff jmp a45 <malloc+0x4e> } ad8: c9 leave ad9: c3 ret
examples/Setoid.agda
asr/agda-kanso
1
5532
<gh_stars>1-10 module Setoid where module Logic where infix 4 _/\_ -- infix 2 _\/_ data True : Set where tt : True data False : Set where data _/\_ (P Q : Set) : Set where andI : P -> Q -> P /\ Q -- Not allowed if we have proof irrelevance -- data _\/_ (P Q : Set) : Set where -- orIL : P -> P \/ Q -- orIR : Q -> P \/ Q module Setoid where data Setoid : Set1 where setoid : (A : Set) -> (_==_ : A -> A -> Set) -> (refl : (x : A) -> x == x) -> (sym : (x y : A) -> x == y -> y == x) -> (trans : (x y z : A) -> x == y -> y == z -> x == z) -> Setoid El : Setoid -> Set El (setoid A _ _ _ _) = A module Projections where eq : (A : Setoid) -> El A -> El A -> Set eq (setoid _ e _ _ _) = e refl : (A : Setoid) -> {x : El A} -> eq A x x refl (setoid _ _ r _ _) = r _ sym : (A : Setoid) -> {x y : El A} -> (h : eq A x y) -> eq A y x sym (setoid _ _ _ s _) = s _ _ trans : (A : Setoid) -> {x y z : El A} -> eq A x y -> eq A y z -> eq A x z trans (setoid _ _ _ _ t) = t _ _ _ module Equality (A : Setoid) where infix 6 _==_ _==_ : El A -> El A -> Set _==_ = Projections.eq A refl : {x : El A} -> x == x refl = Projections.refl A sym : {x y : El A} -> x == y -> y == x sym = Projections.sym A trans : {x y z : El A} -> x == y -> y == z -> x == z trans = Projections.trans A module EqChain (A : Setoid.Setoid) where infixl 5 _===_ _=-=_ infix 8 _since_ open Setoid private open module EqA = Equality A eqProof>_ : (x : El A) -> x == x eqProof> x = refl _=-=_ : (x : El A) -> {y : El A} -> x == y -> x == y x =-= eq = eq _===_ : {x y z : El A} -> x == y -> y == z -> x == z _===_ = trans _since_ : {x : El A} -> (y : El A) -> x == y -> x == y _ since eq = eq module Fun where open Logic open Setoid infixr 10 _=>_ _==>_ open Setoid.Projections using (eq) data _=>_ (A B : Setoid) : Set where lam : (f : El A -> El B) -> ({x y : El A} -> eq A x y -> eq B (f x) (f y) ) -> A => B app : {A B : Setoid} -> (A => B) -> El A -> El B app (lam f _) = f cong : {A B : Setoid} -> (f : A => B) -> {x y : El A} -> eq A x y -> eq B (app f x) (app f y) cong (lam _ resp) = resp data EqFun {A B : Setoid}(f g : A => B) : Set where eqFunI : ({x y : El A} -> eq A x y -> eq B (app f x) (app g y)) -> EqFun f g eqFunE : {A B : Setoid} -> {f g : A => B} -> {x y : El A} -> EqFun f g -> eq A x y -> eq B (app f x) (app g y) eqFunE (eqFunI h) = h _==>_ : Setoid -> Setoid -> Setoid A ==> B = setoid (A => B) EqFun r s t where module Proof where open module EqChainB = EqChain B module EqA = Equality A open module EqB = Equality B -- either abstract or --proof-irrelevance needed -- (we don't want to compare the proofs for equality) -- abstract r : (f : A => B) -> EqFun f f r f = eqFunI (\xy -> cong f xy) s : (f g : A => B) -> EqFun f g -> EqFun g f s f g fg = eqFunI (\{x}{y} xy -> app g x =-= app g y since cong g xy === app f x since sym (eqFunE fg xy) === app f y since cong f xy ) t : (f g h : A => B) -> EqFun f g -> EqFun g h -> EqFun f h t f g h fg gh = eqFunI (\{x}{y} xy -> app f x =-= app g y since eqFunE fg xy === app g x since cong g (EqA.sym xy) === app h y since eqFunE gh xy ) open Proof infixl 100 _$_ _$_ : {A B : Setoid} -> El (A ==> B) -> El A -> El B _$_ = app lam2 : {A B C : Setoid} -> (f : El A -> El B -> El C) -> ({x x' : El A} -> eq A x x' -> {y y' : El B} -> eq B y y' -> eq C (f x y) (f x' y') ) -> El (A ==> B ==> C) lam2 {A} f h = lam (\x -> lam (\y -> f x y) (\y -> h EqA.refl y)) (\x -> eqFunI (\y -> h x y)) where module EqA = Equality A lam3 : {A B C D : Setoid} -> (f : El A -> El B -> El C -> El D) -> ({x x' : El A} -> eq A x x' -> {y y' : El B} -> eq B y y' -> {z z' : El C} -> eq C z z' -> eq D (f x y z) (f x' y' z') ) -> El (A ==> B ==> C ==> D) lam3 {A} f h = lam (\x -> lam2 (\y z -> f x y z) (\y z -> h EqA.refl y z)) (\x -> eqFunI (\y -> eqFunI (\z -> h x y z))) where module EqA = Equality A eta : {A B : Setoid} -> (f : El (A ==> B)) -> eq (A ==> B) f (lam (\x -> f $ x) (\xy -> cong f xy)) eta f = eqFunI (\xy -> cong f xy) id : {A : Setoid} -> El (A ==> A) id = lam (\x -> x) (\x -> x) {- Now it looks okay. But it's incredibly slow! Proof irrelevance makes it go fast again... The problem is equality checking of (function type) setoids which without proof irrelevance checks equality of the proof that EqFun is an equivalence relation. It's not clear why using lam3 involves so many more equality checks than using lam. Making the proofs abstract makes the problem go away. -} compose : {A B C : Setoid} -> El ((B ==> C) ==> (A ==> B) ==> (A ==> C)) compose = lam3 (\f g x -> f $ (g $ x)) (\f g x -> eqFunE f (eqFunE g x)) _∘_ : {A B C : Setoid} -> El (B ==> C) -> El (A ==> B) -> El (A ==> C) f ∘ g = compose $ f $ g const : {A B : Setoid} -> El (A ==> B ==> A) const = lam2 (\x y -> x) (\x y -> x) module Nat where open Logic open Setoid open Fun infixl 10 _+_ data Nat : Set where zero : Nat suc : Nat -> Nat module NatSetoid where eqNat : Nat -> Nat -> Set eqNat zero zero = True eqNat zero (suc _) = False eqNat (suc _) zero = False eqNat (suc n) (suc m) = eqNat n m data EqNat (n m : Nat) : Set where eqnat : eqNat n m -> EqNat n m uneqnat : {n m : Nat} -> EqNat n m -> eqNat n m uneqnat (eqnat x) = x r : (x : Nat) -> eqNat x x r zero = tt r (suc n) = r n -- reflexivity of EqNat rf : (n : Nat) -> EqNat n n rf = \ x -> eqnat (r x) s : (x y : Nat) -> eqNat x y -> eqNat y x s zero zero _ = tt s (suc n) (suc m) h = s n m h s zero (suc _) () s (suc _) zero () -- symmetry of EqNat sy : (x y : Nat) -> EqNat x y -> EqNat y x sy = \x y h -> eqnat (s x y (uneqnat h)) t : (x y z : Nat) -> eqNat x y -> eqNat y z -> eqNat x z t zero zero z xy yz = yz t (suc x) (suc y) (suc z) xy yz = t x y z xy yz t zero (suc _) _ () _ t (suc _) zero _ () _ t (suc _) (suc _) zero _ () -- transitivity of EqNat tr : (x y z : Nat) -> EqNat x y -> EqNat y z -> EqNat x z tr = \x y z xy yz -> eqnat (t x y z (uneqnat xy) (uneqnat yz)) NAT : Setoid NAT = setoid Nat NatSetoid.EqNat NatSetoid.rf NatSetoid.sy NatSetoid.tr _+_ : Nat -> Nat -> Nat zero + m = m suc n + m = suc (n + m) plus : El (NAT ==> NAT ==> NAT) plus = lam2 (\n m -> n + m) eqPlus where module EqNat = Equality NAT open EqNat open NatSetoid eqPlus : {n n' : Nat} -> n == n' -> {m m' : Nat} -> m == m' -> n + m == n' + m' eqPlus {zero} {zero} _ mm = mm eqPlus {suc n} {suc n'} (eqnat nn) {m}{m'} (eqnat mm) = eqnat (uneqnat (eqPlus{n}{n'} (eqnat nn) {m}{m'} (eqnat mm) ) ) eqPlus {zero} {suc _} (eqnat ()) _ eqPlus {suc _} {zero} (eqnat ()) _ module List where open Logic open Setoid data List (A : Set) : Set where nil : List A _::_ : A -> List A -> List A LIST : Setoid -> Setoid LIST A = setoid (List (El A)) eqList r s t where module EqA = Equality A open EqA eqList : List (El A) -> List (El A) -> Set eqList nil nil = True eqList nil (_ :: _) = False eqList (_ :: _) nil = False eqList (x :: xs) (y :: ys) = x == y /\ eqList xs ys r : (x : List (El A)) -> eqList x x r nil = tt r (x :: xs) = andI refl (r xs) s : (x y : List (El A)) -> eqList x y -> eqList y x s nil nil h = h s (x :: xs) (y :: ys) (andI xy xys) = andI (sym xy) (s xs ys xys) s nil (_ :: _) () s (_ :: _) nil () t : (x y z : List (El A)) -> eqList x y -> eqList y z -> eqList x z t nil nil zs _ h = h t (x :: xs) (y :: ys) (z :: zs) (andI xy xys) (andI yz yzs) = andI (trans xy yz) (t xs ys zs xys yzs) t nil (_ :: _) _ () _ t (_ :: _) nil _ () _ t (_ :: _) (_ :: _) nil _ () open Fun
home/compare.asm
opiter09/ASM-Machina
1
6976
<reponame>opiter09/ASM-Machina ; Compare strings, c bytes in length, at de and hl. ; Often used to compare big endian numbers in battle calculations. StringCmp:: ld a, [de] cp [hl] ret nz inc de inc hl dec c jr nz, StringCmp ret
obj/gnattest/tests/dg_types-test_data-tests.ads
SMerrony/dgemua
2
27144
-- This package has been generated automatically by GNATtest. -- Do not edit any part of it, see GNATtest documentation for more details. -- begin read only with Gnattest_Generated; package DG_Types.Test_Data.Tests is type Test is new GNATtest_Generated.GNATtest_Standard.DG_Types.Test_Data.Test with null record; procedure Test_Boolean_To_YN_3d5779 (Gnattest_T : in out Test); -- dg_types.ads:111:5:Boolean_To_YN procedure Test_Clear_W_Bit_3be3ae (Gnattest_T : in out Test); -- dg_types.ads:114:5:Clear_W_Bit procedure Test_Flip_W_Bit_d2d2b6 (Gnattest_T : in out Test); -- dg_types.ads:115:5:Flip_W_Bit procedure Test_Set_W_Bit_f63f6c (Gnattest_T : in out Test); -- dg_types.ads:116:5:Set_W_Bit procedure Test_Test_W_Bit_7a11db (Gnattest_T : in out Test); -- dg_types.ads:117:5:Test_W_Bit procedure Test_Get_W_Bits_ea9a74 (Gnattest_T : in out Test); -- dg_types.ads:118:5:Get_W_Bits procedure Test_Get_DW_Bits_a2bf67 (Gnattest_T : in out Test); -- dg_types.ads:119:5:Get_DW_Bits procedure Test_Test_DW_Bit_799079 (Gnattest_T : in out Test); -- dg_types.ads:120:5:Test_DW_Bit procedure Test_Clear_QW_Bit_f212ea (Gnattest_T : in out Test); -- dg_types.ads:121:5:Clear_QW_Bit procedure Test_Set_QW_Bit_1b4331 (Gnattest_T : in out Test); -- dg_types.ads:122:5:Set_QW_Bit procedure Test_Test_QW_Bit_2ec078 (Gnattest_T : in out Test); -- dg_types.ads:123:5:Test_QW_Bit procedure Test_Get_Lower_Byte_2c7e4b (Gnattest_T : in out Test); -- dg_types.ads:126:5:Get_Lower_Byte procedure Test_Get_Upper_Byte_d89a4b (Gnattest_T : in out Test); -- dg_types.ads:127:5:Get_Upper_Byte procedure Test_Swap_Bytes_7d46a7 (Gnattest_T : in out Test); -- dg_types.ads:128:5:Swap_Bytes procedure Test_Get_Bytes_From_Word_075975 (Gnattest_T : in out Test); -- dg_types.ads:129:5:Get_Bytes_From_Word procedure Test_Word_From_Bytes_ea4510 (Gnattest_T : in out Test); -- dg_types.ads:130:5:Word_From_Bytes procedure Test_Byte_To_String_d93915 (Gnattest_T : in out Test); -- dg_types.ads:131:5:Byte_To_String procedure Test_Low_Byte_To_Char_00e4b2 (Gnattest_T : in out Test); -- dg_types.ads:137:5:Low_Byte_To_Char procedure Test_Byte_Arr_To_Unbounded_8c1bb0 (Gnattest_T : in out Test); -- dg_types.ads:138:5:Byte_Arr_To_Unbounded procedure Test_Get_Data_Sensitive_Portion_2234ef (Gnattest_T : in out Test); -- dg_types.ads:139:5:Get_Data_Sensitive_Portion procedure Test_Word_To_String_8605e3 (Gnattest_T : in out Test); -- dg_types.ads:142:5:Word_To_String procedure Test_Lower_Word_3da74d (Gnattest_T : in out Test); -- dg_types.ads:149:5:Lower_Word procedure Test_Upper_Word_05c493 (Gnattest_T : in out Test); -- dg_types.ads:150:5:Upper_Word procedure Test_Dword_From_Two_Words_3c389f (Gnattest_T : in out Test); -- dg_types.ads:151:5:Dword_From_Two_Words procedure Test_Dword_To_String_55061d (Gnattest_T : in out Test); -- dg_types.ads:152:5:Dword_To_String procedure Test_String_To_Dword_3c5214 (Gnattest_T : in out Test); -- dg_types.ads:158:5:String_To_Dword procedure Test_Sext_Word_To_Dword_45b429 (Gnattest_T : in out Test); -- dg_types.ads:159:5:Sext_Word_To_Dword procedure Test_Lower_Dword_d008b0 (Gnattest_T : in out Test); -- dg_types.ads:162:5:Lower_Dword procedure Test_Upper_Dword_1042da (Gnattest_T : in out Test); -- dg_types.ads:163:5:Upper_Dword procedure Test_Qword_From_Two_Dwords_e0cb2c (Gnattest_T : in out Test); -- dg_types.ads:164:5:Qword_From_Two_Dwords procedure Test_Int_To_String_506364 (Gnattest_T : in out Test); -- dg_types.ads:168:5:Int_To_String procedure Test_String_To_Integer_fdacf8 (Gnattest_T : in out Test); -- dg_types.ads:175:5:String_To_Integer procedure Test_Decode_Dec_Data_Type_056a82 (Gnattest_T : in out Test); -- dg_types.ads:178:5:Decode_Dec_Data_Type procedure Test_Read_Decimal_385668 (Gnattest_T : in out Test); -- dg_types.ads:182:5:Read_Decimal procedure Test_DG_Double_To_Long_Float_2d8c8f (Gnattest_T : in out Test); -- dg_types.ads:185:5:DG_Double_To_Long_Float procedure Test_DG_Single_To_Long_Float_aba5b2 (Gnattest_T : in out Test); -- dg_types.ads:186:5:DG_Single_To_Long_Float procedure Test_Long_Float_To_DG_Double_8175dc (Gnattest_T : in out Test); -- dg_types.ads:187:5:Long_Float_To_DG_Double procedure Test_Long_Float_To_DG_Single_d6dcc8 (Gnattest_T : in out Test); -- dg_types.ads:188:5:Long_Float_To_DG_Single procedure Test_Byte_To_Integer_8_6ac9f0 (Gnattest_T : in out Test); -- dg_types.ads:191:5:Byte_To_Integer_8 procedure Test_Char_To_Byte_11390e (Gnattest_T : in out Test); -- dg_types.ads:192:5:Char_To_Byte procedure Test_Byte_To_Char_7742da (Gnattest_T : in out Test); -- dg_types.ads:193:5:Byte_To_Char procedure Test_Dword_To_Integer_32_e9169d (Gnattest_T : in out Test); -- dg_types.ads:194:5:Dword_To_Integer_32 procedure Test_Dword_To_Integer_bb8284 (Gnattest_T : in out Test); -- dg_types.ads:195:5:Dword_To_Integer procedure Test_Integer_32_To_Dword_67c35b (Gnattest_T : in out Test); -- dg_types.ads:196:5:Integer_32_To_Dword procedure Test_Integer_32_To_Phys_0e179b (Gnattest_T : in out Test); -- dg_types.ads:197:5:Integer_32_To_Phys procedure Test_Word_To_Integer_16_a3a65b (Gnattest_T : in out Test); -- dg_types.ads:198:5:Word_To_Integer_16 procedure Test_Integer_16_To_Word_40bf8b (Gnattest_T : in out Test); -- dg_types.ads:199:5:Integer_16_To_Word procedure Test_Word_To_Unsigned_16_d3e005 (Gnattest_T : in out Test); -- dg_types.ads:200:5:Word_To_Unsigned_16 procedure Test_Integer_64_To_Unsigned_64_f5c627 (Gnattest_T : in out Test); -- dg_types.ads:201:5:Integer_64_To_Unsigned_64 procedure Test_Unsigned_32_To_Integer_5e891f (Gnattest_T : in out Test); -- dg_types.ads:202:5:Unsigned_32_To_Integer procedure Test_Integer_To_Unsigned_64_d5b49e (Gnattest_T : in out Test); -- dg_types.ads:203:5:Integer_To_Unsigned_64 end DG_Types.Test_Data.Tests; -- end read only
pin-3.22-98547-g7a303a835-gcc-linux/source/tools/Debugger/zmm-asm-intel64.asm
ArthasZhang007/15418FinalProject
0
83452
<filename>pin-3.22-98547-g7a303a835-gcc-linux/source/tools/Debugger/zmm-asm-intel64.asm ; ; Copyright (C) 2017-2018 Intel Corporation. ; SPDX-License-Identifier: MIT ; include asm_macros.inc PROLOGUE .code loadYmm0 PROC ; This is "VMOVDQU ymm0, YMMWORD PTR [rdi]". We directly specify the machine code, ; so this test runs even when the compiler doesn't support AVX. db 0C5h, 0FEh, 06Fh, 007h ret loadYmm0 ENDP loadZmm0 PROC ; This is "VMOVUPD zmm0, ZMMWORD PTR [rdi]". We directly specify the machine code, ; so this test runs even when the compiler doesn't support AVX512. db 062h, 0F1h, 0FDh, 048h, 010h, 007h ret loadZmm0 ENDP loadK0 PROC ; This is "KMOVW k0, WORD PTR [rdi]". We directly specify the machine code, ; so this test runs even when the compiler doesn't support AVX512. db 0C5h, 0F8h, 090h, 007h ret loadK0 ENDP end
programs/oeis/225/A225530.asm
jmorken/loda
1
26000
; A225530: Number of ordered pairs (i,j) with i,j >= 0, i + j = n and gcd(i,j) <= 1. ; 1,2,1,2,2,4,2,6,4,6,4,10,4,12,6,8,8,16,6,18,8,12,10,22,8,20,12,18,12,28,8,30,16,20,16,24,12,36,18,24,16,40,12,42,20,24,22,46,16,42,20,32,24,52,18,40,24,36,28,58,16,60,30,36,32,48,20,66,32,44,24,70,24,72,36,40,36,60,24,78,32,54,40,82,24,64,42,56,40,88,24,72,44,60,46,72,32,96,42,60,40,100,32,102,48,48,52,106,36,108,40,72,48,112,36,88,56,72,58,96,32,110,60,80,60,100,36,126,64,84,48,130,40,108,66,72,64,136,44,138,48,92,70,120,48,112,72,84,72,148,40,150,72,96,60,120,48,156,78,104,64,132,54,162,80,80,82,166,48,156,64,108,84,172,56,120,80,116,88,178,48,180,72,120,88,144,60,160,92,108,72,190,64,192,96,96,84,196,60,198,80,132,100,168,64,160,102,132,96,180,48,210,104,140,106,168,72,180,108,144,80,192,72,222,96,120,112,226,72,228,88,120,112,232,72,184,116,156,96,238,64,240,110,162,120,168,80,216,120,164 mov $1,$0 lpb $0 sub $1,$1 mov $2,$0 trn $2,1 cal $2,10 ; Euler totient function phi(n): count numbers <= n and prime to n. mov $0,1 sub $2,1 add $1,$2 lpe add $1,1
oeis/158/A158744.asm
neoneye/loda-programs
11
8812
<reponame>neoneye/loda-programs ; A158744: a(n) = 74*n^2 - 1. ; 73,295,665,1183,1849,2663,3625,4735,5993,7399,8953,10655,12505,14503,16649,18943,21385,23975,26713,29599,32633,35815,39145,42623,46249,50023,53945,58015,62233,66599,71113,75775,80585,85543,90649,95903,101305,106855,112553,118399,124393,130535,136825,143263,149849,156583,163465,170495,177673,184999,192473,200095,207865,215783,223849,232063,240425,248935,257593,266399,275353,284455,293705,303103,312649,322343,332185,342175,352313,362599,373033,383615,394345,405223,416249,427423,438745,450215 mov $1,2 add $1,$0 mul $1,$0 mul $1,74 add $1,73 mov $0,$1
Transynther/x86/_processed/US/_zr_/i3-7100_9_0x84_notsx.log_60_2824.asm
ljhsiun2/medusa
9
18843
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r15 push %r8 push %rbp push %rdi push %rdx // Load lea addresses_D+0x1089d, %r13 nop nop nop and %r8, %r8 vmovups (%r13), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %r11 nop nop nop nop nop dec %r15 // Store lea addresses_WT+0x8389, %r11 nop nop nop nop nop and %rdi, %rdi mov $0x5152535455565758, %r8 movq %r8, %xmm7 vmovaps %ymm7, (%r11) nop nop and $50294, %r11 // Store lea addresses_WT+0xe1d4, %r13 nop nop and %rdx, %rdx mov $0x5152535455565758, %r11 movq %r11, %xmm0 vmovups %ymm0, (%r13) add %r11, %r11 // Store lea addresses_WC+0x157f9, %rbp nop nop nop nop nop add $31164, %r8 mov $0x5152535455565758, %rdx movq %rdx, %xmm3 vmovups %ymm3, (%rbp) // Exception!!! nop nop nop nop nop mov (0), %rdx nop nop nop nop dec %rbp // Store lea addresses_US+0x164c9, %r15 sub $14900, %rdi movb $0x51, (%r15) inc %r11 // Load lea addresses_WC+0x179c9, %r13 nop nop xor %rbp, %rbp vmovups (%r13), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $0, %xmm7, %rdi nop nop nop nop nop sub $56381, %r13 // Store lea addresses_D+0x1d868, %rdx nop nop cmp $33365, %r15 mov $0x5152535455565758, %r8 movq %r8, %xmm6 vmovups %ymm6, (%rdx) nop nop nop nop cmp %r8, %r8 // Store lea addresses_US+0x14bd1, %r8 nop nop nop xor $31532, %rbp mov $0x5152535455565758, %r13 movq %r13, %xmm7 movups %xmm7, (%r8) nop nop cmp $55027, %r15 // Faulty Load lea addresses_US+0x166c9, %r13 nop nop nop nop nop inc %rdi movb (%r13), %r15b lea oracles, %rdx and $0xff, %r15 shlq $12, %r15 mov (%rdx,%r15,1), %r15 pop %rdx pop %rdi pop %rbp pop %r8 pop %r15 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 32, 'congruent': 6, 'NT': True, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_US', 'same': False, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_US', 'same': False, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_US', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'00': 60} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
bugs/bug12.ada
daveshields/AdaEd
3
17536
procedure integer_image is c : character; j : integer := 3; k : constant integer := 3; begin for i in 1 .. 3 loop c := integer'image(k)(2); -- ok c := integer'image(3)(2); -- ok c := integer'image(i)(2); -- causes error c := integer'image(j)(2); -- causes error end loop; end integer_image;
oeis/142/A142058.asm
neoneye/loda-programs
11
166122
<reponame>neoneye/loda-programs ; A142058: Primes congruent to 16 mod 33. ; Submitted by <NAME>(s4) ; 181,313,379,577,643,709,907,1039,1171,1237,1303,1567,1699,1831,2029,2161,2293,2557,2689,2887,2953,3019,3217,3547,3613,3877,3943,4273,4339,4603,4801,4933,4999,5197,5527,5659,5791,5857,5923,6121,6451,6781,7177,7243,7309,7507,7573,7639,8101,8167,8233,8431,8563,8629,8761,8893,9091,9157,9421,9619,9817,9883,9949,10477,10939,11071,11467,11731,11863,12391,12457,12589,12721,12853,12919,13183,13249,13381,13513,13711,14107,14173,14437,14503,14767,15031,15361,15427,15493,15559,15823,15889,16087,16417,16747 mov $1,3 mov $2,$0 add $2,2 pow $2,2 lpb $2 add $1,21 mov $3,$1 sub $1,4 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,16 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,1 lpe mov $0,$1 mul $0,2 add $0,43
oeis/324/A324122.asm
neoneye/loda-programs
11
173787
<filename>oeis/324/A324122.asm ; A324122: a(n) = sigma(n) - gcd(n*d(n), sigma(n)), where d(n) = number of divisors of n (A000005) and sigma(n) = sum of divisors of n (A000203). ; Submitted by <NAME> ; 0,2,2,6,4,0,6,14,12,16,10,24,12,16,12,30,16,36,18,36,28,32,22,48,30,40,36,0,28,48,30,60,36,52,44,90,36,56,52,80,40,48,42,72,72,64,46,120,54,90,60,96,52,96,68,112,76,88,58,144,60,88,102,126,80,96,66,120,84,128,70,192,72,112,122,136,92,144,78,184,120,124,82,112,104,128,108,176,88,216,84,144,124,136,100,216,96,168,150,216 add $0,1 mov $2,$0 lpb $0 add $1,$4 mov $3,$2 dif $3,$0 sub $0,1 cmp $3,$2 cmp $3,0 add $4,$3 lpe add $4,1 add $4,$1 mul $1,$2 gcd $1,$4 sub $4,$1 mov $0,$4
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/games.lzh/games/temp/kart-apu.asm
prismotizm/gigaleak
0
93105
<reponame>prismotizm/gigaleak<gh_stars>0 Name: kart-apu.asm Type: file Size: 530 Last-Modified: '1991-11-29T03:29:32Z' SHA-1: CC8114760BDDCDE0270E6F1BFB81ADC7CA26DBFF Description: null
oeis/165/A165662.asm
neoneye/loda-programs
11
170912
; A165662: Period 5: repeat 4,4,8,6,8. ; Submitted by <NAME> ; 4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8 bin $0,2 mul $0,14 add $0,4 mod $0,10
lab02/ex03/Calculator.g4
BlasphemyCoder/Compilers
3
6892
/* * grammar to identify and compute the result of mathematical expressions */ grammar Calculator; program: stat* EOF; /* * code to identify a new entry each new entry can either be an expression or an empty line if it is * an expression, its result is presented */ stat: expr NEWLINE { System.out.println("Result: " + $expr.res); } | NEWLINE; /* * code to identify the possible expression definitions it also computes its value */ expr returns[int res = 0]: e1 = expr op = ('*' | '/') e2 = expr { switch ($op.text) { case "*": $res += $e1.res * $e2.res; break; case "/": if ($e2.res == 0) { System.err.println("Division by 0 not possible"); System.exit(1); } $res += $e1.res / $e2.res; break; } } | e1 = expr op = ('+' | '-') e2 = expr { switch ($op.text) { case "+": $res = $e1.res + $e2.res; break; case "-": $res = $e1.res - $e2.res; break; } } | INT { $res = Integer.parseInt($INT.text); } | '(' expr ')' { $res = $expr.res; }; INT: [0-9]+; NEWLINE: '\r'? '\n'; WS: [ \t]+ -> skip;
Transynther/x86/_processed/NONE/_st_/i7-8650U_0xd2.log_10251_1602.asm
ljhsiun2/medusa
9
23756
<filename>Transynther/x86/_processed/NONE/_st_/i7-8650U_0xd2.log_10251_1602.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0xe7ed, %rsi lea addresses_UC_ht+0x1bc95, %rdi sub $39688, %rbx mov $59, %rcx rep movsw xor %r10, %r10 lea addresses_UC_ht+0x17c27, %rbp nop nop and $61384, %rdi vmovups (%rbp), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rsi add $58956, %r10 lea addresses_WT_ht+0xbc85, %rcx nop nop nop nop nop add $64487, %rbp vmovups (%rcx), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $0, %xmm1, %rsi nop nop nop xor $63536, %rbp lea addresses_normal_ht+0xa495, %rsi lea addresses_D_ht+0x17695, %rdi nop nop nop nop nop sub %rbp, %rbp mov $75, %rcx rep movsl nop nop nop add $44921, %r10 lea addresses_D_ht+0x5c95, %rcx clflush (%rcx) add %r12, %r12 mov $0x6162636465666768, %r10 movq %r10, %xmm6 movups %xmm6, (%rcx) nop nop xor %r12, %r12 lea addresses_WC_ht+0x8095, %rsi lea addresses_D_ht+0x7595, %rdi nop nop add $2772, %rax mov $36, %rcx rep movsb nop nop nop nop nop xor %r12, %r12 lea addresses_WT_ht+0x1e895, %r12 nop nop nop cmp %rcx, %rcx vmovups (%r12), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rbx nop nop xor $40697, %rbx lea addresses_A_ht+0x13ca5, %rdi nop xor %rbx, %rbx movb (%rdi), %r10b nop nop nop nop nop sub $20278, %r10 lea addresses_D_ht+0x1bc95, %rdi nop nop nop nop xor $5612, %rcx movl $0x61626364, (%rdi) nop nop nop nop cmp %rcx, %rcx lea addresses_normal_ht+0x7fa1, %r10 nop nop nop nop nop add %rbp, %rbp mov $0x6162636465666768, %r12 movq %r12, %xmm7 movups %xmm7, (%r10) nop nop nop nop nop add $46480, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r15 push %r8 push %r9 push %rcx push %rdi // Store lea addresses_UC+0xa7d5, %r8 nop nop nop cmp $3345, %r12 mov $0x5152535455565758, %r10 movq %r10, %xmm5 movups %xmm5, (%r8) nop inc %r10 // Store lea addresses_US+0x1e215, %rdi nop and $42485, %r12 mov $0x5152535455565758, %r10 movq %r10, %xmm5 vmovups %ymm5, (%rdi) nop nop nop xor %rdi, %rdi // Store lea addresses_WT+0x1d095, %r15 nop nop nop inc %rcx mov $0x5152535455565758, %r9 movq %r9, (%r15) nop cmp %r12, %r12 // Store lea addresses_normal+0x19ab5, %rdi nop nop nop nop and %r15, %r15 movw $0x5152, (%rdi) nop xor %rcx, %rcx // Faulty Load lea addresses_A+0x5095, %r8 nop cmp $16784, %r15 movb (%r8), %r9b lea oracles, %r15 and $0xff, %r9 shlq $12, %r9 mov (%r15,%r9,1), %r9 pop %rdi pop %rcx pop %r9 pop %r8 pop %r15 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'58': 10251} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
001_HelloWorld/hello_world.asm
Lambda1/GB_Dev
0
92139
<reponame>Lambda1/GB_Dev<filename>001_HelloWorld/hello_world.asm SECTION "Header", rom0[$100] EntryPoint: di jp Start rept $150 - $104 db 0 endr SECTION "Game Code", rom0 Start: .waitVBlank ld a, [$ff44] cp 144 jr c, .waitVBlank xor a ld [$ff40], a ld hl, $9000 ld de, FontTiles ld bc, FontTilesEnd - FontTiles .copyFont ld a, [de] ld [hli], a inc de dec bc ld a, b or c jr nz, .copyFont ld hl, $9800 ld de, HelloWorldStr .copyString ld a, [de] ld [hli], a inc de and a jr nz, .copyString ld a, %11100100 ld [$ff47], a xor a ld [$ff42], a ld [$ff43], a ld [$ff26], a ld a, %10000001 ld [$ff40], a .lockup jr .lockup SECTION "Font", rom0 FontTiles: INCBIN "font.chr" FontTilesEnd: SECTION "Hello World string", rom0 HelloWorldStr: db "HELLO, WORLD!", 0
arch/ARM/cortex_m/src/cm7/cortex_m_svd-fpu.ads
rocher/Ada_Drivers_Library
192
2405
-- This spec has been automatically generated from cm7.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; -- Floating Point Unit package Cortex_M_SVD.FPU is pragma Preelaborate; --------------- -- Registers -- --------------- -- Access privileges for coprocessor 10. type CPACR_CP10_Field is ( -- Any attempted access generates a NOCP UsageFault. Access_Denied, -- Privileged access only. An unprivileged addess generates a NOCP -- UsageFault. Privileged, -- Full access. Full_Access) with Size => 2; for CPACR_CP10_Field use (Access_Denied => 0, Privileged => 1, Full_Access => 3); -- CPACR_CP array type CPACR_CP_Field_Array is array (10 .. 11) of CPACR_CP10_Field with Component_Size => 2, Size => 4; -- Type definition for CPACR_CP type CPACR_CP_Field (As_Array : Boolean := False) is record case As_Array is when False => -- CP as a value Val : HAL.UInt4; when True => -- CP as an array Arr : CPACR_CP_Field_Array; end case; end record with Unchecked_Union, Size => 4; for CPACR_CP_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- Coprocessor Access Control Register type CPACR_Register is record -- unspecified Reserved_0_19 : HAL.UInt20 := 16#0#; -- Access privileges for coprocessor 10. CP : CPACR_CP_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CPACR_Register use record Reserved_0_19 at 0 range 0 .. 19; CP at 0 range 20 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- Floating-Point Context Control Register type FPCCR_Register is record -- Lazy state preservation activation. LSPACT : Boolean := False; -- Read-only. If set, privilege level was user when the floating-point -- stack frame was allocated. USER : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- Read-only. If set, the mode was Thread Mode when the floating-point -- stack frame was allocated. THREAD : Boolean := False; -- Read-only. If set, priority permitted setting the HardFault handler -- to the pending state when the floating-point stack frame was -- allocated. HFRDY : Boolean := False; -- Read-only. If set, MemManage is enabled and priority permitted -- setting the MemManage handler to the pending state when the -- floating-point stack frame was allocated. MMRDY : Boolean := False; -- Read-only. If set, BusFault is enabled and priority permitted setting -- the BusFault handler to the pending state when the floating-point -- stack frame was allocated. BFRDY : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Read-only. If set, DebugMonitor is enabled and priority permitted -- setting the DebugMonitor handler to the pending state when the -- floating-point stack frame was allocated. MONRDY : Boolean := False; -- unspecified Reserved_9_29 : HAL.UInt21 := 16#0#; -- Enables automatic lazy state preservation for floating-point context. LSPEN : Boolean := True; -- Enables CONTROL.FPCA setting on execution of a floating point -- instruction. This results in automatic hardware state preservation -- and restoration, for floating-point context, on exception entry and -- exit. ASPEN : Boolean := True; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FPCCR_Register use record LSPACT at 0 range 0 .. 0; USER at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; THREAD at 0 range 3 .. 3; HFRDY at 0 range 4 .. 4; MMRDY at 0 range 5 .. 5; BFRDY at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; MONRDY at 0 range 8 .. 8; Reserved_9_29 at 0 range 9 .. 29; LSPEN at 0 range 30 .. 30; ASPEN at 0 range 31 .. 31; end record; subtype FPCAR_ADDRESS_Field is HAL.UInt29; -- Floating-Point Context Address Register type FPCAR_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- The FPCAR register holds the location of the unpopulated -- floating-point register space allocated on an exception stack frame. ADDRESS : FPCAR_ADDRESS_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FPCAR_Register use record Reserved_0_2 at 0 range 0 .. 2; ADDRESS at 0 range 3 .. 31; end record; subtype FPDSCR_RMode_Field is HAL.UInt2; -- Floating-Point Default Status Control Register type FPDSCR_Register is record -- unspecified Reserved_0_21 : HAL.UInt22 := 16#0#; -- Default value for FPSCR.RMode. RMode : FPDSCR_RMode_Field := 16#0#; -- Default value for FPSCR.FZ. FZ : Boolean := False; -- Default value for FPSCR.DN. DN : Boolean := False; -- Default value for FPSCR.AHP. AHP : Boolean := False; -- unspecified Reserved_27_31 : HAL.UInt5 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FPDSCR_Register use record Reserved_0_21 at 0 range 0 .. 21; RMode at 0 range 22 .. 23; FZ at 0 range 24 .. 24; DN at 0 range 25 .. 25; AHP at 0 range 26 .. 26; Reserved_27_31 at 0 range 27 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Floating Point Unit type FPU_Peripheral is record -- Coprocessor Access Control Register CPACR : aliased CPACR_Register; -- Floating-Point Context Control Register FPCCR : aliased FPCCR_Register; -- Floating-Point Context Address Register FPCAR : aliased FPCAR_Register; -- Floating-Point Default Status Control Register FPDSCR : aliased FPDSCR_Register; end record with Volatile; for FPU_Peripheral use record CPACR at 16#0# range 0 .. 31; FPCCR at 16#1AC# range 0 .. 31; FPCAR at 16#1B0# range 0 .. 31; FPDSCR at 16#1B4# range 0 .. 31; end record; -- Floating Point Unit FPU_Periph : aliased FPU_Peripheral with Import, Address => FPU_Base; end Cortex_M_SVD.FPU;
engine/smallflag.asm
Dev727/ancientplatinum
28
104673
SmallFarFlagAction: ; Perform action b on bit c in flag array hl. ; If checking a flag, check flag array d:hl unless d is 0. ; For longer flag arrays, see FlagAction. push hl push bc ; Divide by 8 to get the byte we want. push bc srl c srl c srl c ld b, 0 add hl, bc pop bc ; Which bit we want from the byte ld a, c and 7 ld c, a ; Shift left until we can mask the bit ld a, 1 jr z, .shifted .shift add a dec c jr nz, .shift .shifted ld c, a ; What are we doing to this flag? dec b jr z, .set ; 1 dec b jr z, .check ; 2 .reset ld a, c cpl and [hl] ld [hl], a jr .done .set ld a, [hl] or c ld [hl], a jr .done .check ld a, d cp 0 jr nz, .farcheck ld a, [hl] and c jr .done .farcheck call GetFarByte and c .done pop bc pop hl ld c, a ret
data/jpred4/jp_batch_1613899824__igafGhJ/jp_batch_1613899824__igafGhJ.als
jonriege/predict-protein-structure
0
2612
SILENT_MODE BLOCK_FILE jp_batch_1613899824__igafGhJ.concise.blc MAX_NSEQ 865 MAX_INPUT_LEN 867 OUTPUT_FILE jp_batch_1613899824__igafGhJ.concise.ps PORTRAIT POINTSIZE 8 IDENT_WIDTH 12 X_OFFSET 2 Y_OFFSET 2 DEFINE_FONT 0 Helvetica DEFAULT DEFINE_FONT 1 Helvetica REL 0.75 DEFINE_FONT 7 Helvetica REL 0.6 DEFINE_FONT 3 Helvetica-Bold DEFAULT DEFINE_FONT 4 Times-Bold DEFAULT DEFINE_FONT 5 Helvetica-BoldOblique DEFAULT # DEFINE_COLOUR 3 1 0.62 0.67 # Turquiose DEFINE_COLOUR 4 1 1 0 # Yellow DEFINE_COLOUR 5 1 0 0 # Red DEFINE_COLOUR 7 1 0 1 # Purple DEFINE_COLOUR 8 0 0 1 # Blue DEFINE_COLOUR 9 0 1 0 # Green DEFINE_COLOUR 10 0.41 0.64 1.00 # Pale blue DEFINE_COLOUR 11 0.41 0.82 0.67 # Pale green DEFINE_COLOUR 50 0.69 0.18 0.37 # Pink (helix) DEFINE_COLOUR 51 1.00 0.89 0.00 # Gold (strand) NUMBER_INT 10 SETUP # # Highlight specific residues. # Avoid highlighting Lupas 'C' predictions by # limiting the highlighting to the alignments Scol_CHARS C 1 1 146 854 4 Ccol_CHARS H ALL 5 Ccol_CHARS P ALL 8 SURROUND_CHARS LIV ALL # # Replace known structure types with whitespace SUB_CHARS 1 855 146 864 H SPACE SUB_CHARS 1 855 146 864 E SPACE SUB_CHARS 1 855 146 864 - SPACE HELIX 5 858 16 COLOUR_TEXT_REGION 5 858 16 858 50 HELIX 22 858 34 COLOUR_TEXT_REGION 22 858 34 858 50 HELIX 37 858 42 COLOUR_TEXT_REGION 37 858 42 858 50 HELIX 52 858 53 COLOUR_TEXT_REGION 52 858 53 858 50 HELIX 58 858 76 COLOUR_TEXT_REGION 58 858 76 858 50 HELIX 84 858 92 COLOUR_TEXT_REGION 84 858 92 858 50 HELIX 103 858 117 COLOUR_TEXT_REGION 103 858 117 858 50 HELIX 124 858 143 COLOUR_TEXT_REGION 124 858 143 858 50 HELIX 5 863 17 COLOUR_TEXT_REGION 5 863 17 863 50 HELIX 22 863 41 COLOUR_TEXT_REGION 22 863 41 863 50 HELIX 51 863 53 COLOUR_TEXT_REGION 51 863 53 863 50 HELIX 58 863 76 COLOUR_TEXT_REGION 58 863 76 863 50 HELIX 82 863 92 COLOUR_TEXT_REGION 82 863 92 863 50 HELIX 103 863 117 COLOUR_TEXT_REGION 103 863 117 863 50 HELIX 124 863 144 COLOUR_TEXT_REGION 124 863 144 863 50 HELIX 5 864 14 COLOUR_TEXT_REGION 5 864 14 864 50 HELIX 24 864 34 COLOUR_TEXT_REGION 24 864 34 864 50 HELIX 37 864 43 COLOUR_TEXT_REGION 37 864 43 864 50 HELIX 53 864 53 COLOUR_TEXT_REGION 53 864 53 864 50 HELIX 58 864 76 COLOUR_TEXT_REGION 58 864 76 864 50 HELIX 84 864 91 COLOUR_TEXT_REGION 84 864 91 864 50 HELIX 108 864 117 COLOUR_TEXT_REGION 108 864 117 864 50 HELIX 124 864 143 COLOUR_TEXT_REGION 124 864 143 864 50
core/lib/types/Wedge.agda
timjb/HoTT-Agda
294
1217
{-# OPTIONS --without-K --rewriting #-} open import lib.Basics open import lib.types.Coproduct open import lib.types.Paths open import lib.types.Pointed open import lib.types.Pushout open import lib.types.PushoutFlattening open import lib.types.PushoutFmap open import lib.types.Sigma open import lib.types.Span open import lib.types.Unit -- Wedge of two pointed types is defined as a particular case of pushout module lib.types.Wedge where module _ {i j} (X : Ptd i) (Y : Ptd j) where ⊙∨-span : ⊙Span ⊙∨-span = ⊙span X Y ⊙Unit ⊙cst ⊙cst ⊙wedge-span = ⊙∨-span ∨-span : Span ∨-span = ⊙Span-to-Span ⊙∨-span wedge-span = ∨-span Wedge : Type (lmax i j) Wedge = Pushout wedge-span infix 80 _∨_ _∨_ = Wedge ⊙Wedge : Ptd (lmax i j) ⊙Wedge = ⊙Pushout ⊙wedge-span infix 80 _⊙∨_ _⊙∨_ = ⊙Wedge module _ {i j} {X : Ptd i} {Y : Ptd j} where winl : de⊙ X → X ∨ Y winl x = left x winr : de⊙ Y → X ∨ Y winr y = right y wglue : winl (pt X) == winr (pt Y) wglue = glue tt ⊙winl : X ⊙→ X ⊙∨ Y ⊙winl = (winl , idp) ⊙winr : Y ⊙→ X ⊙∨ Y ⊙winr = (winr , ! wglue) module WedgeElim {k} {P : X ∨ Y → Type k} (winl* : (x : de⊙ X) → P (winl x)) (winr* : (y : de⊙ Y) → P (winr y)) (glue* : winl* (pt X) == winr* (pt Y) [ P ↓ wglue ]) where private module M = PushoutElim winl* winr* (λ _ → glue*) f = M.f glue-β = M.glue-β unit ∨-elim = WedgeElim.f Wedge-elim = WedgeElim.f module WedgeRec {k} {C : Type k} (winl* : de⊙ X → C) (winr* : de⊙ Y → C) (glue* : winl* (pt X) == winr* (pt Y)) where private module M = PushoutRec {d = wedge-span X Y} winl* winr* (λ _ → glue*) f = M.f glue-β = M.glue-β unit ∨-rec = WedgeRec.f Wedge-rec = WedgeRec.f module ⊙WedgeRec {k} {Z : Ptd k} (g : X ⊙→ Z) (h : Y ⊙→ Z) where open WedgeRec (fst g) (fst h) (snd g ∙ ! (snd h)) public ⊙f : X ⊙∨ Y ⊙→ Z ⊙f = (f , snd g) ⊙winl-β : ⊙f ⊙∘ ⊙winl == g ⊙winl-β = idp ⊙winr-β : ⊙f ⊙∘ ⊙winr == h ⊙winr-β = ⊙λ=' (λ _ → idp) lemma where abstract lemma : snd (⊙f ⊙∘ ⊙winr) == snd h lemma = ap (_∙ snd g) (ap-! f wglue ∙ ap ! glue-β ∙ !-∙ (snd g) (! (snd h))) ∙ ∙-assoc (! (! (snd h))) (! (snd g)) (snd g) ∙ ap (! (! (snd h)) ∙_) (!-inv-l (snd g)) ∙ ∙-unit-r (! (! (snd h))) ∙ !-! (snd h) ⊙∨-rec = ⊙WedgeRec.⊙f ⊙Wedge-rec = ⊙WedgeRec.⊙f ⊙Wedge-rec-post∘ : ∀ {k l} {Z : Ptd k} {W : Ptd l} (k : Z ⊙→ W) (g : X ⊙→ Z) (h : Y ⊙→ Z) → k ⊙∘ ⊙Wedge-rec g h ⊙∼ ⊙Wedge-rec (k ⊙∘ g) (k ⊙∘ h) ⊙Wedge-rec-post∘ k g h = (Wedge-elim (λ _ → idp) (λ _ → idp) (↓-='-in' $ ⊙WedgeRec.glue-β (k ⊙∘ g) (k ⊙∘ h) ∙ lemma (fst k) (snd g) (snd h) (snd k) ∙ ! (ap (ap (fst k)) (⊙WedgeRec.glue-β g h)) ∙ ∘-ap (fst k) (fst (⊙Wedge-rec g h)) wglue)) , idp where lemma : ∀ {i j} {A : Type i} {B : Type j} (f : A → B) {x y z : A} {w : B} (p : x == z) (q : y == z) (r : f z == w) → (ap f p ∙ r) ∙ ! (ap f q ∙ r) == ap f (p ∙ ! q) lemma f idp idp idp = idp ⊙∨-rec-post∘ = ⊙Wedge-rec-post∘ ⊙Wedge-rec-η : ⊙Wedge-rec ⊙winl ⊙winr == ⊙idf (X ⊙∨ Y) ⊙Wedge-rec-η = ⊙λ=' (Wedge-elim (λ _ → idp) (λ _ → idp) (↓-='-in' $ ap-idf wglue ∙ ! (!-! wglue) ∙ ! (⊙WedgeRec.glue-β ⊙winl ⊙winr))) idp ⊙∨-rec-η = ⊙Wedge-rec-η add-wglue : de⊙ (X ⊙⊔ Y) → X ∨ Y add-wglue (inl x) = winl x add-wglue (inr y) = winr y ⊙add-wglue : X ⊙⊔ Y ⊙→ X ⊙∨ Y ⊙add-wglue = add-wglue , idp module Projl = ⊙WedgeRec (⊙idf X) (⊙cst {X = Y}) module Projr = ⊙WedgeRec (⊙cst {X = X}) (⊙idf Y) projl = Projl.f projr = Projr.f ⊙projl = Projl.⊙f ⊙projr = Projr.⊙f module WedgeToProduct = ⊙WedgeRec ((_, pt Y) , idp) ((pt X ,_), idp) ∨-⊙to-× : X ⊙∨ Y ⊙→ X ⊙× Y ∨-⊙to-× = WedgeToProduct.⊙f ∨-to-× : X ∨ Y → de⊙ (X ⊙× Y) ∨-to-× = WedgeToProduct.f ∨-to-×-glue-β : ap ∨-to-× wglue == idp ∨-to-×-glue-β = WedgeToProduct.glue-β abstract ↓-∨to×=cst-in : ∀ {x y} {p p' : (pt X , pt Y) == (x , y)} → p == p' → p == p' [ (λ w → ∨-to-× w == (x , y)) ↓ wglue ] ↓-∨to×=cst-in {p' = idp} q = ↓-app=cst-in' (q ∙ ! WedgeToProduct.glue-β) ↓-∨to×=cst-out : ∀ {x y} {p p' : (pt X , pt Y) == (x , y)} → p == p' [ (λ w → ∨-to-× w == (x , y)) ↓ wglue ] → p == p' ↓-∨to×=cst-out {p' = idp} q = ↓-app=cst-out' q ∙ WedgeToProduct.glue-β ↓-∨to×=cst-β : ∀ {x y} {p p' : (pt X , pt Y) == (x , y)} (q : p == p') → ↓-∨to×=cst-out (↓-∨to×=cst-in q) == q ↓-∨to×=cst-β {p' = idp} idp = ap (_∙ WedgeToProduct.glue-β) (↓-app=cst-β' {p = wglue} (! WedgeToProduct.glue-β)) ∙ !-inv-l WedgeToProduct.glue-β ↓-∨to×=cst-η : ∀ {x y} {p p' : (pt X , pt Y) == (x , y)} (q : p == p' [ (λ w → ∨-to-× w == (x , y)) ↓ wglue ]) → ↓-∨to×=cst-in (↓-∨to×=cst-out q) == q ↓-∨to×=cst-η {p = p} {p' = idp} q = ap ↓-app=cst-in' ( ∙-assoc (↓-app=cst-out' q) WedgeToProduct.glue-β (! WedgeToProduct.glue-β) ∙ ap (↓-app=cst-out' q ∙_) (!-inv-r WedgeToProduct.glue-β) ∙ ∙-unit-r (↓-app=cst-out' q)) ∙ ↓-app=cst-η' q module Fold {i} {X : Ptd i} = ⊙WedgeRec (⊙idf X) (⊙idf X) fold = Fold.f ⊙fold = Fold.⊙f module _ {i i' j j'} {X : Ptd i} {X' : Ptd i'} {Y : Ptd j} {Y' : Ptd j'} (fX : X ⊙→ X') (fY : Y ⊙→ Y') where wedge-span-map : SpanMap (wedge-span X Y) (wedge-span X' Y') wedge-span-map = span-map (fst fX) (fst fY) (idf _) (comm-sqr λ _ → snd fX) (comm-sqr λ _ → snd fY) module WedgeFmap where private module M = PushoutFmap wedge-span-map f = M.f glue-β = M.glue-β unit ∨-fmap : X ∨ Y → X' ∨ Y' ∨-fmap = WedgeFmap.f ⊙∨-fmap : X ⊙∨ Y ⊙→ X' ⊙∨ Y' ⊙∨-fmap = ∨-fmap , ap winl (snd fX) Wedge-fmap = ∨-fmap ⊙Wedge-fmap = ⊙∨-fmap module _ {i₀ i₁ i₂ j₀ j₁ j₂} {X₀ : Ptd i₀} {X₁ : Ptd i₁} {X₂ : Ptd i₂} {Y₀ : Ptd j₀} {Y₁ : Ptd j₁} {Y₂ : Ptd j₂} where ∨-fmap-∘ : (gX : X₁ ⊙→ X₂) (fX : X₀ ⊙→ X₁) (gY : Y₁ ⊙→ Y₂) (fY : Y₀ ⊙→ Y₁) → ∨-fmap (gX ⊙∘ fX) (gY ⊙∘ fY) ∼ ∨-fmap gX gY ∘ ∨-fmap fX fY ∨-fmap-∘ (gX , idp) (fX , idp) (gY , idp) (fY , idp) = Pushout-fmap-∘ (wedge-span-map (gX , idp) (gY , idp)) (wedge-span-map (fX , idp) (fY , idp)) ⊙∨-fmap-∘ : (gX : X₁ ⊙→ X₂) (fX : X₀ ⊙→ X₁) (gY : Y₁ ⊙→ Y₂) (fY : Y₀ ⊙→ Y₁) → ⊙∨-fmap (gX ⊙∘ fX) (gY ⊙∘ fY) ⊙∼ ⊙∨-fmap gX gY ⊙∘ ⊙∨-fmap fX fY ⊙∨-fmap-∘ (gX , idp) (fX , idp) (gY , idp) (fY , idp) = ∨-fmap-∘ (gX , idp) (fX , idp) (gY , idp) (fY , idp) , idp Wedge-fmap-∘ = ∨-fmap-∘ ⊙Wedge-fmap-∘ = ⊙∨-fmap-∘ module _ {i i' j j'} {X : Ptd i} {X' : Ptd i'} {Y : Ptd j} {Y' : Ptd j'} (eqX : X ⊙≃ X') (eqY : Y ⊙≃ Y') where wedge-span-emap : SpanEquiv (wedge-span X Y) (wedge-span X' Y') wedge-span-emap = wedge-span-map (⊙–> eqX) (⊙–> eqY) , snd eqX , snd eqY , idf-is-equiv _ ∨-emap : X ∨ Y ≃ X' ∨ Y' ∨-emap = Pushout-emap wedge-span-emap ⊙∨-emap : X ⊙∨ Y ⊙≃ X' ⊙∨ Y' ⊙∨-emap = ≃-to-⊙≃ ∨-emap (ap winl (⊙–>-pt eqX)) Wedge-emap = ∨-emap ⊙Wedge-emap = ⊙∨-emap module _ {i i' j j' k} {X : Ptd i} {X' : Ptd i'} {Y : Ptd j} {Y' : Ptd j'} {Z : Ptd k} (winl* : X' ⊙→ Z) (winr* : Y' ⊙→ Z) (f : X ⊙→ X') (g : Y ⊙→ Y') where ⊙Wedge-rec-fmap : ⊙Wedge-rec winl* winr* ⊙∘ ⊙∨-fmap f g ⊙∼ ⊙Wedge-rec (winl* ⊙∘ f) (winr* ⊙∘ g) ⊙Wedge-rec-fmap = Wedge-elim (λ _ → idp) (λ _ → idp) (↓-='-in' $ ! $ lemma₀ winl* winr* f g) , lemma₁ winl* winr* f where abstract lemma₀ : ∀ {X' Y' Z} (winl* : X' ⊙→ Z) (winr* : Y' ⊙→ Z) (f : X ⊙→ X') (g : Y ⊙→ Y') → ap (⊙WedgeRec.f winl* winr* ∘ ∨-fmap f g) wglue == ap (⊙WedgeRec.f (winl* ⊙∘ f) (winr* ⊙∘ g)) wglue lemma₀ (winl* , idp) (winr* , winr*-pt) (f , idp) (g , idp) = ap (Wedge-rec winl* winr* (! winr*-pt) ∘ ∨-fmap (f , idp) (g , idp)) wglue =⟨ ap-∘ (Wedge-rec winl* winr* (! winr*-pt)) (∨-fmap (f , idp) (g , idp)) wglue ⟩ ap (Wedge-rec winl* winr* (! winr*-pt)) (ap (∨-fmap (f , idp) (g , idp)) wglue) =⟨ ap (ap (Wedge-rec winl* winr* (! winr*-pt))) $ WedgeFmap.glue-β (f , idp) (g , idp) ⟩ ap (Wedge-rec winl* winr* (! winr*-pt)) wglue =⟨ WedgeRec.glue-β winl* winr* (! winr*-pt) ⟩ ! winr*-pt =⟨ ! $ WedgeRec.glue-β (winl* ∘ f) (winr* ∘ g) (! winr*-pt) ⟩ ap (Wedge-rec (winl* ∘ f) (winr* ∘ g) (! winr*-pt)) wglue =∎ lemma₁ : ∀ {X' Z} (winl* : X' ⊙→ Z) (winr* : Y' ⊙→ Z) (f : X ⊙→ X') → snd (⊙Wedge-rec winl* winr* ⊙∘ ⊙∨-fmap f g) == snd (⊙Wedge-rec (winl* ⊙∘ f) (winr* ⊙∘ g)) lemma₁ (f , idp) _ (winl* , idp) = idp ⊙∨-rec-fmap = ⊙Wedge-rec-fmap module _ {i i' j j'} {X : Ptd i} {X' : Ptd i'} {Y : Ptd j} {Y' : Ptd j'} (f : X ⊙→ X') (g : Y ⊙→ Y') where ⊙projl-fmap : ⊙projl ⊙∘ ⊙∨-fmap f g ⊙∼ ⊙Wedge-rec f ⊙cst ⊙projl-fmap = Wedge-elim (λ _ → idp) (λ _ → idp) (↓-='-in' $ ! $ lemma₀ f g) , lemma₁ f g where abstract lemma₀ : ∀ {X' Y'} (f : X ⊙→ X') (g : Y ⊙→ Y') → ap (projl ∘ ∨-fmap f g) wglue == ap (⊙WedgeRec.f f ⊙cst) wglue lemma₀ (f , idp) (g , idp) = ap (projl ∘ ∨-fmap (f , idp) (g , idp)) wglue =⟨ ap-∘ projl (∨-fmap (f , idp) (g , idp)) wglue ⟩ ap projl (ap (∨-fmap (f , idp) (g , idp)) wglue) =⟨ ap (ap projl) (WedgeFmap.glue-β (f , idp) (g , idp)) ⟩ ap projl wglue =⟨ Projl.glue-β ⟩ idp =⟨ ! $ ⊙WedgeRec.glue-β (f , idp) ⊙cst ⟩ ap (⊙WedgeRec.f (f , idp) ⊙cst) wglue =∎ lemma₁ : ∀ {X' Y'} (f : X ⊙→ X') (g : Y ⊙→ Y') → snd (⊙projl ⊙∘ ⊙∨-fmap f g) == snd (⊙Wedge-rec {Y = Y} f ⊙cst) lemma₁ (f , idp) (g , idp) = idp ⊙projr-fmap : ⊙projr ⊙∘ ⊙∨-fmap f g ⊙∼ ⊙Wedge-rec ⊙cst g ⊙projr-fmap = Wedge-elim (λ _ → idp) (λ _ → idp) (↓-='-in' $ ! $ lemma₀ f g) , lemma₁ f g where abstract lemma₀ : ∀ {X' Y'} (f : X ⊙→ X') (g : Y ⊙→ Y') → ap (projr ∘ ∨-fmap f g) wglue == ap (⊙WedgeRec.f ⊙cst g) wglue lemma₀ (f , idp) (g , idp) = ap (projr ∘ ∨-fmap (f , idp) (g , idp)) wglue =⟨ ap-∘ projr (∨-fmap (f , idp) (g , idp)) wglue ⟩ ap projr (ap (∨-fmap (f , idp) (g , idp)) wglue) =⟨ ap (ap projr) (WedgeFmap.glue-β (f , idp) (g , idp)) ⟩ ap projr wglue =⟨ Projr.glue-β ⟩ idp =⟨ ! $ ⊙WedgeRec.glue-β ⊙cst (g , idp) ⟩ ap (⊙WedgeRec.f ⊙cst (g , idp)) wglue =∎ lemma₁ : ∀ {X' Y'} (f : X ⊙→ X') (g : Y ⊙→ Y') → snd (⊙projr ⊙∘ ⊙∨-fmap f g) == snd (⊙Wedge-rec {X = X} ⊙cst g) lemma₁ (f , idp) (g , idp) = idp module _ {i j k} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} (f : X ⊙→ Z) (g : Y ⊙→ Z) where {- favonia: This is a special case, but still proved separately to make sure it has good computational content. (Maybe this is overkilling.) -} ⊙fold-fmap : ⊙fold ⊙∘ ⊙∨-fmap f g ⊙∼ ⊙Wedge-rec f g ⊙fold-fmap = Wedge-elim (λ _ → idp) (λ _ → idp) (↓-='-in' $ ! $ lemma₀ f g) , lemma₁ f g where abstract lemma₀ : ∀ {Z} (f : X ⊙→ Z) (g : Y ⊙→ Z) → ap (⊙WedgeRec.f (⊙idf _) (⊙idf _) ∘ ∨-fmap f g) wglue == ap (⊙WedgeRec.f f g) wglue lemma₀ (f , idp) (g , g-pt) = ap (⊙WedgeRec.f (⊙idf _) (⊙idf _) ∘ ∨-fmap (f , idp) (g , g-pt)) wglue =⟨ ap-∘ (⊙WedgeRec.f (⊙idf _) (⊙idf _)) (∨-fmap (f , idp) (g , g-pt)) wglue ⟩ ap (⊙WedgeRec.f (⊙idf _) (⊙idf _)) (ap (∨-fmap (f , idp) (g , g-pt)) wglue) =⟨ ap (ap (⊙WedgeRec.f (⊙idf _) (⊙idf _))) (WedgeFmap.glue-β (f , idp) (g , g-pt)) ⟩ ap (⊙WedgeRec.f (⊙idf _) (⊙idf _)) (wglue ∙' ap winr (! g-pt)) =⟨ ap-∙' (⊙WedgeRec.f (⊙idf _) (⊙idf _)) wglue (ap winr (! g-pt)) ⟩ ap (⊙WedgeRec.f (⊙idf _) (⊙idf _)) wglue ∙' ap (⊙WedgeRec.f (⊙idf _) (⊙idf _)) (ap winr (! g-pt)) =⟨ ap2 _∙'_ (⊙WedgeRec.glue-β (⊙idf _) (⊙idf _)) ( ∘-ap (⊙WedgeRec.f (⊙idf _) (⊙idf _)) winr (! g-pt) ∙ ap-idf (! g-pt)) ⟩ idp ∙' ! g-pt =⟨ ∙'-unit-l (! g-pt) ⟩ ! g-pt =⟨ ! $ ⊙WedgeRec.glue-β (f , idp) (g , g-pt) ⟩ ap (⊙WedgeRec.f (f , idp) (g , g-pt) ) wglue =∎ lemma₁ : ∀ {Z} (f : X ⊙→ Z) (g : Y ⊙→ Z) → snd (⊙Wedge-rec (⊙idf _) (⊙idf _) ⊙∘ ⊙∨-fmap f g) == snd (⊙Wedge-rec f g) lemma₁ (f , idp) (g , g-pt) = idp module _ {i j k} (X : Ptd i) (Y : Ptd j) (Z : Ptd k) where module WedgeAssocInl = WedgeRec {C = X ∨ (Y ⊙∨ Z)} winl (winr ∘ winl) wglue module WedgeAssoc = WedgeRec {X = X ⊙∨ Y} WedgeAssocInl.f (winr ∘ winr) (wglue ∙ ap winr wglue) ∨-assoc : (X ⊙∨ Y) ∨ Z ≃ X ∨ (Y ⊙∨ Z) ∨-assoc = equiv to from to-from from-to where to : (X ⊙∨ Y) ∨ Z → X ∨ (Y ⊙∨ Z) to = WedgeAssoc.f module FromInr = WedgeRec {C = (X ⊙∨ Y) ∨ Z} (winl ∘ winr) winr (! (ap winl wglue) ∙ wglue) module From = WedgeRec {Y = Y ⊙∨ Z} (winl ∘ winl) FromInr.f (ap winl wglue) from : X ∨ (Y ⊙∨ Z) → (X ⊙∨ Y) ∨ Z from = From.f abstract to-from : ∀ x → to (from x) == x to-from = Wedge-elim (λ x → idp) (Wedge-elim (λ y → idp) (λ z → idp) $ ↓-='-in' $ ! $ ap (to ∘ FromInr.f) wglue =⟨ ap-∘ to FromInr.f wglue ⟩ ap to (ap FromInr.f wglue) =⟨ ap (ap to) FromInr.glue-β ⟩ ap to (! (ap winl wglue) ∙ wglue) =⟨ ap-∙ to (! (ap winl wglue)) wglue ⟩ ap to (! (ap winl wglue)) ∙ ap to wglue =⟨ _∙2_ (ap-! to (ap winl wglue) ∙ ap ! (∘-ap to winl wglue ∙ WedgeAssocInl.glue-β)) WedgeAssoc.glue-β ⟩ ! wglue ∙ wglue ∙ ap winr wglue =⟨ ! $ ∙-assoc (! wglue) wglue (ap winr wglue) ⟩ (! wglue ∙ wglue) ∙ ap winr wglue =⟨ ap (_∙ ap winr wglue) (!-inv-l wglue) ⟩ ap winr wglue =∎) (↓-∘=idf-in' to from (ap (ap to) From.glue-β ∙ ∘-ap to winl wglue ∙ WedgeAssocInl.glue-β)) from-to : ∀ x → from (to x) == x from-to = Wedge-elim (Wedge-elim (λ x → idp) (λ y → idp) $ ↓-='-in' $ ! $ ap-∘ from WedgeAssocInl.f wglue ∙ ap (ap from) WedgeAssocInl.glue-β ∙ From.glue-β) (λ z → idp) (↓-∘=idf-in' from to $ ap from (ap to wglue) =⟨ ap (ap from) WedgeAssoc.glue-β ⟩ ap from (wglue ∙ ap winr wglue) =⟨ ap-∙ from wglue (ap winr wglue) ⟩ ap from wglue ∙ ap from (ap winr wglue) =⟨ From.glue-β ∙2 (∘-ap from winr wglue ∙ FromInr.glue-β) ⟩ ap winl wglue ∙ ! (ap winl wglue) ∙ wglue =⟨ ! $ ∙-assoc (ap winl wglue) (! (ap winl wglue)) wglue ⟩ (ap winl wglue ∙ ! (ap winl wglue)) ∙ wglue =⟨ ap (_∙ wglue) (!-inv-r (ap winl wglue)) ⟩ wglue =∎) ⊙∨-assoc : (X ⊙∨ Y) ⊙∨ Z ⊙≃ X ⊙∨ (Y ⊙∨ Z) ⊙∨-assoc = ≃-to-⊙≃ ∨-assoc idp {- module _ {i₀ i₁ j₀ j₁ k₀ k₁} {X₀ : Ptd i₀} {Y₀ : Ptd j₀} {Z₀ : Ptd k₀} {X₁ : Ptd i₁} {Y₁ : Ptd j₁} {Z₁ : Ptd k₁} where ⊙∨-assoc-nat : ∀ (f : X₀ ⊙→ X₁) (g : Y₀ ⊙→ Y₁) (h : Z₀ ⊙→ Z₁) → ⊙–> (⊙∨-assoc X₁ Y₁ Z₁) ⊙∘ ⊙∨-fmap (⊙∨-fmap f g) h ⊙∼ ⊙∨-fmap f (⊙∨-fmap g h) ⊙∘ ⊙–> (⊙∨-assoc X₀ Y₀ Z₀) ⊙∨-assoc-nat (f , idp) (g , idp) (h , idp) = (Wedge-elim -- {P = –> (∨-assoc X₁ Y₁ Z₁) ∘ ∨-fmap (⊙∨-fmap f g) h ∼ ∨-fmap f (⊙∨-fmap g h) ∘ –> (∨-assoc X₀ Y₀ Z₀)} (Wedge-elim (λ _ → idp) (λ _ → idp) (↓-='-in' $ ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp)) ∘ WedgeAssocInl.f X₀ Y₀ Z₀) wglue =⟨ ap-∘ (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp))) (WedgeAssocInl.f X₀ Y₀ Z₀) wglue ⟩ ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp))) (ap (WedgeAssocInl.f X₀ Y₀ Z₀) wglue) =⟨ ap (ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp)))) (WedgeAssocInl.glue-β X₀ Y₀ Z₀) ⟩ ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp))) wglue =⟨ WedgeFmap.glue-β (f , idp) (⊙∨-fmap (g , idp) (h , idp)) ⟩ wglue =⟨ ! $ WedgeAssocInl.glue-β X₁ Y₁ Z₁ ⟩ ap (WedgeAssocInl.f X₁ Y₁ Z₁) wglue =⟨ ! $ ap (ap (WedgeAssocInl.f X₁ Y₁ Z₁)) $ WedgeFmap.glue-β (f , idp) (g , idp) ⟩ ap (WedgeAssocInl.f X₁ Y₁ Z₁) (ap (∨-fmap (f , idp) (g , idp)) wglue) =⟨ ∘-ap (WedgeAssocInl.f X₁ Y₁ Z₁) (∨-fmap (f , idp) (g , idp)) wglue ⟩ ap (WedgeAssocInl.f X₁ Y₁ Z₁ ∘ ∨-fmap (f , idp) (g , idp)) wglue =∎)) (λ _ → idp) (↓-='-in' $ ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp)) ∘ WedgeAssoc.f X₀ Y₀ Z₀) wglue =⟨ ap-∘ (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp))) (WedgeAssoc.f X₀ Y₀ Z₀) wglue ⟩ ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp))) (ap (WedgeAssoc.f X₀ Y₀ Z₀) wglue) =⟨ ap (ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp)))) (WedgeAssoc.glue-β X₀ Y₀ Z₀) ⟩ ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp))) (wglue ∙ ap winr wglue) =⟨ ap-∙ (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp))) wglue (ap winr wglue) ⟩ ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp))) wglue ∙ ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp))) (ap winr wglue) =⟨ ap2 _∙_ (WedgeFmap.glue-β (f , idp) (⊙∨-fmap (g , idp) (h , idp))) ( ∘-ap (∨-fmap (f , idp) (⊙∨-fmap (g , idp) (h , idp))) winr wglue ∙ ap-∘ winr (∨-fmap (g , idp) (h , idp)) wglue ∙ ap (ap winr) (WedgeFmap.glue-β (g , idp) (h , idp))) ⟩ wglue ∙ ap winr wglue =⟨ ! $ WedgeAssoc.glue-β X₁ Y₁ Z₁ ⟩ ap (WedgeAssoc.f X₁ Y₁ Z₁) wglue =⟨ ! $ ap (ap (WedgeAssoc.f X₁ Y₁ Z₁)) $ WedgeFmap.glue-β (⊙∨-fmap (f , idp) (g , idp)) (h , idp) ⟩ ap (WedgeAssoc.f X₁ Y₁ Z₁) (ap (∨-fmap (⊙∨-fmap (f , idp) (g , idp)) (h , idp)) wglue) =⟨ ∘-ap (WedgeAssoc.f X₁ Y₁ Z₁) (∨-fmap (⊙∨-fmap (f , idp) (g , idp)) (h , idp)) wglue ⟩ ap (WedgeAssoc.f X₁ Y₁ Z₁ ∘ ∨-fmap (⊙∨-fmap (f , idp) (g , idp)) (h , idp)) wglue =∎)) , idp -} module _ {i j k l} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} {W : Ptd l} (f : X ⊙→ W) (g : Y ⊙→ W) (h : Z ⊙→ W) where ⊙Wedge-rec-assoc : ⊙Wedge-rec (⊙Wedge-rec f g) h ⊙∼ ⊙Wedge-rec f (⊙Wedge-rec g h) ⊙∘ ⊙–> (⊙∨-assoc X Y Z) ⊙Wedge-rec-assoc = (Wedge-elim (Wedge-elim (λ x → idp) (λ y → idp) (↓-='-in' $ ap-∘ (⊙WedgeRec.f f (⊙Wedge-rec g h)) (WedgeAssocInl.f X Y Z) wglue ∙ ap (ap (⊙WedgeRec.f f (⊙Wedge-rec g h))) (WedgeAssocInl.glue-β X Y Z) ∙ ⊙WedgeRec.glue-β f (⊙Wedge-rec g h) ∙ ! (⊙WedgeRec.glue-β f g))) (λ z → idp) (↓-='-in' $ ap-∘ (⊙WedgeRec.f f (⊙Wedge-rec g h)) (WedgeAssoc.f X Y Z) wglue ∙ ap (ap (⊙WedgeRec.f f (⊙Wedge-rec g h))) (WedgeAssoc.glue-β X Y Z) ∙ ap-∙ (⊙WedgeRec.f f (⊙Wedge-rec g h)) wglue (ap winr wglue) ∙ _∙2_ (⊙WedgeRec.glue-β f (⊙Wedge-rec g h)) ( ∘-ap (⊙WedgeRec.f f (⊙Wedge-rec g h)) winr wglue ∙ ⊙WedgeRec.glue-β g h) ∙ ∙-assoc (snd f) (! (snd g)) (snd g ∙ ! (snd h)) ∙ ap (snd f ∙_) (! $ ∙-assoc (! (snd g)) (snd g) (! (snd h))) ∙ ap (λ p → snd f ∙ p ∙ ! (snd h)) (!-inv-l (snd g)) ∙ ! (⊙WedgeRec.glue-β (⊙Wedge-rec f g) h))) , idp ⊙∨-rec-assoc = ⊙Wedge-rec-assoc
mpmc lab assignment/ex.asm
apurvjain9999/Microprocessor-8085
0
171947
LXI SP, 2500H ; Initialize SP to save and retrieve register’s data onto/from stack during execution CALL and subroutine LXI H, 2200H ; initialize data pointer to get the get the length of block of BCD numbers i.e. HL=2200H LXI B, time delay ; load BC reg. pair with specified delay time whatever we want. MOV D, M ; get the length of block in register D to set the counter INX H ; increment data pointer to get the first packed BCD number i.e. HL=2201H CALL UNPACK ; call subroutine to unpack the packed BCD number HLT UNPACK: MOV A,M ; get the packed BCD number pointed by data pointer HL ANI 0FH ; mask upper nibble to get lower (unpacked) BCD number CALL DISPLAY ; call the display subroutine for lower BCD number MOV A, M ; get the packed BCD number again to get upper (unpacked) BCD ANI F0H ; mask lower nibble i.e. A=X0 RRC RRC ;swap A i.e. A=0X RRC RRC CALL DISPLAY ; call the display subroutine for upper BCD number INX H ; increment data pointer HL by one to get next packed BCD number DCR D ; decrement counter by one JNZ UNPACK ; check the counter is 0 or not. If D is not 0, jump to UNPACK, to display next packed BCD number. RET ; i block of BCD is displayed return to main program DISPLAY: PUSH H ; save the data pointer HL contents on stack LXI H, 2304 ; load the HL reg. pair with look-up-table starting address ADD L ; add the contents of register L with contents of A i.e. A=contents of A+04H MOV L,A ; copied A into register L i.e. L=A MOV A,M ; get the contents of memory location pointed by HL reg. pair OUT 05H ; send the 7-segment code of BCD number to the 05 port to display. CALL DELAY ; keep the BCD number display for specified time POP H ; get back the contents of stack pointed by SP into HL register pair RET ; return to the UNPACK subroutine DELAY: DCX B MOV A, B ORA C JNZ DELAY RET
asm/math.asm
KrisDavie/ALttPDoorRandomizer
42
178921
;divide by 2 example ; 0 1 2 3 4 5 6 7 8 9 a b c d e f 10--Offset Ruler ;v 00 01 01 02 02 03 03 04 04 04 05 05 06 06 07 07 08 ;divide by 3 example ; 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 ;00 00 01 01 01 02 02 02 03 03 03 04 04 04 05 05 05 06 06 06 07 07 07 08 08 MultiplyByY: .loop cpy #$0001 : beq .done cpy #$0003 : bne ++ jsr MultiBy3 : bra .done ++ cpy #$0005 : bne ++ jsr MultiBy5 : bra .done ++ asl : sta $00 : tya : lsr : tay : lda $00 : bra .loop .done rts ;Divisor in Y. Width of division is in X for rounding toward middle DivideByY: .loop cpy #$0000 : beq .done cpy #$0001 : beq .done cpy #$0003 : bne ++ jsr DivideBy3 : bra .done ++ cpy #$0005 : bne ++ jsr DivideBy5 : bra .done ++ jsr DivideBy2 : sta $00 tya : lsr : tay txa : lsr : tax lda $00 : bra .loop .done rts MultiBy3: sta $00 : asl : !add $00 rts MultiBy5: sta $00 : asl #2 : !add $00 rts ;width of divison in x: rounds toward X/2 DivideBy2: sta $00 lsr : bcc .done sta $02 : txa : lsr : cmp $00 : !blt + lda $02 : inc : bra .done + lda $02 .done rts DivideBy3: sta $00 ldx #$0000 lda #$0002 .loop cmp $00 : !bge .store inx : !add #$0003 : bra .loop .store txa rts DivideBy5: sta $00 ldx #$0000 lda #$0003 .loop cmp $00 : !bge .store inx : !add #$0005 : bra .loop .store txa rts
electricforce.asm
petersobolev/electric_force
1
168421
<filename>electricforce.asm ; Electric Force - 233 bytes intro by Frog (for CC'2015) ; http://frog.enlight.ru ; <EMAIL> ; ; rev. 2 (optimized), July 2015 ; (real Vectrex required!) include "vectrex.i" counter equ $C880 ;*************************************************************************** org 0 db "g GCE 2015", $80 ; 'g' is copyright sign dw $F600 ; music from the rom (no music) db $FC, $30, 33, -$36 ; height, width, rel y, rel x db "ELECTRIC FORCE", $80 ; app title, ending with $80 db 0 ; end of header ldx #Char_Table ; just source of some numbers... stx counter loop: jsr Wait_Recal ; recalibrate CRT, reset beam to 0,0 lda #$ff ; scale (max possible) sta <VIA_t1_cnt_lo jsr Intensity_5F ; FRAME EDGE LINES --------------------------- ldd #(60*256+(-64)) ; Y,X jsr Moveto_d ldd #(0*256+(127)) ; Y,X jsr Draw_Line_d ldd #(-102*256+(0)) ; Y,X jsr Moveto_d ldd #(0*256+(-127)) ; Y,X jsr Draw_Line_d ; text ldu #alltext jsr Print_List_hw ; start drawing curve ldy #0 nextcurve: jsr Reset0Ref ; recalibrate crt (x,y = 0) lda #$CE ; /Blank low, /ZERO high sta <VIA_cntl ; enable beam, disable zeroing ldd #(116*256+(30)) ; Y,X jsr Moveto_d lda ,y+ rola jsr Intensity_a ; Draw_Curve begin ; params: y - coeff. to make curves look different ldd #$1881 stb <VIA_port_b ; disable MUX, disable ~RAMP sta <VIA_aux_cntl ; AUX: shift mode 4. PB7 not timer controlled. PB7 is ~RAMP lda #-85 ; Y -86 sta <VIA_port_a ; Y to DAC decb ; b now $80 stb <VIA_port_b ; enable MUX clrb inc <VIA_port_b ; MUX off, only X on DAC now stb <VIA_port_a ; X to DAC incb stb <VIA_port_b ; MUX disable, ~RAMP enable. Start integration ldb #$ff stb <VIA_shift_reg ; pattern ldx #0 tfr y,d exg a,b nextchunk: adca counter rola sta <VIA_port_a ; put X to DAC leax 1,x ; inc x cmpx #12 ; 12 (+1) segments per curve bne nextchunk ldb #$81 ; ramp off, MUX off stb <VIA_port_b lda #$98 sta <VIA_aux_cntl ; restore usual AUX setting (enable PB7 timer, SHIFT mode 4) ; Draw_Curve end ; draw bright end dot ldb #30 ; end dot brightness (hold dot long enough) repeat_dot: decb bne repeat_dot clr <VIA_shift_reg ; Blank beam in VIA shift register cmpy #30 ; number of curves (max. which fit in 30000 cycles) bne nextcurve inc counter bra loop ; Text lines ; height, width, rel y, rel x, string, eol ($80) alltext: db $fc,$20,120,15,'233 BYTES',$80 db $fc,$20,14,-113,'BY FROG',$80 db $fc,$20,-4,-113,'CC',$27,'2015',$80 db $fb,$20,50,-113,'ELECTRIC FORCE',$80 db 0
programs/oeis/063/A063087.asm
neoneye/loda
22
178560
; A063087: Dimension of the space of weight 2n cusp forms for Gamma_0( 19 ). ; 1,4,8,10,14,18,20,24,28,30,34,38,40,44,48,50,54,58,60,64,68,70,74,78,80,84,88,90,94,98,100,104,108,110,114,118,120,124,128,130,134,138,140,144,148,150,154,158,160,164 mul $0,2 mov $1,1 trn $1,$0 add $1,$0 lpb $0 trn $0,3 add $1,2 lpe mov $0,$1
src/Categories/Category/Species.agda
Trebor-Huang/agda-categories
279
939
{-# OPTIONS --without-K --safe #-} module Categories.Category.Species where -- The Category of Species, as the Functor category from Core (FinSetoids) to Setoids. -- Setoids used here because that's what fits best in this setting. -- The constructions of the theory of Species are in Species.Construction open import Level open import Categories.Category.Core using (Category) open import Categories.Category.Construction.Functors open import Categories.Category.Construction.Core using (Core) open import Categories.Category.Instance.FinSetoids using (FinSetoids) open import Categories.Category.Instance.Setoids using (Setoids) private variable o ℓ o′ ℓ′ : Level -- note how Species, as a category, raises levels. Species : (o ℓ o′ ℓ′ : Level) → Category (suc (o ⊔ ℓ ⊔ o′ ⊔ ℓ′)) (suc (o ⊔ ℓ) ⊔ (o′ ⊔ ℓ′)) (suc (o ⊔ ℓ) ⊔ o′ ⊔ ℓ′) Species o ℓ o′ ℓ′ = Functors (Core (FinSetoids o ℓ)) (Setoids o′ ℓ′)
roms/tests/apu/blargg_apu_2005.07.30/source/03.irq_flag.asm
MrKOSMOS/ANESE
1,461
90848
<gh_stars>1000+ ; Tests basic operation of frame irq flag. .include "prefix_apu.a" reset: jsr setup_apu lda #2;) Flag shouldn't be set in $4017 mode $40 sta result lda #$40 sta $4017 lda #20 jsr delay_msec jsr should_be_clear lda #3;) Flag shouldn't be set in $4017 mode $80 sta result lda #$80 sta $4017 lda #20 jsr delay_msec jsr should_be_clear lda #4;) Flag should be set in $4017 mode $00 sta result lda #$00 sta $4017 lda #20 jsr delay_msec jsr should_be_set lda #5;) Reading flag clears it sta result lda #$00 sta $4017 lda #20 jsr delay_msec lda $4015 jsr should_be_clear lda #6;) Writing $00 or $80 to $4017 doesn't affect flag sta result lda #$00 sta $4017 lda #20 jsr delay_msec lda #$00 sta $4017 lda #$80 sta $4017 jsr should_be_set lda #7;) Writing $40 or $c0 to $4017 clears flag sta result lda #$00 sta $4017 lda #20 jsr delay_msec lda #$40 sta $4017 lda #$00 sta $4017 jsr should_be_clear lda #1;) Tests passed sta result error: jmp report_final_result ; Report error if flag isn't clear should_be_clear: lda $4015 and #$40 bne error rts ; Report error if flag isn't set should_be_set: lda $4015 and #$40 beq error rts
ffight/lcs/weapon/2E.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
8081
copyright zengfr site:http://github.com/zengfr/romhack 003A06 movem.l D0-D3, -(A6) 003A0A movem.l D0-D3, -(A6) 004434 move.b ($2e,A0), ($2e,A6) [weapon+ E, weapon+10] 00443A move.b ($2b,A0), D0 [weapon+2E] 009ACA dbra D5, $9ac8 057B8C move.b ($2e,A0), ($36,A6) [weapon+2E] 057DCA eori.b #$1, ($2e,A6) [weapon+2E] 057DD0 move.w ($412,A5), D0 057DEE rts 058DEA move.b ($3e,A6), ($2e,A6) 058DF0 eori.b #$1, ($2e,A6) [weapon+2E] 058DF6 move.w ($412,A5), D0 [weapon+2E] 059672 move.b ($2e,A0), ($36,A6) [weapon+2E] 0597F4 move.b ($2e,A0), ($2e,A6) [weapon+ E, weapon+10] 0597FA move.b ($2b,A0), D0 [weapon+2E] copyright zengfr site:http://github.com/zengfr/romhack
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c37213k.ada
best08618/asylo
7
2327
-- C37213K.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK, FOR A GENERIC FORMAL TYPE - WHERE A DISCRIMINANT OR AN -- INDEX CONSTRAINT DEPENDS ON A RECORD DISCRIMINANT AND THE -- RECORD TYPE IS CONSTRAINED BY DEFAULT - USED TO DECLARE AN -- ARRAY OR RECORD COMPONENT, THAT THE NON-DISCRIMINANT EXPRESSIONS -- OF THE CONSTRAINT ARE CHECKED FOR COMPATIBILITY: -- 1) ONLY IN AN OBJECT DECLARATION, AND -- 2) ONLY IF THE DESCRIMINANT-DEPENDENT COMPONENT IS PRESENT -- IN THE SUBTYPE. -- HISTORY: -- VCL 10/23/88 CREATED ORIGINAL TEST BY SPLITTING FROM C37213J. -- VCL 03/30/88 MODIFIED THE TEST DISCRIPTION TO MORE ACCURATELY -- DESCRIBE THE OBJECTIVE; CHANGED THE FORMAL -- PARAMETERS TO THE GENERIC UNITS AND THE -- CORRESPONDING ACTUAL PARAMETERS; REORGANIZED THE -- TEST SO THAT ALL OPERATIONS ON A SPECIFIC TYPE -- ARE TOGETHER; REWROTE ONE OF THE GENERIC -- PACKAGES AS A GENERIC PROCEDURE TO BROADEN -- COVERAGE OF TEST. WITH REPORT; USE REPORT; PROCEDURE C37213K IS BEGIN TEST ("C37213K", "THE NON-DISCRIMINANT VALUES OF A DISCRIMINANT " & "OR AN INDEX CONSTRAINT THAT DEPEND ON A " & "DISCRIMINANT ARE PROPERLY CHECKED WHEN THE " & "RECORD TYPE IS CONSTRAINED BY DEFAULT AND " & "USED AS THE ACTUAL PARAMETER TO A GENERIC " & "FORMAL TYPE USED TO DECLARE AN ARRAY OR A " & "RECORD COMPONENT"); DECLARE SUBTYPE SM IS INTEGER RANGE 1..10; TYPE REC (D1, D2 : SM) IS RECORD NULL; END RECORD; TYPE MY_ARR IS ARRAY (SM RANGE <>) OF INTEGER; SEQUENCE_NUMBER : INTEGER; GENERIC TYPE CONS IS PRIVATE; OBJ_XCP : BOOLEAN; TAG : STRING; PACKAGE ARRAY_COMP_CHK IS END ARRAY_COMP_CHK; PACKAGE BODY ARRAY_COMP_CHK IS BEGIN DECLARE TYPE ARR IS ARRAY (1..5) OF CONS; BEGIN DECLARE X : ARR; FUNCTION VALUE RETURN ARR IS BEGIN IF EQUAL (3,3) THEN RETURN X; ELSE RETURN X; END IF; END VALUE; BEGIN IF OBJ_XCP THEN FAILED ("NO CHECK DURING DECLARATION " & "OF OBJECT OF TYPE ARR - " & TAG); ELSIF X /= VALUE THEN FAILED ("INCORRECT VALUE FOR OBJECT OF " & "TYPE ARR - " & TAG); END IF; END; EXCEPTION WHEN CONSTRAINT_ERROR => IF NOT OBJ_XCP THEN FAILED ("IMPROPER CONSTRAINT CHECKED " & "DURING DECLARATION OF OBJECT " & "OF TYPE ARR - " & TAG); END IF; END; EXCEPTION WHEN CONSTRAINT_ERROR => FAILED ("CONSTRAINT IMPROPERLY CHECKED " & "DURING DECLARATION OF ARR - " & TAG); END ARRAY_COMP_CHK; GENERIC TYPE CONS IS PRIVATE; PROCEDURE REC_COMP_CHK (OBJ_XCP : BOOLEAN; TAG : STRING); PROCEDURE REC_COMP_CHK (OBJ_XCP : BOOLEAN; TAG : STRING) IS BEGIN DECLARE TYPE NREC IS RECORD C1 : CONS; END RECORD; BEGIN DECLARE X : NREC; FUNCTION VALUE RETURN NREC IS BEGIN IF EQUAL (5, 5) THEN RETURN X; ELSE RETURN X; END IF; END VALUE; BEGIN IF OBJ_XCP THEN FAILED ("NO CHECK DURING DECLARATION " & "OF OBJECT OF TYPE NREC - " & TAG); ELSIF X /= VALUE THEN FAILED ("INCORRECT VALUE FOR OBJECT " & "OF TYPE NREC - " & TAG); END IF; END; EXCEPTION WHEN CONSTRAINT_ERROR => IF NOT OBJ_XCP THEN FAILED ("IMPROPER CONSTRAINT CHECKED " & "DURING DECLARATION OF OBJECT " & "OF TYPE NREC - " & TAG); END IF; END; EXCEPTION WHEN CONSTRAINT_ERROR => FAILED ("CONSTRAINT IMPROPERLY CHECKED " & "DURING DECLARATION OF NREC - " & TAG); END; BEGIN SEQUENCE_NUMBER := 1; DECLARE TYPE REC_DEF (D3 : INTEGER := 1) IS RECORD C1 : REC (D3, 0); END RECORD; PACKAGE PACK1 IS NEW ARRAY_COMP_CHK (REC_DEF, OBJ_XCP => TRUE, TAG => "PACK1"); PROCEDURE PROC1 IS NEW REC_COMP_CHK (REC_DEF); BEGIN PROC1 (OBJ_XCP => TRUE, TAG => "PROC1"); END; SEQUENCE_NUMBER := 2; DECLARE TYPE ARR_DEF (D3 : INTEGER := IDENT_INT(1)) IS RECORD C1 : MY_ARR (0..D3); END RECORD; PACKAGE PACK2 IS NEW ARRAY_COMP_CHK (ARR_DEF, OBJ_XCP => TRUE, TAG => "PACK2"); PROCEDURE PROC2 IS NEW REC_COMP_CHK (ARR_DEF); BEGIN PROC2 (OBJ_XCP => TRUE, TAG => "PROC2"); END; SEQUENCE_NUMBER := 3; DECLARE TYPE VAR_REC_DEF1 (D3 : INTEGER := 1) IS RECORD CASE D3 IS WHEN -5..10 => C1 : REC (D3, IDENT_INT(11)); WHEN OTHERS => C2 : INTEGER := IDENT_INT(5); END CASE; END RECORD; PACKAGE PACK3 IS NEW ARRAY_COMP_CHK (VAR_REC_DEF1, OBJ_XCP => TRUE, TAG => "PACK3"); PROCEDURE PROC3 IS NEW REC_COMP_CHK (VAR_REC_DEF1); BEGIN PROC3 (OBJ_XCP => TRUE, TAG => "PROC3"); END; SEQUENCE_NUMBER := 4; DECLARE TYPE VAR_REC_DEF6 (D3 : INTEGER := IDENT_INT(-6)) IS RECORD CASE D3 IS WHEN -5..10 => C1 : REC (D3, IDENT_INT(11)); WHEN OTHERS => C2 : INTEGER := IDENT_INT(5); END CASE; END RECORD; PACKAGE PACK4 IS NEW ARRAY_COMP_CHK (VAR_REC_DEF6, OBJ_XCP => FALSE, TAG => "PACK4"); PROCEDURE PROC4 IS NEW REC_COMP_CHK (VAR_REC_DEF6); BEGIN PROC4 (OBJ_XCP => FALSE, TAG => "PROC4"); END; SEQUENCE_NUMBER := 5; DECLARE TYPE VAR_REC_DEF11 (D3 : INTEGER := 11) IS RECORD CASE D3 IS WHEN -5..10 => C1 : REC (D3, IDENT_INT(11)); WHEN OTHERS => C2 : INTEGER := IDENT_INT(5); END CASE; END RECORD; PACKAGE PACK5 IS NEW ARRAY_COMP_CHK (VAR_REC_DEF11, OBJ_XCP => FALSE, TAG => "PACK5"); PROCEDURE PROC5 IS NEW REC_COMP_CHK (VAR_REC_DEF11); BEGIN PROC5 (OBJ_XCP => FALSE, TAG => "PROC5"); END; SEQUENCE_NUMBER := 6; DECLARE TYPE VAR_ARR_DEF1 (D3 : INTEGER := IDENT_INT(1)) IS RECORD CASE D3 IS WHEN -5..10 => C1 : MY_ARR(D3..IDENT_INT(11)); WHEN OTHERS => C2 : INTEGER := IDENT_INT(5); END CASE; END RECORD; PACKAGE PACK6 IS NEW ARRAY_COMP_CHK (VAR_ARR_DEF1, OBJ_XCP => TRUE, TAG => "PACK6"); PROCEDURE PROC6 IS NEW REC_COMP_CHK (VAR_ARR_DEF1); BEGIN PROC6 (OBJ_XCP => TRUE, TAG => "PROC6"); END; SEQUENCE_NUMBER := 7; DECLARE TYPE VAR_ARR_DEF6 (D3 : INTEGER := -6) IS RECORD CASE D3 IS WHEN -5..10 => C1 : MY_ARR(D3..IDENT_INT(11)); WHEN OTHERS => C2 : INTEGER := IDENT_INT(5); END CASE; END RECORD; PACKAGE PACK7 IS NEW ARRAY_COMP_CHK (VAR_ARR_DEF6, OBJ_XCP => FALSE, TAG => "PACK7"); PROCEDURE PROC7 IS NEW REC_COMP_CHK (VAR_ARR_DEF6); BEGIN PROC7 (OBJ_XCP => FALSE, TAG => "PROC7"); END; SEQUENCE_NUMBER := 8; DECLARE TYPE VAR_ARR_DEF11 (D3 : INTEGER := IDENT_INT(11)) IS RECORD CASE D3 IS WHEN -5..10 => C1 : MY_ARR(D3..IDENT_INT(11)); WHEN OTHERS => C2 : INTEGER := IDENT_INT(5); END CASE; END RECORD; PACKAGE PACK8 IS NEW ARRAY_COMP_CHK (VAR_ARR_DEF11, OBJ_XCP => FALSE, TAG => "PACK8"); PROCEDURE PROC8 IS NEW REC_COMP_CHK (VAR_ARR_DEF11); BEGIN PROC8 (OBJ_XCP => FALSE, TAG => "PROC8"); END; EXCEPTION WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED DURING " & "DECLARATION / INSTANTIATION ELABORATION - " & INTEGER'IMAGE (SEQUENCE_NUMBER)); END; RESULT; END C37213K;
src/x86/looprestoration_ssse3.asm
myarchsource/dav1d
0
18885
; Copyright © 2018, VideoLAN and dav1d authors ; Copyright © 2018, Two Orioles, LLC ; Copyright © 2018, VideoLabs ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; ; 1. Redistributions of source code must retain the above copyright notice, this ; list of conditions and the following disclaimer. ; ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %include "ext/x86/x86inc.asm" SECTION_RODATA 16 pb_right_ext_mask: times 16 db 0xff times 16 db 0 pb_14x0_1_2: times 14 db 0 db 1, 2 pb_0_to_15_min_n: db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13 db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14 pb_unpcklwdw: db 0, 1, 0, 1, 4, 5, 4, 5, 8, 9, 8, 9, 12, 13, 12, 13 pb_0: times 16 db 0 pb_2: times 16 db 2 pb_3: times 16 db 3 pb_4: times 16 db 4 pb_15: times 16 db 15 pb_0_1: times 8 db 0, 1 pb_6_7: times 8 db 6, 7 pb_14_15: times 8 db 14, 15 pw_1: times 8 dw 1 pw_16: times 8 dw 16 pw_128: times 8 dw 128 pw_255: times 8 dw 255 pw_256: times 8 dw 256 pw_2048: times 8 dw 2048 pw_16380: times 8 dw 16380 pw_5_6: times 4 dw 5, 6 pw_0_128: times 4 dw 0, 128 pd_1024: times 4 dd 1024 %if ARCH_X86_32 pd_256: times 4 dd 256 pd_512: times 4 dd 512 pd_2048: times 4 dd 2048 %endif pd_0xF0080029: times 4 dd 0xF0080029 pd_0xF00801C7: times 4 dd 0XF00801C7 cextern sgr_x_by_x SECTION .text %if ARCH_X86_32 %define PIC_base_offset $$ %macro SETUP_PIC 1-3 1,0 ; PIC_reg, save_PIC_reg, restore_PIC_reg %assign pic_reg_stk_off 4 %xdefine PIC_reg %1 %if %2 == 1 mov [esp], %1 %endif LEA PIC_reg, PIC_base_offset %if %3 == 1 XCHG_PIC_REG %endif %endmacro %macro XCHG_PIC_REG 0 mov [esp+pic_reg_stk_off], PIC_reg %assign pic_reg_stk_off (pic_reg_stk_off+4) % 8 mov PIC_reg, [esp+pic_reg_stk_off] %endmacro %define PIC_sym(sym) (PIC_reg+(sym)-PIC_base_offset) %else %macro XCHG_PIC_REG 0 %endmacro %define PIC_sym(sym) (sym) %endif %macro PALIGNR 4 ; dst, src1, src2, shift %if cpuflag(ssse3) palignr %1, %2, %3, %4 %else %assign %%i regnumof%+%1 + 1 %define %%tmp m %+ %%i psrldq %1, %3, %4 pslldq %%tmp, %2, 16-%4 por %1, %%tmp %endif %endmacro %macro PMADDUBSW 5 ; dst, src, zero, tmp, reset_zero %if cpuflag(ssse3) pmaddubsw %1, %2 %else %if %5 == 1 pxor %3, %3 %endif punpckhbw %4, %1, %3 punpcklbw %1, %3 pmaddwd %4, %2 pmaddwd %1, %2 packssdw %1, %4 %endif %endmacro ;;;;;;;;;;;;;;;;;;;;;; ;; wiener ;; ;;;;;;;;;;;;;;;;;;;;;; %macro WIENER_H 0 %if ARCH_X86_64 cglobal wiener_filter_h, 5, 15, 16, dst, left, src, stride, fh, w, h, edge mov edged, edgem movifnidn wd, wm mov hd, hm %else cglobal wiener_filter_h, 5, 7, 8, -84, dst, left, src, stride, fh, w, h, edge mov r5, edgem mov [esp+12], r5 mov wd, wm mov hd, hm SETUP_PIC hd %define m15 m0 %define m14 m1 %define m13 m2 %define m12 m3 %endif movq m15, [fhq] %if cpuflag(ssse3) pshufb m12, m15, [PIC_sym(pb_6_7)] pshufb m13, m15, [PIC_sym(pb_4)] pshufb m14, m15, [PIC_sym(pb_2)] pshufb m15, m15, [PIC_sym(pb_0)] %else pshuflw m12, m15, q3333 punpcklbw m15, m15 pshufhw m13, m15, q0000 pshuflw m14, m15, q2222 pshuflw m15, m15, q0000 punpcklqdq m12, m12 punpckhqdq m13, m13 punpcklqdq m14, m14 punpcklqdq m15, m15 psraw m13, 8 psraw m14, 8 psraw m15, 8 %endif %if ARCH_X86_64 mova m11, [pw_2048] mova m10, [pw_16380] lea r11, [pb_right_ext_mask] DEFINE_ARGS dst, left, src, stride, x, w, h, edge, srcptr, dstptr, xlim %else %define m10 [PIC_sym(pw_16380)] %define m11 [PIC_sym(pw_2048)] %define m12 [esp+0x14] %define m13 [esp+0x24] %define m14 [esp+0x34] %define m15 [esp+0x44] mova m12, m3 mova m13, m2 mova m14, m1 mova m15, m0 DEFINE_ARGS dst, left, src, stride, x, w, h, edge %define srcptrq srcq %define dstptrq dstq %define hd dword [esp+ 0] %define edgeb byte [esp+12] %define xlimd dword [esp+16] %endif ; if (edge & has_right) align_w_to_16 ; else w -= 3, and use that as limit in x loop test edgeb, 2 ; has_right jnz .align mov xlimd, -3 jmp .loop .align: add wd, 15 and wd, ~15 %if ARCH_X86_64 xor xlimd, xlimd %else mov xlimd, 0 %endif ; main y loop for vertical filter .loop: %if ARCH_X86_64 mov srcptrq, srcq mov dstptrq, dstq lea xd, [wq+xlimq] %else mov [esp+8], srcq mov [esp+4], dstq mov xd, xlimd add xd, wd %endif ; load left edge pixels test edgeb, 1 ; have_left jz .emu_left test leftq, leftq ; left == NULL for the edge-extended bottom/top jz .load_left_combined movd m0, [leftq] movd m1, [srcq] punpckldq m0, m1 pslldq m0, 9 add leftq, 4 jmp .left_load_done .load_left_combined: movq m0, [srcq-3] pslldq m0, 10 jmp .left_load_done .emu_left: movd m0, [srcq] %if cpuflag(ssse3) pshufb m0, [PIC_sym(pb_14x0_1_2)] %else pslldq m1, m0, 13 punpcklbw m0, m0 pshuflw m0, m0, q0000 punpcklqdq m0, m0 psrldq m0, 2 por m0, m1 %endif ; load right edge pixels .left_load_done: cmp xd, 16 jg .main_load test xd, xd jg .load_and_splat je .splat_right ; for very small images (w=[1-2]), edge-extend the original cache, ; ugly, but only runs in very odd cases %if cpuflag(ssse3) add wd, wd %if ARCH_X86_64 pshufb m0, [r11-pb_right_ext_mask+pb_0_to_15_min_n+wq*8-16] %else pshufb m0, [PIC_sym(pb_0_to_15_min_n)+wq*8-16] %endif shr wd, 1 %else shl wd, 4 pcmpeqd m2, m2 movd m3, wd psrldq m2, 2 punpckhbw m1, m0, m0 pshufhw m1, m1, q1122 psllq m1, m3 pand m0, m2 pandn m2, m1 por m0, m2 shr wd, 4 %endif ; main x loop, mostly this starts in .main_load .splat_right: ; no need to load new pixels, just extend them from the (possibly previously ; extended) previous load into m0 %if cpuflag(ssse3) pshufb m1, m0, [PIC_sym(pb_15)] %else punpckhbw m1, m0, m0 pshufhw m1, m1, q3333 punpckhqdq m1, m1 %endif jmp .main_loop .load_and_splat: ; load new pixels and extend edge for right-most movu m1, [srcptrq+3] %if ARCH_X86_64 sub r11, xq movu m2, [r11+16] add r11, xq %else sub PIC_reg, xd movu m2, [PIC_sym(pb_right_ext_mask)+16] add PIC_reg, xd %endif movd m3, [srcptrq+2+xq] %if cpuflag(ssse3) pshufb m3, [PIC_sym(pb_0)] %else punpcklbw m3, m3 pshuflw m3, m3, q0000 punpcklqdq m3, m3 %endif pand m1, m2 pxor m2, [PIC_sym(pb_right_ext_mask)] pand m3, m2 pxor m2, [PIC_sym(pb_right_ext_mask)] por m1, m3 jmp .main_loop .main_load: ; load subsequent line movu m1, [srcptrq+3] .main_loop: %if ARCH_X86_64 PALIGNR m2, m1, m0, 10 PALIGNR m3, m1, m0, 11 PALIGNR m4, m1, m0, 12 PALIGNR m5, m1, m0, 13 PALIGNR m6, m1, m0, 14 PALIGNR m7, m1, m0, 15 punpcklbw m0, m2, m1 punpckhbw m2, m1 punpcklbw m8, m3, m7 punpckhbw m3, m7 punpcklbw m7, m4, m6 punpckhbw m4, m6 PMADDUBSW m0, m15, m6, m9, 1 PMADDUBSW m2, m15, m6, m9, 0 PMADDUBSW m8, m14, m6, m9, 0 PMADDUBSW m3, m14, m6, m9, 0 PMADDUBSW m7, m13, m6, m9, 0 PMADDUBSW m4, m13, m6, m9, 0 paddw m0, m8 paddw m2, m3 %if cpuflag(ssse3) pxor m6, m6 %endif punpcklbw m3, m5, m6 punpckhbw m5, m6 psllw m8, m3, 7 psllw m6, m5, 7 psubw m8, m10 psubw m6, m10 pmullw m3, m12 pmullw m5, m12 paddw m0, m7 paddw m2, m4 paddw m0, m3 paddw m2, m5 paddsw m0, m8 ; see the avx2 for an explanation paddsw m2, m6 ; of how the clipping works here psraw m0, 3 psraw m2, 3 paddw m0, m11 paddw m2, m11 mova [dstptrq+ 0], m0 mova [dstptrq+16], m2 %else PALIGNR m2, m1, m0, 10 punpcklbw m3, m2, m1 punpckhbw m2, m1 PMADDUBSW m3, m15, m4, m5, 1 PMADDUBSW m2, m15, m4, m5, 0 PALIGNR m4, m1, m0, 11 PALIGNR m5, m1, m0, 15 punpcklbw m6, m4, m5 punpckhbw m4, m5 PMADDUBSW m6, m14, m5, m7, 1 PMADDUBSW m4, m14, m5, m7, 0 paddw m3, m6 paddw m2, m4 PALIGNR m4, m1, m0, 12 PALIGNR m5, m1, m0, 14 punpcklbw m6, m4, m5 punpckhbw m4, m5 PMADDUBSW m6, m13, m5, m7, 1 PMADDUBSW m4, m13, m5, m7, 0 paddw m3, m6 paddw m2, m4 PALIGNR m6, m1, m0, 13 %if cpuflag(ssse3) pxor m5, m5 %endif punpcklbw m4, m6, m5 punpckhbw m6, m5 psllw m5, m4, 7 psllw m7, m6, 7 psubw m5, m10 psubw m7, m10 pmullw m4, m12 pmullw m6, m12 paddw m3, m4 paddw m2, m6 paddsw m3, m5 paddsw m2, m7 psraw m3, 3 psraw m2, 3 paddw m3, m11 paddw m2, m11 mova [dstptrq+ 0], m3 mova [dstptrq+16], m2 %endif mova m0, m1 add srcptrq, 16 add dstptrq, 32 sub xd, 16 cmp xd, 16 jg .main_load test xd, xd jg .load_and_splat cmp xd, xlimd jg .splat_right %if ARCH_X86_32 mov srcq, [esp+8] mov dstq, [esp+4] %endif add srcq, strideq add dstq, 384*2 dec hd jg .loop RET %endmacro %macro WIENER_V 0 %if ARCH_X86_64 cglobal wiener_filter_v, 4, 10, 16, dst, stride, mid, w, h, fv, edge mov edged, edgem movifnidn fvq, fvmp movifnidn hd, hm movq m15, [fvq] pshufd m14, m15, q1111 pshufd m15, m15, q0000 paddw m14, [pw_0_128] mova m12, [pd_1024] DEFINE_ARGS dst, stride, mid, w, h, y, edge, ylim, mptr, dstptr mov ylimd, edged and ylimd, 8 ; have_bottom shr ylimd, 2 sub ylimd, 3 %else cglobal wiener_filter_v, 5, 7, 8, -96, dst, stride, mid, w, h, fv, edge %define ylimd [esp+12] mov r5d, edgem and r5d, 8 shr r5d, 2 sub r5d, 3 mov ylimd, r5d mov fvq, fvmp mov edged, edgem SETUP_PIC edged movq m0, [fvq] pshufd m1, m0, q1111 pshufd m0, m0, q0000 paddw m1, [PIC_sym(pw_0_128)] mova [esp+0x50], m0 mova [esp+0x40], m1 DEFINE_ARGS dst, stride, mid, w, h, y, edge %define mptrq midq %define dstptrq dstq %define edgeb byte [esp] %endif ; main x loop for vertical filter, does one column of 16 pixels .loop_x: mova m3, [midq] ; middle line ; load top pixels test edgeb, 4 ; have_top jz .emu_top mova m0, [midq-384*4] mova m2, [midq-384*2] mova m1, m0 jmp .load_bottom_pixels .emu_top: mova m0, m3 mova m1, m3 mova m2, m3 ; load bottom pixels .load_bottom_pixels: mov yd, hd %if ARCH_X86_64 mov mptrq, midq mov dstptrq, dstq add yd, ylimd %else mov [esp+8], midq mov [esp+4], dstq add yd, ylimd %endif jg .load_threelines ; the remainder here is somewhat messy but only runs in very weird ; circumstances at the bottom of the image in very small blocks (h=[1-3]), ; so performance is not terribly important here... je .load_twolines cmp yd, -1 je .load_oneline ; h == 1 case mova m5, m3 mova m4, m3 mova m6, m3 jmp .loop .load_oneline: ; h == 2 case mova m4, [midq+384*2] mova m5, m4 mova m6, m4 jmp .loop .load_twolines: ; h == 3 case mova m4, [midq+384*2] mova m5, [midq+384*4] mova m6, m5 jmp .loop .load_threelines: ; h > 3 case mova m4, [midq+384*2] mova m5, [midq+384*4] ; third line loaded in main loop below ; main y loop for vertical filter .loop_load: ; load one line into m6. if that pixel is no longer available, do ; nothing, since m6 still has the data from the previous line in it. We ; try to structure the loop so that the common case is evaluated fastest mova m6, [mptrq+384*6] .loop: %if ARCH_X86_64 paddw m7, m0, m6 paddw m8, m1, m5 paddw m9, m2, m4 punpcklwd m10, m7, m8 punpckhwd m7, m8 punpcklwd m11, m9, m3 punpckhwd m9, m3 pmaddwd m10, m15 pmaddwd m7, m15 pmaddwd m11, m14 pmaddwd m9, m14 paddd m10, m12 paddd m7, m12 paddd m10, m11 paddd m7, m9 psrad m10, 11 psrad m7, 11 packssdw m10, m7 packuswb m10, m10 movq [dstptrq], m10 %else mova [esp+0x30], m1 mova [esp+0x20], m2 mova [esp+0x10], m3 paddw m0, m6 paddw m1, m5 paddw m2, m4 punpcklwd m7, m2, m3 punpckhwd m2, m3 punpcklwd m3, m0, m1 punpckhwd m0, m1 mova m1, [esp+0x50] pmaddwd m3, m1 pmaddwd m0, m1 mova m1, [esp+0x40] pmaddwd m7, m1 pmaddwd m2, m1 paddd m3, [PIC_sym(pd_1024)] paddd m0, [PIC_sym(pd_1024)] paddd m3, m7 paddd m0, m2 psrad m3, 11 psrad m0, 11 packssdw m3, m0 packuswb m3, m3 movq [dstq], m3 mova m1, [esp+0x30] mova m2, [esp+0x20] mova m3, [esp+0x10] %endif ; shift pixels one position mova m0, m1 mova m1, m2 mova m2, m3 mova m3, m4 mova m4, m5 mova m5, m6 add mptrq, 384*2 add dstptrq, strideq dec yd jg .loop_load ; for the bottom pixels, continue using m6 (as extended edge) cmp yd, ylimd jg .loop %if ARCH_X86_32 mov midq, [esp+8] mov dstq, [esp+4] %endif add midq, 16 add dstq, 8 sub wd, 8 jg .loop_x RET %endmacro INIT_XMM sse2 WIENER_H WIENER_V INIT_XMM ssse3 WIENER_H WIENER_V ;;;;;;;;;;;;;;;;;;;;;;;;;; ;; self-guided ;; ;;;;;;;;;;;;;;;;;;;;;;;;;; %macro MULLD 2 pmulhuw m5, %1, %2 pmullw %1, %2 pslld m5, 16 paddd %1, m5 %endmacro %macro GATHERDD 2 mova m5, m7 movd r6d, %2 %if ARCH_X86_64 movd %1, [r5+r6] pextrw r6d, %2, 2 pinsrw m5, [r5+r6+2], 3 pextrw r6d, %2, 4 pinsrw %1, [r5+r6+2], 5 pextrw r6d, %2, 6 pinsrw m5, [r5+r6+2], 7 %else movd %1, [PIC_sym(sgr_x_by_x-0xF03)+r6] pextrw r6d, %2, 2 pinsrw m5, [PIC_sym(sgr_x_by_x-0xF03)+r6+2], 3 pextrw r6d, %2, 4 pinsrw %1, [PIC_sym(sgr_x_by_x-0xF03)+r6+2], 5 pextrw r6d, %2, 6 pinsrw m5, [PIC_sym(sgr_x_by_x-0xF03)+r6+2], 7 %endif por %1, m5 %endmacro %if ARCH_X86_64 cglobal sgr_box3_h, 5, 11, 8, sumsq, sum, left, src, stride, x, h, edge, w, xlim mov xlimd, edgem movifnidn xd, xm mov hd, hm mov edged, xlimd and xlimd, 2 ; have_right add xd, xlimd xor xlimd, 2 ; 2*!have_right %else cglobal sgr_box3_h, 6, 7, 8, sumsq, sum, left, src, stride, x, h, edge, w, xlim %define wq r0m %define xlimd r1m %define hd hmp %define edgeb byte edgem mov r6, edgem and r6, 2 ; have_right add xd, r6 xor r6, 2 ; 2*!have_right mov xlimd, r6 SETUP_PIC r6, 0 %endif jnz .no_right add xd, 7 and xd, ~7 .no_right: pxor m1, m1 lea srcq, [srcq+xq] lea sumq, [sumq+xq*2-2] lea sumsqq, [sumsqq+xq*4-4] neg xq mov wq, xq %if ARCH_X86_64 lea r10, [pb_right_ext_mask+16] %endif .loop_y: mov xq, wq ; load left test edgeb, 1 ; have_left jz .no_left test leftq, leftq jz .load_left_from_main movd m0, [leftq] pslldq m0, 12 add leftq, 4 jmp .expand_x .no_left: movd m0, [srcq+xq] pshufb m0, [PIC_sym(pb_0)] jmp .expand_x .load_left_from_main: movd m0, [srcq+xq-2] pslldq m0, 14 .expand_x: punpckhbw xm0, xm1 ; when we reach this, m0 contains left two px in highest words cmp xd, -8 jle .loop_x .partial_load_and_extend: movd m3, [srcq-4] pshufb m3, [PIC_sym(pb_3)] movq m2, [srcq+xq] punpcklbw m2, m1 punpcklbw m3, m1 %if ARCH_X86_64 movu m4, [r10+xq*2] %else movu m4, [PIC_sym(pb_right_ext_mask+16)+xd*2] %endif pand m2, m4 pandn m4, m3 por m2, m4 jmp .loop_x_noload .right_extend: pshufb m2, m0, [PIC_sym(pb_14_15)] jmp .loop_x_noload .loop_x: movq m2, [srcq+xq] punpcklbw m2, m1 .loop_x_noload: palignr m3, m2, m0, 12 palignr m4, m2, m0, 14 punpcklwd m5, m3, m2 punpckhwd m6, m3, m2 paddw m3, m4 punpcklwd m7, m4, m1 punpckhwd m4, m1 pmaddwd m5, m5 pmaddwd m6, m6 pmaddwd m7, m7 pmaddwd m4, m4 paddd m5, m7 paddd m6, m4 paddw m3, m2 movu [sumq+xq*2], m3 movu [sumsqq+xq*4+ 0], m5 movu [sumsqq+xq*4+16], m6 mova m0, m2 add xq, 8 ; if x <= -8 we can reload more pixels ; else if x < 0 we reload and extend (this implies have_right=0) ; else if x < xlimd we extend from previous load (this implies have_right=0) ; else we are done cmp xd, -8 jle .loop_x test xd, xd jl .partial_load_and_extend cmp xd, xlimd jl .right_extend add sumsqq, (384+16)*4 add sumq, (384+16)*2 add srcq, strideq dec hd jg .loop_y RET %if ARCH_X86_64 cglobal sgr_box3_v, 4, 10, 9, sumsq, sum, w, h, edge, x, y, sumsq_base, sum_base, ylim movifnidn edged, edgem %else cglobal sgr_box3_v, 3, 7, 8, -28, sumsq, sum, w, edge, h, x, y %define sumsq_baseq dword [esp+0] %define sum_baseq dword [esp+4] %define ylimd dword [esp+8] %define m8 [esp+12] mov edged, r4m mov hd, r3m %endif mov xq, -2 %if ARCH_X86_64 mov ylimd, edged and ylimd, 8 ; have_bottom shr ylimd, 2 sub ylimd, 2 ; -2 if have_bottom=0, else 0 mov sumsq_baseq, sumsqq mov sum_baseq, sumq .loop_x: mov sumsqq, sumsq_baseq mov sumq, sum_baseq lea yd, [hq+ylimq+2] %else mov yd, edged and yd, 8 ; have_bottom shr yd, 2 sub yd, 2 ; -2 if have_bottom=0, else 0 mov sumsq_baseq, sumsqq mov sum_baseq, sumq mov ylimd, yd .loop_x: mov sumsqd, sumsq_baseq mov sumd, sum_baseq lea yd, [hq+2] add yd, ylimd %endif lea sumsqq, [sumsqq+xq*4+4-(384+16)*4] lea sumq, [sumq+xq*2+2-(384+16)*2] test edgeb, 4 ; have_top jnz .load_top movu m0, [sumsqq+(384+16)*4*1] movu m1, [sumsqq+(384+16)*4*1+16] mova m2, m0 mova m3, m1 mova m4, m0 mova m5, m1 movu m6, [sumq+(384+16)*2*1] mova m7, m6 mova m8, m6 jmp .loop_y_noload .load_top: movu m0, [sumsqq-(384+16)*4*1] ; l2sq [left] movu m1, [sumsqq-(384+16)*4*1+16] ; l2sq [right] movu m2, [sumsqq-(384+16)*4*0] ; l1sq [left] movu m3, [sumsqq-(384+16)*4*0+16] ; l1sq [right] movu m6, [sumq-(384+16)*2*1] ; l2 movu m7, [sumq-(384+16)*2*0] ; l1 .loop_y: %if ARCH_X86_64 movu m8, [sumq+(384+16)*2*1] ; l0 %else movu m4, [sumq+(384+16)*2*1] ; l0 mova m8, m4 %endif movu m4, [sumsqq+(384+16)*4*1] ; l0sq [left] movu m5, [sumsqq+(384+16)*4*1+16] ; l0sq [right] .loop_y_noload: paddd m0, m2 paddd m1, m3 paddw m6, m7 paddd m0, m4 paddd m1, m5 paddw m6, m8 movu [sumsqq+ 0], m0 movu [sumsqq+16], m1 movu [sumq], m6 ; shift position down by one mova m0, m2 mova m1, m3 mova m2, m4 mova m3, m5 mova m6, m7 mova m7, m8 add sumsqq, (384+16)*4 add sumq, (384+16)*2 dec yd jg .loop_y cmp yd, ylimd jg .loop_y_noload add xd, 8 cmp xd, wd jl .loop_x RET cglobal sgr_calc_ab1, 4, 7, 12, a, b, w, h, s movifnidn sd, sm sub aq, (384+16-1)*4 sub bq, (384+16-1)*2 add hd, 2 %if ARCH_X86_64 LEA r5, sgr_x_by_x-0xF03 %else SETUP_PIC r5, 0 %endif movd m6, sd pshuflw m6, m6, q0000 punpcklqdq m6, m6 pxor m7, m7 DEFINE_ARGS a, b, w, h, x %if ARCH_X86_64 mova m8, [pd_0xF00801C7] mova m9, [pw_256] psrld m10, m9, 13 ; pd_2048 mova m11, [pb_unpcklwdw] %else %define m8 [PIC_sym(pd_0xF00801C7)] %define m9 [PIC_sym(pw_256)] %define m10 [PIC_sym(pd_2048)] %define m11 [PIC_sym(pb_unpcklwdw)] %endif .loop_y: mov xq, -2 .loop_x: movq m0, [bq+xq*2] movq m1, [bq+xq*2+(384+16)*2] punpcklwd m0, m7 punpcklwd m1, m7 movu m2, [aq+xq*4] movu m3, [aq+xq*4+(384+16)*4] pslld m4, m2, 3 pslld m5, m3, 3 paddd m2, m4 ; aa * 9 paddd m3, m5 pmaddwd m4, m0, m0 pmaddwd m5, m1, m1 pmaddwd m0, m8 pmaddwd m1, m8 psubd m2, m4 ; p = aa * 9 - bb * bb psubd m3, m5 MULLD m2, m6 MULLD m3, m6 paddusw m2, m8 paddusw m3, m8 psrld m2, 20 ; z psrld m3, 20 GATHERDD m4, m2 ; xx GATHERDD m2, m3 psrld m4, 24 psrld m2, 24 packssdw m3, m4, m2 pshufb m4, m11 MULLD m0, m4 pshufb m2, m11 MULLD m1, m2 psubw m5, m9, m3 paddd m0, m10 paddd m1, m10 psrld m0, 12 psrld m1, 12 movq [bq+xq*2], m5 psrldq m5, 8 movq [bq+xq*2+(384+16)*2], m5 movu [aq+xq*4], m0 movu [aq+xq*4+(384+16)*4], m1 add xd, 4 cmp xd, wd jl .loop_x add aq, (384+16)*4*2 add bq, (384+16)*2*2 sub hd, 2 jg .loop_y RET %if ARCH_X86_64 cglobal sgr_finish_filter1, 5, 13, 16, t, src, stride, a, b, w, h, \ tmp_base, src_base, a_base, b_base, x, y movifnidn wd, wm mov hd, hm mova m15, [pw_16] mov tmp_baseq, tq mov src_baseq, srcq mov a_baseq, aq mov b_baseq, bq xor xd, xd %else cglobal sgr_finish_filter1, 7, 7, 8, -144, t, src, stride, a, b, x, y %define tmp_baseq [esp+8] %define src_baseq [esp+12] %define a_baseq [esp+16] %define b_baseq [esp+20] %define wd [esp+24] %define hd [esp+28] mov tmp_baseq, tq mov src_baseq, srcq mov a_baseq, aq mov b_baseq, bq mov wd, xd mov hd, yd xor xd, xd SETUP_PIC yd, 1, 1 jmp .loop_start %endif .loop_x: mov tq, tmp_baseq mov srcq, src_baseq mov aq, a_baseq mov bq, b_baseq %if ARCH_X86_32 .loop_start: movu m0, [bq+xq*2-(384+16)*2-2] movu m2, [bq+xq*2-(384+16)*2+2] mova m1, [bq+xq*2-(384+16)*2] ; b:top paddw m0, m2 ; b:tl+tr movu m2, [bq+xq*2-2] movu m3, [bq+xq*2+2] paddw m1, [bq+xq*2] ; b:top+ctr paddw m2, m3 ; b:l+r mova [esp+0x80], m0 mova [esp+0x70], m1 mova [esp+0x60], m2 %endif movu m0, [aq+xq*4-(384+16)*4-4] movu m2, [aq+xq*4-(384+16)*4+4] mova m1, [aq+xq*4-(384+16)*4] ; a:top [first half] paddd m0, m2 ; a:tl+tr [first half] movu m2, [aq+xq*4-(384+16)*4-4+16] movu m4, [aq+xq*4-(384+16)*4+4+16] mova m3, [aq+xq*4-(384+16)*4+16] ; a:top [second half] paddd m2, m4 ; a:tl+tr [second half] movu m4, [aq+xq*4-4] movu m5, [aq+xq*4+4] paddd m1, [aq+xq*4] ; a:top+ctr [first half] paddd m4, m5 ; a:l+r [first half] movu m5, [aq+xq*4+16-4] movu m6, [aq+xq*4+16+4] paddd m3, [aq+xq*4+16] ; a:top+ctr [second half] paddd m5, m6 ; a:l+r [second half] %if ARCH_X86_64 movu m6, [bq+xq*2-(384+16)*2-2] movu m8, [bq+xq*2-(384+16)*2+2] mova m7, [bq+xq*2-(384+16)*2] ; b:top paddw m6, m8 ; b:tl+tr movu m8, [bq+xq*2-2] movu m9, [bq+xq*2+2] paddw m7, [bq+xq*2] ; b:top+ctr paddw m8, m9 ; b:l+r %endif lea tq, [tq+xq*2] lea srcq, [srcq+xq*1] lea aq, [aq+xq*4+(384+16)*4] lea bq, [bq+xq*2+(384+16)*2] mov yd, hd .loop_y: %if ARCH_X86_64 movu m9, [bq-2] movu m10, [bq+2] paddw m7, [bq] ; b:top+ctr+bottom paddw m9, m10 ; b:bl+br paddw m10, m7, m8 ; b:top+ctr+bottom+l+r paddw m6, m9 ; b:tl+tr+bl+br psubw m7, [bq-(384+16)*2*2] ; b:ctr+bottom paddw m10, m6 psllw m10, 2 psubw m10, m6 ; aa pxor m14, m14 movq m12, [srcq] punpcklbw m12, m14 punpcklwd m6, m10, m15 punpckhwd m10, m15 punpcklwd m13, m12, m15 punpckhwd m12, m15 pmaddwd m6, m13 ; aa*src[x]+256 [first half] pmaddwd m10, m12 ; aa*src[x]+256 [second half] %else paddd m1, [aq] ; a:top+ctr+bottom [first half] paddd m3, [aq+16] ; a:top+ctr+bottom [second half] mova [esp+0x50], m1 mova [esp+0x40], m3 mova [esp+0x30], m4 movu m6, [aq-4] movu m7, [aq+4] paddd m1, m4 ; a:top+ctr+bottom+l+r [first half] paddd m3, m5 ; a:top+ctr+bottom+l+r [second half] paddd m6, m7 ; a:bl+br [first half] movu m7, [aq+16-4] movu m4, [aq+16+4] paddd m7, m4 ; a:bl+br [second half] paddd m0, m6 ; a:tl+tr+bl+br [first half] paddd m2, m7 ; a:tl+tr+bl+br [second half] paddd m1, m0 paddd m3, m2 pslld m1, 2 pslld m3, 2 psubd m1, m0 ; bb [first half] psubd m3, m2 ; bb [second half] %endif %if ARCH_X86_64 movu m11, [aq-4] movu m12, [aq+4] paddd m1, [aq] ; a:top+ctr+bottom [first half] paddd m11, m12 ; a:bl+br [first half] movu m12, [aq+16-4] movu m13, [aq+16+4] paddd m3, [aq+16] ; a:top+ctr+bottom [second half] paddd m12, m13 ; a:bl+br [second half] paddd m13, m1, m4 ; a:top+ctr+bottom+l+r [first half] paddd m14, m3, m5 ; a:top+ctr+bottom+l+r [second half] paddd m0, m11 ; a:tl+tr+bl+br [first half] paddd m2, m12 ; a:tl+tr+bl+br [second half] paddd m13, m0 paddd m14, m2 pslld m13, 2 pslld m14, 2 psubd m13, m0 ; bb [first half] psubd m14, m2 ; bb [second half] psubd m1, [aq-(384+16)*4*2] ; a:ctr+bottom [first half] psubd m3, [aq-(384+16)*4*2+16] ; a:ctr+bottom [second half] %else mova m4, [esp+0x80] mova [esp+0x80], m5 mova m5, [esp+0x70] mova [esp+0x70], m6 mova m6, [esp+0x60] mova [esp+0x60], m7 mova [esp+0x20], m1 movu m7, [bq-2] movu m1, [bq+2] paddw m5, [bq] ; b:top+ctr+bottom paddw m7, m1 paddw m1, m5, m6 ; b:top+ctr+bottom+l+r paddw m4, m7 ; b:tl+tr+bl+br psubw m5, [bq-(384+16)*2*2] ; b:ctr+bottom paddw m1, m4 psllw m1, 2 psubw m1, m4 ; aa movq m0, [srcq] XCHG_PIC_REG punpcklbw m0, [PIC_sym(pb_right_ext_mask)+16] punpcklwd m4, m1, [PIC_sym(pw_16)] punpckhwd m1, [PIC_sym(pw_16)] punpcklwd m2, m0, [PIC_sym(pw_16)] punpckhwd m0, [PIC_sym(pw_16)] XCHG_PIC_REG pmaddwd m4, m2 ; aa*src[x]+256 [first half] pmaddwd m1, m0 ; aa*src[x]+256 [second half] %endif %if ARCH_X86_64 paddd m6, m13 paddd m10, m14 psrad m6, 9 psrad m10, 9 packssdw m6, m10 mova [tq], m6 %else paddd m4, [esp+0x20] paddd m1, m3 psrad m4, 9 psrad m1, 9 packssdw m4, m1 mova [tq], m4 %endif ; shift to next row %if ARCH_X86_64 mova m0, m4 mova m2, m5 mova m4, m11 mova m5, m12 mova m6, m8 mova m8, m9 %else mova m1, [esp+0x50] mova m3, [esp+0x40] mova m0, [esp+0x30] mova m2, [esp+0x80] mova m4, [esp+0x70] mova [esp+0x70], m5 mova m5, [esp+0x60] mova [esp+0x80], m6 mova [esp+0x60], m7 psubd m1, [aq-(384+16)*4*2] ; a:ctr+bottom [first half] psubd m3, [aq-(384+16)*4*2+16] ; a:ctr+bottom [second half] %endif add srcq, strideq add aq, (384+16)*4 add bq, (384+16)*2 add tq, 384*2 dec yd jg .loop_y add xd, 8 cmp xd, wd jl .loop_x RET cglobal sgr_weighted1, 4, 7, 8, dst, stride, t, w, h, wt movifnidn hd, hm %if ARCH_X86_32 SETUP_PIC r6, 0 %endif movd m0, wtm pshufb m0, [PIC_sym(pb_0_1)] psllw m0, 4 pxor m7, m7 DEFINE_ARGS dst, stride, t, w, h, idx .loop_y: xor idxd, idxd .loop_x: mova m1, [tq+idxq*2+ 0] mova m4, [tq+idxq*2+16] mova m5, [dstq+idxq] punpcklbw m2, m5, m7 punpckhbw m5, m7 psllw m3, m2, 4 psllw m6, m5, 4 psubw m1, m3 psubw m4, m6 pmulhrsw m1, m0 pmulhrsw m4, m0 paddw m1, m2 paddw m4, m5 packuswb m1, m4 mova [dstq+idxq], m1 add idxd, 16 cmp idxd, wd jl .loop_x add dstq, strideq add tq, 384 * 2 dec hd jg .loop_y RET %if ARCH_X86_64 cglobal sgr_box5_h, 5, 11, 12, sumsq, sum, left, src, stride, w, h, edge, x, xlim mov edged, edgem movifnidn wd, wm mov hd, hm mova m10, [pb_0] mova m11, [pb_0_1] %else cglobal sgr_box5_h, 7, 7, 8, sumsq, sum, left, src, xlim, x, h, edge %define edgeb byte edgem %define wd xd %define wq wd %define wm r5m %define strideq r4m SUB esp, 8 SETUP_PIC sumsqd, 1, 1 %define m10 [PIC_sym(pb_0)] %define m11 [PIC_sym(pb_0_1)] %endif test edgeb, 2 ; have_right jz .no_right xor xlimd, xlimd add wd, 2 add wd, 15 and wd, ~15 jmp .right_done .no_right: mov xlimd, 3 dec wd .right_done: pxor m1, m1 lea srcq, [srcq+wq+1] lea sumq, [sumq+wq*2-2] lea sumsqq, [sumsqq+wq*4-4] neg wq %if ARCH_X86_64 lea r10, [pb_right_ext_mask+16] %else mov wm, xd %define wq wm %endif .loop_y: mov xq, wq ; load left test edgeb, 1 ; have_left jz .no_left test leftq, leftq jz .load_left_from_main movd m0, [leftq] movd m2, [srcq+xq-1] pslldq m2, 4 por m0, m2 pslldq m0, 11 add leftq, 4 jmp .expand_x .no_left: movd m0, [srcq+xq-1] XCHG_PIC_REG pshufb m0, m10 XCHG_PIC_REG jmp .expand_x .load_left_from_main: movd m0, [srcq+xq-4] pslldq m0, 12 .expand_x: punpckhbw m0, m1 ; when we reach this, m0 contains left two px in highest words cmp xd, -8 jle .loop_x test xd, xd jge .right_extend .partial_load_and_extend: XCHG_PIC_REG movd m3, [srcq-1] movq m2, [srcq+xq] pshufb m3, m10 punpcklbw m3, m1 punpcklbw m2, m1 %if ARCH_X86_64 movu m4, [r10+xq*2] %else movu m4, [PIC_sym(pb_right_ext_mask+16)+xd*2] XCHG_PIC_REG %endif pand m2, m4 pandn m4, m3 por m2, m4 jmp .loop_x_noload .right_extend: psrldq m2, m0, 14 XCHG_PIC_REG pshufb m2, m11 XCHG_PIC_REG jmp .loop_x_noload .loop_x: movq m2, [srcq+xq] punpcklbw m2, m1 .loop_x_noload: palignr m3, m2, m0, 8 palignr m4, m2, m0, 10 palignr m5, m2, m0, 12 palignr m6, m2, m0, 14 %if ARCH_X86_64 paddw m0, m3, m2 punpcklwd m7, m3, m2 punpckhwd m3, m2 paddw m0, m4 punpcklwd m8, m4, m5 punpckhwd m4, m5 paddw m0, m5 punpcklwd m9, m6, m1 punpckhwd m5, m6, m1 paddw m0, m6 pmaddwd m7, m7 pmaddwd m3, m3 pmaddwd m8, m8 pmaddwd m4, m4 pmaddwd m9, m9 pmaddwd m5, m5 paddd m7, m8 paddd m3, m4 paddd m7, m9 paddd m3, m5 movu [sumq+xq*2], m0 movu [sumsqq+xq*4+ 0], m7 movu [sumsqq+xq*4+16], m3 %else paddw m0, m3, m2 paddw m0, m4 paddw m0, m5 paddw m0, m6 movu [sumq+xq*2], m0 punpcklwd m7, m3, m2 punpckhwd m3, m2 punpcklwd m0, m4, m5 punpckhwd m4, m5 punpckhwd m5, m6, m1 pmaddwd m7, m7 pmaddwd m3, m3 pmaddwd m0, m0 pmaddwd m4, m4 pmaddwd m5, m5 paddd m7, m0 paddd m3, m4 paddd m3, m5 punpcklwd m0, m6, m1 pmaddwd m0, m0 paddd m7, m0 movu [sumsqq+xq*4+ 0], m7 movu [sumsqq+xq*4+16], m3 %endif mova m0, m2 add xq, 8 ; if x <= -8 we can reload more pixels ; else if x < 0 we reload and extend (this implies have_right=0) ; else if x < xlimd we extend from previous load (this implies have_right=0) ; else we are done cmp xd, -8 jle .loop_x test xd, xd jl .partial_load_and_extend cmp xd, xlimd jl .right_extend add srcq, strideq add sumsqq, (384+16)*4 add sumq, (384+16)*2 dec hd jg .loop_y %if ARCH_X86_32 ADD esp, 8 %endif RET %if ARCH_X86_64 cglobal sgr_box5_v, 4, 10, 15, sumsq, sum, w, h, edge, x, y, sumsq_ptr, sum_ptr, ylim movifnidn edged, edgem mov ylimd, edged %else cglobal sgr_box5_v, 5, 7, 8, -44, sumsq, sum, x, y, ylim, sumsq_ptr, sum_ptr %define wm [esp+0] %define hm [esp+4] %define edgem [esp+8] mov wm, xd mov hm, yd mov edgem, ylimd %endif and ylimd, 8 ; have_bottom shr ylimd, 2 sub ylimd, 3 ; -3 if have_bottom=0, else -1 mov xq, -2 %if ARCH_X86_64 .loop_x: lea yd, [hd+ylimd+2] lea sumsq_ptrq, [sumsqq+xq*4+4-(384+16)*4] lea sum_ptrq, [ sumq+xq*2+2-(384+16)*2] test edgeb, 4 ; have_top jnz .load_top movu m0, [sumsq_ptrq+(384+16)*4*1] movu m1, [sumsq_ptrq+(384+16)*4*1+16] mova m2, m0 mova m3, m1 mova m4, m0 mova m5, m1 mova m6, m0 mova m7, m1 movu m10, [sum_ptrq+(384+16)*2*1] mova m11, m10 mova m12, m10 mova m13, m10 jmp .loop_y_second_load .load_top: movu m0, [sumsq_ptrq-(384+16)*4*1] ; l3/4sq [left] movu m1, [sumsq_ptrq-(384+16)*4*1+16] ; l3/4sq [right] movu m4, [sumsq_ptrq-(384+16)*4*0] ; l2sq [left] movu m5, [sumsq_ptrq-(384+16)*4*0+16] ; l2sq [right] mova m2, m0 mova m3, m1 movu m10, [sum_ptrq-(384+16)*2*1] ; l3/4 movu m12, [sum_ptrq-(384+16)*2*0] ; l2 mova m11, m10 .loop_y: movu m6, [sumsq_ptrq+(384+16)*4*1] ; l1sq [left] movu m7, [sumsq_ptrq+(384+16)*4*1+16] ; l1sq [right] movu m13, [sum_ptrq+(384+16)*2*1] ; l1 .loop_y_second_load: test yd, yd jle .emulate_second_load movu m8, [sumsq_ptrq+(384+16)*4*2] ; l0sq [left] movu m9, [sumsq_ptrq+(384+16)*4*2+16] ; l0sq [right] movu m14, [sum_ptrq+(384+16)*2*2] ; l0 .loop_y_noload: paddd m0, m2 paddd m1, m3 paddw m10, m11 paddd m0, m4 paddd m1, m5 paddw m10, m12 paddd m0, m6 paddd m1, m7 paddw m10, m13 paddd m0, m8 paddd m1, m9 paddw m10, m14 movu [sumsq_ptrq+ 0], m0 movu [sumsq_ptrq+16], m1 movu [sum_ptrq], m10 ; shift position down by one mova m0, m4 mova m1, m5 mova m2, m6 mova m3, m7 mova m4, m8 mova m5, m9 mova m10, m12 mova m11, m13 mova m12, m14 add sumsq_ptrq, (384+16)*4*2 add sum_ptrq, (384+16)*2*2 sub yd, 2 jge .loop_y ; l1 = l0 mova m6, m8 mova m7, m9 mova m13, m14 cmp yd, ylimd jg .loop_y_noload add xd, 8 cmp xd, wd jl .loop_x RET .emulate_second_load: mova m8, m6 mova m9, m7 mova m14, m13 jmp .loop_y_noload %else .sumsq_loop_x: lea yd, [ylimd+2] add yd, hm lea sumsq_ptrq, [sumsqq+xq*4+4-(384+16)*4] test byte edgem, 4 ; have_top jnz .sumsq_load_top movu m0, [sumsq_ptrq+(384+16)*4*1] movu m1, [sumsq_ptrq+(384+16)*4*1+16] mova m4, m0 mova m5, m1 mova m6, m0 mova m7, m1 mova [esp+0x1c], m0 mova [esp+0x0c], m1 jmp .sumsq_loop_y_second_load .sumsq_load_top: movu m0, [sumsq_ptrq-(384+16)*4*1] ; l3/4sq [left] movu m1, [sumsq_ptrq-(384+16)*4*1+16] ; l3/4sq [right] movu m4, [sumsq_ptrq-(384+16)*4*0] ; l2sq [left] movu m5, [sumsq_ptrq-(384+16)*4*0+16] ; l2sq [right] mova [esp+0x1c], m0 mova [esp+0x0c], m1 .sumsq_loop_y: movu m6, [sumsq_ptrq+(384+16)*4*1] ; l1sq [left] movu m7, [sumsq_ptrq+(384+16)*4*1+16] ; l1sq [right] .sumsq_loop_y_second_load: test yd, yd jle .sumsq_emulate_second_load movu m2, [sumsq_ptrq+(384+16)*4*2] ; l0sq [left] movu m3, [sumsq_ptrq+(384+16)*4*2+16] ; l0sq [right] .sumsq_loop_y_noload: paddd m0, [esp+0x1c] paddd m1, [esp+0x0c] paddd m0, m4 paddd m1, m5 paddd m0, m6 paddd m1, m7 paddd m0, m2 paddd m1, m3 movu [sumsq_ptrq+ 0], m0 movu [sumsq_ptrq+16], m1 ; shift position down by one mova m0, m4 mova m1, m5 mova m4, m2 mova m5, m3 mova [esp+0x1c], m6 mova [esp+0x0c], m7 add sumsq_ptrq, (384+16)*4*2 sub yd, 2 jge .sumsq_loop_y ; l1 = l0 mova m6, m2 mova m7, m3 cmp yd, ylimd jg .sumsq_loop_y_noload add xd, 8 cmp xd, wm jl .sumsq_loop_x mov xd, -2 .sum_loop_x: lea yd, [ylimd+2] add yd, hm lea sum_ptrq, [sumq+xq*2+2-(384+16)*2] test byte edgem, 4 ; have_top jnz .sum_load_top movu m0, [sum_ptrq+(384+16)*2*1] mova m1, m0 mova m2, m0 mova m3, m0 jmp .sum_loop_y_second_load .sum_load_top: movu m0, [sum_ptrq-(384+16)*2*1] ; l3/4 movu m2, [sum_ptrq-(384+16)*2*0] ; l2 mova m1, m0 .sum_loop_y: movu m3, [sum_ptrq+(384+16)*2*1] ; l1 .sum_loop_y_second_load: test yd, yd jle .sum_emulate_second_load movu m4, [sum_ptrq+(384+16)*2*2] ; l0 .sum_loop_y_noload: paddw m0, m1 paddw m0, m2 paddw m0, m3 paddw m0, m4 movu [sum_ptrq], m0 ; shift position down by one mova m0, m2 mova m1, m3 mova m2, m4 add sum_ptrq, (384+16)*2*2 sub yd, 2 jge .sum_loop_y ; l1 = l0 mova m3, m4 cmp yd, ylimd jg .sum_loop_y_noload add xd, 8 cmp xd, wm jl .sum_loop_x RET .sumsq_emulate_second_load: mova m2, m6 mova m3, m7 jmp .sumsq_loop_y_noload .sum_emulate_second_load: mova m4, m3 jmp .sum_loop_y_noload %endif cglobal sgr_calc_ab2, 4, 7, 11, a, b, w, h, s movifnidn sd, sm sub aq, (384+16-1)*4 sub bq, (384+16-1)*2 add hd, 2 %if ARCH_X86_64 LEA r5, sgr_x_by_x-0xF03 %else SETUP_PIC r5, 0 %endif movd m6, sd pshuflw m6, m6, q0000 punpcklqdq m6, m6 pxor m7, m7 DEFINE_ARGS a, b, w, h, x %if ARCH_X86_64 mova m8, [pd_0xF0080029] mova m9, [pw_256] psrld m10, m9, 15 ; pd_512 %else %define m8 [PIC_sym(pd_0xF0080029)] %define m9 [PIC_sym(pw_256)] %define m10 [PIC_sym(pd_512)] %endif .loop_y: mov xq, -2 .loop_x: movq m0, [bq+xq*2+0] movq m1, [bq+xq*2+8] punpcklwd m0, m7 punpcklwd m1, m7 movu m2, [aq+xq*4+ 0] movu m3, [aq+xq*4+16] pslld m4, m2, 3 ; aa * 8 pslld m5, m3, 3 paddd m2, m4 ; aa * 9 paddd m3, m5 paddd m4, m4 ; aa * 16 paddd m5, m5 paddd m2, m4 ; aa * 25 paddd m3, m5 pmaddwd m4, m0, m0 pmaddwd m5, m1, m1 psubd m2, m4 ; p = aa * 25 - bb * bb psubd m3, m5 MULLD m2, m6 MULLD m3, m6 paddusw m2, m8 paddusw m3, m8 psrld m2, 20 ; z psrld m3, 20 GATHERDD m4, m2 ; xx GATHERDD m2, m3 psrld m4, 24 psrld m2, 24 packssdw m3, m4, m2 pmullw m4, m8 pmullw m2, m8 psubw m5, m9, m3 pmaddwd m0, m4 pmaddwd m1, m2 paddd m0, m10 paddd m1, m10 psrld m0, 10 psrld m1, 10 movu [bq+xq*2], m5 movu [aq+xq*4+ 0], m0 movu [aq+xq*4+16], m1 add xd, 8 cmp xd, wd jl .loop_x add aq, (384+16)*4*2 add bq, (384+16)*2*2 sub hd, 2 jg .loop_y RET %if ARCH_X86_64 cglobal sgr_finish_filter2, 5, 13, 14, t, src, stride, a, b, w, h, \ tmp_base, src_base, a_base, b_base, x, y movifnidn wd, wm mov hd, hm mov tmp_baseq, tq mov src_baseq, srcq mov a_baseq, aq mov b_baseq, bq mova m9, [pw_5_6] mova m12, [pw_256] psrlw m10, m12, 8 ; pw_1 psrlw m11, m12, 1 ; pw_128 pxor m13, m13 %else cglobal sgr_finish_filter2, 6, 7, 8, t, src, stride, a, b, x, y %define tmp_baseq r0m %define src_baseq r1m %define a_baseq r3m %define b_baseq r4m %define wd r5m %define hd r6m SUB esp, 8 SETUP_PIC yd %define m8 m5 %define m9 [PIC_sym(pw_5_6)] %define m10 [PIC_sym(pw_1)] %define m11 [PIC_sym(pw_128)] %define m12 [PIC_sym(pw_256)] %define m13 m0 %endif xor xd, xd .loop_x: mov tq, tmp_baseq mov srcq, src_baseq mov aq, a_baseq mov bq, b_baseq movu m0, [aq+xq*4-(384+16)*4-4] mova m1, [aq+xq*4-(384+16)*4] movu m2, [aq+xq*4-(384+16)*4+4] movu m3, [aq+xq*4-(384+16)*4-4+16] mova m4, [aq+xq*4-(384+16)*4+16] movu m5, [aq+xq*4-(384+16)*4+4+16] paddd m0, m2 paddd m3, m5 paddd m0, m1 paddd m3, m4 pslld m2, m0, 2 pslld m5, m3, 2 paddd m2, m0 paddd m5, m3 paddd m0, m2, m1 ; prev_odd_b [first half] paddd m1, m5, m4 ; prev_odd_b [second half] movu m3, [bq+xq*2-(384+16)*2-2] mova m4, [bq+xq*2-(384+16)*2] movu m5, [bq+xq*2-(384+16)*2+2] paddw m3, m5 punpcklwd m5, m3, m4 punpckhwd m3, m4 pmaddwd m5, m9 pmaddwd m3, m9 mova m2, m5 packssdw m2, m3 ; prev_odd_a lea tq, [tq+xq*2] lea srcq, [srcq+xq*1] lea aq, [aq+xq*4+(384+16)*4] lea bq, [bq+xq*2+(384+16)*2] %if ARCH_X86_32 mov [esp], PIC_reg %endif mov yd, hd XCHG_PIC_REG .loop_y: movu m3, [aq-4] mova m4, [aq] movu m5, [aq+4] paddd m3, m5 paddd m3, m4 pslld m5, m3, 2 paddd m5, m3 paddd m5, m4 ; cur_odd_b [first half] movu m3, [aq+16-4] mova m6, [aq+16] movu m7, [aq+16+4] paddd m3, m7 paddd m3, m6 pslld m7, m3, 2 paddd m7, m3 paddd m4, m7, m6 ; cur_odd_b [second half] movu m3, [bq-2] mova m6, [bq] movu m7, [bq+2] paddw m3, m7 punpcklwd m7, m3, m6 punpckhwd m3, m6 pmaddwd m7, m9 pmaddwd m3, m9 packssdw m6, m7, m3 ; cur_odd_a paddd m0, m5 ; cur_even_b [first half] paddd m1, m4 ; cur_even_b [second half] paddw m2, m6 ; cur_even_a movq m3, [srcq] %if ARCH_X86_64 punpcklbw m3, m13 %else mova [td], m5 pxor m7, m7 punpcklbw m3, m7 %endif punpcklwd m7, m3, m10 punpckhwd m3, m10 punpcklwd m8, m2, m12 punpckhwd m2, m12 pmaddwd m7, m8 pmaddwd m3, m2 paddd m7, m0 paddd m3, m1 psrad m7, 9 psrad m3, 9 %if ARCH_X86_32 pxor m13, m13 %endif movq m8, [srcq+strideq] punpcklbw m8, m13 punpcklwd m0, m8, m10 punpckhwd m8, m10 punpcklwd m1, m6, m11 punpckhwd m2, m6, m11 pmaddwd m0, m1 pmaddwd m8, m2 %if ARCH_X86_64 paddd m0, m5 %else paddd m0, [td] %endif paddd m8, m4 psrad m0, 8 psrad m8, 8 packssdw m7, m3 packssdw m0, m8 %if ARCH_X86_32 mova m5, [td] %endif mova [tq+384*2*0], m7 mova [tq+384*2*1], m0 mova m0, m5 mova m1, m4 mova m2, m6 add aq, (384+16)*4*2 add bq, (384+16)*2*2 add tq, 384*2*2 lea srcq, [srcq+strideq*2] %if ARCH_X86_64 sub yd, 2 %else sub dword [esp+4], 2 %endif jg .loop_y add xd, 8 cmp xd, wd jl .loop_x %if ARCH_X86_32 ADD esp, 8 %endif RET cglobal sgr_weighted2, 4, 7, 12, dst, stride, t1, t2, w, h, wt movifnidn wd, wm movd m0, wtm %if ARCH_X86_64 movifnidn hd, hm mova m10, [pd_1024] pxor m11, m11 %else SETUP_PIC hd, 0 %define m10 [PIC_sym(pd_1024)] %define m11 m7 %endif pshufd m0, m0, 0 DEFINE_ARGS dst, stride, t1, t2, w, h, idx %if ARCH_X86_32 %define hd hmp %endif .loop_y: xor idxd, idxd .loop_x: mova m1, [t1q+idxq*2+ 0] mova m2, [t1q+idxq*2+16] mova m3, [t2q+idxq*2+ 0] mova m4, [t2q+idxq*2+16] mova m6, [dstq+idxq] %if ARCH_X86_32 pxor m11, m11 %endif punpcklbw m5, m6, m11 punpckhbw m6, m11 psllw m7, m5, 4 psubw m1, m7 psubw m3, m7 psllw m7, m6, 4 psubw m2, m7 psubw m4, m7 punpcklwd m7, m1, m3 punpckhwd m1, m3 punpcklwd m3, m2, m4 punpckhwd m2, m4 pmaddwd m7, m0 pmaddwd m1, m0 pmaddwd m3, m0 pmaddwd m2, m0 paddd m7, m10 paddd m1, m10 paddd m3, m10 paddd m2, m10 psrad m7, 11 psrad m1, 11 psrad m3, 11 psrad m2, 11 packssdw m7, m1 packssdw m3, m2 paddw m7, m5 paddw m3, m6 packuswb m7, m3 mova [dstq+idxq], m7 add idxd, 16 cmp idxd, wd jl .loop_x add dstq, strideq add t1q, 384 * 2 add t2q, 384 * 2 dec hd jg .loop_y RET
libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_sinh.asm
jpoikela/z88dk
640
84180
<filename>libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_sinh.asm SECTION code_clib SECTION code_fp_math48 PUBLIC asm_sinh EXTERN am48_sinh defc asm_sinh = am48_sinh
alloy4fun_models/trashltl/models/7/QC8hRnKyEqKA49yNG.als
Kaixi26/org.alloytools.alloy
0
2241
<gh_stars>0 open main pred idQC8hRnKyEqKA49yNG_prop8 { all f:File| some f.^link implies (eventually f+f.^link in Trash) } pred __repair { idQC8hRnKyEqKA49yNG_prop8 } check __repair { idQC8hRnKyEqKA49yNG_prop8 <=> prop8o }
alloy4fun_models/trashltl/models/7/RRC5EvnTKvtiBSksF.als
Kaixi26/org.alloytools.alloy
0
4171
<gh_stars>0 open main pred idRRC5EvnTKvtiBSksF_prop8 { eventually (all f1,f2:File | f1->f2 in link implies f1 in Trash) } pred __repair { idRRC5EvnTKvtiBSksF_prop8 } check __repair { idRRC5EvnTKvtiBSksF_prop8 <=> prop8o }
test/bugs/Issue166NotSized.agda
alhassy/agda
3
430
<filename>test/bugs/Issue166NotSized.agda -- {-# OPTIONS --sized-types #-} module Issue166NotSized where postulate Size : Set ↑_ : Size → Size ∞ : Size -- {-# BUILTIN SIZE Size #-} -- {-# BUILTIN SIZESUC ↑_ #-} -- {-# BUILTIN SIZEINF ∞ #-} data ⊥ : Set where module M (A : Set) where data SizedNat : {i : Size} → Set where zero : {i : Size} → SizedNat {↑ i} suc : {i : Size} → SizedNat {i} → SizedNat {↑ i} open M ⊥
libsrc/stdio/ansi/vtrendition.asm
jpoikela/z88dk
640
26772
; void vtrendition(attribute) ; 09.2017 stefano SECTION code_clib PUBLIC vtrendition PUBLIC _vtrendition EXTERN ansi_attr .vtrendition ._vtrendition ld a,l jp ansi_attr
test/Succeed/Issue1280.agda
shlevy/agda
1,989
12522
module Issue1280 where open import Common.Prelude open import Common.Reflection infixr 5 _∷_ data Vec (A : Set) : Nat → Set where [] : Vec A 0 _∷_ : ∀ {n} → A → Vec A n → Vec A (suc n) test : Vec _ _ test = 0 ∷ [] quoteTest : Term quoteTest = quoteTerm test unquoteTest = unquote (give quoteTest) data Foo (A : Set) : Set where foo : Foo A ok : Foo Nat ok = unquote (give (quoteTerm (foo {Nat}))) -- This shouldn't type-check. The term `bad` is type-checked because -- the implicit argument of `foo` is missing when using quoteTerm. bad : Foo Bool bad = unquote (give (quoteTerm (foo {Nat})))
oeis/189/A189630.asm
neoneye/loda-programs
11
82474
<filename>oeis/189/A189630.asm ; A189630: Positions of 1 in A189628; complement of A189629. ; Submitted by <NAME> ; 3,6,8,12,15,17,21,23,27,30,33,35,39,42,44,48,50,54,57,60,62,66,68,72,75,78,80,84,87,89,93,96,98,102,104,108,111,114,116,120,123,125,129,131,135,138,141,143,147,149,153,156,159,161,165,168,170,174,177,179,183,185,189,192,195,197,201,203,207,210,213,215,219,222,224,228,231,233,237,239,243 mov $2,$0 add $2,1 add $2,$0 mul $0,3 seq $2,189632 ; Fixed point starting with 0 of the morphism 0->001, 1->100. add $0,$2 mul $2,2 sub $0,$2 add $0,3
oeis/217/A217285.asm
neoneye/loda-programs
11
24145
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A217285: Irregular triangle read by rows: T(n,k) is the number of labeled relations on n nodes with exactly k edges; n>=0, 0<=k<=n^2. ; 1,1,1,1,4,6,4,1,1,9,36,84,126,126,84,36,9,1,1,16,120,560,1820,4368,8008,11440,12870,11440,8008,4368,1820,560,120,16,1,1,25,300,2300,12650,53130,177100,480700,1081575,2042975,3268760,4457400,5200300,5200300,4457400,3268760,2042975,1081575,480700,177100,53130,12650,2300,300,25,1,1,36,630,7140,58905,376992,1947792,8347680,30260340,94143280,254186856,600805296,1251677700,2310789600,3796297200,5567902560,7307872110,8597496600,9075135300,8597496600,7307872110,5567902560,3796297200,2310789600 lpb $0 add $1,1 sub $0,$1 add $1,$2 add $2,2 lpe bin $1,$0 mov $0,$1
libsrc/_DEVELOPMENT/stdlib/c/sccz80/rand.asm
meesokim/z88dk
0
101404
; int rand(void) SECTION code_stdlib PUBLIC rand EXTERN asm_rand defc rand = asm_rand
oeis/219/A219196.asm
neoneye/loda-programs
11
81741
; A219196: A subsequence of the denominators of the Bernoulli numbers: a(n) = A027642(A131577(n)). ; Submitted by <NAME> ; 1,2,6,30,30,510,510,510,510,131070,131070,131070,131070,131070,131070,131070,131070,8589934590,8589934590,8589934590,8589934590,8589934590,8589934590,8589934590,8589934590,8589934590,8589934590,8589934590,8589934590,8589934590,8589934590 sub $0,1 mov $3,2 lpb $0 div $0,2 pow $3,2 lpe sub $2,$3 mul $2,2 sub $2,7 sub $0,$2 sub $0,9
Working Disassembly/General/Sprites/Turbo Spiker/Map - Turbo Spiker Hidden.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
5
162100
Map_87F40: dc.w word_87F42-Map_87F40 word_87F42: dc.w 3 dc.b $D0, $F, 0, $50, $FF, $F0 dc.b $F0, $F, 0, $50, $FF, $F0 dc.b $F0, 3, 0, $50, 0, $10
oeis/179/A179604.asm
neoneye/loda-programs
11
8276
<gh_stars>10-100 ; A179604: Eight white kings and one red king on a 3 X 3 chessboard. G.f.: (1 + x)/(1 - 2*x - 9*x^2 - 2*x^3). ; Submitted by <NAME> ; 1,3,15,59,259,1079,4607,19443,82507,349215,1479879,6267707,26552755,112474631,476459471,2018296131,8549676763,36216937647,153417558423,649886909195,2752965719491,11661748738583,49399962770975 mov $2,1 lpb $0 sub $0,1 add $1,$3 add $1,$3 sub $3,$1 add $1,$2 sub $3,$1 add $1,$3 mul $2,2 sub $2,$3 add $3,$2 lpe mov $0,$2
coverage/PENDING_SUBMIT/amdvlk/0598-COVERAGE-instruction-simplify-1093/work/variant/1_spirv_asm/shader.frag.asm
asuonpaa/ShaderTests
0
11025
<reponame>asuonpaa/ShaderTests<gh_stars>0 ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 10 ; Bound: 60 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %13 %35 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %8 "a" OpName %13 "gl_FragCoord" OpName %35 "_GLF_color" OpName %38 "buf0" OpMemberName %38 0 "_GLF_uniform_int_values" OpName %40 "" OpDecorate %13 BuiltIn FragCoord OpDecorate %35 Location 0 OpDecorate %37 ArrayStride 16 OpMemberDecorate %38 0 Offset 0 OpDecorate %38 Block OpDecorate %40 DescriptorSet 0 OpDecorate %40 Binding 0 %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeInt 32 1 %7 = OpTypePointer Function %6 %9 = OpConstant %6 0 %10 = OpTypeFloat 32 %11 = OpTypeVector %10 4 %12 = OpTypePointer Input %11 %13 = OpVariable %12 Input %14 = OpTypeInt 32 0 %15 = OpConstant %14 1 %16 = OpTypePointer Input %10 %19 = OpConstant %10 10 %20 = OpTypeBool %25 = OpConstant %6 1 %27 = OpConstant %6 2 %34 = OpTypePointer Output %11 %35 = OpVariable %34 Output %36 = OpConstant %14 2 %37 = OpTypeArray %6 %36 %38 = OpTypeStruct %37 %39 = OpTypePointer Uniform %38 %40 = OpVariable %39 Uniform %41 = OpTypePointer Uniform %6 %4 = OpFunction %2 None %3 %5 = OpLabel %8 = OpVariable %7 Function OpStore %8 %9 %17 = OpAccessChain %16 %13 %15 %18 = OpLoad %10 %17 %21 = OpFOrdGreaterThan %20 %18 %19 OpSelectionMerge %23 None OpBranchConditional %21 %22 %23 %22 = OpLabel %24 = OpLoad %6 %8 %26 = OpIAdd %6 %24 %25 OpStore %8 %26 OpBranch %23 %23 = OpLabel %28 = OpLoad %6 %8 %29 = OpSDiv %6 %28 %27 OpStore %8 %29 %30 = OpLoad %6 %8 %31 = OpIEqual %20 %30 %9 OpSelectionMerge %33 None OpBranchConditional %31 %32 %55 %32 = OpLabel %42 = OpAccessChain %41 %40 %9 %9 %43 = OpLoad %6 %42 %44 = OpConvertSToF %10 %43 %45 = OpAccessChain %41 %40 %9 %25 %46 = OpLoad %6 %45 %47 = OpConvertSToF %10 %46 %48 = OpAccessChain %41 %40 %9 %25 %49 = OpLoad %6 %48 %50 = OpConvertSToF %10 %49 %51 = OpAccessChain %41 %40 %9 %9 %52 = OpLoad %6 %51 %53 = OpConvertSToF %10 %52 %54 = OpCompositeConstruct %11 %44 %47 %50 %53 OpStore %35 %54 OpBranch %33 %55 = OpLabel %56 = OpAccessChain %41 %40 %9 %25 %57 = OpLoad %6 %56 %58 = OpConvertSToF %10 %57 %59 = OpCompositeConstruct %11 %58 %58 %58 %58 OpStore %35 %59 OpBranch %33 %33 = OpLabel OpReturn OpFunctionEnd
src/lumen-binary-endian-shorts.adb
darkestkhan/lumen
0
12233
<reponame>darkestkhan/lumen<gh_stars>0 -- Lumen.Binary.Endian.Shorts -- Byte re-ordering routines for "short" -- (16-bit) values -- -- -- <NAME>, NiEstu, Phoenix AZ, Summer 2010 -- This code is covered by the ISC License: -- -- Copyright © 2010, NiEstu -- -- 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. -- Environment with Ada.Unchecked_Conversion; package body Lumen.Binary.Endian.Shorts is --------------------------------------------------------------------------- -- Swap the bytes, no matter the host ordering function Swap_Bytes (Value : Short_Type) return Short_Type is S : Two_Bytes; T : Two_Bytes; function VTT is new Ada.Unchecked_Conversion (Short_Type, Two_Bytes); function TTV is new Ada.Unchecked_Conversion (Two_Bytes, Short_Type); begin -- Swap_Bytes T := VTT (Value); S.B0 := T.B1; S.B1 := T.B0; return TTV (S); end Swap_Bytes; --------------------------------------------------------------------------- -- Swap bytes if host is little-endian, or no-op if it's big-endian function To_Big (Value : Short_Type) return Short_Type is begin -- To_Big if System_Byte_Order /= High_Order_First then return Swap_Bytes (Value); else return Value; end if; end To_Big; --------------------------------------------------------------------------- -- Swap bytes if host is big-endian, or no-op if it's little-endian function To_Little (Value : Short_Type) return Short_Type is begin -- To_Little if System_Byte_Order /= Low_Order_First then return Swap_Bytes (Value); else return Value; end if; end To_Little; --------------------------------------------------------------------------- -- Swap the bytes, no matter the host ordering procedure Swap_Bytes (Value : in out Short_Type) is S : Two_Bytes; T : Two_Bytes; function VTT is new Ada.Unchecked_Conversion (Short_Type, Two_Bytes); function TTV is new Ada.Unchecked_Conversion (Two_Bytes, Short_Type); begin -- Swap_Bytes T := VTT (Value); S.B0 := T.B1; S.B1 := T.B0; Value := TTV (S); end Swap_Bytes; --------------------------------------------------------------------------- -- Swap bytes if host is little-endian, or no-op if it's big-endian procedure To_Big (Value : in out Short_Type) is begin -- To_Big if System_Byte_Order /= High_Order_First then Swap_Bytes (Value); end if; end To_Big; --------------------------------------------------------------------------- -- Swap bytes if host is big-endian, or no-op if it's little-endian procedure To_Little (Value : in out Short_Type) is begin -- To_Little if System_Byte_Order /= Low_Order_First then Swap_Bytes (Value); end if; end To_Little; --------------------------------------------------------------------------- end Lumen.Binary.Endian.Shorts;
libsrc/target/newbrain/warm_reset.asm
jpoikela/z88dk
640
390
<gh_stars>100-1000 ; ; Grundy Newbrain Specific libraries ; ; <NAME> - 05/04/2007 ; ; ; warm reset: foolishly jump to BASIC entry ; ; ; ; $Id: warm_reset.asm,v 1.4 2016-06-19 20:33:40 dom Exp $ ; SECTION code_clib PUBLIC warm_reset PUBLIC _warm_reset .warm_reset ._warm_reset jp 49373