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
ANTLRTestProjects/antbased/GlobalActions/grammar/GlobalParserActions1.g4
timboudreau/ANTLR4-Plugins-for-NetBeans
1
4986
parser grammar GlobalParserActions1; options { tokenVocab=GlobalLexerActions1; } @parser::header { /** * this is a Javadoc comment that will be added in the header of Java generated * class. */ } @parser::members { protected int anAttributeAddedToParser = 0; public int getAnAttributeAddedToParser() { return anAttributeAddedToParser; } } rule1 : T;
source/adam-assist.ads
charlie5/aIDE
3
17598
package AdaM.Assist is function Tail_of (the_full_Name : in Identifier) return Identifier; function strip_Tail_of (the_full_Name : in Identifier) return Identifier; function type_button_Name_of (the_full_Name : in Identifier) return String; -- function Split (the_Text : in String) return text_Lines; function identifier_Suffix (Id : in Identifier; Count : in Positive) return Identifier; function strip_standard_Prefix (Id : in Identifier) return Identifier; function parent_Name (Id : in Identifier) return Identifier; function simple_Name (Id : in Identifier) return Identifier; function Split (Id : in Identifier) return text_Lines; end AdaM.Assist;
include/constant.asm
Hiroshi123/bin_tools
0
8630
;;; eflags carry flag %define eflags_cf 0x0001 ;;; eflags parity flag %define eflags_pf 0x0004 ;;; eflags adjust flag %define eflags_af 0x0010 ;;; eflags zero flag %define eflags_zf 0x0040 ;;; eflags sign flag %define eflags_sf 0x0080 ;;; eflags trap flag %define eflags_tf 0x0100 ;;; eflags interrupt enable flag %define eflags_if 0x0200 ;;; eflags direction flag %define eflags_df 0x0400 ;;; eflags overflow flag %define eflags_of 0x0800 ;;; eflags iopl %define eflags_iopl 0x3000 ;;; eflags nested task flag %define eflags_nt 0x4000 ;;; sign flag & overflow flag %define eflags_sof 0x0880 ;;; carry flag & zero flag %define eflags_czf 0x0041 %ifidn __OUTPUT_FORMAT__, macho64 %include "macho_syscall.asm" %elifidn __OUTPUT_FORMAT__, elf64 %define SYS_write 0x1 %define SYS_mmap 9 %define SYS_clone 56 %define SYS_exit 60 %endif ;; unistd.h %define STDIN 0 %define STDOUT 1 %define STDERR 2 ;; sched.h %define CLONE_VM 0x00000100 %define CLONE_FS 0x00000200 %define CLONE_FILES 0x00000400 %define CLONE_SIGHAND 0x00000800 %define CLONE_VFORK 0x00004000 %define CLONE_PARENT 0x00008000 %define CLONE_THREAD 0x00010000 %define CLONE_NEWNS 0x00020000 %define CLONE_SYSVSEM 0x00040000 %define CLONE_SETTLS 0x00080000 %define CLONE_PARENT_SETTID 0x00100000 %define CLONE_CHILD_CLEARTID 0x00200000 %define CLONE_DETACHED 0x00400000 %define CLONE_UNTRACED 0x00800000 %define CLONE_CHILD_SETTID 0x01000000 %define CLONE_NEWCGROUP 0x02000000 %define CLONE_NEWUTS 0x04000000 %define CLONE_NEWIPC 0x08000000 %define CLONE_NEWUSER 0x10000000 %define CLONE_NEWPID 0x20000000 %define CLONE_NEWNET 0x40000000 %define CLONE_IO 0x80000000 ;; sys/mman.h %define MAP_GROWSDOWN 0x0100 %define MAP_ANONYMOUS 0x0020 %define MAP_PRIVATE 0x0002 %define PROT_READ 0x1 %define PROT_WRITE 0x2 %define PROT_EXEC 0x4 %define THREAD_FLAGS \ CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_PARENT|CLONE_THREAD|CLONE_IO %define STACK_SIZE 4096 %define MAX_LINES 1000000 ; number of output lines before exiting ;;; x86 trap and interrupt constants. ;;; Processor-defined: %define T_DIVIDE 0 // divide error %define T_DEBUG 1 // debug exception %define T_NMI 2 // non-maskable interrupt %define T_BRKPT 3 // breakpoint %define T_OFLOW 4 // overflow %define T_BOUND 5 // bounds check %define T_ILLOP 6 // illegal opcode %define T_DEVICE 7 // device not available %define T_DBLFLT 8 // double fault ;;; %define T_COPROC 9 // reserved (not used since 486) %define T_TSS 10 // invalid task switch segment %define T_SEGNP 11 // segment not present %define T_STACK 12 // stack exception %define T_GPFLT 13 // general protection fault %define T_PGFLT 14 // page fault ;;; %define T_RES 15 // reserved %define T_FPERR 16 // floating point error %define T_ALIGN 17 // aligment check %define T_MCHK 18 // machine check %define T_SIMDERR 19 // SIMD floating point error %define T_IRQ0 32 // IRQ 0 corresponds to int T_IRQ %define IRQ_TIMER 0 %define IRQ_KBD 1 %define IRQ_COM1 4 %define IRQ_IDE 14 %define IRQ_ERROR 19 %define IRQ_SPURIOUS 31
source/vampire-r3-index_page.ads
ytomino/vampire
1
17490
-- The Village of Vampire by YT, このソースコードはNYSLです procedure Vampire.R3.Index_Page ( Output : not null access Ada.Streams.Root_Stream_Type'Class; Form : in Forms.Root_Form_Type'Class; Template : in String; HTML_Directory : in String; Summaries : in out Tabula.Villages.Lists.Summary_Maps.Map; Muramura : in Natural; User_Id : in String; User_Password : in String);
libsrc/_DEVELOPMENT/adt/w_vector/c/sdcc_iy/w_vector_back_fastcall.asm
jpoikela/z88dk
640
172957
<gh_stars>100-1000 ; void *w_vector_back_fastcall(b_vector_t *v) SECTION code_clib SECTION code_adt_w_vector PUBLIC _w_vector_back_fastcall EXTERN asm_w_vector_back defc _w_vector_back_fastcall = asm_w_vector_back
dice/src/main/antlr4/org/gnube/dice/generated/DiceNotation.g4
patriot1burke/nemesis-dnd
0
1829
/** * Copyright 2014-2019 the original author or authors * * 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. */ /** * Dice notation grammar. * * This is the notation which RPGs and other tabletop games use to represent operations with dice. */ grammar DiceNotation; options { tokenVocab=DiceNotationLexer; } /** * Rules. */ notation : expression EOF ; expression : left=expression operator=(TIMES | DIV) right=expression | left=expression operator=(PLUS | MINUS) right=expression | LPAREN subExpression=expression RPAREN | uni=(PLUS | MINUS)? value=atom | EOF ; atom : dice | number | variable ; dice : quantity=DIGIT DSEPARATOR sides=DIGIT ((KSEPARATOR keep=DIGIT) | DSEPARATOR drop=DIGIT)? ; number : DIGIT ; variable : VAR ;
agda/Number/Instances/QuoIntFromIntSIP.agda
mchristianl/synthetic-reals
3
10293
{-# OPTIONS --cubical --no-import-sorts #-} module Number.Instances.QuoIntFromIntSIP where open import Agda.Primitive renaming (_⊔_ to ℓ-max; lsuc to ℓ-suc; lzero to ℓ-zero) open import Cubical.Foundations.Everything hiding (⋆) renaming (_⁻¹ to _⁻¹ᵖ; assoc to ∙-assoc) open import Cubical.Foundations.Logic renaming (inl to inlᵖ; inr to inrᵖ) -- open import Cubical.Relation.Nullary.Base renaming (¬_ to ¬ᵗ_) -- open import Cubical.Relation.Binary.Base -- open import Cubical.Data.Sum.Base renaming (_⊎_ to infixr 4 _⊎_) open import Cubical.Data.Sigma.Base renaming (_×_ to infixr 4 _×_) -- open import Cubical.Data.Sigma -- open import Cubical.Data.Bool as Bool using (Bool; not; true; false) -- open import Cubical.Data.Empty renaming (elim to ⊥-elim; ⊥ to ⊥⊥) -- `⊥` and `elim` -- open import Cubical.Foundations.Logic renaming (¬_ to ¬ᵖ_; inl to inlᵖ; inr to inrᵖ) -- open import Function.Base using (it; _∋_; _$_) open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Univalence open import Cubical.HITs.PropositionalTruncation --.Properties open import Cubical.Foundations.SIP -- open import Utils using (!_; !!_) -- open import MoreLogic.Reasoning open import MoreLogic.Definitions -- open import MoreLogic.Properties -- open import MorePropAlgebra.Definitions hiding (_≤''_) -- open import MorePropAlgebra.Structures -- open import MorePropAlgebra.Bundles -- open import MorePropAlgebra.Consequences open import Number.Structures2 open import Number.Bundles2 -- import Agda.Builtin.Int as Builtin -- import Data.Integer.Base as BuiltinBase -- import Data.Integer.Properties as BuiltinProps -- open import Cubical.Data.Nat.Literals -- open import Number.Prelude.Nat -- open import Number.Prelude.Int -- import Cubical.Data.Int as Int -- import Number.Instances.Int -- LinearlyOrderedCommRing ≡ LOCR record LOCRStructure {ℓ ℓ'} (Carrier : Type ℓ) : Type (ℓ-max ℓ (ℓ-suc ℓ')) where constructor locrstructure field 0f 1f : Carrier _+_ : Carrier → Carrier → Carrier -_ : Carrier → Carrier _·_ : Carrier → Carrier → Carrier min max : Carrier → Carrier → Carrier _<_ : hPropRel Carrier Carrier ℓ' is-LOCR : [ isLinearlyOrderedCommRing 0f 1f _+_ _·_ -_ _<_ min max ] LOCRΣ : ∀{ℓ ℓ'} → Type (ℓ-suc (ℓ-max ℓ ℓ')) LOCRΣ {ℓ} {ℓ'} = TypeWithStr {ℓ' = ℓ-max ℓ (ℓ-suc ℓ')} ℓ (LOCRStructure {ℓ} {ℓ'}) record LOCRΣEquiv {ℓ} {ℓ'} (Σ₁ Σ₂ : LOCRΣ {ℓ} {ℓ'}) (Carrier₁≃₂ : fst Σ₁ ≃ fst Σ₂) : Type (ℓ-max ℓ (ℓ-suc ℓ')) where constructor locrΣequiv Carrier₁ = fst Σ₁ Carrier₂ = fst Σ₂ Structure₁ = snd Σ₁ Structure₂ = snd Σ₂ private module ₁ = LOCRStructure Structure₁ module ₂ = LOCRStructure Structure₂ 〚_〛 = equivFun Carrier₁≃₂ field pres0 : 〚 ₁.0f 〛 ≡ ₂.0f pres1 : 〚 ₁.1f 〛 ≡ ₂.1f isHom-- : ∀ y → 〚 ₁.- y 〛 ≡ ₂.- 〚 y 〛 isHom-+ : ∀ x y → 〚 x ₁.+ y 〛 ≡ 〚 x 〛 ₂.+ 〚 y 〛 isHom-· : ∀ x y → 〚 x ₁.· y 〛 ≡ 〚 x 〛 ₂.· 〚 y 〛 isHom-min : ∀ x y → 〚 ₁.min x y 〛 ≡ ₂.min 〚 x 〛 〚 y 〛 isHom-max : ∀ x y → 〚 ₁.max x y 〛 ≡ ₂.max 〚 x 〛 〚 y 〛 isHom-< : ∀ x y → x ₁.< y ≡ 〚 x 〛 ₂.< 〚 y 〛 LOCREquivStr : ∀{ℓ ℓ'} → StrEquiv (LOCRStructure {ℓ} {ℓ'}) (ℓ-max ℓ (ℓ-suc ℓ')) LOCREquivStr Σ₁@(Carrier₁ , Structure₁) Σ₂@(Carrier₂ , Structure₂) Carrier₁≃₂ = LOCRΣEquiv Σ₁ Σ₂ Carrier₁≃₂ LOCRUnivalentStructure : ∀{ℓ ℓ'} → UnivalentStr (LOCRStructure {ℓ} {ℓ'}) LOCREquivStr LOCRUnivalentStructure {A = Σ₁@(Carrier₁ , Structure₁)} {B = Σ₂@(Carrier₂ , Structure₂)} Carrier₁≃₂ = f , φ where Carrier₁≡Carrier₂ : Carrier₁ ≡ Carrier₂ Carrier₁≡Carrier₂ = ua Carrier₁≃₂ module ₁ = LOCRStructure Structure₁ module ₂ = LOCRStructure Structure₂ 〚_〛 = equivFun Carrier₁≃₂ -- {-# DISPLAY equivFun Carrier₁≃₂ x = 〚 x 〛 #-} -- somehow omits its `x` ? -- I guess this is what we have "the machinery" for f : LOCREquivStr Σ₁ Σ₂ Carrier₁≃₂ → PathP (λ i → LOCRStructure (Carrier₁≡Carrier₂ i)) Structure₁ Structure₂ f (locrΣequiv pres0 pres1 isHom-- isHom-+ isHom-· isHom-min isHom-max isHom-<) = {! !} φ : isEquiv f φ .equiv-proof Structure₁≡₂ = {! !} -- R ≃[ LOCREquivStr ] S ≡ Σ _ (LOCRΣEquiv R S) -- LOCRΣPath : ∀{ℓ ℓ'} (R S : LOCRΣ {ℓ} {ℓ'}) → (R ≃[ LOCREquivStr ] S) ≃ (R ≡ S) -- "an equivalence between the two carriers that fulfills the axioms in `LOCRΣEquiv` is equivalent to a path between the two structures" LOCRΣPath* : ∀{ℓ ℓ'} (R S : LOCRΣ {ℓ} {ℓ'}) → Σ _ (LOCRΣEquiv R S) ≃ (R ≡ S) LOCRΣPath* = SIP LOCRUnivalentStructure open import Cubical.Structures.Axioms open import Cubical.Structures.Auto open import Cubical.Foundations.Equiv open import Cubical.Foundations.Equiv.HalfAdjoint -- congIso module _ {ℓ ℓ'} where LOCRRawStructure' = λ(X : Type ℓ) → X × X × (X → X) × (X → X → X) × (X → X → X) × (X → X → X) × (X → X → X) × (X → X → hProp ℓ') LOCRRawEquivStr' = AutoEquivStr LOCRRawStructure' LOCRRawUnivalentStr' : UnivalentStr _ LOCRRawEquivStr' LOCRRawUnivalentStr' = autoUnivalentStr LOCRRawStructure' LOCRAxioms' : (X : Type ℓ) (Structure : LOCRRawStructure' X) → _ LOCRAxioms' X (0f , 1f , -_ , _+_ , _·_ , min , max , _<_) = [ isLinearlyOrderedCommRing 0f 1f _+_ _·_ -_ _<_ min max ] LOCRStructure' = AxiomsStructure LOCRRawStructure' LOCRAxioms' LOCRΣ' = TypeWithStr ℓ LOCRStructure' LOCREquivStr' = AxiomsEquivStr LOCRRawEquivStr' LOCRAxioms' LOCRUnivalentStructure' : UnivalentStr LOCRStructure' LOCREquivStr' LOCRUnivalentStructure' = axiomsUnivalentStr _ γ LOCRRawUnivalentStr' where γ : (X : Type ℓ) (s : LOCRRawStructure' X) → isProp (LOCRAxioms' X s) γ X (0f , 1f , -_ , _+_ , _·_ , min , max , _<_) = isProp[] (isLinearlyOrderedCommRing 0f 1f _+_ _·_ -_ _<_ min max) LOCRΣPath' : (A B : LOCRΣ') → (A ≃[ LOCREquivStr' ] B) ≃ (A ≡ B) LOCRΣPath' = SIP LOCRUnivalentStructure' LOCRΣ→' : LOCRΣ {ℓ} {ℓ'} → LOCRΣ' LOCRΣ→' (X , s) = let open LOCRStructure s in X , (0f , 1f , -_ , _+_ , _·_ , min , max , _<_) , is-LOCR LOCRΣ←' : LOCRΣ' → LOCRΣ {ℓ} {ℓ'} LOCRΣ←' (X , (0f , 1f , -_ , _+_ , _·_ , min , max , _<_) , is-LOCR) = (X , γ) where γ : LOCRStructure {ℓ} {ℓ'} X γ .LOCRStructure.0f = 0f γ .LOCRStructure.1f = 1f γ .LOCRStructure._+_ = _+_ γ .LOCRStructure.-_ = -_ γ .LOCRStructure._·_ = _·_ γ .LOCRStructure.min = min γ .LOCRStructure.max = max γ .LOCRStructure._<_ = _<_ γ .LOCRStructure.is-LOCR = is-LOCR LOCRΣIso : Iso LOCRΣ LOCRΣ' LOCRΣIso = iso LOCRΣ→' LOCRΣ←' (λ _ → refl) (λ _ → refl) LOCRΣEquiv' = λ(A B : LOCRΣ {ℓ} {ℓ'}) → LOCRΣ→' A ≃[ LOCREquivStr' ] LOCRΣ→' B LOCRΣEquivIso : {R S : LOCRΣ} → Iso (Σ _ (LOCRΣEquiv R S)) (LOCRΣEquiv' R S) LOCRΣEquivIso .Iso.fun (Carrier₁≃₂ , locrΣequiv pres0 pres1 isHom-- isHom-+ isHom-· isHom-min isHom-max isHom-<) = (Carrier₁≃₂ , pres0 , pres1 , isHom-- , isHom-+ , isHom-· , isHom-min , isHom-max , isHom-<) LOCRΣEquivIso .Iso.inv (Carrier₁≃₂ , pres0 , pres1 , isHom-- , isHom-+ , isHom-· , isHom-min , isHom-max , isHom-<) = (Carrier₁≃₂ , locrΣequiv pres0 pres1 isHom-- isHom-+ isHom-· isHom-min isHom-max isHom-<) LOCRΣEquivIso .Iso.rightInv _ = refl LOCRΣEquivIso .Iso.leftInv _ = refl -- obtained by SIP-machinery: -- our previously defined LOCRΣEquiv-record is equivalent to a path LOCRΣPath : (R S : LOCRΣ {ℓ} {ℓ'}) → Σ _ (LOCRΣEquiv R S) ≃ (R ≡ S) LOCRΣPath R S = Σ _ (LOCRΣEquiv R S) ≃⟨ isoToEquiv LOCRΣEquivIso ⟩ LOCRΣEquiv' R S ≃⟨ LOCRΣPath' _ _ ⟩ LOCRΣ→' R ≡ LOCRΣ→' S ≃⟨ isoToEquiv (invIso (congIso LOCRΣIso)) ⟩ R ≡ S ■
programs/oeis/157/A157448.asm
karttu/loda
1
244558
; A157448: a(n) = 2048*n^2 - 128*n + 1. ; 1921,7937,18049,32257,50561,72961,99457,130049,164737,203521,246401,293377,344449,399617,458881,522241,589697,661249,736897,816641,900481,988417,1080449,1176577,1276801,1381121,1489537,1602049,1718657,1839361,1964161,2093057,2226049,2363137,2504321,2649601,2798977,2952449,3110017,3271681,3437441,3607297,3781249,3959297,4141441,4327681,4518017,4712449,4910977,5113601,5320321,5531137,5746049,5965057,6188161,6415361,6646657,6882049,7121537,7365121,7612801,7864577,8120449,8380417,8644481,8912641,9184897,9461249,9741697,10026241,10314881,10607617,10904449,11205377,11510401,11819521,12132737,12450049,12771457,13096961,13426561,13760257,14098049,14439937,14785921,15136001,15490177,15848449,16210817,16577281,16947841,17322497,17701249,18084097,18471041,18862081,19257217,19656449,20059777,20467201,20878721,21294337,21714049,22137857,22565761,22997761,23433857,23874049,24318337,24766721,25219201,25675777,26136449,26601217,27070081,27543041,28020097,28501249,28986497,29475841,29969281,30466817,30968449,31474177,31984001,32497921,33015937,33538049,34064257,34594561,35128961,35667457,36210049,36756737,37307521,37862401,38421377,38984449,39551617,40122881,40698241,41277697,41861249,42448897,43040641,43636481,44236417,44840449,45448577,46060801,46677121,47297537,47922049,48550657,49183361,49820161,50461057,51106049,51755137,52408321,53065601,53726977,54392449,55062017,55735681,56413441,57095297,57781249,58471297,59165441,59863681,60566017,61272449,61982977,62697601,63416321,64139137,64866049,65597057,66332161,67071361,67814657,68562049,69313537,70069121,70828801,71592577,72360449,73132417,73908481,74688641,75472897,76261249,77053697,77850241,78650881,79455617,80264449,81077377,81894401,82715521,83540737,84370049,85203457,86040961,86882561,87728257,88578049,89431937,90289921,91152001,92018177,92888449,93762817,94641281,95523841,96410497,97301249,98196097,99095041,99998081,100905217,101816449,102731777,103651201,104574721,105502337,106434049,107369857,108309761,109253761,110201857,111154049,112110337,113070721,114035201,115003777,115976449,116953217,117934081,118919041,119908097,120901249,121898497,122899841,123905281,124914817,125928449,126946177,127968001 mov $1,16 mul $1,$0 add $1,31 mul $1,$0 mul $1,128 add $1,1921
components/src/environment/lps25h-spi.adb
RREE/Ada_Drivers_Library
0
14332
<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- Copyright (C) 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 Ada.Unchecked_Conversion; with Interfaces; package body LPS25H.SPI is use HAL; -- SPI direction and multiplicity masks: 'or' these into the -- register to control the characteristics of the required -- transfer with the LPS25H. Read_Request : constant := 2#1000_0000#; Transfer_Multiples : constant := 2#0100_0000#; -- Utility specs -- generic Register : HAL.UInt8; type Register_Type is private; procedure Write_Register (This : LPS25H_Barometric_Sensor_SPI; Value : Register_Type; Status : out Boolean); procedure Write (This : LPS25H_Barometric_Sensor_SPI; Index : HAL.UInt8; Data : HAL.UInt8; Status : out Boolean); procedure Read (This : LPS25H_Barometric_Sensor_SPI; Index : HAL.UInt8; Data : out HAL.UInt8_Array; Status : out Boolean); procedure Read (This : LPS25H_Barometric_Sensor_SPI; Index : HAL.UInt8; Data : out HAL.UInt8; Status : out Boolean); -------------- -- Get_Data -- -------------- overriding procedure Get_Data (This : in out LPS25H_Barometric_Sensor_SPI; Press : out Pressure; Temp : out Temperature; Asl : out Altitude; Status : out Boolean) is Buf : HAL.UInt8_Array (0 .. 2) := (others => 0); begin -- Pressure declare type Integer_24 is range -(2 ** 23) .. 2 ** 23 - 1 with Size => 24; subtype Buffer_3 is HAL.UInt8_Array (Buf'Range); function Convert is new Ada.Unchecked_Conversion (Buffer_3, Integer_24); begin -- bit 6 => read multiple bytes This.Read (PRESS_OUT_XL or Transfer_Multiples, Buf, Status); if not Status then return; end if; Press := Float (Convert (Buf)) / 4096.0; end; -- Temperature declare subtype Buffer_2 is HAL.UInt8_Array (0 .. 1); function Convert is new Ada.Unchecked_Conversion (Buffer_2, Interfaces.Integer_16); begin -- bit 6 => read multiple bytes This.Read (TEMP_OUT_L or Transfer_Multiples, Buf (0 .. 1), Status); if not Status then return; end if; Temp := 42.5 + Float (Convert (Buf (0 .. 1))) / 480.0; end; -- See Wikipedia, "Barometric formula": The pressure drops -- approximately by 11.3 pascals per meter in first 1000 meters -- above sea level. -- See Wikipedia, "Atmospheric pressure": the standard atmosphere is -- 1013.25 mbar. -- 1 Pascal = 0.01 mbar Asl := (1013.25 - Press) * (100.0 / 11.3); end Get_Data; ---------------- -- Initialize -- ---------------- overriding procedure Initialize (This : in out LPS25H_Barometric_Sensor_SPI) is Data : UInt8; Status : Boolean; begin This.Timing.Delay_Milliseconds (5); -- ? This.Read (WHO_AM_I, Data, Status); if not Status then return; end if; if Data /= WAI_ID then return; end if; declare procedure Write_Ctrl_Reg1 is new Write_Register (CTRL_REG1, Ctrl_Reg1_Register); begin Write_Ctrl_Reg1 (This, (PD => 1, ODR => Hz_25, BDU => 1, others => <>), Status); if not Status then return; end if; end; This.Initialized := True; end Initialize; -- Utilities -- -------------------- -- Write_Register -- -------------------- procedure Write_Register (This : LPS25H_Barometric_Sensor_SPI; Value : Register_Type; Status : out Boolean) is pragma Assert (Register_Type'Size = 8); function Convert is new Ada.Unchecked_Conversion (Register_Type, HAL.UInt8); begin Write (This, Index => Register, Data => Convert (Value), Status => Status); end Write_Register; ----------- -- Write -- ----------- procedure Write (This : LPS25H_Barometric_Sensor_SPI; Index : HAL.UInt8; Data : HAL.UInt8; Status : out Boolean) is Outcome : HAL.SPI.SPI_Status; use all type HAL.SPI.SPI_Status; Buf : constant HAL.SPI.SPI_Data_8b := (Index, Data); begin This.CS.Clear; This.Port.Transmit (Data => Buf, Status => Outcome); Status := Outcome = Ok; This.CS.Set; end Write; ---------- -- Read -- ---------- procedure Read (This : LPS25H_Barometric_Sensor_SPI; Index : HAL.UInt8; Data : out HAL.UInt8_Array; Status : out Boolean) is Outcome : HAL.SPI.SPI_Status; Buf : HAL.SPI.SPI_Data_8b (Data'Range); use all type HAL.SPI.SPI_Status; begin This.CS.Clear; -- bit 7 => read This.Port.Transmit (Data => HAL.SPI.SPI_Data_8b'((1 => Index or Read_Request)), Status => Outcome); Status := Outcome = Ok; if Status then This.Port.Receive (Data => Buf, Status => Outcome); Status := Outcome = Ok; if Status then for J in Buf'Range loop Data (J) := Buf (J); end loop; end if; end if; This.CS.Set; end Read; ---------- -- Read -- ---------- procedure Read (This : LPS25H_Barometric_Sensor_SPI; Index : HAL.UInt8; Data : out HAL.UInt8; Status : out Boolean) is Buf : UInt8_Array (1 .. 1); begin This.Read (Index => Index, Data => Buf, Status => Status); if Status then Data := Buf (1); end if; end Read; end LPS25H.SPI;
data/mapObjects/lavenderhouse1.asm
adhi-thirumala/EvoYellow
16
179763
LavenderHouse1Object: db $a ; border block db $2 ; warps db $7, $2, $2, $ff db $7, $3, $2, $ff db $0 ; signs db $6 ; objects object SPRITE_BLACK_HAIR_BOY_2, $3, $5, STAY, NONE, $1 ; person object SPRITE_LITTLE_GIRL, $6, $3, STAY, DOWN, $2 ; person object SPRITE_SLOWBRO, $6, $4, STAY, UP, $3 ; person object SPRITE_SLOWBRO, $1, $3, STAY, NONE, $4 ; person object SPRITE_MR_FUJI, $3, $1, STAY, NONE, $5 ; person object SPRITE_BOOK_MAP_DEX, $3, $3, STAY, NONE, $6 ; person ; warp-to EVENT_DISP LAVENDER_HOUSE_1_WIDTH, $7, $2 EVENT_DISP LAVENDER_HOUSE_1_WIDTH, $7, $3
src/lithium-line_parsers.adb
faelys/lithium3
1
22286
------------------------------------------------------------------------------ -- Copyright (c) 2015-2017, <NAME> -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ package body Lithium.Line_Parsers is procedure Append_Line (Line : in out Natools.S_Expressions.Atom_Buffers.Atom_Buffer; Source : in out Ada.Streams.Root_Stream_Type'Class; Finished : out Boolean) is Buffer : Ada.Streams.Stream_Element_Array (1 .. 1); Last : Ada.Streams.Stream_Element_Offset; begin Finished := False; loop Source.Read (Buffer, Last); if Last not in Buffer'Range then Finished := True; exit; end if; Line.Append (Buffer (Last)); exit when Buffer (Last) in 10 | 13; end loop; end Append_Line; overriding procedure Read_More (Self : in out Parser; Buffer : out Natools.S_Expressions.Atom_Buffers.Atom_Buffer) is Finished : Boolean; begin Append_Line (Buffer, Self.Source.all, Finished); end Read_More; end Lithium.Line_Parsers;
libsrc/stdio/ansi/px4/f_ansi_scrollup.asm
teknoplop/z88dk
0
86046
<reponame>teknoplop/z88dk<gh_stars>0 ; ; ANSI Video handling for the Epson PX4 ; By <NAME> - Nov 2014 ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.1 2015/11/05 16:08:04 stefano Exp $ ; PUBLIC ansi_SCROLLUP EXTERN ansi_del_line .ansi_SCROLLUP ld hl,8*32 ld de,$e000 add hl,de ld bc,32*8*7 ldir ld a,7 jp ansi_del_line
spec/ics-024-host-requirements/HostRequirements.agda
dogemos/ics
7
12134
<filename>spec/ics-024-host-requirements/HostRequirements.agda module HostRequirements where open import Agda.Builtin.Unit open import Data.String as String using (String) open import Category.Applicative open import Category.Monad open import Category.Monad.State data Path : Set where MkPath : String -> Path data Value : Set where MkValue : String -> Value data Identifier : Set where MkIdentifier : String -> Identifier separator : String separator = "/" data Env : Set where MkEnv : Env {- get : Path -> State Env Value get path = return (MkValue "") set : Path -> Value -> State Env ⊤ set path value = return ⊤ delete : Path -> State Env ⊤ delete path = return ⊤ getConsensusState : State Env ConsensusState getConsensusState = ? getCallingModule : State Env Identifier getCallingModule = return (MkIdentifier "") -}
programs/oeis/070/A070824.asm
neoneye/loda
22
169017
<filename>programs/oeis/070/A070824.asm ; A070824: Number of divisors of n which are > 1 and < n (nontrivial divisors). ; 0,0,0,1,0,2,0,2,1,2,0,4,0,2,2,3,0,4,0,4,2,2,0,6,1,2,2,4,0,6,0,4,2,2,2,7,0,2,2,6,0,6,0,4,4,2,0,8,1,4,2,4,0,6,2,6,2,2,0,10,0,2,4,5,2,6,0,4,2,6,0,10,0,2,4,4,2,6,0,8,3,2,0,10,2,2,2,6,0,10,2,4,2,2,2,10,0,4,4,7 seq $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. trn $0,2
src/LibraBFT/Impl/Consensus/BlockStorage/Properties/BlockStore.agda
LaudateCorpus1/bft-consensus-agda
0
15546
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} open import LibraBFT.Base.Types open import LibraBFT.Concrete.System.Parameters open import LibraBFT.Impl.Consensus.BlockStorage.BlockStore import LibraBFT.Impl.Consensus.BlockStorage.BlockTree as BlockTree open import LibraBFT.Impl.Consensus.ConsensusTypes.Vote as Vote import LibraBFT.Impl.Consensus.PersistentLivenessStorage as PersistentLivenessStorage open import LibraBFT.Impl.OBM.Rust.RustTypes open import LibraBFT.Impl.Properties.Util open import LibraBFT.ImplShared.Base.Types open import LibraBFT.ImplShared.Consensus.Types open import LibraBFT.ImplShared.Consensus.Types.EpochDep open import LibraBFT.ImplShared.Interface.Output open import LibraBFT.ImplShared.Util.Crypto open import LibraBFT.ImplShared.Util.Dijkstra.All open import Optics.All open import Util.ByteString open import Util.Hash open import Util.KVMap as Map open import Util.PKCS open import Util.Prelude open import Yasm.System ℓ-RoundManager ℓ-VSFP ConcSysParms open Invariants open RoundManagerTransProps open QCProps module LibraBFT.Impl.Consensus.BlockStorage.Properties.BlockStore where module new (storage : PersistentLivenessStorage) (initialData : RecoveryData) (stateComp : StateComputer) (maxPrunedBlocksInMem : Usize) where -- TODO-2: May require refinement (additional requirements and/or properties, particularly regarding ECinfo) Contract : ECinfo → EitherD-Post ErrLog BlockStore Contract _ (Left _) = ⊤ Contract eci (Right bs) = BlockStoreInv (bs , eci) postulate contract : ∀ {eci} → Contract eci (new-e-abs storage initialData stateComp maxPrunedBlocksInMem) module executeBlockESpec (bs : BlockStore) (block : Block) where Ok : Set Ok = ∃[ eb ] (executeBlockE bs block ≡ Right eb) record ContractOk (eb : ExecutedBlock) : Set where constructor mkContractOk field ebBlock≡ : block ≡ eb ^∙ ebBlock postulate -- TODO: prove contract : (isOk : Ok) → ContractOk (proj₁ isOk) module executeAndInsertBlockESpec (bs0 : BlockStore) (vblock : ValidBlock) where block = vbBlock vblock block-c = vbValid vblock open executeAndInsertBlockE bs0 block open import LibraBFT.Impl.Consensus.BlockStorage.Properties.BlockTree blockId = block ^∙ bId ------ These are used only outside this module. Ok : Set Ok = ∃₂ λ bs' eb → executeAndInsertBlockE bs0 block ≡ Right (bs' , eb) open Reqs block (bs0 ^∙ bsInner) record ContractOk (bs' : BlockStore) (eb : ExecutedBlock) : Set where constructor mkContractOk field ebBlock≈ : NoHC1 → eb ^∙ ebBlock ≈Block block bsInv : ∀ {eci} → Preserves BlockStoreInv (bs0 , eci) (bs' , eci) -- executeAndInsertBlockE does not modify BlockTree fields other than btIDToBlock bs≡x : bs0 ≡ (bs' & (bsInner ∙ btIdToBlock) ∙~ (bs0 ^∙ bsInner ∙ btIdToBlock)) Contract : EitherD-Post ErrLog (BlockStore × ExecutedBlock) Contract (Left x) = ⊤ Contract (Right (bs' , eb)) = ContractOk bs' eb -- TUTORIAL: This proof has some additional commentary helping to understand the structure of the -- proof, and showing an example of how using abstract variants of functions makes proofs more -- resilient to change, as explained in -- https://github.com/oracle/bft-consensus-agda/blob/main/docs/PeerHandlerContracts.org contract' : EitherD-weakestPre step₀ Contract -- step₀ is a maybeSD in context of EitherD. Therefore, via MonadMaybeD and EitherD-MonadMaybeD, -- this translates to EitherD-maybe. We first deal with the easy case, applying the NoHC1 -- function provided to ebBlock≈ to evidence eb≡ that eb is in btIdToBlock. proj₂ contract' eb eb≡ = mkContractOk (λ nohc → nohc eb≡ block-c) id refl proj₁ contract' getBlock≡nothing = contract₁ where -- step₁ is again a maybeSD; if bs0 ^∙ bsRoot ≡ nothing, the Contract is trivial contract₁ : EitherD-weakestPre step₁ Contract proj₁ contract₁ _ = tt -- otherwise, bs0 ^∙ bsRoot ≡ just bsr, and we have an ifD; in the true branch, step₁ returns a -- Left, so again it is trivial proj₁ (proj₂ contract₁ bsr bsr≡) _ = tt -- in the else branch, we call step₂ bsr proj₂ (proj₂ contract₁ bsr bsr≡) btr<br = contract₂ where contract₃ : ∀ eb → block ≡ (eb ^∙ ebBlock) → EitherD-weakestPre (step₃ eb) Contract module EB = executeBlockESpec bs0 block open EB.ContractOk contract₂ : EitherD-weakestPre (step₂ bsr) Contract proj₂ contract₂ eb eb≡ ._ executeBlockE≡Right@refl = let con = (EB.contract (eb , eb≡)) in contract₃ eb (EB.ContractOk.ebBlock≡ con) proj₁ contract₂ (ErrCBlockNotFound _) executeBlockE≡Left = tt proj₁ contract₂ (ErrVerify _) executeBlockE≡Left = tt proj₁ contract₂ (ErrInfo _) executeBlockE≡Left = tt -- if executeBlockE returns Left (ErrECCBlockNotFound parentBlockId), then we have two casesdue to -- eitherSD (pathFromRoot parentBlockId bs0) LeftD λ blocksToReexecute → -- in the first case, we have a Left, so it's easy proj₁ (proj₁ contract₂ (ErrECCBlockNotFound parentBlockId) executeBlockE≡Left) _ _ = tt -- in the second case, we have -- case⊎D (forM) blocksToReexecute (executeBlockE bs0 ∘ (_^∙ ebBlock)) of λ where -- and therefore two more cases; if the case⊎D returns Left, it's easy again proj₁ (proj₂ (proj₁ contract₂ (ErrECCBlockNotFound parentBlockId) executeBlockE≡Left) blocksToReexecute btr≡) _ _ = tt -- if the case⊎D returns a Right, we call executeBlockE₀ (the EitherD variant). We use executeBlockE≡ to handle case -- analysis on the result of calling the abstract executeBlockE variant, ensuring we must use the contract for -- executeBlockE because the proof cannot "look into" the implementation of executeBlockE, which makes the proof -- more resilient in case of changes in its implementation. -- TODO-2: clean this up by writing a general version of the contract for executeBlockE proj₂ (proj₂ (proj₁ contract₂ (ErrECCBlockNotFound parentBlockId) executeBlockE≡Left) blocksToReexecute btr≡) _ _ with executeBlockE bs0 block | inspect (executeBlockE bs0) block ... | Left x | [ R ] rewrite executeBlockE≡ R = tt ... | Right y | [ R ] rewrite executeBlockE≡ R = λ where c refl ._ refl → let con = EB.contract (c , R) in contract₃ c (ebBlock≡ con) _ refl contract₃ eb refl _ _ = contract₄ where contract₄ : EitherD-weakestPre (step₄ eb) Contract contract₄ with insertBlockESpec.contract eb (bs0 ^∙ bsInner) ...| con with BlockTree.insertBlockE.E eb (bs0 ^∙ bsInner) ...| Left _ = tt ...| Right (bt' , eb') = λ where ._ refl → mkContractOk IBE.blocks≈ btP bss≡x where module IBE = insertBlockESpec.ContractOk con open BlockStoreInv btP : ∀ {eci} → Preserves BlockStoreInv (bs0 , eci) ((bs0 & bsInner ∙~ bt') , eci) btP (mkBlockStoreInv bti) = mkBlockStoreInv (IBE.btiPres bti) bss≡x : bs0 ≡ (bs0 & bsInner ∙~ bt' & bsInner ∙ btIdToBlock ∙~ (bs0 ^∙ (bsInner ∙ btIdToBlock))) bss≡x rewrite sym IBE.bt≡x = refl contract : Contract (executeAndInsertBlockE bs0 block) contract = EitherD-contract (executeAndInsertBlockE.step₀ bs0 block) Contract contract' module executeAndInsertBlockMSpec (vb : ValidBlock) where b = vbBlock vb -- NOTE: This function returns any errors, rather than producing them as output. module _ (pre : RoundManager) where bs = pre ^∙ lBlockStore contract : ∀ Post → (∀ e → {- At the moment we do not need to know why it failed -} Post (Left e) pre []) → ((isOk : executeAndInsertBlockESpec.Ok bs vb) → let (bs' , eb , _) = isOk in executeAndInsertBlockESpec.ContractOk bs vb bs' eb → Post (Right eb) (pre & rmBlockStore ∙~ bs') []) → LBFT-weakestPre (executeAndInsertBlockM b) Post pre proj₁ (contract Post pfBail pfOk ._ refl) e ≡left = pfBail e proj₂ (contract Post pfBail pfOk ._ refl) (bs' , eb) ≡right ._ refl unit refl with executeAndInsertBlockESpec.contract bs vb ...| con rewrite ≡right = pfOk (bs' , eb , refl) con module insertSingleQuorumCertMSpec (qc : QuorumCert) where module _ (pre : RoundManager) where record Contract (r : Either ErrLog Unit) (post : RoundManager) (outs : List Output) : Set where constructor mkContract field -- General invariants / properties rmInv : Preserves RoundManagerInv pre post noEpochChange : NoEpochChange pre post noMsgOuts : OutputProps.NoMsgs outs -- Voting noVote : VoteNotGenerated pre post true -- Signatures qcPost : ∈Post⇒∈PreOr (_≡ qc) pre post postulate -- TODO-2: prove contract' : LBFT-weakestPre (insertSingleQuorumCertM qc) Contract pre contract : ∀ Q → RWS-Post-⇒ Contract Q → LBFT-weakestPre (insertSingleQuorumCertM qc) Q pre contract Q pf = LBFT-⇒ (insertSingleQuorumCertM qc) pre contract' pf module syncInfoMSpec where syncInfo : RoundManager → SyncInfo syncInfo pre = SyncInfo∙new (pre ^∙ lBlockStore ∙ bsHighestQuorumCert) (pre ^∙ lBlockStore ∙ bsHighestCommitCert) (pre ^∙ lBlockStore ∙ bsHighestTimeoutCert) contract : ∀ pre Post → (Post (syncInfo pre) pre []) → LBFT-weakestPre syncInfoM Post pre contract pre Post pf ._ refl ._ refl ._ refl ._ refl ._ refl ._ refl = pf
Serial/Code/ACIA.asm
Gonzo-XIII/Southern-Cross-Computer-z80
11
97792
;--------------------------- ; Southern Cross 6850 Serial ;--------------------------- ; ; <NAME> August 2021 ; Version 1 ; ; SC-Serial Add-on board for Southern Cross Z80 SBC ; using Southern Cross Monitor SCM V1.5 ; ; $2000 blink ; The blink routine at $2000 toggles the RTS output of the 6850, ; connect a high efficiency LED and series 2k2 resistor between RTS and 5V to check that you have ; the board connected properly with the default IO address. ; ; $2030 connect the ACIA to the serial monitor ; substitute the ACIA transmit and receive routines for the bit banged serial routines in the serial monitor. ; ; monitor V1.5 vectors ; PUTCH .EQU $3faa ;output a serial character GETCH .EQU $3fac ;get a serial character RST38 .EQU $3ffa ;interrupt vector ; ;monitor V1.5 entry points ; WARM .EQU $0f8c ;serial monitor warm entry point ; ; 6850 ACIA registers ;---------------------- CONTROL .EQU $80 ;(write) STATUS .EQU $80 ;(read) TDR .EQU $81 ;(write) RDR .EQU $81 ;(read) ; ; control register bits ;---------------------- ; ;clock divisor ; MRESET .EQU $03 ;master reset the ACIA DIV0 .EQU $00 ;CLOCK/1 DIV16 .EQU $01 ;CLOCK/16 DIV64 .EQU $02 ;CLOCK/64 ; ; format select ; F7E2 .EQU $00 ;7 data bits, EVEN parity, 2 stop bits (1+7+1+2= 11 bits) F7O2 .EQU $04 ;7 data bits, ODD parity, 2 stop bits (1+7+1+2= 11 bits) F7E1 .EQU $08 ;7 data bits, EVEN parity, 1 stop bit (1+7+1+1= 10 bits) F7O1 .EQU $0C ;7 data bits, ODD parity, 1 stop bit (1+7+1+1= 10 bits) F8N2 .EQU $10 ;8 data bits, NO parity, 2 stop bits (1+8+0+2= 11 bits) F8N1 .EQU $14 ;8 data bits, NO parity, 1 stop bit (1+8+0+1= 10 bits) F8E1 .EQU $18 ;8 data bits, EVEN parity, 1 stop bit (1+8+1+1= 11 bits) F8O1 .EQU $1C ;8 data bits, ODD parity,1 stop bit (1+8+1+1= 11 bits) ; ; transmitter control ; RTSLID .EQU $00 ;RTS LOW, transmit interrupt disabled RTSLIE .EQU $20 ;RTS LOW, transmit interrupt enabled RTSHID .EQU $40 ;RTS HIGH, transmit interrupt disabled RTSLIDB .EQU $60 ;RTS LOW, transmit interrupt disabled and 'break' transmitted ; ; receiver interrupt ; RIE .EQU $80 ;receiver interrupt enabled ; ; status register bits ;--------------------- RDRF .EQU 0 ;receive data register full TDRE .EQU 1 ;transmit data register empty DCD .EQU 2 ;data carrier detect CTS .EQU 3 ;clear to send FE .EQU 4 ;framing error OVRN .EQU 5 ;overrun PE .EQU 6 ;parity error IRQ .EQU 7 ;interrupt request ; ; blink ;----------- ; toggles the RTS output of the ACIA .org $2000 blink: ld a,MRESET out (CONTROL),a ;reset the ACIA ld d,20 blink1: ld a,RTSLID ;make RTS low to turn LED on out (CONTROL),a ld b,200 call delae ld a,RTSHID ;make RTS high to turn LED off out (CONTROL),a ld b,200 call delae dec d jr nz,blink1 ;done enough? jp WARM ;exit to the serial monitor ; ; approx. b x 1mS delay @ 4MHz ;----------------------------- delae push bc ;11T ld b,233 ;7T delae1 nop ;4T djnz delae1 ;NZ=13T,Z=8T pop bc ;10T djnz delae ;NZ=13T,Z=8T ret ;10T ; ; Connect the ACIA to the Serial Monitor ;---------------------------------------- ; ; initialise the ACIA and use it instead of the bit banged serial routines for the ; serial monitor. ; .org $2030 start: ld a,MRESET out (CONTROL),a ;reset the ACIA ld a,RTSLID+F8N2+DIV64 out (CONTROL),a ;initialise ACIA 8 bit word, No parity 2 stop divide by 64 for 115200 baud ;point to our new transmit routine ld hl,TxChar ld (PUTCH),hl ;point to our new receive routine ld hl,RxChar ld (GETCH),hl ; jump (back) into the serial monitor, the prompt '>' will be displayed on ; the terminal connected to the ACIA, remember that the ACIA communicates at 115200! (with a 7.3728MHz crystal oscillator) jp WARM ; ; transmit a character in a ;-------------------------- TxChar: ld b,a ;save the character for later TxChar1: in a,(STATUS) ;get the ACIA status bit TDRE,a ;is the TDRE bit high? jr z,TxChar1 ;no, the TDR is not empty ld a,b ;yes, get the character out (TDR),a ;and put it in the TDR ret ; ; receive a character in a ;--------------------------------- RxChar: in a,(STATUS) ;get the ACIA status bit RDRF,a ;is the RDRF bit high? jr z,RxChar ;no, the RDR is empty in a,(RDR) ;yes, read the received char ret .end
programs/oeis/129/A129839.asm
neoneye/loda
22
24987
; A129839: a(n) = Stirling_2(n,3)^2. ; 0,0,0,1,36,625,8100,90601,933156,9150625,87048900,812307001,7486748676,68447640625,622473660900,5641104760201,51003678922596,460438253730625,4152386009780100,37422167780506201,337103845136750916,3035761307578140625,27332814735512302500 seq $0,392 ; Stirling numbers of second kind S(n,3). pow $0,2
verify/alfy/6_function/definition_variables.alfy.asm
alexandruradovici/alf-alfy-asm-public
0
160118
<reponame>alexandruradovici/alf-alfy-asm-public ; script start: ; asm ; run sum ; push used regsters ; value int 3 set r2 3 push r2 ; value int 7 set r2 7 push r2 run sum ; pop parameters set r2 16 pushsp pop r3 add r3 r3 r2 push r3 popsp mov r2 r1 writenumber r2 stop ; function sum sum: ; Base pointer push r0 pushsp pop r0 ; Make space for variables set r3 4 sub r2 r0 r3 push r2 popsp ; function ; attribution ; expression + ; n1: r3 set r3 8 add r3 r0 r3 load r3 r3 ; n2: r4 set r4 12 add r4 r0 r4 load r4 r4 add r2 r3 r4 ; s: r3 set r3 0 store r3 r2 ; s: r2 set r2 0 load r2 r2 ; Restore base pointer push r0 popsp pop r0 ; return value mov r1 r2 ret ; Restore base pointer push r0 popsp pop r0 ; return ret
Transynther/x86/_processed/NC/_ht_zr_/i7-8650U_0xd2_notsx.log_1264_966.asm
ljhsiun2/medusa
9
22666
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %rax push %rcx push %rdi push %rsi lea addresses_A_ht+0x1ee1, %r12 nop nop nop nop nop xor $24432, %rax mov $0x6162636465666768, %r15 movq %r15, %xmm0 vmovups %ymm0, (%r12) sub $26894, %rsi lea addresses_WT_ht+0x17001, %rsi lea addresses_WC_ht+0x15f31, %rdi nop nop nop cmp $30979, %r14 mov $10, %rcx rep movsw nop nop nop inc %r14 lea addresses_normal_ht+0x1e661, %rsi nop nop nop nop nop cmp $58358, %r14 movb (%rsi), %cl nop nop nop nop and $56969, %r14 pop %rsi pop %rdi pop %rcx pop %rax pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r14 push %r15 push %r9 push %rax push %rcx push %rdi // Load lea addresses_A+0x1baa1, %rcx nop nop nop and %rax, %rax mov (%rcx), %r9 nop nop nop nop cmp $19202, %r9 // Store lea addresses_UC+0x4581, %r14 nop nop nop nop cmp $39172, %rcx mov $0x5152535455565758, %rax movq %rax, (%r14) nop add %rcx, %rcx // Faulty Load mov $0x304bb10000000581, %rcx nop nop nop add $20325, %r14 vmovups (%rcx), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $1, %xmm0, %r9 lea oracles, %r15 and $0xff, %r9 shlq $12, %r9 mov (%r15,%r9,1), %r9 pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r14 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 4, 'same': False}} {'49': 162, '00': 1102} 49 49 00 00 00 49 00 00 00 00 00 00 49 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 49 49 00 00 00 00 00 00 00 00 00 00 49 00 49 00 00 49 49 49 00 00 00 00 00 00 00 00 00 00 00 00 49 49 49 00 00 00 49 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 49 00 49 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 49 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 49 49 00 00 00 00 00 00 00 00 00 00 49 00 49 00 49 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 49 00 00 00 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 49 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 49 49 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 49 00 00 00 49 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 49 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 49 00 00 00 00 00 49 00 00 49 00 00 49 00 49 00 49 49 00 49 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 49 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 49 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 49 00 00 00 00 00 00 49 49 00 00 49 00 00 00 00 00 49 49 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00 49 49 00 49 00 00 00 00 00 00 00 49 00 00 49 00 49 00 00 49 00 00 49 49 49 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 49 49 49 00 00 00 00 00 00 00 49 49 00 00 00 49 00 49 00 00 00 00 00 49 00 49 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 49 49 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 49 49 00 00 00 00 00 00 00 00 */
hetu-sql-migration-tool/src/main/antlr4/io/hetu/core/migration/source/impala/ImpalaSql.g4
ufolr/hetu-core
0
341
/* * Copyright (C) 2018-2020. Huawei Technologies Co., Ltd. All rights reserved. * 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. */ grammar ImpalaSql; tokens { DELIMITER } singleStatement : statement EOF ; standaloneExpression : expression EOF ; standalonePathSpecification : pathSpecification EOF ; statement : query #statementDefault | USE schema=identifier #use | CREATE (SCHEMA | DATABASE) (IF NOT EXISTS)? qualifiedName (COMMENT comment=string)? (LOCATION location=string)? #createSchema | ALTER DATABASE qualifiedName SET OWNER (USER | ROLE) identifier #alterSchema | DROP (SCHEMA | DATABASE) (IF EXISTS)? qualifiedName (CASCADE | RESTRICT)? #dropSchema | CREATE EXTERNAL? TABLE (IF NOT EXISTS)? tblName=qualifiedName ('(' tableElement (',' tableElement)* ')')? (PARTITIONED BY '('partitionedBy')')? (SORT BY '(' sortedBy ')')? (COMMENT comment=string)? (ROW FORMAT rowFormat)? (WITH SERDEPROPERTIES serdProp=properties)? (STORED_AS stored_as=identifier)? (LOCATION location=string)? (CACHED IN cacheName=qualifiedName (WITH REPLICATION EQ INTEGER_VALUE)? | UNCACHED)? (TBLPROPERTIES tblProp=properties)? (AS query)? #createTable | CREATE EXTERNAL? TABLE (IF NOT EXISTS)? tblName=qualifiedName LIKE (likeTableName=qualifiedName | PARQUET parquet=string) (COMMENT comment=string)? (STORED_AS stored_as=identifier)? (LOCATION location=string)? #createTableLike | CREATE EXTERNAL? TABLE (IF NOT EXISTS)? tblName=qualifiedName ('(' kuduTableElement (',' kuduTableElement)* (',' PRIMARY KEY columnAliases)? ')')? (PARTITION BY .*)? (COMMENT string)? STORED_AS KUDU (TBLPROPERTIES tblProp=properties)? #createKuduTable | CREATE EXTERNAL? TABLE (IF NOT EXISTS)? tblName=qualifiedName ('(' PRIMARY KEY columnAliases? ')')? (PARTITION BY .*)? (COMMENT string)? STORED_AS KUDU (TBLPROPERTIES tblProp=properties)? AS query #createKuduTableAsSelect | ALTER TABLE from=qualifiedName RENAME TO to=qualifiedName #renameTable | ALTER TABLE qualifiedName ADD (IF NOT EXISTS)? COLUMNS '(' columnSpecWithKudu (',' columnSpecWithKudu)* ')' #addColumns | ALTER TABLE qualifiedName REPLACE COLUMNS '(' columnSpecWithKudu (',' columnSpecWithKudu)* ')' #replaceColumns | ALTER TABLE qualifiedName ADD COLUMN (IF NOT EXISTS)? columnSpecWithKudu #addSingleColumn | ALTER TABLE qualifiedName DROP (COLUMN)? identifier #dropSingleColumn | ALTER TABLE qualifiedName SET OWNER (USER | ROLE) identifier #alterTableOwner | ALTER TABLE qualifiedName ALTER (COLUMN)? identifier '{' (SET expression expression | DROP DEFAULT) '}' #alterTableKuduOnly | DROP TABLE (IF EXISTS)? qualifiedName PURGE? #dropTable | TRUNCATE TABLE? (IF EXISTS)? qualifiedName #truncateTable | CREATE VIEW (IF NOT EXISTS)? qualifiedName viewColumns? (COMMENT string)? AS query #createView | ALTER VIEW qualifiedName viewColumns? AS query #alterView | ALTER VIEW qualifiedName RENAME TO qualifiedName #renameView | ALTER VIEW qualifiedName SET OWNER (USER|ROLE) qualifiedName #alterViewOwner | DROP VIEW (IF EXISTS)? qualifiedName #dropView | DESCRIBE DATABASE? (FORMATTED|EXTENDED)? qualifiedName #describeDbOrTable | COMPUTE STATS qualifiedName (columnAliases)? (TABLESAMPLE SYSTEM '('number')' (REPEATABLE'('number')')?)? #computeStats | COMPUTE INCREMENTAL STATS qualifiedName (PARTITION expression)? #computeIncrementalStats | DROP STATS qualifiedName #dropStats | DROP INCREMENTAL STATS qualifiedName PARTITION '('expression')' #dropIncrementalStats | CREATE AGGREGATE? FUNCTION (IF NOT EXISTS)? qualifiedName ('('(type (',' type)*)? ')')? (RETURNS type)? (INTERMEDIATE type)? LOCATION STRING (SYMBOL EQ symbol=string)? (INIT_FN EQ STRING)? (UPDATE_FN EQ STRING)? (MERGE_FN EQ STRING)? (CLOSEFN EQ STRING)? (SERIALIZE_FN EQ STRING)? (FINALIZE_FN EQ STRING)? #createFunction | REFRESH FUNCTIONS qualifiedName #refreshFunction | DROP AGGREGATE? FUNCTION (IF EXISTS)? qualifiedName ('('(type (',' type)*)? ')')? #dropFunction | CREATE ROLE name=identifier #createRole | DROP ROLE name=identifier #dropRole | GRANT ROLE identifier TO GROUP identifier #grantRole | GRANT (privilege (',' privilege)* | ALL) ON objectType qualifiedName TO grantee=principal (WITH GRANT OPTION)? #grant | REVOKE ROLE identifier FROM GROUP identifier #revokeRole | REVOKE (GRANT OPTION FOR)? (privilege (',' privilege)* | ALL) ON objectType qualifiedName FROM grantee=principal #revoke | with? INSERT hintClause? (INTO | OVERWRITE) TABLE? qualifiedName columnAliases? (PARTITION '('expression(',' expression)*')')? hintClause? query #insertInto | DELETE FROM? qualifiedName (WHERE booleanExpression)? #delete | DELETE expression (AS? identifier)? FROM? relation ((',' relation)*)? (WHERE booleanExpression)? #deleteTableRef | UPDATE qualifiedName SET assignmentList (FROM relation (',' relation)*)? (WHERE booleanExpression)? #updateTable | UPSERT hintClause? INTO TABLE? qualifiedName columnAliases? hintClause? query #upsert | SHOW (SCHEMAS | DATABASES) (LIKE? pattern=string ('|' string)*)? #showSchemas | SHOW TABLES ((FROM | IN) qualifiedName)? (LIKE? pattern=string ('|' string)*)? #showTables | SHOW (AGGREGATE | ANALYTIC)? FUNCTIONS (IN qualifiedName)? (LIKE? pattern=string ('|' string)*)? #showFunctions | SHOW CREATE TABLE qualifiedName #showCreateTable | SHOW CREATE VIEW qualifiedName #showCreateView | SHOW TABLE STATS qualifiedName #showTableStats | SHOW COLUMN STATS qualifiedName #showColumnStats | SHOW (RANGE)? PARTITIONS qualifiedName #showPartitions | SHOW FILES IN qualifiedName (PARTITION '('expression (',' expression)?')')? #showFiles | SHOW (CURRENT)? ROLES #showRoles | SHOW ROLE GRANT GROUP identifier #showRoleGrant | SHOW GRANT ROLE identifier #showGrantRole | SHOW GRANT USER identifier (ON (SERVER | DATABASE | TABLE | URI) (qualifiedName)? )? #showGrantUser | COMMENT ON (DATABASE|TABLE|COLUMN) qualifiedName IS (string | NULL) #addComments | EXPLAIN statement #explain | SET (ALL | identifier EQ expression)? #setSession | ':'SHUTDOWN '(' ('\\')? (expression)? (':' expression)? (',' expression )? ')' #shutdown | INVALIDATE METADATA qualifiedName #invalidateMeta | LOAD DATA INPATH STRING (OVERWRITE)? INTO TABLE qualifiedName (PARTITION '('expression (',' expression)?')')? #loadData | REFRESH qualifiedName (PARTITION '('expression (',' expression)?')')? #refreshMeta | REFRESH AUTHORIZATION #refreshAuth ; assignmentList : assignmentItem (',' assignmentItem)* ; assignmentItem : qualifiedName EQ expression ; viewColumns : '(' identifier (COMMENT string)? (',' identifier (COMMENT string)?)* ')' ; query : with? queryNoWith ; with : WITH namedQuery (',' namedQuery)* ; tableElement : columnDefinition ; columnDefinition : identifier type (COMMENT string)? ; kuduTableElement : kuduColumnDefinition ; kuduColumnDefinition : identifier type (kuduAttributes)? (COMMENT string)? (PRIMARY KEY)? ; columnSpecWithKudu : identifier type (COMMENT string)? (kuduAttributes)? ; kuduAttributes : '{' ((NOT)? NULL | ENCODING expression | COMPRESSION expression | DEFAULT expression | BLOCK_SIZE number) '}' ; likeClause : LIKE qualifiedName (optionType=(INCLUDING | EXCLUDING) PROPERTIES)? ; hintClause : '-- +SHUFFLE' | '-- +NOSHUFFLE -- +CLUSTERED' | '/* +SHUFFLE */' | '/* +NOSHUFFLE */' | '/* +CLUSTERED */' | '[SHUFFLE]' | '[NOSHUFFLE]' ; properties : '(' property (',' property)* ')' ; partitionedBy : columnDefinition (',' columnDefinition)* ; sortedBy : expression (',' expression)* ; rowFormat : DELIMITED (FIELDS TERMINATED BY string (ESCAPED BY string)?)? (LINES TERMINATED BY string)? ; property : identifier EQ expression ; queryNoWith: queryTerm (ORDER BY sortItem (',' sortItem)*)? (LIMIT rows=INTEGER_VALUE (OFFSET offset=INTEGER_VALUE)?)? ; queryTerm : queryPrimary #queryTermDefault | left=queryTerm operator=INTERSECT setQuantifier? right=queryTerm #setOperation | left=queryTerm operator=(UNION | EXCEPT) setQuantifier? right=queryTerm #setOperation ; queryPrimary : querySpecification #queryPrimaryDefault | TABLE qualifiedName #table | VALUES expression (',' expression)* #inlineTable | '(' queryNoWith ')' #subquery ; sortItem : expression ordering=(ASC | DESC)? (NULLS nullOrdering=(FIRST | LAST))? ; querySpecification : SELECT setQuantifier? (STRAIGHT_JOIN)? selectItem (',' selectItem)* (FROM relation (',' relation)*)? (WHERE where=booleanExpression)? (GROUP BY groupBy)? (HAVING having=booleanExpression)? ; groupBy : setQuantifier? groupingElement (',' groupingElement)* ; groupingElement : groupingSet #singleGroupingSet ; groupingSet : '(' (expression (',' expression)*)? ')' | expression ; namedQuery : name=identifier (columnAliases)? AS '(' query ')' ; setQuantifier : DISTINCT | ALL ; selectItem : expression (AS? identifier)? #selectSingle | qualifiedName '.' ASTERISK #selectAll | ASTERISK #selectAll ; relation : left=relation ( CROSS JOIN right=sampledRelation | joinType JOIN rightRelation=relation joinCriteria ) #joinRelation | sampledRelation #relationDefault ; joinType : INNER? | LEFT INNER? | RIGHT INNER? | LEFT OUTER? | RIGHT OUTER? | FULL OUTER? | LEFT SEMI | RIGHT SEMI | LEFT ANTI | RIGHT ANTI ; joinCriteria : ON booleanExpression | USING '(' identifier (',' identifier)* ')' ; sampledRelation : aliasedRelation ( TABLESAMPLE sampleType '(' percentage=expression ')' )? ; sampleType : BERNOULLI | SYSTEM ; aliasedRelation : relationPrimary (AS? identifier columnAliases?)? ; columnAliases : '(' identifier (',' identifier)* ')' ; relationPrimary : qualifiedName #tableName | '(' query ')' #subqueryRelation | UNNEST '(' expression (',' expression)* ')' (WITH ORDINALITY)? #unnest | LATERAL '(' query ')' #lateral | '(' relation ')' #parenthesizedRelation ; expression : booleanExpression ; booleanExpression : valueExpression predicate[$valueExpression.ctx]? #predicated | NOT booleanExpression #logicalNot | left=booleanExpression operator=AND right=booleanExpression #logicalBinary | left=booleanExpression operator=OR right=booleanExpression #logicalBinary ; // workaround for https://github.com/antlr/antlr4/issues/780 predicate[ParserRuleContext value] : comparisonOperator right=valueExpression #comparison | comparisonOperator comparisonQuantifier '(' query ')' #quantifiedComparison | NOT? BETWEEN lower=valueExpression AND upper=valueExpression #between | NOT? IN '(' expression (',' expression)* ')' #inList | NOT? IN '(' query ')' #inSubquery | NOT? LIKE pattern=valueExpression (ESCAPE escape=valueExpression)? #like | IS NOT? NULL #nullPredicate | IS NOT? DISTINCT FROM right=valueExpression #distinctFrom ; valueExpression : primaryExpression #valueExpressionDefault | operator=(MINUS | PLUS) valueExpression #arithmeticUnary | left=valueExpression operator=(ASTERISK | SLASH | PERCENT) right=valueExpression #arithmeticBinary | left=valueExpression operator=(PLUS | MINUS) right=valueExpression #arithmeticBinary | left=valueExpression CONCAT right=valueExpression #concatenation ; primaryExpression : NULL #nullLiteral | interval #intervalLiteral | identifier string #typeConstructor | DOUBLE_PRECISION string #typeConstructor | number #numericLiteral | booleanValue #booleanLiteral | string #stringLiteral | BINARY_LITERAL #binaryLiteral | '?' #parameter | POSITION '(' valueExpression IN valueExpression ')' #position | '(' expression (',' expression)+ ')' #rowConstructor | ROW '(' expression (',' expression)* ')' #rowConstructor | qualifiedName '(' ASTERISK ')' filter? over? #functionCall | qualifiedName '(' (setQuantifier? expression (',' expression)*)? (ORDER BY sortItem (',' sortItem)*)? ')' filter? over? #functionCall | identifier '->' expression #lambda | '(' (identifier (',' identifier)*)? ')' '->' expression #lambda | '(' query ')' #subqueryExpression // This is an extension to ANSI SQL, which considers EXISTS to be a <boolean expression> | EXISTS '(' query ')' #exists | CASE valueExpression whenClause+ (ELSE elseExpression=expression)? END #simpleCase | CASE whenClause+ (ELSE elseExpression=expression)? END #searchedCase | CAST '(' expression AS type ')' #cast | TRY_CAST '(' expression AS type ')' #cast | ARRAY '[' (expression (',' expression)*)? ']' #arrayConstructor | value=primaryExpression '[' index=valueExpression ']' #subscript | identifier #columnReference | base=primaryExpression '.' fieldName=identifier #dereference | name=CURRENT_DATE #specialDateTimeFunction | name=CURRENT_TIME ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=CURRENT_TIMESTAMP ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=LOCALTIME ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=LOCALTIMESTAMP ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=CURRENT_USER #currentUser | name=CURRENT_PATH #currentPath | SUBSTRING '(' valueExpression FROM valueExpression (FOR valueExpression)? ')' #substring | NORMALIZE '(' valueExpression (',' normalForm)? ')' #normalize | EXTRACT '(' identifier FROM valueExpression ')' #extract | '(' expression ')' #parenthesizedExpression | GROUPING '(' (qualifiedName (',' qualifiedName)*)? ')' #groupingOperation ; string : STRING #basicStringLiteral | UNICODE_STRING (UESCAPE STRING)? #unicodeStringLiteral ; comparisonOperator : EQ | NEQ | LT | LTE | GT | GTE ; comparisonQuantifier : ALL | SOME | ANY ; booleanValue : TRUE | FALSE ; interval : INTEGER_VALUE intervalField | '(' INTEGER_VALUE ')' intervalField | INTERVAL INTEGER_VALUE intervalField | INTERVAL '(' INTEGER_VALUE ')' intervalField ; intervalField : YEAR | YEARS | MONTH | MONTHS | DAY | DAYS | HOUR | HOURS | MINUTE | MINUTES | SECOND | SECONDS ; normalForm : NFD | NFC | NFKD | NFKC ; type : type ARRAY | ARRAY '<' type '>' | MAP '<' type ',' type '>' | STRUCT '<' identifier ':' type (',' identifier ':' type)* '>' | baseType ('(' typeParameter (',' typeParameter)* ')')? ; typeParameter : INTEGER_VALUE | type ; baseType : TIME_WITH_TIME_ZONE | TIMESTAMP_WITH_TIME_ZONE | DOUBLE_PRECISION | identifier ; whenClause : WHEN condition=expression THEN result=expression ; filter : FILTER '(' WHERE booleanExpression ')' ; over : OVER '(' (PARTITION BY partition+=expression (',' partition+=expression)*)? (ORDER BY sortItem (',' sortItem)*)? windowFrame? ')' ; windowFrame : frameType=RANGE start=frameBound | frameType=ROWS start=frameBound | frameType=RANGE BETWEEN start=frameBound AND end=frameBound | frameType=ROWS BETWEEN start=frameBound AND end=frameBound ; frameBound : UNBOUNDED boundType=PRECEDING #unboundedFrame | UNBOUNDED boundType=FOLLOWING #unboundedFrame | CURRENT ROW #currentRowBound | expression boundType=(PRECEDING | FOLLOWING) #boundedFrame ; pathElement : identifier '.' identifier #qualifiedArgument | identifier #unqualifiedArgument ; pathSpecification : pathElement (',' pathElement)* ; privilege : CREATE | INSERT | REFRESH | SELECT ('('columnName=identifier')')? ; objectType : SERVER | URI | DATABASE | TABLE ; qualifiedName : identifier ('.' identifier)* ; principal : identifier #unspecifiedPrincipal | ROLE identifier #rolePrincipal ; identifier : IDENTIFIER #unquotedIdentifier | STRING #quotedIdentifier | nonReserved #unquotedIdentifier | BACKQUOTED_IDENTIFIER #backQuotedIdentifier | DIGIT_IDENTIFIER #digitIdentifier ; number : MINUS? DECIMAL_VALUE #decimalLiteral | MINUS? DOUBLE_VALUE #doubleLiteral | MINUS? INTEGER_VALUE #integerLiteral ; nonReserved // IMPORTANT: this rule must only contain tokens. Nested rules are not supported. See SqlParser.exitNonReserved : ADD | ADMIN | ALL | ANALYZE | ANY | ARRAY | ASC | AT | BERNOULLI | CALL | CASCADE | CATALOGS | COLUMN | COLUMNS | COMMENT | COMMIT | COMMITTED | CURRENT | DATA | DATABASE | DATABASES | DATE | DAY | DAYS | DEFINER | DESC | EXCLUDING | EXPLAIN | FETCH | FILTER | FIRST | FOLLOWING | FORMAT | FUNCTIONS | GRANT | GRANTED | GRANTS | GRAPHVIZ | HOUR | IF | INCLUDING | INPUT | INTERVAL | INVOKER | IO | ISOLATION | JSON | LAST | LATERAL | LEVEL | LIMIT | LOGICAL | MAP | MINUTE | MONTH | NEXT | NFC | NFD | NFKC | NFKD | NO | NONE | NULLIF | NULLS | OFFSET | ONLY | OPTION | ORDINALITY | OUTPUT | OVER | PARTITION | PARTITIONS | PARQUET | PATH | POSITION | PRECEDING | PRIVILEGES | PROPERTIES | RANGE | READ | RENAME | REPEATABLE | REPLACE | RESET | RESTRICT | REVOKE | ROLE | ROLES | ROLLBACK | ROW | ROWS | SCHEMA | SCHEMAS | SECOND | SECONDS | SECURITY | SERIALIZABLE | SESSION | SET | SETS | SHOW | SOME | START | STATS | SUBSTRING | SYSTEM | TABLES | TABLESAMPLE | TEXT | TIES | TIME | TIMESTAMP | TO | TRANSACTION | TRY_CAST | TYPE | UNBOUNDED | UNCOMMITTED | USE | USER | VALIDATE | VERBOSE | VIEW | VIEWS | WORK | WRITE | YEAR | ZONE | DEFAULT ; ADD: 'ADD'; ADMIN: 'ADMIN'; ALL: 'ALL'; ALTER: 'ALTER'; ANALYZE: 'ANALYZE'; ANALYTIC: 'ANALYTIC'; AND: 'AND'; ANY: 'ANY'; ANTI: 'ANTI'; ARCHIVE: 'ARCHIVE'; ARRAY: 'ARRAY'; AS: 'AS'; ASC: 'ASC'; AT: 'AT'; AGGREGATE: 'AGGREGATE'; AUTHORIZATION: 'AUTHORIZATION'; BERNOULLI: 'BERNOULLI'; BETWEEN: 'BETWEEN'; PARTITIONED: 'PARTITIONED'; PREPARE_FN: 'PREPARE_FN'; TEMPORARY: 'TEMPORARY'; EXTERNAL: 'EXTERNAL'; CLOSEFN: 'CLOSEFN'; SORT: 'SORT'; SORTED: 'SORTED'; BUCKETS: 'BUCKETS'; PURGE: 'PURGE'; STORED: 'STORED'; STORED_AS: 'STORED AS'; LOCATION: 'LOCATION'; TBLPROPERTIES: 'TBLPROPERTIES'; DBPROPERTIES : 'DBPROPERTIES'; BY: 'BY'; CALL: 'CALL'; CASCADE: 'CASCADE'; CASE: 'CASE'; CAST: 'CAST'; CACHED: 'CACHED'; CATALOGS: 'CATALOGS'; COLUMN: 'COLUMN'; COLUMNS: 'COLUMNS'; COMMENT: 'COMMENT'; COMMIT: 'COMMIT'; COMMITTED: 'COMMITTED'; COMPUTE: 'COMPUTE'; CONSTRAINT: 'CONSTRAINT'; CREATE: 'CREATE'; CROSS: 'CROSS'; CUBE: 'CUBE'; CURRENT: 'CURRENT'; CURRENT_DATE: 'CURRENT_DATE'; CURRENT_PATH: 'CURRENT_PATH'; CURRENT_ROLE: 'CURRENT_ROLE'; CURRENT_TIME: 'CURRENT_TIME'; CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'; CURRENT_USER: 'CURRENT_USER'; DATA: 'DATA'; DATABASE: 'DATABASE'; DATABASES: 'DATABASES'; DATE: 'DATE'; DAY: 'DAY'; DAYS: 'DAYS'; DEALLOCATE: 'DEALLOCATE'; DEFINER: 'DEFINER'; DELETE: 'DELETE'; DEFAULT: 'DEFAULT'; DELIMITED: 'DELIMITED '; DISABLE: 'DISABLE'; UPDATE: 'UPDATE'; DESC: 'DESC'; DESCRIBE: 'DESCRIBE'; DISTINCT: 'DISTINCT'; DROP: 'DROP'; ELSE: 'ELSE'; ENABLE: 'ENABLE'; END: 'END'; ESCAPE: 'ESCAPE'; ESCAPED: 'ESCAPED'; EXCEPT: 'EXCEPT'; EXCLUDING: 'EXCLUDING'; EXECUTE: 'EXECUTE'; EXISTS: 'EXISTS'; EXPLAIN: 'EXPLAIN'; EXTRACT: 'EXTRACT'; EXTENDED: 'EXTENDED'; FALSE: 'FALSE'; FETCH: 'FETCH'; FIELDS: 'FIELDS'; FILE: 'FILE'; FILES: 'FILES'; FILTER: 'FILTER'; FIRST: 'FIRST'; FINALIZE_FN: 'FINALIZE_FN'; FOLLOWING: 'FOLLOWING'; FOR: 'FOR'; FORMAT: 'FORMAT'; FORMATTED: 'FORMATTED'; FROM: 'FROM'; FULL: 'FULL'; FUNCTION: 'FUNCTION'; FUNCTIONS: 'FUNCTIONS'; GRANT: 'GRANT'; GRANTED: 'GRANTED'; GRANTS: 'GRANTS'; GRAPHVIZ: 'GRAPHVIZ'; GROUP: 'GROUP'; GROUPING: 'GROUPING'; HASH: 'HASH'; HAVING: 'HAVING'; HOUR: 'HOUR'; HOURS: 'HOURS'; IF: 'IF'; IN: 'IN'; INCLUDING: 'INCLUDING'; INCREMENTAL: 'INCREMENTAL'; INNER: 'INNER'; INPATH: 'INPATH'; INPUT: 'INPUT'; INSERT: 'INSERT'; INTERSECT: 'INTERSECT'; INTERVAL: 'INTERVAL'; INTERMEDIATE: 'INTERMEDIATE'; INTO: 'INTO'; INVOKER: 'INVOKER'; INIT_FN: 'INIT_FN'; INVALIDATE: 'INVALIDATE'; IO: 'IO'; IS: 'IS'; ISOLATION: 'ISOLATION'; JAR: 'JAR'; JSON: 'JSON'; JOIN: 'JOIN'; KEY: 'KEY'; KUDU: 'KUDU'; LAST: 'LAST'; LATERAL: 'LATERAL'; LEFT: 'LEFT'; LEVEL: 'LEVEL'; LIKE: 'LIKE'; LIMIT: 'LIMIT'; LINES: 'LINES'; LOAD: 'LOAD'; LOCALTIME: 'LOCALTIME'; LOCALTIMESTAMP: 'LOCALTIMESTAMP'; LOGICAL: 'LOGICAL'; METADATA: 'METADATA'; MATERIALIZED: 'MATERIALIZED'; MAP: 'MAP'; MINUTE: 'MINUTE'; MINUTES: 'MINUTES'; MONTH: 'MONTH'; MONTHS: 'MONTHS'; NATURAL: 'NATURAL'; MERGE_FN: 'MERGE_FN'; NEXT: 'NEXT'; NFC : 'NFC'; NFD : 'NFD'; NFKC : 'NFKC'; NFKD : 'NFKD'; NO: 'NO'; NONE: 'NONE'; NORMALIZE: 'NORMALIZE'; NOT: 'NOT'; NULL: 'NULL'; NULLIF: 'NULLIF'; NULLS: 'NULLS'; OFFSET: 'OFFSET'; ON: 'ON'; ONLY: 'ONLY'; OPTION: 'OPTION'; OR: 'OR'; ORDER: 'ORDER'; ORDINALITY: 'ORDINALITY'; OUTER: 'OUTER'; OUTPUT: 'OUTPUT'; OWNER: 'OWNER'; OVER: 'OVER'; OVERWRITE: 'OVERWRITE'; PARTITION: 'PARTITION'; PARTITIONS: 'PARTITIONS'; PATH: 'PATH'; PARQUET: 'PARQUET'; POSITION: 'POSITION'; PRECEDING: 'PRECEDING'; PREPARE: 'PREPARE'; PRIMARY: 'PRIMARY'; REPLICATION: 'REPLICATION'; PRIVILEGES: 'PRIVILEGES'; PROPERTIES: 'PROPERTIES'; RANGE: 'RANGE'; READ: 'READ'; RELOAD: 'RELOAD'; RECURSIVE: 'RECURSIVE'; RENAME: 'RENAME'; REPEATABLE: 'REPEATABLE'; REPLACE: 'REPLACE'; REWRITE: 'REWRITE'; RESET: 'RESET'; RESTRICT: 'RESTRICT'; RETURNS: 'RETURNS'; REVOKE: 'REVOKE'; REFRESH: 'REFRESH'; RIGHT: 'RIGHT'; ROLE: 'ROLE'; ROLES: 'ROLES'; ROLLBACK: 'ROLLBACK'; ROLLUP: 'ROLLUP'; ROW: 'ROW'; ROWS: 'ROWS'; SCHEMA: 'SCHEMA'; SCHEMAS: 'SCHEMAS'; SECOND: 'SECOND'; SECONDS: 'SECONDS'; SECURITY: 'SECURITY'; SELECT: 'SELECT'; SERDEPROPERTIES: 'SERDEPROPERTIES'; SERIALIZABLE: 'SERIALIZABLE'; SESSION: 'SESSION'; SET: 'SET'; SETS: 'SETS'; SEMI: 'SEMI'; SERVER: 'SERVER'; SHOW: 'SHOW'; SHUTDOWN: 'SHUTDOWN'; SOME: 'SOME'; START: 'START'; STATS: 'STATS'; STRUCT: 'STRUCT'; STRAIGHT_JOIN: 'STRAIGHT_JOIN'; SUBSTRING: 'SUBSTRING'; SYSTEM: 'SYSTEM'; SYMBOL: 'SYMBOL'; SERIALIZE_FN: 'SERIALIZE_FN'; TABLE: 'TABLE'; TABLES: 'TABLES'; TABLESAMPLE: 'TABLESAMPLE'; TEXT: 'TEXT'; TERMINATED: 'TERMINATED '; THEN: 'THEN'; TIES: 'TIES'; TIME: 'TIME'; TIMESTAMP: 'TIMESTAMP'; TO: 'TO'; TRANSACTION: 'TRANSACTION'; TRUE: 'TRUE'; TRY_CAST: 'TRY_CAST'; TRUNCATE: 'TRUNCATE'; TYPE: 'TYPE'; UNCACHED: 'UNCACHED'; UESCAPE: 'UESCAPE'; UNBOUNDED: 'UNBOUNDED'; UNCOMMITTED: 'UNCOMMITTED'; UNION: 'UNION'; UNNEST: 'UNNEST'; USE: 'USE'; USER: 'USER'; USING: 'USING'; UPDATE_FN: 'UPDATE_FN'; UPSERT: 'UPSERT'; URI: 'URI'; VALIDATE: 'VALIDATE'; VALUES: 'VALUES'; VERBOSE: 'VERBOSE'; VIEW: 'VIEW'; VIEWS: 'VIEWS'; WHEN: 'WHEN'; WHERE: 'WHERE'; WITH: 'WITH'; WORK: 'WORK'; WRITE: 'WRITE'; YEAR: 'YEAR'; YEARS: 'YEARS'; ZONE: 'ZONE'; EQ : '='; NEQ : '<>' | '!='; LT : '<'; LTE : '<='; GT : '>'; GTE : '>='; PLUS: '+'; MINUS: '-'; ASTERISK: '*'; SLASH: '/'; PERCENT: '%'; CONCAT: '||'; STRING : '\'' (~'\'' | '\\' | ('\\' '\''))* '\'' | '"' (~'"' | '\\' | '\\"')* '"' ; UNICODE_STRING : 'U&\'' ( ~'\'' | '\'\'' )* '\'' ; // Note: we allow any character inside the binary literal and validate // its a correct literal when the AST is being constructed. This // allows us to provide more meaningful error messages to the user BINARY_LITERAL : 'X\'' (~'\'')* '\'' ; INTEGER_VALUE : DIGIT+ ; DECIMAL_VALUE : DIGIT+ '.' DIGIT* | '.' DIGIT+ ; DOUBLE_VALUE : DIGIT+ ('.' DIGIT*)? EXPONENT | '.' DIGIT+ EXPONENT ; IDENTIFIER : (LETTER | '_') (LETTER | DIGIT | '_')* ; DIGIT_IDENTIFIER : DIGIT (LETTER | DIGIT | '_' | '@' | ':')+ ; QUOTED_IDENTIFIER : '"' ( ~'"' | '""' )* '"' ; BACKQUOTED_IDENTIFIER : '`' ( ~'`' | '``' )* '`' ; TIME_WITH_TIME_ZONE : 'TIME' WS 'WITH' WS 'TIME' WS 'ZONE' ; TIMESTAMP_WITH_TIME_ZONE : 'TIMESTAMP' WS 'WITH' WS 'TIME' WS 'ZONE' ; DOUBLE_PRECISION : 'DOUBLE' WS 'PRECISION' ; fragment EXPONENT : 'E' [+-]? DIGIT+ ; fragment DIGIT : [0-9] ; fragment LETTER : [A-Z] ; SIMPLE_COMMENT : '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN) ; BRACKETED_COMMENT : '/*' .*? '*/' -> channel(HIDDEN) ; WS : [ \r\n\t]+ -> channel(HIDDEN) ; // Catch-all for anything we can't recognize. // We use this to be able to ignore and recover all the text // when splitting statements with DelimiterLexer UNRECOGNIZED : . ;
sdk-6.5.20/tools/led/example/sdk5675.asm
copslock/broadcom_cpri
0
100378
<gh_stars>0 ; ; $Id: sdk5675.asm,v 1.3 2011/05/22 23:38:43 iakramov Exp $ ; ; This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. ; ; Copyright 2007-2020 Broadcom Inc. All rights reserved. ; ; ; Adapted from sdk5670.asm ; February 27, 2004 ; ; This is the default program for the 5675 SDK. ; To start it, use the following commands from BCM: ; ; led load sdk5675.hex ; led auto on ; led start ; ; The BCM5675 SDK has 10 columns of 4 LEDs each as shown below: ; ; E1 E2 E3 E4 E5 E6 E7 E8 U1 U5 ; L1 L2 L3 L4 L5 L6 L7 L8 U2 U6 ; T1 T2 T3 T4 T5 T6 T7 T8 U3 U7 ; R1 R2 R3 R4 R5 R6 R7 R8 U4 U8 ; ; There is one bit per LED with the following colors: ; ; ZERO Green ; ONE Black ; ; The bits are shifted out in the following order: ; E1, L1, T1, R1, E2, L2, T2, R2, ; E3, L3, T3, R3, E4, L4, T4, R4, ; E5, L5, T5, R5, E6, L6, T6, R6, ; E7, L7, T7, R7, E8, L8, T8, R8, ; U1, U2, U3, U4, U5, U6, U7, U8 ; ; Current implementation: ; ; E1 reflects port 1 higig link enable ; L1 reflects port 1 higig link up ; T1 reflects port 1 higig transmit activity ; R1 reflects port 1 higig receive activity ; ; U1 through U8 are user-defined LEDs and ; just display a chasing LED pattern. ; ld a,1 ; Start with first column up1: port a pushst LINKEN tinv pack pushst LINKUP tinv pack pushst TX tinv pack pushst RX tinv pack inc a ; Next column cmp a,9 jnz up1 ; ; Put out 8 more values to user LEDs. ; In this case it is a cycling pattern. ; inc (0x7f) ld a,(0x7f) and a,7 jnz up2 inc (0x7e) up2: ld b,(0x7e) and b,0x07 sub a,a stc bit a,b ld b,0x08 up3: ror a push cy tinv pack dec b jnz up3 send 0x28 ; ; Symbolic names for the bits of the port status fields ; RX equ 0x0 ; received packet TX equ 0x1 ; transmitted packet COLL equ 0x2 ; collision indicator SPEED_C equ 0x3 ; 100 Mbps SPEED_M equ 0x4 ; 1000 Mbps DUPLEX equ 0x5 ; half/full duplex FLOW equ 0x6 ; flow control capable LINKUP equ 0x7 ; link down/up status LINKEN equ 0x8 ; link disabled/enabled status ZERO equ 0xE ; always 0 ONE equ 0xF ; always 1
src/c_resources/unique_c_resources.adb
jhumphry/auto_counters
5
14315
-- unique_c_resources.adb -- A convenience package to wrap a C type that requires initialization and -- finalization. -- Copyright (c) 2016, <NAME> -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. package body Unique_C_Resources is -------------- -- Unique_T -- -------------- function Make_Unique_T (X : in T) return Unique_T is (Unique_T'(Ada.Finalization.Limited_Controlled with Element => X)); function Element (U : Unique_T) return T is (U.Element); overriding procedure Initialize (Object : in out Unique_T) is begin Object.Element := Initialize; end Initialize; overriding procedure Finalize (Object : in out Unique_T) is begin Finalize(Object.Element); end Finalize; end Unique_C_Resources;
sw/552tests/rand_mem/t_5_mem.asm
JPShen-UWM/ThreadKraken
1
24665
// seed 5 lbi r0, 128 // icount 0 slbi r0, 0 // icount 1 lbi r1, 128 // icount 2 slbi r1, 0 // icount 3 lbi r2, 128 // icount 4 slbi r2, 0 // icount 5 lbi r3, 128 // icount 6 slbi r3, 0 // icount 7 lbi r4, 128 // icount 8 slbi r4, 0 // icount 9 lbi r5, 128 // icount 10 slbi r5, 0 // icount 11 lbi r6, 128 // icount 12 slbi r6, 0 // icount 13 lbi r7, 128 // icount 14 nop // to align meminst icount 15 slbi r7, 0 // icount 16 nop // to align meminst icount 17 st r2, r1, 10 // icount 18 stu r3, r1, 12 // icount 19 lbi r6, 6 // icount 20 nop // to align meminst icount 21 st r3, r1, -12 // icount 22 ld r5, r1, 0 // icount 23 addi r0, r0, 0 // change base addr // icount 24 nop // to align meminst icount 25 ld r6, r0, -8 // icount 26 nop // to align meminst icount 27 ld r2, r0, -8 // icount 28 nop // to align meminst icount 29 stu r2, r1, -12 // icount 30 nop // to align meminst icount 31 ld r6, r1, -10 // icount 32 nop // to align meminst icount 33 ld r4, r1, -12 // icount 34 nop // to align meminst icount 35 ld r3, r1, -8 // icount 36 nop // to align meminst icount 37 stu r5, r0, 14 // icount 38 nop // to align meminst icount 39 ld r3, r0, 4 // icount 40 nop // to align meminst icount 41 ld r5, r0, -4 // icount 42 nop // to align meminst icount 43 st r2, r1, 12 // icount 44 nop // to align meminst icount 45 ld r2, r0, 10 // icount 46 nop // to align meminst icount 47 stu r4, r0, -2 // icount 48 nop // to align meminst icount 49 st r6, r1, 4 // icount 50 nop // to align meminst icount 51 stu r2, r1, 14 // icount 52 nop // to align meminst icount 53 ld r4, r1, -2 // icount 54 nop // to align meminst icount 55 ld r6, r1, -6 // icount 56 nop // to align meminst icount 57 ld r2, r0, -2 // icount 58 nop // to align meminst icount 59 ld r4, r1, 6 // icount 60 nop // to align meminst icount 61 st r6, r1, 2 // icount 62 nop // to align meminst icount 63 ld r2, r1, -12 // icount 64 nop // to align meminst icount 65 st r3, r1, 14 // icount 66 nop // to align meminst icount 67 ld r4, r1, -10 // icount 68 nop // to align meminst icount 69 st r6, r1, 4 // icount 70 nop // to align meminst icount 71 st r4, r0, -16 // icount 72 nop // to align meminst icount 73 st r3, r0, -10 // icount 74 nop // to align meminst icount 75 stu r3, r0, 8 // icount 76 nop // to align meminst icount 77 ld r6, r0, 2 // icount 78 nop // to align meminst icount 79 ld r4, r1, 12 // icount 80 nop // to align meminst icount 81 ld r2, r1, 0 // icount 82 nop // to align meminst icount 83 st r4, r0, 4 // icount 84 nop // to align meminst icount 85 ld r4, r1, 0 // icount 86 nop // to align meminst icount 87 ld r4, r1, -2 // icount 88 nop // to align meminst icount 89 st r5, r0, -8 // icount 90 nop // to align meminst icount 91 ld r5, r1, -6 // icount 92 nop // to align meminst icount 93 ld r3, r0, 14 // icount 94 nop // to align meminst icount 95 ld r6, r0, -16 // icount 96 nop // to align meminst icount 97 ld r2, r1, 12 // icount 98 nop // to align meminst icount 99 stu r2, r1, 4 // icount 100 nop // to align meminst icount 101 ld r4, r1, -8 // icount 102 nop // to align meminst icount 103 ld r6, r0, 14 // icount 104 nop // to align meminst icount 105 st r2, r1, 4 // icount 106 nop // to align meminst icount 107 ld r4, r0, 8 // icount 108 nop // to align meminst icount 109 stu r6, r0, -8 // icount 110 nop // to align meminst icount 111 ld r4, r1, -16 // icount 112 nop // to align meminst icount 113 ld r6, r1, -8 // icount 114 ld r4, r1, 10 // icount 115 andni r0, r0, 1 // icount 116 nop // to align meminst icount 117 stu r4, r0, 0 // icount 118 nop // to align meminst icount 119 st r2, r0, -16 // icount 120 st r2, r0, -4 // icount 121 lbi r3, 0 // icount 122 lbi r2, 0 // icount 123 nop // to align branch icount 124 bnez r1, 20 // icount 125 xor r3, r5, r1 // icount 126 sco r5, r4, r3 // icount 127 seq r3, r1, r3 // icount 128 andn r5, r3, r6 // icount 129 subi r4, r6, 5 // icount 130 slbi r2, 11 // icount 131 addi r7, r4, 8 // icount 132 rol r3, r1, r5 // icount 133 sll r7, r7, r2 // icount 134 nop // to align meminst icount 135 andni r6, r6, 1 // icount 136 st r4, r6, 0 // icount 137 andni r1, r1, 1 // icount 138 ld r7, r1, 12 // icount 139 lbi r4, 6 // icount 140 andn r3, r0, r4 // icount 141 srl r3, r1, r4 // icount 142 nop // to align meminst icount 143 andni r4, r4, 1 // icount 144 st r7, r4, 0 // icount 145 xori r4, r5, 8 // icount 146 slli r4, r0, 15 // icount 147 slt r5, r2, r3 // icount 148 seq r7, r1, r0 // icount 149 lbi r7, 14 // icount 150 nop // to align meminst icount 151 stu r2, r0, -6 // icount 152 nop // to align meminst icount 153 ld r5, r1, 10 // icount 154 nop // to align meminst icount 155 st r4, r1, -6 // icount 156 nop // to align meminst icount 157 stu r5, r0, -2 // icount 158 nop // to align meminst icount 159 ld r5, r1, 4 // icount 160 ld r4, r1, -16 // icount 161 addi r1, r1, -12 // change base addr // icount 162 nop // to align meminst icount 163 ld r2, r0, 12 // icount 164 nop // to align meminst icount 165 ld r4, r1, -2 // icount 166 nop // to align meminst icount 167 st r6, r1, -8 // icount 168 nop // to align meminst icount 169 st r5, r1, 0 // icount 170 nop // to align meminst icount 171 stu r3, r1, 6 // icount 172 nop // to align meminst icount 173 ld r4, r1, 4 // icount 174 nop // to align meminst icount 175 ld r3, r0, 10 // icount 176 nop // to align meminst icount 177 ld r3, r0, -6 // icount 178 nop // to align meminst icount 179 stu r2, r1, -14 // icount 180 nop // to align meminst icount 181 ld r6, r1, -10 // icount 182 nop // to align meminst icount 183 stu r3, r1, -6 // icount 184 nop // to align meminst icount 185 ld r2, r0, -16 // icount 186 nop // to align meminst icount 187 stu r3, r1, 6 // icount 188 nop // to align meminst icount 189 st r5, r1, 8 // icount 190 nop // to align meminst icount 191 ld r3, r1, 12 // icount 192 nop // to align meminst icount 193 ld r3, r1, -16 // icount 194 nop // to align meminst icount 195 stu r5, r1, 8 // icount 196 nop // to align meminst icount 197 st r5, r0, 6 // icount 198 nop // to align meminst icount 199 ld r6, r1, -2 // icount 200 nop // to align meminst icount 201 ld r2, r1, 8 // icount 202 stu r5, r1, 6 // icount 203 roli r2, r1, 14 // icount 204 nop // to align meminst icount 205 st r3, r1, 8 // icount 206 nop // to align meminst icount 207 stu r4, r1, 14 // icount 208 nop // to align meminst icount 209 st r3, r1, 6 // icount 210 nop // to align meminst icount 211 stu r3, r0, -12 // icount 212 nop // to align meminst icount 213 ld r4, r1, 2 // icount 214 nop // to align meminst icount 215 ld r5, r1, 10 // icount 216 nop // to align meminst icount 217 st r5, r0, -4 // icount 218 nop // to align meminst icount 219 stu r3, r1, 14 // icount 220 nop // to align meminst icount 221 ld r5, r0, 8 // icount 222 nop // to align meminst icount 223 ld r5, r0, -8 // icount 224 nop // to align meminst icount 225 stu r6, r0, -14 // icount 226 nop // to align meminst icount 227 ld r4, r0, -8 // icount 228 nop // to align meminst icount 229 ld r6, r1, -2 // icount 230 nop // to align meminst icount 231 st r4, r0, 6 // icount 232 nop // to align meminst icount 233 st r3, r1, 8 // icount 234 nop // to align meminst icount 235 st r6, r0, 2 // icount 236 nop // to align meminst icount 237 st r4, r1, -10 // icount 238 nop // to align meminst icount 239 stu r6, r0, 14 // icount 240 nop // to align meminst icount 241 st r3, r0, 8 // icount 242 nop // to align meminst icount 243 ld r3, r1, -12 // icount 244 nop // to align meminst icount 245 stu r2, r0, -8 // icount 246 nop // to align meminst icount 247 st r3, r0, -12 // icount 248 nop // to align meminst icount 249 ld r2, r0, -2 // icount 250 nop // to align meminst icount 251 st r3, r0, -14 // icount 252 nop // to align meminst icount 253 st r2, r0, -8 // icount 254 nop // to align meminst icount 255 ld r2, r0, 14 // icount 256 nop // to align meminst icount 257 ld r5, r1, 10 // icount 258 nop // to align meminst icount 259 st r5, r0, -16 // icount 260 nop // to align meminst icount 261 ld r3, r1, -4 // icount 262 nop // to align meminst icount 263 stu r5, r1, -12 // icount 264 nop // to align meminst icount 265 st r5, r0, 10 // icount 266 nop // to align meminst icount 267 st r6, r0, -6 // icount 268 nop // to align meminst icount 269 st r4, r1, 0 // icount 270 nop // to align meminst icount 271 ld r5, r1, -6 // icount 272 nop // to align meminst icount 273 ld r5, r0, 10 // icount 274 nop // to align meminst icount 275 st r6, r0, 10 // icount 276 st r2, r0, 0 // icount 277 addi r1, r1, -4 // change base addr // icount 278 nop // to align meminst icount 279 st r4, r1, -12 // icount 280 nop // to align meminst icount 281 stu r2, r0, 14 // icount 282 nop // to align meminst icount 283 st r5, r1, -10 // icount 284 nop // to align meminst icount 285 ld r5, r0, -2 // icount 286 nop // to align meminst icount 287 st r3, r1, -16 // icount 288 nop // to align meminst icount 289 stu r2, r0, -10 // icount 290 nop // to align meminst icount 291 st r2, r0, -4 // icount 292 nop // to align meminst icount 293 stu r2, r0, 8 // icount 294 nop // to align meminst icount 295 st r5, r1, 4 // icount 296 ld r6, r0, -14 // icount 297 addi r0, r0, -2 // change base addr // icount 298 nop // to align meminst icount 299 ld r6, r0, 6 // icount 300 nop // to align meminst icount 301 ld r3, r0, -8 // icount 302 nop // to align meminst icount 303 ld r4, r0, 10 // icount 304 nop // to align meminst icount 305 ld r3, r0, 4 // icount 306 nop // to align meminst icount 307 stu r6, r1, 14 // icount 308 nop // to align meminst icount 309 stu r3, r0, 14 // icount 310 nop // to align meminst icount 311 ld r6, r1, 12 // icount 312 nop // to align meminst icount 313 st r6, r1, 10 // icount 314 nop // to align meminst icount 315 ld r3, r0, 6 // icount 316 nop // to align meminst icount 317 ld r4, r0, 4 // icount 318 nop // to align meminst icount 319 stu r6, r1, 4 // icount 320 nop // to align meminst icount 321 st r3, r1, 4 // icount 322 nop // to align meminst icount 323 stu r4, r0, -10 // icount 324 nop // to align meminst icount 325 ld r3, r0, -16 // icount 326 nop // to align meminst icount 327 st r3, r0, 14 // icount 328 nop // to align meminst icount 329 ld r5, r0, -16 // icount 330 nop // to align meminst icount 331 st r6, r1, 14 // icount 332 nop // to align meminst icount 333 ld r5, r1, 8 // icount 334 nop // to align meminst icount 335 ld r4, r0, 2 // icount 336 nop // to align meminst icount 337 st r5, r0, -16 // icount 338 nop // to align meminst icount 339 st r2, r1, -12 // icount 340 nop // to align meminst icount 341 stu r4, r0, 6 // icount 342 nop // to align meminst icount 343 st r2, r0, 4 // icount 344 nop // to align meminst icount 345 ld r6, r0, -8 // icount 346 nop // to align meminst icount 347 st r6, r0, 12 // icount 348 nop // to align meminst icount 349 stu r4, r1, 0 // icount 350 nop // to align meminst icount 351 ld r3, r0, 14 // icount 352 nop // to align meminst icount 353 st r2, r0, 2 // icount 354 nop // to align meminst icount 355 st r5, r1, -12 // icount 356 nop // to align meminst icount 357 st r5, r1, -6 // icount 358 nop // to align meminst icount 359 ld r3, r1, 8 // icount 360 nop // to align meminst icount 361 stu r4, r0, -2 // icount 362 nop // to align meminst icount 363 stu r5, r0, -16 // icount 364 nop // to align meminst icount 365 ld r6, r1, 2 // icount 366 nop // to align meminst icount 367 ld r4, r1, -16 // icount 368 nop // to align meminst icount 369 ld r3, r1, -8 // icount 370 nop // to align meminst icount 371 ld r3, r1, 2 // icount 372 nop // to align meminst icount 373 stu r4, r0, 2 // icount 374 nop // to align meminst icount 375 stu r5, r0, -2 // icount 376 nop // to align meminst icount 377 stu r2, r0, -10 // icount 378 nop // to align meminst icount 379 ld r3, r1, 0 // icount 380 nop // to align meminst icount 381 ld r4, r1, 0 // icount 382 nop // to align meminst icount 383 ld r4, r0, 12 // icount 384 nop // to align meminst icount 385 st r5, r1, 10 // icount 386 nop // to align meminst icount 387 stu r6, r0, -16 // icount 388 nop // to align meminst icount 389 st r4, r1, -12 // icount 390 nop // to align meminst icount 391 ld r2, r1, 0 // icount 392 nop // to align meminst icount 393 ld r2, r0, 0 // icount 394 nop // to align meminst icount 395 stu r6, r0, 0 // icount 396 nop // to align meminst icount 397 stu r6, r0, -10 // icount 398 nop // to align meminst icount 399 ld r3, r0, -10 // icount 400 nop // to align meminst icount 401 ld r2, r0, -12 // icount 402 nop // to align meminst icount 403 ld r5, r1, 0 // icount 404 nop // to align meminst icount 405 ld r6, r0, -4 // icount 406 nop // to align meminst icount 407 st r2, r1, 6 // icount 408 nop // to align meminst icount 409 st r2, r1, -12 // icount 410 nop // to align meminst icount 411 ld r3, r0, 0 // icount 412 nop // to align meminst icount 413 st r5, r0, -10 // icount 414 nop // to align meminst icount 415 st r4, r0, -14 // icount 416 nop // to align meminst icount 417 ld r5, r1, -2 // icount 418 nop // to align meminst icount 419 ld r2, r1, -2 // icount 420 nop // to align meminst icount 421 ld r2, r0, -8 // icount 422 nop // to align meminst icount 423 ld r4, r1, 2 // icount 424 nop // to align meminst icount 425 ld r2, r1, 10 // icount 426 nop // to align meminst icount 427 ld r4, r0, 2 // icount 428 nop // to align meminst icount 429 ld r4, r1, -10 // icount 430 nop // to align meminst icount 431 ld r4, r1, 8 // icount 432 nop // to align meminst icount 433 stu r2, r1, 12 // icount 434 nop // to align meminst icount 435 st r3, r0, -6 // icount 436 nop // to align meminst icount 437 stu r4, r1, -6 // icount 438 nop // to align meminst icount 439 ld r6, r1, 6 // icount 440 nop // to align meminst icount 441 ld r3, r1, -2 // icount 442 nop // to align meminst icount 443 ld r6, r1, 14 // icount 444 nop // to align meminst icount 445 stu r2, r0, -12 // icount 446 nop // to align meminst icount 447 ld r6, r1, 2 // icount 448 nop // to align meminst icount 449 ld r2, r1, -4 // icount 450 nop // to align meminst icount 451 stu r2, r1, 12 // icount 452 nop // to align meminst icount 453 ld r6, r0, 4 // icount 454 nop // to align meminst icount 455 stu r4, r0, 12 // icount 456 nop // to align meminst icount 457 stu r6, r1, 14 // icount 458 nop // to align meminst icount 459 ld r3, r1, -4 // icount 460 nop // to align meminst icount 461 ld r2, r1, -6 // icount 462 nop // to align meminst icount 463 ld r3, r0, -4 // icount 464 nop // to align meminst icount 465 ld r4, r1, 2 // icount 466 nop // to align meminst icount 467 ld r6, r1, 12 // icount 468 nop // to align meminst icount 469 stu r4, r1, 0 // icount 470 nop // to align meminst icount 471 stu r3, r0, -4 // icount 472 stu r2, r1, 14 // icount 473 andn r2, r4, r5 // icount 474 stu r2, r0, -6 // icount 475 slt r6, r3, r2 // icount 476 nop // to align meminst icount 477 ld r4, r1, 4 // icount 478 nop // to align meminst icount 479 stu r2, r1, -4 // icount 480 nop // to align meminst icount 481 ld r3, r1, -12 // icount 482 nop // to align meminst icount 483 ld r4, r0, -14 // icount 484 nop // to align meminst icount 485 st r2, r0, 8 // icount 486 nop // to align meminst icount 487 st r6, r0, -8 // icount 488 nop // to align meminst icount 489 st r5, r0, -16 // icount 490 nop // to align meminst icount 491 ld r2, r1, -12 // icount 492 nop // to align meminst icount 493 ld r6, r1, 10 // icount 494 stu r2, r1, 4 // icount 495 lbi r3, 0 // icount 496 lbi r2, 0 // icount 497 nop // to align branch icount 498 beqz r0, 24 // icount 499 slli r3, r0, 4 // icount 500 xori r3, r6, 14 // icount 501 addi r3, r5, 4 // icount 502 seq r7, r3, r6 // icount 503 sco r2, r1, r5 // icount 504 add r5, r4, r4 // icount 505 addi r7, r6, 7 // icount 506 nop // to align meminst icount 507 andni r4, r4, 1 // icount 508 ld r6, r4, 4 // icount 509 roli r6, r5, 13 // icount 510 addi r7, r6, 13 // icount 511 andn r6, r2, r1 // icount 512 sll r4, r5, r2 // icount 513 slli r7, r1, 6 // icount 514 andn r2, r6, r0 // icount 515 slbi r3, 9 // icount 516 sub r2, r4, r1 // icount 517 slt r6, r2, r4 // icount 518 sco r7, r6, r3 // icount 519 lbi r7, 15 // icount 520 rol r2, r4, r2 // icount 521 andni r4, r4, 1 // icount 522 st r4, r4, 6 // icount 523 ror r6, r1, r6 // icount 524 srli r5, r5, 9 // icount 525 seq r2, r6, r6 // icount 526 nop // to align meminst icount 527 st r2, r1, -16 // icount 528 nop // to align meminst icount 529 stu r3, r0, -12 // icount 530 nop // to align meminst icount 531 stu r2, r1, 0 // icount 532 nop // to align meminst icount 533 ld r2, r1, 6 // icount 534 nop // to align meminst icount 535 st r4, r0, 12 // icount 536 nop // to align meminst icount 537 stu r5, r1, 0 // icount 538 nop // to align meminst icount 539 st r5, r0, 6 // icount 540 nop // to align meminst icount 541 st r2, r0, -14 // icount 542 nop // to align meminst icount 543 st r2, r0, -14 // icount 544 nop // to align meminst icount 545 stu r4, r1, 0 // icount 546 nop // to align meminst icount 547 st r2, r1, -2 // icount 548 nop // to align meminst icount 549 ld r5, r0, -4 // icount 550 nop // to align meminst icount 551 st r2, r1, -2 // icount 552 nop // to align meminst icount 553 ld r6, r1, -12 // icount 554 nop // to align meminst icount 555 ld r2, r1, 0 // icount 556 nop // to align meminst icount 557 ld r6, r0, 14 // icount 558 nop // to align meminst icount 559 ld r5, r1, 2 // icount 560 nop // to align meminst icount 561 ld r2, r1, 4 // icount 562 nop // to align meminst icount 563 st r6, r1, 8 // icount 564 nop // to align meminst icount 565 stu r5, r1, 6 // icount 566 nop // to align meminst icount 567 stu r6, r0, -10 // icount 568 nop // to align meminst icount 569 ld r6, r0, -4 // icount 570 nop // to align meminst icount 571 ld r5, r0, -6 // icount 572 nop // to align meminst icount 573 ld r2, r1, 8 // icount 574 nop // to align meminst icount 575 ld r3, r0, 0 // icount 576 nop // to align meminst icount 577 ld r6, r0, 12 // icount 578 nop // to align meminst icount 579 st r6, r0, -4 // icount 580 nop // to align meminst icount 581 st r2, r0, -14 // icount 582 nop // to align meminst icount 583 st r5, r1, 8 // icount 584 nop // to align meminst icount 585 ld r2, r1, 4 // icount 586 nop // to align meminst icount 587 stu r3, r1, -14 // icount 588 nop // to align meminst icount 589 stu r6, r1, -8 // icount 590 nop // to align meminst icount 591 ld r6, r0, -4 // icount 592 nop // to align meminst icount 593 stu r3, r0, 6 // icount 594 nop // to align meminst icount 595 st r2, r0, -8 // icount 596 nop // to align meminst icount 597 st r4, r0, 6 // icount 598 nop // to align meminst icount 599 ld r5, r1, 14 // icount 600 nop // to align meminst icount 601 ld r5, r1, -2 // icount 602 nop // to align meminst icount 603 st r2, r0, -12 // icount 604 nop // to align meminst icount 605 st r5, r0, 4 // icount 606 nop // to align meminst icount 607 ld r5, r1, 2 // icount 608 nop // to align meminst icount 609 ld r5, r1, -16 // icount 610 nop // to align meminst icount 611 st r5, r1, 4 // icount 612 nop // to align meminst icount 613 ld r2, r1, 2 // icount 614 nop // to align meminst icount 615 ld r6, r1, -6 // icount 616 st r2, r0, 8 // icount 617 addi r1, r1, 0 // change base addr // icount 618 nop // to align meminst icount 619 stu r6, r0, 8 // icount 620 nop // to align meminst icount 621 ld r6, r0, 12 // icount 622 nop // to align meminst icount 623 ld r2, r1, -16 // icount 624 nop // to align meminst icount 625 stu r4, r0, 8 // icount 626 nop // to align meminst icount 627 ld r2, r0, 4 // icount 628 nop // to align meminst icount 629 st r5, r1, 6 // icount 630 nop // to align meminst icount 631 ld r5, r0, 12 // icount 632 nop // to align meminst icount 633 ld r3, r1, 0 // icount 634 nop // to align meminst icount 635 ld r3, r1, -16 // icount 636 nop // to align meminst icount 637 ld r4, r0, -8 // icount 638 nop // to align meminst icount 639 st r5, r0, -8 // icount 640 nop // to align meminst icount 641 stu r4, r0, -16 // icount 642 nop // to align meminst icount 643 ld r3, r0, -16 // icount 644 nop // to align meminst icount 645 ld r2, r1, 14 // icount 646 nop // to align meminst icount 647 st r3, r1, 12 // icount 648 nop // to align meminst icount 649 ld r6, r0, 2 // icount 650 nop // to align meminst icount 651 ld r6, r0, -12 // icount 652 nop // to align meminst icount 653 stu r5, r0, 10 // icount 654 nop // to align meminst icount 655 stu r5, r0, 10 // icount 656 nop // to align meminst icount 657 stu r6, r0, -14 // icount 658 nop // to align meminst icount 659 stu r6, r0, -4 // icount 660 nop // to align meminst icount 661 stu r4, r1, 2 // icount 662 nop // to align meminst icount 663 st r2, r0, 4 // icount 664 nop // to align meminst icount 665 st r2, r0, -4 // icount 666 nop // to align meminst icount 667 stu r4, r1, 4 // icount 668 nop // to align meminst icount 669 st r3, r1, 12 // icount 670 nop // to align meminst icount 671 ld r5, r0, 4 // icount 672 nop // to align meminst icount 673 stu r5, r1, 10 // icount 674 nop // to align meminst icount 675 stu r2, r0, 8 // icount 676 nop // to align meminst icount 677 ld r2, r1, -14 // icount 678 nop // to align meminst icount 679 ld r5, r0, 12 // icount 680 nop // to align meminst icount 681 st r2, r0, 2 // icount 682 nop // to align meminst icount 683 ld r6, r0, -4 // icount 684 nop // to align meminst icount 685 st r5, r0, 6 // icount 686 nop // to align meminst icount 687 stu r4, r0, 4 // icount 688 nop // to align meminst icount 689 stu r4, r0, -16 // icount 690 nop // to align meminst icount 691 ld r6, r1, 10 // icount 692 nop // to align meminst icount 693 stu r3, r1, 8 // icount 694 nop // to align meminst icount 695 stu r5, r1, 14 // icount 696 nop // to align meminst icount 697 stu r6, r1, -14 // icount 698 nop // to align meminst icount 699 stu r2, r0, 10 // icount 700 nop // to align meminst icount 701 ld r4, r0, -10 // icount 702 nop // to align meminst icount 703 ld r2, r1, 10 // icount 704 nop // to align meminst icount 705 stu r4, r0, 4 // icount 706 nop // to align meminst icount 707 stu r5, r0, -14 // icount 708 nop // to align meminst icount 709 ld r4, r1, -6 // icount 710 nop // to align meminst icount 711 st r5, r1, 8 // icount 712 ld r3, r0, -10 // icount 713 andni r7, r1, 12 // icount 714 nop // to align meminst icount 715 ld r4, r0, -10 // icount 716 nop // to align meminst icount 717 st r5, r1, 2 // icount 718 nop // to align meminst icount 719 stu r2, r1, 4 // icount 720 nop // to align meminst icount 721 ld r5, r0, 14 // icount 722 nop // to align meminst icount 723 ld r5, r1, -2 // icount 724 nop // to align meminst icount 725 st r4, r0, -4 // icount 726 nop // to align meminst icount 727 st r6, r0, 2 // icount 728 nop // to align meminst icount 729 st r5, r1, -12 // icount 730 nop // to align meminst icount 731 st r2, r1, -12 // icount 732 nop // to align meminst icount 733 st r2, r1, -16 // icount 734 nop // to align meminst icount 735 ld r3, r1, 10 // icount 736 nop // to align meminst icount 737 ld r2, r0, 14 // icount 738 nop // to align meminst icount 739 st r2, r1, 8 // icount 740 nop // to align meminst icount 741 stu r6, r1, 4 // icount 742 nop // to align meminst icount 743 ld r5, r0, -6 // icount 744 nop // to align meminst icount 745 st r2, r0, -12 // icount 746 nop // to align meminst icount 747 ld r5, r1, -14 // icount 748 nop // to align meminst icount 749 ld r5, r0, -14 // icount 750 nop // to align meminst icount 751 ld r3, r0, -12 // icount 752 nop // to align meminst icount 753 ld r2, r1, 4 // icount 754 nop // to align meminst icount 755 st r6, r0, -12 // icount 756 nop // to align meminst icount 757 stu r3, r0, 12 // icount 758 nop // to align meminst icount 759 ld r4, r1, 8 // icount 760 nop // to align meminst icount 761 ld r2, r1, 10 // icount 762 nop // to align meminst icount 763 st r3, r1, -4 // icount 764 nop // to align meminst icount 765 st r6, r1, -10 // icount 766 nop // to align meminst icount 767 stu r2, r0, 10 // icount 768 nop // to align meminst icount 769 stu r3, r1, 8 // icount 770 nop // to align meminst icount 771 stu r3, r1, 14 // icount 772 nop // to align meminst icount 773 ld r6, r1, -14 // icount 774 nop // to align meminst icount 775 ld r4, r1, 10 // icount 776 nop // to align meminst icount 777 ld r5, r1, -16 // icount 778 ld r5, r0, -4 // icount 779 addi r0, r0, 2 // change base addr // icount 780 nop // to align meminst icount 781 ld r6, r0, 2 // icount 782 nop // to align meminst icount 783 ld r2, r1, -14 // icount 784 nop // to align meminst icount 785 st r2, r0, 14 // icount 786 stu r6, r0, 0 // icount 787 addi r0, r0, 14 // change base addr // icount 788 nop // to align meminst icount 789 stu r3, r0, -16 // icount 790 nop // to align meminst icount 791 ld r4, r0, 0 // icount 792 nop // to align meminst icount 793 st r4, r1, -4 // icount 794 nop // to align meminst icount 795 ld r5, r1, 8 // icount 796 nop // to align meminst icount 797 ld r4, r1, 6 // icount 798 nop // to align meminst icount 799 ld r3, r0, -8 // icount 800 nop // to align meminst icount 801 st r2, r0, 6 // icount 802 nop // to align meminst icount 803 stu r5, r0, 8 // icount 804 nop // to align meminst icount 805 st r5, r0, -10 // icount 806 nop // to align meminst icount 807 st r3, r1, -4 // icount 808 nop // to align meminst icount 809 stu r4, r1, -2 // icount 810 nop // to align meminst icount 811 st r3, r1, -10 // icount 812 nop // to align meminst icount 813 ld r3, r1, -16 // icount 814 ld r6, r0, -4 // icount 815 lbi r5, 0 // icount 816 lbi r2, 0 // icount 817 nop // to align branch icount 818 bnez r2, 28 // icount 819 rori r6, r5, 3 // icount 820 nop // to align meminst icount 821 andni r6, r6, 1 // icount 822 stu r5, r6, 0 // icount 823 srl r4, r1, r6 // icount 824 srl r6, r6, r0 // icount 825 rol r7, r6, r1 // icount 826 nop // to align meminst icount 827 andni r5, r5, 1 // icount 828 stu r6, r5, 10 // icount 829 ror r3, r5, r1 // icount 830 andni r3, r3, 9 // icount 831 roli r3, r7, 1 // icount 832 nop // to align meminst icount 833 andni r2, r2, 1 // icount 834 stu r6, r2, 2 // icount 835 slt r3, r0, r4 // icount 836 srli r6, r3, 14 // icount 837 addi r7, r0, 14 // icount 838 sll r6, r3, r6 // icount 839 rol r3, r2, r3 // icount 840 ror r7, r4, r1 // icount 841 rori r4, r2, 1 // icount 842 lbi r3, 3 // icount 843 slli r3, r5, 15 // icount 844 srli r3, r7, 7 // icount 845 slt r3, r4, r7 // icount 846 sub r5, r4, r6 // icount 847 addi r7, r2, 9 // icount 848 srl r4, r2, r6 // icount 849 srl r6, r5, r6 // icount 850 andn r7, r2, r4 // icount 851 srli r4, r7, 1 // icount 852 nop // to align meminst icount 853 srl r2, r4, r5 // icount 854 nop // to align meminst icount 855 stu r2, r0, -2 // icount 856 nop // to align meminst icount 857 ld r4, r1, -6 // icount 858 nop // to align meminst icount 859 ld r4, r1, 8 // icount 860 nop // to align meminst icount 861 ld r6, r1, 6 // icount 862 nop // to align meminst icount 863 st r3, r1, 14 // icount 864 nop // to align meminst icount 865 ld r4, r0, -2 // icount 866 nop // to align meminst icount 867 stu r5, r0, -12 // icount 868 nop // to align meminst icount 869 st r6, r1, 8 // icount 870 nop // to align meminst icount 871 stu r4, r0, -10 // icount 872 nop // to align meminst icount 873 ld r3, r1, -6 // icount 874 nop // to align meminst icount 875 ld r4, r0, -2 // icount 876 nop // to align meminst icount 877 ld r4, r1, -8 // icount 878 nop // to align meminst icount 879 ld r5, r1, -2 // icount 880 nop // to align meminst icount 881 st r6, r1, 4 // icount 882 nop // to align meminst icount 883 ld r4, r1, -6 // icount 884 nop // to align meminst icount 885 ld r3, r1, 4 // icount 886 nop // to align meminst icount 887 ld r4, r1, 14 // icount 888 nop // to align meminst icount 889 ld r3, r0, -14 // icount 890 nop // to align meminst icount 891 st r5, r1, -4 // icount 892 nop // to align meminst icount 893 st r3, r1, 8 // icount 894 nop // to align meminst icount 895 ld r5, r0, 8 // icount 896 nop // to align meminst icount 897 st r5, r0, -12 // icount 898 nop // to align meminst icount 899 st r2, r0, -10 // icount 900 nop // to align meminst icount 901 ld r3, r0, 6 // icount 902 nop // to align meminst icount 903 st r2, r0, 2 // icount 904 nop // to align meminst icount 905 stu r5, r0, 6 // icount 906 nop // to align meminst icount 907 st r5, r0, 2 // icount 908 nop // to align meminst icount 909 st r5, r0, -2 // icount 910 nop // to align meminst icount 911 ld r5, r0, -16 // icount 912 nop // to align meminst icount 913 ld r6, r0, 6 // icount 914 nop // to align meminst icount 915 stu r6, r1, -16 // icount 916 nop // to align meminst icount 917 stu r5, r1, 8 // icount 918 nop // to align meminst icount 919 stu r3, r0, 6 // icount 920 stu r2, r1, 0 // icount 921 rol r3, r7, r6 // icount 922 nop // to align meminst icount 923 ld r4, r1, -12 // icount 924 nop // to align meminst icount 925 ld r4, r1, 2 // icount 926 nop // to align meminst icount 927 st r2, r0, -8 // icount 928 nop // to align meminst icount 929 ld r6, r0, 10 // icount 930 nop // to align meminst icount 931 ld r5, r0, 14 // icount 932 nop // to align meminst icount 933 ld r3, r0, 4 // icount 934 nop // to align meminst icount 935 st r4, r1, 14 // icount 936 ld r3, r0, 2 // icount 937 sco r2, r4, r1 // icount 938 nop // to align meminst icount 939 st r5, r1, -12 // icount 940 nop // to align meminst icount 941 ld r2, r1, -6 // icount 942 nop // to align meminst icount 943 st r5, r0, 14 // icount 944 nop // to align meminst icount 945 ld r5, r1, -14 // icount 946 nop // to align meminst icount 947 ld r2, r0, -14 // icount 948 nop // to align meminst icount 949 ld r5, r1, 10 // icount 950 nop // to align meminst icount 951 st r5, r1, -2 // icount 952 nop // to align meminst icount 953 stu r6, r1, 2 // icount 954 nop // to align meminst icount 955 ld r2, r0, 0 // icount 956 nop // to align meminst icount 957 stu r4, r0, -2 // icount 958 nop // to align meminst icount 959 stu r2, r1, 2 // icount 960 nop // to align meminst icount 961 ld r2, r1, -6 // icount 962 nop // to align meminst icount 963 ld r2, r0, -16 // icount 964 nop // to align meminst icount 965 ld r2, r1, -16 // icount 966 nop // to align meminst icount 967 stu r6, r0, -6 // icount 968 nop // to align meminst icount 969 st r4, r1, -2 // icount 970 nop // to align meminst icount 971 ld r6, r1, -4 // icount 972 nop // to align meminst icount 973 ld r4, r1, 2 // icount 974 nop // to align meminst icount 975 ld r3, r1, -6 // icount 976 nop // to align meminst icount 977 ld r5, r0, -4 // icount 978 nop // to align meminst icount 979 st r5, r1, -2 // icount 980 nop // to align meminst icount 981 ld r4, r0, 12 // icount 982 nop // to align meminst icount 983 stu r5, r1, -14 // icount 984 nop // to align meminst icount 985 ld r2, r0, -16 // icount 986 nop // to align meminst icount 987 ld r5, r1, -4 // icount 988 nop // to align meminst icount 989 ld r4, r0, -2 // icount 990 nop // to align meminst icount 991 stu r2, r1, -16 // icount 992 nop // to align meminst icount 993 ld r5, r1, 8 // icount 994 nop // to align meminst icount 995 ld r4, r1, 14 // icount 996 ld r6, r1, 14 // icount 997 lbi r4, 0 // icount 998 lbi r6, 0 // icount 999 nop // to align branch icount 1000 bgez r2, 32 // icount 1001 sle r5, r5, r4 // icount 1002 nop // to align meminst icount 1003 andni r7, r7, 1 // icount 1004 stu r5, r7, 4 // icount 1005 andn r2, r7, r6 // icount 1006 roli r5, r5, 10 // icount 1007 rol r2, r3, r3 // icount 1008 add r4, r5, r7 // icount 1009 sco r6, r1, r0 // icount 1010 srl r3, r4, r2 // icount 1011 andni r5, r5, 1 // icount 1012 stu r5, r5, 10 // icount 1013 xori r3, r7, 4 // icount 1014 nop // to align meminst icount 1015 andni r5, r5, 1 // icount 1016 stu r2, r5, 4 // icount 1017 xor r6, r7, r6 // icount 1018 andni r2, r0, 7 // icount 1019 andni r2, r2, 1 // icount 1020 ld r5, r2, 4 // icount 1021 ror r4, r6, r7 // icount 1022 slbi r2, 5 // icount 1023 xori r2, r5, 1 // icount 1024 ror r5, r2, r5 // icount 1025 rori r3, r2, 2 // icount 1026 srl r6, r4, r0 // icount 1027 slbi r4, 9 // icount 1028 add r3, r1, r1 // icount 1029 andni r5, r5, 1 // icount 1030 st r4, r5, 10 // icount 1031 rori r4, r7, 4 // icount 1032 nop // to align meminst icount 1033 andni r0, r0, 1 // icount 1034 ld r4, r0, 12 // icount 1035 andn r5, r3, r0 // icount 1036 nop // to align meminst icount 1037 andni r1, r1, 1 // icount 1038 ld r7, r1, 14 // icount 1039 srl r2, r6, r6 // icount 1040 sle r4, r5, r5 // icount 1041 slli r7, r6, 9 // icount 1042 xori r3, r0, 6 // icount 1043 xori r2, r1, 6 // icount 1044 nop // to align meminst icount 1045 ld r6, r0, 6 // icount 1046 nop // to align meminst icount 1047 ld r4, r0, 10 // icount 1048 nop // to align meminst icount 1049 ld r2, r1, -12 // icount 1050 nop // to align meminst icount 1051 ld r6, r0, 12 // icount 1052 nop // to align meminst icount 1053 st r5, r1, -14 // icount 1054 nop // to align meminst icount 1055 ld r4, r0, -16 // icount 1056 nop // to align meminst icount 1057 ld r6, r0, -10 // icount 1058 nop // to align meminst icount 1059 ld r2, r0, 0 // icount 1060 nop // to align meminst icount 1061 ld r3, r1, 14 // icount 1062 nop // to align meminst icount 1063 ld r2, r0, -4 // icount 1064 nop // to align meminst icount 1065 st r3, r0, -16 // icount 1066 nop // to align meminst icount 1067 st r4, r0, -10 // icount 1068 nop // to align meminst icount 1069 ld r3, r1, -4 // icount 1070 nop // to align meminst icount 1071 st r6, r1, -16 // icount 1072 nop // to align meminst icount 1073 ld r4, r0, 6 // icount 1074 nop // to align meminst icount 1075 st r3, r1, 2 // icount 1076 nop // to align meminst icount 1077 ld r2, r0, -16 // icount 1078 nop // to align meminst icount 1079 stu r2, r1, 14 // icount 1080 nop // to align meminst icount 1081 ld r6, r0, 14 // icount 1082 ld r6, r0, -16 // icount 1083 addi r0, r0, -4 // change base addr // icount 1084 nop // to align meminst icount 1085 st r3, r1, 6 // icount 1086 nop // to align meminst icount 1087 ld r5, r0, -16 // icount 1088 nop // to align meminst icount 1089 stu r4, r1, -2 // icount 1090 nop // to align meminst icount 1091 ld r4, r0, 4 // icount 1092 nop // to align meminst icount 1093 st r3, r1, -16 // icount 1094 nop // to align meminst icount 1095 stu r6, r1, -12 // icount 1096 nop // to align meminst icount 1097 ld r2, r1, -2 // icount 1098 nop // to align meminst icount 1099 st r4, r1, -6 // icount 1100 nop // to align meminst icount 1101 st r3, r1, -4 // icount 1102 nop // to align meminst icount 1103 st r4, r1, 14 // icount 1104 ld r5, r0, -10 // icount 1105 sle r3, r7, r3 // icount 1106 nop // to align meminst icount 1107 andn r4, r7, r3 // icount 1108 nop // to align meminst icount 1109 stu r2, r1, 8 // icount 1110 nop // to align meminst icount 1111 ld r5, r0, 12 // icount 1112 nop // to align meminst icount 1113 ld r3, r1, -10 // icount 1114 nop // to align meminst icount 1115 ld r6, r1, 4 // icount 1116 nop // to align meminst icount 1117 st r6, r0, -8 // icount 1118 nop // to align meminst icount 1119 ld r2, r0, -2 // icount 1120 nop // to align meminst icount 1121 st r5, r0, -4 // icount 1122 nop // to align meminst icount 1123 stu r5, r1, 4 // icount 1124 nop // to align meminst icount 1125 stu r2, r1, -10 // icount 1126 nop // to align meminst icount 1127 st r4, r1, 4 // icount 1128 nop // to align meminst icount 1129 ld r6, r0, 12 // icount 1130 nop // to align meminst icount 1131 ld r2, r1, -10 // icount 1132 nop // to align meminst icount 1133 st r3, r0, 6 // icount 1134 nop // to align meminst icount 1135 ld r5, r1, 4 // icount 1136 nop // to align meminst icount 1137 stu r4, r1, 10 // icount 1138 nop // to align meminst icount 1139 st r6, r1, -14 // icount 1140 nop // to align meminst icount 1141 ld r5, r1, 10 // icount 1142 nop // to align meminst icount 1143 ld r6, r1, -12 // icount 1144 nop // to align meminst icount 1145 stu r2, r1, -10 // icount 1146 nop // to align meminst icount 1147 stu r5, r1, 6 // icount 1148 nop // to align meminst icount 1149 ld r2, r1, 8 // icount 1150 nop // to align meminst icount 1151 stu r5, r1, 0 // icount 1152 nop // to align meminst icount 1153 ld r6, r1, -4 // icount 1154 nop // to align meminst icount 1155 stu r3, r1, -12 // icount 1156 nop // to align meminst icount 1157 stu r2, r1, 6 // icount 1158 nop // to align meminst icount 1159 stu r2, r0, -8 // icount 1160 nop // to align meminst icount 1161 stu r4, r0, -16 // icount 1162 nop // to align meminst icount 1163 st r3, r1, -6 // icount 1164 nop // to align meminst icount 1165 st r5, r1, 14 // icount 1166 nop // to align meminst icount 1167 ld r6, r1, -4 // icount 1168 nop // to align meminst icount 1169 stu r3, r1, 10 // icount 1170 nop // to align meminst icount 1171 stu r5, r0, -16 // icount 1172 nop // to align meminst icount 1173 st r3, r0, 8 // icount 1174 nop // to align meminst icount 1175 ld r5, r1, -4 // icount 1176 nop // to align meminst icount 1177 st r4, r1, 10 // icount 1178 nop // to align meminst icount 1179 ld r4, r0, 2 // icount 1180 nop // to align meminst icount 1181 ld r3, r1, 6 // icount 1182 nop // to align meminst icount 1183 st r5, r1, -6 // icount 1184 nop // to align meminst icount 1185 ld r4, r1, 12 // icount 1186 nop // to align meminst icount 1187 st r2, r0, -8 // icount 1188 nop // to align meminst icount 1189 ld r2, r0, -6 // icount 1190 nop // to align meminst icount 1191 st r2, r1, 12 // icount 1192 nop // to align meminst icount 1193 stu r6, r1, 6 // icount 1194 nop // to align meminst icount 1195 ld r6, r1, 8 // icount 1196 nop // to align meminst icount 1197 stu r5, r0, -8 // icount 1198 nop // to align meminst icount 1199 stu r3, r0, -16 // icount 1200 nop // to align meminst icount 1201 ld r6, r1, -14 // icount 1202 nop // to align meminst icount 1203 ld r6, r0, -8 // icount 1204 nop // to align meminst icount 1205 ld r6, r0, -2 // icount 1206 nop // to align meminst icount 1207 ld r5, r0, 8 // icount 1208 nop // to align meminst icount 1209 ld r4, r1, 10 // icount 1210 nop // to align meminst icount 1211 stu r6, r0, -8 // icount 1212 nop // to align meminst icount 1213 ld r3, r0, -16 // icount 1214 nop // to align meminst icount 1215 ld r3, r1, 2 // icount 1216 nop // to align meminst icount 1217 ld r5, r1, -2 // icount 1218 nop // to align meminst icount 1219 ld r2, r0, 4 // icount 1220 nop // to align meminst icount 1221 ld r2, r1, 12 // icount 1222 nop // to align meminst icount 1223 ld r2, r0, 0 // icount 1224 nop // to align meminst icount 1225 stu r2, r1, -6 // icount 1226 nop // to align meminst icount 1227 stu r5, r1, 10 // icount 1228 nop // to align meminst icount 1229 stu r3, r1, 4 // icount 1230 nop // to align meminst icount 1231 st r4, r1, 6 // icount 1232 nop // to align meminst icount 1233 stu r6, r1, 6 // icount 1234 nop // to align meminst icount 1235 st r5, r1, -14 // icount 1236 nop // to align meminst icount 1237 stu r4, r1, -12 // icount 1238 nop // to align meminst icount 1239 ld r5, r0, 8 // icount 1240 nop // to align meminst icount 1241 ld r5, r1, -14 // icount 1242 nop // to align meminst icount 1243 st r4, r1, -4 // icount 1244 nop // to align meminst icount 1245 ld r5, r0, 12 // icount 1246 nop // to align meminst icount 1247 st r3, r1, 8 // icount 1248 nop // to align meminst icount 1249 stu r5, r0, -6 // icount 1250 nop // to align meminst icount 1251 st r3, r0, 6 // icount 1252 nop // to align meminst icount 1253 stu r4, r1, -16 // icount 1254 nop // to align meminst icount 1255 stu r5, r1, 12 // icount 1256 nop // to align meminst icount 1257 st r4, r0, -10 // icount 1258 nop // to align meminst icount 1259 ld r2, r1, -6 // icount 1260 nop // to align meminst icount 1261 ld r5, r0, -10 // icount 1262 nop // to align meminst icount 1263 stu r5, r0, -2 // icount 1264 nop // to align meminst icount 1265 st r3, r0, -16 // icount 1266 nop // to align meminst icount 1267 st r2, r1, 14 // icount 1268 st r2, r0, -2 // icount 1269 lbi r2, 0 // icount 1270 lbi r4, 0 // icount 1271 nop // to align branch icount 1272 bltz r4, 0 // icount 1273 st r6, r0, -16 // icount 1274 nop // to align meminst icount 1275 addi r1, r1, -2 // change base addr // icount 1276 nop // to align meminst icount 1277 st r2, r0, 2 // icount 1278 nop // to align meminst icount 1279 ld r6, r1, 8 // icount 1280 nop // to align meminst icount 1281 ld r5, r1, 10 // icount 1282 nop // to align meminst icount 1283 st r4, r1, -12 // icount 1284 ld r5, r0, -12 // icount 1285 add r4, r6, r2 // icount 1286 nop // to align meminst icount 1287 ld r4, r0, 2 // icount 1288 nop // to align meminst icount 1289 ld r4, r1, -10 // icount 1290 nop // to align meminst icount 1291 stu r6, r0, -16 // icount 1292 nop // to align meminst icount 1293 st r2, r0, 6 // icount 1294 nop // to align meminst icount 1295 ld r2, r1, 8 // icount 1296 nop // to align meminst icount 1297 stu r6, r0, -6 // icount 1298 nop // to align meminst icount 1299 ld r5, r0, -6 // icount 1300 nop // to align meminst icount 1301 st r4, r0, 4 // icount 1302 nop // to align meminst icount 1303 ld r2, r0, -16 // icount 1304 nop // to align meminst icount 1305 stu r4, r1, 6 // icount 1306 nop // to align meminst icount 1307 ld r6, r0, -4 // icount 1308 nop // to align meminst icount 1309 stu r6, r1, 12 // icount 1310 nop // to align meminst icount 1311 ld r3, r1, -12 // icount 1312 nop // to align meminst icount 1313 st r4, r1, -6 // icount 1314 nop // to align meminst icount 1315 stu r2, r0, 4 // icount 1316 nop // to align meminst icount 1317 st r6, r1, 12 // icount 1318 nop // to align meminst icount 1319 ld r5, r1, 12 // icount 1320 nop // to align meminst icount 1321 st r3, r1, -10 // icount 1322 nop // to align meminst icount 1323 stu r3, r1, -14 // icount 1324 nop // to align meminst icount 1325 stu r5, r1, 8 // icount 1326 nop // to align meminst icount 1327 ld r5, r1, -10 // icount 1328 nop // to align meminst icount 1329 ld r5, r1, 8 // icount 1330 nop // to align meminst icount 1331 stu r3, r1, -16 // icount 1332 nop // to align meminst icount 1333 st r4, r0, -4 // icount 1334 nop // to align meminst icount 1335 st r2, r1, -2 // icount 1336 nop // to align meminst icount 1337 ld r3, r0, -16 // icount 1338 nop // to align meminst icount 1339 stu r2, r1, 10 // icount 1340 nop // to align meminst icount 1341 ld r6, r0, -8 // icount 1342 nop // to align meminst icount 1343 ld r5, r1, 8 // icount 1344 nop // to align meminst icount 1345 ld r6, r0, 0 // icount 1346 nop // to align meminst icount 1347 ld r6, r0, -14 // icount 1348 nop // to align meminst icount 1349 stu r5, r1, -6 // icount 1350 nop // to align meminst icount 1351 ld r2, r1, 6 // icount 1352 nop // to align meminst icount 1353 stu r4, r0, 12 // icount 1354 nop // to align meminst icount 1355 stu r6, r0, 0 // icount 1356 nop // to align meminst icount 1357 stu r3, r1, 0 // icount 1358 nop // to align meminst icount 1359 ld r6, r1, 4 // icount 1360 nop // to align meminst icount 1361 stu r6, r1, -4 // icount 1362 nop // to align meminst icount 1363 ld r2, r0, 12 // icount 1364 nop // to align meminst icount 1365 stu r6, r0, -6 // icount 1366 nop // to align meminst icount 1367 stu r4, r1, 0 // icount 1368 nop // to align meminst icount 1369 ld r2, r1, -8 // icount 1370 nop // to align meminst icount 1371 st r6, r0, -12 // icount 1372 nop // to align meminst icount 1373 ld r3, r1, 8 // icount 1374 nop // to align meminst icount 1375 st r5, r0, 14 // icount 1376 nop // to align meminst icount 1377 ld r5, r0, 14 // icount 1378 nop // to align meminst icount 1379 ld r5, r0, -6 // icount 1380 nop // to align meminst icount 1381 ld r3, r1, -14 // icount 1382 nop // to align meminst icount 1383 st r4, r1, 4 // icount 1384 nop // to align meminst icount 1385 ld r5, r0, 12 // icount 1386 nop // to align meminst icount 1387 ld r3, r0, 8 // icount 1388 nop // to align meminst icount 1389 st r3, r0, 2 // icount 1390 nop // to align meminst icount 1391 ld r2, r1, 8 // icount 1392 nop // to align meminst icount 1393 st r3, r0, 8 // icount 1394 nop // to align meminst icount 1395 st r4, r0, -10 // icount 1396 nop // to align meminst icount 1397 ld r3, r0, -16 // icount 1398 ld r4, r0, 12 // icount 1399 andni r5, r5, 1 // icount 1400 nop // to align meminst icount 1401 ld r3, r5, 4 // icount 1402 nop // to align meminst icount 1403 st r6, r0, 14 // icount 1404 nop // to align meminst icount 1405 ld r6, r1, -10 // icount 1406 nop // to align meminst icount 1407 ld r6, r0, 8 // icount 1408 nop // to align meminst icount 1409 ld r6, r0, -16 // icount 1410 nop // to align meminst icount 1411 ld r4, r1, 4 // icount 1412 nop // to align meminst icount 1413 ld r6, r1, 14 // icount 1414 nop // to align meminst icount 1415 st r3, r0, -2 // icount 1416 nop // to align meminst icount 1417 stu r6, r1, 14 // icount 1418 nop // to align meminst icount 1419 st r6, r0, -12 // icount 1420 nop // to align meminst icount 1421 stu r6, r1, -16 // icount 1422 nop // to align meminst icount 1423 stu r6, r1, 6 // icount 1424 nop // to align meminst icount 1425 st r5, r0, 10 // icount 1426 nop // to align meminst icount 1427 st r5, r0, 4 // icount 1428 nop // to align meminst icount 1429 stu r5, r0, -2 // icount 1430 nop // to align meminst icount 1431 ld r5, r0, 4 // icount 1432 nop // to align meminst icount 1433 ld r6, r0, 4 // icount 1434 nop // to align meminst icount 1435 ld r2, r0, -6 // icount 1436 nop // to align meminst icount 1437 st r4, r1, 6 // icount 1438 nop // to align meminst icount 1439 st r5, r1, -4 // icount 1440 nop // to align meminst icount 1441 ld r3, r0, 12 // icount 1442 nop // to align meminst icount 1443 ld r5, r0, -12 // icount 1444 nop // to align meminst icount 1445 ld r6, r0, 6 // icount 1446 nop // to align meminst icount 1447 stu r2, r1, 6 // icount 1448 nop // to align meminst icount 1449 stu r5, r1, -6 // icount 1450 nop // to align meminst icount 1451 stu r2, r1, -6 // icount 1452 nop // to align meminst icount 1453 st r3, r1, 8 // icount 1454 nop // to align meminst icount 1455 st r5, r1, -6 // icount 1456 nop // to align meminst icount 1457 stu r4, r0, -16 // icount 1458 nop // to align meminst icount 1459 st r3, r1, -12 // icount 1460 nop // to align meminst icount 1461 st r6, r0, 4 // icount 1462 ld r5, r0, -8 // icount 1463 addi r0, r0, -14 // change base addr // icount 1464 nop // to align meminst icount 1465 st r5, r0, 4 // icount 1466 nop // to align meminst icount 1467 ld r2, r1, -8 // icount 1468 nop // to align meminst icount 1469 st r2, r0, -4 // icount 1470 nop // to align meminst icount 1471 stu r2, r1, -4 // icount 1472 nop // to align meminst icount 1473 ld r6, r0, 14 // icount 1474 nop // to align meminst icount 1475 st r5, r1, -12 // icount 1476 nop // to align meminst icount 1477 ld r3, r1, -4 // icount 1478 nop // to align meminst icount 1479 stu r4, r0, 8 // icount 1480 nop // to align meminst icount 1481 stu r5, r1, -12 // icount 1482 nop // to align meminst icount 1483 ld r4, r1, -10 // icount 1484 nop // to align meminst icount 1485 ld r6, r1, 10 // icount 1486 nop // to align meminst icount 1487 stu r6, r1, -8 // icount 1488 nop // to align meminst icount 1489 stu r3, r1, -12 // icount 1490 nop // to align meminst icount 1491 ld r5, r1, 6 // icount 1492 nop // to align meminst icount 1493 st r5, r0, 0 // icount 1494 nop // to align meminst icount 1495 st r6, r0, -2 // icount 1496 nop // to align meminst icount 1497 st r2, r0, -2 // icount 1498 nop // to align meminst icount 1499 ld r2, r0, -10 // icount 1500 nop // to align meminst icount 1501 stu r6, r0, 6 // icount 1502 nop // to align meminst icount 1503 ld r2, r1, -6 // icount 1504 nop // to align meminst icount 1505 ld r6, r1, -4 // icount 1506 nop // to align meminst icount 1507 ld r4, r1, 6 // icount 1508 nop // to align meminst icount 1509 ld r5, r0, 4 // icount 1510 nop // to align meminst icount 1511 stu r4, r0, -10 // icount 1512 nop // to align meminst icount 1513 ld r4, r1, 12 // icount 1514 nop // to align meminst icount 1515 stu r4, r1, -12 // icount 1516 nop // to align meminst icount 1517 st r4, r0, 8 // icount 1518 nop // to align meminst icount 1519 ld r5, r1, 0 // icount 1520 nop // to align meminst icount 1521 st r5, r0, 2 // icount 1522 nop // to align meminst icount 1523 ld r2, r0, -4 // icount 1524 nop // to align meminst icount 1525 st r2, r1, 0 // icount 1526 nop // to align meminst icount 1527 ld r4, r1, 6 // icount 1528 nop // to align meminst icount 1529 stu r3, r0, 0 // icount 1530 stu r3, r0, -14 // icount 1531 lbi r3, 0 // icount 1532 lbi r4, 0 // icount 1533 nop // to align branch icount 1534 bltz r5, 24 // icount 1535 andni r6, r6, 1 // icount 1536 stu r4, r6, 10 // icount 1537 seq r7, r0, r0 // icount 1538 sle r2, r6, r7 // icount 1539 andni r5, r5, 1 // icount 1540 ld r6, r5, 0 // icount 1541 seq r4, r1, r6 // icount 1542 sle r2, r0, r5 // icount 1543 xori r6, r3, 1 // icount 1544 sll r3, r5, r6 // icount 1545 sub r3, r0, r7 // icount 1546 lbi r3, 6 // icount 1547 addi r2, r6, 0 // icount 1548 xor r5, r3, r5 // icount 1549 addi r4, r3, 2 // icount 1550 srli r2, r0, 2 // icount 1551 andni r1, r1, 1 // icount 1552 ld r3, r1, 8 // icount 1553 sco r7, r4, r1 // icount 1554 xor r4, r5, r1 // icount 1555 andni r6, r6, 1 // icount 1556 ld r4, r6, 12 // icount 1557 slt r7, r6, r4 // icount 1558 slbi r3, 13 // icount 1559 andni r1, r1, 1 // icount 1560 stu r6, r1, 0 // icount 1561 slbi r6, 9 // icount 1562 ror r7, r1, r0 // icount 1563 slli r7, r1, 6 // icount 1564 nop // to align meminst icount 1565 st r5, r1, -2 // icount 1566 nop // to align meminst icount 1567 stu r2, r1, 14 // icount 1568 nop // to align meminst icount 1569 ld r4, r0, 4 // icount 1570 nop // to align meminst icount 1571 st r6, r0, -10 // icount 1572 nop // to align meminst icount 1573 stu r2, r0, 10 // icount 1574 nop // to align meminst icount 1575 ld r2, r1, -4 // icount 1576 nop // to align meminst icount 1577 stu r5, r1, 4 // icount 1578 nop // to align meminst icount 1579 ld r4, r0, -8 // icount 1580 nop // to align meminst icount 1581 stu r3, r1, 0 // icount 1582 nop // to align meminst icount 1583 ld r2, r0, 2 // icount 1584 nop // to align meminst icount 1585 ld r6, r0, 12 // icount 1586 nop // to align meminst icount 1587 st r4, r0, -12 // icount 1588 nop // to align meminst icount 1589 ld r2, r1, -10 // icount 1590 nop // to align meminst icount 1591 stu r2, r1, -4 // icount 1592 nop // to align meminst icount 1593 stu r5, r1, 6 // icount 1594 st r3, r1, 4 // icount 1595 addi r0, r0, 12 // change base addr // icount 1596 nop // to align meminst icount 1597 ld r4, r0, -2 // icount 1598 nop // to align meminst icount 1599 ld r5, r1, 2 // icount 1600 nop // to align meminst icount 1601 ld r3, r0, 14 // icount 1602 stu r4, r0, 6 // icount 1603 ror r5, r5, r3 // icount 1604 ld r5, r0, -2 // icount 1605 ror r4, r0, r5 // icount 1606 nop // to align meminst icount 1607 ld r2, r1, 2 // icount 1608 nop // to align meminst icount 1609 ld r5, r1, 0 // icount 1610 nop // to align meminst icount 1611 stu r5, r1, -6 // icount 1612 nop // to align meminst icount 1613 ld r3, r1, 0 // icount 1614 nop // to align meminst icount 1615 ld r4, r0, 10 // icount 1616 nop // to align meminst icount 1617 ld r4, r1, 14 // icount 1618 nop // to align meminst icount 1619 stu r6, r1, 14 // icount 1620 nop // to align meminst icount 1621 ld r3, r0, 0 // icount 1622 nop // to align meminst icount 1623 ld r4, r0, -4 // icount 1624 nop // to align meminst icount 1625 stu r6, r1, 14 // icount 1626 nop // to align meminst icount 1627 st r4, r1, 10 // icount 1628 nop // to align meminst icount 1629 st r6, r1, 0 // icount 1630 nop // to align meminst icount 1631 ld r3, r1, 4 // icount 1632 nop // to align meminst icount 1633 stu r6, r1, -6 // icount 1634 nop // to align meminst icount 1635 ld r2, r0, -12 // icount 1636 nop // to align meminst icount 1637 st r4, r0, 10 // icount 1638 nop // to align meminst icount 1639 ld r6, r0, 4 // icount 1640 nop // to align meminst icount 1641 st r6, r0, -8 // icount 1642 nop // to align meminst icount 1643 ld r6, r1, 10 // icount 1644 nop // to align meminst icount 1645 stu r4, r1, -6 // icount 1646 nop // to align meminst icount 1647 ld r3, r1, -12 // icount 1648 nop // to align meminst icount 1649 ld r3, r1, 12 // icount 1650 nop // to align meminst icount 1651 st r5, r0, -14 // icount 1652 nop // to align meminst icount 1653 ld r3, r0, 6 // icount 1654 nop // to align meminst icount 1655 st r3, r1, 8 // icount 1656 nop // to align meminst icount 1657 ld r2, r0, -8 // icount 1658 nop // to align meminst icount 1659 st r2, r0, -4 // icount 1660 nop // to align meminst icount 1661 st r6, r0, 12 // icount 1662 nop // to align meminst icount 1663 ld r3, r1, -10 // icount 1664 nop // to align meminst icount 1665 ld r6, r1, 0 // icount 1666 nop // to align meminst icount 1667 ld r6, r1, -14 // icount 1668 nop // to align meminst icount 1669 st r3, r0, -14 // icount 1670 nop // to align meminst icount 1671 ld r2, r0, 0 // icount 1672 nop // to align meminst icount 1673 st r6, r0, 10 // icount 1674 nop // to align meminst icount 1675 st r4, r1, -4 // icount 1676 nop // to align meminst icount 1677 ld r3, r1, 4 // icount 1678 nop // to align meminst icount 1679 ld r4, r1, -6 // icount 1680 nop // to align meminst icount 1681 stu r3, r1, -6 // icount 1682 nop // to align meminst icount 1683 stu r5, r0, 6 // icount 1684 nop // to align meminst icount 1685 st r4, r1, -2 // icount 1686 nop // to align meminst icount 1687 ld r3, r0, -14 // icount 1688 st r2, r0, 14 // icount 1689 lbi r5, 0 // icount 1690 lbi r2, 0 // icount 1691 nop // to align branch icount 1692 beqz r7, 0 // icount 1693 st r3, r1, 2 // icount 1694 nop // to align meminst icount 1695 ld r5, r0, 2 // icount 1696 nop // to align meminst icount 1697 st r4, r1, 2 // icount 1698 nop // to align meminst icount 1699 st r3, r0, -6 // icount 1700 nop // to align meminst icount 1701 stu r6, r1, -4 // icount 1702 nop // to align meminst icount 1703 ld r5, r1, -10 // icount 1704 nop // to align meminst icount 1705 stu r6, r1, -8 // icount 1706 nop // to align meminst icount 1707 st r3, r0, -2 // icount 1708 nop // to align meminst icount 1709 st r4, r1, 0 // icount 1710 nop // to align meminst icount 1711 ld r4, r0, -4 // icount 1712 nop // to align meminst icount 1713 ld r2, r1, -14 // icount 1714 nop // to align meminst icount 1715 ld r2, r1, 8 // icount 1716 nop // to align meminst icount 1717 ld r6, r1, 10 // icount 1718 nop // to align meminst icount 1719 ld r2, r1, -6 // icount 1720 nop // to align meminst icount 1721 stu r4, r0, -8 // icount 1722 nop // to align meminst icount 1723 ld r6, r0, 2 // icount 1724 nop // to align meminst icount 1725 ld r3, r1, 2 // icount 1726 nop // to align meminst icount 1727 ld r2, r1, 4 // icount 1728 nop // to align meminst icount 1729 stu r2, r0, -2 // icount 1730 nop // to align meminst icount 1731 stu r5, r1, 12 // icount 1732 nop // to align meminst icount 1733 ld r5, r0, -10 // icount 1734 nop // to align meminst icount 1735 ld r2, r0, 6 // icount 1736 nop // to align meminst icount 1737 ld r4, r1, -12 // icount 1738 nop // to align meminst icount 1739 ld r4, r1, 2 // icount 1740 ld r6, r1, -4 // icount 1741 lbi r7, 0 // icount 1742 lbi r5, 0 // icount 1743 nop // to align branch icount 1744 bgez r5, 16 // icount 1745 andni r7, r7, 1 // icount 1746 st r7, r7, 8 // icount 1747 rori r2, r0, 4 // icount 1748 sle r4, r3, r7 // icount 1749 addi r7, r5, 8 // icount 1750 nop // to align meminst icount 1751 andni r0, r0, 1 // icount 1752 stu r3, r0, 14 // icount 1753 sle r6, r2, r3 // icount 1754 add r3, r2, r1 // icount 1755 add r2, r5, r6 // icount 1756 srl r2, r0, r0 // icount 1757 slli r2, r1, 15 // icount 1758 slbi r5, 11 // icount 1759 andni r3, r3, 1 // icount 1760 ld r7, r3, 0 // icount 1761 seq r2, r6, r0 // icount 1762 nop // to align meminst icount 1763 andni r0, r0, 1 // icount 1764 ld r2, r0, 14 // icount 1765 rol r5, r5, r1 // icount 1766 nop // to align meminst icount 1767 andni r6, r0, 8 // icount 1768 nop // to align meminst icount 1769 st r6, r0, 6 // icount 1770 nop // to align meminst icount 1771 stu r6, r1, 12 // icount 1772 nop // to align meminst icount 1773 stu r2, r1, 10 // icount 1774 nop // to align meminst icount 1775 stu r3, r1, -4 // icount 1776 nop // to align meminst icount 1777 ld r4, r1, -8 // icount 1778 nop // to align meminst icount 1779 st r2, r0, -4 // icount 1780 nop // to align meminst icount 1781 st r3, r0, 4 // icount 1782 nop // to align meminst icount 1783 st r5, r1, -8 // icount 1784 nop // to align meminst icount 1785 stu r5, r0, -4 // icount 1786 nop // to align meminst icount 1787 ld r2, r1, 8 // icount 1788 nop // to align meminst icount 1789 ld r3, r0, -14 // icount 1790 nop // to align meminst icount 1791 stu r4, r1, -14 // icount 1792 nop // to align meminst icount 1793 st r5, r0, -4 // icount 1794 nop // to align meminst icount 1795 stu r2, r0, 2 // icount 1796 nop // to align meminst icount 1797 ld r2, r0, 4 // icount 1798 nop // to align meminst icount 1799 st r6, r1, -2 // icount 1800 nop // to align meminst icount 1801 stu r2, r1, -2 // icount 1802 st r5, r1, -10 // icount 1803 xor r5, r6, r0 // icount 1804 nop // to align meminst icount 1805 ld r3, r0, 10 // icount 1806 nop // to align meminst icount 1807 st r3, r1, -8 // icount 1808 nop // to align meminst icount 1809 ld r3, r0, -4 // icount 1810 nop // to align meminst icount 1811 st r4, r0, 8 // icount 1812 stu r6, r0, 14 // icount 1813 addi r0, r0, -2 // change base addr // icount 1814 nop // to align meminst icount 1815 ld r6, r0, 2 // icount 1816 nop // to align meminst icount 1817 stu r4, r0, -12 // icount 1818 nop // to align meminst icount 1819 stu r3, r0, 0 // icount 1820 nop // to align meminst icount 1821 ld r2, r1, -16 // icount 1822 st r3, r1, 10 // icount 1823 lbi r6, 0 // icount 1824 lbi r2, 0 // icount 1825 nop // to align branch icount 1826 beqz r3, 24 // icount 1827 rori r3, r2, 15 // icount 1828 roli r5, r3, 0 // icount 1829 slbi r3, 10 // icount 1830 sub r7, r6, r6 // icount 1831 srl r6, r4, r4 // icount 1832 srli r6, r7, 6 // icount 1833 ror r5, r3, r3 // icount 1834 andn r2, r0, r6 // icount 1835 slt r2, r1, r0 // icount 1836 slt r2, r7, r6 // icount 1837 sco r5, r6, r2 // icount 1838 srli r3, r5, 15 // icount 1839 xor r7, r5, r6 // icount 1840 rori r5, r5, 14 // icount 1841 lbi r6, 7 // icount 1842 sll r3, r2, r6 // icount 1843 andn r5, r5, r7 // icount 1844 ror r3, r0, r7 // icount 1845 xor r7, r2, r6 // icount 1846 rori r4, r5, 10 // icount 1847 sub r2, r3, r0 // icount 1848 slt r7, r5, r4 // icount 1849 slli r4, r6, 6 // icount 1850 nop // to align meminst icount 1851 slbi r7, 4 // icount 1852 nop // to align meminst icount 1853 stu r3, r1, 10 // icount 1854 nop // to align meminst icount 1855 ld r6, r1, -12 // icount 1856 nop // to align meminst icount 1857 st r3, r0, 12 // icount 1858 nop // to align meminst icount 1859 stu r2, r1, -6 // icount 1860 nop // to align meminst icount 1861 ld r5, r0, -6 // icount 1862 nop // to align meminst icount 1863 stu r5, r1, 2 // icount 1864 nop // to align meminst icount 1865 ld r4, r0, 14 // icount 1866 nop // to align meminst icount 1867 st r2, r0, 0 // icount 1868 nop // to align meminst icount 1869 stu r3, r1, -4 // icount 1870 nop // to align meminst icount 1871 ld r3, r1, 4 // icount 1872 nop // to align meminst icount 1873 st r3, r0, -14 // icount 1874 nop // to align meminst icount 1875 ld r2, r0, -16 // icount 1876 nop // to align meminst icount 1877 stu r3, r1, -8 // icount 1878 nop // to align meminst icount 1879 st r5, r0, 14 // icount 1880 nop // to align meminst icount 1881 ld r5, r0, -16 // icount 1882 ld r5, r1, -6 // icount 1883 sco r4, r2, r2 // icount 1884 nop // to align meminst icount 1885 st r2, r0, 6 // icount 1886 nop // to align meminst icount 1887 ld r2, r1, -12 // icount 1888 nop // to align meminst icount 1889 stu r2, r0, -10 // icount 1890 nop // to align meminst icount 1891 stu r6, r1, 12 // icount 1892 nop // to align meminst icount 1893 st r3, r1, -12 // icount 1894 nop // to align meminst icount 1895 stu r6, r1, 6 // icount 1896 nop // to align meminst icount 1897 ld r3, r0, 8 // icount 1898 nop // to align meminst icount 1899 ld r5, r0, -12 // icount 1900 nop // to align meminst icount 1901 ld r4, r0, 10 // icount 1902 nop // to align meminst icount 1903 ld r5, r0, 14 // icount 1904 nop // to align meminst icount 1905 st r4, r1, -4 // icount 1906 nop // to align meminst icount 1907 ld r5, r0, -16 // icount 1908 nop // to align meminst icount 1909 ld r5, r1, 8 // icount 1910 nop // to align meminst icount 1911 ld r2, r1, 4 // icount 1912 nop // to align meminst icount 1913 stu r5, r1, 6 // icount 1914 nop // to align meminst icount 1915 ld r3, r1, -2 // icount 1916 nop // to align meminst icount 1917 st r6, r1, 0 // icount 1918 nop // to align meminst icount 1919 ld r6, r0, 0 // icount 1920 nop // to align meminst icount 1921 ld r3, r1, -6 // icount 1922 nop // to align meminst icount 1923 ld r6, r1, -14 // icount 1924 nop // to align meminst icount 1925 ld r5, r0, 6 // icount 1926 nop // to align meminst icount 1927 ld r6, r0, -6 // icount 1928 stu r3, r1, -14 // icount 1929 andni r2, r2, 1 // icount 1930 nop // to align meminst icount 1931 stu r4, r2, 8 // icount 1932 nop // to align meminst icount 1933 st r3, r0, -14 // icount 1934 nop // to align meminst icount 1935 ld r5, r0, -4 // icount 1936 nop // to align meminst icount 1937 ld r5, r0, 4 // icount 1938 nop // to align meminst icount 1939 ld r4, r0, -16 // icount 1940 nop // to align meminst icount 1941 ld r6, r0, -12 // icount 1942 nop // to align meminst icount 1943 ld r5, r0, 12 // icount 1944 nop // to align meminst icount 1945 ld r4, r0, -14 // icount 1946 nop // to align meminst icount 1947 st r5, r1, 6 // icount 1948 nop // to align meminst icount 1949 ld r2, r0, -2 // icount 1950 nop // to align meminst icount 1951 ld r2, r0, 10 // icount 1952 nop // to align meminst icount 1953 ld r6, r1, -2 // icount 1954 st r4, r0, -10 // icount 1955 addi r1, r1, 4 // change base addr // icount 1956 nop // to align meminst icount 1957 ld r4, r0, -16 // icount 1958 nop // to align meminst icount 1959 ld r5, r0, 2 // icount 1960 nop // to align meminst icount 1961 ld r6, r1, -4 // icount 1962 nop // to align meminst icount 1963 ld r6, r0, 4 // icount 1964 nop // to align meminst icount 1965 ld r3, r1, -14 // icount 1966 nop // to align meminst icount 1967 ld r2, r0, 10 // icount 1968 nop // to align meminst icount 1969 stu r4, r1, -2 // icount 1970 nop // to align meminst icount 1971 ld r5, r0, -4 // icount 1972 nop // to align meminst icount 1973 stu r2, r1, -8 // icount 1974 nop // to align meminst icount 1975 ld r4, r1, 10 // icount 1976 nop // to align meminst icount 1977 st r2, r1, 6 // icount 1978 nop // to align meminst icount 1979 ld r4, r0, 10 // icount 1980 nop // to align meminst icount 1981 ld r2, r1, -2 // icount 1982 nop // to align meminst icount 1983 ld r3, r1, 2 // icount 1984 nop // to align meminst icount 1985 st r4, r1, 10 // icount 1986 nop // to align meminst icount 1987 ld r4, r1, -14 // icount 1988 nop // to align meminst icount 1989 st r6, r1, -12 // icount 1990 nop // to align meminst icount 1991 st r3, r1, -4 // icount 1992 nop // to align meminst icount 1993 stu r6, r0, 2 // icount 1994 nop // to align meminst icount 1995 stu r3, r0, -8 // icount 1996 nop // to align meminst icount 1997 ld r2, r1, 14 // icount 1998 nop // to align meminst icount 1999 st r5, r0, 6 // icount 2000 nop // to align meminst icount 2001 st r5, r1, -16 // icount 2002 nop // to align meminst icount 2003 ld r4, r1, -8 // icount 2004 nop // to align meminst icount 2005 ld r4, r1, -12 // icount 2006 nop // to align meminst icount 2007 st r6, r1, -2 // icount 2008 nop // to align meminst icount 2009 ld r5, r0, 8 // icount 2010 nop // to align meminst icount 2011 stu r4, r1, -4 // icount 2012 nop // to align meminst icount 2013 ld r2, r1, 2 // icount 2014 nop // to align meminst icount 2015 st r3, r0, -10 // icount 2016 ld r3, r0, -16 // icount 2017 lbi r6, 0 // icount 2018 lbi r7, 0 // icount 2019 nop // to align branch icount 2020 bltz r6, 12 // icount 2021 srl r7, r0, r6 // icount 2022 nop // to align meminst icount 2023 andni r0, r0, 1 // icount 2024 st r5, r0, 10 // icount 2025 slt r2, r2, r0 // icount 2026 srl r5, r4, r7 // icount 2027 sll r4, r0, r3 // icount 2028 lbi r4, 4 // icount 2029 rori r4, r1, 6 // icount 2030 subi r6, r1, 8 // icount 2031 slt r7, r7, r5 // icount 2032 andn r3, r6, r6 // icount 2033 andn r2, r3, r2 // icount 2034 nop // to align meminst icount 2035 sll r4, r0, r6 // icount 2036 nop // to align meminst icount 2037 ld r3, r1, 10 // icount 2038 nop // to align meminst icount 2039 ld r5, r1, -2 // icount 2040 ld r4, r1, 6 // icount 2041 lbi r5, 0 // icount 2042 lbi r5, 0 // icount 2043 nop // to align branch icount 2044 bnez r5, 24 // icount 2045 andni r0, r0, 1 // icount 2046 st r5, r0, 14 // icount 2047 srli r3, r3, 15 // icount 2048 nop // to align meminst icount 2049 andni r0, r0, 1 // icount 2050 st r3, r0, 8 // icount 2051 xori r7, r0, 9 // icount 2052 seq r7, r4, r5 // icount 2053 andni r3, r0, 10 // icount 2054 nop // to align meminst icount 2055 andni r5, r5, 1 // icount 2056 ld r4, r5, 6 // icount 2057 rol r6, r2, r1 // icount 2058 andni r6, r6, 3 // icount 2059 roli r6, r4, 5 // icount 2060 slbi r2, 1 // icount 2061 ror r6, r0, r5 // icount 2062 sll r7, r4, r0 // icount 2063 andni r6, r6, 1 // icount 2064 st r7, r6, 8 // icount 2065 roli r7, r0, 10 // icount 2066 srl r5, r6, r2 // icount 2067 andni r6, r6, 1 // icount 2068 st r4, r6, 0 // icount 2069 xori r2, r2, 13 // icount 2070 andn r3, r0, r6 // icount 2071 slt r5, r0, r2 // icount 2072 nop // to align meminst icount 2073 andni r3, r3, 1 // icount 2074 stu r5, r3, 4 // icount 2075 andni r6, r6, 1 // icount 2076 st r3, r6, 14 // icount 2077 xori r5, r7, 4 // icount 2078 nop // to align meminst icount 2079 xori r5, r7, 13 // icount 2080 nop // to align meminst icount 2081 stu r5, r1, -14 // icount 2082 nop // to align meminst icount 2083 ld r2, r1, 14 // icount 2084 nop // to align meminst icount 2085 ld r5, r0, 12 // icount 2086 nop // to align meminst icount 2087 ld r6, r1, 6 // icount 2088 nop // to align meminst icount 2089 ld r2, r1, 10 // icount 2090 nop // to align meminst icount 2091 st r3, r0, -8 // icount 2092 nop // to align meminst icount 2093 stu r6, r1, -12 // icount 2094 nop // to align meminst icount 2095 ld r4, r1, 6 // icount 2096 nop // to align meminst icount 2097 ld r3, r1, -10 // icount 2098 st r4, r0, 4 // icount 2099 andni r5, r5, 1 // icount 2100 nop // to align meminst icount 2101 st r6, r5, 4 // icount 2102 nop // to align meminst icount 2103 ld r3, r0, 4 // icount 2104 nop // to align meminst icount 2105 stu r2, r0, 4 // icount 2106 nop // to align meminst icount 2107 st r2, r0, 14 // icount 2108 nop // to align meminst icount 2109 ld r3, r1, -12 // icount 2110 nop // to align meminst icount 2111 ld r2, r1, 0 // icount 2112 nop // to align meminst icount 2113 ld r3, r1, 6 // icount 2114 nop // to align meminst icount 2115 ld r2, r1, -10 // icount 2116 nop // to align meminst icount 2117 stu r4, r0, -6 // icount 2118 nop // to align meminst icount 2119 st r3, r0, -10 // icount 2120 nop // to align meminst icount 2121 st r2, r0, 14 // icount 2122 nop // to align meminst icount 2123 ld r6, r1, -6 // icount 2124 nop // to align meminst icount 2125 st r6, r1, 4 // icount 2126 nop // to align meminst icount 2127 stu r3, r1, 14 // icount 2128 nop // to align meminst icount 2129 stu r4, r1, -2 // icount 2130 nop // to align meminst icount 2131 st r6, r1, 10 // icount 2132 nop // to align meminst icount 2133 st r2, r0, 4 // icount 2134 nop // to align meminst icount 2135 st r6, r0, 8 // icount 2136 nop // to align meminst icount 2137 stu r4, r0, 6 // icount 2138 nop // to align meminst icount 2139 ld r3, r0, 10 // icount 2140 nop // to align meminst icount 2141 stu r2, r1, 0 // icount 2142 nop // to align meminst icount 2143 ld r5, r0, 14 // icount 2144 nop // to align meminst icount 2145 st r4, r1, 8 // icount 2146 nop // to align meminst icount 2147 ld r2, r1, 8 // icount 2148 nop // to align meminst icount 2149 ld r6, r0, -4 // icount 2150 nop // to align meminst icount 2151 st r2, r0, 12 // icount 2152 nop // to align meminst icount 2153 st r6, r1, -12 // icount 2154 nop // to align meminst icount 2155 ld r6, r1, -4 // icount 2156 nop // to align meminst icount 2157 stu r4, r0, -12 // icount 2158 nop // to align meminst icount 2159 stu r5, r0, 2 // icount 2160 nop // to align meminst icount 2161 st r6, r1, 0 // icount 2162 nop // to align meminst icount 2163 ld r6, r1, -16 // icount 2164 nop // to align meminst icount 2165 ld r2, r0, 4 // icount 2166 nop // to align meminst icount 2167 st r5, r1, 14 // icount 2168 nop // to align meminst icount 2169 st r5, r0, 4 // icount 2170 nop // to align meminst icount 2171 ld r3, r1, -12 // icount 2172 nop // to align meminst icount 2173 ld r4, r0, -12 // icount 2174 nop // to align meminst icount 2175 ld r4, r1, 4 // icount 2176 nop // to align meminst icount 2177 st r6, r0, -14 // icount 2178 nop // to align meminst icount 2179 st r5, r1, -4 // icount 2180 nop // to align meminst icount 2181 stu r4, r0, -8 // icount 2182 nop // to align meminst icount 2183 ld r4, r1, 10 // icount 2184 nop // to align meminst icount 2185 stu r3, r1, 6 // icount 2186 nop // to align meminst icount 2187 ld r6, r0, -6 // icount 2188 nop // to align meminst icount 2189 st r3, r0, 6 // icount 2190 nop // to align meminst icount 2191 ld r4, r0, 2 // icount 2192 nop // to align meminst icount 2193 ld r3, r0, -16 // icount 2194 nop // to align meminst icount 2195 stu r4, r0, 8 // icount 2196 nop // to align meminst icount 2197 stu r2, r1, 12 // icount 2198 nop // to align meminst icount 2199 st r3, r1, 8 // icount 2200 nop // to align meminst icount 2201 ld r4, r1, -12 // icount 2202 nop // to align meminst icount 2203 st r6, r1, 0 // icount 2204 nop // to align meminst icount 2205 stu r5, r1, 12 // icount 2206 nop // to align meminst icount 2207 ld r5, r1, -4 // icount 2208 nop // to align meminst icount 2209 stu r5, r1, -10 // icount 2210 nop // to align meminst icount 2211 st r5, r1, -4 // icount 2212 nop // to align meminst icount 2213 st r6, r0, -8 // icount 2214 nop // to align meminst icount 2215 stu r2, r0, 6 // icount 2216 nop // to align meminst icount 2217 stu r2, r1, 2 // icount 2218 nop // to align meminst icount 2219 stu r2, r0, -6 // icount 2220 nop // to align meminst icount 2221 st r5, r0, 6 // icount 2222 nop // to align meminst icount 2223 ld r4, r0, 14 // icount 2224 stu r3, r0, 4 // icount 2225 andn r2, r0, r2 // icount 2226 stu r5, r0, 6 // icount 2227 addi r0, r0, 2 // change base addr // icount 2228 nop // to align meminst icount 2229 st r2, r0, 4 // icount 2230 nop // to align meminst icount 2231 ld r6, r1, 0 // icount 2232 nop // to align meminst icount 2233 ld r2, r1, -10 // icount 2234 nop // to align meminst icount 2235 stu r2, r1, 0 // icount 2236 nop // to align meminst icount 2237 st r2, r1, 4 // icount 2238 nop // to align meminst icount 2239 ld r5, r0, 0 // icount 2240 nop // to align meminst icount 2241 st r6, r1, 14 // icount 2242 nop // to align meminst icount 2243 ld r6, r0, 14 // icount 2244 nop // to align meminst icount 2245 st r5, r1, 4 // icount 2246 nop // to align meminst icount 2247 stu r5, r1, -10 // icount 2248 nop // to align meminst icount 2249 stu r2, r1, 0 // icount 2250 nop // to align meminst icount 2251 st r6, r0, 12 // icount 2252 nop // to align meminst icount 2253 ld r3, r1, 8 // icount 2254 nop // to align meminst icount 2255 st r5, r1, -12 // icount 2256 nop // to align meminst icount 2257 ld r5, r1, 6 // icount 2258 nop // to align meminst icount 2259 st r3, r1, 14 // icount 2260 nop // to align meminst icount 2261 ld r3, r0, 0 // icount 2262 nop // to align meminst icount 2263 stu r5, r1, -10 // icount 2264 nop // to align meminst icount 2265 st r5, r1, -8 // icount 2266 nop // to align meminst icount 2267 stu r3, r0, -14 // icount 2268 nop // to align meminst icount 2269 stu r5, r1, 2 // icount 2270 nop // to align meminst icount 2271 ld r4, r1, 8 // icount 2272 nop // to align meminst icount 2273 st r2, r1, 12 // icount 2274 st r6, r1, 0 // icount 2275 halt // icount 2276
libsrc/oz/ozgfx/ozscrollclear.asm
dex4er/deb-z88dk
1
82462
<filename>libsrc/oz/ozgfx/ozscrollclear.asm ; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by <NAME> ; by <NAME> - Oct. 2003 ; ; void ozscrollclear(); ; ; ------ ; $Id: ozscrollclear.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozscrollclear XREF ozactivepage ozscrollclear: in a,(3) ld c,a in a,(4) ld b,a push bc ld bc,(ozactivepage) ld a,c out (3),a ld a,b out (4),a ld hl,0a000h+300 ld de,0a000h ld bc,2400-300 ldir ld de,300 xor a ld e,a ld hl,0a000h+2400-300 ld bc,300 rpt: ld (hl),e inc hl dec bc ld a,b or c jr nz,rpt pop bc ld a,c out (3),a ld a,b out (4),a ret
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1017.asm
ljhsiun2/medusa
9
27007
<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1017.asm .global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r8 push %rax lea addresses_D_ht+0x14038, %r14 clflush (%r14) nop nop inc %r8 mov (%r14), %r13d nop nop nop nop inc %rax pop %rax pop %r8 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r15 push %rbx push %rcx push %rsi // Store lea addresses_UC+0xb2b8, %r15 nop nop nop nop and %r13, %r13 mov $0x5152535455565758, %r10 movq %r10, %xmm5 movups %xmm5, (%r15) cmp $683, %r10 // Faulty Load lea addresses_PSE+0xcab8, %r12 nop nop nop nop nop lfence movups (%r12), %xmm2 vpextrq $0, %xmm2, %rcx lea oracles, %r12 and $0xff, %rcx shlq $12, %rcx mov (%r12,%rcx,1), %rcx pop %rsi pop %rcx pop %rbx pop %r15 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 7}} [Faulty Load] {'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
tests/tk-image-bitmap-test_data-tests.ads
thindil/tashy2
2
14917
<gh_stars>1-10 -- 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.Bitmap.Test_Data.Tests is type Test is new GNATtest_Generated.GNATtest_Standard.Tk.Image.Bitmap .Test_Data .Test with null record; procedure Test_Get_Option_e3d52c_aaa578(Gnattest_T: in out Test); -- tk-image-bitmap.ads:148:4:Get_Option:Tests_Get_Option_Bitmap end Tk.Image.Bitmap.Test_Data.Tests; -- end read only
src/fot/FOTC/Program/Division/Specification.agda
asr/fotc
11
4441
------------------------------------------------------------------------------ -- The division specification ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Program.Division.Specification where open import FOTC.Base open import FOTC.Data.Nat open import FOTC.Data.Nat.Inequalities ------------------------------------------------------------------------------ -- Specification: The division is total and the result is correct. divSpec : D → D → D → Set divSpec i j q = N q ∧ (∃[ r ] N r ∧ r < j ∧ i ≡ j * q + r) {-# ATP definition divSpec #-}
programs/oeis/110/A110749.asm
neoneye/loda
22
84212
; A110749: Triangle read by rows with the n-th row containing the first n multiples of n with digits reversed. ; 1,2,4,3,6,9,4,8,21,61,5,1,51,2,52,6,21,81,42,3,63,7,41,12,82,53,24,94,8,61,42,23,4,84,65,46,9,81,72,63,54,45,36,27,18,1,2,3,4,5,6,7,8,9,1,11,22,33,44,55,66,77,88,99,11,121,21,42,63,84,6,27,48,69,801,21,231,441 seq $0,75362 ; Triangle read by rows with the n-th row containing the first n multiples of n. seq $0,4086 ; Read n backwards (referred to as R(n) in many sequences).
src/glfw/v3/glfw-input.ads
Roldak/OpenGLAda
79
19417
<filename>src/glfw/v3/glfw-input.ads -- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" package Glfw.Input is type Button_State is (Released, Pressed); type Sticky_Toggle is (Sticky_Keys, Sticky_Mouse_Buttons); procedure Poll_Events; procedure Wait_For_Events; private for Button_State use (Released => 0, Pressed => 1); for Button_State'Size use Interfaces.C.int'Size; for Sticky_Toggle use (Sticky_Keys => 16#33002#, Sticky_Mouse_Buttons => 16#33003#); for Sticky_Toggle'Size use Interfaces.C.int'Size; -- just so we can implement them with rename pragma Convention (C, Poll_Events); pragma Convention (C, Wait_For_Events); end Glfw.Input;
cohomology/SpectrumModel.agda
danbornside/HoTT-Agda
0
794
{-# OPTIONS --without-K #-} open import HoTT open import cohomology.SuspAdjointLoopIso open import cohomology.WithCoefficients open import cohomology.Theory open import cohomology.Exactness open import cohomology.Choice module cohomology.SpectrumModel {i} (E : ℤ → Ptd i) (spectrum : (n : ℤ) → ⊙Ω (E (succ n)) == E n) where module SpectrumModel where {- Definition of cohomology group C -} module _ (n : ℤ) (X : Ptd i) where C : Group i C = →Ω-Group X (E (succ n)) {- convenient abbreviations -} CEl = Group.El C ⊙CEl = Group.⊙El C Cid = Group.ident C {- before truncation -} ⊙uCEl : Ptd i ⊙uCEl = X ⊙→ ⊙Ω (E (succ n)) uCEl = fst ⊙uCEl uCid = snd ⊙uCEl {- Cⁿ(X) is an abelian group -} C-abelian : (n : ℤ) (X : Ptd i) → is-abelian (C n X) C-abelian n X = transport (is-abelian ∘ →Ω-Group X) (spectrum (succ n)) C-abelian-lemma where pt-lemma : ∀ {i} {X : Ptd i} {α β : Ω^ 2 X} (γ : α == idp^ 2) (δ : β == idp^ 2) → ap2 _∙_ γ δ == conc^2-comm α β ∙ ap2 _∙_ δ γ pt-lemma idp idp = idp C-abelian-lemma = Trunc-elim (λ _ → Π-level (λ _ → =-preserves-level _ Trunc-level)) (λ {(f , fpt) → Trunc-elim (λ _ → =-preserves-level _ Trunc-level) (λ {(g , gpt) → ap [_] $ ⊙λ= (λ x → conc^2-comm (f x) (g x)) (pt-lemma fpt gpt)})}) {- CF, the functorial action of C: - contravariant functor from pointed spaces to abelian groups -} module _ (n : ℤ) {X Y : Ptd i} where {- before truncation - from pointed spaces to pointed spaces -} uCF : fst (X ⊙→ Y) → fst (⊙uCEl n Y ⊙→ ⊙uCEl n X) uCF f = ((λ g → g ⊙∘ f) , pair= idp (∙-unit-r _ ∙ ap-cst idp (snd f))) CF-hom : fst (X ⊙→ Y) → (C n Y →ᴳ C n X) CF-hom f = record { f = Trunc-fmap {n = ⟨0⟩} (fst (uCF f)); pres-comp = Trunc-elim (λ _ → Π-level (λ _ → =-preserves-level _ Trunc-level)) (λ g → Trunc-elim (λ _ → =-preserves-level _ Trunc-level) (λ h → ap [_] $ pair= idp (comp-snd _∙_ f g h)))} where comp-snd : ∀ {i j k} {X : Ptd i} {Y : Ptd j} {C : Type k} {c₁ c₂ : C} (_⊕_ : C → C → C) (f : fst (X ⊙→ Y)) (g : fst (Y ⊙→ ⊙[ C , c₁ ])) (h : fst (Y ⊙→ ⊙[ C , c₂ ])) → ap (λ x → fst g x ⊕ fst h x) (snd f) ∙ ap2 _⊕_ (snd g) (snd h) == ap2 _⊕_ (ap (fst g) (snd f) ∙ snd g) (ap (fst h) (snd f) ∙ snd h) comp-snd _⊕_ (_ , idp) (_ , idp) (_ , idp) = idp CF : fst (X ⊙→ Y) → fst (⊙CEl n Y ⊙→ ⊙CEl n X) CF F = GroupHom.⊙f (CF-hom F) {- CF-hom is a functor from pointed spaces to abelian groups -} module _ (n : ℤ) {X : Ptd i} where CF-ident : CF-hom n {X} {X} (⊙idf X) == idhom (C n X) CF-ident = hom= _ _ $ λ= $ Trunc-elim (λ _ → =-preserves-level _ Trunc-level) (λ _ → idp) CF-comp : {Y Z : Ptd i} (g : fst (Y ⊙→ Z)) (f : fst (X ⊙→ Y)) → CF-hom n (g ⊙∘ f) == CF-hom n f ∘ᴳ CF-hom n g CF-comp g f = hom= _ _ $ λ= $ Trunc-elim (λ _ → =-preserves-level _ Trunc-level) (λ h → ap [_] (! (⊙∘-assoc h g f))) {- Eilenberg-Steenrod Axioms -} {- Suspension Axiom -} C-Susp : (n : ℤ) (X : Ptd i) → C (succ n) (⊙Susp X) == C n X C-Susp n X = group-ua (SuspAdjointLoopIso.iso X (E (succ (succ n)))) ∙ ap (→Ω-Group X) (spectrum (succ n)) {- Non-truncated Exactness Axiom -} module _ (n : ℤ) {X Y : Ptd i} where {- [uCF n (⊙cfcod f) ∘ uCF n f] is constant -} uC-exact-itok-lemma : (f : fst (X ⊙→ Y)) (g : uCEl n (⊙Cof f)) → fst (uCF n f) (fst (uCF n (⊙cfcod f)) g) == uCid n X uC-exact-itok-lemma (f , fpt) (g , gpt) = ⊙λ= (λ x → ap g (! (cfglue f x)) ∙ gpt) (ap (g ∘ cfcod f) fpt ∙ ap g (ap (cfcod f) (! fpt) ∙ ! (cfglue f (snd X))) ∙ gpt =⟨ lemma (cfcod f) g fpt (! (cfglue f (snd X))) gpt ⟩ ap g (! (cfglue f (snd X))) ∙ gpt =⟨ ! (∙-unit-r _) ⟩ (ap g (! (cfglue f (snd X))) ∙ gpt) ∙ idp ∎) where lemma : ∀ {i j k} {A : Type i} {B : Type j} {C : Type k} {a₁ a₂ : A} {b : B} {c : C} (f : A → B) (g : B → C) (p : a₁ == a₂) (q : f a₁ == b) (r : g b == c) → ap (g ∘ f) p ∙ ap g (ap f (! p) ∙ q) ∙ r == ap g q ∙ r lemma f g idp idp idp = idp {- in kernel of [uCF n f] ⇒ in image of [uCF n (⊙cfcod f)] -} uC-exact-ktoi-lemma : (f : fst (X ⊙→ Y)) (g : uCEl n Y) → fst (uCF n f) g == uCid n X → Σ (uCEl n (⊙Cof f)) (λ h → fst (uCF n (⊙cfcod f)) h == g) uC-exact-ktoi-lemma (f , fpt) (h , hpt) p = ((g , ! q ∙ hpt) , pair= idp (! (∙-assoc q (! q) hpt) ∙ ap (λ w → w ∙ hpt) (!-inv-r q))) where g : Cofiber f → Ω (E (succ n)) g = CofiberRec.f f idp h (! ∘ app= (ap fst p)) q : h (snd Y) == g (cfbase f) q = ap g (snd (⊙cfcod (f , fpt))) {- Truncated Exactness Axiom -} module _ (n : ℤ) {X Y : Ptd i} where {- in image of (CF n (⊙cfcod f)) ⇒ in kernel of (CF n f) -} abstract C-exact-itok : (f : fst (X ⊙→ Y)) → is-exact-itok (CF n (⊙cfcod f)) (CF n f) C-exact-itok f = itok-alt-in (CF n (⊙cfcod f)) (CF n f) (Trunc-level {n = ⟨0⟩}) $ Trunc-elim (λ _ → =-preserves-level _ (Trunc-level {n = ⟨0⟩})) (ap [_] ∘ uC-exact-itok-lemma n f) {- in kernel of (CF n f) ⇒ in image of (CF n (⊙cfcod f)) -} abstract C-exact-ktoi : (f : fst (X ⊙→ Y)) → is-exact-ktoi (CF n (⊙cfcod f)) (CF n f) C-exact-ktoi f = Trunc-elim (λ _ → Π-level (λ _ → raise-level _ Trunc-level)) (λ h tp → Trunc-rec Trunc-level (lemma h) (–> (Trunc=-equiv _ _) tp)) where lemma : (h : uCEl n Y) → fst (uCF n f) h == uCid n X → Trunc ⟨-1⟩ (Σ (CEl n (⊙Cof f)) (λ tk → fst (CF n (⊙cfcod f)) tk == [ h ])) lemma h p = [ [ fst wit ] , ap [_] (snd wit) ] where wit : Σ (uCEl n (⊙Cof f)) (λ k → fst (uCF n (⊙cfcod f)) k == h) wit = uC-exact-ktoi-lemma n f h p C-exact : (f : fst (X ⊙→ Y)) → is-exact (CF n (⊙cfcod f)) (CF n f) C-exact f = record {itok = C-exact-itok f; ktoi = C-exact-ktoi f} {- Additivity Axiom -} module _ (n : ℤ) {A : Type i} (X : A → Ptd i) (ac : (W : A → Type i) → has-choice ⟨0⟩ A W) where uie : has-choice ⟨0⟩ A (uCEl n ∘ X) uie = ac (uCEl n ∘ X) R' : CEl n (⊙BigWedge X) → Trunc ⟨0⟩ (Π A (uCEl n ∘ X)) R' = Trunc-rec Trunc-level (λ H → [ (λ a → H ⊙∘ ⊙bwin a) ]) L' : Trunc ⟨0⟩ (Π A (uCEl n ∘ X)) → CEl n (⊙BigWedge X) L' = Trunc-rec Trunc-level (λ k → [ BigWedgeRec.f idp (fst ∘ k) (! ∘ snd ∘ k) , idp ]) R = unchoose ∘ R' L = L' ∘ (is-equiv.g uie) R'-L' : ∀ y → R' (L' y) == y R'-L' = Trunc-elim (λ _ → =-preserves-level _ Trunc-level) (λ K → ap [_] (λ= (λ a → pair= idp $ ap (BigWedgeRec.f idp (fst ∘ K) (! ∘ snd ∘ K)) (! (bwglue a)) ∙ idp =⟨ ∙-unit-r _ ⟩ ap (BigWedgeRec.f idp (fst ∘ K) (! ∘ snd ∘ K)) (! (bwglue a)) =⟨ ap-! (BigWedgeRec.f idp (fst ∘ K) (! ∘ snd ∘ K)) (bwglue a) ⟩ ! (ap (BigWedgeRec.f idp (fst ∘ K) (! ∘ snd ∘ K)) (bwglue a)) =⟨ ap ! (BigWedgeRec.glue-β idp (fst ∘ K) (! ∘ snd ∘ K) a) ⟩ ! (! (snd (K a))) =⟨ !-! (snd (K a)) ⟩ snd (K a) ∎))) L'-R' : ∀ x → L' (R' x) == x L'-R' = Trunc-elim {P = λ tH → L' (R' tH) == tH} (λ _ → =-preserves-level _ Trunc-level) (λ {(h , hpt) → ap [_] (pair= (λ= (L-R-fst (h , hpt))) (↓-app=cst-in $ ! $ ap (λ w → w ∙ hpt) (app=-β (L-R-fst (h , hpt)) bwbase) ∙ !-inv-l hpt))}) where lemma : ∀ {i j} {A : Type i} {B : Type j} (f : A → B) {a₁ a₂ : A} {b : B} (p : a₁ == a₂) (q : f a₁ == b) → ! q ∙ ap f p == ! (ap f (! p) ∙ q) lemma f idp idp = idp l∘r : fst (⊙BigWedge X ⊙→ ⊙Ω (E (succ n))) → (BigWedge X → Ω (E (succ n))) l∘r (h , hpt) = BigWedgeRec.f idp (λ a → h ∘ bwin a) (λ a → ! (ap h (! (bwglue a)) ∙ hpt)) L-R-fst : (h : fst (⊙BigWedge X ⊙→ ⊙Ω (E (succ n)))) → ∀ w → (l∘r h) w == fst h w L-R-fst (h , hpt) = BigWedge-elim (! hpt) (λ _ _ → idp) (λ a → ↓-='-in $ ! hpt ∙ ap h (bwglue a) =⟨ lemma h (bwglue a) hpt ⟩ ! (ap h (! (bwglue a)) ∙ hpt) =⟨ ! (BigWedgeRec.glue-β idp (λ a → h ∘ bwin a) (λ a → ! (ap h (! (bwglue a)) ∙ hpt)) a) ⟩ ap (l∘r (h , hpt)) (bwglue a) ∎) R-is-equiv : is-equiv R R-is-equiv = uie ∘ise (is-eq R' L' R'-L' L'-R') pres-comp : (tf tg : CEl n (⊙BigWedge X)) → R (Group.comp (C n (⊙BigWedge X)) tf tg) == Group.comp (Πᴳ A (C n ∘ X)) (R tf) (R tg) pres-comp = Trunc-elim (λ _ → Π-level (λ _ → =-preserves-level _ (Π-level (λ _ → Trunc-level)))) (λ {(f , fpt) → Trunc-elim (λ _ → =-preserves-level _ (Π-level (λ _ → Trunc-level))) (λ {(g , gpt) → λ= $ λ a → ap [_] $ pair= idp (comp-snd f g (! (bwglue a)) fpt gpt)})}) where comp-snd : ∀ {i j} {A : Type i} {B : Type j} {a₁ a₂ : A} {b₀ : B} {p q : b₀ == b₀} (f : A → b₀ == b₀) (g : A → b₀ == b₀) (r : a₁ == a₂) (α : f a₂ == p) (β : g a₂ == q) → ap (λ x → f x ∙ g x) r ∙ ap2 _∙_ α β == ap2 _∙_ (ap f r ∙ α) (ap g r ∙ β) comp-snd f g idp idp idp = idp abstract C-additive : C n (⊙BigWedge X) == Πᴳ A (C n ∘ X) C-additive = group-ua (group-hom R pres-comp , R-is-equiv) open SpectrumModel spectrum-cohomology : CohomologyTheory i spectrum-cohomology = record { C = C; CF-hom = CF-hom; CF-ident = CF-ident; CF-comp = CF-comp; C-abelian = C-abelian; C-Susp = C-Susp; C-exact = C-exact; C-additive = C-additive} spectrum-C-S⁰ : (n : ℤ) → C n (⊙Sphere O) == π 1 (ℕ-S≠O _) (E (succ n)) spectrum-C-S⁰ n = Bool⊙→Ω-is-π₁ (E (succ n))
programs/oeis/173/A173073.asm
jmorken/loda
1
243334
; A173073: (n-th nonnegative nonprime) minus (n-1). ; 0,0,2,3,4,4,4,5,6,6,6,7,8,8,8,9,9,9,9,9,10,11,11,11,11,11,12,12,12,13,14,14,14,15,15,15,15,15,16,16,16,16,16,17,18,18,18,18,18,19,19,19,20,21,21,21,21,21,22,22,22,23,23,23,23,23,24,24,24,24,24,24,24,25,25,25 sub $1,$0 add $1,1 lpb $0 sub $0,$1 mov $2,$1 cal $0,230980 ; Number of primes <= n, starting at n=0. lpb $1 mul $1,$3 sub $1,$2 lpe lpe mov $1,$0
algorithms/base64.asm
ratedali/assembly-exercises
1
105046
<filename>algorithms/base64.asm<gh_stars>1-10 section .data table db "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/+",0 prompt db "Please enter a string of at most 1024 characters:",0x0a,0 nullprompt db "Input not given, using default string: '%s'", 0x0a, 0 resformat db "base64 of '%s' is '%s'", 0x0a,0 informat db "%s",0 defaultstr db "BA144043",0 defaultlen dd $-defaultstr section .bss input resb 1024 output resb 1024 section .text extern _printf, _scanf global _main _main push ebp ; for correct debugging mov ebp, esp and esp, 0xfffffff0; stack alignment sub esp, 16 n equ 0 padding equ 4 push prompt ; read input form user call _printf push input push informat call _scanf cmp byte [input], 0 jne base64_encode use_defaultstr push defaultstr push nullprompt call _printf mov ecx, [defaultlen] mov esi, defaultstr mov edi, input cld rep movsb base64_encode mov ebx, table mov esi, input mov edi, output divide_bytes mov ecx, 3 divide_loop lodsb cmp al, 0 je encode_bytes shl eax, 8 dec ecx jz encode_bytes jmp divide_loop encode_bytes sub ecx, 3 ; number of bytes read is 3 - $ecx neg ecx jz add_padding ; if no bytes were read, add the padding (depending on the value of [esp+n]) mov [esp+n], ecx inc ecx ; number of characters to extract from an n bytes sequence is n+1 mov edx, eax ; save data to edx mov eax,[esp+n] cmp eax, 1 je onebyte cmp eax, 2 je twobytes jmp encode_loop twobytes shl edx, 8 ; to align with the 3 bytes case jmp encode_loop onebyte shl edx, 16 ; to align with the 3 and 2 bytes cases encode_loop mov eax, 0xFC000000 and eax, edx shr eax, 26 xlat mov [edi], al inc edi shl edx, 6 dec ecx jnz encode_loop jmp divide_bytes add_padding xor eax, eax ; padding for three bytes: only null(0) mov ecx, 0x3d ; padding for two bytes: an equal sign(0x3d) mov edx, 0x3d3d ; padding for one byte: two equal signs cmp dword [esp+n], 2 cmove eax, ecx cmp dword [esp+n], 1 cmove eax, edx mov dword [edi], eax print push output call _printf xor eax, eax leave ret
Hangman/Hangman.asm
Rafid013/Hangman--ASM-
4
179079
.MODEL SMALL .STACK 100h .DATA HEADING DB 'HANGMAN' TYPED_LETTERS DB 'PRESSED LETTERS: ' HIGHSCORE_MSG DB 'HIGHSCORE' SCORE DB 'SCORE: ' QUESTION DB 'QUESTION: ' ANSWER DB 'ANSWER: ' LOSE DB 'YOU LOSE!!!' WIN DB 'YOU WIN!!!' EXIT_MSG DB 'PRESS ANY KEY TO EXIT' QUESTION_F DB 120 DUP (0) ANSWER_F DB 120 DUP (0) FILENAME DB 'RiQue.txt',0 FILENAME2 DB 'RiAns.txt',0 SCORE_FILE DB 'Score.txt',0 QSIZE DW 0 ASIZE DW 0 A DB 6 DUP(0) N DB 6 BUFFERSIZE DW 0 BUFFER DB 512 DUP (0) BUFFER2 DB 512 DUP(0) BUFFER_SCORE DB 512 DUP (0) HANDLE DW ? HANDLE2 DW ? HANDLE_SCORE DW ? OPENERR DB 0DH,0AH, 'OPEN ERROR - CODE' ERRCODE DB 30H,'$' CORRECT DW ? CHANCE DW 6 CURSOR DW ? WIN_OR_LOSE DW ? TOTAL_SCORE DB 0 .CODE ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- MAIN PROC MOV AX,@DATA MOV DS,AX MOV ES,AX ; set VGA 640x480 16 color mode MOV AH, 0 ;set mode func MOV AL, 12h INT 10h ;set backgroundM MOV AH,0BH MOV BH,0 MOV BL,0 ;background color code(black) INT 10H ;choose palatte MOV BH,1 MOV BL,0 ;SELECT PALATTE INT 10H ;DWAW STAND ; | ; | ; | ; | MOV AH,0CH ;WRITE PIXEL MOV AL,3 ;COLOR BROWN MOV BH,0 ;PAGE 0 MOV CX,30 ;COLUMN STAND_OUTER: MOV DX,90 ;STARTING ROW STAND_INNER: INT 10H INC DX CMP DX,350 JL STAND_INNER INC CX CMP CX,35 JL STAND_OUTER ;DRAW UPPER LINE _______ MOV AH,0CH ;WRITE PIXEL MOV AL,3 ;COLOR BROWN MOV BH,0 ;PAGE 0 MOV DX,90 ;ROW uLINE_OUTER: MOV CX,30 ;STARTING COLUMN uLINE_INNER: INT 10H INC CX CMP CX,150 JL uLINE_INNER INC DX CMP DX,95 JL uLINE_OUTER ;DRAW BASE LINE _______ MOV AH,0CH ;WRITE PIXEL MOV AL,3 ;COLOR BROWN MOV BH,0 ;PAGE 0 MOV DX,345 ;ROW bLINE_OUTER: MOV CX,10 ;STARTING COLUMN bLINE_INNER: INT 10H INC CX CMP CX,50 JL bLINE_INNER INC DX CMP DX,350 JL bLINE_OUTER ;DRAWING THE SUPPORT ; / ; / ; / ; / ; / MOV AH,0CH ;WRITE PIXEL MOV AL,3 ;COLOR BROWN MOV BH,0 ;PAGE 0 MOV DX,90 ;STARTING ROW MOV CX,90 ;STARTING COLUMN sLINE_OUTER: PUSH CX MOV BL,0 sLINE_INNER: INT 10H INC CX INC BL CMP BL,7 JL sLINE_INNER INC DX POP CX DEC CX CMP DX,151 JL sLINE_OUTER MOV CX,35 INT 10H ;DRAW ROPE ; | ; | ; | ; | MOV AH,0CH ;WRITE PIXEL MOV AL,3 ;COLOR BROWN MOV BH,0 ;PAGE 0 MOV DX,90 ;ROW ROPE_OUTER: MOV CX,120 ;STARTING COLUMN ROPE_INNER: INT 10H INC CX CMP CX,125 JL ROPE_INNER INC DX CMP DX,160 JL ROPE_OUTER ;write Title of the game ; ;HANGMAN ;HANGMAN ; ;;;; ;set cursor MOV AH,2 MOV BH,0 MOV DH,1 ;row = 1 MOV DL,37 ;column = 37 INT 10H ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green LEA SI,HEADING CLD MOV CX,7 WRITE_TITLE: LODSB INT 10h LOOP WRITE_TITLE ;write PRESSED LETTERS ;set cursor MOV AH,2 MOV BH,0 MOV DH,16 ;row = 16 MOV DL,30 ;column = 30 INT 10H ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green LEA SI,TYPED_LETTERS CLD MOV CX,17 WRITE_PRESSED: LODSB INT 10h LOOP WRITE_PRESSED ;write SCORE ;set cursor MOV AH,2 MOV BH,0 MOV DH,18 ;row = 18 MOV DL,30 ;column = 30 INT 10H ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green LEA SI,SCORE CLD MOV CX,7 WRITE_SCORE: LODSB INT 10h LOOP WRITE_SCORE ;write Question ;set cursor MOV AH,2 MOV BH,0 MOV DH,25 ;row = 25 MOV DL,1 ;column = 1 INT 10H ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green LEA SI,QUESTION CLD MOV CX,10 WRITE_QUES: LODSB INT 10h LOOP WRITE_QUES ;write Answer ;set cursor MOV AH,2 MOV BH,0 MOV DH,27 ;row = 27 MOV DL,1 ;column = 1 INT 10H ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green LEA SI,ANSWER CLD MOV CX,8 WRITE_ANS: LODSB INT 10h LOOP WRITE_ANS ;-------------------------------------- ;FILE WORK ;OPENING QUESTION FILE LEA DX,FILENAME ;DX HAS FILENAME OFFSE MOV AL,0 ; ACCESS CODE 0 FOR READING CALL OPEN ;OPEN FILE JC OPEN_ERROR_BRIDGE ;EXIT IF ERROR MOV HANDLE,AX ;SAVE HANDLE ;OPENING ANSWER FILE LEA DX,FILENAME2 ;DX HAS FILENAME OFFSE MOV AL,0 ; ACCESS CODE 0 FOR READING CALL OPEN ;OPEN FILE JC OPEN_ERROR_BRIDGE ;EXIT IF ERROR MOV HANDLE2,AX ;SAVE HANDLE ;INITIALIZING BUFFER LEA DX, BUFFER ; DX PTS TO BUFFER MOV BX,HANDLE ;GET HANDLE CALL READ ;READ FILE. AX = BYTES READ OR AX,AX ;EOF? JE EXIT_BRIDGE MOV CX,AX LEA DI,QUESTION_F ;INITIALIZING QUESTION POINTER LEA SI,BUFFER ;INITIALIZING BUFFER POINTER CLD ;MOVING POINTERS FORWARD QLOOP: CMP BYTE PTR [SI],0AH ;CHECKING IF QUESTION IS COMPLETED? JE END_QLOOP ;OKY DUDE. THIS ONE IS DONE MOVSB ;KEEP WRITING QUESTION INC QSIZE ;KEEP TRACKING QUESTION LENGTH LOOP QLOOP RELOAD: ;CX = 0, BUFFER ENDED BUT QUESTION NOT COMPLETED; RELOAD BUFFER LEA DX,BUFFER ; DX PTS TO BUFFER MOV BX,HANDLE ;GET HANDLE CALL READ ;READ FILE. AX = BYTES READ OR AX,AX JE EXIT_BRIDGE MOV CX,AX ;RELOADING CX LEA SI,BUFFER ;RESTORING BUFFER POINTER JMP QLOOP EXIT_BRIDGE: JMP EXIT END_QLOOP: MOVSB ;SAVING 0AH INC QSIZE MOV AL,'$' STOSB ;INDICATING END OF STRING DEC CX ;JUMPED BEFORE LOOP QLOOP WAS CALLED. SO MANUALLY ;DECREASING CX ;MOV AH,9 ;LEA DX,QUESTION ;INT 21H ;SHOWING QUESTION ;NOW QUESTION ARRAY HAS QUESTION AND QLENGTH HAS STRING LENGTH ;LETS LOAD ANSWER IN ANSWER ARRAY ;START BY SAVING CURRENT INFO PUSH SI PUSH DI PUSH AX PUSH BX PUSH CX PUSH DX ;READ 1 BYTE EACH TIME UNTIL YOU FIND 0DH ;AND STORE THEN IN ANSWER LEA DI,ANSWER_F MOV AX,0 MOV ASIZE,AX ;RESTORING ANSWER SIZE JMP ALOOP OPEN_ERROR_BRIDGE: JMP OPEN_ERROR ALOOP: LEA DX,BUFFER2 ; DX PTS TO BUFFER MOV BX,HANDLE2 ;GET HANDLE PUSH CX MOV AH,3FH MOV CX,1 INT 21H POP CX CMP AX,0 JE END_ALOOP2 MOV AL,[BUFFER2+0] CMP AL,0AH JE END_ALOOP STOSB INC ASIZE JMP ALOOP END_ALOOP: STOSB DEC ASIZE END_ALOOP2: MOV AL,'$' STOSB ;MOV AH,9 ;LEA DX,ANSWER ;INT 21H JMP SKIP_NEXT_LINE RELOAD_BRIDGE: JMP RELOAD ;TIME TO RESTORE REGISTERS. WHAT DO U SAY VOTKA? SKIP_NEXT_LINE: POP DX POP CX POP BX POP AX POP DI POP SI ;HEY RALPH NOW YOU HAVE ;QUESTION IN QUESTION ;QUESTION SIZE IN QLENGTH ;ANSWER IN ANSWER ;ANSWER SIZE IN ALENGTH ;PUT YOUR CODE HERE ;SHOW IN SCREEN ;PLAY THE GAME ;WHEN YOU ARE DONE ;REFRESH THE SCREEN (GET RID OF THE CORPSE, CLEAR QUESTION AND ANSWER AREA) ;THEN ASK A NEW QUESTION ;PLAY THE GAME ;I'M DONE HERE ;HAPPY ? CALL CLEAR_TYPED_LET PUSH CX PUSH SI PUSH DI LEA SI,QUESTION_F LEA DI,ANSWER_F MOV CX,QSIZE SUB CX,2 MOV AX,ASIZE ;MOV AH,9 CALL PROCESS_QUES CMP WIN_OR_LOSE,0 JE EXIT ;MOV AH,2 ;MOV DL,'1' ;INT 21h MOV AL,0 CALL BODY CALL HEAD CALL LEFT_HAND CALL RIGHT_HAND CALL RIGHT_LEG POP DI POP SI POP CX LEA DI,QUESTION_F ;RESTORING QUESTION POINTER MOV AX,0 MOV QSIZE,AX ;RESTORING QUESTION LENGTH CMP CX,0 ;IF QUESTION ENDED AND SO DID BUFFER JLE RELOAD_BRIDGE ;YES, RELOAD BUFFER JMP QLOOP ;BUFFER HAS NEXT QUESTION , START READING OPEN_ERROR: LEA DX,OPENERR ;GET ERROR MESSAGE ADD ERRCODE,AL ;CONVERT ERROR CODE TO ASCII MOV AH,9 INT 21H ;DISPLAY ERROR MESSAGE ;FILE WORK END ;-------------------------------------- ;OTHERS EXIT: LEA DX,SCORE_FILE ;DX HAS FILENAME OFFSE MOV AL,0 ; ACCESS CODE 0 FOR READING CALL OPEN ;OPEN FILE MOV HANDLE_SCORE,AX ;SAVE HANDLE LEA DX, BUFFER_SCORE ; DX PTS TO BUFFER MOV BX,HANDLE_SCORE ;GET HANDLE CALL READ ;READ FILE. AX = BYTES READ OR AX,AX ;EOF? JE SHOW_HIGH_SCORE CLD LEA SI,BUFFER_SCORE LEA DI,A MOV CX,5 INPUT: CALL INDEC STOSB LOOP INPUT MOV AL,TOTAL_SCORE STOSB SORT: MOV CL,N XOR CH,CH DEC CX JCXZ COMP OUTER: PUSH CX LEA SI,A INNER: MOV AL,BYTE PTR[SI+1] CMP BYTE PTR[SI],AL JNL FINAL XCHG BYTE PTR[SI],AL MOV BYTE PTR[SI+1],AL FINAL: INC SI LOOP INNER POP CX LOOP OUTER COMP: MOV CX,5 LEA SI,A LEA DI,BUFFER_SCORE OUTPUT: MOV AH,0 LODSB CALL OUTDEC MOV AL,0DH STOSB MOV AL,0AH STOSB ADD BX,2 ADD BX,BUFFERSIZE MOV BUFFERSIZE,BX LOOP OUTPUT MOV BX,HANDLE_SCORE ;GET HANDLE CALL CLOSE LEA DX,SCORE_FILE ;DX HAS FILENAME OFFSE MOV AH,3DH MOV AL,1 INT 21H MOV HANDLE_SCORE,AX ;SAVE HANDL MOV BX,HANDLE_SCORE MOV CX,BUFFERSIZE LEA DX,BUFFER_SCORE MOV AH,40H ;WRITE FUNCTION INT 21H SHOW_HIGH_SCORE: CALL SCROLL_SCREEN CMP WIN_OR_LOSE,1 JNE PRINT_LOSE CALL SHOW_WIN_MSG JMP PROPER_EXIT PRINT_LOSE: CALL SHOW_LOSE_MSG PROPER_EXIT: CALL SHOW_SCORES CALL SHOW_EXIT_MSG MOV BX,HANDLE_SCORE ;GET HANDLE CALL CLOSE MOV AH, 0 INT 16h MOV AX, 3 INT 10h MOV AH, 4CH INT 21h MAIN ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- HIGHSCORE PROC PUSH AX PUSH BX PUSH CX PUSH DX ;set cursor MOV AH,2 MOV BH,0 MOV DH,1 ;row = 1 MOV DL,34 ;column = 37 INT 10H ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green LEA SI,HIGHSCORE_MSG CLD MOV CX,9 WRITE_HIGH: LODSB INT 10h LOOP WRITE_HIGH POP DX POP CX POP BX POP AX RET HIGHSCORE ENDP _SHOW_DEC PROC PUSH AX PUSH BX PUSH CX PUSH DX MOV BL,N XOR BH,BH NEG BX ADD BX,5 MOV AL,A[BX] XOR AH,AH XOR CX,CX DIV_AND_DEC: CMP AX,0 JE PRINT_DEC MOV BL,10 IDIV BL INC CX XOR DH,DH MOV DL,AH PUSH DX XOR AH,AH JMP DIV_AND_DEC PRINT_DEC: POP DX MOV AL,DL ADD AL,48 MOV AH,0Eh MOV BH,0 MOV BL,2 ;color = red INT 10h LOOP PRINT_DEC POP DX POP CX POP BX POP AX RET _SHOW_DEC ENDP SHOW_SCORES PROC PUSH AX PUSH BX PUSH CX PUSH DX DEC N CALL HIGHSCORE MOV DH,4 N_LOOP: CMP N,0 JE EXIT_SHOW_SCORE ;set cursor MOV AH,2 MOV BH,0 ;MOV DH,4 ;row = 1 MOV DL,37 ;column = 37 INT 10H ;write CALL _SHOW_DEC DEC N ADD DH,3 JMP N_LOOP EXIT_SHOW_SCORE: POP DX POP CX POP BX POP AX RET SHOW_SCORES ENDP SCROLL_SCREEN PROC PUSH AX PUSH BX PUSH CX PUSH DX MOV AH,7 MOV AL,0 MOV BH,0 XOR CX,CX MOV DH,28 MOV DL,79 INT 10h POP DX POP CX POP BX POP AX RET SCROLL_SCREEN ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- SHOW_LOSE_MSG PROC ;set cursor MOV AH,2 MOV BH,0 MOV DH,23 ;row = 10 MOV DL,34 ;column = 50 INT 10H ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green LEA SI,LOSE CLD MOV CX,11 WRITE_LOSE: LODSB INT 10h LOOP WRITE_LOSE RET SHOW_LOSE_MSG ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- SHOW_EXIT_MSG PROC ;set cursor MOV AH,2 MOV BH,0 MOV DH,27 ;row = 10 MOV DL,27 ;column = 50 INT 10H ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green LEA SI,EXIT_MSG CLD MOV CX,21 WRITE_EXIT: LODSB INT 10h LOOP WRITE_EXIT RET SHOW_EXIT_MSG ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- SHOW_WIN_MSG PROC ;set cursor MOV AH,2 MOV BH,0 MOV DH,23 ;row = 10 MOV DL,34 ;column = 50 INT 10H ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green LEA SI,WIN CLD MOV CX,10 WRITE_WIN: LODSB INT 10h LOOP WRITE_WIN RET SHOW_WIN_MSG ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- SHOWQUES PROC NEAR ;input: SI = input string ; CX = size of string ;output: writes the ques from row = 25, column = 11 PUSH AX PUSH BX PUSH DX PUSH CX ;set cursor MOV AH,2 MOV BH,0 MOV DH,25 ;row = 25 MOV DL,11 ;column = 11 INT 10h ;print space MOV CX,69 MOV AH,0Eh MOV BH,0 MOV BL,2 ;color = red MOV AL,' ' PRINT_SPACE_QUES1: INT 10h LOOP PRINT_SPACE_QUES1 ;set cursor MOV AH,2 MOV BH,0 MOV DH,26 ;row = 26 MOV DL,0 ;column = 11 INT 10h ;print space MOV CX,79 MOV AH,0Eh MOV BH,0 MOV BL,2 ;color = red MOV AL,' ' PRINT_SPACE_QUES2: INT 10h LOOP PRINT_SPACE_QUES2 ;set cursor MOV AH,2 MOV BH,0 MOV DH,25 ;row = 25 MOV DL,11 ;column = 11 INT 10h POP CX ;start writing MOV AH,0Eh MOV BH,0 MOV BL,2 ;color = red SHOW_QUES: LODSB INT 10h LOOP SHOW_QUES POP DX POP BX POP AX RET SHOWQUES ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- SHOW_QUES_MARK PROC NEAR ;CX = Number of ? PUSH AX PUSH BX PUSH DX PUSH CX ;set cursor MOV AH,2 MOV BH,0 MOV DH,27 ;row = 27 MOV DL,10 ;column = 10 INT 10h ;write space MOV AH,0Eh XOR BH,BH MOV BL,2 MOV AL,' ' MOV CX,70 P_SPACE: INT 10h LOOP P_SPACE ;set cursor MOV AH,2 MOV BH,0 MOV DH,27 ;row = 27 MOV DL,10 ;column = 10 INT 10h ;start writing POP CX MOV AH,0Eh MOV BH,0 MOV BL,2 ;color = red MOV AL,'?' QMARK: INT 10h LOOP QMARK POP DX POP BX POP AX RET SHOW_QUES_MARK ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- MATCH_CHAR PROC NEAR ;input ;DI = input string ;AL = char to match ;CX = string size ;output ;DX = 1 if found, DX = 0 if not found ;BX = position at which it was found, undefined when not found PUSH CX PUSH DI PUSH AX INC CX CLD REPNZ SCASB CMP CX,0 JNE FOUNDC MOV DX,0 JMP EXIT_MATCH FOUNDC: MOV DX,1 MOV BX,DI DEC BX DEC DI MOV AL,'.' STOSB EXIT_MATCH: POP AX POP DI SUB BX,DI POP CX RET MATCH_CHAR ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- SHOW_SCORE PROC PUSH AX PUSH BX PUSH CX PUSH DX ;set cursor MOV AH,2 MOV BH,0 MOV DH,18 ;row = 18 MOV DL,38 ;column = 38 INT 10h XOR CX,CX MOV AL,TOTAL_SCORE XOR AH,AH CMP TOTAL_SCORE,0 JNE DIV_AND_SHOW ;start writing MOV AH,0Eh MOV BH,0 MOV BL,2 ;color = red MOV AL,'0' INT 10h JMP EXIT_SCORE DIV_AND_SHOW: CMP AX,0 JE PRINT_SCORE MOV BL,10 IDIV BL INC CX XOR DH,DH MOV DL,AH PUSH DX XOR AH,AH JMP DIV_AND_SHOW PRINT_SCORE: POP DX MOV AL,DL ADD AL,48 MOV AH,0Eh MOV BH,0 MOV BL,2 ;color = red INT 10h LOOP PRINT_SCORE EXIT_SCORE: POP DX POP CX POP BX POP AX RET SHOW_SCORE ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- CLEAR_TYPED_LET PROC PUSH AX PUSH BX PUSH CX PUSH DX ;set cursor MOV AH,2 MOV BH,0 MOV DH,16 ;row = 16 MOV DL,48 INT 10H MOV AL,' ' ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green MOV CX,32 LOP: INT 10h LOOP LOP POP DX POP CX POP BX POP AX RET CLEAR_TYPED_LET ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- SHOW_TYPED_LET PROC ;input AL = char ; DL = COLUMN ;output = none PUSH AX PUSH BX PUSH CX PUSH DX ;set cursor MOV AH,2 MOV BH,0 MOV DH,16 ;row = 16 INT 10H ;start writing MOV AH,0Eh MOV BH,0 MOV BL,1 ;color = green INT 10h POP DX POP CX POP BX POP AX RET SHOW_TYPED_LET ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- PROCESS_QUES PROC NEAR ;This runs until the man is fully drawn or player guesses correctly ;SI = question ;DI = answer ;CX = question size ;AX = answer size PUSH AX PUSH BX PUSH CX PUSH DX CLD CALL SHOWQUES ;show the question MOV CX,AX CALL SHOW_QUES_MARK ;show unknown letters MOV CORRECT,AX MOV CHANCE,6 MOV CURSOR,48 MOV CX,AX ;answer size WHILE_PQ: CALL SHOW_SCORE CMP CHANCE,0 JE EXIT_CHANCE_BRIDGE CMP CORRECT,0 JE EXIT_CORRECT_BRIDGE ;take input MOV AH,0 INT 16h JMP BRIDGE EXIT_CHANCE_BRIDGE: JMP EXIT_CHANCE EXIT_CORRECT_BRIDGE: JMP EXIT_CORRECT ;MATCH WITH ANSWER BRIDGE: CALL MATCH_CHAR CMP DX,1 JNE DEC_CHANCE MATCH_AGAIN: DEC CORRECT ADD TOTAL_SCORE,1 ;show the correct char ;set cursor MOV AH,2 MOV DH,27 ;row 27 MOV DL,10 ;column 10 ADD DL,BL ;column 10 + BL MOV BH,0 INT 10h ;show char at cursor MOV AH,0Eh MOV BL,2 ;red INT 10h CALL MATCH_CHAR CMP DX,0 JE WHILE_PQ JMP MATCH_AGAIN DEC_CHANCE: DEC CHANCE CMP TOTAL_SCORE,0 JE SKIP_TO_NEXT SUB TOTAL_SCORE,1 ;then show the char at typed words, draw hangman, etc SKIP_TO_NEXT: PUSH DX MOV DX,CURSOR CALL SHOW_TYPED_LET INC CURSOR POP DX PUSH AX MOV AL,2 CMP CHANCE,5 JE DR_HEAD CMP CHANCE,4 JE DR_BODY CMP CHANCE,3 JE DR_RIGHT_HAND ;depending on the chance draw the body part CMP CHANCE,2 JE DR_LEFT_HAND CMP CHANCE,1 JE DR_RIGHT_LEG CMP CHANCE,0 JE DR_LEFT_LEG DR_HEAD: CALL HEAD POP AX JMP WHILE_PQ DR_BODY: CALL BODY POP AX JMP WHILE_PQ DR_RIGHT_HAND: CALL RIGHT_HAND POP AX JMP WHILE_PQ DR_LEFT_HAND: CALL LEFT_HAND POP AX JMP WHILE_PQ DR_RIGHT_LEG: CALL RIGHT_LEG POP AX JMP WHILE_PQ DR_LEFT_LEG: CALL LEFT_LEG POP AX JMP WHILE_PQ EXIT_CHANCE: ;you lose MOV WIN_OR_LOSE,0 JMP EXIT_PQ EXIT_CORRECT: ;you win MOV WIN_OR_LOSE,1 EXIT_PQ: POP DX POP CX POP BX POP AX RET PROCESS_QUES ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- BODY PROC NEAR ;DRAW BODY ; | ; | ; | ; | PUSH AX PUSH BX PUSH CX PUSH DX MOV AH,0CH ;WRITE PIXEL ;MOV AL,2 ;COLOR BROWN MOV BH,0 ;PAGE 0 MOV DX,200 ;ROW BODY_OUTER: MOV CX,119 ;STARTING COLUMN BODY_INNER: INT 10H INC CX CMP CX,126 JL BODY_INNER INC DX CMP DX,265 JL BODY_OUTER POP DX POP CX POP BX POP AX RET BODY ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- RIGHT_HAND PROC NEAR ;DRAWING RIGHT HAND ; / ; / ; / ; / ; / PUSH AX PUSH BX PUSH CX PUSH DX MOV AH,0CH ;WRITE PIXEL ;MOV AL,2 ;COLOR BROWN MOV BH,0 ;PAGE 0 MOV DX,215 ;STARTING ROW MOV CX,119 ;STARTING COLUMN rHAND_OUTER: PUSH CX MOV BL,0 rHAND_INNER: INT 10H INC CX INC BL CMP BL,7 JL rHAND_INNER INC DX POP CX DEC CX CMP DX,245 JL rHAND_OUTER POP DX POP CX POP BX POP AX RET RIGHT_HAND ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- HEAD PROC NEAR ;DRAW HEAD ; |--------| ; | o - O | ; | --- | ; |--------| ;AL = color PUSH AX PUSH BX PUSH CX PUSH DX MOV AH,0CH ;WRITE PIXEL ;MOV AL,2 ;COLOR RED MOV BH,0 ;PAGE 0 ;DRAW ------- MOV DX,160 ;ROW H1_OUTER: MOV CX,102 ;STARTING COLUMN H1_INNER: INT 10H INC CX CMP CX,143 JL H1_INNER INC DX CMP DX,165 JL H1_OUTER ;DRAW ------- ; ; ; ; ------- MOV DX,195 ;ROW H2_OUTER: MOV CX,102 ;STARTING COLUMN H2_INNER: INT 10H INC CX CMP CX,143 JL H2_INNER INC DX CMP DX,200 JL H2_OUTER ;DRAW ------- ; | ; | ; | ; ------- MOV DX,165 ;ROW H3_OUTER: MOV CX,102 ;STARTING COLUMN H3_INNER: INT 10H INC CX CMP CX,107 JL H3_INNER INC DX CMP DX,195 JL H3_OUTER ;DRAW ------- ; | | ; | | ; | | ; ------- MOV DX,165 ;ROW H4_OUTER: MOV CX,138 ;STARTING COLUMN H4_INNER: INT 10H INC CX CMP CX,143 JL H4_INNER INC DX CMP DX,195 JL H4_OUTER POP DX POP CX POP BX POP AX RET HEAD ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- LEFT_HAND PROC NEAR ;DRAWING LEFT HAND ; \ ; \ ; \ ; \ ; \ PUSH AX PUSH BX PUSH CX PUSH DX MOV AH,0CH ;WRITE PIXEL ;MOV AL,2 ;COLOR BROWN MOV BH,0 ;PAGE 0 MOV DX,215 ;STARTING ROW MOV CX,119 ;STARTING COLUMN lHAND_OUTER: PUSH CX MOV BL,0 lHAND_INNER: INT 10H INC CX INC BL CMP BL,7 JL lHAND_INNER INC DX POP CX INC CX CMP DX,245 JL lHAND_OUTER POP DX POP CX POP BX POP AX RET LEFT_HAND ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- LEFT_LEG PROC NEAR ;DRAWING LEFT LEG ; \ ; \ ; \ ; \ ; \ PUSH AX PUSH BX PUSH CX PUSH DX MOV AH,0CH ;WRITE PIXEL ;MOV AL,2 ;COLOR BROWN MOV BH,0 ;PAGE 0 MOV DX,265 ;STARTING ROW MOV CX,119 ;STARTING COLUMN lLEG_OUTER: PUSH CX MOV BL,0 lLEG_INNER: INT 10H INC CX INC BL CMP BL,7 JL lLEG_INNER INC DX POP CX INC CX CMP DX,295 JL lLEG_OUTER POP DX POP CX POP BX POP AX RET LEFT_LEG ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- RIGHT_LEG PROC NEAR ;DRAWING RIGHT LEG ; / ; / ; / ; / ; / PUSH AX PUSH BX PUSH CX PUSH DX MOV AH,0CH ;WRITE PIXEL ;MOV AL,2 ;COLOR BROWN MOV BH,0 ;PAGE 0 MOV DX,265 ;STARTING ROW MOV CX,119 ;STARTING COLUMN rLEG_OUTER: PUSH CX MOV BL,0 rLEG_INNER: INT 10H INC CX INC BL CMP BL,7 JL rLEG_INNER INC DX POP CX DEC CX CMP DX,295 JL rLEG_OUTER POP DX POP CX POP BX POP AX RET RIGHT_LEG ENDP ;----------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;file procedures OPEN PROC NEAR ;OPENS FILE ;INPUT DS:DX FILENAME, AL ACCESS CODE ;OUTPUT IF SUCCESSFUL AX HANDLE ;IF UNSUCCESSFUL CF =1 , AX = ERROR CODE MOV AH,3DH MOV AL,0 INT 21H RET OPEN ENDP READ PROC NEAR ;READS A FILE SECTOR ;INPUT: BX FILE HANDLE ;CX BYTES TO READ ;DS:DX BUFFER ;OUTPUT: IF SUCCESSFUL, SECTOR IN BUFFER ;AX NUMBER OF BYTED READ ; IF UNSUCCESSFUL CF =1 PUSH CX MOV AH,3FH MOV CX,512 INT 21H POP CX RET READ ENDP CLOSE PROC NEAR ;CLOSES A FILE ;INPUT BX = HANDLE ;OUTPUT CF =1; ERROR CODE IN AX MOV AH,3EH INT 21H RET CLOSE ENDP INDEC PROC ;OUTPUT AX HOLDS THE SCORE ;INPUT SI CONTAINS BUFFER PUSH BX PUSH CX PUSH DX @BEGIN: XOR BX,BX XOR CX,CX LODSB @REPEAT2: CMP AL,'0' JNGE @NOT_DIGIT CMP AL,'9' JNLE @NOT_DIGIT AND AX,000FH PUSH AX MOV AX,10 MUL BX POP BX ADD BX,AX LODSB CMP AL,0DH JNE @REPEAT2 MOV AX,BX @EXIT: POP DX POP CX POP BX RET @NOT_DIGIT: JMP @BEGIN INDEC ENDP OUTDEC PROC ;INPUT AX ;OUTPUT : DI CONTAINS BUFFER FOR FILE ;BX CONTAINS NO. OF BYTES PUSH AX PUSH CX PUSH DX @END_IF1: XOR CX,CX MOV BX,10D @REPEAT1: XOR DX,DX DIV BX PUSH DX INC CX OR AX,AX JNE @REPEAT1 MOV BX,CX @PRINT_LOOP: POP AX OR AL,30H STOSB LOOP @PRINT_LOOP POP DX POP CX POP AX RET OUTDEC ENDP END MAIN ;----------------------------------------------------------------------------------------------------------- ;-----------------------------------------------------------------------------------------------------------
OpenOutlookCalendar.applescript
coyotwill/scripts
0
4068
tell application "Microsoft Outlook" -- Bring app to FG if it was already open. activate if exists window "Calendar" then -- Unminimize, open default window reopen -- Set Calendar to foremost set index of window "Calendar" to 1 else tell application "System Events" -- Open new window, then navigate to calendar view keystroke "n" using {command down, option down} keystroke 2 using {command down} end tell with timeout of 2 seconds repeat until exists (window "Calendar") delay 0.1 end repeat set bounds of window "Calendar" to {50, 80, 1500, 1000} end timeout end if end tell
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_43_1345.asm
ljhsiun2/medusa
9
5188
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r8 push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0x19d99, %r14 add $29630, %rbp mov $0x6162636465666768, %r8 movq %r8, %xmm4 movups %xmm4, (%r14) nop nop nop nop nop add %rdi, %rdi lea addresses_D_ht+0x3a79, %rsi nop nop xor $52786, %rcx vmovups (%rsi), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %r10 nop sub $34414, %rcx lea addresses_A_ht+0x18809, %rsi nop nop nop dec %rcx movw $0x6162, (%rsi) nop nop nop nop xor %r14, %r14 lea addresses_normal_ht+0x2479, %rdi clflush (%rdi) nop cmp %r14, %r14 movw $0x6162, (%rdi) nop nop nop nop nop sub %r8, %r8 lea addresses_A_ht+0x7479, %r14 nop nop nop cmp $12647, %r10 mov $0x6162636465666768, %rdi movq %rdi, %xmm3 and $0xffffffffffffffc0, %r14 movaps %xmm3, (%r14) nop cmp $21804, %rsi pop %rsi pop %rdi pop %rcx pop %rbp pop %r8 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r15 push %rdi push %rdx // Store lea addresses_UC+0xd079, %r13 clflush (%r13) nop nop nop nop add %rdx, %rdx mov $0x5152535455565758, %r12 movq %r12, (%r13) dec %rdx // Load lea addresses_PSE+0x1c79, %rdi and %r15, %r15 vmovups (%rdi), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %r12 // Exception!!! nop mov (0), %rdi nop nop nop nop and %rdi, %rdi // Load lea addresses_PSE+0x1c79, %r11 nop dec %r10 mov (%r11), %r12 nop nop nop nop nop sub %r11, %r11 // Store lea addresses_A+0x1f879, %r10 clflush (%r10) xor %r11, %r11 movw $0x5152, (%r10) and %rdi, %rdi // Store lea addresses_US+0x16115, %r11 nop nop xor %rdi, %rdi movb $0x51, (%r11) nop nop xor $6275, %rdi // Store lea addresses_UC+0xcbf9, %rdx nop nop add $44706, %r10 mov $0x5152535455565758, %r13 movq %r13, %xmm0 vmovups %ymm0, (%rdx) nop nop nop nop nop dec %rdx // Load mov $0x690b4a0000000a79, %r10 nop nop nop and $22692, %rdx mov (%r10), %edi nop nop nop nop nop and $18511, %r11 // Faulty Load lea addresses_PSE+0x1c79, %r13 nop dec %rdi mov (%r13), %r10w lea oracles, %r15 and $0xff, %r10 shlq $12, %r10 mov (%r15,%r10,1), %r10 pop %rdx pop %rdi pop %r15 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': False}} {'33': 43} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
src/MmLexer.g4
anterokangas/mmjs
0
7040
<filename>src/MmLexer.g4<gh_stars>0 lexer grammar Mm; Comment : '(*' .*? '*)' -> skip ; CommandStart : LPAREN -> pushMode(CommandMode) ; StringStart : ~RPAREN -> pushMode(StringMode) ; mode DefinitionsMode ; LPAREN : '(' ; RPAREN : ')' ; WS : [ \t\r\n]+ ; Q : ['] ; QQ : ["] ; ID : ~(WS | Q | QQ | LPAREN | QPAREN) ; mode CommandMode; CommandWS : WS -> skip ; Role : 'Role' -> mode(RoleCommandMode) ; mode RoleCommandMode ; RoleCommandWS : WS -> skip ; RoleName : ID ; RoleParameterStart : LPAREN ; RolePitch : 'pitch' -> pushMode(IntegerParameterMode) ; RoleCommandEnd : RPAREN -> popMode ; mode StringMode ; QStringStart : Q -> mode(QStringMode) ; QQStringStart : QQ -> mode(QQStringMode) ; mode QStringMode ; QString : ~Q* ; QStringEnd : Q -> popMode ; mode QQStringMode ; QQString : ~QQ* ; QQStringEnd : QQ -> popMode ; mode IntegerParameterMode ; IntegerWS : WS -> skip ; Integer : [+\-]?[0-9]+ ; IntegerEnd : RPAREN -> popMode ;
kv-avm-registers.adb
davidkristola/vole
4
28564
<gh_stars>1-10 with Ada.Streams.Stream_IO; with Ada.Strings.Maps; with Ada.Text_IO; with String_Ops; with kv.avm.Tuples; package body kv.avm.Registers is function "+"(S : String) return String_Type renames Ada.Strings.Unbounded.To_Unbounded_String; function "+"(U : String_Type) return String renames Ada.Strings.Unbounded.To_String; type Data_Kind_Lookup_Type is array (Data_Kind) of Character; Data_Kind_Signatures : constant Data_Kind_Lookup_Type := ( Unset => 'E', Signed_Integer => 'I', Unsigned_Integer => 'U', Floatingpoint => 'F', Bit_Or_Boolean => 'B', Tuple => 'T', Tuple_Map => 'm', Immutable_String => 'S', Actor_Reference => 'R', Actor_Definition => 'A', Message_Definition => 'M', Future => 'f', Tuple_Definition => 'd'); ----------------------------------------------------------------------------- function Signature(Format : in Data_Kind) return Character is begin return Data_Kind_Signatures(Format); end Signature; ----------------------------------------------------------------------------- function Format(Signature : in Character) return Data_Kind is begin for Answer in Data_Kind loop if Data_Kind_Signatures(Answer) = Signature then return Answer; end if; end loop; return Unset; end Format; ----------------------------------------------------------------------------- function Signature_To_String(Signature : in Signature_Type) return String is Answer : String(1..Signature'LENGTH); Index : Integer := 1; begin for Kind in Signature'RANGE loop Answer(Index) := kv.avm.Registers.Signature(Signature(Kind)); Index := Index + 1; end loop; return Answer; end Signature_To_String; ----------------------------------------------------------------------------- function String_To_Signature(Signature : in String) return Signature_Type is Answer : Signature_Type(1..Signature'LENGTH); begin for Index in 1..Signature'LENGTH loop Answer(Index) := Format(Signature(Index + Signature'FIRST - 1)); end loop; return Answer; end String_To_Signature; ----------------------------------------------------------------------------- function Reg_Img(Reg : Register_Type) return String is Fmt : constant String := Data_Kind'IMAGE(Reg.Format); begin case Reg.Format is when Signed_Integer => return " " & Interfaces.Integer_64'IMAGE(Reg.signed_value); when Unsigned_Integer => return " uint:" & Interfaces.Unsigned_64'IMAGE(Reg.unsigned_value); when Bit_Or_Boolean => return " " & Boolean'IMAGE(Reg.bit); when Floatingpoint => return " " & Interfaces.IEEE_Float_64'IMAGE(Reg.value); when Actor_Definition => return " Def:" & (+Reg.Actor_Kind); when Immutable_String => return " '" & (+Reg.The_String) & "'"; when Message_Definition => return " Msg:" & (+Reg.Message_Name); when Future => return " " & Fmt & Interfaces.Unsigned_32'IMAGE(Reg.ID); when Tuple => return " [" & Reg.folded_tuple.To_String & "]"; when Actor_Reference => return " Ref:" & Reg.Instance.Image; when others => null; end case; return Fmt; end Reg_Img; ----------------------------------------------------------------------------- procedure Register_Write(Stream : not null access Ada.Streams.Root_Stream_Type'CLASS; Item : in Register_Type) is begin Data_Kind'WRITE(Stream, Item.Format); case Item.Format is when Signed_Integer => Interfaces.Integer_64'WRITE(Stream, Item.signed_value); when Unsigned_Integer => Interfaces.Unsigned_64'WRITE(Stream, Item.Unsigned_Value); when Actor_Definition => String'OUTPUT(Stream, +Item.Actor_Kind); when Message_Definition => String'OUTPUT(Stream, +Item.Message_Name); when Immutable_String => String'OUTPUT(Stream, +Item.The_String); when Tuple => kv.avm.Tuples.Tuple_Type'WRITE(Stream, Item.Folded_Tuple); when Tuple_Map => kv.avm.Tuples.Map_Type'WRITE(Stream, Item.map); when Bit_Or_Boolean => Boolean'OUTPUT(Stream, Item.bit); when others => Ada.Text_IO.Put_Line("ERROR: Register_Write of " & Data_Kind'IMAGE(Item.Format) & " is not implemented yet."); raise Unimplemented_Error; end case; end Register_Write; ----------------------------------------------------------------------------- procedure Register_Read(Stream : not null access Ada.Streams.Root_Stream_Type'CLASS; Item : out Register_Type) is Kind : Data_Kind; begin Data_Kind'READ(Stream, Kind); case Kind is when Signed_Integer => declare Value : Interfaces.Integer_64; begin Interfaces.Integer_64'READ(Stream, Value); Item := (Format => Signed_Integer, signed_value => Value); end; when Unsigned_Integer => declare Value : Interfaces.Unsigned_64; begin Interfaces.Unsigned_64'READ(Stream, Value); Item := (Format => Unsigned_Integer, Unsigned_Value => Value); end; when Actor_Definition => Item := (Format => Actor_Definition, Actor_Kind => +String'INPUT(Stream)); when Message_Definition => Item := (Format => Message_Definition, Message_Name => +String'INPUT(Stream), Send_Count => 0, Reply_Count => 0); when Immutable_String => Item := (Format => Immutable_String, The_String => +String'INPUT(Stream)); when Tuple => declare Value : kv.avm.Tuples.Tuple_Type; begin kv.avm.Tuples.Tuple_Type'READ(Stream, Value); Item := (Format => Tuple, Folded_Tuple => Value); end; when Tuple_Map => declare Value : kv.avm.Tuples.Map_Type; begin kv.avm.Tuples.Map_Type'READ(Stream, Value); Item := (Format => Tuple_Map, map => Value); end; when Bit_Or_Boolean => Item := (Format => Bit_Or_Boolean, bit => Boolean'INPUT(Stream)); when others => Ada.Text_IO.Put_Line("ERROR: Register_Read of " & Data_Kind'IMAGE(Kind) & " is not implemented yet."); raise Unimplemented_Error; end case; end Register_Read; ----------------------------------------------------------------------------- function Bool(B : Boolean) return String is begin return " "&Boolean'IMAGE(B)(1..1); end Bool; ----------------------------------------------------------------------------- function Make_Tuple_Map(Value : kv.avm.references.Reference_Array_Type) return Register_Type is Tuple_Layout : kv.avm.Tuples.Map_Type; Fold_List : aliased constant kv.avm.references.Reference_Array_Type := Value; use kv.avm.Registers; begin Tuple_Layout.Set(Fold_List'ACCESS); return (format => Tuple_Map, Map => Tuple_Layout); end Make_Tuple_Map; Reference_Set : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.To_Set("SsIiLlAaFfCc0123456789"); ----------------------------------------------------------------------------- function Is_Reference_Character(C : in Character) return Boolean is begin return Ada.Strings.Maps.Is_In(C, Reference_Set); end Is_Reference_Character; ----------------------------------------------------------------------------- -- The *_First and *_Rest routines come from LISP car and cdr, -- and provide easy parsing support. -- function Reference_First (Str : in String) return String is S : Natural := Str'FIRST; begin while S < Str'LAST loop exit when Is_Reference_Character(Str(S)); S := S + 1; end loop; for I in S .. Str'LAST loop if not Is_Reference_Character(Str(I)) then return Str(S..I-1); end if; end loop; return Str; -- no blanks, return the whole string. end Reference_First; ----------------------------------------------------------------------------- function Reference_Rest (Str : in String) return String is B : Boolean := False; -- found a blank S : Natural := Str'FIRST; begin while not Is_Reference_Character(Str(S)) loop if S = Str'LAST then return ""; end if; S := S + 1; end loop; for I in S .. Str'LAST loop if not Is_Reference_Character(Str(I)) then B := True; elsif B then return Str(I..Str'LAST); end if; end loop; return ""; -- there was no second part to Str end Reference_Rest; Foundation_For_Empty_Reference_Array : constant kv.avm.references.Reference_Array_Type := (kv.avm.references.Make_Reference("L9"), kv.avm.references.Make_Reference("L1")); Empty_Reference_Array_Default : constant kv.avm.references.Reference_Array_Type := Foundation_For_Empty_Reference_Array(1..0); ----------------------------------------------------------------------------- -- Tuple Maps should never be too long so a *simple* recursive parser will -- do the job. -- function String_To_Reference_Array_Type(Token : String; List : kv.avm.references.Reference_Array_Type := Empty_Reference_Array_Default) return kv.avm.references.Reference_Array_Type is First : constant String := Reference_First(Token); use Interfaces; begin --Ada.Text_IO.Put_Line("String_To_Reference_Array_Type '" & Token & "', len(List) = " & Natural'IMAGE(List'LENGTH)); if First = "" then return List; else declare Plus_One : kv.avm.references.Reference_Array_Type(1 .. List'LENGTH + 1); begin Plus_One(1 .. List'LENGTH) := List; Plus_One(List'LENGTH + 1) := kv.avm.references.Make_Reference(First); return String_To_Reference_Array_Type(Reference_Rest(Token), Plus_One); end; end if; end String_To_Reference_Array_Type; ----------------------------------------------------------------------------- function String_To_Tuple_Map(Token : String) return Register_Type is Tuple_Layout : kv.avm.Tuples.Map_Type; Fold_List : aliased constant kv.avm.references.Reference_Array_Type := String_To_Reference_Array_Type(Token); begin Tuple_Layout.Set(Fold_List'ACCESS); return (format => Tuple_Map, Map => Tuple_Layout); end String_To_Tuple_Map; ----------------------------------------------------------------------------- function Make_S(Value : Interfaces.Integer_64) return Register_Type is begin return (format => Signed_Integer, signed_value => Value); end Make_S; ----------------------------------------------------------------------------- function Make_U(Value : Interfaces.Unsigned_64) return Register_Type is begin return (format => Unsigned_Integer, unsigned_value => Value); end Make_U; ----------------------------------------------------------------------------- function Make_String(Value : String) return Register_Type is begin return (Format => Immutable_String, The_String => +Value); end Make_String; ----------------------------------------------------------------------------- function Make_Tuple(Value : kv.avm.Tuples.Tuple_Type) return Register_Type is begin return (Format => Tuple, Folded_Tuple => Value); end Make_Tuple; ----------------------------------------------------------------------------- function Make_Ref(Value : kv.avm.Actor_References.Actor_Reference_Type) return Register_Type is begin return (Format => Actor_Reference, Instance => Value); end Make_Ref; end kv.avm.Registers;
programs/oeis/144/A144604.asm
neoneye/loda
22
91409
; A144604: Christoffel word of slope 6/11. ; 0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1 add $0,1 mod $0,17 gcd $0,3 div $0,2
programs/oeis/084/A084902.asm
neoneye/loda
22
243475
<filename>programs/oeis/084/A084902.asm<gh_stars>10-100 ; A084902: a(n) = 5^(n-1)*n*(n+1)/2. ; 0,1,15,150,1250,9375,65625,437500,2812500,17578125,107421875,644531250,3808593750,22216796875,128173828125,732421875000,4150390625000,23345947265625,130462646484375,724792480468750,4005432128906250 mov $2,5 pow $2,$0 mul $2,$0 add $0,2 mul $0,$2 sub $0,$2 div $0,10
my-bool-test.agda
logicshan/IAL
0
5176
module my-bool-test where open import bool open import eq open import level ~~tt : ~ ~ tt ≡ tt ~~tt = refl ~~ff : ~ ~ ff ≡ ff ~~ff = refl {- ~~-elim : ∀ (b : 𝔹) → ~ ~ b ≡ b ~~-elim tt = refl ~~-elim ff = refl -} ~~-elim2 : ∀ (b : 𝔹) → ~ ~ b ≡ b ~~-elim2 tt = ~~tt ~~-elim2 ff = ~~ff ~~tt' : ~ ~ tt ≡ tt ~~tt' = refl{lzero}{𝔹}{tt} ~~ff' : ~ ~ ff ≡ ff ~~ff' = refl{lzero}{𝔹}{ff} ~~-elim : ∀ (b : 𝔹) → ~ ~ b ≡ b ~~-elim tt = refl ~~-elim ff = refl ||≡ff₁ : ∀ {b1 b2} → b1 || b2 ≡ ff → b1 ≡ ff ||≡ff₁ {ff} _ = refl{lzero}{𝔹}{ff} ||≡ff₁ {tt} () ||≡ff₂ : ∀ {b1 b2} → b1 || b2 ≡ ff → ff ≡ b1 ||≡ff₂ {ff} _ = refl{lzero}{𝔹}{ff} ||≡ff₂ {tt} p = sym p ||-cong₁ : ∀ {b1 b1' b2} → b1 ≡ b1' → b1 || b2 ≡ b1' || b2 ||-cong₁{b1}{.b1}{b2} refl = refl ||-cong₂ : ∀ {b1 b2 b2'} → b2 ≡ b2' → b1 || b2 ≡ b1 || b2' ||-cong₂ p rewrite p = refl ite-same : ∀{ℓ}{A : Set ℓ} → ∀(b : 𝔹) (x : A) → (if b then x else x) ≡ x ite-same tt x = refl ite-same ff x = refl 𝔹-contra : ff ≡ tt → ∀ {P : Set} → P 𝔹-contra () p : ff && ff ≡ ~ tt p = refl
alloy4fun_models/trainstlt/models/1/uwAocRi2ujFTcqLev.als
Kaixi26/org.alloytools.alloy
0
3887
open main pred iduwAocRi2ujFTcqLev_prop2 { eventually Signal in (Signal&Green) } pred __repair { iduwAocRi2ujFTcqLev_prop2 } check __repair { iduwAocRi2ujFTcqLev_prop2 <=> prop2o }
src/ls.asm
dalegebit/DamnOS-DamnFS
2
92070
<reponame>dalegebit/DamnOS-DamnFS ls: file format elf32-i386 Disassembly of section .text: 80001020 <_start>: ;// starts us running when we are initially loaded into a new environment. .text .globl _start _start: ;// See if we were started with arguments on the stack cmpl $USTACKTOP, %esp 80001020: 81 fc 00 e0 bf ee cmp $0xeebfe000,%esp jne args_exist 80001026: 75 04 jne 8000102c <args_exist> ;// If not, push dummy argc/argv arguments. ;// This happens when we are loaded by the kernel, ;// because the kernel does not know about passing arguments. pushl $0 80001028: 6a 00 push $0x0 pushl $0 8000102a: 6a 00 push $0x0 8000102c <args_exist>: args_exist: call libmain 8000102c: e8 df 07 00 00 call 80001810 <libmain> 1: jmp 1b 80001031: eb fe jmp 80001031 <args_exist+0x5> 80001033 <ls1>: panic("error reading directory %s: %e", path, n); } void ls1(const char *prefix, bool isdir, off_t size, const char *name) { 80001033: 55 push %ebp 80001034: 89 e5 mov %esp,%ebp 80001036: 56 push %esi 80001037: 53 push %ebx 80001038: 8b 5d 08 mov 0x8(%ebp),%ebx 8000103b: 8b 75 0c mov 0xc(%ebp),%esi const char *sep; if(flag['l']) 8000103e: 83 3d 70 56 00 80 00 cmpl $0x0,0x80005670 80001045: 74 20 je 80001067 <ls1+0x34> printf("%11d %c ", size, isdir ? 'd' : '-'); 80001047: 89 f0 mov %esi,%eax 80001049: 3c 01 cmp $0x1,%al 8000104b: 19 c0 sbb %eax,%eax 8000104d: 83 e0 c9 and $0xffffffc9,%eax 80001050: 83 c0 64 add $0x64,%eax 80001053: 83 ec 04 sub $0x4,%esp 80001056: 50 push %eax 80001057: ff 75 10 pushl 0x10(%ebp) 8000105a: 68 22 33 00 80 push $0x80003322 8000105f: e8 4d 1f 00 00 call 80002fb1 <printf> 80001064: 83 c4 10 add $0x10,%esp if(prefix) { 80001067: 85 db test %ebx,%ebx 80001069: 74 3a je 800010a5 <ls1+0x72> if (prefix[0] && prefix[strlen(prefix)-1] != '/') sep = "/"; else sep = ""; 8000106b: b8 7c 33 00 80 mov $0x8000337c,%eax const char *sep; if(flag['l']) printf("%11d %c ", size, isdir ? 'd' : '-'); if(prefix) { if (prefix[0] && prefix[strlen(prefix)-1] != '/') 80001070: 80 3b 00 cmpb $0x0,(%ebx) 80001073: 74 1e je 80001093 <ls1+0x60> 80001075: 83 ec 0c sub $0xc,%esp 80001078: 53 push %ebx 80001079: e8 56 03 00 00 call 800013d4 <strlen> 8000107e: 83 c4 10 add $0x10,%esp sep = "/"; else sep = ""; 80001081: 80 7c 03 ff 2f cmpb $0x2f,-0x1(%ebx,%eax,1) 80001086: ba 7c 33 00 80 mov $0x8000337c,%edx 8000108b: b8 20 33 00 80 mov $0x80003320,%eax 80001090: 0f 44 c2 cmove %edx,%eax printf("%s%s", prefix, sep); 80001093: 83 ec 04 sub $0x4,%esp 80001096: 50 push %eax 80001097: 53 push %ebx 80001098: 68 2b 33 00 80 push $0x8000332b 8000109d: e8 0f 1f 00 00 call 80002fb1 <printf> 800010a2: 83 c4 10 add $0x10,%esp } printf("%s", name); 800010a5: 83 ec 08 sub $0x8,%esp 800010a8: ff 75 14 pushl 0x14(%ebp) 800010ab: 68 65 33 00 80 push $0x80003365 800010b0: e8 fc 1e 00 00 call 80002fb1 <printf> if(flag['F'] && isdir) 800010b5: 83 c4 10 add $0x10,%esp 800010b8: 83 3d d8 55 00 80 00 cmpl $0x0,0x800055d8 800010bf: 74 16 je 800010d7 <ls1+0xa4> 800010c1: 89 f0 mov %esi,%eax 800010c3: 84 c0 test %al,%al 800010c5: 74 10 je 800010d7 <ls1+0xa4> printf("/"); 800010c7: 83 ec 0c sub $0xc,%esp 800010ca: 68 20 33 00 80 push $0x80003320 800010cf: e8 dd 1e 00 00 call 80002fb1 <printf> 800010d4: 83 c4 10 add $0x10,%esp printf("\n"); 800010d7: 83 ec 0c sub $0xc,%esp 800010da: 68 7b 33 00 80 push $0x8000337b 800010df: e8 cd 1e 00 00 call 80002fb1 <printf> } 800010e4: 83 c4 10 add $0x10,%esp 800010e7: 8d 65 f8 lea -0x8(%ebp),%esp 800010ea: 5b pop %ebx 800010eb: 5e pop %esi 800010ec: 5d pop %ebp 800010ed: c3 ret 800010ee <lsdir>: ls1(0, st.st_isdir, st.st_size, path); } void lsdir(const char *path, const char *prefix) { 800010ee: 55 push %ebp 800010ef: 89 e5 mov %esp,%ebp 800010f1: 57 push %edi 800010f2: 56 push %esi 800010f3: 53 push %ebx 800010f4: 81 ec d8 00 00 00 sub $0xd8,%esp int fd, n, len, r; struct DirEntry f; struct Stat st; char fullpath[MAXPATHLEN]; len = strlen(path); 800010fa: ff 75 08 pushl 0x8(%ebp) 800010fd: e8 d2 02 00 00 call 800013d4 <strlen> 80001102: 89 c6 mov %eax,%esi if ((fd = open(path, O_RDONLY)) < 0) 80001104: 83 c4 08 add $0x8,%esp 80001107: 6a 00 push $0x0 80001109: ff 75 08 pushl 0x8(%ebp) 8000110c: e8 5d 11 00 00 call 8000226e <open> 80001111: 89 c3 mov %eax,%ebx 80001113: 83 c4 10 add $0x10,%esp 80001116: 85 c0 test %eax,%eax 80001118: 0f 89 8b 00 00 00 jns 800011a9 <lsdir+0xbb> panic("open %s: %e", path, fd); 8000111e: 83 ec 0c sub $0xc,%esp 80001121: 50 push %eax 80001122: ff 75 08 pushl 0x8(%ebp) 80001125: 68 30 33 00 80 push $0x80003330 8000112a: 6a 28 push $0x28 8000112c: 68 3c 33 00 80 push $0x8000333c 80001131: e8 09 20 00 00 call 8000313f <_panic> while ((n = readn(fd, &f, sizeof f)) == sizeof f) if (f.f_name[0]) { 80001136: 80 7d d6 00 cmpb $0x0,-0x2a(%ebp) 8000113a: 74 7f je 800011bb <lsdir+0xcd> strcpy(fullpath, path); 8000113c: 83 ec 08 sub $0x8,%esp 8000113f: ff 75 08 pushl 0x8(%ebp) 80001142: 57 push %edi 80001143: e8 e7 02 00 00 call 8000142f <strcpy> strcpy(fullpath+len, f.f_name); 80001148: 83 c4 08 add $0x8,%esp 8000114b: 8d 45 d6 lea -0x2a(%ebp),%eax 8000114e: 50 push %eax 8000114f: ff b5 34 ff ff ff pushl -0xcc(%ebp) 80001155: e8 d5 02 00 00 call 8000142f <strcpy> if ((r = stat(fullpath, &st)) < 0) 8000115a: 83 c4 08 add $0x8,%esp 8000115d: 8d 45 b8 lea -0x48(%ebp),%eax 80001160: 50 push %eax 80001161: 57 push %edi 80001162: e8 50 0f 00 00 call 800020b7 <stat> 80001167: 83 c4 10 add $0x10,%esp 8000116a: 85 c0 test %eax,%eax 8000116c: 79 1c jns 8000118a <lsdir+0x9c> panic("stat %s: %e", fullpath, r); 8000116e: 83 ec 0c sub $0xc,%esp 80001171: 50 push %eax 80001172: 8d 85 38 ff ff ff lea -0xc8(%ebp),%eax 80001178: 50 push %eax 80001179: 68 41 33 00 80 push $0x80003341 8000117e: 6a 2e push $0x2e 80001180: 68 3c 33 00 80 push $0x8000333c 80001185: e8 b5 1f 00 00 call 8000313f <_panic> ls1(prefix, st.st_isdir, st.st_size, f.f_name); 8000118a: 8d 45 d6 lea -0x2a(%ebp),%eax 8000118d: 50 push %eax 8000118e: ff 75 c8 pushl -0x38(%ebp) 80001191: 83 7d cc 00 cmpl $0x0,-0x34(%ebp) 80001195: 0f 95 c0 setne %al 80001198: 0f b6 c0 movzbl %al,%eax 8000119b: 50 push %eax 8000119c: ff 75 0c pushl 0xc(%ebp) 8000119f: e8 8f fe ff ff call 80001033 <ls1> 800011a4: 83 c4 10 add $0x10,%esp 800011a7: eb 0f jmp 800011b8 <lsdir+0xca> len = strlen(path); if ((fd = open(path, O_RDONLY)) < 0) panic("open %s: %e", path, fd); while ((n = readn(fd, &f, sizeof f)) == sizeof f) if (f.f_name[0]) { strcpy(fullpath, path); 800011a9: 8d bd 38 ff ff ff lea -0xc8(%ebp),%edi strcpy(fullpath+len, f.f_name); 800011af: 8d 04 37 lea (%edi,%esi,1),%eax 800011b2: 89 85 34 ff ff ff mov %eax,-0xcc(%ebp) char fullpath[MAXPATHLEN]; len = strlen(path); if ((fd = open(path, O_RDONLY)) < 0) panic("open %s: %e", path, fd); while ((n = readn(fd, &f, sizeof f)) == sizeof f) 800011b8: 8d 75 d6 lea -0x2a(%ebp),%esi 800011bb: 83 ec 04 sub $0x4,%esp 800011be: 6a 12 push $0x12 800011c0: 56 push %esi 800011c1: 53 push %ebx 800011c2: e8 e8 0c 00 00 call 80001eaf <readn> 800011c7: 83 c4 10 add $0x10,%esp 800011ca: 83 f8 12 cmp $0x12,%eax 800011cd: 0f 84 63 ff ff ff je 80001136 <lsdir+0x48> strcpy(fullpath+len, f.f_name); if ((r = stat(fullpath, &st)) < 0) panic("stat %s: %e", fullpath, r); ls1(prefix, st.st_isdir, st.st_size, f.f_name); } if (n > 0) 800011d3: 85 c0 test %eax,%eax 800011d5: 7e 14 jle 800011eb <lsdir+0xfd> panic("short read in directory %s", path); 800011d7: ff 75 08 pushl 0x8(%ebp) 800011da: 68 4d 33 00 80 push $0x8000334d 800011df: 6a 32 push $0x32 800011e1: 68 3c 33 00 80 push $0x8000333c 800011e6: e8 54 1f 00 00 call 8000313f <_panic> if (n < 0) 800011eb: 85 c0 test %eax,%eax 800011ed: 79 18 jns 80001207 <lsdir+0x119> panic("error reading directory %s: %e", path, n); 800011ef: 83 ec 0c sub $0xc,%esp 800011f2: 50 push %eax 800011f3: ff 75 08 pushl 0x8(%ebp) 800011f6: 68 8c 33 00 80 push $0x8000338c 800011fb: 6a 34 push $0x34 800011fd: 68 3c 33 00 80 push $0x8000333c 80001202: e8 38 1f 00 00 call 8000313f <_panic> } 80001207: 8d 65 f4 lea -0xc(%ebp),%esp 8000120a: 5b pop %ebx 8000120b: 5e pop %esi 8000120c: 5f pop %edi 8000120d: 5d pop %ebp 8000120e: c3 ret 8000120f <ls>: void lsdir(const char*, const char*); void ls1(const char*, bool, off_t, const char*); void ls(const char *path, const char *prefix) { 8000120f: 55 push %ebp 80001210: 89 e5 mov %esp,%ebp 80001212: 56 push %esi 80001213: 53 push %ebx 80001214: 81 ec a0 00 00 00 sub $0xa0,%esp 8000121a: 8b 5d 08 mov 0x8(%ebp),%ebx int r; struct Stat st; char fullpath[MAXPATHLEN]; if (path[0] == '.') { 8000121d: 80 3b 2e cmpb $0x2e,(%ebx) 80001220: 75 2b jne 8000124d <ls+0x3e> strcpy(fullpath, curpath); 80001222: 83 ec 08 sub $0x8,%esp 80001225: 68 20 54 00 80 push $0x80005420 8000122a: 8d b5 5c ff ff ff lea -0xa4(%ebp),%esi 80001230: 56 push %esi 80001231: e8 f9 01 00 00 call 8000142f <strcpy> strcpy(fullpath+curpathlen, path); 80001236: 83 c4 08 add $0x8,%esp 80001239: 53 push %ebx 8000123a: 89 f0 mov %esi,%eax 8000123c: 03 05 a0 54 00 80 add 0x800054a0,%eax 80001242: 50 push %eax 80001243: e8 e7 01 00 00 call 8000142f <strcpy> 80001248: 83 c4 10 add $0x10,%esp path = fullpath; 8000124b: 89 f3 mov %esi,%ebx } if ((r = stat(path, &st)) < 0) 8000124d: 83 ec 08 sub $0x8,%esp 80001250: 8d 45 dc lea -0x24(%ebp),%eax 80001253: 50 push %eax 80001254: 53 push %ebx 80001255: e8 5d 0e 00 00 call 800020b7 <stat> 8000125a: 83 c4 10 add $0x10,%esp 8000125d: 85 c0 test %eax,%eax 8000125f: 79 16 jns 80001277 <ls+0x68> panic("stat %s: %e", path, r); 80001261: 83 ec 0c sub $0xc,%esp 80001264: 50 push %eax 80001265: 53 push %ebx 80001266: 68 41 33 00 80 push $0x80003341 8000126b: 6a 17 push $0x17 8000126d: 68 3c 33 00 80 push $0x8000333c 80001272: e8 c8 1e 00 00 call 8000313f <_panic> if (st.st_isdir && !flag['d']) 80001277: 8b 45 f0 mov -0x10(%ebp),%eax 8000127a: 85 c0 test %eax,%eax 8000127c: 74 18 je 80001296 <ls+0x87> 8000127e: 83 3d 50 56 00 80 00 cmpl $0x0,0x80005650 80001285: 75 0f jne 80001296 <ls+0x87> lsdir(path, path); 80001287: 83 ec 08 sub $0x8,%esp 8000128a: 53 push %ebx 8000128b: 53 push %ebx 8000128c: e8 5d fe ff ff call 800010ee <lsdir> 80001291: 83 c4 10 add $0x10,%esp 80001294: eb 17 jmp 800012ad <ls+0x9e> else ls1(0, st.st_isdir, st.st_size, path); 80001296: 53 push %ebx 80001297: ff 75 ec pushl -0x14(%ebp) 8000129a: 85 c0 test %eax,%eax 8000129c: 0f 95 c0 setne %al 8000129f: 0f b6 c0 movzbl %al,%eax 800012a2: 50 push %eax 800012a3: 6a 00 push $0x0 800012a5: e8 89 fd ff ff call 80001033 <ls1> 800012aa: 83 c4 10 add $0x10,%esp } 800012ad: 8d 65 f8 lea -0x8(%ebp),%esp 800012b0: 5b pop %ebx 800012b1: 5e pop %esi 800012b2: 5d pop %ebp 800012b3: c3 ret 800012b4 <usage>: printf("\n"); } void usage(void) { 800012b4: 55 push %ebp 800012b5: 89 e5 mov %esp,%ebp 800012b7: 83 ec 14 sub $0x14,%esp printf("usage: ls [file...]\n"); 800012ba: 68 68 33 00 80 push $0x80003368 800012bf: e8 ed 1c 00 00 call 80002fb1 <printf> exit(); 800012c4: e8 db 14 00 00 call 800027a4 <exit> } 800012c9: 83 c4 10 add $0x10,%esp 800012cc: c9 leave 800012cd: c3 ret 800012ce <load_curpath>: void load_curpath(){ 800012ce: 55 push %ebp 800012cf: 89 e5 mov %esp,%ebp 800012d1: 53 push %ebx 800012d2: 83 ec 0c sub $0xc,%esp int glb_var_fd; // load curpath if ((glb_var_fd = open("/.global_var", O_RDONLY)) < 0) 800012d5: 6a 00 push $0x0 800012d7: 68 7d 33 00 80 push $0x8000337d 800012dc: e8 8d 0f 00 00 call 8000226e <open> 800012e1: 89 c3 mov %eax,%ebx 800012e3: 83 c4 10 add $0x10,%esp 800012e6: 85 c0 test %eax,%eax 800012e8: 79 1a jns 80001304 <load_curpath+0x36> panic("open %s: %e", "/.global_var", glb_var_fd); 800012ea: 83 ec 0c sub $0xc,%esp 800012ed: 50 push %eax 800012ee: 68 7d 33 00 80 push $0x8000337d 800012f3: 68 30 33 00 80 push $0x80003330 800012f8: 6a 58 push $0x58 800012fa: 68 3c 33 00 80 push $0x8000333c 800012ff: e8 3b 1e 00 00 call 8000313f <_panic> curpathlen = readn(glb_var_fd, curpath, MAXPATHLEN); 80001304: 83 ec 04 sub $0x4,%esp 80001307: 68 80 00 00 00 push $0x80 8000130c: 68 20 54 00 80 push $0x80005420 80001311: 50 push %eax 80001312: e8 98 0b 00 00 call 80001eaf <readn> 80001317: a3 a0 54 00 80 mov %eax,0x800054a0 curpath[curpathlen] = '\0'; 8000131c: c6 80 20 54 00 80 00 movb $0x0,-0x7fffabe0(%eax) close(glb_var_fd); 80001323: 89 1c 24 mov %ebx,(%esp) 80001326: e8 b9 09 00 00 call 80001ce4 <close> } 8000132b: 83 c4 10 add $0x10,%esp 8000132e: 8b 5d fc mov -0x4(%ebp),%ebx 80001331: c9 leave 80001332: c3 ret 80001333 <umain>: void umain(int argc, char **argv) { 80001333: 55 push %ebp 80001334: 89 e5 mov %esp,%ebp 80001336: 56 push %esi 80001337: 53 push %ebx 80001338: 83 ec 10 sub $0x10,%esp 8000133b: 8b 75 0c mov 0xc(%ebp),%esi int i; struct Argstate args; load_curpath(); 8000133e: e8 8b ff ff ff call 800012ce <load_curpath> argstart(&argc, argv, &args); 80001343: 83 ec 04 sub $0x4,%esp 80001346: 8d 45 e8 lea -0x18(%ebp),%eax 80001349: 50 push %eax 8000134a: 56 push %esi 8000134b: 8d 45 08 lea 0x8(%ebp),%eax 8000134e: 50 push %eax 8000134f: e8 a5 14 00 00 call 800027f9 <argstart> while ((i = argnext(&args)) >= 0) 80001354: 83 c4 10 add $0x10,%esp 80001357: 8d 5d e8 lea -0x18(%ebp),%ebx 8000135a: eb 1e jmp 8000137a <umain+0x47> switch (i) { 8000135c: 83 f8 64 cmp $0x64,%eax 8000135f: 74 0a je 8000136b <umain+0x38> 80001361: 83 f8 6c cmp $0x6c,%eax 80001364: 74 05 je 8000136b <umain+0x38> 80001366: 83 f8 46 cmp $0x46,%eax 80001369: 75 0a jne 80001375 <umain+0x42> case 'd': case 'F': case 'l': flag[i]++; 8000136b: 83 04 85 c0 54 00 80 addl $0x1,-0x7fffab40(,%eax,4) 80001372: 01 break; 80001373: eb 05 jmp 8000137a <umain+0x47> default: usage(); 80001375: e8 3a ff ff ff call 800012b4 <usage> struct Argstate args; load_curpath(); argstart(&argc, argv, &args); while ((i = argnext(&args)) >= 0) 8000137a: 83 ec 0c sub $0xc,%esp 8000137d: 53 push %ebx 8000137e: e8 a6 14 00 00 call 80002829 <argnext> 80001383: 83 c4 10 add $0x10,%esp 80001386: 85 c0 test %eax,%eax 80001388: 79 d2 jns 8000135c <umain+0x29> break; default: usage(); } if (argc == 1) 8000138a: 8b 45 08 mov 0x8(%ebp),%eax 8000138d: 83 f8 01 cmp $0x1,%eax 80001390: 74 0c je 8000139e <umain+0x6b> lsdir(curpath, curpath); else { for (i = 1; i < argc; i++) 80001392: bb 01 00 00 00 mov $0x1,%ebx 80001397: 83 f8 01 cmp $0x1,%eax 8000139a: 7f 19 jg 800013b5 <umain+0x82> 8000139c: eb 2f jmp 800013cd <umain+0x9a> default: usage(); } if (argc == 1) lsdir(curpath, curpath); 8000139e: 83 ec 08 sub $0x8,%esp 800013a1: 68 20 54 00 80 push $0x80005420 800013a6: 68 20 54 00 80 push $0x80005420 800013ab: e8 3e fd ff ff call 800010ee <lsdir> 800013b0: 83 c4 10 add $0x10,%esp 800013b3: eb 18 jmp 800013cd <umain+0x9a> else { for (i = 1; i < argc; i++) ls(argv[i], argv[i]); 800013b5: 8b 04 9e mov (%esi,%ebx,4),%eax 800013b8: 83 ec 08 sub $0x8,%esp 800013bb: 50 push %eax 800013bc: 50 push %eax 800013bd: e8 4d fe ff ff call 8000120f <ls> } if (argc == 1) lsdir(curpath, curpath); else { for (i = 1; i < argc; i++) 800013c2: 83 c3 01 add $0x1,%ebx 800013c5: 83 c4 10 add $0x10,%esp 800013c8: 39 5d 08 cmp %ebx,0x8(%ebp) 800013cb: 7f e8 jg 800013b5 <umain+0x82> ls(argv[i], argv[i]); } } 800013cd: 8d 65 f8 lea -0x8(%ebp),%esp 800013d0: 5b pop %ebx 800013d1: 5e pop %esi 800013d2: 5d pop %ebp 800013d3: c3 ret 800013d4 <strlen>: #include <x86.h> #define ASM 1 int strlen(const char *s) { 800013d4: 55 push %ebp 800013d5: 89 e5 mov %esp,%ebp 800013d7: 8b 55 08 mov 0x8(%ebp),%edx int n; for (n = 0; *s != '\0'; s++) 800013da: 80 3a 00 cmpb $0x0,(%edx) 800013dd: 74 10 je 800013ef <strlen+0x1b> 800013df: b8 00 00 00 00 mov $0x0,%eax n++; 800013e4: 83 c0 01 add $0x1,%eax int strlen(const char *s) { int n; for (n = 0; *s != '\0'; s++) 800013e7: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) 800013eb: 75 f7 jne 800013e4 <strlen+0x10> 800013ed: eb 05 jmp 800013f4 <strlen+0x20> 800013ef: b8 00 00 00 00 mov $0x0,%eax n++; return n; } 800013f4: 5d pop %ebp 800013f5: c3 ret 800013f6 <strnlen>: int strnlen(const char *s, size_t size) { 800013f6: 55 push %ebp 800013f7: 89 e5 mov %esp,%ebp 800013f9: 53 push %ebx 800013fa: 8b 5d 08 mov 0x8(%ebp),%ebx 800013fd: 8b 4d 0c mov 0xc(%ebp),%ecx int n; for (n = 0; size > 0 && *s != '\0'; s++, size--) 80001400: 85 c9 test %ecx,%ecx 80001402: 74 1c je 80001420 <strnlen+0x2a> 80001404: 80 3b 00 cmpb $0x0,(%ebx) 80001407: 74 1e je 80001427 <strnlen+0x31> 80001409: ba 01 00 00 00 mov $0x1,%edx n++; 8000140e: 89 d0 mov %edx,%eax int strnlen(const char *s, size_t size) { int n; for (n = 0; size > 0 && *s != '\0'; s++, size--) 80001410: 39 ca cmp %ecx,%edx 80001412: 74 18 je 8000142c <strnlen+0x36> 80001414: 83 c2 01 add $0x1,%edx 80001417: 80 7c 13 ff 00 cmpb $0x0,-0x1(%ebx,%edx,1) 8000141c: 75 f0 jne 8000140e <strnlen+0x18> 8000141e: eb 0c jmp 8000142c <strnlen+0x36> 80001420: b8 00 00 00 00 mov $0x0,%eax 80001425: eb 05 jmp 8000142c <strnlen+0x36> 80001427: b8 00 00 00 00 mov $0x0,%eax n++; return n; } 8000142c: 5b pop %ebx 8000142d: 5d pop %ebp 8000142e: c3 ret 8000142f <strcpy>: char * strcpy(char *dst, const char *src) { 8000142f: 55 push %ebp 80001430: 89 e5 mov %esp,%ebp 80001432: 53 push %ebx 80001433: 8b 45 08 mov 0x8(%ebp),%eax 80001436: 8b 4d 0c mov 0xc(%ebp),%ecx char *ret; ret = dst; while ((*dst++ = *src++) != '\0') 80001439: 89 c2 mov %eax,%edx 8000143b: 83 c2 01 add $0x1,%edx 8000143e: 83 c1 01 add $0x1,%ecx 80001441: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 80001445: 88 5a ff mov %bl,-0x1(%edx) 80001448: 84 db test %bl,%bl 8000144a: 75 ef jne 8000143b <strcpy+0xc> /* do nothing */; return ret; } 8000144c: 5b pop %ebx 8000144d: 5d pop %ebp 8000144e: c3 ret 8000144f <strcat>: char * strcat(char *dst, const char *src) { 8000144f: 55 push %ebp 80001450: 89 e5 mov %esp,%ebp 80001452: 53 push %ebx 80001453: 8b 5d 08 mov 0x8(%ebp),%ebx int len = strlen(dst); 80001456: 53 push %ebx 80001457: e8 78 ff ff ff call 800013d4 <strlen> 8000145c: 83 c4 04 add $0x4,%esp strcpy(dst + len, src); 8000145f: ff 75 0c pushl 0xc(%ebp) 80001462: 01 d8 add %ebx,%eax 80001464: 50 push %eax 80001465: e8 c5 ff ff ff call 8000142f <strcpy> return dst; } 8000146a: 89 d8 mov %ebx,%eax 8000146c: 8b 5d fc mov -0x4(%ebp),%ebx 8000146f: c9 leave 80001470: c3 ret 80001471 <strncpy>: char * strncpy(char *dst, const char *src, size_t size) { 80001471: 55 push %ebp 80001472: 89 e5 mov %esp,%ebp 80001474: 56 push %esi 80001475: 53 push %ebx 80001476: 8b 75 08 mov 0x8(%ebp),%esi 80001479: 8b 55 0c mov 0xc(%ebp),%edx 8000147c: 8b 5d 10 mov 0x10(%ebp),%ebx size_t i; char *ret; ret = dst; for (i = 0; i < size; i++) { 8000147f: 85 db test %ebx,%ebx 80001481: 74 17 je 8000149a <strncpy+0x29> 80001483: 01 f3 add %esi,%ebx 80001485: 89 f1 mov %esi,%ecx *dst++ = *src; 80001487: 83 c1 01 add $0x1,%ecx 8000148a: 0f b6 02 movzbl (%edx),%eax 8000148d: 88 41 ff mov %al,-0x1(%ecx) // If strlen(src) < size, null-pad 'dst' out to 'size' chars if (*src != '\0') src++; 80001490: 80 3a 01 cmpb $0x1,(%edx) 80001493: 83 da ff sbb $0xffffffff,%edx strncpy(char *dst, const char *src, size_t size) { size_t i; char *ret; ret = dst; for (i = 0; i < size; i++) { 80001496: 39 cb cmp %ecx,%ebx 80001498: 75 ed jne 80001487 <strncpy+0x16> // If strlen(src) < size, null-pad 'dst' out to 'size' chars if (*src != '\0') src++; } return ret; } 8000149a: 89 f0 mov %esi,%eax 8000149c: 5b pop %ebx 8000149d: 5e pop %esi 8000149e: 5d pop %ebp 8000149f: c3 ret 800014a0 <strlcpy>: size_t strlcpy(char *dst, const char *src, size_t size) { 800014a0: 55 push %ebp 800014a1: 89 e5 mov %esp,%ebp 800014a3: 56 push %esi 800014a4: 53 push %ebx 800014a5: 8b 75 08 mov 0x8(%ebp),%esi 800014a8: 8b 5d 0c mov 0xc(%ebp),%ebx 800014ab: 8b 55 10 mov 0x10(%ebp),%edx 800014ae: 89 f0 mov %esi,%eax char *dst_in; dst_in = dst; if (size > 0) { 800014b0: 85 d2 test %edx,%edx 800014b2: 74 35 je 800014e9 <strlcpy+0x49> while (--size > 0 && *src != '\0') 800014b4: 89 d0 mov %edx,%eax 800014b6: 83 e8 01 sub $0x1,%eax 800014b9: 74 25 je 800014e0 <strlcpy+0x40> 800014bb: 0f b6 0b movzbl (%ebx),%ecx 800014be: 84 c9 test %cl,%cl 800014c0: 74 22 je 800014e4 <strlcpy+0x44> 800014c2: 8d 53 01 lea 0x1(%ebx),%edx 800014c5: 01 c3 add %eax,%ebx 800014c7: 89 f0 mov %esi,%eax *dst++ = *src++; 800014c9: 83 c0 01 add $0x1,%eax 800014cc: 88 48 ff mov %cl,-0x1(%eax) { char *dst_in; dst_in = dst; if (size > 0) { while (--size > 0 && *src != '\0') 800014cf: 39 da cmp %ebx,%edx 800014d1: 74 13 je 800014e6 <strlcpy+0x46> 800014d3: 83 c2 01 add $0x1,%edx 800014d6: 0f b6 4a ff movzbl -0x1(%edx),%ecx 800014da: 84 c9 test %cl,%cl 800014dc: 75 eb jne 800014c9 <strlcpy+0x29> 800014de: eb 06 jmp 800014e6 <strlcpy+0x46> 800014e0: 89 f0 mov %esi,%eax 800014e2: eb 02 jmp 800014e6 <strlcpy+0x46> 800014e4: 89 f0 mov %esi,%eax *dst++ = *src++; *dst = '\0'; 800014e6: c6 00 00 movb $0x0,(%eax) } return dst - dst_in; 800014e9: 29 f0 sub %esi,%eax } 800014eb: 5b pop %ebx 800014ec: 5e pop %esi 800014ed: 5d pop %ebp 800014ee: c3 ret 800014ef <strcmp>: int strcmp(const char *p, const char *q) { 800014ef: 55 push %ebp 800014f0: 89 e5 mov %esp,%ebp 800014f2: 8b 4d 08 mov 0x8(%ebp),%ecx 800014f5: 8b 55 0c mov 0xc(%ebp),%edx while (*p && *p == *q) 800014f8: 0f b6 01 movzbl (%ecx),%eax 800014fb: 84 c0 test %al,%al 800014fd: 74 15 je 80001514 <strcmp+0x25> 800014ff: 3a 02 cmp (%edx),%al 80001501: 75 11 jne 80001514 <strcmp+0x25> p++, q++; 80001503: 83 c1 01 add $0x1,%ecx 80001506: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while (*p && *p == *q) 80001509: 0f b6 01 movzbl (%ecx),%eax 8000150c: 84 c0 test %al,%al 8000150e: 74 04 je 80001514 <strcmp+0x25> 80001510: 3a 02 cmp (%edx),%al 80001512: 74 ef je 80001503 <strcmp+0x14> p++, q++; return (int) ((unsigned char) *p - (unsigned char) *q); 80001514: 0f b6 c0 movzbl %al,%eax 80001517: 0f b6 12 movzbl (%edx),%edx 8000151a: 29 d0 sub %edx,%eax } 8000151c: 5d pop %ebp 8000151d: c3 ret 8000151e <strncmp>: int strncmp(const char *p, const char *q, size_t n) { 8000151e: 55 push %ebp 8000151f: 89 e5 mov %esp,%ebp 80001521: 56 push %esi 80001522: 53 push %ebx 80001523: 8b 5d 08 mov 0x8(%ebp),%ebx 80001526: 8b 55 0c mov 0xc(%ebp),%edx 80001529: 8b 75 10 mov 0x10(%ebp),%esi while (n > 0 && *p && *p == *q) 8000152c: 85 f6 test %esi,%esi 8000152e: 74 29 je 80001559 <strncmp+0x3b> 80001530: 0f b6 03 movzbl (%ebx),%eax 80001533: 84 c0 test %al,%al 80001535: 74 30 je 80001567 <strncmp+0x49> 80001537: 3a 02 cmp (%edx),%al 80001539: 75 2c jne 80001567 <strncmp+0x49> 8000153b: 8d 43 01 lea 0x1(%ebx),%eax 8000153e: 01 de add %ebx,%esi n--, p++, q++; 80001540: 89 c3 mov %eax,%ebx 80001542: 83 c2 01 add $0x1,%edx } int strncmp(const char *p, const char *q, size_t n) { while (n > 0 && *p && *p == *q) 80001545: 39 c6 cmp %eax,%esi 80001547: 74 17 je 80001560 <strncmp+0x42> 80001549: 0f b6 08 movzbl (%eax),%ecx 8000154c: 84 c9 test %cl,%cl 8000154e: 74 17 je 80001567 <strncmp+0x49> 80001550: 83 c0 01 add $0x1,%eax 80001553: 3a 0a cmp (%edx),%cl 80001555: 74 e9 je 80001540 <strncmp+0x22> 80001557: eb 0e jmp 80001567 <strncmp+0x49> n--, p++, q++; if (n == 0) return 0; 80001559: b8 00 00 00 00 mov $0x0,%eax 8000155e: eb 0f jmp 8000156f <strncmp+0x51> 80001560: b8 00 00 00 00 mov $0x0,%eax 80001565: eb 08 jmp 8000156f <strncmp+0x51> else return (int) ((unsigned char) *p - (unsigned char) *q); 80001567: 0f b6 03 movzbl (%ebx),%eax 8000156a: 0f b6 12 movzbl (%edx),%edx 8000156d: 29 d0 sub %edx,%eax } 8000156f: 5b pop %ebx 80001570: 5e pop %esi 80001571: 5d pop %ebp 80001572: c3 ret 80001573 <strchr>: // Return a pointer to the first occurrence of 'c' in 's', // or a null pointer if the string has no 'c'. char * strchr(const char *s, char c) { 80001573: 55 push %ebp 80001574: 89 e5 mov %esp,%ebp 80001576: 53 push %ebx 80001577: 8b 45 08 mov 0x8(%ebp),%eax 8000157a: 8b 5d 0c mov 0xc(%ebp),%ebx for (; *s; s++) 8000157d: 0f b6 10 movzbl (%eax),%edx 80001580: 84 d2 test %dl,%dl 80001582: 74 1d je 800015a1 <strchr+0x2e> 80001584: 89 d9 mov %ebx,%ecx if (*s == c) 80001586: 38 d3 cmp %dl,%bl 80001588: 75 06 jne 80001590 <strchr+0x1d> 8000158a: eb 1a jmp 800015a6 <strchr+0x33> 8000158c: 38 ca cmp %cl,%dl 8000158e: 74 16 je 800015a6 <strchr+0x33> // Return a pointer to the first occurrence of 'c' in 's', // or a null pointer if the string has no 'c'. char * strchr(const char *s, char c) { for (; *s; s++) 80001590: 83 c0 01 add $0x1,%eax 80001593: 0f b6 10 movzbl (%eax),%edx 80001596: 84 d2 test %dl,%dl 80001598: 75 f2 jne 8000158c <strchr+0x19> if (*s == c) return (char *) s; return 0; 8000159a: b8 00 00 00 00 mov $0x0,%eax 8000159f: eb 05 jmp 800015a6 <strchr+0x33> 800015a1: b8 00 00 00 00 mov $0x0,%eax } 800015a6: 5b pop %ebx 800015a7: 5d pop %ebp 800015a8: c3 ret 800015a9 <strfind>: // Return a pointer to the first occurrence of 'c' in 's', // or a pointer to the string-ending null character if the string has no 'c'. char * strfind(const char *s, char c) { 800015a9: 55 push %ebp 800015aa: 89 e5 mov %esp,%ebp 800015ac: 53 push %ebx 800015ad: 8b 45 08 mov 0x8(%ebp),%eax 800015b0: 8b 55 0c mov 0xc(%ebp),%edx for (; *s; s++) 800015b3: 0f b6 18 movzbl (%eax),%ebx if (*s == c) 800015b6: 38 d3 cmp %dl,%bl 800015b8: 74 14 je 800015ce <strfind+0x25> 800015ba: 89 d1 mov %edx,%ecx 800015bc: 84 db test %bl,%bl 800015be: 74 0e je 800015ce <strfind+0x25> // Return a pointer to the first occurrence of 'c' in 's', // or a pointer to the string-ending null character if the string has no 'c'. char * strfind(const char *s, char c) { for (; *s; s++) 800015c0: 83 c0 01 add $0x1,%eax 800015c3: 0f b6 10 movzbl (%eax),%edx if (*s == c) 800015c6: 38 ca cmp %cl,%dl 800015c8: 74 04 je 800015ce <strfind+0x25> 800015ca: 84 d2 test %dl,%dl 800015cc: 75 f2 jne 800015c0 <strfind+0x17> break; return (char *) s; } 800015ce: 5b pop %ebx 800015cf: 5d pop %ebp 800015d0: c3 ret 800015d1 <memset>: #if ASM void * memset(void *v, int c, size_t n) { 800015d1: 55 push %ebp 800015d2: 89 e5 mov %esp,%ebp 800015d4: 57 push %edi 800015d5: 56 push %esi 800015d6: 53 push %ebx 800015d7: 8b 7d 08 mov 0x8(%ebp),%edi 800015da: 8b 4d 10 mov 0x10(%ebp),%ecx if (n == 0) 800015dd: 85 c9 test %ecx,%ecx 800015df: 74 36 je 80001617 <memset+0x46> return v; if ((int)v%4 == 0 && n%4 == 0) { 800015e1: f7 c7 03 00 00 00 test $0x3,%edi 800015e7: 75 28 jne 80001611 <memset+0x40> 800015e9: f6 c1 03 test $0x3,%cl 800015ec: 75 23 jne 80001611 <memset+0x40> c &= 0xFF; 800015ee: 0f b6 55 0c movzbl 0xc(%ebp),%edx c = (c<<24)|(c<<16)|(c<<8)|c; 800015f2: 89 d3 mov %edx,%ebx 800015f4: c1 e3 08 shl $0x8,%ebx 800015f7: 89 d6 mov %edx,%esi 800015f9: c1 e6 18 shl $0x18,%esi 800015fc: 89 d0 mov %edx,%eax 800015fe: c1 e0 10 shl $0x10,%eax 80001601: 09 f0 or %esi,%eax 80001603: 09 c2 or %eax,%edx asm volatile("cld; rep stosl\n" 80001605: 89 d8 mov %ebx,%eax 80001607: 09 d0 or %edx,%eax 80001609: c1 e9 02 shr $0x2,%ecx 8000160c: fc cld 8000160d: f3 ab rep stos %eax,%es:(%edi) 8000160f: eb 06 jmp 80001617 <memset+0x46> :: "D" (v), "a" (c), "c" (n/4) : "cc", "memory"); } else asm volatile("cld; rep stosb\n" 80001611: 8b 45 0c mov 0xc(%ebp),%eax 80001614: fc cld 80001615: f3 aa rep stos %al,%es:(%edi) :: "D" (v), "a" (c), "c" (n) : "cc", "memory"); return v; } 80001617: 89 f8 mov %edi,%eax 80001619: 5b pop %ebx 8000161a: 5e pop %esi 8000161b: 5f pop %edi 8000161c: 5d pop %ebp 8000161d: c3 ret 8000161e <memmove>: void * memmove(void *dst, const void *src, size_t n) { 8000161e: 55 push %ebp 8000161f: 89 e5 mov %esp,%ebp 80001621: 57 push %edi 80001622: 56 push %esi 80001623: 8b 45 08 mov 0x8(%ebp),%eax 80001626: 8b 75 0c mov 0xc(%ebp),%esi 80001629: 8b 4d 10 mov 0x10(%ebp),%ecx const char *s; char *d; s = src; d = dst; if (s < d && s + n > d) { 8000162c: 39 c6 cmp %eax,%esi 8000162e: 73 35 jae 80001665 <memmove+0x47> 80001630: 8d 14 0e lea (%esi,%ecx,1),%edx 80001633: 39 d0 cmp %edx,%eax 80001635: 73 2e jae 80001665 <memmove+0x47> s += n; d += n; 80001637: 8d 3c 08 lea (%eax,%ecx,1),%edi if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 8000163a: 89 d6 mov %edx,%esi 8000163c: 09 fe or %edi,%esi 8000163e: f7 c6 03 00 00 00 test $0x3,%esi 80001644: 75 13 jne 80001659 <memmove+0x3b> 80001646: f6 c1 03 test $0x3,%cl 80001649: 75 0e jne 80001659 <memmove+0x3b> asm volatile("std; rep movsl\n" 8000164b: 83 ef 04 sub $0x4,%edi 8000164e: 8d 72 fc lea -0x4(%edx),%esi 80001651: c1 e9 02 shr $0x2,%ecx 80001654: fd std 80001655: f3 a5 rep movsl %ds:(%esi),%es:(%edi) 80001657: eb 09 jmp 80001662 <memmove+0x44> :: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory"); else asm volatile("std; rep movsb\n" 80001659: 83 ef 01 sub $0x1,%edi 8000165c: 8d 72 ff lea -0x1(%edx),%esi 8000165f: fd std 80001660: f3 a4 rep movsb %ds:(%esi),%es:(%edi) :: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory"); // Some versions of GCC rely on DF being clear asm volatile("cld" ::: "cc"); 80001662: fc cld 80001663: eb 1d jmp 80001682 <memmove+0x64> } else { if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 80001665: 89 f2 mov %esi,%edx 80001667: 09 c2 or %eax,%edx 80001669: f6 c2 03 test $0x3,%dl 8000166c: 75 0f jne 8000167d <memmove+0x5f> 8000166e: f6 c1 03 test $0x3,%cl 80001671: 75 0a jne 8000167d <memmove+0x5f> asm volatile("cld; rep movsl\n" 80001673: c1 e9 02 shr $0x2,%ecx 80001676: 89 c7 mov %eax,%edi 80001678: fc cld 80001679: f3 a5 rep movsl %ds:(%esi),%es:(%edi) 8000167b: eb 05 jmp 80001682 <memmove+0x64> :: "D" (d), "S" (s), "c" (n/4) : "cc", "memory"); else asm volatile("cld; rep movsb\n" 8000167d: 89 c7 mov %eax,%edi 8000167f: fc cld 80001680: f3 a4 rep movsb %ds:(%esi),%es:(%edi) :: "D" (d), "S" (s), "c" (n) : "cc", "memory"); } return dst; } 80001682: 5e pop %esi 80001683: 5f pop %edi 80001684: 5d pop %ebp 80001685: c3 ret 80001686 <memcpy>: } #endif void * memcpy(void *dst, const void *src, size_t n) { 80001686: 55 push %ebp 80001687: 89 e5 mov %esp,%ebp return memmove(dst, src, n); 80001689: ff 75 10 pushl 0x10(%ebp) 8000168c: ff 75 0c pushl 0xc(%ebp) 8000168f: ff 75 08 pushl 0x8(%ebp) 80001692: e8 87 ff ff ff call 8000161e <memmove> } 80001697: c9 leave 80001698: c3 ret 80001699 <memcmp>: int memcmp(const void *v1, const void *v2, size_t n) { 80001699: 55 push %ebp 8000169a: 89 e5 mov %esp,%ebp 8000169c: 57 push %edi 8000169d: 56 push %esi 8000169e: 53 push %ebx 8000169f: 8b 5d 08 mov 0x8(%ebp),%ebx 800016a2: 8b 75 0c mov 0xc(%ebp),%esi 800016a5: 8b 45 10 mov 0x10(%ebp),%eax const uint8_t *s1 = (const uint8_t *) v1; const uint8_t *s2 = (const uint8_t *) v2; while (n-- > 0) { 800016a8: 85 c0 test %eax,%eax 800016aa: 74 39 je 800016e5 <memcmp+0x4c> 800016ac: 8d 78 ff lea -0x1(%eax),%edi if (*s1 != *s2) 800016af: 0f b6 13 movzbl (%ebx),%edx 800016b2: 0f b6 0e movzbl (%esi),%ecx 800016b5: 38 ca cmp %cl,%dl 800016b7: 75 17 jne 800016d0 <memcmp+0x37> 800016b9: b8 00 00 00 00 mov $0x0,%eax 800016be: eb 1a jmp 800016da <memcmp+0x41> 800016c0: 0f b6 54 03 01 movzbl 0x1(%ebx,%eax,1),%edx 800016c5: 83 c0 01 add $0x1,%eax 800016c8: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx 800016cc: 38 ca cmp %cl,%dl 800016ce: 74 0a je 800016da <memcmp+0x41> return (int) *s1 - (int) *s2; 800016d0: 0f b6 c2 movzbl %dl,%eax 800016d3: 0f b6 c9 movzbl %cl,%ecx 800016d6: 29 c8 sub %ecx,%eax 800016d8: eb 10 jmp 800016ea <memcmp+0x51> memcmp(const void *v1, const void *v2, size_t n) { const uint8_t *s1 = (const uint8_t *) v1; const uint8_t *s2 = (const uint8_t *) v2; while (n-- > 0) { 800016da: 39 f8 cmp %edi,%eax 800016dc: 75 e2 jne 800016c0 <memcmp+0x27> if (*s1 != *s2) return (int) *s1 - (int) *s2; s1++, s2++; } return 0; 800016de: b8 00 00 00 00 mov $0x0,%eax 800016e3: eb 05 jmp 800016ea <memcmp+0x51> 800016e5: b8 00 00 00 00 mov $0x0,%eax } 800016ea: 5b pop %ebx 800016eb: 5e pop %esi 800016ec: 5f pop %edi 800016ed: 5d pop %ebp 800016ee: c3 ret 800016ef <memfind>: void * memfind(const void *s, int c, size_t n) { 800016ef: 55 push %ebp 800016f0: 89 e5 mov %esp,%ebp 800016f2: 53 push %ebx 800016f3: 8b 55 08 mov 0x8(%ebp),%edx const void *ends = (const char *) s + n; 800016f6: 89 d0 mov %edx,%eax 800016f8: 03 45 10 add 0x10(%ebp),%eax for (; s < ends; s++) 800016fb: 39 c2 cmp %eax,%edx 800016fd: 73 1d jae 8000171c <memfind+0x2d> if (*(const unsigned char *) s == (unsigned char) c) 800016ff: 0f b6 5d 0c movzbl 0xc(%ebp),%ebx 80001703: 0f b6 0a movzbl (%edx),%ecx 80001706: 39 d9 cmp %ebx,%ecx 80001708: 75 09 jne 80001713 <memfind+0x24> 8000170a: eb 14 jmp 80001720 <memfind+0x31> 8000170c: 0f b6 0a movzbl (%edx),%ecx 8000170f: 39 d9 cmp %ebx,%ecx 80001711: 74 11 je 80001724 <memfind+0x35> void * memfind(const void *s, int c, size_t n) { const void *ends = (const char *) s + n; for (; s < ends; s++) 80001713: 83 c2 01 add $0x1,%edx 80001716: 39 d0 cmp %edx,%eax 80001718: 75 f2 jne 8000170c <memfind+0x1d> 8000171a: eb 0a jmp 80001726 <memfind+0x37> 8000171c: 89 d0 mov %edx,%eax 8000171e: eb 06 jmp 80001726 <memfind+0x37> if (*(const unsigned char *) s == (unsigned char) c) 80001720: 89 d0 mov %edx,%eax 80001722: eb 02 jmp 80001726 <memfind+0x37> void * memfind(const void *s, int c, size_t n) { const void *ends = (const char *) s + n; for (; s < ends; s++) 80001724: 89 d0 mov %edx,%eax if (*(const unsigned char *) s == (unsigned char) c) break; return (void *) s; } 80001726: 5b pop %ebx 80001727: 5d pop %ebp 80001728: c3 ret 80001729 <strtol>: long strtol(const char *s, char **endptr, int base) { 80001729: 55 push %ebp 8000172a: 89 e5 mov %esp,%ebp 8000172c: 57 push %edi 8000172d: 56 push %esi 8000172e: 53 push %ebx 8000172f: 8b 4d 08 mov 0x8(%ebp),%ecx 80001732: 8b 5d 10 mov 0x10(%ebp),%ebx int neg = 0; long val = 0; // gobble initial whitespace while (*s == ' ' || *s == '\t') 80001735: 0f b6 01 movzbl (%ecx),%eax 80001738: 3c 20 cmp $0x20,%al 8000173a: 74 04 je 80001740 <strtol+0x17> 8000173c: 3c 09 cmp $0x9,%al 8000173e: 75 0e jne 8000174e <strtol+0x25> s++; 80001740: 83 c1 01 add $0x1,%ecx { int neg = 0; long val = 0; // gobble initial whitespace while (*s == ' ' || *s == '\t') 80001743: 0f b6 01 movzbl (%ecx),%eax 80001746: 3c 20 cmp $0x20,%al 80001748: 74 f6 je 80001740 <strtol+0x17> 8000174a: 3c 09 cmp $0x9,%al 8000174c: 74 f2 je 80001740 <strtol+0x17> s++; // plus/minus sign if (*s == '+') 8000174e: 3c 2b cmp $0x2b,%al 80001750: 75 0a jne 8000175c <strtol+0x33> s++; 80001752: 83 c1 01 add $0x1,%ecx } long strtol(const char *s, char **endptr, int base) { int neg = 0; 80001755: bf 00 00 00 00 mov $0x0,%edi 8000175a: eb 11 jmp 8000176d <strtol+0x44> 8000175c: bf 00 00 00 00 mov $0x0,%edi s++; // plus/minus sign if (*s == '+') s++; else if (*s == '-') 80001761: 3c 2d cmp $0x2d,%al 80001763: 75 08 jne 8000176d <strtol+0x44> s++, neg = 1; 80001765: 83 c1 01 add $0x1,%ecx 80001768: bf 01 00 00 00 mov $0x1,%edi // hex or octal base prefix if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) 8000176d: f7 c3 ef ff ff ff test $0xffffffef,%ebx 80001773: 75 15 jne 8000178a <strtol+0x61> 80001775: 80 39 30 cmpb $0x30,(%ecx) 80001778: 75 10 jne 8000178a <strtol+0x61> 8000177a: 80 79 01 78 cmpb $0x78,0x1(%ecx) 8000177e: 75 7c jne 800017fc <strtol+0xd3> s += 2, base = 16; 80001780: 83 c1 02 add $0x2,%ecx 80001783: bb 10 00 00 00 mov $0x10,%ebx 80001788: eb 16 jmp 800017a0 <strtol+0x77> else if (base == 0 && s[0] == '0') 8000178a: 85 db test %ebx,%ebx 8000178c: 75 12 jne 800017a0 <strtol+0x77> s++, base = 8; else if (base == 0) base = 10; 8000178e: bb 0a 00 00 00 mov $0xa,%ebx s++, neg = 1; // hex or octal base prefix if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) s += 2, base = 16; else if (base == 0 && s[0] == '0') 80001793: 80 39 30 cmpb $0x30,(%ecx) 80001796: 75 08 jne 800017a0 <strtol+0x77> s++, base = 8; 80001798: 83 c1 01 add $0x1,%ecx 8000179b: bb 08 00 00 00 mov $0x8,%ebx else if (base == 0) base = 10; 800017a0: b8 00 00 00 00 mov $0x0,%eax 800017a5: 89 5d 10 mov %ebx,0x10(%ebp) // digits while (1) { int dig; if (*s >= '0' && *s <= '9') 800017a8: 0f b6 11 movzbl (%ecx),%edx 800017ab: 8d 72 d0 lea -0x30(%edx),%esi 800017ae: 89 f3 mov %esi,%ebx 800017b0: 80 fb 09 cmp $0x9,%bl 800017b3: 77 08 ja 800017bd <strtol+0x94> dig = *s - '0'; 800017b5: 0f be d2 movsbl %dl,%edx 800017b8: 83 ea 30 sub $0x30,%edx 800017bb: eb 22 jmp 800017df <strtol+0xb6> else if (*s >= 'a' && *s <= 'z') 800017bd: 8d 72 9f lea -0x61(%edx),%esi 800017c0: 89 f3 mov %esi,%ebx 800017c2: 80 fb 19 cmp $0x19,%bl 800017c5: 77 08 ja 800017cf <strtol+0xa6> dig = *s - 'a' + 10; 800017c7: 0f be d2 movsbl %dl,%edx 800017ca: 83 ea 57 sub $0x57,%edx 800017cd: eb 10 jmp 800017df <strtol+0xb6> else if (*s >= 'A' && *s <= 'Z') 800017cf: 8d 72 bf lea -0x41(%edx),%esi 800017d2: 89 f3 mov %esi,%ebx 800017d4: 80 fb 19 cmp $0x19,%bl 800017d7: 77 16 ja 800017ef <strtol+0xc6> dig = *s - 'A' + 10; 800017d9: 0f be d2 movsbl %dl,%edx 800017dc: 83 ea 37 sub $0x37,%edx else break; if (dig >= base) 800017df: 3b 55 10 cmp 0x10(%ebp),%edx 800017e2: 7d 0b jge 800017ef <strtol+0xc6> break; s++, val = (val * base) + dig; 800017e4: 83 c1 01 add $0x1,%ecx 800017e7: 0f af 45 10 imul 0x10(%ebp),%eax 800017eb: 01 d0 add %edx,%eax // we don't properly detect overflow! } 800017ed: eb b9 jmp 800017a8 <strtol+0x7f> if (endptr) 800017ef: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 800017f3: 74 0d je 80001802 <strtol+0xd9> *endptr = (char *) s; 800017f5: 8b 75 0c mov 0xc(%ebp),%esi 800017f8: 89 0e mov %ecx,(%esi) 800017fa: eb 06 jmp 80001802 <strtol+0xd9> s++, neg = 1; // hex or octal base prefix if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) s += 2, base = 16; else if (base == 0 && s[0] == '0') 800017fc: 85 db test %ebx,%ebx 800017fe: 74 98 je 80001798 <strtol+0x6f> 80001800: eb 9e jmp 800017a0 <strtol+0x77> // we don't properly detect overflow! } if (endptr) *endptr = (char *) s; return (neg ? -val : val); 80001802: 89 c2 mov %eax,%edx 80001804: f7 da neg %edx 80001806: 85 ff test %edi,%edi 80001808: 0f 45 c2 cmovne %edx,%eax } 8000180b: 5b pop %ebx 8000180c: 5e pop %esi 8000180d: 5f pop %edi 8000180e: 5d pop %ebp 8000180f: c3 ret 80001810 <libmain>: const volatile struct Env *thisenv; const char *binaryname = "<unknown>"; void libmain(int argc, char **argv) { 80001810: 55 push %ebp 80001811: 89 e5 mov %esp,%ebp 80001813: 56 push %esi 80001814: 53 push %ebx 80001815: 8b 5d 08 mov 0x8(%ebp),%ebx 80001818: 8b 75 0c mov 0xc(%ebp),%esi // set thisenv to point at our Env structure in envs[]. thisenv = &envs[ENVX(sys_getenvid())]; 8000181b: e8 b4 00 00 00 call 800018d4 <sys_getenvid> 80001820: 25 ff 03 00 00 and $0x3ff,%eax 80001825: 6b c0 7c imul $0x7c,%eax,%eax 80001828: 05 00 00 c0 ee add $0xeec00000,%eax 8000182d: a3 c0 58 00 80 mov %eax,0x800058c0 // save the name of the program so that panic() can use it if (argc > 0) 80001832: 85 db test %ebx,%ebx 80001834: 7e 07 jle 8000183d <libmain+0x2d> binaryname = argv[0]; 80001836: 8b 06 mov (%esi),%eax 80001838: a3 00 40 00 80 mov %eax,0x80004000 // call user main routine umain(argc, argv); 8000183d: 83 ec 08 sub $0x8,%esp 80001840: 56 push %esi 80001841: 53 push %ebx 80001842: e8 ec fa ff ff call 80001333 <umain> // exit gracefully exit(); 80001847: e8 58 0f 00 00 call 800027a4 <exit> } 8000184c: 83 c4 10 add $0x10,%esp 8000184f: 8d 65 f8 lea -0x8(%ebp),%esp 80001852: 5b pop %ebx 80001853: 5e pop %esi 80001854: 5d pop %ebp 80001855: c3 ret 80001856 <sys_cputs>: return ret; } void sys_cputs(const char *s, size_t len) { 80001856: 55 push %ebp 80001857: 89 e5 mov %esp,%ebp 80001859: 57 push %edi 8000185a: 56 push %esi 8000185b: 53 push %ebx // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 8000185c: b8 00 00 00 00 mov $0x0,%eax 80001861: 8b 4d 0c mov 0xc(%ebp),%ecx 80001864: 8b 55 08 mov 0x8(%ebp),%edx 80001867: 89 c3 mov %eax,%ebx 80001869: 89 c7 mov %eax,%edi 8000186b: 89 c6 mov %eax,%esi 8000186d: cd 30 int $0x30 void sys_cputs(const char *s, size_t len) { syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0); } 8000186f: 5b pop %ebx 80001870: 5e pop %esi 80001871: 5f pop %edi 80001872: 5d pop %ebp 80001873: c3 ret 80001874 <sys_cgetc>: int sys_cgetc(void) { 80001874: 55 push %ebp 80001875: 89 e5 mov %esp,%ebp 80001877: 57 push %edi 80001878: 56 push %esi 80001879: 53 push %ebx // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 8000187a: ba 00 00 00 00 mov $0x0,%edx 8000187f: b8 01 00 00 00 mov $0x1,%eax 80001884: 89 d1 mov %edx,%ecx 80001886: 89 d3 mov %edx,%ebx 80001888: 89 d7 mov %edx,%edi 8000188a: 89 d6 mov %edx,%esi 8000188c: cd 30 int $0x30 int sys_cgetc(void) { return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0); } 8000188e: 5b pop %ebx 8000188f: 5e pop %esi 80001890: 5f pop %edi 80001891: 5d pop %ebp 80001892: c3 ret 80001893 <sys_env_destroy>: int sys_env_destroy(envid_t envid) { 80001893: 55 push %ebp 80001894: 89 e5 mov %esp,%ebp 80001896: 57 push %edi 80001897: 56 push %esi 80001898: 53 push %ebx 80001899: 83 ec 0c sub $0xc,%esp // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 8000189c: b9 00 00 00 00 mov $0x0,%ecx 800018a1: b8 03 00 00 00 mov $0x3,%eax 800018a6: 8b 55 08 mov 0x8(%ebp),%edx 800018a9: 89 cb mov %ecx,%ebx 800018ab: 89 cf mov %ecx,%edi 800018ad: 89 ce mov %ecx,%esi 800018af: cd 30 int $0x30 "b" (a3), "D" (a4), "S" (a5) : "cc", "memory"); if(check && ret > 0) 800018b1: 85 c0 test %eax,%eax 800018b3: 7e 17 jle 800018cc <sys_env_destroy+0x39> panic("syscall %d returned %d (> 0)", num, ret); 800018b5: 83 ec 0c sub $0xc,%esp 800018b8: 50 push %eax 800018b9: 6a 03 push $0x3 800018bb: 68 b5 33 00 80 push $0x800033b5 800018c0: 6a 21 push $0x21 800018c2: 68 d2 33 00 80 push $0x800033d2 800018c7: e8 73 18 00 00 call 8000313f <_panic> int sys_env_destroy(envid_t envid) { return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0); } 800018cc: 8d 65 f4 lea -0xc(%ebp),%esp 800018cf: 5b pop %ebx 800018d0: 5e pop %esi 800018d1: 5f pop %edi 800018d2: 5d pop %ebp 800018d3: c3 ret 800018d4 <sys_getenvid>: envid_t sys_getenvid(void) { 800018d4: 55 push %ebp 800018d5: 89 e5 mov %esp,%ebp 800018d7: 57 push %edi 800018d8: 56 push %esi 800018d9: 53 push %ebx // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 800018da: ba 00 00 00 00 mov $0x0,%edx 800018df: b8 02 00 00 00 mov $0x2,%eax 800018e4: 89 d1 mov %edx,%ecx 800018e6: 89 d3 mov %edx,%ebx 800018e8: 89 d7 mov %edx,%edi 800018ea: 89 d6 mov %edx,%esi 800018ec: cd 30 int $0x30 envid_t sys_getenvid(void) { return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0); } 800018ee: 5b pop %ebx 800018ef: 5e pop %esi 800018f0: 5f pop %edi 800018f1: 5d pop %ebp 800018f2: c3 ret 800018f3 <sys_yield>: void sys_yield(void) { 800018f3: 55 push %ebp 800018f4: 89 e5 mov %esp,%ebp 800018f6: 57 push %edi 800018f7: 56 push %esi 800018f8: 53 push %ebx // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 800018f9: ba 00 00 00 00 mov $0x0,%edx 800018fe: b8 0b 00 00 00 mov $0xb,%eax 80001903: 89 d1 mov %edx,%ecx 80001905: 89 d3 mov %edx,%ebx 80001907: 89 d7 mov %edx,%edi 80001909: 89 d6 mov %edx,%esi 8000190b: cd 30 int $0x30 void sys_yield(void) { syscall(SYS_yield, 0, 0, 0, 0, 0, 0); } 8000190d: 5b pop %ebx 8000190e: 5e pop %esi 8000190f: 5f pop %edi 80001910: 5d pop %ebp 80001911: c3 ret 80001912 <sys_page_alloc>: int sys_page_alloc(envid_t envid, void *va, int perm) { 80001912: 55 push %ebp 80001913: 89 e5 mov %esp,%ebp 80001915: 57 push %edi 80001916: 56 push %esi 80001917: 53 push %ebx 80001918: 83 ec 0c sub $0xc,%esp // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 8000191b: be 00 00 00 00 mov $0x0,%esi 80001920: b8 04 00 00 00 mov $0x4,%eax 80001925: 8b 4d 0c mov 0xc(%ebp),%ecx 80001928: 8b 55 08 mov 0x8(%ebp),%edx 8000192b: 8b 5d 10 mov 0x10(%ebp),%ebx 8000192e: 89 f7 mov %esi,%edi 80001930: cd 30 int $0x30 "b" (a3), "D" (a4), "S" (a5) : "cc", "memory"); if(check && ret > 0) 80001932: 85 c0 test %eax,%eax 80001934: 7e 17 jle 8000194d <sys_page_alloc+0x3b> panic("syscall %d returned %d (> 0)", num, ret); 80001936: 83 ec 0c sub $0xc,%esp 80001939: 50 push %eax 8000193a: 6a 04 push $0x4 8000193c: 68 b5 33 00 80 push $0x800033b5 80001941: 6a 21 push $0x21 80001943: 68 d2 33 00 80 push $0x800033d2 80001948: e8 f2 17 00 00 call 8000313f <_panic> int sys_page_alloc(envid_t envid, void *va, int perm) { return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0); } 8000194d: 8d 65 f4 lea -0xc(%ebp),%esp 80001950: 5b pop %ebx 80001951: 5e pop %esi 80001952: 5f pop %edi 80001953: 5d pop %ebp 80001954: c3 ret 80001955 <sys_page_map>: int sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm) { 80001955: 55 push %ebp 80001956: 89 e5 mov %esp,%ebp 80001958: 57 push %edi 80001959: 56 push %esi 8000195a: 53 push %ebx 8000195b: 83 ec 0c sub $0xc,%esp // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 8000195e: b8 05 00 00 00 mov $0x5,%eax 80001963: 8b 4d 0c mov 0xc(%ebp),%ecx 80001966: 8b 55 08 mov 0x8(%ebp),%edx 80001969: 8b 5d 10 mov 0x10(%ebp),%ebx 8000196c: 8b 7d 14 mov 0x14(%ebp),%edi 8000196f: 8b 75 18 mov 0x18(%ebp),%esi 80001972: cd 30 int $0x30 "b" (a3), "D" (a4), "S" (a5) : "cc", "memory"); if(check && ret > 0) 80001974: 85 c0 test %eax,%eax 80001976: 7e 17 jle 8000198f <sys_page_map+0x3a> panic("syscall %d returned %d (> 0)", num, ret); 80001978: 83 ec 0c sub $0xc,%esp 8000197b: 50 push %eax 8000197c: 6a 05 push $0x5 8000197e: 68 b5 33 00 80 push $0x800033b5 80001983: 6a 21 push $0x21 80001985: 68 d2 33 00 80 push $0x800033d2 8000198a: e8 b0 17 00 00 call 8000313f <_panic> int sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm) { return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm); } 8000198f: 8d 65 f4 lea -0xc(%ebp),%esp 80001992: 5b pop %ebx 80001993: 5e pop %esi 80001994: 5f pop %edi 80001995: 5d pop %ebp 80001996: c3 ret 80001997 <sys_page_unmap>: int sys_page_unmap(envid_t envid, void *va) { 80001997: 55 push %ebp 80001998: 89 e5 mov %esp,%ebp 8000199a: 57 push %edi 8000199b: 56 push %esi 8000199c: 53 push %ebx 8000199d: 83 ec 0c sub $0xc,%esp // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 800019a0: bb 00 00 00 00 mov $0x0,%ebx 800019a5: b8 06 00 00 00 mov $0x6,%eax 800019aa: 8b 4d 0c mov 0xc(%ebp),%ecx 800019ad: 8b 55 08 mov 0x8(%ebp),%edx 800019b0: 89 df mov %ebx,%edi 800019b2: 89 de mov %ebx,%esi 800019b4: cd 30 int $0x30 "b" (a3), "D" (a4), "S" (a5) : "cc", "memory"); if(check && ret > 0) 800019b6: 85 c0 test %eax,%eax 800019b8: 7e 17 jle 800019d1 <sys_page_unmap+0x3a> panic("syscall %d returned %d (> 0)", num, ret); 800019ba: 83 ec 0c sub $0xc,%esp 800019bd: 50 push %eax 800019be: 6a 06 push $0x6 800019c0: 68 b5 33 00 80 push $0x800033b5 800019c5: 6a 21 push $0x21 800019c7: 68 d2 33 00 80 push $0x800033d2 800019cc: e8 6e 17 00 00 call 8000313f <_panic> int sys_page_unmap(envid_t envid, void *va) { return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0); } 800019d1: 8d 65 f4 lea -0xc(%ebp),%esp 800019d4: 5b pop %ebx 800019d5: 5e pop %esi 800019d6: 5f pop %edi 800019d7: 5d pop %ebp 800019d8: c3 ret 800019d9 <sys_env_set_status>: // sys_exofork is inlined in lib.h int sys_env_set_status(envid_t envid, int status) { 800019d9: 55 push %ebp 800019da: 89 e5 mov %esp,%ebp 800019dc: 57 push %edi 800019dd: 56 push %esi 800019de: 53 push %ebx 800019df: 83 ec 0c sub $0xc,%esp // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 800019e2: bb 00 00 00 00 mov $0x0,%ebx 800019e7: b8 08 00 00 00 mov $0x8,%eax 800019ec: 8b 4d 0c mov 0xc(%ebp),%ecx 800019ef: 8b 55 08 mov 0x8(%ebp),%edx 800019f2: 89 df mov %ebx,%edi 800019f4: 89 de mov %ebx,%esi 800019f6: cd 30 int $0x30 "b" (a3), "D" (a4), "S" (a5) : "cc", "memory"); if(check && ret > 0) 800019f8: 85 c0 test %eax,%eax 800019fa: 7e 17 jle 80001a13 <sys_env_set_status+0x3a> panic("syscall %d returned %d (> 0)", num, ret); 800019fc: 83 ec 0c sub $0xc,%esp 800019ff: 50 push %eax 80001a00: 6a 08 push $0x8 80001a02: 68 b5 33 00 80 push $0x800033b5 80001a07: 6a 21 push $0x21 80001a09: 68 d2 33 00 80 push $0x800033d2 80001a0e: e8 2c 17 00 00 call 8000313f <_panic> int sys_env_set_status(envid_t envid, int status) { return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0); } 80001a13: 8d 65 f4 lea -0xc(%ebp),%esp 80001a16: 5b pop %ebx 80001a17: 5e pop %esi 80001a18: 5f pop %edi 80001a19: 5d pop %ebp 80001a1a: c3 ret 80001a1b <sys_env_set_trapframe>: int sys_env_set_trapframe(envid_t envid, struct Trapframe *tf) { 80001a1b: 55 push %ebp 80001a1c: 89 e5 mov %esp,%ebp 80001a1e: 57 push %edi 80001a1f: 56 push %esi 80001a20: 53 push %ebx 80001a21: 83 ec 0c sub $0xc,%esp // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 80001a24: bb 00 00 00 00 mov $0x0,%ebx 80001a29: b8 09 00 00 00 mov $0x9,%eax 80001a2e: 8b 4d 0c mov 0xc(%ebp),%ecx 80001a31: 8b 55 08 mov 0x8(%ebp),%edx 80001a34: 89 df mov %ebx,%edi 80001a36: 89 de mov %ebx,%esi 80001a38: cd 30 int $0x30 "b" (a3), "D" (a4), "S" (a5) : "cc", "memory"); if(check && ret > 0) 80001a3a: 85 c0 test %eax,%eax 80001a3c: 7e 17 jle 80001a55 <sys_env_set_trapframe+0x3a> panic("syscall %d returned %d (> 0)", num, ret); 80001a3e: 83 ec 0c sub $0xc,%esp 80001a41: 50 push %eax 80001a42: 6a 09 push $0x9 80001a44: 68 b5 33 00 80 push $0x800033b5 80001a49: 6a 21 push $0x21 80001a4b: 68 d2 33 00 80 push $0x800033d2 80001a50: e8 ea 16 00 00 call 8000313f <_panic> int sys_env_set_trapframe(envid_t envid, struct Trapframe *tf) { return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0); } 80001a55: 8d 65 f4 lea -0xc(%ebp),%esp 80001a58: 5b pop %ebx 80001a59: 5e pop %esi 80001a5a: 5f pop %edi 80001a5b: 5d pop %ebp 80001a5c: c3 ret 80001a5d <sys_env_set_pgfault_upcall>: int sys_env_set_pgfault_upcall(envid_t envid, void *upcall) { 80001a5d: 55 push %ebp 80001a5e: 89 e5 mov %esp,%ebp 80001a60: 57 push %edi 80001a61: 56 push %esi 80001a62: 53 push %ebx 80001a63: 83 ec 0c sub $0xc,%esp // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 80001a66: bb 00 00 00 00 mov $0x0,%ebx 80001a6b: b8 0a 00 00 00 mov $0xa,%eax 80001a70: 8b 4d 0c mov 0xc(%ebp),%ecx 80001a73: 8b 55 08 mov 0x8(%ebp),%edx 80001a76: 89 df mov %ebx,%edi 80001a78: 89 de mov %ebx,%esi 80001a7a: cd 30 int $0x30 "b" (a3), "D" (a4), "S" (a5) : "cc", "memory"); if(check && ret > 0) 80001a7c: 85 c0 test %eax,%eax 80001a7e: 7e 17 jle 80001a97 <sys_env_set_pgfault_upcall+0x3a> panic("syscall %d returned %d (> 0)", num, ret); 80001a80: 83 ec 0c sub $0xc,%esp 80001a83: 50 push %eax 80001a84: 6a 0a push $0xa 80001a86: 68 b5 33 00 80 push $0x800033b5 80001a8b: 6a 21 push $0x21 80001a8d: 68 d2 33 00 80 push $0x800033d2 80001a92: e8 a8 16 00 00 call 8000313f <_panic> int sys_env_set_pgfault_upcall(envid_t envid, void *upcall) { return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0); } 80001a97: 8d 65 f4 lea -0xc(%ebp),%esp 80001a9a: 5b pop %ebx 80001a9b: 5e pop %esi 80001a9c: 5f pop %edi 80001a9d: 5d pop %ebp 80001a9e: c3 ret 80001a9f <sys_ipc_try_send>: int sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm) { 80001a9f: 55 push %ebp 80001aa0: 89 e5 mov %esp,%ebp 80001aa2: 57 push %edi 80001aa3: 56 push %esi 80001aa4: 53 push %ebx // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 80001aa5: be 00 00 00 00 mov $0x0,%esi 80001aaa: b8 0c 00 00 00 mov $0xc,%eax 80001aaf: 8b 4d 0c mov 0xc(%ebp),%ecx 80001ab2: 8b 55 08 mov 0x8(%ebp),%edx 80001ab5: 8b 5d 10 mov 0x10(%ebp),%ebx 80001ab8: 8b 7d 14 mov 0x14(%ebp),%edi 80001abb: cd 30 int $0x30 int sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm) { return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0); } 80001abd: 5b pop %ebx 80001abe: 5e pop %esi 80001abf: 5f pop %edi 80001ac0: 5d pop %ebp 80001ac1: c3 ret 80001ac2 <sys_ipc_recv>: int sys_ipc_recv(void *dstva) { 80001ac2: 55 push %ebp 80001ac3: 89 e5 mov %esp,%ebp 80001ac5: 57 push %edi 80001ac6: 56 push %esi 80001ac7: 53 push %ebx 80001ac8: 83 ec 0c sub $0xc,%esp // // The last clause tells the assembler that this can // potentially change the condition codes and arbitrary // memory locations. asm volatile("int %1\n" 80001acb: b9 00 00 00 00 mov $0x0,%ecx 80001ad0: b8 0d 00 00 00 mov $0xd,%eax 80001ad5: 8b 55 08 mov 0x8(%ebp),%edx 80001ad8: 89 cb mov %ecx,%ebx 80001ada: 89 cf mov %ecx,%edi 80001adc: 89 ce mov %ecx,%esi 80001ade: cd 30 int $0x30 "b" (a3), "D" (a4), "S" (a5) : "cc", "memory"); if(check && ret > 0) 80001ae0: 85 c0 test %eax,%eax 80001ae2: 7e 17 jle 80001afb <sys_ipc_recv+0x39> panic("syscall %d returned %d (> 0)", num, ret); 80001ae4: 83 ec 0c sub $0xc,%esp 80001ae7: 50 push %eax 80001ae8: 6a 0d push $0xd 80001aea: 68 b5 33 00 80 push $0x800033b5 80001aef: 6a 21 push $0x21 80001af1: 68 d2 33 00 80 push $0x800033d2 80001af6: e8 44 16 00 00 call 8000313f <_panic> int sys_ipc_recv(void *dstva) { return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0); } 80001afb: 8d 65 f4 lea -0xc(%ebp),%esp 80001afe: 5b pop %ebx 80001aff: 5e pop %esi 80001b00: 5f pop %edi 80001b01: 5d pop %ebp 80001b02: c3 ret 80001b03 <fd2num>: // File descriptor manipulators // -------------------------------------------------------------- int fd2num(struct Fd *fd) { 80001b03: 55 push %ebp 80001b04: 89 e5 mov %esp,%ebp return ((uintptr_t) fd - FDTABLE) / PGSIZE; 80001b06: 8b 45 08 mov 0x8(%ebp),%eax 80001b09: 2d 00 00 00 20 sub $0x20000000,%eax 80001b0e: c1 e8 0c shr $0xc,%eax } 80001b11: 5d pop %ebp 80001b12: c3 ret 80001b13 <fd2data>: char* fd2data(struct Fd *fd) { 80001b13: 55 push %ebp 80001b14: 89 e5 mov %esp,%ebp return INDEX2DATA(fd2num(fd)); 80001b16: 8b 45 08 mov 0x8(%ebp),%eax 80001b19: 2d 00 00 00 20 sub $0x20000000,%eax 80001b1e: 25 00 f0 ff ff and $0xfffff000,%eax 80001b23: 8d 80 00 00 02 20 lea 0x20020000(%eax),%eax } 80001b29: 5d pop %ebp 80001b2a: c3 ret 80001b2b <fd_alloc>: // Returns 0 on success, < 0 on error. Errors are: // -E_MAX_FD: no more file descriptors // On error, *fd_store is set to 0. int fd_alloc(struct Fd **fd_store) { 80001b2b: 55 push %ebp 80001b2c: 89 e5 mov %esp,%ebp int i; struct Fd *fd; for (i = 0; i < MAXFD; i++) { fd = INDEX2FD(i); if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) { 80001b2e: a1 00 d2 7b ef mov 0xef7bd200,%eax 80001b33: a8 01 test $0x1,%al 80001b35: 74 34 je 80001b6b <fd_alloc+0x40> 80001b37: a1 00 00 48 ef mov 0xef480000,%eax 80001b3c: a8 01 test $0x1,%al 80001b3e: 74 32 je 80001b72 <fd_alloc+0x47> 80001b40: b8 00 10 00 20 mov $0x20001000,%eax { int i; struct Fd *fd; for (i = 0; i < MAXFD; i++) { fd = INDEX2FD(i); 80001b45: 89 c1 mov %eax,%ecx if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) { 80001b47: 89 c2 mov %eax,%edx 80001b49: c1 ea 16 shr $0x16,%edx 80001b4c: 8b 14 95 00 d0 7b ef mov -0x10843000(,%edx,4),%edx 80001b53: f6 c2 01 test $0x1,%dl 80001b56: 74 1f je 80001b77 <fd_alloc+0x4c> 80001b58: 89 c2 mov %eax,%edx 80001b5a: c1 ea 0c shr $0xc,%edx 80001b5d: 8b 14 95 00 00 40 ef mov -0x10c00000(,%edx,4),%edx 80001b64: f6 c2 01 test $0x1,%dl 80001b67: 75 1a jne 80001b83 <fd_alloc+0x58> 80001b69: eb 0c jmp 80001b77 <fd_alloc+0x4c> { int i; struct Fd *fd; for (i = 0; i < MAXFD; i++) { fd = INDEX2FD(i); 80001b6b: b9 00 00 00 20 mov $0x20000000,%ecx 80001b70: eb 05 jmp 80001b77 <fd_alloc+0x4c> 80001b72: b9 00 00 00 20 mov $0x20000000,%ecx if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) { *fd_store = fd; 80001b77: 8b 45 08 mov 0x8(%ebp),%eax 80001b7a: 89 08 mov %ecx,(%eax) return 0; 80001b7c: b8 00 00 00 00 mov $0x0,%eax 80001b81: eb 1a jmp 80001b9d <fd_alloc+0x72> 80001b83: 05 00 10 00 00 add $0x1000,%eax fd_alloc(struct Fd **fd_store) { int i; struct Fd *fd; for (i = 0; i < MAXFD; i++) { 80001b88: 3d 00 00 02 20 cmp $0x20020000,%eax 80001b8d: 75 b6 jne 80001b45 <fd_alloc+0x1a> if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) { *fd_store = fd; return 0; } } *fd_store = 0; 80001b8f: 8b 45 08 mov 0x8(%ebp),%eax 80001b92: c7 00 00 00 00 00 movl $0x0,(%eax) return -E_MAX_OPEN; 80001b98: b8 f5 ff ff ff mov $0xfffffff5,%eax } 80001b9d: 5d pop %ebp 80001b9e: c3 ret 80001b9f <fd_lookup>: // Returns 0 on success (the page is in range and mapped), < 0 on error. // Errors are: // -E_INVAL: fdnum was either not in range or not mapped. int fd_lookup(int fdnum, struct Fd **fd_store) { 80001b9f: 55 push %ebp 80001ba0: 89 e5 mov %esp,%ebp 80001ba2: 8b 45 08 mov 0x8(%ebp),%eax struct Fd *fd; if (fdnum < 0 || fdnum >= MAXFD) { 80001ba5: 83 f8 1f cmp $0x1f,%eax 80001ba8: 77 36 ja 80001be0 <fd_lookup+0x41> if (debug) cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum); return -E_INVAL; } fd = INDEX2FD(fdnum); 80001baa: 05 00 00 02 00 add $0x20000,%eax 80001baf: c1 e0 0c shl $0xc,%eax if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) { 80001bb2: 89 c2 mov %eax,%edx 80001bb4: c1 ea 16 shr $0x16,%edx 80001bb7: 8b 14 95 00 d0 7b ef mov -0x10843000(,%edx,4),%edx 80001bbe: f6 c2 01 test $0x1,%dl 80001bc1: 74 24 je 80001be7 <fd_lookup+0x48> 80001bc3: 89 c2 mov %eax,%edx 80001bc5: c1 ea 0c shr $0xc,%edx 80001bc8: 8b 14 95 00 00 40 ef mov -0x10c00000(,%edx,4),%edx 80001bcf: f6 c2 01 test $0x1,%dl 80001bd2: 74 1a je 80001bee <fd_lookup+0x4f> if (debug) cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum); return -E_INVAL; } *fd_store = fd; 80001bd4: 8b 55 0c mov 0xc(%ebp),%edx 80001bd7: 89 02 mov %eax,(%edx) return 0; 80001bd9: b8 00 00 00 00 mov $0x0,%eax 80001bde: eb 13 jmp 80001bf3 <fd_lookup+0x54> struct Fd *fd; if (fdnum < 0 || fdnum >= MAXFD) { if (debug) cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum); return -E_INVAL; 80001be0: b8 fd ff ff ff mov $0xfffffffd,%eax 80001be5: eb 0c jmp 80001bf3 <fd_lookup+0x54> } fd = INDEX2FD(fdnum); if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) { if (debug) cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum); return -E_INVAL; 80001be7: b8 fd ff ff ff mov $0xfffffffd,%eax 80001bec: eb 05 jmp 80001bf3 <fd_lookup+0x54> 80001bee: b8 fd ff ff ff mov $0xfffffffd,%eax } *fd_store = fd; return 0; } 80001bf3: 5d pop %ebp 80001bf4: c3 ret 80001bf5 <dev_lookup>: 0 }; int dev_lookup(int dev_id, struct Dev **dev) { 80001bf5: 55 push %ebp 80001bf6: 89 e5 mov %esp,%ebp 80001bf8: 53 push %ebx 80001bf9: 83 ec 04 sub $0x4,%esp 80001bfc: 8b 45 08 mov 0x8(%ebp),%eax 80001bff: 8b 5d 0c mov 0xc(%ebp),%ebx int i; for (i = 0; devtab[i]; i++) if (devtab[i]->dev_id == dev_id) { 80001c02: 3b 05 04 40 00 80 cmp 0x80004004,%eax 80001c08: 75 1e jne 80001c28 <dev_lookup+0x33> 80001c0a: eb 0e jmp 80001c1a <dev_lookup+0x25> int dev_lookup(int dev_id, struct Dev **dev) { int i; for (i = 0; devtab[i]; i++) 80001c0c: b8 20 40 00 80 mov $0x80004020,%eax 80001c11: eb 0c jmp 80001c1f <dev_lookup+0x2a> 80001c13: b8 3c 40 00 80 mov $0x8000403c,%eax 80001c18: eb 05 jmp 80001c1f <dev_lookup+0x2a> 80001c1a: b8 04 40 00 80 mov $0x80004004,%eax if (devtab[i]->dev_id == dev_id) { *dev = devtab[i]; 80001c1f: 89 03 mov %eax,(%ebx) return 0; 80001c21: b8 00 00 00 00 mov $0x0,%eax 80001c26: eb 36 jmp 80001c5e <dev_lookup+0x69> int dev_lookup(int dev_id, struct Dev **dev) { int i; for (i = 0; devtab[i]; i++) if (devtab[i]->dev_id == dev_id) { 80001c28: 3b 05 20 40 00 80 cmp 0x80004020,%eax 80001c2e: 74 dc je 80001c0c <dev_lookup+0x17> 80001c30: 3b 05 3c 40 00 80 cmp 0x8000403c,%eax 80001c36: 74 db je 80001c13 <dev_lookup+0x1e> *dev = devtab[i]; return 0; } cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id); 80001c38: 8b 15 c0 58 00 80 mov 0x800058c0,%edx 80001c3e: 8b 52 48 mov 0x48(%edx),%edx 80001c41: 83 ec 04 sub $0x4,%esp 80001c44: 50 push %eax 80001c45: 52 push %edx 80001c46: 68 dc 33 00 80 push $0x800033dc 80001c4b: e8 c7 12 00 00 call 80002f17 <cprintf> *dev = 0; 80001c50: c7 03 00 00 00 00 movl $0x0,(%ebx) return -E_INVAL; 80001c56: 83 c4 10 add $0x10,%esp 80001c59: b8 fd ff ff ff mov $0xfffffffd,%eax } 80001c5e: 8b 5d fc mov -0x4(%ebp),%ebx 80001c61: c9 leave 80001c62: c3 ret 80001c63 <fd_close>: // If 'must_exist' is 1, then fd_close returns -E_INVAL when passed a // closed or nonexistent file descriptor. // Returns 0 on success, < 0 on error. int fd_close(struct Fd *fd, bool must_exist) { 80001c63: 55 push %ebp 80001c64: 89 e5 mov %esp,%ebp 80001c66: 56 push %esi 80001c67: 53 push %ebx 80001c68: 83 ec 10 sub $0x10,%esp 80001c6b: 8b 75 08 mov 0x8(%ebp),%esi 80001c6e: 8b 5d 0c mov 0xc(%ebp),%ebx struct Fd *fd2; struct Dev *dev; int r; if ((r = fd_lookup(fd2num(fd), &fd2)) < 0 80001c71: 8d 45 f4 lea -0xc(%ebp),%eax 80001c74: 50 push %eax 80001c75: 8d 86 00 00 00 e0 lea -0x20000000(%esi),%eax 80001c7b: c1 e8 0c shr $0xc,%eax 80001c7e: 50 push %eax 80001c7f: e8 1b ff ff ff call 80001b9f <fd_lookup> 80001c84: 83 c4 08 add $0x8,%esp 80001c87: 85 c0 test %eax,%eax 80001c89: 78 05 js 80001c90 <fd_close+0x2d> || fd != fd2) 80001c8b: 3b 75 f4 cmp -0xc(%ebp),%esi 80001c8e: 74 0c je 80001c9c <fd_close+0x39> return (must_exist ? r : 0); 80001c90: 84 db test %bl,%bl 80001c92: ba 00 00 00 00 mov $0x0,%edx 80001c97: 0f 44 c2 cmove %edx,%eax 80001c9a: eb 41 jmp 80001cdd <fd_close+0x7a> if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) { 80001c9c: 83 ec 08 sub $0x8,%esp 80001c9f: 8d 45 f0 lea -0x10(%ebp),%eax 80001ca2: 50 push %eax 80001ca3: ff 36 pushl (%esi) 80001ca5: e8 4b ff ff ff call 80001bf5 <dev_lookup> 80001caa: 89 c3 mov %eax,%ebx 80001cac: 83 c4 10 add $0x10,%esp 80001caf: 85 c0 test %eax,%eax 80001cb1: 78 1a js 80001ccd <fd_close+0x6a> if (dev->dev_close) 80001cb3: 8b 45 f0 mov -0x10(%ebp),%eax 80001cb6: 8b 40 10 mov 0x10(%eax),%eax r = (*dev->dev_close)(fd); else r = 0; 80001cb9: bb 00 00 00 00 mov $0x0,%ebx int r; if ((r = fd_lookup(fd2num(fd), &fd2)) < 0 || fd != fd2) return (must_exist ? r : 0); if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) { if (dev->dev_close) 80001cbe: 85 c0 test %eax,%eax 80001cc0: 74 0b je 80001ccd <fd_close+0x6a> r = (*dev->dev_close)(fd); 80001cc2: 83 ec 0c sub $0xc,%esp 80001cc5: 56 push %esi 80001cc6: ff d0 call *%eax 80001cc8: 89 c3 mov %eax,%ebx 80001cca: 83 c4 10 add $0x10,%esp else r = 0; } // Make sure fd is unmapped. Might be a no-op if // (*dev->dev_close)(fd) already unmapped it. (void) sys_page_unmap(0, fd); 80001ccd: 83 ec 08 sub $0x8,%esp 80001cd0: 56 push %esi 80001cd1: 6a 00 push $0x0 80001cd3: e8 bf fc ff ff call 80001997 <sys_page_unmap> return r; 80001cd8: 83 c4 10 add $0x10,%esp 80001cdb: 89 d8 mov %ebx,%eax } 80001cdd: 8d 65 f8 lea -0x8(%ebp),%esp 80001ce0: 5b pop %ebx 80001ce1: 5e pop %esi 80001ce2: 5d pop %ebp 80001ce3: c3 ret 80001ce4 <close>: return -E_INVAL; } int close(int fdnum) { 80001ce4: 55 push %ebp 80001ce5: 89 e5 mov %esp,%ebp 80001ce7: 83 ec 18 sub $0x18,%esp struct Fd *fd; int r; if ((r = fd_lookup(fdnum, &fd)) < 0) 80001cea: 8d 45 f4 lea -0xc(%ebp),%eax 80001ced: 50 push %eax 80001cee: ff 75 08 pushl 0x8(%ebp) 80001cf1: e8 a9 fe ff ff call 80001b9f <fd_lookup> 80001cf6: 83 c4 08 add $0x8,%esp 80001cf9: 85 c0 test %eax,%eax 80001cfb: 78 10 js 80001d0d <close+0x29> return r; else return fd_close(fd, 1); 80001cfd: 83 ec 08 sub $0x8,%esp 80001d00: 6a 01 push $0x1 80001d02: ff 75 f4 pushl -0xc(%ebp) 80001d05: e8 59 ff ff ff call 80001c63 <fd_close> 80001d0a: 83 c4 10 add $0x10,%esp } 80001d0d: c9 leave 80001d0e: c3 ret 80001d0f <close_all>: void close_all(void) { 80001d0f: 55 push %ebp 80001d10: 89 e5 mov %esp,%ebp 80001d12: 53 push %ebx 80001d13: 83 ec 04 sub $0x4,%esp int i; for (i = 0; i < MAXFD; i++) 80001d16: bb 00 00 00 00 mov $0x0,%ebx close(i); 80001d1b: 83 ec 0c sub $0xc,%esp 80001d1e: 53 push %ebx 80001d1f: e8 c0 ff ff ff call 80001ce4 <close> void close_all(void) { int i; for (i = 0; i < MAXFD; i++) 80001d24: 83 c3 01 add $0x1,%ebx 80001d27: 83 c4 10 add $0x10,%esp 80001d2a: 83 fb 20 cmp $0x20,%ebx 80001d2d: 75 ec jne 80001d1b <close_all+0xc> close(i); } 80001d2f: 8b 5d fc mov -0x4(%ebp),%ebx 80001d32: c9 leave 80001d33: c3 ret 80001d34 <dup>: // file and the file offset of the other. // Closes any previously open file descriptor at 'newfdnum'. // This is implemented using virtual memory tricks (of course!). int dup(int oldfdnum, int newfdnum) { 80001d34: 55 push %ebp 80001d35: 89 e5 mov %esp,%ebp 80001d37: 57 push %edi 80001d38: 56 push %esi 80001d39: 53 push %ebx 80001d3a: 83 ec 2c sub $0x2c,%esp 80001d3d: 8b 75 0c mov 0xc(%ebp),%esi int r; char *ova, *nva; struct Fd *oldfd, *newfd; if ((r = fd_lookup(oldfdnum, &oldfd)) < 0) 80001d40: 8d 45 e4 lea -0x1c(%ebp),%eax 80001d43: 50 push %eax 80001d44: ff 75 08 pushl 0x8(%ebp) 80001d47: e8 53 fe ff ff call 80001b9f <fd_lookup> 80001d4c: 83 c4 08 add $0x8,%esp 80001d4f: 85 c0 test %eax,%eax 80001d51: 0f 88 bf 00 00 00 js 80001e16 <dup+0xe2> return r; close(newfdnum); 80001d57: 83 ec 0c sub $0xc,%esp 80001d5a: 56 push %esi 80001d5b: e8 84 ff ff ff call 80001ce4 <close> newfd = INDEX2FD(newfdnum); 80001d60: 8d 9e 00 00 02 00 lea 0x20000(%esi),%ebx 80001d66: c1 e3 0c shl $0xc,%ebx ova = fd2data(oldfd); 80001d69: 83 c4 04 add $0x4,%esp 80001d6c: ff 75 e4 pushl -0x1c(%ebp) 80001d6f: e8 9f fd ff ff call 80001b13 <fd2data> 80001d74: 89 c7 mov %eax,%edi nva = fd2data(newfd); 80001d76: 89 1c 24 mov %ebx,(%esp) 80001d79: e8 95 fd ff ff call 80001b13 <fd2data> 80001d7e: 83 c4 10 add $0x10,%esp 80001d81: 89 45 d4 mov %eax,-0x2c(%ebp) if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P)) 80001d84: 89 f8 mov %edi,%eax 80001d86: c1 e8 16 shr $0x16,%eax 80001d89: 8b 04 85 00 d0 7b ef mov -0x10843000(,%eax,4),%eax 80001d90: a8 01 test $0x1,%al 80001d92: 74 37 je 80001dcb <dup+0x97> 80001d94: 89 f8 mov %edi,%eax 80001d96: c1 e8 0c shr $0xc,%eax 80001d99: 8b 14 85 00 00 40 ef mov -0x10c00000(,%eax,4),%edx 80001da0: f6 c2 01 test $0x1,%dl 80001da3: 74 26 je 80001dcb <dup+0x97> if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0) 80001da5: 8b 04 85 00 00 40 ef mov -0x10c00000(,%eax,4),%eax 80001dac: 83 ec 0c sub $0xc,%esp 80001daf: 25 07 0e 00 00 and $0xe07,%eax 80001db4: 50 push %eax 80001db5: ff 75 d4 pushl -0x2c(%ebp) 80001db8: 6a 00 push $0x0 80001dba: 57 push %edi 80001dbb: 6a 00 push $0x0 80001dbd: e8 93 fb ff ff call 80001955 <sys_page_map> 80001dc2: 89 c7 mov %eax,%edi 80001dc4: 83 c4 20 add $0x20,%esp 80001dc7: 85 c0 test %eax,%eax 80001dc9: 78 2e js 80001df9 <dup+0xc5> goto err; if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0) 80001dcb: 8b 55 e4 mov -0x1c(%ebp),%edx 80001dce: 89 d0 mov %edx,%eax 80001dd0: c1 e8 0c shr $0xc,%eax 80001dd3: 8b 04 85 00 00 40 ef mov -0x10c00000(,%eax,4),%eax 80001dda: 83 ec 0c sub $0xc,%esp 80001ddd: 25 07 0e 00 00 and $0xe07,%eax 80001de2: 50 push %eax 80001de3: 53 push %ebx 80001de4: 6a 00 push $0x0 80001de6: 52 push %edx 80001de7: 6a 00 push $0x0 80001de9: e8 67 fb ff ff call 80001955 <sys_page_map> 80001dee: 89 c7 mov %eax,%edi 80001df0: 83 c4 20 add $0x20,%esp goto err; return newfdnum; 80001df3: 89 f0 mov %esi,%eax nva = fd2data(newfd); if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P)) if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0) goto err; if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0) 80001df5: 85 ff test %edi,%edi 80001df7: 79 1d jns 80001e16 <dup+0xe2> goto err; return newfdnum; err: sys_page_unmap(0, newfd); 80001df9: 83 ec 08 sub $0x8,%esp 80001dfc: 53 push %ebx 80001dfd: 6a 00 push $0x0 80001dff: e8 93 fb ff ff call 80001997 <sys_page_unmap> sys_page_unmap(0, nva); 80001e04: 83 c4 08 add $0x8,%esp 80001e07: ff 75 d4 pushl -0x2c(%ebp) 80001e0a: 6a 00 push $0x0 80001e0c: e8 86 fb ff ff call 80001997 <sys_page_unmap> return r; 80001e11: 83 c4 10 add $0x10,%esp 80001e14: 89 f8 mov %edi,%eax } 80001e16: 8d 65 f4 lea -0xc(%ebp),%esp 80001e19: 5b pop %ebx 80001e1a: 5e pop %esi 80001e1b: 5f pop %edi 80001e1c: 5d pop %ebp 80001e1d: c3 ret 80001e1e <read>: ssize_t read(int fdnum, void *buf, size_t n) { 80001e1e: 55 push %ebp 80001e1f: 89 e5 mov %esp,%ebp 80001e21: 53 push %ebx 80001e22: 83 ec 14 sub $0x14,%esp 80001e25: 8b 5d 08 mov 0x8(%ebp),%ebx int r; struct Dev *dev; struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0 80001e28: 8d 45 f0 lea -0x10(%ebp),%eax 80001e2b: 50 push %eax 80001e2c: 53 push %ebx 80001e2d: e8 6d fd ff ff call 80001b9f <fd_lookup> 80001e32: 83 c4 08 add $0x8,%esp 80001e35: 89 c2 mov %eax,%edx 80001e37: 85 c0 test %eax,%eax 80001e39: 78 6d js 80001ea8 <read+0x8a> || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0) 80001e3b: 83 ec 08 sub $0x8,%esp 80001e3e: 8d 45 f4 lea -0xc(%ebp),%eax 80001e41: 50 push %eax 80001e42: 8b 45 f0 mov -0x10(%ebp),%eax 80001e45: ff 30 pushl (%eax) 80001e47: e8 a9 fd ff ff call 80001bf5 <dev_lookup> 80001e4c: 83 c4 10 add $0x10,%esp 80001e4f: 85 c0 test %eax,%eax 80001e51: 78 4c js 80001e9f <read+0x81> return r; if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) { 80001e53: 8b 55 f0 mov -0x10(%ebp),%edx 80001e56: 8b 42 08 mov 0x8(%edx),%eax 80001e59: 83 e0 03 and $0x3,%eax 80001e5c: 83 f8 01 cmp $0x1,%eax 80001e5f: 75 21 jne 80001e82 <read+0x64> cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum); 80001e61: a1 c0 58 00 80 mov 0x800058c0,%eax 80001e66: 8b 40 48 mov 0x48(%eax),%eax 80001e69: 83 ec 04 sub $0x4,%esp 80001e6c: 53 push %ebx 80001e6d: 50 push %eax 80001e6e: 68 1d 34 00 80 push $0x8000341d 80001e73: e8 9f 10 00 00 call 80002f17 <cprintf> return -E_INVAL; 80001e78: 83 c4 10 add $0x10,%esp 80001e7b: ba fd ff ff ff mov $0xfffffffd,%edx 80001e80: eb 26 jmp 80001ea8 <read+0x8a> } if (!dev->dev_read) 80001e82: 8b 45 f4 mov -0xc(%ebp),%eax 80001e85: 8b 40 08 mov 0x8(%eax),%eax 80001e88: 85 c0 test %eax,%eax 80001e8a: 74 17 je 80001ea3 <read+0x85> return -E_NOT_SUPP; return (*dev->dev_read)(fd, buf, n); 80001e8c: 83 ec 04 sub $0x4,%esp 80001e8f: ff 75 10 pushl 0x10(%ebp) 80001e92: ff 75 0c pushl 0xc(%ebp) 80001e95: 52 push %edx 80001e96: ff d0 call *%eax 80001e98: 89 c2 mov %eax,%edx 80001e9a: 83 c4 10 add $0x10,%esp 80001e9d: eb 09 jmp 80001ea8 <read+0x8a> int r; struct Dev *dev; struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0 || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0) 80001e9f: 89 c2 mov %eax,%edx 80001ea1: eb 05 jmp 80001ea8 <read+0x8a> if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) { cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum); return -E_INVAL; } if (!dev->dev_read) return -E_NOT_SUPP; 80001ea3: ba ef ff ff ff mov $0xffffffef,%edx return (*dev->dev_read)(fd, buf, n); } 80001ea8: 89 d0 mov %edx,%eax 80001eaa: 8b 5d fc mov -0x4(%ebp),%ebx 80001ead: c9 leave 80001eae: c3 ret 80001eaf <readn>: ssize_t readn(int fdnum, void *buf, size_t n) { 80001eaf: 55 push %ebp 80001eb0: 89 e5 mov %esp,%ebp 80001eb2: 57 push %edi 80001eb3: 56 push %esi 80001eb4: 53 push %ebx 80001eb5: 83 ec 0c sub $0xc,%esp 80001eb8: 8b 7d 08 mov 0x8(%ebp),%edi 80001ebb: 8b 75 10 mov 0x10(%ebp),%esi int m, tot; for (tot = 0; tot < n; tot += m) { 80001ebe: 85 f6 test %esi,%esi 80001ec0: 74 31 je 80001ef3 <readn+0x44> 80001ec2: b8 00 00 00 00 mov $0x0,%eax 80001ec7: bb 00 00 00 00 mov $0x0,%ebx m = read(fdnum, (char*)buf + tot, n - tot); 80001ecc: 83 ec 04 sub $0x4,%esp 80001ecf: 89 f2 mov %esi,%edx 80001ed1: 29 c2 sub %eax,%edx 80001ed3: 52 push %edx 80001ed4: 03 45 0c add 0xc(%ebp),%eax 80001ed7: 50 push %eax 80001ed8: 57 push %edi 80001ed9: e8 40 ff ff ff call 80001e1e <read> if (m < 0) 80001ede: 83 c4 10 add $0x10,%esp 80001ee1: 85 c0 test %eax,%eax 80001ee3: 78 17 js 80001efc <readn+0x4d> return m; if (m == 0) 80001ee5: 85 c0 test %eax,%eax 80001ee7: 74 11 je 80001efa <readn+0x4b> ssize_t readn(int fdnum, void *buf, size_t n) { int m, tot; for (tot = 0; tot < n; tot += m) { 80001ee9: 01 c3 add %eax,%ebx 80001eeb: 89 d8 mov %ebx,%eax 80001eed: 39 f3 cmp %esi,%ebx 80001eef: 72 db jb 80001ecc <readn+0x1d> 80001ef1: eb 09 jmp 80001efc <readn+0x4d> 80001ef3: b8 00 00 00 00 mov $0x0,%eax 80001ef8: eb 02 jmp 80001efc <readn+0x4d> 80001efa: 89 d8 mov %ebx,%eax return m; if (m == 0) break; } return tot; } 80001efc: 8d 65 f4 lea -0xc(%ebp),%esp 80001eff: 5b pop %ebx 80001f00: 5e pop %esi 80001f01: 5f pop %edi 80001f02: 5d pop %ebp 80001f03: c3 ret 80001f04 <write>: ssize_t write(int fdnum, const void *buf, size_t n) { 80001f04: 55 push %ebp 80001f05: 89 e5 mov %esp,%ebp 80001f07: 53 push %ebx 80001f08: 83 ec 14 sub $0x14,%esp 80001f0b: 8b 5d 08 mov 0x8(%ebp),%ebx int r; struct Dev *dev; struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0 80001f0e: 8d 45 f0 lea -0x10(%ebp),%eax 80001f11: 50 push %eax 80001f12: 53 push %ebx 80001f13: e8 87 fc ff ff call 80001b9f <fd_lookup> 80001f18: 83 c4 08 add $0x8,%esp 80001f1b: 89 c2 mov %eax,%edx 80001f1d: 85 c0 test %eax,%eax 80001f1f: 78 68 js 80001f89 <write+0x85> || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0) 80001f21: 83 ec 08 sub $0x8,%esp 80001f24: 8d 45 f4 lea -0xc(%ebp),%eax 80001f27: 50 push %eax 80001f28: 8b 45 f0 mov -0x10(%ebp),%eax 80001f2b: ff 30 pushl (%eax) 80001f2d: e8 c3 fc ff ff call 80001bf5 <dev_lookup> 80001f32: 83 c4 10 add $0x10,%esp 80001f35: 85 c0 test %eax,%eax 80001f37: 78 47 js 80001f80 <write+0x7c> return r; if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) { 80001f39: 8b 45 f0 mov -0x10(%ebp),%eax 80001f3c: f6 40 08 03 testb $0x3,0x8(%eax) 80001f40: 75 21 jne 80001f63 <write+0x5f> cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum); 80001f42: a1 c0 58 00 80 mov 0x800058c0,%eax 80001f47: 8b 40 48 mov 0x48(%eax),%eax 80001f4a: 83 ec 04 sub $0x4,%esp 80001f4d: 53 push %ebx 80001f4e: 50 push %eax 80001f4f: 68 39 34 00 80 push $0x80003439 80001f54: e8 be 0f 00 00 call 80002f17 <cprintf> return -E_INVAL; 80001f59: 83 c4 10 add $0x10,%esp 80001f5c: ba fd ff ff ff mov $0xfffffffd,%edx 80001f61: eb 26 jmp 80001f89 <write+0x85> } if (debug) cprintf("write %d %p %d via dev %s\n", fdnum, buf, n, dev->dev_name); if (!dev->dev_write) 80001f63: 8b 55 f4 mov -0xc(%ebp),%edx 80001f66: 8b 52 0c mov 0xc(%edx),%edx 80001f69: 85 d2 test %edx,%edx 80001f6b: 74 17 je 80001f84 <write+0x80> return -E_NOT_SUPP; return (*dev->dev_write)(fd, buf, n); 80001f6d: 83 ec 04 sub $0x4,%esp 80001f70: ff 75 10 pushl 0x10(%ebp) 80001f73: ff 75 0c pushl 0xc(%ebp) 80001f76: 50 push %eax 80001f77: ff d2 call *%edx 80001f79: 89 c2 mov %eax,%edx 80001f7b: 83 c4 10 add $0x10,%esp 80001f7e: eb 09 jmp 80001f89 <write+0x85> int r; struct Dev *dev; struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0 || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0) 80001f80: 89 c2 mov %eax,%edx 80001f82: eb 05 jmp 80001f89 <write+0x85> } if (debug) cprintf("write %d %p %d via dev %s\n", fdnum, buf, n, dev->dev_name); if (!dev->dev_write) return -E_NOT_SUPP; 80001f84: ba ef ff ff ff mov $0xffffffef,%edx return (*dev->dev_write)(fd, buf, n); } 80001f89: 89 d0 mov %edx,%eax 80001f8b: 8b 5d fc mov -0x4(%ebp),%ebx 80001f8e: c9 leave 80001f8f: c3 ret 80001f90 <seek>: int seek(int fdnum, off_t offset) { 80001f90: 55 push %ebp 80001f91: 89 e5 mov %esp,%ebp 80001f93: 83 ec 10 sub $0x10,%esp int r; struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0) 80001f96: 8d 45 fc lea -0x4(%ebp),%eax 80001f99: 50 push %eax 80001f9a: ff 75 08 pushl 0x8(%ebp) 80001f9d: e8 fd fb ff ff call 80001b9f <fd_lookup> 80001fa2: 83 c4 08 add $0x8,%esp 80001fa5: 85 c0 test %eax,%eax 80001fa7: 78 0e js 80001fb7 <seek+0x27> return r; fd->fd_offset = offset; 80001fa9: 8b 45 fc mov -0x4(%ebp),%eax 80001fac: 8b 55 0c mov 0xc(%ebp),%edx 80001faf: 89 50 04 mov %edx,0x4(%eax) return 0; 80001fb2: b8 00 00 00 00 mov $0x0,%eax } 80001fb7: c9 leave 80001fb8: c3 ret 80001fb9 <ftruncate>: int ftruncate(int fdnum, off_t newsize) { 80001fb9: 55 push %ebp 80001fba: 89 e5 mov %esp,%ebp 80001fbc: 53 push %ebx 80001fbd: 83 ec 14 sub $0x14,%esp 80001fc0: 8b 5d 08 mov 0x8(%ebp),%ebx int r; struct Dev *dev; struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0 80001fc3: 8d 45 f0 lea -0x10(%ebp),%eax 80001fc6: 50 push %eax 80001fc7: 53 push %ebx 80001fc8: e8 d2 fb ff ff call 80001b9f <fd_lookup> 80001fcd: 83 c4 08 add $0x8,%esp 80001fd0: 89 c2 mov %eax,%edx 80001fd2: 85 c0 test %eax,%eax 80001fd4: 78 65 js 8000203b <ftruncate+0x82> || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0) 80001fd6: 83 ec 08 sub $0x8,%esp 80001fd9: 8d 45 f4 lea -0xc(%ebp),%eax 80001fdc: 50 push %eax 80001fdd: 8b 45 f0 mov -0x10(%ebp),%eax 80001fe0: ff 30 pushl (%eax) 80001fe2: e8 0e fc ff ff call 80001bf5 <dev_lookup> 80001fe7: 83 c4 10 add $0x10,%esp 80001fea: 85 c0 test %eax,%eax 80001fec: 78 44 js 80002032 <ftruncate+0x79> return r; if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) { 80001fee: 8b 45 f0 mov -0x10(%ebp),%eax 80001ff1: f6 40 08 03 testb $0x3,0x8(%eax) 80001ff5: 75 21 jne 80002018 <ftruncate+0x5f> cprintf("[%08x] ftruncate %d -- bad mode\n", thisenv->env_id, fdnum); 80001ff7: a1 c0 58 00 80 mov 0x800058c0,%eax struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0 || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0) return r; if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) { cprintf("[%08x] ftruncate %d -- bad mode\n", 80001ffc: 8b 40 48 mov 0x48(%eax),%eax 80001fff: 83 ec 04 sub $0x4,%esp 80002002: 53 push %ebx 80002003: 50 push %eax 80002004: 68 fc 33 00 80 push $0x800033fc 80002009: e8 09 0f 00 00 call 80002f17 <cprintf> thisenv->env_id, fdnum); return -E_INVAL; 8000200e: 83 c4 10 add $0x10,%esp 80002011: ba fd ff ff ff mov $0xfffffffd,%edx 80002016: eb 23 jmp 8000203b <ftruncate+0x82> } if (!dev->dev_trunc) 80002018: 8b 55 f4 mov -0xc(%ebp),%edx 8000201b: 8b 52 18 mov 0x18(%edx),%edx 8000201e: 85 d2 test %edx,%edx 80002020: 74 14 je 80002036 <ftruncate+0x7d> return -E_NOT_SUPP; return (*dev->dev_trunc)(fd, newsize); 80002022: 83 ec 08 sub $0x8,%esp 80002025: ff 75 0c pushl 0xc(%ebp) 80002028: 50 push %eax 80002029: ff d2 call *%edx 8000202b: 89 c2 mov %eax,%edx 8000202d: 83 c4 10 add $0x10,%esp 80002030: eb 09 jmp 8000203b <ftruncate+0x82> { int r; struct Dev *dev; struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0 || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0) 80002032: 89 c2 mov %eax,%edx 80002034: eb 05 jmp 8000203b <ftruncate+0x82> cprintf("[%08x] ftruncate %d -- bad mode\n", thisenv->env_id, fdnum); return -E_INVAL; } if (!dev->dev_trunc) return -E_NOT_SUPP; 80002036: ba ef ff ff ff mov $0xffffffef,%edx return (*dev->dev_trunc)(fd, newsize); } 8000203b: 89 d0 mov %edx,%eax 8000203d: 8b 5d fc mov -0x4(%ebp),%ebx 80002040: c9 leave 80002041: c3 ret 80002042 <fstat>: int fstat(int fdnum, struct Stat *stat) { 80002042: 55 push %ebp 80002043: 89 e5 mov %esp,%ebp 80002045: 53 push %ebx 80002046: 83 ec 14 sub $0x14,%esp 80002049: 8b 5d 0c mov 0xc(%ebp),%ebx int r; struct Dev *dev; struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0 8000204c: 8d 45 f0 lea -0x10(%ebp),%eax 8000204f: 50 push %eax 80002050: ff 75 08 pushl 0x8(%ebp) 80002053: e8 47 fb ff ff call 80001b9f <fd_lookup> 80002058: 83 c4 08 add $0x8,%esp 8000205b: 89 c2 mov %eax,%edx 8000205d: 85 c0 test %eax,%eax 8000205f: 78 4f js 800020b0 <fstat+0x6e> || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0) 80002061: 83 ec 08 sub $0x8,%esp 80002064: 8d 45 f4 lea -0xc(%ebp),%eax 80002067: 50 push %eax 80002068: 8b 45 f0 mov -0x10(%ebp),%eax 8000206b: ff 30 pushl (%eax) 8000206d: e8 83 fb ff ff call 80001bf5 <dev_lookup> 80002072: 83 c4 10 add $0x10,%esp 80002075: 85 c0 test %eax,%eax 80002077: 78 2e js 800020a7 <fstat+0x65> return r; if (!dev->dev_stat) 80002079: 8b 45 f4 mov -0xc(%ebp),%eax 8000207c: 83 78 14 00 cmpl $0x0,0x14(%eax) 80002080: 74 29 je 800020ab <fstat+0x69> return -E_NOT_SUPP; stat->st_name[0] = 0; 80002082: c6 03 00 movb $0x0,(%ebx) stat->st_size = 0; 80002085: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) stat->st_isdir = 0; 8000208c: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) stat->st_dev = dev; 80002093: 89 43 18 mov %eax,0x18(%ebx) return (*dev->dev_stat)(fd, stat); 80002096: 83 ec 08 sub $0x8,%esp 80002099: 53 push %ebx 8000209a: ff 75 f0 pushl -0x10(%ebp) 8000209d: ff 50 14 call *0x14(%eax) 800020a0: 89 c2 mov %eax,%edx 800020a2: 83 c4 10 add $0x10,%esp 800020a5: eb 09 jmp 800020b0 <fstat+0x6e> int r; struct Dev *dev; struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0 || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0) 800020a7: 89 c2 mov %eax,%edx 800020a9: eb 05 jmp 800020b0 <fstat+0x6e> return r; if (!dev->dev_stat) return -E_NOT_SUPP; 800020ab: ba ef ff ff ff mov $0xffffffef,%edx stat->st_name[0] = 0; stat->st_size = 0; stat->st_isdir = 0; stat->st_dev = dev; return (*dev->dev_stat)(fd, stat); } 800020b0: 89 d0 mov %edx,%eax 800020b2: 8b 5d fc mov -0x4(%ebp),%ebx 800020b5: c9 leave 800020b6: c3 ret 800020b7 <stat>: int stat(const char *path, struct Stat *stat) { 800020b7: 55 push %ebp 800020b8: 89 e5 mov %esp,%ebp 800020ba: 56 push %esi 800020bb: 53 push %ebx int fd, r; if ((fd = open(path, O_RDONLY)) < 0) 800020bc: 83 ec 08 sub $0x8,%esp 800020bf: 6a 00 push $0x0 800020c1: ff 75 08 pushl 0x8(%ebp) 800020c4: e8 a5 01 00 00 call 8000226e <open> 800020c9: 89 c3 mov %eax,%ebx 800020cb: 83 c4 10 add $0x10,%esp 800020ce: 85 c0 test %eax,%eax 800020d0: 78 1b js 800020ed <stat+0x36> return fd; r = fstat(fd, stat); 800020d2: 83 ec 08 sub $0x8,%esp 800020d5: ff 75 0c pushl 0xc(%ebp) 800020d8: 50 push %eax 800020d9: e8 64 ff ff ff call 80002042 <fstat> 800020de: 89 c6 mov %eax,%esi close(fd); 800020e0: 89 1c 24 mov %ebx,(%esp) 800020e3: e8 fc fb ff ff call 80001ce4 <close> return r; 800020e8: 83 c4 10 add $0x10,%esp 800020eb: 89 f0 mov %esi,%eax } 800020ed: 8d 65 f8 lea -0x8(%ebp),%esp 800020f0: 5b pop %ebx 800020f1: 5e pop %esi 800020f2: 5d pop %ebp 800020f3: c3 ret 800020f4 <fsipc>: // type: request code, passed as the simple integer IPC value. // dstva: virtual address at which to receive reply page, 0 if none. // Returns result from the file server. static int fsipc(unsigned type, void *dstva) { 800020f4: 55 push %ebp 800020f5: 89 e5 mov %esp,%ebp 800020f7: 56 push %esi 800020f8: 53 push %ebx 800020f9: 89 c6 mov %eax,%esi 800020fb: 89 d3 mov %edx,%ebx static envid_t fsenv; if (fsenv == 0) 800020fd: 83 3d 00 50 00 80 00 cmpl $0x0,0x80005000 80002104: 75 12 jne 80002118 <fsipc+0x24> fsenv = ipc_find_env(ENV_TYPE_FS); 80002106: 83 ec 0c sub $0xc,%esp 80002109: 6a 01 push $0x1 8000210b: e8 4b 06 00 00 call 8000275b <ipc_find_env> 80002110: a3 00 50 00 80 mov %eax,0x80005000 80002115: 83 c4 10 add $0x10,%esp if (debug) cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf); ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U); 80002118: 6a 07 push $0x7 8000211a: 68 00 60 00 80 push $0x80006000 8000211f: 56 push %esi 80002120: ff 35 00 50 00 80 pushl 0x80005000 80002126: e8 dc 05 00 00 call 80002707 <ipc_send> return ipc_recv(NULL, dstva, NULL); 8000212b: 83 c4 0c add $0xc,%esp 8000212e: 6a 00 push $0x0 80002130: 53 push %ebx 80002131: 6a 00 push $0x0 80002133: e8 4e 05 00 00 call 80002686 <ipc_recv> } 80002138: 8d 65 f8 lea -0x8(%ebp),%esp 8000213b: 5b pop %ebx 8000213c: 5e pop %esi 8000213d: 5d pop %ebp 8000213e: c3 ret 8000213f <devfile_trunc>: } // Truncate or extend an open file to 'size' bytes static int devfile_trunc(struct Fd *fd, off_t newsize) { 8000213f: 55 push %ebp 80002140: 89 e5 mov %esp,%ebp 80002142: 83 ec 08 sub $0x8,%esp fsipcbuf.set_size.req_fileid = fd->fd_file.id; 80002145: 8b 45 08 mov 0x8(%ebp),%eax 80002148: 8b 40 0c mov 0xc(%eax),%eax 8000214b: a3 00 60 00 80 mov %eax,0x80006000 fsipcbuf.set_size.req_size = newsize; 80002150: 8b 45 0c mov 0xc(%ebp),%eax 80002153: a3 04 60 00 80 mov %eax,0x80006004 return fsipc(FSREQ_SET_SIZE, NULL); 80002158: ba 00 00 00 00 mov $0x0,%edx 8000215d: b8 02 00 00 00 mov $0x2,%eax 80002162: e8 8d ff ff ff call 800020f4 <fsipc> } 80002167: c9 leave 80002168: c3 ret 80002169 <devfile_flush>: // open, unmapping it is enough to free up server-side resources. // Other than that, we just have to make sure our changes are flushed // to disk. static int devfile_flush(struct Fd *fd) { 80002169: 55 push %ebp 8000216a: 89 e5 mov %esp,%ebp 8000216c: 83 ec 08 sub $0x8,%esp fsipcbuf.flush.req_fileid = fd->fd_file.id; 8000216f: 8b 45 08 mov 0x8(%ebp),%eax 80002172: 8b 40 0c mov 0xc(%eax),%eax 80002175: a3 00 60 00 80 mov %eax,0x80006000 return fsipc(FSREQ_FLUSH, NULL); 8000217a: ba 00 00 00 00 mov $0x0,%edx 8000217f: b8 06 00 00 00 mov $0x6,%eax 80002184: e8 6b ff ff ff call 800020f4 <fsipc> } 80002189: c9 leave 8000218a: c3 ret 8000218b <devfile_stat>: return fsipc(FSREQ_WRITE, NULL); } static int devfile_stat(struct Fd *fd, struct Stat *st) { 8000218b: 55 push %ebp 8000218c: 89 e5 mov %esp,%ebp 8000218e: 53 push %ebx 8000218f: 83 ec 04 sub $0x4,%esp 80002192: 8b 5d 0c mov 0xc(%ebp),%ebx int r; fsipcbuf.stat.req_fileid = fd->fd_file.id; 80002195: 8b 45 08 mov 0x8(%ebp),%eax 80002198: 8b 40 0c mov 0xc(%eax),%eax 8000219b: a3 00 60 00 80 mov %eax,0x80006000 if ((r = fsipc(FSREQ_STAT, NULL)) < 0) 800021a0: ba 00 00 00 00 mov $0x0,%edx 800021a5: b8 05 00 00 00 mov $0x5,%eax 800021aa: e8 45 ff ff ff call 800020f4 <fsipc> 800021af: 85 c0 test %eax,%eax 800021b1: 78 26 js 800021d9 <devfile_stat+0x4e> return r; strcpy(st->st_name, fsipcbuf.statRet.ret_name); 800021b3: 83 ec 08 sub $0x8,%esp 800021b6: 68 00 60 00 80 push $0x80006000 800021bb: 53 push %ebx 800021bc: e8 6e f2 ff ff call 8000142f <strcpy> st->st_size = fsipcbuf.statRet.ret_size; 800021c1: a1 10 60 00 80 mov 0x80006010,%eax 800021c6: 89 43 10 mov %eax,0x10(%ebx) st->st_isdir = fsipcbuf.statRet.ret_isdir; 800021c9: a1 14 60 00 80 mov 0x80006014,%eax 800021ce: 89 43 14 mov %eax,0x14(%ebx) return 0; 800021d1: 83 c4 10 add $0x10,%esp 800021d4: b8 00 00 00 00 mov $0x0,%eax } 800021d9: 8b 5d fc mov -0x4(%ebp),%ebx 800021dc: c9 leave 800021dd: c3 ret 800021de <devfile_write>: // Returns: // The number of bytes successfully written. // < 0 on error. static ssize_t devfile_write(struct Fd *fd, const void *buf, size_t n) { 800021de: 55 push %ebp 800021df: 89 e5 mov %esp,%ebp 800021e1: 83 ec 0c sub $0xc,%esp 800021e4: 8b 45 10 mov 0x10(%ebp),%eax // remember that write is always allowed to write *fewer* // bytes than requested. // LAB 5: Your code here // panic("devfile_write not implemented"); int max = PGSIZE - (sizeof(int) + sizeof(size_t)); n = n > max ? max : n; 800021e7: 3d f8 0f 00 00 cmp $0xff8,%eax 800021ec: ba f8 0f 00 00 mov $0xff8,%edx 800021f1: 0f 47 c2 cmova %edx,%eax fsipcbuf.write.req_fileid = fd->fd_file.id; 800021f4: 8b 55 08 mov 0x8(%ebp),%edx 800021f7: 8b 52 0c mov 0xc(%edx),%edx 800021fa: 89 15 00 60 00 80 mov %edx,0x80006000 fsipcbuf.write.req_n = n; 80002200: a3 04 60 00 80 mov %eax,0x80006004 memmove(fsipcbuf.write.req_buf, buf, n); 80002205: 50 push %eax 80002206: ff 75 0c pushl 0xc(%ebp) 80002209: 68 08 60 00 80 push $0x80006008 8000220e: e8 0b f4 ff ff call 8000161e <memmove> return fsipc(FSREQ_WRITE, NULL); 80002213: ba 00 00 00 00 mov $0x0,%edx 80002218: b8 04 00 00 00 mov $0x4,%eax 8000221d: e8 d2 fe ff ff call 800020f4 <fsipc> } 80002222: c9 leave 80002223: c3 ret 80002224 <devfile_read>: // Returns: // The number of bytes successfully read. // < 0 on error. static ssize_t devfile_read(struct Fd *fd, void *buf, size_t n) { 80002224: 55 push %ebp 80002225: 89 e5 mov %esp,%ebp 80002227: 53 push %ebx 80002228: 83 ec 04 sub $0x4,%esp // filling fsipcbuf.read with the request arguments. The // bytes read will be written back to fsipcbuf by the file // system server. int r; fsipcbuf.read.req_fileid = fd->fd_file.id; 8000222b: 8b 45 08 mov 0x8(%ebp),%eax 8000222e: 8b 40 0c mov 0xc(%eax),%eax 80002231: a3 00 60 00 80 mov %eax,0x80006000 fsipcbuf.read.req_n = n; 80002236: 8b 45 10 mov 0x10(%ebp),%eax 80002239: a3 04 60 00 80 mov %eax,0x80006004 if ((r = fsipc(FSREQ_READ, NULL)) < 0) 8000223e: ba 00 00 00 00 mov $0x0,%edx 80002243: b8 03 00 00 00 mov $0x3,%eax 80002248: e8 a7 fe ff ff call 800020f4 <fsipc> 8000224d: 89 c3 mov %eax,%ebx 8000224f: 85 c0 test %eax,%eax 80002251: 78 14 js 80002267 <devfile_read+0x43> return r; memmove(buf, fsipcbuf.readRet.ret_buf, r); 80002253: 83 ec 04 sub $0x4,%esp 80002256: 50 push %eax 80002257: 68 00 60 00 80 push $0x80006000 8000225c: ff 75 0c pushl 0xc(%ebp) 8000225f: e8 ba f3 ff ff call 8000161e <memmove> return r; 80002264: 83 c4 10 add $0x10,%esp } 80002267: 89 d8 mov %ebx,%eax 80002269: 8b 5d fc mov -0x4(%ebp),%ebx 8000226c: c9 leave 8000226d: c3 ret 8000226e <open>: // The file descriptor index on success // -E_BAD_PATH if the path is too long (>= MAXPATHLEN) // < 0 for other errors. int open(const char *path, int mode) { 8000226e: 55 push %ebp 8000226f: 89 e5 mov %esp,%ebp 80002271: 53 push %ebx 80002272: 83 ec 20 sub $0x20,%esp 80002275: 8b 5d 08 mov 0x8(%ebp),%ebx // file descriptor. int r; struct Fd *fd; if (strlen(path) >= MAXPATHLEN) 80002278: 53 push %ebx 80002279: e8 56 f1 ff ff call 800013d4 <strlen> 8000227e: 83 c4 10 add $0x10,%esp 80002281: 83 f8 7f cmp $0x7f,%eax 80002284: 7f 67 jg 800022ed <open+0x7f> return -E_BAD_PATH; if ((r = fd_alloc(&fd)) < 0) 80002286: 83 ec 0c sub $0xc,%esp 80002289: 8d 45 f4 lea -0xc(%ebp),%eax 8000228c: 50 push %eax 8000228d: e8 99 f8 ff ff call 80001b2b <fd_alloc> 80002292: 83 c4 10 add $0x10,%esp return r; 80002295: 89 c2 mov %eax,%edx struct Fd *fd; if (strlen(path) >= MAXPATHLEN) return -E_BAD_PATH; if ((r = fd_alloc(&fd)) < 0) 80002297: 85 c0 test %eax,%eax 80002299: 78 57 js 800022f2 <open+0x84> return r; strcpy(fsipcbuf.open.req_path, path); 8000229b: 83 ec 08 sub $0x8,%esp 8000229e: 53 push %ebx 8000229f: 68 00 60 00 80 push $0x80006000 800022a4: e8 86 f1 ff ff call 8000142f <strcpy> fsipcbuf.open.req_omode = mode; 800022a9: 8b 45 0c mov 0xc(%ebp),%eax 800022ac: a3 80 60 00 80 mov %eax,0x80006080 if ((r = fsipc(FSREQ_OPEN, fd)) < 0) { 800022b1: 8b 55 f4 mov -0xc(%ebp),%edx 800022b4: b8 01 00 00 00 mov $0x1,%eax 800022b9: e8 36 fe ff ff call 800020f4 <fsipc> 800022be: 89 c3 mov %eax,%ebx 800022c0: 83 c4 10 add $0x10,%esp 800022c3: 85 c0 test %eax,%eax 800022c5: 79 14 jns 800022db <open+0x6d> fd_close(fd, 0); 800022c7: 83 ec 08 sub $0x8,%esp 800022ca: 6a 00 push $0x0 800022cc: ff 75 f4 pushl -0xc(%ebp) 800022cf: e8 8f f9 ff ff call 80001c63 <fd_close> return r; 800022d4: 83 c4 10 add $0x10,%esp 800022d7: 89 da mov %ebx,%edx 800022d9: eb 17 jmp 800022f2 <open+0x84> } return fd2num(fd); 800022db: 83 ec 0c sub $0xc,%esp 800022de: ff 75 f4 pushl -0xc(%ebp) 800022e1: e8 1d f8 ff ff call 80001b03 <fd2num> 800022e6: 89 c2 mov %eax,%edx 800022e8: 83 c4 10 add $0x10,%esp 800022eb: eb 05 jmp 800022f2 <open+0x84> int r; struct Fd *fd; if (strlen(path) >= MAXPATHLEN) return -E_BAD_PATH; 800022ed: ba f3 ff ff ff mov $0xfffffff3,%edx fd_close(fd, 0); return r; } return fd2num(fd); } 800022f2: 89 d0 mov %edx,%eax 800022f4: 8b 5d fc mov -0x4(%ebp),%ebx 800022f7: c9 leave 800022f8: c3 ret 800022f9 <sync>: // Synchronize disk with buffer cache int sync(void) { 800022f9: 55 push %ebp 800022fa: 89 e5 mov %esp,%ebp 800022fc: 83 ec 08 sub $0x8,%esp // Ask the file server to update the disk // by writing any dirty blocks in the buffer cache. return fsipc(FSREQ_SYNC, NULL); 800022ff: ba 00 00 00 00 mov $0x0,%edx 80002304: b8 09 00 00 00 mov $0x9,%eax 80002309: e8 e6 fd ff ff call 800020f4 <fsipc> } 8000230e: c9 leave 8000230f: c3 ret 80002310 <devpipe_stat>: return i; } static int devpipe_stat(struct Fd *fd, struct Stat *stat) { 80002310: 55 push %ebp 80002311: 89 e5 mov %esp,%ebp 80002313: 56 push %esi 80002314: 53 push %ebx 80002315: 8b 5d 0c mov 0xc(%ebp),%ebx struct Pipe *p = (struct Pipe*) fd2data(fd); 80002318: 83 ec 0c sub $0xc,%esp 8000231b: ff 75 08 pushl 0x8(%ebp) 8000231e: e8 f0 f7 ff ff call 80001b13 <fd2data> 80002323: 89 c6 mov %eax,%esi strcpy(stat->st_name, "<pipe>"); 80002325: 83 c4 08 add $0x8,%esp 80002328: 68 56 34 00 80 push $0x80003456 8000232d: 53 push %ebx 8000232e: e8 fc f0 ff ff call 8000142f <strcpy> stat->st_size = p->p_wpos - p->p_rpos; 80002333: 8b 46 04 mov 0x4(%esi),%eax 80002336: 2b 06 sub (%esi),%eax 80002338: 89 43 10 mov %eax,0x10(%ebx) stat->st_isdir = 0; 8000233b: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) stat->st_dev = &devpipe; 80002342: c7 43 18 20 40 00 80 movl $0x80004020,0x18(%ebx) return 0; } 80002349: b8 00 00 00 00 mov $0x0,%eax 8000234e: 8d 65 f8 lea -0x8(%ebp),%esp 80002351: 5b pop %ebx 80002352: 5e pop %esi 80002353: 5d pop %ebp 80002354: c3 ret 80002355 <devpipe_close>: static int devpipe_close(struct Fd *fd) { 80002355: 55 push %ebp 80002356: 89 e5 mov %esp,%ebp 80002358: 53 push %ebx 80002359: 83 ec 0c sub $0xc,%esp 8000235c: 8b 5d 08 mov 0x8(%ebp),%ebx (void) sys_page_unmap(0, fd); 8000235f: 53 push %ebx 80002360: 6a 00 push $0x0 80002362: e8 30 f6 ff ff call 80001997 <sys_page_unmap> return sys_page_unmap(0, fd2data(fd)); 80002367: 89 1c 24 mov %ebx,(%esp) 8000236a: e8 a4 f7 ff ff call 80001b13 <fd2data> 8000236f: 83 c4 08 add $0x8,%esp 80002372: 50 push %eax 80002373: 6a 00 push $0x0 80002375: e8 1d f6 ff ff call 80001997 <sys_page_unmap> } 8000237a: 8b 5d fc mov -0x4(%ebp),%ebx 8000237d: c9 leave 8000237e: c3 ret 8000237f <_pipeisclosed>: return r; } static int _pipeisclosed(struct Fd *fd, struct Pipe *p) { 8000237f: 55 push %ebp 80002380: 89 e5 mov %esp,%ebp 80002382: 57 push %edi 80002383: 56 push %esi 80002384: 53 push %ebx 80002385: 83 ec 1c sub $0x1c,%esp 80002388: 89 45 e0 mov %eax,-0x20(%ebp) 8000238b: 89 d7 mov %edx,%edi int n, nn, ret; while (1) { n = thisenv->env_runs; 8000238d: a1 c0 58 00 80 mov 0x800058c0,%eax 80002392: 8b 70 58 mov 0x58(%eax),%esi ret = pageref(fd) == pageref(p); 80002395: 83 ec 0c sub $0xc,%esp 80002398: ff 75 e0 pushl -0x20(%ebp) 8000239b: e8 1e 04 00 00 call 800027be <pageref> 800023a0: 89 c3 mov %eax,%ebx 800023a2: 89 3c 24 mov %edi,(%esp) 800023a5: e8 14 04 00 00 call 800027be <pageref> 800023aa: 83 c4 10 add $0x10,%esp 800023ad: 39 c3 cmp %eax,%ebx 800023af: 0f 94 c1 sete %cl 800023b2: 0f b6 c9 movzbl %cl,%ecx 800023b5: 89 4d e4 mov %ecx,-0x1c(%ebp) nn = thisenv->env_runs; 800023b8: 8b 15 c0 58 00 80 mov 0x800058c0,%edx 800023be: 8b 4a 58 mov 0x58(%edx),%ecx if (n == nn) 800023c1: 39 ce cmp %ecx,%esi 800023c3: 74 1b je 800023e0 <_pipeisclosed+0x61> return ret; if (n != nn && ret == 1) 800023c5: 39 c3 cmp %eax,%ebx 800023c7: 75 c4 jne 8000238d <_pipeisclosed+0xe> cprintf("pipe race avoided\n", n, thisenv->env_runs, ret); 800023c9: 8b 42 58 mov 0x58(%edx),%eax 800023cc: ff 75 e4 pushl -0x1c(%ebp) 800023cf: 50 push %eax 800023d0: 56 push %esi 800023d1: 68 5d 34 00 80 push $0x8000345d 800023d6: e8 3c 0b 00 00 call 80002f17 <cprintf> 800023db: 83 c4 10 add $0x10,%esp 800023de: eb ad jmp 8000238d <_pipeisclosed+0xe> } } 800023e0: 8b 45 e4 mov -0x1c(%ebp),%eax 800023e3: 8d 65 f4 lea -0xc(%ebp),%esp 800023e6: 5b pop %ebx 800023e7: 5e pop %esi 800023e8: 5f pop %edi 800023e9: 5d pop %ebp 800023ea: c3 ret 800023eb <devpipe_write>: return i; } static ssize_t devpipe_write(struct Fd *fd, const void *vbuf, size_t n) { 800023eb: 55 push %ebp 800023ec: 89 e5 mov %esp,%ebp 800023ee: 57 push %edi 800023ef: 56 push %esi 800023f0: 53 push %ebx 800023f1: 83 ec 28 sub $0x28,%esp 800023f4: 8b 75 08 mov 0x8(%ebp),%esi const uint8_t *buf; size_t i; struct Pipe *p; p = (struct Pipe*) fd2data(fd); 800023f7: 56 push %esi 800023f8: e8 16 f7 ff ff call 80001b13 <fd2data> 800023fd: 89 c3 mov %eax,%ebx if (debug) cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n", thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos); buf = vbuf; for (i = 0; i < n; i++) { 800023ff: 83 c4 10 add $0x10,%esp 80002402: bf 00 00 00 00 mov $0x0,%edi 80002407: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8000240b: 75 52 jne 8000245f <devpipe_write+0x74> 8000240d: eb 5e jmp 8000246d <devpipe_write+0x82> while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) { // pipe is full // if all the readers are gone // (it's only writers like us now), // note eof if (_pipeisclosed(fd, p)) 8000240f: 89 da mov %ebx,%edx 80002411: 89 f0 mov %esi,%eax 80002413: e8 67 ff ff ff call 8000237f <_pipeisclosed> 80002418: 85 c0 test %eax,%eax 8000241a: 75 56 jne 80002472 <devpipe_write+0x87> return 0; // yield and see what happens if (debug) cprintf("devpipe_write yield\n"); sys_yield(); 8000241c: e8 d2 f4 ff ff call 800018f3 <sys_yield> cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n", thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos); buf = vbuf; for (i = 0; i < n; i++) { while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) { 80002421: 8b 43 04 mov 0x4(%ebx),%eax 80002424: 8b 0b mov (%ebx),%ecx 80002426: 8d 51 20 lea 0x20(%ecx),%edx 80002429: 39 d0 cmp %edx,%eax 8000242b: 73 e2 jae 8000240f <devpipe_write+0x24> cprintf("devpipe_write yield\n"); sys_yield(); } // there's room for a byte. store it. // wait to increment wpos until the byte is stored! p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i]; 8000242d: 8b 4d 0c mov 0xc(%ebp),%ecx 80002430: 0f b6 0c 39 movzbl (%ecx,%edi,1),%ecx 80002434: 88 4d e7 mov %cl,-0x19(%ebp) 80002437: 89 c2 mov %eax,%edx 80002439: c1 fa 1f sar $0x1f,%edx 8000243c: 89 d1 mov %edx,%ecx 8000243e: c1 e9 1b shr $0x1b,%ecx 80002441: 8d 14 08 lea (%eax,%ecx,1),%edx 80002444: 83 e2 1f and $0x1f,%edx 80002447: 29 ca sub %ecx,%edx 80002449: 0f b6 4d e7 movzbl -0x19(%ebp),%ecx 8000244d: 88 4c 13 08 mov %cl,0x8(%ebx,%edx,1) p->p_wpos++; 80002451: 83 c0 01 add $0x1,%eax 80002454: 89 43 04 mov %eax,0x4(%ebx) if (debug) cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n", thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos); buf = vbuf; for (i = 0; i < n; i++) { 80002457: 83 c7 01 add $0x1,%edi 8000245a: 39 7d 10 cmp %edi,0x10(%ebp) 8000245d: 74 0e je 8000246d <devpipe_write+0x82> while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) { 8000245f: 8b 43 04 mov 0x4(%ebx),%eax 80002462: 8b 0b mov (%ebx),%ecx 80002464: 8d 51 20 lea 0x20(%ecx),%edx 80002467: 39 d0 cmp %edx,%eax 80002469: 73 a4 jae 8000240f <devpipe_write+0x24> 8000246b: eb c0 jmp 8000242d <devpipe_write+0x42> // wait to increment wpos until the byte is stored! p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i]; p->p_wpos++; } return i; 8000246d: 8b 45 10 mov 0x10(%ebp),%eax 80002470: eb 05 jmp 80002477 <devpipe_write+0x8c> // pipe is full // if all the readers are gone // (it's only writers like us now), // note eof if (_pipeisclosed(fd, p)) return 0; 80002472: b8 00 00 00 00 mov $0x0,%eax p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i]; p->p_wpos++; } return i; } 80002477: 8d 65 f4 lea -0xc(%ebp),%esp 8000247a: 5b pop %ebx 8000247b: 5e pop %esi 8000247c: 5f pop %edi 8000247d: 5d pop %ebp 8000247e: c3 ret 8000247f <devpipe_read>: return _pipeisclosed(fd, p); } static ssize_t devpipe_read(struct Fd *fd, void *vbuf, size_t n) { 8000247f: 55 push %ebp 80002480: 89 e5 mov %esp,%ebp 80002482: 57 push %edi 80002483: 56 push %esi 80002484: 53 push %ebx 80002485: 83 ec 18 sub $0x18,%esp 80002488: 8b 7d 08 mov 0x8(%ebp),%edi uint8_t *buf; size_t i; struct Pipe *p; p = (struct Pipe*)fd2data(fd); 8000248b: 57 push %edi 8000248c: e8 82 f6 ff ff call 80001b13 <fd2data> 80002491: 89 c3 mov %eax,%ebx if (debug) cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n", thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos); buf = vbuf; for (i = 0; i < n; i++) { 80002493: 83 c4 10 add $0x10,%esp 80002496: be 00 00 00 00 mov $0x0,%esi 8000249b: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8000249f: 75 40 jne 800024e1 <devpipe_read+0x62> 800024a1: eb 4b jmp 800024ee <devpipe_read+0x6f> while (p->p_rpos == p->p_wpos) { // pipe is empty // if we got any data, return it if (i > 0) return i; 800024a3: 89 f0 mov %esi,%eax 800024a5: eb 51 jmp 800024f8 <devpipe_read+0x79> // if all the writers are gone, note eof if (_pipeisclosed(fd, p)) 800024a7: 89 da mov %ebx,%edx 800024a9: 89 f8 mov %edi,%eax 800024ab: e8 cf fe ff ff call 8000237f <_pipeisclosed> 800024b0: 85 c0 test %eax,%eax 800024b2: 75 3f jne 800024f3 <devpipe_read+0x74> return 0; // yield and see what happens if (debug) cprintf("devpipe_read yield\n"); sys_yield(); 800024b4: e8 3a f4 ff ff call 800018f3 <sys_yield> cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n", thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos); buf = vbuf; for (i = 0; i < n; i++) { while (p->p_rpos == p->p_wpos) { 800024b9: 8b 03 mov (%ebx),%eax 800024bb: 3b 43 04 cmp 0x4(%ebx),%eax 800024be: 74 e7 je 800024a7 <devpipe_read+0x28> cprintf("devpipe_read yield\n"); sys_yield(); } // there's a byte. take it. // wait to increment rpos until the byte is taken! buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ]; 800024c0: 99 cltd 800024c1: c1 ea 1b shr $0x1b,%edx 800024c4: 01 d0 add %edx,%eax 800024c6: 83 e0 1f and $0x1f,%eax 800024c9: 29 d0 sub %edx,%eax 800024cb: 0f b6 44 03 08 movzbl 0x8(%ebx,%eax,1),%eax 800024d0: 8b 4d 0c mov 0xc(%ebp),%ecx 800024d3: 88 04 31 mov %al,(%ecx,%esi,1) p->p_rpos++; 800024d6: 83 03 01 addl $0x1,(%ebx) if (debug) cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n", thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos); buf = vbuf; for (i = 0; i < n; i++) { 800024d9: 83 c6 01 add $0x1,%esi 800024dc: 39 75 10 cmp %esi,0x10(%ebp) 800024df: 74 0d je 800024ee <devpipe_read+0x6f> while (p->p_rpos == p->p_wpos) { 800024e1: 8b 03 mov (%ebx),%eax 800024e3: 3b 43 04 cmp 0x4(%ebx),%eax 800024e6: 75 d8 jne 800024c0 <devpipe_read+0x41> // pipe is empty // if we got any data, return it if (i > 0) 800024e8: 85 f6 test %esi,%esi 800024ea: 75 b7 jne 800024a3 <devpipe_read+0x24> 800024ec: eb b9 jmp 800024a7 <devpipe_read+0x28> // there's a byte. take it. // wait to increment rpos until the byte is taken! buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ]; p->p_rpos++; } return i; 800024ee: 8b 45 10 mov 0x10(%ebp),%eax 800024f1: eb 05 jmp 800024f8 <devpipe_read+0x79> // if we got any data, return it if (i > 0) return i; // if all the writers are gone, note eof if (_pipeisclosed(fd, p)) return 0; 800024f3: b8 00 00 00 00 mov $0x0,%eax // wait to increment rpos until the byte is taken! buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ]; p->p_rpos++; } return i; } 800024f8: 8d 65 f4 lea -0xc(%ebp),%esp 800024fb: 5b pop %ebx 800024fc: 5e pop %esi 800024fd: 5f pop %edi 800024fe: 5d pop %ebp 800024ff: c3 ret 80002500 <pipe>: uint8_t p_buf[PIPEBUFSIZ]; // data buffer }; int pipe(int pfd[2]) { 80002500: 55 push %ebp 80002501: 89 e5 mov %esp,%ebp 80002503: 56 push %esi 80002504: 53 push %ebx 80002505: 83 ec 1c sub $0x1c,%esp int r; struct Fd *fd0, *fd1; void *va; // allocate the file descriptor table entries if ((r = fd_alloc(&fd0)) < 0 80002508: 8d 45 f4 lea -0xc(%ebp),%eax 8000250b: 50 push %eax 8000250c: e8 1a f6 ff ff call 80001b2b <fd_alloc> 80002511: 83 c4 10 add $0x10,%esp 80002514: 89 c2 mov %eax,%edx 80002516: 85 c0 test %eax,%eax 80002518: 0f 88 2c 01 00 00 js 8000264a <pipe+0x14a> || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0) 8000251e: 83 ec 04 sub $0x4,%esp 80002521: 68 07 04 00 00 push $0x407 80002526: ff 75 f4 pushl -0xc(%ebp) 80002529: 6a 00 push $0x0 8000252b: e8 e2 f3 ff ff call 80001912 <sys_page_alloc> 80002530: 83 c4 10 add $0x10,%esp 80002533: 89 c2 mov %eax,%edx 80002535: 85 c0 test %eax,%eax 80002537: 0f 88 0d 01 00 00 js 8000264a <pipe+0x14a> goto err; if ((r = fd_alloc(&fd1)) < 0 8000253d: 83 ec 0c sub $0xc,%esp 80002540: 8d 45 f0 lea -0x10(%ebp),%eax 80002543: 50 push %eax 80002544: e8 e2 f5 ff ff call 80001b2b <fd_alloc> 80002549: 89 c3 mov %eax,%ebx 8000254b: 83 c4 10 add $0x10,%esp 8000254e: 85 c0 test %eax,%eax 80002550: 0f 88 e2 00 00 00 js 80002638 <pipe+0x138> || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0) 80002556: 83 ec 04 sub $0x4,%esp 80002559: 68 07 04 00 00 push $0x407 8000255e: ff 75 f0 pushl -0x10(%ebp) 80002561: 6a 00 push $0x0 80002563: e8 aa f3 ff ff call 80001912 <sys_page_alloc> 80002568: 89 c3 mov %eax,%ebx 8000256a: 83 c4 10 add $0x10,%esp 8000256d: 85 c0 test %eax,%eax 8000256f: 0f 88 c3 00 00 00 js 80002638 <pipe+0x138> goto err1; // allocate the pipe structure as first data page in both va = fd2data(fd0); 80002575: 83 ec 0c sub $0xc,%esp 80002578: ff 75 f4 pushl -0xc(%ebp) 8000257b: e8 93 f5 ff ff call 80001b13 <fd2data> 80002580: 89 c6 mov %eax,%esi if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0) 80002582: 83 c4 0c add $0xc,%esp 80002585: 68 07 04 00 00 push $0x407 8000258a: 50 push %eax 8000258b: 6a 00 push $0x0 8000258d: e8 80 f3 ff ff call 80001912 <sys_page_alloc> 80002592: 89 c3 mov %eax,%ebx 80002594: 83 c4 10 add $0x10,%esp 80002597: 85 c0 test %eax,%eax 80002599: 0f 88 89 00 00 00 js 80002628 <pipe+0x128> goto err2; if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0) 8000259f: 83 ec 0c sub $0xc,%esp 800025a2: ff 75 f0 pushl -0x10(%ebp) 800025a5: e8 69 f5 ff ff call 80001b13 <fd2data> 800025aa: c7 04 24 07 04 00 00 movl $0x407,(%esp) 800025b1: 50 push %eax 800025b2: 6a 00 push $0x0 800025b4: 56 push %esi 800025b5: 6a 00 push $0x0 800025b7: e8 99 f3 ff ff call 80001955 <sys_page_map> 800025bc: 89 c3 mov %eax,%ebx 800025be: 83 c4 20 add $0x20,%esp 800025c1: 85 c0 test %eax,%eax 800025c3: 78 55 js 8000261a <pipe+0x11a> goto err3; // set up fd structures fd0->fd_dev_id = devpipe.dev_id; 800025c5: 8b 15 20 40 00 80 mov 0x80004020,%edx 800025cb: 8b 45 f4 mov -0xc(%ebp),%eax 800025ce: 89 10 mov %edx,(%eax) fd0->fd_omode = O_RDONLY; 800025d0: 8b 45 f4 mov -0xc(%ebp),%eax 800025d3: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) fd1->fd_dev_id = devpipe.dev_id; 800025da: 8b 15 20 40 00 80 mov 0x80004020,%edx 800025e0: 8b 45 f0 mov -0x10(%ebp),%eax 800025e3: 89 10 mov %edx,(%eax) fd1->fd_omode = O_WRONLY; 800025e5: 8b 45 f0 mov -0x10(%ebp),%eax 800025e8: c7 40 08 01 00 00 00 movl $0x1,0x8(%eax) if (debug) cprintf("[%08x] pipecreate %08x\n", thisenv->env_id, uvpt[PGNUM(va)]); pfd[0] = fd2num(fd0); 800025ef: 83 ec 0c sub $0xc,%esp 800025f2: ff 75 f4 pushl -0xc(%ebp) 800025f5: e8 09 f5 ff ff call 80001b03 <fd2num> 800025fa: 8b 4d 08 mov 0x8(%ebp),%ecx 800025fd: 89 01 mov %eax,(%ecx) pfd[1] = fd2num(fd1); 800025ff: 83 c4 04 add $0x4,%esp 80002602: ff 75 f0 pushl -0x10(%ebp) 80002605: e8 f9 f4 ff ff call 80001b03 <fd2num> 8000260a: 8b 4d 08 mov 0x8(%ebp),%ecx 8000260d: 89 41 04 mov %eax,0x4(%ecx) return 0; 80002610: 83 c4 10 add $0x10,%esp 80002613: ba 00 00 00 00 mov $0x0,%edx 80002618: eb 30 jmp 8000264a <pipe+0x14a> err3: sys_page_unmap(0, va); 8000261a: 83 ec 08 sub $0x8,%esp 8000261d: 56 push %esi 8000261e: 6a 00 push $0x0 80002620: e8 72 f3 ff ff call 80001997 <sys_page_unmap> 80002625: 83 c4 10 add $0x10,%esp err2: sys_page_unmap(0, fd1); 80002628: 83 ec 08 sub $0x8,%esp 8000262b: ff 75 f0 pushl -0x10(%ebp) 8000262e: 6a 00 push $0x0 80002630: e8 62 f3 ff ff call 80001997 <sys_page_unmap> 80002635: 83 c4 10 add $0x10,%esp err1: sys_page_unmap(0, fd0); 80002638: 83 ec 08 sub $0x8,%esp 8000263b: ff 75 f4 pushl -0xc(%ebp) 8000263e: 6a 00 push $0x0 80002640: e8 52 f3 ff ff call 80001997 <sys_page_unmap> 80002645: 83 c4 10 add $0x10,%esp 80002648: 89 da mov %ebx,%edx err: return r; } 8000264a: 89 d0 mov %edx,%eax 8000264c: 8d 65 f8 lea -0x8(%ebp),%esp 8000264f: 5b pop %ebx 80002650: 5e pop %esi 80002651: 5d pop %ebp 80002652: c3 ret 80002653 <pipeisclosed>: } } int pipeisclosed(int fdnum) { 80002653: 55 push %ebp 80002654: 89 e5 mov %esp,%ebp 80002656: 83 ec 20 sub $0x20,%esp struct Fd *fd; struct Pipe *p; int r; if ((r = fd_lookup(fdnum, &fd)) < 0) 80002659: 8d 45 f4 lea -0xc(%ebp),%eax 8000265c: 50 push %eax 8000265d: ff 75 08 pushl 0x8(%ebp) 80002660: e8 3a f5 ff ff call 80001b9f <fd_lookup> 80002665: 83 c4 10 add $0x10,%esp 80002668: 85 c0 test %eax,%eax 8000266a: 78 18 js 80002684 <pipeisclosed+0x31> return r; p = (struct Pipe*) fd2data(fd); 8000266c: 83 ec 0c sub $0xc,%esp 8000266f: ff 75 f4 pushl -0xc(%ebp) 80002672: e8 9c f4 ff ff call 80001b13 <fd2data> return _pipeisclosed(fd, p); 80002677: 89 c2 mov %eax,%edx 80002679: 8b 45 f4 mov -0xc(%ebp),%eax 8000267c: e8 fe fc ff ff call 8000237f <_pipeisclosed> 80002681: 83 c4 10 add $0x10,%esp } 80002684: c9 leave 80002685: c3 ret 80002686 <ipc_recv>: // If 'pg' is null, pass sys_ipc_recv a value that it will understand // as meaning "no page". (Zero is not the right value, since that's // a perfectly valid place to map a page.) int32_t ipc_recv(envid_t *from_env_store, void *pg, int *perm_store) { 80002686: 55 push %ebp 80002687: 89 e5 mov %esp,%ebp 80002689: 56 push %esi 8000268a: 53 push %ebx 8000268b: 8b 75 08 mov 0x8(%ebp),%esi 8000268e: 8b 45 0c mov 0xc(%ebp),%eax 80002691: 8b 5d 10 mov 0x10(%ebp),%ebx // LAB 4: Your code here. // panic("ipc_recv not implemented"); int r; if(!pg) 80002694: 85 c0 test %eax,%eax pg = (void *)-1; // all 1 80002696: ba ff ff ff ff mov $0xffffffff,%edx 8000269b: 0f 44 c2 cmove %edx,%eax if((r = sys_ipc_recv(pg)) < 0) 8000269e: 83 ec 0c sub $0xc,%esp 800026a1: 50 push %eax 800026a2: e8 1b f4 ff ff call 80001ac2 <sys_ipc_recv> 800026a7: 83 c4 10 add $0x10,%esp 800026aa: 85 c0 test %eax,%eax 800026ac: 79 10 jns 800026be <ipc_recv+0x38> { if(from_env_store) 800026ae: 85 f6 test %esi,%esi 800026b0: 74 40 je 800026f2 <ipc_recv+0x6c> *from_env_store = 0; 800026b2: c7 06 00 00 00 00 movl $0x0,(%esi) if(perm_store) 800026b8: 85 db test %ebx,%ebx 800026ba: 74 20 je 800026dc <ipc_recv+0x56> 800026bc: eb 24 jmp 800026e2 <ipc_recv+0x5c> *perm_store = 0; } if(from_env_store) 800026be: 85 f6 test %esi,%esi 800026c0: 74 0a je 800026cc <ipc_recv+0x46> *from_env_store = thisenv->env_ipc_from; 800026c2: a1 c0 58 00 80 mov 0x800058c0,%eax 800026c7: 8b 40 74 mov 0x74(%eax),%eax 800026ca: 89 06 mov %eax,(%esi) if(perm_store) 800026cc: 85 db test %ebx,%ebx 800026ce: 74 28 je 800026f8 <ipc_recv+0x72> *perm_store = thisenv->env_ipc_perm; 800026d0: a1 c0 58 00 80 mov 0x800058c0,%eax 800026d5: 8b 40 78 mov 0x78(%eax),%eax 800026d8: 89 03 mov %eax,(%ebx) 800026da: eb 1c jmp 800026f8 <ipc_recv+0x72> if(from_env_store) *from_env_store = 0; if(perm_store) *perm_store = 0; } if(from_env_store) 800026dc: 85 f6 test %esi,%esi 800026de: 75 e2 jne 800026c2 <ipc_recv+0x3c> 800026e0: eb 16 jmp 800026f8 <ipc_recv+0x72> if((r = sys_ipc_recv(pg)) < 0) { if(from_env_store) *from_env_store = 0; if(perm_store) *perm_store = 0; 800026e2: c7 03 00 00 00 00 movl $0x0,(%ebx) 800026e8: eb d8 jmp 800026c2 <ipc_recv+0x3c> 800026ea: c7 03 00 00 00 00 movl $0x0,(%ebx) 800026f0: eb de jmp 800026d0 <ipc_recv+0x4a> pg = (void *)-1; // all 1 if((r = sys_ipc_recv(pg)) < 0) { if(from_env_store) *from_env_store = 0; if(perm_store) 800026f2: 85 db test %ebx,%ebx 800026f4: 75 f4 jne 800026ea <ipc_recv+0x64> 800026f6: eb e4 jmp 800026dc <ipc_recv+0x56> } if(from_env_store) *from_env_store = thisenv->env_ipc_from; if(perm_store) *perm_store = thisenv->env_ipc_perm; return thisenv->env_ipc_value; 800026f8: a1 c0 58 00 80 mov 0x800058c0,%eax 800026fd: 8b 40 70 mov 0x70(%eax),%eax } 80002700: 8d 65 f8 lea -0x8(%ebp),%esp 80002703: 5b pop %ebx 80002704: 5e pop %esi 80002705: 5d pop %ebp 80002706: c3 ret 80002707 <ipc_send>: // Use sys_yield() to be CPU-friendly. // If 'pg' is null, pass sys_ipc_try_send a value that it will understand // as meaning "no page". (Zero is not the right value.) void ipc_send(envid_t to_env, uint32_t val, void *pg, int perm) { 80002707: 55 push %ebp 80002708: 89 e5 mov %esp,%ebp 8000270a: 57 push %edi 8000270b: 56 push %esi 8000270c: 53 push %ebx 8000270d: 83 ec 0c sub $0xc,%esp 80002710: 8b 7d 08 mov 0x8(%ebp),%edi 80002713: 8b 75 0c mov 0xc(%ebp),%esi 80002716: 8b 5d 10 mov 0x10(%ebp),%ebx // LAB 4: Your code here. // panic("ipc_send not implemented"); int r; if(!pg) 80002719: 85 db test %ebx,%ebx pg = (void *)-1; // all 1 8000271b: b8 ff ff ff ff mov $0xffffffff,%eax 80002720: 0f 44 d8 cmove %eax,%ebx 80002723: eb 1c jmp 80002741 <ipc_send+0x3a> while((r = sys_ipc_try_send(to_env, val, pg, perm))) { if(r == 0) break; if(r != -E_IPC_NOT_RECV) 80002725: 83 f8 f9 cmp $0xfffffff9,%eax 80002728: 74 12 je 8000273c <ipc_send+0x35> panic("ipc_send : %e", r); 8000272a: 50 push %eax 8000272b: 68 75 34 00 80 push $0x80003475 80002730: 6a 41 push $0x41 80002732: 68 83 34 00 80 push $0x80003483 80002737: e8 03 0a 00 00 call 8000313f <_panic> sys_yield(); 8000273c: e8 b2 f1 ff ff call 800018f3 <sys_yield> // LAB 4: Your code here. // panic("ipc_send not implemented"); int r; if(!pg) pg = (void *)-1; // all 1 while((r = sys_ipc_try_send(to_env, val, pg, perm))) 80002741: ff 75 14 pushl 0x14(%ebp) 80002744: 53 push %ebx 80002745: 56 push %esi 80002746: 57 push %edi 80002747: e8 53 f3 ff ff call 80001a9f <sys_ipc_try_send> { if(r == 0) 8000274c: 83 c4 10 add $0x10,%esp 8000274f: 85 c0 test %eax,%eax 80002751: 75 d2 jne 80002725 <ipc_send+0x1e> break; if(r != -E_IPC_NOT_RECV) panic("ipc_send : %e", r); sys_yield(); } } 80002753: 8d 65 f4 lea -0xc(%ebp),%esp 80002756: 5b pop %ebx 80002757: 5e pop %esi 80002758: 5f pop %edi 80002759: 5d pop %ebp 8000275a: c3 ret 8000275b <ipc_find_env>: // Find the first environment of the given type. We'll use this to // find special environments. // Returns 0 if no such environment exists. envid_t ipc_find_env(enum EnvType type) { 8000275b: 55 push %ebp 8000275c: 89 e5 mov %esp,%ebp 8000275e: 8b 4d 08 mov 0x8(%ebp),%ecx int i; for (i = 0; i < NENV; i++) if (envs[i].env_type == type) 80002761: a1 50 00 c0 ee mov 0xeec00050,%eax 80002766: 39 c1 cmp %eax,%ecx 80002768: 74 17 je 80002781 <ipc_find_env+0x26> 8000276a: b8 01 00 00 00 mov $0x1,%eax 8000276f: 6b d0 7c imul $0x7c,%eax,%edx 80002772: 81 c2 00 00 c0 ee add $0xeec00000,%edx 80002778: 8b 52 50 mov 0x50(%edx),%edx 8000277b: 39 ca cmp %ecx,%edx 8000277d: 75 14 jne 80002793 <ipc_find_env+0x38> 8000277f: eb 05 jmp 80002786 <ipc_find_env+0x2b> // Returns 0 if no such environment exists. envid_t ipc_find_env(enum EnvType type) { int i; for (i = 0; i < NENV; i++) 80002781: b8 00 00 00 00 mov $0x0,%eax if (envs[i].env_type == type) return envs[i].env_id; 80002786: 6b c0 7c imul $0x7c,%eax,%eax 80002789: 05 00 00 c0 ee add $0xeec00000,%eax 8000278e: 8b 40 48 mov 0x48(%eax),%eax 80002791: eb 0f jmp 800027a2 <ipc_find_env+0x47> // Returns 0 if no such environment exists. envid_t ipc_find_env(enum EnvType type) { int i; for (i = 0; i < NENV; i++) 80002793: 83 c0 01 add $0x1,%eax 80002796: 3d 00 04 00 00 cmp $0x400,%eax 8000279b: 75 d2 jne 8000276f <ipc_find_env+0x14> if (envs[i].env_type == type) return envs[i].env_id; return 0; 8000279d: b8 00 00 00 00 mov $0x0,%eax } 800027a2: 5d pop %ebp 800027a3: c3 ret 800027a4 <exit>: #include <syslib.h> void exit(void) { 800027a4: 55 push %ebp 800027a5: 89 e5 mov %esp,%ebp 800027a7: 83 ec 08 sub $0x8,%esp close_all(); 800027aa: e8 60 f5 ff ff call 80001d0f <close_all> sys_env_destroy(0); 800027af: 83 ec 0c sub $0xc,%esp 800027b2: 6a 00 push $0x0 800027b4: e8 da f0 ff ff call 80001893 <sys_env_destroy> } 800027b9: 83 c4 10 add $0x10,%esp 800027bc: c9 leave 800027bd: c3 ret 800027be <pageref>: #include <syslib.h> int pageref(void *v) { 800027be: 55 push %ebp 800027bf: 89 e5 mov %esp,%ebp 800027c1: 8b 55 08 mov 0x8(%ebp),%edx pte_t pte; if (!(uvpd[PDX(v)] & PTE_P)) 800027c4: 89 d0 mov %edx,%eax 800027c6: c1 e8 16 shr $0x16,%eax 800027c9: 8b 0c 85 00 d0 7b ef mov -0x10843000(,%eax,4),%ecx return 0; 800027d0: b8 00 00 00 00 mov $0x0,%eax int pageref(void *v) { pte_t pte; if (!(uvpd[PDX(v)] & PTE_P)) 800027d5: f6 c1 01 test $0x1,%cl 800027d8: 74 1d je 800027f7 <pageref+0x39> return 0; pte = uvpt[PGNUM(v)]; 800027da: c1 ea 0c shr $0xc,%edx 800027dd: 8b 14 95 00 00 40 ef mov -0x10c00000(,%edx,4),%edx // cprintf("pageref pte:0x%08x\n", pte); if (!(pte & PTE_P)) 800027e4: f6 c2 01 test $0x1,%dl 800027e7: 74 0e je 800027f7 <pageref+0x39> return 0; // cprintf("pageref 0x%08x: %d\n", v, pages[PGNUM(pte)].pp_ref); return pages[PGNUM(pte)].pp_ref; 800027e9: c1 ea 0c shr $0xc,%edx 800027ec: 0f b7 04 d5 04 00 00 movzwl -0x10fffffc(,%edx,8),%eax 800027f3: ef 800027f4: 0f b7 c0 movzwl %ax,%eax } 800027f7: 5d pop %ebp 800027f8: c3 ret 800027f9 <argstart>: #include <args.h> #include <string.h> void argstart(int *argc, char **argv, struct Argstate *args) { 800027f9: 55 push %ebp 800027fa: 89 e5 mov %esp,%ebp 800027fc: 8b 55 08 mov 0x8(%ebp),%edx 800027ff: 8b 4d 0c mov 0xc(%ebp),%ecx 80002802: 8b 45 10 mov 0x10(%ebp),%eax args->argc = argc; 80002805: 89 10 mov %edx,(%eax) args->argv = (const char **) argv; 80002807: 89 48 04 mov %ecx,0x4(%eax) args->curarg = (*argc > 1 && argv ? "" : 0); 8000280a: 83 3a 01 cmpl $0x1,(%edx) 8000280d: 7e 09 jle 80002818 <argstart+0x1f> 8000280f: ba 7c 33 00 80 mov $0x8000337c,%edx 80002814: 85 c9 test %ecx,%ecx 80002816: 75 05 jne 8000281d <argstart+0x24> 80002818: ba 00 00 00 00 mov $0x0,%edx 8000281d: 89 50 08 mov %edx,0x8(%eax) args->argvalue = 0; 80002820: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) } 80002827: 5d pop %ebp 80002828: c3 ret 80002829 <argnext>: int argnext(struct Argstate *args) { 80002829: 55 push %ebp 8000282a: 89 e5 mov %esp,%ebp 8000282c: 53 push %ebx 8000282d: 83 ec 04 sub $0x4,%esp 80002830: 8b 5d 08 mov 0x8(%ebp),%ebx int arg; args->argvalue = 0; 80002833: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) // Done processing arguments if args->curarg == 0 if (args->curarg == 0) 8000283a: 8b 43 08 mov 0x8(%ebx),%eax 8000283d: 85 c0 test %eax,%eax 8000283f: 74 6f je 800028b0 <argnext+0x87> return -1; if (!*args->curarg) { 80002841: 80 38 00 cmpb $0x0,(%eax) 80002844: 75 4e jne 80002894 <argnext+0x6b> // Need to process the next argument // Check for end of argument list if (*args->argc == 1 80002846: 8b 0b mov (%ebx),%ecx 80002848: 83 39 01 cmpl $0x1,(%ecx) 8000284b: 74 55 je 800028a2 <argnext+0x79> || args->argv[1][0] != '-' 8000284d: 8b 53 04 mov 0x4(%ebx),%edx 80002850: 8b 42 04 mov 0x4(%edx),%eax 80002853: 80 38 2d cmpb $0x2d,(%eax) 80002856: 75 4a jne 800028a2 <argnext+0x79> || args->argv[1][1] == '\0') 80002858: 80 78 01 00 cmpb $0x0,0x1(%eax) 8000285c: 74 44 je 800028a2 <argnext+0x79> goto endofargs; // Shift arguments down one args->curarg = args->argv[1] + 1; 8000285e: 83 c0 01 add $0x1,%eax 80002861: 89 43 08 mov %eax,0x8(%ebx) memmove(args->argv + 1, args->argv + 2, sizeof(const char *) * (*args->argc - 1)); 80002864: 83 ec 04 sub $0x4,%esp 80002867: 8b 01 mov (%ecx),%eax 80002869: 8d 04 85 fc ff ff ff lea -0x4(,%eax,4),%eax 80002870: 50 push %eax 80002871: 8d 42 08 lea 0x8(%edx),%eax 80002874: 50 push %eax 80002875: 83 c2 04 add $0x4,%edx 80002878: 52 push %edx 80002879: e8 a0 ed ff ff call 8000161e <memmove> (*args->argc)--; 8000287e: 8b 03 mov (%ebx),%eax 80002880: 83 28 01 subl $0x1,(%eax) // Check for "--": end of argument list if (args->curarg[0] == '-' && args->curarg[1] == '\0') 80002883: 8b 43 08 mov 0x8(%ebx),%eax 80002886: 83 c4 10 add $0x10,%esp 80002889: 80 38 2d cmpb $0x2d,(%eax) 8000288c: 75 06 jne 80002894 <argnext+0x6b> 8000288e: 80 78 01 00 cmpb $0x0,0x1(%eax) 80002892: 74 0e je 800028a2 <argnext+0x79> goto endofargs; } arg = (unsigned char) *args->curarg; 80002894: 8b 53 08 mov 0x8(%ebx),%edx 80002897: 0f b6 02 movzbl (%edx),%eax args->curarg++; 8000289a: 83 c2 01 add $0x1,%edx 8000289d: 89 53 08 mov %edx,0x8(%ebx) return arg; 800028a0: eb 13 jmp 800028b5 <argnext+0x8c> endofargs: args->curarg = 0; 800028a2: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) return -1; 800028a9: b8 ff ff ff ff mov $0xffffffff,%eax 800028ae: eb 05 jmp 800028b5 <argnext+0x8c> args->argvalue = 0; // Done processing arguments if args->curarg == 0 if (args->curarg == 0) return -1; 800028b0: b8 ff ff ff ff mov $0xffffffff,%eax return arg; endofargs: args->curarg = 0; return -1; } 800028b5: 8b 5d fc mov -0x4(%ebp),%ebx 800028b8: c9 leave 800028b9: c3 ret 800028ba <argnextvalue>: return (char*) (args->argvalue ? args->argvalue : argnextvalue(args)); } char * argnextvalue(struct Argstate *args) { 800028ba: 55 push %ebp 800028bb: 89 e5 mov %esp,%ebp 800028bd: 53 push %ebx 800028be: 83 ec 04 sub $0x4,%esp 800028c1: 8b 5d 08 mov 0x8(%ebp),%ebx if (!args->curarg) 800028c4: 8b 43 08 mov 0x8(%ebx),%eax 800028c7: 85 c0 test %eax,%eax 800028c9: 74 58 je 80002923 <argnextvalue+0x69> return 0; if (*args->curarg) { 800028cb: 80 38 00 cmpb $0x0,(%eax) 800028ce: 74 0c je 800028dc <argnextvalue+0x22> args->argvalue = args->curarg; 800028d0: 89 43 0c mov %eax,0xc(%ebx) args->curarg = ""; 800028d3: c7 43 08 7c 33 00 80 movl $0x8000337c,0x8(%ebx) 800028da: eb 42 jmp 8000291e <argnextvalue+0x64> } else if (*args->argc > 1) { 800028dc: 8b 13 mov (%ebx),%edx 800028de: 83 3a 01 cmpl $0x1,(%edx) 800028e1: 7e 2d jle 80002910 <argnextvalue+0x56> args->argvalue = args->argv[1]; 800028e3: 8b 43 04 mov 0x4(%ebx),%eax 800028e6: 8b 48 04 mov 0x4(%eax),%ecx 800028e9: 89 4b 0c mov %ecx,0xc(%ebx) memmove(args->argv + 1, args->argv + 2, sizeof(const char *) * (*args->argc - 1)); 800028ec: 83 ec 04 sub $0x4,%esp 800028ef: 8b 12 mov (%edx),%edx 800028f1: 8d 14 95 fc ff ff ff lea -0x4(,%edx,4),%edx 800028f8: 52 push %edx 800028f9: 8d 50 08 lea 0x8(%eax),%edx 800028fc: 52 push %edx 800028fd: 83 c0 04 add $0x4,%eax 80002900: 50 push %eax 80002901: e8 18 ed ff ff call 8000161e <memmove> (*args->argc)--; 80002906: 8b 03 mov (%ebx),%eax 80002908: 83 28 01 subl $0x1,(%eax) 8000290b: 83 c4 10 add $0x10,%esp 8000290e: eb 0e jmp 8000291e <argnextvalue+0x64> } else { args->argvalue = 0; 80002910: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) args->curarg = 0; 80002917: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) } return (char*) args->argvalue; 8000291e: 8b 43 0c mov 0xc(%ebx),%eax 80002921: eb 05 jmp 80002928 <argnextvalue+0x6e> char * argnextvalue(struct Argstate *args) { if (!args->curarg) return 0; 80002923: b8 00 00 00 00 mov $0x0,%eax } else { args->argvalue = 0; args->curarg = 0; } return (char*) args->argvalue; } 80002928: 8b 5d fc mov -0x4(%ebp),%ebx 8000292b: c9 leave 8000292c: c3 ret 8000292d <argvalue>: return -1; } char * argvalue(struct Argstate *args) { 8000292d: 55 push %ebp 8000292e: 89 e5 mov %esp,%ebp 80002930: 83 ec 08 sub $0x8,%esp 80002933: 8b 4d 08 mov 0x8(%ebp),%ecx return (char*) (args->argvalue ? args->argvalue : argnextvalue(args)); 80002936: 8b 51 0c mov 0xc(%ecx),%edx 80002939: 89 d0 mov %edx,%eax 8000293b: 85 d2 test %edx,%edx 8000293d: 75 0c jne 8000294b <argvalue+0x1e> 8000293f: 83 ec 0c sub $0xc,%esp 80002942: 51 push %ecx 80002943: e8 72 ff ff ff call 800028ba <argnextvalue> 80002948: 83 c4 10 add $0x10,%esp } 8000294b: c9 leave 8000294c: c3 ret 8000294d <getuint>: // Get an unsigned int of various possible sizes from a varargs list, // depending on the lflag parameter. static unsigned long long getuint(va_list *ap, int lflag) { 8000294d: 55 push %ebp 8000294e: 89 e5 mov %esp,%ebp if (lflag >= 2) 80002950: 83 fa 01 cmp $0x1,%edx 80002953: 7e 0e jle 80002963 <getuint+0x16> return va_arg(*ap, unsigned long long); 80002955: 8b 10 mov (%eax),%edx 80002957: 8d 4a 08 lea 0x8(%edx),%ecx 8000295a: 89 08 mov %ecx,(%eax) 8000295c: 8b 02 mov (%edx),%eax 8000295e: 8b 52 04 mov 0x4(%edx),%edx 80002961: eb 22 jmp 80002985 <getuint+0x38> else if (lflag) 80002963: 85 d2 test %edx,%edx 80002965: 74 10 je 80002977 <getuint+0x2a> return va_arg(*ap, unsigned long); 80002967: 8b 10 mov (%eax),%edx 80002969: 8d 4a 04 lea 0x4(%edx),%ecx 8000296c: 89 08 mov %ecx,(%eax) 8000296e: 8b 02 mov (%edx),%eax 80002970: ba 00 00 00 00 mov $0x0,%edx 80002975: eb 0e jmp 80002985 <getuint+0x38> else return va_arg(*ap, unsigned int); 80002977: 8b 10 mov (%eax),%edx 80002979: 8d 4a 04 lea 0x4(%edx),%ecx 8000297c: 89 08 mov %ecx,(%eax) 8000297e: 8b 02 mov (%edx),%eax 80002980: ba 00 00 00 00 mov $0x0,%edx } 80002985: 5d pop %ebp 80002986: c3 ret 80002987 <printnum>: } static void printnum(void (*putch)(int, void*), void *putdat, unsigned long num, unsigned base, int width, int padc) { 80002987: 55 push %ebp 80002988: 89 e5 mov %esp,%ebp 8000298a: 57 push %edi 8000298b: 56 push %esi 8000298c: 53 push %ebx 8000298d: 83 ec 1c sub $0x1c,%esp 80002990: 89 c7 mov %eax,%edi 80002992: 89 d6 mov %edx,%esi 80002994: 89 4d e4 mov %ecx,-0x1c(%ebp) // first recursively print all preceding (more significant) digits if (num >= base) { 80002997: 3b 4d 08 cmp 0x8(%ebp),%ecx 8000299a: 73 0c jae 800029a8 <printnum+0x21> printnum(putch, putdat, num / base, base, width - 1, padc); } else { // print any needed pad characters before first digit while (--width > 0) 8000299c: 8b 45 0c mov 0xc(%ebp),%eax 8000299f: 8d 58 ff lea -0x1(%eax),%ebx 800029a2: 85 db test %ebx,%ebx 800029a4: 7f 2d jg 800029d3 <printnum+0x4c> 800029a6: eb 3c jmp 800029e4 <printnum+0x5d> printnum(void (*putch)(int, void*), void *putdat, unsigned long num, unsigned base, int width, int padc) { // first recursively print all preceding (more significant) digits if (num >= base) { printnum(putch, putdat, num / base, base, width - 1, padc); 800029a8: 8b 45 e4 mov -0x1c(%ebp),%eax 800029ab: ba 00 00 00 00 mov $0x0,%edx 800029b0: f7 75 08 divl 0x8(%ebp) 800029b3: 89 c1 mov %eax,%ecx 800029b5: 83 ec 04 sub $0x4,%esp 800029b8: ff 75 10 pushl 0x10(%ebp) 800029bb: 8b 45 0c mov 0xc(%ebp),%eax 800029be: 8d 50 ff lea -0x1(%eax),%edx 800029c1: 52 push %edx 800029c2: ff 75 08 pushl 0x8(%ebp) 800029c5: 89 f2 mov %esi,%edx 800029c7: 89 f8 mov %edi,%eax 800029c9: e8 b9 ff ff ff call 80002987 <printnum> 800029ce: 83 c4 10 add $0x10,%esp 800029d1: eb 11 jmp 800029e4 <printnum+0x5d> } else { // print any needed pad characters before first digit while (--width > 0) putch(padc, putdat); 800029d3: 83 ec 08 sub $0x8,%esp 800029d6: 56 push %esi 800029d7: ff 75 10 pushl 0x10(%ebp) 800029da: ff d7 call *%edi // first recursively print all preceding (more significant) digits if (num >= base) { printnum(putch, putdat, num / base, base, width - 1, padc); } else { // print any needed pad characters before first digit while (--width > 0) 800029dc: 83 c4 10 add $0x10,%esp 800029df: 83 eb 01 sub $0x1,%ebx 800029e2: 75 ef jne 800029d3 <printnum+0x4c> putch(padc, putdat); } // then print this (the least significant) digit putch("0123456789abcdef"[num % base], putdat); 800029e4: 83 ec 08 sub $0x8,%esp 800029e7: 56 push %esi 800029e8: 8b 45 e4 mov -0x1c(%ebp),%eax 800029eb: ba 00 00 00 00 mov $0x0,%edx 800029f0: f7 75 08 divl 0x8(%ebp) 800029f3: 0f be 82 89 34 00 80 movsbl -0x7fffcb77(%edx),%eax 800029fa: 50 push %eax 800029fb: ff d7 call *%edi } 800029fd: 83 c4 10 add $0x10,%esp 80002a00: 8d 65 f4 lea -0xc(%ebp),%esp 80002a03: 5b pop %ebx 80002a04: 5e pop %esi 80002a05: 5f pop %edi 80002a06: 5d pop %ebp 80002a07: c3 ret 80002a08 <sprintputch>: int cnt; }; static void sprintputch(int ch, struct sprintbuf *b) { 80002a08: 55 push %ebp 80002a09: 89 e5 mov %esp,%ebp 80002a0b: 8b 45 0c mov 0xc(%ebp),%eax b->cnt++; 80002a0e: 83 40 08 01 addl $0x1,0x8(%eax) if (b->buf < b->ebuf) 80002a12: 8b 10 mov (%eax),%edx 80002a14: 3b 50 04 cmp 0x4(%eax),%edx 80002a17: 73 0a jae 80002a23 <sprintputch+0x1b> *b->buf++ = ch; 80002a19: 8d 4a 01 lea 0x1(%edx),%ecx 80002a1c: 89 08 mov %ecx,(%eax) 80002a1e: 8b 45 08 mov 0x8(%ebp),%eax 80002a21: 88 02 mov %al,(%edx) } 80002a23: 5d pop %ebp 80002a24: c3 ret 80002a25 <putch>: }; static void putch(int ch, struct printbuf *b) { 80002a25: 55 push %ebp 80002a26: 89 e5 mov %esp,%ebp 80002a28: 53 push %ebx 80002a29: 83 ec 04 sub $0x4,%esp 80002a2c: 8b 5d 0c mov 0xc(%ebp),%ebx b->buf[b->idx++] = ch; 80002a2f: 8b 13 mov (%ebx),%edx 80002a31: 8d 42 01 lea 0x1(%edx),%eax 80002a34: 89 03 mov %eax,(%ebx) 80002a36: 8b 4d 08 mov 0x8(%ebp),%ecx 80002a39: 88 4c 13 08 mov %cl,0x8(%ebx,%edx,1) if (b->idx == 256-1) { 80002a3d: 3d ff 00 00 00 cmp $0xff,%eax 80002a42: 75 1a jne 80002a5e <putch+0x39> sys_cputs(b->buf, b->idx); 80002a44: 83 ec 08 sub $0x8,%esp 80002a47: 68 ff 00 00 00 push $0xff 80002a4c: 8d 43 08 lea 0x8(%ebx),%eax 80002a4f: 50 push %eax 80002a50: e8 01 ee ff ff call 80001856 <sys_cputs> b->idx = 0; 80002a55: c7 03 00 00 00 00 movl $0x0,(%ebx) 80002a5b: 83 c4 10 add $0x10,%esp } b->cnt++; 80002a5e: 83 43 04 01 addl $0x1,0x4(%ebx) } 80002a62: 8b 5d fc mov -0x4(%ebp),%ebx 80002a65: c9 leave 80002a66: c3 ret 80002a67 <writebuf>: static void writebuf(struct fprintbuf *b) { if (b->error > 0) { 80002a67: 83 78 0c 00 cmpl $0x0,0xc(%eax) 80002a6b: 7e 37 jle 80002aa4 <writebuf+0x3d> }; static void writebuf(struct fprintbuf *b) { 80002a6d: 55 push %ebp 80002a6e: 89 e5 mov %esp,%ebp 80002a70: 53 push %ebx 80002a71: 83 ec 08 sub $0x8,%esp 80002a74: 89 c3 mov %eax,%ebx if (b->error > 0) { ssize_t result = write(b->fd, b->buf, b->idx); 80002a76: ff 70 04 pushl 0x4(%eax) 80002a79: 8d 40 10 lea 0x10(%eax),%eax 80002a7c: 50 push %eax 80002a7d: ff 33 pushl (%ebx) 80002a7f: e8 80 f4 ff ff call 80001f04 <write> if (result > 0) 80002a84: 83 c4 10 add $0x10,%esp 80002a87: 85 c0 test %eax,%eax 80002a89: 7e 03 jle 80002a8e <writebuf+0x27> b->result += result; 80002a8b: 01 43 08 add %eax,0x8(%ebx) if (result != b->idx) // error, or wrote less than supplied 80002a8e: 3b 43 04 cmp 0x4(%ebx),%eax 80002a91: 74 0d je 80002aa0 <writebuf+0x39> b->error = (result < 0 ? result : 0); 80002a93: 85 c0 test %eax,%eax 80002a95: ba 00 00 00 00 mov $0x0,%edx 80002a9a: 0f 4f c2 cmovg %edx,%eax 80002a9d: 89 43 0c mov %eax,0xc(%ebx) } } 80002aa0: 8b 5d fc mov -0x4(%ebp),%ebx 80002aa3: c9 leave 80002aa4: f3 c3 repz ret 80002aa6 <fputch>: static void fputch(int ch, void *thunk) { 80002aa6: 55 push %ebp 80002aa7: 89 e5 mov %esp,%ebp 80002aa9: 53 push %ebx 80002aaa: 83 ec 04 sub $0x4,%esp 80002aad: 8b 5d 0c mov 0xc(%ebp),%ebx struct fprintbuf *b = (struct fprintbuf *) thunk; b->buf[b->idx++] = ch; 80002ab0: 8b 53 04 mov 0x4(%ebx),%edx 80002ab3: 8d 42 01 lea 0x1(%edx),%eax 80002ab6: 89 43 04 mov %eax,0x4(%ebx) 80002ab9: 8b 4d 08 mov 0x8(%ebp),%ecx 80002abc: 88 4c 13 10 mov %cl,0x10(%ebx,%edx,1) if (b->idx == 256) { 80002ac0: 3d 00 01 00 00 cmp $0x100,%eax 80002ac5: 75 0e jne 80002ad5 <fputch+0x2f> writebuf(b); 80002ac7: 89 d8 mov %ebx,%eax 80002ac9: e8 99 ff ff ff call 80002a67 <writebuf> b->idx = 0; 80002ace: c7 43 04 00 00 00 00 movl $0x0,0x4(%ebx) } } 80002ad5: 83 c4 04 add $0x4,%esp 80002ad8: 5b pop %ebx 80002ad9: 5d pop %ebp 80002ada: c3 ret 80002adb <vprintfmt>: va_end(ap); } void vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) { 80002adb: 55 push %ebp 80002adc: 89 e5 mov %esp,%ebp 80002ade: 57 push %edi 80002adf: 56 push %esi 80002ae0: 53 push %ebx 80002ae1: 83 ec 2c sub $0x2c,%esp 80002ae4: 8b 7d 0c mov 0xc(%ebp),%edi 80002ae7: eb 03 jmp 80002aec <vprintfmt+0x11> break; // unrecognized escape sequence - just print it literally default: putch('%', putdat); for (fmt--; fmt[-1] != '%'; fmt--) 80002ae9: 89 75 10 mov %esi,0x10(%ebp) unsigned long long num; int base, lflag, width, precision, altflag; char padc; while (1) { while ((ch = *(unsigned char *) fmt++) != '%') { 80002aec: 8b 45 10 mov 0x10(%ebp),%eax 80002aef: 8d 70 01 lea 0x1(%eax),%esi 80002af2: 0f b6 00 movzbl (%eax),%eax 80002af5: 83 f8 25 cmp $0x25,%eax 80002af8: 74 2c je 80002b26 <vprintfmt+0x4b> if (ch == '\0') 80002afa: 85 c0 test %eax,%eax 80002afc: 75 0f jne 80002b0d <vprintfmt+0x32> 80002afe: e9 bb 03 00 00 jmp 80002ebe <vprintfmt+0x3e3> 80002b03: 85 c0 test %eax,%eax 80002b05: 0f 84 b3 03 00 00 je 80002ebe <vprintfmt+0x3e3> 80002b0b: eb 03 jmp 80002b10 <vprintfmt+0x35> 80002b0d: 8b 5d 08 mov 0x8(%ebp),%ebx return; putch(ch, putdat); 80002b10: 83 ec 08 sub $0x8,%esp 80002b13: 57 push %edi 80002b14: 50 push %eax 80002b15: ff d3 call *%ebx unsigned long long num; int base, lflag, width, precision, altflag; char padc; while (1) { while ((ch = *(unsigned char *) fmt++) != '%') { 80002b17: 83 c6 01 add $0x1,%esi 80002b1a: 0f b6 46 ff movzbl -0x1(%esi),%eax 80002b1e: 83 c4 10 add $0x10,%esp 80002b21: 83 f8 25 cmp $0x25,%eax 80002b24: 75 dd jne 80002b03 <vprintfmt+0x28> if (width < 0) width = 0; goto reswitch; case '#': altflag = 1; 80002b26: c6 45 e3 20 movb $0x20,-0x1d(%ebp) 80002b2a: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp) 80002b31: c7 45 d4 ff ff ff ff movl $0xffffffff,-0x2c(%ebp) 80002b38: c7 45 e4 ff ff ff ff movl $0xffffffff,-0x1c(%ebp) 80002b3f: ba 00 00 00 00 mov $0x0,%edx 80002b44: bb 00 00 00 00 mov $0x0,%ebx 80002b49: eb 07 jmp 80002b52 <vprintfmt+0x77> width = -1; precision = -1; lflag = 0; altflag = 0; reswitch: switch (ch = *(unsigned char *) fmt++) { 80002b4b: 8b 75 10 mov 0x10(%ebp),%esi // flag to pad on the right case '-': padc = '-'; 80002b4e: c6 45 e3 2d movb $0x2d,-0x1d(%ebp) width = -1; precision = -1; lflag = 0; altflag = 0; reswitch: switch (ch = *(unsigned char *) fmt++) { 80002b52: 8d 46 01 lea 0x1(%esi),%eax 80002b55: 89 45 10 mov %eax,0x10(%ebp) 80002b58: 0f b6 06 movzbl (%esi),%eax 80002b5b: 0f b6 c8 movzbl %al,%ecx 80002b5e: 83 e8 23 sub $0x23,%eax 80002b61: 3c 55 cmp $0x55,%al 80002b63: 0f 87 15 03 00 00 ja 80002e7e <vprintfmt+0x3a3> 80002b69: 0f b6 c0 movzbl %al,%eax 80002b6c: ff 24 85 00 36 00 80 jmp *-0x7fffca00(,%eax,4) 80002b73: 8b 75 10 mov 0x10(%ebp),%esi padc = '-'; goto reswitch; // flag to pad with 0's instead of spaces case '0': padc = '0'; 80002b76: c6 45 e3 30 movb $0x30,-0x1d(%ebp) 80002b7a: eb d6 jmp 80002b52 <vprintfmt+0x77> case '6': case '7': case '8': case '9': for (precision = 0; ; ++fmt) { precision = precision * 10 + ch - '0'; 80002b7c: 8d 41 d0 lea -0x30(%ecx),%eax 80002b7f: 89 45 d4 mov %eax,-0x2c(%ebp) ch = *fmt; 80002b82: 0f be 46 01 movsbl 0x1(%esi),%eax if (ch < '0' || ch > '9') 80002b86: 8d 48 d0 lea -0x30(%eax),%ecx 80002b89: 83 f9 09 cmp $0x9,%ecx 80002b8c: 77 5b ja 80002be9 <vprintfmt+0x10e> 80002b8e: 8b 75 10 mov 0x10(%ebp),%esi 80002b91: 89 55 d0 mov %edx,-0x30(%ebp) 80002b94: 8b 55 d4 mov -0x2c(%ebp),%edx case '5': case '6': case '7': case '8': case '9': for (precision = 0; ; ++fmt) { 80002b97: 83 c6 01 add $0x1,%esi precision = precision * 10 + ch - '0'; 80002b9a: 8d 14 92 lea (%edx,%edx,4),%edx 80002b9d: 8d 54 50 d0 lea -0x30(%eax,%edx,2),%edx ch = *fmt; 80002ba1: 0f be 06 movsbl (%esi),%eax if (ch < '0' || ch > '9') 80002ba4: 8d 48 d0 lea -0x30(%eax),%ecx 80002ba7: 83 f9 09 cmp $0x9,%ecx 80002baa: 76 eb jbe 80002b97 <vprintfmt+0xbc> 80002bac: 89 55 d4 mov %edx,-0x2c(%ebp) 80002baf: 8b 55 d0 mov -0x30(%ebp),%edx 80002bb2: eb 38 jmp 80002bec <vprintfmt+0x111> break; } goto process_precision; case '*': precision = va_arg(ap, int); 80002bb4: 8b 45 14 mov 0x14(%ebp),%eax 80002bb7: 8d 48 04 lea 0x4(%eax),%ecx 80002bba: 89 4d 14 mov %ecx,0x14(%ebp) 80002bbd: 8b 00 mov (%eax),%eax 80002bbf: 89 45 d4 mov %eax,-0x2c(%ebp) width = -1; precision = -1; lflag = 0; altflag = 0; reswitch: switch (ch = *(unsigned char *) fmt++) { 80002bc2: 8b 75 10 mov 0x10(%ebp),%esi } goto process_precision; case '*': precision = va_arg(ap, int); goto process_precision; 80002bc5: eb 25 jmp 80002bec <vprintfmt+0x111> 80002bc7: 8b 45 e4 mov -0x1c(%ebp),%eax 80002bca: 85 c0 test %eax,%eax 80002bcc: 0f 48 c3 cmovs %ebx,%eax 80002bcf: 89 45 e4 mov %eax,-0x1c(%ebp) width = -1; precision = -1; lflag = 0; altflag = 0; reswitch: switch (ch = *(unsigned char *) fmt++) { 80002bd2: 8b 75 10 mov 0x10(%ebp),%esi 80002bd5: e9 78 ff ff ff jmp 80002b52 <vprintfmt+0x77> 80002bda: 8b 75 10 mov 0x10(%ebp),%esi if (width < 0) width = 0; goto reswitch; case '#': altflag = 1; 80002bdd: c7 45 d8 01 00 00 00 movl $0x1,-0x28(%ebp) goto reswitch; 80002be4: e9 69 ff ff ff jmp 80002b52 <vprintfmt+0x77> width = -1; precision = -1; lflag = 0; altflag = 0; reswitch: switch (ch = *(unsigned char *) fmt++) { 80002be9: 8b 75 10 mov 0x10(%ebp),%esi case '#': altflag = 1; goto reswitch; process_precision: if (width < 0) 80002bec: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 80002bf0: 0f 89 5c ff ff ff jns 80002b52 <vprintfmt+0x77> width = precision, precision = -1; 80002bf6: 8b 45 d4 mov -0x2c(%ebp),%eax 80002bf9: 89 45 e4 mov %eax,-0x1c(%ebp) 80002bfc: c7 45 d4 ff ff ff ff movl $0xffffffff,-0x2c(%ebp) 80002c03: e9 4a ff ff ff jmp 80002b52 <vprintfmt+0x77> goto reswitch; // long flag (doubled for long long) case 'l': lflag++; 80002c08: 83 c2 01 add $0x1,%edx width = -1; precision = -1; lflag = 0; altflag = 0; reswitch: switch (ch = *(unsigned char *) fmt++) { 80002c0b: 8b 75 10 mov 0x10(%ebp),%esi goto reswitch; // long flag (doubled for long long) case 'l': lflag++; goto reswitch; 80002c0e: e9 3f ff ff ff jmp 80002b52 <vprintfmt+0x77> // character case 'c': putch(va_arg(ap, int), putdat); 80002c13: 8b 45 14 mov 0x14(%ebp),%eax 80002c16: 8d 50 04 lea 0x4(%eax),%edx 80002c19: 89 55 14 mov %edx,0x14(%ebp) 80002c1c: 83 ec 08 sub $0x8,%esp 80002c1f: 57 push %edi 80002c20: ff 30 pushl (%eax) 80002c22: ff 55 08 call *0x8(%ebp) break; 80002c25: 83 c4 10 add $0x10,%esp 80002c28: e9 bf fe ff ff jmp 80002aec <vprintfmt+0x11> // error message case 'e': err = va_arg(ap, int); 80002c2d: 8b 45 14 mov 0x14(%ebp),%eax 80002c30: 8d 50 04 lea 0x4(%eax),%edx 80002c33: 89 55 14 mov %edx,0x14(%ebp) 80002c36: 8b 00 mov (%eax),%eax 80002c38: 99 cltd 80002c39: 31 d0 xor %edx,%eax 80002c3b: 29 d0 sub %edx,%eax if (err < 0) err = -err; if (err >= MAXERROR || (p = error_string[err]) == NULL) 80002c3d: 83 f8 11 cmp $0x11,%eax 80002c40: 7f 0b jg 80002c4d <vprintfmt+0x172> 80002c42: 8b 14 85 60 37 00 80 mov -0x7fffc8a0(,%eax,4),%edx 80002c49: 85 d2 test %edx,%edx 80002c4b: 75 17 jne 80002c64 <vprintfmt+0x189> printfmt(putch, putdat, "error %d", err); 80002c4d: 50 push %eax 80002c4e: 68 a1 34 00 80 push $0x800034a1 80002c53: 57 push %edi 80002c54: ff 75 08 pushl 0x8(%ebp) 80002c57: e8 6b 03 00 00 call 80002fc7 <printfmt> 80002c5c: 83 c4 10 add $0x10,%esp 80002c5f: e9 88 fe ff ff jmp 80002aec <vprintfmt+0x11> else printfmt(putch, putdat, "%s", p); 80002c64: 52 push %edx 80002c65: 68 65 33 00 80 push $0x80003365 80002c6a: 57 push %edi 80002c6b: ff 75 08 pushl 0x8(%ebp) 80002c6e: e8 54 03 00 00 call 80002fc7 <printfmt> 80002c73: 83 c4 10 add $0x10,%esp 80002c76: e9 71 fe ff ff jmp 80002aec <vprintfmt+0x11> break; // string case 's': if ((p = va_arg(ap, char *)) == NULL) 80002c7b: 8b 45 14 mov 0x14(%ebp),%eax 80002c7e: 8d 50 04 lea 0x4(%eax),%edx 80002c81: 89 55 14 mov %edx,0x14(%ebp) 80002c84: 8b 00 mov (%eax),%eax p = "(null)"; 80002c86: 85 c0 test %eax,%eax 80002c88: b9 9a 34 00 80 mov $0x8000349a,%ecx 80002c8d: 0f 45 c8 cmovne %eax,%ecx 80002c90: 89 4d d0 mov %ecx,-0x30(%ebp) if (width > 0 && padc != '-') 80002c93: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 80002c97: 7e 06 jle 80002c9f <vprintfmt+0x1c4> 80002c99: 80 7d e3 2d cmpb $0x2d,-0x1d(%ebp) 80002c9d: 75 19 jne 80002cb8 <vprintfmt+0x1dd> for (width -= strnlen(p, precision); width > 0; width--) putch(padc, putdat); for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--) 80002c9f: 8b 45 d0 mov -0x30(%ebp),%eax 80002ca2: 8d 70 01 lea 0x1(%eax),%esi 80002ca5: 0f b6 00 movzbl (%eax),%eax 80002ca8: 0f be d0 movsbl %al,%edx 80002cab: 85 d2 test %edx,%edx 80002cad: 0f 85 92 00 00 00 jne 80002d45 <vprintfmt+0x26a> 80002cb3: e9 82 00 00 00 jmp 80002d3a <vprintfmt+0x25f> // string case 's': if ((p = va_arg(ap, char *)) == NULL) p = "(null)"; if (width > 0 && padc != '-') for (width -= strnlen(p, precision); width > 0; width--) 80002cb8: 83 ec 08 sub $0x8,%esp 80002cbb: ff 75 d4 pushl -0x2c(%ebp) 80002cbe: ff 75 d0 pushl -0x30(%ebp) 80002cc1: e8 30 e7 ff ff call 800013f6 <strnlen> 80002cc6: 29 45 e4 sub %eax,-0x1c(%ebp) 80002cc9: 8b 4d e4 mov -0x1c(%ebp),%ecx 80002ccc: 83 c4 10 add $0x10,%esp 80002ccf: 85 c9 test %ecx,%ecx 80002cd1: 0f 8e ce 01 00 00 jle 80002ea5 <vprintfmt+0x3ca> putch(padc, putdat); 80002cd7: 0f be 75 e3 movsbl -0x1d(%ebp),%esi 80002cdb: 89 cb mov %ecx,%ebx 80002cdd: 83 ec 08 sub $0x8,%esp 80002ce0: 57 push %edi 80002ce1: 56 push %esi 80002ce2: ff 55 08 call *0x8(%ebp) // string case 's': if ((p = va_arg(ap, char *)) == NULL) p = "(null)"; if (width > 0 && padc != '-') for (width -= strnlen(p, precision); width > 0; width--) 80002ce5: 83 c4 10 add $0x10,%esp 80002ce8: 83 eb 01 sub $0x1,%ebx 80002ceb: 75 f0 jne 80002cdd <vprintfmt+0x202> 80002ced: 89 5d e4 mov %ebx,-0x1c(%ebp) 80002cf0: e9 b0 01 00 00 jmp 80002ea5 <vprintfmt+0x3ca> putch(padc, putdat); for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--) if (altflag && (ch < ' ' || ch > '~')) 80002cf5: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 80002cf9: 74 1b je 80002d16 <vprintfmt+0x23b> 80002cfb: 0f be c0 movsbl %al,%eax 80002cfe: 83 e8 20 sub $0x20,%eax 80002d01: 83 f8 5e cmp $0x5e,%eax 80002d04: 76 10 jbe 80002d16 <vprintfmt+0x23b> putch('?', putdat); 80002d06: 83 ec 08 sub $0x8,%esp 80002d09: ff 75 0c pushl 0xc(%ebp) 80002d0c: 6a 3f push $0x3f 80002d0e: ff 55 08 call *0x8(%ebp) 80002d11: 83 c4 10 add $0x10,%esp 80002d14: eb 0d jmp 80002d23 <vprintfmt+0x248> else putch(ch, putdat); 80002d16: 83 ec 08 sub $0x8,%esp 80002d19: ff 75 0c pushl 0xc(%ebp) 80002d1c: 52 push %edx 80002d1d: ff 55 08 call *0x8(%ebp) 80002d20: 83 c4 10 add $0x10,%esp if ((p = va_arg(ap, char *)) == NULL) p = "(null)"; if (width > 0 && padc != '-') for (width -= strnlen(p, precision); width > 0; width--) putch(padc, putdat); for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--) 80002d23: 83 ef 01 sub $0x1,%edi 80002d26: 83 c6 01 add $0x1,%esi 80002d29: 0f b6 46 ff movzbl -0x1(%esi),%eax 80002d2d: 0f be d0 movsbl %al,%edx 80002d30: 85 d2 test %edx,%edx 80002d32: 75 25 jne 80002d59 <vprintfmt+0x27e> 80002d34: 89 7d e4 mov %edi,-0x1c(%ebp) 80002d37: 8b 7d 0c mov 0xc(%ebp),%edi if (altflag && (ch < ' ' || ch > '~')) putch('?', putdat); else putch(ch, putdat); for (; width > 0; width--) 80002d3a: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 80002d3e: 7f 2a jg 80002d6a <vprintfmt+0x28f> 80002d40: e9 a7 fd ff ff jmp 80002aec <vprintfmt+0x11> 80002d45: 8b 5d d4 mov -0x2c(%ebp),%ebx 80002d48: 89 7d 0c mov %edi,0xc(%ebp) 80002d4b: 8b 7d e4 mov -0x1c(%ebp),%edi 80002d4e: eb 09 jmp 80002d59 <vprintfmt+0x27e> 80002d50: 8b 5d d4 mov -0x2c(%ebp),%ebx 80002d53: 89 7d 0c mov %edi,0xc(%ebp) 80002d56: 8b 7d e4 mov -0x1c(%ebp),%edi if ((p = va_arg(ap, char *)) == NULL) p = "(null)"; if (width > 0 && padc != '-') for (width -= strnlen(p, precision); width > 0; width--) putch(padc, putdat); for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--) 80002d59: 85 db test %ebx,%ebx 80002d5b: 78 98 js 80002cf5 <vprintfmt+0x21a> 80002d5d: 83 eb 01 sub $0x1,%ebx 80002d60: 79 93 jns 80002cf5 <vprintfmt+0x21a> 80002d62: 89 7d e4 mov %edi,-0x1c(%ebp) 80002d65: 8b 7d 0c mov 0xc(%ebp),%edi 80002d68: eb d0 jmp 80002d3a <vprintfmt+0x25f> 80002d6a: 8b 5d e4 mov -0x1c(%ebp),%ebx 80002d6d: 8b 75 08 mov 0x8(%ebp),%esi if (altflag && (ch < ' ' || ch > '~')) putch('?', putdat); else putch(ch, putdat); for (; width > 0; width--) putch(' ', putdat); 80002d70: 83 ec 08 sub $0x8,%esp 80002d73: 57 push %edi 80002d74: 6a 20 push $0x20 80002d76: ff d6 call *%esi for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--) if (altflag && (ch < ' ' || ch > '~')) putch('?', putdat); else putch(ch, putdat); for (; width > 0; width--) 80002d78: 83 c4 10 add $0x10,%esp 80002d7b: 83 eb 01 sub $0x1,%ebx 80002d7e: 75 f0 jne 80002d70 <vprintfmt+0x295> 80002d80: e9 67 fd ff ff jmp 80002aec <vprintfmt+0x11> // Same as getuint but signed - can't use getuint // because of sign extension static long long getint(va_list *ap, int lflag) { if (lflag >= 2) 80002d85: 83 fa 01 cmp $0x1,%edx 80002d88: 7e 16 jle 80002da0 <vprintfmt+0x2c5> return va_arg(*ap, long long); 80002d8a: 8b 45 14 mov 0x14(%ebp),%eax 80002d8d: 8d 50 08 lea 0x8(%eax),%edx 80002d90: 89 55 14 mov %edx,0x14(%ebp) 80002d93: 8b 50 04 mov 0x4(%eax),%edx 80002d96: 8b 00 mov (%eax),%eax 80002d98: 89 45 d8 mov %eax,-0x28(%ebp) 80002d9b: 89 55 dc mov %edx,-0x24(%ebp) 80002d9e: eb 32 jmp 80002dd2 <vprintfmt+0x2f7> else if (lflag) 80002da0: 85 d2 test %edx,%edx 80002da2: 74 18 je 80002dbc <vprintfmt+0x2e1> return va_arg(*ap, long); 80002da4: 8b 45 14 mov 0x14(%ebp),%eax 80002da7: 8d 50 04 lea 0x4(%eax),%edx 80002daa: 89 55 14 mov %edx,0x14(%ebp) 80002dad: 8b 30 mov (%eax),%esi 80002daf: 89 75 d8 mov %esi,-0x28(%ebp) 80002db2: 89 f0 mov %esi,%eax 80002db4: c1 f8 1f sar $0x1f,%eax 80002db7: 89 45 dc mov %eax,-0x24(%ebp) 80002dba: eb 16 jmp 80002dd2 <vprintfmt+0x2f7> else return va_arg(*ap, int); 80002dbc: 8b 45 14 mov 0x14(%ebp),%eax 80002dbf: 8d 50 04 lea 0x4(%eax),%edx 80002dc2: 89 55 14 mov %edx,0x14(%ebp) 80002dc5: 8b 30 mov (%eax),%esi 80002dc7: 89 75 d8 mov %esi,-0x28(%ebp) 80002dca: 89 f0 mov %esi,%eax 80002dcc: c1 f8 1f sar $0x1f,%eax 80002dcf: 89 45 dc mov %eax,-0x24(%ebp) putch(' ', putdat); break; // (signed) decimal case 'd': num = getint(&ap, lflag); 80002dd2: 8b 4d d8 mov -0x28(%ebp),%ecx if ((long long) num < 0) { putch('-', putdat); num = -(long long) num; } base = 10; 80002dd5: b8 0a 00 00 00 mov $0xa,%eax break; // (signed) decimal case 'd': num = getint(&ap, lflag); if ((long long) num < 0) { 80002dda: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) 80002dde: 79 70 jns 80002e50 <vprintfmt+0x375> putch('-', putdat); 80002de0: 83 ec 08 sub $0x8,%esp 80002de3: 57 push %edi 80002de4: 6a 2d push $0x2d 80002de6: ff 55 08 call *0x8(%ebp) num = -(long long) num; 80002de9: 8b 4d d8 mov -0x28(%ebp),%ecx 80002dec: f7 d9 neg %ecx 80002dee: 83 c4 10 add $0x10,%esp } base = 10; 80002df1: b8 0a 00 00 00 mov $0xa,%eax 80002df6: eb 58 jmp 80002e50 <vprintfmt+0x375> goto number; // unsigned decimal case 'u': num = getuint(&ap, lflag); 80002df8: 8d 45 14 lea 0x14(%ebp),%eax 80002dfb: e8 4d fb ff ff call 8000294d <getuint> 80002e00: 89 c1 mov %eax,%ecx base = 10; 80002e02: b8 0a 00 00 00 mov $0xa,%eax goto number; 80002e07: eb 47 jmp 80002e50 <vprintfmt+0x375> // (unsigned) octal case 'o': // Replace this with your code. num = getuint(&ap, lflag); 80002e09: 8d 45 14 lea 0x14(%ebp),%eax 80002e0c: e8 3c fb ff ff call 8000294d <getuint> 80002e11: 89 c1 mov %eax,%ecx base = 8; 80002e13: b8 08 00 00 00 mov $0x8,%eax goto number; 80002e18: eb 36 jmp 80002e50 <vprintfmt+0x375> // pointer case 'p': putch('0', putdat); 80002e1a: 83 ec 08 sub $0x8,%esp 80002e1d: 57 push %edi 80002e1e: 6a 30 push $0x30 80002e20: ff 55 08 call *0x8(%ebp) putch('x', putdat); 80002e23: 83 c4 08 add $0x8,%esp 80002e26: 57 push %edi 80002e27: 6a 78 push $0x78 80002e29: ff 55 08 call *0x8(%ebp) num = (unsigned long long) (uintptr_t) va_arg(ap, void *); 80002e2c: 8b 45 14 mov 0x14(%ebp),%eax 80002e2f: 8d 50 04 lea 0x4(%eax),%edx 80002e32: 89 55 14 mov %edx,0x14(%ebp) // pointer case 'p': putch('0', putdat); putch('x', putdat); num = (unsigned long long) 80002e35: 8b 08 mov (%eax),%ecx (uintptr_t) va_arg(ap, void *); base = 16; goto number; 80002e37: 83 c4 10 add $0x10,%esp case 'p': putch('0', putdat); putch('x', putdat); num = (unsigned long long) (uintptr_t) va_arg(ap, void *); base = 16; 80002e3a: b8 10 00 00 00 mov $0x10,%eax goto number; 80002e3f: eb 0f jmp 80002e50 <vprintfmt+0x375> // (unsigned) hexadecimal case 'x': num = getuint(&ap, lflag); 80002e41: 8d 45 14 lea 0x14(%ebp),%eax 80002e44: e8 04 fb ff ff call 8000294d <getuint> 80002e49: 89 c1 mov %eax,%ecx base = 16; 80002e4b: b8 10 00 00 00 mov $0x10,%eax number: printnum(putch, putdat, num, base, width, padc); 80002e50: 83 ec 04 sub $0x4,%esp 80002e53: 0f be 75 e3 movsbl -0x1d(%ebp),%esi 80002e57: 56 push %esi 80002e58: ff 75 e4 pushl -0x1c(%ebp) 80002e5b: 50 push %eax 80002e5c: 89 fa mov %edi,%edx 80002e5e: 8b 45 08 mov 0x8(%ebp),%eax 80002e61: e8 21 fb ff ff call 80002987 <printnum> break; 80002e66: 83 c4 10 add $0x10,%esp 80002e69: e9 7e fc ff ff jmp 80002aec <vprintfmt+0x11> // escaped '%' character case '%': putch(ch, putdat); 80002e6e: 83 ec 08 sub $0x8,%esp 80002e71: 57 push %edi 80002e72: 51 push %ecx 80002e73: ff 55 08 call *0x8(%ebp) break; 80002e76: 83 c4 10 add $0x10,%esp 80002e79: e9 6e fc ff ff jmp 80002aec <vprintfmt+0x11> // unrecognized escape sequence - just print it literally default: putch('%', putdat); 80002e7e: 83 ec 08 sub $0x8,%esp 80002e81: 57 push %edi 80002e82: 6a 25 push $0x25 80002e84: ff 55 08 call *0x8(%ebp) for (fmt--; fmt[-1] != '%'; fmt--) 80002e87: 83 c4 10 add $0x10,%esp 80002e8a: 80 7e ff 25 cmpb $0x25,-0x1(%esi) 80002e8e: 0f 84 55 fc ff ff je 80002ae9 <vprintfmt+0xe> 80002e94: 83 ee 01 sub $0x1,%esi 80002e97: 80 7e ff 25 cmpb $0x25,-0x1(%esi) 80002e9b: 75 f7 jne 80002e94 <vprintfmt+0x3b9> 80002e9d: 89 75 10 mov %esi,0x10(%ebp) 80002ea0: e9 47 fc ff ff jmp 80002aec <vprintfmt+0x11> if ((p = va_arg(ap, char *)) == NULL) p = "(null)"; if (width > 0 && padc != '-') for (width -= strnlen(p, precision); width > 0; width--) putch(padc, putdat); for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--) 80002ea5: 8b 45 d0 mov -0x30(%ebp),%eax 80002ea8: 8d 70 01 lea 0x1(%eax),%esi 80002eab: 0f b6 00 movzbl (%eax),%eax 80002eae: 0f be d0 movsbl %al,%edx 80002eb1: 85 d2 test %edx,%edx 80002eb3: 0f 85 97 fe ff ff jne 80002d50 <vprintfmt+0x275> 80002eb9: e9 2e fc ff ff jmp 80002aec <vprintfmt+0x11> for (fmt--; fmt[-1] != '%'; fmt--) /* do nothing */; break; } } } 80002ebe: 8d 65 f4 lea -0xc(%ebp),%esp 80002ec1: 5b pop %ebx 80002ec2: 5e pop %esi 80002ec3: 5f pop %edi 80002ec4: 5d pop %ebp 80002ec5: c3 ret 80002ec6 <vcprintf>: b->cnt++; } int vcprintf(const char *fmt, va_list ap) { 80002ec6: 55 push %ebp 80002ec7: 89 e5 mov %esp,%ebp 80002ec9: 81 ec 18 01 00 00 sub $0x118,%esp struct printbuf b; b.idx = 0; 80002ecf: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 80002ed6: 00 00 00 b.cnt = 0; 80002ed9: c7 85 f4 fe ff ff 00 movl $0x0,-0x10c(%ebp) 80002ee0: 00 00 00 vprintfmt((void*)putch, &b, fmt, ap); 80002ee3: ff 75 0c pushl 0xc(%ebp) 80002ee6: ff 75 08 pushl 0x8(%ebp) 80002ee9: 8d 85 f0 fe ff ff lea -0x110(%ebp),%eax 80002eef: 50 push %eax 80002ef0: 68 25 2a 00 80 push $0x80002a25 80002ef5: e8 e1 fb ff ff call 80002adb <vprintfmt> sys_cputs(b.buf, b.idx); 80002efa: 83 c4 08 add $0x8,%esp 80002efd: ff b5 f0 fe ff ff pushl -0x110(%ebp) 80002f03: 8d 85 f8 fe ff ff lea -0x108(%ebp),%eax 80002f09: 50 push %eax 80002f0a: e8 47 e9 ff ff call 80001856 <sys_cputs> return b.cnt; } 80002f0f: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax 80002f15: c9 leave 80002f16: c3 ret 80002f17 <cprintf>: int cprintf(const char *fmt, ...) { 80002f17: 55 push %ebp 80002f18: 89 e5 mov %esp,%ebp 80002f1a: 83 ec 10 sub $0x10,%esp va_list ap; int cnt; va_start(ap, fmt); 80002f1d: 8d 45 0c lea 0xc(%ebp),%eax cnt = vcprintf(fmt, ap); 80002f20: 50 push %eax 80002f21: ff 75 08 pushl 0x8(%ebp) 80002f24: e8 9d ff ff ff call 80002ec6 <vcprintf> va_end(ap); return cnt; } 80002f29: c9 leave 80002f2a: c3 ret 80002f2b <vfprintf>: } } int vfprintf(int fd, const char *fmt, va_list ap) { 80002f2b: 55 push %ebp 80002f2c: 89 e5 mov %esp,%ebp 80002f2e: 81 ec 18 01 00 00 sub $0x118,%esp struct fprintbuf b; b.fd = fd; 80002f34: 8b 45 08 mov 0x8(%ebp),%eax 80002f37: 89 85 e8 fe ff ff mov %eax,-0x118(%ebp) b.idx = 0; 80002f3d: c7 85 ec fe ff ff 00 movl $0x0,-0x114(%ebp) 80002f44: 00 00 00 b.result = 0; 80002f47: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 80002f4e: 00 00 00 b.error = 1; 80002f51: c7 85 f4 fe ff ff 01 movl $0x1,-0x10c(%ebp) 80002f58: 00 00 00 vprintfmt(fputch, &b, fmt, ap); 80002f5b: ff 75 10 pushl 0x10(%ebp) 80002f5e: ff 75 0c pushl 0xc(%ebp) 80002f61: 8d 85 e8 fe ff ff lea -0x118(%ebp),%eax 80002f67: 50 push %eax 80002f68: 68 a6 2a 00 80 push $0x80002aa6 80002f6d: e8 69 fb ff ff call 80002adb <vprintfmt> if (b.idx > 0) 80002f72: 83 c4 10 add $0x10,%esp 80002f75: 83 bd ec fe ff ff 00 cmpl $0x0,-0x114(%ebp) 80002f7c: 7e 0b jle 80002f89 <vfprintf+0x5e> writebuf(&b); 80002f7e: 8d 85 e8 fe ff ff lea -0x118(%ebp),%eax 80002f84: e8 de fa ff ff call 80002a67 <writebuf> return (b.result ? b.result : b.error); 80002f89: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax 80002f8f: 85 c0 test %eax,%eax 80002f91: 0f 44 85 f4 fe ff ff cmove -0x10c(%ebp),%eax } 80002f98: c9 leave 80002f99: c3 ret 80002f9a <fprintf>: int fprintf(int fd, const char *fmt, ...) { 80002f9a: 55 push %ebp 80002f9b: 89 e5 mov %esp,%ebp 80002f9d: 83 ec 0c sub $0xc,%esp va_list ap; int cnt; va_start(ap, fmt); 80002fa0: 8d 45 10 lea 0x10(%ebp),%eax cnt = vfprintf(fd, fmt, ap); 80002fa3: 50 push %eax 80002fa4: ff 75 0c pushl 0xc(%ebp) 80002fa7: ff 75 08 pushl 0x8(%ebp) 80002faa: e8 7c ff ff ff call 80002f2b <vfprintf> va_end(ap); return cnt; } 80002faf: c9 leave 80002fb0: c3 ret 80002fb1 <printf>: int printf(const char *fmt, ...) { 80002fb1: 55 push %ebp 80002fb2: 89 e5 mov %esp,%ebp 80002fb4: 83 ec 0c sub $0xc,%esp va_list ap; int cnt; va_start(ap, fmt); 80002fb7: 8d 45 0c lea 0xc(%ebp),%eax cnt = vfprintf(1, fmt, ap); 80002fba: 50 push %eax 80002fbb: ff 75 08 pushl 0x8(%ebp) 80002fbe: 6a 01 push $0x1 80002fc0: e8 66 ff ff ff call 80002f2b <vfprintf> va_end(ap); return cnt; } 80002fc5: c9 leave 80002fc6: c3 ret 80002fc7 <printfmt>: putch("0123456789abcdef"[num % base], putdat); } void printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) { 80002fc7: 55 push %ebp 80002fc8: 89 e5 mov %esp,%ebp 80002fca: 83 ec 08 sub $0x8,%esp va_list ap; va_start(ap, fmt); 80002fcd: 8d 45 14 lea 0x14(%ebp),%eax vprintfmt(putch, putdat, fmt, ap); 80002fd0: 50 push %eax 80002fd1: ff 75 10 pushl 0x10(%ebp) 80002fd4: ff 75 0c pushl 0xc(%ebp) 80002fd7: ff 75 08 pushl 0x8(%ebp) 80002fda: e8 fc fa ff ff call 80002adb <vprintfmt> va_end(ap); } 80002fdf: 83 c4 10 add $0x10,%esp 80002fe2: c9 leave 80002fe3: c3 ret 80002fe4 <vsnprintf>: *b->buf++ = ch; } int vsnprintf(char *buf, int n, const char *fmt, va_list ap) { 80002fe4: 55 push %ebp 80002fe5: 89 e5 mov %esp,%ebp 80002fe7: 83 ec 18 sub $0x18,%esp 80002fea: 8b 45 08 mov 0x8(%ebp),%eax 80002fed: 8b 55 0c mov 0xc(%ebp),%edx struct sprintbuf b = {buf, buf+n-1, 0}; 80002ff0: 89 45 ec mov %eax,-0x14(%ebp) 80002ff3: 8d 4c 10 ff lea -0x1(%eax,%edx,1),%ecx 80002ff7: 89 4d f0 mov %ecx,-0x10(%ebp) 80002ffa: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if (buf == NULL || n < 1) 80003001: 85 c0 test %eax,%eax 80003003: 74 26 je 8000302b <vsnprintf+0x47> 80003005: 85 d2 test %edx,%edx 80003007: 7e 22 jle 8000302b <vsnprintf+0x47> return -E_INVAL; // print the string to the buffer vprintfmt((void*)sprintputch, &b, fmt, ap); 80003009: ff 75 14 pushl 0x14(%ebp) 8000300c: ff 75 10 pushl 0x10(%ebp) 8000300f: 8d 45 ec lea -0x14(%ebp),%eax 80003012: 50 push %eax 80003013: 68 08 2a 00 80 push $0x80002a08 80003018: e8 be fa ff ff call 80002adb <vprintfmt> // null terminate the buffer *b.buf = '\0'; 8000301d: 8b 45 ec mov -0x14(%ebp),%eax 80003020: c6 00 00 movb $0x0,(%eax) return b.cnt; 80003023: 8b 45 f4 mov -0xc(%ebp),%eax 80003026: 83 c4 10 add $0x10,%esp 80003029: eb 05 jmp 80003030 <vsnprintf+0x4c> vsnprintf(char *buf, int n, const char *fmt, va_list ap) { struct sprintbuf b = {buf, buf+n-1, 0}; if (buf == NULL || n < 1) return -E_INVAL; 8000302b: b8 fd ff ff ff mov $0xfffffffd,%eax // null terminate the buffer *b.buf = '\0'; return b.cnt; } 80003030: c9 leave 80003031: c3 ret 80003032 <snprintf>: int snprintf(char *buf, int n, const char *fmt, ...) { 80003032: 55 push %ebp 80003033: 89 e5 mov %esp,%ebp 80003035: 83 ec 08 sub $0x8,%esp va_list ap; int rc; va_start(ap, fmt); 80003038: 8d 45 14 lea 0x14(%ebp),%eax rc = vsnprintf(buf, n, fmt, ap); 8000303b: 50 push %eax 8000303c: ff 75 10 pushl 0x10(%ebp) 8000303f: ff 75 0c pushl 0xc(%ebp) 80003042: ff 75 08 pushl 0x8(%ebp) 80003045: e8 9a ff ff ff call 80002fe4 <vsnprintf> va_end(ap); return rc; } 8000304a: c9 leave 8000304b: c3 ret 8000304c <readline>: #define BUFLEN 1024 static char buf[BUFLEN]; char * readline(const char *prompt) { 8000304c: 55 push %ebp 8000304d: 89 e5 mov %esp,%ebp 8000304f: 57 push %edi 80003050: 56 push %esi 80003051: 53 push %ebx 80003052: 83 ec 0c sub $0xc,%esp 80003055: 8b 45 08 mov 0x8(%ebp),%eax #ifndef __FOR_USER__ if (prompt != NULL) cprintf("%s", prompt); #else if (prompt != NULL) 80003058: 85 c0 test %eax,%eax 8000305a: 74 13 je 8000306f <readline+0x23> fprintf(1, "%s", prompt); 8000305c: 83 ec 04 sub $0x4,%esp 8000305f: 50 push %eax 80003060: 68 65 33 00 80 push $0x80003365 80003065: 6a 01 push $0x1 80003067: e8 2e ff ff ff call 80002f9a <fprintf> 8000306c: 83 c4 10 add $0x10,%esp #endif i = 0; echoing = iscons(0); 8000306f: 83 ec 0c sub $0xc,%esp 80003072: 6a 00 push $0x0 80003074: e8 1b 02 00 00 call 80003294 <iscons> 80003079: 89 c7 mov %eax,%edi 8000307b: 83 c4 10 add $0x10,%esp #else if (prompt != NULL) fprintf(1, "%s", prompt); #endif i = 0; 8000307e: be 00 00 00 00 mov $0x0,%esi echoing = iscons(0); while (1) { c = getchar(); 80003083: e8 e1 01 00 00 call 80003269 <getchar> 80003088: 89 c3 mov %eax,%ebx if (c < 0) { 8000308a: 85 c0 test %eax,%eax 8000308c: 79 29 jns 800030b7 <readline+0x6b> if (c != -E_EOF) cprintf("read error: %e\n", c); return NULL; 8000308e: b8 00 00 00 00 mov $0x0,%eax i = 0; echoing = iscons(0); while (1) { c = getchar(); if (c < 0) { if (c != -E_EOF) 80003093: 83 fb f8 cmp $0xfffffff8,%ebx 80003096: 0f 84 9b 00 00 00 je 80003137 <readline+0xeb> cprintf("read error: %e\n", c); 8000309c: 83 ec 08 sub $0x8,%esp 8000309f: 53 push %ebx 800030a0: 68 aa 34 00 80 push $0x800034aa 800030a5: e8 6d fe ff ff call 80002f17 <cprintf> 800030aa: 83 c4 10 add $0x10,%esp return NULL; 800030ad: b8 00 00 00 00 mov $0x0,%eax 800030b2: e9 80 00 00 00 jmp 80003137 <readline+0xeb> } else if ((c == '\b' || c == '\x7f') && i > 0) { 800030b7: 83 f8 08 cmp $0x8,%eax 800030ba: 0f 94 c2 sete %dl 800030bd: 83 f8 7f cmp $0x7f,%eax 800030c0: 0f 94 c0 sete %al 800030c3: 08 c2 or %al,%dl 800030c5: 74 1a je 800030e1 <readline+0x95> 800030c7: 85 f6 test %esi,%esi 800030c9: 7e 16 jle 800030e1 <readline+0x95> if (echoing) 800030cb: 85 ff test %edi,%edi 800030cd: 74 0d je 800030dc <readline+0x90> cputchar('\b'); 800030cf: 83 ec 0c sub $0xc,%esp 800030d2: 6a 08 push $0x8 800030d4: e8 74 01 00 00 call 8000324d <cputchar> 800030d9: 83 c4 10 add $0x10,%esp i--; 800030dc: 83 ee 01 sub $0x1,%esi 800030df: eb a2 jmp 80003083 <readline+0x37> } else if (c >= ' ' && i < BUFLEN-1) { 800030e1: 83 fb 1f cmp $0x1f,%ebx 800030e4: 7e 26 jle 8000310c <readline+0xc0> 800030e6: 81 fe fe 03 00 00 cmp $0x3fe,%esi 800030ec: 7f 1e jg 8000310c <readline+0xc0> if (echoing) 800030ee: 85 ff test %edi,%edi 800030f0: 74 0c je 800030fe <readline+0xb2> cputchar(c); 800030f2: 83 ec 0c sub $0xc,%esp 800030f5: 53 push %ebx 800030f6: e8 52 01 00 00 call 8000324d <cputchar> 800030fb: 83 c4 10 add $0x10,%esp buf[i++] = c; 800030fe: 88 9e 20 50 00 80 mov %bl,-0x7fffafe0(%esi) 80003104: 8d 76 01 lea 0x1(%esi),%esi 80003107: e9 77 ff ff ff jmp 80003083 <readline+0x37> } else if (c == '\n' || c == '\r') { 8000310c: 83 fb 0a cmp $0xa,%ebx 8000310f: 74 09 je 8000311a <readline+0xce> 80003111: 83 fb 0d cmp $0xd,%ebx 80003114: 0f 85 69 ff ff ff jne 80003083 <readline+0x37> if (echoing) 8000311a: 85 ff test %edi,%edi 8000311c: 74 0d je 8000312b <readline+0xdf> cputchar('\n'); 8000311e: 83 ec 0c sub $0xc,%esp 80003121: 6a 0a push $0xa 80003123: e8 25 01 00 00 call 8000324d <cputchar> 80003128: 83 c4 10 add $0x10,%esp buf[i] = 0; 8000312b: c6 86 20 50 00 80 00 movb $0x0,-0x7fffafe0(%esi) return buf; 80003132: b8 20 50 00 80 mov $0x80005020,%eax } } } 80003137: 8d 65 f4 lea -0xc(%ebp),%esp 8000313a: 5b pop %ebx 8000313b: 5e pop %esi 8000313c: 5f pop %edi 8000313d: 5d pop %ebp 8000313e: c3 ret 8000313f <_panic>: */ #include <syslib.h> void _panic(const char *file, int line, const char *fmt, ...) { 8000313f: 55 push %ebp 80003140: 89 e5 mov %esp,%ebp 80003142: 56 push %esi 80003143: 53 push %ebx va_list ap; va_start(ap, fmt); 80003144: 8d 5d 14 lea 0x14(%ebp),%ebx // Print the panic message cprintf("[%08x] user panic in %s at %s:%d: ", 80003147: 8b 35 00 40 00 80 mov 0x80004000,%esi 8000314d: e8 82 e7 ff ff call 800018d4 <sys_getenvid> 80003152: 83 ec 0c sub $0xc,%esp 80003155: ff 75 0c pushl 0xc(%ebp) 80003158: ff 75 08 pushl 0x8(%ebp) 8000315b: 56 push %esi 8000315c: 50 push %eax 8000315d: 68 a8 37 00 80 push $0x800037a8 80003162: e8 b0 fd ff ff call 80002f17 <cprintf> sys_getenvid(), binaryname, file, line); vcprintf(fmt, ap); 80003167: 83 c4 18 add $0x18,%esp 8000316a: 53 push %ebx 8000316b: ff 75 10 pushl 0x10(%ebp) 8000316e: e8 53 fd ff ff call 80002ec6 <vcprintf> cprintf("\n"); 80003173: c7 04 24 7b 33 00 80 movl $0x8000337b,(%esp) 8000317a: e8 98 fd ff ff call 80002f17 <cprintf> 8000317f: 83 c4 10 add $0x10,%esp // Cause a breakpoint exception while (1) asm volatile("int3"); 80003182: cc int3 80003183: eb fd jmp 80003182 <_panic+0x43> 80003185 <devcons_close>: return tot; } static int devcons_close(struct Fd *fd) { 80003185: 55 push %ebp 80003186: 89 e5 mov %esp,%ebp USED(fd); return 0; } 80003188: b8 00 00 00 00 mov $0x0,%eax 8000318d: 5d pop %ebp 8000318e: c3 ret 8000318f <devcons_stat>: static int devcons_stat(struct Fd *fd, struct Stat *stat) { 8000318f: 55 push %ebp 80003190: 89 e5 mov %esp,%ebp 80003192: 83 ec 10 sub $0x10,%esp strcpy(stat->st_name, "<cons>"); 80003195: 68 ec 37 00 80 push $0x800037ec 8000319a: ff 75 0c pushl 0xc(%ebp) 8000319d: e8 8d e2 ff ff call 8000142f <strcpy> return 0; } 800031a2: b8 00 00 00 00 mov $0x0,%eax 800031a7: c9 leave 800031a8: c3 ret 800031a9 <devcons_write>: return 1; } static ssize_t devcons_write(struct Fd *fd, const void *vbuf, size_t n) { 800031a9: 55 push %ebp 800031aa: 89 e5 mov %esp,%ebp 800031ac: 57 push %edi 800031ad: 56 push %esi 800031ae: 53 push %ebx 800031af: 81 ec 8c 00 00 00 sub $0x8c,%esp int tot, m; char buf[128]; // mistake: have to nul-terminate arg to sys_cputs, // so we have to copy vbuf into buf in chunks and nul-terminate. for (tot = 0; tot < n; tot += m) { 800031b5: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 800031b9: 74 46 je 80003201 <devcons_write+0x58> 800031bb: b8 00 00 00 00 mov $0x0,%eax 800031c0: be 00 00 00 00 mov $0x0,%esi m = n - tot; if (m > sizeof(buf) - 1) m = sizeof(buf) - 1; memmove(buf, (char*)vbuf + tot, m); 800031c5: 8d bd 68 ff ff ff lea -0x98(%ebp),%edi char buf[128]; // mistake: have to nul-terminate arg to sys_cputs, // so we have to copy vbuf into buf in chunks and nul-terminate. for (tot = 0; tot < n; tot += m) { m = n - tot; 800031cb: 8b 5d 10 mov 0x10(%ebp),%ebx 800031ce: 29 c3 sub %eax,%ebx if (m > sizeof(buf) - 1) 800031d0: 83 fb 7f cmp $0x7f,%ebx char buf[128]; // mistake: have to nul-terminate arg to sys_cputs, // so we have to copy vbuf into buf in chunks and nul-terminate. for (tot = 0; tot < n; tot += m) { m = n - tot; 800031d3: ba 7f 00 00 00 mov $0x7f,%edx 800031d8: 0f 47 da cmova %edx,%ebx if (m > sizeof(buf) - 1) m = sizeof(buf) - 1; memmove(buf, (char*)vbuf + tot, m); 800031db: 83 ec 04 sub $0x4,%esp 800031de: 53 push %ebx 800031df: 03 45 0c add 0xc(%ebp),%eax 800031e2: 50 push %eax 800031e3: 57 push %edi 800031e4: e8 35 e4 ff ff call 8000161e <memmove> sys_cputs(buf, m); 800031e9: 83 c4 08 add $0x8,%esp 800031ec: 53 push %ebx 800031ed: 57 push %edi 800031ee: e8 63 e6 ff ff call 80001856 <sys_cputs> int tot, m; char buf[128]; // mistake: have to nul-terminate arg to sys_cputs, // so we have to copy vbuf into buf in chunks and nul-terminate. for (tot = 0; tot < n; tot += m) { 800031f3: 01 de add %ebx,%esi 800031f5: 89 f0 mov %esi,%eax 800031f7: 83 c4 10 add $0x10,%esp 800031fa: 3b 75 10 cmp 0x10(%ebp),%esi 800031fd: 72 cc jb 800031cb <devcons_write+0x22> 800031ff: eb 05 jmp 80003206 <devcons_write+0x5d> 80003201: be 00 00 00 00 mov $0x0,%esi m = sizeof(buf) - 1; memmove(buf, (char*)vbuf + tot, m); sys_cputs(buf, m); } return tot; } 80003206: 89 f0 mov %esi,%eax 80003208: 8d 65 f4 lea -0xc(%ebp),%esp 8000320b: 5b pop %ebx 8000320c: 5e pop %esi 8000320d: 5f pop %edi 8000320e: 5d pop %ebp 8000320f: c3 ret 80003210 <devcons_read>: return fd2num(fd); } static ssize_t devcons_read(struct Fd *fd, void *vbuf, size_t n) { 80003210: 55 push %ebp 80003211: 89 e5 mov %esp,%ebp 80003213: 83 ec 08 sub $0x8,%esp 80003216: b8 00 00 00 00 mov $0x0,%eax int c; if (n == 0) 8000321b: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8000321f: 74 2a je 8000324b <devcons_read+0x3b> 80003221: eb 05 jmp 80003228 <devcons_read+0x18> return 0; while ((c = sys_cgetc()) == 0) sys_yield(); 80003223: e8 cb e6 ff ff call 800018f3 <sys_yield> int c; if (n == 0) return 0; while ((c = sys_cgetc()) == 0) 80003228: e8 47 e6 ff ff call 80001874 <sys_cgetc> 8000322d: 85 c0 test %eax,%eax 8000322f: 74 f2 je 80003223 <devcons_read+0x13> sys_yield(); if (c < 0) 80003231: 85 c0 test %eax,%eax 80003233: 78 16 js 8000324b <devcons_read+0x3b> return c; if (c == 0x04) // ctl-d is eof 80003235: 83 f8 04 cmp $0x4,%eax 80003238: 74 0c je 80003246 <devcons_read+0x36> return 0; *(char*)vbuf = c; 8000323a: 8b 55 0c mov 0xc(%ebp),%edx 8000323d: 88 02 mov %al,(%edx) return 1; 8000323f: b8 01 00 00 00 mov $0x1,%eax 80003244: eb 05 jmp 8000324b <devcons_read+0x3b> while ((c = sys_cgetc()) == 0) sys_yield(); if (c < 0) return c; if (c == 0x04) // ctl-d is eof return 0; 80003246: b8 00 00 00 00 mov $0x0,%eax *(char*)vbuf = c; return 1; } 8000324b: c9 leave 8000324c: c3 ret 8000324d <cputchar>: #include <string.h> #include <syslib.h> void cputchar(int ch) { 8000324d: 55 push %ebp 8000324e: 89 e5 mov %esp,%ebp 80003250: 83 ec 20 sub $0x20,%esp char c = ch; 80003253: 8b 45 08 mov 0x8(%ebp),%eax 80003256: 88 45 f7 mov %al,-0x9(%ebp) // Unlike standard Unix's putchar, // the cputchar function _always_ outputs to the system console. sys_cputs(&c, 1); 80003259: 6a 01 push $0x1 8000325b: 8d 45 f7 lea -0x9(%ebp),%eax 8000325e: 50 push %eax 8000325f: e8 f2 e5 ff ff call 80001856 <sys_cputs> } 80003264: 83 c4 10 add $0x10,%esp 80003267: c9 leave 80003268: c3 ret 80003269 <getchar>: int getchar(void) { 80003269: 55 push %ebp 8000326a: 89 e5 mov %esp,%ebp 8000326c: 83 ec 1c sub $0x1c,%esp int r; // JOS does, however, support standard _input_ redirection, // allowing the user to redirect script files to the shell and such. // getchar() reads a character from file descriptor 0. r = read(0, &c, 1); 8000326f: 6a 01 push $0x1 80003271: 8d 45 f7 lea -0x9(%ebp),%eax 80003274: 50 push %eax 80003275: 6a 00 push $0x0 80003277: e8 a2 eb ff ff call 80001e1e <read> if (r < 0) 8000327c: 83 c4 10 add $0x10,%esp 8000327f: 85 c0 test %eax,%eax 80003281: 78 0f js 80003292 <getchar+0x29> return r; if (r < 1) 80003283: 85 c0 test %eax,%eax 80003285: 7e 06 jle 8000328d <getchar+0x24> return -E_EOF; return c; 80003287: 0f b6 45 f7 movzbl -0x9(%ebp),%eax 8000328b: eb 05 jmp 80003292 <getchar+0x29> // getchar() reads a character from file descriptor 0. r = read(0, &c, 1); if (r < 0) return r; if (r < 1) return -E_EOF; 8000328d: b8 f8 ff ff ff mov $0xfffffff8,%eax return c; } 80003292: c9 leave 80003293: c3 ret 80003294 <iscons>: .dev_stat = devcons_stat }; int iscons(int fdnum) { 80003294: 55 push %ebp 80003295: 89 e5 mov %esp,%ebp 80003297: 83 ec 20 sub $0x20,%esp int r; struct Fd *fd; if ((r = fd_lookup(fdnum, &fd)) < 0) 8000329a: 8d 45 f4 lea -0xc(%ebp),%eax 8000329d: 50 push %eax 8000329e: ff 75 08 pushl 0x8(%ebp) 800032a1: e8 f9 e8 ff ff call 80001b9f <fd_lookup> 800032a6: 83 c4 10 add $0x10,%esp 800032a9: 85 c0 test %eax,%eax 800032ab: 78 11 js 800032be <iscons+0x2a> return r; return fd->fd_dev_id == devcons.dev_id; 800032ad: 8b 45 f4 mov -0xc(%ebp),%eax 800032b0: 8b 15 3c 40 00 80 mov 0x8000403c,%edx 800032b6: 39 10 cmp %edx,(%eax) 800032b8: 0f 94 c0 sete %al 800032bb: 0f b6 c0 movzbl %al,%eax } 800032be: c9 leave 800032bf: c3 ret 800032c0 <opencons>: int opencons(void) { 800032c0: 55 push %ebp 800032c1: 89 e5 mov %esp,%ebp 800032c3: 83 ec 24 sub $0x24,%esp int r; struct Fd* fd; if ((r = fd_alloc(&fd)) < 0) 800032c6: 8d 45 f4 lea -0xc(%ebp),%eax 800032c9: 50 push %eax 800032ca: e8 5c e8 ff ff call 80001b2b <fd_alloc> 800032cf: 83 c4 10 add $0x10,%esp return r; 800032d2: 89 c2 mov %eax,%edx opencons(void) { int r; struct Fd* fd; if ((r = fd_alloc(&fd)) < 0) 800032d4: 85 c0 test %eax,%eax 800032d6: 78 3e js 80003316 <opencons+0x56> return r; if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0) 800032d8: 83 ec 04 sub $0x4,%esp 800032db: 68 07 04 00 00 push $0x407 800032e0: ff 75 f4 pushl -0xc(%ebp) 800032e3: 6a 00 push $0x0 800032e5: e8 28 e6 ff ff call 80001912 <sys_page_alloc> 800032ea: 83 c4 10 add $0x10,%esp return r; 800032ed: 89 c2 mov %eax,%edx int r; struct Fd* fd; if ((r = fd_alloc(&fd)) < 0) return r; if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0) 800032ef: 85 c0 test %eax,%eax 800032f1: 78 23 js 80003316 <opencons+0x56> return r; fd->fd_dev_id = devcons.dev_id; 800032f3: 8b 15 3c 40 00 80 mov 0x8000403c,%edx 800032f9: 8b 45 f4 mov -0xc(%ebp),%eax 800032fc: 89 10 mov %edx,(%eax) fd->fd_omode = O_RDWR; 800032fe: 8b 45 f4 mov -0xc(%ebp),%eax 80003301: c7 40 08 02 00 00 00 movl $0x2,0x8(%eax) return fd2num(fd); 80003308: 83 ec 0c sub $0xc,%esp 8000330b: 50 push %eax 8000330c: e8 f2 e7 ff ff call 80001b03 <fd2num> 80003311: 89 c2 mov %eax,%edx 80003313: 83 c4 10 add $0x10,%esp } 80003316: 89 d0 mov %edx,%eax 80003318: c9 leave 80003319: c3 ret
src/q_bingada.adb
mgrojo/bingada
2
19152
--***************************************************************************** --* --* PROJECT: BINGADA --* --* FILE: q_bingada.adb --* --* AUTHOR: <NAME> --* --***************************************************************************** with TEXT_IO; with ADA.STRINGS.FIXED; with ADA.CONTAINERS; with GLIB.MAIN; with GLIB.ERROR; with GLIB.PROPERTIES; with GTK.BOX; with GTK.MAIN; with GTK.WINDOW; with GTK.ENUMS; with GTK.WIDGET; with GTK.IMAGE; with GTK.BUTTON; with GTK.MENU; with GTK.MENU_BAR; with GTK.MENU_ITEM; with GTK.HANDLERS; with GTK.SETTINGS; with GTK.STYLE_PROVIDER; with GDK.EVENT; with GDK.TYPES.KEYSYMS; with GDK.PIXBUF; with GTKADA.STYLE; with GTKADA.INTL; with Q_BINGO.Q_BOMBO; with Q_BINGO_HELP; with Q_CSV.Q_READ_FILE; with Q_BINGO.Q_GTK.Q_INTL; package body Q_BINGADA is use type GLIB.MAIN.G_SOURCE_ID; use type GLIB.GUINT; use type GDK.TYPES.GDK_KEY_TYPE; --================================================================== C_NULL_NUMBER_IMAGE : constant STRING := " "; C_BOMBO_FILE : constant STRING := "bombo.png"; C_DRUM_SPIN_FILE : constant STRING := "drum_spin.png"; V_FIRST_BOMBO : POSITIVE := 1; V_BOMBO_BUTTON : GTK.BUTTON.GTK_BUTTON; --================================================================== procedure P_LOAD_CSS is C_COLOURS_CONF_FILENAME : constant STRING := "bingada.css"; begin -- Use this if you want to use Aero themes from Gnome -- This is not recommended but can help if animation is requested. -- In this case the .themes directory must exists in the home directory. -- Glib.Properties.Set_Property -- (Object => Gtk.Settings.Get_Default, -- Name => Gtk.Settings.Gtk_Theme_Name, -- Value => "Aero"); GLIB.PROPERTIES.SET_PROPERTY (OBJECT => GTK.SETTINGS.GET_DEFAULT, NAME => GTK.SETTINGS.GTK_CURSOR_BLINK_PROPERTY, VALUE => TRUE); GTKADA.STYLE.LOAD_CSS_FILE (Path => C_COLOURS_CONF_FILENAME, Error => TEXT_IO.PUT_LINE'ACCESS, Priority => GTK.STYLE_PROVIDER.PRIORITY_APPLICATION); end P_LOAD_CSS; --========================================================================= function F_SWAP_BOMBO_IMAGE return STRING is begin if V_FIRST_BOMBO = 1 then V_FIRST_BOMBO := 2; return C_BOMBO_FILE; else V_FIRST_BOMBO := 1; return C_DRUM_SPIN_FILE; end if; end F_SWAP_BOMBO_IMAGE; --================================================================== procedure P_MAIN_QUIT (SELF : access GTK.WIDGET.GTK_WIDGET_RECORD'CLASS) is pragma UNREFERENCED (SELF); begin TEXT_IO.PUT_LINE (GTKADA.INTL."-" ("exit_message")); GTK.MAIN.MAIN_QUIT; end P_MAIN_QUIT; --================================================================== V_CURRENT_NUMBER : GTK.BUTTON.GTK_BUTTON; V_PREVIOUS_NUMBER_1 : GTK.BUTTON.GTK_BUTTON; V_PREVIOUS_NUMBER_2 : GTK.BUTTON.GTK_BUTTON; V_PREVIOUS_NUMBER_3 : GTK.BUTTON.GTK_BUTTON; C_MAX_BUTTONS : constant := Q_BINGO.C_LAST_NUMBER; type T_BUTTONS_ARRAY is array (1 .. C_MAX_BUTTONS) of GTK.BUTTON.GTK_BUTTON; V_BUTTON_ARRAY : T_BUTTONS_ARRAY; --================================================================== function F_GET_NUMBER (V_INDEX : POSITIVE) return STRING is begin if V_INDEX < 10 then return " " & ADA.STRINGS.FIXED.TRIM (SOURCE => V_INDEX'IMAGE, SIDE => ADA.STRINGS.BOTH); else return ADA.STRINGS.FIXED.TRIM (SOURCE => V_INDEX'IMAGE, SIDE => ADA.STRINGS.BOTH); end if; end F_GET_NUMBER; --================================================================== procedure P_SET_CURRENT_AND_PREVIOUS_NUMBERS (V_CURRENT_INDEX : Q_BINGO.T_NUMBER) is C_NUMBER : constant POSITIVE := Q_BINGO.Q_BOMBO.F_GET_NUMBER (V_CURRENT_INDEX); begin V_BUTTON_ARRAY (C_NUMBER).SET_NAME ("myButton_blue"); V_CURRENT_NUMBER.SET_NAME ("myButton_blue"); V_CURRENT_NUMBER.SET_LABEL (F_GET_NUMBER (C_NUMBER)); if V_CURRENT_INDEX > 1 then -- GTK.LABEL.SET_MARKUP -- (GTK.LABEL.GTK_LABEL (GTK.BUTTON.GET_CHILD (V_PREVIOUS_NUMBER_1)), -- "<span face=""Sans Italic"" color=""red"" size=""large"" >" & -- F_GET_NUMBER -- (Q_BINGO.Q_BOMBO.F_GET_NUMBER (V_CURRENT_INDEX - 1)) & "</span>"); V_PREVIOUS_NUMBER_1.SET_LABEL (F_GET_NUMBER (Q_BINGO.Q_BOMBO.F_GET_NUMBER (V_CURRENT_INDEX - 1))); V_PREVIOUS_NUMBER_1.SET_NAME ("myButton_previous_1"); end if; if V_CURRENT_INDEX > 2 then V_PREVIOUS_NUMBER_2.SET_LABEL (F_GET_NUMBER (Q_BINGO.Q_BOMBO.F_GET_NUMBER (V_CURRENT_INDEX - 2))); V_PREVIOUS_NUMBER_2.SET_NAME ("myButton_previous_2"); end if; if V_CURRENT_INDEX > 3 then V_PREVIOUS_NUMBER_3.SET_LABEL (F_GET_NUMBER (Q_BINGO.Q_BOMBO.F_GET_NUMBER (V_CURRENT_INDEX - 3))); V_PREVIOUS_NUMBER_3.SET_NAME ("myButton_previous_3"); end if; end P_SET_CURRENT_AND_PREVIOUS_NUMBERS; --================================================================== procedure P_GET_NUMBER is V_LAST_NUMBER : BOOLEAN; V_CURRENT_INDEX : Q_BINGO.T_NUMBER; V_NUMBER : POSITIVE; begin Q_BINGO.Q_BOMBO.P_SPIN (V_NUMBER => V_NUMBER, V_CURRENT_INDEX => V_CURRENT_INDEX, V_LAST_NUMBER => V_LAST_NUMBER); P_SET_CURRENT_AND_PREVIOUS_NUMBERS (V_CURRENT_INDEX => V_CURRENT_INDEX); end P_GET_NUMBER; --================================================================== procedure P_BUTTON_CLICKED (SELF : access GTK.BUTTON.GTK_BUTTON_RECORD'CLASS) is pragma UNREFERENCED (SELF); begin P_GET_NUMBER; end P_BUTTON_CLICKED; --================================================================== procedure P_BUTTON_PRESSED (SELF : access GTK.BUTTON.GTK_BUTTON_RECORD'CLASS) is V_DRUM_SPIN_IMAGE : GTK.IMAGE.GTK_IMAGE; begin V_DRUM_SPIN_IMAGE := GTK.IMAGE.GTK_IMAGE_NEW_FROM_FILE (F_SWAP_BOMBO_IMAGE); SELF.SET_IMAGE (V_DRUM_SPIN_IMAGE); end P_BUTTON_PRESSED; --================================================================== procedure P_BUTTON_RELEASED (SELF : access GTK.BUTTON.GTK_BUTTON_RECORD'CLASS) is V_BOMBO_IMAGE : GTK.IMAGE.GTK_IMAGE; begin V_BOMBO_IMAGE := GTK.IMAGE.GTK_IMAGE_NEW_FROM_FILE (F_SWAP_BOMBO_IMAGE); SELF.SET_IMAGE (V_BOMBO_IMAGE); end P_BUTTON_RELEASED; --================================================================== procedure P_CREATE_NUMBERS (V_NUMBERS_BOX : out GTK.BOX.GTK_BOX) is V_HORIZONTAL : GTK.BOX.GTK_BOX; V_INDEX : POSITIVE := 1; begin GTK.BOX.GTK_NEW_VBOX (BOX => V_NUMBERS_BOX, HOMOGENEOUS => TRUE); for I in 1 .. 9 loop GTK.BOX.GTK_NEW_HBOX (BOX => V_HORIZONTAL, HOMOGENEOUS => TRUE); GTK.BOX.PACK_START (IN_BOX => V_NUMBERS_BOX, CHILD => V_HORIZONTAL, EXPAND => TRUE, FILL => TRUE); for J in 1 .. 10 loop GTK.BUTTON.GTK_NEW (V_BUTTON_ARRAY (V_INDEX), LABEL => F_GET_NUMBER (V_INDEX)); V_BUTTON_ARRAY (V_INDEX).SET_SENSITIVE (FALSE); GTK.BOX.PACK_START (IN_BOX => V_HORIZONTAL, CHILD => V_BUTTON_ARRAY (V_INDEX), EXPAND => TRUE, FILL => TRUE); V_INDEX := V_INDEX + 1; end loop; end loop; end P_CREATE_NUMBERS; --================================================================== type T_WIDGETS_TO_UPDATE is null record; V_NULL_RECORD : T_WIDGETS_TO_UPDATE; package Q_TIMEOUT is new GLIB.MAIN.GENERIC_SOURCES (T_WIDGETS_TO_UPDATE); V_TIMEOUT : GLIB.MAIN.G_SOURCE_ID; V_SPIN_TIMEOUT : GLIB.MAIN.G_SOURCE_ID; --================================================================== function F_SWAP_BOMBO_IMAGE (V_USER : T_WIDGETS_TO_UPDATE) return BOOLEAN is pragma UNREFERENCED (V_USER); begin V_BOMBO_BUTTON.SET_IMAGE (GTK.IMAGE.GTK_IMAGE_NEW_FROM_FILE (F_SWAP_BOMBO_IMAGE)); return TRUE; end F_SWAP_BOMBO_IMAGE; --================================================================== function F_SPIN_TIMEOUT (V_USER : T_WIDGETS_TO_UPDATE) return BOOLEAN is pragma UNREFERENCED (V_USER); begin P_GET_NUMBER; return TRUE; end F_SPIN_TIMEOUT; --================================================================== procedure P_START_TIMER is begin V_SPIN_TIMEOUT := Q_TIMEOUT.TIMEOUT_ADD (-- This timeout will refresh every 5sec 500, -- This is the function to call in the timeout F_SWAP_BOMBO_IMAGE'ACCESS, -- This is the part of the GUI to refresh V_NULL_RECORD); V_TIMEOUT := Q_TIMEOUT.TIMEOUT_ADD (-- This timeout will refresh every 5sec 6000, -- This is the function to call in the timeout F_SPIN_TIMEOUT'ACCESS, -- This is the part of the GUI to refresh V_NULL_RECORD); end P_START_TIMER; --================================================================== procedure P_STOP_TIMER is begin if V_TIMEOUT /= 0 then GLIB.MAIN.REMOVE (V_TIMEOUT); GLIB.MAIN.REMOVE (V_SPIN_TIMEOUT); V_TIMEOUT := 0; V_SPIN_TIMEOUT := 0; end if; end P_STOP_TIMER; --================================================================== procedure P_START_PAUSE_BINGO is begin if V_TIMEOUT /= 0 then P_STOP_TIMER; else P_START_TIMER; end if; end P_START_PAUSE_BINGO; --================================================================== package Q_MAIN_WINDOW_HANDLER is new GTK.HANDLERS.RETURN_CALLBACK (GTK.WIDGET.GTK_WIDGET_RECORD, BOOLEAN); function F_MAIN_WINDOW_BUTTON_PRESS (V_OBJECT : access GTK.WIDGET.GTK_WIDGET_RECORD'CLASS; V_EVENT : GDK.EVENT.GDK_EVENT) return BOOLEAN is pragma UNREFERENCED (V_OBJECT); C_KEY_VAL : constant GDK.TYPES.GDK_KEY_TYPE := GDK.EVENT.GET_KEY_VAL (V_EVENT); begin --TEXT_IO.PUT_LINE -- ("button pressed : " & GLIB.GUINT'IMAGE -- (GDK.EVENT.GET_BUTTON (V_EVENT)) & " key val " & -- GDK.TYPES.GDK_KEY_TYPE'IMAGE (GDK.EVENT.GET_KEY_VAL (V_EVENT))); if C_KEY_VAL = GDK.TYPES.KEYSYMS.GDK_LC_s or else C_KEY_VAL = GDK.TYPES.KEYSYMS.GDK_S or else C_KEY_VAL = GDK.TYPES.KEYSYMS.GDK_SPACE then P_START_PAUSE_BINGO; end if; return TRUE; end F_MAIN_WINDOW_BUTTON_PRESS; --================================================================== procedure P_CREATE_UPPER_AREA (V_UPPER_AREA : out GTK.BOX.GTK_BOX) is V_BOMBO_IMAGE : GTK.IMAGE.GTK_IMAGE; V_NUMBERS_BOX : GTK.BOX.GTK_BOX; V_NUMBERS_BOX_UPPER : GTK.BOX.GTK_BOX; V_NUMBERS_BOX_LOWER : GTK.BOX.GTK_BOX; begin GTK.BOX.GTK_NEW_HBOX (BOX => V_UPPER_AREA, HOMOGENEOUS => TRUE); GTK.BUTTON.GTK_NEW (V_BOMBO_BUTTON); GTK.BUTTON.GTK_NEW (V_CURRENT_NUMBER, LABEL => C_NULL_NUMBER_IMAGE); V_CURRENT_NUMBER.SET_SENSITIVE (FALSE); GTK.BUTTON.GTK_NEW (V_PREVIOUS_NUMBER_1, LABEL => C_NULL_NUMBER_IMAGE); V_PREVIOUS_NUMBER_1.SET_SENSITIVE (FALSE); GTK.BUTTON.GTK_NEW (V_PREVIOUS_NUMBER_2, LABEL => C_NULL_NUMBER_IMAGE); V_PREVIOUS_NUMBER_2.SET_SENSITIVE (FALSE); GTK.BUTTON.GTK_NEW (V_PREVIOUS_NUMBER_3, LABEL => C_NULL_NUMBER_IMAGE); V_PREVIOUS_NUMBER_3.SET_SENSITIVE (FALSE); Q_MAIN_WINDOW_HANDLER.CONNECT (V_BOMBO_BUTTON, "key_press_event", Q_MAIN_WINDOW_HANDLER.TO_MARSHALLER (F_MAIN_WINDOW_BUTTON_PRESS'ACCESS)); V_BOMBO_BUTTON.ON_PRESSED (P_BUTTON_PRESSED'ACCESS); V_BOMBO_BUTTON.ON_RELEASED (P_BUTTON_RELEASED'ACCESS); V_BOMBO_BUTTON.ON_CLICKED (P_BUTTON_CLICKED'ACCESS); V_BOMBO_IMAGE := GTK.IMAGE.GTK_IMAGE_NEW_FROM_FILE (C_BOMBO_FILE); V_BOMBO_BUTTON.SET_IMAGE (IMAGE => V_BOMBO_IMAGE); V_BOMBO_BUTTON.Set_Name ("drum_button"); GTK.BOX.PACK_START (IN_BOX => V_UPPER_AREA, CHILD => V_BOMBO_BUTTON); GTK.BOX.GTK_NEW_VBOX (BOX => V_NUMBERS_BOX, HOMOGENEOUS => TRUE); GTK.BOX.PACK_START (IN_BOX => V_UPPER_AREA, CHILD => V_NUMBERS_BOX); GTK.BOX.GTK_NEW_HBOX (BOX => V_NUMBERS_BOX_UPPER, HOMOGENEOUS => TRUE); GTK.BOX.GTK_NEW_HBOX (BOX => V_NUMBERS_BOX_LOWER, HOMOGENEOUS => TRUE); GTK.BOX.PACK_START (IN_BOX => V_NUMBERS_BOX, CHILD => V_NUMBERS_BOX_UPPER); GTK.BOX.PACK_START (IN_BOX => V_NUMBERS_BOX, CHILD => V_NUMBERS_BOX_LOWER); GTK.BOX.PACK_START (IN_BOX => V_NUMBERS_BOX_UPPER, CHILD => V_CURRENT_NUMBER); GTK.BOX.PACK_START (IN_BOX => V_NUMBERS_BOX_LOWER, CHILD => V_PREVIOUS_NUMBER_1); GTK.BOX.PACK_START (IN_BOX => V_NUMBERS_BOX_LOWER, CHILD => V_PREVIOUS_NUMBER_2); GTK.BOX.PACK_START (IN_BOX => V_NUMBERS_BOX_LOWER, CHILD => V_PREVIOUS_NUMBER_3); end P_CREATE_UPPER_AREA; --================================================================== procedure P_CREATE_MAIN_WINDOW (V_MENU_BAR : GTK.MENU_BAR.GTK_MENU_BAR; V_UPPER_AREA : GTK.BOX.GTK_BOX; V_NUMBERS_BOX : GTK.BOX.GTK_BOX; V_MAIN_WINDOW : out GTK.WINDOW.GTK_WINDOW) is V_VERTICAL_BOX : GTK.BOX.GTK_BOX; V_BOMBO_ICON : GDK.PIXBUF.GDK_PIXBUF; V_ICON_ERROR : GLIB.ERROR.GERROR; begin -- Create main window box -- GTK.WINDOW.GTK_NEW (V_MAIN_WINDOW, GTK.ENUMS.WINDOW_TOPLEVEL); GTK.WINDOW.SET_MODAL (WINDOW => V_MAIN_WINDOW, MODAL => FALSE); GTK.WINDOW.SET_TITLE (V_MAIN_WINDOW, "BingAda"); GDK.PIXBUF.GDK_NEW_FROM_FILE (PIXBUF => V_BOMBO_ICON, FILENAME => C_BOMBO_FILE, ERROR => V_ICON_ERROR); GTK.WINDOW.SET_ICON (WINDOW => V_MAIN_WINDOW, ICON => V_BOMBO_ICON); -- |--- Vertical BOX | -- | | -- | | -- | | -- GTK.BOX.GTK_NEW_VBOX (BOX => V_VERTICAL_BOX, HOMOGENEOUS => FALSE); GTK.WINDOW.ADD (V_MAIN_WINDOW, V_VERTICAL_BOX); GTK.BOX.PACK_START (IN_BOX => V_VERTICAL_BOX, CHILD => V_MENU_BAR, EXPAND => FALSE, FILL => TRUE); -- -- | ---- Vertical Box --- | -- | ------ Upper Area---- | -- | - - | -- | - - | -- | ------Numbers_box-----| -- | - - | -- | - - | -- | ----------------------| -- GTK.BOX.PACK_START (IN_BOX => V_VERTICAL_BOX, CHILD => V_UPPER_AREA); GTK.BOX.PACK_START (IN_BOX => V_VERTICAL_BOX, CHILD => V_NUMBERS_BOX); end P_CREATE_MAIN_WINDOW; --================================================================== procedure P_START_BINGO (V_OBJECT : access GTK.MENU_ITEM.GTK_MENU_ITEM_RECORD'CLASS) is pragma UNREFERENCED (V_OBJECT); begin -- If there is no timeout registered to monitor the tasks, -- start one now! -- if V_TIMEOUT = 0 then P_START_TIMER; end if; end P_START_BINGO; --================================================================== procedure P_PAUSE_BINGO (V_OBJECT : access GTK.MENU_ITEM.GTK_MENU_ITEM_RECORD'CLASS) is pragma UNREFERENCED (V_Object); begin P_STOP_TIMER; end P_PAUSE_BINGO; --================================================================== V_CARDS : Q_CSV.Q_READ_FILE.Q_BINGO_CARDS.VECTOR; function F_IS_NUMBER_MARKED_OFF (V_NUMBER : Q_BINGO.T_NUMBER) return BOOLEAN is V_FOUND : BOOLEAN := FALSE; begin for I in 1 .. Q_BINGO.Q_BOMBO.F_GET_CURRENT_INDEX loop V_FOUND := Q_BINGO.Q_BOMBO.F_GET_NUMBER (I) = V_NUMBER; exit when V_FOUND; end loop; return V_FOUND; end F_IS_NUMBER_MARKED_OFF; --================================================================== function F_ALL_NUMBERS_MARKED_OFF (V_CARD : Q_CSV.Q_READ_FILE.T_CARD) return BOOLEAN is V_ALL_MARKED_OFF : BOOLEAN := TRUE; begin for I in V_CARD.R_NUMBERS'RANGE loop V_ALL_MARKED_OFF := F_IS_NUMBER_MARKED_OFF (V_CARD.R_NUMBERS (I)); exit when not V_ALL_MARKED_OFF; end loop; return V_ALL_MARKED_OFF; end F_ALL_NUMBERS_MARKED_OFF; --================================================================== procedure P_CHECK_BINGO (V_CARDS : Q_CSV.Q_READ_FILE.Q_BINGO_CARDS.VECTOR) is begin TEXT_IO.PUT_LINE ("-------------------------------------------"); for V_CARD of V_CARDS loop TEXT_IO.PUT_LINE (V_CARD.R_NAME & " : " & BOOLEAN'IMAGE (F_ALL_NUMBERS_MARKED_OFF (V_CARD))); end loop; end P_CHECK_BINGO; --================================================================== procedure P_SHOW_CARDS (V_CARDS : Q_CSV.Q_READ_FILE.Q_BINGO_CARDS.VECTOR) is begin TEXT_IO.PUT_LINE ("Number of Elements : " & ADA.CONTAINERS.COUNT_TYPE'IMAGE (V_CARDS.LENGTH)); for E of V_CARDS loop TEXT_IO.PUT_LINE ("- " & E.R_NAME); end loop; end P_SHOW_CARDS; --================================================================== procedure P_READ_CARDS_FROM_FILE is begin V_CARDS.SET_LENGTH (0); Q_CSV.Q_READ_FILE.P_READ_BINGO_CARDS (V_FILE_NAME => "bingo_cards.csv", V_CARDS => V_CARDS); P_CHECK_BINGO (V_CARDS); --P_SHOW_CARDS (V_CARDS); end P_READ_CARDS_FROM_FILE; --================================================================== procedure P_CHECK_CARDS (V_Object : access GTK.MENU_ITEM.GTK_MENU_ITEM_RECORD'Class) is pragma UNREFERENCED (V_Object); begin P_READ_CARDS_FROM_FILE; end P_CHECK_CARDS; --================================================================== procedure P_INIT_BINGO is begin Q_BINGO.Q_BOMBO.P_INIT; for I in 1 .. C_MAX_BUTTONS loop V_BUTTON_ARRAY (I).SET_NAME ("myButton_white"); end loop; V_CURRENT_NUMBER.SET_NAME ("current"); V_CURRENT_NUMBER.SET_LABEL (C_NULL_NUMBER_IMAGE); V_PREVIOUS_NUMBER_1.SET_LABEL (C_NULL_NUMBER_IMAGE); V_PREVIOUS_NUMBER_2.SET_LABEL (C_NULL_NUMBER_IMAGE); V_PREVIOUS_NUMBER_3.SET_LABEL (C_NULL_NUMBER_IMAGE); P_STOP_TIMER; end P_INIT_BINGO; --================================================================== package P_MENU_ITEM_HANDLER is new GTK.HANDLERS.CALLBACK (GTK.MENU_ITEM.GTK_MENU_ITEM_RECORD); procedure P_NEW_GAME (V_EMITTER : access GTK.MENU_ITEM.GTK_MENU_ITEM_RECORD'CLASS) is pragma UNREFERENCED (V_EMITTER); begin P_INIT_BINGO; end P_NEW_GAME; --================================================================== procedure P_EXIT_BINGO (SELF : access GTK.MENU_ITEM.GTK_MENU_ITEM_RECORD'CLASS) is begin P_MAIN_QUIT (SELF); end P_EXIT_BINGO; --================================================================== procedure P_HELP_BINGO (V_WIDGET : access GTK.MENU_ITEM.GTK_MENU_ITEM_RECORD'CLASS) is begin Q_BINGO_HELP.P_SHOW_WINDOW (V_PARENT_WINDOW => GTK.WINDOW.GTK_WINDOW (GTK.MENU_ITEM.GET_TOPLEVEL (V_WIDGET))); end P_HELP_BINGO; --================================================================== procedure P_CREATE_GAME_MENU (V_GAME_MENU_ITEM : out GTK.MENU_ITEM.GTK_MENU_ITEM) is V_NEW_GAME, V_AUTO_START, V_PAUSE, V_CHECK_CARDS, V_EXIT, V_HELP : GTK.MENU_ITEM.GTK_MENU_ITEM; V_GAME_MENU : GTK.MENU.GTK_MENU; begin -- Creates GAME menu submenus -- GTK.MENU_ITEM.GTK_NEW_WITH_MNEMONIC (V_NEW_GAME, "_" & GTKADA.INTL."-" ("menu_new_game")); GTK.MENU_ITEM.GTK_NEW_WITH_MNEMONIC (V_AUTO_START, "_" & GTKADA.INTL."-" ("menu_auto_spin")); GTK.MENU_ITEM.GTK_NEW_WITH_MNEMONIC (V_PAUSE, "_" & GTKADA.INTL."-" ("menu_pause")); GTK.MENU_ITEM.GTK_NEW_WITH_MNEMONIC (V_CHECK_CARDS, "_" & GTKADA.INTL."-" ("menu_check_cards")); GTK.MENU_ITEM.GTK_NEW_WITH_MNEMONIC (V_EXIT, "_" & GTKADA.INTL."-" ("menu_exit")); GTK.MENU_ITEM.GTK_NEW_WITH_MNEMONIC (V_HELP, "_" & GTKADA.INTL."-" ("menu_help")); GTK.MENU_ITEM.GTK_NEW_WITH_MNEMONIC (V_GAME_MENU_ITEM, "_" & GTKADA.INTL."-" ("main_menu")); -- Creates the menu called game -- GTK.MENU.GTK_NEW (V_GAME_MENU); -- Append all menu items to the game menu. -- GTK.MENU.APPEND (MENU_SHELL => V_GAME_MENU, CHILD => V_NEW_GAME); GTK.MENU.APPEND (MENU_SHELL => V_GAME_MENU, CHILD => V_AUTO_START); GTK.MENU.APPEND (MENU_SHELL => V_GAME_MENU, CHILD => V_PAUSE); GTK.MENU.APPEND (MENU_SHELL => V_GAME_MENU, CHILD => V_CHECK_CARDS); GTK.MENU.APPEND (MENU_SHELL => V_GAME_MENU, CHILD => V_HELP); GTK.MENU.APPEND (MENU_SHELL => V_GAME_MENU, CHILD => V_EXIT); -- Sets the submenu -- GTK.MENU_ITEM.SET_SUBMENU (V_GAME_MENU_ITEM, V_GAME_MENU); P_MENU_ITEM_HANDLER.CONNECT (V_NEW_GAME, "activate", P_NEW_GAME'ACCESS); P_MENU_ITEM_HANDLER.CONNECT (V_AUTO_START, "activate", P_START_BINGO'ACCESS); P_MENU_ITEM_HANDLER.CONNECT (V_PAUSE, "activate", P_PAUSE_BINGO'ACCESS); P_MENU_ITEM_HANDLER.CONNECT (V_CHECK_CARDS, "activate", P_CHECK_CARDS'ACCESS); P_MENU_ITEM_HANDLER.CONNECT (V_EXIT, "activate", P_EXIT_BINGO'ACCESS); P_MENU_ITEM_HANDLER.CONNECT (V_HELP, "activate", P_HELP_BINGO'ACCESS); end P_CREATE_GAME_MENU; --================================================================== procedure P_CREATE_MENU_BAR (V_MENU_BAR : out GTK.MENU_BAR.GTK_MENU_BAR) is V_GAME_MENU_ITEM : GTK.MENU_ITEM.GTK_MENU_ITEM; begin P_CREATE_GAME_MENU (V_GAME_MENU_ITEM => V_GAME_MENU_ITEM); -- It creates the menu bar which contains all the menus. -- GTK.MENU_BAR.GTK_NEW (V_MENU_BAR); GTK.MENU_BAR.ADD (V_MENU_BAR, V_GAME_MENU_ITEM); end P_CREATE_MENU_BAR; --================================================================== --[ -- This is the main gtkada procedure. -- It initialises the bingo's bombo and the GTKAda HMI. --] procedure P_CREATE_WIDGETS is V_UPPER_AREA : GTK.BOX.GTK_BOX; V_NUMBERS_BOX : GTK.BOX.GTK_BOX; V_MAIN_WINDOW : GTK.WINDOW.GTK_WINDOW; V_MENU_BAR : GTK.MENU_BAR.GTK_MENU_BAR; begin Q_BINGO.Q_GTK.Q_INTL.P_INITIALISE; P_LOAD_CSS; P_CREATE_UPPER_AREA (V_UPPER_AREA => V_UPPER_AREA); P_CREATE_NUMBERS (V_NUMBERS_BOX => V_NUMBERS_BOX); P_CREATE_MENU_BAR (V_MENU_BAR => V_MENU_BAR); P_CREATE_MAIN_WINDOW (V_MENU_BAR => V_MENU_BAR, V_UPPER_AREA => V_UPPER_AREA, V_NUMBERS_BOX => V_NUMBERS_BOX, V_MAIN_WINDOW => V_MAIN_WINDOW); Q_MAIN_WINDOW_HANDLER.CONNECT (V_MAIN_WINDOW, "key_press_event", Q_MAIN_WINDOW_HANDLER.TO_MARSHALLER (F_MAIN_WINDOW_BUTTON_PRESS'ACCESS)); -- Initialise bombo numbers. -- P_INIT_BINGO; V_MAIN_WINDOW.ON_DESTROY (P_MAIN_QUIT'ACCESS); V_MAIN_WINDOW.MAXIMIZE; V_MAIN_WINDOW.SHOW_ALL; end P_CREATE_WIDGETS; --================================================================== end Q_BINGADA;
regtests/search-positions-tests.adb
stcarrez/ada-search
9
12951
----------------------------------------------------------------------- -- search-positions-tests -- Tests for positions -- Copyright (C) 2020 <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 Util.Test_Caller; package body Search.Positions.Tests is package Caller is new Util.Test_Caller (Test, "Search.Positions"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Search.Positions.Add", Test_Add_Positions'Access); end Add_Tests; procedure Test_Add_Positions (T : in out Test) is P : Position_Type; begin Util.Tests.Assert_Equals (T, 0, Last (P), "Invalid Last value"); Add (P, 1); Util.Tests.Assert_Equals (T, 1, Last (P), "Invalid Last value"); end Test_Add_Positions; end Search.Positions.Tests;
misc/tests/test2.asm
SimonFJ20/jdh-8
911
21070
<gh_stars>100-1000 @org 0x0000 @include "os/arch.asm" @define SEED 0x8000 @define OFFSET 0x8001 sw [ADDR_MB], 0x01 lda a, b, [0x0000] loop: lda [image] add16 h, l, a, b lw c lda [ADDR_BANK] add16 h, l, a, b sw c add16 a, b, 0x01 eq16 a, b, (SCANLINE_WIDTH_BYTES * SCREEN_HEIGHT) jne [loop] ; fib fib: mw a, 0 mw b, 1 mw c, 9 .loop3: mw d, a add d, b mw a, b mw b, d clb sbb c, 1 jnz c, [.loop3] ; result sw [(ADDR_BANK + (SCANLINE_WIDTH_BYTES * 16) + 16)], d spin: jmp [spin] @include "programs/holiday/image.asm"
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c8/c87b27a.ada
best08618/asylo
7
7592
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c8/c87b27a.ada -- C87B27A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT OVERLOADING RESOLUTION USES THE RULE THAT: -- -- THE TYPE OF A STRING LITERAL MUST BE DETERMINED FROM THE FACT -- THAT A STRING LITERAL IS A VALUE OF A ONE DIMENSIONAL ARRAY OF -- CHARACTER COMPONENTS. -- TRH 18 AUG 82 -- DSJ 07 JUN 83 WITH REPORT; USE REPORT; PROCEDURE C87B27A IS TYPE ENUMLIT IS (A, B, C, D, E, F); TYPE NEW_CHAR IS NEW CHARACTER RANGE 'G' .. 'Z'; TYPE CHARS3 IS ('G','H','I','K','M','N','P','R','S','T'); TYPE CHARS4 IS ('S','T','R','I','N','G','Z','A','P'); TYPE NEW_STR IS ARRAY (A .. F) OF NEW_CHAR; TYPE STRING3 IS ARRAY (11..16) OF CHARS3; TYPE STRING4 IS ARRAY (21..26) OF CHARS4; TYPE ENUM_VEC IS ARRAY (1 .. 6) OF ENUMLIT; TYPE CHAR_GRID IS ARRAY (D .. F, 1 .. 3) OF NEW_CHAR; TYPE STR_LIST IS ARRAY (1 .. 6) OF STRING (1 .. 1); ERR : BOOLEAN := FALSE; PROCEDURE P (X : NEW_STR) IS BEGIN NULL; END P; PROCEDURE P (X : ENUM_VEC) IS BEGIN ERR := TRUE; END P; PROCEDURE P (X : CHAR_GRID) IS BEGIN ERR := TRUE; END P; PROCEDURE P (X : STR_LIST) IS BEGIN ERR := TRUE; END P; BEGIN TEST ("C87B27A","OVERLOADING RESOLUTION OF STRING LITERALS"); P ("STRING"); IF ERR THEN FAILED ("RESOLUTION INCORRECT FOR STRING LITERALS"); END IF; RESULT; END C87B27A;
ch02/2_power_4.asm
zzb610/asm-learn
0
18984
data SEGMENT hello DB 'Hello World!$' ;注意要以$结束 data ENDS code SEGMENT ASSUME CS:CODE,DS:DATA start: mov ax, 2; mov ax, ax; mov ax, ax; mov ax, ax int 21h ;调用4C00h号功能,结束程序 code ENDS END start
invokes_plsql/src/main/antlr4/dev/evolution/plsql/PlSqlComment.g4
victoryw/LADE_Analysis
12
6938
grammar PlSqlComment; swallow_to_semi : ~( ';' )+ ; compilation_unit : unit_statement* EOF ; unit_statement : comment ; comment : SINGLE_LINE_COMMENT | MULTI_LINE_COMMENT ; //{ Rule #097 <COMMENT> SINGLE_LINE_COMMENT : '--' ( ~('\r' | '\n') )* (NEWLINE|EOF) -> channel(2) ; //:'--' ( ~('\r' | '\n') )* (NEWLINE|EOF) -> channel(HIDDEN) MULTI_LINE_COMMENT : '/*' .*? '*/' -> channel(2) ; fragment NEWLINE: '\r'? '\n';
dev/smartdrv/doubleb/badpart.asm
minblock/msdos
0
86005
<reponame>minblock/msdos ; ; Microsoft Confidential ; Copyright (C) Microsoft Corporation 1991 ; All Rights Reserved. ; vseg segment byte public 'CODE' assume cs:vseg,ds:vseg,es:NOTHING PUBLIC check_for_dangerous_disk_partitions PUBLIC last_safe_byte _PartitionEntry struc PartBoot db ? ; Boot indicator PartBeginHead db ? ; Beginning Head PartBeginSect db ? ; Beginning Sector PartBeginCyl db ? ; Beginning Cylinder ; Above two bytes are in ; INT 13h format bits 8 & 9 ; of Cylinder in high 2 bits ; of PartBeginSect PartSystemID db ? ; Partition ID PartEndHead db ? ; Ending Head PartEndSect db ? ; Ending Sector PartEndCyl db ? ; Ending Cylinder ; See Comment for PartStartCyl PartRelStart dd ? ; Starting Sector (Relative to ; beginning of Disk PartNumSects dd ? ; Number of sectors in ; Partition _PartitionEntry ends PARTENTRY_SIZE equ (SIZE _PartitionEntry) MBR_SIGNATURE equ 0aa55h MBR_SIGLENGTH equ 2 ONTRACK_SIG equ 055aah ; M013 ONTRACK_SIGLEN equ 2 ONTRACK_NUMPARTS equ 16 ONTRACK_PARTSIZE equ (ONTRACK_NUMPARTS * PARTENTRY_SIZE) SSTOR_NUMPARTS equ 8 DOS_NUMPARTS equ 4 MAXMBRCODESIZE equ (512-ONTRACK_PARTSIZE-MBR_SIGLENGTH-ONTRACK_SIGLEN) __MBR struc MBR_Code db MAXMBRCODESIZE dup (?) MBR_OnTrkSig dw ? MBR_OnTrkPart db ((ONTRACK_NUMPARTS-SSTOR_NUMPARTS)*(PARTENTRY_SIZE)) dup (?) MBR_SStorPart db ((SSTOR_NUMPARTS-DOS_NUMPARTS)*(PARTENTRY_SIZE)) dup (?) MBR_DOSPart db (DOS_NUMPARTS * (PARTENTRY_SIZE)) dup (?) MBR_Sign dw ? __MBR ends ; Partition system indicators for disk partitions which we may ; not work with: RiskyPartitions label byte db 50h,51h ; Ontrack's Disk Manager db 56h ; Golden Bow's Vfeature db 61h,63h,64h,66h,71h,73h,74h,76h SSTORParts label byte ; M10 db 0E1h,0E3h,0E4h,0E6h,0F1h,0F3h,0F4h,0F6h ;M07 ;M03 ; Storage Dimensions' SpeedStor NUMSSPARTIDS equ $-SSTORParts ; M10 db 21h,23h,24h,26h,31h,33h,34h,36h db 0A1h,0A3h,0A4h,0A6h,0B1h,0B3h,0B4h,0B6h ;M07 ; HP Volume Expansion (SpeedStor derivative) db 45h ;M03 ; Priam NUM_RISKYPARTITIONS equ $-RiskyPartitions db 05 ; Extended DOS partition; M10 EXTNUM_RISKYPARTS equ $-RiskyPartitions ; M10 VfeatureStr db "Vfeature" ; string to identify Vfeature LEN_VFEATURESTR equ $-VfeatureStr PartitionCheck db 1 ; check for incompatible disk ; partitions = true ; M10 - BEGIN ExtPartCheck db 1 ; scan extended master boot record ; for incompatible disk partitions ; M10 - END UMBCheck db 1 ;M06 ; check that we can read all disks UMBCheckSig db "DOlSMRDO" ;M06 ; signature M10 CHECKSIGLEN equ $-UMBCheckSig ;M06 ; signature length check_for_dangerous_disk_partitions proc near ; ; 3.5 Check for dangerous disk partitions. ; mov bp,sp ; BP = saved stack pointer push cs pop es assume es:vseg ; Determine number of drives through BIOS GetParams call. ; ; This may not work correctly with some systems (some Compaq's?) ; that return only the number of drives attached to the corresponding ; controller. MS-DOS has decided to support the IBM approach, ; which returns the total number of hard drives for any GetParams call. mov dl,80h ; DL = physical drive number mov ah,8 ; AH = 'Get Drive Parameters' int 13h ; call BIOS jc PartitionCheckDone ; no hard drives? - give up ; DL = number of drives xor dh,dh ; DX = number of drives mov cx,dx ; CX = number of drives mov dl,80h ; DL = physical drive number GetPartitionTable: push cx ; save number of drives remaining mov bx,offset temp_buffer ; ES:BX = ptr to buffer mov dh,0 ; DH = head = 0 mov cx,1 ; CX = cylinder/sector = 0/1 mov ax,0201h ; AX = function/#secs = READ/1 ; push dx ; save drive number stc int 13h ; call BIOS disk services ; pop dx ; DL = drive number jc PartitionCheckDone ; BIOS is fucking with us - give up mov bx,MBR_DOSPart ; BX = offset of partition table mov cx,DOS_NUMPARTS ; CX = # partition entries in table NextPartitionEntry: push cx ; save partition entry count mov al,temp_buffer[bx].PartSystemID ; AL = partition system indicator mov di,offset RiskyPartitions ; ES:DI = ptr to list of risky ; partition system indicators mov cx,NUM_RISKYPARTITIONS ; CX = length of list cld repne scasb ; scan list for match pop cx ; CX = partition entry count again ; je RiskyPartition ; found a risky partition jne @f jmp RiskyPartition @@: add bx,PARTENTRY_SIZE ; BX = offset of next partition entry loop NextPartitionEntry ; M10 - BEGIN ; ; Look for Extended MBR partition entries SPEEDSTOR has 4 more ; entries but no signature in the MBR. Ontrack has 12 more entries ; but will have signature AA55 at offset FC. ; ; Speedstor uses system indicator 05 (DOS extended partition ID) also. ; So if we find a 05 partition system indicator in partition entries ; 5 thru 8 we assume that it is a Speeed Stor MBR. ; cmp ExtPartCheck, 0 ; do we want to scan extended MBR ? je NoExtPartCheck ; no mov bx, MBR_OnTrkPart ; Setup regs for Ontrack disk scan mov cx, (ONTRACK_NUMPARTS-DOS_NUMPARTS) mov si, NUM_RISKYPARTITIONS cmp word ptr temp_buffer[MBR_OnTrkSig], ONTRACK_SIG ; Is it an OnTrack Master boot record ? je NextExtPartEntry ; yes mov bx, MBR_SStorPart ; setup regs for SSTOR disk type mov cx, (SSTOR_NUMPARTS-DOS_NUMPARTS) mov si, EXTNUM_RISKYPARTS ; This includes DOS extended partition ; system indicator 5 also, since ; SppedStor uses this ID also. NextExtPartEntry: ; ; M12 - BEGIN ; mov al, temp_buffer[bx].PartBoot and al, 7fh or al, al ; partition boot indicator should ; be either 0 or 80h ; else we assume that it is an ; invalid partition entry jnz next_entry ; ; M12 - END ; mov di, offset RiskyPartitions mov al, temp_buffer[bx].PartSystemID ; AL = partition system indicator ; ES:DI = ptr to list of risky ; partition system indicators push cx ; save partition entry count mov cx, si ; CX = length of list cld repne scasb ; scan list for match pop cx ; CX = partition entry count again jne next_entry jmp RiskyPartition ; found a risky partition next_entry: add bx,PARTENTRY_SIZE ; BX = offset of next partition entry loop NextExtPartEntry NoExtPartCheck: ; ; M10 - END ; inc dl ; DL = next drive number pop cx ; CX = number of drives remaining loop GetPartitionTable ; go check partitions on next drive ; ; M10 - BEGIN ; PartitionCheckDone: ; ; Chain thru the Extended partitions (id == 05) and make sure that ; there are no Speedstor partitions within them. ; cmp ExtPartCheck, 0 ; do we want to scan extended partns ? je ExtPartitionCheckDone ; no mov dl,80h ; DL = physical drive number mov ah,8 ; AH = 'Get Drive Parameters' int 13h ; call BIOS jc ExtPartitionCheckDone ; no hard drives? - give up ; DL = number of drives xor dh,dh ; DX = number of drives mov cx,dx ; CX = number of drives mov dl,80h ; DL = physical drive number ExtGetPartitionTable: push cx ; save number of drives remaining mov bx,offset temp_buffer ; ES:BX = ptr to buffer mov dh,0 ; DH = head = 0 mov cx,1 ; CX = cylinder/sector = 0/1 mov ax,0201h ; AX = function/#secs = READ/1 push dx ; save drive number stc int 13h ; call BIOS disk services pop dx ; DL = drive number jc ExtPartitionCheckDone ; BIOS is fucking with us - give up NextExtMBR: mov bx,MBR_DOSPart ; BX = offset of partition table mov cx,DOS_NUMPARTS ; CX = # partition entries in table NextExtPart: push cx ; save partition entry count mov al,temp_buffer[bx].PartSystemID ; AL = partition system indicator mov di,offset SSTORParts ; point to Speedstor partn IDs ; ES:DI = ptr to list of risky ; partition system indicators mov cx,NUMSSPARTIDS ; CX = number of SpeedStor partn IDs cld repne scasb ; scan list for match pop cx ; CX = partition entry count again je RiskyPartition ; found a risky partition add bx,PARTENTRY_SIZE ; BX = offset of next partition entry loop NextExtPart ; ; scan and find the extended partition entry (if there is one) ; mov bx, MBR_DOSPart mov cx, DOS_NUMPARTS Next05: cmp temp_buffer[bx]+4, 05 ; Extended partition ? je ReadExtendedMBR add bx, PARTENTRY_SIZE loop Next05 ; ; no more extended partition, try the next drive ; jmp short NextExtMBRDrv ; ; found one extended partition entry ; temp_buffer[bx] : pointer to the extended partition entry ; ReadExtendedMBR: mov ax, 201h ; read one sector mov cx, word ptr temp_buffer[bx].PartBeginSect ; CX = cylinder/sector number mov dh, temp_buffer[bx].PartBeginHead ; DH = head number mov bx, offset temp_buffer ; into temp_buffer stc int 13h jc NextExtMBRDrv ; give up on this drive in case of err cmp word ptr temp_buffer[MBR_Sign], MBR_SIGNATURE ; valid boot ? je NextExtMBR ; start scanning for Speedstor ; partitions in the newly read in MBR NextExtMBRDrv: inc dl pop cx loop ExtGetPartitionTable jmp short ExtPartitionCheckDone ; ; M10 - END ; RiskyPartition: ; We found a partition that is on our list of at-risk systems. ; Complain about it and abort our load. mov sp,bp ; restore stack pointer stc ret ExtPartitionCheckDone: mov sp,bp ; restore stack pointer assume es:NOTHING ; All the partition system indicators looked ok. ; Vfeature Deluxe (Golden Bow Systems) could still be out there. ; Scan the device chain for their device driver. ; Look at offset 0Bh from each device header for the string "Vfeature". mov ah,52h ; AH = 'Get Sysinit Variables' int 21h ; ES:BX = ptr to sysinit variables add bx,22h ; ES:BX = ptr to NUL device header NextVfeatureCheck: mov di,bx ; ES:DI = ptr to device header add di,0Bh ; ES:DI = ptr to possible "Vfeature" mov si,offset VfeatureStr ; DS:SI = ptr to "Vfeature" constant mov cx,LEN_VFEATURESTR ; CX = string length cld repe cmpsb ; compare the strings je RiskyPartition ; they're the same - go abort les bx,es:[bx] ; ES:BX = ptr to next device header cmp bx,0FFFFh ; check for end of device chain jne NextVfeatureCheck ; not last device - check the next one NoRisk: clc ret check_for_dangerous_disk_partitions endp last_safe_byte db ? temp_buffer db 1 vseg ends end 
loaders_patches_etc/screen_plasm_fade.asm
alexanderbazhenoff/zx-spectrum-various
0
86742
ORG 25500 ATRBUF EQU #8400 ADRBUF EQU #BA00 PHASES EQU 32 DI LD HL,#BE00 LD B,L LD A,H LD I,A INC A INT_IL LD (HL),A INC HL DJNZ INT_IL LD (HL),A LD HL,#5800 LD BC,#300 LD D,B LD E,C CHA_L LD A,(HL) OR A JR NZ,NO0ATR DEC DE NO0ATR DEC BC INC HL LD A,B OR C JR NZ,CHA_L LD A,D OR E JR Z,NOFADE0 FADEP LD DE,ATRBUF LD HL,#5800 LD BC,#300 PUSH DE PUSH HL LDIR POP DE POP HL LD B,8 FADEPL PUSH BC PUSH AF PUSH DE PUSH HL PUSH HL EI DUP 4 HALT EDUP LD B,3 LDIR POP HL CALL FADE_ POP HL POP DE POP AF POP BC DJNZ FADEPL NOFADE0 LD HL,SCREEN LD DE,#4000 LD BC,#C020 LOOP PUSH BC PUSH DE LOOP1 LD A,(HL) LD (DE),A INC HL INC D LD A,D AND 7 JR NZ,AROUND LD A,E ADD A,#20 LD E,A JR C,AROUND LD A,D SUB 8 LD D,A AROUND DJNZ LOOP1 POP DE INC DE POP BC DEC C JR NZ,LOOP LD DE,ATRBUF+#1500 LD B,3 PUSH HL PUSH BC LDIR POP BC POP HL LD DE,ATRBUF PUSH DE LDIR POP HL LD B,6 LD DE,ATRBUF+#1200 SFAD_L PUSH BC PUSH HL PUSH HL PUSH DE CALL FADE_ POP DE POP HL LD B,3 LDIR LD A,D SUB 6 LD D,A POP HL POP BC DJNZ SFAD_L LD HL,#C000 LD DE,#1017 LD BC,#7FFD OUT (C),E LD (HL),E OUT (C),D LD (HL),D OUT (C),E LD A,(HL) CP E JP NZ,MODE48 LD A,#C3 LD (#BFBF),A LD HL,INT LD (#BFC0),HL IM 2 DI LD HL,#4000 LD DE,#C000 LD BC,#1B00 LDIR LD HL,ATRBUF LD DE,ATRBUF+1 LD BC,#2FF LD (HL),L LDIR LD A,ATRBUF/#100 LD HL,ADRBUF LD DE,ADRBUF+1 CRADTL LD B,1 LD (HL),A LDIR INC A CP ATRBUF/#100+3 JR NZ,CRADTL PUSH IY XOR A OUT_ML PUSH AF INC A LD (PHASE),A EI HALT LD DE,#D800 LD L,E LD IX,TABL LD IY,ADRBUF LD B,3 OUT_L1 LD A,(IX) CP 0 PHASE EQU $-1 JR NC,NOFADZ1 LD A,(IY) CP ATRBUF/#100+#15 JR NC,NOFADZ ADD A,3 LD (IY),A NOFADZ LD H,A INC IY INC IX LDI JP PE,OUT_L1 ALLATR POP AF INC A CP PHASES JR NZ,OUT_ML POP IY LD A,#10 LD BC,#7FFD OUT (C),A IM 1 EI RET NOFADZ1 INC IY INC IX INC L INC DE DEC BC LD A,B OR C JR NZ,OUT_L1 JR ALLATR MODE48 LD B,7 LD HL,ATRBUF+#300 OUT_L PUSH BC LD DE,#5800 LD BC,#300 EI DUP 4 HALT EDUP LDIR POP BC DJNZ OUT_L RET INT DI PUSH AF PUSH BC LD A,#15+8 SCREENP EQU $-1 LD BC,#7FFD OUT (C),A XOR 8+2 LD (SCREENP),A POP BC POP AF RET FADE_ LD BC,#300 FAD_LP LD D,(HL) LD A,D AND 1+2+4 OR A JR Z,NODINK DEC D NODINK LD A,D AND 8+16+32 OR A JR Z,NODPAP LD A,D SUB 8 LD D,A NODPAP LD (HL),D INC HL DEC BC LD A,B OR C JR NZ,FAD_LP RET TABL INCBIN "PLASMTBL" SCREEN INCBIN "PICTURE"
src/arch/i686/int_routines/keyboard_irq_wrapper.asm
miklhh/os4
3
23328
global keyboard_irq_wrapper:function (keyboard_irq_wrapper.end - keyboard_irq_wrapper) keyboard_irq_wrapper: pusha extern keyboard_irq call keyboard_irq popa iret .end:
src/DTGP.agda
larrytheliquid/dtgp
9
12432
<reponame>larrytheliquid/dtgp<filename>src/DTGP.agda open import Relation.Nullary open import Relation.Binary.PropositionalEquality module DTGP {Domain Word : Set} (pre post : Word → Domain → Domain) (_≟_ : (x y : Domain) → Dec (x ≡ y)) where open import Function open import Relation.Binary open import Data.Bool hiding (_≟_) open import Data.Nat hiding (_≥_; _≟_) open import Data.Fin hiding (_+_; raise) open import Data.Maybe open import Data.Product hiding (map; swap) open import Data.List hiding (length) renaming (_++_ to _l++_) open import Data.Vec hiding (_++_; _>>=_; concat; map; init) open import DTGP.Rand infixr 5 _∷_ _++_ _++'_ data Term (inp : Domain) : Domain → Set where [] : Term inp inp _∷_ : ∀ {d} (w : Word) → Term inp (pre w d) → Term inp (post w d) _++_ : ∀ {inp mid out} → Term mid out → Term inp mid → Term inp out [] ++ ys = ys (x ∷ xs) ++ ys = x ∷ (xs ++ ys) data Split {inp out} mid : Term inp out → Set where _++'_ : (xs : Term mid out) (ys : Term inp mid) → Split mid (xs ++ ys) swap₁ : ∀ {inp mid out} {xs ys : Term inp out} → Split mid xs → Split mid ys → Term inp out swap₁ (xs ++' ys) (as ++' bs) = xs ++ bs swap₂ : ∀ {inp mid out} {xs ys : Term inp out} → Split mid xs → Split mid ys → Term inp out swap₂ (xs ++' ys) (as ++' bs) = as ++ ys swaps : ∀ {inp mid out} {xs ys : Term inp out} → Split mid xs → Split mid ys → Term inp out × Term inp out swaps xs ys = swap₁ xs ys , swap₂ xs ys split : ∀ {inp out} (n : ℕ) (xs : Term inp out) → ∃ λ mid → Split mid xs split zero xs = _ , [] ++' xs split (suc n) [] = _ , [] ++' [] split (suc n) (x ∷ xs) with split n xs split (suc n) (x ∷ ._) | _ , xs ++' ys = _ , (x ∷ xs) ++' ys splits : ∀ {inp out} (n : ℕ) mid → (xs : Term inp out) → ∃ (Vec (Split mid xs)) splits zero mid xs with split zero xs ... | mid' , ys with mid ≟ mid' ... | yes p rewrite p = _ , ys ∷ [] ... | no p = _ , [] splits (suc n) mid xs with split (suc n) xs ... | mid' , ys with mid ≟ mid' | splits n mid xs ... | yes p | _ , yss rewrite p = _ , ys ∷ yss ... | no p | _ , yss = _ , yss length : ∀ {inp out} → Term inp out → ℕ length [] = 0 length (x ∷ xs) = suc (length xs) split♀ : ∀ {inp out} → (xs : Term inp out) → Rand (∃ λ mid → Split mid xs) split♀ xs = rand >>= λ r → let i = r mod (suc (length xs)) in return (split (toℕ i) xs) split♂ : ∀ {inp out} (xs : Term inp out) mid → Maybe (Rand (Split mid xs)) split♂ xs B with splits (length xs) B xs ... | zero , [] = nothing ... | suc n , xss = just ( rand >>= λ r → return (lookup (r mod suc n) xss) ) crossover : ∀ {inp out} (♀ ♂ : Term inp out) → Rand (Term inp out × Term inp out) crossover ♀ ♂ = split♀ ♀ >>= λ b,xs → maybe′ (_=<<_ (return ∘ (swaps (proj₂ b,xs)))) (return (♀ , ♂)) (split♂ ♂ (proj₁ b,xs)) Population : ∀ inp out n → Set Population inp out n = Vec (Term inp out) (2 + n) module Initialization (match : ∀ w out → Dec (∃ λ d → out ≡ pre w d)) where toMaybe : ∀ {w inp out} → Term inp out → Dec (∃ λ d → out ≡ pre w d) → Maybe (∃ λ d → Term inp d) toMaybe {w = w} ws (no _) = nothing toMaybe {w = w} ws (yes (_ , p)) rewrite p = just (_ , w ∷ ws) enum-inp : ∀ (n : ℕ) inp → List Word → List (∃ λ out → Term inp out) enum-inp zero inp ws = gfilter (λ w → toMaybe [] (match w inp)) ws enum-inp (suc n) A ws with enum-inp n A ws ... | ih = concat (map (λ out,t → gfilter (λ w → toMaybe (proj₂ out,t) (match w (proj₁ out,t)) ) ws) ih) l++ ih filter-out : ∀ {inp} out → List (∃ (Term inp)) → List (Term inp out) filter-out out [] = [] filter-out out ((out' , x) ∷ xs) with out' ≟ out ... | no p = filter-out out xs ... | yes p rewrite p = x ∷ filter-out out xs init : ∀ (n : ℕ) inp out → List Word → List (Term inp out) init n inp out ws = filter-out out (enum-inp n inp ws) module Evolution {inp out} (score : Term inp out → ℕ) where _≥_ : ℕ → ℕ → Bool zero ≥ zero = true zero ≥ (suc n) = false (suc m) ≥ zero = true (suc m) ≥ (suc n) = m ≥ n select : ∀ {n} → Population inp out n → Rand (Term inp out) select {n = n} xss = rand >>= λ ii → rand >>= λ jj → let ♀ = lookup (ii mod (2 + n)) xss ♂ = lookup (jj mod (2 + n)) xss in return $ if score ♀ ≥ score ♂ then ♀ else ♂ breed2 : ∀ {n} → Population inp out n → Rand (Term inp out × Term inp out) breed2 xss = select xss >>= λ ♀ → select xss >>= λ ♂ → crossover ♀ ♂ breedN : ∀ {m} → (n : ℕ) → Population inp out m → Rand (Vec (Term inp out) n) breedN zero xss = return [] breedN (suc n) xss = breed2 xss >>= λ offspring → breedN n xss >>= λ ih → return (proj₁ offspring ∷ ih) evolve1 : ∀ {n} → Population inp out n → Rand (Population inp out n) evolve1 xss = breedN _ xss evolveN : ∀ {n} → (gens : ℕ) → Population inp out n → Rand (Population inp out n) evolveN zero xss = return xss evolveN (suc gens) xss = evolveN gens xss >>= evolve1 evolve : ∀ {n} → (seed gens : ℕ) → Population inp out n → Population inp out n evolve seed gens xss = runRand (evolveN gens xss) seed
src/keystore-tools.adb
thierr26/ada-keystore
25
8723
<reponame>thierr26/ada-keystore ----------------------------------------------------------------------- -- keystore-tools -- Tools for the keystore -- Copyright (C) 2019 <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.Stream_IO; with Util.Log.Loggers; with Util.Streams.Files; package body Keystore.Tools is use type Ada.Directories.File_Kind; subtype File_Kind is Ada.Directories.File_Kind; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.Tools"); -- ------------------------------ -- Store the file in the keystore and use the prefix followed by the file basename -- for the name to identify the stored the content. -- ------------------------------ procedure Store (Wallet : in out Keystore.Wallet'Class; Path : in String; Prefix : in String) is Name : constant String := Prefix & Ada.Directories.Simple_Name (Path); File : Util.Streams.Files.File_Stream; begin Log.Info ("Store file {0} as {1}", Path, Name); File.Open (Mode => Ada.Streams.Stream_IO.In_File, Name => Path); Wallet.Set (Name => Name, Kind => Keystore.T_FILE, Input => File); end Store; -- ------------------------------ -- Scan the directory for files matching the pattern and store them in the -- keystore when the filter predicate accepts them. -- ------------------------------ procedure Store (Wallet : in out Keystore.Wallet'Class; Path : in String; Prefix : in String; Pattern : in String; Filter : not null access function (Ent : in Directory_Entry_Type) return Boolean) is Search_Filter : constant Ada.Directories.Filter_Type := (Ada.Directories.Ordinary_File => True, Ada.Directories.Directory => True, Ada.Directories.Special_File => False); Search : Ada.Directories.Search_Type; Ent : Directory_Entry_Type; begin Log.Info ("Scan directory {0}", Path); Ada.Directories.Start_Search (Search, Directory => Path, Pattern => Pattern, Filter => Search_Filter); while Ada.Directories.More_Entries (Search) loop Ada.Directories.Get_Next_Entry (Search, Ent); declare Name : constant String := Ada.Directories.Simple_Name (Ent); Kind : constant File_Kind := Ada.Directories.Kind (Ent); Fpath : constant String := Ada.Directories.Full_Name (Ent); begin if Kind /= Ada.Directories.Directory then if Filter (Ent) then Store (Wallet, Fpath, Prefix); end if; elsif Name /= "." and then Name /= ".." then if Filter (Ent) then Store (Wallet, Fpath, Prefix & Name & '/', Pattern, Filter); end if; end if; end; end loop; end Store; end Keystore.Tools;
Definition/LogicalRelation/Substitution/Introductions/Universe.agda
loic-p/logrel-mltt
0
13069
<filename>Definition/LogicalRelation/Substitution/Introductions/Universe.agda<gh_stars>0 {-# OPTIONS --without-K --safe #-} open import Definition.Typed.EqualityRelation module Definition.LogicalRelation.Substitution.Introductions.Universe {{eqrel : EqRelSet}} where open EqRelSet {{...}} open import Definition.Untyped open import Definition.LogicalRelation open import Definition.LogicalRelation.Properties open import Definition.LogicalRelation.Substitution open import Tools.Product import Tools.PropositionalEquality as PE -- Validity of the universe type. Uᵛ : ∀ {Γ} ([Γ] : ⊩ᵛ Γ) → Γ ⊩ᵛ⟨ ¹ ⟩ U / [Γ] Uᵛ [Γ] ⊢Δ [σ] = Uᵣ′ ⁰ 0<1 ⊢Δ , λ _ x₂ → U₌ PE.refl -- Valid terms of type U are valid types. univᵛ : ∀ {A Γ l l′} ([Γ] : ⊩ᵛ Γ) ([U] : Γ ⊩ᵛ⟨ l ⟩ U / [Γ]) → Γ ⊩ᵛ⟨ l ⟩ A ∷ U / [Γ] / [U] → Γ ⊩ᵛ⟨ l′ ⟩ A / [Γ] univᵛ {l′ = l′} [Γ] [U] [A] ⊢Δ [σ] = let [A]₁ = maybeEmb′ {l′} (univEq (proj₁ ([U] ⊢Δ [σ])) (proj₁ ([A] ⊢Δ [σ]))) in [A]₁ , (λ [σ′] [σ≡σ′] → univEqEq (proj₁ ([U] ⊢Δ [σ])) [A]₁ ((proj₂ ([A] ⊢Δ [σ])) [σ′] [σ≡σ′])) -- Valid term equality of type U is valid type equality. univEqᵛ : ∀ {A B Γ l l′} ([Γ] : ⊩ᵛ Γ) ([U] : Γ ⊩ᵛ⟨ l′ ⟩ U / [Γ]) ([A] : Γ ⊩ᵛ⟨ l ⟩ A / [Γ]) → Γ ⊩ᵛ⟨ l′ ⟩ A ≡ B ∷ U / [Γ] / [U] → Γ ⊩ᵛ⟨ l ⟩ A ≡ B / [Γ] / [A] univEqᵛ {A} [Γ] [U] [A] [t≡u] ⊢Δ [σ] = univEqEq (proj₁ ([U] ⊢Δ [σ])) (proj₁ ([A] ⊢Δ [σ])) ([t≡u] ⊢Δ [σ])
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_549.asm
ljhsiun2/medusa
9
93909
<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_549.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r9 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x11c7f, %rsi lea addresses_normal_ht+0x19a7f, %rdi nop nop nop sub $46914, %rdx mov $88, %rcx rep movsq nop nop nop and $731, %r13 lea addresses_WC_ht+0x1ec7f, %r9 nop nop and %r11, %r11 vmovups (%r9), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %rcx nop nop nop nop nop xor %r13, %r13 lea addresses_UC_ht+0x4c95, %rsi lea addresses_WC_ht+0xa853, %rdi clflush (%rdi) nop mfence mov $14, %rcx rep movsl nop nop xor %rdx, %rdx lea addresses_WT_ht+0x6c0f, %rsi lea addresses_UC_ht+0x8e4d, %rdi nop nop nop nop nop and %r11, %r11 mov $97, %rcx rep movsw nop nop nop nop nop cmp $26380, %r9 lea addresses_WT_ht+0xafe9, %rsi lea addresses_A_ht+0xe07f, %rdi nop nop xor $61745, %r9 mov $119, %rcx rep movsb nop nop nop nop nop xor $41244, %rsi lea addresses_A_ht+0x547f, %rdi nop nop nop nop nop sub %r13, %r13 mov (%rdi), %eax nop nop nop nop dec %r9 lea addresses_UC_ht+0x19902, %r11 nop nop sub $4519, %rsi mov (%r11), %di xor %r9, %r9 lea addresses_normal_ht+0x10ae2, %rsi nop cmp $48794, %rdx movl $0x61626364, (%rsi) nop and $4508, %r11 lea addresses_normal_ht+0xc07f, %rsi nop nop add %r11, %r11 mov $0x6162636465666768, %rcx movq %rcx, %xmm6 movups %xmm6, (%rsi) nop nop nop nop cmp %r11, %r11 lea addresses_UC_ht+0x12d77, %rsi lea addresses_UC_ht+0x1d3ff, %rdi clflush (%rdi) nop nop nop nop and $24344, %rdx mov $91, %rcx rep movsb nop nop sub $18520, %rdx lea addresses_WC_ht+0x1b48f, %rax nop nop nop nop nop cmp $626, %r9 mov $0x6162636465666768, %r13 movq %r13, %xmm7 and $0xffffffffffffffc0, %rax movntdq %xmm7, (%rax) nop nop inc %rdi lea addresses_normal_ht+0x10f7f, %rsi lea addresses_A_ht+0x17787, %rdi nop nop nop nop xor %r11, %r11 mov $106, %rcx rep movsb nop nop nop nop and $30747, %r9 lea addresses_WT_ht+0x1c87f, %rsi lea addresses_normal_ht+0x5a7f, %rdi xor $53416, %r13 mov $95, %rcx rep movsw nop nop nop nop dec %rsi lea addresses_normal_ht+0x1607f, %rsi nop nop nop nop nop add $15580, %r11 vmovups (%rsi), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $1, %xmm3, %rdi nop nop nop inc %r9 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r9 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r14 push %rbp push %rcx push %rdx // Faulty Load lea addresses_normal+0xf87f, %rdx nop nop nop nop nop and %r14, %r14 mov (%rdx), %ecx lea oracles, %r14 and $0xff, %rcx shlq $12, %rcx mov (%r14,%rcx,1), %rcx pop %rdx pop %rcx pop %rbp pop %r14 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}} {'src': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16}} {'src': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 4, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}} {'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
src/arch/Ada/types.ads
vdh-anssi/ewok-kernel
65
26196
<filename>src/arch/Ada/types.ads pragma restrictions (no_secondary_stack); pragma restrictions (no_elaboration_code); pragma restrictions (no_finalization); pragma restrictions (no_exception_handlers); pragma restrictions (no_recursion); pragma restrictions (no_wide_characters); with system; with ada.unchecked_conversion; with interfaces; use interfaces; package types with spark_mode => on is KBYTE : constant := 2 ** 10; MBYTE : constant := 2 ** 20; GBYTE : constant := 2 ** 30; subtype byte is unsigned_8; subtype short is unsigned_16; subtype word is unsigned_32; subtype milliseconds is unsigned_64; subtype microseconds is unsigned_64; subtype system_address is unsigned_32; function to_address is new ada.unchecked_conversion (system_address, system.address); function to_system_address is new ada.unchecked_conversion (system.address, system_address); function to_word is new ada.unchecked_conversion (system.address, word); function to_unsigned_32 is new ada.unchecked_conversion (system.address, unsigned_32); pragma warnings (off); function to_unsigned_32 is new ada.unchecked_conversion (unsigned_8, unsigned_32); function to_unsigned_32 is new ada.unchecked_conversion (unsigned_16, unsigned_32); pragma warnings (on); type byte_array is array (unsigned_32 range <>) of byte; for byte_array'component_size use byte'size; type short_array is array (unsigned_32 range <>) of short; for short_array'component_size use short'size; type word_array is array (unsigned_32 range <>) of word; for word_array'component_size use word'size; type unsigned_8_array is new byte_array; type unsigned_16_array is new short_array; type unsigned_32_array is new word_array; nul : constant character := character'First; type bit is mod 2**1 with size => 1; type bits_2 is mod 2**2 with size => 2; type bits_3 is mod 2**3 with size => 3; type bits_4 is mod 2**4 with size => 4; type bits_5 is mod 2**5 with size => 5; type bits_6 is mod 2**6 with size => 6; type bits_7 is mod 2**7 with size => 7; -- type bits_9 is mod 2**9 with size => 9; type bits_10 is mod 2**10 with size => 10; type bits_11 is mod 2**11 with size => 11; type bits_12 is mod 2**12 with size => 12; -- type bits_17 is mod 2**17 with size => 17; -- type bits_24 is mod 2**24 with size => 24; -- type bits_27 is mod 2**27 with size => 27; type bool is new boolean with size => 1; for bool use (true => 1, false => 0); function to_bit (u : unsigned_8) return types.bit with pre => u <= 1; function to_bit (u : unsigned_32) return types.bit with pre => u <= 1; end types;
alloy4fun_models/trashltl/models/9/S4kqo6K7jPpdsmZjf.als
Kaixi26/org.alloytools.alloy
0
623
open main pred idS4kqo6K7jPpdsmZjf_prop10 { always Protected in Protected' } pred __repair { idS4kqo6K7jPpdsmZjf_prop10 } check __repair { idS4kqo6K7jPpdsmZjf_prop10 <=> prop10o }
src/LibraBFT/Impl/Properties/Common.agda
LaudateCorpus1/bft-consensus-agda
0
13081
<reponame>LaudateCorpus1/bft-consensus-agda {- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} open import LibraBFT.Concrete.System open import LibraBFT.Concrete.System.Parameters import LibraBFT.Concrete.Properties.Common as Common import LibraBFT.Concrete.Properties.VotesOnce as VO open import LibraBFT.Impl.Consensus.Network as Network open import LibraBFT.Impl.Consensus.Network.Properties as NetworkProps open import LibraBFT.Impl.Consensus.RoundManager import LibraBFT.Impl.Handle as Handle open import LibraBFT.Impl.IO.OBM.InputOutputHandlers open import LibraBFT.Impl.IO.OBM.Properties.InputOutputHandlers open import LibraBFT.Impl.Handle.Properties open import LibraBFT.Impl.Properties.Util open import LibraBFT.ImplShared.Consensus.Types open import LibraBFT.ImplShared.Consensus.Types.EpochDep open import LibraBFT.ImplShared.Interface.Output open import LibraBFT.ImplShared.Util.Crypto open import LibraBFT.ImplShared.Util.Dijkstra.All open import Optics.All open import Util.Lemmas open import Util.PKCS open import Util.Prelude open Invariants open RoundManagerTransProps open import LibraBFT.Abstract.Types.EpochConfig UID NodeId open ParamsWithInitAndHandlers Handle.InitHandler.initAndHandlers open PeerCanSignForPK open import LibraBFT.ImplShared.Util.HashCollisions Handle.InitHandler.initAndHandlers open import Yasm.Yasm ℓ-RoundManager ℓ-VSFP ConcSysParms Handle.InitHandler.initAndHandlers PeerCanSignForPK PeerCanSignForPK-stable open import LibraBFT.Impl.Handle.InitProperties open initHandlerSpec -- This module contains definitions and lemmas used by proofs of the -- implementation obligations for VotesOnce and PreferredRoundRule. module LibraBFT.Impl.Properties.Common where postulate -- TODO-3: prove (note: advanced; waiting on: `handle`) -- This will require updates to the existing proofs for the peer handlers. We -- will need to show that honest peers sign things only for their only PK, and -- that they either resend messages signed before or if sending a new one, -- that signature hasn't been sent before impl-sps-avp : StepPeerState-AllValidParts open Structural impl-sps-avp -- We can prove this easily for the Agda model because (unlike the Haskell -- prototype) it does not yet do epoch changes, so only the initial EC is -- relevant. Later, this will require us to use the fact that epoch changes -- require proof of committing an epoch-changing transaction. availEpochsConsistent : ∀{pid pid' v v' pk}{st : SystemState} → (pkvpf : PeerCanSignForPK st v pid pk) → (pkvpf' : PeerCanSignForPK st v' pid' pk) → v ^∙ vEpoch ≡ v' ^∙ vEpoch → pcs4𝓔 pkvpf ≡ pcs4𝓔 pkvpf' availEpochsConsistent (mkPCS4PK _ (inBootstrapInfo refl) _) (mkPCS4PK _ (inBootstrapInfo refl) _) refl = refl postulate -- TODO-1: Prove (waiting on: complete definition of `initRM`) uninitQcs∈Bootstrap : ∀ {pid qc vs}{st : SystemState} → ReachableSystemState st → initialised st pid ≡ uninitd → qc QCProps.∈RoundManager (peerStates st pid) → vs ∈ qcVotes qc → ∈BootstrapInfo-impl fakeBootstrapInfo (proj₂ vs) module ∈BootstrapInfoProps where sameSig∉ : ∀ {pk} {v v' : Vote} → (sig : WithVerSig pk v) (sig' : WithVerSig pk v') → ¬ ∈BootstrapInfo-impl fakeBootstrapInfo (ver-signature sig) → ver-signature sig' ≡ ver-signature sig → ¬ ∈BootstrapInfo-impl fakeBootstrapInfo (ver-signature sig') sameSig∉ _ _ ¬bootstrap ≡sig rewrite ≡sig = ¬bootstrap -- Lemmas for `PeerCanSignForPK` module PeerCanSignForPKProps where msb4 -- NOTE: This proof requires updating when we model epoch changes. : ∀ {pid v pk}{pre post : SystemState} → ReachableSystemState pre → Step pre post → PeerCanSignForPK post v pid pk → Meta-Honest-PK pk → (sig : WithVerSig pk v) → MsgWithSig∈ pk (ver-signature sig) (msgPool pre) → PeerCanSignForPK pre v pid pk msb4 preach step (mkPCS4PK 𝓔@._ (inBootstrapInfo refl) (mkPCS4PKin𝓔 𝓔id≡ mbr nid≡ pk≡)) hpk sig mws∈pool = mkPCS4PK 𝓔 (inBootstrapInfo refl) (mkPCS4PKin𝓔 𝓔id≡ mbr nid≡ pk≡) msb4-eid≡ : ∀ {pre post : SystemState} {v v' pid pk} → ReachableSystemState pre → Step pre post → Meta-Honest-PK pk → PeerCanSignForPK post v pid pk → v ≡L v' at vEpoch → (sig' : WithVerSig pk v') → MsgWithSig∈ pk (ver-signature sig') (msgPool pre) → PeerCanSignForPK pre v pid pk msb4-eid≡ rss step hpk pcsfpk ≡eid sig' mws' = peerCanSignEp≡ (msb4 rss step (peerCanSignEp≡ pcsfpk ≡eid) hpk sig' mws') (sym ≡eid) pidInjective : ∀ {pid pid' pk v v'}{st : SystemState} → PeerCanSignForPK st v pid pk → PeerCanSignForPK st v' pid' pk → v ^∙ vEpoch ≡ v' ^∙ vEpoch → pid ≡ pid' pidInjective{pid}{pid'}{pk} pcsfpk₁ pcsfpk₂ ≡epoch = begin pid ≡⟨ sym (nid≡ (pcs4in𝓔 pcsfpk₁)) ⟩ pcsfpk₁∙pid ≡⟨ PK-inj-same-ECs{pcs4𝓔 pcsfpk₁}{pcs4𝓔 pcsfpk₂} (availEpochsConsistent pcsfpk₁ pcsfpk₂ ≡epoch) pcsfpk∙pk≡ ⟩ pcsfpk₂∙pid ≡⟨ nid≡ (pcs4in𝓔 pcsfpk₂) ⟩ pid' ∎ where open ≡-Reasoning open PeerCanSignForPKinEpoch open PeerCanSignForPK pcsfpk₁∙pid = EpochConfig.toNodeId (pcs4𝓔 pcsfpk₁) (mbr (pcs4in𝓔 pcsfpk₁)) pcsfpk₂∙pid = EpochConfig.toNodeId (pcs4𝓔 pcsfpk₂) (mbr (pcs4in𝓔 pcsfpk₂)) pcsfpk₁∙pk = EpochConfig.getPubKey (pcs4𝓔 pcsfpk₁) (mbr (pcs4in𝓔 pcsfpk₁)) pcsfpk₂∙pk = EpochConfig.getPubKey (pcs4𝓔 pcsfpk₂) (mbr (pcs4in𝓔 pcsfpk₂)) pcsfpk∙pk≡ : pcsfpk₁∙pk ≡ pcsfpk₂∙pk pcsfpk∙pk≡ = begin pcsfpk₁∙pk ≡⟨ pk≡ (pcs4in𝓔 pcsfpk₁) ⟩ pk ≡⟨ sym (pk≡ (pcs4in𝓔 pcsfpk₂)) ⟩ pcsfpk₂∙pk ∎ module ReachableSystemStateProps where mws∈pool⇒initd : ∀ {pid pk v}{st : SystemState} → ReachableSystemState st → PeerCanSignForPK st v pid pk → Meta-Honest-PK pk → (sig : WithVerSig pk v) → ¬ (∈BootstrapInfo-impl fakeBootstrapInfo (ver-signature sig)) → MsgWithSig∈ pk (ver-signature sig) (msgPool st) → initialised st pid ≡ initd mws∈pool⇒initd{pk = pk}{v} (step-s{pre = pre} rss step@(step-peer sp@(step-cheat cmc))) pcsfpk hpk sig ¬bootstrap mws∈pool = peersRemainInitialized step (mws∈pool⇒initd rss (PeerCanSignForPKProps.msb4 rss step pcsfpk hpk sig mws∈poolPre) hpk sig ¬bootstrap mws∈poolPre) where ¬bootstrap' = ∈BootstrapInfoProps.sameSig∉ sig (msgSigned mws∈pool) ¬bootstrap (msgSameSig mws∈pool) mws∈poolPre : MsgWithSig∈ pk (ver-signature sig) (msgPool pre) mws∈poolPre = ¬cheatForgeNew sp refl unit hpk mws∈pool ¬bootstrap' mws∈pool⇒initd{pid₁}{pk = pk} (step-s{pre = pre} rss step@(step-peer sp@(step-honest{pid₂} sps@(step-init {rm} rm×acts uni)))) pcsfpk hpk sig ¬bootstrap mws∈pool with pid₁ ≟ pid₂ ...| yes refl = StepPeer-post-lemma2 {pre = pre} sps ...| no neq with newMsg⊎msgSentB4 rss sps hpk (msgSigned mws∈pool) ¬bootstrap' (msg⊆ mws∈pool) (msg∈pool mws∈pool) where ¬bootstrap' = ∈BootstrapInfoProps.sameSig∉ sig (msgSigned mws∈pool) ¬bootstrap (msgSameSig mws∈pool) ...| Right mws∈poolPre = peersRemainInitialized step (mws∈pool⇒initd rss (PeerCanSignForPKProps.msb4 rss step pcsfpk hpk sig mws∈poolPre') hpk sig ¬bootstrap mws∈poolPre') where mws∈poolPre' : MsgWithSig∈ pk (ver-signature sig) (msgPool pre) mws∈poolPre' rewrite msgSameSig mws∈pool = mws∈poolPre ...| Left (send∈acts , _ , _) with initHandlerSpec.contract pid₂ fakeBootstrapInfo rm×acts ...| init-contract with msg⊆ mws∈pool ...| vote∈vm = ⊥-elim (P≢V (sym (proj₁ (proj₂ (initHandlerSpec.ContractOk.isInitPM init-contract send∈acts))))) ...| vote∈qc vs∈qc _ qc∈pm with initHandlerSpec.ContractOk.isInitPM init-contract send∈acts ...| (_ , refl , noSigs) = ⊥-elim (noSigs vs∈qc qc∈pm) mws∈pool⇒initd{pid₁}{pk}{v} (step-s{pre = pre} rss step@(step-peer{pid₂} sp@(step-honest sps@(step-msg _ ini)))) pcsfpk hpk sig ¬bootstrap mws∈pool with newMsg⊎msgSentB4 rss sps hpk (msgSigned mws∈pool) ¬bootstrap' (msg⊆ mws∈pool) (msg∈pool mws∈pool) where ¬bootstrap' = ∈BootstrapInfoProps.sameSig∉ sig (msgSigned mws∈pool) ¬bootstrap (msgSameSig mws∈pool) ...| Left (m∈outs , pcsfpk' , ¬msb4) with pid≡ where vd₁≡vd₂ : v ≡L msgPart mws∈pool at vVoteData vd₁≡vd₂ = either (⊥-elim ∘ PerReachableState.meta-no-collision rss) id (sameSig⇒sameVoteData (msgSigned mws∈pool) sig (msgSameSig mws∈pool)) pid≡ : pid₁ ≡ pid₂ pid≡ = PeerCanSignForPKProps.pidInjective pcsfpk pcsfpk' (cong (_^∙ vdProposed ∙ biEpoch) vd₁≡vd₂) ...| refl rewrite StepPeer-post-lemma2{pid₂}{pre = pre} sps = refl mws∈pool⇒initd{pid₁}{pk} (step-s{pre = pre} rss step@(step-peer{pid₂} sp@(step-honest sps@(step-msg _ ini)))) pcsfpk hpk sig ¬bootstrap mws∈pool | Right mws∈poolPre = peersRemainInitialized step (mws∈pool⇒initd rss (PeerCanSignForPKProps.msb4 rss step pcsfpk hpk sig mws∈poolPre') hpk sig ¬bootstrap mws∈poolPre') where mws∈poolPre' : MsgWithSig∈ pk (ver-signature sig) (msgPool pre) mws∈poolPre' rewrite msgSameSig mws∈pool = mws∈poolPre mws∈pool⇒epoch≡ : ∀ {pid v s' outs pk}{st : SystemState} → ReachableSystemState st → (sps : StepPeerState pid (msgPool st) (initialised st) (peerStates st pid) (s' , outs)) → PeerCanSignForPK st v pid pk → Meta-Honest-PK pk → (sig : WithVerSig pk v) → ¬ (∈BootstrapInfo-impl fakeBootstrapInfo (ver-signature sig)) → MsgWithSig∈ pk (ver-signature sig) (msgPool st) → s' ^∙ rmEpoch ≡ v ^∙ vEpoch → peerStates st pid ^∙ rmEpoch ≡ v ^∙ vEpoch mws∈pool⇒epoch≡ rss (step-init _ uni) pcsfpk hpk sig ¬bootstrap mws∈pool epoch≡ = absurd (uninitd ≡ initd) case (trans (sym uni) ini) of λ () where ini = mws∈pool⇒initd rss pcsfpk hpk sig ¬bootstrap mws∈pool mws∈pool⇒epoch≡{pid}{v}{st = st} rss (step-msg{_ , P pm} m∈pool ini) pcsfpk hpk sig ¬bootstrap mws∈pool epoch≡ = begin hpPre ^∙ rmEpoch ≡⟨ noEpochChange ⟩ hpPos ^∙ rmEpoch ≡⟨ epoch≡ ⟩ v ^∙ vEpoch ∎ where hpPool = msgPool st hpPre = peerStates st pid hpPos = LBFT-post (handleProposal 0 pm) hpPre open handleProposalSpec.Contract (handleProposalSpec.contract! 0 pm hpPool hpPre) open ≡-Reasoning mws∈pool⇒epoch≡{pid}{v}{st = st} rss (step-msg{sndr , V vm} _ _) pcsfpk hpk sig ¬bootstrap mws∈pool epoch≡ = begin hvPre ^∙ rmEpoch ≡⟨ noEpochChange ⟩ hvPos ^∙ rmEpoch ≡⟨ epoch≡ ⟩ v ^∙ vEpoch ∎ where hvPre = peerStates st pid hvPos = LBFT-post (handleVote 0 vm) hvPre open handleVoteSpec.Contract (handleVoteSpec.contract! 0 vm (msgPool st) hvPre) open ≡-Reasoning mws∈pool⇒epoch≡{pid}{v}{st = st} rss (step-msg{sndr , C cm} _ _) pcsfpk hpk sig ¬bootstrap mws∈pool epoch≡ = epoch≡
programs/oeis/038/A038048.asm
neoneye/loda
22
84427
<gh_stars>10-100 ; A038048: a(n) = (n-1)! * sigma(n). ; 1,3,8,42,144,1440,5760,75600,524160,6531840,43545600,1117670400,6706022400,149448499200,2092278988800,40537905408000,376610217984000,13871809695744000,128047474114560000,5109094217170944000,77852864261652480000,1839273918181539840000,26976017466662584320000,1551121004333098598400000,19233900453730422620160000,651470821819901411328000000,16131658445064225423360000000,609776689223427721003008000000,9146650338351415815045120000000,636606863549258540727140352000000,8488091513990113876361871360000000,518038835213209137516710461440000000 mov $1,$0 seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters). mul $0,11 seq $1,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n). mul $0,$1 div $0,11
lib/types/Lift.agda
UlrikBuchholtz/HoTT-Agda
1
8268
<reponame>UlrikBuchholtz/HoTT-Agda {-# OPTIONS --without-K #-} open import lib.Basics open import lib.types.Pointed module lib.types.Lift where ⊙Lift : ∀ {i j} → Ptd i → Ptd (lmax i j) ⊙Lift {j = j} (A , a) = ⊙[ Lift {j = j} A , lift a ] ⊙lift : ∀ {i j} {X : Ptd i} → fst (X ⊙→ ⊙Lift {j = j} X) ⊙lift = (lift , idp) ⊙lower : ∀ {i j} {X : Ptd i} → fst (⊙Lift {j = j} X ⊙→ X) ⊙lower = (lower , idp) Lift-level : ∀ {i j} {A : Type i} {n : ℕ₋₂} → has-level n A → has-level n (Lift {j = j} A) Lift-level = equiv-preserves-level ((lift-equiv)⁻¹)
programs/oeis/100/A100637.asm
jmorken/loda
1
94785
; A100637: Trisection of A000720. ; 2,3,4,5,6,7,8,9,9,10,11,11,12,13,14,15,15,16,16,17,18,18,19,20,21,21,22,23,23,24,24,24,25,26,27,28,29,30,30,30,30,30,31,32,32,33,34,34,34,35,36,36,37,37,38,39,39,40,40,41,42,42,42,43,44,45,46,46,46,46,47,47,47,47,48,49,50,51,51,52,53,53,53,54,54,55,55,56,56,57,58,58,59,60,61,61,61,62,62,62,62,62,63,64,65,66,66,66,66,66,67,67,68,68,68,69,70,71,71,72,72,72,73,73,74,74,75,76,76,77,77,77,78,79,79,79,80,80,80,81,82,82,82,83,84,84,85,86,86,87,87,87,88,89,90,91,91,91,91,92,92,92,93,94,94,94,95,96,96,97,97,97,97,98,99,99,99,99,99,99,100,100,101,101,101,102,102,103,103,104,105,105,106,106,106,107,107,108,108,109,110,110,111,111,112,113,114,114,114,114,115,115,115,116,117,118,118,119,119,120,121,121,121,121,122,123,123,124,124,124,125,125,125,126,126,126,127,127,127,128,128,128,129,129,130,130,131,132,132,132 mov $2,$0 add $2,1 mov $5,$0 lpb $2 mov $0,$5 sub $2,1 sub $0,$2 mul $0,3 cal $0,278907 ; a(n) = floor((n*2^(n+1)+2)/(2*n-(-1)^n+3)) - floor((n*2^(n+1)-2)/(2*n-(-1)^n+3)). mov $3,2 mov $4,$0 add $4,1 mul $3,$4 sub $3,2 div $3,2 add $1,$3 lpe
deps/gmp.js/mpn/x86_64/aorrlsh2_n.asm
6un9-h0-Dan/cobaul
184
7849
<gh_stars>100-1000 dnl AMD64 mpn_addlsh2_n and mpn_rsblsh2_n. R = 2*V +- U. dnl ("rsb" means reversed subtract, name mandated by mpn_sublsh2_n which dnl subtacts the shifted operand from the unshifted operand.) dnl Copyright 2009 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of the GNU Lesser General Public License as published dnl by the Free Software Foundation; either version 3 of the License, or (at dnl your option) any later version. dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public dnl License for more details. 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 K8,K9: 2 C K10: 2 C P4: ? C P6 core2: 3 C P6 corei7: 2.75 C P6 atom: ? C INPUT PARAMETERS define(`rp', `%rdi') define(`up', `%rsi') define(`vp', `%rdx') define(`n', `%rcx') ifdef(`OPERATION_addlsh2_n',` define(ADDSUB, `add') define(ADCSBB, `adc') define(func, mpn_addlsh2_n)') ifdef(`OPERATION_rsblsh2_n',` define(ADDSUB, `sub') define(ADCSBB, `sbb') define(func, mpn_rsblsh2_n)') MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_rsblsh2_n) ASM_START() TEXT ALIGN(16) PROLOGUE(func) push %r12 push %r13 push %r14 push %r15 mov (vp), %r8 lea (,%r8,4), %r12 shr $62, %r8 mov R32(n), R32(%rax) lea (rp,n,8), rp lea (up,n,8), up lea (vp,n,8), vp neg n and $3, R8(%rax) je L(b00) cmp $2, R8(%rax) jc L(b01) je L(b10) L(b11): mov 8(vp,n,8), %r10 lea (%r8,%r10,4), %r14 shr $62, %r10 mov 16(vp,n,8), %r11 lea (%r10,%r11,4), %r15 shr $62, %r11 ADDSUB (up,n,8), %r12 ADCSBB 8(up,n,8), %r14 ADCSBB 16(up,n,8), %r15 sbb R32(%rax), R32(%rax) C save carry for next mov %r12, (rp,n,8) mov %r14, 8(rp,n,8) mov %r15, 16(rp,n,8) add $3, n js L(top) jmp L(end) L(b01): mov %r8, %r11 ADDSUB (up,n,8), %r12 sbb R32(%rax), R32(%rax) C save carry for next mov %r12, (rp,n,8) add $1, n js L(top) jmp L(end) L(b10): mov 8(vp,n,8), %r11 lea (%r8,%r11,4), %r15 shr $62, %r11 ADDSUB (up,n,8), %r12 ADCSBB 8(up,n,8), %r15 sbb R32(%rax), R32(%rax) C save carry for next mov %r12, (rp,n,8) mov %r15, 8(rp,n,8) add $2, n js L(top) jmp L(end) L(b00): mov 8(vp,n,8), %r9 mov 16(vp,n,8), %r10 jmp L(e00) ALIGN(16) L(top): mov 16(vp,n,8), %r10 mov (vp,n,8), %r8 mov 8(vp,n,8), %r9 lea (%r11,%r8,4), %r12 shr $62, %r8 L(e00): lea (%r8,%r9,4), %r13 shr $62, %r9 mov 24(vp,n,8), %r11 lea (%r9,%r10,4), %r14 shr $62, %r10 lea (%r10,%r11,4), %r15 shr $62, %r11 add R32(%rax), R32(%rax) C restore carry ADCSBB (up,n,8), %r12 ADCSBB 8(up,n,8), %r13 ADCSBB 16(up,n,8), %r14 ADCSBB 24(up,n,8), %r15 mov %r12, (rp,n,8) mov %r13, 8(rp,n,8) mov %r14, 16(rp,n,8) sbb R32(%rax), R32(%rax) C save carry for next mov %r15, 24(rp,n,8) add $4, n js L(top) L(end): ifdef(`OPERATION_addlsh2_n',` sub R32(%r11), R32(%rax) neg R32(%rax)') ifdef(`OPERATION_rsblsh2_n',` add R32(%r11), R32(%rax) movslq R32(%rax), %rax') pop %r15 pop %r14 pop %r13 pop %r12 ret EPILOGUE()
llvm-gcc-4.2-2.9/gcc/ada/g-excact.ads
vidkidz/crossbridge
1
16096
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T . E X C E P T I O N _ A C T I O N S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2002-2005, 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, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides support for callbacks on exceptions -- These callbacks are called immediately when either a specific exception, -- or any exception, is raised, before any other actions taken by raise, in -- particular before any unwinding of the stack occcurs. -- Callbacks for specific exceptions are registered through calls to -- Register_Id_Action. Here is an example of code that uses this package to -- automatically core dump when the exception Constraint_Error is raised. -- Register_Id_Action (Constraint_Error'Identity, Core_Dump'Access); -- Subprograms are also provided to list the currently registered exceptions, -- or to convert from a string to an exception id. -- This package can easily be extended, for instance to provide a callback -- whenever an exception matching a regular expression is raised. The idea -- is to register a global action, called whenever any exception is raised. -- Dispatching can then be done directly in this global action callback. with Ada.Exceptions; use Ada.Exceptions; package GNAT.Exception_Actions is type Exception_Action is access procedure (Occurence : Exception_Occurrence); -- General callback type whenever an exception is raised. The callback -- procedure must not propagate an exception (execution of the program -- is erroneous if such an exception is propagated). procedure Register_Global_Action (Action : Exception_Action); -- Action will be called whenever an exception is raised. Only one such -- action can be registered at any given time, and registering a new action -- will override any previous action that might have been registered. -- -- Action is called before the exception is propagated to user's code. -- If Action is null, this will in effect cancel all exception actions. procedure Register_Id_Action (Id : Exception_Id; Action : Exception_Action); -- Action will be called whenever an exception of type Id is raised. Only -- one such action can be registered for each exception id, and registering -- a new action will override any previous action registered for this -- Exception_Id. Program_Error is raised if Id is Null_Id. function Name_To_Id (Name : String) return Exception_Id; -- Convert an exception name to an exception id. Null_Id is returned -- if no such exception exists. Name must be an all upper-case string, -- or the exception will not be found. The exception name must be fully -- qualified (but not including Standard). It is not possible to convert -- an exception that is declared within an unlabeled block. -- -- Note: All non-predefined exceptions will return Null_Id for programs -- compiled with pragma Restriction (No_Exception_Registration) function Registered_Exceptions_Count return Natural; -- Return the number of exceptions that have been registered so far. -- Exceptions declared locally will not appear in this list until their -- block has been executed at least once. -- -- Note: The count includes only predefined exceptions for programs -- compiled with pragma Restrictions (No_Exception_Registration). type Exception_Id_Array is array (Natural range <>) of Exception_Id; procedure Get_Registered_Exceptions (List : out Exception_Id_Array; Last : out Integer); -- Return the list of registered exceptions. -- Last is the index in List of the last exception returned. -- -- An exception is registered the first time the block containing its -- declaration is elaborated. Exceptions defined at library-level are -- therefore immediately visible, whereas exceptions declared in local -- blocks will not be visible until the block is executed at least once. -- -- Note: The list contains only the predefined exceptions if the program -- is compiled with pragma Restrictions (No_Exception_Registration); procedure Core_Dump (Occurrence : Exception_Occurrence); -- Dump memory (called a core dump in some systems), and abort execution -- of the application. end GNAT.Exception_Actions;
Algorithms/List/Sort/IsSort.agda
rei1024/agda-misc
3
17319
<filename>Algorithms/List/Sort/IsSort.agda<gh_stars>1-10 {-# OPTIONS --without-K --safe #-} open import Relation.Binary module Algorithms.List.Sort.IsSort {c l₁ l₂} (DTO : DecTotalOrder c l₁ l₂) where -- agda-stdlib open import Level import Relation.Binary.Reasoning.Setoid as SetoidReasoning open import Data.List import Data.List.Relation.Binary.Equality.Setoid as SetoidEquality import Data.List.Relation.Binary.Permutation.Setoid as PermutationSetoid open import Data.List.Relation.Unary.Linked as Linked -- agda-misc open import Algorithms.List.Sort.Common DTO import Algorithms.List.Sort.Insertion as I import Algorithms.List.Sort.Insertion.Properties as Iₚ open DecTotalOrder DTO renaming (Carrier to A) open PermutationSetoid Eq.setoid open SetoidEquality Eq.setoid open I.InsertionSortOperation _≤?_ renaming (sort to Isort) record IsSort (sort : List A → List A) : Set (c ⊔ l₁ ⊔ l₂) where field sorted : (xs : List A) → Sorted (sort xs) perm : (xs : List A) → sort xs ↭ xs open Iₚ DTO sort-Isort : ∀ xs → sort xs ≋ Isort xs sort-Isort xs = Sorted-unique (↭-trans (perm xs) (↭-sym (sort-permutation xs))) (sorted xs) (sort-Sorted xs) isSort-unique : ∀ {sort₁ sort₂ : List A → List A} → IsSort sort₁ → IsSort sort₂ → ∀ xs → sort₁ xs ≋ sort₂ xs isSort-unique {sort₁} {sort₂} sort₁-isSort sort₂-isSort xs = begin sort₁ xs ≈⟨ IsSort.sort-Isort sort₁-isSort xs ⟩ Isort xs ≈⟨ ≋-sym (IsSort.sort-Isort sort₂-isSort xs) ⟩ sort₂ xs ∎ where open SetoidReasoning ≋-setoid
src/main/fragment/mos6502-common/vbuyy_lt_vbuaa_then_la1.asm
jbrandwood/kickc
2
96824
<filename>src/main/fragment/mos6502-common/vbuyy_lt_vbuaa_then_la1.asm sta $ff cpy $ff bcc {la1}
src/sys/encoders/util-encoders-base64.adb
RREE/ada-util
60
29598
----------------------------------------------------------------------- -- util-encoders-base64 -- Encode/Decode a stream in base64 -- Copyright (C) 2009, 2010, 2011, 2012, 2013, 2016, 2017, 2019 <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 Util.Streams; package body Util.Encoders.Base64 is use Interfaces; -- ------------------------------ -- Encode the 64-bit value to LEB128 and then base64url. -- ------------------------------ function Encode (Value : in Interfaces.Unsigned_64) return String is E : Encoder; Data : Ada.Streams.Stream_Element_Array (1 .. 10); Last : Ada.Streams.Stream_Element_Offset; Encoded : Ada.Streams.Stream_Element_Offset; Result : String (1 .. 16); Buf : Ada.Streams.Stream_Element_Array (1 .. Result'Length); for Buf'Address use Result'Address; pragma Import (Ada, Buf); begin -- Encode the integer to LEB128 in the data buffer. Encode_LEB128 (Into => Data, Pos => Data'First, Val => Value, Last => Last); -- Encode the data buffer in base64url. E.Set_URL_Mode (True); E.Transform (Data => Data (Data'First .. Last), Into => Buf, Last => Last, Encoded => Encoded); E.Finish (Into => Buf (Last + 1 .. Buf'Last), Last => Last); -- Strip the '=' or '==' at end of base64url. if Result (Positive (Last)) /= '=' then return Result (Result'First .. Positive (Last)); elsif Result (Positive (Last) - 1) /= '=' then return Result (Result'First .. Positive (Last) - 1); else return Result (Result'First .. Positive (Last) - 2); end if; end Encode; -- ------------------------------ -- Decode the base64url string and then the LEB128 integer. -- Raise the Encoding_Error if the string is invalid and cannot be decoded. -- ------------------------------ function Decode (Value : in String) return Interfaces.Unsigned_64 is D : Decoder; Buf : Ada.Streams.Stream_Element_Array (1 .. Value'Length + 2); R : Ada.Streams.Stream_Element_Array (1 .. Value'Length + 2); Last : Ada.Streams.Stream_Element_Offset; Encoded : Ada.Streams.Stream_Element_Offset; Result : Interfaces.Unsigned_64; End_Pos : constant Ada.Streams.Stream_Element_Offset := Value'Length + ((4 - (Value'Length mod 4)) mod 4); begin if Buf'Length < End_Pos then raise Encoding_Error with "Input string is too short"; end if; Util.Streams.Copy (Into => Buf (1 .. Value'Length), From => Value); -- Set back the '=' for the base64url (pad to multiple of 4. Buf (Value'Length + 1) := Character'Pos ('='); Buf (Value'Length + 2) := Character'Pos ('='); -- Decode using base64url D.Set_URL_Mode (True); D.Transform (Data => Buf (Buf'First .. End_Pos), Into => R, Last => Last, Encoded => Encoded); if Encoded /= End_Pos then raise Encoding_Error with "Input string is too short"; end if; -- Decode the LEB128 number. Decode_LEB128 (From => R (R'First .. Last), Pos => R'First, Val => Result, Last => Encoded); -- Check that everything was decoded. if Last + 1 /= Encoded then raise Encoding_Error with "Input string contains garbage at the end"; end if; return Result; end Decode; -- ------------------------------ -- Encodes the binary input stream represented by <b>Data</b> into -- the a base64 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) is Pos : Ada.Streams.Stream_Element_Offset := Into'First; I : Ada.Streams.Stream_Element_Offset := Data'First; C1, C2 : Unsigned_8; Alphabet : constant Alphabet_Access := E.Alphabet; begin while E.Count /= 0 and I <= Data'Last loop if E.Count = 2 then C1 := E.Value; C2 := Unsigned_8 (Data (I)); Into (Pos) := Alphabet (Shift_Left (C1 and 16#03#, 4) or Shift_Right (C2, 4)); Pos := Pos + 1; I := I + 1; E.Count := 1; E.Value := C2; else C2 := E.Value; C1 := Unsigned_8 (Data (I)); Into (Pos) := Alphabet (Shift_Left (C2 and 16#0F#, 2) or Shift_Right (C1, 6)); Into (Pos + 1) := Alphabet (C1 and 16#03F#); Pos := Pos + 2; I := I + 1; E.Count := 0; end if; end loop; while I <= Data'Last loop if Pos + 4 > Into'Last + 1 then Last := Pos - 1; Encoded := I - 1; E.Count := 0; return; end if; -- Encode the first byte, add padding if necessary. C1 := Unsigned_8 (Data (I)); Into (Pos) := Alphabet (Shift_Right (C1, 2)); if I = Data'Last then E.Value := C1; E.Count := 2; Last := Pos; Encoded := Data'Last; return; end if; -- Encode the second byte, add padding if necessary. C2 := Unsigned_8 (Data (I + 1)); Into (Pos + 1) := Alphabet (Shift_Left (C1 and 16#03#, 4) or Shift_Right (C2, 4)); if I = Data'Last - 1 then E.Value := C2; E.Count := 1; Last := Pos + 1; Encoded := Data'Last; return; end if; -- Encode the third byte C1 := Unsigned_8 (Data (I + 2)); Into (Pos + 2) := Alphabet (Shift_Left (C2 and 16#0F#, 2) or Shift_Right (C1, 6)); Into (Pos + 3) := Alphabet (C1 and 16#03F#); Pos := Pos + 4; I := I + 3; end loop; E.Count := 0; Last := Pos - 1; Encoded := Data'Last; end Transform; -- ------------------------------ -- Finish encoding the input array. -- ------------------------------ overriding procedure Finish (E : in out Encoder; Into : in out Ada.Streams.Stream_Element_Array; Last : in out Ada.Streams.Stream_Element_Offset) is Pos : constant Ada.Streams.Stream_Element_Offset := Into'First; begin if E.Count = 2 then Into (Pos) := E.Alphabet (Shift_Left (E.Value and 3, 4)); Into (Pos + 1) := Character'Pos ('='); Into (Pos + 2) := Character'Pos ('='); Last := Pos + 2; E.Count := 0; elsif E.Count = 1 then Into (Pos) := E.Alphabet (Shift_Left (E.Value and 16#0F#, 2)); Into (Pos + 1) := Character'Pos ('='); Last := Pos + 1; E.Count := 0; else Last := Pos - 1; end if; end Finish; -- ------------------------------ -- Set the encoder to use the base64 URL alphabet when <b>Mode</b> is True. -- The URL alphabet uses the '-' and '_' instead of the '+' and '/' characters. -- ------------------------------ procedure Set_URL_Mode (E : in out Encoder; Mode : in Boolean) is begin if Mode then E.Alphabet := BASE64_URL_ALPHABET'Access; else E.Alphabet := BASE64_ALPHABET'Access; end if; end Set_URL_Mode; -- ------------------------------ -- Create a base64 encoder using the URL alphabet. -- The URL alphabet uses the '-' and '_' instead of the '+' and '/' characters. -- ------------------------------ function Create_URL_Encoder return Transformer_Access is begin return new Encoder '(Alphabet => BASE64_URL_ALPHABET'Access, others => <>); end Create_URL_Encoder; -- ------------------------------ -- Decodes the base64 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) is Pos : Ada.Streams.Stream_Element_Offset := Into'First; I : Ada.Streams.Stream_Element_Offset := Data'First; C1, C2 : Ada.Streams.Stream_Element; Val1, Val2 : Unsigned_8; Values : constant Alphabet_Values_Access := E.Values; begin while I <= Data'Last loop if Pos + 3 > Into'Last + 1 then Last := Pos - 1; Encoded := I - 1; return; end if; -- Decode the first two bytes to produce the first output byte C1 := Data (I); Val1 := Values (C1); if (Val1 and 16#C0#) /= 0 then raise Encoding_Error with "Invalid character '" & Character'Val (C1) & "'"; end if; C2 := Data (I + 1); Val2 := Values (C2); if (Val2 and 16#C0#) /= 0 then raise Encoding_Error with "Invalid character '" & Character'Val (C2) & "'"; end if; Into (Pos) := Stream_Element (Shift_Left (Val1, 2) or Shift_Right (Val2, 4)); if I + 2 > Data'Last then Encoded := I + 1; Last := Pos; return; end if; -- Decode the next byte C1 := Data (I + 2); Val1 := Values (C1); if (Val1 and 16#C0#) /= 0 then if C1 /= Character'Pos ('=') then raise Encoding_Error with "Invalid character '" & Character'Val (C1) & "'"; end if; Encoded := I + 3; Last := Pos; return; end if; Into (Pos + 1) := Stream_Element (Shift_Left (Val2, 4) or Shift_Right (Val1, 2)); if I + 3 > Data'Last then Encoded := I + 2; Last := Pos + 1; return; end if; C2 := Data (I + 3); Val2 := Values (C2); if (Val2 and 16#C0#) /= 0 then if C2 /= Character'Pos ('=') then raise Encoding_Error with "Invalid character '" & Character'Val (C2) & "'"; end if; Encoded := I + 3; Last := Pos + 1; return; end if; Into (Pos + 2) := Stream_Element (Shift_Left (Val1, 6) or Val2); Pos := Pos + 3; I := I + 4; end loop; Last := Pos - 1; Encoded := Data'Last; end Transform; -- ------------------------------ -- Set the decoder to use the base64 URL alphabet when <b>Mode</b> is True. -- The URL alphabet uses the '-' and '_' instead of the '+' and '/' characters. -- ------------------------------ procedure Set_URL_Mode (E : in out Decoder; Mode : in Boolean) is begin if Mode then E.Values := BASE64_URL_VALUES'Access; else E.Values := BASE64_VALUES'Access; end if; end Set_URL_Mode; -- ------------------------------ -- Create a base64 decoder using the URL alphabet. -- The URL alphabet uses the '-' and '_' instead of the '+' and '/' characters. -- ------------------------------ function Create_URL_Decoder return Transformer_Access is begin return new Decoder '(Values => BASE64_URL_VALUES'Access); end Create_URL_Decoder; end Util.Encoders.Base64;
oeis/071/A071005.asm
neoneye/loda-programs
11
88995
<gh_stars>10-100 ; A071005: Binary expansion of Pi/3, A019670. ; Submitted by <NAME> ; 1,0,0,0,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,1,0,1,1,1,0,0,1,1,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,1,1,0,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,0,1,0,1,1,1,0,0,0,0,0,1,1,1,1,0,1,0 add $0,1 mov $2,1 mov $3,$0 mul $3,5 lpb $3 mul $1,$3 mov $5,$3 mul $5,2 add $5,1 mul $2,$5 add $1,$2 div $1,$0 div $2,$0 sub $3,1 lpe mul $1,4 div $1,12 mov $4,2 pow $4,$0 div $2,$4 div $1,$2 mov $0,$1 mod $0,2
src/main.asm
Gegel85/RunnerGB
0
93422
include "src/constants.asm" include "src/macro.asm" SECTION "Main", ROM0 notCGB:: call waitVBLANK reset LCD_CONTROL reg BGP, $E4 ld hl, NoCGBScreen ld de, VRAM_START ld bc, NoCGBScreenMap - NoCGBScreen call copyMemory ld b, 18 push hl ld hl, VRAM_BG_START pop de .loop: ld c, 20 .miniLoop: ld a, [de] ld [hli], a inc de dec c jr nz, .miniLoop push bc ld bc, 12 add hl, bc pop bc dec b jr nz, .loop reg LCD_CONTROL, %11010001 ; Locks the CPU ; Params: ; None ; Return: ; None ; Registers: ; N/A lockup:: reset INTERRUPT_REQUEST ld [INTERRUPT_ENABLED], a .loop: halt jr .loop ; Main function main:: ld sp, $FFFF cp CGB_A_INIT jp nz, notCGB call init mainMenu:: ld de, PLAYING_MUSICS ld hl, MainMenuTheme call startMusic reg WX, 167 - 70 reg WY, 144 - 18 call waitVBLANK reset LCD_CONTROL reg VBK, 1 ld a, 3 ld de, $9C00 ld bc, 200 call fillMemory reset VBK ld de, VRAM_START ld hl, MainMenuChrs ld bc, EndMMChr - MainMenuChrs call copyMemory ld hl, LogoChrs ld bc, EndLogoChr - LogoChrs call copyMemory ld de, $8880 ld hl, ScoreZoneSprite ld bc, NumbersSprite - ScoreZoneSprite call copyMemory ld hl, $9C00 ld de, ScoreZoneMap ld bc, $20 - 9 .copypyLoop: ld a, [de] inc de add $88 ld [hli], a bit 3, l jr z, .copypyLoop bit 0, l jr z, .copypyLoop add hl, bc bit 7, l jr z, .copypyLoop ld de, BGPI ld a, $98 ld [de], a inc e ld b, 8 ld hl, scoreZonePal .bgPalLoopk: ld a, [hli] ld [de], a dec b jr nz, .bgPalLoopk ld de, VRAM_START + $A00 ld hl, NumbersSprite ld bc, NumbersEnd - NumbersSprite call copyMemory ld hl, $9800 ld de, MainMenuMap ld bc, $20 - 20 .copyLoop: ld a, [de] inc de ld [hli], a bit 2, l jr z, .copyLoop bit 4, l jr z, .copyLoop add hl, bc bit 2, h jr z, .copyLoop reg VBK, 1 xor a ld de, VRAM_BG_START ld bc, 32 * 32 call fillMemory reset VBK ld hl, $A000 ld de, SCORE ld bc, 3 call copyMemory call drawScore ld hl, mainMenuPal ld de, BGPI ld a, $80 ld [de], a inc e ld b, 8 + 6 .bgPalLoop: ld a, [hli] ld [de], a dec b jr nz, .bgPalLoop xor a ld [de], a ld [de], a ld b, 8 ld hl, logoPal .bgPalLoop2: ld a, [hli] ld [de], a dec b jr nz, .bgPalLoop2 ld hl, $9844 ld de, LogoMap ld b, 12 .copyLoop2: reg VBK, 1 ld a, [de] add (EndMMChr - MainMenuChrs) / $10 inc de ld [hl], 2 ld c, a reset VBK ld a, c ld [hli], a dec b jr nz, .copyLoop2 ld bc, $20 - 12 add hl, bc ld b, 12 ld a, $E4 cp l jr nz, .copyLoop2 reg LCD_CONTROL, %11110010 .loop: reset INTERRUPT_REQUEST ld [SCROLL_PAST_TILE], a halt ld hl, LY ld a, $90 cp [hl] jr nc, .loop call getKeys bit SELECT_BIT, a jp z, showCredits bit START_BIT, a jr nz, .loop game:: call waitVBLANK reset LCD_CONTROL ld hl, SpriteInitArray ld bc, $18 ld de, SPRITES_BUFFER call copyMemory ld de, VRAM_START ld hl, BackgroundChrs ld bc, NumbersSprite - BackgroundChrs call copyMemory ld de, BGPI ld a, $80 ld [de], a inc e ld b, 8 * 3 ld hl, bgPal .bgPalLoop: ld a, [hli] ld [de], a dec b jr nz, .bgPalLoop inc e ld a, $80 ld [de], a inc e ld b, 8 * 3 .objPalLoop: ld a, [hli] ld [de], a dec b jr nz, .objPalLoop initGame: ld de, PLAYING_MUSICS ld hl, SleepingTheme call startMusic xor a ld de, FRAME_COUNTER ld bc, MAX_SCROLL_COUNTER - FRAME_COUNTER + 1 call fillMemory ld de, SPRITES_BUFFER + $18 ld bc, $A0 - $18 call fillMemory reg PLAYER_Y, $60 call moveSprites reg ANIMATION_COUNTER, 5 reg MAX_SCROLL, 1 reset SCROLL_X reg MOON_POS, $80 call waitVBLANK reset LCD_CONTROL ld [BG_1_POS], a ld [BG_2_POS], a ld [BG_1_POS_COUNTER], a ld hl, LEFT_MAP_PTR ld a, (BackgroundTileMap) & $FF ld [hli], a ld a, (VRAM_BG_START + $1C0 + 23) & $FF ld [hli], a ld a, (VRAM_BG_START + $1C0 + 23) >> 8 ld [hli], a ld a, $60 ld de, GROUND_POS_X8 ld bc, 25 call fillMemory call copyBgMap ;reg VBK, 1 ;ld a, 1 ;ld de, $99C0 ;ld bc, 23 ;call fillMemory reset VBK ld a, (GroundSprite - BackgroundChrs) / $10 ld de, $99C0 ld bc, 23 call fillMemory reg CLOCK_ANIM, 1 reg LYC, 68 reg STAT_CONTROL, %01000000 reg LCD_CONTROL, %11110011 gameLoop: reset INTERRUPT_REQUEST ld [SCROLL_PAST_TILE], a halt ld hl, LY ld a, $90 cp [hl] jr nc, gameLoop ld hl, CLOCK_ANIM dec [hl] jr nz, .skip ld [hl], 60 ld hl, $9c22 ld a, [hl] xor %00111010 ld [hli], a inc l inc l ld a, [hl] xor %00111010 ld [hli], a .skip: ld hl, SPAWN_COUNTER ld a, [CURRENT_SCROLL] add [hl] ld b, a and %00000111 ld [hl], a ld a, b and %11111000 jr z, .noSpawn ; ground height ; création new tile reg SCROLL_PAST_TILE, 1 ; Remove the block at the left of the screen ld a, [GROUND_POS_X8] add $10 ld c, a ld a, 0 adc 0 ld b, a sla c rl b sla c rl b ld hl, LEFT_MAP_PTR ld a, [hl] inc [hl] and 31 add c ld c, a ld hl, $9800 add hl, bc ld d, h ld e, l ld hl, BackgroundTileMap add hl, bc ld a, [hl] ld [de], a ld hl, RIGHT_MAP_PTR ld a, [hli] ld h, [hl] ld l, a ld [hl], (GroundSprite - BackgroundChrs) / $10 ; reg VBK, 1 ; ld [hl], 1 ; reset VBK .noSpawn: call drawScore call scrollBg ; Animation ld hl, ANIMATION_COUNTER dec [hl] call z, animatePlayerMoon call updateSpikes call displaySpikes call incrementScore ld a, e and $10 xor d call nz, updateBgSpeed call updatePlayerState call getKeys bit DOWN_BIT, a jr nz, .noDown ld hl, PLAYER_SPEED_Y inc [hl] .noDown: bit A_BIT, a call z, playerJump bit UP_BIT, a call z, playerJump ld a, [SCROLL_PAST_TILE] or a jr z, .calcNextScroll call createNewTile ld hl, GROUND_POS_X8 call shiftTiles call random and %11 jr nz, .calcNextScroll ld d, a ld hl, NB_SPIKES inc [hl] ld a, [hl] ld e, a sla e add hl, de ld a, [CURRENT_SCROLL] ld b, a ld a, $C0 sub b ld [hld], a ld a, [GROUND_POS_X8 + 23] ld [hl], a .calcNextScroll: call calcNextScroll jp gameLoop include "src/init.asm" include "src/interrupts.asm" include "src/sound/music.asm" include "src/sound/sfx.asm" include "src/gameOver.asm" include "src/spikes.asm" include "src/gameLogic.asm" include "src/rendering.asm" include "src/sound/alarm_musics/alarm_one/main.asm" include "src/sound/alarm_musics/alarm_two/main.asm" include "src/sound/main_menu_music/main.asm" include "src/sound/sfx/sfxs.asm" include "src/sound/sleeping_music/main.asm" include "src/utils.asm"
test/p9.asm
slcz/hummingbird
0
22905
<gh_stars>0 #include "hi.asm" lh H(0xa5) addi L(0xa5) add 2f addi 1 addic 1 // a = 2 hlt 2: 0x5a
test/succeed/Rose.agda
larrytheliquid/agda
0
16682
<filename>test/succeed/Rose.agda {-# OPTIONS --sized-types #-} module Rose where postulate Size : Set _^ : Size -> Size ∞ : Size {-# BUILTIN SIZE Size #-} {-# BUILTIN SIZESUC _^ #-} {-# BUILTIN SIZEINF ∞ #-} data List (A : Set) : {_ : Size} -> Set where [] : {size : Size} -> List A {size ^} _::_ : {size : Size} -> A -> List A {size} -> List A {size ^} map : {A B : Set} -> (A -> B) -> {size : Size} -> List A {size} -> List B {size} map f [] = [] map f (x :: xs) = f x :: map f xs data Rose (A : Set) : {_ : Size} -> Set where rose : {size : Size} -> A -> List (Rose A {size}) {∞} -> Rose A {size ^} {- mapRose : {A B : Set} -> (A -> B) -> {size : Size} -> Rose A {size} -> Rose B {size} mapRose {A} {B} f .{size ^} (rose {size} a l) = rose (f a) (map (\ r -> mapRose {A} {B} f {size} r) l) -} mapRose : {A B : Set} -> (A -> B) -> {size : Size} -> Rose A {size} -> Rose B {size} mapRose f (rose a l) = rose (f a) (map (mapRose f) l)
chapter_1/page_35/exercise_4/strlen.asm
assaflevy/practical_reverse_engineering
0
104796
global _main extern _printf section .data hello_str: db 'Hello world!', 0 format: db 'my_strlen() returned %d', 10, 0 section .text my_strlen: push ebp mov ebp, esp mov edi, [ebp+8] xor al, al or ecx, 0xFFFFFFFF repnz scasb add ecx, 2 neg ecx mov eax, ecx mov esp, ebp pop ebp ret _main: push hello_str call my_strlen add esp, 4 push eax push format call _printf add esp, 8 ret
_anim/obj16.asm
vladjester2020/Sonic1TMR
0
160754
<reponame>vladjester2020/Sonic1TMR<gh_stars>0 ; --------------------------------------------------------------------------- ; Animation script - harpoon (LZ) ; --------------------------------------------------------------------------- dc.w byte_11F8A-Ani_obj16 dc.w byte_11F8E-Ani_obj16 dc.w byte_11F92-Ani_obj16 dc.w byte_11F96-Ani_obj16 byte_11F8A: dc.b 3, 1, 2, $FC byte_11F8E: dc.b 3, 1, 0, $FC byte_11F92: dc.b 3, 4, 5, $FC byte_11F96: dc.b 3, 4, 3, $FC even
programs/oeis/005/A005910.asm
karttu/loda
1
25041
<gh_stars>1-10 ; A005910: Truncated octahedral numbers: 16*n^3 - 33*n^2 + 24*n - 6. ; 1,38,201,586,1289,2406,4033,6266,9201,12934,17561,23178,29881,37766,46929,57466,69473,83046,98281,115274,134121,154918,177761,202746,229969,259526,291513,326026,363161,403014,445681,491258,539841,591526,646409,704586,766153,831206,899841,972154,1048241,1128198,1212121,1300106,1392249,1488646,1589393,1694586,1804321,1918694,2037801,2161738,2290601,2424486,2563489,2707706,2857233,3012166,3172601,3338634,3510361,3687878,3871281,4060666,4256129,4457766,4665673,4879946,5100681,5327974,5561921,5802618,6050161,6304646,6566169,6834826,7110713,7393926,7684561,7982714,8288481,8601958,8923241,9252426,9589609,9934886,10288353,10650106,11020241,11398854,11786041,12181898,12586521,13000006,13422449,13853946,14294593,14744486,15203721,15672394,16150601,16638438,17136001,17643386,18160689,18688006,19225433,19773066,20331001,20899334,21478161,22067578,22667681,23278566,23900329,24533066,25176873,25831846,26498081,27175674,27864721,28565318,29277561,30001546,30737369,31485126,32244913,33016826,33800961,34597414,35406281,36227658,37061641,37908326,38767809,39640186,40525553,41424006,42335641,43260554,44198841,45150598,46115921,47094906,48087649,49094246,50114793,51149386,52198121,53261094,54338401,55430138,56536401,57657286,58792889,59943306,61108633,62288966,63484401,64695034,65920961,67162278,68419081,69691466,70979529,72283366,73603073,74938746,76290481,77658374,79042521,80443018,81859961,83293446,84743569,86210426,87694113,89194726,90712361,92247114,93799081,95368358,96955041,98559226,100181009,101820486,103477753,105152906,106846041,108557254,110286641,112034298,113800321,115584806,117387849,119209546,121049993,122909286,124787521,126684794,128601201,130536838,132491801,134466186,136460089,138473606,140506833,142559866,144632801,146725734,148838761,150971978,153125481,155299366,157493729,159708666,161944273,164200646,166477881,168776074,171095321,173435718,175797361,178180346,180584769,183010726,185458313,187927626,190418761,192931814,195466881,198024058,200603441,203205126,205829209,208475786,211144953,213836806,216551441,219288954,222049441,224832998,227639721,230469706,233323049,236199846,239100193,242024186,244971921,247943494 mov $1,6 mul $1,$0 add $1,1 mov $3,$0 mul $3,$0 mov $2,$3 mul $2,15 add $1,$2 mul $3,$0 mov $2,$3 mul $2,16 add $1,$2
programs/oeis/011/A011848.asm
karttu/loda
1
10947
<reponame>karttu/loda<filename>programs/oeis/011/A011848.asm<gh_stars>1-10 ; A011848: a(n) = floor(binomial(n,2)/2). ; 0,0,0,1,3,5,7,10,14,18,22,27,33,39,45,52,60,68,76,85,95,105,115,126,138,150,162,175,189,203,217,232,248,264,280,297,315,333,351,370,390,410,430,451,473,495,517,540,564,588,612,637,663,689,715,742,770,798,826,855,885,915,945,976,1008,1040,1072,1105,1139,1173,1207,1242,1278,1314,1350,1387,1425,1463,1501,1540,1580,1620,1660,1701,1743,1785,1827,1870,1914,1958,2002,2047,2093,2139,2185,2232,2280,2328,2376,2425,2475,2525,2575,2626,2678,2730,2782,2835,2889,2943,2997,3052,3108,3164,3220,3277,3335,3393,3451,3510,3570,3630,3690,3751,3813,3875,3937,4000,4064,4128,4192,4257,4323,4389,4455,4522,4590,4658,4726,4795,4865,4935,5005,5076,5148,5220,5292,5365,5439,5513,5587,5662,5738,5814,5890,5967,6045,6123,6201,6280,6360,6440,6520,6601,6683,6765,6847,6930,7014,7098,7182,7267,7353,7439,7525,7612,7700,7788,7876,7965,8055,8145,8235,8326,8418,8510,8602,8695,8789,8883,8977,9072,9168,9264,9360,9457,9555,9653,9751,9850,9950,10050,10150,10251,10353,10455,10557,10660,10764,10868,10972,11077,11183,11289,11395,11502,11610,11718,11826,11935,12045,12155,12265,12376,12488,12600,12712,12825,12939,13053,13167,13282,13398,13514,13630,13747,13865,13983,14101,14220,14340,14460,14580,14701,14823,14945,15067,15190,15314,15438 mov $1,$0 bin $1,2 div $1,2
alloy4fun_models/trashltl/models/17/REmKkFiPJWmQJbzX8.als
Kaixi26/org.alloytools.alloy
0
4723
open main pred idREmKkFiPJWmQJbzX8_prop18 { all f : File | always (f in Trash' => f not in Protected') } pred __repair { idREmKkFiPJWmQJbzX8_prop18 } check __repair { idREmKkFiPJWmQJbzX8_prop18 <=> prop18o }
llvm-gcc-4.2-2.9/gcc/ada/a-textio.ads
vidkidz/crossbridge
1
10497
<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- Note: the generic subpackages of Text_IO (Integer_IO, Float_IO, Fixed_IO, -- Modular_IO, Decimal_IO and Enumeration_IO) appear as private children in -- GNAT. These children are with'ed automatically if they are referenced, so -- this rearrangement is invisible to user programs, but has the advantage -- that only the needed parts of Text_IO are processed and loaded. with Ada.IO_Exceptions; with Ada.Streams; with System; with System.File_Control_Block; package Ada.Text_IO is pragma Elaborate_Body; type File_Type is limited private; type File_Mode is (In_File, Out_File, Append_File); -- The following representation clause allows the use of unchecked -- conversion for rapid translation between the File_Mode type -- used in this package and System.File_IO. for File_Mode use (In_File => 0, -- System.FIle_IO.File_Mode'Pos (In_File) Out_File => 2, -- System.File_IO.File_Mode'Pos (Out_File) Append_File => 3); -- System.File_IO.File_Mode'Pos (Append_File) type Count is range 0 .. Natural'Last; -- The value of Count'Last must be large enough so that the assumption -- enough so that the assumption that the Line, Column and Page -- counts can never exceed this value is a valid assumption. subtype Positive_Count is Count range 1 .. Count'Last; Unbounded : constant Count := 0; -- Line and page length subtype Field is Integer range 0 .. 255; -- Note: if for any reason, there is a need to increase this value, -- then it will be necessary to change the corresponding value in -- System.Img_Real in file s-imgrea.adb. subtype Number_Base is Integer range 2 .. 16; type Type_Set is (Lower_Case, Upper_Case); --------------------- -- File Management -- --------------------- procedure Create (File : in out File_Type; Mode : File_Mode := Out_File; Name : String := ""; Form : String := ""); procedure Open (File : in out File_Type; Mode : File_Mode; Name : String; Form : String := ""); procedure Close (File : in out File_Type); procedure Delete (File : in out File_Type); procedure Reset (File : in out File_Type; Mode : File_Mode); procedure Reset (File : in out File_Type); function Mode (File : File_Type) return File_Mode; function Name (File : File_Type) return String; function Form (File : File_Type) return String; function Is_Open (File : File_Type) return Boolean; ------------------------------------------------------ -- Control of default input, output and error files -- ------------------------------------------------------ procedure Set_Input (File : File_Type); procedure Set_Output (File : File_Type); procedure Set_Error (File : File_Type); function Standard_Input return File_Type; function Standard_Output return File_Type; function Standard_Error return File_Type; function Current_Input return File_Type; function Current_Output return File_Type; function Current_Error return File_Type; type File_Access is access constant File_Type; function Standard_Input return File_Access; function Standard_Output return File_Access; function Standard_Error return File_Access; function Current_Input return File_Access; function Current_Output return File_Access; function Current_Error return File_Access; -------------------- -- Buffer control -- -------------------- -- Note: The parameter file is IN OUT in the RM, but this is clearly -- an oversight, and was intended to be IN, see AI95-00057. procedure Flush (File : File_Type); procedure Flush; -------------------------------------------- -- Specification of line and page lengths -- -------------------------------------------- procedure Set_Line_Length (File : File_Type; To : Count); procedure Set_Line_Length (To : Count); procedure Set_Page_Length (File : File_Type; To : Count); procedure Set_Page_Length (To : Count); function Line_Length (File : File_Type) return Count; function Line_Length return Count; function Page_Length (File : File_Type) return Count; function Page_Length return Count; ------------------------------------ -- Column, Line, and Page Control -- ------------------------------------ procedure New_Line (File : File_Type; Spacing : Positive_Count := 1); procedure New_Line (Spacing : Positive_Count := 1); procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1); procedure Skip_Line (Spacing : Positive_Count := 1); function End_Of_Line (File : File_Type) return Boolean; function End_Of_Line return Boolean; procedure New_Page (File : File_Type); procedure New_Page; procedure Skip_Page (File : File_Type); procedure Skip_Page; function End_Of_Page (File : File_Type) return Boolean; function End_Of_Page return Boolean; function End_Of_File (File : File_Type) return Boolean; function End_Of_File return Boolean; procedure Set_Col (File : File_Type; To : Positive_Count); procedure Set_Col (To : Positive_Count); procedure Set_Line (File : File_Type; To : Positive_Count); procedure Set_Line (To : Positive_Count); function Col (File : File_Type) return Positive_Count; function Col return Positive_Count; function Line (File : File_Type) return Positive_Count; function Line return Positive_Count; function Page (File : File_Type) return Positive_Count; function Page return Positive_Count; ---------------------------- -- Character Input-Output -- ---------------------------- procedure Get (File : File_Type; Item : out Character); procedure Get (Item : out Character); procedure Put (File : File_Type; Item : Character); procedure Put (Item : Character); procedure Look_Ahead (File : File_Type; Item : out Character; End_Of_Line : out Boolean); procedure Look_Ahead (Item : out Character; End_Of_Line : out Boolean); procedure Get_Immediate (File : File_Type; Item : out Character); procedure Get_Immediate (Item : out Character); procedure Get_Immediate (File : File_Type; Item : out Character; Available : out Boolean); procedure Get_Immediate (Item : out Character; Available : out Boolean); ------------------------- -- String Input-Output -- ------------------------- procedure Get (File : File_Type; Item : out String); procedure Get (Item : out String); procedure Put (File : File_Type; Item : String); procedure Put (Item : String); procedure Get_Line (File : File_Type; Item : out String; Last : out Natural); procedure Get_Line (Item : out String; Last : out Natural); function Get_Line (File : File_Type) return String; pragma Ada_05 (Get_Line); function Get_Line return String; pragma Ada_05 (Get_Line); procedure Put_Line (File : File_Type; Item : String); procedure Put_Line (Item : String); --------------------------------------- -- Generic packages for Input-Output -- --------------------------------------- -- The generic packages: -- Ada.Text_IO.Integer_IO -- Ada.Text_IO.Modular_IO -- Ada.Text_IO.Float_IO -- Ada.Text_IO.Fixed_IO -- Ada.Text_IO.Decimal_IO -- Ada.Text_IO.Enumeration_IO -- are implemented as separate child packages in GNAT, so the -- spec and body of these packages are to be found in separate -- child units. This implementation detail is hidden from the -- Ada programmer by special circuitry in the compiler that -- treats these child packages as though they were nested in -- Text_IO. The advantage of this special processing is that -- the subsidiary routines needed if these generics are used -- are not loaded when they are not used. ---------------- -- Exceptions -- ---------------- Status_Error : exception renames IO_Exceptions.Status_Error; Mode_Error : exception renames IO_Exceptions.Mode_Error; Name_Error : exception renames IO_Exceptions.Name_Error; Use_Error : exception renames IO_Exceptions.Use_Error; Device_Error : exception renames IO_Exceptions.Device_Error; End_Error : exception renames IO_Exceptions.End_Error; Data_Error : exception renames IO_Exceptions.Data_Error; Layout_Error : exception renames IO_Exceptions.Layout_Error; private ----------------------------------- -- Handling of Format Characters -- ----------------------------------- -- Line marks are represented by the single character ASCII.LF (16#0A#). -- In DOS and similar systems, underlying file translation takes care -- of translating this to and from the standard CR/LF sequences used in -- these operating systems to mark the end of a line. On output there is -- always a line mark at the end of the last line, but on input, this -- line mark can be omitted, and is implied by the end of file. -- Page marks are represented by the single character ASCII.FF (16#0C#), -- The page mark at the end of the file may be omitted, and is normally -- omitted on output unless an explicit New_Page call is made before -- closing the file. No page mark is added when a file is appended to, -- so, in accordance with the permission in (RM A.10.2(4)), there may -- or may not be a page mark separating preexising text in the file -- from the new text to be written. -- A file mark is marked by the physical end of file. In DOS translation -- mode on input, an EOF character (SUB = 16#1A#) gets translated to the -- physical end of file, so in effect this character is recognized as -- marking the end of file in DOS and similar systems. LM : constant := Character'Pos (ASCII.LF); -- Used as line mark PM : constant := Character'Pos (ASCII.FF); -- Used as page mark, except at end of file where it is implied -------------------------------- -- Text_IO File Control Block -- -------------------------------- package FCB renames System.File_Control_Block; type Text_AFCB; type File_Type is access all Text_AFCB; type Text_AFCB is new FCB.AFCB with record Page : Count := 1; Line : Count := 1; Col : Count := 1; Line_Length : Count := 0; Page_Length : Count := 0; Self : aliased File_Type; -- Set to point to the containing Text_AFCB block. This is used to -- implement the Current_{Error,Input,Ouput} functions which return -- a File_Access, the file access value returned is a pointer to -- the Self field of the corresponding file. Before_LM : Boolean := False; -- This flag is used to deal with the anomolies introduced by the -- peculiar definition of End_Of_File and End_Of_Page in Ada. These -- functions require looking ahead more than one character. Since -- there is no convenient way of backing up more than one character, -- what we do is to leave ourselves positioned past the LM, but set -- this flag, so that we know that from an Ada point of view we are -- in front of the LM, not after it. A bit of a kludge, but it works! Before_LM_PM : Boolean := False; -- This flag similarly handles the case of being physically positioned -- after a LM-PM sequence when logically we are before the LM-PM. This -- flag can only be set if Before_LM is also set. end record; function AFCB_Allocate (Control_Block : Text_AFCB) return FCB.AFCB_Ptr; procedure AFCB_Close (File : access Text_AFCB); procedure AFCB_Free (File : access Text_AFCB); procedure Read (File : in out Text_AFCB; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); -- Read operation used when Text_IO file is treated directly as Stream procedure Write (File : in out Text_AFCB; Item : Ada.Streams.Stream_Element_Array); -- Write operation used when Text_IO file is treated directly as Stream ------------------------ -- The Standard Files -- ------------------------ Null_Str : aliased constant String := ""; -- Used as name and form of standard files Standard_Err_AFCB : aliased Text_AFCB; Standard_In_AFCB : aliased Text_AFCB; Standard_Out_AFCB : aliased Text_AFCB; Standard_Err : aliased File_Type := Standard_Err_AFCB'Access; Standard_In : aliased File_Type := Standard_In_AFCB'Access; Standard_Out : aliased File_Type := Standard_Out_AFCB'Access; -- Standard files Current_In : aliased File_Type := Standard_In; Current_Out : aliased File_Type := Standard_Out; Current_Err : aliased File_Type := Standard_Err; -- Current files ----------------------- -- Local Subprograms -- ----------------------- -- These subprograms are in the private part of the spec so that they can -- be shared by the routines in the body of Ada.Text_IO.Wide_Text_IO. -- Note: we use Integer in these declarations instead of the more accurate -- Interfaces.C_Streams.int, because we do not want to drag in the spec of -- this interfaces package with the spec of Ada.Text_IO, and we know that -- in fact these types are identical function EOF_Char return Integer; -- Returns the system-specific character indicating the end of a text file. -- This is exported for use by child packages such as Enumeration_Aux to -- eliminate their needing to depend directly on Interfaces.C_Streams. function Getc (File : File_Type) return Integer; -- Gets next character from file, which has already been checked for -- being in read status, and returns the character read if no error -- occurs. The result is EOF if the end of file was read. function Nextc (File : File_Type) return Integer; -- Returns next character from file without skipping past it (i.e. it -- is a combination of Getc followed by an Ungetc). procedure Putc (ch : Integer; File : File_Type); -- Outputs the given character to the file, which has already been -- checked for being in output status. Device_Error is raised if the -- character cannot be written. procedure Terminate_Line (File : File_Type); -- If the file is in Write_File or Append_File mode, and the current -- line is not terminated, then a line terminator is written using -- New_Line. Note that there is no Terminate_Page routine, because -- the page mark at the end of the file is implied if necessary. procedure Ungetc (ch : Integer; File : File_Type); -- Pushes back character into stream, using ungetc. The caller has -- checked that the file is in read status. Device_Error is raised -- if the character cannot be pushed back. An attempt to push back -- and end of file character (EOF) is ignored. end Ada.Text_IO;
Completeness.agda
fangyi-zhou/mpst-in-agda
1
17328
open import Data.Empty using (⊥-elim) open import Data.Fin using (Fin; _≟_) open import Data.Nat using (suc; zero) open import Data.Nat.Properties using (suc-injective; 0≢1+n) open import Data.Product using (∃-syntax; _×_; _,_; proj₁; proj₂) open import Data.Sum using (inj₁; inj₂) open import Data.Vec using (lookup; _[_]≔_) open import Data.Vec.Properties using (lookup∘update; lookup∘update′) open import Relation.Binary.PropositionalEquality using (refl; sym; cong; trans; _≡_; _≢_; module ≡-Reasoning) open import Relation.Nullary using (yes; no) open ≡-Reasoning open import Common open import Global open import Local open import Projection completeness : ∀{ n } { act : Action n } { c c′ g g-size } -> { g-size-is-size-g : g-size ≡ size-g g } -> g ↔ c -> c - act →c c′ -> ∃[ g′ ] g - act →g g′ × g′ ↔ c′ completeness assoc (→c-comm c p≢q lp≡c[p] lq≡c[q] c→c′ (→l-send p _ _) (→l-send .p _ _)) = ⊥-elim (p≢q refl) completeness assoc (→c-comm c p≢q lp≡c[p] lq≡c[q] c→c′ (→l-recv p _ _) (→l-send .p _ _)) = ⊥-elim (p≢q refl) completeness assoc (→c-comm c p≢q lp≡c[p] lq≡c[q] c→c′ (→l-recv p _ _) (→l-recv .p _ _)) = ⊥-elim (p≢q refl) completeness {n} {act} {c′ = c′} {g = g} {g-size = g-size} {g-size-is-size-g = g-size-is-size-g} assoc (→c-comm {p} {q} {l} c p≢q lp≡c[p] lq≡c[q] refl lpReduce@(→l-send {lp = lp} {lpSub = lp′} .p refl p≢q-p) lqReduce@(→l-recv {lp = lq} {lpSub = lq′} .q refl p≢q-q) ) with proj-inv-send-recv {g = g} (trans (sym (_↔_.isProj assoc p)) (sym lp≡c[p])) (trans (sym (_↔_.isProj assoc q)) (sym lq≡c[q])) ... | inj₁ (p≢q , g′ , refl , refl , refl) = g′ , →g-prefix , record { isProj = isProj-g′ } where isProj-g′ : (r : Fin n) -> lookup c′ r ≡ project g′ r isProj-g′ r with r ≟ p | r ≟ q ... | yes refl | yes refl = ⊥-elim (p≢q refl) ... | no r≢p | yes refl rewrite lookup∘update q (c [ p ]≔ lp′) lq′ = refl ... | yes refl | no r≢q rewrite lookup∘update′ p≢q (c [ p ]≔ lp′) lq′ rewrite lookup∘update p c lp′ = refl ... | no r≢p | no r≢q rewrite lookup∘update′ r≢q (c [ p ]≔ lp′) lq′ rewrite lookup∘update′ r≢p c lp′ rewrite sym (proj-prefix-other {l = l} p q r {p≢q} g′ (¬≡-flip r≢p) (¬≡-flip r≢q)) rewrite _↔_.isProj assoc r = refl ... | inj₂ (r , s , r≢s , l′ , gSub , refl , r≢p , s≢p , r≢q , s≢q , gSub-proj-p , gSub-proj-q) with g-size ... | zero = ⊥-elim (0≢1+n g-size-is-size-g) ... | suc gSub-size = g′ , gReduce , record { isProj = isProj-g′ } where lrSub = project gSub r lsSub = project gSub s remove-prefix-g : ∃[ cSub ] cSub ≡ (c [ r ]≔ lrSub) [ s ]≔ lsSub × gSub ↔ cSub remove-prefix-g = config-gt-remove-prefix g c assoc refl completeness-gSub : ∃[ gSub′ ] gSub - act →g gSub′ × gSub′ ↔ ((((c [ r ]≔ lrSub) [ s ]≔ lsSub) [ p ]≔ lp′) [ q ]≔ lq′) completeness-gSub with remove-prefix-g ... | cSub , refl , gSub↔cSub = completeness {g = gSub} {g-size = gSub-size} {gSub-size-is-size-gSub} gSub↔cSub cSub→cSub′ where gSub-size-is-size-gSub : gSub-size ≡ size-g gSub gSub-size-is-size-gSub = suc-injective g-size-is-size-g cSub′ = (cSub [ p ]≔ lp′) [ q ]≔ lq′ cSub→cSub′ : cSub - act →c cSub′ cSub→cSub′ with remove-prefix-g ... | cSub , refl , gSub↔cSub = →c-comm cSub p≢q lp≡cSub[p] lq≡cSub[q] refl lpReduce lqReduce where lp≡cSub[p] : lp ≡ lookup cSub p lp≡cSub[p] rewrite lp≡c[p] rewrite sym (lookup∘update′ (¬≡-flip r≢p) c lrSub) rewrite sym (lookup∘update′ (¬≡-flip s≢p) (c [ r ]≔ lrSub) lsSub) = refl lq≡cSub[q] : lq ≡ lookup cSub q lq≡cSub[q] rewrite lq≡c[q] rewrite sym (lookup∘update′ (¬≡-flip r≢q) c lrSub) rewrite sym (lookup∘update′ (¬≡-flip s≢q) (c [ r ]≔ lrSub) lsSub) = refl g′ : Global n g′ with completeness-gSub ... | gSub′ , _ , _ = msgSingle r s r≢s l′ gSub′ gReduce : g - act →g g′ gReduce with completeness-gSub ... | gSub′ , gSubReduce , gSub′↔cSub′ = →g-cont gSubReduce (¬≡-flip r≢p) (¬≡-flip r≢q) (¬≡-flip s≢p) (¬≡-flip s≢q) isProj-g′ : (t : Fin n) -> lookup c′ t ≡ project g′ t isProj-g′ t with remove-prefix-g | completeness-gSub ... | cSub , un-c′ , g′↔c′ | gSub′ , gSubReduce , gSub′↔cSub′ with r ≟ t | s ≟ t ... | yes refl | yes refl = ⊥-elim (r≢s refl) ... | no r≢t | yes refl rewrite sym (_↔_.isProj gSub′↔cSub′ s) rewrite lookup∘update′ s≢q (c [ p ]≔ lp′) lq′ rewrite lookup∘update′ s≢p c lp′ rewrite _↔_.isProj assoc s rewrite proj-prefix-recv {l = l′} r s gSub r≢s rewrite lookup∘update′ s≢q (((c [ r ]≔ lrSub) [ s ]≔ lsSub) [ p ]≔ lp′) lq′ rewrite lookup∘update′ s≢p ((c [ r ]≔ lrSub) [ s ]≔ lsSub) lp′ rewrite lookup∘update s (c [ r ]≔ lrSub) lsSub = refl ... | yes refl | no s≢t rewrite sym (_↔_.isProj gSub′↔cSub′ r) rewrite lookup∘update′ r≢q (c [ p ]≔ lp′) lq′ rewrite lookup∘update′ r≢p c lp′ rewrite _↔_.isProj assoc r rewrite proj-prefix-send {l = l′} r s gSub r≢s rewrite lookup∘update′ r≢q (((c [ r ]≔ lrSub) [ s ]≔ lsSub) [ p ]≔ lp′) lq′ rewrite lookup∘update′ r≢p ((c [ r ]≔ lrSub) [ s ]≔ lsSub) lp′ rewrite lookup∘update′ r≢s (c [ r ]≔ lrSub) lsSub rewrite lookup∘update r c lrSub = refl ... | no r≢t | no s≢t rewrite proj-prefix-other {l = l′} r s t {r≢s} gSub′ r≢t s≢t with p ≟ t | q ≟ t ... | yes refl | yes refl = ⊥-elim (p≢q refl) ... | yes refl | no q≢t rewrite lookup∘update′ p≢q (c [ p ]≔ lp′) lq′ rewrite lookup∘update p c lp′ rewrite sym (_↔_.isProj gSub′↔cSub′ p) rewrite lookup∘update′ p≢q (((c [ r ]≔ lrSub) [ s ]≔ lsSub) [ p ]≔ lp′) lq′ rewrite lookup∘update p ((c [ r ]≔ lrSub) [ s ]≔ lsSub) lp′ = refl ... | no p≢t | yes refl rewrite lookup∘update q (c [ p ]≔ lp′) lq′ rewrite sym (_↔_.isProj gSub′↔cSub′ q) rewrite lookup∘update q (((c [ r ]≔ lrSub) [ s ]≔ lsSub) [ p ]≔ lp′) lq′ = refl ... | no p≢t | no q≢t rewrite lookup∘update′ (¬≡-flip q≢t) (c [ p ]≔ lp′) lq′ rewrite lookup∘update′ (¬≡-flip p≢t) c lp′ rewrite sym (_↔_.isProj gSub′↔cSub′ t) rewrite lookup∘update′ (¬≡-flip q≢t) (((c [ r ]≔ lrSub) [ s ]≔ lsSub) [ p ]≔ lp′) lq′ rewrite lookup∘update′ (¬≡-flip p≢t) ((c [ r ]≔ lrSub) [ s ]≔ lsSub) lp′ rewrite lookup∘update′ (¬≡-flip s≢t) (c [ r ]≔ lrSub) lsSub rewrite lookup∘update′ (¬≡-flip r≢t) c lrSub = refl
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/mak.lzh/mak/kart-bg-j.asm
prismotizm/gigaleak
0
172399
<reponame>prismotizm/gigaleak Name: kart-bg-j.asm Type: file Size: 17571 Last-Modified: '1992-08-06T07:16:30Z' SHA-1: A834631CD7DE9ABF5E8162AD31EB5C2B6B99C68E Description: null
QuantitativeAlloy/models/alloy/bayesianNetwork/bayesContract.als
pf7/QAlloy
0
4155
<reponame>pf7/QAlloy one sig Unit{ rain : one R, -- input distribution to measure the contract [[grass_wet <- f <- raining]] delta : one R } abstract sig R{ sprinkler : one S, -- Helper relation to store: sprinkler ▿ iden spID : one RS, -- System that reacts to rain: sprinkler ▿ ((sprinkler ▿ iden).grass) f : one SG } one sig Rain, NoRain extends R{} abstract sig S, G{} one sig On, Off extends S{} one sig Wet, Dry extends G{} // S x R abstract sig RS{ grass : one G } one sig RainOff, RainOn, NoRainOff, NoRainOn extends RS{} // S x G abstract sig SG{} one sig OffDry, OffWet, OnDry, OnWet extends SG{} fact{ //sprinkler #(NoRain.sprinkler :> On) = div[4, 10] #(Rain.sprinkler :> On) = div[1, 100] // grass one NoRainOff.grass :> Dry #(RainOff.grass :> Dry) = div[2, 10] #(NoRainOn.grass :> Dry) = div[1, 10] #(RainOn.grass :> Dry) = div[1, 100] // sprinkler ▿ id #(Rain.spID :> RainOn) = #(Rain.sprinkler :> On) #(Rain.spID :> RainOff) = #(Rain.sprinkler :> Off) #(NoRain.spID :> NoRainOn) = #(NoRain.sprinkler :> On) #(NoRain.spID :> NoRainOff) = #(NoRain.sprinkler :> Off) // sprinkler ▿ ((sprinkler ▿ iden).grass) let gis = spID.grass { #(NoRain.f :> OffDry) = mul[#(NoRain.sprinkler :> Off), #(NoRain.gis :> Dry)] #(NoRain.f :> OffWet) = mul[#(NoRain.sprinkler :> Off), #(NoRain.gis :> Wet)] #(NoRain.f :> OnDry) = mul[#(NoRain.sprinkler :> On), #(NoRain.gis :> Dry)] #(NoRain.f :> OnWet) = mul[#(NoRain.sprinkler :> On), #(NoRain.gis :> Wet)] #(Rain.f :> OffDry) = mul[#(Rain.sprinkler :> Off), #(Rain.gis :> Dry)] #(Rain.f :> OffWet) = mul[#(Rain.sprinkler :> Off), #(Rain.gis :> Wet)] #(Rain.f :> OnDry) = mul[#(Rain.sprinkler :> On), #(Rain.gis :> Dry)] #(Rain.f :> OnWet) = mul[#(Rain.sprinkler :> On), #(Rain.gis :> Wet)] } } fun grass_wet : SG{ OffWet + OnWet } fun raining : R{ Rain } -- [[grass_wet <- f - raining]](delta) = (f.grass_wet x raining) . delta / delta.raining -- = P(grass_wet | raining) fun measureContract : Unit{ delta.(f.grass_wet fun/mul raining) fun/div delta.raining } assert contract{ #measureContract = div[8019, 10000] } check contract run knownRain{ // rain #(Unit.rain :> Rain) = div[2, 10] // Currently needed to ensure that division by zero instances are properly detected some measureContract or no measureContract }
programs/oeis/135/A135947.asm
neoneye/loda
22
241409
<filename>programs/oeis/135/A135947.asm ; A135947: a(n)=(floor(3*S2(n)/2)) mod 2, where S2(n) is the binary weight of n. ; 0,1,1,1,1,1,1,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,1,0,1,1,1,1,1,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0 seq $0,324467 ; Three times the binary weight of n: 3*A000120(n). div $0,2 mod $0,2
ZeroMQ/filecode/examples/Ada/zmq-examples.ads
JailbreakFox/LightWeightRepository
2
18035
package ZMQ.Examples is END_MESSAGE : constant String := "<END>"; end ZMQ.Examples;
source/oasis/program-elements-defining_names.ads
reznikmm/gela
0
17080
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package Program.Elements.Defining_Names is pragma Pure (Program.Elements.Defining_Names); type Defining_Name is limited interface and Program.Elements.Element; type Defining_Name_Access is access all Defining_Name'Class with Storage_Size => 0; not overriding function Image (Self : Defining_Name) return Text is abstract; end Program.Elements.Defining_Names;
programs/oeis/206/A206909.asm
karttu/loda
1
166564
; A206909: Position of 2n+cos(n) when the sets {2k+cos(k)} and {2k+sin(k)} are jointly ranked. ; 1,3,5,8,10,12,14,15,17,19,22,24,26,27,29,31,34,36,38,39,41,43,46,48,50,51,53,55,57,60,62,64,65,67,69,72,74,76,77,79,81,84,86,88,89,91,93,96,98,100,102,103,105,107,110,112,114,115,117,119,122,124,126 mov $3,$0 add $3,1 mov $4,7 mul $4,$3 sub $4,6 div $4,22 add $4,1 gcd $4,2 mov $1,$4 mov $2,$0 mul $2,2 add $1,$2
programs/oeis/027/A027937.asm
karttu/loda
0
94078
; A027937: a(n) = T(2*n, n+1), T given by A027935. ; 1,7,26,79,221,596,1581,4163,10926,28635,75001,196392,514201,1346239,3524546,9227431,24157781,63245948,165580101,433494395,1134903126,2971215027,7778742001,20365011024,53316291121 lpb $0,1 sub $0,1 add $1,1 add $3,2 add $1,$3 add $2,$1 add $1,$2 lpe add $1,1
src/EntityLanguage/EntityLanguage.g4
cyberlect/entity-language
0
3443
grammar EntityLanguage; start : 'module' ID definition* ; definition : 'entity' ID '{' property* '}' ; property : ID ':' type ; type : ID ; ID : [a-zA-Z_\-][a-zA-Z0-9_\-]* ; WS : [ \t\r\n]+ -> skip ;
alloy4fun_models/trashltl/models/4/MeE3DFfqNyDGofdZC.als
Kaixi26/org.alloytools.alloy
0
2498
open main pred idMeE3DFfqNyDGofdZC_prop5 { eventually (some f : File | f in Trash) } pred __repair { idMeE3DFfqNyDGofdZC_prop5 } check __repair { idMeE3DFfqNyDGofdZC_prop5 <=> prop5o }
src/game_level/level_data.asm
TypeDefinition/NautiBuoy
2
99126
INCLUDE "./src/definitions/definitions.inc" /* Stores the data on where and what type of enemy should be place on the level Data for enemies: - Enemy type - Grid pos y * 8 pixels - Grid pos x * 8 pixels - Direction of movement and shoot direction - health - velocity - initial max animation frame */ SECTION "Level Data", ROMX Stage0PlayerData:: db 20 * 8 ; spawn y pos db 3 * 8 ; spawn x pos db 3 ; starting health for level Stage1PlayerData:: db 21 * 8 ; spawn y pos db 5 * 8 ; spawn x pos db 3 ; starting health for level Stage2PlayerData:: db 20 * 8 ; spawn y pos db 5 * 8 ; spawn x pos db 3 ; starting health for level Stage3PlayerData:: db 28 * 8 ; spawn y pos db 3 * 8 ; spawn x pos db 3 ; starting health for level Stage4PlayerData:: db 28 * 8 ; spawn y pos db 4 * 8 ; spawn x pos db 3 ; starting health for level StageXXPlayerData:: db 23 * 8 ; spawn y pos db 3 * 8 ; spawn x pos db 3 ; starting health for level Stage0EnemyData:: db 5 ; number of enemies in level .enemyOne ; top in the bush db TYPE_ENEMYA | FLAG_ENEMY | FLAG_ACTIVE db 7 * 8 ; y db 10 * 8 ; x db DIR_UP db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .enemyTwo ; on the right, not moving db TYPE_ENEMYA | FLAG_ENEMY | FLAG_ACTIVE db 12 * 8 ; y db 17 * 8 ; x db DIR_UP db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .enemyThree ; very right, moving up and down db TYPE_ENEMYA_MOV | FLAG_ENEMY | FLAG_ACTIVE db 12 * 8 ; y db 22 * 8 ; x db DIR_UP db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .enemyFour ; at the water area db TYPE_ENEMYA | FLAG_ENEMY | FLAG_ACTIVE db 2 * 8 ; y db 24 * 8 ; x db DIR_UP db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .enemyFive ; ON THE very top, moving db TYPE_ENEMYA_MOV | FLAG_ENEMY | FLAG_ACTIVE db 2 * 8 ; y db 2 * 8 ; x db DIR_RIGHT db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .endStage0EnemyData: Stage1EnemyData:: db 7 ; number of enemies in level .enemyOne ; left at the start db TYPE_ENEMYA | FLAG_ENEMY | FLAG_ACTIVE db 12 * 8 ; y db 2 * 8 ; x db DIR_LEFT db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .enemyTwo ; turtle in the middle db TYPE_ENEMYB | FLAG_ENEMY | FLAG_ACTIVE db 15 * 8 ; y db 15 * 8 ; x db DIR_RIGHT db ENEMY_TYPEB_HEALTH dw ENEMY_TYPEB_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEB_WALK_MAX_FRAMES .enemyThree ; very top db TYPE_ENEMYB | FLAG_ENEMY | FLAG_ACTIVE db 4 * 8 ; y db 2 * 8 ; x db DIR_RIGHT db ENEMY_TYPEB_HEALTH dw ENEMY_TYPEB_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEB_WALK_MAX_FRAMES .enemyFour ; squid, little bit on the top right, not moving db TYPE_ENEMYA | FLAG_ENEMY | FLAG_ACTIVE db 6 * 8 ; y db 22 * 8 ; x db DIR_UP db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .enemyFive ; squid, little bit on the top, moving db TYPE_ENEMYA_MOV | FLAG_ENEMY | FLAG_ACTIVE db 2 * 8 ; y db 16 * 8 ; x db DIR_LEFT db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .enemySix ; turtle, on the right corner db TYPE_ENEMYB | FLAG_ENEMY | FLAG_ACTIVE db 12 * 8 ; y db 26 * 8 ; x db DIR_UP db ENEMY_TYPEB_HEALTH dw ENEMY_TYPEB_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEB_WALK_MAX_FRAMES .enemySeven ; squid, bottom right corner db TYPE_ENEMYA | FLAG_ENEMY | FLAG_ACTIVE db 21 * 8 ; y db 19 * 8 ; x db DIR_DOWN db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .endStage1EnemyData: Stage2EnemyData:: db 5 ; number of enemies in level .enemyOne ; in the middle at the start db TYPE_ENEMYC | FLAG_ENEMY | FLAG_ACTIVE db 11 * 8 ; y db 4 * 8 ; x db DIR_RIGHT | SHOOT_DIR_UP | SHOOT_DIR_DOWN | SHOOT_DIR_RIGHT | SHOOT_DIR_LEFT db ENEMY_TYPEC_HEALTH dw ENEMY_TYPEC_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEC_NORMAL_STATE_MAX_FRAME .enemyTwo ; right db TYPE_ENEMYC | FLAG_ENEMY | FLAG_ACTIVE db 6 * 8 ; y db 24 * 8 ; x db DIR_UP | SHOOT_DIR_UP | SHOOT_DIR_DOWN | SHOOT_DIR_RIGHT | SHOOT_DIR_LEFT db ENEMY_TYPEC_HEALTH dw ENEMY_TYPEC_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEC_NORMAL_STATE_MAX_FRAME .enemyThree ; very right db TYPE_ENEMYB | FLAG_ENEMY | FLAG_ACTIVE db 21 * 8 ; y db 27 * 8 ; x db DIR_UP db ENEMY_TYPEB_HEALTH dw ENEMY_TYPEB_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEB_WALK_MAX_FRAMES .enemyFour ; very top db TYPE_ENEMYB | FLAG_ENEMY | FLAG_ACTIVE db 2 * 8 ; y db 2 * 8 ; x db DIR_RIGHT db ENEMY_TYPEB_HEALTH dw ENEMY_TYPEB_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEB_WALK_MAX_FRAMES .enemyFive ; bottom, squid, not moving db TYPE_ENEMYA | FLAG_ENEMY | FLAG_ACTIVE db 16 * 8 ; y db 19 * 8 ; x db DIR_UP db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .endStage2EnemyData: Stage3EnemyData:: db 6 ; number of enemies in level .enemyOne ; very top left db TYPE_ENEMYD | FLAG_ENEMY | FLAG_ACTIVE db 3 * 8 ; y db 4 * 8 ; x db DIR_DOWN db ENEMY_TYPED_HEALTH dw ENEMY_TYPED_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPED_ANIMATION_FRAMES .enemyTwo ; on the right db TYPE_ENEMYC | FLAG_ENEMY | FLAG_ACTIVE db 15 * 8 ; y db 19 * 8 ; x db DIR_RIGHT | SHOOT_DIR_UP | SHOOT_DIR_DOWN | SHOOT_DIR_RIGHT | SHOOT_DIR_LEFT db ENEMY_TYPEC_HEALTH dw ENEMY_TYPEC_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEC_NORMAL_STATE_MAX_FRAME .enemyThree ; on the top right db TYPE_ENEMYB | FLAG_ENEMY | FLAG_ACTIVE db 2 * 8 ; y db 21 * 8 ; x db DIR_RIGHT db ENEMY_TYPEB_HEALTH dw ENEMY_TYPEB_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEB_WALK_MAX_FRAMES .enemyFour ; at the very bottom db TYPE_ENEMYB | FLAG_ENEMY | FLAG_ACTIVE db 28 * 8 ; y db 20 * 8 ; x db DIR_RIGHT db ENEMY_TYPEB_HEALTH dw ENEMY_TYPEB_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEB_WALK_MAX_FRAMES .enemyFive ; at the very bottom db TYPE_ENEMYA | FLAG_ENEMY | FLAG_ACTIVE db 19 * 8 ; y db 10 * 8 ; x db DIR_RIGHT db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .enemySix ; at the very bottom right db TYPE_ENEMYA | FLAG_ENEMY | FLAG_ACTIVE db 29 * 8 ; y db 28 * 8 ; x db DIR_DOWN db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .endStage3EnemyData: Stage4EnemyData:: db 6 ; number of enemies in level .enemyOne ; top left stingray db TYPE_ENEMYD | FLAG_ENEMY | FLAG_ACTIVE db 3 * 8 ; y db 2 * 8 ; x db DIR_DOWN db ENEMY_TYPED_HEALTH dw ENEMY_TYPED_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPED_ANIMATION_FRAMES .enemyTwo ; right stingray db TYPE_ENEMYD | FLAG_ENEMY | FLAG_ACTIVE db 10 * 8 ; y db 28 * 8 ; x db DIR_RIGHT db ENEMY_TYPED_HEALTH dw ENEMY_TYPED_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPED_ANIMATION_FRAMES .enemyThree ; bottom squid, not moving db TYPE_ENEMYA | FLAG_ENEMY | FLAG_ACTIVE db 19 * 8 ; y db 19 * 8 ; x db DIR_UP db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .enemyFour ; puffer fish middle db TYPE_ENEMYC | FLAG_ENEMY | FLAG_ACTIVE db 13 * 8 ; y db 6 * 8 ; x db DIR_RIGHT | SHOOT_DIR_UP | SHOOT_DIR_DOWN | SHOOT_DIR_RIGHT | SHOOT_DIR_LEFT db ENEMY_TYPEC_HEALTH dw ENEMY_TYPEC_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEC_NORMAL_STATE_MAX_FRAME .enemyFive ; squid moving, above db TYPE_ENEMYA_MOV | FLAG_ENEMY | FLAG_ACTIVE db 6 * 8 ; y db 19 * 8 ; x db DIR_LEFT db ENEMY_TYPEA_HEALTH dw ENEMY_TYPEA_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .enemySix ; turtle left db TYPE_ENEMYB | FLAG_ENEMY | FLAG_ACTIVE db 22 * 8 ; y db 27 * 8 ; x db DIR_UP db ENEMY_TYPEB_HEALTH dw ENEMY_TYPEB_VELOCITY ; cpu allocate and auto store in little endian db ENEMY_TYPEB_WALK_MAX_FRAMES .endStage4EnemyData: Stage5EnemyData:: db 1 ; number of enemies in level .endStage5EnemyData: /* Final level data */ StageXXEnemyData:: db 1 ; number of enemies in level .enemyOne ; at the db TYPE_ENEMY_BOSS | FLAG_ENEMY | FLAG_ACTIVE db 8 * 8 ; y db 16 * 8 ; x db DIR_LEFT | SHOOT_DIR_DOWN | SHOOT_DIR_RIGHT | SHOOT_DIR_UP | SHOOT_DIR_LEFT db ENEMY_BOSS_HEALTH dw VELOCITY_VSLOW ; cpu allocate and auto store in little endian db ENEMY_TYPEA_WALK_FRAMES .endStageXXEnemyData: /* Powerup information and data for level 1 */ Level0PowerUpData:: db 4 ; number of powerups in level .powerUpOne db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 15 * 8 ; y db 9 * 8 ; x db HEART_POWERUP_SPRITE_ID .powerUpTwo db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 2 * 8 ; y db 17 * 8 ; x db HEART_POWERUP_SPRITE_ID .powerUpThree db TYPE_TIME_POWERUP | FLAG_ACTIVE db 20 * 8 ; y db 24 * 8 ; x db TIME_POWERUP_SPRITE_ID .powerUpFour db TYPE_TIME_POWERUP | FLAG_ACTIVE db 3 * 8 ; y db 9 * 8 ; x db TIME_POWERUP_SPRITE_ID .endPowerUp0 Level1PowerUpData:: db 6 ; number of powerups in level .powerUpOne db TYPE_DAMAGE_POWERUP | FLAG_ACTIVE db 20 * 8 ; y db 8 * 8 ; x db DAMAGE_POWERUP_SPRITE_ID .powerUpTwo ; at the very top db TYPE_TIME_POWERUP | FLAG_ACTIVE db 3 * 8 ; y db 10 * 8 ; x db TIME_POWERUP_SPRITE_ID .powerUpThree ; in the plants db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 9 * 8 ; y db 4 * 8 ; x db HEART_POWERUP_SPRITE_ID .powerUpFour ; next to the turtle in the middle db TYPE_DAMAGE_POWERUP | FLAG_ACTIVE db 14 * 8 ; y db 21 * 8 ; x db DAMAGE_POWERUP_SPRITE_ID .powerUpFive ; at the top near the water db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 5 * 8 ; y db 15 * 8 ; x db HEART_POWERUP_SPRITE_ID .powerUpSix ; at the very right db TYPE_TIME_POWERUP | FLAG_ACTIVE db 18 * 8 ; y db 26 * 8 ; x db TIME_POWERUP_SPRITE_ID .endPowerUp1 Level2PowerUpData:: db 5 ; number of powerups in level .powerUpOne ; beside the starting puffer fish db TYPE_INVINCIBILITY_POWERUP | FLAG_ACTIVE db 13 * 8 ; y db 5 * 8 ; x db INVINCIBILITY_POWERUP_SPRITE_ID .powerUpTwo ; ay the very bottom db TYPE_TIME_POWERUP | FLAG_ACTIVE db 24 * 8 ; y db 22 * 8 ; x db TIME_POWERUP_SPRITE_ID .powerUpThree ; at the turtle area on the right db TYPE_DAMAGE_POWERUP | FLAG_ACTIVE db 15 * 8 ; y db 29 * 8 ; x db DAMAGE_POWERUP_SPRITE_ID .powerUpFour ; at the very top right db TYPE_TIME_POWERUP | FLAG_ACTIVE db 2 * 8 ; y db 23 * 8 ; x db TIME_POWERUP_SPRITE_ID .powerUpFive ; at the top db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 4 * 8 ; y db 13 * 8 ; x db HEART_POWERUP_SPRITE_ID .endPowerUp2 Level3PowerUpData:: db 7 ; number of powerups in level .powerUpOne ; middle left, speed db TYPE_SPEED_POWERUP | FLAG_ACTIVE db 12 * 8 ; y db 8 * 8 ; x db SPEED_POWERUP_SPRITE_ID .powerUpTwo ; health, top middle db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 2 * 8 ; y db 16 * 8 ; x db HEART_POWERUP_SPRITE_ID .powerUpThree ; middle, middle, time, after the squid db TYPE_TIME_POWERUP | FLAG_ACTIVE db 15 * 8 ; y db 15 * 8 ; x db TIME_POWERUP_SPRITE_ID .powerUpFour ; very bottom right db TYPE_TIME_POWERUP | FLAG_ACTIVE db 29 * 8 ; y db 30 * 8 ; x db TIME_POWERUP_SPRITE_ID .powerUpFive ; near the puffle fish db TYPE_INVINCIBILITY_POWERUP | FLAG_ACTIVE db 11 * 8 ; y db 21 * 8 ; x db INVINCIBILITY_POWERUP_SPRITE_ID .powerUpSix ; top right db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 5 * 8 ; y db 29 * 8 ; x db HEART_POWERUP_SPRITE_ID .powerUpSeven ; top right db TYPE_DAMAGE_POWERUP | FLAG_ACTIVE db 18 * 8 ; y db 25 * 8 ; x db DAMAGE_POWERUP_SPRITE_ID .endPowerUp3 Level4PowerUpData:: db 6 ; number of powerups in level .powerUpOne ; near the puffer fish db TYPE_SPEED_POWERUP | FLAG_ACTIVE db 16 * 8 ; y db 10 * 8 ; x db SPEED_POWERUP_SPRITE_ID .powerUpTwo ; near left stingray db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 5 * 8 ; y db 12 * 8 ; x db HEART_POWERUP_SPRITE_ID .powerUpThree ; very top right db TYPE_INVINCIBILITY_POWERUP | FLAG_ACTIVE db 2 * 8 ; y db 28 * 8 ; x db INVINCIBILITY_POWERUP_SPRITE_ID .powerUpFour ; near right stingray db TYPE_DAMAGE_POWERUP | FLAG_ACTIVE db 9 * 8 ; y db 30 * 8 ; x db DAMAGE_POWERUP_SPRITE_ID .powerUpFive ; near turtle db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 21 * 8 ; y db 28 * 8 ; x db HEART_POWERUP_SPRITE_ID .powerUpSix ; inside with moving squid db TYPE_TIME_POWERUP | FLAG_ACTIVE db 8 * 8 ; y db 20 * 8 ; x db TIME_POWERUP_SPRITE_ID .endPowerUp4 LevelXXPowerUpData:: db 7 ; number of powerups in level .powerUpOne db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 2 * 8 ; y db 2 * 8 ; x db HEART_POWERUP_SPRITE_ID .powerUpTwo db TYPE_SPEED_POWERUP | FLAG_ACTIVE db 19 * 8 ; y db 21 * 8 ; x db SPEED_POWERUP_SPRITE_ID .powerUpThree db TYPE_DAMAGE_POWERUP | FLAG_ACTIVE db 4 * 8 ; y db 20 * 8 ; x db DAMAGE_POWERUP_SPRITE_ID .powerUpFour db TYPE_INVINCIBILITY_POWERUP | FLAG_ACTIVE db 10 * 8 ; y db 12 * 8 ; x db INVINCIBILITY_POWERUP_SPRITE_ID .powerUpFive db TYPE_HEALTH_POWERUP | FLAG_ACTIVE db 17 * 8 ; y db 5 * 8 ; x db HEART_POWERUP_SPRITE_ID .powerUpSix db TYPE_DAMAGE_POWERUP | FLAG_ACTIVE db 12 * 8 ; y db 18 * 8 ; x db DAMAGE_POWERUP_SPRITE_ID .powerUpSeven db TYPE_SPEED_POWERUP | FLAG_ACTIVE db 19 * 8 ; y db 10 * 8 ; x db SPEED_POWERUP_SPRITE_ID .endPowerUp5
_anim/obj0E.asm
NatsumiFox/AMPS-Sonic-1-2005
2
241656
; --------------------------------------------------------------------------- ; Animation script - Sonic on the title screen ; --------------------------------------------------------------------------- dc.w byte_A706-Ani_obj0E byte_A706: dc.b 7, 0, 1, 2, 3, 4, 5, 6, 7, $FE, 2, 0 even
03/1/src/main.adb
Heziode/aoc-ada-2021
3
19086
with Ada.Containers.Vectors, Ada.Exceptions, Ada.Integer_Text_IO, Ada.Text_IO; with Utils; procedure Main is use Ada.Containers, Ada.Text_IO; use Utils; type Binary_Rate is record Zero : Natural; One : Natural; end record; type Binary is mod 2; package Binary_Rate_Vectors is new Ada.Containers.Vectors (Natural, Binary_Rate); use Binary_Rate_Vectors; File : File_Type; Gamma : Vector := Empty_Vector; Epsilon : Vector := Empty_Vector; begin Get_File (File); -- Get all values while not End_Of_File (File) loop declare procedure Process (Vec : out Vector; Index : Natural; Bit : Binary); procedure Process (Vec : out Vector; Index : Natural; Bit : Binary) is begin if Count_Type (Index) > Vec.Length then Vec.Append (New_Item => (Zero => (if Bit = 0 then 1 else 0), One => Natural (Bit))); else declare Temp_Rate : Binary_Rate := Vec.Element (Index - 1); begin if Bit = 0 then Temp_Rate.Zero := Temp_Rate.Zero + 1; else Temp_Rate.One := Temp_Rate.One + 1; end if; Vec.Replace_Element (Index - 1, Temp_Rate); end; end if; end Process; Line : constant String := Get_Line (File); begin Split_Value : for Index in Line'Range loop Solve_Puzzle : declare Bit : constant Binary := Binary'Value (Line (Index) & ""); begin Process (Gamma, Index, Bit); Process (Epsilon, Index, Bit + 1); end Solve_Puzzle; end loop Split_Value; end; end loop; declare function Compute_Vector_Value (Vec : Vector) return Natural; function Compute_Vector_Value (Vec : Vector) return Natural is Exp : Natural := 0; Result : Natural := 0; begin for Elt : Binary_Rate of reverse Vec loop if Elt.One > Elt.Zero then Result := Result + 2**Exp; end if; Exp := Exp + 1; end loop; return Result; end Compute_Vector_Value; Gamma_Result : constant Natural := Compute_Vector_Value (Gamma); Epsilon_Result : constant Natural := Compute_Vector_Value (Epsilon); begin -- Print the result Put ("Result: "); Ada.Integer_Text_IO.Put (Item => Gamma_Result * Epsilon_Result, Width => 0); New_Line; end; Close_If_Open (File); exception when Occur : others => Put_Line ("Error: " & Ada.Exceptions.Exception_Message (Occur)); Close_If_Open (File); end Main;
src/Data/Bindings/Examples/HelloFour.agda
agda/agda-data-bindings
2
14082
<filename>src/Data/Bindings/Examples/HelloFour.agda open import IO using ( run ; putStrLn ) open import Data.String using ( _++_ ) open import Data.Natural using ( # ; _+_ ; toString ) module Data.Bindings.Examples.HelloFour where main = run (putStrLn ("Hello, " ++ toString (#(2) + #(2)) ++ "."))
routines.asm
brian-kelley/Mandelbrot
1
172032
<filename>routines.asm ; Notes on System V ABI: ; pointer/int argument passing order: ; rdi, rsi, rdx, rccx, r8, r9 ; pointer/int returning order: ; rax, rdx ; free registers (no need to push/pop): ; rax, rcx, rdx, rsi, rdi, r8, r9, r10, r11 global _bimul ; void bimul(BigInt* dst, BigInt* lhs, BigInt* rhs) global _biadd ; void bimul(BigInt* dst, BigInt* lhs, BigInt* rhs) global _bisub ; void bimul(BigInt* dst, BigInt* lhs, BigInt* rhs) global _biinc ; void biinc(BigInt* op) section .text _bimul: ; rdi = BigInt* dst ; rsi = BigInt* lhs ; rdx = BigInt* rhs xor rcx, rcx mov ecx, [rsi + 8] ; ecx = # of words cmp ecx, 1 je .bimul1 cmp ecx, 2 je .bimul2 mov r10, rdx ; r10 = &rhs mov r11, rdi ; r11 = &dst mov rdi, [r11] ; rdi points to dst words xor rdx, rdx mov edx, ecx ; save a copy of # of words to r9 (ecx gets lost) ; r11 = &dst ; rsi = &lhs ; r10 = &rhs ; rdx = # of words mov r9, rdx shl rcx, 1 ; rcx needs the # of dwords to zero out xor eax, eax ; eax has the 0 to write out rep stosd ; writes eax to ecx dwords starting at edi push r12 ; now dst words are all 0 mov r11, [r11] mov rsi, [rsi] mov r10, [r10] ; r11 = dst->val ; rsi = lhs->val ; r10 = rhs->val ; r9 = # of qwords to operate on ; vars needed here: ; dst starting word (ptr) ; r11 ; lhs starting word (ptr) ; rsi ; rhs starting word (ptr) ; r10 ; dst word index ; rbx ; lhs word index ; r12 ; rhs word index ; r8 ; eax free for mulq ; rax ; edx free for mulq ; rdx ; number of words ; r9 ; lhs word address ; rcx ; rhs word address ; rdi xor r12, r12 ; zero out loop i .iloop: ; loops from original bimul implementation xor r8, r8 ; zero out loop j .jloop: ; get actual address of operands lea rcx, [rsi + 8 * r12] lea rdi, [r10 + 8 * r8] mov rax, [rcx] ; load current lhs qword mul qword [rdi] ; multiply with current rhs qword ; rdx = high part ; rax = lo part ; get the dst word position (reuse rcx) mov rcx, r12 add rcx, r8 lea rcx, [r11 + 8 * rcx] ; rcx has the high word dst add [rcx + 8], rax adc [rcx], rdx jnc .carryDone .handleCarry: sub rcx, 8 adc qword [rcx], 1 jc .handleCarry .carryDone: inc r8 cmp r8, r9 je .jdone jmp .jloop ; todo: unroll a few times .jdone: inc r12 cmp r12, r9 je .idone jmp .iloop ; todo: unroll .idone: pop r12 ret .bimul1: ; rdi = BigInt* dst ; rsi = BigInt* lhs ; rdx = BigInt* rhs mov rdi, [rdi] mov rsi, [rsi] mov rdx, [rdx] mov rax, [rsi] mul qword [rdx] mov [rdi], rdx mov [rdi + 8], rax ret .bimul2: ; rdi = BigInt* dst ; rsi = BigInt* lhs ; rdx = BigInt* rhs ; lhs, rhs have 2 word; dst has 4 ; l0 * r0 => dst[0, 1] ; l0 * r1 => dst[1, 2] ; l1 * r0 => dst[1, 2] ; l1 * r1 => dst[2, 3] ; free regs: r8 r9 r10 r11 ; first get rdi, rsi, rdx pointing to the actual words xor rcx, rcx mov rdi, [rdi] mov rsi, [rsi] mov r8, [rdx] ; do l0 * r0 mov rax, [rsi] mul qword [r8] ; directly assign to dst words 0 and 1 mov [rdi], rdx mov [rdi + 8], rax ; do l1 * r1 mov rax, [rsi + 8] mul qword [r8 + 8] mov [rdi + 16], rdx mov [rdi + 24], rax ; do l0 * r1 mov rax, [rsi] mul qword [r8 + 8] add qword [rdi + 16], rax adc qword [rdi + 8], rdx adc qword [rdi], rcx ; just add carry bit mov rax, [rsi + 8] mul qword [r8] add qword [rdi + 16], rax adc qword [rdi + 8], rdx adc qword [rdi], rcx ; just add carry bit ret _biadd: ;rdi = BigInt* dst ;rsi = BigInt* lhs ;rdx = BigInt* rhs mov r8, [rdi] mov r9, [rsi] mov r10, [rdx] mov ecx, [rdi + 8] add cl, 0 .addloop: lea rdi, [r8 + 8 * rcx - 8] lea rsi, [r9 + 8 * rcx - 8] lea rdx, [r10 + 8 * rcx - 8] mov rax, [rsi] adc rax, [rdx] mov [rdi], rax loop .addloop ret _bisub: ; rdi = BigInt* dst ; rsi = BigInt* lhs ; rdx = BigInt* rhs mov r8, [rdi] mov r9, [rsi] mov r10, [rdx] mov ecx, [rdi + 8] neg eax ; sets carry (don't care about eax) .addloop: lea rdi, [r8 + 8 * rcx - 8] lea rsi, [r9 + 8 * rcx - 8] lea rdx, [r10 + 8 * rcx - 8] mov rax, [rsi] mov r11, [rdx] not r11 adc rax, r11 mov [rdi], rax loop .addloop ret _biinc: ; rdi = BigInt* op xor rcx, rcx mov rdx, [rdi] ; rdx = ptr to first word mov ecx, [rdi + 8] ; rcx = # of 64-bit words dec rcx shl rcx, 3 ; ecx = byte offset of least sig word mov rsi, [rdi] ; rsi points to first word add rsi, rcx ; rsi poins to last word add qword [rsi], 1 ; increment lowest word jc .loop ret .loop: sub rsi, 8 add qword [rsi], 1 cmp rsi, rdx ; did the most significant word just get ++? jne .check ret .check: jc .loop ret
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_2026.asm
ljhsiun2/medusa
9
19202
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x2d51, %rsi lea addresses_UC_ht+0x1ca81, %rdi nop nop nop nop add $41195, %rbx mov $67, %rcx rep movsw nop nop nop and %rdx, %rdx lea addresses_A_ht+0x8f01, %r9 nop cmp $20166, %rdi movb (%r9), %bl nop nop add $37412, %rsi lea addresses_WC_ht+0xf997, %rsi lea addresses_UC_ht+0x18841, %rdi xor $4487, %r13 mov $86, %rcx rep movsw nop nop nop add %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r9 push %rax push %rbx push %rdi push %rdx // Store lea addresses_normal+0x1b101, %r9 nop nop cmp %rbx, %rbx mov $0x5152535455565758, %rdi movq %rdi, (%r9) nop nop nop sub %rbx, %rbx // Store lea addresses_WC+0x15ad1, %r10 nop xor $19775, %r13 mov $0x5152535455565758, %rax movq %rax, %xmm1 vmovups %ymm1, (%r10) nop nop and $17677, %r9 // Store lea addresses_PSE+0x1b4ad, %r13 xor $12853, %r9 mov $0x5152535455565758, %rax movq %rax, (%r13) nop nop nop nop nop inc %r9 // Store lea addresses_A+0x7c81, %rdi nop nop nop nop xor $52705, %rax movw $0x5152, (%rdi) nop nop nop nop nop sub $33724, %rbx // Load lea addresses_WT+0xbb01, %r13 add %r10, %r10 mov (%r13), %bx sub %rbx, %rbx // Faulty Load lea addresses_WC+0x6301, %r10 nop dec %rbx mov (%r10), %r13 lea oracles, %rbx and $0xff, %r13 shlq $12, %r13 mov (%rbx,%r13,1), %r13 pop %rdx pop %rdi pop %rbx pop %rax pop %r9 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 2, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': True, 'congruent': 6, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c37211b.ada
best08618/asylo
7
1862
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c37211b.ada -- C37211B.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT CONSTRAINT_ERROR IS RAISED BY A DISCRIMINANT CONSTRAINT -- IF A VALUE SPECIFIED FOR A DISCRIMINANT DOES NOT LIE IN THE RANGE -- OF THE DISCRIMINANT. THIS TEST CONTAINS CHECKS FOR SUBTYPE -- INDICATIONS WHERE THE TYPE MARK DENOTES A PRIVATE OR LIMITED -- PRIVATE TYPE, AND THE DISCRIMINANT CONSTRAINT OCCURS AFTER THE FULL -- DECLARATION OF THE TYPE. -- R.WILLIAMS 8/28/86 -- EDS 7/14/98 AVOID OPTIMIZATION WITH REPORT; USE REPORT; PROCEDURE C37211B IS SUBTYPE LIES IS BOOLEAN RANGE FALSE .. FALSE; PACKAGE PKG IS TYPE PRIV (L : LIES) IS PRIVATE; TYPE LIM (L : LIES) IS LIMITED PRIVATE; PRIVATE TYPE PRIV (L : LIES) IS RECORD NULL; END RECORD; TYPE LIM (L : LIES) IS RECORD NULL; END RECORD; END PKG; USE PKG; BEGIN TEST ( "C37211B", "CHECK THAT CONSTRAINT_ERROR IS RAISED BY " & "A DISCRIMINANT CONSTRAINT IF A VALUE " & "SPECIFIED FOR A DISCRIMINANT DOES NOT LIE " & "IN THE RANGE OF THE DISCRIMINANT WHERE THE " & "TYPE MARK DENOTES A PRIVATE OR LIMITED " & "PRIVATE TYPE, AND THE DISCRIMINANT " & "CONSTRAINT OCCURS AFTER THE FULL " & "DECLARATION OF THE TYPE" ); BEGIN DECLARE SUBTYPE SUBPRIV IS PRIV (IDENT_BOOL (TRUE)); BEGIN DECLARE SP : SUBPRIV; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF SUBTYPE SUBPRIV " & BOOLEAN'IMAGE(SP.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT SP" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "SUBTYPE SUBPRIV" ); END; BEGIN DECLARE SUBTYPE SUBLIM IS LIM (IDENT_BOOL (TRUE)); BEGIN DECLARE SL : SUBLIM; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF SUBTYPE SUBLIM" & BOOLEAN'IMAGE(SL.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT SL " ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "SUBTYPE SUBLIM" ); END; BEGIN DECLARE TYPE PARR IS ARRAY (1 .. 5) OF PRIV (IDENT_BOOL (TRUE)); BEGIN DECLARE PAR : PARR; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE PARR " & BOOLEAN'IMAGE(PAR(1).L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT PAR" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE PARR" ); END; BEGIN DECLARE TYPE LARR IS ARRAY (1 .. 10) OF LIM (IDENT_BOOL (TRUE)); BEGIN DECLARE LAR : LARR; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE LARR " & BOOLEAN'IMAGE(LAR(1).L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT LAR" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE LARR" ); END; BEGIN DECLARE TYPE PRIV1 IS RECORD X : PRIV (IDENT_BOOL (TRUE)); END RECORD; BEGIN DECLARE P1 : PRIV1; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE PRIV1 " & BOOLEAN'IMAGE(P1.X.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT P1" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE PRIV1" ); END; BEGIN DECLARE TYPE LIM1 IS RECORD X : LIM (IDENT_BOOL (TRUE)); END RECORD; BEGIN DECLARE L1 : LIM1; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE LIM1 " & BOOLEAN'IMAGE(L1.X.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT L1" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE LIM1" ); END; BEGIN DECLARE TYPE ACCPRIV IS ACCESS PRIV (IDENT_BOOL (TRUE)); BEGIN DECLARE ACP : ACCPRIV; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE ACCPRIV " & BOOLEAN'IMAGE(ACP.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT ACP" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE ACCPRIV" ); END; BEGIN DECLARE TYPE ACCLIM IS ACCESS LIM (IDENT_BOOL (TRUE)); BEGIN DECLARE ACL : ACCLIM; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE ACCLIM " & BOOLEAN'IMAGE(ACL.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT ACL" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE ACCLIM" ); END; BEGIN DECLARE TYPE NEWPRIV IS NEW PRIV (IDENT_BOOL (TRUE)); BEGIN DECLARE NP : NEWPRIV; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE NEWPRIV " & BOOLEAN'IMAGE(NP.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT NP" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE NEWPRIV" ); END; BEGIN DECLARE TYPE NEWLIM IS NEW LIM (IDENT_BOOL (TRUE)); BEGIN DECLARE NL : NEWLIM; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE NEWLIM " & BOOLEAN'IMAGE(NL.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT NL" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE NEWLIM" ); END; BEGIN DECLARE P : PRIV (IDENT_BOOL (TRUE)); BEGIN FAILED ( "NO EXCEPTION RAISED AT THE DECLARATION OF " & "P " & BOOLEAN'IMAGE(P.L)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED INSIDE BLOCK " & "CONTAINING P" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION OF " & "P" ); END; BEGIN DECLARE L : LIM (IDENT_BOOL (TRUE)); BEGIN FAILED ( "NO EXCEPTION RAISED AT THE DECLARATION OF " & "L " & BOOLEAN'IMAGE(L.L)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED INSIDE BLOCK " & "CONTAINING L" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION OF " & "L" ); END; BEGIN DECLARE TYPE PRIV_NAME IS ACCESS PRIV; BEGIN DECLARE PN : PRIV_NAME := NEW PRIV (IDENT_BOOL (TRUE)); BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "DECLARATION OF OBJECT PN " & BOOLEAN'IMAGE(PN.L)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION ATTEMPTING TO USE OBJECT" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION " & "OF OBJECT PN" ); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT ELABORATION OF TYPE " & "PRIV_NAME" ); END; BEGIN DECLARE TYPE LIM_NAME IS ACCESS LIM; BEGIN DECLARE LN : LIM_NAME := NEW LIM (IDENT_BOOL (TRUE)); BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "DECLARATION OF OBJECT LN " & BOOLEAN'IMAGE(LN.L)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION ATTEMPTING TO USE OBJECT" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION " & "OF OBJECT LN" ); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT ELABORATION OF TYPE " & "LIM_NAME" ); END; BEGIN DECLARE PACKAGE PP IS TYPE BAD_PRIV (D : LIES := IDENT_BOOL (TRUE)) IS PRIVATE; PRIVATE TYPE BAD_PRIV (D : LIES := IDENT_BOOL (TRUE)) IS RECORD NULL; END RECORD; END PP; USE PP; BEGIN DECLARE BP : BAD_PRIV; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "DECLARATION OF OBJECT BP " & BOOLEAN'IMAGE(BP.D)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION ATTEMPTING TO USE OBJECT" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION " & "OF OBJECT BP" ); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT ELABORATION OF TYPE " & "BAD_PRIV" ); END; BEGIN DECLARE PACKAGE PL IS TYPE BAD_LIM (D : LIES := IDENT_BOOL (TRUE)) IS LIMITED PRIVATE; PRIVATE TYPE BAD_LIM (D : LIES := IDENT_BOOL (TRUE)) IS RECORD NULL; END RECORD; END PL; USE PL; BEGIN DECLARE BL : BAD_LIM; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "DECLARATION OF OBJECT BL " & BOOLEAN'IMAGE(BL.D)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION ATTEMPTING TO USE OBJECT" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION " & "OF OBJECT BL" ); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT ELABORATION OF TYPE " & "BAD_LIM" ); END; RESULT; END C37211B;
libsrc/_DEVELOPMENT/target/zxn/driver/terminal/tshr_01_output_char_64/tshr_01_output_char_64_oterm_msg_printc.asm
jpoikela/z88dk
640
18642
SECTION code_driver SECTION code_driver_terminal_output PUBLIC tshr_01_output_char_64_oterm_msg_printc EXTERN asm_tshr_cxy2saddr tshr_01_output_char_64_oterm_msg_printc: ; enter : c = ascii code ; l = absolute x coordinate ; h = absolute y coordinate ; can use: af, bc, de, hl ld a,c cp 32 jr nc, code_ok ld c,'?' code_ok: call asm_tshr_cxy2saddr ex de,hl ; de = screen address ld l,c ld h,0 add hl,hl add hl,hl add hl,hl ; hl = 8 * ascii code ld c,(ix+21) ld b,(ix+22) ; bc = font address add hl,bc ; hl = & character definition ; print character pixels ld b,7 __print_loop: ld a,(hl) ld (de),a inc hl inc d djnz __print_loop ld a,(hl) ld (de),a ret
basic_associations/composite_foreign_keys.als
nowavailable/alloy_als_study
0
2676
<gh_stars>0 module composite_foreign_keys /** * 複合ユニーク外部キー(および複合ユニーク制約)の表現。 */ sig Actor { charactors: set Charactor } sig Movie { charactors: set Charactor } sig Charactor { actor: lone Actor, movie: lone Movie, novelty_items: set NoveltyItem } sig NoveltyItem { charactor: one Charactor } fact { Actor<:charactors = ~(Charactor<:actor) Movie<:charactors = ~(Charactor<:movie) Charactor<:novelty_items = ~(NoveltyItem<:charactor) all e,e':Charactor | e != e' => (e.actor -> e.movie != e'.actor -> e'.movie) all e,e':NoveltyItem | e != e' => (e.charactor.actor -> e.charactor.movie != e'.charactor.actor -> e'.charactor.movie) } run {}
Games/CMonster (Breakout)/Source/ti84cse.asm
CiaranGruber/Ti-84-Calculator
1
12070
;############## CMonster by <NAME> - TI-84 Plus CSE main program #include ti84pcse.inc #define WORDLEN 2 #include data.asm #define rscount $4024 Search_Levels rs(3) Read_Ext_Level rs(3) Draw_String rs(3) Draw_Char rs(3) Draw_Strings rs(3) Write_Display_Control rs(11) Write_Display_Control_C11 rs(9) GET_KEY rs(3) Select_External_Levels rs(3) Clear_Screen rs(3) Full_Window rs(3) timer_wait rs(3) timer_init rs(3) Decode_A_DE rs(3) Decode_A_DE_3 rs(3) #define rscount $4100 brick_palettes rs(128) tileData rs(98*8) packed_brick_images rs(17*4*8) .org plotSScreen+768 call Display_Org call main jp Display_Normal ;############## Subroutines #include hiscore.asm #include gfx.asm #include levels.asm #include bonus.asm #include ball.asm #include title.asm #include extlevel.asm #include cmonster.asm #if ($ > $C000) .echo "CSE executable code overflow by ",eval($ - $C000) .error "!!!!!!!!!!!!!!!!!!!! DISASTER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!" #else .echo "Bytes left over for CSE executable code: ",eval($C000 - $) #endif levelData: #include map256.i scroll_table: #include scroll_table.i #if ($ > $FFFF) .echo "CSE RAM overflow of available memory by ",eval($ - $FFFF) .error "!!!!!!!!!!!!!!!!!!!! DISASTER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!" #else .echo "Bytes left over in CSE RAM: ",eval($FFFF - $) #endif .end
src/LibraBFT/Impl/IO/OBM/GenKeyFile.agda
LaudateCorpus1/bft-consensus-agda
0
8581
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} import LibraBFT.Impl.OBM.Genesis as Genesis open import LibraBFT.Impl.OBM.Rust.RustTypes open import LibraBFT.Impl.OBM.Util import LibraBFT.Impl.Types.OnChainConfig.ValidatorSet as ValidatorSet import LibraBFT.Impl.Types.ValidatorVerifier as ValidatorVerifier open import LibraBFT.Impl.OBM.Rust.RustTypes open import LibraBFT.Impl.OBM.Util import LibraBFT.Impl.Types.OnChainConfig.ValidatorSet as ValidatorSet import LibraBFT.Impl.Types.ValidatorVerifier as ValidatorVerifier open import LibraBFT.ImplShared.Base.Types open import LibraBFT.ImplShared.Consensus.Types open import Util.PKCS open import Util.Prelude module LibraBFT.Impl.IO.OBM.GenKeyFile where ------------------------------------------------------------------------------ EndpointAddress = Author AddressToSkAndPkAssocList = List (EndpointAddress × (SK × PK)) ------------------------------------------------------------------------------ genKeys : {-Crypto.SystemDRG →-} ℕ → List (SK × PK) mkAuthors : {-Crypto.SystemDRG →-} U64 → List EndpointAddress → Either ErrLog AddressToSkAndPkAssocList mkValidatorSignersAndVerifierAndProposerElection : U64 → AddressToSkAndPkAssocList → Either ErrLog (List ValidatorSigner × ValidatorVerifier × ProposerElection) ------------------------------------------------------------------------------ NfLiwsVssVvPe = (U64 × LedgerInfoWithSignatures × List ValidatorSigner × ValidatorVerifier × ProposerElection) NfLiwsVsVvPe = (U64 × LedgerInfoWithSignatures × ValidatorSigner × ValidatorVerifier × ProposerElection) create' : U64 → List EndpointAddress {-→ SystemDRG-} → Either ErrLog ( U64 × AddressToSkAndPkAssocList × List ValidatorSigner × ValidatorVerifier × ProposerElection × LedgerInfoWithSignatures ) create' numFailures addresses {-drg-} = do authors ← mkAuthors {-drg-} numFailures addresses (s , vv , pe) ← mkValidatorSignersAndVerifierAndProposerElection numFailures authors case Genesis.obmMkGenesisLedgerInfoWithSignatures s (ValidatorSet.obmFromVV vv) of λ where (Left err) → Left err (Right liws) → pure (numFailures , authors , s , vv , pe , liws) abstract create = create' create≡ : create ≡ create' create≡ = refl mkAuthors {-drg-} numFailures0 addresses0 = do addrs <- checkAddresses checkBftAndRun numFailures0 addrs f where f : ℕ → List EndpointAddress → AddressToSkAndPkAssocList f _numFailures addresses = zip addresses (genKeys {-drg-} (length addresses)) checkAddresses : Either ErrLog (List EndpointAddress) checkAddresses = pure addresses0 postulate -- Valid assumption: secret and public keys for each NodeId mkSK : NodeId → SK mkPK : NodeId → PK genKeys zero = [] genKeys x@(suc n) = (mkSK x , mkPK x) ∷ genKeys n mkValidatorSignersAndVerifierAndProposerElection numFaults ks = do -- IMPL-DIFF: Agda Author type does NOT contain a PK let allAuthors = fmap fst ks validatorVerifier ← ValidatorVerifier.initValidatorVerifier numFaults ks let authorKeyPairs = fmap (λ (a , (sk , _)) → (a , sk)) ks validatorSigners = foldl' go [] authorKeyPairs pure (validatorSigners , validatorVerifier , ProposerElection∙new allAuthors) where go : List ValidatorSigner → (Author × SK) → List ValidatorSigner go acc (author , sk) = ValidatorSigner∙new author sk ∷ acc
getFrame.applescript
rcmdnk/AppleScript
11
4665
<reponame>rcmdnk/AppleScript<filename>getFrame.applescript use framework "AppKit" on sysv() return current application's NSProcessInfo's processInfo()'s operatingSystemVersion() end sysv on highSierra() set v to sysv() return (majorVersion of v > 10 or (majorVersion of v is 10 and minorVersion of v ≥ 13)) end highSierra on getFrameOriginX(frame) if highSierra() then return item 1 of item 1 of frame else return frame's origin's x end if end getFrameOriginX on getFrameOriginY(frame) if highSierra() then return item 2 of item 1 of frame else return frame's origin's y end if end getFrameOriginY on getFrameWidth(frame) if highSierra() then return item 1 of item 2 of frame else return frame's |size|'s width end if end getFrameWidth on getFrameHeight(frame) if highSierra() then return item 2 of item 2 of frame else return frame's |size|'s height end if end getFrameHeight on convertToWindowFrame(frame, mfH) -- Visible Frame's origin is left lower, -- while an origin of "position of window" in windowSize function is left upper. -- Therefore, second (y) is recalculated as left upper origin version. if highSierra() then set item 2 of item 1 of frame to -(getFrameOriginY(frame)) - (getFrameHeight(frame)) + mfH else set frame's origin's y to -(frame's origin's y) - (frame's |size|'s height) + mfH end if return frame end convertToWindowFrame on getMainScreen() -- current application's NSScreen's mainScreen: -- -- This just return the screen of current application. -- -- Need to find real main screen with frame of (x, y) == (0, 0) set nss to current application's NSScreen repeat with sc in nss's screens() set f to sc's frame() if getFrameOriginX(f) is 0 and getFrameOriginY(f) is 0 then return sc end if end repeat return 0 end getMainScreen on getVisibleFrame(x, y) set nss to current application's NSScreen set mf to frame() of getMainScreen() set mfH to getFrameHeight(mf) set p to {x:x, y:y} set vf to 0 repeat with sc in nss's screens() set f to convertToWindowFrame(sc's frame(), mfH) if current application's NSMouseInRect(p, f, 0) then return convertToWindowFrame(sc's visibleFrame(), mfH) end if end repeat return vf end getVisibleFrame on getAllVisibleFrames() set nss to current application's NSScreen set mf to frame() of getMainScreen() set mfW to getFrameWidth(mf) set mfH to getFrameHeight(mf) set mvf to convertToWindowFrame(visibleFrame() of getMainScreen(), mfH) set vframes to {main_frames:{mvf}, left_frames:{}, right_frames:{}, top_frames:{}, bottom_frames:{}} repeat with sc in nss's screens() set f to convertToWindowFrame(sc's frame(), mfH) if f is not mf then set vf to convertToWindowFrame(sc's visibleFrame(), mfH) set frames to {} set putflag to false if (getFrameOriginX(f)) + (getFrameWidth(f)) ≤ 0 then set lf to left_frames of vframes set oldframes to lf repeat with i from 1 to lf's length if getFrameOriginX(vf) ≥ origin's x of item i of lf then set frames to frames & {vf} & oldframes set putflag to true exit repeat end if set frames to frames & {item 1 of oldframes} set oldframes to rest of oldframes end repeat if not putflag then set frames to frames & {vf} end if set left_frames of vframes to frames else if (getFrameOriginX(f)) ≥ mfW then set rf to right_frames of vframes set oldframes to rf repeat with i from 1 to rf's length if vf's origin's x ≤ origin's x of item i of rf then set frames to frames & {vf} & oldframes set putflag to true exit repeat end if set frames to frames & {item 1 of oldframes} set oldframes to rest of oldframes end repeat if not putflag then set frames to frames & {vf} end if set right_frames of vframes to frames else if (getFrameOriginY(f)) + (getFrameHeight(f)) ≤ 0 then set tf to top_frames of vframes set oldframes to tf repeat with i from 1 to tf's length if getFrameOriginY(vf) ≤ origin's y of item i of tf then set frames to frames & {vf} & oldframes set putflag to true exit repeat end if set frames to frames & {item 1 of oldframes} set oldframes to rest of oldframes end repeat if not putflag then set frames to frames & {vf} end if set top_frames of vframes to frames else set bf to bottom_frames of vframes set oldframes to bf repeat with i from 1 to bf's length if getFrameOriginY(vf) ≥ origin's y of item i of bf then set frames to frames & {vf} & oldframes set putflag to true exit repeat end if set frames to frames & {item 1 of oldframes} set oldframes to rest of oldframes end repeat if not putflag then set frames to frames & {vf} end if set bottom_frames of vframes to frames end if end if end repeat return vframes end getAllVisibleFrames on getAllFrames() set nss to current application's NSScreen set mf to frame() of getMainScreen() set mfW to getFrameWidth(mf) set mfH to getFrameHeight(mf) set allframes to {main_frames:{mf}, left_frames:{}, right_frames:{}, top_frames:{}, bottom_frames:{}} repeat with sc in nss's screens() set f to convertToWindowFrame(sc's frame(), mfH) if f is not mf then set frames to {} set putflag to false if (getFrameOriginX(f)) + (getFrameWidth(f)) ≤ 0 then set lf to left_frames of allframes set oldframes to lf repeat with i from 1 to lf's length if getFrameOriginX(f) ≥ origin's x of item i of lf then set frames to frames & {f} & oldframes set putflag to true exit repeat end if set frames to frames & {item 1 of oldframes} set oldframes to rest of oldframes end repeat if not putflag then set frames to frames & {f} end if set left_frames of allframes to frames else if (getFrameOriginX(f)) ≥ mfW then set rf to right_frames of allframes set oldframes to rf repeat with i from 1 to rf's length if getFrameOriginX(f) ≤ origin's x of item i of rf then set frames to frames & {f} & oldframes set putflag to true exit repeat end if set frames to frames & {item 1 of oldframes} set oldframes to rest of oldframes end repeat if not putflag then set frames to frames & {f} end if set right_frames of allframes to frames else if (getFrameOriginY(f)) + (getFrameHeight(f)) ≤ 0 then set tf to top_frames of allframes set oldframes to tf repeat with i from 1 to tf's length if getFrameOriginY(f) ≤ origin's y of item i of tf then set frames to frames & {f} & oldframes set putflag to true exit repeat end if set frames to frames & {item 1 of oldframes} set oldframes to rest of oldframes end repeat if not putflag then set frames to frames & {f} end if set top_frames of allframes to frames else set bf to bottom_frames of allframes set oldframes to bf repeat with i from 1 to bf's length if getFrameOriginY(f) ≥ origin's y of item i of bf then set frames to frames & {f} & oldframes set putflag to true exit repeat end if set frames to frames & {item 1 of oldframes} set oldframes to rest of oldframes end repeat if not putflag then set frames to frames & {f} end if set bottom_frames of allframes to frames end if end if end repeat return allframes end getAllFrames on run set sc to getMainScreen() set f to sc's frame() log getFrameOriginX(f) log getFrameOriginY(f) getAllVisibleFrames() getVisibleFrame(1, 1) getAllFrames() end run
Irvine/Examples/ch11/TestReadkey.asm
alieonsido/ASM_TESTING
0
105333
<gh_stars>0 ; Testing ReadKey (TestReadkey.asm) INCLUDE Irvine32.inc INCLUDE Macros.inc .code main PROC L1: mov eax,10 ; delay for msg processing call Delay call ReadKey ; wait for a keypress jz L1 test ebx,CAPSLOCK_ON jz L2 mWrite <"CapsLock is ON",0dh,0ah> jmp L3 L2: mWrite <"CapsLock is OFF",0dh,0ah> L3: exit main ENDP END main
oeis/272/A272706.asm
neoneye/loda-programs
11
177992
; A272706: Number of active (ON,black) cells at stage 2^n-1 of the two-dimensional cellular automaton defined by "Rule 515", based on the 5-celled von Neumann neighborhood. ; Submitted by <NAME> ; 1,5,25,137,649,2825,11785,48137,194569,782345,3137545,12566537,50298889,201261065,805175305,3220963337 mov $1,2 pow $1,$0 sub $1,1 mul $1,9 div $1,6 pow $1,2 mov $0,$1 add $0,2 div $0,3 mul $0,4 add $0,1