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 |
|---|---|---|---|---|
OutsideIn/Inference/ConstraintGen.agda | liamoc/outside-in | 2 | 9624 | <reponame>liamoc/outside-in
open import OutsideIn.Prelude
open import OutsideIn.X
module OutsideIn.Inference.ConstraintGen(x : X) where
import OutsideIn.Constraints as C
import OutsideIn.TypeSchema as TS
import OutsideIn.Expressions as E
import OutsideIn.Environments as V
open X(x) renaming (funType to _⟶_; appType to _··_)
open C(x)
open TS(x)
open E(x)
open V(x)
open import Data.Vec
private module PlusN-m n = Monad (PlusN-is-monad {n})
module PlusN-f n = Functor (Monad.is-functor (PlusN-is-monad {n}))
module TypeSchema-f {n} = Functor (type-schema-is-functor {n})
module Type-f = Functor (type-is-functor)
module QC-f = Functor (qconstraint-is-functor)
module Exp-f₁ {tv} {r} = Functor (expression-is-functor₁ {tv} {r})
module Exp-f₂ {ev} {r} = Functor (expression-is-functor₂ {ev} {r})
module Constraint-f {s} = Functor (constraint-is-functor {s})
module Vec-f {n} = Functor (vec-is-functor {n})
open Monad (type-is-monad) using () renaming (unit to TVar)
private
upindex : {X : Set → Set}{tv : Set} → ⦃ is-functor : Functor X ⦄ → X tv → X (Ⓢ tv)
upindex ⦃ is-functor ⦄ e = suc <$> e
where open Functor (is-functor)
_↑c : {tv : Set}{s : Strata} → (Constraint tv s) → (Constraint (Ⓢ tv) s)
_↑c {s = s} = upindex ⦃ constraint-is-functor {s} ⦄
_↑e : {ev tv : Set}{r : Shape} → (Expression ev tv r) → (Expression ev (Ⓢ tv) r)
_↑e = upindex ⦃ expression-is-functor₂ ⦄
_↑a : {ev tv : Set}{r : Shape} → (Alternatives ev tv r) → (Alternatives ev (Ⓢ tv) r)
_↑a = upindex ⦃ alternatives-is-functor₂ ⦄
_↑t : {tv : Set} → (Type tv) → (Type (Ⓢ tv))
_↑t = upindex ⦃ type-is-functor ⦄
_↑q : {tv : Set} → (QConstraint tv) → (QConstraint (Ⓢ tv))
_↑q = upindex ⦃ qconstraint-is-functor ⦄
infixr 7 _↑e
infixr 7 _↑c
infixr 7 _↑t
infixr 7 _↑a
applyAll : ∀{tv}(n : ℕ) → Type tv → Type (tv ⨁ n)
applyAll zero x = x
applyAll (suc n) x = applyAll n ((x ↑t) ·· (TVar zero))
funType : ∀{tv}{n} → Vec (Type tv) n → Type tv → Type tv
funType [] t = t
funType (x ∷ xs) t = x ⟶ (funType xs t)
upType : ∀ {n}{tv} → Type tv → Type (tv ⨁ n)
upType {n} t = Type-f.map (Monad.unit (PlusN-is-monad {n})) t
upGamma : ∀ {n}{ev}{tv} → Environment ev tv → Environment ev (tv ⨁ n)
upGamma {n} Γ = TypeSchema-f.map (Monad.unit (PlusN-is-monad {n})) ∘ Γ
upExp : ∀ {n}{ev}{tv}{r} → Expression ev tv r → Expression ev (tv ⨁ n) r
upExp {n} e = Exp-f₂.map (Monad.unit (PlusN-is-monad {n})) e
upAlts : ∀ {n}{ev}{tv}{r} → Alternatives ev tv r → Alternatives ev (tv ⨁ n) r
upAlts {n} e = Functor.map alternatives-is-functor₂ (Monad.unit (PlusN-is-monad {n})) e
mutual
syntax alternativeConstraintGen Γ α₀ α₁ alt C = Γ ►′ alt ∶ α₀ ⟶ α₁ ↝ C
data alternativeConstraintGen {ev : Set}{tv : Set}(Γ : Environment ev tv)(α₀ α₁ : Type tv) :
{r : Shape} → Alternative ev tv r → Constraint tv Extended → Set where
Simple : ∀ {r}{n}{v : Name ev (Datacon n)}{e : Expression _ _ r}{a}{τs}{T}{C}
→ let δ = TVar zero
in Γ v ≡ DC∀ a · τs ⟶ T
→ addAll (Vec-f.map (_↑t) τs) (upGamma {a} Γ ↑Γ) ► (upExp {a} e ↑e) ∶ δ ↝ C
→ Γ ►′ v →′ e ∶ α₀ ⟶ α₁ ↝ Ⅎ′ a · (Ⅎ δ ∼′ (upType {a} α₁ ↑t) ∧′ C) ∧′ applyAll a (TVar T) ∼′ upType {a} α₀
GADT : ∀ {r}{n}{v : Name ev (Datacon n)}{e : Expression _ _ r}{a}{b}{Q}{τs}{T}{C}
→ let δ = TVar zero
in Γ v ≡ DC∀′ a , b · Q ⇒ τs ⟶ T
→ addAll (Vec-f.map (_↑t) τs) (upGamma {b} (upGamma {a} Γ) ↑Γ)
► (upExp {b} (upExp {a} e) ↑e) ∶ δ ↝ C
→ Γ ►′ v →′ e ∶ α₀ ⟶ α₁ ↝ Ⅎ′ a · Ⅎ′ b · (Imp′ Q (Ⅎ (C ∧′ δ ∼′ (upType {b} (upType {a} α₁) ↑t))))
∧′ upType {b} (upType {a} α₀) ∼′ Type-f.map (PlusN-m.unit b) (applyAll a (TVar T))
syntax alternativesConstraintGen Γ α₀ α₁ alts C = Γ ►► alts ∶ α₀ ⟶ α₁ ↝ C
data alternativesConstraintGen {ev : Set}{tv : Set}(Γ : Environment ev tv)(α₀ α₁ : Type tv) :
{r : Shape} → Alternatives ev tv r → Constraint tv Extended → Set where
NoAlternative : Γ ►► esac ∶ α₀ ⟶ α₁ ↝ ε′
AnAlternative : ∀ {r₁ r₂}{a : Alternative _ _ r₁}{as : Alternatives _ _ r₂}{C₁}{C₂}
→ Γ ►′ a ∶ α₀ ⟶ α₁ ↝ C₁
→ Γ ►► as ∶ α₀ ⟶ α₁ ↝ C₂
→ Γ ►► a ∣ as ∶ α₀ ⟶ α₁ ↝ C₂
syntax constraintGen a c b d = a ► b ∶ c ↝ d
data constraintGen {ev : Set}{tv : Set}
(Γ : Environment ev tv)(τ : Type tv) : {r : Shape} →
Expression ev tv r → Constraint tv Extended → Set where
VarCon₁ : ∀ {v}{n}{q}{t}
→ Γ (N v) ≡ ∀′ n · q ⇒ t
→ Γ ► Var (N v) ∶ τ ↝ Ⅎ′ n · QC q ∧′ upType {n} τ ∼′ t
VarCon₂ : ∀ {n}{d}{a}{τs : Vec _ n}{k}
→ Γ (DC d) ≡ DC∀ a · τs ⟶ k
→ Γ ► Var (DC d) ∶ τ ↝ Ⅎ′ a · upType {a} τ ∼′ funType τs (applyAll a (TVar k))
VarCon₃ : ∀ {n}{d}{a}{b}{Q}{τs : Vec _ n}{k}
→ Γ (DC d) ≡ DC∀′ a , b · Q ⇒ τs ⟶ k
→ Γ ► Var (DC d) ∶ τ ↝ Ⅎ′ a · Ⅎ′ b ·
QC Q ∧′ upType {b} (upType {a} τ) ∼′ funType τs (upType {b} (applyAll a (TVar k)))
App : ∀ {r₁}{r₂}{e₁ : Expression _ _ r₁}{e₂ : Expression _ _ r₂}{C₁}{C₂}
→ let α₀ = TVar zero
α₁ = TVar (suc zero)
α₂ = TVar (suc (suc zero))
in upGamma {3} Γ ► upExp {3} e₁ ∶ α₀ ↝ C₁
→ upGamma {3} Γ ► upExp {3} e₂ ∶ α₁ ↝ C₂
→ Γ ► e₁ · e₂ ∶ τ ↝ Ⅎ Ⅎ Ⅎ C₁ ∧′ C₂ ∧′ α₀ ∼′ (α₁ ⟶ α₂) ∧′ upType {3} τ ∼′ α₂
Abs : ∀ {r}{e : Expression _ _ r}{C}
→ let α₀ = TVar zero
α₁ = TVar (suc zero)
in ⟨ ∀′ 0 · ε ⇒ α₀ ⟩, upGamma {2} Γ ► upExp {2} e ∶ α₁ ↝ C
→ Γ ► λ′ e ∶ τ ↝ Ⅎ Ⅎ C ∧′ upType {2} τ ∼′ (α₀ ⟶ α₁)
Let : ∀{r₁}{r₂}{x : Expression _ _ r₁}{y : Expression _ _ r₂}{C₁}{C₂}
→ let α₀ = TVar zero
α₁ = TVar (suc zero)
in upGamma {2} Γ ► upExp {2} x ∶ α₀ ↝ C₁
→ ⟨ ∀′ 0 · ε ⇒ α₀ ⟩, upGamma {2} Γ ► upExp {2} y ∶ α₁ ↝ C₂
→ Γ ► let₁ x in′ y ∶ τ ↝ Ⅎ Ⅎ C₁ ∧′ C₂ ∧′ upType {2} τ ∼′ α₁
LetA : ∀{r₁}{r₂}{x : Expression _ _ r₁}{y : Expression _ _ r₂}{t}{C₁}{C₂}
→ let α₀ = TVar zero
α₁ = TVar (suc zero)
in upGamma {2} Γ ► upExp {2} x ∶ α₀ ↝ C₁
→ ⟨ ∀′ 0 · ε ⇒ α₀ ⟩, upGamma {2} Γ ► upExp {2} y ∶ α₁ ↝ C₂
→ Γ ► let₂ x ∷ t in′ y ∶ τ ↝ Ⅎ Ⅎ C₁ ∧′ C₂ ∧′ upType {2} τ ∼′ α₁ ∧′ upType {2} t ∼′ α₀
GLetA : ∀{n}{r₁}{r₂}{x : Expression _ _ r₁}{y : Expression _ _ r₂}{Q}{t}{C}{C₂}
→ let α₀ = upType {n} (TVar zero)
α₁ = upType {n} (TVar (suc zero))
up2 = PlusN-f.map n (PlusN-m.unit 2)
in upGamma {n} (upGamma {2} Γ) ► Exp-f₂.map up2 x ∶ α₀ ↝ C
→ upGamma {n} (upGamma {2} (⟨ ∀′ n · Q ⇒ t ⟩, Γ)) ► upExp {n} (upExp {2} y) ∶ α₁ ↝ C₂
→ Γ ► let₃ n · x ∷ Q ⇒ t in′ y ∶ τ ↝ Ⅎ Ⅎ Ⅎ′ n · Imp′ (QC-f.map up2 Q) (C ∧′ α₀ ∼′ Type-f.map up2 t)
∧′ C₂ ∧′ upType {n} (upType {2} τ) ∼′ α₁
Case : ∀{r₁}{r₂}{x : Expression _ _ r₁}{alts : Alternatives _ _ r₂}{C₁}{C₂}
→ let α₀ = TVar zero
α₁ = TVar (suc zero)
in upGamma {2} Γ ► upExp {2} x ∶ α₀ ↝ C₁
→ upGamma {2} Γ ►► upAlts {2} alts ∶ α₀ ⟶ α₁ ↝ C₂
→ Γ ► case x of alts ∶ τ ↝ Ⅎ Ⅎ C₁ ∧′ C₂
genConstraint : {ev : Set}{tv : Set}{r : Shape}
(Γ : Environment ev tv)(e : Expression ev tv r)(τ : Type tv) → ∃ (λ C → Γ ► e ∶ τ ↝ C)
genConstraintAlternative : {ev : Set}{tv : Set}{r : Shape} (Γ : Environment ev tv)(a : Alternative ev tv r)(α₀ α₁ : Type tv)
→ ∃ (λ C → Γ ►′ a ∶ α₀ ⟶ α₁ ↝ C)
genConstraintAlternative Γ (n →′ e) α₀ α₁ with Γ n | inspect Γ n
... | DC∀ a · τs ⟶ k | iC p with genConstraint (addAll (Vec-f.map _↑t τs) (upGamma {a} Γ ↑Γ)) (upExp {a} e ↑e) (TVar zero)
... | C , p₂ = _ , Simple p p₂
genConstraintAlternative Γ (n →′ e) α₀ α₁
| DC∀′ a , b · Q ⇒ τs ⟶ k | iC p with genConstraint (addAll (Vec-f.map _↑t τs) (upGamma {b} (upGamma {a} Γ) ↑Γ))
(upExp {b} (upExp {a} e) ↑e)
(TVar zero)
... | C , p₂ = _ , GADT p p₂
genConstraintAlternatives : {ev : Set}{tv : Set}{r : Shape} (Γ : Environment ev tv)(a : Alternatives ev tv r)(α₀ α₁ : Type tv)
→ ∃ (λ C → Γ ►► a ∶ α₀ ⟶ α₁ ↝ C)
genConstraintAlternatives Γ esac α₀ α₁ = _ , NoAlternative
genConstraintAlternatives Γ (a ∣ as) α₀ α₁ with genConstraintAlternative Γ a α₀ α₁ | genConstraintAlternatives Γ as α₀ α₁
... | C₁ , p₁ | C₂ , p₂ = _ , AnAlternative p₁ p₂
genConstraint Γ (Var (N v)) τ with Γ (N v) | inspect Γ (N v)
... | ∀′ n · q ⇒ t | iC prf = _ , VarCon₁ prf
genConstraint Γ (Var (DC d)) τ with Γ (DC d) | inspect Γ (DC d)
... | DC∀ a · τs ⟶ k | iC prf = _ , VarCon₂ prf
... | DC∀′ a , b · q ⇒ τs ⟶ k | iC prf = _ , VarCon₃ prf
genConstraint Γ (e₁ · e₂) τ with genConstraint (upGamma {3} Γ) (upExp {3} e₁) (TVar zero)
| genConstraint (upGamma {3} Γ) (upExp {3} e₂) (TVar (suc zero))
... | C₁ , p₁ | C₂ , p₂ = _ , App p₁ p₂
genConstraint Γ (λ′ e′) τ with genConstraint (⟨ ∀′ 0 · ε ⇒ TVar zero ⟩, upGamma {2} Γ) (upExp {2} e′) (TVar (suc zero))
... | C , p = _ , Abs p
genConstraint Γ (let₁ x in′ y) τ with genConstraint (upGamma {2} Γ) (upExp {2} x) (TVar zero)
| genConstraint (⟨ ∀′ 0 · ε ⇒ TVar zero ⟩, upGamma {2} Γ) (upExp {2} y) (TVar (suc zero))
... | C₁ , p₁ | C₂ , p₂ = _ , Let p₁ p₂
genConstraint Γ (let₂ x ∷ t in′ y) τ with genConstraint (upGamma {2} Γ) (upExp {2} x) (TVar zero)
| genConstraint (⟨ ∀′ 0 · ε ⇒ TVar zero ⟩, upGamma {2} Γ) (upExp {2} y) (TVar (suc zero))
... | C₁ , p₁ | C₂ , p₂ = _ , LetA p₁ p₂
genConstraint Γ (let₃ n · x ∷ Q ⇒ t in′ y) τ with genConstraint (upGamma {n} (upGamma {2} Γ))
(Exp-f₂.map (PlusN-f.map n (PlusN-m.unit 2)) x)
(upType {n} (TVar zero))
| genConstraint (upGamma {n} (upGamma {2} (⟨ ∀′ n · Q ⇒ t ⟩, Γ)))
(upExp {n} (upExp {2} y))
(upType {n} (TVar (suc zero)))
... | C₁ , p₁ | C₂ , p₂ = _ , GLetA p₁ p₂
genConstraint Γ (case x of alts) τ with genConstraint (upGamma {2} Γ) (upExp {2} x) (TVar zero)
| genConstraintAlternatives (upGamma {2} Γ) (upAlts {2} alts) (TVar zero) (TVar (suc zero))
... | C₁ , p₁ | C₂ , p₂ = _ , Case p₁ p₂
|
src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz1_minus_vwuc1.asm | jbrandwood/kickc | 2 | 241854 | ldy #0
lda ({z1}),y
sec
sbc #<{c1}
sta ({z1}),y
iny
lda ({z1}),y
sbc #>{c1}
sta ({z1}),y
|
src/main/antlr4/com/orange/labs/conllparser/Replacements.g4 | lenoch/conllueditor | 0 | 741 | <filename>src/main/antlr4/com/orange/labs/conllparser/Replacements.g4
/* This library is under the 3-Clause BSD License
Copyright (c) 2018-2021, Orange S.A.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@author <NAME>
@version 2.13.1 as of 16th October 2021
*/
/* grammer for the rules to prepare the new values in search and replace and mass edit
... > column:"value"
... > column:token(column2)
... > column:head(head(column2))
e.g.
... > Upos:"NOUN" // set Upos to "NOUN"
... > Feat:"Number=Sing" // adds a feature "Number=Sing" (Number: deletes the feature)
... > Lemma:this(Form) // set lemma to the Form of current token
... > Lemma:this(Misc_Translit) // set lemma to the key Translit from the Misc comlmn
... > Lemma:this(Form)+"er" // set lemma to Form + "er"
... > Lemma:"de" + token(Form) // set lemma to "de" + Form
... > Feat:"Featname"+this(Lemma) // set the feature Featnamer to the value of Lemma
... > Feat:"Gender"+this(Misc_Special) // set the feature Gender to the value of the Misc Special
... > Misc:"Keyname"+head(head(Upos)) // set the key "Keyname" of column MISC to the Upos of the head of the head
... > Lemma:substring(this(Form), 1, 3) // set lemma to the substring (1 - 3) of Form
... > Lemma:substring(this(Form), 1) // set lemma to the substring (1 - end) of Form
The grammer here sees only the part after the first ":"
*/
grammar Replacements;
prog : expression EOF # printResult
;
expression
: token ( ' '* '+' ' '* token )* # element
;
token
: THIS OPEN COLUMN CLOSE # spalte
| head # kopf
| value # wort
| 'substring' OPEN token ',' NUMBER ( ',' NUMBER )? CLOSE # substr
| 'replace' OPEN token ',' value ',' value CLOSE # repl
| 'cap' OPEN token CLOSE # gross
| 'upper' OPEN token CLOSE # block
| 'lower' OPEN token CLOSE # klein
;
head
: HEADKW OPEN COLUMN CLOSE # kopfspalte
| HEADKW OPEN inner=head CLOSE # kopfkopf
;
value
// : '"' (CHAR+ | NUMBER+)+ '"' # wortohne
: CHARS # wortohne
;
// Lexer tules are uppercase
QUOTE : '"' ;
OPEN : '(' ;
CLOSE : ')' ;
THIS : 'this' ;
HEADKW : 'head' ;
COLUMN : 'Form' | 'Lemma' | 'Upos' | 'Xpos' | 'Feat_' [A-Za-z0-9_]+ | 'Deprel' | 'Misc_' ~[")]+ | 'HeadId';
NUMBER: [0-9]+ ;
//CHAR : ~["] ;
CHARS: '"' ~["]+ '"' ;
//fragment NUMBER: [0-9];
//fragment NON_DIGITS : ~["0-9];
//CHAR: (NUMBER+ | NON_DIGITS+ (NUMBER+)?);
// NEWLINE:'\r'? '\n' ; // return newlines to parser (is end-statement signal)
WS : [ \t] + -> skip ;
|
BasicIPC/Metatheory/Hilbert-TarskiConcreteGluedImplicit.agda | mietek/hilbert-gentzen | 29 | 12685 | module BasicIPC.Metatheory.Hilbert-TarskiConcreteGluedImplicit where
open import BasicIPC.Syntax.Hilbert public
open import BasicIPC.Semantics.TarskiConcreteGluedImplicit public
open ImplicitSyntax (_⊢_) public
-- Completeness with respect to a particular model.
module _ {{_ : Model}} where
reify : ∀ {A w} → w ⊩ A → unwrap w ⊢ A
reify {α P} s = syn s
reify {A ▻ B} s = syn s
reify {A ∧ B} s = pair (reify (π₁ s)) (reify (π₂ s))
reify {⊤} s = unit
reify⋆ : ∀ {Ξ w} → w ⊩⋆ Ξ → unwrap w ⊢⋆ Ξ
reify⋆ {∅} ∙ = ∙
reify⋆ {Ξ , A} (ts , t) = reify⋆ ts , reify t
-- Additional useful equipment.
module _ {{_ : Model}} where
⟪K⟫ : ∀ {A B w} → w ⊩ A → w ⊩ B ▻ A
⟪K⟫ {A} a = app ck (reify a) ⅋ K a
⟪S⟫′ : ∀ {A B C w} → w ⊩ A ▻ B ▻ C → w ⊩ (A ▻ B) ▻ A ▻ C
⟪S⟫′ {A} {B} {C} s₁ = app cs (syn s₁) ⅋ λ s₂ →
app (app cs (syn s₁)) (syn s₂) ⅋ ⟪S⟫ s₁ s₂
_⟪,⟫′_ : ∀ {A B w} → w ⊩ A → w ⊩ B ▻ A ∧ B
_⟪,⟫′_ {A} a = app cpair (reify a) ⅋ _,_ a
-- Soundness with respect to all models, or evaluation.
eval : ∀ {A Γ} → Γ ⊢ A → Γ ⊨ A
eval (var i) γ = lookup i γ
eval (app t u) γ = eval t γ ⟪$⟫ eval u γ
eval ci γ = ci ⅋ I
eval ck γ = ck ⅋ ⟪K⟫
eval cs γ = cs ⅋ ⟪S⟫′
eval cpair γ = cpair ⅋ _⟪,⟫′_
eval cfst γ = cfst ⅋ π₁
eval csnd γ = csnd ⅋ π₂
eval unit γ = ∙
-- TODO: Correctness of evaluation with respect to conversion.
-- The canonical model.
private
instance
canon : Model
canon = record
{ _⊩ᵅ_ = λ w P → unwrap w ⊢ α P
}
-- Soundness with respect to the canonical model.
reflectᶜ : ∀ {A w} → unwrap w ⊢ A → w ⊩ A
reflectᶜ {α P} t = t ⅋ t
reflectᶜ {A ▻ B} t = t ⅋ λ a → reflectᶜ (app t (reify a))
reflectᶜ {A ∧ B} t = reflectᶜ (fst t) , reflectᶜ (snd t)
reflectᶜ {⊤} t = ∙
reflectᶜ⋆ : ∀ {Ξ w} → unwrap w ⊢⋆ Ξ → w ⊩⋆ Ξ
reflectᶜ⋆ {∅} ∙ = ∙
reflectᶜ⋆ {Ξ , A} (ts , t) = reflectᶜ⋆ ts , reflectᶜ t
-- Reflexivity and transitivity.
refl⊩⋆ : ∀ {w} → w ⊩⋆ unwrap w
refl⊩⋆ = reflectᶜ⋆ refl⊢⋆
trans⊩⋆ : ∀ {w w′ w″} → w ⊩⋆ unwrap w′ → w′ ⊩⋆ unwrap w″ → w ⊩⋆ unwrap w″
trans⊩⋆ ts us = reflectᶜ⋆ (trans⊢⋆ (reify⋆ ts) (reify⋆ us))
-- Completeness with respect to all models, or quotation.
quot : ∀ {A Γ} → Γ ⊨ A → Γ ⊢ A
quot s = reify (s refl⊩⋆)
-- Normalisation by evaluation.
norm : ∀ {A Γ} → Γ ⊢ A → Γ ⊢ A
norm = quot ∘ eval
-- TODO: Correctness of normalisation with respect to conversion.
|
oeis/221/A221173.asm | neoneye/loda-programs | 11 | 93143 | <reponame>neoneye/loda-programs
; A221173: a(0)=-3, a(1)=4; thereafter a(n) = 2*a(n-1) + a(n-2).
; Submitted by <NAME>
; -3,4,5,14,33,80,193,466,1125,2716,6557,15830,38217,92264,222745,537754,1298253,3134260,7566773,18267806,44102385,106472576,257047537,620567650,1498182837,3616933324,8732049485,21081032294,50894114073,122869260440,296632634953,716134530346,1728901695645,4173937921636,10076777538917,24327492999470,58731763537857,141791020075184,342313803688225,826418627451634,1995151058591493,4816720744634620,11628592547860733,28073905840356086,67776404228572905,163626714297501896,395029832823576697
mov $2,-3
mov $4,10
lpb $0
sub $0,1
mov $3,$4
mov $4,$2
mul $2,2
add $2,$3
lpe
mov $0,$2
|
Exams/Test2_2014_2015/Account.als | pemesteves/MFES_2021 | 0 | 5169 | <reponame>pemesteves/MFES_2021<filename>Exams/Test2_2014_2015/Account.als
sig Account {}
abstract sig Transaction {
amount: Int
}
-- A transaction is either a deposit or a withdrawal
sig Deposit, Withdrawal extends Transaction {}
sig Client {
accounts: some Account, -- a client can access several accounts (1 or more)
withdrawPrivileges: set Account, -- but can’t withdraw from all of them (0..*)
balance: Account set -> lone Int, -- the amount each account currently has
transactions: Account one -> set Transaction -- a list of all account movements
}
pred invariants[c: Client] {
-- the balance of an account should never be lower than 0
all i: c.balance[Account] | i >= 0
-- a client can only withdraw from accounts she has access to
c.withdrawPrivileges in c.accounts
-- a client only has balance from accounts she has access to
c.balance.Int in c.accounts
}
-- transaction t withdraws quantity q from account a of client c,
-- resulting in a new state c1
pred withdraw[c, c1: Client, a: Account, qty: Int, t: Transaction] {
-- pre-conditions (without using predicate invariants)
a in c.accounts
a in c.withdrawPrivileges
c1 = c
qty > 0
qty <= c.balance[a]
-- post-conditions (without using predicate invariants)
t.amount = 0 - qty
c1.balance[a] = c.balance[a] - qty
c1.transactions = c.transactions + a -> t
}
-- gives the total balance of a client c
fun totalBalance[c: Client] : Int {
{sum i: c.balance[Account] | i}
}
assert withdraw_preserves_invariants {
all c, c1: Client, account: Account, qty: Int, t: Transaction |
-- if one withdraws from a consistent client
(invariants[c] and withdraw[c, c1, account, qty, t]) =>
-- one ends up with a new consistent client state
(invariants[c1])
}
check withdraw_preserves_invariants |
programs/oeis/094/A094025.asm | jmorken/loda | 1 | 17766 | ; A094025: Expansion of (1+3x)/((1-x^2)(1-3x^2)).
; 1,3,4,12,13,39,40,120,121,363,364,1092,1093,3279,3280,9840,9841,29523,29524,88572,88573,265719,265720,797160,797161,2391483,2391484,7174452,7174453,21523359,21523360,64570080,64570081,193710243,193710244
mov $1,$0
lpb $0
trn $0,2
add $2,1
add $1,$2
mov $2,$1
sub $1,$0
add $2,$1
lpe
add $1,1
|
xidstart.g4 | jbclements/rust-antlr | 39 | 5476 | <filename>xidstart.g4
grammar Xidstart;
XIDSTART :
'\u0041' .. '\u005a'
| '\u0061' .. '\u007a'
| '\u00aa'
| '\u00b5'
| '\u00ba'
| '\u00c0' .. '\u00d6'
| '\u00d8' .. '\u00f6'
| '\u00f8' .. '\u01ba'
| '\u01bb'
| '\u01bc' .. '\u01bf'
| '\u01c0' .. '\u01c3'
| '\u01c4' .. '\u0293'
| '\u0294'
| '\u0295' .. '\u02af'
| '\u02b0' .. '\u02c1'
| '\u02c6' .. '\u02d1'
| '\u02e0' .. '\u02e4'
| '\u02ec'
| '\u02ee'
| '\u0370' .. '\u0373'
| '\u0374'
| '\u0376' .. '\u0377'
| '\u037b' .. '\u037d'
| '\u0386'
| '\u0388' .. '\u038a'
| '\u038c'
| '\u038e' .. '\u03a1'
| '\u03a3' .. '\u03f5'
| '\u03f7' .. '\u0481'
| '\u048a' .. '\u0527'
| '\u0531' .. '\u0556'
| '\u0559'
| '\u0561' .. '\u0587'
| '\u05d0' .. '\u05ea'
| '\u05f0' .. '\u05f2'
| '\u0620' .. '\u063f'
| '\u0640'
| '\u0641' .. '\u064a'
| '\u066e' .. '\u066f'
| '\u0671' .. '\u06d3'
| '\u06d5'
| '\u06e5' .. '\u06e6'
| '\u06ee' .. '\u06ef'
| '\u06fa' .. '\u06fc'
| '\u06ff'
| '\u0710'
| '\u0712' .. '\u072f'
| '\u074d' .. '\u07a5'
| '\u07b1'
| '\u07ca' .. '\u07ea'
| '\u07f4' .. '\u07f5'
| '\u07fa'
| '\u0800' .. '\u0815'
| '\u081a'
| '\u0824'
| '\u0828'
| '\u0840' .. '\u0858'
| '\u0904' .. '\u0939'
| '\u093d'
| '\u0950'
| '\u0958' .. '\u0961'
| '\u0971'
| '\u0972' .. '\u0977'
| '\u0979' .. '\u097f'
| '\u0985' .. '\u098c'
| '\u098f' .. '\u0990'
| '\u0993' .. '\u09a8'
| '\u09aa' .. '\u09b0'
| '\u09b2'
| '\u09b6' .. '\u09b9'
| '\u09bd'
| '\u09ce'
| '\u09dc' .. '\u09dd'
| '\u09df' .. '\u09e1'
| '\u09f0' .. '\u09f1'
| '\u0a05' .. '\u0a0a'
| '\u0a0f' .. '\u0a10'
| '\u0a13' .. '\u0a28'
| '\u0a2a' .. '\u0a30'
| '\u0a32' .. '\u0a33'
| '\u0a35' .. '\u0a36'
| '\u0a38' .. '\u0a39'
| '\u0a59' .. '\u0a5c'
| '\u0a5e'
| '\u0a72' .. '\u0a74'
| '\u0a85' .. '\u0a8d'
| '\u0a8f' .. '\u0a91'
| '\u0a93' .. '\u0aa8'
| '\u0aaa' .. '\u0ab0'
| '\u0ab2' .. '\u0ab3'
| '\u0ab5' .. '\u0ab9'
| '\u0abd'
| '\u0ad0'
| '\u0ae0' .. '\u0ae1'
| '\u0b05' .. '\u0b0c'
| '\u0b0f' .. '\u0b10'
| '\u0b13' .. '\u0b28'
| '\u0b2a' .. '\u0b30'
| '\u0b32' .. '\u0b33'
| '\u0b35' .. '\u0b39'
| '\u0b3d'
| '\u0b5c' .. '\u0b5d'
| '\u0b5f' .. '\u0b61'
| '\u0b71'
| '\u0b83'
| '\u0b85' .. '\u0b8a'
| '\u0b8e' .. '\u0b90'
| '\u0b92' .. '\u0b95'
| '\u0b99' .. '\u0b9a'
| '\u0b9c'
| '\u0b9e' .. '\u0b9f'
| '\u0ba3' .. '\u0ba4'
| '\u0ba8' .. '\u0baa'
| '\u0bae' .. '\u0bb9'
| '\u0bd0'
| '\u0c05' .. '\u0c0c'
| '\u0c0e' .. '\u0c10'
| '\u0c12' .. '\u0c28'
| '\u0c2a' .. '\u0c33'
| '\u0c35' .. '\u0c39'
| '\u0c3d'
| '\u0c58' .. '\u0c59'
| '\u0c60' .. '\u0c61'
| '\u0c85' .. '\u0c8c'
| '\u0c8e' .. '\u0c90'
| '\u0c92' .. '\u0ca8'
| '\u0caa' .. '\u0cb3'
| '\u0cb5' .. '\u0cb9'
| '\u0cbd'
| '\u0cde'
| '\u0ce0' .. '\u0ce1'
| '\u0cf1' .. '\u0cf2'
| '\u0d05' .. '\u0d0c'
| '\u0d0e' .. '\u0d10'
| '\u0d12' .. '\u0d3a'
| '\u0d3d'
| '\u0d4e'
| '\u0d60' .. '\u0d61'
| '\u0d7a' .. '\u0d7f'
| '\u0d85' .. '\u0d96'
| '\u0d9a' .. '\u0db1'
| '\u0db3' .. '\u0dbb'
| '\u0dbd'
| '\u0dc0' .. '\u0dc6'
| '\u0e01' .. '\u0e30'
| '\u0e32'
| '\u0e40' .. '\u0e45'
| '\u0e46'
| '\u0e81' .. '\u0e82'
| '\u0e84'
| '\u0e87' .. '\u0e88'
| '\u0e8a'
| '\u0e8d'
| '\u0e94' .. '\u0e97'
| '\u0e99' .. '\u0e9f'
| '\u0ea1' .. '\u0ea3'
| '\u0ea5'
| '\u0ea7'
| '\u0eaa' .. '\u0eab'
| '\u0ead' .. '\u0eb0'
| '\u0eb2'
| '\u0ebd'
| '\u0ec0' .. '\u0ec4'
| '\u0ec6'
| '\u0edc' .. '\u0edd'
| '\u0f00'
| '\u0f40' .. '\u0f47'
| '\u0f49' .. '\u0f6c'
| '\u0f88' .. '\u0f8c'
| '\u1000' .. '\u102a'
| '\u103f'
| '\u1050' .. '\u1055'
| '\u105a' .. '\u105d'
| '\u1061'
| '\u1065' .. '\u1066'
| '\u106e' .. '\u1070'
| '\u1075' .. '\u1081'
| '\u108e'
| '\u10a0' .. '\u10c5'
| '\u10d0' .. '\u10fa'
| '\u10fc'
| '\u1100' .. '\u1248'
| '\u124a' .. '\u124d'
| '\u1250' .. '\u1256'
| '\u1258'
| '\u125a' .. '\u125d'
| '\u1260' .. '\u1288'
| '\u128a' .. '\u128d'
| '\u1290' .. '\u12b0'
| '\u12b2' .. '\u12b5'
| '\u12b8' .. '\u12be'
| '\u12c0'
| '\u12c2' .. '\u12c5'
| '\u12c8' .. '\u12d6'
| '\u12d8' .. '\u1310'
| '\u1312' .. '\u1315'
| '\u1318' .. '\u135a'
| '\u1380' .. '\u138f'
| '\u13a0' .. '\u13f4'
| '\u1401' .. '\u166c'
| '\u166f' .. '\u167f'
| '\u1681' .. '\u169a'
| '\u16a0' .. '\u16ea'
| '\u16ee' .. '\u16f0'
| '\u1700' .. '\u170c'
| '\u170e' .. '\u1711'
| '\u1720' .. '\u1731'
| '\u1740' .. '\u1751'
| '\u1760' .. '\u176c'
| '\u176e' .. '\u1770'
| '\u1780' .. '\u17b3'
| '\u17d7'
| '\u17dc'
| '\u1820' .. '\u1842'
| '\u1843'
| '\u1844' .. '\u1877'
| '\u1880' .. '\u18a8'
| '\u18aa'
| '\u18b0' .. '\u18f5'
| '\u1900' .. '\u191c'
| '\u1950' .. '\u196d'
| '\u1970' .. '\u1974'
| '\u1980' .. '\u19ab'
| '\u19c1' .. '\u19c7'
| '\u1a00' .. '\u1a16'
| '\u1a20' .. '\u1a54'
| '\u1aa7'
| '\u1b05' .. '\u1b33'
| '\u1b45' .. '\u1b4b'
| '\u1b83' .. '\u1ba0'
| '\u1bae' .. '\u1baf'
| '\u1bc0' .. '\u1be5'
| '\u1c00' .. '\u1c23'
| '\u1c4d' .. '\u1c4f'
| '\u1c5a' .. '\u1c77'
| '\u1c78' .. '\u1c7d'
| '\u1ce9' .. '\u1cec'
| '\u1cee' .. '\u1cf1'
| '\u1d00' .. '\u1d2b'
| '\u1d2c' .. '\u1d61'
| '\u1d62' .. '\u1d77'
| '\u1d78'
| '\u1d79' .. '\u1d9a'
| '\u1d9b' .. '\u1dbf'
| '\u1e00' .. '\u1f15'
| '\u1f18' .. '\u1f1d'
| '\u1f20' .. '\u1f45'
| '\u1f48' .. '\u1f4d'
| '\u1f50' .. '\u1f57'
| '\u1f59'
| '\u1f5b'
| '\u1f5d'
| '\u1f5f' .. '\u1f7d'
| '\u1f80' .. '\u1fb4'
| '\u1fb6' .. '\u1fbc'
| '\u1fbe'
| '\u1fc2' .. '\u1fc4'
| '\u1fc6' .. '\u1fcc'
| '\u1fd0' .. '\u1fd3'
| '\u1fd6' .. '\u1fdb'
| '\u1fe0' .. '\u1fec'
| '\u1ff2' .. '\u1ff4'
| '\u1ff6' .. '\u1ffc'
| '\u2071'
| '\u207f'
| '\u2090' .. '\u209c'
| '\u2102'
| '\u2107'
| '\u210a' .. '\u2113'
| '\u2115'
| '\u2118'
| '\u2119' .. '\u211d'
| '\u2124'
| '\u2126'
| '\u2128'
| '\u212a' .. '\u212d'
| '\u212e'
| '\u212f' .. '\u2134'
| '\u2135' .. '\u2138'
| '\u2139'
| '\u213c' .. '\u213f'
| '\u2145' .. '\u2149'
| '\u214e'
| '\u2160' .. '\u2182'
| '\u2183' .. '\u2184'
| '\u2185' .. '\u2188'
| '\u2c00' .. '\u2c2e'
| '\u2c30' .. '\u2c5e'
| '\u2c60' .. '\u2c7c'
| '\u2c7d'
| '\u2c7e' .. '\u2ce4'
| '\u2ceb' .. '\u2cee'
| '\u2d00' .. '\u2d25'
| '\u2d30' .. '\u2d65'
| '\u2d6f'
| '\u2d80' .. '\u2d96'
| '\u2da0' .. '\u2da6'
| '\u2da8' .. '\u2dae'
| '\u2db0' .. '\u2db6'
| '\u2db8' .. '\u2dbe'
| '\u2dc0' .. '\u2dc6'
| '\u2dc8' .. '\u2dce'
| '\u2dd0' .. '\u2dd6'
| '\u2dd8' .. '\u2dde'
| '\u3005'
| '\u3006'
| '\u3007'
| '\u3021' .. '\u3029'
| '\u3031' .. '\u3035'
| '\u3038' .. '\u303a'
| '\u303b'
| '\u303c'
| '\u3041' .. '\u3096'
| '\u309d' .. '\u309e'
| '\u309f'
| '\u30a1' .. '\u30fa'
| '\u30fc' .. '\u30fe'
| '\u30ff'
| '\u3105' .. '\u312d'
| '\u3131' .. '\u318e'
| '\u31a0' .. '\u31ba'
| '\u31f0' .. '\u31ff'
| '\u3400' .. '\u4db5'
| '\u4e00' .. '\u9fcb'
| '\ua000' .. '\ua014'
| '\ua015'
| '\ua016' .. '\ua48c'
| '\ua4d0' .. '\ua4f7'
| '\ua4f8' .. '\ua4fd'
| '\ua500' .. '\ua60b'
| '\ua60c'
| '\ua610' .. '\ua61f'
| '\ua62a' .. '\ua62b'
| '\ua640' .. '\ua66d'
| '\ua66e'
| '\ua67f'
| '\ua680' .. '\ua697'
| '\ua6a0' .. '\ua6e5'
| '\ua6e6' .. '\ua6ef'
| '\ua717' .. '\ua71f'
| '\ua722' .. '\ua76f'
| '\ua770'
| '\ua771' .. '\ua787'
| '\ua788'
| '\ua78b' .. '\ua78e'
| '\ua790' .. '\ua791'
| '\ua7a0' .. '\ua7a9'
| '\ua7fa'
| '\ua7fb' .. '\ua801'
| '\ua803' .. '\ua805'
| '\ua807' .. '\ua80a'
| '\ua80c' .. '\ua822'
| '\ua840' .. '\ua873'
| '\ua882' .. '\ua8b3'
| '\ua8f2' .. '\ua8f7'
| '\ua8fb'
| '\ua90a' .. '\ua925'
| '\ua930' .. '\ua946'
| '\ua960' .. '\ua97c'
| '\ua984' .. '\ua9b2'
| '\ua9cf'
| '\uaa00' .. '\uaa28'
| '\uaa40' .. '\uaa42'
| '\uaa44' .. '\uaa4b'
| '\uaa60' .. '\uaa6f'
| '\uaa70'
| '\uaa71' .. '\uaa76'
| '\uaa7a'
| '\uaa80' .. '\uaaaf'
| '\uaab1'
| '\uaab5' .. '\uaab6'
| '\uaab9' .. '\uaabd'
| '\uaac0'
| '\uaac2'
| '\uaadb' .. '\uaadc'
| '\uaadd'
| '\uab01' .. '\uab06'
| '\uab09' .. '\uab0e'
| '\uab11' .. '\uab16'
| '\uab20' .. '\uab26'
| '\uab28' .. '\uab2e'
| '\uabc0' .. '\uabe2'
| '\uac00' .. '\ud7a3'
| '\ud7b0' .. '\ud7c6'
| '\ud7cb' .. '\ud7fb'
| '\uf900' .. '\ufa2d'
| '\ufa30' .. '\ufa6d'
| '\ufa70' .. '\ufad9'
| '\ufb00' .. '\ufb06'
| '\ufb13' .. '\ufb17'
| '\ufb1d'
| '\ufb1f' .. '\ufb28'
| '\ufb2a' .. '\ufb36'
| '\ufb38' .. '\ufb3c'
| '\ufb3e'
| '\ufb40' .. '\ufb41'
| '\ufb43' .. '\ufb44'
| '\ufb46' .. '\ufbb1'
| '\ufbd3' .. '\ufc5d'
| '\ufc64' .. '\ufd3d'
| '\ufd50' .. '\ufd8f'
| '\ufd92' .. '\ufdc7'
| '\ufdf0' .. '\ufdf9'
| '\ufe71'
| '\ufe73'
| '\ufe77'
| '\ufe79'
| '\ufe7b'
| '\ufe7d'
| '\ufe7f' .. '\ufefc'
| '\uff21' .. '\uff3a'
| '\uff41' .. '\uff5a'
| '\uff66' .. '\uff6f'
| '\uff70'
| '\uff71' .. '\uff9d'
| '\uffa0' .. '\uffbe'
| '\uffc2' .. '\uffc7'
| '\uffca' .. '\uffcf'
| '\uffd2' .. '\uffd7'
| '\uffda' .. '\uffdc'
| '\U00010000' .. '\U0001000b'
| '\U0001000d' .. '\U00010026'
| '\U00010028' .. '\U0001003a'
| '\U0001003c' .. '\U0001003d'
| '\U0001003f' .. '\U0001004d'
| '\U00010050' .. '\U0001005d'
| '\U00010080' .. '\U000100fa'
| '\U00010140' .. '\U00010174'
| '\U00010280' .. '\U0001029c'
| '\U000102a0' .. '\U000102d0'
| '\U00010300' .. '\U0001031e'
| '\U00010330' .. '\U00010340'
| '\U00010341'
| '\U00010342' .. '\U00010349'
| '\U0001034a'
| '\U00010380' .. '\U0001039d'
| '\U000103a0' .. '\U000103c3'
| '\U000103c8' .. '\U000103cf'
| '\U000103d1' .. '\U000103d5'
| '\U00010400' .. '\U0001044f'
| '\U00010450' .. '\U0001049d'
| '\U00010800' .. '\U00010805'
| '\U00010808'
| '\U0001080a' .. '\U00010835'
| '\U00010837' .. '\U00010838'
| '\U0001083c'
| '\U0001083f' .. '\U00010855'
| '\U00010900' .. '\U00010915'
| '\U00010920' .. '\U00010939'
| '\U00010a00'
| '\U00010a10' .. '\U00010a13'
| '\U00010a15' .. '\U00010a17'
| '\U00010a19' .. '\U00010a33'
| '\U00010a60' .. '\U00010a7c'
| '\U00010b00' .. '\U00010b35'
| '\U00010b40' .. '\U00010b55'
| '\U00010b60' .. '\U00010b72'
| '\U00010c00' .. '\U00010c48'
| '\U00011003' .. '\U00011037'
| '\U00011083' .. '\U000110af'
| '\U00012000' .. '\U0001236e'
| '\U00012400' .. '\U00012462'
| '\U00013000' .. '\U0001342e'
| '\U00016800' .. '\U00016a38'
| '\U0001b000' .. '\U0001b001'
| '\U0001d400' .. '\U0001d454'
| '\U0001d456' .. '\U0001d49c'
| '\U0001d49e' .. '\U0001d49f'
| '\U0001d4a2'
| '\U0001d4a5' .. '\U0001d4a6'
| '\U0001d4a9' .. '\U0001d4ac'
| '\U0001d4ae' .. '\U0001d4b9'
| '\U0001d4bb'
| '\U0001d4bd' .. '\U0001d4c3'
| '\U0001d4c5' .. '\U0001d505'
| '\U0001d507' .. '\U0001d50a'
| '\U0001d50d' .. '\U0001d514'
| '\U0001d516' .. '\U0001d51c'
| '\U0001d51e' .. '\U0001d539'
| '\U0001d53b' .. '\U0001d53e'
| '\U0001d540' .. '\U0001d544'
| '\U0001d546'
| '\U0001d54a' .. '\U0001d550'
| '\U0001d552' .. '\U0001d6a5'
| '\U0001d6a8' .. '\U0001d6c0'
| '\U0001d6c2' .. '\U0001d6da'
| '\U0001d6dc' .. '\U0001d6fa'
| '\U0001d6fc' .. '\U0001d714'
| '\U0001d716' .. '\U0001d734'
| '\U0001d736' .. '\U0001d74e'
| '\U0001d750' .. '\U0001d76e'
| '\U0001d770' .. '\U0001d788'
| '\U0001d78a' .. '\U0001d7a8'
| '\U0001d7aa' .. '\U0001d7c2'
| '\U0001d7c4' .. '\U0001d7cb'
| '\U00020000' .. '\U0002a6d6'
| '\U0002a700' .. '\U0002b734'
| '\U0002b740' .. '\U0002b81d'
| '\U0002f800' .. '\U0002fa1d'
;
|
game/data/tilesets/logo.asm | benoitryder/super-tilt-bro | 91 | 21907 | <gh_stars>10-100
TILESET_LOGO_BANK_NUMBER = CURRENT_BANK_NUMBER
tileset_logo:
; Tileset's size in tiles (zero means 256)
.byt (tileset_logo_end-tileset_logo_tiles)/16
tileset_logo_tiles:
; Super Tilt Bro. Logo
;
; Full picture layout
; $00 $00 $00 $00 $01 $02 $03 $04 $05 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
; $00 $00 $00 $00 $06 $07 $08 $09 $0a $0b $0c $0d $0e $0b $0f $10 $11 $12 $13 $14 $0b $0f $15 $00 $00 $00 $00 $00
; $00 $00 $00 $00 $16 $17 $18 $19 $1a $1b $19 $1c $1a $1b $1d $1e $1f $20 $21 $22 $1b $1d $1e $23 $00 $00 $00 $00
; $00 $00 $00 $00 $24 $25 $26 $27 $28 $1b $19 $1c $1a $29 $2a $2b $1f $2c $2d $1a $29 $2a $2e $2f $00 $00 $00 $00
; $00 $00 $00 $00 $30 $31 $32 $33 $34 $35 $19 $1c $1a $36 $37 $19 $1f $38 $39 $1a $36 $3a $3b $00 $00 $00 $00 $00
; $00 $00 $00 $00 $3c $3d $3e $3f $40 $41 $42 $43 $44 $29 $45 $46 $47 $2c $48 $49 $29 $4a $4b $4c $00 $00 $00 $00
; $00 $00 $00 $00 $4d $4e $4f $50 $00 $51 $4f $52 $53 $4f $54 $55 $4f $4f $4f $56 $4f $57 $4f $58 $00 $00 $00 $00
; $59 $03 $03 $03 $5a $5b $00 $00 $00 $00 $00 $00 $00 $5c $03 $5d $5e $05 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
; $5f $60 $61 $62 $63 $64 $65 $66 $67 $68 $69 $6a $6b $6c $61 $6d $6e $6f $70 $0b $0f $15 $71 $72 $73 $74 $00 $00
; $75 $76 $77 $78 $19 $77 $79 $77 $79 $7a $7b $7c $7d $76 $77 $7e $7f $80 $1a $1b $1d $1e $81 $82 $83 $84 $85 $00
; $00 $86 $77 $78 $19 $77 $79 $77 $79 $19 $7b $87 $00 $86 $77 $88 $89 $8a $1a $29 $2a $2b $8b $20 $19 $8c $8d $00
; $00 $86 $77 $78 $19 $77 $79 $77 $79 $19 $7b $87 $00 $86 $77 $78 $8e $8f $1a $36 $3a $90 $91 $92 $93 $94 $95 $96
; $00 $97 $98 $99 $9a $98 $9b $98 $9c $9d $9e $9f $a0 $a1 $98 $a2 $a3 $a4 $44 $29 $4a $a5 $a6 $a7 $a8 $a9 $aa $ab
; $00 $ac $4f $ad $ae $4f $af $4f $4f $b0 $b1 $ad $b2 $ac $4f $4f $b3 $b4 $b5 $4f $b6 $4f $b7 $51 $b3 $b8 $b9 $ba
; $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
; $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000001, %00000011, %00000111
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000001, %00000011
.byt %00000011, %00001111, %00111111, %01111100, %11110011, %11101111, %11011111, %10111111
.byt %00000000, %00000011, %00001111, %00111111, %01111100, %11110000, %11100000, %11000000
.byt %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111, %11111111
.byt %00000000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %00000000
.byt %00000000, %11100000, %11111000, %11111110, %00011111, %11100111, %11111001, %11111110
.byt %00000000, %00000000, %11100000, %11111000, %11111110, %00011111, %00000111, %00000001
.byt %00000000, %00000000, %00000000, %00000000, %10000000, %11000000, %11100000, %11110000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %10000000, %11000000, %11100000
.byt %00001111, %00001110, %00011101, %00011101, %00111011, %00111011, %00111011, %00111011
.byt %00000111, %00000111, %00001110, %00001110, %00011100, %00011100, %00011100, %00011100
.byt %01111111, %11111111, %11111110, %11111101, %11111011, %11111011, %11111011, %11111011
.byt %10000000, %00000000, %00000001, %00000011, %00000111, %00000111, %00000111, %00000111
.byt %11000000, %00111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %00111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11111110, %00111110, %11011110, %11011110, %11011110, %11011110, %11100001, %11111111
.byt %00000001, %11000001, %11100001, %11100001, %11100001, %11100001, %11111111, %11111111
.byt %11111111, %11111111, %11111111, %11110000, %11101111, %11101111, %11101111, %11110001
.byt %11110000, %11111111, %11111111, %11111111, %11110000, %11110000, %11110000, %11111110
.byt %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111, %11111000
.byt %00000000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %00000111
.byt %00000000, %11000011, %11111111, %11111111, %01111110, %01111110, %01111110, %11111111
.byt %00000000, %00000000, %11000011, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111, %00011110
.byt %00000000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %11100001
.byt %11111111, %11111111, %11111111, %00110000, %11001111, %11001111, %11001111, %00110001
.byt %00000000, %11111111, %11111111, %11111111, %00110000, %00110000, %00110000, %11111110
.byt %11100000, %11111100, %11111111, %00011111, %11100011, %11111100, %11111111, %00011111
.byt %00000000, %11100000, %11111100, %11111111, %00011111, %00000011, %00000000, %11100000
.byt %00000000, %00000001, %10000011, %11111111, %11111110, %01111110, %10011110, %11101111
.byt %00000000, %00000000, %00000001, %10000011, %11111111, %11111111, %01111111, %00011111
.byt %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111, %00011111
.byt %00000000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %11100000
.byt %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111, %10000000
.byt %00000000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %01111111
.byt %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111, %00000111
.byt %00000000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %11111000
.byt %11111111, %11111111, %11111111, %11110000, %01101111, %01101111, %01101111, %01110001
.byt %00000000, %11111111, %11111111, %11111111, %11110000, %11110000, %11110000, %11111110
.byt %00000000, %00000000, %10000000, %11100000, %11111000, %01111100, %10011110, %11101111
.byt %00000000, %00000000, %00000000, %10000000, %11100000, %11111000, %01111100, %00011110
.byt %00111011, %00111011, %00111011, %00111011, %00111011, %00011101, %00011110, %00001111
.byt %00011100, %00011100, %00011100, %00011100, %00011100, %00001110, %00001111, %00000111
.byt %11111011, %11111011, %11111101, %11111110, %11111111, %11111111, %11111111, %01111111
.byt %00000111, %00000111, %00000011, %00000001, %00000000, %00000000, %00000000, %10000000
.byt %11111111, %11111111, %11111111, %11111111, %01111111, %10011111, %11100011, %11111100
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %01111111, %00011111, %00000011
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11111101, %11111101, %11111101, %11111101, %11111101, %11111101, %11111101, %11111101
.byt %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110
.byt %11111011, %11111011, %11111011, %11111011, %11111011, %11111011, %11111011, %11111011
.byt %00000111, %00000111, %00000111, %00000111, %00000111, %00000111, %00000111, %00000111
.byt %11011110, %11011110, %11011110, %11011110, %11011110, %11011110, %11011110, %11011110
.byt %11100001, %11100001, %11100001, %11100001, %11100001, %11100001, %11100001, %11100001
.byt %11100111, %11111011, %11111101, %11111110, %11111110, %11111110, %11111110, %11111110
.byt %11111000, %11111100, %11111110, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11110111, %11111011, %11111101, %11111110, %11111110, %11111110, %11111110, %11111110
.byt %00001111, %00000111, %00000011, %00000001, %00000001, %00000001, %00000001, %00000001
.byt %11011111, %11011111, %11011111, %11011111, %11011111, %11011111, %11011111, %11011111
.byt %11100000, %11100000, %11100000, %11100000, %11100000, %11100000, %11100000, %11100000
.byt %10111111, %10111111, %10111111, %10111111, %10111111, %10111111, %10111111, %10111111
.byt %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111
.byt %11110111, %11110111, %11111000, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11111000, %11111000, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %01111101, %01111101, %11111101, %11111101, %11111101, %11111101, %11111101, %11111101
.byt %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110
.byt %10000000, %11000000, %11000000, %11100000, %11100000, %11100000, %11100000, %11100000
.byt %00000000, %10000000, %10000000, %11000000, %11000000, %11000000, %11000000, %11000000
.byt %00000111, %00000011, %00000001, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000011, %00000001, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %10111111, %11011111, %11100111, %11111001, %01111110, %00011111, %00000111, %00000001
.byt %11000000, %11100000, %11111000, %01111110, %00011111, %00000111, %00000001, %00000000
.byt %11111111, %11111111, %11111111, %11111111, %01111111, %10011111, %11100111, %11111001
.byt %00000000, %00000000, %00000000, %00000000, %10000000, %11100000, %11111000, %11111110
.byt %00111111, %11001111, %11110111, %11111011, %11111101, %11111110, %11111111, %11111111
.byt %11111111, %00111111, %00001111, %00000111, %00000011, %00000001, %00000000, %00000000
.byt %11111101, %11111101, %11111101, %11111101, %11111101, %11111101, %01111101, %10111101
.byt %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %01111110
.byt %11111011, %11111011, %11111011, %11111011, %11111000, %11111111, %11111111, %11111111
.byt %00000111, %00000111, %00000111, %00000111, %00000111, %00000000, %00000000, %00000000
.byt %11111110, %11111101, %11111011, %11100111, %00011111, %11111111, %11111111, %11111110
.byt %11111111, %11111110, %11111100, %11111000, %11100000, %00000000, %00000000, %00000001
.byt %11111110, %11111101, %11111011, %11110111, %11101111, %11011111, %10111111, %01111111
.byt %00000001, %00000011, %00000111, %00001111, %00011111, %00111111, %01111111, %11111111
.byt %10111111, %10111111, %10111111, %10111111, %10000000, %11111111, %11111111, %11111111
.byt %01111111, %01111111, %01111111, %01111111, %01111111, %00000000, %00000000, %00000000
.byt %11111111, %10011111, %01101111, %01101111, %01101111, %11101111, %11101111, %11101111
.byt %11111111, %11111111, %10011111, %10011111, %10011111, %00011111, %00011111, %00011111
.byt %11111110, %11111101, %11111011, %11110111, %11101111, %11011110, %10111100, %01111000
.byt %00000001, %00000011, %00000111, %00001111, %00011110, %00111100, %01111000, %11110000
.byt %11100000, %11000000, %11000000, %10000000, %00000000, %00000000, %00000000, %00000000
.byt %11000000, %10000000, %10000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000011, %00001111, %00011111, %00011100, %00111011, %00111011, %00111011, %00111011
.byt %00000000, %00000011, %00001111, %00001111, %00011100, %00011100, %00011100, %00011100
.byt %11000001, %11110001, %11111111, %00111111, %11011111, %11011111, %11011111, %11011111
.byt %00000000, %11000000, %11110001, %11111111, %00111111, %00111111, %00111111, %00111111
.byt %11111110, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11111111, %01111111, %10111111, %11011111, %11011111, %11011111, %11011111, %11011111
.byt %00000000, %10000000, %11000000, %11100000, %11100000, %11100000, %11100000, %11100000
.byt %10111101, %11011101, %11011101, %11011101, %11011101, %11011101, %11011110, %11011110
.byt %01111110, %00111110, %00111110, %00111110, %00111110, %00111110, %00111111, %00111111
.byt %11111011, %11111011, %11111011, %11111011, %11111011, %11111011, %11111011, %11111101
.byt %00000111, %00000111, %00000111, %00000111, %00000111, %00000111, %00000111, %00000011
.byt %11111000, %11111011, %11111011, %11111011, %11111011, %11111011, %11111011, %11111011
.byt %00000111, %00000111, %00000111, %00000111, %00000111, %00000111, %00000111, %00000111
.byt %00000001, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %10000000, %10111111, %10111111, %10111111, %10111111, %10111111, %10111111, %10111111
.byt %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111
.byt %01101111, %01101111, %01101111, %10011111, %11111111, %11111111, %11111111, %11111111
.byt %10011111, %10011111, %10011111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %01111110, %01111110, %10111111, %10111111, %11011111, %11011111, %11101111, %11101111
.byt %10000001, %10000001, %11000000, %11000000, %11100000, %11100000, %11110000, %11110000
.byt %11111000, %11110000, %01110000, %01110000, %10111000, %10111000, %11011100, %11011100
.byt %11110000, %11100000, %11100000, %11100000, %01110000, %01110000, %00111000, %00111000
.byt %00111011, %00111011, %00011101, %00011101, %00001110, %00001111, %00000111, %00000011
.byt %00011100, %00011100, %00001110, %00001110, %00000111, %00000111, %00000011, %00000001
.byt %11011111, %11011111, %11101111, %11110111, %11111000, %01111111, %10111111, %11001111
.byt %00111111, %00111111, %00011111, %00001111, %00000111, %10000000, %11000000, %11110000
.byt %11111111, %11111111, %11111111, %11111100, %00000011, %11111111, %11111111, %11111111
.byt %11111111, %11111111, %11111111, %11111111, %11111100, %00000000, %00000000, %00000000
.byt %11011111, %10111111, %01111111, %11111111, %11111110, %11111101, %11111011, %11100111
.byt %11100000, %11000000, %10000000, %00000000, %00000001, %00000011, %00000111, %00011111
.byt %11011110, %10111110, %10111110, %01111110, %11111111, %11100111, %11000011, %10000001
.byt %00111111, %01111111, %01111111, %11111111, %11100111, %11000011, %10000001, %00000000
.byt %11111101, %11111101, %11111101, %11111100, %01111111, %10111111, %11011111, %11100111
.byt %00000011, %00000011, %00000011, %00000011, %10000000, %11000000, %11100000, %11111000
.byt %11111111, %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000
.byt %10011110, %01111001, %01111011, %01111011, %11110111, %11110111, %11101111, %00011111
.byt %11100001, %10000111, %10000111, %10000111, %00001111, %00001111, %00011111, %11111111
.byt %11111101, %11111101, %11111101, %11111101, %11110001, %11101111, %11101111, %11101111
.byt %11111110, %11111110, %11111110, %11111110, %11111110, %11110000, %11110000, %11110000
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %01111111, %01111111, %01111111
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111110, %11111110, %11111110
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11011111, %11011111, %11011111, %11011111, %00011111, %11111111, %11111111, %11111111
.byt %11100000, %11100000, %11100000, %11100000, %11100000, %00000000, %00000000, %00000000
.byt %11111111, %11111110, %11111101, %11111101, %00000001, %11111111, %11111111, %11111111
.byt %11111111, %11111111, %11111110, %11111110, %11111110, %00000000, %00000000, %00000000
.byt %11111101, %00111101, %11011101, %11011101, %11010001, %11001111, %11001111, %00101111
.byt %11111110, %11111110, %00111110, %00111110, %00111110, %00110000, %00110000, %11110000
.byt %11110111, %11110111, %11111011, %11111011, %11111101, %01111101, %01111101, %01111101
.byt %11111000, %11111000, %11111100, %11111100, %11111110, %11111110, %11111110, %11111110
.byt %11101110, %11101111, %11110111, %11110111, %11111000, %11111111, %11111111, %11111111
.byt %00011100, %00011110, %00001111, %00001111, %00000111, %00000000, %00000000, %00000000
.byt %00000000, %10000000, %11000000, %11100000, %11100000, %01110000, %01110000, %01110000
.byt %00000000, %00000000, %10000000, %11000000, %11000000, %11100000, %11100000, %11100000
.byt %00000001, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11110000, %11111111, %00111111, %00001111, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %00111111, %00001111, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00011111, %11111110, %11111000, %11100000, %00000000, %00000000, %00000000, %00000000
.byt %11111110, %11111000, %11100000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11111000, %01111111, %00011111, %00000111, %00000000, %00000000, %00000000, %00000000
.byt %01111111, %00011111, %00000111, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %11110000, %10000000, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11110000, %10000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11110000, %11111111, %01111111, %00111111, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %01111111, %00111111, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %11100000, %10000000, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11100000, %10000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %00000111, %00000001, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %00000111, %00000001, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11110000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11111110, %11111111, %11111111, %11000000, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %11000001, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11100000, %11100000, %11000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11000000, %11000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000111, %00001111, %00011111, %00111100, %00111011, %01111011, %01110111, %01110111
.byt %00000000, %00000111, %00001111, %00011111, %00011100, %00111100, %00111000, %00111000
.byt %11111000, %11111110, %11111111, %00000111, %11111011, %11111011, %11111101, %11111101
.byt %00000000, %11111000, %11111110, %11111111, %00000111, %00000111, %00000011, %00000011
.byt %00000000, %00000000, %00000000, %10000000, %11000000, %11000000, %11100000, %11110000
.byt %00000000, %00000000, %00000000, %00000000, %10000000, %10000000, %11000000, %11100000
.byt %00000011, %00000111, %00001111, %00011110, %00011101, %00011101, %00011101, %00011101
.byt %00000000, %00000011, %00000111, %00001111, %00001110, %00001110, %00001110, %00001110
.byt %11111100, %11111111, %11111111, %00000111, %11111000, %11111111, %11111111, %11111111
.byt %00000000, %11111100, %11111111, %11111111, %00000111, %00000000, %00000000, %00000000
.byt %00000000, %11100000, %11111100, %11111111, %00011111, %11100111, %11111001, %11111110
.byt %00000000, %00000000, %11100000, %11111100, %11111111, %00011111, %00000111, %00000001
.byt %01110111, %01110111, %01110111, %01110111, %01111011, %00111100, %00111111, %00011111
.byt %00111000, %00111000, %00111000, %00111000, %00111100, %00011111, %00011111, %00001111
.byt %11111111, %11000000, %00111111, %01111111, %01111111, %11100011, %11100011, %11000011
.byt %00000000, %00111111, %11111111, %11111111, %11100001, %11000001, %11000001, %10000001
.byt %11111111, %00111111, %10111111, %10111111, %10111111, %10111111, %10111111, %10111111
.byt %00000000, %11000000, %11000000, %11000000, %11000000, %11000000, %11000000, %11000000
.byt %11111111, %11000000, %11011111, %11011111, %11011111, %11011111, %11011111, %11011111
.byt %00000000, %00111111, %00111111, %00111111, %00111111, %00111111, %00111111, %00111111
.byt %11111101, %01111101, %10011101, %11011100, %11011011, %11100011, %11111011, %11111100
.byt %00000011, %10000011, %11100011, %11100011, %11100100, %11111100, %11111100, %11111111
.byt %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111, %00111111
.byt %11110000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %11000000
.byt %11111111, %11111111, %11111111, %00001110, %11110101, %11110101, %11110101, %00001110
.byt %00000000, %11111111, %11111111, %11111111, %00001110, %00001110, %00001110, %11111111
.byt %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111, %00111111
.byt %00000000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %11000000
.byt %11000000, %11110000, %11111111, %00111111, %11011111, %11011111, %11011111, %00111111
.byt %00000000, %11000000, %11110000, %11111111, %00111111, %00111111, %00111111, %11111111
.byt %00001111, %00111111, %11111111, %11110000, %11101111, %11011111, %11011111, %11011100
.byt %00000000, %00001111, %00111111, %11111111, %11110000, %11100000, %11100000, %11100011
.byt %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111, %00001111
.byt %00000000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %11110000
.byt %11111111, %11111111, %11111111, %00000000, %11111111, %11111111, %11111111, %11000000
.byt %00000000, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000, %00111111
.byt %11110000, %11111100, %11111110, %00001111, %11110111, %11111011, %11111011, %00111011
.byt %00000000, %11110000, %11111100, %11111110, %00001110, %00000111, %00000111, %11000111
.byt %00011101, %00011110, %00001111, %00000111, %00000011, %10000011, %10000011, %10000011
.byt %00001110, %00001111, %00000111, %00000011, %00000001, %00000001, %00000001, %00000001
.byt %11111111, %11000001, %11011110, %11011111, %11011111, %11011111, %11011111, %11011111
.byt %00000000, %00111110, %00111111, %00111111, %00111111, %00111111, %00111111, %00111111
.byt %11111111, %11111111, %01111111, %10111111, %11011111, %11011111, %11101111, %11101111
.byt %00000000, %00000000, %10000000, %11000000, %11100000, %11100000, %11110000, %11110000
.byt %01111000, %10111100, %11011100, %11101110, %11101111, %11110111, %11110111, %11110111
.byt %11110000, %01111000, %00111000, %00011100, %00011110, %00001111, %00001111, %00001111
.byt %00001111, %00111111, %01111111, %01110000, %11101111, %11101111, %11101111, %11110001
.byt %00000000, %00001111, %00111111, %00111111, %01110000, %11110000, %11110000, %11111110
.byt %00000000, %00000000, %00000000, %00000000, %00000001, %00000011, %00000111, %00011111
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000001, %00000011, %00000111
.byt %00000111, %00011111, %01111111, %11111000, %11100111, %11011111, %10111111, %01111110
.byt %00000000, %00000111, %00011111, %01111111, %11111000, %11100000, %11000000, %10000001
.byt %11111100, %11111111, %11111111, %00000011, %11111100, %11111111, %11111111, %00001111
.byt %00000000, %11111100, %11111111, %11111111, %00000011, %00000000, %00000000, %11110000
.byt %00000000, %00000000, %11000000, %11100000, %11110000, %01111000, %10111100, %11011110
.byt %00000000, %00000000, %00000000, %11000000, %11100000, %11110000, %01111000, %00111100
.byt %00001111, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %10000011, %00000011, %00000011, %00000011, %00000011, %00000011, %00000011, %00000011
.byt %00000001, %00000001, %00000001, %00000001, %00000001, %00000001, %00000001, %00000001
.byt %10111111, %10111111, %10111111, %10111111, %10111111, %10111111, %10111111, %10111111
.byt %11000000, %11000000, %11000000, %11000000, %11000000, %11000000, %11000000, %11000000
.byt %11011111, %11011111, %11011111, %11011111, %11011111, %11011111, %11011111, %11011111
.byt %00111111, %00111111, %00111111, %00111111, %00111111, %00111111, %00111111, %00111111
.byt %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111, %01111111
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11011101, %11101101, %11110011, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11100011, %11110011, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11101111, %11101111, %11101111, %11101111, %11101111, %11101111, %11101111, %11101111
.byt %11110000, %11110000, %11110000, %11110000, %11110000, %11110000, %11110000, %11110000
.byt %11011111, %11011111, %11011111, %11011111, %11011111, %11011100, %11011100, %11011100
.byt %00111111, %00111111, %00111111, %00111111, %00111100, %00111000, %00111000, %00111000
.byt %10111011, %10110111, %11001111, %11111110, %11111100, %01110000, %00000000, %00000000
.byt %11000111, %11001110, %11111110, %11111100, %01110000, %00000000, %00000000, %00000000
.byt %11011111, %11011111, %11011111, %11011111, %11011111, %11011111, %11011111, %11000000
.byt %00111111, %00111111, %00111111, %00111111, %00111111, %00111111, %00111111, %00111111
.byt %11101111, %11101111, %11101111, %11101111, %11011111, %11011111, %00111111, %11111111
.byt %11110000, %11110000, %11110000, %11110000, %11100000, %11100000, %11000000, %00000000
.byt %11110111, %11110111, %11110111, %11110111, %11101111, %11011111, %10111111, %01111111
.byt %00001111, %00001111, %00001111, %00001111, %00011111, %00111111, %01111111, %11111111
.byt %11111110, %11111101, %11111011, %11111011, %11110111, %11110111, %11101111, %11101111
.byt %00011111, %11111110, %11111100, %11111100, %11111000, %11111000, %11110000, %11110000
.byt %11111101, %11111011, %11110111, %11101111, %11101111, %11011111, %11011111, %11011111
.byt %00000011, %00000111, %00001111, %00011111, %00011111, %00111111, %00111111, %00111111
.byt %11110111, %11111011, %11111101, %11111110, %11111110, %11111111, %11111111, %11111111
.byt %11111000, %11111100, %11111110, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %11101110, %11110111, %11110111, %11111011, %11111011, %01111101, %01111101, %01111110
.byt %00011100, %00001110, %00001110, %00000111, %00000111, %10000011, %10000011, %10000001
.byt %00000000, %00000000, %00000000, %10000000, %10000000, %11000000, %11000000, %11100000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %10000000, %10000000, %11000000
.byt %00000011, %00000011, %00000011, %00000011, %00000011, %00000011, %00000011, %00000011
.byt %00000001, %00000001, %00000001, %00000001, %00000001, %00000001, %00000001, %00000001
.byt %11011100, %11011100, %11011100, %11011100, %11011100, %11011100, %11011100, %11011100
.byt %00111000, %00111000, %00111000, %00111000, %00111000, %00111000, %00111000, %00111000
.byt %11111111, %11111111, %11111111, %11111111, %11000000, %11011111, %11011111, %11011111
.byt %00000000, %00000000, %00000000, %00000000, %00111111, %00111111, %00111111, %00111111
.byt %11111110, %11111101, %11111110, %11111111, %00111111, %11001111, %11110111, %11111011
.byt %00000001, %00000011, %00000001, %00000000, %11000000, %11110000, %11111000, %11111100
.byt %11111111, %11111111, %01111111, %10011111, %11101111, %11110111, %11111011, %11111101
.byt %11111111, %11111111, %11111111, %01111111, %00011111, %00001111, %00000111, %00000011
.byt %11101111, %11011111, %11011111, %11011111, %11011111, %11011111, %11011111, %11011111
.byt %11110000, %11100000, %11100000, %11100000, %11100000, %11100000, %11100000, %11100000
.byt %01111110, %10111110, %10111111, %10111111, %10111111, %10111111, %10111111, %10111111
.byt %10000001, %11000001, %11000000, %11000000, %11000000, %11000000, %11000000, %11000000
.byt %11100000, %11100000, %01110000, %01110000, %01110000, %01110000, %01110000, %01110000
.byt %11000000, %11000000, %11100000, %11100000, %11100000, %11100000, %11100000, %11100000
.byt %11111011, %11111101, %11111101, %11111101, %11111101, %11111101, %11111101, %11111011
.byt %11111100, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111100
.byt %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111110, %11111101
.byt %00000001, %00000001, %00000001, %00000001, %00000001, %00000001, %00000001, %00000011
.byt %11111111, %11111111, %01111111, %01111111, %10111111, %10111111, %11011111, %11011111
.byt %11111111, %11111111, %11111111, %11111111, %01111111, %01111111, %00111111, %00111111
.byt %11011111, %11011111, %11011111, %11011111, %11101111, %11101111, %11101111, %11110111
.byt %11100000, %11100000, %11100000, %11100000, %11110000, %11110000, %11110000, %11111000
.byt %10111111, %10111111, %10111111, %10111111, %10111111, %11011111, %11011111, %11011111
.byt %01111111, %01111111, %01111111, %01111111, %01111111, %00111111, %00111111, %00111111
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111110
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.byt %10111111, %10111111, %10111111, %01111110, %01111110, %01111110, %01111101, %11111101
.byt %11000000, %11000000, %11000000, %10000001, %10000001, %10000001, %10000011, %00000011
.byt %01110000, %01110000, %01110000, %11100000, %11100000, %11111110, %11111111, %11111111
.byt %11100000, %11100000, %11100000, %11000000, %11000000, %11100000, %11111110, %11111111
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %10000000, %11000000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %10000000
.byt %00000011, %00000011, %00000111, %00001111, %00011110, %00011101, %00011101, %00011101
.byt %00000001, %00000001, %00000011, %00000111, %00001111, %00001110, %00001110, %00001110
.byt %10111111, %10111111, %10111111, %10111111, %00111111, %11111111, %11111111, %11111111
.byt %11000000, %11000000, %11000000, %11000000, %11000000, %00000000, %00000000, %00000000
.byt %11011111, %11011111, %11011111, %11011111, %11000111, %11111011, %11111011, %11111011
.byt %00111111, %00111111, %00111111, %00111111, %00111111, %00000111, %00000111, %00000111
.byt %11111111, %11111111, %11111111, %11111111, %11111100, %11111011, %11111011, %11111011
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %11111100, %11111100, %11111100
.byt %01111111, %01111111, %01111111, %01111111, %00001110, %11110101, %11110101, %11110101
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %00001110, %00001110, %00001110
.byt %01111111, %01111111, %01111111, %01111111, %00000000, %11111111, %11111111, %11111111
.byt %11111111, %11111111, %11111111, %11111111, %11111111, %00000000, %00000000, %00000000
.byt %11111111, %11110001, %11101110, %11101110, %00001110, %11111110, %11111110, %11111110
.byt %11111111, %11111111, %11110001, %11110001, %11110001, %00000001, %00000001, %00000001
.byt %11101111, %11101111, %11101111, %11101111, %10001111, %01111111, %01111111, %01111111
.byt %11110000, %11110000, %11110000, %11110000, %11110000, %10000000, %10000000, %10000000
.byt %11011100, %11011110, %11011110, %11011111, %11000111, %11111011, %11111011, %11111011
.byt %00111000, %00111100, %00111100, %00111110, %00111110, %00000111, %00000111, %00000111
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %10000000, %10000000, %10000000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000011, %00000011, %00001111, %00011111, %00011110, %00011101, %00011101, %00011101
.byt %00000001, %00000001, %00000011, %00001111, %00001111, %00001110, %00001110, %00001110
.byt %11011111, %11011111, %11011111, %11000000, %11111111, %11111111, %11111111, %11111111
.byt %00111111, %00111111, %00111111, %00111111, %00000000, %00000000, %00000000, %00000000
.byt %11111011, %11110111, %11001111, %00111111, %11111111, %11111111, %11111111, %11111100
.byt %11111100, %11111000, %11110000, %11000000, %00000000, %00000000, %00000000, %00000011
.byt %11111101, %11111011, %11110111, %11101111, %11011111, %10111111, %01111111, %11111111
.byt %00000011, %00000111, %00001111, %00011111, %00111111, %01111111, %11111111, %11110001
.byt %11101111, %11101111, %11110111, %11110111, %11111000, %11111111, %11111111, %11111111
.byt %00011111, %00011111, %00001111, %00001111, %00000111, %00000000, %00000000, %00000000
.byt %11110111, %11111011, %11111011, %11111101, %11111110, %01111111, %01111111, %01111111
.byt %11111000, %11111100, %11111100, %11111110, %11111111, %11111111, %11111111, %11110001
.byt %11101111, %11101111, %11110111, %11111011, %11111100, %01111111, %10011111, %11100111
.byt %00011111, %00011111, %00001111, %00000111, %00000011, %10000000, %11100000, %11111000
.byt %11111110, %11111101, %11111011, %11110111, %11001111, %00111111, %11111111, %11111100
.byt %11111111, %11111110, %11111100, %11111000, %11110000, %11000000, %00000000, %00000011
.byt %11111011, %11110111, %11110111, %11101111, %11011111, %10111111, %01111111, %11111111
.byt %00000111, %00001111, %00001111, %00011111, %00111111, %01111111, %11111111, %11100011
.byt %11000001, %10111110, %01111111, %01111111, %01111111, %01111111, %01111111, %10111110
.byt %11111111, %11000001, %10000000, %10000000, %10000000, %10000000, %10000000, %11000001
.byt %11100000, %11100000, %01110000, %01110000, %01110000, %01110000, %01110000, %11100000
.byt %11000000, %11000000, %11100000, %11100000, %11100000, %11100000, %11100000, %11000000
.byt %00011110, %00001111, %00000111, %00000011, %00000000, %00000000, %00000000, %00000000
.byt %00001111, %00000111, %00000011, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000111, %11111111, %11111110, %11111100, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111110, %11111100, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11111100, %00011111, %00011111, %00001111, %00000000, %00000000, %00000000, %00000000
.byt %00011111, %00001111, %00001111, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00001110, %11111111, %11111111, %11110001, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %11110001, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000001, %11111111, %11111111, %11111110, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %11111110, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %10000000, %11111111, %11111111, %01111111, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %01111111, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %10000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000011, %11111111, %11111111, %11111100, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %11111100, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11110001, %11000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11110000, %01111111, %00111111, %00011111, %00000000, %00000000, %00000000, %00000000
.byt %01111111, %00111111, %00011111, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11111110, %11111111, %11000111, %00000001, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11000111, %00000001, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11110001, %11100000, %11000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11100000, %11000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11100011, %11000001, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11000001, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11000001, %11111111, %11111111, %00111110, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %00111110, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11100000, %11000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11000000, %10000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
tileset_logo_end:
|
Des_Ada/obj/b__mainparallel.adb | VMika/Des_Ada | 0 | 9465 | pragma Warnings (Off);
pragma Ada_95;
pragma Source_File_Name (ada_main, Spec_File_Name => "b__mainparallel.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b__mainparallel.adb");
pragma Suppress (Overflow_Check);
with System.Restrictions;
with Ada.Exceptions;
package body ada_main is
E068 : Short_Integer; pragma Import (Ada, E068, "system__os_lib_E");
E011 : Short_Integer; pragma Import (Ada, E011, "system__soft_links_E");
E021 : Short_Integer; pragma Import (Ada, E021, "system__exception_table_E");
E064 : Short_Integer; pragma Import (Ada, E064, "ada__io_exceptions_E");
E048 : Short_Integer; pragma Import (Ada, E048, "ada__strings_E");
E036 : Short_Integer; pragma Import (Ada, E036, "ada__containers_E");
E023 : Short_Integer; pragma Import (Ada, E023, "system__exceptions_E");
E015 : Short_Integer; pragma Import (Ada, E015, "system__secondary_stack_E");
E074 : Short_Integer; pragma Import (Ada, E074, "interfaces__c_E");
E050 : Short_Integer; pragma Import (Ada, E050, "ada__strings__maps_E");
E054 : Short_Integer; pragma Import (Ada, E054, "ada__strings__maps__constants_E");
E076 : Short_Integer; pragma Import (Ada, E076, "system__object_reader_E");
E043 : Short_Integer; pragma Import (Ada, E043, "system__dwarf_lines_E");
E035 : Short_Integer; pragma Import (Ada, E035, "system__traceback__symbolic_E");
E139 : Short_Integer; pragma Import (Ada, E139, "interfaces__c__strings_E");
E199 : Short_Integer; pragma Import (Ada, E199, "interfaces__cobol_E");
E154 : Short_Integer; pragma Import (Ada, E154, "system__task_info_E");
E101 : Short_Integer; pragma Import (Ada, E101, "ada__tags_E");
E099 : Short_Integer; pragma Import (Ada, E099, "ada__streams_E");
E115 : Short_Integer; pragma Import (Ada, E115, "system__file_control_block_E");
E114 : Short_Integer; pragma Import (Ada, E114, "system__finalization_root_E");
E112 : Short_Integer; pragma Import (Ada, E112, "ada__finalization_E");
E111 : Short_Integer; pragma Import (Ada, E111, "system__file_io_E");
E214 : Short_Integer; pragma Import (Ada, E214, "ada__streams__stream_io_E");
E180 : Short_Integer; pragma Import (Ada, E180, "system__storage_pools_E");
E176 : Short_Integer; pragma Import (Ada, E176, "system__finalization_masters_E");
E174 : Short_Integer; pragma Import (Ada, E174, "system__storage_pools__subpools_E");
E166 : Short_Integer; pragma Import (Ada, E166, "ada__strings__unbounded_E");
E133 : Short_Integer; pragma Import (Ada, E133, "ada__real_time_E");
E097 : Short_Integer; pragma Import (Ada, E097, "ada__text_io_E");
E201 : Short_Integer; pragma Import (Ada, E201, "system__pool_global_E");
E210 : Short_Integer; pragma Import (Ada, E210, "system__sequential_io_E");
E232 : Short_Integer; pragma Import (Ada, E232, "system__tasking__initialization_E");
E240 : Short_Integer; pragma Import (Ada, E240, "system__tasking__protected_objects_E");
E244 : Short_Integer; pragma Import (Ada, E244, "system__tasking__protected_objects__entries_E");
E248 : Short_Integer; pragma Import (Ada, E248, "system__tasking__queuing_E");
E254 : Short_Integer; pragma Import (Ada, E254, "system__tasking__stages_E");
E193 : Short_Integer; pragma Import (Ada, E193, "p_structuraltypes_E");
E191 : Short_Integer; pragma Import (Ada, E191, "p_stephandler_E");
E205 : Short_Integer; pragma Import (Ada, E205, "p_stephandler__feistelhandler_E");
E207 : Short_Integer; pragma Import (Ada, E207, "p_stephandler__inputhandler_E");
E218 : Short_Integer; pragma Import (Ada, E218, "p_stephandler__iphandler_E");
E220 : Short_Integer; pragma Import (Ada, E220, "p_stephandler__keyhandler_E");
E222 : Short_Integer; pragma Import (Ada, E222, "p_stephandler__outputhandler_E");
E224 : Short_Integer; pragma Import (Ada, E224, "p_stephandler__reverseiphandler_E");
Local_Priority_Specific_Dispatching : constant String := "";
Local_Interrupt_States : constant String := "";
Is_Elaborated : Boolean := False;
procedure finalize_library is
begin
E224 := E224 - 1;
declare
procedure F1;
pragma Import (Ada, F1, "p_stephandler__reverseiphandler__finalize_spec");
begin
F1;
end;
E222 := E222 - 1;
declare
procedure F2;
pragma Import (Ada, F2, "p_stephandler__outputhandler__finalize_spec");
begin
F2;
end;
E220 := E220 - 1;
declare
procedure F3;
pragma Import (Ada, F3, "p_stephandler__keyhandler__finalize_spec");
begin
F3;
end;
E218 := E218 - 1;
declare
procedure F4;
pragma Import (Ada, F4, "p_stephandler__iphandler__finalize_spec");
begin
F4;
end;
E207 := E207 - 1;
declare
procedure F5;
pragma Import (Ada, F5, "p_stephandler__inputhandler__finalize_spec");
begin
F5;
end;
E205 := E205 - 1;
declare
procedure F6;
pragma Import (Ada, F6, "p_stephandler__feistelhandler__finalize_spec");
begin
F6;
end;
E191 := E191 - 1;
declare
procedure F7;
pragma Import (Ada, F7, "p_stephandler__finalize_spec");
begin
F7;
end;
E244 := E244 - 1;
declare
procedure F8;
pragma Import (Ada, F8, "system__tasking__protected_objects__entries__finalize_spec");
begin
F8;
end;
E210 := E210 - 1;
declare
procedure F9;
pragma Import (Ada, F9, "system__sequential_io__finalize_spec");
begin
F9;
end;
E201 := E201 - 1;
declare
procedure F10;
pragma Import (Ada, F10, "system__pool_global__finalize_spec");
begin
F10;
end;
E097 := E097 - 1;
declare
procedure F11;
pragma Import (Ada, F11, "ada__text_io__finalize_spec");
begin
F11;
end;
E166 := E166 - 1;
declare
procedure F12;
pragma Import (Ada, F12, "ada__strings__unbounded__finalize_spec");
begin
F12;
end;
E174 := E174 - 1;
declare
procedure F13;
pragma Import (Ada, F13, "system__storage_pools__subpools__finalize_spec");
begin
F13;
end;
E176 := E176 - 1;
declare
procedure F14;
pragma Import (Ada, F14, "system__finalization_masters__finalize_spec");
begin
F14;
end;
E214 := E214 - 1;
declare
procedure F15;
pragma Import (Ada, F15, "ada__streams__stream_io__finalize_spec");
begin
F15;
end;
declare
procedure F16;
pragma Import (Ada, F16, "system__file_io__finalize_body");
begin
E111 := E111 - 1;
F16;
end;
declare
procedure Reraise_Library_Exception_If_Any;
pragma Import (Ada, Reraise_Library_Exception_If_Any, "__gnat_reraise_library_exception_if_any");
begin
Reraise_Library_Exception_If_Any;
end;
end finalize_library;
procedure adafinal is
procedure s_stalib_adafinal;
pragma Import (C, s_stalib_adafinal, "system__standard_library__adafinal");
procedure Runtime_Finalize;
pragma Import (C, Runtime_Finalize, "__gnat_runtime_finalize");
begin
if not Is_Elaborated then
return;
end if;
Is_Elaborated := False;
Runtime_Finalize;
s_stalib_adafinal;
end adafinal;
type No_Param_Proc is access procedure;
procedure adainit is
Main_Priority : Integer;
pragma Import (C, Main_Priority, "__gl_main_priority");
Time_Slice_Value : Integer;
pragma Import (C, Time_Slice_Value, "__gl_time_slice_val");
WC_Encoding : Character;
pragma Import (C, WC_Encoding, "__gl_wc_encoding");
Locking_Policy : Character;
pragma Import (C, Locking_Policy, "__gl_locking_policy");
Queuing_Policy : Character;
pragma Import (C, Queuing_Policy, "__gl_queuing_policy");
Task_Dispatching_Policy : Character;
pragma Import (C, Task_Dispatching_Policy, "__gl_task_dispatching_policy");
Priority_Specific_Dispatching : System.Address;
pragma Import (C, Priority_Specific_Dispatching, "__gl_priority_specific_dispatching");
Num_Specific_Dispatching : Integer;
pragma Import (C, Num_Specific_Dispatching, "__gl_num_specific_dispatching");
Main_CPU : Integer;
pragma Import (C, Main_CPU, "__gl_main_cpu");
Interrupt_States : System.Address;
pragma Import (C, Interrupt_States, "__gl_interrupt_states");
Num_Interrupt_States : Integer;
pragma Import (C, Num_Interrupt_States, "__gl_num_interrupt_states");
Unreserve_All_Interrupts : Integer;
pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts");
Detect_Blocking : Integer;
pragma Import (C, Detect_Blocking, "__gl_detect_blocking");
Default_Stack_Size : Integer;
pragma Import (C, Default_Stack_Size, "__gl_default_stack_size");
Leap_Seconds_Support : Integer;
pragma Import (C, Leap_Seconds_Support, "__gl_leap_seconds_support");
Bind_Env_Addr : System.Address;
pragma Import (C, Bind_Env_Addr, "__gl_bind_env_addr");
procedure Runtime_Initialize (Install_Handler : Integer);
pragma Import (C, Runtime_Initialize, "__gnat_runtime_initialize");
Finalize_Library_Objects : No_Param_Proc;
pragma Import (C, Finalize_Library_Objects, "__gnat_finalize_library_objects");
begin
if Is_Elaborated then
return;
end if;
Is_Elaborated := True;
Main_Priority := -1;
Time_Slice_Value := -1;
WC_Encoding := 'b';
Locking_Policy := ' ';
Queuing_Policy := ' ';
Task_Dispatching_Policy := ' ';
System.Restrictions.Run_Time_Restrictions :=
(Set =>
(False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, True, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False),
Value => (0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
Violated =>
(False, False, False, True, True, False, False, False,
False, False, False, True, True, True, False, False,
False, False, False, True, True, False, True, True,
False, True, True, True, True, False, False, False,
False, False, True, False, False, True, False, True,
False, False, True, False, False, False, True, True,
False, True, True, False, True, False, False, False,
True, False, True, True, True, True, True, False,
False, True, False, True, True, True, False, True,
True, False, True, True, True, True, False, False,
True, False, False, False, False, True, True, True,
False, False, False),
Count => (0, 0, 0, 0, 2, 2, 1, 0, 0, 0),
Unknown => (False, False, False, False, False, False, True, False, False, False));
Priority_Specific_Dispatching :=
Local_Priority_Specific_Dispatching'Address;
Num_Specific_Dispatching := 0;
Main_CPU := -1;
Interrupt_States := Local_Interrupt_States'Address;
Num_Interrupt_States := 0;
Unreserve_All_Interrupts := 0;
Detect_Blocking := 0;
Default_Stack_Size := -1;
Leap_Seconds_Support := 0;
Runtime_Initialize (1);
Finalize_Library_Objects := finalize_library'access;
System.Soft_Links'Elab_Spec;
System.Exception_Table'Elab_Body;
E021 := E021 + 1;
Ada.Io_Exceptions'Elab_Spec;
E064 := E064 + 1;
Ada.Strings'Elab_Spec;
E048 := E048 + 1;
Ada.Containers'Elab_Spec;
E036 := E036 + 1;
System.Exceptions'Elab_Spec;
E023 := E023 + 1;
System.Soft_Links'Elab_Body;
E011 := E011 + 1;
Interfaces.C'Elab_Spec;
System.Os_Lib'Elab_Body;
E068 := E068 + 1;
Ada.Strings.Maps'Elab_Spec;
Ada.Strings.Maps.Constants'Elab_Spec;
E054 := E054 + 1;
System.Secondary_Stack'Elab_Body;
E015 := E015 + 1;
System.Object_Reader'Elab_Spec;
System.Dwarf_Lines'Elab_Spec;
E043 := E043 + 1;
E074 := E074 + 1;
E050 := E050 + 1;
System.Traceback.Symbolic'Elab_Body;
E035 := E035 + 1;
E076 := E076 + 1;
Interfaces.C.Strings'Elab_Spec;
E139 := E139 + 1;
Interfaces.Cobol'Elab_Spec;
E199 := E199 + 1;
System.Task_Info'Elab_Spec;
E154 := E154 + 1;
Ada.Tags'Elab_Spec;
Ada.Tags'Elab_Body;
E101 := E101 + 1;
Ada.Streams'Elab_Spec;
E099 := E099 + 1;
System.File_Control_Block'Elab_Spec;
E115 := E115 + 1;
System.Finalization_Root'Elab_Spec;
E114 := E114 + 1;
Ada.Finalization'Elab_Spec;
E112 := E112 + 1;
System.File_Io'Elab_Body;
E111 := E111 + 1;
Ada.Streams.Stream_Io'Elab_Spec;
E214 := E214 + 1;
System.Storage_Pools'Elab_Spec;
E180 := E180 + 1;
System.Finalization_Masters'Elab_Spec;
System.Finalization_Masters'Elab_Body;
E176 := E176 + 1;
System.Storage_Pools.Subpools'Elab_Spec;
E174 := E174 + 1;
Ada.Strings.Unbounded'Elab_Spec;
E166 := E166 + 1;
Ada.Real_Time'Elab_Spec;
Ada.Real_Time'Elab_Body;
E133 := E133 + 1;
Ada.Text_Io'Elab_Spec;
Ada.Text_Io'Elab_Body;
E097 := E097 + 1;
System.Pool_Global'Elab_Spec;
E201 := E201 + 1;
System.Sequential_Io'Elab_Spec;
E210 := E210 + 1;
System.Tasking.Initialization'Elab_Body;
E232 := E232 + 1;
System.Tasking.Protected_Objects'Elab_Body;
E240 := E240 + 1;
System.Tasking.Protected_Objects.Entries'Elab_Spec;
E244 := E244 + 1;
System.Tasking.Queuing'Elab_Body;
E248 := E248 + 1;
System.Tasking.Stages'Elab_Body;
E254 := E254 + 1;
E193 := E193 + 1;
P_Stephandler'Elab_Spec;
P_Stephandler'Elab_Body;
E191 := E191 + 1;
P_Stephandler.Feistelhandler'Elab_Spec;
P_Stephandler.Feistelhandler'Elab_Body;
E205 := E205 + 1;
P_Stephandler.Inputhandler'Elab_Spec;
P_Stephandler.Inputhandler'Elab_Body;
E207 := E207 + 1;
P_Stephandler.Iphandler'Elab_Spec;
P_Stephandler.Iphandler'Elab_Body;
E218 := E218 + 1;
P_Stephandler.Keyhandler'Elab_Spec;
P_Stephandler.Keyhandler'Elab_Body;
E220 := E220 + 1;
P_Stephandler.Outputhandler'Elab_Spec;
P_Stephandler.Outputhandler'Elab_Body;
E222 := E222 + 1;
P_Stephandler.Reverseiphandler'Elab_Spec;
P_Stephandler.Reverseiphandler'Elab_Body;
E224 := E224 + 1;
end adainit;
procedure Ada_Main_Program;
pragma Import (Ada, Ada_Main_Program, "_ada_mainparallel");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer
is
procedure Initialize (Addr : System.Address);
pragma Import (C, Initialize, "__gnat_initialize");
procedure Finalize;
pragma Import (C, Finalize, "__gnat_finalize");
SEH : aliased array (1 .. 2) of Integer;
Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address;
pragma Volatile (Ensure_Reference);
begin
gnat_argc := argc;
gnat_argv := argv;
gnat_envp := envp;
Initialize (SEH'Address);
adainit;
Ada_Main_Program;
adafinal;
Finalize;
return (gnat_exit_status);
end;
-- BEGIN Object file/option list
-- C:\Users\vadim\des-ada\Des_Ada\obj\p_structuraltypes.o
-- C:\Users\vadim\des-ada\Des_Ada\obj\p_stephandler.o
-- C:\Users\vadim\des-ada\Des_Ada\obj\p_stephandler-feistelhandler.o
-- C:\Users\vadim\des-ada\Des_Ada\obj\p_stephandler-inputhandler.o
-- C:\Users\vadim\des-ada\Des_Ada\obj\p_stephandler-iphandler.o
-- C:\Users\vadim\des-ada\Des_Ada\obj\p_stephandler-keyhandler.o
-- C:\Users\vadim\des-ada\Des_Ada\obj\p_stephandler-outputhandler.o
-- C:\Users\vadim\des-ada\Des_Ada\obj\p_stephandler-reverseiphandler.o
-- C:\Users\vadim\des-ada\Des_Ada\obj\mainParallel.o
-- -LC:\Users\vadim\des-ada\Des_Ada\obj\
-- -LC:\Users\vadim\des-ada\Des_Ada\obj\
-- -LC:/gnat/2017/lib/gcc/i686-pc-mingw32/6.3.1/adalib/
-- -static
-- -lgnarl
-- -lgnat
-- -Xlinker
-- --stack=0x200000,0x1000
-- -mthreads
-- -Wl,--stack=0x2000000
-- END Object file/option list
end ada_main;
|
Ver 1/Flame.asm | Switchxxi/CandleLEDs | 1 | 168453 | <reponame>Switchxxi/CandleLEDs
;****************************************************************************************************
; Simulador de llama. Versión: 0.1
;
;
; Simple simulador de una llama.
; Micro usado: PIC12F629 (Debería funcionar también con el PIC12F675 sin modificar el HEX).
; Ver esquema electrico de conexión.
;
; <EMAIL>
;
;****************************************************************************************************
list p=12F629
radix dec
include "p12f629.inc"
errorlevel -302 ; Don't complain about BANK 1 Registers
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT ;Internal osc.
;****************************************************************************************************
; Registros usados
;****************************************************************************************************
D1 equ 20h
D2 equ 21h
D3 equ 22h
Index equ 23h
;****************************************************************************************************
; Constants
;****************************************************************************************************
#define rp0 0x05 ; bit 5 of the status register (Page Selector)
;****************************************************************************************************
; Reset Vector
;****************************************************************************************************
org 0x00 ; program starts at location 000
goto SetUp
;****************************************************************************************************
; Setup
;****************************************************************************************************
SetUp
bsf STATUS, rp0 ; Bank 1
call 0x3ff
movwf OSCCAL ;
movlw b'10000000' ; Prescale for TMR0 = 1:2, CLK --> TMR0, pull-up off
movwf OPTION_REG
clrf TRISIO ; All GPIO = Out
clrf INTCON ; Interrups off
bcf STATUS, rp0 ; bank 0
movlw 07h ; Set up W to turn off Comparator ports
movwf CMCON ; must be placed in bank 0
;****************************************************************************************************
; Main
;****************************************************************************************************
clrf GPIO ; Clear GPIO
clrf Index
Loop
call T1
movwf GPIO
call Delay
incf Index
movlw 33
xorwf Index, w
btfsc STATUS, Z
clrf Index
goto Loop
;****************************************************************************************************
; Delay. Aprox = 60ms
;****************************************************************************************************
Delay
movlw 78
movwf D1
Del2
movlw 255
movwf D2
Del1
decfsz D2, f
goto Del1
decfsz D1, f
goto Del2
return
;****************************************************************************************************
; Tablas
;****************************************************************************************************
T1
movf Index, w
addwf PCL, f
retlw b'00000001' ; 0
retlw b'00000011' ; 1
retlw b'00000111' ; 2
retlw b'00010101' ; 3
retlw b'00110001' ; 4
retlw b'00100001' ; 5
retlw b'00000001' ; 6
retlw b'00000011' ; 7
retlw b'00000111' ; 8
retlw b'00010101' ; 9
retlw b'00110001' ; 10
retlw b'00100001' ; 11
retlw b'00000001' ; 12
retlw b'00000011' ; 13
retlw b'00000111' ; 14
retlw b'00010111' ; 15
retlw b'00000111' ; 16
retlw b'00010111' ; 17
retlw b'00000111' ; 18
retlw b'00000001' ; 19
retlw b'00000011' ; 20
retlw b'00000111' ; 21
retlw b'00010111' ; 22
retlw b'00110111' ; 23
retlw b'00010111' ; 24
retlw b'00000111' ; 25
retlw b'00000011' ; 26
retlw b'00000001' ; 27
retlw b'00000011' ; 28
retlw b'00000111' ; 29
retlw b'00010111' ; 30
retlw b'00000111' ; 31
retlw b'00000011' ; 32
end
|
Sources/Graphics/graphics_opengl.ads | ForYouEyesOnly/Space-Convoy | 1 | 16537 | <gh_stars>1-10
--
-- Jan & <NAME>, Australia, July 2011
--
with Real_Type; use Real_Type;
with GLOBE_3D;
with Graphics_Data; use Graphics_Data;
with Graphics_Structures; use Graphics_Structures;
with Rotations; use Rotations;
with Vectors_3D; use Vectors_3D;
package Graphics_OpenGL is
pragma Elaborate_Body;
procedure Position_Camera (C : Camera := Cam);
procedure Draw (Draw_Object : GLOBE_3D.p_Object_3D;
In_Object_Position : Vector_3D;
In_Object_Rotation : Quaternion_Rotation);
procedure Draw_Lines (Points : Points_3D);
procedure Draw_Line (Line : Line_3D; Line_Radius : Real);
procedure Draw_Laser (Line_Start, Line_End : Vector_3D;
Beam_Radius, Aura_Radius : Real;
Beam_Colour : RGBA_Colour);
package Cursor_Management is
function Cursor return Point_2D;
procedure Home;
procedure Line_Feed;
procedure Paragraph_Feed;
procedure Indend (Set_x : Natural);
private
Leading : constant Natural := 12;
Paragraph_Spacing : constant Natural := Leading + 10;
Home_Pos : constant Point_2D := (2, 10);
Cursor_Pos : Point_2D := Home_Pos;
end Cursor_Management;
procedure Text_2D (S : String; C : Point_2D := Cursor_Management.Cursor);
procedure Text_3D (S : String; P : Vector_3D);
procedure Show_Drawing;
package Full_Screen_Mode is
procedure Change_Full_Screen;
private
Memoried_Viewer_Size : Size_2D;
Memoried_Viewer_Position : Point_2D;
end Full_Screen_Mode;
procedure Set_Colour (Colour : RGB_Colour);
procedure Set_Colour (Colour : RGBA_Colour);
procedure Set_Material (Material : Materials);
end Graphics_OpenGL;
|
tests/syntax/bad/testfile-for-3.adb | xuedong/mini-ada | 0 | 441 | with Ada.Text_IO; use Ada.Text_IO;
procedure Test is begin
for i in 1 .. 10 p; end loop;
end;
|
programs/oeis/047/A047548.asm | neoneye/loda | 22 | 13940 | <reponame>neoneye/loda
; A047548: Numbers that are congruent to {1, 2, 3, 4, 7} mod 8.
; 1,2,3,4,7,9,10,11,12,15,17,18,19,20,23,25,26,27,28,31,33,34,35,36,39,41,42,43,44,47,49,50,51,52,55,57,58,59,60,63,65,66,67,68,71,73,74,75,76,79,81,82,83,84,87,89,90,91,92,95,97,98,99,100,103,105,106,107,108,111,113,114,115,116,119,121,122,123,124,127,129,130,131,132,135,137,138,139,140,143,145,146,147,148,151,153,154,155,156,159
add $0,2
mov $1,$0
lpb $1
add $0,1
add $0,$1
trn $1,2
sub $0,$1
trn $1,3
lpe
sub $0,4
|
alloy4fun_models/trashltl/models/11/LwoG2GydxupuQWqde.als | Kaixi26/org.alloytools.alloy | 0 | 3232 | open main
pred idLwoG2GydxupuQWqde_prop12 {
eventually always all f:File | f in Trash implies always f in Trash'
}
pred __repair { idLwoG2GydxupuQWqde_prop12 }
check __repair { idLwoG2GydxupuQWqde_prop12 <=> prop12o } |
multimedia/directx/dxg/dd/ddraw/ddraw16/libinit.asm | npocmaka/Windows-Server-2003 | 17 | 88631 | <gh_stars>10-100
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Copyright (c) 1995 Microsoft Corporation. All Rights Reserved.
;
; File: libinit.asm
; Content: DLL entry point - used to avoid dragging in CLIB
; History:
; Date By Reason
; ==== == ======
; 29-mar-95 craige initial implementation
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.286p
.xlist
include cmacros.inc
.list
?PLM=1 ; Pascal calling convention
?WIN=0 ; Windows prolog/epilog code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; segmentation
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ifndef SEGNAME
SEGNAME equ <_TEXT>
endif
createSeg %SEGNAME, CodeSeg, word, public, CODE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; external functions
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
externFP LocalInit ; in KERNEL
externFP LibMain ; C code to do DLL init
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; data segment
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
sBegin Data
assumes ds, Data
; stuff needed to avoid the C runtime coming in, and init the Windows
; reserved parameter block at the base of DGROUP
org 0 ; base of DATA segment!
dd 0 ; so null pointers get 0
maxRsrvPtrs = 5
dw maxRsrvPtrs
usedRsrvPtrs = 0
labelDP <PUBLIC, rsrvptrs>
DefRsrvPtr macro name
globalW name, 0
usedRsrvPtrs = usedRsrvPtrs + 1
endm
DefRsrvPtr pLocalHeap ; local heap pointer
DefRsrvPtr pAtomTable ; atom table pointer
DefRsrvPtr pStackTop ; top of stack
DefRsrvPtr pStackMin ; minimum value of SP
DefRsrvPtr pStackBot ; bottom of stack
if maxRsrvPtrs-usedRsrvPtrs
dw maxRsrvPtrs-usedRsrvPtrs DUP (0)
endif
public __acrtused
__acrtused = 1
sEnd Data
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; code segment
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
sBegin CodeSeg
assumes cs, CodeSeg
public LibEntry
LibEntry PROC FAR
; push frame for LibMain (hModule, cbHeap, lpszCmdLine)
push di
push cx
push es
push si
; init the local heap (if one is declared in the .def file)
jcxz no_heap
cCall LocalInit, <0, 0, cx>
no_heap:
cCall LibMain
ret
LibEntry ENDP
sEnd CodeSeg
end LibEntry
|
Assembly/quicksort.asm | codersinghal/sorting-algorithms | 24 | 87836 | #quick sort
# SETUP
.data
#set the size and content of array
Sz: .word 100
Array: 7, 5, 4, 1, 6, 8, 3, 2, 9, 0, 8, 3, 2, 4, 9, 0, 6, 7, 5, 1, 1, 6, 5, 7, 4, 8, 2, 3, 9, 0, 2, 8, 5, 1, 3, 9, 6, 0, 7, 4, 5, 8, 1, 6, 0, 7, 9, 2, 3, 4, 7, 9, 0, 2, 5, 1, 8, 6, 3, 4, 2, 8, 4, 5, 0, 7, 3, 9, 6, 1, 2, 0, 3, 6, 5, 4, 7, 9, 1, 8, 5, 6, 8, 1, 3, 2, 0, 9, 7, 4, 9, 3, 2, 1, 7, 5, 6, 8, 0, 4
NL: .asciiz "\n"
.text
# Initialize List
main:
lw $s7, Sz # get size of list
move $s1, $zero # set counter for # of elems printed
move $s2, $zero # set offset from Array
j start
quickSort:
#variable list:
#a0: left
#a1: right
#s0: i
#s1: j
#s2: tmp
#s3: pivot
#s4: array access
move $s0, $a0 #i = left
move $s1, $a1 #j = right
add $t0, $a0, $a1 #left + right
div $t0, $t0, 2 #(left + right) / 2
mul $s4, $t0, 4 #array access
lw $s3, Array($s4) #pivot = arr[(left + right) / 2]
outsideWhile:
bgt $s0, $s1, outsideWhileEnd #if i > j escape while
# while (arr[i] < pivot)
# i++;
insideWhile1:
mul $s4, $s0, 4
lw $t0, Array($s4) #arr[i]
bge $t0, $s3, insideWhile1End #escape inside if arr[i] >= pivot
addi $s0, $s0, 1 #i++
j insideWhile1
insideWhile1End:
# while (arr[j] > pivot)
# j--;
insideWhile2:
mul $s4, $s1, 4
lw $t0, Array($s4) #arr[j]
ble $t0, $s3, insideWhile2End #escape inside if arr[i] >= pivot
subi $s1, $s1, 1 #i++
j insideWhile2
insideWhile2End:
bgt $s0, $s1, whileIfFalse #if (i <= j) {
mul $s4, $s0, 4
lw $s2, Array($s4) #tmp = arr[i]
mul $s4, $s1, 4
lw $t0, Array($s4) #access arr[j]
mul $s4, $s0, 4
sw $t0, Array($s4) #arr[i] = arr[j]
mul $s4, $s1, 4
sw $s2, Array($s4) #arr[j] = tmp;
addi $s0, $s0, 1 #i++
subi $s1, $s1, 1 #j--
whileIfFalse:
j outsideWhile
outsideWhileEnd:
bge $a0, $s1, if1False #if left < j{
sub $sp, $sp, 12
sw $ra, 8($sp)
sw $a0, 4($sp)
sw $a1, 0($sp)
move $a0, $a0 #left = left
move $a1, $s1 #right = j
jal quickSort
lw $ra, 8($sp)
lw $a0, 4($sp)
lw $a1, 0($sp)
add $sp, $sp, 12
if1False:
bge $s0, $a1, if2False
sub $sp, $sp, 12
sw $ra, 8($sp)
sw $a0, 4($sp)
sw $a1, 0($sp)
move $a0, $s0 #left = i
move $a1, $a1 #right = right
jal quickSort
lw $ra, 8($sp)
lw $a0, 4($sp)
lw $a1, 0($sp)
add $sp, $sp, 12
if2False:
jr $ra
start:
addi $a0, $a0, 0
move $a1, $s7
sub $sp, $sp, 12
sw $ra, 8($sp)
sw $a0, 4($sp)
sw $a1, 0($sp)
jal quickSort
lw $ra, 8($sp)
lw $a0, 4($sp)
lw $a1, 0($sp)
add $sp, $sp, 12
# main print loop
move $s1, $zero
move $s2, $zero
print_loop:
bge $s1, $s7, print_loop_end # stop after last elem is printed
lw $a0, Array($s2) # print next value from the list
li $v0, 1
syscall
la $a0, NL # print a newline
li $v0, 4
syscall
addi $s1, $s1, 1 # increment the loop counter
addi $s2, $s2, 4 # step to the next array elem
j print_loop # repeat the loop
print_loop_end:
|
parser.asm | cotarr/calc-pi-x86-64-asm | 0 | 82058 | <reponame>cotarr/calc-pi-x86-64-asm
%define PARSER
%include "var_header.inc" ; Header has global variable definitions for other modules
%include "func_header.inc" ; Header has global function definitions for other modules
;-------------------------------------------------------------
;
; SINGLE THREAD FLOATING POINT MULTI-PRECISION CALCULATOR
;
; COMMAND PARSER MODULE MODULE
; This module contains command processing routines
;
; File: parser.asm
; Module: parser.asm, parser.o
; Exec: calc-pi
;
; Created: 10/15/2014
; Last Edit: 05/03/2020
;
;--------------------------------------------------------------
; MIT License
;
; Copyright 2014-2020 <NAME>
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
; The above copyright notice and this permission notice shall be included in all
; copies or substantial portions of the Software.
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
; SOFTWARE.
;-------------------------------------------------------------
; ParseCmd
; PrintCommandList
;-------------------------------------------------------------
SECTION .data align=8 ; Section containing initialized data
;
;---------------------------------------------------------------------
;
; Command Table
;
; 8 character command for up to 7 character command zero terminated
;
; 64 bit QWord address pointer
;
;---------------------------------------------------------------------
;
Command_Table:
db ".", 0, 0, 0, 0, 0, 0, 0
dq Command_print
db " ", 0, 0, 0, 0, 0, 0, 0
dq Command_vars
db '+', 0, 0, 0, 0, 0, 0, 0
dq Command_plus_symbol
db '-', 0, 0, 0, 0, 0, 0, 0
dq Command_minus_symbol
db '*', 0, 0, 0, 0, 0, 0, 0
dq Command_star_symbol
db '/', 0, 0, 0, 0, 0, 0, 0
dq Command_slash_symbol
db "c.e", 0, 0, 0, 0, 0
dq Command_c_e
db "c.ln2", 0, 0, 0
dq Command_c_ln2
db "c.gr", 0, 0, 0, 0
dq Command_c_gr
db "c.pi", 0, 0, 0, 0
dq Command_c_pi_ch
db "c.pi.ch", 0
dq Command_c_pi_ch
db "c.pi.ra", 0
dq Command_c_pi_ra
db "c.pi.st", 0
dq Command_c_pi_st
db "c.pi.ze", 0
dq Command_c_pi_ze
db "c.pi.mc", 0
dq Command_c_pi_mc
db "c.sr2", 0, 0, 0
dq Command_c_sr2
db "chs", 0, 0, 0, 0, 0
dq Command_chs
db "clrall", 0, 0
dq Command_clrall
db "clrreg", 0, 0
dq Command_clrreg
db "clrstk", 0, 0
dq Command_clrstk
db "clrx", 0, 0, 0, 0
dq Command_clrx
db "cmdlist", 0
dq Command_cmdlist
db "comment", 0
dq Command_comment
db "D.comp", 0, 0
dq Command_D.comp
db "D.endi", 0, 0
dq Command_D.endi
db "D.fill", 0, 0
dq Command_D.fill
db "D.flag", 0, 0
dq Command_D.flag
db "D.init", 0, 0
dq Command_D.init
db "D.ofst", 0, 0
dq Command_D.ofst
db "desc", 0, 0, 0, 0
dq Command_desc
db "descnew", 0
dq Command_descnew
db "enter", 0, 0, 0
dq Command_enter
db "exit", 0, 0, 0, 0
dq Command_exit
db "f.asin", 0, 0
dq Command_f_asin
db "f.cos", 0, 0, 0
dq Command_f_cos
db "f.exp", 0, 0, 0
dq Command_f_exp
db "f.ipwr", 0, 0
dq Command_f_ipwr
db "f.ln", 0, 0, 0, 0
dq Command_f_ln_is
db "f.ln.rg", 0
dq Command_f_ln_rg
db "f.ln.is", 0
dq Command_f_ln_is
db "f.nroot", 0
dq Command_f_nroot
db "f.sin", 0, 0, 0
dq Command_f_sin
db "f.zeta", 0, 0
dq Command_f_zeta
db "fix", 0, 0, 0, 0, 0
dq Command_fix
db "head", 0, 0, 0, 0
dq Command_head
db "headoff", 0
dq Command_headoff
db "help", 0, 0, 0, 0
dq Command_help
db "helpall", 0
dq Command_help_all
db "hex", 0, 0, 0, 0, 0
dq Command_hex
db "int", 0, 0, 0, 0, 0
dq Command_int
db "load", 0, 0, 0, 0
dq Command_load
db "log", 0, 0, 0, 0, 0
dq Command_log
db "logoff", 0, 0
dq Command_logoff
db "mmode", 0, 0, 0
dq Command_mmode
db "mobile", 0, 0
dq Command_mobile
db "normal", 0, 0
dq Command_normal
%IFDEF PROFILE
db "profile", 0
dq Command_profile
%ENDIF
db "print", 0, 0, 0
dq Command_print
db "q", 0, 0, 0, 0, 0, 0, 0
dq Command_exit
db "quiet", 0, 0, 0
dq Command_quiet
db "rcl", 0, 0, 0, 0, 0
dq Command_rcl
db "rdown", 0, 0, 0
dq Command_rdown
db "recip", 0, 0, 0
dq Command_recip
db "rup", 0, 0, 0, 0, 0
dq Command_rup
db "sand", 0, 0, 0, 0
dq Command_sand
db "sandbox", 0
dq Command_sandbox
db "save", 0, 0, 0, 0
dq Command_save
db "sci", 0, 0, 0, 0, 0
dq Command_sci
db "sf", 0, 0, 0, 0, 0, 0
dq Command_sigfigs
db "show", 0, 0, 0, 0
dq Command_show
db "showoff", 0
dq Command_showoff
db "sigfigs", 0
dq Command_sigfigs
db "slimit", 0, 0
dq Command_slimit
db "sstep", 0, 0, 0
dq Command_sstep
db "stack", 0, 0, 0
dq Command_stack
db "sto", 0, 0, 0, 0, 0
dq Command_sto
db "vars", 0, 0, 0, 0
dq Command_vars
db "verbose", 0
dq Command_verbose
db "xonly", 0, 0, 0
dq Command_xonly
db "xy", 0, 0, 0, 0, 0, 0
dq Command_exchange_xy
Command_Table_End:
db 0, 0, 0, 0, 0, 0, 0, 0
dq 0 ; End of list
TimeStr:
db "(Elapsed time: ", 0
TimeStr2:
db " Seconds ", 0
SP_Moving:
db 0xD, 0xA, " Warning: Stack Pointer Moving: ", 0
ACC_Error:
db 0xD, 0xA, " Warning: [No_Word] not equal [D_Flt_Word]", 0xD, 0xA, 0
PromptStr:
; db 0x7 ; bell character
db " Op Code: ", 0
DoneMsg:
db " Done", 00H
OpCodeErrStr:
db " Input Error: Illegal Op Code. (Type: help or cmdlist)", 0xD, 0xA, 00H
SECTION .bss ; Section containing uninitialized data
SECTION .text ; Section containing code
;-----------------------------------------------------------------------------
;
; C O M M A N D P A R S E R
;
; Input: none
;
; Output: none
;
;-----------------------------------------------------------------------------
ParseCmd:
;
; Debug: Check for memory leak
;
mov rax, [StackPtrSnapshot]
or rax, rax
jnz .SP_check_initialized
mov [StackPtrSnapshot], rsp ; Saved only at first run
.SP_check_initialized:
mov rax, [StackPtrSnapshot]
cmp rax, rsp
je .Stack_OK
mov rax, SP_Moving
call StrOut
mov rax, RSP
call PrintHexWord
call CROut
.Stack_OK:
;
; Check accuracy
;
mov rax, [No_Word]
cmp rax, [D_Flt_Word]
je .Acc_OK
mov rax, ACC_Error
call StrOut
.Acc_OK:
;
; Update header at top of screen
;
;;;; call Header_Update
;
; Command Parser issue prompt strings
;
call CROut
;
; Elapsed timer display
;
mov rax, TimeStr
call StrOut
call ReadSysTime ; Read system clock in seconds in RAX
mov [CalcSTime], rax ; Save end of calculation time
SUB rax, [StartSTime]
call PrintWordB10 ; Print seconds as integer
push rax
mov rax, TimeStr2 ; Message 'Sec)'
call StrOut
pop rax
call PrintDDHHMMSS ; Print elapsed time
mov al, ')'
call CharOut
mov rax, PromptStr
call StrOut ; Print command Prompt
call KeyIn ; Get command string, RAX is buffer address
push rax
call CheckEchoing ; Are we echoing to file?
or rax, rax ; 1 = yes 0 = no
jz .NoEcho
pop rax
push rax
call StrOut
call CROut
.NoEcho:
call CROut
pop rax
;
; Start elapsed timer
;
push rax
call ReadSysTime ; Read system clock in seconds in RAX
mov [StartSTime], rax ; Initialize System time as Calc start time
mov rax, 0
mov [iCounter01], rax
mov [iCounter02], rax
mov [iCounter03], rax
mov [iCounter04], rax
mov [iCounter05], rax
pop rax
;
;...............................................
;
; (number) - input
;
;...............................................
;
; Assume number start with '+' or '-' or '.' or digit '0' to '9'
;
; Case of '+' or '-' or '.' followed by 0x00 (string length = 1)
; In this case, it must be addition, subtraction or print command
;
; check 16 bit word '+' + 00
cmp [rax], word 0x002b
je .not_number
; check 16 bit word '-' + 00
cmp [rax], word 0x002D
je .not_number
; check 16 bit word '.' + 00
cmp [rax], word 0x002E
je .not_number
; check 16 bit word ' ' + 00
cmp [rax], word 0x0020
je .not_number
;
; Next, accept '+' or '-' as start of number
;
cmp [rax], byte '+'
je .is_numeric
cmp [rax], byte '-'
je .is_numeric
cmp [rax], byte '.'
je .is_numeric
cmp [rax], byte ' '
je .is_numeric
cmp [rax], byte '0' ; Check first character of command
jl .not_number ; less than 0? then skip
cmp [rax], byte '9' ; greater than 9? then skip
jg .not_number
;
; It must be a number, convert it.
;
.is_numeric:
; call IntegerInput ; call input routine with RAX is buffer addresss
call FP_Input
jnc .no_input_error ; CF = 1 on error
;
; Error Message
mov rax, .message_input_error
call StrOut
call Header_Update
ret
;
.no_input_error:
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
;
mov rsi, HAND_ACC
mov rdi, HAND_XREG
call CopyVariable
;
call PrintResult
ret
.message_input_error:
; red text
db 27, "[31m"
db " Error converting string to floating point number, stack not rotated.",0xD, 0xA
; clear red text
db 27, "[0m", 0
.not_number:
;--------------------------------------------------------------------------------------------
;
; Parse commands from structured command table (RAX = index to null terminated command string
;
;--------------------------------------------------------------------------------------------
;
; Check alignment of command table (could be entry/code error)
;
mov rbx, Command_Table_End ; Check for byte alignment
and rbx, 0x07 ; Should be zero
jz .Com_Tab_OK
mov rax, .Command_Error2
call StrOut
mov rax, 0
jmp FatalError
.Com_Tab_OK:
mov rbx, Command_Table ; Table Address
;
; Loop here for next command word check
;
.Com_Tab_Loop1:
cmp byte [rbx], 0 ; Check for past last command in table
je .Com_Tab_Not_Found ; Zero marker found, end of command table
mov rbp, 0
;
; Loop here for next character check
;
.Com_Tab_Loop2:
mov DL, [rax+rbp]
cmp byte [rbx+rbp], DL
jne .Com_Tab_Next
inc rbp ; next character compare
cmp rbp, 8 ; Only 7 char + zero allowed
jne .Com_Tab_Skip1 ; 8 Found is fatal error in table
mov rax, .Command_Error1
call StrOut
mov rax, 0
call FatalError
.Com_Tab_Skip1:
cmp byte [rbx+rbp], 0 ; No more characters?
jne .Com_Tab_Loop2 ; Not zero, more to check
cmp byte [rax+rbp], 0 ; Else was zero, see if command 0 or space
je .Com_Tab_MatchNoArg ; Command also ended zero, its a match
cmp byte [rax+rbp], ' ' ; Space character allowed
je .Com_Tab_MatchWithArg ; Command trailing space, expect
jmp .Com_Tab_Next ; Not match zero or space on next char
.Com_Tab_MatchNoArg:
mov rax, 0 ; No argument
jmp [rbx+BYTE_PER_WORD]
.Com_Tab_MatchWithArg:
inc rbp ; Ponint past space
cmp byte[rax+rbp], 0 ; end of string? expect argument
je .Com_Tab_MatchNoArg ; Error ends after space, don't point string
add rax, rbp ; RAX point at argument characters
jmp [rbx+BYTE_PER_WORD]
.Com_Tab_Next:
add rbx, (BYTE_PER_WORD * 2) ; Point to next command
jmp .Com_Tab_Loop1
.Command_Error1:
db "Command Parser Error: zero end marker not found in text table", 0xD, 0xA, 0
.Command_Error2:
db "Command Parser Error: End of command table not QWord aligned, probably table error", 0xD, 0xA, 0
.red_text:
db 27, "[31m", 0
.red_cancel:
db 27, "[0m", 0
.Com_Tab_Not_Found:
; Set text color red for error
mov rax, .red_text
call StrOut
; Print error message
mov rax, OpCodeErrStr ; Error message for Illegal op coce
call StrOut;
; Cancel red color
mov rax, .red_cancel
call StrOut
ret
;
Command_plus_symbol:
mov rsi, HAND_XREG
mov rdi, HAND_ACC
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_OPR
call CopyVariable
;
call FP_Addition ; Add X = Y + X
mov rsi, HAND_ACC
mov rdi, HAND_XREG
call CopyVariable
;
mov rsi, HAND_ZREG
mov rdi, HAND_YREG
call CopyVariable
;
mov rsi, HAND_TREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_TREG
call ClearVariable
;
call PrintResult
ret
;
;
;
Command_minus_symbol:
mov rsi, HAND_XREG
mov rdi, HAND_ACC
call CopyVariable
;
mov rsi, HAND_ACC
call FP_TwosCompliment
;
mov rsi, HAND_YREG
mov rdi, HAND_OPR
call CopyVariable
;
call FP_Addition ; Subtract X = Y + (0-X)
mov rsi, HAND_ACC
mov rdi, HAND_XREG
call CopyVariable
;
mov rsi, HAND_ZREG
mov rdi, HAND_YREG
call CopyVariable
;
mov rsi, HAND_TREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_TREG
call ClearVariable
;
call PrintResult
ret
;
;
;
Command_star_symbol:
mov rsi, HAND_XREG
mov rdi, HAND_ACC
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_OPR
call CopyVariable
;
call FP_Multiplication ; Multiply X = Y * X
mov rsi, HAND_ACC
mov rdi, HAND_XREG
call CopyVariable
;
mov rsi, HAND_ZREG
mov rdi, HAND_YREG
call CopyVariable
;
mov rsi, HAND_TREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_TREG
call ClearVariable
;
call PrintResult
ret
;
;
;
Command_slash_symbol:
mov rsi, HAND_XREG
mov rdi, HAND_ACC
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_OPR
call CopyVariable
;
call FP_Division ; Divide X = Y / X
;
mov rsi, HAND_ACC
mov rdi, HAND_XREG
call CopyVariable
;
mov rsi, HAND_ZREG
mov rdi, HAND_YREG
call CopyVariable
;
mov rsi, HAND_TREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_TREG
call ClearVariable
;
call PrintResult
ret
;
;
;
Command_c_e:
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
;
or rax, rax ; Check for argument
jz .no_arg ; No argument use default method
cmp [rax], byte '1' ; 1 use fix point
je .arg_1
cmp [rax], byte '2' ; 2 use register method
je .arg_2
cmp [rax], byte '3' ; 3 use full floating point
je .arg_3
cmp [rax], byte '4' ; 4 use function exp(1)
je .arg_4
.no_arg:
.arg_1:
call Function_calc_e_Fix ; fixed (non-normalized) method
call CROut
call PrintResult
ret
.arg_2:
call Function_calc_e_Reg ; Register division
call CROut
call PrintResult
ret
.arg_3:
call Function_calc_e_FP ; Full floating point
call CROut
call PrintResult
ret
.arg_4:
mov rax, .calcestr ; get message
call StrOut
mov rsi, HAND_XREG ; set XReg = 1
call SetToOne
call Function_exp_x ; calc exp(xreg) ... exp(1)
call PrintResult
ret
.calcestr:
db "Function_exp_x: Calculating e using function exp(XReg) with XReg=1", 0xD, 0XA, 0xA, 0
;
;
;
Command_c_ln2:
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
;
call Function_calc_ln2
call CROut
call PrintResult
ret
;
;
;
Command_c_pi_st:
mov rbx, rax ; Save Argument
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
;
;
; Arguments to c.pi.st
; (no argument) - calculate pi to Stormer method
; 1 - calculate first term to pi-st-1.num
; 2 - calculate first term to pi-st-2.num
; 3 - calculate first term to pi-st-3.num
; 4 - calculate first term to pi-st-4.num
; 1234 - Combine all 4 filnames, sum the results as pi
;
mov rax, rbx ; Restore RAX
or rax, rax ; Check RAX for valid argument
jz .No_arg ; RAX = zero, no argument found
cmp byte [rax], '1' ; Check first character of command
jl .Not_num ; less than 0? then skip
cmp byte [rax], '4' ; greater than 9? then skip
jg .Not_num
call IntWordInput ; RAX in binary 64 bit data
jmp .pi_st_w_num ; cotinue to Stormer method RAX = argument
.Not_num:
.No_arg:
.pi_st: ; ****** case of Stormer method
mov rax, 0 ; Case of no argument, use 0
; Stormer codes with RAX = 0 perform all 4 arctan series
; RAX = 1,2,3,4 perform each arctan sum separately
.pi_st_w_num:
call Function_calc_pi_sto ; Calculate Pi Stormer formula
call CROut
call PrintResult
ret
;
;
;
Command_c_pi_ch: ; ****** case of Chudnovsky Formula
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
mov rax, .pi_ch_str ; Description line
call StrOut
mov rsi, HAND_XREG ; Place 10005 in XReg
mov rax, 10005
call FP_Load64BitNumber ; X-Reg = 10005
mov rax, 2 ; for 2 root (square root)
call Function_nth_root_x ; Calculate nth root (N in RAX, A in ACC)
call Function_calc_pi_chud ; Calculate Pi Ramanujan formula
call CROut
call PrintResult
ret
.pi_ch_str:
db "Functon_calc_pi_chud: Calculation of pi using Chudnovsky formula.", 0xD, 0xA
db "Calculation square root 10005", 0xD, 0xA, 0
;
;
;
Command_c_pi_ra: ; ****** case of Ramanujan Formula
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
mov rax, .pi_ra_str ; Description line
call StrOut
call Function_calc_sr2 ; First calculate SR 2
call Function_calc_pi_ram ; Calculate Pi Ramanujan formula
call CROut
call PrintResult
ret
.pi_ra_str: db "Functon_calc_pi_ram: Calculation of pi using Ramanujan formula.", 0xD, 0xA, 0xA, 0
;
;
;
Command_c_pi_ze: ; ****** case of zeta2 sum 1/n^2 = (pi^2)/6
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
mov rax, .pi_ze_str ; Description line
call StrOut
call Function_calc_pi_zeta2
call CROut
call PrintResult
ret
.pi_ze_str:
db "Functon_calc_pi_zeta: Calculation of pi using zeta(2)", 0xD, 0xA, 0xA, 0
;
;
;
Command_c_pi_mc:
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
; ****** case of Monte Carlo statistical method
mov rax, .pi_mc_str ; Description line
call StrOut
call Function_calc_pi_monte_carlo
call CROut
call PrintResult
ret
.pi_mc_str: db "Functon_calc_pi_monte_carlo: Monte Carlo method for pi.", 0xD, 0xA, 0xA, 0
;
;
;
Command_c_sr2:
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
;
; mov rax, 2 ; A = 2 for N root of A
; mov rsi, HAND_XREG
; call FP_Load64BitNumber ; X-Reg = 2.00000...
; mov rax, 2 ; N = 2 for N root of A
; call Function_nth_root_x ; Calculate SQRT(2) into X-Reg
call Function_calc_sr2
call CROut
call PrintResult
ret
;
; Golden Ratio = (1 + sqrt(5)) / 2
;
Command_c_gr:
mov rax, .gr_str
call StrOut
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
;
mov rax, 5 ; A = 5 for N root of A
mov rsi, HAND_XREG
call FP_Load64BitNumber ; X-Reg = 2.00000...
mov rax, 2 ; N = 2 for N root of A
call Function_nth_root_x ; Calculate SQRT(2) into X-Reg
;
; Add 1
mov rsi, HAND_XREG
mov rdi, HAND_ACC
call CopyVariable
mov rax, 1
mov rsi, HAND_OPR
call FP_Load64BitNumber
call FP_Addition
;
; Divide by 2
;
mov rsi, HAND_ACC
mov rdi, HAND_OPR
call CopyVariable
mov rax, 2
mov rsi, HAND_ACC
call FP_Load64BitNumber
call FP_Division
mov rsi, HAND_ACC
mov rdi, HAND_XREG
call CopyVariable
call CROut
call PrintResult
ret
.gr_str:
db "Calculate Golden Ratio.", 0xD, 0xA, 0
;
;
;
Command_chs:
mov rsi, HAND_XREG
call FP_TwosCompliment
call PrintResult
ret
;
;
;
Command_clrall:
mov rsi, HAND_ACC
.loop:
call ClearVariable
inc rsi
cmp rsi, TOPHAND
jle .loop
mov rax, .Msg
call StrOut
call PrintResult
ret
.Msg: db "All Varaibles Cleared.", 0xD, 0xA, 0xA, 0
;
;
;
Command_clrreg:
mov rsi, HAND_REG0
.loop:
call ClearVariable
inc rsi
cmp rsi, TOPHAND
jle .loop
mov rax, .Msg
call StrOut
call PrintResult
ret
.Msg: db "Registers Reg0 and greater Cleared.", 0xD, 0xA, 0xA, 0
;
;
;
Command_clrstk:
mov rsi, HAND_XREG
call ClearVariable
mov rsi, HAND_YREG
call ClearVariable
mov rsi, HAND_ZREG
call ClearVariable
mov rsi, HAND_TREG
call ClearVariable
call CROut
call PrintResult
ret
;
;
;
Command_clrx:
mov rsi, HAND_XREG
call ClearVariable
call CROut
call PrintResult
ret
;
;
;
Command_cmdlist:
cmp rax, 0 ; is there a search key?
je .skip1
mov rbx, rax ; point to input string
mov al, [rbx] ; Get the character
.skip1:
push rax
mov rax, .Msg
call StrOut
pop rax
call PrintCommandList ; Call with AL search key
ret
.Msg: db "cmdlist <x> <-- search first letter of command.", 0xD, 0xA
db "Command List:", 0xD, 0xA, 0xA, 0
;
;
;
Command_comment:
or rax, rax ; Check valid argument
jnz .skip1
mov rax, .Msg_error
call StrOut ; print error message
ret
.skip1:
call StrOut ; Print the comment into console/file output
call CROut
ret
.Msg_error:
db "Command Parser: Error, invalid comment argument", 0xD, 0xA
db " Usage: comment <comment string>", 0xD, 0xA, 0
;
;
;
Command_D.comp:
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call Variable_Compare
ret
;
;
;
Command_D.endi:
call EndianCheck
ret
;
;
;
Command_D.fill:
or rax, rax ; Check for argument
jz .Error1 ; No argument
cmp byte [rax], '0' ; Check first character of command
jl .Error1 ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .Error1
call IntWordInput ; RAX in binary 64 bit data
cmp rax, TOPHAND ; Check for highest register
jg .Error1
mov rsi, rax ; Variable handle number
call DebugFillVariable ; Execute subroutine
mov rax, .Msg1
call StrOut
ret
.Error1:
mov rax, .Msg_error
call StrOut
ret
.Msg_error:
db "Command Parser: D.Fill argument out of range", 0xD, 0xA
db " Usage: hex <integer> (given variable handle)", 0xD, 0xA, 0
.Msg1:
db "Variable filled with incremental byte data", 0xD, 0xA, 0
;
;
;
Command_D.flag:
or rax, rax ; Check for argument
jz .no_arg ; No argument
cmp byte [rax], '0' ; Check first character of command
jl .no_arg ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .no_arg
call IntWordInput ; RAX in binary 64 bit data
mov [DebugFlag], rax
.no_arg:
mov rax, .Msg1
call StrOut
mov rax, [DebugFlag]
call PrintWordB10
call CROut
call Header_Update
ret
.Msg1: db "Debug Flag = ", 0
;
;
;
Command_D.init:
call FP_Initialize
call Header_Update
mov rax, .Msg
call StrOut
call PrintResult
ret
.Msg: db "Called FP_Initialize", 0xD, 0xA, 0xA, 0
;
;
;
Command_D.ofst:
;
mov rax, .Msg0
call StrOut
mov rax, [No_Word]
call PrintWordB10
call CROut
;
mov rax, .Msg0a
call StrOut
mov rax, [D_Flt_Word]
call PrintWordB10
call CROut
;
mov rax, .Msg1
call StrOut
mov rax, [LSWOfst]
call PrintWordB10
call CROut
;
mov rax, .Msg1a
call StrOut
mov rax, [D_Flt_LSWO]
call PrintWordB10
call CROut
;
mov rax, .Msg2
call StrOut
mov rax, MAN_MSW_OFST
call PrintWordB10
call CROut
;
mov rax, .Msg3
call StrOut
mov rax, EXP_WORD_OFST
call PrintWordB10
call CROut
;
mov rax, .Msg4
call StrOut
mov rax, [Shift_Count]
call PrintWordB10
call CROut
;
mov rax, .Msg4a
call StrOut
mov rax, [Last_Shift_Count]
call PrintWordB10
call CROut
;
mov rax, .Msg5
call StrOut
mov rax, [No_Byte]
call PrintWordB10
call CROut
;
mov rax, .Msg5a
call StrOut
mov rax, [D_Flt_Byte]
call PrintWordB10
call CROut
;
mov rax, .Msg6
call StrOut
mov rax, MAN_MSB_OFST
call PrintWordB10
call CROut
;
ret
;
.Msg0: db "[No_Word] = ", 0
.Msg0a: db "[D_Flt_Word] = ", 0
.Msg0b: db "[D_Flt_Word] = ", 0
.Msg0c: db "[D_Flt_Word] = ", 0
.Msg1: db "[LSWOfst] = ", 0
.Msg1a: db "[D_Flt_LSWO] = ", 0
.Msg2: db "MAN_MSW_OFST = ", 0
.Msg3: db "EXP_WORD_OFST = ", 0
.Msg4: db "Shift_Count = ", 0
.Msg4a: db "Last_Shift_Count = ", 0
.Msg5: db "[No_Byte] = ", 0
.Msg5a: db "[D_Flt_Byte] = ", 0
.Msg6: db "MAN_MSB_OFST = ", 0
;Shift_Count
;Nearly_Zero
;Last_Shift_Count
;Last_Nearly_Zero
;
;
;
Command_desc:
mov rax, .Msg1
call StrOut
mov rax, Description
call StrOut
call CROut
ret
.Msg1: db "File Description: ", 0
Command_descnew:
call EnterFileDescription
call CROut
mov rax, .Msg1
call StrOut
mov rax, Description
call StrOut
call CROut
call Header_Update
ret
.Msg1: db "File Description: ", 0
;
;
;
Command_enter:
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
;
call PrintResult
ret
;
;
;
Command_exit:
jmp ProgramExit ; Exit program
;
;
;
Command_f_asin:
mov rax, .Msg1
call StrOut
call Function_arcsin_x ; Calculate Sin(x))
call PrintResult
ret
.Msg1 db "Arcsine valid range -1 <= Xreg <= 1 (not checked)", 0xD, 0xA
db "Calculation time increases when Xreg near |1|", 0xD, 0xA, 0xA, 0
;
;
;
Command_f_cos:
call Function_cos_x ; Calculate Sin(x))
call PrintResult
ret
;
;
;
Command_f_exp:
call Function_exp_x
call PrintResult
ret
;
;
;
Command_f_ipwr:
or rax, rax ; Check RAX for valid argument
jz .Error1 ; RAX = zero, no argument found
cmp byte [rax], '0' ; Check first character of command
jl .Error1 ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .Error1
call IntWordInput ; RAX in binary 64 bit data
call Function_int_power_x ; Calculate nth root (N in RAX, A in ACC)
call CROut
call PrintResult
ret
.Error1:
mov rax, .Msg_error
call StrOut
ret
.Msg_error:
db 0xD, 0xA, "Command Parser: Error, f.ipwr (X-Reg to the integer power) invalid argument.", 0xD, 0xA
db " Usage: f.ipwr <integer>", 0xD, 0xA, 0
;
;
;
Command_f_ln_rg:
mov rax, .Msg1
call StrOut
call Function_ln_x_by_guess
call PrintResult
ret
.Msg1: db "Calc natural log by recursive guesses", 0xD, 0xA, 0
;
;
;
Command_f_ln_is:
mov rax, .Msg1
call StrOut
call Function_ln_x_series
call PrintResult
ret
.Msg1: db "Calc natural log by infinite series", 0xD, 0xA, 0
;
;
;
Command_f_nroot:
or rax, rax ; Check RAX for valid argument
jz .Error1 ; RAX = zero, no argument found
cmp byte [rax], '0' ; Check first character of command
jl .Error1 ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .Error1
call IntWordInput ; RAX in binary 64 bit data
call Function_nth_root_x ; Calculate nth root (N in RAX, A in ACC)
;
; push rax ; then nth root number (2=square root, 3=cube root
; mov rax, .Msg_1 ; (temporarily set at top of file)
; call StrOut
; pop rax
; call PrintWordB10
; mov rax, .Msg_2 ; (temporarily set at top of file)
; call StrOut
;
call CROut
call PrintResult
ret
.Error1:
mov rax, .Msg_error
call StrOut
ret
.Msg_1:
db 0xD, 0xA, 0xA, "Calculated ", 0
.Msg_2:
db " root of X-Reg", 0xD, 0xA, 0
.Msg_error:
db 0xD, 0xA, "Command_nroot: Error, invalid argument." , 0xD , 0xA
db " Usage: nroot <integer>", 0xD, 0xA
db " Calculates integer root of X-Reg", 0xD, 0xA
db " Valid for integers 2 or greater.", 0xD, 0xA, 0
;
;
;
Command_f_sin:
call Function_sin_x ; Calculate Sin(x))
call PrintResult
ret
;
;
;
Command_f_zeta:
or rax, rax ; Check RAX for valid argument
jz .Error1 ; RAX = zero, no argument found
cmp byte [rax], '0' ; Check first character of command
jl .Error1 ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .Error1
call IntWordInput ; RAX in binary 64 bit data
cmp rax, 2 ; Check for < 2 error
jl .Error1
push rax ; SAVE FOR FUNCTION
;
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
;
pop rax
call Function_calc_zeta
call CROut
call PrintResult
ret
.Error1:
mov rax, .ErrorMsg
call StrOut
ret
.ErrorMsg:
db "Error: argument must be integer >= 2." , 0xD , 0xA , 0
;
;
;
Command_fix:
mov qword[Out_Mode], 1 ; Print with fixed notation
call CROut
call PrintResult
call Header_Update
ret
;
;
;
Command_head:
call Header_Init
call Header_Update
ret
;
;
;
Command_headoff:
call Header_Cancel
;; call ClrScr
ret
;
;
;
Command_help:
call Help ; Address passed in RAX
ret
;
;
;
Command_help_all:
call PrintAllHelp
ret
;
;
;
Command_hex:
or rax, rax ; Check for argument
jz .no_arg ; No argument
cmp byte [rax], '0' ; Check first character of command
jl .Error1 ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .Error1
call IntWordInput ; RAX in binary 64 bit data
cmp rax, TOPHAND ; Check for highest register
jg .Error1
mov rsi, rax ; Variable handle number
call PrintVar
call CROut
ret
.no_arg:
call PrintHex
ret
.Error1:
mov rax, .Msg_error
call StrOut
ret
.Msg_error:
db "Command Parser: hex argument out of range", 0xD, 0xA
db " Usage: hex (without argument shows all registers", 0xD, 0xA
db " Usage: hex <integer> (given variable handle 0-16)", 0xD, 0xA, 0
;
;
;
Command_int:
mov qword[Out_Mode], 2 ; Print integer format
call CROut
call PrintResult
call Header_Update
ret
;
;
;
Command_load:
push rax ; Save argument pointer
mov rsi, HAND_ACC ; Clear ACC for input buffer
call ClearVariable ; Call clear variable
pop rax ; Restore argument (filename) pointer
call LoadVariable ; Load variable into ACC from file
mov rax, [FP_Acc+MAN_MSB_OFST] ; M.S.Byte
or rax, rax ; Error check, is MSByte zero?
jnz .fl_NoErr ; No, non-zero number assumed valid
mov rax, .Msg_error1 ; message, stack not rotated
call StrOut
call Header_Update
ret
.fl_NoErr:
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
;
mov rsi, HAND_ACC
mov rdi, HAND_XREG
call CopyVariable
;
call CROut
mov rax, .Msg2
call StrOut
;
call CROut
call PrintResult
;
call Header_Update
ret
.Msg_error1:
db 0xD, 0xA, "Command Parser: Variable is zero. Assume I/O error. X-Reg preserved, Stack not rotated", 0xD, 0xA, 0
.Msg2:
db "Command Parser: File data copied from ACC to X-Reg, stack rolled", 0xD, 0xA, 0
;
;
;
Command_log:
call StartEcho
call Header_Update
ret
;
;
;
Command_logoff:
call StopEcho
call Header_Update
ret
;
;
;
Command_mmode:
or rax, rax ; Check for argument
jz .no_arg ; No argument
cmp byte [rax], '0' ; Check first character of command
jl .no_arg ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .no_arg
call IntWordInput ; RAX in binary 64 bit data
mov [MathMode], rax
.no_arg:
mov rax, .Msg1
call StrOut
mov rax, [MathMode]
call PrintWordB10
mov rax, .Msg1a
call StrOut
mov al, [MathMode+1]
call PrintHexByte
mov al, [MathMode]
call PrintHexByte
mov rax, ')'
call CharOut
call CROut
call CROut
;
mov rbx, [MathMode] ; get mode
mov rax, .Mode_N1 ; bit 0 = 0 i86 word mult
test rbx, 1
jz .sk01
mov rax, .Mode_1 ; bit 0 = 1 long mult
.sk01: call StrOut
test rbx, 4
jnz .sk02
mov rax, .Mode_N4 ; bit 4 = 0 single word mult enabled
call StrOut
.sk02:
mov rax, .Mode_N2 ; bit 2 = 0 normal (reciprocal) division
test rbx, 2
jz .sk03
mov rax, .Mode_2 ; bit 1 = 1 long div
.sk03: call StrOut
test rbx, 0x10 ; 0x10 = 1 Disable reciprocal variable accuracy
jz .sk10
mov rax, .Mode_10
call StrOut
.sk10:
test rbx, 0x20 ; 0x10 = 1 reciprocal with bitwise mult.
jz .sk20
mov rax, .Mode_20
call StrOut
.sk20:
test rbx, 8
jnz .sk04
mov rax, .Mode_N8 ; bit 3 = 0 single word div enabled
call StrOut
.sk04:
test rbx, 0x40
jz .sk40
mov rax, .Mode_40 ; 0x40 = 1 FP_Addition use bitwise alignment
call StrOut
.sk40:
test rbx, 0x80
jz .sk80
mov rax, .Mode_80 ; 0x80 = 1 FP_Normalization use bitwise alignment
call StrOut
.sk80:
test rbx, 0x100
jz .sk100
mov rax, .Mode_100 ; 0x100 = 1 disable function ReduceSeriesAccuracy
call StrOut
.sk100:
mov rax, .Msg2
call StrOut
call Header_Update
ret
.Msg1: db " MathMode = ", 0
.Msg1a: db " (0x", 0
.Mode_N1: db " Multiplication: 64 bit x86 MUL matrix multiplicaiton", 0xD, 0xA, 0
.Mode_1: db " Multiplication: Binary long multiplication, shift and add bitwise.", 0xD, 0xA, 0
.Mode_N2: db " Division: Newton-Raphson reciprocal with i86 MUL matrix multiplication", 0xD, 0xA, 0
.Mode_2: db " Division: Binary long division, subtraction and rotate bitwise", 0xD, 0xA, 0
.Mode_N4: db " Enable: Single word x86 MUL register multiplication where possible", 0xD, 0xA, 0
.Mode_N8: db " Enable: Single word x86 DIV register division where possible", 0xD, 0xA, 0
.Mode_10: db " Disable: Reciprocal variable accuracy (used in FP_Division).", 0xD, 0xA, 0
.Mode_20: db " Disable: Reciprocal 64bit word mult * * * Destroys FP_Reg7 * * *", 0xD, 0xA, 0
.Mode_40: db " Addition: Force bitwise alignment", 0xD, 0xA, 0
.Mode_80: db " Normalize: Force bitwise alignment", 0xD, 0xA, 0
.Mode_100: db " Summation: Function ReduceSeriesAccuracy is disabled", 0xD, 0xA, 0
.Msg2: db 0xD, 0xA, " So see list of modes type: help mmode", 0xD, 0xA, 0
;
;
;
Command_mobile:
mov rax, 0x30
mov [iVerboseFlags], rax ; 1 = print loop updates
mov rax, 0xF700CCCC
mov [iShowCalcMask], rax
ret
;
;
;
SetNormal: ; <--- Global command
Command_normal:
push rax
mov rax, 0x30
mov [iVerboseFlags], rax ; 1 = print loop updates
mov rax, 0xFFFFFFFF
mov [iShowCalcMask], rax
pop rax
ret
;
;
;
Command_print:
or rax, rax ; Check for argument
jz .no_arg ; No argument
cmp [rax], byte 's' ; s for short lines
jne .not_dots
mov rsi, HAND_XREG ; Handle number X-Reg
mov rdi, HAND_ACC ; Handle number ACC (for printing)
call CopyVariable ; Move RegX to Acc
mov qword [OutCountActive], 0x2+0x1
call PrintVariable ; Convert base 10 and print
call CROut
ret
.not_dots:
cmp [rax], byte 'u' ; u = unformatted
jne .not_dotu
mov rsi, HAND_XREG ; Handle number X-Reg
mov rdi, HAND_ACC ; Handle number ACC (for printing)
call CopyVariable ; Move RegX to Acc
mov qword [OutCountActive], 0
call PrintVariable ; Convert base 10 and print
call CROut
ret
.not_dotu:
cmp [rax], byte 'f' ; u = unformatted
jne .not_dotf
mov rsi, HAND_XREG ; Handle number X-Reg
mov rdi, HAND_ACC ; Handle number ACC (for printing)
call CopyVariable ; Move RegX to Acc
mov qword [OutCountActive], 1 ; Formatted
call PrintVariable ; Convert base 10 and print
call CROut
ret
.not_dotf:
cmp [rax], byte 'q' ; q = quiet, stop console echo
jne .no_arg
mov rsi, HAND_XREG ; Handle number X-Reg
mov rdi, HAND_ACC ; Handle number ACC (for printing)
call CopyVariable ; Move RegX to Acc
mov qword [OutCountActive], 1
mov qword [ConInhibit], 1 ; Inhibit console characters
call PrintVariable ; Convert base 10 and print
mov rax, 0
mov [ConInhibit], rax ; Restore console output
ret
.no_arg:
mov rsi, HAND_XREG ; Handle number X-Reg
mov rdi, HAND_ACC ; Handle number ACC (for printing)
call CopyVariable ; Move RegX to Acc
mov qword [OutCountActive], 0 ; Default - unformatted
call PrintVariable ; Convert base 10 and print
call CROut
ret
;
;
;
;
;
;
%IFDEF PROFILE
Command_profile:
or rax, rax ; Is there argument?
jz .no_arg ; No argument
cmp [rax], byte 'i' ; i = initialize profile
jne .no_arg
call Profile_Init ; Initialize profile counters
mov rax, .Msg1
call StrOut
.no_arg:
call Profile_Show_Always
ret
.Msg1: db 0xD, 0xA, "Profile counters initialized", 0xD, 0xA, 0
%ENDIF ;IFDEF PROFILE
Command_quiet:
mov rax, 0
mov [iVerboseFlags], rax
mov rax, 0xFFFFFFFF
mov [iShowCalcMask], rax
mov rax, .Msg
call StrOut
ret
.Msg: db "Set Quiet", 0xD, 0xA, 0
;
;
;
Command_rcl:
or rax, rax ; Check for valid argument
jnz .arg_present
.Error1:
mov rax, .Msg_error
call StrOut
ret
.arg_present:
cmp byte [rax], '0' ; Check first character of command
jl .Error1 ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .Error1
call IntWordInput ; RAX in binary 64 bit data
cmp rax, (TOPHAND-HAND_REG0)
jg .Error1
;
push rax
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
pop rax
mov rsi, rax ; Get register number starting 0
add rsi, HAND_REG0 ; Add lowest handle
mov rdi, HAND_XREG
call CopyVariable
call PrintResult
ret
.Msg_error:
db "Command Parser: Invalid argument for rcl (recall register).", 0xD, 0xA
db " Usage: rcl <integer> (enter register number 0-7)", 0xD, 0xA, 0
;
;
;
Command_recip:
mov rsi, HAND_XREG
mov rdi, HAND_ACC
call CopyVariable
;
call FP_Reciprocal
;
mov rsi, HAND_ACC
mov rdi, HAND_XREG
call CopyVariable
call CROut
call PrintResult
ret
;
;
;
Command_rdown:
mov rsi, HAND_TREG
mov rdi, HAND_WORKB
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_XREG
call CopyVariable
;
mov rsi, HAND_ZREG
mov rdi, HAND_YREG
call CopyVariable
;
mov rsi, HAND_WORKB
mov rdi, HAND_ZREG
call CopyVariable
;
call PrintResult
ret
;
;
;
Command_rup:
mov rsi, HAND_TREG
mov rdi, HAND_WORKB
call CopyVariable
;
mov rsi, HAND_ZREG
mov rdi, HAND_TREG
call CopyVariable
;
mov rsi, HAND_YREG
mov rdi, HAND_ZREG
call CopyVariable
;
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call CopyVariable
;
mov rsi, HAND_WORKB
mov rdi, HAND_XREG
call CopyVariable
;
call PrintResult
ret
;
;
;
Command_sci:
mov qword [Out_Mode], 0
call CROut
call PrintResult
call Header_Update
ret
;
;
;
Command_show:
mov qword[iShowCalc], 1
call Header_Update
mov rax, .msg1
call StrOut
mov rax, [iShowCalcStep]
call PrintWordB10
call CROut
ret
.msg1: db "Show Progress: On, Step = ", 0
;
;
;
Command_showoff:
mov qword[iShowCalc], 0
call Header_Update
mov rax, .msg1
call StrOut
ret
.msg1: db "Show Progress: Off", 0xD, 0xA, 0
;
;
;
Command_sand:
call Sand
call CROut
;;; call PrintResult
ret
;
;
;
Command_sandbox:
or rax, rax ; Check for argument
jz .no_arg ; No argument
cmp byte [rax], '0' ; Check first character of command
jl .no_arg ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .no_arg
call IntWordInput ; RAX in binary 64 bit data
.no_arg:
call SandBox ; If argument present, it will be 64 bit value in RAX
call CROut
call PrintResult
ret
;
;
;
Command_save:
call SaveVariable
ret
;
;
;
;
Command_sigfigs:
or rax, rax ; Is argument present?
jnz .has_arg
call PrintAccuracy ; Print accuracy number to output
; call PrintAccVerbose ; Print accuracy number to output
call Header_Update
ret
.has_arg:
cmp [rax], byte 'v' ; Verbose
jne .skip_sf1 ; No, other accuracy commands?
call PrintAccVerbose ; Print accuracy information to output
call Header_Update
ret
.skip_sf1:
cmp [rax], byte 'x' ; Set Maximum Accuracy
jne .skip_sf2 ; No, other accuracy commands?
call SetMaximumAccuracy ; Set all accuracy variables to maximum
call PrintAccVerbose ; Print accuracy information to output
call Header_Update
ret
.skip_sf2:
cmp [rax], byte 'e' ; Input extended digits
jne .skip_sf3 ; No, other accuracy commands?
cmp [rax+1], byte ' ' ; Space character
jne .Error1 ; Error, space expected
cmp [rax+2], byte '0' ; Check first character of command
jl .Error1 ; less than 0? then skip
cmp [rax+2], byte '9' ; greater than 9? then skip
jg .Error1
add rax, 2 ; increment for 2 command letters
call IntWordInput ; RAX in binary 64 bit data
call SetExtendedDigits ; Set digits to value in RAX
call PrintAccVerbose ; Print accuracy information to output
call Header_Update
ret
.skip_sf3:
cmp [rax], byte 'w' ; Input number of words
jne .skip_sf4 ; No, other accuracy commands?
cmp [rax+1], byte ' ' ; Space character
jne .Error1 ; Error, space expected
cmp [rax+2], byte '0' ; Check first character of command
jl .Error1 ; less than 0? then skip
cmp [rax+2], byte '9' ; greater than 9? then skip
jg .Error1
add rax, 2 ; increment for 2 command letters
call IntWordInput ; RAX in binary 64 bit data
call SetWordAccuracy ; Set digits to value in RAX
call PrintAccVerbose ; Print accuracy information to output
call Header_Update
ret
.skip_sf4:
cmp [rax], byte 'K' ; Input number of words
jne .skip_sf5 ; No, other accuracy commands?
mov rax, 1000 ; 1K digits
call SetDigitAccuracy ; Set digits to value in RAX
call PrintAccVerbose ; Print accuracy information to output
call Header_Update
ret
.skip_sf5:
cmp [rax], byte 'M' ; Input number of words
jne .skip_sf6 ; No, other accuracy commands?
mov rax, 1000000 ; 1M digits
call SetDigitAccuracy ; Set digits to value in RAX
call PrintAccVerbose ; Print accuracy information to output
call Header_Update
ret
.skip_sf6:
cmp [rax], byte '0' ; Check first character of command
jl .Error1 ; less than 0? then skip
cmp [rax], byte '9' ; greater than 9? then skip
jg .Error1
call IntWordInput ; RAX in binary 64 bit data
call SetDigitAccuracy ; Set digits to value in RAX
call PrintAccuracy ; Print accuracy information to output
call Header_Update
ret
.Error1:
mov rax, .Msg_Error1
call StrOut
mov rax, Help_sigfigs ; Text located in help.asm
call StrOut
call CROut
ret
.Msg_Error1: db "Command Parser: sigfigs command invalid argument", 0xD, 0xA, 0xA, 0
;
;
;
Command_slimit:
or rax, rax ; Check for argument
jz .no_arg ; No argument
cmp byte [rax], '1' ; Check first character of command
jl .no_arg ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .no_arg
call IntWordInput ; RAX in binary 64 bit data
mov [Sum_Limit], rax
.no_arg:
mov rax, .Msg1
call StrOut
mov rax, [Sum_Limit]
call PrintWordB10
call CROut
call Header_Update
ret
.Msg1: db "[Sum_Limit] = ", 0
;
;
;
Command_sstep:
or rax, rax ; Check for argument
jz .no_arg ; No argument
cmp byte [rax], '0' ; Check first character of command
jl .no_arg ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .no_arg
call IntWordInput ; RAX in binary 64 bit data
mov [iShowCalcStep], rax
.no_arg:
mov rax, .Msg1
call StrOut
mov rax, [iShowCalcStep]
call PrintWordB10
call CROut
call Header_Update
ret
.Msg1: db "[iShowCalcStep] = ", 0
;
;
;
Command_stack:
mov rbx, [iVerboseFlags]
push rbx
mov rbx, 0x30 ; code for all registers
mov [iVerboseFlags], rbx
call PrintResult
pop rbx
mov [iVerboseFlags], rbx
ret
;
;
;
Command_sto:
or rax, rax ; Check for valid argument
jnz .arg_present
.Error1:
mov rax, .Msg_error
call StrOut
ret
.arg_present:
cmp byte [rax], '0' ; Check first character of command
jl .Error1 ; less than 0? then skip
cmp byte [rax], '9' ; greater than 9? then skip
jg .Error1
call IntWordInput ; RAX in binary 64 bit data
cmp rax, (TOPHAND-HAND_REG0)
jg .Error1
mov rsi, HAND_XREG
mov rdi, rax ; Get register number starting 0
add rdi, HAND_REG0 ; Add lowest handle
call CopyVariable
call PrintResult
ret
.Msg_error: db "Command Parser: Invalid argument for sto (recall register).", 0xD, 0xA
db " Usage: sto <integer> (enter register number 0-7)", 0xD, 0xA, 0
;
;
;
Command_vars:
mov rbx, [iVerboseFlags]
push rbx
mov rbx, 0x70 ; code for all registers
mov [iVerboseFlags], rbx
call PrintResult
pop rbx
mov [iVerboseFlags], rbx
ret
;
;
;
Command_verbose:
mov rax, 0x70
mov [iVerboseFlags], rax
mov rax, 0xFFFFFFFF
mov [iShowCalcMask], rax
mov rax, .Msg
call StrOut
ret
.Msg: db "Set Verbose", 0xD, 0xA, 0
;
;
;
Command_xonly:
push rax
mov rax, 0x10
mov [iVerboseFlags], rax ; 10 = print on
mov rax, 0xFFFFFFFF
mov [iShowCalcMask], rax
pop rax
ret
;
;
;
Command_exchange_xy:
mov rsi, HAND_XREG
mov rdi, HAND_YREG
call ExchangeVariable
call PrintResult
ret
;
;
;
;----------------------------------------------
;
; Print Command List
;
; Input: AL = 0, print all commands
; AL = (character), print commands
; starting with character
;
;----------------------------------------------
PrintCommandList:
push rax
push rbx
push rcx
push rdx
push r15
mov r15, 0 ; initialize line feed counter
mov CL, al ; Get search character
mov rbx, Command_Table ; Address of command table
.loop1:
mov rax, rbx ; Get pointer
mov DL, [rax] ; Get character to see if done
or DL, DL ; Is it zero, then done
jz .done
or CL, CL ; Is CL zero, is there a search?
jz .skip1 ; It is zero, print all
cmp DL, CL ; Does character match?
jne .skip2 ; Does not match skip
.skip1:
call StrOut ; Print command
mov al, ' '
call CharOut
inc r15 ; increment line feed counter
cmp r15, 8 ; limit value
jc .skip2
mov r15, 0
call CROut ; line return + feed
.skip2:
add rbx, (BYTE_PER_WORD * 2)
jmp .loop1
.done:
call CROut
pop r15
pop rdx
pop rcx
pop rbx
pop rax
ret
;
;--------------------
; parser.asm - EOF
;--------------------
|
programs/oeis/327/A327247.asm | neoneye/loda | 22 | 29350 | ; A327247: Number of odd prime powers <= n (with exponents > 0).
; 0,0,1,1,2,2,3,3,4,4,5,5,6,6,6,6,7,7,8,8,8,8,9,9,10,10,11,11,12,12,13,13,13,13,13,13,14,14,14,14,15,15,16,16,16,16,17,17,18,18,18,18,19,19,19,19,19,19,20,20,21,21,21,21,21,21,22,22,22,22,23,23,24,24,24
div $0,2
seq $0,25548 ; a(n) = sum of the exponents in the prime factorization of the least common multiple of {1,3,5,...,2n-1}.
|
randfloat.adb | tyudosen/DualStack | 0 | 25931 | <filename>randfloat.adb
With Ada.Text_IO; Use Ada.Text_IO;
Package body RandFloat is
package IntIO is new Ada.Text_IO.Integer_IO(Integer);
use IntIO;
--x: integer;--:= 737; -- seed
function next_float(x: in out integer) return float is
n: integer;
begin
--put("Seed the rand gen");
--new_line;
x := x*29+37;
n := x;
x := x mod 1001;
return float(n mod 101) / 100.0;
end next_float;
end RandFloat; |
test/Succeed/Issue1344.agda | shlevy/agda | 0 | 11024 | <filename>test/Succeed/Issue1344.agda
{-# OPTIONS -v tc.unquote:30 #-}
open import Common.Prelude
open import Common.Reflection
open import Agda.Builtin.Sigma
data Box : Bool → Set where
box : (b : Bool) → Box b
works : (b : Bool) → Box b → Bool
works b (box .b) = unquote (give (var 0 []))
works₂ : (b : Bool) → Box b → Bool
unquoteDef works₂ = defineFun works₂ (clause
( ("b" , arg (argInfo visible relevant) unknown) ∷ [])
( arg (argInfo visible relevant) (var 0)
∷ arg (argInfo visible relevant) (con (quote box)
(arg (argInfo visible relevant) (dot unknown) ∷ []))
∷ [])
(var 0 []) ∷ [])
works₃ : (b : Bool) → Box b → (x y : Bool) → Bool
unquoteDef works₃ = defineFun works₃ (clause
( ("y" , arg (argInfo visible relevant) unknown)
∷ ("x" , arg (argInfo visible relevant) unknown)
∷ ("b" , arg (argInfo visible relevant) unknown)
∷ [])
( arg (argInfo visible relevant) (var 2)
∷ arg (argInfo visible relevant) (con (quote box)
(arg (argInfo visible relevant) (dot unknown) ∷ []))
∷ arg (argInfo visible relevant) (var 1)
∷ arg (argInfo visible relevant) (var 0)
∷ [])
(var 2 []) ∷ [])
|
Appl/Games/Uki/uki.asm | steakknife/pcgeos | 504 | 244858 | <gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PROJECT: Practice Project
MODULE: Uki program
FILE: uki.asm
Author <NAME>, January 14, 1991
$Id: uki.asm,v 1.1 97/04/04 15:47:09 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UkiChooseUki
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: GLOBAL
PASS: ax = 0; only do functions
ax != 0; do full init
RETURN: Void.
DESTROYED: Nada.
PSEUDOCODE/STRATEGY:
KNOWN BUGS/SIDEFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/ 7/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiChooseUki method UkiContentClass, MSG_UKI_CHOOSE_UKI
UkiAssignFunction initGame, UkiInitGame
UkiAssignFunction validMove, UkiIsClickValidMove
UkiAssignFunction movePiece, UkiMovePiece
UkiAssignFunction adjustMoveValues, UkiAdjustMoveValues
UkiAssignFunction userInput, UkiGetMouseClick
UkiAssignFunction computerFindMove, UkiComputerFindBestMove
; Start the game, maybe
tst ax
jz done
mov ax, UKI_INIT_BOARD_SIZE
mov es:[cells], al
call UkiSetUpBoardSizeUI
mov ax, MSG_UKI_START
call ObjCallInstanceNoLock
done:
ret
UkiChooseUki endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiInitGame
DESCRIPTION: initializes all state variables for a new game
PASS: nothing
RETURN: nothing
DESTROYED: ax, bx, cx, dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiInitGame proc far
;CELLS = 7
;LINES = CELLS+1
;BAD_COORD = LINES
;MAXCELLS = CELLS*CELLS
mov es:[obstacles], 0
mov al, es:[cells]
shr al
mov bl, al
mov cx, mask GDN_PLAYER2
call UkiSetNode
dec al
mov cx, mask GDN_PLAYER1
call UkiSetNode
dec bl
mov cx, mask GDN_PLAYER2
call UkiSetNode
inc al
mov cx, mask GDN_PLAYER1
call UkiSetNode
initLoop:
; keep initting the obstcles until the first guy can go...
call UkiInitObstacles
call UkiComputerMoveSearch ; find best move
; if the bestMoveCoord has an x coordinate of BAD_COORD then
; there were no possible moves for player1 so re-init the obstacles
cmp es:[bestMoveCoord].x_pos,BAD_COORD
je initLoop
; if no obstacles got put up, try again...
; unless of course there aren't supposed to be any
tst es:[obstacles]
jnz done ; have obstacles, ok we are done
; ok, no obstacles, if maxObstacles is zero then we are not supposed
; to have obstacles so we are done, else try again
tst es:[maxObstacles]
jnz initLoop
done:
ret
UkiInitGame endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UkiInitObstacles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
put up a symmetric pattern of obstacles four at a time,
up to maxObstacles
(could be 0)
CALLED BY: UkiInitGame
PASS: nothing
RETURN: Void.
DESTROYED: Nada.
PSEUDOCODE/STRATEGY:
for each of the upper left quadrant squares, randomly decide to
add an obstacle, if yes then duplicate it symmetrically in other
3 quadrants until we are done with all the upper left quadrant or have
reached the maximum number of obstacles
KNOWN BUGS/SIDEFFECTS/IDEAS: ????
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 6/18/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiInitObstacles proc near
; start at 0,0
mov ax, 0
mov bx, ax
; init number of obstacles to zero
mov es:[obstacles], ax
initloop:
; if the node already has an obstacle then we are being called
; again from UkiInitGame because they board set up didn't allow
; a first move, so just blank out the obstacle and continue as if
; this was a blank space all along
; if the current node is not empty (zero) then don't put an
; obstacle there
call UkiGetNode
cmp cl, mask GDN_OBSTACLE
jne notObstacle
mov dl, 0
call UkiDoObstacle
notObstacle:
tst cx
jnz cont
; else randomly decide to add an obstacle or not using a weighting
; factor of OBSTACLE_FREQEUNCY
mov dx, es:[obstacles]
cmp dx, es:[maxObstacles]
jge done
call FastRandom
and dx, UKI_OBSTACLE_FREQUENCY
tst dx
jnz cont
; we have decided to add an obstacles do add it symetrically to all
; four quadrants
mov dl, mask GDN_OBSTACLE
call UkiDoObstacle
cont:
; we are only doing the upper quadrant do calculate the x and y
; to which we need to loop through, not effecient, but whose counting?
push bx
inc al
mov bl, es:[cells]
shr bl
; inc bl
cmp al, bl
pop bx
jl initloop
inc bl
mov al, es:[cells]
shr al
; inc al
cmp bl, al
mov al, 0
jl initloop
done:
ret
UkiInitObstacles endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UkiDoObstacle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: adds four obstacles the given one in the first quadrant and
then added the other 3 symmetric ones in the other three
quadrants
CALLED BY: GLOBAL
PASS: ax, bx = cell coordinate in first quadrant
dl = value to put in the 4 cells (GameDataNode type)
RETURN: Void.
DESTROYED: Nada.
PSEUDOCODE/STRATEGY:
KNOWN BUGS/SIDEFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 11/30/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiDoObstacle proc near
uses ax, bx
.enter
mov cl, dl
call UkiSetNode
push bx
push ax
mov al, es:[cells]
dec al
sub al, bl
mov bl, al
pop ax
mov cl, dl
call UkiSetNode
push bx
mov bl, es:[cells]
dec bl
sub bl, al
mov al, bl
pop bx
mov cl, dl
call UkiSetNode
pop bx
mov cl, dl
call UkiSetNode
tst dl ; if we are clearing things out
jz done ; then don't update number of obstacles
add es:[obstacles], 4
done:
.leave
ret
UkiDoObstacle endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiAdjustMoveValues
DESCRIPTION: change the parameters to calculate moves value as game
goes along
PASS: nothing
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiAdjustMoveValues proc far
cmp dl, 20
jl done
mov es:[generalValue2], UKI_EDGE_MOVE_VALUE_1
cmp dl, 35
jl done
mov es:[generalValue2], UKI_EDGE_MOVE_VALUE_2
cmp dl, 50
jl done
mov es:[generalValue2], UKI_EDGE_MOVE_VALUE_3
cmp dl, 65
jl done
mov es:[generalValue2], UKI_EDGE_MOVE_VALUE_4
cmp dl, 80
jl done
mov es:[generalValue2], UKI_EDGE_MOVE_VALUE_5
done:
ret
UkiAdjustMoveValues endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiGetMouseClick
DESCRIPTION: respond to a mouse click on the board
PASS: cx,dx = position of mouse click in grid coordinates
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiGetMouseClick proc far
; now see the current status of that cell
mov bx, es:[gameBoard]
call MemLock
mov ds, ax
mov_tr ax, cx
mov_tr bx, dx
call UkiGetNode
; see if it is occupied by a piece owned by the current player
tst cl
jnz noMove
xchg ax, cx
xchg bx, dx
call UkiIsClickValidMove
tst cl
jz noMove
mov ch, al
mov dh, bl
call UkiMovePiece
call UkiCallComputerMove
mov si, UKI_MOVE_MADE
jmp done
noMove:
mov si, UKI_NO_MOVE_MADE
done:
mov bx, es:[gameBoard]
call MemUnlock
ret
UkiGetMouseClick endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiIsClickValidMove
DESCRIPTION: check to see if a move is a legal move
PASS: cl, dl = clicked position
RETURN: cl = number of opponents captured (0 == illegal move)
al, bl = cl, dl that got passed in
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiIsClickValidMove proc far
.enter
mov_tr ax, cx
mov_tr bx, dx
clr cl
mov dl, -1
mov dh, -1
checkloop:
call UkiCheckLine
inc dl
cmp dl, 2
jl checkloop
mov dl, -1
inc dh
cmp dh, 2
jl checkloop
.leave
ret
UkiIsClickValidMove endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiCheckLine
DESCRIPTION: giveen a starting position and direction see if any
opponents are captured along that line
PASS: al, bl starting point
dl, dh = direction vector (ie -1,-1 or 1,0 or 0,1)
cl = value of move so far
RETURN:
cl = value of move after checking this row
(ie. passed in cl + number of oppnents
taken in this row)
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiCheckLine proc near
uses ax, bx, dx
.enter
push cx
mov cl, dl
or dl, dh
tst dl
pushf
mov dl, cl
clr cl
popf
jz nogoodPopCX
cmp es:[whoseTurn], offset player1
jz doplayer1
mov ah, mask GDN_PLAYER1
jmp checkloop
doplayer1:
mov ah, mask GDN_PLAYER2
checkloop:
add al, dl
add bl, dh
call UkiCheckBounds
jc nogoodPopCX
push cx
call UkiGetNode
tst cl
jz nogoodPopCXCX
cmp cl, mask GDN_OBSTACLE
jz nogoodPopCXCX
mov si, es:[whoseTurn]
cmp cl, es:[si].SP_player
jz contPopCX
pop cx
inc cl
jmp checkloop
nogoodPopCX:
pop cx
jmp done
nogoodPopCXCX:
pop cx
pop cx
jmp done
contPopCX:
pop cx
mov al, cl
pop cx
add cl , al
done:
.leave
ret
UkiCheckLine endp
if 0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UkiIsEdgeMove
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: ????
PASS: al, bl = position
dl, dh is line vector
RETURN: ch = 0 or 1
DESTROYED: Nada.
PSEUDOCODE/STRATEGY: ????
KNOWN BUGS/SIDEFFECTS/IDEAS: ????
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 6/17/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiIsEdgeMove proc near
uses ax, bx, dx
.enter
clr ch
tst al
jnz checkHighX
doVertical:
tst dl
jnz done
mov ch, 1
jmp done
checkHighX:
inc al
cmp al, es:[cells]
jnz checkLowY
jmp doVertical
checkLowY:
tst bl
jnz checkHighY
doHorizontal:
tst dh
jnz done
mov ch, 1
jmp done
checkHighY:
inc bl
cmp bl, es:[cells]
jnz done
jmp doHorizontal
done:
.leave
ret
UkiIsEdgeMove endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiCheckBounds
DESCRIPTION: check the bounds of a position
PASS: al, bl grid position
RETURN:
DESTROYED: ???
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiCheckBounds proc near
tst al
jl outOfBounds
tst bl
jl outOfBounds
cmp al, es:[cells]
jge outOfBounds
cmp bl, es:[cells]
jge outOfBounds
clc
jmp done
outOfBounds:
stc
done:
ret
UkiCheckBounds endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiMovePiece
DESCRIPTION: update board and screen for a given move
PASS: ch,dh: position to move to
cl: type of move (1 = jump, 3 = replication)
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiMovePiece proc far
mov al, ch
mov bl, dh
mov si, es:[whoseTurn]
inc es:[si].SP_numberOfGuys
mov cl, es:[si].SP_player
call UkiSetNode
mov cl, es:[si].SP_pieceColor
clr es:[si].SP_noMoveCount
call UkiDrawPlayer
; if we took a hint, then the new piece got drawn over
; the hint, so mark the hint as BAD_COORD so that it
; doesn't try to undo it later
cmp al, es:[hintMoveCoord].x_pos
jnz skiphint
cmp bl, es:[hintMoveCoord].y_pos
jnz skiphint
mov es:[hintMoveCoord].x_pos, BAD_COORD
skiphint:
call UkiAffectOpponent
ret
UkiMovePiece endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiAffectOpponent
DESCRIPTION: turn over all captured opponents updating board and screen
PASS: al,bl = position moved to
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiAffectOpponent proc near
mov dl, -1
mov dh, -1
checkloop:
clr cx
clr si
call UkiCheckLine
tst cl
jz cont
call UkiDoAffect
cont:
inc dl
cmp dl, 2
jl checkloop
mov dl, -1
inc dh
cmp dh, 2
jl checkloop
ret
UkiAffectOpponent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiDoAffect
DESCRIPTION: turn over opponents along given line
PASS: al, bl position moved to
dl, dh = direction vector
cl = number of opponents in this row to be affected
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiDoAffect proc near
uses ax, bx, dx
.enter
cmp es:[whoseTurn], offset player1
jnz doplayer2
add es:[player1].SP_numberOfGuys, cx
sub es:[player2].SP_numberOfGuys, cx
jmp doloop
doplayer2:
add es:[player2].SP_numberOfGuys, cx
sub es:[player1].SP_numberOfGuys, cx
doloop:
add al, dl
add bl, dh
push cx, dx
mov si, es:[whoseTurn]
mov cl, es:[si].SP_player
call UkiSetNode
call UkiDrawCurrentPlayer
pop cx, dx
loop doloop
.leave
ret
UkiDoAffect endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiComputerFindBestMove
DESCRIPTION: find the best move for the computer
PASS: nothing
RETURN: si: 0 if no move found, 1 otherwise
DESTROYED: ???
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiComputerFindBestMove proc far
mov bx, es:[gameBoard]
call MemLock
mov ds, ax
clr ax
mov bx, ax
mov si, ax
mov es:[bestMoveSoFar], al
mov es:[bestMoveCoord].x_pos, BAD_COORD
gridloop:
call UkiGetNodeNL
tst cl
jnz cont
call UkiDoBestMoveFromHere
cont:
inc al
cmp al, es:[cells]
jl gridloop
inc bl
clr al
cmp bl, es:[cells]
jl gridloop
mov bx, es:[gameBoard]
call MemUnlock
ret
UkiComputerFindBestMove endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: UkiDoBestFromHere
DESCRIPTION: see if this spot would be valid, and if so get its move value
if its better than the best move so far then mark it as the
best move so far
PASS: al, bl = position
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 2/91 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiDoBestMoveFromHere proc near
uses si, dx, bp, cx
.enter
mov cl, al
mov dl, bl
call UkiIsClickValidMove
tst cl
jz done
add cl, UKI_BASE_MOVE_VALUE
; add to cl so base value of a
; legal move is a value great
; enough, so that a "bad"
; move can have a positive value
call UkiFindMoveValue
cmp cl, es:[bestMoveSoFar]
jl done
jg doNewOne
cmp es:[bestMoveCoord].x_pos, BAD_COORD
jz doNewOne
call FastRandom
and dl, UKI_EQUAL_BESTMOVE_FACTOR
jz doNewOne
jmp done
doNewOne:
mov dx, bp
mov es:[bestMoveSoFar], cl
mov es:[bestMoveCoord].x_pos, al
mov es:[bestMoveCoord].y_pos, bl
done:
.leave
ret
UkiDoBestMoveFromHere endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UkiFindMoveValue
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: get the value for a given move
CALLED BY: GLOBAL
PASS: al, bl = board position
RETURN: move value
DESTROYED: Nada.
PSEUDOCODE/STRATEGY: this is my strategy....
a)
if a move is in the "center" that is, not an edge
or next to an edge then the move value is worth
the base value + the number of opponents turned
b)
if it is next to an edge than subtract a constant
value from the number of stones turned
c)
if its an edge then calculate the number of neighbors
along the edge of the opposing player are there,
if there is one, then the move value is
base value + # players turned - edge_neighbors_constant
if the value isn't 1, (0 or 2), then the move value is
base value + edge_constant + # of players turned
the corners get extra high values
KNOWN BUGS/SIDEFFECTS/IDEAS: ????
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 6/13/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiFindMoveValue proc near
uses ax, bx, si
.enter
push ax, bx
mov bx, es:[gameBoard]
call MemLock
mov ds, ax
pop ax, bx
clr ah
mov bh, ah
mov dx, 0
mov si, ax
call UkiFindMoveValueHelp
mov dx, 1
mov si, bx
call UkiFindMoveValueHelp
tst cl
jg done
mov cl, 1
done:
mov bx, es:[gameBoard]
call MemUnlock
.leave
ret
UkiFindMoveValue endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UkiFindMoveValueHelp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: helper routine for finding out a moves value
CALLED BY: ????
PASS: al, bl = board position
dl = horizontal edge(1) or vertical edge (0)
cl = move value so far
si = relevent coordinate
ds = gameBoard segment
es = dgroup
RETURN: cl = move value
DESTROYED: dx
PSEUDOCODE/STRATEGY: ????
KNOWN BUGS/SIDEFFECTS/IDEAS: ????
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 6/13/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiFindMoveValueHelp proc near
uses ax, bx
.enter
; if si is zero we are at an edge so find value of edge position
tst si
jnz testALhigh ; else cont
; if an edge has one opponent by it then its not "safe"
call UkiCaptureEdgeNeighbors
call UkiCheckEdgeNeighbors
cmp dh, 1 ; as long as not one neighbor, safe move
jnz doEdgeValue
; if the edge has 1 neighbor then make the move value lower
sub cl, UKI_EDGE_NEIGHBORS_VALUE
jmp done
doEdgeValue:
; if its a "safe" edge, add some value to the move, this changes
; of time
add cl, es:[generalValue2]
jmp done
testALhigh:
; if si+1 == cells we are at an edge so find edge position value
xchg ax, si
inc al
cmp al, es:[cells]
xchg ax, si
jnz checkAL2 ; else cont
call UkiCaptureEdgeNeighbors
call UkiCheckEdgeNeighbors
cmp dh, 1
jnz doEdgeValue
checkAL2:
dec si ; restore si to passed in value
; if si == 1 we are next to an edge so subtract from the move value
cmp si, 1
jnz checkALHigh2
doNextToEdge:
tst dl
jz doVertical
checkNextToCorner:
cmp al, 1
jz nextToCorner
mov bl, al
inc al
cmp al, es:[cells]
jnz notNextToCorner
nextToCorner:
sub cl, 20
jmp done
notNextToCorner:
sub cl, UKI_NEXT_TO_EDGE_VALUE
jmp done
doVertical:
xchg ax, bx
jmp checkNextToCorner
checkALHigh2:
; if si+2 == cells we are enxt to an edge so subtract from move value
add si, 2
xchg ax, si
cmp al, es:[cells]
xchg ax, si
jnz done
jmp doNextToEdge
done:
.leave
ret
UkiFindMoveValueHelp endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UkiCaptureEdgeNeighbors
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: ????
PASS: al, bl = board position
dl = 0 for vertical edge, 1 for horizontal edge
RETURN: cl = new move value
DESTROYED: Nada.
PSEUDOCODE/STRATEGY: ????
KNOWN BUGS/SIDEFFECTS/IDEAS: ????
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 6/18/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiCaptureEdgeNeighbors proc near
uses ax, bx, dx, si
.enter
push cx
tst dl
jz doVertical
clr dh
mov dl, -1
clr cl
call UkiCheckLine
mov dh, 1
common:
call UkiCheckLine
tst cl
pop cx
jz done
add cl, UKI_CAPTURE_EDGE_VALUE
jmp done
doVertical:
clr dl
mov dh, -1
clr cl
call UkiCheckLine
mov dl, 1
jmp common
done:
.leave
ret
UkiCaptureEdgeNeighbors endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UkiCheckEdgeNeighbors
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: ????
PASS: al, bl = board position
dl = 0 for vertical edge, 1 for horizontal edge
RETURN: dh = number of opposing neighbors 0, 1 or 2
ds = gameBoard segment
es = dgroup
DESTROYED: Nada.
PSEUDOCODE/STRATEGY: ????
KNOWN BUGS/SIDEFFECTS/IDEAS: ????
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 6/13/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UkiCheckEdgeNeighbors proc near
uses ax, bx, cx
.enter
mov si, es:[whoseTurn]
clr dh ; init our edge neighbors value to zero
tst dl ; check to see if we are doing vertical
jnz doHoriz ; or horizontal
; if we are doing a horizontal edge the first test to see
; if bl is zero, if so then check below (since the upper left
; corner is [0,0]) else check "above"
tst bl
jz checkBelow
; set al, bl to cell above this cell
dec bl
; set the current state of that cell
call UkiGetNodeNL
; if that cell is empty, then there is no neigbor
; else check to see if it is an oppoising neighbor or a friendly
; one, if opposing, then increment dh else cont
tst cl
jz checkBelowIncBL
and cl, es:[si].SP_player
and cl, 0xf0 ; zero out non relevant bits
tst cl
jnz checkBelowIncBL
inc dh
checkBelowIncBL:
inc bl
checkBelow:
; if we are at the bottom of the board, don't check beyond boundary
inc bl
cmp bl, es:[cells]
jz done
; else get the cell node and check for noeghbors
call UkiGetNodeNL
tst cl
; if a neighbor, check for friendliness
jz done
and cl, es:[si].SP_player
and cl, 0xf0 ; zero out non relevant bits
tst cl
jnz done
inc dh
jmp done
doHoriz:
; check left boundary
tst al
; if at check do right
jz checkRight
; else get node and check for neighbors
dec al
call UkiGetNodeNL
tst cl
; if neighbor, check for friendliness
jz checkRightIncAL
and cl, es:[si].SP_player
and cl, 0xf0 ; zero out piece type info
tst cl
jnz checkRightIncAL
inc dh
checkRightIncAL:
inc al
checkRight:
; now check right boudary
inc al
cmp al, es:[cells]
jz done
; if within boundary get node data
call UkiGetNodeNL
; check for neighbors
tst cl
jz done
; if neighbors, check for friendliness
and cl, es:[si].SP_player
and cl, 0xf0
tst cl
jnz done
inc dh
jmp done
done:
.leave
ret
UkiCheckEdgeNeighbors endp
UkiCode ends
|
functions.asm | racerxdl/asm2web | 59 | 88939 | section .text
; Importados do strings.asm
extern modo_leitura
extern linebreak
; Importados da libc e ligados como GCC
extern printf
extern free
extern malloc
extern fopen
extern fread
extern sprintf
; Lista de syscalls do linux https://filippo.io/linux-syscall-table/
SYSCALL_WRITE equ 1
SYSCALL_EXIT equ 60
STDOUT equ 1
global formatastring
formatastring:
; Recebe destino em RDI
; Recebe formato em RSI
; Recebe argumentos em RDX, RCX, R8, R9
call sprintf
global alo_kernel
alo_kernel:
; Uma zoeira pra chamar syscall. totalmente desnecessário, inútil e lerdo
syscall
ret
global exit
exit:
; Sai do programa
; Chama syscall exit
mov rax, SYSCALL_EXIT
mov rdi, 0 ; Exit Code = 0, success
syscall
global print
print:
; Imprime uma string em STDOUT
; Recebe string em RSI
push rax
push rsi
call strlen ; Tamanho da string em RAX
pop rsi
; Chamar syscall write em stdout
mov rdi, STDOUT ; File Description = STDOUT
mov rdx, rax ; Tamanho da string
mov rax, SYSCALL_WRITE ; Syscall Write
syscall
pop rax
ret
global println
println:
; Imprime uma string em STDOUT e uma quebra de linha
; Recebe string em RSI
push rsi
call print ; Imprime string recebida em RSI
mov rsi, linebreak ; Coloca quebra de linha em RSI
call print ; Imprime Quebra de Linha
pop rsi
ret
global eprintf
eprintf:
; Imprime uma string em STDOUT usando printf da libc
push rbp
mov rbp, rsp
call printf
pop rbp
ret
global strlen
strlen:
; Calcula o comprimento da string até o primeiro 0x00
; String para se calcular rsi
; Tamanho retorna em rax
push rbx ; Salva valor original de RBX na Stack
mov rbx, 0 ; Armazenar contagem de letras no RBX
loopstart:
mov rax, 0 ; Reseta RAX para armazenar o byte
lodsb ; Lê o byte em RSI e grava em AL (8 bits da direita de RAX)
test ax, ax ; Verifica se AL = 0 -- CACHORRO / DOG
jz loopout ; Se AL == 0, vá para loopout
inc rbx
jmp loopstart ; Volte para o começo do loop
loopout:
mov rax, rbx
pop rbx ; Restaura valor original de RBX da Stack
ret
global allocate
allocate:
; Aloca uma porção de memória de RDI bytes
; usando a função malloc da libc
; Endereço de memória retornado em RAX
push rbp
mov rbp, rsp
mov rax, 0
call malloc
pop rbp
ret
global deallocate
deallocate:
; Desaloca uma porção de memória no endereço RDI
; alocada com a função allocate usando a função
; free da libc
; Nenhum retorno
push rbp
mov rbp, rsp
call free
pop rbp
ret
global abrirarquivo
abrirarquivo:
; Abre um arquivo usando função fopen da libc
; Nome do arquivo em rdi
; Sempre somente-leitura
; Retorna "handler" do arquivo em RAX
push rbp
mov rbp, rsp
mov rsi, modo_leitura
call fopen
pop rbp
ret
global lerdados
lerdados:
; Le dados de um arquivo aberto com abrirarquivo
; Posicao de memoria de leitura em RDI
; Tamanho em RSI (numero de bytes)
; "Handler" do arquivo em RDX
; Retorna numero de bytes lidos em RAX
push rbp
mov rbp, rsp
mov rcx, rdx
mov rdx, 1 ; Um elemento de RCX bytes
call fread
pop rbp
ret
|
arbitrary-trig.adb | joewing/arbitrary | 0 | 10957 | <gh_stars>0
--------------------------------------------------------------------------
-- Arbitrary Precision Math Library: Trigonometric Functions
-- <NAME> 20020320 <> 20020327
--------------------------------------------------------------------------
with Arbitrary.Log; use Arbitrary.Log;
with Arbitrary.Const; use Arbitrary.Const;
package body Arbitrary.Trig is
-----------------------------------------------------------------------
-- Compute the sine of a
-----------------------------------------------------------------------
function Sin(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
last : Arbitrary_Type(a.precision);
count : Arbitrary_Type(a.precision);
term : Arbitrary_Type(a.precision);
one : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
sign : integer range -1 .. 1;
begin
-- sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ...
count := one;
term := a;
sign := 1;
loop
last := result;
if sign > 0 then
result := result + term;
else
result := result - term;
end if;
exit when last = result;
count := count + one;
term := term / count;
count := count + one;
term := term / count;
term := term * a * a;
sign := -sign;
end loop;
return result;
end Sin;
-----------------------------------------------------------------------
-- Compute the cosine of a
-----------------------------------------------------------------------
function Cos(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
last : Arbitrary_Type(a.precision);
term : Arbitrary_Type(a.precision);
count : Arbitrary_Type(a.precision);
one : Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
sign : integer range -1 .. 1;
begin
-- cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + ...
result := one;
count := To_Arbitrary(2, a.precision);
term := a * a / count;
sign := -1;
loop
last := result;
if sign > 0 then
result := result + term;
else
result := result - term;
end if;
exit when last = result;
count := count + one;
term := term / count;
count := count + one;
term := term / count;
term := term * a * a;
sign := -sign;
end loop;
return result;
end Cos;
-----------------------------------------------------------------------
-- Compute the tangent of a
-----------------------------------------------------------------------
function Tan(a : Arbitrary_Type) return Arbitrary_Type is
begin
-- tan(x) = x + x^3/3 + 2x^5/15 + 17x^7/315 + 62x^9/2835 + ...
-- tan(x) = sin(x) / cos(x)
return Sin(a) / Cos(a);
end Tan;
-----------------------------------------------------------------------
-- Compute the cosecant of a
-----------------------------------------------------------------------
function Csc(a : Arbitrary_Type) return Arbitrary_Type is
begin
-- csc(x) = 1/sin(x)
return To_Arbitrary(1, a.precision) / Sin(a);
end Csc;
-----------------------------------------------------------------------
-- Compute the secant of a
-----------------------------------------------------------------------
function Sec(a : Arbitrary_Type) return Arbitrary_Type is
begin
-- sec(x) = 1/cos(x)
return To_Arbitrary(1, a.precision) / Cos(a);
end Sec;
-----------------------------------------------------------------------
-- Compute the cotangent of a
-----------------------------------------------------------------------
function Cot(a : Arbitrary_Type) return Arbitrary_Type is
begin
-- cot(x) = cos(x)/sin(x)
return Cos(a) / Sin(a);
end Cot;
-----------------------------------------------------------------------
-- Compute the inverse sine of a
-----------------------------------------------------------------------
function ArcSin(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
last : Arbitrary_Type(a.precision);
term : Arbitrary_Type(a.precision);
count : Arbitrary_Type(a.precision);
one : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
begin
-- asin(x) = x + (1/6)x^3 + (3/40)x^5 + (5/112)x^7 + ...
-- each term: 1^2*3^2*5^2*...*(n-2)^2/n! * x^n for n=1,3,5,7,...
term := a;
count := one;
loop
last := result;
result := result + term;
exit when last = result;
term := term * count * count;
count := count + one;
term := term / count;
count := count + one;
term := term / count;
term := term * a * a;
end loop;
return result;
end ArcSin;
-----------------------------------------------------------------------
-- Compute the inverse cosine of a
-----------------------------------------------------------------------
function ArcCos(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
begin
-- acos(x) = pi/2 - x - (1/6)x^3 - (3/40)x^5 - (5/112)x^7 - ...
-- acos(x) = pi/2 - asin(x)
result := Pi(a.precision) / To_Arbitrary(2, a.precision);
result := result - ArcSin(a);
return result;
end ArcCos;
-----------------------------------------------------------------------
-- Compute the inverse tangent of a
-----------------------------------------------------------------------
function ArcTan(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
last : Arbitrary_Type(a.precision);
term : Arbitrary_Type(a.precision);
count : Arbitrary_Type(a.precision);
two : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(2, a.precision);
sign : integer range -1 .. 1;
begin
-- atan(x) = x - x^3/3 + x^5/5 - ...
term := a;
count := To_Arbitrary(1, a.precision);
sign := 1;
loop
last := result;
if sign > 0 then
result := result + term / count;
else
result := result - term / count;
end if;
exit when last = result;
count := count + two;
term := term * a * a;
sign := -sign;
end loop;
return result;
end ArcTan;
-----------------------------------------------------------------------
-- Compute the inverse cosecant of a
-----------------------------------------------------------------------
function ArcCsc(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
last : Arbitrary_Type(a.precision);
term : Arbitrary_Type(a.precision);
count : Arbitrary_Type(a.precision);
one : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
begin
-- acsc(x) = x^-1 + (1/6)x^-3 + (3/40)x^-5 + ...
term := one / a;
count := one;
loop
last := result;
result := result + term;
exit when last = result;
term := term * count * count;
count := count + one;
term := term / count;
count := count + one;
term := term / count;
term := term / (a * a);
end loop;
return result;
end ArcCsc;
-----------------------------------------------------------------------
-- Compute the inverse secant of a
-----------------------------------------------------------------------
function ArcSec(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
begin
-- asec(x) = pi/2 - acsc(x)
result := Pi(a.precision) / To_Arbitrary(2, a.precision);
result := result - ArcCsc(a);
return result;
end ArcSec;
-----------------------------------------------------------------------
-- Compute the inverse cotangent of a
-----------------------------------------------------------------------
function ArcCot(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
begin
-- acot(x) = pi/2 - x + (1/3)x^3 - (1/5)x^5 + ...
-- acot(x) = pi/2 - atan(x)
result := Pi(a.precision) / To_Arbitrary(2, a.precision);
result := result - ArcTan(a);
return result;
end ArcCot;
-----------------------------------------------------------------------
-- Compute the hyperbolic sine of a
-----------------------------------------------------------------------
function Sinh(a : Arbitrary_Type) return Arbitrary_Type is
begin
-- sinh(x) = (e^x - e^-x) / 2
return (Exp(a) - Exp(-a)) / To_Arbitrary(2, a.precision);
end Sinh;
-----------------------------------------------------------------------
-- Compute the hyperbolic cosine of a
-----------------------------------------------------------------------
function Cosh(a : Arbitrary_Type) return Arbitrary_Type is
begin
-- cosh(x) = (e^x + e^-x) / 2
return (Exp(a) + Exp(-a)) / To_Arbitrary(2, a.precision);
end Cosh;
-----------------------------------------------------------------------
-- Compute the hyperbolic tangent of a
-----------------------------------------------------------------------
function Tanh(a : Arbitrary_Type) return Arbitrary_Type is
one : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
exp2x : Arbitrary_Type(a.precision);
begin
-- tanh(x) = (e^(2x) - 1) / (e^(2x) + 1)
exp2x := Exp(a * To_Arbitrary(2, a.precision));
return (exp2x - one) / (exp2x + one);
end Tanh;
-----------------------------------------------------------------------
-- Compute the hyperbolic cosecant of a
-----------------------------------------------------------------------
function Csch(a : Arbitrary_Type) return Arbitrary_Type is
begin
-- csch(x) = 2 / (e^x - e^-x)
return To_Arbitrary(2, a.precision) / (Exp(a) - Exp(-a));
end Csch;
-----------------------------------------------------------------------
-- Compute the hyperbolic secant a
-----------------------------------------------------------------------
function Sech(a : Arbitrary_Type) return Arbitrary_Type is
begin
-- sech(x) = 2 / (e^x + e^-x)
return To_Arbitrary(2, a.precision) / (Exp(a) + Exp(-a));
end Sech;
-----------------------------------------------------------------------
-- Compute the hyperbolic cotangent of a
-----------------------------------------------------------------------
function Coth(a : Arbitrary_Type) return Arbitrary_Type is
one : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
exp2x : Arbitrary_Type(a.precision);
begin
-- coth(x) = (e^(2x) + 1) / (e^(2x) - 1)
exp2x := Exp(a * To_Arbitrary(2, a.precision));
return (exp2x + one) / (exp2x - one);
end Coth;
-----------------------------------------------------------------------
-- Compute the inverse hyperbolic sine of a
-----------------------------------------------------------------------
function ArcSinh(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
last : Arbitrary_Type(a.precision);
term : Arbitrary_Type(a.precision);
count : Arbitrary_Type(a.precision);
one : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
sign : integer range -1 .. 1;
begin
-- asinh(x) = ln(x + sqrt(1 + x^2))
-- asinh(x) = x - (1/6)x^3 + (3/40)x^5 - (5/112)x^7 + ...
term := a;
count := one;
sign := 1;
loop
last := result;
if sign > 0 then
result := result + term;
else
result := result - term;
end if;
exit when last = result;
term := term * count * count;
count := count + one;
term := term / count;
count := count + one;
term := term / count;
term := term * (a * a);
sign := -sign;
end loop;
return result;
end ArcSinh;
-----------------------------------------------------------------------
-- Compute the inverse hyperbolic cosine
-----------------------------------------------------------------------
function ArcCosh(a : Arbitrary_Type) return Arbitrary_Type is
begin
-- acosh(x) = ln(x +/- sqrt(x^2 - 1))
return Ln(a + Square_Root(a * a - To_Arbitrary(1, a.precision)));
end ArcCosh;
-----------------------------------------------------------------------
-- Compute the inverse hyperbolic tangent of a
-----------------------------------------------------------------------
function ArcTanh(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
last : Arbitrary_Type(a.precision);
term : Arbitrary_Type(a.precision);
count : Arbitrary_Type(a.precision);
one : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
begin
-- atanh(x) = x + x^3/3 + x^5/5 + x^7/7 + x^9/9 + ...
term := a;
count := one;
loop
last := result;
result := result + term / count;
exit when last = result;
count := count + one;
term := term * a;
end loop;
return result;
end ArcTanh;
-----------------------------------------------------------------------
-- Compute the inverse hyperbolic cosecant of a
-----------------------------------------------------------------------
function ArcCsch(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
last : Arbitrary_Type(a.precision);
term : Arbitrary_Type(a.precision);
count : Arbitrary_Type(a.precision);
one : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
sign : integer range -1 .. 1;
begin
-- acsch(x) = x^-1 - (1/6)x^-3 + (3/40)x^-5 - (5/112)x^-7 + ...
term := one / a;
count := one;
sign := 1;
loop
last := result;
if sign > 0 then
result := result + term;
else
result := result - term;
end if;
exit when last = result;
term := term * count * count;
count := count + one;
term := term / count;
count := count + one;
term := term / count;
term := term / (a * a);
sign := -sign;
end loop;
return result;
end ArcCsch;
-----------------------------------------------------------------------
-- Compute the inverse hyperbolic secant of a
-----------------------------------------------------------------------
function ArcSech(a : Arbitrary_Type) return Arbitrary_Type is
one : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
begin
-- asech(x) = ln((1 +/- sqrt(1 - x^2)) / x)
return Ln((one + Square_Root(one - a * a)) / a);
end ArcSech;
-----------------------------------------------------------------------
-- Compute the inverse hyperbolic cotangent of a
-----------------------------------------------------------------------
function ArcCoth(a : Arbitrary_Type) return Arbitrary_Type is
result : Arbitrary_Type(a.precision);
last : Arbitrary_Type(a.precision);
term : Arbitrary_Type(a.precision);
count : Arbitrary_Type(a.precision);
one : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(1, a.precision);
two : constant Arbitrary_Type(a.precision) :=
To_Arbitrary(2, a.precision);
begin
-- acoth(x) = x^-1 + (1/3)x^-3 + (1/5)x^-5 + ...
term := one / a;
count := one;
loop
last := result;
result := result + term / count;
exit when last = result;
count := count + two;
term := term / (a * a);
end loop;
return result;
end ArcCoth;
end Arbitrary.Trig;
|
applescript/Console.applescript | zhaorui/minions | 1 | 2131 | <reponame>zhaorui/minions
activate application "Console"
tell application "System Events"
keystroke "~"
delay 0.1
key code 124 -- which is right arrow
delay 0.1
key code 4 using shift down
end tell |
tools-src/gnu/gcc/gcc/ada/exp_ch8.adb | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 30911 | <reponame>enfoTek/tomato.linksys.e2000.nvram-mod<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ C H 8 --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Einfo; use Einfo;
with Exp_Dbug; use Exp_Dbug;
with Exp_Util; use Exp_Util;
with Nlists; use Nlists;
with Sem; use Sem;
with Sem_Ch8; use Sem_Ch8;
with Sinfo; use Sinfo;
with Stand; use Stand;
package body Exp_Ch8 is
---------------------------------------------
-- Expand_N_Exception_Renaming_Declaration --
---------------------------------------------
procedure Expand_N_Exception_Renaming_Declaration (N : Node_Id) is
Decl : constant Node_Id := Debug_Renaming_Declaration (N);
begin
if Present (Decl) then
Insert_Action (N, Decl);
end if;
end Expand_N_Exception_Renaming_Declaration;
------------------------------------------
-- Expand_N_Object_Renaming_Declaration --
------------------------------------------
-- Most object renaming cases can be done by just capturing the address
-- of the renamed object. The cases in which this is not true are when
-- this address is not computable, since it involves extraction of a
-- packed array element, or of a record component to which a component
-- clause applies (that can specify an arbitrary bit boundary), or where
-- the enclosing record itself has a non-standard representation.
-- In these two cases, we pre-evaluate the renaming expression, by
-- extracting and freezing the values of any subscripts, and then we
-- set the flag Is_Renaming_Of_Object which means that any reference
-- to the object will be handled by macro substitution in the front
-- end, and the back end will know to ignore the renaming declaration.
-- An additional odd case that requires processing by expansion is
-- the renaming of a discriminant of a mutable record type. The object
-- is a constant because it renames something that cannot be assigned to,
-- but in fact the underlying value can change and must be reevaluated
-- at each reference. Gigi does have a notion of a "constant view" of
-- an object, and therefore the front-end must perform the expansion.
-- For simplicity, and to bypass some obscure code-generation problem,
-- we use macro substitution for all renamed discriminants, whether the
-- enclosing type is constrained or not.
-- The other special processing required is for the case of renaming
-- of an object of a class wide type, where it is necessary to build
-- the appropriate subtype for the renamed object.
-- More comments needed for this para ???
procedure Expand_N_Object_Renaming_Declaration (N : Node_Id) is
Nam : Node_Id := Name (N);
T : Entity_Id;
Decl : Node_Id;
procedure Evaluate_Name (Fname : Node_Id);
-- A recursive procedure used to freeze a name in the sense described
-- above, i.e. any variable references or function calls are removed.
-- Of course the outer level variable reference must not be removed.
-- For example in A(J,F(K)), A is left as is, but J and F(K) are
-- evaluated and removed.
function Evaluation_Required (Nam : Node_Id) return Boolean;
-- Determines whether it is necessary to do static name evaluation
-- for renaming of Nam. It is considered necessary if evaluating the
-- name involves indexing a packed array, or extracting a component
-- of a record to which a component clause applies. Note that we are
-- only interested in these operations if they occur as part of the
-- name itself, subscripts are just values that are computed as part
-- of the evaluation, so their form is unimportant.
-------------------
-- Evaluate_Name --
-------------------
procedure Evaluate_Name (Fname : Node_Id) is
K : constant Node_Kind := Nkind (Fname);
E : Node_Id;
begin
-- For an explicit dereference, we simply force the evaluation
-- of the name expression. The dereference provides a value that
-- is the address for the renamed object, and it is precisely
-- this value that we want to preserve.
if K = N_Explicit_Dereference then
Force_Evaluation (Prefix (Fname));
-- For a selected component, we simply evaluate the prefix
elsif K = N_Selected_Component then
Evaluate_Name (Prefix (Fname));
-- For an indexed component, or an attribute reference, we evaluate
-- the prefix, which is itself a name, recursively, and then force
-- the evaluation of all the subscripts (or attribute expressions).
elsif K = N_Indexed_Component
or else K = N_Attribute_Reference
then
Evaluate_Name (Prefix (Fname));
E := First (Expressions (Fname));
while Present (E) loop
Force_Evaluation (E);
if Original_Node (E) /= E then
Set_Do_Range_Check (E, Do_Range_Check (Original_Node (E)));
end if;
Next (E);
end loop;
-- For a slice, we evaluate the prefix, as for the indexed component
-- case and then, if there is a range present, either directly or
-- as the constraint of a discrete subtype indication, we evaluate
-- the two bounds of this range.
elsif K = N_Slice then
Evaluate_Name (Prefix (Fname));
declare
DR : constant Node_Id := Discrete_Range (Fname);
Constr : Node_Id;
Rexpr : Node_Id;
begin
if Nkind (DR) = N_Range then
Force_Evaluation (Low_Bound (DR));
Force_Evaluation (High_Bound (DR));
elsif Nkind (DR) = N_Subtype_Indication then
Constr := Constraint (DR);
if Nkind (Constr) = N_Range_Constraint then
Rexpr := Range_Expression (Constr);
Force_Evaluation (Low_Bound (Rexpr));
Force_Evaluation (High_Bound (Rexpr));
end if;
end if;
end;
-- For a type conversion, the expression of the conversion must be
-- the name of an object, and we simply need to evaluate this name.
elsif K = N_Type_Conversion then
Evaluate_Name (Expression (Fname));
-- For a function call, we evaluate the call.
elsif K = N_Function_Call then
Force_Evaluation (Fname);
-- The remaining cases are direct name, operator symbol and
-- character literal. In all these cases, we do nothing, since
-- we want to reevaluate each time the renamed object is used.
else
return;
end if;
end Evaluate_Name;
-------------------------
-- Evaluation_Required --
-------------------------
function Evaluation_Required (Nam : Node_Id) return Boolean is
begin
if Nkind (Nam) = N_Indexed_Component
or else Nkind (Nam) = N_Slice
then
if Is_Packed (Etype (Prefix (Nam))) then
return True;
else
return Evaluation_Required (Prefix (Nam));
end if;
elsif Nkind (Nam) = N_Selected_Component then
declare
Rec_Type : Entity_Id := Etype (Prefix (Nam));
begin
if Present (Component_Clause (Entity (Selector_Name (Nam))))
or else Has_Non_Standard_Rep (Rec_Type)
then
return True;
elsif Ekind (Entity (Selector_Name (Nam))) = E_Discriminant
and then Is_Record_Type (Rec_Type)
and then not Is_Concurrent_Record_Type (Rec_Type)
then
return True;
else
return Evaluation_Required (Prefix (Nam));
end if;
end;
else
return False;
end if;
end Evaluation_Required;
-- Start of processing for Expand_N_Object_Renaming_Declaration
begin
-- Perform name evaluation if required
if Evaluation_Required (Nam) then
Evaluate_Name (Nam);
Set_Is_Renaming_Of_Object (Defining_Identifier (N));
end if;
-- Deal with construction of subtype in class-wide case
T := Etype (Defining_Identifier (N));
if Is_Class_Wide_Type (T) then
Expand_Subtype_From_Expr (N, T, Subtype_Mark (N), Name (N));
Find_Type (Subtype_Mark (N));
Set_Etype (Defining_Identifier (N), Entity (Subtype_Mark (N)));
end if;
-- Create renaming entry for debug information
Decl := Debug_Renaming_Declaration (N);
if Present (Decl) then
Insert_Action (N, Decl);
end if;
end Expand_N_Object_Renaming_Declaration;
-------------------------------------------
-- Expand_N_Package_Renaming_Declaration --
-------------------------------------------
procedure Expand_N_Package_Renaming_Declaration (N : Node_Id) is
Decl : constant Node_Id := Debug_Renaming_Declaration (N);
begin
if Present (Decl) then
-- If we are in a compilation unit, then this is an outer
-- level declaration, and must have a scope of Standard
if Nkind (Parent (N)) = N_Compilation_Unit then
declare
Aux : constant Node_Id := Aux_Decls_Node (Parent (N));
begin
New_Scope (Standard_Standard);
if No (Actions (Aux)) then
Set_Actions (Aux, New_List (Decl));
else
Append (Decl, Actions (Aux));
end if;
Analyze (Decl);
Pop_Scope;
end;
-- Otherwise, just insert after the package declaration
else
Insert_Action (N, Decl);
end if;
end if;
end Expand_N_Package_Renaming_Declaration;
end Exp_Ch8;
|
programs/oeis/106/A106469.asm | neoneye/loda | 22 | 173070 | <filename>programs/oeis/106/A106469.asm
; A106469: Expansion of (1+x^2)(1+2x)/(1-x^2).
; 1,2,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4
mov $1,$0
gcd $0,2
min $1,3
div $1,$0
mov $0,$1
add $0,1
|
tests/tk-image-photo-test_data-tests.ads | thindil/tashy2 | 2 | 26712 | -- 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 Tk.Image.Photo.Test_Data.Tests is
type Test is new GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo
.Test_Data
.Test with
null record;
procedure Test_Blank_2c1442_30601f(Gnattest_T: in out Test);
-- tk-image-photo.ads:273:4:Blank:Tests_Blank_Photo
procedure Test_Get_Option_e3d52c_8f9fe9(Gnattest_T: in out Test);
-- tk-image-photo.ads:328:4:Get_Option:Tests_Get_Option_Photo
procedure Test_Copy_0a35cf_21de2d(Gnattest_T: in out Test);
-- tk-image-photo.ads:408:4:Copy:Tests_Copy_Photo
procedure Test_Get_Data_433b25_8ba84f(Gnattest_T: in out Test);
-- tk-image-photo.ads:448:4:Get_Data:Tests_Get_Data_Photo
procedure Test_Get_Color_6fd571_5f6b3a(Gnattest_T: in out Test);
-- tk-image-photo.ads:478:4:Get_Color:Tests_Get_Color_Photo
procedure Test_Put_Data_cd9739_ee5695(Gnattest_T: in out Test);
-- tk-image-photo.ads:506:4:Put_Data:Tests_Put_Data_Photo
procedure Test_Read_95a1fe_24b510(Gnattest_T: in out Test);
-- tk-image-photo.ads:545:4:Read:Tests_Read_Photo
procedure Test_Redither_68a59f_4f3041(Gnattest_T: in out Test);
-- tk-image-photo.ads:572:4:Redither:Tests_Redither_Photo
procedure Test_Get_Transparency_6cdf5e_ffe137(Gnattest_T: in out Test);
-- tk-image-photo.ads:604:4:Get_Transparency:Tests_Get_Transparency_Photo
procedure Test_Set_Transparency_76d5d1_e76ade(Gnattest_T: in out Test);
-- tk-image-photo.ads:636:4:Set_Transparency:Tests_Set_Transparency_Photo
procedure Test_Write_a9d740_96f97b(Gnattest_T: in out Test);
-- tk-image-photo.ads:671:4:Write:Tests_Write_Photo
end Tk.Image.Photo.Test_Data.Tests;
-- end read only
|
demos/win64/DEMO2/demo2.asm | gbmaster/nasmx | 18 | 170214 | ;// DEMO2.ASM
;//
;// Copyright (C)2005-2014 The NASMX Project
;//
;// This is a fully UNICODE aware, typedefined demo that demonstrates
;// using NASMX typedef system to make your code truly portable between
;// 32 and 64-bit systems using either ASCII or UNICODE
;//
;// Contributors:
;// <NAME>
;// <NAME>
;//
%include "..\..\windemos.inc"
DEFAULT REL
entry demo2
[section .bss]
fname: resb 1025
lname: resb 1025
[section .data]
szFirstName: declare(NASMX_TCHAR) NASMX_TEXT("First Name: "), 0
szLastName: declare(NASMX_TCHAR) NASMX_TEXT("Last Name: "), 0
szAge: declare(NASMX_TCHAR) NASMX_TEXT("Age: "), 0
szHello: declare(NASMX_TCHAR) 13,10,NASMX_TEXT("Hello, %s %s! What are you having today?"), 13,10,0
szSorry: declare(NASMX_TCHAR) 13,10,NASMX_TEXT("Sorry kid, you're only %d!"), 13,10,0
szFreeDrink: declare(NASMX_TCHAR) 13,10,NASMX_TEXT("Good lord, %s %s! At your age please accept a free drink on the house!"), 13,10,0
szScanStr: declare(NASMX_TCHAR) NASMX_TEXT("%1024s"), 0
szScanNum: declare(NASMX_TCHAR) NASMX_TEXT("%d"), 0
[section .text]
NASMX_PRAGMA CALLSTACK, 64
proc demo2
locals
local age, qword
endlocals
invoke printf, szFirstName
invoke scanf, szScanStr, fname
invoke printf, szLastName
invoke scanf, szScanStr, lname
invoke printf, szAge
invoke scanf, szScanNum, var(.age)
mov rax, qword [var(.age)]
if rax, >=, 90
invoke printf, szFreeDrink, fname, lname
elsif rax, >=, 21
invoke printf, szHello, fname, lname
else
invoke printf, szSorry, qword [var(.age)]
endif
xor rax, rax
endproc
|
src/Bee2/Crypto/Defs.agda | semenov-vladyslav/bee2-agda | 0 | 16954 | module Bee2.Crypto.Defs where
open import Data.ByteString
open import Data.ByteVec
open import Agda.Builtin.Nat renaming (Nat to ℕ)
{-# FOREIGN GHC import qualified Bee2.Defs #-}
postulate
SizeT : Set
SizeFromℕ : ℕ → SizeT
{-# COMPILE GHC SizeT = type (Bee2.Defs.Size) #-}
{-# COMPILE GHC SizeFromℕ =
( Prelude.fromIntegral ) #-}
Hash = ByteVec {Strict} 32
data SecurityLevel : Set where
l128 l192 l256 : SecurityLevel
|
programs/oeis/160/A160410.asm | karttu/loda | 1 | 80271 | ; A160410: Number of "ON" cells at n-th stage in simple 2-dimensional cellular automaton (see Comments for precise definition).
; 0,4,16,28,64,76,112,148,256,268,304,340,448,484,592,700,1024,1036,1072,1108,1216,1252,1360,1468,1792,1828,1936,2044,2368,2476,2800,3124,4096,4108,4144,4180,4288,4324,4432,4540,4864,4900,5008,5116,5440,5548,5872,6196
sub $0,1
cal $0,130665 ; a(n) = Sum_{k=0..n} 3^wt(k), where wt() = A000120().
mov $1,$0
mul $1,4
|
src/g4/ONEI.g4 | djimenez81/onei | 1 | 4321 | /**
* Copyright (c) 2017 Universidad de Costa Rica
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSIDAD DE COSTA RICA 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.
*/
// Principal Investigator:
// <NAME> <<EMAIL>>
// Assistants:
// <NAME>
grammar ONEI;
/* ********************
* ********************
* ** **
* ** PARSER RULES **
* ** **
* ********************
* ********************
*/
file : definitionOneiFile | scriptOneiFile ;
scriptOneiFile : ( oneiStatement ( ';' | NL ) | NL )* EOF ;
definitionOneiFile : oneiImport*
oneiSetup?
( oneiEnvironment
| oneiFunction
| oneiPatch
| oneiAgent
| oneiRule
| oneiMessage // Message sent from something to s else.
| oneiExchange // Exchage table of messages
| oneiItem
| oneiTable // Keeps track of what is where
)*
EOF
;
oneiImport : FROM ID IMPORT importList NL
| IMPORT importList NL
;
oneiFunction : FUNCTION ID ':' NL
oneiInput?
oneiOutput?
oneiVariables?
( oneiStatement NL )*
END NL
;
oneiSetup : SETUP ':' NL ( oneiStatement NL )* END NL;
oneiEnvironment : ( ENVIRONMENT ID EXTENDS ID ':' NL
| ENVIRONMENT ID ':' NL
)
oneiAttributes?
( oneiFunction )*
END NL
;
oneiPatch : ( PATCH ID EXTENDS ID ':' NL
| PATCH ID ':' NL
)
oneiAttributes?
( oneiFunction )*
END NL
;
oneiAgent : ( AGENT ID EXTENDS ID ':' NL
| AGENT ID ':' NL
)
oneiAttributes?
( oneiFunction )*
END NL
;
oneiRule : ( RULE ID EXTENDS ID ':' NL
| RULE ID ':' NL
)
oneiAttributes?
( oneiFunction )*
END NL
;
oneiMessage : ( MESSAGE ID EXTENDS ID ':' NL
| MESSAGE ID ':' NL
)
oneiAttributes?
( oneiFunction )*
END NL
;
oneiExchange : ( EXCHANGE ID EXTENDS ID ':' NL
| EXCHANGE ID ':' NL
)
oneiAttributes?
( oneiFunction )*
END NL
;
oneiItem : ( ITEM ID EXTENDS ID ':' NL
| ITEM ID ':' NL
)
oneiAttributes?
( oneiFunction )*
END NL
;
oneiTable: ( TABLE ID EXTENDS ':' NL
| TABLE ID ':' NL
)
oneiAttributes?
( oneiFunction )*
END NL
;
importList : ID ',' importList
| ID ';'
;
oneiInput : INPUT NL argumentList END NL
| INPUT NL argumentList oneiOutput
| INPUT NL argumentList oneiVariables
;
oneiOutput : OUTPUT NL argumentList END NL
| OUTPUT NL argumentList oneiVariables
;
oneiVariables : OUTPUT NL argumentList END NL ;
oneiAttribute : ATTRIBUTES NL argumentList END NL ;
argumentList : argument ';' NL argumentList
| argument ';' NL
;
argument : structureType? dataType ( ID ',' )* ID NL
| structureType? dataType ID '<-' expression NL // check carefully
;
oneiStatement : ( assignment
| expression
| commandForm // Not sure what it is
| forCommand
| ifCommand
| whileCommand
) // should we include a switch case statement?
';'
NL
;
assignment : ID '=' expression
ifCommand : IF expression ':' NL oneiStatement+
( ELSEIF expression ':' NL oneiStatement+ )* NL?
( ELSE ':' NL oneiStatement+ )? NL?
END NL
;
whileCommand : WHILE expression ':' NL oneiStatement+ END NL ;
forCommand : FOR ID IN expression ':' NL oneiStatement+ END NL ;
expression : reference
| '+' expression
| '-' expression
| NOT expression
| expression '+' expression
| expression '-' expression
| expression '*' expression
| expression '/' expression
| expression '^' expression
| expression '<' expression
| expression '>' expression
| expression '==' expression
| expression '<=' expression
| expression '>=' expression
| expression '!=' expression
| expression AND expression
| expression OR expression
| expression XOR expression
;
reference : ID
| INTVAL
| FLOATVAL
| TRUE
| FALSE
| ID '(' ')' // Call to method without input
| ID '(' (expression ',')* expression ')'
| '(' expression ')'
| ID ('.'
(
( ID '(' (expression ',')* expression ')'
| ID '(' ')'
)
)
)+
;
// Should we include void?
dataType : BOOL
| INT
| FLOAT
| CHAR // Can we pull a python and have only strings?
| IO // maybe a type for displaying
;
// Think whether to include Container, Stack, Queue, Double-ended queue,
// Tree, Graph.
structureType : LIST
| ARRAY
| STRING
;
/* *******************
* *******************
* ** **
* ** LEXER RULES **
* ** **
* *******************
* *******************
*/
/* *********************
* * LANGUAGE KEYWORDS *
* *********************
*/
AGENT : 'agent' ;
AND : 'and' ;
ARRAY : 'array' ;
ATTRIBUTES : 'attibutes' ;
BOOL : 'boolean' ;
CHAR : 'character' ;
DICT : 'dictonary' ;
ELSE : 'else' ;
END : 'end' ;
ENVIRONMENT : 'environment' ;
EXCHANGE : 'exchage' ;
EXTENDS : 'extends' ;
FALSE : 'false' ;
FLOAT : 'float' ;
FOR : 'for' ;
FUNCTION : 'function' ;
IF : 'if' ;
IMPORT : 'import' ;
IN : 'in' ;
INPUT : 'input' ;
INT : 'integer' ;
IO : 'io' ;
ITEM : 'item' ;
LIST : 'list' ;
MESSAGE : 'message' ;
NOT : 'not' ;
OR : 'or' ;
OUTPUT : 'output' ;
PASS : 'pass' ;
PATCH : 'patch' ;
RULE : 'rule' ;
SELF : 'self' ;
STRING : 'string' ;
TABLE : 'table' ;
TRUE : 'true' ;
VARIABLES : 'variables' ;
WHILE : 'while' ;
XOR : 'xor' ;
/* *****************************
* * OPERATORS AND ASSIGNMENTS *
* *****************************
*/
CONTASSIG : '<-' ; // Conditional assignment
ASSIGNING : '=' ;
EQUAL : '==' ;
NOTEQUAL : '!=' ;
LST : '<' ;
GRT : '>' ;
LSTEQ : '<=' ;
GRTEQ : '>=' ;
PLUS : '+' ;
MINUS : '-' ;
TIMES : '*' ;
DIVISION : '/' ;
EXPONENTIAL : '^' ;
/* ****************************
* * DELIMITERS AND EXTENDERS *
* ****************************
*/
SEMICOLON : ';' ;
COLON : ':' ;
DOT : '.' ;
COMMA : ',' ;
LEFTPAREN : '(' ;
RIGHTPAREN : ')' ;
LEFTBRACKET : '[' ;
RIGHTBRACKET : ']' ;
LEFTBRACE : '{' ;
RIGHTBRACE : '}' ;
AT : '@' ; // Might want it as a referencer
/* **************************
* * COMMENTS AND CONTIUERS *
* **************************
*/
COMMENT : '#' ; // Should we make a block comment sequence?
CONTINUER : '...' ; // This is for when a command does not end in the line.
/* *********************************************
* * IDENTIFIERS, STRINGS, NUMBERS, WHITESPACE *
* *********************************************
*/
NL : '\n' -> channel(HIDDEN);
ID : [a-zA-Z] [a-zA-Z0-9_]*;
DIGIT : [0-9] ;
EXPONENT : ('e'|'E') ('+'|'-')? DIGIT+ ;
STRING : '\'' ( ~('\\'|'\'') )* '\'' ;
INTVAL : DIGIT+ ;
FLOATVAL : DIGIT+ '.' DIGIT* EXPONENT?
| DIGIT+ EXPONENT
| '.' DIGIT+ EXPONENT?
;
|
boot/stage1/stage1.asm | arushsharma24/KSOS | 87 | 10599 | ;This is our bootloader assembly code
Stage2Sector equ 0x7e0
TempKernelSector equ 0x3000
RootLoad equ 0x1000
FATLoad equ 0x6000
[org 0x7c00]
[bits 16]
jmp near boot_stage_1
;---------------------------------------------------------------------------------------
;times (0x3d-0x02) db 0
bpbOEM db "DummyBPB"
bpbBytesPerSector: DW 512
bpbSectorsPerCluster: DB 1
bpbReservedSectors: DW 1
bpbNumberOfFATs: DB 2
bpbRootEntries: DW 512
bpbTotalSectors: DW 2880
bpbMedia: DB 0xf0
bpbSectorsPerFAT: DW 6 ;We need all this
bpbSectorsPerTrack: DW 63
bpbHeadsPerCylinder: DW 16
bpbHiddenSectors: DD 0
bpbTotalSectorsBig: DD 0
bsDriveNumber: DB 0
bsUnused: DB 0
bsExtBootSignature: DB 0x29
bsSerialNumber: DD 0xa0a1a2a3
bsVolumeLabel: DB "DUMMY DISK "
bsFileSystem: DB "FAT12 "
;---------------------------------------------------------------------------------------
boot_stage_1:
cli
xor bx,bx
mov ss,bx
mov ds,bx
mov bp,0x9000
mov sp,bp
sti
mov [BootDiskNumber],dl
;---------------------------------------------------------------------------------------
;Initialize ROOT_SECT_NO and DATA_SECT_NO
;---------------------------------------------------------------------------------------
xor ax,ax
mov al,[bpbNumberOfFATs]
mul byte[bpbSectorsPerFAT] ;we ignore dx what?? potential bug?
add ax,[bpbReservedSectors]
mov [ROOT_SECT_NO],ax
mov bx,[bpbRootEntries]
shr bx,4
add ax,bx
mov [DATA_SECT_NO],ax
;---------------------------------------------------------------------------------------
call init_CHS ;Initializes the disk geometry
;---------------------------------------------------------------------------------------
;---------------------------------------------------------------------------------------
;Loads the Root directory and FAT tables into memory
;---------------------------------------------------------------------------------------
LoadRoot:
mov ax,[ROOT_SECT_NO]
call LBA_to_CHS
mov bx,[bpbRootEntries]
shr bx,4 ;9-5 Number of sectors
mov al,bl
xor bx,bx
mov es,bx
mov bx,RootLoad ;Reading to 0x1000
call disk_read_16
LoadFAT:
mov ax,[bpbReservedSectors]
call LBA_to_CHS
mov al,[bpbSectorsPerFAT]
mov bx,FATLoad ;Reading to 0x6000
call disk_read_16
;---------------------------------------------------------------------------------------
;Finds the file with given target name
;---------------------------------------------------------------------------------------
mov bx,Stage2Name
mov word[ReadWhere],Stage2Sector
call Findfile
xor bx,bx
mov es,bx
mov bx,KernelName
mov word[ReadWhere],TempKernelSector
call Findfile
;---------------------------------------------------------------------------------------
END_OF_STAGE:
mov ah,0x00 ;This is a cool thing... It waits for user input before going into 32 bit mode
int 0x16
push word[bpbReservedSectors] ;FAT start
push word[ROOT_SECT_NO] ;Root Start
push word[DATA_SECT_NO] ;Data start
jmp (Stage2Sector << 4)
;---------------------------------------------------------------------------------------
;Functions
%include "boot/stage1/disk_read.asm"
%include "boot/stage1/print.asm"
%include "boot/stage1/CHS.asm"
Findfile: ;Returns cluster number in bx
mov si,.TargetMessage
call print_si_16
mov si,bx
call print_si_16
cld ;Clears the direction flag
mov di,RootLoad
mov cx,[bpbRootEntries] ; Loop whatever number of times
.Loop:
push cx
mov cx,11
push di
mov si,bx
rep cmpsb
pop di
pop cx
je .Found
add di,0x20
loop .Loop
.NotFound
mov si, .Error
call print_si_16
jmp $
.Error: db 0xa,0xd,'Not found!',0
.Message: db 0xa,0xd,'Success!',0x0a,0x0d,0
.TargetMessage: db 0xa,0xd,'Target:',0
.Found:
mov si,.Message
call print_si_16
add di,26
mov dx,word[di]
ReadFile:
;Read sector bx, get next sector, loop
xor cx,cx
mov bx,[ReadWhere]
mov es,bx
xor bx,bx
.loop:
mov ax,dx ;ax current, dx next
cmp ax,0xfff
je .end
sub ax,2
add ax,[DATA_SECT_NO]
push dx
push cx
call LBA_to_CHS
mov al,1 ;Read on sector at a time
call disk_read_16
pop cx
pop dx
call GetNextSector
add bx,512 ;Next sector memory location
inc cx
jmp .loop
.end:
ret
GetNextSector: ;dx is parameter
push bx
mov bx,dx ;move the fat cluster value in bx
shl bx,1
add bx,dx ;bx = dx*3
shr bx,1 ;bx = dx*3/2
jc .odd
.even:
add bx,FATLoad
mov dx,[bx]
and dx,0x0fff
pop bx
ret
.odd:
add bx,FATLoad
mov dx,[bx]
shr dx,4 ; 0040 -> 0004
pop bx
ret
;These are all hard disk addresses
ROOT_SECT_NO: dw 0
DATA_SECT_NO: dw 0 ; Corresponds to FAT table entry 2 (0,1,2..)
ReadWhere: dw 0
KernelName: db 'KERNEL BIN',0
Stage2Name: db 'STAGE2 BIN',0
times 510 - ($-$$) db 0
dw 0xaa55
;---------------------------------------------------------------------------------------
;---------------------------------------------------------------------------------------
;Bootsector over
|
projects/VM/08/ProgramFlow/FibonacciSeries/FibonacciSeries.asm | NanJerry/Nand2Tetris | 0 | 241698 | @ARG
D = M
@1
A = D + A
D = M
@SP
M = M + 1
A = M - 1
M = D
@SP
M = M - 1
A = M
D = M
@THAT
M = D
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
@1
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@ARG
D = M
@0
A = D + A
D = M
@SP
M = M + 1
A = M - 1
M = D
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
@SP
M = M - 1
A = M
D = M
@SP
A = M - 1
M = M - D
@0
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(MAIN_LOOP_START)
@ARG
D = M
@0
A = D + A
D = M
@SP
M = M + 1
A = M - 1
M = D
@SP
M=M-1
A=M
D=M
@COMPUTE_ELEMENT
D;JGT
@END_PROGRAM
0;JMP
(COMPUTE_ELEMENT)
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
@1
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
@SP
M = M - 1
A = M
D = M
@SP
A = M - 1
M = M + D
@2
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
@SP
M = M - 1
A = M
D = M
@SP
A = M - 1
M = M + D
@SP
M = M - 1
A = M
D = M
@THAT
M = D
@ARG
D = M
@0
A = D + A
D = M
@SP
M = M + 1
A = M - 1
M = D
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
@SP
M = M - 1
A = M
D = M
@SP
A = M - 1
M = M - D
@0
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@MAIN_LOOP_START
0;JMP
(END_PROGRAM)
|
programs/oeis/186/A186303.asm | neoneye/loda | 22 | 176196 | ; A186303: ( A007522(n)+1 )/2.
; 4,12,16,24,36,40,52,64,76,84,96,100,112,120,132,136,156,180,184,192,216,220,232,240,244,252,300,304,316,324,360,364,372,376,412,420,432,444,456,460,484,492,496,516,520,532,544
mov $2,$0
add $2,1
pow $2,2
lpb $2
add $1,6
sub $2,1
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,2
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
div $1,2
mov $0,$1
|
src/adacar-motores.ads | Asier98/AdaCar | 0 | 7484 | <filename>src/adacar-motores.ads<gh_stars>0
package AdaCar.Motores is
procedure Actua_Step(Motor: Tipo_Motor; Valor: Tipo_Step);
procedure Actua_Direccion(Motor: Tipo_Motor; Valor: Tipo_Direccion);
end AdaCar.Motores;
|
Data/Fin/Indexed/Literals.agda | oisdk/agda-playground | 6 | 3660 | {-# OPTIONS --without-K --safe #-}
module Data.Fin.Indexed.Literals where
-- import Data.Nat as ℕ
-- import Data.Nat.Properties as ℕ
open import Data.Fin.Indexed.Base
open import Literals.Number
-- open import Relation.Nullary
open import Agda.Builtin.Nat renaming (_<_ to _<ᵇ_)
open import Data.Bool
open import Agda.Builtin.Nat using (_<_)
instance
numberFin : ∀ {n} → Number (Fin n)
numberFin {n} = record
{ Constraint = λ m → T (m <ᵇ n)
; fromNat = λ m {{pr}} → FinFromℕ {n} m pr
}
|
030-semigroup.agda | mcmtroffaes/agda-proofs | 2 | 15745 | module 030-semigroup where
-- We need equivalence.
open import 020-equivalence
-- Semigroups are basically a set with equality and some binary
-- operator which is associative and respects equality.
record SemiGroup
{M : Set}
(_==_ : M -> M -> Set)
(_*_ : M -> M -> M)
: Set1 where
field
equiv : Equivalence _==_
assoc : ∀ {r s t} -> ((r * s) * t) == (r * (s * t))
cong : ∀ {r s u v} -> (r == s) -> (u == v) -> (r * u) == (s * v)
-- The next line brings all fields and declarations of Equivalence
-- into this record's namespace so we can refer to them in an
-- unqualified way in proofs (for example, we can write "refl" for
-- "Equivalence.symm equiv" and so on).
open Equivalence equiv public
-- No theorems here yet.
|
test/common_utils_test.adb | psyomn/ash | 11 | 23863 | -- Copyright 2019 <NAME> (psyomn)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with AUnit.Assertions; use AUnit.Assertions;
with Common_Utils; use Common_Utils;
with Ada.Strings.Maps;
with Ada.Strings.Fixed;
package body Common_Utils_Test is
procedure Test_Integer_To_Trimmed_String (T : in out Test) is
pragma Unreferenced (T);
Actual : constant String := Integer_To_Trimmed_String (123);
Expected : constant String := "123";
Result : constant Boolean := Actual = Expected;
begin
Assert (Result, "expected: " & Expected & " actual: " & Actual);
end Test_Integer_To_Trimmed_String;
procedure Test_Header_String (T : in out Test) is
pragma Unreferenced (T);
Field : constant String := "Server";
Value : constant String := "ash";
Actual : constant String := Header_String (Field, Value);
Expected : constant String := "Server: ash";
Result : constant Boolean := Actual = Expected;
begin
Assert (Result, "expected: " & Expected & ", actual: " & Actual);
end Test_Header_String;
procedure Test_Header_String_Integer (T : in out Test) is
pragma Unreferenced (T);
Field : constant String := "Processor";
Value : constant Integer := 6502;
Actual : constant String := Header_String (Field, Value);
Expected : constant String := "Processor: 6502";
Result : constant Boolean := Actual = Expected;
begin
Assert (Result, "expected header: " & Expected & ", actual: " & Actual);
end Test_Header_String_Integer;
procedure Test_Empty_String (T : in out Test) is
pragma Unreferenced (T);
S : String := "notempty";
Count : Integer := 0;
begin
for I in Positive range S'First .. S'Last loop
if S (I) = Character'Val (0) then
Count := Count + 1;
end if;
end loop;
Assert (Count = 0, "should not have null chars");
Empty_String (S);
for I in Positive range S'First .. S'Last loop
if S (I) = Character'Val (0) then
Count := Count + 1;
end if;
end loop;
Assert (Count = S'Length, "should be all null chars");
end Test_Empty_String;
procedure Test_Empty_String_Range (T : in out Test) is
pragma Unreferenced (T);
use Ada.Strings.Maps;
use Ada.Strings.Fixed;
type Test_Case is record
Data : String (1 .. 9);
First : Positive;
Last : Positive;
end record;
type Tca is array (Positive range <>) of Test_Case;
Null_Map : constant Character_Mapping :=
To_Mapping (From => " ", To => "" & Character'Val (0));
Tc1 : constant Test_Case := (Translate ("hello ", Null_Map), 5, 5);
Tc2 : constant Test_Case := (Translate (" hello", Null_Map), 1, 5);
Tc3 : constant Test_Case := (Translate (" hello ", Null_Map), 1, 3);
Tcs : constant Tca := (Tc1, Tc2, Tc3);
F, L : Positive := 1;
begin
for I in Positive range Tcs'First .. Tcs'Last loop
Empty_String_Range
(S => Tcs (I).Data, First => F, Last => L);
Assert (Tcs (I).First = F and Tcs (I).Last = L,
"expected first,last:" &
Tcs (I).First'Image & "," & Tcs (I).Last'Image & " " &
"got first,last:" & F'Image & "," & F'Image & " " &
"with data: ." & Tcs (I).Data & ".");
end loop;
end Test_Empty_String_Range;
procedure Test_Concat_Null_String (T : in out Test) is
pragma Unreferenced (T);
Buff1, Buff2 : String (1 .. 1024) := (others => Character'Val (0));
Expected : constant String := "hellolle";
begin
Buff1 (1 .. 4) := "hell";
Buff2 (1 .. 4) := "olle";
declare
Actual : constant String :=
Concat_Null_Strings (Buff1, Buff2);
begin
Assert
(Actual = Expected,
"actual: " & Actual & " expected: " & Expected);
end;
end Test_Concat_Null_String;
end Common_Utils_Test;
|
third_party/antlr_grammars_v4/promql/PromQLLexer.g4 | mikhan808/rsyntaxtextarea-antlr4-extension | 2 | 1457 | <filename>third_party/antlr_grammars_v4/promql/PromQLLexer.g4
/*
[The "BSD licence"]
Copyright (c) 2013 <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
lexer grammar PromQLLexer;
NUMBER: [0-9]+ ('.' [0-9]+)?;
STRING
: '\'' (~('\'' | '\\') | '\\' .)* '\''
| '"' (~('"' | '\\') | '\\' .)* '"'
;
// Binary operators
ADD: '+';
SUB: '-';
MULT: '*';
DIV: '/';
MOD: '%';
POW: '^';
AND: 'and';
OR: 'or';
UNLESS: 'unless';
// Comparison operators
EQ: '=';
DEQ: '==';
NE: '!=';
GT: '>';
LT: '<';
GE: '>=';
LE: '<=';
RE: '=~';
NRE: '!~';
// Aggregation modifiers
BY: 'by';
WITHOUT: 'without';
// Join modifiers
ON: 'on';
IGNORING: 'ignoring';
GROUP_LEFT: 'group_left';
GROUP_RIGHT: 'group_right';
OFFSET: 'offset';
BOOL: 'bool';
AGGREGATION_OPERATOR
: 'sum'
| 'min'
| 'max'
| 'avg'
| 'group'
| 'stddev'
| 'stdvar'
| 'count'
| 'count_values'
| 'bottomk'
| 'topk'
| 'quantile'
;
FUNCTION
: 'abs'
| 'absent'
| 'absent_over_time'
| 'ceil'
| 'changes'
| 'clamp_max'
| 'clamp_min'
| 'day_of_month'
| 'day_of_week'
| 'days_in_month'
| 'delta'
| 'deriv'
| 'exp'
| 'floor'
| 'histogram_quantile'
| 'holt_winters'
| 'hour'
| 'idelta'
| 'increase'
| 'irate'
| 'label_join'
| 'label_replace'
| 'ln'
| 'log2'
| 'log10'
| 'minute'
| 'month'
| 'predict_linear'
| 'rate'
| 'resets'
| 'round'
| 'scalar'
| 'sort'
| 'sort_desc'
| 'sqrt'
| 'time'
| 'timestamp'
| 'vector'
| 'year'
| 'avg_over_time'
| 'min_over_time'
| 'max_over_time'
| 'sum_over_time'
| 'count_over_time'
| 'quantile_over_time'
| 'stddev_over_time'
| 'stdvar_over_time'
;
LEFT_BRACE: '{';
RIGHT_BRACE: '}';
LEFT_PAREN: '(';
RIGHT_PAREN: ')';
LEFT_BRACKET: '[';
RIGHT_BRACKET: ']';
COMMA: ',';
TIME_RANGE
: LEFT_BRACKET DURATION RIGHT_BRACKET
| LEFT_BRACKET DURATION ':' DURATION? RIGHT_BRACKET ;
DURATION: [0-9]+ ('s' | 'm' | 'h' | 'd' | 'w' | 'y');
METRIC_NAME: [a-zA-Z_:] [a-zA-Z0-9_:]*;
LABEL_NAME: [a-zA-Z_] [a-zA-Z0-9_]*;
WS: [\r\t\n ]+ -> skip; |
issues/universal-quantified-functions-option/NonFOLAgdaInternalTermsVarNonEmptyArgumentsTerm.agda | asr/apia | 10 | 5352 | <filename>issues/universal-quantified-functions-option/NonFOLAgdaInternalTermsVarNonEmptyArgumentsTerm.agda
------------------------------------------------------------------------------
-- Testing Agda internal term: @Var Nat Args@ when @Args ≠ []@
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --universal-quantified-functions #-}
{-# OPTIONS --without-K #-}
module NonFOLAgdaInternalTermsVarNonEmptyArgumentsTerm where
postulate
D : Set
_≡_ : D → D → Set
-- TODO: 2012-04-29. Are we using Koen's approach in the translation?
postulate f-refl : (f : D → D) → ∀ x → f x ≡ f x
{-# ATP prove f-refl #-}
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt57.adb | best08618/asylo | 7 | 23542 | <reponame>best08618/asylo
package body Opt57 is
type Phase_Enum is (None_Phase, FE_Init_Phase, FE_Phase);
type Message_State is (No_Messages, Some_Messages);
type Module_List_Array is array (Phase_Enum, Message_State) of List;
type Private_Module_Factory is limited record
Module_Lists : Module_List_Array;
end record;
type Element_Array is array (Positive range <>) of Module_Factory_Ptr;
type Hash_Table is array (Positive range <>) of aliased Module_Factory_Ptr;
type Heap_Data_Rec (Table_Last : Positive) is limited record
Number_Of_Elements : Positive;
Table : Hash_Table (1 .. Table_Last);
end record;
type Heap_Data_Ptr is access Heap_Data_Rec;
type Table is limited record
Data : Heap_Data_Ptr;
end record;
function All_Elements (M : Table) return Element_Array is
Result : Element_Array (1 .. Natural (M.Data.Number_Of_Elements));
Last : Natural := 0;
begin
for H in M.Data.Table'Range loop
Last := Last + 1;
Result (Last) := M.Data.Table(H);
end loop;
return Result;
end;
The_Factories : Table;
subtype Language_Array is Element_Array;
type Language_Array_Ptr is access Language_Array;
All_Languages : Language_Array_Ptr := null;
procedure Init is
begin
if All_Languages = null then
All_Languages := new Language_Array'(All_Elements (The_Factories));
end if;
end;
function Is_Empty (L : List) return Boolean is
begin
return Link_Constant (L.Next) = L'Unchecked_Access;
end;
function First (L : List) return Linkable_Ptr is
begin
return Links_Type (L.Next.all).Container.all'Access;
end;
procedure Update is
Check_New_Dependences : Boolean := False;
begin
loop
for Lang_Index in All_Languages'Range loop
for Has_Messages in Message_State loop
declare
L : List renames
All_Languages (Lang_Index).Priv.Module_Lists
(FE_Init_Phase, Has_Messages);
begin
while not Is_Empty (L) loop
declare
Module_In_Init_State : constant Module_Ptr :=
Module_Ptr (First (L));
Pin_Dependence : Pinned (Module_In_Init_State);
begin
Check_New_Dependences := True;
end;
end loop;
end;
end loop;
end loop;
exit when not Check_New_Dependences;
end loop;
end;
end Opt57;
|
base/mvdm/softpc.new/bios/msinit.asm | npocmaka/Windows-Server-2003 | 17 | 88339 | <gh_stars>10-100
page ,160
title msinit for BIOS
;
;----------------------------------------------------------------------------
;
; Modification history
;
; 26-Feb-1991 sudeepb Ported for NT DOSEm
;----------------------------------------------------------------------------
;
EXTENDEDKEY equ 1 ; use extended keyboard functions
include version.inc ; set build flags
include biosseg.inc ; establish bios segment structure
include msequ.inc
include dossym.inc
include dosmac.inc
include biostruc.inc
include dossvc.inc
include vint.inc
; the following segment follows sysinit. It is used to define
; the location to load MSDOS.SYS into.
dos_load_seg segment para public 'dos_load_seg'
dos_load_seg ends
extrn RomVectors:dword
extrn NUMROMVECTORS:abs
extrn res_dev_list:word
extrn keyrd_func:byte ; for mscon. defined in msdata.
extrn keysts_func:byte ; for mscon. defined in msdata.
extrn endBIOSData:byte
extrn dosdatasg:word
extrn Int15:far ; M036
extrn int19:far
extrn intret:near
extrn cbreak:near
extrn outchr:near
extrn outchr:near
sysinitseg segment
assume cs:sysinitseg
extrn current_dos_location:word
extrn device_list:dword
extrn memory_size:word
extrn sysinit:far
sysinitseg ends
Bios_Data_Init segment
assume cs:datagrp
;*********************************************************
; system initialization
;
; the entry conditions are established by the bootstrap
; loader and are considered unknown. the following jobs
; will be performed by this module:
;
; 1. all device initialization is performed
;
; 2. a local stack is set up and ds:si are set
; to point to an initialization table. then
; an inter-segment call is made to the first
; byte of the dos
;
; 3. once the dos returns from this call the ds
; register has been set up to point to the start
; of free memory. the initialization will then
; load the command program into this area
; beginning at 100 hex and transfer control to
; this program.
;
;********************************************************
;===========================================================================
;
; entry from boot sector. the register contents are:
;
; dl = int 13 drive number we booted from
; ch = media byte
; bx = first data sector on disk.
; ax = first data sector (high)
; di = sectors/fat for the boot media.
;
public init
init proc near
assume ds:nothing,es:nothing
FCLI
xor ax,ax
mov ds,ax
; Save a pack of interrupt vectors...
push cs
pop es ; cannot use cs override for stos
mov cx, NUMROMVECTORS ; no. of rom vectors to be saved
mov si, offset RomVectors ; point to list of int vectors
next_int:
lods byte ptr cs:[si] ; get int number
cbw ; assume < 128
shl ax, 1
shl ax, 1 ; int no * 4
mov di, ax
xchg si, di
lodsw
stosw
lodsw
stosw ; save the vector
xchg si, di
loop next_int
; set up int 15 for new action ; M036
mov word ptr ds:[15h*4],offset Int15 ; M036
mov ds:[15h*4+2],cs ; M036
; set up int 19 for new action
mov word ptr ds:[19h*4],offset int19
mov ds:[19h*4+2],cs
;
xor dx,dx
mov ss,dx
mov sp,700h ;local stack
FSTI
assume ss:nothing
; NTVDM we do not intialize the com,prn ports here
; to stay seamless with the host OS
; 15-Sep-1992 Jonle
;
; mov al,3 ; init com4
; call aux_init
; mov al,2 ; init com3
; call aux_init
; mov al,1 ; init com2
; call aux_init
; xor al,al ; init com1
; call aux_init
;
; mov al,2 ; init lpt3
; call print_init
; mov al,1 ; init lpt2
; call print_init
; xor al,al ; init lpt1
; call print_init
xor dx,dx
mov ds,dx ; to initialize print screen vector
mov es,dx
xor ax,ax
mov di,initspot
stosw ; init four bytes to 0
stosw
mov ax,cs ; fetch segment
mov ds:word ptr brkadr,offset cbreak ;break entry point
mov ds:brkadr+2,ax ;vector for break
mov ds:word ptr chrout*4,offset outchr
mov ds:word ptr chrout*4+2,ax
mov di,4
mov bx,offset intret ;will initialize rest of interrupts
xchg ax,bx
stosw ;location 4
xchg ax,bx
stosw ;int 1 ;location 6
add di,4
xchg ax,bx
stosw ;location 12
xchg ax,bx
stosw ;int 3 ;location 14
xchg ax,bx
stosw ;location 16
xchg ax,bx
stosw ;int 4 ;location 18
mov ds:word ptr 500h,dx ;set print screen & break =0
mov ds:word ptr lstdrv,dx ;clean out last drive spec
mov dx,sysinitseg
mov ds,dx
assume ds:sysinitseg
; set pointer to resident device driver chain
mov word ptr device_list,offset res_dev_list
mov word ptr device_list+2,cs
mov current_dos_location,dos_load_seg ; will load MSDOS here
ifdef EXTENDEDKEY
; we will check if the system has ibm extended keyboard by
; looking at a byte at 40:96. if bit 4 is set, then extended key board
; is installed, and we are going to set keyrd_func to 10h, keysts_func to 11h
; for the extended keyboard function. use cx as the temporary register.
xor cx,cx
mov ds,cx
assume ds:nothing
mov cl,ds:0496h ; get keyboard flag
test cl,00010000b
jz org_key ; orginal keyboard
mov byte ptr keyrd_func,10h ; extended keyboard
mov byte ptr keysts_func,11h ; change for ext. keyboard functions
org_key:
endif
push cs
pop ds
push cs
pop es
assume ds:datagrp, es:datagrp
mov di, offset endBIOSData ; BIOS data segment end address
shr di,1
shr di,1
shr di,1
shr di,1 ; Converted to segmnet
inc di ; para align
add di,datagrp ; Add segment of BIOS data
mov [dosdatasg],di ; di = to be dos data segment
mov di,dos_load_seg
SVC SVC_DEMLOADDOS ; di is segment to load DOS
; If it fails it never comes back
jmp sysinit
init endp
;--------------------------------------------------------------------
; al = device number
print_init proc near
assume ds:nothing,es:nothing
cbw
mov dx,ax ; get printer port number into dx
mov ah,1 ;initalize printer port
int 17h ;call rom-bios routine
ret
print_init endp
;--------------------------------------------------------------------
aux_init proc near
assume ds:nothing,es:nothing
cbw
mov dx,ax
mov al,rsinit ;2400,n,1,8 (msequ.inc)
mov ah,0 ;initalize aux port
int 14h ;call rom-bios routine
ret
aux_init endp
Bios_Data_Init ends
end
|
bootsector/04-stack/boot.asm | wpmed92/os-adventures | 1 | 160410 | <filename>bootsector/04-stack/boot.asm
;stack operations
;bp -> base stack pointer, sp -> top stack pointer
;stack grows downward, towards lower addresses
[org 0x7c00]
mov ah, 0x0e; tty mode
mov bp, 0x8000 ; set stack pointer far away from boot sector
mov sp, bp; top and base stack pointer point to same
push 'o'
push 'l'
push 'l'
push 'e'
push 'H'
;0x8000
;0x7FFF empty
;0x7FFE 'o'
;0x7FFD empty
;0x7FFC 'l'
;0x7FFB empty
;0x7FFA 'l'
;0x7FF9 empty
;0x7FF8 'e'
;0x7FF7 empty
;0x7FF6 'H'
;we can only pop word (16bit)
pop bx
mov al, bl ;move lower 8bit of bx to al
int 0x10 ;should print 'H'
pop bx
mov al, bl
int 0x10
pop bx
mov al, bl
int 0x10
pop bx
mov al, bl
int 0x10
pop bx
mov al, bl
int 0x10
;After the whole stack is popped it should print 'Hello'
times 510 - ($ - $$) db 0; zero padding to 512 byte boot sector expected size
dw 0xaa55; magic word tells BIOS it's a bootable sector
|
source/amf/utp/amf-utp-set_timezone_actions-collections.ads | svn2github/matreshka | 24 | 3577 | <filename>source/amf/utp/amf-utp-set_timezone_actions-collections.ads
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.Utp.Set_Timezone_Actions.Collections is
pragma Preelaborate;
package Utp_Set_Timezone_Action_Collections is
new AMF.Generic_Collections
(Utp_Set_Timezone_Action,
Utp_Set_Timezone_Action_Access);
type Set_Of_Utp_Set_Timezone_Action is
new Utp_Set_Timezone_Action_Collections.Set with null record;
Empty_Set_Of_Utp_Set_Timezone_Action : constant Set_Of_Utp_Set_Timezone_Action;
type Ordered_Set_Of_Utp_Set_Timezone_Action is
new Utp_Set_Timezone_Action_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_Utp_Set_Timezone_Action : constant Ordered_Set_Of_Utp_Set_Timezone_Action;
type Bag_Of_Utp_Set_Timezone_Action is
new Utp_Set_Timezone_Action_Collections.Bag with null record;
Empty_Bag_Of_Utp_Set_Timezone_Action : constant Bag_Of_Utp_Set_Timezone_Action;
type Sequence_Of_Utp_Set_Timezone_Action is
new Utp_Set_Timezone_Action_Collections.Sequence with null record;
Empty_Sequence_Of_Utp_Set_Timezone_Action : constant Sequence_Of_Utp_Set_Timezone_Action;
private
Empty_Set_Of_Utp_Set_Timezone_Action : constant Set_Of_Utp_Set_Timezone_Action
:= (Utp_Set_Timezone_Action_Collections.Set with null record);
Empty_Ordered_Set_Of_Utp_Set_Timezone_Action : constant Ordered_Set_Of_Utp_Set_Timezone_Action
:= (Utp_Set_Timezone_Action_Collections.Ordered_Set with null record);
Empty_Bag_Of_Utp_Set_Timezone_Action : constant Bag_Of_Utp_Set_Timezone_Action
:= (Utp_Set_Timezone_Action_Collections.Bag with null record);
Empty_Sequence_Of_Utp_Set_Timezone_Action : constant Sequence_Of_Utp_Set_Timezone_Action
:= (Utp_Set_Timezone_Action_Collections.Sequence with null record);
end AMF.Utp.Set_Timezone_Actions.Collections;
|
src/sys/encoders/util-encoders-base16.ads | RREE/ada-util | 60 | 11292 | <reponame>RREE/ada-util<gh_stars>10-100
-----------------------------------------------------------------------
-- util-encoders-base16 -- Encode/Decode a stream in hexadecimal
-- Copyright (C) 2009, 2010, 2011, 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Streams;
-- The <b>Util.Encodes.Base16</b> packages encodes and decodes streams
-- in hexadecimal.
package Util.Encoders.Base16 is
pragma Preelaborate;
-- ------------------------------
-- Base16 encoder
-- ------------------------------
-- This <b>Encoder</b> translates the (binary) input stream into
-- an ascii hexadecimal stream. The encoding alphabet is: 0123456789ABCDEF.
type Encoder is new Util.Encoders.Transformer with private;
-- Encodes the binary input stream represented by <b>Data</b> into
-- the a base16 (hexadecimal) output stream <b>Into</b>.
--
-- If the transformer does not have enough room to write the result,
-- it must return in <b>Encoded</b> the index of the last encoded
-- position in the <b>Data</b> stream.
--
-- The transformer returns in <b>Last</b> the last valid position
-- in the output stream <b>Into</b>.
--
-- The <b>Encoding_Error</b> exception is raised if the input
-- stream cannot be transformed.
overriding
procedure Transform (E : in out Encoder;
Data : in Ada.Streams.Stream_Element_Array;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Encoded : out Ada.Streams.Stream_Element_Offset);
-- ------------------------------
-- Base16 decoder
-- ------------------------------
-- The <b>Decoder</b> decodes an hexadecimal stream into a binary stream.
type Decoder is new Util.Encoders.Transformer with private;
-- Decodes the base16 input stream represented by <b>Data</b> into
-- the binary output stream <b>Into</b>.
--
-- If the transformer does not have enough room to write the result,
-- it must return in <b>Encoded</b> the index of the last encoded
-- position in the <b>Data</b> stream.
--
-- The transformer returns in <b>Last</b> the last valid position
-- in the output stream <b>Into</b>.
--
-- The <b>Encoding_Error</b> exception is raised if the input
-- stream cannot be transformed.
overriding
procedure Transform (E : in out Decoder;
Data : in Ada.Streams.Stream_Element_Array;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Encoded : out Ada.Streams.Stream_Element_Offset);
private
type Encoder is new Util.Encoders.Transformer with null record;
type Decoder is new Util.Encoders.Transformer with null record;
generic
type Input_Char is (<>);
type Output_Char is (<>);
type Index is range <>;
type Output_Index is range <>;
type Input is array (Index range <>) of Input_Char;
type Output is array (Output_Index range <>) of Output_Char;
package Encoding is
procedure Encode (From : in Input;
Into : in out Output;
Last : out Output_Index;
Encoded : out Index);
procedure Decode (From : in Input;
Into : in out Output;
Last : out Output_Index;
Encoded : out Index);
end Encoding;
end Util.Encoders.Base16;
|
release/src/router/gmp/source/mpn/x86/k7/mod_34lsub1.asm | zhoutao0712/rtn11pb1 | 184 | 91005 | <gh_stars>100-1000
dnl AMD K7 mpn_mod_34lsub1 -- remainder modulo 2^24-1.
dnl Copyright 2000, 2001, 2002, 2004, 2005, 2008 Free Software Foundation,
dnl Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public License as
dnl published by the Free Software Foundation; either version 3 of the
dnl License, or (at your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C Athlon: 1
C Hammer: 1
C mp_limb_t mpn_mod_34lsub1 (mp_srcptr src, mp_size_t size)
C
C The loop form below and the 64 byte code alignment seem necessary for the
C claimed speed. This is a bit strange, since normally k7 isn't very
C sensitive to such things. Perhaps there has to be 6 instructions in the
C first 16 bytes for the BTB entry or something.
defframe(PARAM_SIZE, 8)
defframe(PARAM_SRC, 4)
dnl re-use parameter space
define(SAVE_EDI, `PARAM_SIZE')
TEXT
ALIGN(64)
PROLOGUE(mpn_mod_34lsub1)
deflit(`FRAME',0)
movl PARAM_SIZE, %ecx
movl PARAM_SRC, %edx
subl $2, %ecx
ja L(three_or_more)
movl (%edx), %eax
jb L(one)
movl 4(%edx), %ecx
movl %eax, %edx
shrl $24, %eax C src[0] low
andl $0xFFFFFF, %edx C src[0] high
addl %edx, %eax
movl %ecx, %edx
andl $0xFFFF, %ecx
shrl $16, %edx C src[1] high
addl %edx, %eax
shll $8, %ecx C src[1] low
addl %ecx, %eax
L(one):
ret
L(three_or_more):
C eax
C ebx
C ecx size-2
C edx src
C esi
C edi
pushl %ebx FRAME_pushl()
xorl %eax, %eax
xorl %ebx, %ebx
movl %edi, SAVE_EDI
pushl %esi FRAME_pushl()
xorl %esi, %esi C and clear carry flag
C code offset 0x40 at this point
L(top):
C eax acc 0mod3
C ebx acc 1mod3
C ecx counter, limbs
C edx src
C esi acc 2mod3
C edi
leal 24(%edx), %edx
leal -2(%ecx), %ecx
adcl -24(%edx), %eax
adcl -20(%edx), %ebx
adcl -16(%edx), %esi
decl %ecx
jng L(done_loop)
leal -2(%ecx), %ecx
adcl -12(%edx), %eax
adcl -8(%edx), %ebx
adcl -4(%edx), %esi
decl %ecx
jg L(top)
leal 12(%edx), %edx
L(done_loop):
C ecx is -2, -1 or 0 representing 0, 1 or 2 more limbs, respectively
incl %ecx
movl $0xFFFFFFFF, %edi
js L(combine)
adcl -12(%edx), %eax
decl %ecx
movl $0xFFFFFF00, %edi
js L(combine)
adcl -8(%edx), %ebx
movl $0xFFFF0000, %edi
L(combine):
C eax acc 0mod3
C ebx acc 1mod3
C ecx
C edx
C esi acc 2mod3
C edi mask
sbbl %ecx, %ecx C carry
movl %eax, %edx C 0mod3
shrl $24, %eax C 0mod3 high
andl %edi, %ecx C carry masked
andl $0x00FFFFFF, %edx C 0mod3 low
movl %ebx, %edi C 1mod3
subl %ecx, %eax C apply carry
shrl $16, %ebx C 1mod3 high
andl $0xFFFF, %edi
addl %edx, %eax C apply 0mod3 low
movl %esi, %edx C 2mod3
shll $8, %edi C 1mod3 low
addl %ebx, %eax C apply 1mod3 high
shrl $8, %esi C 2mod3 high
movzbl %dl, %edx C 2mod3 low
addl %edi, %eax C apply 1mod3 low
shll $16, %edx C 2mod3 low
addl %esi, %eax C apply 2mod3 high
popl %esi FRAME_popl()
movl SAVE_EDI, %edi
addl %edx, %eax C apply 2mod3 low
popl %ebx FRAME_popl()
ret
EPILOGUE()
|
electives/pw/lab/lista-3/ada/logger.adb | jerry-sky/academic-notebook | 4 | 30729 | <reponame>jerry-sky/academic-notebook
package body Logger is
task body LoggerReceiver is
exitTask: Boolean := False;
begin
loop
select
accept Log(message: String) do
PrintBounded(message);
end Log;
or
accept Stop do
-- allow for pending requests to be fulfilled
loop
select
accept Log(message: String) do
PrintBounded(message);
end Log;
or
delay 1.0;
exit;
end select;
end loop;
exitTask := True;
end Stop;
end select;
if exitTask then
exit;
end if;
end loop;
end LoggerReceiver;
end Logger;
|
programs/oeis/017/A017573.asm | neoneye/loda | 22 | 90228 | <reponame>neoneye/loda
; A017573: (12n+4)^5.
; 1024,1048576,17210368,102400000,380204032,1073741824,2535525376,5277319168,10000000000,17623416832,29316250624,46525874176,71008211968,104857600000,150536645632,210906087424,289254654976,389328928768,515363200000,672109330432,864866612224,1099511627776,1382528109568,1721036800000,2122825311232,2596377985024,3150905752576,3796375994368,4543542400000,5403974828032,6390089165824,7515177189376,8793436423168,10240000000000,11870966520832,13703429914624,15755509298176,18046378835968,20596297600000,23426639429632,26559922791424,30019840638976,33831290272768,38020403200000,42614574994432,47642495156224,53134176971776,59120987373568,65635676800000,72712409055232,80386791169024,88695903256576,97678328378368,107374182400000,117825143852032,129074483789824,141167095653376,154149525127168,168070000000000,182978460024832,198926586778624,215967833522176,234157455059968,253552537600000,274212028613632,296196766695424,319569511422976,344394973216768,370739843200000,398672823058432,428264654900224,459588151115776,492718224237568,527731916800000,564708431199232,603729159553024,644877713560576,688239954362368,733904022400000,781960367276032,832501777613824,885623410917376,941422823431168,1000000000000000,1061457383928832,1125899906842624,1193435018546176,1264172716883968,1338225577600000,1415708784197632,1496740157799424,1581440187006976,1669932057760768,1762341683200000,1858797733522432,1959431665844224,2064377754059776,2173773118701568,2287757756800000,2406474571743232
mul $0,12
add $0,4
pow $0,5
|
maps/RavagedPath.asm | AtmaBuster/pokeplat-gen2-old | 2 | 97205 | object_const_def ; object_event constants
RavagedPath_MapScripts:
db 0 ; scene scripts
db 0 ; callbacks
RavagedPath_RockScript:
jumpstd smashrock
RavagedPath_PotionScript:
itemball POTION
RavagedPath_TMRockTombScript:
tmhmball TM_ROCK_TOMB
RavagedPath_LuckIncenseScript:
itemball LUCK_INCENSE
RavagedPath_TMWaterPulseScript:
tmhmball TM_WATER_PULSE
IF DEF(_DEMO1)
RavagedPath_EndOfDemoScript:
jumptextfaceplayer .Text
.Text:
text "Hey!"
para "This is the end of"
line "the demo version."
para "Thanks a lot for"
line "playing!"
para "Did you try out"
line "the mining game in"
cont "the OREBURGH MINE?"
para "I worked hard on"
line "that, so please"
cont "give it a go. :)"
para "Please share any"
line "bugs and feedback"
cont "with us. We'd love"
cont "to hear from you!"
done
ENDC
RavagedPath_MapEvents:
db 0, 0 ; filler
db 2 ; warp events
warp_event 13, 29, ROUTE_204_S, 1
warp_event 19, 25, ROUTE_204_N, 1
db 0 ; coord events
db 0 ; bg events
IF DEF(_DEMO1)
db 11 ; object events
ELSE
db 10 ; object events
ENDC
object_event 15, 24, SPRITE_ROCK, SPRITEMOVEDATA_SMASHABLE_ROCK, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, RavagedPath_RockScript, -1
object_event 15, 25, SPRITE_ROCK, SPRITEMOVEDATA_SMASHABLE_ROCK, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, RavagedPath_RockScript, -1
object_event 4, 2, SPRITE_ROCK, SPRITEMOVEDATA_SMASHABLE_ROCK, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, RavagedPath_RockScript, -1
object_event 3, 8, SPRITE_ROCK, SPRITEMOVEDATA_SMASHABLE_ROCK, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, RavagedPath_RockScript, -1
object_event 10, 22, SPRITE_ROCK, SPRITEMOVEDATA_SMASHABLE_ROCK, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, RavagedPath_RockScript, -1
object_event 8, 20, SPRITE_ROCK, SPRITEMOVEDATA_SMASHABLE_ROCK, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, RavagedPath_RockScript, -1
object_event 15, 26, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, RavagedPath_PotionScript, EVENT_RAVAGED_PATH_POTION
object_event 4, 21, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_TMHMBALL, 0, RavagedPath_TMRockTombScript, EVENT_RAVAGED_PATH_TM_ROCK_TOMB
object_event 9, 3, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, RavagedPath_LuckIncenseScript, EVENT_RAVAGED_PATH_LUCK_INCENSE
object_event 18, 3, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_TMHMBALL, 0, RavagedPath_TMWaterPulseScript, EVENT_RAVAGED_PATH_TM_WATER_PULSE
IF DEF(_DEMO1)
object_event 19, 25, SPRITE_SUPER_NERD, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, RavagedPath_EndOfDemoScript, -1
ENDC
|
intellij/src/reo/lang/antlr4/Reo.g4 | jakobehmsen/midmod | 0 | 6310 | grammar Reo;
block: statementOrExpression*;
statementOrExpression: statement | expression;
statement: variableDeclaration;
variableDeclaration: 'var' ID '=' expression;
expression: assignment | addExpression;
addExpression: lhs=mulExpression (('+'|'-') addExpressionOp)*;
addExpressionOp: mulExpression;
mulExpression: lhs=chainedExpression (('*'|'/') mulExpressionOp)*;
mulExpressionOp: chainedExpression;
chainedExpression: atomExpression (expressionTail);
expressionTail: expressionTailPart* expressionTailEnd?;
expressionTailPart: ('.' message) | slotAccess;
message: ID '(' (expression (',' expression)*)? ')';
expressionTailEnd: '.' slotAssignment;
slotAssignment: fieldSlotAssignment | methodSlotAssignment;
fieldSlotAssignment: selector '=' expression;
methodSlotAssignment: (selectorName selectorParameters) '=>' (singleExpressionBody=expression | '{' blockBody=block '}');
slotAccess: '.' access;
atomExpression: selfSend | access | string | number | embeddedExpression | self | objectLiteral;
selfSend: message;
access: ID | qualifiedSelector;
string: STRING;
number: NUMBER;
embeddedExpression: '(' expression ')';
self: 'this';
objectLiteral: '#' '{' slotAssignment* '}';
assignment: slotAssignment;
selector: unqualifiedSelector | qualifiedSelector;
unqualifiedSelector: ID selectorParameters?;
qualifiedSelector: SELECTOR selectorParameters?;
selectorParameters: '(' (ID (',' ID)*)? ')';
selectorName: ID | SELECTOR;
fragment DIGIT: [0-9];
fragment LETTER: [A-Z]|[a-z];
SELECTOR : '\'' ~['\\]* '\'';
ID: (LETTER | '_') (LETTER | '_' | DIGIT)*;
STRING : '"' (ESC | ~["\\])* '"' ;
fragment ESC : '\\' (["\\/bfnrt] | UNICODE) ;
fragment UNICODE : 'u' HEX HEX HEX HEX ;
fragment HEX : [0-9a-fA-F] ;
NUMBER
: '-'? INT '.' [0-9]+ EXP? // 1.35, 1.35E-9, 0.3, -4.5
| '-'? INT EXP // 1e10 -3e4
| '-'? INT // -3, 45
;
fragment INT : '0' | [1-9] [0-9]* ; // no leading zeros
fragment EXP : [Ee] [+\-]? INT ; // \- since - means "range" inside [...]
WS : [ \t\n\r]+ -> skip ;
SINGLE_LINE_COMMENT: '//' ~('\r' | '\n')* -> skip;
MULTI_LINE_COMMENT: '/*' .*? '*/' -> skip; |
oeis/142/A142777.asm | neoneye/loda-programs | 11 | 167391 | <reponame>neoneye/loda-programs
; A142777: Primes congruent to 50 mod 59.
; Submitted by <NAME>
; 109,227,463,1171,1289,1879,1997,2351,3413,3767,4003,4357,5419,6481,6599,7307,8369,9431,10139,10729,10847,11083,11437,11909,12263,12853,13679,14033,14387,14741,15331,15803,16747,17573,18517,19697,20051,20287,20641,20759,21467,21821,23473,23827,24181,24889,25243,25951,26423,26777,27367,28429,28547,28901,29137,30553,30671,31379,32323,32441,33149,33503,33739,33857,34211,34919,35509,35863,36217,36571,37397,37633,37987,38459,39521,40111,40583,40819,41999,42589,42943,43651,44123,45893,46601,47309
mov $1,54
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,1
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,59
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
mul $0,2
sub $0,117
|
src/drivers/qspi_u2008/sam-qspi.adb | Fabien-Chouteau/samd51-hal | 1 | 11440 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2020-2021, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with System;
with System.Machine_Code; use System.Machine_Code;
with SAM_SVD.QSPI; use SAM_SVD.QSPI;
package body SAM.QSPI is
QSPI_Region : constant := 16#04000000#;
Empty : UInt8_Array (1 .. 0);
------------
-- Enable --
------------
procedure Enable is
begin
QSPI_Periph.CTRLA.ENABLE := True;
end Enable;
-----------
-- Reset --
-----------
procedure Reset is
begin
QSPI_Periph.CTRLA.SWRST := True;
end Reset;
---------------
-- Configure --
---------------
procedure Configure (Baud : UInt8) is
begin
QSPI_Periph.BAUD.BAUD := Baud;
QSPI_Periph.CTRLB.MODE := MEMORY;
QSPI_Periph.CTRLB.DATALEN := Val_8BITS;
QSPI_Periph.CTRLB.CSMODE := LASTXFER;
end Configure;
---------
-- Run --
---------
procedure Run (Command : UInt8) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := SINGLE_BIT_SPI;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := READ;
Iframe.INSTREN := True;
Run_Instruction (Command, Iframe, 0, Empty);
end Run;
----------
-- Read --
----------
procedure Read (Command : UInt8; Data : out UInt8_Array) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := SINGLE_BIT_SPI;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := READ;
Iframe.DATAEN := True;
Iframe.INSTREN := True;
Run_Instruction (Command, Iframe, 0, Data);
end Read;
-----------
-- Write --
-----------
procedure Write (Command : UInt8; Data : in out UInt8_Array) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := SINGLE_BIT_SPI;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := WRITE;
Iframe.DATAEN := Data'Length /= 0;
Iframe.INSTREN := True;
Run_Instruction (Command, Iframe, 0, Data);
end Write;
-----------
-- Erase --
-----------
procedure Erase (Command : UInt8; Addr : UInt32) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := SINGLE_BIT_SPI;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := WRITE;
Iframe.ADDREN := True;
Iframe.INSTREN := True;
Run_Instruction (Command, Iframe, Addr, Empty);
end Erase;
-----------------
-- Read_Memory --
-----------------
procedure Read_Memory (Addr : UInt32; Data : out UInt8_Array) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := QUAD_OUTPUT;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := READMEMORY;
Iframe.ADDREN := True;
Iframe.DATAEN := True;
Iframe.INSTREN := True;
Iframe.DUMMYLEN := 8;
Run_Instruction (16#6B#, Iframe, Addr, Data);
end Read_Memory;
------------------
-- Write_Memory --
------------------
procedure Write_Memory (Addr : UInt32; Data : in out UInt8_Array) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := QUAD_OUTPUT;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := WRITEMEMORY;
Iframe.ADDREN := True;
Iframe.DATAEN := True;
Iframe.INSTREN := True;
Run_Instruction (16#32#, Iframe, Addr, Data);
end Write_Memory;
---------------------
-- Run_Instruction --
---------------------
procedure Run_Instruction
(Command : UInt8;
Iframe : SAM_SVD.QSPI.QSPI_INSTRFRAME_Register;
Addr : UInt32;
Buffer : in out UInt8_Array)
is
Unused : QSPI_INSTRFRAME_Register;
begin
-- WTF?!?
-- if Command in 16#20# | 16#D8# then
-- QSPI_Periph.INSTRADDR := Addr;
-- end if;
QSPI_Periph.INSTRCTRL.INSTR := Command;
QSPI_Periph.INSTRADDR := Addr;
QSPI_Periph.INSTRFRAME := Iframe;
-- Dummy read of INSTRFRAME needed to synchronize.
-- See Instruction Transmission Flow Diagram, figure 37.9, page 995
-- and Example 4, page 998, section 37.6.8.5.
Unused := QSPI_Periph.INSTRFRAME;
if Buffer'Length /= 0 then
declare
Mem : UInt8_Array (Buffer'First .. Buffer'Last)
with Address => System'To_Address (QSPI_Region + Addr);
begin
case Iframe.TFRTYPE is
when READ | READMEMORY =>
Buffer := Mem;
when WRITE | WRITEMEMORY =>
Mem := Buffer;
end case;
end;
end if;
Asm ("dsb" & ASCII.LF & ASCII.HT &
"isb",
Volatile => True);
QSPI_Periph.CTRLA := (SWRST => False, ENABLE => True, LASTXFER => True,
others => <>);
while not QSPI_Periph.INTFLAG.INSTREND loop
null;
end loop;
QSPI_Periph.INTFLAG.INSTREND := True;
end Run_Instruction;
end SAM.QSPI;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/gen_disp.adb | best08618/asylo | 7 | 4358 | <gh_stars>1-10
-- { dg-do compile }
with Ada.Containers.Ordered_Maps;
with Ada.Tags.Generic_Dispatching_Constructor;
package body gen_disp is
use type Ada.Tags.Tag;
function "<" (L, R : in Ada.Tags.Tag) return Boolean is
begin
return Ada.Tags.External_Tag (L) < Ada.Tags.External_Tag (R);
end "<";
package Char_To_Tag_Map is new Ada.Containers.Ordered_Maps (
Key_Type => Character,
Element_Type => Ada.Tags.Tag,
"<" => "<",
"=" => Ada.Tags. "=");
package Tag_To_Char_Map is new Ada.Containers.Ordered_Maps (
Key_Type => Ada.Tags.Tag,
Element_Type => Character,
"<" => "<",
"=" => "=");
use type Char_To_Tag_Map.Cursor;
use type Tag_To_Char_Map.Cursor;
Char_To_Tag : Char_To_Tag_Map.Map;
Tag_To_Char : Tag_To_Char_Map.Map;
function Get_Object is new
Ada.Tags.Generic_Dispatching_Constructor
(Root_Type, Ada.Streams.Root_Stream_Type'Class, Root_Type'Input);
function Root_Type_Class_Input
(S : not null access Ada.Streams.Root_Stream_Type'Class)
return Root_Type'Class
is
External_Tag : constant Character := Character'Input (S);
C : constant Char_To_Tag_Map.Cursor := Char_To_Tag.Find (External_Tag);
begin
return Get_Object (Char_To_Tag_Map.Element (C), S);
end Root_Type_Class_Input;
end gen_disp;
|
programs/oeis/131/A131352.asm | jmorken/loda | 1 | 175599 | ; A131352: Row sums of triangle A133935.
; 1,2,6,14,32,72,160,352,768,1664,3584,7680,16384,34816,73728,155648,327680,688128,1441792,3014656,6291456,13107200,27262976,56623104,117440512,243269632,503316480,1040187392,2147483648,4429185024
mov $1,2
pow $1,$0
add $0,4
mul $1,$0
div $1,4
|
src/regex.ads | skordal/ada-regex | 2 | 30411 | -- Ada regular expression library
-- (c) <NAME> 2020 <<EMAIL>>
-- Report bugs and issues on <https://github.com/skordal/ada-regex>
package Regex is
pragma Pure;
-- Main package for the regular expression library.
-- Include Regex.Regular_Expressions to get the main library functionality.
end Regex;
|
Import pdfs from folder/Import PDFs from folder.applescript | SupposeNot/BibDeskAppleScripts | 16 | 4139 | <reponame>SupposeNot/BibDeskAppleScripts<filename>Import pdfs from folder/Import PDFs from folder.applescript
(*
MIT License
Copyright (c) 2017 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*)
***************** DESCRIPTION AND USE *****************
* Leverages Hazel (https://www.noodlesoft.com) to import PDFs files from a watched folder into a pre-specified BibDesk file
* Could probably be modified to work with Folder Actions
* Relies on having auto file set up in BibDesk as well as a rule to auto generate a cite key.
tell application "Finder" to set eachFileAlias to theFile as alias
tell application "BibDesk"
open "/path/to/yourbibliography.bib"
set theDoc to get first document
tell theDoc
import with eachFileAlias
-- Now autofile, after checking there is enough information. If there is not, put in easy to find artificial data.
set justImported to last item of (publications of theDoc's last import group) -- Could be done more cleanly
if value of field "author" of justImported is "" then set value of field "author" of justImported to "00FixMe"
if value of field "title" of justImported is "" then set value of field "title" of justImported to "00Fixme"
if value of field "year" of justImported is "" then set value of field "year" of justImported to "9999"
set justImported's cite key to justImported's generated cite key
auto file justImported
end tell
end tell
|
alloy4fun_models/trainstlt/models/6/YwBr5K9e3sqJ8YtLu.als | Kaixi26/org.alloytools.alloy | 0 | 2292 | <filename>alloy4fun_models/trainstlt/models/6/YwBr5K9e3sqJ8YtLu.als
open main
pred idYwBr5K9e3sqJ8YtLu_prop7 {
all t : Train | one t.pos implies (eventually always no t.pos')
}
pred __repair { idYwBr5K9e3sqJ8YtLu_prop7 }
check __repair { idYwBr5K9e3sqJ8YtLu_prop7 <=> prop7o } |
test/Fail/Unknown-names-in-polarity-pragmas.agda | pthariensflame/agda | 3 | 3093 | {-# POLARITY F #-}
{-# POLARITY G #-}
|
courses/fundamentals_of_ada/labs/solar_system/adv_280_low_level_programming/question_4/src/stm32-rng-interrupts.adb | AdaCore/training_material | 15 | 12424 | <reponame>AdaCore/training_material<filename>courses/fundamentals_of_ada/labs/solar_system/adv_280_low_level_programming/question_4/src/stm32-rng-interrupts.adb
with Ada.Interrupts.Names;
package body STM32.RNG.Interrupts is
type Buffer_Content is array (Integer range <>) of UInt32;
type Ring_Buffer is record
Content : Buffer_Content (0 .. 9);
Head : Integer := 0;
Tail : Integer := 0;
end record;
--------------
-- Receiver --
--------------
protected Receiver is
pragma Interrupt_Priority;
entry Get_Random_32 (Value : out UInt32);
private
Last : UInt32 := 0;
Buffer : Ring_Buffer;
Data_Available : Boolean := False;
procedure Interrupt_Handler;
pragma Attach_Handler
(Interrupt_Handler,
Ada.Interrupts.Names.HASH_RNG_Interrupt);
end Receiver;
--------------
-- Receiver --
--------------
protected body Receiver is
-------------------
-- Get_Random_32 --
-------------------
entry Get_Random_32 (Value : out UInt32) when Data_Available is
Next : constant Integer :=
(Buffer.Tail + 1) mod Buffer.Content'Length;
begin
-- Remove an item from our ring buffer.
Value := Buffer.Content (Next);
Buffer.Tail := Next;
-- If the buffer is empty, make sure we block subsequent callers
-- until the buffer has something in it.
if Buffer.Tail = Buffer.Head then
Data_Available := False;
end if;
Enable_RNG;
end Get_Random_32;
-----------------------
-- Interrupt_Handler --
-----------------------
procedure Interrupt_Handler is
Current : UInt32;
begin
if RNG_Seed_Error_Status then
Clear_RNG_Seed_Error_Status;
-- Clear then set the RNGEN bit to reinitialize and restart
-- the RNG.
Reset_RNG;
end if;
if RNG_Clock_Error_Status then
-- TODO: reconfigure the clock and make sure it's okay
-- Clear the bit.
Clear_RNG_Clock_Error_Status;
end if;
if RNG_Data_Ready then
Current := RNG_Data;
if Current /= Last then
-- This number is good.
if (Buffer.Head + 1) mod Buffer.Content'Length = Buffer.Tail
then
-- But our buffer is full. Turn off the RNG.
Disable_RNG;
else
-- Add this new data to our buffer.
Buffer.Head := (Buffer.Head + 1) mod Buffer.Content'Length;
Buffer.Content (Buffer.Head) := Current;
Data_Available := True;
Last := Current;
end if;
end if;
end if;
end Interrupt_Handler;
end Receiver;
--------------------
-- Initialize_RNG --
--------------------
procedure Initialize_RNG is
Discard : UInt32;
begin
Enable_RNG_Clock;
Enable_RNG_Interrupt;
Enable_RNG;
-- Discard the first randomly generated number, according to STM32F4
-- docs.
Receiver.Get_Random_32 (Discard);
end Initialize_RNG;
------------
-- Random --
------------
function Random return UInt32 is
Result : UInt32;
begin
Receiver.Get_Random_32 (Result);
return Result;
end Random;
end STM32.RNG.Interrupts;
|
programs/oeis/010/A010013.asm | neoneye/loda | 22 | 162396 | ; A010013: a(0) = 1, a(n) = 23*n^2 + 2 for n>0.
; 1,25,94,209,370,577,830,1129,1474,1865,2302,2785,3314,3889,4510,5177,5890,6649,7454,8305,9202,10145,11134,12169,13250,14377,15550,16769,18034,19345,20702,22105,23554,25049,26590,28177,29810,31489,33214,34985,36802,38665,40574,42529,44530,46577,48670,50809,52994,55225,57502,59825,62194,64609,67070,69577,72130,74729,77374,80065,82802,85585,88414,91289,94210,97177,100190,103249,106354,109505,112702,115945,119234,122569,125950,129377,132850,136369,139934,143545,147202,150905,154654,158449,162290,166177,170110,174089,178114,182185,186302,190465,194674,198929,203230,207577,211970,216409,220894,225425
pow $1,$0
gcd $1,2
mov $3,$0
mul $3,$0
mov $2,$3
mul $2,23
add $1,$2
mov $0,$1
|
test/Succeed/Issue4408.agda | shlevy/agda | 1,989 | 3844 | module Issue4408 where
comp :
(A : Set)
(B : A → Set)
(C : (x : A) → B x → Set) →
((x : A) (y : B x) → C x y) →
(g : (x : A) → B x) →
((x : A) → C x (g x))
comp _ _ _ f g x = f x (g x)
data Unit : Set where
unit : Unit
P : Unit → Set
P unit = Unit
Q : Unit → Set → Set
Q unit = λ _ → Unit
f : (x : Unit) → P x → P x
f unit x = x
g :
(A : Set) →
((x : Unit) → Q x A → P x) →
((x : Unit) → Q x A → P x)
g A h x = comp _ _ _ (λ _ → f _) (h _)
|
ada/001/euler.adb | seaneshbaugh/rosetta-euler | 36 | 12245 | <gh_stars>10-100
with Ada.Text_IO;
with Ada.Integer_Text_IO;
use Ada.Text_IO;
use Ada.Integer_Text_IO;
procedure euler is
sum : integer := 0;
begin
for i in 1 .. 999 loop
if (i mod 3) = 0 or (i mod 5) = 0 then
sum := (sum + i);
end if;
end loop;
put(Item => sum, Width => 1);
new_line;
end euler;
|
BTTfolder/getdocument.applescript | pection-zz/Allproject | 2 | 2089 | <reponame>pection-zz/Allproject
set str to {}
if ((str is equal to str) and (application "Safari" is running)) then
tell application "Safari"
repeat with t in tabs of windows
tell t
if URL starts with "https://music.youtube.com" then
set artworkURL to do JavaScript "artwork= document.querySelectorAll('img.image.style-scope.ytmusic-player-bar')[0].src;"
-- set artworkURL2 to do JavaScript "artwork= document.querySelectorAll('img.image.style-scope.ytmusic-player-bar')[0].src;"
return artworkURL
do shell script "curl -O " & artworkURL & "~/youtube_cover.png"
set uri to "~/youtube_cover.png"
end if
end tell
end repeat
end tell
end if
|
kv-avm-code_generator.ads | davidkristola/vole | 4 | 17430 | with Ada.Text_IO;
with kv.avm.vole_tree; use kv.avm.vole_tree;
with kv.avm.Tree_Visitors; use kv.avm.Tree_Visitors;
with kv.avm.Code_Buffers;
package kv.avm.Code_Generator is
Non_Boolean_Condition_Error : exception;
type Code_Generator_Class is limited new Visitor_Class with
record
Buffer : kv.avm.Code_Buffers.Buffer_Type;
end record;
not overriding
procedure Init
(Self : in out Code_Generator_Class);
not overriding
procedure Finalize
(Self : in out Code_Generator_Class);
not overriding
procedure Print
(Self : in Code_Generator_Class);
not overriding
procedure Process_Lines
(Self : in Code_Generator_Class;
Processor : access procedure(Line : String));
overriding
procedure Visit_Id
(Self : in out Code_Generator_Class;
Target : in out Id_Node_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Actor_Definition
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Attribute_Definition
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Message_Definition
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Kind_Node
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Argument
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Constructor_Send_Node
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Expression_List
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Expression_Op
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Expression_Var
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Expression_Literal
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Expression_Send
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Expression_Fold
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Statement_List
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Statement_Assign
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Statement_Var_Def
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Statement_Emit
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Statement_Return
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Statement_If
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Statement_Assert
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Statement_Send
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Statement_While
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Program
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
overriding
procedure Visit_Unimp
(Self : in out Code_Generator_Class;
Target : in out Node_Base_Class'CLASS;
Depth : in Natural);
end kv.avm.Code_Generator;
|
oeis/304/A304726.asm | neoneye/loda-programs | 11 | 169827 | ; A304726: a(n) = n^4 + 4*n^2 + 3.
; 3,8,35,120,323,728,1443,2600,4355,6888,10403,15128,21315,29240,39203,51528,66563,84680,106275,131768,161603,196248,236195,281960,334083,393128,459683,534360,617795,710648,813603,927368,1052675,1190280,1340963,1505528,1684803,1879640,2090915,2319528,2566403,2832488,3118755,3426200,3755843,4108728,4485923,4888520,5317635,5774408,6260003,6775608,7322435,7901720,8514723,9162728,9847043,10569000,11329955,12131288,12974403,13860728,14791715,15768840,16793603,17867528,18992163,20169080,21399875
pow $0,2
add $0,2
pow $0,2
sub $0,1
|
day24/tests/day-test.adb | jwarwick/aoc_2020 | 3 | 25513 | <gh_stars>1-10
with AUnit.Assertions; use AUnit.Assertions;
package body Day.Test is
procedure Test_Part1 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
t1 : constant Natural := count_tiles("test1.txt");
begin
Assert(t1 = 10, "Wrong number, expected 10, got" & t1'IMAGE);
end Test_Part1;
procedure Test_Part2 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
t1 : constant Natural := evolve_tiles("test1.txt", 100);
begin
Assert(t1 = 2208, "Wrong number, expected 2208, got" & t1'IMAGE);
end Test_Part2;
function Name (T : Test) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("Test Day package");
end Name;
procedure Register_Tests (T : in out Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Part1'Access, "Test Part 1");
Register_Routine (T, Test_Part2'Access, "Test Part 2");
end Register_Tests;
end Day.Test;
|
tests/comment/6.asm | NullMember/customasm | 414 | 82026 | ; = 0x00
#d8 0 ;**; |
Location Helper Scripts/GetYourLatLong.applescript | rogues-gallery/applescript | 360 | 2510 | <gh_stars>100-1000
--- Find the lat and long of an address using the Location Helper application, and optionally copy the data to the clipboard or search with google
--- really sorry for the crappy variable names...
tell application "Finder"
activate
set locName to text returned of (display dialog "Search for the latitude and logitude of your location by entering the full address of the location below (include zip code and country)" default answer "" with icon note buttons {"OK"} default button {"OK"})
tell application "Location Helper"
set geoAddy to geocode address of locName
set geoAddy to (geocode address of locName) as list
set geoAddy1 to every item of geoAddy
set geoAddy2 to item 1 of item 1 of geoAddy1
set geoAddy3 to every item of geoAddy2
set geoAddy4 to item 3 of geoAddy3
set geoAddy5 to every item of geoAddy4 as list
set LocLatLong to (get item 2 of geoAddy5) as list
end tell
set AppleScript's text item delimiters to space
display dialog "The Lat/Long is " & LocLatLong with icon note buttons {"OK"} default button {"OK"}
set LatLongChoice to button returned of (display dialog "Copy to Clipboard or Search with Google?" with icon note buttons {"Copy to Clipboard", "Search with Google", "Cancel"} default button {"Search with Google"})
if LatLongChoice is "Copy to Clipboard" then
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to space
tell application "Finder" to set the clipboard to LocLatLong as text
set AppleScript's text item delimiters to tid
end if
if LatLongChoice is "Search with Google" then
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to space
open location "http://www.google.com.au/search?q=" & LocLatLong
set AppleScript's text item delimiters to tid
end if
end tell
--- http://www.github.com/unforswearing
|
source/regions/regions-contexts-environments-nodes.ads | reznikmm/declarative-regions | 0 | 16013 | -- SPDX-FileCopyrightText: 2022 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Ada.Containers.Hashed_Maps;
with Ada.Unchecked_Deallocation;
with Regions.Entities;
with Regions.Shared_Hashed_Maps;
private
package Regions.Contexts.Environments.Nodes is
pragma Preelaborate;
type Entity_Node is tagged limited null record;
type Entity_Node_Access is access all Entity_Node'Class;
function Hash (List : Selected_Entity_Name) return Ada.Containers.Hash_Type
is (Ada.Containers.Hash_Type'Mod (List));
procedure Free is new Ada.Unchecked_Deallocation
(Entity_Node'Class, Entity_Node_Access);
package Node_Maps is new Regions.Shared_Hashed_Maps
(Selected_Entity_Name,
Entity_Node_Access,
Ada.Containers.Hash_Type,
Regions.Contexts.Change_Count,
Hash,
"=",
"=",
Free);
package Entity_Maps is new Ada.Containers.Hashed_Maps
(Selected_Entity_Name,
Regions.Entities.Entity_Access,
Hash,
"=",
Regions.Entities."=");
type Environment_Node;
function Empty_Map (Self : access Environment_Node) return Node_Maps.Map;
type Environment_Node (Context : access Regions.Contexts.Context) is
tagged limited
record
Counter : Natural := 1;
Nodes : Node_Maps.Map := Empty_Map (Environment_Node'Unchecked_Access);
Cache : Entity_Maps.Map;
Nested : Selected_Entity_Name_Lists.List;
end record;
function Get_Entity
(Self : in out Environment_Node'Class;
Name : Selected_Entity_Name) return Regions.Entities.Entity_Access;
procedure Reference (Self : in out Environment_Node'Class);
procedure Unreference
(Self : in out Environment_Node'Class;
Last : out Boolean);
type Base_Entity (Env : not null Environment_Node_Access) is
abstract limited new Regions.Entities.Entity with
record
Name : Selected_Entity_Name;
end record;
end Regions.Contexts.Environments.Nodes;
|
test/Succeed/TopLevelImport.agda | cruhland/agda | 1,989 | 9942 |
import Nat
open Nat using (Nat)
module TopLevelImport (n : Nat) where
it : Nat
it = n
|
firmware/coreboot/3rdparty/blobs/cpu/amd/geode_lx/gplvsa_ii/vsm_lib/resource.asm | fabiojna02/OpenCellular | 1 | 173142 | ;
; Copyright (c) 2006-2008 Advanced Micro Devices,Inc. ("AMD").
;
; This library is free software; you can redistribute it and/or modify
; it under the terms of the GNU Lesser General Public License as
; published by the Free Software Foundation; either version 2.1 of the
; License, or (at your option) any later version.
;
; This code is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
; Lesser General Public License for more details.
;
; You should have received a copy of the GNU Lesser General
; Public License along with this library; if not, write to the
; Free Software Foundation, Inc., 59 Temple Place, Suite 330,
; Boston, MA 02111-1307 USA
;
;*******************************************************************************
;* This file implements the resource-related macros:
;* SYS_MBUS_DESCRIPTOR
;* SYS_IO_DESCRIPTOR
;* SYS_ALLOCATE_RESOURCE
;* SYS_SET_DECODE
;*******************************************************************************
include sysmgr.inc
.model tiny,c
.586p
.CODE
externdef sys_system_call:proc
;***********************************************************************
; ULONG sys_mbus_descriptor(USHORT Address, ULONG * Buffer, UCHAR IO_Flag);
;
; Returns the MSR address & contents of the descriptor assigned to a
; virtualized PCI address or an I/O address.
;
;***********************************************************************
sys_mbus_descriptor proc pascal \
Address: WORD, \
Buffer: PTR, \
IO_Flag: WORD
mov bx, [Address]
mov cx, [IO_Flag]
mov ax, SYS_CODE_DESCRIPTOR
call sys_system_call
; Returns:
; ECX = MSR address
; EDX:EAX = original MSR value
mov bx, [Buffer] ; Store MSR value into caller's buffer
mov [bx+0], eax
mov [bx+4], edx
push ecx ; Return MSR address
pop ax
pop dx
ret
sys_mbus_descriptor endp
;***********************************************************************
; ULONG sys_resource(USHORT Resource, ULONG Param1, ULONG Param2);
;
; Records a VSM's use of a non-shareable resource (e.g. GPIO, IRQ, etc.)
; If the resources is a memory or I/O PCI BAR, it returns the assigned
; PCI address.
;
;***********************************************************************
sys_resource proc pascal uses edi si \
Resource: BYTE, \
BAR: WORD, \
BaseRange: DWORD, \
Pci_ID: WORD, \
MBus_ID: WORD
mov bl, [Resource]
mov si, [BAR]
mov ecx, [BaseRange]
mov di, [MBus_ID]
shl edi, 16
mov di, [Pci_ID]
mov ax, SYS_CODE_RESOURCE
call sys_system_call
; If xxxx != 0x0000, then return 0x8000xxxx, where xxxx is return value
xor dx, dx
or ax, ax
jz Exit
or dh, 80h
Exit: ret
sys_resource endp
;***********************************************************************
; ULONG __pascal sys_lookup_device(USHORT DeviceID, USHORT Instance);
; Returns the routing bits for the specified Device ID.
;***********************************************************************
sys_lookup_device proc pascal \
Device_ID: word, \
Instance: word
mov bx, [Device_ID]
mov cx, [Instance]
mov ax, SYS_CODE_LOOKUP
call sys_system_call
ret
sys_lookup_device endp
;***********************************************************************
;void Set_Address_Decode(USHORT Address, USHORT Decode)
;***********************************************************************
sys_address_decode proc pascal \
Address: WORD, \
Decode: WORD
mov bx, [Address]
mov cx, [Decode]
mov ax, SYS_CODE_DECODE
call sys_system_call
ret
sys_address_decode endp
END
|
Hazelnut-sensible.agda | ivoysey/agda-tfp16 | 2 | 10346 | <filename>Hazelnut-sensible.agda
open import Nat
open import Prelude
open import Hazelnut-core
module Hazelnut-sensible where
-- theorem 1: action sensibility
synthmovelem : {Γ : ·ctx} {e e' : ê} {t : τ̇} {δ : direction} →
(e + move δ +>e e') →
(Γ ⊢ e ◆e => t) →
(Γ ⊢ e' ◆e => t)
synthmovelem EMAscFirstChild d2 = d2
synthmovelem EMAscParent1 d2 = d2
synthmovelem EMAscParent2 d2 = d2
synthmovelem EMAscNextSib d2 = d2
synthmovelem EMAscPrevSib d2 = d2
synthmovelem EMLamFirstChild d2 = d2
synthmovelem EMLamParent d2 = d2
synthmovelem EMPlusFirstChild d2 = d2
synthmovelem EMPlusParent1 d2 = d2
synthmovelem EMPlusParent2 d2 = d2
synthmovelem EMPlusNextSib d2 = d2
synthmovelem EMPlusPrevSib d2 = d2
synthmovelem EMApFirstChild d2 = d2
synthmovelem EMApParent1 d2 = d2
synthmovelem EMApParent2 d2 = d2
synthmovelem EMApNextSib d2 = d2
synthmovelem EMApPrevSib d2 = d2
synthmovelem EMFHoleFirstChild d2 = d2
synthmovelem EMFHoleParent d2 = d2
-- movements preserve analytic types up to erasure. this lemma seems
-- silly because all it seems to do in each case is return the second
-- derivation D. the pattern matching here, though, constrains what that
-- derivation may be in each case, and is therefore actually
-- non-trivial. it's just that most of the work is happening in the
-- implicit arguments.
anamovelem : {Γ : ·ctx} {δ : direction} {e e' : ê} {t : τ̇}
(p : e + move δ +>e e') →
(Γ ⊢ e ◆e <= t) →
(Γ ⊢ e' ◆e <= t)
anamovelem EMAscFirstChild d2 = d2
anamovelem EMAscParent1 d2 = d2
anamovelem EMAscParent2 d2 = d2
anamovelem EMAscNextSib d2 = d2
anamovelem EMAscPrevSib d2 = d2
anamovelem EMLamFirstChild d2 = d2
anamovelem EMLamParent d2 = d2
anamovelem EMPlusFirstChild d2 = d2
anamovelem EMPlusParent1 d2 = d2
anamovelem EMPlusParent2 d2 = d2
anamovelem EMPlusNextSib d2 = d2
anamovelem EMPlusPrevSib d2 = d2
anamovelem EMApFirstChild d2 = d2
anamovelem EMApParent1 d2 = d2
anamovelem EMApParent2 d2 = d2
anamovelem EMApNextSib d2 = d2
anamovelem EMApPrevSib d2 = d2
anamovelem EMFHoleFirstChild d2 = d2
anamovelem EMFHoleParent d2 = d2
mutual
-- if an action transforms an zexp in a synthetic posistion to another
-- zexp, they have the same type up erasure of focus.
actsense1 : {Γ : ·ctx} {e e' : ê} {t t' : τ̇} {α : action} →
(Γ ⊢ e => t ~ α ~> e' => t') →
(Γ ⊢ (e ◆e) => t) →
Γ ⊢ (e' ◆e) => t'
actsense1 (SAMove x) D2 = synthmovelem x D2
actsense1 SADel D2 = SEHole
actsense1 SAConAsc D2 = SAsc (ASubsume D2 TCRefl)
actsense1 (SAConVar p) D2 = SVar p
actsense1 (SAConLam p) D2 = SAsc (ALam p (ASubsume SEHole TCRefl))
actsense1 SAConAp1 D2 = SAp D2 (ASubsume SEHole TCHole1)
actsense1 SAConAp2 D2 = SApHole D2 (ASubsume SEHole TCRefl)
actsense1 (SAConAp3 x) D2 = SApHole (SFHole D2) (ASubsume SEHole TCRefl)
actsense1 SAConArg D2 = SApHole SEHole (ASubsume D2 TCHole2)
actsense1 SAConNumlit D2 = SNum
actsense1 (SAConPlus1 TCRefl) D2 = SPlus (ASubsume D2 TCRefl) (ASubsume SEHole TCHole1)
actsense1 (SAConPlus1 TCHole2) D2 = SPlus (ASubsume D2 TCHole1) (ASubsume SEHole TCHole1)
actsense1 (SAConPlus2 x) D2 = SPlus (ASubsume (SFHole D2) TCHole1) (ASubsume SEHole TCHole1)
actsense1 (SAFinish x) D2 = x
actsense1 (SAZipAsc1 x) (SAsc D2) = SAsc (actsense2 x D2)
actsense1 (SAZipAsc2 x x₁) _ = SAsc x₁
actsense1 (SAZipAp1 x D1 x₁) D2 = SAp (actsense1 D1 x) x₁
actsense1 (SAZipAp2 x D1 x₁) D2 = SApHole (actsense1 D1 x) x₁
actsense1 (SAZipAp3 x x₁) (SAp D2 x₃) with synthunicity x D2
... | refl = SAp x (actsense2 x₁ x₃)
actsense1 (SAZipAp3 x x₁) (SApHole D2 x₂) with synthunicity x D2
... | ()
actsense1 (SAZipAp4 x x₁) (SAp D2 x₂) with synthunicity x D2
... | ()
actsense1 (SAZipAp4 x x₁) (SApHole D2 x₂) = SApHole x (actsense2 x₁ x₂)
actsense1 (SAZipPlus1 x) (SPlus x₁ x₂) = SPlus (actsense2 x x₁) x₂
actsense1 (SAZipPlus2 x) (SPlus x₁ x₂) = SPlus x₁ (actsense2 x x₂)
actsense1 (SAZipHole1 x D1 x₁) D2 = SFHole (actsense1 D1 x)
actsense1 (SAZipHole2 x D1) D2 = SEHole
-- if an action transforms an zexp in an analytic posistion to another
-- zexp, they have the same type up erasure of focus.
actsense2 : {Γ : ·ctx} {e e' : ê} {t : τ̇} {α : action} →
(Γ ⊢ e ~ α ~> e' ⇐ t) →
(Γ ⊢ (e ◆e) <= t) →
(Γ ⊢ (e' ◆e) <= t)
actsense2 (AASubsume x act p) D2 = ASubsume (actsense1 act x) p
actsense2 (AAMove x) D2 = anamovelem x D2
actsense2 AADel _ = ASubsume SEHole TCHole1
actsense2 AAConAsc D2 = ASubsume (SAsc D2) TCRefl
actsense2 (AAConVar x₁ p) D2 = ASubsume (SFHole (SVar p)) TCHole1
actsense2 (AAConLam1 p) (ASubsume SEHole TCHole1) = ALam p (ASubsume SEHole TCHole1)
actsense2 (AAConLam2 p n~) (ASubsume SEHole TCRefl) = abort (n~ TCHole2)
actsense2 (AAConLam2 p x₁) (ASubsume SEHole TCHole1) = ASubsume (SFHole (SAsc (ALam p (ASubsume SEHole TCRefl)))) TCHole1
actsense2 (AAConLam2 p n~) (ASubsume SEHole TCHole2) = abort (n~ TCHole2)
actsense2 (AAConNumlit _) _ = ASubsume (SFHole SNum) TCHole1
actsense2 (AAFinish x) _ = x
actsense2 (AAZipLam _ _ ) (ASubsume () _)
actsense2 (AAZipLam x₁ (AASubsume {p = p} x₂ x₃ x₄)) (ALam x₅ D2) = ALam x₅ (actsense2 (AASubsume {p = p} x₂ x₃ x₄) D2)
actsense2 (AAZipLam x₁ (AAMove x₂)) (ALam x₃ D2) = ALam x₃ (anamovelem x₂ D2)
actsense2 (AAZipLam x₁ AADel) (ALam x₂ D2) = ALam x₂ (ASubsume SEHole TCHole1)
actsense2 (AAZipLam x₁ AAConAsc) (ALam x₂ (ASubsume x₃ x₄)) = ALam x₂ (ASubsume (SAsc (ASubsume x₃ x₄)) TCRefl)
actsense2 (AAZipLam x₁ AAConAsc) (ALam x₂ (ALam x₃ D2)) = ALam x₂ (ASubsume (SAsc (ALam x₃ D2)) TCRefl)
actsense2 (AAZipLam x₁ (AAConVar x₃ p)) (ALam x₄ D2) = ALam x₄ (ASubsume (SFHole (SVar p)) TCHole1)
actsense2 (AAZipLam x₁ (AAConLam1 x₃)) (ALam x₄ D2) = ALam x₄ (ALam x₃ (ASubsume SEHole TCHole1))
actsense2 (AAZipLam x₁ (AAConLam2 x₃ x₄)) (ALam x₅ D2) = ALam x₅ (ASubsume (SFHole (SAsc (ALam x₃ (ASubsume SEHole TCRefl))))
TCHole1)
actsense2 (AAZipLam x₁ (AAConNumlit x₂)) (ALam x₃ D2) = ALam x₃ (ASubsume (SFHole SNum) TCHole1)
actsense2 (AAZipLam x₁ (AAFinish x₂)) (ALam x₃ D2) = ALam x₃ x₂
actsense2 (AAZipLam x₁ (AAZipLam x₃ D1)) (ALam x₄ (ASubsume () x₆))
actsense2 (AAZipLam x₁ (AAZipLam x₃ D1)) (ALam x₄ (ALam x₅ D2)) = ALam x₄ (ALam x₃ (actsense2 D1 D2))
|
oeis/016/A016632.asm | neoneye/loda-programs | 11 | 100743 | ; A016632: Decimal expansion of log(9).
; Submitted by <NAME>
; 2,1,9,7,2,2,4,5,7,7,3,3,6,2,1,9,3,8,2,7,9,0,4,9,0,4,7,3,8,4,5,0,5,1,4,0,9,2,9,4,9,8,1,1,1,5,6,4,5,4,9,8,9,0,3,4,6,9,3,8,8,6,6,7,2,7,4,9,8,8,5,8,6,4,3,7,2,1,7,9,3,3,7,4,7,2,3,1,5,0,9,6,2,7,4,6,4,1,7,7
mov $1,1
mov $2,3
mov $3,$0
mul $3,4
lpb $3
mul $1,$3
mov $5,$3
add $5,1
mul $2,$5
add $2,$1
add $1,$2
add $2,$1
cmp $4,0
mov $5,$0
add $5,$4
div $1,$5
div $2,$5
sub $3,1
lpe
mul $1,4
mov $6,10
pow $6,$0
div $2,$6
div $1,$2
add $1,$6
mov $0,$1
mod $0,10
|
locations.scpt | siliconninja/customschedule | 0 | 1489 | <reponame>siliconninja/customschedule<filename>locations.scpt
-- Copyright (c) 2017 siliconninja
-- This repository and its files are licensed under the the MIT License.
-- READ THIS: This only works if your school has a calendar (that you can subscribe to via iCal or Google Calendars which you can download as an iCal file)
-- **You must run the customschedule.scpt script FIRST before running this one to input the class events in the empty calendar.**
-- and it has the days (4, 3, 2, 1...) and you have a Mac. If you don't have a Mac, try one of the following.
-- Run this via a VM (virtual machine) or Hackintosh
-- Get someone else's Mac (with their permission) and change the class names.
-- TODO:
-- Quarterly classes (e.g. Gym, Health)
-- School events e.g. snow days, pep rallies, etc.
-- Any Mac AppleScript developers here? Please contribute your code to GitHub. It would be greatly appreciated :)
-- (repo is called customschedule, fork and use this code all you like under the MIT license) https://github.com/siliconninja/customschedule
-- * Only for non-developers or users of this app.
tell application "Calendar"
-- Input your schedule calendar here (with the periods/events.)
-- CHANGE THIS SO IT WORKS*.
tell calendar "[Your Calendar Here]"
with timeout of 600 seconds
-- Class names: please input your class names (event names) here, including Lunch and other periods.
-- CHANGE THIS SO IT WORKS*.
set C1List to every event whose summary contains "Period 1: Class 1"
set C2List to every event whose summary contains "Period 2: Class 2"
set C3List to every event whose summary contains "Period 3: Class 3"
set C4List to every event whose summary contains "Period 4: Class 4"
set LList to every event whose summary contains "Lunch"
set C5List to every event whose summary contains "Period 5: Class 5"
set C6List to every event whose summary contains "Period 6: Class 6"
set C7List to every event whose summary contains "Period 7: Class 7"
set C8List to every event whose summary contains "Period 8: Class 8"
set P9List to every event whose summary contains "Period 9: Period 9"
repeat with i from 1 to the count of C1List
set theEvent to item i of C1List
set location of theEvent to "Room 101"
end repeat
repeat with i from 1 to the count of C2List
set theEvent to item i of C2List
set location of theEvent to "Room 102"
end repeat
repeat with i from 1 to the count of C3List
set theEvent to item i of C3List
set location of theEvent to "Room 103"
end repeat
repeat with i from 1 to the count of C4List
set theEvent to item i of C4List
set location of theEvent to "Room 104"
end repeat
repeat with i from 1 to the count of C5List
set theEvent to item i of C5List
set location of theEvent to "Room 105"
end repeat
repeat with i from 1 to the count of C6List
set theEvent to item i of C6List
set location of theEvent to "Room 106"
end repeat
repeat with i from 1 to the count of C7List
set theEvent to item i of C7List
set location of theEvent to "Room 107"
end repeat
repeat with i from 1 to the count of C8List
set theEvent to item i of C8List
set location of theEvent to "Room 108"
end repeat
repeat with i from 1 to the count of P9List
set theEvent to item i of P9List
set location of theEvent to "Any Room"
end repeat
repeat with i from 1 to the count of LList
set theEvent to item i of LList
set location of theEvent to "Cafeteria A"
end repeat
end timeout
end tell
end tell
|
oeis/309/A309827.asm | neoneye/loda-programs | 11 | 100805 | <filename>oeis/309/A309827.asm<gh_stars>10-100
; A309827: a(n) is the square of the number consisting of one 1 and n 6's: (166...6)^2.
; 1,256,27556,2775556,277755556,27777555556,2777775555556,277777755555556,27777777555555556,2777777775555555556,277777777755555555556,27777777777555555555556,2777777777775555555555556,277777777777755555555555556,27777777777777555555555555556,2777777777777775555555555555556,277777777777777755555555555555556,27777777777777777555555555555555556,2777777777777777775555555555555555556,277777777777777777755555555555555555556,27777777777777777777555555555555555555556
seq $0,246057 ; a(n) = (5*10^n - 2)/3.
pow $0,2
|
init.asm | tzulang/xv6_4 | 0 | 17804 |
_init: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
char *argv[] = { "sh", 0 };
int
main(void)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
6: 83 ec 20 sub $0x20,%esp
int pid, wpid;
mknod("proc", 2, 0);
9: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
10: 00
11: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
18: 00
19: c7 04 24 e2 08 00 00 movl $0x8e2,(%esp)
20: e8 b6 03 00 00 call 3db <mknod>
if(open("console", O_RDWR) < 0){
25: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
2c: 00
2d: c7 04 24 e7 08 00 00 movl $0x8e7,(%esp)
34: e8 9a 03 00 00 call 3d3 <open>
39: 85 c0 test %eax,%eax
3b: 79 30 jns 6d <main+0x6d>
mknod("console", 1, 1);
3d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
44: 00
45: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
4c: 00
4d: c7 04 24 e7 08 00 00 movl $0x8e7,(%esp)
54: e8 82 03 00 00 call 3db <mknod>
open("console", O_RDWR);
59: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
60: 00
61: c7 04 24 e7 08 00 00 movl $0x8e7,(%esp)
68: e8 66 03 00 00 call 3d3 <open>
}
dup(0); // stdout
6d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
74: e8 92 03 00 00 call 40b <dup>
dup(0); // stderr
79: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80: e8 86 03 00 00 call 40b <dup>
for(;;){
printf(1, "init: starting sh\n");
85: c7 44 24 04 ef 08 00 movl $0x8ef,0x4(%esp)
8c: 00
8d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
94: e8 7a 04 00 00 call 513 <printf>
pid = fork();
99: e8 ed 02 00 00 call 38b <fork>
9e: 89 44 24 1c mov %eax,0x1c(%esp)
if(pid < 0){
a2: 83 7c 24 1c 00 cmpl $0x0,0x1c(%esp)
a7: 79 19 jns c2 <main+0xc2>
printf(1, "init: fork failed\n");
a9: c7 44 24 04 02 09 00 movl $0x902,0x4(%esp)
b0: 00
b1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
b8: e8 56 04 00 00 call 513 <printf>
exit();
bd: e8 d1 02 00 00 call 393 <exit>
}
if(pid == 0){
c2: 83 7c 24 1c 00 cmpl $0x0,0x1c(%esp)
c7: 75 2d jne f6 <main+0xf6>
exec("sh", argv);
c9: c7 44 24 04 80 0b 00 movl $0xb80,0x4(%esp)
d0: 00
d1: c7 04 24 df 08 00 00 movl $0x8df,(%esp)
d8: e8 ee 02 00 00 call 3cb <exec>
printf(1, "init: exec sh failed\n");
dd: c7 44 24 04 15 09 00 movl $0x915,0x4(%esp)
e4: 00
e5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
ec: e8 22 04 00 00 call 513 <printf>
exit();
f1: e8 9d 02 00 00 call 393 <exit>
}
while((wpid=wait()) >= 0 && wpid != pid)
f6: eb 14 jmp 10c <main+0x10c>
printf(1, "zombie!\n");
f8: c7 44 24 04 2b 09 00 movl $0x92b,0x4(%esp)
ff: 00
100: c7 04 24 01 00 00 00 movl $0x1,(%esp)
107: e8 07 04 00 00 call 513 <printf>
if(pid == 0){
exec("sh", argv);
printf(1, "init: exec sh failed\n");
exit();
}
while((wpid=wait()) >= 0 && wpid != pid)
10c: e8 8a 02 00 00 call 39b <wait>
111: 89 44 24 18 mov %eax,0x18(%esp)
115: 83 7c 24 18 00 cmpl $0x0,0x18(%esp)
11a: 78 0a js 126 <main+0x126>
11c: 8b 44 24 18 mov 0x18(%esp),%eax
120: 3b 44 24 1c cmp 0x1c(%esp),%eax
124: 75 d2 jne f8 <main+0xf8>
printf(1, "zombie!\n");
}
126: e9 5a ff ff ff jmp 85 <main+0x85>
0000012b <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
12b: 55 push %ebp
12c: 89 e5 mov %esp,%ebp
12e: 57 push %edi
12f: 53 push %ebx
asm volatile("cld; rep stosb" :
130: 8b 4d 08 mov 0x8(%ebp),%ecx
133: 8b 55 10 mov 0x10(%ebp),%edx
136: 8b 45 0c mov 0xc(%ebp),%eax
139: 89 cb mov %ecx,%ebx
13b: 89 df mov %ebx,%edi
13d: 89 d1 mov %edx,%ecx
13f: fc cld
140: f3 aa rep stos %al,%es:(%edi)
142: 89 ca mov %ecx,%edx
144: 89 fb mov %edi,%ebx
146: 89 5d 08 mov %ebx,0x8(%ebp)
149: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
14c: 5b pop %ebx
14d: 5f pop %edi
14e: 5d pop %ebp
14f: c3 ret
00000150 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
156: 8b 45 08 mov 0x8(%ebp),%eax
159: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
15c: 90 nop
15d: 8b 45 08 mov 0x8(%ebp),%eax
160: 8d 50 01 lea 0x1(%eax),%edx
163: 89 55 08 mov %edx,0x8(%ebp)
166: 8b 55 0c mov 0xc(%ebp),%edx
169: 8d 4a 01 lea 0x1(%edx),%ecx
16c: 89 4d 0c mov %ecx,0xc(%ebp)
16f: 0f b6 12 movzbl (%edx),%edx
172: 88 10 mov %dl,(%eax)
174: 0f b6 00 movzbl (%eax),%eax
177: 84 c0 test %al,%al
179: 75 e2 jne 15d <strcpy+0xd>
;
return os;
17b: 8b 45 fc mov -0x4(%ebp),%eax
}
17e: c9 leave
17f: c3 ret
00000180 <strcmp>:
int
strcmp(const char *p, const char *q)
{
180: 55 push %ebp
181: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
183: eb 08 jmp 18d <strcmp+0xd>
p++, q++;
185: 83 45 08 01 addl $0x1,0x8(%ebp)
189: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
18d: 8b 45 08 mov 0x8(%ebp),%eax
190: 0f b6 00 movzbl (%eax),%eax
193: 84 c0 test %al,%al
195: 74 10 je 1a7 <strcmp+0x27>
197: 8b 45 08 mov 0x8(%ebp),%eax
19a: 0f b6 10 movzbl (%eax),%edx
19d: 8b 45 0c mov 0xc(%ebp),%eax
1a0: 0f b6 00 movzbl (%eax),%eax
1a3: 38 c2 cmp %al,%dl
1a5: 74 de je 185 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
1a7: 8b 45 08 mov 0x8(%ebp),%eax
1aa: 0f b6 00 movzbl (%eax),%eax
1ad: 0f b6 d0 movzbl %al,%edx
1b0: 8b 45 0c mov 0xc(%ebp),%eax
1b3: 0f b6 00 movzbl (%eax),%eax
1b6: 0f b6 c0 movzbl %al,%eax
1b9: 29 c2 sub %eax,%edx
1bb: 89 d0 mov %edx,%eax
}
1bd: 5d pop %ebp
1be: c3 ret
000001bf <strlen>:
uint
strlen(char *s)
{
1bf: 55 push %ebp
1c0: 89 e5 mov %esp,%ebp
1c2: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
1c5: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
1cc: eb 04 jmp 1d2 <strlen+0x13>
1ce: 83 45 fc 01 addl $0x1,-0x4(%ebp)
1d2: 8b 55 fc mov -0x4(%ebp),%edx
1d5: 8b 45 08 mov 0x8(%ebp),%eax
1d8: 01 d0 add %edx,%eax
1da: 0f b6 00 movzbl (%eax),%eax
1dd: 84 c0 test %al,%al
1df: 75 ed jne 1ce <strlen+0xf>
;
return n;
1e1: 8b 45 fc mov -0x4(%ebp),%eax
}
1e4: c9 leave
1e5: c3 ret
000001e6 <memset>:
void*
memset(void *dst, int c, uint n)
{
1e6: 55 push %ebp
1e7: 89 e5 mov %esp,%ebp
1e9: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
1ec: 8b 45 10 mov 0x10(%ebp),%eax
1ef: 89 44 24 08 mov %eax,0x8(%esp)
1f3: 8b 45 0c mov 0xc(%ebp),%eax
1f6: 89 44 24 04 mov %eax,0x4(%esp)
1fa: 8b 45 08 mov 0x8(%ebp),%eax
1fd: 89 04 24 mov %eax,(%esp)
200: e8 26 ff ff ff call 12b <stosb>
return dst;
205: 8b 45 08 mov 0x8(%ebp),%eax
}
208: c9 leave
209: c3 ret
0000020a <strchr>:
char*
strchr(const char *s, char c)
{
20a: 55 push %ebp
20b: 89 e5 mov %esp,%ebp
20d: 83 ec 04 sub $0x4,%esp
210: 8b 45 0c mov 0xc(%ebp),%eax
213: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
216: eb 14 jmp 22c <strchr+0x22>
if(*s == c)
218: 8b 45 08 mov 0x8(%ebp),%eax
21b: 0f b6 00 movzbl (%eax),%eax
21e: 3a 45 fc cmp -0x4(%ebp),%al
221: 75 05 jne 228 <strchr+0x1e>
return (char*)s;
223: 8b 45 08 mov 0x8(%ebp),%eax
226: eb 13 jmp 23b <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
228: 83 45 08 01 addl $0x1,0x8(%ebp)
22c: 8b 45 08 mov 0x8(%ebp),%eax
22f: 0f b6 00 movzbl (%eax),%eax
232: 84 c0 test %al,%al
234: 75 e2 jne 218 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
236: b8 00 00 00 00 mov $0x0,%eax
}
23b: c9 leave
23c: c3 ret
0000023d <gets>:
char*
gets(char *buf, int max)
{
23d: 55 push %ebp
23e: 89 e5 mov %esp,%ebp
240: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
243: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
24a: eb 4c jmp 298 <gets+0x5b>
cc = read(0, &c, 1);
24c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
253: 00
254: 8d 45 ef lea -0x11(%ebp),%eax
257: 89 44 24 04 mov %eax,0x4(%esp)
25b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
262: e8 44 01 00 00 call 3ab <read>
267: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
26a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
26e: 7f 02 jg 272 <gets+0x35>
break;
270: eb 31 jmp 2a3 <gets+0x66>
buf[i++] = c;
272: 8b 45 f4 mov -0xc(%ebp),%eax
275: 8d 50 01 lea 0x1(%eax),%edx
278: 89 55 f4 mov %edx,-0xc(%ebp)
27b: 89 c2 mov %eax,%edx
27d: 8b 45 08 mov 0x8(%ebp),%eax
280: 01 c2 add %eax,%edx
282: 0f b6 45 ef movzbl -0x11(%ebp),%eax
286: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
288: 0f b6 45 ef movzbl -0x11(%ebp),%eax
28c: 3c 0a cmp $0xa,%al
28e: 74 13 je 2a3 <gets+0x66>
290: 0f b6 45 ef movzbl -0x11(%ebp),%eax
294: 3c 0d cmp $0xd,%al
296: 74 0b je 2a3 <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
298: 8b 45 f4 mov -0xc(%ebp),%eax
29b: 83 c0 01 add $0x1,%eax
29e: 3b 45 0c cmp 0xc(%ebp),%eax
2a1: 7c a9 jl 24c <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
2a3: 8b 55 f4 mov -0xc(%ebp),%edx
2a6: 8b 45 08 mov 0x8(%ebp),%eax
2a9: 01 d0 add %edx,%eax
2ab: c6 00 00 movb $0x0,(%eax)
return buf;
2ae: 8b 45 08 mov 0x8(%ebp),%eax
}
2b1: c9 leave
2b2: c3 ret
000002b3 <stat>:
int
stat(char *n, struct stat *st)
{
2b3: 55 push %ebp
2b4: 89 e5 mov %esp,%ebp
2b6: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
2b9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2c0: 00
2c1: 8b 45 08 mov 0x8(%ebp),%eax
2c4: 89 04 24 mov %eax,(%esp)
2c7: e8 07 01 00 00 call 3d3 <open>
2cc: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
2cf: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2d3: 79 07 jns 2dc <stat+0x29>
return -1;
2d5: b8 ff ff ff ff mov $0xffffffff,%eax
2da: eb 23 jmp 2ff <stat+0x4c>
r = fstat(fd, st);
2dc: 8b 45 0c mov 0xc(%ebp),%eax
2df: 89 44 24 04 mov %eax,0x4(%esp)
2e3: 8b 45 f4 mov -0xc(%ebp),%eax
2e6: 89 04 24 mov %eax,(%esp)
2e9: e8 fd 00 00 00 call 3eb <fstat>
2ee: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
2f1: 8b 45 f4 mov -0xc(%ebp),%eax
2f4: 89 04 24 mov %eax,(%esp)
2f7: e8 bf 00 00 00 call 3bb <close>
return r;
2fc: 8b 45 f0 mov -0x10(%ebp),%eax
}
2ff: c9 leave
300: c3 ret
00000301 <atoi>:
int
atoi(const char *s)
{
301: 55 push %ebp
302: 89 e5 mov %esp,%ebp
304: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
307: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
30e: eb 25 jmp 335 <atoi+0x34>
n = n*10 + *s++ - '0';
310: 8b 55 fc mov -0x4(%ebp),%edx
313: 89 d0 mov %edx,%eax
315: c1 e0 02 shl $0x2,%eax
318: 01 d0 add %edx,%eax
31a: 01 c0 add %eax,%eax
31c: 89 c1 mov %eax,%ecx
31e: 8b 45 08 mov 0x8(%ebp),%eax
321: 8d 50 01 lea 0x1(%eax),%edx
324: 89 55 08 mov %edx,0x8(%ebp)
327: 0f b6 00 movzbl (%eax),%eax
32a: 0f be c0 movsbl %al,%eax
32d: 01 c8 add %ecx,%eax
32f: 83 e8 30 sub $0x30,%eax
332: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
335: 8b 45 08 mov 0x8(%ebp),%eax
338: 0f b6 00 movzbl (%eax),%eax
33b: 3c 2f cmp $0x2f,%al
33d: 7e 0a jle 349 <atoi+0x48>
33f: 8b 45 08 mov 0x8(%ebp),%eax
342: 0f b6 00 movzbl (%eax),%eax
345: 3c 39 cmp $0x39,%al
347: 7e c7 jle 310 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
349: 8b 45 fc mov -0x4(%ebp),%eax
}
34c: c9 leave
34d: c3 ret
0000034e <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
34e: 55 push %ebp
34f: 89 e5 mov %esp,%ebp
351: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
354: 8b 45 08 mov 0x8(%ebp),%eax
357: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
35a: 8b 45 0c mov 0xc(%ebp),%eax
35d: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
360: eb 17 jmp 379 <memmove+0x2b>
*dst++ = *src++;
362: 8b 45 fc mov -0x4(%ebp),%eax
365: 8d 50 01 lea 0x1(%eax),%edx
368: 89 55 fc mov %edx,-0x4(%ebp)
36b: 8b 55 f8 mov -0x8(%ebp),%edx
36e: 8d 4a 01 lea 0x1(%edx),%ecx
371: 89 4d f8 mov %ecx,-0x8(%ebp)
374: 0f b6 12 movzbl (%edx),%edx
377: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
379: 8b 45 10 mov 0x10(%ebp),%eax
37c: 8d 50 ff lea -0x1(%eax),%edx
37f: 89 55 10 mov %edx,0x10(%ebp)
382: 85 c0 test %eax,%eax
384: 7f dc jg 362 <memmove+0x14>
*dst++ = *src++;
return vdst;
386: 8b 45 08 mov 0x8(%ebp),%eax
}
389: c9 leave
38a: c3 ret
0000038b <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
38b: b8 01 00 00 00 mov $0x1,%eax
390: cd 40 int $0x40
392: c3 ret
00000393 <exit>:
SYSCALL(exit)
393: b8 02 00 00 00 mov $0x2,%eax
398: cd 40 int $0x40
39a: c3 ret
0000039b <wait>:
SYSCALL(wait)
39b: b8 03 00 00 00 mov $0x3,%eax
3a0: cd 40 int $0x40
3a2: c3 ret
000003a3 <pipe>:
SYSCALL(pipe)
3a3: b8 04 00 00 00 mov $0x4,%eax
3a8: cd 40 int $0x40
3aa: c3 ret
000003ab <read>:
SYSCALL(read)
3ab: b8 05 00 00 00 mov $0x5,%eax
3b0: cd 40 int $0x40
3b2: c3 ret
000003b3 <write>:
SYSCALL(write)
3b3: b8 10 00 00 00 mov $0x10,%eax
3b8: cd 40 int $0x40
3ba: c3 ret
000003bb <close>:
SYSCALL(close)
3bb: b8 15 00 00 00 mov $0x15,%eax
3c0: cd 40 int $0x40
3c2: c3 ret
000003c3 <kill>:
SYSCALL(kill)
3c3: b8 06 00 00 00 mov $0x6,%eax
3c8: cd 40 int $0x40
3ca: c3 ret
000003cb <exec>:
SYSCALL(exec)
3cb: b8 07 00 00 00 mov $0x7,%eax
3d0: cd 40 int $0x40
3d2: c3 ret
000003d3 <open>:
SYSCALL(open)
3d3: b8 0f 00 00 00 mov $0xf,%eax
3d8: cd 40 int $0x40
3da: c3 ret
000003db <mknod>:
SYSCALL(mknod)
3db: b8 11 00 00 00 mov $0x11,%eax
3e0: cd 40 int $0x40
3e2: c3 ret
000003e3 <unlink>:
SYSCALL(unlink)
3e3: b8 12 00 00 00 mov $0x12,%eax
3e8: cd 40 int $0x40
3ea: c3 ret
000003eb <fstat>:
SYSCALL(fstat)
3eb: b8 08 00 00 00 mov $0x8,%eax
3f0: cd 40 int $0x40
3f2: c3 ret
000003f3 <link>:
SYSCALL(link)
3f3: b8 13 00 00 00 mov $0x13,%eax
3f8: cd 40 int $0x40
3fa: c3 ret
000003fb <mkdir>:
SYSCALL(mkdir)
3fb: b8 14 00 00 00 mov $0x14,%eax
400: cd 40 int $0x40
402: c3 ret
00000403 <chdir>:
SYSCALL(chdir)
403: b8 09 00 00 00 mov $0x9,%eax
408: cd 40 int $0x40
40a: c3 ret
0000040b <dup>:
SYSCALL(dup)
40b: b8 0a 00 00 00 mov $0xa,%eax
410: cd 40 int $0x40
412: c3 ret
00000413 <getpid>:
SYSCALL(getpid)
413: b8 0b 00 00 00 mov $0xb,%eax
418: cd 40 int $0x40
41a: c3 ret
0000041b <sbrk>:
SYSCALL(sbrk)
41b: b8 0c 00 00 00 mov $0xc,%eax
420: cd 40 int $0x40
422: c3 ret
00000423 <sleep>:
SYSCALL(sleep)
423: b8 0d 00 00 00 mov $0xd,%eax
428: cd 40 int $0x40
42a: c3 ret
0000042b <uptime>:
SYSCALL(uptime)
42b: b8 0e 00 00 00 mov $0xe,%eax
430: cd 40 int $0x40
432: c3 ret
00000433 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
433: 55 push %ebp
434: 89 e5 mov %esp,%ebp
436: 83 ec 18 sub $0x18,%esp
439: 8b 45 0c mov 0xc(%ebp),%eax
43c: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
43f: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
446: 00
447: 8d 45 f4 lea -0xc(%ebp),%eax
44a: 89 44 24 04 mov %eax,0x4(%esp)
44e: 8b 45 08 mov 0x8(%ebp),%eax
451: 89 04 24 mov %eax,(%esp)
454: e8 5a ff ff ff call 3b3 <write>
}
459: c9 leave
45a: c3 ret
0000045b <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
45b: 55 push %ebp
45c: 89 e5 mov %esp,%ebp
45e: 56 push %esi
45f: 53 push %ebx
460: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
463: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
46a: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
46e: 74 17 je 487 <printint+0x2c>
470: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
474: 79 11 jns 487 <printint+0x2c>
neg = 1;
476: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
47d: 8b 45 0c mov 0xc(%ebp),%eax
480: f7 d8 neg %eax
482: 89 45 ec mov %eax,-0x14(%ebp)
485: eb 06 jmp 48d <printint+0x32>
} else {
x = xx;
487: 8b 45 0c mov 0xc(%ebp),%eax
48a: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
48d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
494: 8b 4d f4 mov -0xc(%ebp),%ecx
497: 8d 41 01 lea 0x1(%ecx),%eax
49a: 89 45 f4 mov %eax,-0xc(%ebp)
49d: 8b 5d 10 mov 0x10(%ebp),%ebx
4a0: 8b 45 ec mov -0x14(%ebp),%eax
4a3: ba 00 00 00 00 mov $0x0,%edx
4a8: f7 f3 div %ebx
4aa: 89 d0 mov %edx,%eax
4ac: 0f b6 80 88 0b 00 00 movzbl 0xb88(%eax),%eax
4b3: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
4b7: 8b 75 10 mov 0x10(%ebp),%esi
4ba: 8b 45 ec mov -0x14(%ebp),%eax
4bd: ba 00 00 00 00 mov $0x0,%edx
4c2: f7 f6 div %esi
4c4: 89 45 ec mov %eax,-0x14(%ebp)
4c7: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
4cb: 75 c7 jne 494 <printint+0x39>
if(neg)
4cd: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
4d1: 74 10 je 4e3 <printint+0x88>
buf[i++] = '-';
4d3: 8b 45 f4 mov -0xc(%ebp),%eax
4d6: 8d 50 01 lea 0x1(%eax),%edx
4d9: 89 55 f4 mov %edx,-0xc(%ebp)
4dc: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
4e1: eb 1f jmp 502 <printint+0xa7>
4e3: eb 1d jmp 502 <printint+0xa7>
putc(fd, buf[i]);
4e5: 8d 55 dc lea -0x24(%ebp),%edx
4e8: 8b 45 f4 mov -0xc(%ebp),%eax
4eb: 01 d0 add %edx,%eax
4ed: 0f b6 00 movzbl (%eax),%eax
4f0: 0f be c0 movsbl %al,%eax
4f3: 89 44 24 04 mov %eax,0x4(%esp)
4f7: 8b 45 08 mov 0x8(%ebp),%eax
4fa: 89 04 24 mov %eax,(%esp)
4fd: e8 31 ff ff ff call 433 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
502: 83 6d f4 01 subl $0x1,-0xc(%ebp)
506: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
50a: 79 d9 jns 4e5 <printint+0x8a>
putc(fd, buf[i]);
}
50c: 83 c4 30 add $0x30,%esp
50f: 5b pop %ebx
510: 5e pop %esi
511: 5d pop %ebp
512: c3 ret
00000513 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
513: 55 push %ebp
514: 89 e5 mov %esp,%ebp
516: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
519: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
520: 8d 45 0c lea 0xc(%ebp),%eax
523: 83 c0 04 add $0x4,%eax
526: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
529: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
530: e9 7c 01 00 00 jmp 6b1 <printf+0x19e>
c = fmt[i] & 0xff;
535: 8b 55 0c mov 0xc(%ebp),%edx
538: 8b 45 f0 mov -0x10(%ebp),%eax
53b: 01 d0 add %edx,%eax
53d: 0f b6 00 movzbl (%eax),%eax
540: 0f be c0 movsbl %al,%eax
543: 25 ff 00 00 00 and $0xff,%eax
548: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
54b: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
54f: 75 2c jne 57d <printf+0x6a>
if(c == '%'){
551: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
555: 75 0c jne 563 <printf+0x50>
state = '%';
557: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
55e: e9 4a 01 00 00 jmp 6ad <printf+0x19a>
} else {
putc(fd, c);
563: 8b 45 e4 mov -0x1c(%ebp),%eax
566: 0f be c0 movsbl %al,%eax
569: 89 44 24 04 mov %eax,0x4(%esp)
56d: 8b 45 08 mov 0x8(%ebp),%eax
570: 89 04 24 mov %eax,(%esp)
573: e8 bb fe ff ff call 433 <putc>
578: e9 30 01 00 00 jmp 6ad <printf+0x19a>
}
} else if(state == '%'){
57d: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
581: 0f 85 26 01 00 00 jne 6ad <printf+0x19a>
if(c == 'd'){
587: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
58b: 75 2d jne 5ba <printf+0xa7>
printint(fd, *ap, 10, 1);
58d: 8b 45 e8 mov -0x18(%ebp),%eax
590: 8b 00 mov (%eax),%eax
592: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
599: 00
59a: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
5a1: 00
5a2: 89 44 24 04 mov %eax,0x4(%esp)
5a6: 8b 45 08 mov 0x8(%ebp),%eax
5a9: 89 04 24 mov %eax,(%esp)
5ac: e8 aa fe ff ff call 45b <printint>
ap++;
5b1: 83 45 e8 04 addl $0x4,-0x18(%ebp)
5b5: e9 ec 00 00 00 jmp 6a6 <printf+0x193>
} else if(c == 'x' || c == 'p'){
5ba: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
5be: 74 06 je 5c6 <printf+0xb3>
5c0: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
5c4: 75 2d jne 5f3 <printf+0xe0>
printint(fd, *ap, 16, 0);
5c6: 8b 45 e8 mov -0x18(%ebp),%eax
5c9: 8b 00 mov (%eax),%eax
5cb: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
5d2: 00
5d3: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
5da: 00
5db: 89 44 24 04 mov %eax,0x4(%esp)
5df: 8b 45 08 mov 0x8(%ebp),%eax
5e2: 89 04 24 mov %eax,(%esp)
5e5: e8 71 fe ff ff call 45b <printint>
ap++;
5ea: 83 45 e8 04 addl $0x4,-0x18(%ebp)
5ee: e9 b3 00 00 00 jmp 6a6 <printf+0x193>
} else if(c == 's'){
5f3: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
5f7: 75 45 jne 63e <printf+0x12b>
s = (char*)*ap;
5f9: 8b 45 e8 mov -0x18(%ebp),%eax
5fc: 8b 00 mov (%eax),%eax
5fe: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
601: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
605: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
609: 75 09 jne 614 <printf+0x101>
s = "(null)";
60b: c7 45 f4 34 09 00 00 movl $0x934,-0xc(%ebp)
while(*s != 0){
612: eb 1e jmp 632 <printf+0x11f>
614: eb 1c jmp 632 <printf+0x11f>
putc(fd, *s);
616: 8b 45 f4 mov -0xc(%ebp),%eax
619: 0f b6 00 movzbl (%eax),%eax
61c: 0f be c0 movsbl %al,%eax
61f: 89 44 24 04 mov %eax,0x4(%esp)
623: 8b 45 08 mov 0x8(%ebp),%eax
626: 89 04 24 mov %eax,(%esp)
629: e8 05 fe ff ff call 433 <putc>
s++;
62e: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
632: 8b 45 f4 mov -0xc(%ebp),%eax
635: 0f b6 00 movzbl (%eax),%eax
638: 84 c0 test %al,%al
63a: 75 da jne 616 <printf+0x103>
63c: eb 68 jmp 6a6 <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
63e: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
642: 75 1d jne 661 <printf+0x14e>
putc(fd, *ap);
644: 8b 45 e8 mov -0x18(%ebp),%eax
647: 8b 00 mov (%eax),%eax
649: 0f be c0 movsbl %al,%eax
64c: 89 44 24 04 mov %eax,0x4(%esp)
650: 8b 45 08 mov 0x8(%ebp),%eax
653: 89 04 24 mov %eax,(%esp)
656: e8 d8 fd ff ff call 433 <putc>
ap++;
65b: 83 45 e8 04 addl $0x4,-0x18(%ebp)
65f: eb 45 jmp 6a6 <printf+0x193>
} else if(c == '%'){
661: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
665: 75 17 jne 67e <printf+0x16b>
putc(fd, c);
667: 8b 45 e4 mov -0x1c(%ebp),%eax
66a: 0f be c0 movsbl %al,%eax
66d: 89 44 24 04 mov %eax,0x4(%esp)
671: 8b 45 08 mov 0x8(%ebp),%eax
674: 89 04 24 mov %eax,(%esp)
677: e8 b7 fd ff ff call 433 <putc>
67c: eb 28 jmp 6a6 <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
67e: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
685: 00
686: 8b 45 08 mov 0x8(%ebp),%eax
689: 89 04 24 mov %eax,(%esp)
68c: e8 a2 fd ff ff call 433 <putc>
putc(fd, c);
691: 8b 45 e4 mov -0x1c(%ebp),%eax
694: 0f be c0 movsbl %al,%eax
697: 89 44 24 04 mov %eax,0x4(%esp)
69b: 8b 45 08 mov 0x8(%ebp),%eax
69e: 89 04 24 mov %eax,(%esp)
6a1: e8 8d fd ff ff call 433 <putc>
}
state = 0;
6a6: 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++){
6ad: 83 45 f0 01 addl $0x1,-0x10(%ebp)
6b1: 8b 55 0c mov 0xc(%ebp),%edx
6b4: 8b 45 f0 mov -0x10(%ebp),%eax
6b7: 01 d0 add %edx,%eax
6b9: 0f b6 00 movzbl (%eax),%eax
6bc: 84 c0 test %al,%al
6be: 0f 85 71 fe ff ff jne 535 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
6c4: c9 leave
6c5: c3 ret
000006c6 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
6c6: 55 push %ebp
6c7: 89 e5 mov %esp,%ebp
6c9: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
6cc: 8b 45 08 mov 0x8(%ebp),%eax
6cf: 83 e8 08 sub $0x8,%eax
6d2: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6d5: a1 a4 0b 00 00 mov 0xba4,%eax
6da: 89 45 fc mov %eax,-0x4(%ebp)
6dd: eb 24 jmp 703 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
6df: 8b 45 fc mov -0x4(%ebp),%eax
6e2: 8b 00 mov (%eax),%eax
6e4: 3b 45 fc cmp -0x4(%ebp),%eax
6e7: 77 12 ja 6fb <free+0x35>
6e9: 8b 45 f8 mov -0x8(%ebp),%eax
6ec: 3b 45 fc cmp -0x4(%ebp),%eax
6ef: 77 24 ja 715 <free+0x4f>
6f1: 8b 45 fc mov -0x4(%ebp),%eax
6f4: 8b 00 mov (%eax),%eax
6f6: 3b 45 f8 cmp -0x8(%ebp),%eax
6f9: 77 1a ja 715 <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)
6fb: 8b 45 fc mov -0x4(%ebp),%eax
6fe: 8b 00 mov (%eax),%eax
700: 89 45 fc mov %eax,-0x4(%ebp)
703: 8b 45 f8 mov -0x8(%ebp),%eax
706: 3b 45 fc cmp -0x4(%ebp),%eax
709: 76 d4 jbe 6df <free+0x19>
70b: 8b 45 fc mov -0x4(%ebp),%eax
70e: 8b 00 mov (%eax),%eax
710: 3b 45 f8 cmp -0x8(%ebp),%eax
713: 76 ca jbe 6df <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
715: 8b 45 f8 mov -0x8(%ebp),%eax
718: 8b 40 04 mov 0x4(%eax),%eax
71b: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
722: 8b 45 f8 mov -0x8(%ebp),%eax
725: 01 c2 add %eax,%edx
727: 8b 45 fc mov -0x4(%ebp),%eax
72a: 8b 00 mov (%eax),%eax
72c: 39 c2 cmp %eax,%edx
72e: 75 24 jne 754 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
730: 8b 45 f8 mov -0x8(%ebp),%eax
733: 8b 50 04 mov 0x4(%eax),%edx
736: 8b 45 fc mov -0x4(%ebp),%eax
739: 8b 00 mov (%eax),%eax
73b: 8b 40 04 mov 0x4(%eax),%eax
73e: 01 c2 add %eax,%edx
740: 8b 45 f8 mov -0x8(%ebp),%eax
743: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
746: 8b 45 fc mov -0x4(%ebp),%eax
749: 8b 00 mov (%eax),%eax
74b: 8b 10 mov (%eax),%edx
74d: 8b 45 f8 mov -0x8(%ebp),%eax
750: 89 10 mov %edx,(%eax)
752: eb 0a jmp 75e <free+0x98>
} else
bp->s.ptr = p->s.ptr;
754: 8b 45 fc mov -0x4(%ebp),%eax
757: 8b 10 mov (%eax),%edx
759: 8b 45 f8 mov -0x8(%ebp),%eax
75c: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
75e: 8b 45 fc mov -0x4(%ebp),%eax
761: 8b 40 04 mov 0x4(%eax),%eax
764: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
76b: 8b 45 fc mov -0x4(%ebp),%eax
76e: 01 d0 add %edx,%eax
770: 3b 45 f8 cmp -0x8(%ebp),%eax
773: 75 20 jne 795 <free+0xcf>
p->s.size += bp->s.size;
775: 8b 45 fc mov -0x4(%ebp),%eax
778: 8b 50 04 mov 0x4(%eax),%edx
77b: 8b 45 f8 mov -0x8(%ebp),%eax
77e: 8b 40 04 mov 0x4(%eax),%eax
781: 01 c2 add %eax,%edx
783: 8b 45 fc mov -0x4(%ebp),%eax
786: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
789: 8b 45 f8 mov -0x8(%ebp),%eax
78c: 8b 10 mov (%eax),%edx
78e: 8b 45 fc mov -0x4(%ebp),%eax
791: 89 10 mov %edx,(%eax)
793: eb 08 jmp 79d <free+0xd7>
} else
p->s.ptr = bp;
795: 8b 45 fc mov -0x4(%ebp),%eax
798: 8b 55 f8 mov -0x8(%ebp),%edx
79b: 89 10 mov %edx,(%eax)
freep = p;
79d: 8b 45 fc mov -0x4(%ebp),%eax
7a0: a3 a4 0b 00 00 mov %eax,0xba4
}
7a5: c9 leave
7a6: c3 ret
000007a7 <morecore>:
static Header*
morecore(uint nu)
{
7a7: 55 push %ebp
7a8: 89 e5 mov %esp,%ebp
7aa: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
7ad: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
7b4: 77 07 ja 7bd <morecore+0x16>
nu = 4096;
7b6: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
7bd: 8b 45 08 mov 0x8(%ebp),%eax
7c0: c1 e0 03 shl $0x3,%eax
7c3: 89 04 24 mov %eax,(%esp)
7c6: e8 50 fc ff ff call 41b <sbrk>
7cb: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
7ce: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
7d2: 75 07 jne 7db <morecore+0x34>
return 0;
7d4: b8 00 00 00 00 mov $0x0,%eax
7d9: eb 22 jmp 7fd <morecore+0x56>
hp = (Header*)p;
7db: 8b 45 f4 mov -0xc(%ebp),%eax
7de: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
7e1: 8b 45 f0 mov -0x10(%ebp),%eax
7e4: 8b 55 08 mov 0x8(%ebp),%edx
7e7: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
7ea: 8b 45 f0 mov -0x10(%ebp),%eax
7ed: 83 c0 08 add $0x8,%eax
7f0: 89 04 24 mov %eax,(%esp)
7f3: e8 ce fe ff ff call 6c6 <free>
return freep;
7f8: a1 a4 0b 00 00 mov 0xba4,%eax
}
7fd: c9 leave
7fe: c3 ret
000007ff <malloc>:
void*
malloc(uint nbytes)
{
7ff: 55 push %ebp
800: 89 e5 mov %esp,%ebp
802: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
805: 8b 45 08 mov 0x8(%ebp),%eax
808: 83 c0 07 add $0x7,%eax
80b: c1 e8 03 shr $0x3,%eax
80e: 83 c0 01 add $0x1,%eax
811: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
814: a1 a4 0b 00 00 mov 0xba4,%eax
819: 89 45 f0 mov %eax,-0x10(%ebp)
81c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
820: 75 23 jne 845 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
822: c7 45 f0 9c 0b 00 00 movl $0xb9c,-0x10(%ebp)
829: 8b 45 f0 mov -0x10(%ebp),%eax
82c: a3 a4 0b 00 00 mov %eax,0xba4
831: a1 a4 0b 00 00 mov 0xba4,%eax
836: a3 9c 0b 00 00 mov %eax,0xb9c
base.s.size = 0;
83b: c7 05 a0 0b 00 00 00 movl $0x0,0xba0
842: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
845: 8b 45 f0 mov -0x10(%ebp),%eax
848: 8b 00 mov (%eax),%eax
84a: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
84d: 8b 45 f4 mov -0xc(%ebp),%eax
850: 8b 40 04 mov 0x4(%eax),%eax
853: 3b 45 ec cmp -0x14(%ebp),%eax
856: 72 4d jb 8a5 <malloc+0xa6>
if(p->s.size == nunits)
858: 8b 45 f4 mov -0xc(%ebp),%eax
85b: 8b 40 04 mov 0x4(%eax),%eax
85e: 3b 45 ec cmp -0x14(%ebp),%eax
861: 75 0c jne 86f <malloc+0x70>
prevp->s.ptr = p->s.ptr;
863: 8b 45 f4 mov -0xc(%ebp),%eax
866: 8b 10 mov (%eax),%edx
868: 8b 45 f0 mov -0x10(%ebp),%eax
86b: 89 10 mov %edx,(%eax)
86d: eb 26 jmp 895 <malloc+0x96>
else {
p->s.size -= nunits;
86f: 8b 45 f4 mov -0xc(%ebp),%eax
872: 8b 40 04 mov 0x4(%eax),%eax
875: 2b 45 ec sub -0x14(%ebp),%eax
878: 89 c2 mov %eax,%edx
87a: 8b 45 f4 mov -0xc(%ebp),%eax
87d: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
880: 8b 45 f4 mov -0xc(%ebp),%eax
883: 8b 40 04 mov 0x4(%eax),%eax
886: c1 e0 03 shl $0x3,%eax
889: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
88c: 8b 45 f4 mov -0xc(%ebp),%eax
88f: 8b 55 ec mov -0x14(%ebp),%edx
892: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
895: 8b 45 f0 mov -0x10(%ebp),%eax
898: a3 a4 0b 00 00 mov %eax,0xba4
return (void*)(p + 1);
89d: 8b 45 f4 mov -0xc(%ebp),%eax
8a0: 83 c0 08 add $0x8,%eax
8a3: eb 38 jmp 8dd <malloc+0xde>
}
if(p == freep)
8a5: a1 a4 0b 00 00 mov 0xba4,%eax
8aa: 39 45 f4 cmp %eax,-0xc(%ebp)
8ad: 75 1b jne 8ca <malloc+0xcb>
if((p = morecore(nunits)) == 0)
8af: 8b 45 ec mov -0x14(%ebp),%eax
8b2: 89 04 24 mov %eax,(%esp)
8b5: e8 ed fe ff ff call 7a7 <morecore>
8ba: 89 45 f4 mov %eax,-0xc(%ebp)
8bd: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8c1: 75 07 jne 8ca <malloc+0xcb>
return 0;
8c3: b8 00 00 00 00 mov $0x0,%eax
8c8: eb 13 jmp 8dd <malloc+0xde>
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){
8ca: 8b 45 f4 mov -0xc(%ebp),%eax
8cd: 89 45 f0 mov %eax,-0x10(%ebp)
8d0: 8b 45 f4 mov -0xc(%ebp),%eax
8d3: 8b 00 mov (%eax),%eax
8d5: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
8d8: e9 70 ff ff ff jmp 84d <malloc+0x4e>
}
8dd: c9 leave
8de: c3 ret
|
euler5.adb | kimtg/euler-ada | 7 | 29269 | with ada.text_io;
use ada.text_io;
procedure euler5 is
i : long_long_integer;
n : long_long_integer := 20;
begin
i := 19;
while i >= 2 loop
if n mod i /= 0 then
n := n + 20;
i := 20;
end if;
i := i - 1;
end loop;
put_line(long_long_integer'image(n));
end;
|
software/config/config.ads | TUM-EI-RCS/StratoX | 12 | 4828 | -- Institution: Technische Universität München
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Module: Hardware Configuration
--
-- Authors: <NAME> (<EMAIL>)
--
-- Description:
-- Hardware Configuration of the board.
with Units; use Units;
with Units.Navigation; use Units.Navigation;
package Config with SPARK_Mode is
-- Board
-- -------------------------------
LED_PIN : constant := 12;
BARO_I2C_ADDRESS : constant := 0;
-- Estimator
-- -------------------------------
DEFAULT_HOME_LONG : constant Longitude_Type := 11.815031 * Degree; -- east of munich
DEFAULT_HOME_LAT : constant Latitude_Type := 48.192574 * Degree; -- east of munich
DEFAULT_HOME_ALT_MSL : constant Altitude_Type := 518.0 * Meter; -- east of munich
TARGET_AREA_RADIUS : constant Length_Type := 50.0 * Meter; -- final: 50...100.
pragma Assert (TARGET_AREA_RADIUS >= 20.0 * Meter); -- below 15m the navigation is too imprecise
-- Flight
-- -------------------------------
TARGET_PITCH : constant Pitch_Type := -3.0 * Degree; -- assuming that this pitch eventually results in good airspeed
CIRCLE_TRAJECTORY_ROLL : constant Roll_Type := 5.0 * Degree; -- roll angle when circles are requested
-- target attitude limits in controlled flights (symmetric around zero; may be overshot in real world)
MAX_ROLL : constant Roll_Type := 5.0 * Degree;
MAX_PITCH : constant Pitch_Type := 20.0 * Degree;
-- Mission
-- -------------------------------
CFG_TARGET_ALTITUDE : constant Altitude_Type := 6100.0 * Meter; -- 20_000ft
-- when reaching this relative altitude, we detach
CFG_TARGET_ALTITUDE_TIME : constant := 6.0 * Second;
-- after so much time at target altitude the detach happens
CFG_DELTA_ALTITUDE_THRESH : constant Altitude_Type := 20.0 * Meter; -- Diff
CFG_DELTA_ALTITUDE_THRESH_TIME : constant := 2.0 * Second;
-- Servos
-- -------------------------------
CFG_LEFT_SERVO_OFFSET : constant := 8.0 * Degree;
CFG_RIGHT_SERVO_OFFSET : constant := 4.0 * Degree;
-- Limits
CFG_SERVO_ANGLE_LIMIT_MIN : constant := -45.0 * Degree;
CFG_SERVO_ANGLE_LIMIT_MAX : constant := 45.0 * Degree;
CFG_SERVO_PULSE_LENGTH_LIMIT_MIN : constant := 1.100 * Milli*Second;
CFG_SERVO_PULSE_LENGTH_LIMIT_MAX : constant := 1.900 * Milli*Second;
CFG_MOTOR_SPEED_LIMIT_MIN : constant := 0.0 * Degree / Second;
CFG_MOTOR_SPEED_LIMIT_MAX : constant := 10.0 * 360.0 * Degree / Second; -- Degree per Second
-- Parameter Server
-- organize parameters in groups
type Float_Parameter_Type is( TIMEOUT_TEST,
BUADRATE
);
type FLoat_Parameter_Array is array( Float_Parameter_Type ) of Float;
-- procedure get_Parameter( param : Float_Parameter_Type; value : out Float );
end Config;
|
agda-stdlib/src/Reflection/Argument/Visibility.agda | DreamLinuxer/popl21-artifact | 5 | 6154 | <filename>agda-stdlib/src/Reflection/Argument/Visibility.agda
------------------------------------------------------------------------
-- The Agda standard library
--
-- Argument visibility used in the reflection machinery
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Reflection.Argument.Visibility where
open import Data.String as String using (String)
open import Relation.Nullary
open import Relation.Binary
open import Relation.Binary.PropositionalEquality
------------------------------------------------------------------------
-- Re-exporting the builtins publically
open import Agda.Builtin.Reflection public using (Visibility)
open Visibility public
------------------------------------------------------------------------
-- Decidable equality
_≟_ : DecidableEquality Visibility
visible ≟ visible = yes refl
hidden ≟ hidden = yes refl
instance′ ≟ instance′ = yes refl
visible ≟ hidden = no λ()
visible ≟ instance′ = no λ()
hidden ≟ visible = no λ()
hidden ≟ instance′ = no λ()
instance′ ≟ visible = no λ()
instance′ ≟ hidden = no λ()
|
Task/Reverse-a-string/Agda/reverse-a-string.agda | LaudateCorpus1/RosettaCodeData | 1 | 1701 | <gh_stars>1-10
module reverse_string where
open import Data.String
open import Data.List
reverse_string : String → String
reverse_string s = fromList (reverse (toList s))
|
programs/oeis/027/A027966.asm | karttu/loda | 0 | 17151 | <reponame>karttu/loda<gh_stars>0
; A027966: T(n, 2*n-4), T given by A027960.
; 1,4,11,26,54,101,174,281,431,634,901,1244,1676,2211,2864,3651,4589,5696,6991,8494,10226,12209,14466,17021,19899,23126,26729,30736,35176,40079,45476,51399,57881,64956,72659,81026,90094,99901,110486,121889,134151,147314,161421,176516,192644,209851,228184,247691,268421,290424,313751,338454,364586,392201,421354,452101,484499,518606,554481,592184,631776,673319,716876,762511,810289,860276,912539,967146,1024166,1083669,1145726,1210409,1277791,1347946,1420949,1496876,1575804,1657811,1742976,1831379,1923101,2018224,2116831,2219006,2324834,2434401,2547794,2665101,2786411,2911814,3041401,3175264,3313496,3456191,3603444,3755351,3912009,4073516,4239971,4411474,4588126,4770029,4957286,5150001,5348279,5552226,5761949,5977556,6199156,6426859,6660776,6901019,7147701,7400936,7660839,7927526,8201114,8481721,8769466,9064469,9366851,9676734,9994241,10319496,10652624,10993751,11343004,11700511,12066401,12440804,12823851,13215674,13616406,14026181,14445134,14873401,15311119,15758426,16215461,16682364,17159276,17646339,18143696,18651491,19169869,19698976,20238959,20789966,21352146,21925649,22510626,23107229,23715611,24335926,24968329,25612976,26270024,26939631,27621956,28317159,29025401,29746844,30481651,31229986,31992014,32767901,33557814,34361921,35180391,36013394,36861101,37723684,38601316,39494171,40402424,41326251,42265829,43221336,44192951,45180854,46185226,47206249,48244106,49298981,50371059,51460526,52567569,53692376,54835136,55996039,57175276,58373039,59589521,60824916,62079419,63353226,64646534,65959541,67292446,68645449,70018751,71412554,72827061,74262476,75719004,77196851,78696224,80217331,81760381,83325584,84913151,86523294,88156226,89812161,91491314,93193901,94920139,96670246,98444441,100242944,102065976,103913759,105786516,107684471,109607849,111556876,113531779,115532786,117560126,119614029,121694726,123802449,125937431,128099906,130290109,132508276,134754644,137029451,139332936,141665339,144026901,146417864,148838471,151288966,153769594,156280601,158822234,161394741,163998371,166633374
mov $1,$0
mov $2,2
mov $3,2
lpb $0,1
sub $0,1
add $3,$1
add $2,$3
add $4,1
add $1,$4
sub $1,1
lpe
add $0,$2
add $0,4
mov $1,9
add $1,$0
sub $1,14
|
source/oasis/program-element_vectors.adb | reznikmm/gela | 0 | 15345 | -- SPDX-FileCopyrightText: 2019-2021 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Element_Vectors is
procedure Skip_Elements
(Self : Iterator;
Pos : in out Element_Cursor;
Step : Integer);
-- Find a good Element starting from Pos.Index and set other fields of Pos
package Single is
type Iterator is new Iterators.Forward_Iterator with record
Element : Program.Elements.Element_Access;
end record;
overriding function First (Self : Iterator) return Element_Cursor;
overriding function Next
(Self : Iterator;
Pos : Element_Cursor) return Element_Cursor;
end Single;
package body Single is
overriding function First (Self : Iterator) return Element_Cursor is
begin
return (Self.Element, null, 1, Is_Last => True);
end First;
overriding function Next
(Self : Iterator;
Pos : Element_Cursor) return Element_Cursor
is
pragma Unreferenced (Self);
begin
if Pos.Index = 1 then
return (null, null, 0, False);
else
return Pos;
end if;
end Next;
end Single;
package Two is
type Iterator is new Iterators.Forward_Iterator with record
Left, Right : Program.Elements.Element_Access;
Delimiter : Program.Lexical_Elements.Lexical_Element_Access;
end record;
overriding function First (Self : Iterator) return Element_Cursor;
overriding function Next
(Self : Iterator;
Pos : Element_Cursor) return Element_Cursor;
end Two;
package body Two is
overriding function First (Self : Iterator) return Element_Cursor is
begin
return (Self.Left, Self.Delimiter, 1, Is_Last => False);
end First;
overriding function Next
(Self : Iterator;
Pos : Element_Cursor) return Element_Cursor is
begin
if Pos.Index = 2 then
return (null, null, 0, False);
elsif Pos.Index = 1 then
return (Self.Right, null, 2, Is_Last => True);
else
return Pos;
end if;
end Next;
end Two;
------------------
-- Each_Element --
------------------
function Each_Element
(Self : access Element_Vector'Class;
Filter : Element_Checker := null) return Iterator is
begin
return (Vector => Self, Condition => Filter);
end Each_Element;
-----------
-- First --
-----------
overriding function First
(Self : Iterator) return Program.Element_Vectors.Element_Cursor is
begin
return Result : Element_Cursor := (Index => 1, others => <>) do
Self.Skip_Elements (Result, Step => 1);
end return;
end First;
----------
-- Last --
----------
overriding function Last
(Self : Iterator) return Program.Element_Vectors.Element_Cursor is
begin
return Result : Element_Cursor :=
(Index => Self.Vector.Length, others => <>)
do
Self.Skip_Elements (Result, Step => -1);
end return;
end Last;
----------
-- Next --
----------
overriding function Next
(Self : Iterator;
Cursor : Program.Element_Vectors.Element_Cursor)
return Program.Element_Vectors.Element_Cursor is
begin
return Result : Element_Cursor := Cursor do
Result.Index := Result.Index + 1;
Self.Skip_Elements (Result, Step => 1);
end return;
end Next;
--------------
-- Previous --
--------------
overriding function Previous
(Self : Iterator;
Cursor : Program.Element_Vectors.Element_Cursor)
return Program.Element_Vectors.Element_Cursor is
begin
return Result : Element_Cursor := Cursor do
Result.Index := Result.Index - 1;
Self.Skip_Elements (Result, Step => -1);
end return;
end Previous;
--------------------
-- Single_Element --
--------------------
function Single_Element
(Element : Program.Elements.Element_Access)
return Iterators.Forward_Iterator'Class
is
begin
return Single.Iterator'(Element => Element);
end Single_Element;
-------------------
-- Skip_Elements --
-------------------
procedure Skip_Elements
(Self : Iterator;
Pos : in out Element_Cursor;
Step : Integer) is
begin
while Pos.Index in 1 .. Self.Vector.Length
and then Self.Condition /= null
and then not Self.Condition (Self.Vector.Element (Pos.Index))
loop
Pos.Index := Pos.Index + Step;
end loop;
if Pos.Index in 1 .. Self.Vector.Length then
Pos := (Self.Vector.Element (Pos.Index),
Self.Vector.Delimiter (Pos.Index),
Pos.Index,
Pos.Index = Self.Vector.Length);
else
Pos := (null, null, 0, False);
end if;
end Skip_Elements;
------------------
-- Two_Elements --
------------------
function Two_Elements
(Left, Right : Program.Elements.Element_Access)
return Iterators.Forward_Iterator'Class
is
begin
return Two.Iterator'(Left, Right, null);
end Two_Elements;
end Program.Element_Vectors;
|
tools-src/gnu/gcc/gcc/ada/a-exctra.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 8575 | <reponame>enfoTek/tomato.linksys.e2000.nvram-mod<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . E X C E P T I O N S . T R A C E B A C K --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1999-2001 Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package is part of the support for tracebacks on exceptions. It is
-- used ONLY from GNAT.Traceback.Symbolic and is provided to get access to
-- the tracebacks in an exception occurrence. It may not be used directly
-- from the Ada hierarchy (since it references GNAT.Traceback).
with GNAT.Traceback;
package Ada.Exceptions.Traceback is
function Tracebacks
(E : Exception_Occurrence)
return GNAT.Traceback.Tracebacks_Array;
-- This function extracts the traceback information from an exception
-- occurrence, and returns it formatted in the manner required for
-- processing in GNAT.Traceback. See g-traceb.ads for details.
end Ada.Exceptions.Traceback;
|
engine/pokemon/caught_data.asm | Trap-Master/spacworld97-thingy | 0 | 102673 | <filename>engine/pokemon/caught_data.asm
CheckPartyFullAfterContest:
ld a, [wContestMon]
and a
jp z, .DidntCatchAnything
ld [wCurPartySpecies], a
ld [wCurSpecies], a
call GetBaseData
ld hl, wPartyCount
ld a, [hl]
cp PARTY_LENGTH
jp nc, .TryAddToBox
inc a
ld [hl], a
ld c, a
ld b, 0
add hl, bc
ld a, [wContestMon]
ld [hli], a
ld [wCurSpecies], a
ld a, -1
ld [hl], a
ld hl, wPartyMon1Species
ld a, [wPartyCount]
dec a
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld d, h
ld e, l
ld hl, wContestMon
ld bc, PARTYMON_STRUCT_LENGTH
call CopyBytes
ld a, [wPartyCount]
dec a
ld hl, wPartyMonOT
call SkipNames
ld d, h
ld e, l
ld hl, wPlayerName
call CopyBytes
ld a, [wCurPartySpecies]
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
ld de, wMonOrItemNameBuffer
ld bc, MON_NAME_LENGTH
call CopyBytes
call GiveANickname_YesNo
jr c, .Party_SkipNickname
ld a, [wPartyCount]
dec a
ld [wCurPartyMon], a
xor a
ld [wMonType], a
ld de, wMonOrItemNameBuffer
callfar InitNickname
.Party_SkipNickname:
ld a, [wPartyCount]
dec a
ld hl, wPartyMonNicknames
call SkipNames
ld d, h
ld e, l
ld hl, wMonOrItemNameBuffer
call CopyBytes
ld a, [wPartyCount]
dec a
ld hl, wPartyMon1Level
call GetPartyLocation
ld a, [hl]
ld [wCurPartyLevel], a
call SetCaughtData
ld a, [wPartyCount]
dec a
ld hl, wPartyMon1CaughtLocation
call GetPartyLocation
ld a, [hl]
and CAUGHT_GENDER_MASK
ld b, ROUTE_101
or b
ld [hl], a
xor a
ld [wContestMon], a
and a ; BUGCONTEST_CAUGHT_MON
ld [wScriptVar], a
ret
.TryAddToBox:
ld a, BANK(sBoxCount)
call GetSRAMBank
ld hl, sBoxCount
ld a, [hl]
cp MONS_PER_BOX
call CloseSRAM
jr nc, .BoxFull
xor a
ld [wCurPartyMon], a
ld hl, wContestMon
ld de, wBufferMon
ld bc, BOXMON_STRUCT_LENGTH
call CopyBytes
ld hl, wPlayerName
ld de, wBufferMonOT
ld bc, NAME_LENGTH
call CopyBytes
callfar InsertPokemonIntoBox
ld a, [wCurPartySpecies]
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
call GiveANickname_YesNo
ld hl, wStringBuffer1
jr c, .Box_SkipNickname
ld a, BOXMON
ld [wMonType], a
ld de, wMonOrItemNameBuffer
callfar InitNickname
ld hl, wMonOrItemNameBuffer
.Box_SkipNickname:
ld a, BANK(sBoxMonNicknames)
call GetSRAMBank
ld de, sBoxMonNicknames
ld bc, MON_NAME_LENGTH
call CopyBytes
call CloseSRAM
.BoxFull:
ld a, BANK(sBoxMon1Level)
call GetSRAMBank
ld a, [sBoxMon1Level]
ld [wCurPartyLevel], a
call CloseSRAM
call SetBoxMonCaughtData
ld a, BANK(sBoxMon1CaughtLocation)
call GetSRAMBank
ld hl, sBoxMon1CaughtLocation
ld a, [hl]
and CAUGHT_GENDER_MASK
ld b, ROUTE_101
or b
ld [hl], a
call CloseSRAM
xor a
ld [wContestMon], a
ld a, BUGCONTEST_BOXED_MON
ld [wScriptVar], a
ret
.DidntCatchAnything:
ld a, BUGCONTEST_NO_CATCH
ld [wScriptVar], a
ret
GiveANickname_YesNo:
ld hl, TextJump_GiveANickname
call PrintText
jp YesNoBox
TextJump_GiveANickname:
; Give a nickname to the @ you received?
text_far UnknownText_0x1c12fc
text_end
SetCaughtData:
ld a, [wPartyCount]
dec a
ld hl, wPartyMon1CaughtLevel
call GetPartyLocation
SetBoxmonOrEggmonCaughtData:
ld a, [wTimeOfDay]
inc a
rrca
rrca
ld b, a
ld a, [wCurPartyLevel]
or b
ld [hli], a
ld a, [wMapGroup]
ld b, a
ld a, [wMapNumber]
ld c, a
cp MAP_POKECENTER_2F
jr nz, .NotPokecenter2F
ld a, b
cp GROUP_POKECENTER_2F
jr nz, .NotPokecenter2F
ld a, [wBackupMapGroup]
ld b, a
ld a, [wBackupMapNumber]
ld c, a
.NotPokecenter2F:
call GetWorldMapLocation
ld b, a
ld a, [wPlayerGender]
rrca ; shift bit 0 (PLAYERGENDER_FEMALE_F) to bit 7 (CAUGHT_GENDER_MASK)
or b
ld [hl], a
ret
SetBoxMonCaughtData:
ld a, BANK(sBoxMon1CaughtLevel)
call GetSRAMBank
ld hl, sBoxMon1CaughtLevel
call SetBoxmonOrEggmonCaughtData
call CloseSRAM
ret
SetGiftBoxMonCaughtData:
push bc
ld a, BANK(sBoxMon1CaughtLevel)
call GetSRAMBank
ld hl, sBoxMon1CaughtLevel
pop bc
call SetGiftMonCaughtData
call CloseSRAM
ret
SetGiftPartyMonCaughtData:
ld a, [wPartyCount]
dec a
ld hl, wPartyMon1CaughtLevel
push bc
call GetPartyLocation
pop bc
SetGiftMonCaughtData:
xor a
ld [hli], a
ld a, GIFT_LOCATION
rrc b
or b
ld [hl], a
ret
SetEggMonCaughtData:
ld a, [wCurPartyMon]
ld hl, wPartyMon1CaughtLevel
call GetPartyLocation
ld a, [wCurPartyLevel]
push af
ld a, CAUGHT_EGG_LEVEL
ld [wCurPartyLevel], a
call SetBoxmonOrEggmonCaughtData
pop af
ld [wCurPartyLevel], a
ret
|
libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_fzx_tty_z88dk/zx_01_output_fzx_tty_z88dk_15_background_attr.asm | jpoikela/z88dk | 640 | 29143 |
SECTION code_driver
SECTION code_driver_terminal_output
PUBLIC zx_01_output_fzx_tty_z88dk_15_background_attr
zx_01_output_fzx_tty_z88dk_15_background_attr:
; change background colour
; de = parameters *
ld a,(de)
ld (ix+54),a
ret
|
oeis/002/A002548.asm | neoneye/loda-programs | 11 | 242420 | ; A002548: Denominators of coefficients for numerical differentiation.
; Submitted by <NAME>
; 1,1,12,6,180,10,560,1260,12600,1260,166320,13860,2522520,2702700,2882880,360360,110270160,2042040,775975200,162954792,56904848,2586584,1427794368,892371480,116008292400,120470149800,1124388064800,40156716600,34936343442000,1164544781400,1155228423148800,2382658622744400,223169127199200,229732925058000,236296722916800,6563797858800,9228699789472800,9471560310248400,9714420831024000,242860520775600,418205816775583200,1422468764542800,2691310902514977600,30277247653293498000,30950075378922242400
add $0,1
mov $2,1
mov $3,$0
add $0,1
lpb $3
mul $1,$3
mul $1,$0
mov $4,$3
add $4,1
mul $2,$4
add $1,$2
mul $2,$0
sub $3,1
lpe
mul $4,$2
gcd $2,$1
mov $1,$4
div $1,$2
mov $0,$1
div $0,4
|
arch/ARM/STM32/driversL5/stm32-hash.ads | morbos/Ada_Drivers_Library | 2 | 21555 | <reponame>morbos/Ada_Drivers_Library
with System;
with STM32.Device; use STM32.Device;
with STM32_SVD; use STM32_SVD;
with STM32_SVD.HASH; use STM32_SVD.HASH;
package STM32.HASH is
HASH : aliased HASH_Peripheral with Import, Volatile, Address => S_NS_Periph (HASH_Base);
type Algorithm_Selection is
(SHA_1,
MD5,
SHA_224,
SHA_256)
with Size => 2;
type Mode_Selection is
(Hash_Mode,
HMAC_Mode);
type Width_Selection is
(Width_32bit,
Width_16bit,
Width_8bit,
Width_1bit);
-- This selection is only taken into account when the INIT bit is set. Changing this
-- bitfield during a computation has no effect.
-- Bit 6 MODE: Mode selection
-- This bit selects the HASH or HMAC mode for the selected algorithm:
-- 0: Hash mode selected
-- 1: HMAC mode selected. LKEY must be set if the key being used is longer than
-- 64 bytes.
-- This selection is only taken into account when the INIT bit is set. Changing this
-- bit during a computation has no effect.
-- Bits 5:4 DATATYPE[1:0]: Data type selection
-- Defines the format of the data entered into the HASH_DIN register:
-- 00: 32-bit data. The data written into HASH_DIN are directly used by the HASH
-- processing, without reordering.
-- 01: 16-bit data, or half-word. The data written into HASH_DIN are considered as
-- two half-words, and are swapped before being used by the HASH processing.
-- 10: 8-bit data, or bytes. The data written into HASH_DIN are considered as four
-- bytes, and are swapped before being used by the HASH processing.
-- 11: bit data, or bit-string. The data written into HASH_DIN are considered as 32
-- bits (1st bit of the string at position 0), and are swapped before being used by the
-- HASH processing (1st bit of the string at position 31).
procedure Enable_Hash;
procedure Init_Hash (Algorithm : Algorithm_Selection;
Mode : Mode_Selection;
Width : Width_Selection);
procedure Feed_Hash (Input : UInt8_Array);
procedure Feed_Hash (Input : UInt16_Array);
procedure Feed_Hash (Input : UInt32_Array);
procedure Finish_Hash;
end STM32.HASH;
|
iod/iou/cknm.asm | olifink/smsqe | 0 | 21620 | <gh_stars>0
; check file name V2.01 1986 <NAME> QJUMP
section iou
xdef iou_cknm
xdef iou_ckdn
xdef iou_ckfn
xdef iou_ckch
xref cv_lctab
include 'dev8_keys_chn'
include 'dev8_keys_err'
;+++
; Check d0 characters (a0) vs (a4)
;
; d0 c s character count
; d1 s character
; d2 s lowercased character
; a0 c s pointer to name 1
; a4 c s pointer to name 2
;
; condition codes Z if match
;---
iou_ckch
moveq #0,d1 ; d1 zero word
bra.s icn_lset
;+++
; Check filename against directory name in channel block
;
; d0 s character count
; d1 s character
; d2 s lowercased character
; a0 c s pointer to channel block
; a4 c s pointer to name
;
; d0 and condition codes Z if match
;---
iou_ckfn
lea chn_name(a0),a0 ; point to name
moveq #0,d1
move.w (a0)+,d0 ; directory name
cmp.w (a4)+,d0 ; file name or longer?
bge.s icn_rtnf ; ... no
cmp.b #'_',(a4,d0.w) ; ... longer, there must be an underscr
beq.s icn_lset ; ... ... yes
icn_rtnf
moveq #err.fdnf,d0
bra.s icn_rts ; ... ... no
;+++
; Check name against filename in channel block
;
; d0 s character count
; d1 s character
; d2 s lowercased character
; a0 c s pointer to channel block
; a4 c s pointer to name
;+++
; Check directory name against filename in channel block
;
; d0 s character count
; d1 s character
; d2 s lowercased character
; a0 c s pointer to channel block
; a4 c s pointer to name
;
; d0 and condition codes Z if match
;---
iou_ckdn
lea chn_name(a0),a0 ; point to name
moveq #0,d1
move.w (a4)+,d0 ; directory name
cmp.w (a0)+,d0 ; the same or longer?
bgt.s icn_rts ; ... no
beq.s icn_lset ; ... the same
cmp.b #'_',(a0,d0.w) ; ... longer, there must be an underscr
beq.s icn_lset ; ... ... yes
bne.s icn_rts ; ... ... no
;+++
; Check name against filename in channel block
;
; d0 s character count
; d1 s character
; d2 s lowercased character
; a0 c s pointer to channel block
; a4 c s pointer to name
;
; d0 and condition codes Z if match
;---
iou_cknm
lea chn_name(a0),a0 ; point to name
moveq #0,d1
move.w (a0)+,d0 ; name length
cmp.w (a4)+,d0 ; the same?
bne.s icn_rts ; ... no
icn_lset
subq.w #1,d0 ; any characters?
blt.s icn_ok
move.l a1,-(sp)
lea cv_lctab,a1
icn_loop
move.b (a4)+,d1
move.b (a1,d1.w),d2 ; first character
move.b (a0)+,d1
sub.b (a1,d1.w),d2 ; same as second?
icn_lend
dbne d0,icn_loop
move.l (sp)+,a1
bne.s icn_rts
icn_ok
moveq #0,d0
icn_rts
rts
end
|
oeis/254/A254377.asm | neoneye/loda-programs | 11 | 242960 | <filename>oeis/254/A254377.asm
; A254377: Characteristic function of A230709: a(n) = 1 if n is either evil (A001969) or even odious (A128309), otherwise 0 (when n is odd odious).
; Submitted by <NAME>(m3)
; 1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1
dif $0,-2
max $0,0
seq $0,120 ; 1's-counting sequence: number of 1's in binary expansion of n (or the binary weight of n).
add $0,1
mod $0,2
|
tis-100/52544_exposure_mask_viewer.asm | glupmjoed/puzzles | 0 | 88817 | <filename>tis-100/52544_exposure_mask_viewer.asm
@0
@1
MOV UP, RIGHT
MOV UP, DOWN
@2
MOV LEFT, DOWN
MOV 5, ACC
SUB LEFT
MOV ACC, DOWN
@3
@4
NB: MOV UP, DOWN
MOV -2, ACC
ADD UP # H
NL: JLZ EB
MOV 1, RIGHT
MOV -2, DOWN
SUB 1
JMP NL
EB: MOV 5, RIGHT
MOV -3, DOWN
@5
NB: MOV UP, DOWN
MOV UP, ACC # 5-W
SAV
NL: JGZ EL
MOV -4, DOWN
ADD 4
JMP NL
EL: SUB 5
MOV ACC, DOWN
JRO LEFT
SWP
SAV
MOV 1, DOWN
JMP NL
EB: MOV 3, DOWN
@6
@7
@8
NB: MOV UP, ACC #Y
NL: MOV ACC, RIGHT
ADD 1
L1: JRO UP
@9
NB: MOV UP, ACC #X
NL: MOV ACC, DOWN
MOV LEFT, DOWN
JMP NP
MOV 3, DOWN
MOV 3, DOWN
MOV 3, DOWN
MOV 3, DOWN
NP: JRO UP
MOV -1, DOWN
JMP NL
MOV -1, DOWN
JMP NB
@10
|
Source/Boot/BootISO9660.asm | Polaritech/Gloss | 2 | 166348 | [org 0x7c00]
[bits 16]
Entry:
jmp 0x0000:Start
times 8-($-$$) db 0
BootTable:
BootTable.PrimaryDescriptor: resd 1
BootTable.BootFileLocation: resd 1
BootTable.BootFileLength: resd 1
BootTable.Checksum: resd 1
BootTable.Reserved: resb 40
%include "AssemblyFunctions/IAPX86/A20/A20.inc"
%include "AssemblyFunctions/IAPX86/CPU/CPU.inc"
%include "AssemblyFunctions/IAPX86/Error/Error.inc"
%include "AssemblyFunctions/IAPX86/IO/IO.inc"
%include "Data/Data.inc"
%include "Data/BSS.inc"
[SECTION .TEXT]
[CPU X64]
GDT:
GDT.Null:
dd 0x00000000
dd 0x00000000
GDT.Code:
dw 0xFFFF
dw 0x0000
db 0x00
db 10011010b
db 11001111b
db 0x00
GDT.Data:
dw 0xFFFF
dw 0x0000
db 0x00
db 10010010b
db 11001111b
db 0x00
GDT.End:
dw GDT.End - GDT - 1
dd GDT
EnableGDT:
cli
pusha
lgdt [GDT.End]
sti
popa
ret
Start:
; We need to initialize our segment registers and the stack so that we
; don't accidentally access the wrong data or code and triple fault.
xor ax, ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov sp, 0x7c00
; Now we zero out the BSS section of our bootloader so that the bootloader
; can store data and access it with a known initial state.
; pusha
; cld
mov cx, (BSS.End - BSS)
mov di, BSS
cld
rep stosb
; popa
; Next we initialize IO for the bootloader and clear the screen of any
; initial input.
call IAPX86.IO.Init
call IAPX86.IO.Clear
; Now we print out the splash information, consisting of the title of the
; project as well as version information and copyright information.
mov si, Data.Message.Init.Splash001
call IAPX86.IO.Print.String
mov si, Data.Message.Init.Splash002
call IAPX86.IO.Print.String
mov si, Data.Message.NewLine
call IAPX86.IO.Print.String
mov si, Data.Message.Init.Splash003
call IAPX86.IO.Print.String
mov si, Data.Message.Init.Splash004
call IAPX86.IO.Print.String
call IAPX86.A20.Enable
call IAPX86.CPU.Check.AMD64
jc Failure
call EnableGDT
; mov ax, 0x4500
; mov dl, [DriveNumber]
; int 0x13
; mov eax, 17
; mov di, 0x4000
; LoadBRVD:
; call IAPX86.Storage.CD.LoadSector
; cmp byte [di], 0x00
; je FoundBRVD
; inc eax
; cmp byte [di], 255
; je Failure
; cmp eax, 32+17
; jb LoadBRVD
; FoundBRVD:
; cmp byte [di+0x001], 'C'
; jne Failure
; cmp dword [di+0x002], 'D001'
; jne Failure
; cmp byte [di+0x007], 'E'
; jne Failure
; cmp dword [di+0x008], 'L TO'
; jne Failure
; cmp dword [di+0x00C], 'RITO'
; jne Failure
; cmp dword [di+0x010], ' SPE'
; jne Failure
; cmp dword [di+0x014], 'CIFI'
; jne Failure
; cmp dword [di+0x018], 'CATI'
; jne Failure
; cmp word [di+0x01C], 'ON'
; jne Failure
; mov eax, [di+0x47]
; call IAPX86.Storage.CD.LoadSector
; lea bp, [di+2048]
; ; cmp word [di], 0x0001
; ; jne Failure
; ; cmp word [di+0x01E], 0xAA55
; ; jne Failure
cli
mov eax, cr0
or al, 1
mov cr0, eax
jmp 0x08:PStart
Failure:
mov eax, 0x000b8000
mov [eax], word 0x4e4e
cli
hlt
[bits 32]
PStart:
mov ax, 0x10
mov ds, ax
;mov es, ax
;mov fs, ax
;mov gs, ax
;mov ss, ax
;mov esp, 0x9000
; mov eax, 0x000b8000
; mov ebx, 0xdeadbeef
; mov [eax], word 0x3f3f
mov edi, 0x1000
mov cr3, edi
xor eax, eax
mov ecx, 4096
rep stosd
mov edi, cr3
mov dword [edi], 0x2003
add edi, 0x1000
mov dword [edi], 0x3003
add edi, 0x1000
mov dword [edi], 0x4003
add edi, 0x1000
mov ebx, 0x00000003
mov ecx, 512
SetEntry:
mov dword [edi], ebx
add ebx, 0x1000
add edi, 8
loop SetEntry
mov eax, cr4
or eax, 1 << 5
mov cr4, eax
mov ecx, 0xC0000080
rdmsr
or eax, 1 << 8
wrmsr
mov eax, cr0
or eax, 1 << 31
mov cr0, eax
lgdt [GDT64.Pointer]
jmp GDT64.Code:LStart
cli
hlt
GDT64:
GDT64.Null: equ $ - GDT64
dw 0x0000
dw 0x0000
db 0x00
db 0x00
db 0x00
db 0x00
GDT64.Code: equ $ - GDT64
dw 0x0000
dw 0x0000
db 0x00
db 10011010b
db 00100000b
db 0x00
GDT64.Data: equ $ - GDT64
dw 0x0000
dw 0x0000
db 0x00
db 10010010b
db 00000000b
db 0x00
GDT64.Pointer:
dw $ - GDT64 - 1
dq GDT64
[BITS 64]
LStart:
cli
mov ax, GDT64.Data
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
; mov edi, 0xb8000
; mov rax, 0x1f201f201f201f20
; mov ecx, 500
; rep stosq
LHalt:
hlt
jmp LHalt
; ; Check for 64-Bit capable CPU
; pushfd
; pop eax
; mov ecx, eax
; xor eax, 0x200000
; push eax
; popfd
; pushfd
; pop eax
; xor eax, ecx
; shr eax, 0x15
; and eax, 0x01
; push ecx
; popfd
; test eax, eax
; jz Failure
; mov eax, 0x80000000
; cpuid
; cmp eax, 0x80000001
; jb Failure
; mov eax, 0x80000001
; cpuid
; test edx, 1 << 29
; jz Failure
; mov edi, 0x1000
; mov cr3, edi
; mov ecx, 0x1000
; xor eax, eax
; cld
; rep stosd
; mov edi, cr3
; mov dword [edi], 0x2003
; add edi, 0x1000
; mov dword [edi], 0x3003
; add edi, 0x1000
; mov dword [edi], 0x4003
; add edi, 0x1000
; mov ebx, 0x00000003
; mov ecx, 0x00000200
; LoopPages:
; mov dword [edi], ebx
; add ebx, 0x1000
; add edi, 8
; loop LoopPages
; mov al, 0xFF
; out 0xA1, al
; out 0x21, al
; nop
; nop
; lidt [IDT]
; mov eax, cr4
; or eax, 1 << 5
; mov cr4, eax
; mov ecx, 0xC0000080
; rdmsr
; or eax, 0x00000100
; wrmsr
; mov eax, cr0
; or ebx, 0x80000001
; mov cr0, eax
; lgdt [GDT.Ptr]
; jmp 0x0008:LongStart
; Failure:
; mov eax, [0xb8000]
; mov [eax], word 0x3f3f
; cli
; hlt
; jmp Failure
; IDT:
; .Length: dw 0
; .Base dd 0
; GDT:
; GDT.Null:
; dq 0x0000000000000000
; GDT.Code:
; dq 0x00209A0000000000
; GDT.Data:
; dq 0x0000920000000000
; GDT.Ptr:
; dw $ - GDT - 1
; dd GDT
; [bits 64]
; LongStart:
; mov ax, 0x0010
; mov ds, ax
; mov es, ax
; mov fs, ax
; mov gs, ax
; mov ss, ax
; mov rax, 0xB8000
; mov [rax], word 0x3f3f
; mov edi, 0xB8000
; mov rcx, 500
; mov rax, 0x1F201f201f201f20
; rep stosq
; LongHalt:
; hlt
; jmp LongHalt |
08/1/src/main.adb | Heziode/aoc-ada-2021 | 3 | 25126 | <reponame>Heziode/aoc-ada-2021
with Ada.Exceptions,
Ada.Integer_Text_IO,
Ada.Text_IO;
with Utils;
procedure Main is
use Ada.Text_IO;
use Utils;
File : File_Type;
Result : Natural := Natural'First;
begin
Get_File (File);
if End_Of_File (File) then
raise Program_Error with "Empty file";
end if;
-- Resolve puzzle while exploring file
while not End_Of_File (File) loop
declare
use Ada.Integer_Text_IO;
Line : constant String := Get_Line (File);
First : Positive := Line'First;
Last : Positive := Line'First;
Last_Index : Positive := Line'First;
After_Pipe : Boolean := False;
Current_Size : Natural := Natural'First;
begin
while Last <= Line'Last loop
if After_Pipe then
-- Process data
if Line (Last) = ' ' then
Current_Size := Last - First;
First := Last + 1;
if Current_Size in 2 .. 4 or Current_Size = 7 then
Result := Result + 1;
end if;
elsif Last = Line'Last then
Current_Size := Last - First + 1;
First := Last + 1;
if Current_Size in 2 .. 4 or Current_Size = 7 then
Result := Result + 1;
end if;
end if;
Last := Last + 1;
elsif Line (Last) = '|' then
After_Pipe := True;
Last := Last + 2;
First := Last;
else
Last := Last + 1;
end if;
end loop;
end;
end loop;
Put ("Result: ");
Ada.Integer_Text_IO.Put (Result, Width => 0);
New_Line;
Close_If_Open (File);
exception
when Occur : others =>
Close_If_Open (File);
raise;
end Main;
|
programs/oeis/316/A316708.asm | neoneye/loda | 22 | 105334 | ; A316708: Bisection of the odd-indexed Pell numbers A001653: part 1.
; 1,29,985,33461,1136689,38613965,1311738121,44560482149,1513744654945,51422757785981,1746860020068409,59341817924539925,2015874949414289041,68480406462161287469,2326317944764069484905,79026329715516201199301,2684568892382786771291329,91196316011299234022705885,3097990175491791170000708761,105240469650709600546001391989
mul $0,2
mov $1,1
mov $2,1
lpb $0
sub $0,1
add $2,$1
add $1,$2
add $1,$2
add $2,$1
lpe
mov $0,$1
|
src/stars.asm | IGJoshua/assembly-sandbox | 1 | 242776 | <reponame>IGJoshua/assembly-sandbox
;;; stars.asm
;;; Taken from the nasm tutorial https://cs.lmu.edu/~ray/notes/nasmtutorial/
; ----------------------------------------------------------------------------------------
; Adapted from an OSX console program that writes a little triangle of asterisks
; to standard output. Runs on macOS only.
;
; nasm -fmacho64 triangle.asm && gcc hola.o && ./a.out
; ----------------------------------------------------------------------------------------
global _start
section .text
_start:
mov rdx, output ; rdx holds address of the next byte to write
mov r8, 1 ; initial line length
mov r9, 0 ; number of stars written so far
line:
mov byte [rdx], '*' ; write a single star
inc rdx ; advance pointer to the next cell to write
inc r9 ; we've written one more star
cmp r9, r8 ; check if we've gotten to the correct number of stars
jne line ; jump if we need to write more
lineDone:
mov byte [rdx], 10 ; write a newline
inc rdx ; advance the pointer
inc r8 ; next line will be a char longer
mov r9, 0 ; we've not written any stars in the next line yet
cmp r8, maxlines ; check if we've finished the last line
jng line ; if not, write the next line
done:
mov rax, 1 ; write syscall
mov rdi, 1 ; write to stdout
mov rsi, output ; write from the output
mov rdx, dataSize ; write the correct number of bytes
syscall ; invoke write()
mov rax, 60 ; exit syscall
mov rdi, 0 ; exit code 0
syscall ; invoke exit()
section .bss
maxlines equ 8
dataSize equ 44
output: resb dataSize
|
tests/tk-grid-test_data-tests.ads | thindil/tashy2 | 2 | 13284 | <filename>tests/tk-grid-test_data-tests.ads
-- 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 Tk.Grid.Test_Data.Tests is
type Test is new GNATtest_Generated.GNATtest_Standard.Tk.Grid.Test_Data
.Test with
null record;
procedure Test_Add_09f411_b5946b(Gnattest_T: in out Test);
-- tk-grid.ads:175:4:Add:Test_Add1
procedure Test_Add_6de79c_257591(Gnattest_T: in out Test);
-- tk-grid.ads:198:4:Add:Test_Add2
procedure Test_Set_Anchor_94c9fb_f07f8d(Gnattest_T: in out Test);
-- tk-grid.ads:223:4:Set_Anchor:Test_Anchor1
procedure Test_Get_Anchor_3fef99_b06609(Gnattest_T: in out Test);
-- tk-grid.ads:245:4:Get_Anchor:Test_Anchor2
procedure Test_Get_Bounding_Box_c2a26c_6b6e30(Gnattest_T: in out Test);
-- tk-grid.ads:280:4:Get_Bounding_Box:Test_Get_BBox
procedure Test_Get_Bounding_Box_154409_8eb716(Gnattest_T: in out Test);
-- tk-grid.ads:308:4:Get_Bounding_Box:Test_Get_BBox2
procedure Test_Get_Bounding_Box_f0c44d_c84870(Gnattest_T: in out Test);
-- tk-grid.ads:333:4:Get_Bounding_Box:Test_Get_BBox3
procedure Test_Column_Configure_b41aca_dcc0a7(Gnattest_T: in out Test);
-- tk-grid.ads:355:4:Column_Configure:Test_Column_Configure1
procedure Test_Column_Configure_dbcaa4_baf62d(Gnattest_T: in out Test);
-- tk-grid.ads:380:4:Column_Configure:Test_Column_Configure2
procedure Test_Column_Configure_86279e_3e25dc(Gnattest_T: in out Test);
-- tk-grid.ads:405:4:Column_Configure:Test_Column_Configure3
procedure Test_Get_Column_Options_22be63_f54751(Gnattest_T: in out Test);
-- tk-grid.ads:428:4:Get_Column_Options:Test_Get_Column_Options
procedure Test_Configure_c67185_4765c0(Gnattest_T: in out Test);
-- tk-grid.ads:450:4:Configure:Test_Configure1
procedure Test_Configure_f31b66_3e2feb(Gnattest_T: in out Test);
-- tk-grid.ads:471:4:Configure:Test_Configure2
procedure Test_Forget_7f8bc2_8fa399(Gnattest_T: in out Test);
-- tk-grid.ads:493:4:Forget:Test_Forget1
procedure Test_Forget_41161d_27199d(Gnattest_T: in out Test);
-- tk-grid.ads:515:4:Forget:Test_Forget2
procedure Test_Get_Info_8760e4_ba34a0(Gnattest_T: in out Test);
-- tk-grid.ads:536:4:Get_Info:Test_Info
procedure Test_Get_Location_3c34d1_74cec4(Gnattest_T: in out Test);
-- tk-grid.ads:560:4:Get_Location:Test_Location
procedure Test_Set_Propagate_38a3d0_e08f8c(Gnattest_T: in out Test);
-- tk-grid.ads:582:4:Set_Propagate:Test_Propagate1
procedure Test_Get_Propagate_b85f28_142129(Gnattest_T: in out Test);
-- tk-grid.ads:605:4:Get_Propagate:Test_Propagate2
procedure Test_Row_Configure_cd10c1_55f5f1(Gnattest_T: in out Test);
-- tk-grid.ads:631:4:Row_Configure:Test_Row_Configure1
procedure Test_Row_Configure_0a2e60_353acd(Gnattest_T: in out Test);
-- tk-grid.ads:656:4:Row_Configure:Test_Row_Configure2
procedure Test_Row_Configure_7261aa_f7627e(Gnattest_T: in out Test);
-- tk-grid.ads:681:4:Row_Configure:Test_Row_Configure3
procedure Test_Get_Row_Options_192829_8edf28(Gnattest_T: in out Test);
-- tk-grid.ads:704:4:Get_Row_Options:Test_Get_Row_Options
procedure Test_Remove_cf1782_4cc907(Gnattest_T: in out Test);
-- tk-grid.ads:729:4:Remove:Test_Remove1
procedure Test_Remove_4f07d4_13d0b1(Gnattest_T: in out Test);
-- tk-grid.ads:753:4:Remove:Test_Remove2
procedure Test_Get_Size_fbc383_a60758(Gnattest_T: in out Test);
-- tk-grid.ads:774:4:Get_Size:Test_Size
procedure Test_Get_Slaves_6dfdb7_8c1fbf(Gnattest_T: in out Test);
-- tk-grid.ads:798:4:Get_Slaves:Test_Slaves
end Tk.Grid.Test_Data.Tests;
-- end read only
|
oeis/211/A211719.asm | neoneye/loda-programs | 11 | 92367 | <gh_stars>10-100
; A211719: Number of (n+1) X (n+1) -11..11 symmetric matrices with every 2 X 2 subblock having sum zero.
; Submitted by <NAME>
; 265,3059,35377,409883,4757545,55318979,644340577,7517728043,87854788825,1028320041299,12054528824977,141515917523003,1663668298132105,19584269744002019,230833988758608577,2724058135239730763,32183250594377475385,380639089819037473139,4506509987380035131377,53405369853627861567323,633464188299276178706665,7520167510204474383366659,89346579879198455228153377,1062309225874573851643128683,12639363651061002497675713945,150480546158959309029648434579,1792656559716011777988719754577
add $0,2
mov $1,11
pow $1,$0
mov $2,12
pow $2,$0
add $2,$1
mov $0,$2
|
agda-stdlib-0.9/src/Data/Star/Fin.agda | qwe2/try-agda | 1 | 12299 | <filename>agda-stdlib-0.9/src/Data/Star/Fin.agda
------------------------------------------------------------------------
-- The Agda standard library
--
-- Finite sets defined in terms of Data.Star
------------------------------------------------------------------------
module Data.Star.Fin where
open import Data.Star
open import Data.Star.Nat as ℕ using (ℕ)
open import Data.Star.Pointer
open import Data.Unit
-- Finite sets are undecorated pointers into natural numbers.
Fin : ℕ → Set
Fin = Any (λ _ → ⊤) (λ _ → ⊤)
-- "Constructors".
zero : ∀ {n} → Fin (ℕ.suc n)
zero = this tt
suc : ∀ {n} → Fin n → Fin (ℕ.suc n)
suc = that tt
|
Projetos/F-Assembly/src/nasm/examples/quadrado.nasm | juanjorgegarcia/Z01 | 0 | 24264 | <gh_stars>0
; carrega x"FF" em S (todos pxs em '1')
leaw $0, %A
movw %A, %S
notw %S
; linha 1
leaw $17389, %A ;16384
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17409, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17429, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17449, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17469, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17489, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17509, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17529, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17549, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17569, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17589, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17609, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17629, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17649, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17669, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17689, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17709, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17729, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17749, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17769, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17789, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17809, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17829, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17849, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17869, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17889, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17909, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17929, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17949, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17969, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $17989, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $18009, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
leaw $18029, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
|
tnt/tnt.g4 | ChristianWulf/grammars-v4 | 0 | 5660 | /*
[The "BSD licence"]
Copyright (c) 2013 <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* <p>http://en.wikipedia.org/wiki/Typographical_Number_Theory</p>
*/
grammar tnt;
equation
: expression '=' expression
;
atom
: number
| variable
;
number
: SUCCESSOR* ZERO
;
variable
: SUCCESSOR* (A | B | C | D | E) PRIME*
;
expression
: atom
| expression '+' expression
| expression '*' expression
| '(' expression ')'
| '~' expression
| forevery expression
| exists expression
;
forevery
: FOREVERY variable ':'
;
exists
: EXISTS variable ':'
;
ZERO
: '0'
;
SUCCESSOR
: 'S'
;
A
: 'a'
;
B
: 'b'
;
C
: 'c'
;
D
: 'd'
;
E
: 'e'
;
PRIME
: '\''
;
FOREVERY
: 'A'
;
EXISTS
: 'E'
;
WS
: [ \r\t\n] -> skip
;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.