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 |
|---|---|---|---|---|
Basic/Compiler/Code.agda | AndrasKovacs/SemanticsWithApplications | 8 | 15462 | <reponame>AndrasKovacs/SemanticsWithApplications
module Basic.Compiler.Code where
open import Basic.AST
open import Basic.BigStep
open import Utils.Decidable
open import Utils.Monoid
open import Data.Fin using (Fin; #_)
open import Data.Vec hiding (_∷ʳ_; _++_; [_])
open import Data.Nat
open import Data.Bool renaming (not to notBool; if_then_else_ to ifBool_then_else)
open import Data.List hiding ([_])
open import Data.List.Properties
open import Relation.Binary.PropositionalEquality
open import Function
open import Data.Product
open import Relation.Nullary
open import Relation.Nullary.Decidable
open import Data.Empty
open import Algebra
import Level as L
private
module LM {a A} = Algebra.Monoid (Data.List.monoid {a} A)
{-
Chapter 3.1 and 3.2.
Semantics of an abstract machine and specification of the translation from
While syntax to the abstract machine syntax.
-}
{-
Definition of the stack and the AM
We follow the book closely here.
"nat-inj" and "bool-inj" just establish injectivity of context entry
constructors.
That we have to prove them is something of a limitation of the current Agda.
In contrast, Coq derives injectivity of constructors automatically.
-}
data StackEntry : Set where
nat : ℕ → StackEntry
bool : Bool → StackEntry
nat-inj : ∀ {n m} → (StackEntry ∋ nat n) ≡ nat m → n ≡ m
nat-inj refl = refl
bool-inj : ∀ {b b'} → (StackEntry ∋ bool b) ≡ bool b' → b ≡ b'
bool-inj refl = refl
Stack : Set
Stack = List StackEntry
mutual
data Inst (n : ℕ) : Set where
PUSH : ℕ → Inst n
FETCH STORE : Fin n → Inst n
ADD MUL SUB TRUE FALSE EQ LTE LT AND NOT NOOP : Inst n
BRANCH LOOP : Code n → Code n → Inst n
Code : ℕ → Set
Code = List ∘ Inst
-- Semantics
------------------------------------------------------------
data ⟨_,_,_⟩▷⟨_,_,_⟩ {n} : Code n → Stack → State n → Code n → Stack → State n → Set where
PUSH :
∀ n {c e s}
→ --------------------------------------------
⟨ PUSH n ∷ c , e , s ⟩▷⟨ c , nat n ∷ e , s ⟩
ADD :
∀ a b {c e s}
→ ---------------------------------------------------------------
⟨ ADD ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , nat (a + b) ∷ e , s ⟩
MUL :
∀ a b {c e s}
→ ----------------------------------------------------------------
⟨ MUL ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , nat (a * b) ∷ e , s ⟩
SUB :
∀ a b {c e s}
→ ----------------------------------------------------------------
⟨ SUB ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , nat (a ∸ b) ∷ e , s ⟩
TRUE :
∀ {c e s}
→ -----------------------------------------------
⟨ TRUE ∷ c , e , s ⟩▷⟨ c , bool true ∷ e , s ⟩
FALSE :
∀ {c e s}
→ ------------------------------------------------
⟨ FALSE ∷ c , e , s ⟩▷⟨ c , bool false ∷ e , s ⟩
EQ :
∀ a b {c e s}
→ -------------------------------------------------------------------
⟨ EQ ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , bool ⌊ a ≡⁇ b ⌋ ∷ e , s ⟩
LT :
∀ a b {c e s}
→ -------------------------------------------------------------------
⟨ LT ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , bool ⌊ a <⁇ b ⌋ ∷ e , s ⟩
LTE :
∀ a b {c e s}
→ --------------------------------------------------------------------
⟨ LTE ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , bool ⌊ a ≤⁇ b ⌋ ∷ e , s ⟩
AND :
∀ a b {c e s}
→ -------------------------------------------------------------------
⟨ AND ∷ c , bool a ∷ bool b ∷ e , s ⟩▷⟨ c , bool (a ∧ b) ∷ e , s ⟩
NOT :
∀ b {c e s}
→ -----------------------------------------------------------
⟨ NOT ∷ c , bool b ∷ e , s ⟩▷⟨ c , bool (notBool b) ∷ e , s ⟩
FETCH :
∀ x {c e s}
→ ---------------------------------------------------------
⟨ FETCH x ∷ c , e , s ⟩▷⟨ c , nat (lookup x s) ∷ e , s ⟩
STORE :
∀ x {n c e s}
→ ------------------------------------------------------
⟨ STORE x ∷ c , nat n ∷ e , s ⟩▷⟨ c , e , s [ x ]≔ n ⟩
BRANCH :
∀ {c₁ c₂ c t e s} → let c' = (ifBool t then c₁ else c₂) <> c in
--------------------------------------------------------------
⟨ BRANCH c₁ c₂ ∷ c , bool t ∷ e , s ⟩▷⟨ c' , e , s ⟩
NOOP :
∀ {c e s}
→ ------------------------------------
⟨ NOOP ∷ c , e , s ⟩▷⟨ c , e , s ⟩
LOOP :
∀ {c₁ c₂ c e s} → let c' = c₁ <> BRANCH (c₂ ∷ʳ LOOP c₁ c₂ ) (NOOP ∷ []) ∷ c in
-----------------------------------------------------------------------------------
⟨ LOOP c₁ c₂ ∷ c , e , s ⟩▷⟨ c' , e , s ⟩
-- Computation sequences
------------------------------------------------------------
infixr 5 _∷_
data ⟨_,_,_⟩▷*⟨_,_,_⟩ {n} : Code n → Stack → State n → Code n → Stack → State n → Set where
done :
∀ {e s}
→ ---------------------------------
⟨ [] , e , s ⟩▷*⟨ [] , e , s ⟩
{- We define "being stuck" explicitly as a configuration from which no transitions exist -}
stuck :
∀ {c cs e s} → (∀ c' e' s' → ¬ ⟨ c ∷ cs , e , s ⟩▷⟨ c' , e' , s' ⟩)
→ ------------------------------------------------------------
⟨ c ∷ cs , e , s ⟩▷*⟨ c ∷ cs , e , s ⟩
_∷_ :
∀ {c e s c' e' s' c'' e'' s''} →
⟨ c , e , s ⟩▷⟨ c' , e' , s' ⟩ → ⟨ c' , e' , s' ⟩▷*⟨ c'' , e'' , s'' ⟩
→ ------------------------------------------------------------------------
⟨ c , e , s ⟩▷*⟨ c'' , e'' , s'' ⟩
{- We will need the length of computation sequences for the compiler correctness proof -}
▷*-length : ∀ {n}{c c' e e'}{s s' : State n} → ⟨ c , e , s ⟩▷*⟨ c' , e' , s' ⟩ → ℕ
▷*-length done = 0
▷*-length (stuck x) = 0
▷*-length (x ∷ p) = suc (▷*-length p)
-- Determinism (exercise 3.6)
------------------------------------------------------------
▷-deterministic :
∀ {n}{c c' c'' e e' e''}{s s' s'' : State n}
→ ⟨ c , e , s ⟩▷⟨ c' , e' , s' ⟩ → ⟨ c , e , s ⟩▷⟨ c'' , e'' , s'' ⟩
→ (c' ≡ c'') × (e' ≡ e'') × (s' ≡ s'')
▷-deterministic (PUSH n₁) (PUSH .n₁) = refl , refl , refl
▷-deterministic (ADD a b) (ADD .a .b) = refl , refl , refl
▷-deterministic (MUL a b) (MUL .a .b) = refl , refl , refl
▷-deterministic (SUB a b) (SUB .a .b) = refl , refl , refl
▷-deterministic TRUE TRUE = refl , refl , refl
▷-deterministic FALSE FALSE = refl , refl , refl
▷-deterministic (EQ a b) (EQ .a .b) = refl , refl , refl
▷-deterministic (LT a b) (LT .a .b) = refl , refl , refl
▷-deterministic (LTE a b) (LTE .a .b) = refl , refl , refl
▷-deterministic (AND a b) (AND .a .b) = refl , refl , refl
▷-deterministic (NOT b) (NOT .b) = refl , refl , refl
▷-deterministic (FETCH x) (FETCH .x) = refl , refl , refl
▷-deterministic (STORE x) (STORE .x) = refl , refl , refl
▷-deterministic BRANCH BRANCH = refl , refl , refl
▷-deterministic NOOP NOOP = refl , refl , refl
▷-deterministic LOOP LOOP = refl , refl , refl
▷*-deterministic :
∀ {n}{c c' c'' e e' e''}{s s' s'' : State n}
→ ⟨ c , e , s ⟩▷*⟨ c' , e' , s' ⟩ → ⟨ c , e , s ⟩▷*⟨ c'' , e'' , s'' ⟩
→ (c' ≡ c'') × (e' ≡ e'') × (s' ≡ s'')
▷*-deterministic done done = refl , refl , refl
▷*-deterministic done (() ∷ p2)
▷*-deterministic (stuck x) (stuck x₁) = refl , refl , refl
▷*-deterministic (stuck x) (x₁ ∷ p2) = ⊥-elim (x _ _ _ x₁)
▷*-deterministic (() ∷ p1) done
▷*-deterministic (x ∷ p1) (stuck x₁) = ⊥-elim (x₁ _ _ _ x)
▷*-deterministic (x ∷ p1) (x₁ ∷ p2) with ▷-deterministic x x₁
... | eq1 , eq2 , eq3 rewrite eq1 | eq2 | eq3 = ▷*-deterministic p1 p2
-- Compilation (chapter 3.2)
------------------------------------------------------------
𝓒⟦_⟧ᵉ : ∀ {n t} → Exp n t → Code n
𝓒⟦ lit x ⟧ᵉ = PUSH x ∷ []
𝓒⟦ add a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ ADD
𝓒⟦ mul a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ MUL
𝓒⟦ sub a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ SUB
𝓒⟦ var x ⟧ᵉ = FETCH x ∷ []
𝓒⟦ tt ⟧ᵉ = TRUE ∷ []
𝓒⟦ ff ⟧ᵉ = FALSE ∷ []
𝓒⟦ eq a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ EQ
𝓒⟦ lte a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ LTE
𝓒⟦ lt a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ LT
𝓒⟦ Exp.and a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ AND
𝓒⟦ not e ⟧ᵉ = 𝓒⟦ e ⟧ᵉ ∷ʳ NOT
𝓒⟦_⟧ˢ : ∀ {n} → St n → Code n
𝓒⟦ x := e ⟧ˢ = 𝓒⟦ e ⟧ᵉ ∷ʳ STORE x
𝓒⟦ skip ⟧ˢ = NOOP ∷ []
𝓒⟦ s₁ , s₂ ⟧ˢ = 𝓒⟦ s₁ ⟧ˢ <> 𝓒⟦ s₂ ⟧ˢ
𝓒⟦ if b then st₁ else st₂ ⟧ˢ = 𝓒⟦ b ⟧ᵉ ∷ʳ BRANCH 𝓒⟦ st₁ ⟧ˢ 𝓒⟦ st₂ ⟧ˢ
𝓒⟦ while b do st ⟧ˢ = LOOP 𝓒⟦ b ⟧ᵉ 𝓒⟦ st ⟧ˢ ∷ []
------------------------------------------------------------
{-
Some additional lemmas needed to the compiler correctness proofs.
-}
{- A weaker variant of exercise 3.4 -}
weaken-step-code :
∀ {n}{c c' c'' e e'}{s s' : State n}
→ ⟨ c , e , s ⟩▷⟨ c' , e' , s' ⟩
→ ⟨ c <> c'' , e , s ⟩▷⟨ c' <> c'' , e' , s' ⟩
weaken-step-code (PUSH n₁) = PUSH n₁
weaken-step-code (ADD a b) = ADD a b
weaken-step-code (MUL a b) = MUL a b
weaken-step-code (SUB a b) = SUB a b
weaken-step-code TRUE = TRUE
weaken-step-code FALSE = FALSE
weaken-step-code (EQ a b) = EQ a b
weaken-step-code (LT a b) = LT a b
weaken-step-code (LTE a b) = LTE a b
weaken-step-code (AND a b) = AND a b
weaken-step-code (NOT b) = NOT b
weaken-step-code (FETCH x) = FETCH x
weaken-step-code (STORE x) = STORE x
weaken-step-code {c'' = c''}(BRANCH {c₁}{c₂}{c}{t})
rewrite LM.assoc (ifBool t then c₁ else c₂) c c'' = BRANCH
weaken-step-code {c'' = c''}(LOOP {c₁}{c₂}{c})
rewrite LM.assoc c₁ (BRANCH (c₂ ∷ʳ LOOP c₁ c₂) (NOOP ∷ []) ∷ c) c'' = LOOP
weaken-step-code NOOP = NOOP
{-
This lemma is not in the book, but it's very convenient to use in the following
proofs. It's just the analogue of Basic.SmallStep.append for the computation
sequences here.
-}
infixr 5 _▷*<>_
_▷*<>_ :
∀ {n c c' e e' e''}{s s' s'' : State n}
→ ⟨ c , e , s ⟩▷*⟨ [] , e' , s' ⟩
→ ⟨ c' , e' , s' ⟩▷*⟨ [] , e'' , s'' ⟩
→ ⟨ c <> c' , e , s ⟩▷*⟨ [] , e'' , s'' ⟩
_▷*<>_ done p2 = p2
_▷*<>_ (step ∷ p1) p2 = weaken-step-code step ∷ p1 ▷*<> p2
{- Lemma 3.18 -}
𝓒-Exp-nat :
∀ {n e}{s : State n} exp -> ⟨ 𝓒⟦ exp ⟧ᵉ , e , s ⟩▷*⟨ [] , nat (⟦ exp ⟧ᵉ s) ∷ e , s ⟩
𝓒-Exp-nat (lit x) = PUSH x ∷ done
𝓒-Exp-nat (add a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> (ADD _ _ ∷ done)
𝓒-Exp-nat (mul a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> (MUL _ _ ∷ done)
𝓒-Exp-nat (sub a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> (SUB _ _ ∷ done)
𝓒-Exp-nat (var x) = FETCH x ∷ done
{- Lemma 3.19 -}
𝓒-Exp-bool :
∀ {n e}{s : State n} exp -> ⟨ 𝓒⟦ exp ⟧ᵉ , e , s ⟩▷*⟨ [] , bool (⟦ exp ⟧ᵉ s) ∷ e , s ⟩
𝓒-Exp-bool tt = TRUE ∷ done
𝓒-Exp-bool ff = FALSE ∷ done
𝓒-Exp-bool (eq a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> EQ _ _ ∷ done
𝓒-Exp-bool (lte a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> LTE _ _ ∷ done
𝓒-Exp-bool (lt a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> LT _ _ ∷ done
𝓒-Exp-bool (Exp.and a b) = (𝓒-Exp-bool b ▷*<> 𝓒-Exp-bool a) ▷*<> AND _ _ ∷ done
𝓒-Exp-bool (not e) = 𝓒-Exp-bool e ▷*<> NOT _ ∷ done
{-
A "smart constructor" that gets rid of the trailing (++[]) at the end of the branch.
This is not mentioned in the book, because it (rightfully) assumes that appendding an
empty list to the end of a list results in the same list, while here we have to make
this property explicit
-}
BRANCH-[] :
∀ {n c₁ c₂ e t}{s : State n} → let c' = ifBool t then c₁ else c₂ in
⟨ BRANCH c₁ c₂ ∷ [] , bool t ∷ e , s ⟩▷⟨ c' , e , s ⟩
BRANCH-[] {n}{c₁}{c₂}{e}{t}{s} =
subst
(λ b → ⟨ BRANCH c₁ c₂ ∷ [] , bool t ∷ e , s ⟩▷⟨ b , e , s ⟩)
(proj₂ LM.identity (ifBool t then c₁ else c₂))
BRANCH
|
wtfx/samples/whitenoise-v4.asm | bushy555/ZX-Spectrum-1-Bit-Routines | 59 | 28920 |
db 136,136,238,255,255,5,5,0,204,136,204,0,0,238,238,204
db 0,5,5,5,0,204,238,204,204,0,204,0,0,5,238,204
db 136,0,136,5,0,136,5,238,204,204,238,238,5,0,5,0
db 0,5,5,136,204,238,255,255,238,0,255,255,0,204,0,136
db 238,136,0,238,204,0,0,5,238,238,238,204,255,204,238,5
db 204,204,0,255,5,255,204,238,5,136,136,5,238,136,0,136
db 238,136,255,0,136,5,0,255,238,238,136,136,0,255,136,204
db 136,136,0,136,5,238,255,255,5,0,255,238,204,255,255,0
db 0,238,0,204,204,136,136,0,255,204,204,5,136,238,136,238
db 255,204,255,255,5,238,204,255,238,0,136,0,5,0,0,0
db 238,136,204,0,204,238,136,136,0,238,0,204,0,136,5,255
db 238,238,204,238,136,5,204,5,0,255,5,0,255,5,0,204
db 0,238,238,238,136,255,255,136,136,255,255,204,0,238,136,255
db 0,255,136,204,238,255,136,255,204,0,255,0,0,5,238,136
db 238,0,255,255,5,204,0,136,136,255,238,136,136,255,0,204
db 238,204,255,136,0,0,5,204,0,255,238,0,255,136,204,136 |
test1.asm | napobear/py6502 | 0 | 242508 | <gh_stars>0
; This is a comment
;So is this.
LDY #$DF
STY $23
LDY #0
LDY $23
LDA #$34
ROL
TAX
LDA #$90
ADC #$10
ORA #1
PHA
LDA #0
PLA
SEC
SED
|
ada_gui-gnoga.ads | jrcarter/Ada_GUI | 19 | 9666 | -- Ada_GUI implementation based on Gnoga. Adapted 2021
-- Implementation hierarchy rooted at Ada_GUI.Gnoga in recognition
-- Clients should never with packages in the Ada_GUI.Gnoga hierarchy
-- Original Gnoga headers have been left on the implemetation packages for reference
--
------------------------------------------------------------------------------
-- --
-- GNOGA - The GNU Omnificent GUI for Ada --
-- --
-- G N O G A --
-- --
-- S p e c --
-- --
-- --
-- Copyright (C) 2014 <NAME> --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are --
-- granted additional permissions described in the GCC Runtime Library --
-- Exception, version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- 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. --
-- --
-- For more information please go to http://www.gnoga.com --
------------------------------------------------------------------------------
with Ada.Containers.Indefinite_Hashed_Maps;
with Ada.Containers.Indefinite_Vectors;
with Ada.Exceptions;
with Ada.Strings.Hash;
with Ada.Strings.Unbounded;
with Ada.Task_Identification;
package Ada_GUI.Gnoga is
Version : constant String := "1.6a";
Version_High : constant := 1;
Version_Low : constant := 6;
Version_Status : constant String := "a";
HTTP_Server_Name : constant String := "gnoga/" & Version;
function Escape_Quotes (S : String) return String;
-- Escape quotes for JavaScript.
function Unescape_Quotes (S : String) return String;
-- Unescape a string quoted for JavaScript
function Escape_Inner_Quotes (S : in String) return String;
-- Escape quotes for HTML attributes in Javascript.
Substitution_Character : constant Character := '?';
-- Character replacement if UTF-8 character is not existant in Latin-1
function URL_Encode (S : String; Encoding : String := "") return String;
function URL_Decode (S : String; Encoding : String := "") return String;
-- Encode and decode form URL
-- Supported encodings are ISO-8859-1 (default)
-- and UTF-8 (typically from Input_Encoding function)
function Left_Trim (S : String) return String;
function Right_Trim (S : String) return String;
-- Remove extra spaces and tabs
function Left_Trim_Slashes (S : String) return String;
function Right_Trim_Slashes (S : String) return String;
-- Remove extra spaces, tabs and '/'s
procedure String_Replace
(Source : in out Ada.Strings.Unbounded.Unbounded_String;
Pattern : in String;
Replacement : in String);
-- Replace all instances of Pattern with Replacement in Source
procedure Write_To_Console (Message : in String);
-- Output message to console
procedure Log_To_File (File_Name : in String;
Flush_Auto : in Boolean := False);
-- Redirect logging to File_Name instead of console with flushing if specified
procedure Log (Message : in String);
-- Output message to log
procedure Log (Occurrence : in Ada.Exceptions.Exception_Occurrence);
-- Output exception occurence to log
procedure Flush_Log;
-- Manual flush log file
procedure Activate_Exception_Handler (Id : Ada.Task_Identification.Task_Id);
-- Activate exception log for the designated task
-- From Types:
package Data_Arrays is
new Ada.Containers.Indefinite_Vectors (Positive, String);
subtype Data_Array_Type is Data_Arrays.Vector;
package Data_Maps is
new Ada.Containers.Indefinite_Hashed_Maps (String,
String,
Ada.Strings.Hash,
Equivalent_Keys => "=");
subtype Data_Map_Type is Data_Maps.Map;
package Maps_of_Data_Maps is
new Ada.Containers.Indefinite_Hashed_Maps (String,
Data_Maps.Map,
Ada.Strings.Hash,
Equivalent_Keys => "=",
"=" => Data_Maps."=");
subtype Map_of_Data_Maps_Type is Maps_of_Data_Maps.Map;
subtype Web_ID is Ada.Strings.Unbounded.Unbounded_String;
type ID_Enumeration is (No_ID, DOM_ID, Script, Gnoga_ID);
subtype Connection_ID is Integer;
No_Connection : constant Connection_ID := -1;
subtype Unique_ID is Integer;
No_Unique_ID : constant Unique_ID := -1;
type Connection_Data_Type is tagged limited null record;
type Connection_Data_Access is access all Connection_Data_Type;
type Pointer_to_Connection_Data_Class is
access all Connection_Data_Type'Class;
type Frational_Range_Type is delta 0.001 range 0.0 .. 1.0;
for Frational_Range_Type'Small use 0.001;
subtype Alpha_Type is Frational_Range_Type;
type Color_Type is range 0 .. 255;
type RGBA_Type is
record
Red : Color_Type := 0;
Green : Color_Type := 0;
Blue : Color_Type := 0;
Alpha : Alpha_Type := 1.0;
end record;
function To_String (RGBA : RGBA_Type) return String;
-- Returns an rgba(r,g,b,a) representation of RGBA
function To_Hex (RGBA : RGBA_Type) return String;
-- Returns a 0xRRGGBB representation of RGBA
function To_RGBA (Value : String) return RGBA_Type;
-- Will convert rgb(r,g,b) and rgba(r,g,b,a), or
-- Hex color (include Hex with Alpha) to RGBA_Type
type Pixel_Type is
record
Red : Color_Type := 0;
Green : Color_Type := 0;
Blue : Color_Type := 0;
Alpha : Color_Type := 0;
end record;
function To_RGBA (Value : in Pixel_Type) return RGBA_Type;
function To_Pixel (Value : in RGBA_Type) return Pixel_Type;
type Pixel_Data_Type is
array (Positive range <>, Positive range <>) of Pixel_Type;
type Pixel_Data_Access is access Pixel_Data_Type;
type Point_Type is
record
X, Y : Integer;
end record;
type Point_Array_Type is
array (Positive range <>) of Point_Type;
type Rectangle_Type is
record
X, Y, Width, Height : Integer;
end record;
type Size_Type is
record
Width, Height : Integer;
end record;
end Ada_GUI.Gnoga;
|
src/third_party/nasm/test/pragma.asm | Mr-Sheep/naiveproxy | 2,219 | 100157 | <gh_stars>1000+
%pragma
%pragma bluttan
%pragma bluttan blej
%pragma "Hej tomtegubbar"
%define PR asm foobar
%pragma PR
%pragma preproc
%pragma preproc tjo fidelittan preproc
%pragma dbg tjo fidelittan output
%pragma dbgdbg tjo fidelittan debug format
%pragma Dbg Tjo Fidelittan Output
%pragma Dbgdbg Tjo Fidelittan Debug Format
|
programs/oeis/016/A016810.asm | neoneye/loda | 22 | 16278 | ; A016810: (4n)^10.
; 0,1048576,1073741824,61917364224,1099511627776,10240000000000,63403380965376,296196766695424,1125899906842624,3656158440062976,10485760000000000,27197360938418176,64925062108545024,144555105949057024,303305489096114176,604661760000000000,1152921504606846976,2113922820157210624,3743906242624487424,6428888932339941376,10737418240000000000,17490122876598091776,27850097600940212224,43438845422363213824,66483263599150104576,100000000000000000000,148024428491834392576,215892499727278669824,310584820834420916224,441143507864991563776,619173642240000000000,859442550649180389376,1180591620717411303424,1605976966052654874624,2164656967840983678976,2892546549760000000000,3833759992447475122176,5042166166892418433024,6583182266716099969024,8535834451185868210176,10995116277760000000000,14074678408802364030976,17909885825636445978624,22661281678134344679424,28518499943362777317376,35704672266240000000000,44481377712499930955776,55154187683317729460224,68078861925529707085824,83668255425284801560576,102400000000000000000000,124825028607463130136576,151577014775638417997824,183382804125988210868224,221073919720733357899776,265599227914240000000000,318038856534447018213376,379619462565741198311424,451730952053751361306624,535944760708973357694976,634033809653760000000000,747994256939818786226176,880069171864760718721024,1032774265740240721281024,1208925819614629174706176,1411670956533760000000000,1644520413237918591614976,1911383973745667813146624,2216608735069167287271424,2565020383345125413093376,2961967666954240000000000,3413370261743737190219776,3925770232266214525108224,4506387302007237665357824,5163178154897836475416576,5904900000000000000000000,6741178641117286368280576,7682581303222547931725824,8740694478014329047220224,9928207061616528930635776,11258999068426240000000000,12748236216396078174437376,14412470690613620767719424,16269748403915564986138624,18339723085451720682110976,20643777540597760000000000,23205152438409568951730176,26049082995919886849409024,29202943942003483972993024,32696403157284220935602176,36561584400629760000000000,40833239547181264169598976,45548930777599929298714624,50749223173283452812263424,56477888187717354967269376,62782118479882240000000000,69712754611742420055883776,77324524128297629567156224,85676293555491636798029824,94831333868443217691672576
pow $0,10
mul $0,1048576
|
src/main/fragment/mos6502-common/vwum1=vwum1_plus_vwuc1.asm | jbrandwood/kickc | 2 | 174992 | lda {m1}
clc
adc #<{c1}
sta {m1}
lda {m1}+1
adc #>{c1}
sta {m1}+1
|
Cubical/Algebra/AbGroup/Instances/Direct-Sum.agda | howsiyu/cubical | 0 | 13266 | {-# OPTIONS --safe #-}
module Cubical.Algebra.AbGroup.Instances.Direct-Sum where
open import Cubical.Foundations.Prelude
open import Cubical.Algebra.AbGroup
open import Cubical.Algebra.Direct-Sum.Base
open import Cubical.Algebra.Direct-Sum.Properties
open import Cubical.Algebra.Polynomials.Multivariate.Base
private variable
ℓ ℓ' : Level
module _ (Idx : Type ℓ) (P : Idx → Type ℓ') (AGP : (r : Idx) → AbGroupStr (P r)) where
open AbGroupStr
⊕-AbGr : AbGroup (ℓ-max ℓ ℓ')
fst ⊕-AbGr = ⊕ Idx P AGP
0g (snd ⊕-AbGr) = neutral
_+_ (snd ⊕-AbGr) = _add_
- snd ⊕-AbGr = inv Idx P AGP
isAbGroup (snd ⊕-AbGr) = makeIsAbGroup trunc addAssoc addRid (rinv Idx P AGP) addComm
|
data/moves/hm_moves.asm | opiter09/ASM-Machina | 1 | 92066 | ; This file is INCLUDEd twice:
; - for HMMoves in home/names.asm
; - for HMMoveArray in engine/pokemon/bills_pc.asm
db CUT
db FLY
db SURF
db STRENGTH
db FLASH
db -1 ; end
|
src/fot/FOTC/Program/Mirror/Mirror.agda | asr/fotc | 11 | 15476 | ------------------------------------------------------------------------------
-- The mirror function: A function with higher-order recursion
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Program.Mirror.Mirror where
open import FOTC.Base
open import FOTC.Data.List
open import FOTC.Program.Mirror.Type
------------------------------------------------------------------------------
-- The mirror function.
postulate
mirror : D
mirror-eq : ∀ d ts → mirror · node d ts ≡ node d (reverse (map mirror ts))
{-# ATP axiom mirror-eq #-}
|
src/main/antlr4/blf/grammar/BcqlUtil.g4 | PaulsBecks/Blockchain-Logging-Framework | 5 | 3692 | // (outdated) based on
// ANTLR4 grammar for SQLite by <NAME> (https://github.com/antlr/grammars-v4/blob/master/sqlite/SQLite.g4), and
// ANTLR4 grammar for Java9 by <NAME> & <NAME> (https://github.com/antlr/grammars-v4/blob/master/java9/Java9.g4)
// Tutorial for expression evaluation by <NAME> (https://www.codeproject.com/articles/18880/state-of-the-art-expression-evaluation)
//
// 01/12/2020 helpful links
// ANTLR4 documentation (https://github.com/antlr/antlr4/blob/4.9/doc/index.md)
// Tutorial https://docs.google.com/document/d/1gQ2lsidvN2cDUUsHEkT05L-wGbX5mROB7d70Aaj3R64/edit#heading=h.xr0jj8vcdsgc
//
grammar BcqlUtil;
import BcqlLexemes;
// FILTER UTIL
/** A blockNumber is either one of the keywords CURRENT, EARLIEST, CONTINUOUS or should be an integer number
representing a certain block of the current blockchain or a keyword. */
blockNumber
: KEY_CURRENT
| KEY_EARLIEST
| KEY_CONTINUOUS
| valueExpression
;
/** An addressList is parsed either to an enumeration of at least one hexadecimal BYTES_LITERAL, separated by a comma,
the keyword ANY or a variableName. */
addressList
: BYTES_LITERAL (',' BYTES_LITERAL)*
| KEY_ANY
| variableName
// This is needed to be used in Hyperledger
| STRING_LITERAL (',' STRING_LITERAL)*
;
/** A logEntrySignature represents the structure of an existing log/event entry in the specified contract of the respective
logEntryFilter. Starts with defining the Identifier of the log/event entry and subsequently sets an enumeration of
at least one logEntryParameter inside of () braces. */
logEntrySignature
: methodName=Identifier '(' (logEntryParameter (',' logEntryParameter)* )? ')'
;
/** A logEntryParameter corresponds to the single parameters of the log/event entry. It starts with defining the Solidity
type of parameter, continous with the optional INDEXED specification and finishes with the parameter name. */
logEntryParameter
: solType (KEY_INDEXED)? variableName
;
/** (unused) */
skippableLogEntryParameter
: logEntryParameter
| KEY_SKIP_INDEXED
| KEY_SKIP_DATA
;
/** A smartContractQuery is parsed to a publicVariableQuery or a publicFunctionQuery. With the publicVariableQuery
* a variable on the respective Blockchain contract is queried and with a publicFunctionQuery a function on the
* respective Blockchain contract is queried. */
smartContractQuery
: publicVariableQuery
| publicFunctionQuery
;
/** A publicVariableQuery is parsed to a single smartContractParameter, representing a queried variable. */
publicVariableQuery
: smartContractParameter
;
/** A publicFunctionQuery consists of
* - at least one smartContractParameter (devided by ','), defining the output parameters of the respective function
* - the methodName (stated after an '='), which represents the function name the user wants query on the contract
* - at least one smartContractQueryParameter (inside () braces and devided by ','), the corresponding input parameters
* of the respective function. In contrast to the smartContractParameter, this one can also be parsed into an variableName.
*/
publicFunctionQuery
: smartContractParameter (',' smartContractParameter)* '=' methodName=Identifier '(' (smartContractQueryParameter (',' smartContractQueryParameter)* )? ')'
;
/** A smartContractParameter consists of a parameter type (solType) and name (variableName). In contrast to the
* smartContractQueryParameter the name of the parameter is declared and saved in a variable, as it the output parameter
* which is queried for and therefore made usable inside the scope of the smartContractFilter.
*/
smartContractParameter
: solType variableName
;
/** A smartContractQueryParameter consists of a parameter type (solType) and name (literal). Alternativly a variableName
* can be used, in which both parameter type and name has to be previously stored.
*/
smartContractQueryParameter
: variableName
| solType literal
;
// EMIT STATEMENTS UTIL
namedEmitVariable
: valueExpression (KEY_AS variableName)?
;
xesEmitVariable
: valueExpression (KEY_AS (xesTypes)? variableName)?
;
xesTypes
: 'xs:string'
| 'xs:date'
| 'xs:int'
| 'xs:float'
| 'xs:boolean'
;
// EXPRESSION STATEMENTS: Add additional functionality to the grammar
expressionStatement
: methodStatement
| variableDeclarationStatement
| variableAssignmentStatement
;
methodStatement
: methodInvocation ';'
;
methodInvocation
: methodName=Identifier '(' (valueExpression (',' valueExpression)* )? ')'
;
variableDeclarationStatement
: solType variableName '=' statementExpression ';'
;
variableAssignmentStatement
: variableName '=' statementExpression ';'
;
statementExpression
: valueExpression
| methodInvocation
;
conditionalExpression
: conditionalOrExpression
;
conditionalOrExpression
: conditionalAndExpression
| conditionalOrExpression KEY_OR conditionalAndExpression
;
conditionalAndExpression
: conditionalComparisonExpression
| conditionalAndExpression KEY_AND conditionalComparisonExpression
;
conditionalComparisonExpression
: conditionalNotExpression (comparators conditionalNotExpression)?
;
conditionalNotExpression
: KEY_NOT? conditionalPrimaryExpression
;
conditionalPrimaryExpression
: valueExpression
| '(' conditionalOrExpression ')'
;
valueExpression
: literal
| variableName
;
comparators
: '=='
| '!='
| '>='
| '>'
| '<'
| '<='
| KEY_IN
;
variableName
: Identifier
| Identifier ':' Identifier
| Identifier '.' Identifier
;
// LITERALS
literal
: STRING_LITERAL
| BOOLEAN_LITERAL
| BYTES_LITERAL
| INT_LITERAL
| arrayLiteral
;
arrayLiteral
: stringArrayLiteral
| intArrayLiteral
| booleanArrayLiteral
| bytesArrayLiteral
;
stringArrayLiteral
: '{' STRING_LITERAL (',' STRING_LITERAL)* '}'
;
intArrayLiteral
: '{' (INT_LITERAL) (',' INT_LITERAL)* '}'
;
booleanArrayLiteral
: '{' BOOLEAN_LITERAL (',' BOOLEAN_LITERAL)* '}'
;
bytesArrayLiteral
: '{' BYTES_LITERAL (',' BYTES_LITERAL)* '}'
;
// TYPES
solTypeRule : solType EOF;
solType
: SOL_ADDRESS_TYPE
| SOL_BOOL_TYPE
| SOL_BYTE_TYPE
| SOL_INT_TYPE
| SOL_STRING_TYPE
| solType '[' ']'
;
|
dapeng-test/src/test/java/com/github/dapeng/router/router.g4 | calfgz/dapeng-soa | 120 | 7871 | grammar router;
routes: (route)* EOF;
route: left '=>' right;
left: 'otherwise'
| matcher (';' matcher)*;
matcher: ID 'match' patterns;
patterns: pattern (',' pattern)*;
pattern: '~' pattern
| string
| regexpString
| rangeString
| NUMBER
| ip
| mod;
right: rightPattern (',' rightPattern)*;
rightPattern: '~' rightPattern
| ip;
regexpString: 'r' QUOT (ID | NUMBER | '.*')+ QUOT;
ip: 'ip' QUOT (NUMBER '.')+ NUMBER ('/' NUMBER)? QUOT;
mod: '%' QUOT NUMBER 'n+' (NUMBER|rangeString) QUOT;
rangeString: NUMBER '..' NUMBER ;
string: QUOT (ID | NUMBER) QUOT;
QUOT: '"';
ID : [a-z,A-Z,'_']+ ;
NUMBER : [0-9]+;
WS: [ \t\r\n]+ -> skip;
|
filtros/halftone_asm.asm | partu18/edge_detection_algorithm_SIMD | 0 | 16536 | ; void halftone_asm (
; unsigned char *src,
; unsigned char *dst,
; int m,
; int n,
; int src_row_size,
; int dst_row_size
; );
; Parámetros:
; rdi = src
; rsi = dst
; rdx = m
; rcx = n
; r8 = src_row_size
; r9 = dst_row_size
%define Tiene_Ultimo_Tramo 1
%define No_Tiene_ultimo_tramo 0
extern halftone_c
global halftone_asm
section .rodata
mascara_unos: DQ 0xffffffffffffffff,0xffffffffffffffff
mascara_pares: DQ 0x00ff00ff00ff00ff,0x00ff00ff00ff00ff
mascara_impares: DQ 0xff00ff00ff00ff00,0xff00ff00ff00ff00
dosCientosCinco: DW 205, 205, 205, 205, 205, 205, 205, 205
cuatroCientosDiez: DW 410, 410, 410, 410, 410, 410, 410, 410
seisCientosQuince: DW 615, 615, 615, 615, 615, 615, 615, 615
ochoCientosVeinte: DW 820, 820, 820, 820, 820, 820, 820, 820
section .text
halftone_asm:
PUSH rbp ; Alineado
MOV rbp,rsp
PUSH rbx ; Desalineado
PUSH r12 ; Alineado
PUSH r13 ; Desalineado
PUSH r14 ; Alineado
PUSH r15 ; Desalineado
; #################### TENGO QUE VER SI LAS DIMENSIONES SON IMPARES ##############
; me fijo si m es impar, en ese caso primero decremento en 1
MOV r12,0x1 ; armo la mascara 00000 ... 0001 para ver si es impar
AND r12,rdx ; si es impar r12 vale 1, si no r12 vale 0
CMP r12,0x0
JE .cantFilasEsPar
; si no salto es porque es impar y en ese caso primero decremento 1
DEC rdx
.cantFilasEsPar:
; me fijo si n es impar, en ese caso primero decremento en 1
MOV r12,0x1 ; armo la mascara 00000 ... 0001 para ver si es impar
AND r12,rcx ; si es impar r12 vale 1, si no r12 vale 0
CMP r12,0x0
JE .tamFilaEsPar
; si no salto es porque es impar y primero decremento 1
DEC rcx
.tamFilaEsPar:
; ########### TERMINA DE CHECKEAR QUE LAS DIMESIONES SEAN PARES ###############
; guardo valores
MOV r13,rdx ; r13d = m
SAR r13,1 ; r13d = m/2 esto es porque voy de a dos lineas a la vez
; guardo el valor del padding
MOV r10,r8
MOV r11,r9
SUB r10,rcx
SUB r11,rcx
; ////////////////////////////////////////////////////////////////////////////////
; //////////////////////// SETEO DATOS DE USO GENERAL ///////////////////////////
; ////////////////////////////////////////////////////////////////////////////////
; obtengo la cantidad de veces que puedo avanzar en una fila
XOR rdx,rdx
MOV r12,16
MOV rax,rcx
IDIV r12 ; eax <- [n/16], edx <- resto de [n/16]
MOV r14,rax ; r14 <- [n/16]
MOV rbx,r14 ; rbx <- [n/16] ----- sobre este voy a iterar
; me fijo si el resto fue 0 o no, y lo seteo en un flag.
MOV r12,No_Tiene_ultimo_tramo
CMP rdx,0
JE .setear_registros
; si no salto es porque hay un tramo mas a recorrer
; me guardo el valor de lo que hay que restarle a la ultima posicion valida para obtener el ultimo tramo
MOV r15,rdx
MOV r12,Tiene_Ultimo_Tramo ; seteo el falg indicando que si hay un ultimo tramo
.setear_registros:
; seteo todos los datos necesarios una sola vez para todos los ciclos
; registros xmm12-xmm15 con los valores 205,410,615,820 respectivamente
MOVDQU xmm12,[dosCientosCinco]
MOVDQU xmm13,[cuatroCientosDiez]
MOVDQU xmm14,[seisCientosQuince]
MOVDQU xmm15,[ochoCientosVeinte]
MOVDQU xmm11,[mascara_impares]
MOVDQU xmm10,[mascara_pares]
MOVDQU xmm9,[mascara_unos]
; ############################# ESTADO DE LOS REGISTROS ##########################
; ########## REGISTROS PARA EL LOOP ##############################################
; r10 <- padding de src
; r11 <- padding de dst
; r13 <- cant de filas a recorrer
; r12 <- tiene ultimo tramo o no
; r15 <- resto de [n/16]
; r14 <- [n/16]
; rbx <- [n/16]
; ######## REGISTROS GENERALES ##################################################
;XMM9 <- mascara de unos
;XMM10 <- mascara de pares
;XMM11 <- mascara de impares
;XMM12 <- 205,205,205,205,205,205,205,205
;XMM13 <- 410,410,410,410,410,410,410,410
;XMM14 <- 615,615,615,615,615,615,615,615
;XMM15 <- 820,820,820,820,820,820,820,820
;r8 <- rsc_row_size
;r9 <- dst_row_size
; ###############################################################################
; ////////////////////////////////////////////////////////////////////////////////
; /////////////////// COMIENZA EL CICLO PARA RECORRER LA IMAGEN //////////////////
; ////////////////////////////////////////////////////////////////////////////////
.ciclo: CMP r13,0 ; en r13d esta la cantidad de filas que me faltan recorrer
JE .fin ; si termino de recorrer la imagen salgo de la funcion
; ////////////////////////////////////////////////////////////////////////////////
; ///////////////ACA COMIENZA EL PROCESAMIENTO EN PARALELO ///////////////////////
; ////////////////////////////////////////////////////////////////////////////////
; obtengo los datos en memoria
MOVDQU xmm0,[rdi] ; obtengo los primeros 16 bytes de la linea actual
MOVDQU xmm2,[rdi+r8] ; obtengo los primeros 16 bytes de la siguiente linea, r8d = rsc_row_size
; ////////////////////////////////////////////////////////////////////////////////
; ///////////////////////////////// DESEMPAQUETO /////////////////////////////////
; ////////////////////////////////////////////////////////////////////////////////
; muevo la parte baja de los registros a otros para no perderlos ya que al desempaquetar necesito
; el doble de lugar
MOVQ xmm1,xmm0 ; en xmm1 obtengo la parte baja de xmm0 puesto en la parte baja de xmm1
MOVQ xmm3,xmm2 ; en xmm3 obtengo la parte baja de xmm2 puesto en la parte baja de xmm3
PXOR xmm5,xmm5 ; seteo en 0 xmm5 esto es para extender el numero con 0's
; desempaqueto en los registros xmm0,xmm1 los datos de la primera linea
PUNPCKHBW xmm0,xmm5
PUNPCKLBW xmm1,xmm5
; desempaqueto en los registros xmm2,xmm3 los datos de la segunda linea
PUNPCKHBW xmm2,xmm5
PUNPCKLBW xmm3,xmm5
; ////////////////////////////////////////////////////////////////////////////////
; ////////////////////// SUMO LOS VALORES DE LOS CUADRADOS ///////////////////////
; ////////////////////////////////////////////////////////////////////////////////
; sumo los word en paralelo, aca tengo la suma parcial que queda guardada en xmm0,xmm1
PADDW xmm0,xmm2
PADDW xmm1,xmm3
; luego sumo de a dos word's de forma horizontal obteniendo en xmm0 la suma de cada
; uno de los cuadrados que queria
PHADDW xmm1,xmm0
; ////////////////////////////////////////////////////////////////////////////////
; //////////////////////////// ARMO LA MASCARA ///////////////////////////////////
; ////////////////////////////////////////////////////////////////////////////////
;
; primer caso: t >= 205
MOVDQU xmm0,xmm12
PCMPGTW xmm0,xmm1
PXOR xmm0,xmm9
; le pongo 0's a los lugares que no le corresponden. Estos son los lugares pares de la primera fila xmm0, ya que
; si t > 205 en el lugar (1,1) el cuadrado seguro es blanco, 255 = 0x11111111
PAND xmm0,xmm10
; segundo caso t >= 410
MOVDQU xmm2,xmm13
PCMPGTW xmm2,xmm1
PXOR xmm2,xmm9
; le pongo 0's a los lugares que no le corresponden
PAND xmm2,xmm11
; tercer caso t >= 615
MOVDQU xmm3,xmm14
PCMPGTW xmm3,xmm1
PXOR xmm3,xmm9
; le pongo 0's a los lugares que no le corresponden
PAND xmm3,xmm10
; cuarto caso t >= 820
MOVDQU xmm4,xmm15
PCMPGTW xmm4,xmm1
PXOR xmm4,xmm9
; le pongo 0's a los lugares que no le corresponden
PAND xmm4,xmm11
; junto los resultados de la primera linea que esta actualmente en xmm0,xmm1 vertiendolo todo en xmm0
POR xmm0,xmm4
; lo mismo para la segunda fila que esta en xmm2,xmm3
POR xmm2,xmm3
; TENGO UNA MASCARA DE LA PRIMERA LINEA Y LA SEGUNDA DONDE HAY 0's EN LOS LUGARES DONDE VA NEGRO Y 1's EN
; LOS LUGARES DONDE VA BLANCO, DA LA CASUALIDAD QUE NEGRO ES 0 = 0x00000000 Y BLANCO ES 255 = 0x11111111
; POR LO QUE NO TENGO QUE HACER MAS NADA Y LA MASCARA ES EXACTAMENTE EL RESULTADO
; ////////////////////////////////////////////////////////////////////////////////
; ////////////// GUARDO LOS DATOS EN LOS LUGARES DE DESTINO //////////////////////
; ////////////////////////////////////////////////////////////////////////////////
MOVDQU [rsi],xmm0
MOVDQU [rsi+r9],xmm2
; ////////////////////////////////////////////////////////////////////////////////
; ///////////////ACA TERMINA EL PROCESAMIENTO EN PARALELO ////////////////////////
; ////////////////////////////////////////////////////////////////////////////////
; ////////////////////////////////////////////////////////////////////////////////
; /////////////// CODIGO PARA RECORRER LA MATRIZ DE LA IMAGEN ////////////////////
; ////////////////////////////////////////////////////////////////////////////////
; ########## REGISTROS PARA EL LOOP ##############################################
; r10 <- padding de src
; r11 <- padding de dst
; r13 <- cant de filas a recorrer
; r12 <- tiene ultimo tramo o no
; r15 <- resto de [n/16]
; r14 <- [n/16]
; rbx <- cantidad de iteraciones que faltan en una fila
; ###############################################################################
DEC rbx ; decremento la cantidad de iteraciones que me faltan para terminar la fila actual
; me fijo si ya llegue al final de la fila
CMP rbx,0
JE .termine_iteraciones ; en el caso en que halla llegado al final debo ver si tengo que recorrer el proximo
; tramito o no
; me fijo si mire el ultimo tramo
CMP rbx,-1
JE .saltear_proxima_linea
; si no termine las iteraciones entonces solo sumo 16 para pasar al proximo ciclo
.siguienteLinea:
ADD rdi,16
ADD rsi,16
JMP .finCiclo
; si termine las iteraciones entonces me fijo si tengo que saltar directamente a la proxima fila o si queda un tramo menor a 16 por recorrer
.termine_iteraciones:
CMP r12,No_Tiene_ultimo_tramo
JE .saltear_proxima_linea ; si no hay ultimo tramo salto directamente a la proxima fila a procesar
; si no salto es porque puede haber un ultimo tramo a recorrer
; en tal caso me fijo si ya lo hice o no
ADD rdi,r15
ADD rsi,r15
JMP .finCiclo
.saltear_proxima_linea:
MOV rbx,r14 ; le vuelvo a cargar la cantidad de iteraciones a realizar en una lina
ADD rdi,16
ADD rsi,16
ADD rdi,r10 ; le cargo el padding
ADD rsi,r11
ADD rdi,r8 ; me saleteo la lina ya que debo ir de dos en dos
ADD rsi,r9
DEC r13 ; decremento el contador de lineas restantes
.finCiclo:
JMP .ciclo ; paso a la próxima iteración
.fin:
POP r15
POP r14
POP r13
POP r12
POP rbx
POP rbp
RET |
ls.asm | shahendahamdy/xv6-threads | 0 | 103192 | <gh_stars>0
_ls: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
close(fd);
}
int
main(int argc, char *argv[])
{
0: f3 0f 1e fb endbr32
4: 8d 4c 24 04 lea 0x4(%esp),%ecx
8: 83 e4 f0 and $0xfffffff0,%esp
b: ff 71 fc pushl -0x4(%ecx)
e: 55 push %ebp
f: 89 e5 mov %esp,%ebp
11: 56 push %esi
12: 53 push %ebx
13: 51 push %ecx
14: 83 ec 0c sub $0xc,%esp
17: 8b 01 mov (%ecx),%eax
19: 8b 51 04 mov 0x4(%ecx),%edx
int i;
if(argc < 2){
1c: 83 f8 01 cmp $0x1,%eax
1f: 7e 28 jle 49 <main+0x49>
21: 8d 5a 04 lea 0x4(%edx),%ebx
24: 8d 34 82 lea (%edx,%eax,4),%esi
27: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2e: 66 90 xchg %ax,%ax
ls(".");
exit();
}
for(i=1; i<argc; i++)
ls(argv[i]);
30: 83 ec 0c sub $0xc,%esp
33: ff 33 pushl (%ebx)
35: 83 c3 04 add $0x4,%ebx
38: e8 c3 00 00 00 call 100 <ls>
for(i=1; i<argc; i++)
3d: 83 c4 10 add $0x10,%esp
40: 39 f3 cmp %esi,%ebx
42: 75 ec jne 30 <main+0x30>
exit();
44: e8 a4 07 00 00 call 7ed <exit>
ls(".");
49: 83 ec 0c sub $0xc,%esp
4c: 68 70 0b 00 00 push $0xb70
51: e8 aa 00 00 00 call 100 <ls>
exit();
56: e8 92 07 00 00 call 7ed <exit>
5b: 66 90 xchg %ax,%ax
5d: 66 90 xchg %ax,%ax
5f: 90 nop
00000060 <fmtname>:
{
60: f3 0f 1e fb endbr32
64: 55 push %ebp
65: 89 e5 mov %esp,%ebp
67: 56 push %esi
68: 53 push %ebx
69: 8b 75 08 mov 0x8(%ebp),%esi
for(p=path+strlen(path); p >= path && *p != '/'; p--)
6c: 83 ec 0c sub $0xc,%esp
6f: 56 push %esi
70: e8 4b 03 00 00 call 3c0 <strlen>
75: 83 c4 10 add $0x10,%esp
78: 01 f0 add %esi,%eax
7a: 89 c3 mov %eax,%ebx
7c: 73 0b jae 89 <fmtname+0x29>
7e: eb 0e jmp 8e <fmtname+0x2e>
80: 8d 43 ff lea -0x1(%ebx),%eax
83: 39 c6 cmp %eax,%esi
85: 77 0a ja 91 <fmtname+0x31>
87: 89 c3 mov %eax,%ebx
89: 80 3b 2f cmpb $0x2f,(%ebx)
8c: 75 f2 jne 80 <fmtname+0x20>
8e: 83 c3 01 add $0x1,%ebx
if(strlen(p) >= DIRSIZ)
91: 83 ec 0c sub $0xc,%esp
94: 53 push %ebx
95: e8 26 03 00 00 call 3c0 <strlen>
9a: 83 c4 10 add $0x10,%esp
9d: 83 f8 0d cmp $0xd,%eax
a0: 77 4a ja ec <fmtname+0x8c>
memmove(buf, p, strlen(p));
a2: 83 ec 0c sub $0xc,%esp
a5: 53 push %ebx
a6: e8 15 03 00 00 call 3c0 <strlen>
ab: 83 c4 0c add $0xc,%esp
ae: 50 push %eax
af: 53 push %ebx
b0: 68 44 0f 00 00 push $0xf44
b5: e8 b6 04 00 00 call 570 <memmove>
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
ba: 89 1c 24 mov %ebx,(%esp)
bd: e8 fe 02 00 00 call 3c0 <strlen>
c2: 89 1c 24 mov %ebx,(%esp)
return buf;
c5: bb 44 0f 00 00 mov $0xf44,%ebx
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
ca: 89 c6 mov %eax,%esi
cc: e8 ef 02 00 00 call 3c0 <strlen>
d1: ba 0e 00 00 00 mov $0xe,%edx
d6: 83 c4 0c add $0xc,%esp
d9: 29 f2 sub %esi,%edx
db: 05 44 0f 00 00 add $0xf44,%eax
e0: 52 push %edx
e1: 6a 20 push $0x20
e3: 50 push %eax
e4: e8 17 03 00 00 call 400 <memset>
return buf;
e9: 83 c4 10 add $0x10,%esp
}
ec: 8d 65 f8 lea -0x8(%ebp),%esp
ef: 89 d8 mov %ebx,%eax
f1: 5b pop %ebx
f2: 5e pop %esi
f3: 5d pop %ebp
f4: c3 ret
f5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000100 <ls>:
{
100: f3 0f 1e fb endbr32
104: 55 push %ebp
105: 89 e5 mov %esp,%ebp
107: 57 push %edi
108: 56 push %esi
109: 53 push %ebx
10a: 81 ec 64 02 00 00 sub $0x264,%esp
110: 8b 7d 08 mov 0x8(%ebp),%edi
if((fd = open(path, 0)) < 0){
113: 6a 00 push $0x0
115: 57 push %edi
116: e8 12 07 00 00 call 82d <open>
11b: 83 c4 10 add $0x10,%esp
11e: 85 c0 test %eax,%eax
120: 0f 88 9a 01 00 00 js 2c0 <ls+0x1c0>
if(fstat(fd, &st) < 0){
126: 83 ec 08 sub $0x8,%esp
129: 8d b5 d4 fd ff ff lea -0x22c(%ebp),%esi
12f: 89 c3 mov %eax,%ebx
131: 56 push %esi
132: 50 push %eax
133: e8 0d 07 00 00 call 845 <fstat>
138: 83 c4 10 add $0x10,%esp
13b: 85 c0 test %eax,%eax
13d: 0f 88 bd 01 00 00 js 300 <ls+0x200>
switch(st.type){
143: 0f b7 85 d4 fd ff ff movzwl -0x22c(%ebp),%eax
14a: 66 83 f8 01 cmp $0x1,%ax
14e: 74 60 je 1b0 <ls+0xb0>
150: 66 83 f8 02 cmp $0x2,%ax
154: 74 1a je 170 <ls+0x70>
close(fd);
156: 83 ec 0c sub $0xc,%esp
159: 53 push %ebx
15a: e8 b6 06 00 00 call 815 <close>
15f: 83 c4 10 add $0x10,%esp
}
162: 8d 65 f4 lea -0xc(%ebp),%esp
165: 5b pop %ebx
166: 5e pop %esi
167: 5f pop %edi
168: 5d pop %ebp
169: c3 ret
16a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
170: 83 ec 0c sub $0xc,%esp
173: 8b 95 e4 fd ff ff mov -0x21c(%ebp),%edx
179: 8b b5 dc fd ff ff mov -0x224(%ebp),%esi
17f: 57 push %edi
180: 89 95 b4 fd ff ff mov %edx,-0x24c(%ebp)
186: e8 d5 fe ff ff call 60 <fmtname>
18b: 8b 95 b4 fd ff ff mov -0x24c(%ebp),%edx
191: 59 pop %ecx
192: 5f pop %edi
193: 52 push %edx
194: 56 push %esi
195: 6a 02 push $0x2
197: 50 push %eax
198: 68 50 0b 00 00 push $0xb50
19d: 6a 01 push $0x1
19f: e8 bc 07 00 00 call 960 <printf>
break;
1a4: 83 c4 20 add $0x20,%esp
1a7: eb ad jmp 156 <ls+0x56>
1a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
1b0: 83 ec 0c sub $0xc,%esp
1b3: 57 push %edi
1b4: e8 07 02 00 00 call 3c0 <strlen>
1b9: 83 c4 10 add $0x10,%esp
1bc: 83 c0 10 add $0x10,%eax
1bf: 3d 00 02 00 00 cmp $0x200,%eax
1c4: 0f 87 16 01 00 00 ja 2e0 <ls+0x1e0>
strcpy(buf, path);
1ca: 83 ec 08 sub $0x8,%esp
1cd: 57 push %edi
1ce: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi
1d4: 57 push %edi
1d5: e8 66 01 00 00 call 340 <strcpy>
p = buf+strlen(buf);
1da: 89 3c 24 mov %edi,(%esp)
1dd: e8 de 01 00 00 call 3c0 <strlen>
while(read(fd, &de, sizeof(de)) == sizeof(de)){
1e2: 83 c4 10 add $0x10,%esp
p = buf+strlen(buf);
1e5: 01 f8 add %edi,%eax
*p++ = '/';
1e7: 8d 48 01 lea 0x1(%eax),%ecx
p = buf+strlen(buf);
1ea: 89 85 a8 fd ff ff mov %eax,-0x258(%ebp)
*p++ = '/';
1f0: 89 8d a4 fd ff ff mov %ecx,-0x25c(%ebp)
1f6: c6 00 2f movb $0x2f,(%eax)
while(read(fd, &de, sizeof(de)) == sizeof(de)){
1f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
200: 83 ec 04 sub $0x4,%esp
203: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax
209: 6a 10 push $0x10
20b: 50 push %eax
20c: 53 push %ebx
20d: e8 f3 05 00 00 call 805 <read>
212: 83 c4 10 add $0x10,%esp
215: 83 f8 10 cmp $0x10,%eax
218: 0f 85 38 ff ff ff jne 156 <ls+0x56>
if(de.inum == 0)
21e: 66 83 bd c4 fd ff ff cmpw $0x0,-0x23c(%ebp)
225: 00
226: 74 d8 je 200 <ls+0x100>
memmove(p, de.name, DIRSIZ);
228: 83 ec 04 sub $0x4,%esp
22b: 8d 85 c6 fd ff ff lea -0x23a(%ebp),%eax
231: 6a 0e push $0xe
233: 50 push %eax
234: ff b5 a4 fd ff ff pushl -0x25c(%ebp)
23a: e8 31 03 00 00 call 570 <memmove>
p[DIRSIZ] = 0;
23f: 8b 85 a8 fd ff ff mov -0x258(%ebp),%eax
245: c6 40 0f 00 movb $0x0,0xf(%eax)
if(stat(buf, &st) < 0){
249: 58 pop %eax
24a: 5a pop %edx
24b: 56 push %esi
24c: 57 push %edi
24d: e8 8e 02 00 00 call 4e0 <stat>
252: 83 c4 10 add $0x10,%esp
255: 85 c0 test %eax,%eax
257: 0f 88 cb 00 00 00 js 328 <ls+0x228>
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
25d: 83 ec 0c sub $0xc,%esp
260: 8b 8d e4 fd ff ff mov -0x21c(%ebp),%ecx
266: 8b 95 dc fd ff ff mov -0x224(%ebp),%edx
26c: 57 push %edi
26d: 0f bf 85 d4 fd ff ff movswl -0x22c(%ebp),%eax
274: 89 8d ac fd ff ff mov %ecx,-0x254(%ebp)
27a: 89 95 b0 fd ff ff mov %edx,-0x250(%ebp)
280: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp)
286: e8 d5 fd ff ff call 60 <fmtname>
28b: 5a pop %edx
28c: 8b 95 b0 fd ff ff mov -0x250(%ebp),%edx
292: 59 pop %ecx
293: 8b 8d ac fd ff ff mov -0x254(%ebp),%ecx
299: 51 push %ecx
29a: 52 push %edx
29b: ff b5 b4 fd ff ff pushl -0x24c(%ebp)
2a1: 50 push %eax
2a2: 68 50 0b 00 00 push $0xb50
2a7: 6a 01 push $0x1
2a9: e8 b2 06 00 00 call 960 <printf>
2ae: 83 c4 20 add $0x20,%esp
2b1: e9 4a ff ff ff jmp 200 <ls+0x100>
2b6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2bd: 8d 76 00 lea 0x0(%esi),%esi
printf(2, "ls: cannot open %s\n", path);
2c0: 83 ec 04 sub $0x4,%esp
2c3: 57 push %edi
2c4: 68 28 0b 00 00 push $0xb28
2c9: 6a 02 push $0x2
2cb: e8 90 06 00 00 call 960 <printf>
return;
2d0: 83 c4 10 add $0x10,%esp
}
2d3: 8d 65 f4 lea -0xc(%ebp),%esp
2d6: 5b pop %ebx
2d7: 5e pop %esi
2d8: 5f pop %edi
2d9: 5d pop %ebp
2da: c3 ret
2db: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
2df: 90 nop
printf(1, "ls: path too long\n");
2e0: 83 ec 08 sub $0x8,%esp
2e3: 68 5d 0b 00 00 push $0xb5d
2e8: 6a 01 push $0x1
2ea: e8 71 06 00 00 call 960 <printf>
break;
2ef: 83 c4 10 add $0x10,%esp
2f2: e9 5f fe ff ff jmp 156 <ls+0x56>
2f7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2fe: 66 90 xchg %ax,%ax
printf(2, "ls: cannot stat %s\n", path);
300: 83 ec 04 sub $0x4,%esp
303: 57 push %edi
304: 68 3c 0b 00 00 push $0xb3c
309: 6a 02 push $0x2
30b: e8 50 06 00 00 call 960 <printf>
close(fd);
310: 89 1c 24 mov %ebx,(%esp)
313: e8 fd 04 00 00 call 815 <close>
return;
318: 83 c4 10 add $0x10,%esp
}
31b: 8d 65 f4 lea -0xc(%ebp),%esp
31e: 5b pop %ebx
31f: 5e pop %esi
320: 5f pop %edi
321: 5d pop %ebp
322: c3 ret
323: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
327: 90 nop
printf(1, "ls: cannot stat %s\n", buf);
328: 83 ec 04 sub $0x4,%esp
32b: 57 push %edi
32c: 68 3c 0b 00 00 push $0xb3c
331: 6a 01 push $0x1
333: e8 28 06 00 00 call 960 <printf>
continue;
338: 83 c4 10 add $0x10,%esp
33b: e9 c0 fe ff ff jmp 200 <ls+0x100>
00000340 <strcpy>:
};
char*
strcpy(char *s, const char *t)
{
340: f3 0f 1e fb endbr32
344: 55 push %ebp
char *os;
os = s;
while((*s++ = *t++) != 0)
345: 31 c0 xor %eax,%eax
{
347: 89 e5 mov %esp,%ebp
349: 53 push %ebx
34a: 8b 4d 08 mov 0x8(%ebp),%ecx
34d: 8b 5d 0c mov 0xc(%ebp),%ebx
while((*s++ = *t++) != 0)
350: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx
354: 88 14 01 mov %dl,(%ecx,%eax,1)
357: 83 c0 01 add $0x1,%eax
35a: 84 d2 test %dl,%dl
35c: 75 f2 jne 350 <strcpy+0x10>
;
return os;
}
35e: 89 c8 mov %ecx,%eax
360: 5b pop %ebx
361: 5d pop %ebp
362: c3 ret
363: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
36a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000370 <strcmp>:
int
strcmp(const char *p, const char *q)
{
370: f3 0f 1e fb endbr32
374: 55 push %ebp
375: 89 e5 mov %esp,%ebp
377: 53 push %ebx
378: 8b 4d 08 mov 0x8(%ebp),%ecx
37b: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
37e: 0f b6 01 movzbl (%ecx),%eax
381: 0f b6 1a movzbl (%edx),%ebx
384: 84 c0 test %al,%al
386: 75 19 jne 3a1 <strcmp+0x31>
388: eb 26 jmp 3b0 <strcmp+0x40>
38a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
390: 0f b6 41 01 movzbl 0x1(%ecx),%eax
p++, q++;
394: 83 c1 01 add $0x1,%ecx
397: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
39a: 0f b6 1a movzbl (%edx),%ebx
39d: 84 c0 test %al,%al
39f: 74 0f je 3b0 <strcmp+0x40>
3a1: 38 d8 cmp %bl,%al
3a3: 74 eb je 390 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
3a5: 29 d8 sub %ebx,%eax
}
3a7: 5b pop %ebx
3a8: 5d pop %ebp
3a9: c3 ret
3aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3b0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
3b2: 29 d8 sub %ebx,%eax
}
3b4: 5b pop %ebx
3b5: 5d pop %ebp
3b6: c3 ret
3b7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3be: 66 90 xchg %ax,%ax
000003c0 <strlen>:
uint
strlen(const char *s)
{
3c0: f3 0f 1e fb endbr32
3c4: 55 push %ebp
3c5: 89 e5 mov %esp,%ebp
3c7: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for(n = 0; s[n]; n++)
3ca: 80 3a 00 cmpb $0x0,(%edx)
3cd: 74 21 je 3f0 <strlen+0x30>
3cf: 31 c0 xor %eax,%eax
3d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3d8: 83 c0 01 add $0x1,%eax
3db: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
3df: 89 c1 mov %eax,%ecx
3e1: 75 f5 jne 3d8 <strlen+0x18>
;
return n;
}
3e3: 89 c8 mov %ecx,%eax
3e5: 5d pop %ebp
3e6: c3 ret
3e7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3ee: 66 90 xchg %ax,%ax
for(n = 0; s[n]; n++)
3f0: 31 c9 xor %ecx,%ecx
}
3f2: 5d pop %ebp
3f3: 89 c8 mov %ecx,%eax
3f5: c3 ret
3f6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3fd: 8d 76 00 lea 0x0(%esi),%esi
00000400 <memset>:
void*
memset(void *dst, int c, uint n)
{
400: f3 0f 1e fb endbr32
404: 55 push %ebp
405: 89 e5 mov %esp,%ebp
407: 57 push %edi
408: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
40b: 8b 4d 10 mov 0x10(%ebp),%ecx
40e: 8b 45 0c mov 0xc(%ebp),%eax
411: 89 d7 mov %edx,%edi
413: fc cld
414: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
416: 89 d0 mov %edx,%eax
418: 5f pop %edi
419: 5d pop %ebp
41a: c3 ret
41b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
41f: 90 nop
00000420 <strchr>:
char*
strchr(const char *s, char c)
{
420: f3 0f 1e fb endbr32
424: 55 push %ebp
425: 89 e5 mov %esp,%ebp
427: 8b 45 08 mov 0x8(%ebp),%eax
42a: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
42e: 0f b6 10 movzbl (%eax),%edx
431: 84 d2 test %dl,%dl
433: 75 16 jne 44b <strchr+0x2b>
435: eb 21 jmp 458 <strchr+0x38>
437: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
43e: 66 90 xchg %ax,%ax
440: 0f b6 50 01 movzbl 0x1(%eax),%edx
444: 83 c0 01 add $0x1,%eax
447: 84 d2 test %dl,%dl
449: 74 0d je 458 <strchr+0x38>
if(*s == c)
44b: 38 d1 cmp %dl,%cl
44d: 75 f1 jne 440 <strchr+0x20>
return (char*)s;
return 0;
}
44f: 5d pop %ebp
450: c3 ret
451: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return 0;
458: 31 c0 xor %eax,%eax
}
45a: 5d pop %ebp
45b: c3 ret
45c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000460 <gets>:
char*
gets(char *buf, int max)
{
460: f3 0f 1e fb endbr32
464: 55 push %ebp
465: 89 e5 mov %esp,%ebp
467: 57 push %edi
468: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
469: 31 f6 xor %esi,%esi
{
46b: 53 push %ebx
46c: 89 f3 mov %esi,%ebx
46e: 83 ec 1c sub $0x1c,%esp
471: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
474: eb 33 jmp 4a9 <gets+0x49>
476: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
47d: 8d 76 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
480: 83 ec 04 sub $0x4,%esp
483: 8d 45 e7 lea -0x19(%ebp),%eax
486: 6a 01 push $0x1
488: 50 push %eax
489: 6a 00 push $0x0
48b: e8 75 03 00 00 call 805 <read>
if(cc < 1)
490: 83 c4 10 add $0x10,%esp
493: 85 c0 test %eax,%eax
495: 7e 1c jle 4b3 <gets+0x53>
break;
buf[i++] = c;
497: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
49b: 83 c7 01 add $0x1,%edi
49e: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
4a1: 3c 0a cmp $0xa,%al
4a3: 74 23 je 4c8 <gets+0x68>
4a5: 3c 0d cmp $0xd,%al
4a7: 74 1f je 4c8 <gets+0x68>
for(i=0; i+1 < max; ){
4a9: 83 c3 01 add $0x1,%ebx
4ac: 89 fe mov %edi,%esi
4ae: 3b 5d 0c cmp 0xc(%ebp),%ebx
4b1: 7c cd jl 480 <gets+0x20>
4b3: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
4b5: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
4b8: c6 03 00 movb $0x0,(%ebx)
}
4bb: 8d 65 f4 lea -0xc(%ebp),%esp
4be: 5b pop %ebx
4bf: 5e pop %esi
4c0: 5f pop %edi
4c1: 5d pop %ebp
4c2: c3 ret
4c3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
4c7: 90 nop
4c8: 8b 75 08 mov 0x8(%ebp),%esi
4cb: 8b 45 08 mov 0x8(%ebp),%eax
4ce: 01 de add %ebx,%esi
4d0: 89 f3 mov %esi,%ebx
buf[i] = '\0';
4d2: c6 03 00 movb $0x0,(%ebx)
}
4d5: 8d 65 f4 lea -0xc(%ebp),%esp
4d8: 5b pop %ebx
4d9: 5e pop %esi
4da: 5f pop %edi
4db: 5d pop %ebp
4dc: c3 ret
4dd: 8d 76 00 lea 0x0(%esi),%esi
000004e0 <stat>:
int
stat(const char *n, struct stat *st)
{
4e0: f3 0f 1e fb endbr32
4e4: 55 push %ebp
4e5: 89 e5 mov %esp,%ebp
4e7: 56 push %esi
4e8: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
4e9: 83 ec 08 sub $0x8,%esp
4ec: 6a 00 push $0x0
4ee: ff 75 08 pushl 0x8(%ebp)
4f1: e8 37 03 00 00 call 82d <open>
if(fd < 0)
4f6: 83 c4 10 add $0x10,%esp
4f9: 85 c0 test %eax,%eax
4fb: 78 2b js 528 <stat+0x48>
return -1;
r = fstat(fd, st);
4fd: 83 ec 08 sub $0x8,%esp
500: ff 75 0c pushl 0xc(%ebp)
503: 89 c3 mov %eax,%ebx
505: 50 push %eax
506: e8 3a 03 00 00 call 845 <fstat>
close(fd);
50b: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
50e: 89 c6 mov %eax,%esi
close(fd);
510: e8 00 03 00 00 call 815 <close>
return r;
515: 83 c4 10 add $0x10,%esp
}
518: 8d 65 f8 lea -0x8(%ebp),%esp
51b: 89 f0 mov %esi,%eax
51d: 5b pop %ebx
51e: 5e pop %esi
51f: 5d pop %ebp
520: c3 ret
521: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
528: be ff ff ff ff mov $0xffffffff,%esi
52d: eb e9 jmp 518 <stat+0x38>
52f: 90 nop
00000530 <atoi>:
int
atoi(const char *s)
{
530: f3 0f 1e fb endbr32
534: 55 push %ebp
535: 89 e5 mov %esp,%ebp
537: 53 push %ebx
538: 8b 55 08 mov 0x8(%ebp),%edx
int n;
n = 0;
while('0' <= *s && *s <= '9')
53b: 0f be 02 movsbl (%edx),%eax
53e: 8d 48 d0 lea -0x30(%eax),%ecx
541: 80 f9 09 cmp $0x9,%cl
n = 0;
544: b9 00 00 00 00 mov $0x0,%ecx
while('0' <= *s && *s <= '9')
549: 77 1a ja 565 <atoi+0x35>
54b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
54f: 90 nop
n = n*10 + *s++ - '0';
550: 83 c2 01 add $0x1,%edx
553: 8d 0c 89 lea (%ecx,%ecx,4),%ecx
556: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx
while('0' <= *s && *s <= '9')
55a: 0f be 02 movsbl (%edx),%eax
55d: 8d 58 d0 lea -0x30(%eax),%ebx
560: 80 fb 09 cmp $0x9,%bl
563: 76 eb jbe 550 <atoi+0x20>
return n;
}
565: 89 c8 mov %ecx,%eax
567: 5b pop %ebx
568: 5d pop %ebp
569: c3 ret
56a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000570 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
570: f3 0f 1e fb endbr32
574: 55 push %ebp
575: 89 e5 mov %esp,%ebp
577: 57 push %edi
578: 8b 45 10 mov 0x10(%ebp),%eax
57b: 8b 55 08 mov 0x8(%ebp),%edx
57e: 56 push %esi
57f: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
582: 85 c0 test %eax,%eax
584: 7e 0f jle 595 <memmove+0x25>
586: 01 d0 add %edx,%eax
dst = vdst;
588: 89 d7 mov %edx,%edi
58a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
*dst++ = *src++;
590: a4 movsb %ds:(%esi),%es:(%edi)
while(n-- > 0)
591: 39 f8 cmp %edi,%eax
593: 75 fb jne 590 <memmove+0x20>
return vdst;
}
595: 5e pop %esi
596: 89 d0 mov %edx,%eax
598: 5f pop %edi
599: 5d pop %ebp
59a: c3 ret
59b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
59f: 90 nop
000005a0 <thread_join>:
void* stack;
stack =malloc(4096); //pgsize
return clone(start_routine,arg1,arg2,stack);
}
int thread_join()
{
5a0: f3 0f 1e fb endbr32
5a4: 55 push %ebp
5a5: 89 e5 mov %esp,%ebp
5a7: 83 ec 24 sub $0x24,%esp
void * stackPtr;
int x = join(&stackPtr);
5aa: 8d 45 f4 lea -0xc(%ebp),%eax
5ad: 50 push %eax
5ae: e8 f2 02 00 00 call 8a5 <join>
return x;
}
5b3: c9 leave
5b4: c3 ret
5b5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
5bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000005c0 <lock_init>:
void lock_init(struct lock_t *lk){
5c0: f3 0f 1e fb endbr32
5c4: 55 push %ebp
5c5: 89 e5 mov %esp,%ebp
lk->locked=0; //intialize as unnlocked
5c7: 8b 45 08 mov 0x8(%ebp),%eax
5ca: c7 00 00 00 00 00 movl $0x0,(%eax)
}
5d0: 5d pop %ebp
5d1: c3 ret
5d2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
5d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000005e0 <lock_acquire>:
void lock_acquire(struct lock_t *lk){
5e0: f3 0f 1e fb endbr32
5e4: 55 push %ebp
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
5e5: b9 01 00 00 00 mov $0x1,%ecx
5ea: 89 e5 mov %esp,%ebp
5ec: 8b 55 08 mov 0x8(%ebp),%edx
5ef: 90 nop
5f0: 89 c8 mov %ecx,%eax
5f2: f0 87 02 lock xchg %eax,(%edx)
while(xchg(&lk->locked,1) != 0);
5f5: 85 c0 test %eax,%eax
5f7: 75 f7 jne 5f0 <lock_acquire+0x10>
}
5f9: 5d pop %ebp
5fa: c3 ret
5fb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
5ff: 90 nop
00000600 <lock_release>:
void lock_release(struct lock_t *lk){
600: f3 0f 1e fb endbr32
604: 55 push %ebp
605: 31 c0 xor %eax,%eax
607: 89 e5 mov %esp,%ebp
609: 8b 55 08 mov 0x8(%ebp),%edx
60c: f0 87 02 lock xchg %eax,(%edx)
xchg(&lk->locked,0) ;
}
60f: 5d pop %ebp
610: c3 ret
611: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
618: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
61f: 90 nop
00000620 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
620: f3 0f 1e fb endbr32
624: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
625: a1 54 0f 00 00 mov 0xf54,%eax
{
62a: 89 e5 mov %esp,%ebp
62c: 57 push %edi
62d: 56 push %esi
62e: 53 push %ebx
62f: 8b 5d 08 mov 0x8(%ebp),%ebx
632: 8b 10 mov (%eax),%edx
bp = (Header*)ap - 1;
634: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
637: 39 c8 cmp %ecx,%eax
639: 73 15 jae 650 <free+0x30>
63b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
63f: 90 nop
640: 39 d1 cmp %edx,%ecx
642: 72 14 jb 658 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
644: 39 d0 cmp %edx,%eax
646: 73 10 jae 658 <free+0x38>
{
648: 89 d0 mov %edx,%eax
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
64a: 8b 10 mov (%eax),%edx
64c: 39 c8 cmp %ecx,%eax
64e: 72 f0 jb 640 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
650: 39 d0 cmp %edx,%eax
652: 72 f4 jb 648 <free+0x28>
654: 39 d1 cmp %edx,%ecx
656: 73 f0 jae 648 <free+0x28>
break;
if(bp + bp->s.size == p->s.ptr){
658: 8b 73 fc mov -0x4(%ebx),%esi
65b: 8d 3c f1 lea (%ecx,%esi,8),%edi
65e: 39 fa cmp %edi,%edx
660: 74 1e je 680 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
662: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
665: 8b 50 04 mov 0x4(%eax),%edx
668: 8d 34 d0 lea (%eax,%edx,8),%esi
66b: 39 f1 cmp %esi,%ecx
66d: 74 28 je 697 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
66f: 89 08 mov %ecx,(%eax)
freep = p;
}
671: 5b pop %ebx
freep = p;
672: a3 54 0f 00 00 mov %eax,0xf54
}
677: 5e pop %esi
678: 5f pop %edi
679: 5d pop %ebp
67a: c3 ret
67b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
67f: 90 nop
bp->s.size += p->s.ptr->s.size;
680: 03 72 04 add 0x4(%edx),%esi
683: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
686: 8b 10 mov (%eax),%edx
688: 8b 12 mov (%edx),%edx
68a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
68d: 8b 50 04 mov 0x4(%eax),%edx
690: 8d 34 d0 lea (%eax,%edx,8),%esi
693: 39 f1 cmp %esi,%ecx
695: 75 d8 jne 66f <free+0x4f>
p->s.size += bp->s.size;
697: 03 53 fc add -0x4(%ebx),%edx
freep = p;
69a: a3 54 0f 00 00 mov %eax,0xf54
p->s.size += bp->s.size;
69f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
6a2: 8b 53 f8 mov -0x8(%ebx),%edx
6a5: 89 10 mov %edx,(%eax)
}
6a7: 5b pop %ebx
6a8: 5e pop %esi
6a9: 5f pop %edi
6aa: 5d pop %ebp
6ab: c3 ret
6ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000006b0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
6b0: f3 0f 1e fb endbr32
6b4: 55 push %ebp
6b5: 89 e5 mov %esp,%ebp
6b7: 57 push %edi
6b8: 56 push %esi
6b9: 53 push %ebx
6ba: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6bd: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
6c0: 8b 3d 54 0f 00 00 mov 0xf54,%edi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6c6: 8d 70 07 lea 0x7(%eax),%esi
6c9: c1 ee 03 shr $0x3,%esi
6cc: 83 c6 01 add $0x1,%esi
if((prevp = freep) == 0){
6cf: 85 ff test %edi,%edi
6d1: 0f 84 a9 00 00 00 je 780 <malloc+0xd0>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6d7: 8b 07 mov (%edi),%eax
if(p->s.size >= nunits){
6d9: 8b 48 04 mov 0x4(%eax),%ecx
6dc: 39 f1 cmp %esi,%ecx
6de: 73 6d jae 74d <malloc+0x9d>
6e0: 81 fe 00 10 00 00 cmp $0x1000,%esi
6e6: bb 00 10 00 00 mov $0x1000,%ebx
6eb: 0f 43 de cmovae %esi,%ebx
p = sbrk(nu * sizeof(Header));
6ee: 8d 0c dd 00 00 00 00 lea 0x0(,%ebx,8),%ecx
6f5: 89 4d e4 mov %ecx,-0x1c(%ebp)
6f8: eb 17 jmp 711 <malloc+0x61>
6fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
700: 8b 10 mov (%eax),%edx
if(p->s.size >= nunits){
702: 8b 4a 04 mov 0x4(%edx),%ecx
705: 39 f1 cmp %esi,%ecx
707: 73 4f jae 758 <malloc+0xa8>
709: 8b 3d 54 0f 00 00 mov 0xf54,%edi
70f: 89 d0 mov %edx,%eax
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
711: 39 c7 cmp %eax,%edi
713: 75 eb jne 700 <malloc+0x50>
p = sbrk(nu * sizeof(Header));
715: 83 ec 0c sub $0xc,%esp
718: ff 75 e4 pushl -0x1c(%ebp)
71b: e8 65 01 00 00 call 885 <sbrk>
if(p == (char*)-1)
720: 83 c4 10 add $0x10,%esp
723: 83 f8 ff cmp $0xffffffff,%eax
726: 74 1b je 743 <malloc+0x93>
hp->s.size = nu;
728: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
72b: 83 ec 0c sub $0xc,%esp
72e: 83 c0 08 add $0x8,%eax
731: 50 push %eax
732: e8 e9 fe ff ff call 620 <free>
return freep;
737: a1 54 0f 00 00 mov 0xf54,%eax
if((p = morecore(nunits)) == 0)
73c: 83 c4 10 add $0x10,%esp
73f: 85 c0 test %eax,%eax
741: 75 bd jne 700 <malloc+0x50>
return 0;
}
}
743: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
746: 31 c0 xor %eax,%eax
}
748: 5b pop %ebx
749: 5e pop %esi
74a: 5f pop %edi
74b: 5d pop %ebp
74c: c3 ret
if(p->s.size >= nunits){
74d: 89 c2 mov %eax,%edx
74f: 89 f8 mov %edi,%eax
751: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p->s.size == nunits)
758: 39 ce cmp %ecx,%esi
75a: 74 54 je 7b0 <malloc+0x100>
p->s.size -= nunits;
75c: 29 f1 sub %esi,%ecx
75e: 89 4a 04 mov %ecx,0x4(%edx)
p += p->s.size;
761: 8d 14 ca lea (%edx,%ecx,8),%edx
p->s.size = nunits;
764: 89 72 04 mov %esi,0x4(%edx)
freep = prevp;
767: a3 54 0f 00 00 mov %eax,0xf54
}
76c: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
76f: 8d 42 08 lea 0x8(%edx),%eax
}
772: 5b pop %ebx
773: 5e pop %esi
774: 5f pop %edi
775: 5d pop %ebp
776: c3 ret
777: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
77e: 66 90 xchg %ax,%ax
base.s.ptr = freep = prevp = &base;
780: c7 05 54 0f 00 00 58 movl $0xf58,0xf54
787: 0f 00 00
base.s.size = 0;
78a: bf 58 0f 00 00 mov $0xf58,%edi
base.s.ptr = freep = prevp = &base;
78f: c7 05 58 0f 00 00 58 movl $0xf58,0xf58
796: 0f 00 00
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
799: 89 f8 mov %edi,%eax
base.s.size = 0;
79b: c7 05 5c 0f 00 00 00 movl $0x0,0xf5c
7a2: 00 00 00
if(p->s.size >= nunits){
7a5: e9 36 ff ff ff jmp 6e0 <malloc+0x30>
7aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
prevp->s.ptr = p->s.ptr;
7b0: 8b 0a mov (%edx),%ecx
7b2: 89 08 mov %ecx,(%eax)
7b4: eb b1 jmp 767 <malloc+0xb7>
7b6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
7bd: 8d 76 00 lea 0x0(%esi),%esi
000007c0 <thread_create>:
{
7c0: f3 0f 1e fb endbr32
7c4: 55 push %ebp
7c5: 89 e5 mov %esp,%ebp
7c7: 83 ec 14 sub $0x14,%esp
stack =malloc(4096); //pgsize
7ca: 68 00 10 00 00 push $0x1000
7cf: e8 dc fe ff ff call 6b0 <malloc>
return clone(start_routine,arg1,arg2,stack);
7d4: 50 push %eax
7d5: ff 75 10 pushl 0x10(%ebp)
7d8: ff 75 0c pushl 0xc(%ebp)
7db: ff 75 08 pushl 0x8(%ebp)
7de: e8 ba 00 00 00 call 89d <clone>
}
7e3: c9 leave
7e4: c3 ret
000007e5 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
7e5: b8 01 00 00 00 mov $0x1,%eax
7ea: cd 40 int $0x40
7ec: c3 ret
000007ed <exit>:
SYSCALL(exit)
7ed: b8 02 00 00 00 mov $0x2,%eax
7f2: cd 40 int $0x40
7f4: c3 ret
000007f5 <wait>:
SYSCALL(wait)
7f5: b8 03 00 00 00 mov $0x3,%eax
7fa: cd 40 int $0x40
7fc: c3 ret
000007fd <pipe>:
SYSCALL(pipe)
7fd: b8 04 00 00 00 mov $0x4,%eax
802: cd 40 int $0x40
804: c3 ret
00000805 <read>:
SYSCALL(read)
805: b8 05 00 00 00 mov $0x5,%eax
80a: cd 40 int $0x40
80c: c3 ret
0000080d <write>:
SYSCALL(write)
80d: b8 10 00 00 00 mov $0x10,%eax
812: cd 40 int $0x40
814: c3 ret
00000815 <close>:
SYSCALL(close)
815: b8 15 00 00 00 mov $0x15,%eax
81a: cd 40 int $0x40
81c: c3 ret
0000081d <kill>:
SYSCALL(kill)
81d: b8 06 00 00 00 mov $0x6,%eax
822: cd 40 int $0x40
824: c3 ret
00000825 <exec>:
SYSCALL(exec)
825: b8 07 00 00 00 mov $0x7,%eax
82a: cd 40 int $0x40
82c: c3 ret
0000082d <open>:
SYSCALL(open)
82d: b8 0f 00 00 00 mov $0xf,%eax
832: cd 40 int $0x40
834: c3 ret
00000835 <mknod>:
SYSCALL(mknod)
835: b8 11 00 00 00 mov $0x11,%eax
83a: cd 40 int $0x40
83c: c3 ret
0000083d <unlink>:
SYSCALL(unlink)
83d: b8 12 00 00 00 mov $0x12,%eax
842: cd 40 int $0x40
844: c3 ret
00000845 <fstat>:
SYSCALL(fstat)
845: b8 08 00 00 00 mov $0x8,%eax
84a: cd 40 int $0x40
84c: c3 ret
0000084d <link>:
SYSCALL(link)
84d: b8 13 00 00 00 mov $0x13,%eax
852: cd 40 int $0x40
854: c3 ret
00000855 <mkdir>:
SYSCALL(mkdir)
855: b8 14 00 00 00 mov $0x14,%eax
85a: cd 40 int $0x40
85c: c3 ret
0000085d <chdir>:
SYSCALL(chdir)
85d: b8 09 00 00 00 mov $0x9,%eax
862: cd 40 int $0x40
864: c3 ret
00000865 <dup>:
SYSCALL(dup)
865: b8 0a 00 00 00 mov $0xa,%eax
86a: cd 40 int $0x40
86c: c3 ret
0000086d <getpid>:
SYSCALL(getpid)
86d: b8 0b 00 00 00 mov $0xb,%eax
872: cd 40 int $0x40
874: c3 ret
00000875 <getyear>:
SYSCALL(getyear)
875: b8 16 00 00 00 mov $0x16,%eax
87a: cd 40 int $0x40
87c: c3 ret
0000087d <getreadcount>:
SYSCALL(getreadcount)
87d: b8 17 00 00 00 mov $0x17,%eax
882: cd 40 int $0x40
884: c3 ret
00000885 <sbrk>:
SYSCALL(sbrk)
885: b8 0c 00 00 00 mov $0xc,%eax
88a: cd 40 int $0x40
88c: c3 ret
0000088d <sleep>:
SYSCALL(sleep)
88d: b8 0d 00 00 00 mov $0xd,%eax
892: cd 40 int $0x40
894: c3 ret
00000895 <uptime>:
SYSCALL(uptime)
895: b8 0e 00 00 00 mov $0xe,%eax
89a: cd 40 int $0x40
89c: c3 ret
0000089d <clone>:
SYSCALL(clone)
89d: b8 18 00 00 00 mov $0x18,%eax
8a2: cd 40 int $0x40
8a4: c3 ret
000008a5 <join>:
SYSCALL(join)
8a5: b8 19 00 00 00 mov $0x19,%eax
8aa: cd 40 int $0x40
8ac: c3 ret
8ad: 66 90 xchg %ax,%ax
8af: 90 nop
000008b0 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
8b0: 55 push %ebp
8b1: 89 e5 mov %esp,%ebp
8b3: 57 push %edi
8b4: 56 push %esi
8b5: 53 push %ebx
8b6: 83 ec 3c sub $0x3c,%esp
8b9: 89 4d c4 mov %ecx,-0x3c(%ebp)
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
8bc: 89 d1 mov %edx,%ecx
{
8be: 89 45 b8 mov %eax,-0x48(%ebp)
if(sgn && xx < 0){
8c1: 85 d2 test %edx,%edx
8c3: 0f 89 7f 00 00 00 jns 948 <printint+0x98>
8c9: f6 45 08 01 testb $0x1,0x8(%ebp)
8cd: 74 79 je 948 <printint+0x98>
neg = 1;
8cf: c7 45 bc 01 00 00 00 movl $0x1,-0x44(%ebp)
x = -xx;
8d6: f7 d9 neg %ecx
} else {
x = xx;
}
i = 0;
8d8: 31 db xor %ebx,%ebx
8da: 8d 75 d7 lea -0x29(%ebp),%esi
8dd: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
8e0: 89 c8 mov %ecx,%eax
8e2: 31 d2 xor %edx,%edx
8e4: 89 cf mov %ecx,%edi
8e6: f7 75 c4 divl -0x3c(%ebp)
8e9: 0f b6 92 7c 0b 00 00 movzbl 0xb7c(%edx),%edx
8f0: 89 45 c0 mov %eax,-0x40(%ebp)
8f3: 89 d8 mov %ebx,%eax
8f5: 8d 5b 01 lea 0x1(%ebx),%ebx
}while((x /= base) != 0);
8f8: 8b 4d c0 mov -0x40(%ebp),%ecx
buf[i++] = digits[x % base];
8fb: 88 14 1e mov %dl,(%esi,%ebx,1)
}while((x /= base) != 0);
8fe: 39 7d c4 cmp %edi,-0x3c(%ebp)
901: 76 dd jbe 8e0 <printint+0x30>
if(neg)
903: 8b 4d bc mov -0x44(%ebp),%ecx
906: 85 c9 test %ecx,%ecx
908: 74 0c je 916 <printint+0x66>
buf[i++] = '-';
90a: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1)
buf[i++] = digits[x % base];
90f: 89 d8 mov %ebx,%eax
buf[i++] = '-';
911: ba 2d 00 00 00 mov $0x2d,%edx
while(--i >= 0)
916: 8b 7d b8 mov -0x48(%ebp),%edi
919: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx
91d: eb 07 jmp 926 <printint+0x76>
91f: 90 nop
920: 0f b6 13 movzbl (%ebx),%edx
923: 83 eb 01 sub $0x1,%ebx
write(fd, &c, 1);
926: 83 ec 04 sub $0x4,%esp
929: 88 55 d7 mov %dl,-0x29(%ebp)
92c: 6a 01 push $0x1
92e: 56 push %esi
92f: 57 push %edi
930: e8 d8 fe ff ff call 80d <write>
while(--i >= 0)
935: 83 c4 10 add $0x10,%esp
938: 39 de cmp %ebx,%esi
93a: 75 e4 jne 920 <printint+0x70>
putc(fd, buf[i]);
}
93c: 8d 65 f4 lea -0xc(%ebp),%esp
93f: 5b pop %ebx
940: 5e pop %esi
941: 5f pop %edi
942: 5d pop %ebp
943: c3 ret
944: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
948: c7 45 bc 00 00 00 00 movl $0x0,-0x44(%ebp)
94f: eb 87 jmp 8d8 <printint+0x28>
951: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
958: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
95f: 90 nop
00000960 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
960: f3 0f 1e fb endbr32
964: 55 push %ebp
965: 89 e5 mov %esp,%ebp
967: 57 push %edi
968: 56 push %esi
969: 53 push %ebx
96a: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
96d: 8b 75 0c mov 0xc(%ebp),%esi
970: 0f b6 1e movzbl (%esi),%ebx
973: 84 db test %bl,%bl
975: 0f 84 b4 00 00 00 je a2f <printf+0xcf>
ap = (uint*)(void*)&fmt + 1;
97b: 8d 45 10 lea 0x10(%ebp),%eax
97e: 83 c6 01 add $0x1,%esi
write(fd, &c, 1);
981: 8d 7d e7 lea -0x19(%ebp),%edi
state = 0;
984: 31 d2 xor %edx,%edx
ap = (uint*)(void*)&fmt + 1;
986: 89 45 d0 mov %eax,-0x30(%ebp)
989: eb 33 jmp 9be <printf+0x5e>
98b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
98f: 90 nop
990: 89 55 d4 mov %edx,-0x2c(%ebp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
993: ba 25 00 00 00 mov $0x25,%edx
if(c == '%'){
998: 83 f8 25 cmp $0x25,%eax
99b: 74 17 je 9b4 <printf+0x54>
write(fd, &c, 1);
99d: 83 ec 04 sub $0x4,%esp
9a0: 88 5d e7 mov %bl,-0x19(%ebp)
9a3: 6a 01 push $0x1
9a5: 57 push %edi
9a6: ff 75 08 pushl 0x8(%ebp)
9a9: e8 5f fe ff ff call 80d <write>
9ae: 8b 55 d4 mov -0x2c(%ebp),%edx
} else {
putc(fd, c);
9b1: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
9b4: 0f b6 1e movzbl (%esi),%ebx
9b7: 83 c6 01 add $0x1,%esi
9ba: 84 db test %bl,%bl
9bc: 74 71 je a2f <printf+0xcf>
c = fmt[i] & 0xff;
9be: 0f be cb movsbl %bl,%ecx
9c1: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
9c4: 85 d2 test %edx,%edx
9c6: 74 c8 je 990 <printf+0x30>
}
} else if(state == '%'){
9c8: 83 fa 25 cmp $0x25,%edx
9cb: 75 e7 jne 9b4 <printf+0x54>
if(c == 'd'){
9cd: 83 f8 64 cmp $0x64,%eax
9d0: 0f 84 9a 00 00 00 je a70 <printf+0x110>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
9d6: 81 e1 f7 00 00 00 and $0xf7,%ecx
9dc: 83 f9 70 cmp $0x70,%ecx
9df: 74 5f je a40 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
9e1: 83 f8 73 cmp $0x73,%eax
9e4: 0f 84 d6 00 00 00 je ac0 <printf+0x160>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
9ea: 83 f8 63 cmp $0x63,%eax
9ed: 0f 84 8d 00 00 00 je a80 <printf+0x120>
putc(fd, *ap);
ap++;
} else if(c == '%'){
9f3: 83 f8 25 cmp $0x25,%eax
9f6: 0f 84 b4 00 00 00 je ab0 <printf+0x150>
write(fd, &c, 1);
9fc: 83 ec 04 sub $0x4,%esp
9ff: c6 45 e7 25 movb $0x25,-0x19(%ebp)
a03: 6a 01 push $0x1
a05: 57 push %edi
a06: ff 75 08 pushl 0x8(%ebp)
a09: e8 ff fd ff ff call 80d <write>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
a0e: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
a11: 83 c4 0c add $0xc,%esp
a14: 6a 01 push $0x1
a16: 83 c6 01 add $0x1,%esi
a19: 57 push %edi
a1a: ff 75 08 pushl 0x8(%ebp)
a1d: e8 eb fd ff ff call 80d <write>
for(i = 0; fmt[i]; i++){
a22: 0f b6 5e ff movzbl -0x1(%esi),%ebx
putc(fd, c);
a26: 83 c4 10 add $0x10,%esp
}
state = 0;
a29: 31 d2 xor %edx,%edx
for(i = 0; fmt[i]; i++){
a2b: 84 db test %bl,%bl
a2d: 75 8f jne 9be <printf+0x5e>
}
}
}
a2f: 8d 65 f4 lea -0xc(%ebp),%esp
a32: 5b pop %ebx
a33: 5e pop %esi
a34: 5f pop %edi
a35: 5d pop %ebp
a36: c3 ret
a37: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
a3e: 66 90 xchg %ax,%ax
printint(fd, *ap, 16, 0);
a40: 83 ec 0c sub $0xc,%esp
a43: b9 10 00 00 00 mov $0x10,%ecx
a48: 6a 00 push $0x0
a4a: 8b 5d d0 mov -0x30(%ebp),%ebx
a4d: 8b 45 08 mov 0x8(%ebp),%eax
a50: 8b 13 mov (%ebx),%edx
a52: e8 59 fe ff ff call 8b0 <printint>
ap++;
a57: 89 d8 mov %ebx,%eax
a59: 83 c4 10 add $0x10,%esp
state = 0;
a5c: 31 d2 xor %edx,%edx
ap++;
a5e: 83 c0 04 add $0x4,%eax
a61: 89 45 d0 mov %eax,-0x30(%ebp)
a64: e9 4b ff ff ff jmp 9b4 <printf+0x54>
a69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printint(fd, *ap, 10, 1);
a70: 83 ec 0c sub $0xc,%esp
a73: b9 0a 00 00 00 mov $0xa,%ecx
a78: 6a 01 push $0x1
a7a: eb ce jmp a4a <printf+0xea>
a7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
putc(fd, *ap);
a80: 8b 5d d0 mov -0x30(%ebp),%ebx
write(fd, &c, 1);
a83: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
a86: 8b 03 mov (%ebx),%eax
write(fd, &c, 1);
a88: 6a 01 push $0x1
ap++;
a8a: 83 c3 04 add $0x4,%ebx
write(fd, &c, 1);
a8d: 57 push %edi
a8e: ff 75 08 pushl 0x8(%ebp)
putc(fd, *ap);
a91: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
a94: e8 74 fd ff ff call 80d <write>
ap++;
a99: 89 5d d0 mov %ebx,-0x30(%ebp)
a9c: 83 c4 10 add $0x10,%esp
state = 0;
a9f: 31 d2 xor %edx,%edx
aa1: e9 0e ff ff ff jmp 9b4 <printf+0x54>
aa6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
aad: 8d 76 00 lea 0x0(%esi),%esi
putc(fd, c);
ab0: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
ab3: 83 ec 04 sub $0x4,%esp
ab6: e9 59 ff ff ff jmp a14 <printf+0xb4>
abb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
abf: 90 nop
s = (char*)*ap;
ac0: 8b 45 d0 mov -0x30(%ebp),%eax
ac3: 8b 18 mov (%eax),%ebx
ap++;
ac5: 83 c0 04 add $0x4,%eax
ac8: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
acb: 85 db test %ebx,%ebx
acd: 74 17 je ae6 <printf+0x186>
while(*s != 0){
acf: 0f b6 03 movzbl (%ebx),%eax
state = 0;
ad2: 31 d2 xor %edx,%edx
while(*s != 0){
ad4: 84 c0 test %al,%al
ad6: 0f 84 d8 fe ff ff je 9b4 <printf+0x54>
adc: 89 75 d4 mov %esi,-0x2c(%ebp)
adf: 89 de mov %ebx,%esi
ae1: 8b 5d 08 mov 0x8(%ebp),%ebx
ae4: eb 1a jmp b00 <printf+0x1a0>
s = "(null)";
ae6: bb 72 0b 00 00 mov $0xb72,%ebx
while(*s != 0){
aeb: 89 75 d4 mov %esi,-0x2c(%ebp)
aee: b8 28 00 00 00 mov $0x28,%eax
af3: 89 de mov %ebx,%esi
af5: 8b 5d 08 mov 0x8(%ebp),%ebx
af8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
aff: 90 nop
write(fd, &c, 1);
b00: 83 ec 04 sub $0x4,%esp
s++;
b03: 83 c6 01 add $0x1,%esi
b06: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
b09: 6a 01 push $0x1
b0b: 57 push %edi
b0c: 53 push %ebx
b0d: e8 fb fc ff ff call 80d <write>
while(*s != 0){
b12: 0f b6 06 movzbl (%esi),%eax
b15: 83 c4 10 add $0x10,%esp
b18: 84 c0 test %al,%al
b1a: 75 e4 jne b00 <printf+0x1a0>
b1c: 8b 75 d4 mov -0x2c(%ebp),%esi
state = 0;
b1f: 31 d2 xor %edx,%edx
b21: e9 8e fe ff ff jmp 9b4 <printf+0x54>
|
src/wfc-initialize_from_sample.adb | 98devin/ada-wfc | 9 | 29016 | <reponame>98devin/ada-wfc
with Ada.Containers.Vectors;
with Ada.Containers.Ordered_Maps;
separate (WFC)
function Initialize_From_Sample
( Sample : in Element_Matrix;
Include_Rotations : in Boolean := False;
Include_Reflections : in Boolean := False;
N, M : in Positive := 2
) return Instance
is
type Tile is
array (1 .. N, 1 .. M) of Element_Type;
-- The type of a particular tile within the
-- image, an N x M rectangle of elements.
type Tile_ID_Matrix is
array (Natural range <>, Natural range <>) of Tile_ID;
function "<" (T1, T2 : in Tile) return Boolean is
begin
for X in Tile'Range(1) loop
for Y in Tile'Range(2) loop
if T1(X, Y) /= T2(X, Y) then
return T1(X, Y) < T2(X, Y);
end if;
end loop;
end loop;
return False;
end;
-- The less-than relation is not predefined for
-- multidimensional arrays in Ada, apparently.
function Tile_At (Sample : in Element_Matrix; X, Y : Natural) return Tile is
The_Tile : Tile;
begin
for Tile_X in Tile'Range(1) loop
for Tile_Y in Tile'Range(2) loop
The_Tile(Tile_X, Tile_Y) := Modular_Index(Sample, X + Tile_X - 1, Y + Tile_Y - 1);
end loop;
end loop;
return The_Tile;
end;
-- For each position in the sample, we want to build up the Tile
-- which has its top-left at this position. While doing so,
-- we maintain a modular indexing scheme such that the sample is taken to
-- loop back to itself in both directions. This is to ensure that we
-- can find a full tile's worth of information at each position,
-- regardless of the input matrix size.
package Tile_Maps is new Ada.Containers.Ordered_Maps(Tile, Tile_ID); use Tile_Maps;
package Freq_Vecs is new Ada.Containers.Vectors(Tile_ID, Natural); use Freq_Vecs;
Tile_Set : Tile_Maps.Map;
Frequencies_Vec : Freq_Vecs.Vector;
-- To track the set of tiles we've encountered, and their counts,
-- we use a combination of a mapping from tile matrices to ids for
-- uniqueness tests, and a mapping from tile ids to counts (in the form of a vector)
-- for their frequency.
Frequency_Total : Natural := 0;
-- We'll track this total just because it's easy to do that now.
function Lookup_Tile (The_Tile : Tile) return Tile_ID is
Inserted : Boolean;
Position : Tile_Maps.Cursor;
begin
Tile_Set.Insert(The_Tile, Position, Inserted);
if Inserted then
Frequencies_Vec.Append(0); -- insert new empty count (we'll increment it later)
Tile_Set(Position) := Frequencies_Vec.Last_Index; -- the new last index is this tile's unique ID
end if;
return Tile_Set(Position);
end;
-- Check whether we've seen the tile before, and if not,
-- initialize its tile ID and frequency. Return the unique tile id
-- associated with this tile, new or not.
procedure Count_Tile (The_Tile_ID : Tile_ID) is
Frequency : Natural renames Frequencies_Vec(The_Tile_ID);
begin
Frequency := Frequency + 1;
Frequency_Total := Frequency_Total + 1;
end;
-- Simply increment the specific tile's frequency,
-- while also tracking the total across all tiles.
procedure Count_Tiles (All_Tiles : in Tile_ID_Matrix) is
begin
for The_Tile of All_Tiles loop
Count_Tile(The_Tile);
end loop;
end;
-- Count all the tiles within the provided matrix.
function Populate_Tiles_From_Sample (Sample : in Element_Matrix) return Tile_ID_Matrix is
Sample_Tiles : Tile_ID_Matrix (Sample'Range(1), Sample'Range(2));
begin
for Sample_X in Sample'Range(1) loop
for Sample_Y in Sample'Range(2) loop
Sample_Tiles(Sample_X, Sample_Y) := Lookup_Tile(Tile_At(Sample, Sample_X, Sample_Y));
end loop;
end loop;
return Sample_Tiles;
end;
-- Given a sample matrix, lookup each NxM tile within it
-- to produce a matrix of the same size, but holding the ID of the tile
-- found at each position.
Sample_Normal : Element_Matrix renames Sample;
Sample_Reflect_H : constant Element_Matrix := Invert_Horizontal(Sample_Normal);
Sample_Reflect_V : constant Element_Matrix := Invert_Vertical(Sample_Normal);
Sample_Reflect_HV : constant Element_Matrix := Invert_Vertical(Sample_Reflect_H);
Sample_Rotate_90 : constant Element_Matrix := Rotate_Clockwise(Sample_Normal);
Sample_Rotate_90_H : constant Element_Matrix := Invert_Horizontal(Sample_Rotate_90);
Sample_Rotate_90_V : constant Element_Matrix := Invert_Vertical(Sample_Rotate_90);
Sample_Rotate_90_HV : constant Element_Matrix := Invert_Vertical(Sample_Rotate_90_H);
-- We compute each possible re-orientation we may need.
-- Fortunately there are only 8 such resulting changes by combining
-- vertical and horizontal reflections and rotations (some combinations overlap).
-- We don't want to do more processing than necessary, so they are enumerated upfront.
function Process_Tile_Counts return Natural is
procedure Process_Sample (Sample : in Element_Matrix) is
Sample_Tiles : constant Tile_ID_Matrix := Populate_Tiles_From_Sample(Sample);
begin
Count_Tiles(Sample_Tiles);
end;
begin
Process_Sample(Sample_Normal);
if Include_Reflections and Include_Rotations then
Process_Sample(Sample_Reflect_H);
Process_Sample(Sample_Reflect_V);
Process_Sample(Sample_Reflect_HV);
Process_Sample(Sample_Rotate_90);
Process_Sample(Sample_Rotate_90_H);
Process_Sample(Sample_Rotate_90_V);
Process_Sample(Sample_Rotate_90_HV);
elsif Include_Reflections and not Include_Rotations then
Process_Sample(Sample_Reflect_H);
Process_Sample(Sample_Reflect_V);
Process_Sample(Sample_Reflect_HV);
elsif not Include_Reflections and Include_Rotations then
Process_Sample(Sample_Reflect_HV); -- 180 degrees
Process_Sample(Sample_Rotate_90); -- 90 degrees
Process_Sample(Sample_Rotate_90_HV); -- 270 degrees
end if;
return Frequencies_Vec.Last_Index;
end;
-- Count all occurrences of every tile in each desired orientation,
-- and return the total number of tiles found during this process
-- (since counting will also involve tile ID creation).
function Frequencies_To_Array (Num_Tiles : Natural) return Frequency_Array is
Frequencies : Frequency_Array(1 .. Num_Tiles);
begin
for Index in Frequencies'Range loop
Frequencies(Index) := Frequencies_Vec(Index);
end loop;
return Frequencies;
end;
-- Collapse the dynamically-sized vector into an array
-- with a known length, so we guarantee this length in our result.
function Tile_Set_To_Elements (Num_Tiles : Natural) return Tile_Element_Array is
Tile_Elements : Tile_Element_Array(1 .. Num_Tiles);
begin
for C in Tile_Set.Iterate loop
Tile_Elements(Element(C)) := Key(C)(1, 1);
end loop;
return Tile_Elements;
end;
-- Collapse the tile set into an array of just the top-left-most element
-- of each tile we know about.
function Tile_Set_To_Adjacencies (Num_Tiles : Natural) return Adjacency_Matrix is
Adjacencies : Adjacency_Matrix(1 .. Num_Tiles, 1 .. Num_Tiles)
:= (others => (others => (others => False)));
function Adjacent_Rightwards (Tile_1, Tile_2 : Tile) return Boolean is
begin
for X in 1 .. N - 1 loop
for Y in 1 .. M loop
if Tile_1(X + 1, Y) /= Tile_2(X, Y) then
return False;
end if;
end loop;
end loop;
return True;
end;
function Adjacent_Downwards (Tile_1, Tile_2 : Tile) return Boolean is
begin
for X in 1 .. N loop
for Y in 1 .. M - 1 loop
if Tile_1(X, Y + 1) /= Tile_2(X, Y) then
return False;
end if;
end loop;
end loop;
return True;
end;
-- Both the above functions merely compare that, if the tiles were positioned
-- adjacently, then all of their elements would be equal except for those
-- which do not overlap in such a positioning. This is basically just comparing
-- that submatrices ignoring the first/last column/row respectively are equal.
begin
for C_1 in Tile_Set.Iterate loop
for C_2 in Tile_Set.Iterate loop
declare
T_ID_1 : constant Tile_ID := Element(C_1);
T_1 : constant Tile := Key(C_1);
T_ID_2 : constant Tile_ID := Element(C_2);
T_2 : constant Tile := Key(C_2);
begin
if Adjacent_Downwards(T_1, T_2) then
Adjacencies(T_ID_2, T_ID_1)(Upwards) := True;
Adjacencies(T_ID_1, T_ID_2)(Downwards) := True;
end if;
if Adjacent_Rightwards(T_1, T_2) then
Adjacencies(T_ID_2, T_ID_1)(Leftwards) := True;
Adjacencies(T_ID_1, T_ID_2)(Rightwards) := True;
end if;
end;
end loop;
end loop;
return Adjacencies;
end;
-- Compute adjacency information from the set of tiles and their contents.
function Count_Enablers (Adjacencies : in Adjacency_Matrix) return Enabler_Counts is
procedure Inc (N : in out Small_Integer) with Inline is
begin
N := N + 1;
end;
-- Convenience definition just so we don't have
-- to repeat the name of the array location in order to increment it.
Enablers : Enabler_Counts(Adjacencies'Range(1))
:= (others => (others => 0));
begin
for Tile_ID_1 in Enablers'Range loop
for Tile_ID_2 in Enablers'Range loop
for Dir in Adjacency_Direction loop
if Adjacencies(Tile_ID_1, Tile_ID_2)(Dir) then
Inc( Enablers(Tile_ID_1)(Dir) );
-- Notice that we don't increment the opposite case
-- in the same loop iteration, e.g. Enablers(Tile_ID_2)(Opposite(Dir))
-- because we don't want to double count these.
--
-- If we were to count one or more enablers twice,
-- then the algorithm itself would be unable to properly
-- restrict the placements of tiles and the output
-- would not resemble the input.
end if;
end loop;
end loop;
end loop;
return Enablers;
end;
begin
declare
Num_Tiles : constant Natural := Process_Tile_Counts;
Frequencies : constant Frequency_Array := Frequencies_To_Array(Num_Tiles);
Tile_Elements : constant Tile_Element_Array := Tile_Set_To_Elements(Num_Tiles);
Adjacencies : constant Adjacency_Matrix := Tile_Set_To_Adjacencies(Num_Tiles);
Enablers : constant Enabler_Counts := Count_Enablers(Adjacencies);
begin
return Instance'(
Num_Tiles => Num_Tiles,
Tile_Elements => Tile_Elements,
Frequencies => Frequencies,
Frequency_Total => Frequency_Total,
Adjacencies => Adjacencies,
Enablers => Enablers
);
end;
end; |
Task/Continued-fraction/Ada/continued-fraction-3.ada | LaudateCorpus1/RosettaCodeData | 1 | 27915 | with Ada.Text_IO;
with Continued_Fraction;
procedure Test_Continued_Fractions is
type Scalar is digits 15;
package Square_Root_Of_2 is
function A (N : in Natural) return Natural is (if N = 0 then 1 else 2);
function B (N : in Positive) return Natural is (1);
function Estimate is new Continued_Fraction (Scalar, A, B);
end Square_Root_Of_2;
package Napiers_Constant is
function A (N : in Natural) return Natural is (if N = 0 then 2 else N);
function B (N : in Positive) return Natural is (if N = 1 then 1 else N-1);
function Estimate is new Continued_Fraction (Scalar, A, B);
end Napiers_Constant;
package Pi is
function A (N : in Natural) return Natural is (if N = 0 then 3 else 6);
function B (N : in Positive) return Natural is ((2 * N - 1) ** 2);
function Estimate is new Continued_Fraction (Scalar, A, B);
end Pi;
package Scalar_Text_IO is new Ada.Text_IO.Float_IO (Scalar);
use Ada.Text_IO, Scalar_Text_IO;
begin
Put (Square_Root_Of_2.Estimate (200), Exp => 0); New_Line;
Put (Napiers_Constant.Estimate (200), Exp => 0); New_Line;
Put (Pi.Estimate (10000), Exp => 0); New_Line;
end Test_Continued_Fractions;
|
Melika Ahmadi Ranjbar/MiniJava.g4 | meliiwamd/IUSTCompiler | 0 | 5618 | <filename>Melika Ahmadi Ranjbar/MiniJava.g4<gh_stars>0
// Parser section
grammar MiniJava;
program returns[value_attr = str(), type_attr = str()]:
mainClass (classDeclaration)* EOF;
mainClass returns[value_attr = str(), type_attr = str()]:
Class mainClassEnter;
mainClassEnter returns[value_attr = str(), type_attr = str()]:
identifier BraketOpen mainClassBody BraketClose;
mainClassBody returns[value_attr = str(), type_attr = str()]:
Public Static Void Main ParOpen String '[' ']' identifier ParClose BraketOpen statement BraketClose;
classDeclaration returns[value_attr = str(), type_attr = str()]:
Class identifier ('extends' identifier) ? BraketOpen (varDeclaration)* (methodDeclaration)* BraketClose;
varDeclaration returns[value_attr = str(), type_attr = str()]:
kind identifier ';';
methodDeclaration returns[value_attr = str(), type_attr = str()]:
Public kind identifier ParOpen ( kind identifier ( ',' kind identifier )* ) ? ParClose BraketOpen (varDeclaration)* (statement)* Return expression ';' BraketClose;
kind returns[value_attr = str(), type_attr = str()]:
Int '[' ']' #array_int
| Boolean #bool
| Int #int
| identifier #id
;
statement returns[value_attr = str(), type_attr = str()]:
BraketOpen (statement)* BraketClose #braket_statement
| If ParOpen expression ParClose statement Else statement #if_statement
| While ParOpen expression ParClose statement #while_statement
| 'System.out.println' ParOpen expression ParClose ';' #print
| identifier '=' expression ';' #equal_statement
| identifier '[' expression ']' '=' expression ';' #equal_array_statement
;
expression returns[value_attr = str(), type_attr = str()]:
expression ( operations ) expression #operations_expression
| expression '[' expression ']' #array_expression
| expression Dot 'length' #length_expression
| expression Dot identifier ParOpen ( expression ( ',' expression )* ) ? ParClose #dot_par_expression
| IntegerLiteral #number
| KeyWords #keywords
| identifier #word
| New Int '[' expression ']' #new_array_expression
| New identifier ParOpen ParClose #new_identifier
| '!' expression #not_expression
| ParOpen expression ParClose #in_par_expression
;
identifier returns[value_attr = str(), type_attr = str()]:
Identifier;
operations:
Operations;
// Lexical section
Class: 'class';
Public: 'public';
Static: 'static';
Void: 'void';
Main: 'main';
String: 'String';
BraketOpen: '{';
BraketClose: '}';
ParOpen: '(';
ParClose: ')';
Int: 'int';
New: 'new';
Return: 'return';
If: 'if';
Boolean: 'boolean';
While: 'while';
Else: 'else';
Dot: '.';
Identifier: Letter LetterOrDigit*;
KeyWords:
'true'
| 'false'
| 'this';
Operations:
'&&' | '<' | '+' | '-' | '*';
IntegerLiteral:
[0-9] [0-9_]*;
fragment Letter
: [a-zA-Z$_]
| ~[\u0000-\u007F\uD800-\uDBFF]
| [\uD800-\uDBFF] [\uDC00-\uDFFF]
;
fragment LetterOrDigit
: Letter
| [0-9]
;
COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: '//' ~[\r\n]* -> channel(HIDDEN);
WS: [ \t\r\n\u000C]+ -> channel(HIDDEN); |
oeis/166/A166752.asm | neoneye/loda-programs | 11 | 12691 | <reponame>neoneye/loda-programs
; A166752: Interleave A007583 and A000012.
; 1,1,3,1,11,1,43,1,171,1,683,1,2731,1,10923,1,43691,1,174763,1,699051,1,2796203,1,11184811,1,44739243,1,178956971,1,715827883,1,2863311531,1,11453246123,1,45812984491,1,183251937963,1,733007751851,1,2932031007403,1,11728124029611,1,46912496118443,1,187649984473771,1,750599937895083,1,3002399751580331,1,12009599006321323,1,48038396025285291,1,192153584101141163,1,768614336404564651,1,3074457345618258603,1,12297829382473034411,1,49191317529892137643,1,196765270119568550571,1,787061080478274202283
mov $1,2
gcd $1,$0
pow $1,$0
div $1,3
mul $1,2
add $1,1
mov $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_934.asm | ljhsiun2/medusa | 9 | 174163 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r9
push %rax
push %rsi
lea addresses_normal_ht+0x1df6e, %rax
nop
inc %rsi
mov (%rax), %r9d
nop
nop
nop
nop
lfence
pop %rsi
pop %rax
pop %r9
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r9
push %rbx
push %rdi
push %rdx
push %rsi
// Faulty Load
lea addresses_RW+0xbf6e, %rsi
nop
nop
nop
nop
and $61999, %rdx
mov (%rsi), %r9
lea oracles, %r11
and $0xff, %r9
shlq $12, %r9
mov (%r11,%r9,1), %r9
pop %rsi
pop %rdx
pop %rdi
pop %rbx
pop %r9
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
Task/Phrase-reversals/Ada/phrase-reversals.ada | LaudateCorpus1/RosettaCodeData | 1 | 26104 | <reponame>LaudateCorpus1/RosettaCodeData<gh_stars>1-10
<with Ada.Text_IO, Simple_Parse;
procedure Phrase_Reversal is
function Reverse_String (Item : String) return String is
Result : String (Item'Range);
begin
for I in Item'range loop
Result (Result'Last - I + Item'First) := Item (I);
end loop;
return Result;
end Reverse_String;
function Reverse_Words(S: String) return String is
Cursor: Positive := S'First;
Word: String := Simple_Parse.Next_Word(S, Cursor);
begin
if Cursor > S'Last then -- Word holds the last word
return Reverse_String(Word);
else
return Reverse_String(Word) & " " & Reverse_Words(S(Cursor .. S'Last));
end if;
end Reverse_Words;
function Reverse_Order(S: String) return String is
Cursor: Positive := S'First;
Word: String := Simple_Parse.Next_Word(S, Cursor);
begin
if Cursor > S'Last then -- Word holds the last word
return Word;
else
return Reverse_Order(S(Cursor .. S'Last)) & " " & Word;
end if;
end Reverse_Order;
Phrase: String := "rosetta code phrase reversal";
use Ada.Text_IO;
begin
Put_Line("0. The original phrase: """ & Phrase & """");
Put_Line("1. Reverse the entire phrase: """ & Reverse_String(Phrase) & """");
Put_Line("2. Reverse words, same order: """ & Reverse_Words(Phrase) & """");
Put_Line("2. Reverse order, same words: """ & Reverse_Order(Phrase) & """");
end Phrase_Reversal;
|
game-mod/characters/kiki/states.asm | sgadrat/super-tilt-bro | 91 | 24529 | <filename>game-mod/characters/kiki/states.asm<gh_stars>10-100
;
; States index
;
KIKI_STATE_THROWN = PLAYER_STATE_THROWN
KIKI_STATE_RESPAWN = PLAYER_STATE_RESPAWN
KIKI_STATE_INNEXISTANT = PLAYER_STATE_INNEXISTANT
KIKI_STATE_SPAWN = PLAYER_STATE_SPAWN
KIKI_STATE_IDLE = PLAYER_STATE_STANDING
KIKI_STATE_RUNNING = PLAYER_STATE_RUNNING
KIKI_STATE_FALLING = CUSTOM_PLAYER_STATES_BEGIN + 0
KIKI_STATE_LANDING = CUSTOM_PLAYER_STATES_BEGIN + 1
KIKI_STATE_CRASHING = CUSTOM_PLAYER_STATES_BEGIN + 2
KIKI_STATE_HELPLESS = CUSTOM_PLAYER_STATES_BEGIN + 3
KIKI_STATE_JUMPING = CUSTOM_PLAYER_STATES_BEGIN + 4
KIKI_STATE_SHIELDING = CUSTOM_PLAYER_STATES_BEGIN + 5
KIKI_STATE_SHIELDLAG = CUSTOM_PLAYER_STATES_BEGIN + 6
KIKI_STATE_WALLJUMPING = CUSTOM_PLAYER_STATES_BEGIN + 7
KIKI_STATE_SIDE_TILT = CUSTOM_PLAYER_STATES_BEGIN + 8
KIKI_STATE_SIDE_SPE = CUSTOM_PLAYER_STATES_BEGIN + 9
KIKI_STATE_DOWN_WALL = CUSTOM_PLAYER_STATES_BEGIN + 10
KIKI_STATE_TOP_WALL = CUSTOM_PLAYER_STATES_BEGIN + 11
KIKI_STATE_UP_TILT = CUSTOM_PLAYER_STATES_BEGIN + 12
KIKI_STATE_UP_AERIAL = CUSTOM_PLAYER_STATES_BEGIN + 13
KIKI_STATE_DOWN_TILT = CUSTOM_PLAYER_STATES_BEGIN + 14
KIKI_STATE_DOWN_AERIAL = CUSTOM_PLAYER_STATES_BEGIN + 15
KIKI_STATE_SIDE_AERIAL = CUSTOM_PLAYER_STATES_BEGIN + 16
KIKI_STATE_JABBING = CUSTOM_PLAYER_STATES_BEGIN + 17
KIKI_STATE_NEUTRAL_AERIAL = CUSTOM_PLAYER_STATES_BEGIN + 18
KIKI_STATE_COUNTER_GUARD = CUSTOM_PLAYER_STATES_BEGIN + 19
KIKI_STATE_COUNTER_STRIKE = CUSTOM_PLAYER_STATES_BEGIN + 20
;
; Gameplay constants
;
KIKI_AERIAL_DIRECTIONAL_INFLUENCE_STRENGTH = $80
KIKI_AERIAL_SPEED = $0100
KIKI_AIR_FRICTION_STRENGTH = 7
KIKI_COUNTER_GRAVITY = $0100
KIKI_FASTFALL_SPEED = $0400
KIKI_GROUND_FRICTION_STRENGTH = $40
KIKI_JUMP_SQUAT_DURATION_PAL = 4
KIKI_JUMP_SQUAT_DURATION_NTSC = 5
KIKI_JUMP_SHORT_HOP_EXTRA_TIME_PAL = 4
KIKI_JUMP_SHORT_HOP_EXTRA_TIME_NTSC = 5
KIKI_JUMP_POWER = $0480
KIKI_JUMP_SHORT_HOP_POWER = $0102
KIKI_LANDING_MAX_VELOCITY = $0200
KIKI_MAX_NUM_AERIAL_JUMPS = 1
KIKI_MAX_WALLJUMPS = 1
KIKI_PLATFORM_DURATION = 100 ; Note, 106 (ntsc->127) is the max, we have only 7 bits to store the value
KIKI_PLATFORM_BLINK_THRESHOLD_MASK = %01100000 ; Platform is blinking if "timer > 0 && (MASK & timer == 0)"
KIKI_PLATFORM_BLINK_MASK = %00000100 ; Blinking platform is shown on frames where "MASK & timer == 1"
KIKI_RUNNING_INITIAL_VELOCITY = $0100
KIKI_RUNNING_MAX_VELOCITY = $0180
KIKI_RUNNING_ACCELERATION = $40
KIKI_TECH_SPEED = $0400
KIKI_WALL_JUMP_SQUAT_END = 4
KIKI_WALL_JUMP_VELOCITY_V = $03c0
KIKI_WALL_JUMP_VELOCITY_H = $0080
;
; Constants data
;
velocity_table(KIKI_AERIAL_SPEED, kiki_aerial_speed_msb, kiki_aerial_speed_lsb)
velocity_table(-KIKI_AERIAL_SPEED, kiki_aerial_neg_speed_msb, kiki_aerial_neg_speed_lsb)
acceleration_table(KIKI_AERIAL_DIRECTIONAL_INFLUENCE_STRENGTH, kiki_aerial_directional_influence_strength)
acceleration_table(KIKI_AIR_FRICTION_STRENGTH, kiki_air_friction_strength)
velocity_table(KIKI_FASTFALL_SPEED, kiki_fastfall_speed_msb, kiki_fastfall_speed_lsb)
acceleration_table(KIKI_GROUND_FRICTION_STRENGTH, kiki_ground_friction_strength)
acceleration_table(KIKI_GROUND_FRICTION_STRENGTH/3, kiki_ground_friction_strength_weak)
acceleration_table(KIKI_GROUND_FRICTION_STRENGTH*3, kiki_ground_friction_strength_strong)
velocity_table(KIKI_TECH_SPEED, kiki_tech_speed_msb, kiki_tech_speed_lsb)
velocity_table(-KIKI_TECH_SPEED, kiki_tech_speed_neg_msb, kiki_tech_speed_neg_lsb)
velocity_table(-KIKI_JUMP_POWER, kiki_jump_velocity_msb, kiki_jump_velocity_lsb)
velocity_table(-KIKI_JUMP_SHORT_HOP_POWER, kiki_jump_short_hop_velocity_msb, kiki_jump_short_hop_velocity_lsb)
duration_table(KIKI_PLATFORM_DURATION, kiki_platform_duration)
kiki_jumpsquat_duration:
.byt KIKI_JUMP_SQUAT_DURATION_PAL, KIKI_JUMP_SQUAT_DURATION_NTSC
kiki_short_hop_time:
.byt KIKI_JUMP_SQUAT_DURATION_PAL + KIKI_JUMP_SHORT_HOP_EXTRA_TIME_PAL, KIKI_JUMP_SQUAT_DURATION_NTSC + KIKI_JUMP_SHORT_HOP_EXTRA_TIME_NTSC
kiki_wall_attributes_per_player:
.byt 1, 3
kiki_first_wall_sprite_per_player:
.byt INGAME_PLAYER_A_LAST_SPRITE-1, INGAME_PLAYER_B_LAST_SPRITE-1
; Offset of 2 bytes reserved in player's object data for storing current platform sprites Y position on screen
kiki_first_wall_sprite_y_per_player:
.byt (player_a_objects-stage_data)+STAGE_ELEMENT_SIZE+1, (player_b_objects-stage_data)+STAGE_ELEMENT_SIZE+1
kiki_last_anim_sprite_per_player:
.byt INGAME_PLAYER_A_LAST_SPRITE-2, INGAME_PLAYER_B_LAST_SPRITE-2
kiki_first_tile_index_per_player:
.byt CHARACTERS_CHARACTER_A_FIRST_TILE, CHARACTERS_CHARACTER_B_FIRST_TILE
kiki_a_platform_state = player_a_state_field3 ; aTTT TTTT - a, allowed to create a new platform - T, platform timer
kiki_b_platform_state = player_b_state_field3
;
; Implementation
;
kiki_init:
.(
; Reserve two sprites for walls
.(
animation_state_vector = tmpfield2
; Animation's last sprite num = animation's last sprite num - 2
lda anim_last_sprite_num_per_player_lsb, x
sta animation_state_vector
lda anim_last_sprite_num_per_player_msb, x
sta animation_state_vector+1
ldy #0
lda kiki_last_anim_sprite_per_player, x
sta (animation_state_vector), y
; Same for out of screen indicator
lda oos_last_sprite_num_per_player_lsb, x
sta animation_state_vector
lda oos_last_sprite_num_per_player_msb, x
sta animation_state_vector+1
;ldy #0 ; useless, already set above
lda kiki_last_anim_sprite_per_player, x
sta (animation_state_vector), y
.)
; Set wall sprites attributes
.(
lda kiki_first_wall_sprite_per_player, x
asl
asl
tay
lda kiki_wall_attributes_per_player, x
sta oam_mirror+2, y ; First sprite attributes
sta oam_mirror+6, y ; Second sprite attributes
.)
; Init platform state
.(
lda #%10000000
sta kiki_a_platform_state, x
.)
; Setup player's elements
; - First byte is ELEMENT_END (deactivated platform)
; - Stop player's elements after the platform
.(
ldy #0
cpx #0
beq load_element
ldy #player_b_objects-player_a_objects
load_element:
lda #STAGE_ELEMENT_END
sta player_a_objects+0, y
sta player_a_objects+STAGE_ELEMENT_SIZE, y
.)
; Initialize walljump counter
lda #KIKI_MAX_WALLJUMPS
sta player_a_walljump, x
rts
;TODO may be optmizable
; storing the index of the byte from player_a_animation, means one byte per player
; and only have to load it in y and access the byte in "absolute,Y" instead of "(indirect),Y"
anim_last_sprite_num_per_player_msb:
.byt >player_a_animation+ANIMATION_STATE_OFFSET_LAST_SPRITE_NUM
.byt >player_b_animation+ANIMATION_STATE_OFFSET_LAST_SPRITE_NUM
anim_last_sprite_num_per_player_lsb:
.byt <player_a_animation+ANIMATION_STATE_OFFSET_LAST_SPRITE_NUM
.byt <player_b_animation+ANIMATION_STATE_OFFSET_LAST_SPRITE_NUM
oos_last_sprite_num_per_player_msb:
.byt >player_a_out_of_screen_indicator+ANIMATION_STATE_OFFSET_LAST_SPRITE_NUM
.byt >player_b_out_of_screen_indicator+ANIMATION_STATE_OFFSET_LAST_SPRITE_NUM
oos_last_sprite_num_per_player_lsb:
.byt <player_a_out_of_screen_indicator+ANIMATION_STATE_OFFSET_LAST_SPRITE_NUM
.byt <player_b_out_of_screen_indicator+ANIMATION_STATE_OFFSET_LAST_SPRITE_NUM
.)
kiki_netload:
.(
; NOTE performance can be improved by having a branch per player (avoiding "indirect, y" indexing)
ldy #0
cpx #0
beq load_element
ldy #player_b_objects-player_a_objects
load_element:
; Platform stage-element
lda RAINBOW_DATA
sta player_a_objects+0, y
lda RAINBOW_DATA
sta player_a_objects+1, y
lda RAINBOW_DATA
sta player_a_objects+2, y
lda RAINBOW_DATA
sta player_a_objects+3, y
lda RAINBOW_DATA
sta player_a_objects+4, y
lda RAINBOW_DATA
sta player_a_objects+5, y
lda RAINBOW_DATA
sta player_a_objects+6, y
lda RAINBOW_DATA
sta player_a_objects+7, y
lda RAINBOW_DATA
sta player_a_objects+8, y
#if STAGE_ELEMENT_SIZE <> 9
#error above code expects stage elements to be 9 bytes
#endif
; Y pos of the platform (kiki_first_wall_sprite_y_per_player)
lda RAINBOW_DATA
sta player_a_objects+10, y
lda RAINBOW_DATA
sta player_a_objects+11, y
; X pos of the platform tiles
lda kiki_first_wall_sprite_per_player, x
asl
asl
tay
lda RAINBOW_DATA
sta oam_mirror+3, y
lda RAINBOW_DATA
sta oam_mirror+4+3, y
; Platform tiles
lda RAINBOW_DATA
sta oam_mirror+1, y
lda RAINBOW_DATA
sta oam_mirror+4+1, y
; Ensure platform is correctly displayed
.(
; Shall be drawn if
; timer > blink threshold, or
; blink is in a visible tick
lda kiki_a_platform_state, x
and #KIKI_PLATFORM_BLINK_THRESHOLD_MASK
bne displayed
lda kiki_a_platform_state, x
and #KIKI_PLATFORM_BLINK_MASK
bne displayed
hidden:
jsr kiki_hide_platform
jmp end_place_platform
displayed:
jsr kiki_show_platform
end_place_platform:
.)
rts
.)
; Apply air or ground friction, depending on character being grounded
; Ground friction is less than normal, to allow some sliding
kiki_apply_friction_lite:
.(
lda player_a_grounded, x
beq air_friction
ground_friction:
lda #$00
sta tmpfield4
sta tmpfield3
sta tmpfield2
sta tmpfield1
ldy system_index
lda kiki_ground_friction_strength_weak, y
sta tmpfield5
jmp merge_to_player_velocity
; No return, jump to subroutine
air_friction:
jsr kiki_apply_air_friction
jmp apply_player_gravity
; No return, jump to subroutine
;rts ; useless, no branch returns
.)
; Input table for aerial moves, special values are
; fast_fall - mandatorily on INPUT_NONE to take effect on release of DOWN
; jump - automatically choose between aerial jump or wall jump
; no_input - expected default
!define "KIKI_AERIAL_INPUTS_TABLE" {
.(
controller_inputs:
.byt CONTROLLER_INPUT_NONE, CONTROLLER_INPUT_SPECIAL_RIGHT
.byt CONTROLLER_INPUT_SPECIAL_LEFT, CONTROLLER_INPUT_JUMP
.byt CONTROLLER_INPUT_JUMP_RIGHT, CONTROLLER_INPUT_JUMP_LEFT
.byt CONTROLLER_INPUT_ATTACK_LEFT, CONTROLLER_INPUT_ATTACK_RIGHT
.byt CONTROLLER_INPUT_DOWN_TILT, CONTROLLER_INPUT_ATTACK_UP
.byt CONTROLLER_INPUT_JAB, CONTROLLER_INPUT_SPECIAL
.byt CONTROLLER_INPUT_SPECIAL_UP, CONTROLLER_INPUT_SPECIAL_DOWN
.byt CONTROLLER_INPUT_ATTACK_UP_RIGHT, CONTROLLER_INPUT_ATTACK_UP_LEFT
.byt CONTROLLER_INPUT_SPECIAL_UP_RIGHT, CONTROLLER_INPUT_SPECIAL_UP_LEFT
.byt CONTROLLER_INPUT_ATTACK_DOWN_RIGHT, CONTROLLER_INPUT_ATTACK_DOWN_LEFT
.byt CONTROLLER_INPUT_SPECIAL_DOWN_RIGHT, CONTROLLER_INPUT_SPECIAL_DOWN_LEFT
controller_callbacks_lo:
.byt <fast_fall, <kiki_start_side_spe_right
.byt <kiki_start_side_spe_left, <jump
.byt <jump, <jump
.byt <kiki_start_side_aerial_left, <kiki_start_side_aerial_right
.byt <kiki_start_down_aerial, <kiki_start_up_aerial
.byt <kiki_start_neutral_aerial, <kiki_start_top_wall
.byt <kiki_start_down_wall, <kiki_start_counter_guard
.byt <kiki_start_up_aerial, <kiki_start_up_aerial
.byt <kiki_start_down_wall, <kiki_start_down_wall
.byt <kiki_start_down_aerial, <kiki_start_down_aerial
.byt <kiki_start_counter_guard, <kiki_start_counter_guard
controller_callbacks_hi:
.byt >fast_fall, >kiki_start_side_spe_right
.byt >kiki_start_side_spe_left, >jump
.byt >jump, >jump
.byt >kiki_start_side_aerial_left, >kiki_start_side_aerial_right
.byt >kiki_start_down_aerial, >kiki_start_up_aerial
.byt >kiki_start_neutral_aerial, >kiki_start_top_wall
.byt >kiki_start_down_wall, >kiki_start_counter_guard
.byt >kiki_start_up_aerial, >kiki_start_up_aerial
.byt >kiki_start_down_wall, >kiki_start_down_wall
.byt >kiki_start_down_aerial, >kiki_start_down_aerial
.byt >kiki_start_counter_guard, >kiki_start_counter_guard
controller_default_callback:
.word no_input
&INPUT_TABLE_LENGTH = controller_callbacks_lo - controller_inputs
.)
}
!include "std_aerial_input.asm"
kiki_hide_platform:
.(
; Hide platform (set sprites Y position offscreen)
lda kiki_first_wall_sprite_per_player, x
asl
asl
tay
lda #$fe
sta oam_mirror+4, y
sta oam_mirror, y
rts
.)
kiki_show_platform:
.(
; Show platform (set sprites Y position to the original one)
ldy kiki_first_wall_sprite_y_per_player, x
lda stage_data, y
pha
iny
lda stage_data, y
pha
lda kiki_first_wall_sprite_per_player, x
asl
asl
tay
pla
sta oam_mirror+4, y
pla
sta oam_mirror, y
rts
.)
kiki_global_tick:
.(
; Handle platform's lifetime
.(
lda kiki_a_platform_state, x
and #%01111111
beq destroy_platform
dec_timer:
; Decrement platform timer
sec
sbc #1
sta tmpfield1
lda kiki_a_platform_state, x
and #%10000000
ora tmpfield1
sta kiki_a_platform_state, x
jmp end_lifetime
destroy_platform:
; Destroy platform object
ldy #0
cpx #0
beq offset_ok
ldy #player_b_objects-player_a_objects
offset_ok:
#if STAGE_ELEMENT_END <> 0
#error this code expects STAGE_ELEMENT_END to be zero
#endif
;lda #STAGE_ELEMENT_END ; useless, ensured by beq
sta player_a_objects, y ; type
; useless, ensured by blinking
;; Hide platform sprites
;lda kiki_first_wall_sprite_per_player, x
;asl
;asl
;tay
;lda #$fe
;sta oam_mirror, y
;sta oam_mirror+4,y
end_lifetime:
.)
; Make platform blink on end of life
.(
;TODO ntsc timing, if it feels wrong with shared timing
; Do not blink until the platform is about to disapear
lda kiki_a_platform_state, x
tay
and #KIKI_PLATFORM_BLINK_THRESHOLD_MASK
bne end_blinking
tya
and #KIKI_PLATFORM_BLINK_MASK
beq hide
show:
jsr kiki_show_platform
jmp end_blinking
hide:
jsr kiki_hide_platform
end_blinking:
.)
; Call global on-ground
.(
; Do not reset if not on a legit stage platform
lda player_a_grounded, x
beq end_ground_reset ; Not on ground
jsr kiki_global_onground
end_ground_reset:
.)
rts
.)
kiki_global_onground:
.(
; Reinitialize walljump counter
lda #KIKI_MAX_WALLJUMPS
sta player_a_walljump, x
; Reset allowed flag on stage's ground (not on player-made platforms)
.(
lda player_a_grounded, x
cmp #player_a_objects-stage_data
bcs end_ground_reset ; Grounded on any player platform
; Set allowed flag
lda #%10000000
ora kiki_a_platform_state, x
sta kiki_a_platform_state, x
end_ground_reset:
.)
rts
.)
;
; Thrown
;
!include "std_thrown.asm"
;
; Respawn
;
.(
&kiki_start_respawn:
.(
; Set the player's state
lda #KIKI_STATE_RESPAWN
sta player_a_state, x
; Place player to the respawn spot
lda stage_data+STAGE_HEADER_OFFSET_RESPAWNX_HIGH
sta player_a_x, x
lda stage_data+STAGE_HEADER_OFFSET_RESPAWNX_LOW
sta player_a_x_low, x
lda stage_data+STAGE_HEADER_OFFSET_RESPAWNY_HIGH
sta player_a_y, x
lda stage_data+STAGE_HEADER_OFFSET_RESPAWNY_LOW
sta player_a_y_low, x
lda #$00
sta player_a_x_screen, x
sta player_a_y_screen, x
sta player_a_velocity_h, x
sta player_a_velocity_h_low, x
sta player_a_velocity_v, x
sta player_a_velocity_v_low, x
sta player_a_damages, x
; Initialise state's timer
ldy system_index
lda player_respawn_max_duration, y
sta player_a_state_field1, x
; Reinitialize walljump counter
lda #KIKI_MAX_WALLJUMPS
sta player_a_walljump, x
; Set the appropriate animation
lda #<kiki_anim_respawn
sta tmpfield13
lda #>kiki_anim_respawn
sta tmpfield14
jsr set_player_animation
rts
.)
&kiki_tick_respawn:
.(
jsr kiki_global_tick
; Check for timeout
dec player_a_state_field1, x
bne end
jmp kiki_start_falling
; No return, jump to subroutine
end:
rts
.)
&kiki_input_respawn:
.(
; Avoid doing anything until controller has returned to neutral since after
; death the player can release buttons without expecting to take action
lda controller_a_last_frame_btns, x
bne end
; Call kiki_check_aerial_inputs
; If it does not change the player state, go to falling state
; so that any button press makes the player falls from revival
; platform
jsr kiki_check_aerial_inputs
lda player_a_state, x
cmp #KIKI_STATE_RESPAWN
bne end
jmp kiki_start_falling
; No return, jump to subroutine
end:
rts
.)
.)
;
; Innexistant
;
.(
&kiki_start_innexistant:
.(
; Set the player's state
lda #KIKI_STATE_INNEXISTANT
sta player_a_state, x
; Set to a fixed place
lda #0
sta player_a_x_screen, x
sta player_a_x, x
sta player_a_x_low, x
sta player_a_y_screen, x
sta player_a_y, x
sta player_a_y_low, x
sta player_a_velocity_h, x
sta player_a_velocity_h_low, x
sta player_a_velocity_v, x
sta player_a_velocity_v_low, x
; Set the appropriate animation
lda #<anim_invisible
sta tmpfield13
lda #>anim_invisible
sta tmpfield14
jmp set_player_animation
; No return, jump to subroutine
rts
.)
.)
;
; Spawn
;
.(
spawn_duration:
.byt kiki_anim_spawn_dur_pal, kiki_anim_spawn_dur_ntsc
#if kiki_anim_spawn_dur_pal <> 50
#error incorrect spawn duration
#endif
#if kiki_anim_spawn_dur_ntsc <> 60
#error incorrect spawn duration (ntsc only)
#endif
&kiki_start_spawn:
.(
; Hack - there is no ensured call to a character init function
; expect start_spawn to be called once at the begining of a game
jsr kiki_init
; Set the player's state
lda #KIKI_STATE_SPAWN
sta player_a_state, x
; Reset clock
ldy system_index
lda spawn_duration, y
sta player_a_state_clock, x
; Set the appropriate animation
lda #<kiki_anim_spawn
sta tmpfield13
lda #>kiki_anim_spawn
sta tmpfield14
jmp set_player_animation
;rts ; useless, jump to subroutine
.)
&kiki_tick_spawn:
.(
jsr kiki_global_tick
dec player_a_state_clock, x
bne tick
jmp kiki_start_idle
; No return, jump to subroutine
tick:
rts
.)
.)
;
; Idle
;
; Choose between falling or idle depending if grounded
kiki_start_inactive_state:
.(
lda player_a_grounded, x
bne idle
fall:
jmp kiki_start_falling
; No return, jump to subroutine
idle:
; Fallthrough to kiki_start_idle
.)
.(
&kiki_start_idle:
.(
; Set the player's state
lda #KIKI_STATE_IDLE
sta player_a_state, x
; Set the appropriate animation
lda #<kiki_anim_idle
sta tmpfield13
lda #>kiki_anim_idle
sta tmpfield14
jsr set_player_animation
rts
.)
&kiki_tick_idle:
.(
jsr kiki_global_tick
; Do not move, velocity tends toward vector (0,0)
lda #$00
sta tmpfield4
sta tmpfield3
sta tmpfield2
sta tmpfield1
lda #$ff
sta tmpfield5
jsr merge_to_player_velocity
; Force handling directional controls
; we want to start running even if button presses where maintained from previous state
lda controller_a_btns, x
cmp #CONTROLLER_INPUT_LEFT
bne no_left
jsr kiki_input_idle_left
jmp end
no_left:
cmp #CONTROLLER_INPUT_RIGHT
bne end
jsr kiki_input_idle_right
end:
rts
.)
&kiki_input_idle:
.(
; Do not handle any input if under hitstun
lda player_a_hitstun, x
bne end
; Check state changes
lda #<input_table
sta tmpfield1
lda #>input_table
sta tmpfield2
lda #INPUT_TABLE_LENGTH
sta tmpfield3
jmp controller_callbacks
end:
rts
input_table:
.(
controller_inputs:
.byt CONTROLLER_INPUT_LEFT, CONTROLLER_INPUT_RIGHT
.byt CONTROLLER_INPUT_JUMP, CONTROLLER_INPUT_JUMP_RIGHT
.byt CONTROLLER_INPUT_JUMP_LEFT, CONTROLLER_INPUT_ATTACK_RIGHT
.byt CONTROLLER_INPUT_ATTACK_LEFT, CONTROLLER_INPUT_SPECIAL_RIGHT
.byt CONTROLLER_INPUT_SPECIAL_LEFT, CONTROLLER_INPUT_TECH
.byt CONTROLLER_INPUT_SPECIAL_DOWN, CONTROLLER_INPUT_SPECIAL_UP
.byt CONTROLLER_INPUT_ATTACK_UP, CONTROLLER_INPUT_DOWN_TILT
.byt CONTROLLER_INPUT_JAB, CONTROLLER_INPUT_SPECIAL
.byt CONTROLLER_INPUT_TECH_LEFT, CONTROLLER_INPUT_TECH_RIGHT
.byt CONTROLLER_INPUT_SPECIAL_UP_LEFT, CONTROLLER_INPUT_SPECIAL_UP_RIGHT
.byt CONTROLLER_INPUT_ATTACK_UP_LEFT, CONTROLLER_INPUT_ATTACK_UP_RIGHT
.byt CONTROLLER_INPUT_SPECIAL_DOWN_LEFT, CONTROLLER_INPUT_SPECIAL_DOWN_RIGHT
.byt CONTROLLER_INPUT_ATTACK_DOWN_LEFT, CONTROLLER_INPUT_ATTACK_DOWN_RIGHT
controller_callbacks_lsb:
.byt <kiki_input_idle_left, <kiki_input_idle_right
.byt <kiki_start_jumping, <kiki_input_idle_jump_right
.byt <kiki_input_idle_jump_left, <kiki_start_side_tilt_right
.byt <kiki_start_side_tilt_left, <kiki_start_side_spe_right
.byt <kiki_start_side_spe_left, <kiki_start_shielding
.byt <kiki_start_counter_guard, <kiki_start_down_wall
.byt <kiki_start_up_tilt, <kiki_start_down_tilt
.byt <kiki_start_jabbing, <kiki_start_top_wall
.byt <kiki_start_shielding, <kiki_start_shielding
.byt <kiki_start_down_wall, <kiki_start_down_wall
.byt <kiki_start_up_tilt, <kiki_start_up_tilt
.byt <kiki_start_counter_guard, <kiki_start_counter_guard
.byt <kiki_start_down_tilt, <kiki_start_down_tilt
controller_callbacks_msb:
.byt >kiki_input_idle_left, >kiki_input_idle_right
.byt >kiki_start_jumping, >kiki_input_idle_jump_right
.byt >kiki_input_idle_jump_left, >kiki_start_side_tilt_right
.byt >kiki_start_side_tilt_left, >kiki_start_side_spe_right
.byt >kiki_start_side_spe_left, >kiki_start_shielding
.byt >kiki_start_counter_guard, >kiki_start_down_wall
.byt >kiki_start_up_tilt, >kiki_start_down_tilt
.byt >kiki_start_jabbing, >kiki_start_top_wall
.byt >kiki_start_shielding, >kiki_start_shielding
.byt >kiki_start_down_wall, >kiki_start_down_wall
.byt >kiki_start_up_tilt, >kiki_start_up_tilt
.byt >kiki_start_counter_guard, >kiki_start_counter_guard
.byt >kiki_start_down_tilt, >kiki_start_down_tilt
controller_default_callback:
.word end
&INPUT_TABLE_LENGTH = controller_callbacks_lsb - controller_inputs
.)
kiki_input_idle_jump_right:
.(
lda DIRECTION_RIGHT
sta player_a_direction, x
jmp kiki_start_jumping
;rts ; useless - kiki_start_jumping is a routine
.)
kiki_input_idle_jump_left:
.(
lda DIRECTION_LEFT
sta player_a_direction, x
jmp kiki_start_jumping
;rts ; useless - kiki_start_jumping is a routine
.)
.)
kiki_input_idle_left:
.(
lda DIRECTION_LEFT
sta player_a_direction, x
jmp kiki_start_running
;rts ; useless, jump to subroutine
.)
kiki_input_idle_right:
.(
lda DIRECTION_RIGHT
sta player_a_direction, x
jmp kiki_start_running
;rts ; useless, jump to subroutine
.)
.)
;
; Running
;
.(
velocity_table(KIKI_RUNNING_INITIAL_VELOCITY, run_init_velocity_msb, run_init_velocity_lsb)
velocity_table(-KIKI_RUNNING_INITIAL_VELOCITY, run_init_neg_velocity_msb, run_init_neg_velocity_lsb)
velocity_table(KIKI_RUNNING_MAX_VELOCITY, run_max_velocity_msb, run_max_velocity_lsb)
velocity_table(-KIKI_RUNNING_MAX_VELOCITY, run_max_neg_velocity_msb, run_max_neg_velocity_lsb)
acceleration_table(KIKI_RUNNING_ACCELERATION, run_acceleration)
&kiki_start_running:
.(
; Set the player's state
lda #KIKI_STATE_RUNNING
sta player_a_state, x
; Set initial velocity
ldy system_index
lda player_a_direction, x
cmp DIRECTION_LEFT
bne direction_right
direction_left:
lda run_init_neg_velocity_lsb, y
sta player_a_velocity_h_low, x
lda run_init_neg_velocity_msb, y
jmp set_high_byte
direction_right:
lda run_init_velocity_lsb, y
sta player_a_velocity_h_low, x
lda run_init_velocity_msb, y
set_high_byte:
sta player_a_velocity_h, x
; Fallthrough to set animation
.)
kiki_set_running_animation:
.(
; Set the appropriate animation
lda #<kiki_anim_run
sta tmpfield13
lda #>kiki_anim_run
sta tmpfield14
jmp set_player_animation
;rts ; useless, jump to subroutine
.)
&kiki_tick_running:
.(
jsr kiki_global_tick
; Update player's velocity dependeing on his direction
ldy system_index
lda player_a_direction, x
beq run_left
; Running right, velocity tends toward vector max velocity
lda run_max_velocity_msb, y
sta tmpfield4
lda run_max_velocity_lsb, y
jmp update_velocity
run_left:
; Running left, velocity tends toward vector "-1 * max volcity"
lda run_max_neg_velocity_msb, y
sta tmpfield4
lda run_max_neg_velocity_lsb, y
update_velocity:
sta tmpfield2
lda #0
sta tmpfield3
sta tmpfield1
lda run_acceleration, y
sta tmpfield5
jsr merge_to_player_velocity
end:
rts
.)
&kiki_input_running:
.(
; If in hitstun, stop running
lda player_a_hitstun, x
beq take_input
jsr kiki_start_idle
jmp end
take_input:
; Check state changes
lda #<input_table
sta tmpfield1
lda #>input_table
sta tmpfield2
lda #INPUT_TABLE_LENGTH
sta tmpfield3
jmp controller_callbacks
end:
rts
kiki_input_running_left:
.(
lda DIRECTION_LEFT
cmp player_a_direction, x
beq end_changing_direction
sta player_a_direction, x
jsr kiki_set_running_animation
end_changing_direction:
rts
.)
kiki_input_running_right:
.(
lda DIRECTION_RIGHT
cmp player_a_direction, x
beq end_changing_direction
sta player_a_direction, x
jsr kiki_set_running_animation
end_changing_direction:
rts
.)
input_table:
.(
controller_inputs:
.byt CONTROLLER_INPUT_LEFT, CONTROLLER_INPUT_RIGHT
.byt CONTROLLER_INPUT_JUMP, CONTROLLER_INPUT_JUMP_RIGHT
.byt CONTROLLER_INPUT_JUMP_LEFT, CONTROLLER_INPUT_ATTACK_LEFT
.byt CONTROLLER_INPUT_ATTACK_RIGHT, CONTROLLER_INPUT_SPECIAL_LEFT
.byt CONTROLLER_INPUT_SPECIAL_RIGHT, CONTROLLER_INPUT_TECH
.byt CONTROLLER_INPUT_SPECIAL_DOWN, CONTROLLER_INPUT_SPECIAL_UP
.byt CONTROLLER_INPUT_ATTACK_UP, CONTROLLER_INPUT_DOWN_TILT
.byt CONTROLLER_INPUT_JAB, CONTROLLER_INPUT_SPECIAL
.byt CONTROLLER_INPUT_TECH_LEFT, CONTROLLER_INPUT_TECH_RIGHT
.byt CONTROLLER_INPUT_SPECIAL_UP_LEFT, CONTROLLER_INPUT_SPECIAL_UP_RIGHT
.byt CONTROLLER_INPUT_ATTACK_UP_LEFT, CONTROLLER_INPUT_ATTACK_UP_RIGHT
.byt CONTROLLER_INPUT_SPECIAL_DOWN_LEFT, CONTROLLER_INPUT_SPECIAL_DOWN_RIGHT
.byt CONTROLLER_INPUT_ATTACK_DOWN_LEFT, CONTROLLER_INPUT_ATTACK_DOWN_RIGHT
controller_callbacks_lsb:
.byt <kiki_input_running_left, <kiki_input_running_right
.byt <kiki_start_jumping, <kiki_start_jumping
.byt <kiki_start_jumping, <kiki_start_side_tilt_left
.byt <kiki_start_side_tilt_right, <kiki_start_side_spe_left
.byt <kiki_start_side_spe_right, <kiki_start_shielding
.byt <kiki_start_counter_guard, <kiki_start_down_wall
.byt <kiki_start_up_tilt, <kiki_start_down_tilt
.byt <kiki_start_jabbing, <kiki_start_top_wall
.byt <kiki_start_shielding, <kiki_start_shielding
.byt <kiki_start_down_wall, <kiki_start_down_wall
.byt <kiki_start_up_tilt, <kiki_start_up_tilt
.byt <kiki_start_counter_guard, <kiki_start_counter_guard
.byt <kiki_start_down_tilt, <kiki_start_down_tilt
controller_callbacks_msb:
.byt >kiki_input_running_left, >kiki_input_running_right
.byt >kiki_start_jumping, >kiki_start_jumping
.byt >kiki_start_jumping, >kiki_start_side_tilt_left
.byt >kiki_start_side_tilt_right, >kiki_start_side_spe_left
.byt >kiki_start_side_spe_right, >kiki_start_shielding
.byt >kiki_start_counter_guard, >kiki_start_down_wall
.byt >kiki_start_up_tilt, >kiki_start_down_tilt
.byt >kiki_start_jabbing, >kiki_start_top_wall
.byt >kiki_start_shielding, >kiki_start_shielding
.byt >kiki_start_down_wall, >kiki_start_down_wall
.byt >kiki_start_up_tilt, >kiki_start_up_tilt
.byt >kiki_start_counter_guard, >kiki_start_counter_guard
.byt >kiki_start_down_tilt, >kiki_start_down_tilt
controller_default_callback:
.word kiki_start_idle
&INPUT_TABLE_LENGTH = controller_callbacks_lsb - controller_inputs
.)
.)
.)
;
; Jumping
;
.(
&kiki_start_jumping:
.(
lda #KIKI_STATE_JUMPING
sta player_a_state, x
lda #0
sta player_a_state_field1, x
sta player_a_state_clock, x
jsr audio_play_jump
; Set the appropriate animation
lda #<kiki_anim_jump
sta tmpfield13
lda #>kiki_anim_jump
sta tmpfield14
jmp set_player_animation
;rts ; useless, jump to subroutine
.)
&kiki_tick_jumping:
.(
jsr kiki_global_tick
; Tick clock
inc player_a_state_clock, x
; Wait for the preparation to end to begin to jump
ldy system_index
lda player_a_state_clock, x
cmp kiki_jumpsquat_duration, y
bcc end
beq begin_to_jump
; Handle short-hop input
cmp kiki_short_hop_time, y
beq stop_short_hop
; Check if the top of the jump is reached
lda player_a_velocity_v, x
beq top_reached
bpl top_reached
; The top is not reached, stay in jumping state but apply gravity and directional influence
moving_upward:
jmp kiki_tick_falling ; Hack - We just use kiki_tick_falling which do exactly what we want
; No return, jump to subroutine
; The top is reached, return to falling
top_reached:
jmp kiki_start_falling
; No return, jump to subroutine
; If the jump button is no more pressed mid jump, convert the jump to a short-hop
stop_short_hop:
; Handle this tick as any other
jsr kiki_tick_falling
; If the jump button is still pressed, this is not a short-hop
lda controller_a_btns, x
and #CONTROLLER_INPUT_JUMP
bne end
; Reduce upward momentum to end the jump earlier
ldy system_index
lda kiki_jump_short_hop_velocity_msb, y
sta player_a_velocity_v, x
lda kiki_jump_short_hop_velocity_lsb, y
sta player_a_velocity_v_low, x
rts
; No return
; Put initial jumping velocity
begin_to_jump:
ldy system_index
lda kiki_jump_velocity_msb, y
sta player_a_velocity_v, x
lda kiki_jump_velocity_lsb, y
sta player_a_velocity_v_low, x
;jmp end ; Useless, fallthrough
end:
rts
.)
&kiki_input_jumping:
.(
; The jump is cancellable by grounded movements during preparation
; and by aerial movements after that
lda player_a_num_aerial_jumps, x ; performing aerial jump, not
bne not_grounded ; grounded
ldy system_index
lda player_a_state_clock, x ;
cmp kiki_jumpsquat_duration, y ; Still preparing the jump
bcc grounded ;
not_grounded:
jsr kiki_check_aerial_inputs
jmp end
grounded:
lda #<(input_table+1)
sta tmpfield1
lda #>(input_table+1)
sta tmpfield2
lda input_table
sta tmpfield3
jmp controller_callbacks
end:
rts
input_table:
.(
; Impactful controller states and associated callbacks (when still grounded)
; Note - We can put subroutines as callbacks because we have nothing to do after calling it
; (sourboutines return to our caller since "called" with jmp)
table_length:
.byt 2
controller_inputs:
.byt CONTROLLER_INPUT_ATTACK_UP, CONTROLLER_INPUT_SPECIAL_UP
controller_callbacks_lo:
.byt <kiki_start_up_tilt, <kiki_start_down_wall
controller_callbacks_hi:
.byt >kiki_start_up_tilt, >kiki_start_down_wall
controller_default_callback:
.word end
.)
.)
.)
.(
&kiki_start_aerial_jumping:
.(
; Deny to start jump state if the player used all it's jumps
lda #KIKI_MAX_NUM_AERIAL_JUMPS
cmp player_a_num_aerial_jumps, x
bne jump_ok
rts
jump_ok:
inc player_a_num_aerial_jumps, x
; Reset fall speed
jsr reset_default_gravity
; Trick - aerial_jumping set the state to jumping. It is the same state with
; the starting conditions as the only differences
lda #KIKI_STATE_JUMPING
sta player_a_state, x
; Reset clock
lda #0
sta player_a_state_clock, x
;lda #0
sta player_a_velocity_v, x
sta player_a_velocity_v_low, x
; Play SFX
jsr audio_play_aerial_jump
; Set the appropriate animation
;TODO use aerial_jump animation
lda #<kiki_anim_jump
sta tmpfield13
lda #>kiki_anim_jump
sta tmpfield14
jmp set_player_animation
;rts ; useless, jump to subroutine
.)
.)
.(
&kiki_start_falling:
.(
lda #KIKI_STATE_FALLING
sta player_a_state, x
; Set the appropriate animation
lda #<kiki_anim_falling
sta tmpfield13
lda #>kiki_anim_falling
sta tmpfield14
jmp set_player_animation
;rts ; useless, jump to subroutine
.)
&kiki_tick_falling:
.(
jsr kiki_global_tick
jsr kiki_aerial_directional_influence
jmp apply_player_gravity
;rts ; useless, jump to subroutine
.)
.)
;
; Landing
;
.(
landing_duration:
.byt kiki_anim_landing_dur_pal, kiki_anim_landing_dur_ntsc
velocity_table(KIKI_LANDING_MAX_VELOCITY, land_max_velocity_msb, land_max_velocity_lsb)
velocity_table(-KIKI_LANDING_MAX_VELOCITY, land_max_neg_velocity_msb, land_max_neg_velocity_lsb)
&kiki_start_teching:
.(
jsr audio_play_tech
jmp kiki_start_landing_common
.)
&kiki_start_landing:
.(
jsr audio_play_land
; Fallthrough
.)
kiki_start_landing_common:
.(
; Set state
lda #KIKI_STATE_LANDING
sta player_a_state, x
; Reset clock
lda #0
sta player_a_state_clock, x
; Cap initial velocity
ldy system_index
lda player_a_velocity_h, x
bmi negative_cap
positive_cap:
.(
; Check wether to cap or not
lda land_max_velocity_msb, y
cmp player_a_velocity_h, x
bcc do_cap ; msb(max) < msb(velocity)
bne ok ; msb(max) > msb(velocity)
lda player_a_velocity_h_low, x
cmp land_max_velocity_lsb, y
bcc ok ; lsb(velocity) < lsb(max)
do_cap:
lda land_max_velocity_msb, y
sta player_a_velocity_h, x
lda land_max_velocity_lsb, y
sta player_a_velocity_h_low, x
ok:
jmp kiki_set_landing_animation
.)
negative_cap:
.(
; Check wether to cap or not - negative, we have to cap if unsigned CMP is lower than "max"
lda player_a_velocity_h, x
cmp land_max_velocity_msb, y
bcc do_cap ; msb(velocity) < msb(max)
bne ok ; msb(velocity) > msb(max)
lda land_max_velocity_lsb, y
cmp player_a_velocity_h_low, x
bcc ok ; lsb(max) < lsb(velocity)
do_cap:
lda land_max_neg_velocity_msb, y
sta player_a_velocity_h, x
lda land_max_neg_velocity_lsb, y
sta player_a_velocity_h_low, x
ok:
.)
; Fallthrough to set the animation
.)
kiki_set_landing_animation:
.(
; Set the appropriate animation
lda #<kiki_anim_landing
sta tmpfield13
lda #>kiki_anim_landing
sta tmpfield14
jmp set_player_animation
;rts ; useless, jump to subroutine
.)
&kiki_tick_landing:
.(
jsr kiki_global_tick
; Tick clock
inc player_a_state_clock, x
; Do not move, velocity tends toward vector (0,0)
jsr kiki_apply_ground_friction
; After move's time is out, go to standing state
ldy system_index
lda player_a_state_clock, x
cmp landing_duration, y
bne end
jmp kiki_start_inactive_state
; No return, jump to subroutine
end:
rts
.)
.)
;
; Crashing
;
.(
crashing_duration:
.byt kiki_anim_crash_dur_pal, kiki_anim_crash_dur_ntsc
&kiki_start_crashing:
.(
; Set state
lda #KIKI_STATE_CRASHING
sta player_a_state, x
; Reset clock
lda #0
sta player_a_state_clock, x
; Set the appropriate animation
lda #<kiki_anim_crash
sta tmpfield13
lda #>kiki_anim_crash
sta tmpfield14
jsr set_player_animation
; Play crash sound
jmp audio_play_crash
;rts ; useless, jump to subroutine
.)
&kiki_tick_crashing:
.(
jsr kiki_global_tick
; Tick clock
inc player_a_state_clock, x
; Do not move, velocity tends toward vector (0,0)
lda #$00
sta tmpfield4
sta tmpfield3
sta tmpfield2
sta tmpfield1
ldy system_index
lda kiki_ground_friction_strength_strong, y
sta tmpfield5
jsr merge_to_player_velocity
; After move's time is out, go to standing state
lda player_a_state_clock, x
ldy system_index
cmp crashing_duration, y
bne end
jmp kiki_start_inactive_state
; No return, jump to subroutine
end:
rts
.)
.)
.(
&kiki_start_helpless:
.(
; Set state
lda #KIKI_STATE_HELPLESS
sta player_a_state, x
; Set the appropriate animation
lda #<kiki_anim_helpless
sta tmpfield13
lda #>kiki_anim_helpless
sta tmpfield14
jsr set_player_animation
rts
.)
&kiki_tick_helpless:
.(
jsr kiki_global_tick
jmp kiki_tick_falling
.)
&kiki_input_helpless:
.(
; Allow to escape helpless mode with a walljump, else keep input dirty
lda player_a_walled, x
beq no_jump
lda player_a_walljump, x
beq no_jump
jump:
lda player_a_walled_direction, x
sta player_a_direction, x
jmp kiki_start_walljumping
no_jump:
jmp keep_input_dirty
;rts ; useless, both branches jump to a subroutine
.)
.)
;
; Shielding
;
.(
&kiki_start_shielding:
.(
; Set state
lda #KIKI_STATE_SHIELDING
sta player_a_state, x
; Reset clock
lda #0
sta player_a_state_clock, x
; Set the appropriate animation
lda #<kiki_anim_shield_full
sta tmpfield13
lda #>kiki_anim_shield_full
sta tmpfield14
jsr set_player_animation
; Cancel momentum
lda #$00
sta player_a_velocity_h_low, x
sta player_a_velocity_h, x
; Set shield as full life
lda #2
sta player_a_state_field1, x
rts
.)
&kiki_tick_shielding:
.(
jsr kiki_global_tick
; Tick clock
lda player_a_state_clock, x
cmp #PLAYER_DOWN_TAP_MAX_DURATION
bcs end_tick
inc player_a_state_clock, x
end_tick:
rts
.)
&kiki_input_shielding:
.(
; Maintain down to stay on shield
; Ignore left/right as they are too susceptible to be pressed unvoluntarily on a lot of gamepads
; Down-a and down-b are allowed as out of shield moves
; Any other combination ends the shield (with shield lag or falling from smooth platform)
lda controller_a_btns, x
and #CONTROLLER_BTN_A+CONTROLLER_BTN_B+CONTROLLER_BTN_UP+CONTROLLER_BTN_DOWN
cmp #CONTROLLER_INPUT_TECH
beq end
cmp #CONTROLLER_INPUT_DOWN_TILT
beq handle_input
cmp #CONTROLLER_INPUT_SPECIAL_DOWN
beq handle_input
end_shield:
lda #PLAYER_DOWN_TAP_MAX_DURATION
cmp player_a_state_clock, x
beq shieldlag
bcc shieldlag
ldy player_a_grounded, x
beq shieldlag
lda stage_data, y
cmp #STAGE_ELEMENT_PLATFORM
beq shieldlag
cmp #STAGE_ELEMENT_OOS_PLATFORM
beq shieldlag
fall_from_smooth:
; HACK - "position = position + 2" to compensate collision system not handling subpixels and "position + 1" being the collision line
; actually, "position = position + 3" to compensate for moving platforms that move down
; Better solution would be to have an intermediary player state with a specific animation
clc
lda player_a_y, x
adc #3
sta player_a_y, x
lda player_a_y_screen, x
adc #0
sta player_a_y_screen, x
jmp kiki_start_falling
; No return, jump to subroutine
shieldlag:
jmp kiki_start_shieldlag
; No return, jump to subroutine
handle_input:
jmp kiki_input_idle
; No return, jump to subroutine
end:
rts
.)
&kiki_hurt_shielding:
.(
stroke_player = tmpfield11
; Reduce shield's life
dec player_a_state_field1, x
; Select what to do according to shield's life
lda player_a_state_field1, x
beq limit_shield
cmp #1
beq partial_shield
; Break the shield, derived from normal hurt with:
; Knockback * 2
; Screen shaking * 4
; Special sound
jsr hurt_player
ldx stroke_player
asl player_a_velocity_h_low, x
rol player_a_velocity_h, x
asl player_a_velocity_v_low, x
rol player_a_velocity_v, x
asl player_a_hitstun, x
asl screen_shake_counter
asl screen_shake_counter
jsr audio_play_shield_break
jmp end
partial_shield:
; Get the animation corresponding to the shield's life
lda #<kiki_anim_shield_partial
sta tmpfield13
lda #>kiki_anim_shield_partial
jmp still_shield
limit_shield:
; Get the animation corresponding to the shield's life
lda #<kiki_anim_shield_limit
sta tmpfield13
lda #>kiki_anim_shield_limit
still_shield:
; Set the new shield animation
sta tmpfield14
jsr set_player_animation
; Play sound
jsr audio_play_shield_hit
end:
; Disable the hitbox to avoid multi-hits
jsr switch_selected_player
lda HITBOX_DISABLED
sta player_a_hitbox_enabled, x
rts
.)
.)
.(
shieldlag_duration:
.byt kiki_anim_shield_remove_dur_pal, kiki_anim_shield_remove_dur_ntsc
&kiki_start_shieldlag:
.(
; Set state
lda #KIKI_STATE_SHIELDLAG
sta player_a_state, x
; Reset clock
ldy system_index
lda shieldlag_duration, y
sta player_a_state_clock, x
; Set the appropriate animation
lda #<kiki_anim_shield_remove
sta tmpfield13
lda #>kiki_anim_shield_remove
sta tmpfield14
jsr set_player_animation
rts
.)
&kiki_tick_shieldlag:
.(
jsr kiki_global_tick
dec player_a_state_clock, x
bne tick
jmp kiki_start_inactive_state
; No return, jump to subroutine
tick:
jmp kiki_apply_ground_friction
;rts ; useless, jump to subroutine
.)
.)
.(
velocity_table(-KIKI_WALL_JUMP_VELOCITY_V, kiki_wall_jump_velocity_v_msb, kiki_wall_jump_velocity_v_lsb)
velocity_table(KIKI_WALL_JUMP_VELOCITY_H, kiki_wall_jump_velocity_h_msb, kiki_wall_jump_velocity_h_lsb)
velocity_table(-KIKI_WALL_JUMP_VELOCITY_H, kiki_wall_jump_velocity_h_neg_msb, kiki_wall_jump_velocity_h_neg_lsb)
&kiki_start_walljumping:
.(
; Deny to start jump state if the player used all it's jumps
;lda player_a_walljump, x ; useless, all calls to kiki_start_walljumping actually do this check
;beq end
; Update wall jump counter
dec player_a_walljump, x
; Set player's state
lda #KIKI_STATE_WALLJUMPING
sta player_a_state, x
; Reset clock
lda #0
sta player_a_state_clock, x
; Stop any momentum, kiki does not fall during jumpsquat
sta player_a_velocity_h, x
sta player_a_velocity_h_low, x
sta player_a_velocity_v, x
sta player_a_velocity_v_low, x
; Reset fall speed
jsr reset_default_gravity
; Play SFX
jsr audio_play_jump
; Set the appropriate animation
;TODO specific animation
lda #<kiki_anim_jump
sta tmpfield13
lda #>kiki_anim_jump
sta tmpfield14
jsr set_player_animation
end:
rts
.)
&kiki_tick_walljumping:
.(
jsr kiki_global_tick
; Tick clock
inc player_a_state_clock, x
; Wait for the preparation to end to begin to jump
lda player_a_state_clock, x
cmp #KIKI_WALL_JUMP_SQUAT_END
bcc end
beq begin_to_jump
; Check if the top of the jump is reached
lda player_a_velocity_v, x
beq top_reached
bpl top_reached
; The top is not reached, stay in walljumping state but apply gravity, without directional influence
jmp apply_player_gravity
;jmp end ; useless, jump to a subroutine
; The top is reached, return to falling
top_reached:
jmp kiki_start_falling
;jmp end ; useless, jump to a subroutine
; Put initial jumping velocity
begin_to_jump:
; Vertical velocity
ldy system_index
lda kiki_wall_jump_velocity_v_msb, y
sta player_a_velocity_v, x
lda kiki_wall_jump_velocity_v_lsb, y
sta player_a_velocity_v_low, x
; Horizontal velocity
lda player_a_direction, x
;cmp DIRECTION_LEFT ; useless while DIRECTION_LEFT is $00
bne jump_right
jump_left:
lda kiki_wall_jump_velocity_h_neg_lsb, y
sta player_a_velocity_h_low, x
lda kiki_wall_jump_velocity_h_neg_msb, y
jmp end_jump_direction
jump_right:
lda kiki_wall_jump_velocity_h_lsb, y
sta player_a_velocity_h_low, x
lda kiki_wall_jump_velocity_h_msb, y
end_jump_direction:
sta player_a_velocity_h, x
;jmp end ; useless, fallthrough
end:
rts
.)
&kiki_input_walljumping:
.(
; The jump is cancellable by aerial movements, but only after preparation
lda #KIKI_WALL_JUMP_SQUAT_END
cmp player_a_state_clock, x
bcs grounded
not_grounded:
jmp kiki_check_aerial_inputs
; no return, jump to a subroutine
grounded:
rts
.)
.)
.(
kiki_anim_strike_duration:
.byt kiki_anim_strike_dur_pal, kiki_anim_strike_dur_ntsc
&kiki_start_side_tilt_right:
.(
lda DIRECTION_RIGHT
sta player_a_direction, x
jmp kiki_start_side_tilt
; rts ; useless - kiki_start_side_tilt is a routine
.)
&kiki_start_side_tilt_left:
.(
lda DIRECTION_LEFT
sta player_a_direction, x
; jmp kiki_start_side_tilt ; useless - fallthrough
; rts ; useless - kiki_start_side_tilt is a routine
.)
&kiki_start_side_tilt:
.(
; Set the appropriate animation
lda #<kiki_anim_strike
sta tmpfield13
lda #>kiki_anim_strike
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_SIDE_TILT
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
rts
.)
&kiki_tick_side_tilt:
.(
jsr kiki_global_tick
inc player_a_state_clock, x
ldy system_index
lda player_a_state_clock, x
cmp kiki_anim_strike_duration, y
bne update_velocity
jmp kiki_start_idle
; No return, jump to subroutine
update_velocity:
jmp kiki_apply_ground_friction
; No return, jump to subroutine
;rts ; useless, no branch return
.)
.)
.(
KIKI_WALL_WHIFF = 0
KIKI_WALL_DRAWN = 1
kiki_a_wall_drawn = player_a_state_field1
kiki_anim_paint_side_dur:
.byt kiki_anim_paint_side_dur_pal, kiki_anim_paint_side_dur_ntsc
&kiki_start_side_spe_right:
.(
lda DIRECTION_RIGHT
sta player_a_direction, x
jmp kiki_start_side_spe
; rts ; useless - kiki_start_side_spe is a routine
.)
&kiki_start_side_spe_left:
.(
lda DIRECTION_LEFT
sta player_a_direction, x
; jmp kiki_start_side_spe ; useless - fallthrough
; rts ; useless - kiki_start_side_spe is a routine
.)
&kiki_start_side_spe:
.(
sprite_x_lsb = tmpfield1
sprite_x_msb = tmpfield2
sprite_y_lsb = tmpfield3
sprite_y_msb = tmpfield4
; Set the appropriate animation
lda #<kiki_anim_paint_side
sta tmpfield13
lda #>kiki_anim_paint_side
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_SIDE_SPE
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
; TODO study intersting velocity setups
; Original - rapidly slow down to (0, 0) (was done to copy-paste code from side tilt)
; Current - directly stop any velocity (should feel like original, without computations per tick)
; Idea 2 - stop horizontal velocity, keep vertical velocity, apply gravity on tick (should help to side spe as part of aerial gameplay)
; Avoid spawning wall when forbiden
lda kiki_a_platform_state, x
and #%10000000
bne process
lda #KIKI_WALL_WHIFF
sta kiki_a_wall_drawn, x
jmp spawn_wall_end
process:
lda #KIKI_WALL_DRAWN
sta kiki_a_wall_drawn, x
; Reset velocity
lda #0
sta player_a_velocity_h_low, x
sta player_a_velocity_h, x
sta player_a_velocity_v_low, x
sta player_a_velocity_v, x
; Spawn wall
spawn_wall:
.(
; Reset wall state
ldy system_index
lda kiki_platform_duration, y
sta kiki_a_platform_state, x
; Place wall
ldy #0
cpx #0
beq place_wall
ldy #player_b_objects-player_a_objects
place_wall:
lda #STAGE_ELEMENT_OOS_PLATFORM
sta player_a_objects, y ; type
lda player_a_direction, x
cmp DIRECTION_LEFT
bne platform_on_right
lda player_a_x, x
clc
adc #$ef
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_LSB, y
lda player_a_x_screen, x
adc #$ff
jmp end_platform_left_positioning
platform_on_right:
lda player_a_x, x
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_LSB, y
lda player_a_x_screen, x
end_platform_left_positioning:
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_MSB, y
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_LSB, y
clc
adc #16
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_RIGHT_LSB, y
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_MSB, y
adc #0
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_RIGHT_MSB, y
lda player_a_y, x
clc
adc #16
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_BOTTOM_LSB, y
lda player_a_y_screen, x
adc #0
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_BOTTOM_MSB, y
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_BOTTOM_LSB, y
sec
sbc #32
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_LSB, y
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_BOTTOM_MSB, y
sbc #0
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_MSB, y
;lda #STAGE_ELEMENT_END
;sta player_a_objects+STAGE_ELEMENT_SIZE, y ; next's type, useless, set at init time
; Compute wall's sprites position
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_LSB, y
clc
adc #15
sta sprite_y_lsb
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_MSB, y
adc #0
sta sprite_y_msb
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_LSB, y
clc
adc #8
sta sprite_x_lsb
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_MSB, y
adc #0
sta sprite_x_msb
; Y = first wall sprite offset
lda kiki_first_wall_sprite_per_player, x
asl
asl
tay
; Place upper sprite
lda sprite_x_msb
cmp #0
bne hide_upper_sprite
lda sprite_y_msb
bne hide_upper_sprite
lda #KIKI_TILE_WALL_BLOCK_V_UP
clc
adc kiki_first_tile_index_per_player, x
sta oam_mirror+1, y ; First sprite tile
lda sprite_y_lsb
sta oam_mirror, y ; First sprite Y
lda sprite_x_lsb
sta oam_mirror+3, y ; First sprite X
jmp end_upper_sprite
hide_upper_sprite:
lda #$fe
sta oam_mirror, y ; First sprite Y
end_upper_sprite:
; Place lower sprite
lda sprite_x_msb
cmp #0
bne hide_lower_sprite
lda sprite_y_lsb
clc
adc #8
sta sprite_y_lsb
lda sprite_y_msb
adc #0
bne hide_lower_sprite
lda #KIKI_TILE_WALL_BLOCK_V_DOWN
clc
adc kiki_first_tile_index_per_player, x
sta oam_mirror+5, y ; Second sprite tile
lda sprite_y_lsb
sta oam_mirror+4, y ; Second sprite Y
lda sprite_x_lsb
sta oam_mirror+7, y ; Second sprite X
jmp end_lower_sprite
hide_lower_sprite:
lda #$fe
sta oam_mirror+4, y ; Second sprite Y
end_lower_sprite:
; Mirror sprites screen position in unused object memory
lda oam_mirror+4, y
pha
lda oam_mirror, y
pha
ldy kiki_first_wall_sprite_y_per_player, x
pla
sta stage_data, y
iny
pla
sta stage_data, y
.)
spawn_wall_end:
rts
.)
&kiki_tick_side_spe:
.(
jsr kiki_global_tick
; Apply gravity if failed to paint
lda kiki_a_wall_drawn, x
bne skip_gravity
jsr kiki_apply_friction_lite
jsr apply_player_gravity
skip_gravity:
; Return to inactive state after animation's duration
inc player_a_state_clock, x
ldy system_index
lda player_a_state_clock, x
cmp kiki_anim_paint_side_dur, y
bne end
jmp kiki_start_inactive_state
; No return, jump to subroutine
end:
rts
.)
.)
.(
kiki_anim_paint_down_dur:
.byt kiki_anim_paint_down_dur_pal, kiki_anim_paint_down_dur_ntsc
&kiki_start_down_wall:
.(
sprite_x_lsb = tmpfield1
sprite_x_msb = tmpfield2
sprite_y_lsb = tmpfield3
sprite_y_msb = tmpfield4
; Set the appropriate animation
lda #<kiki_anim_paint_down
sta tmpfield13
lda #>kiki_anim_paint_down
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_DOWN_WALL
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
; Avoid spawning wall when forbiden
lda kiki_a_platform_state, x
and #%10000000
bne process
jmp spawn_wall_end
process:
; Reset velocity
lda #0
sta player_a_velocity_h_low, x
sta player_a_velocity_h, x
sta player_a_velocity_v_low, x
sta player_a_velocity_v, x
; Spawn wall
spawn_wall:
.(
; Move player upward (to create wall on ground)
lda player_a_y, x
sec
sbc #8
sta player_a_y, x
lda player_a_y_screen, x
sbc #0
sta player_a_y_screen, x
lda #$ff
sta player_a_y_low, x
; Reset wall state
ldy system_index
lda kiki_platform_duration, y
sta kiki_a_platform_state, x
; Place wall
;TODO factorize code with other specials
ldy #0
cpx #0
beq place_wall
ldy #player_b_objects-player_a_objects
place_wall:
lda #STAGE_ELEMENT_OOS_PLATFORM
sta player_a_objects, y ; type
lda player_a_x, x
clc
adc #$f3
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_LSB, y
lda player_a_x_screen, x
adc #$ff
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_MSB, y
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_LSB, y
clc
adc #24
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_RIGHT_LSB, y
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_MSB, y
adc #0
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_RIGHT_MSB, y
lda player_a_y, x
clc
adc #24
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_BOTTOM_LSB, y
lda player_a_y_screen, x
adc #0
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_BOTTOM_MSB, y
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_BOTTOM_LSB, y
sec
sbc #24
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_LSB, y
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_BOTTOM_MSB, y
sbc #0
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_MSB, y
;lda #STAGE_ELEMENT_END
;sta player_a_objects+STAGE_ELEMENT_SIZE, y ; next's type, useless, set at init time
; Compute wall's sprites position
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_LSB, y
clc
adc #15
sta sprite_y_lsb
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_MSB, y
adc #0
sta sprite_y_msb
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_LSB, y
clc
adc #8
sta sprite_x_lsb
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_MSB, y
adc #0
sta sprite_x_msb
; Y = first wall sprite offset
lda kiki_first_wall_sprite_per_player, x
asl
asl
tay
; Place left sprite
lda sprite_x_msb
cmp #0
bne hide_left_sprite
lda sprite_y_msb
bne hide_left_sprite
lda #KIKI_TILE_WALL_BLOCK_H_LEFT
clc
adc kiki_first_tile_index_per_player, x
sta oam_mirror+1, y ; First sprite tile
lda sprite_y_lsb
sta oam_mirror, y ; First sprite Y
lda sprite_x_lsb
sta oam_mirror+3, y ; First sprite X
jmp end_left_sprite
hide_left_sprite:
lda #$fe
sta oam_mirror, y ; First sprite Y
end_left_sprite:
; Place right sprite
lda sprite_x_lsb
clc
adc #8
sta sprite_x_lsb
lda sprite_x_msb
adc #0
bne hide_right_sprite
lda sprite_y_msb
bne hide_right_sprite
lda #KIKI_TILE_WALL_BLOCK_H_RIGHT
clc
adc kiki_first_tile_index_per_player, x
sta oam_mirror+5, y ; Second sprite tile
lda sprite_y_lsb
sta oam_mirror+4, y ; Second sprite Y
lda sprite_x_lsb
sta oam_mirror+7, y ; Second sprite X
jmp end_right_sprite
hide_right_sprite:
lda #$fe
sta oam_mirror+4, y ; Second sprite Y
end_right_sprite:
; Mirror sprites screen position in unused object memory
lda oam_mirror+4, y
pha
lda oam_mirror, y
pha
ldy kiki_first_wall_sprite_y_per_player, x
pla
sta stage_data, y
iny
pla
sta stage_data, y
.)
spawn_wall_end:
rts
.)
&kiki_tick_down_wall:
.(
jsr kiki_global_tick
jsr apply_player_gravity
inc player_a_state_clock, x
ldy system_index
lda player_a_state_clock, x
cmp kiki_anim_paint_down_dur, y
bne end
jmp kiki_start_inactive_state
end:
rts
.)
.)
.(
KIKI_WALL_WHIFF = 0
KIKI_WALL_DRAWN = 1
kiki_a_wall_drawn = player_a_state_field1
kiki_anim_paint_up_dur:
.byt kiki_anim_paint_side_dur_pal, kiki_anim_paint_side_dur_ntsc
&kiki_start_top_wall:
.(
sprite_x_lsb = tmpfield1
sprite_x_msb = tmpfield2
sprite_y_lsb = tmpfield3
sprite_y_msb = tmpfield4
; Set the appropriate animation
lda #<kiki_anim_paint_up
sta tmpfield13
lda #>kiki_anim_paint_up
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_TOP_WALL
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
; Avoid spawning wall when forbiden
lda kiki_a_platform_state, x
and #%10000000
bne process
lda #KIKI_WALL_WHIFF
sta kiki_a_wall_drawn, x
jmp spawn_wall_end
process:
lda #KIKI_WALL_DRAWN
sta kiki_a_wall_drawn, x
; Reset velocity
lda #0
sta player_a_velocity_h_low, x
sta player_a_velocity_h, x
sta player_a_velocity_v_low, x
sta player_a_velocity_v, x
; Spawn wall
spawn_wall:
.(
; Reset wall state
ldy system_index
lda kiki_platform_duration, y
sta kiki_a_platform_state, x
; Place wall
;TODO factorize code with other specials
ldy #0
cpx #0
beq place_wall
ldy #player_b_objects-player_a_objects
place_wall:
lda #STAGE_ELEMENT_OOS_SMOOTH_PLATFORM
sta player_a_objects, y ; type
lda player_a_x, x
clc
adc #$f3
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_LSB, y
lda player_a_x_screen, x
adc #$ff
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_MSB, y
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_LSB, y
clc
adc #24
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_RIGHT_LSB, y
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_MSB, y
adc #0
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_RIGHT_MSB, y
lda player_a_y, x
sec
sbc #24
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_LSB, y
lda player_a_y_screen, x
sbc #0
sta player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_MSB, y
;lda #STAGE_ELEMENT_END
;sta player_a_objects+STAGE_ELEMENT_SIZE, y ; next's type, useless, set at init time
; Compute wall's sprites position
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_LSB, y
clc
adc #15
sta sprite_y_lsb
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_TOP_MSB, y
adc #0
sta sprite_y_msb
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_LSB, y
clc
adc #8
sta sprite_x_lsb
lda player_a_objects+STAGE_OOS_PLATFORM_OFFSET_LEFT_MSB, y
adc #0
sta sprite_x_msb
; Y = first wall sprite offset
lda kiki_first_wall_sprite_per_player, x
asl
asl
tay
; Place left sprite
lda sprite_x_msb
cmp #0
bne hide_left_sprite
lda sprite_y_msb
bne hide_left_sprite
lda #KIKI_TILE_SMOOTH_WALL_BLOCK_LEFT
clc
adc kiki_first_tile_index_per_player, x
sta oam_mirror+1, y ; First sprite tile
lda sprite_y_lsb
sta oam_mirror, y ; First sprite Y
lda sprite_x_lsb
sta oam_mirror+3, y ; First sprite X
jmp end_left_sprite
hide_left_sprite:
lda #$fe
sta oam_mirror, y ; First sprite Y
end_left_sprite:
; Place right sprite
lda sprite_x_lsb
clc
adc #8
sta sprite_x_lsb
lda sprite_x_msb
adc #0
bne hide_right_sprite
lda sprite_y_msb
bne hide_right_sprite
lda #KIKI_TILE_SMOOTH_WALL_BLOCK_RIGHT
clc
adc kiki_first_tile_index_per_player, x
sta oam_mirror+5, y ; Second sprite tile
lda sprite_y_lsb
sta oam_mirror+4, y ; Second sprite Y
lda sprite_x_lsb
sta oam_mirror+7, y ; Second sprite X
jmp end_right_sprite
hide_right_sprite:
lda #$fe
sta oam_mirror+4, y ; Second sprite Y
end_right_sprite:
; Mirror sprites screen position in unused object memory
lda oam_mirror+4, y
pha
lda oam_mirror, y
pha
ldy kiki_first_wall_sprite_y_per_player, x
pla
sta stage_data, y
iny
pla
sta stage_data, y
.)
spawn_wall_end:
rts
.)
&kiki_tick_top_wall:
.(
jsr kiki_global_tick
; Apply gravity if failed to paint
lda kiki_a_wall_drawn, x
bne skip_gravity
jsr kiki_apply_friction_lite
jsr apply_player_gravity
skip_gravity:
; Return to inactive state after animation's duration
inc player_a_state_clock, x
ldy system_index
lda player_a_state_clock, x
cmp kiki_anim_paint_up_dur, y
bne end
jmp kiki_start_inactive_state
end:
rts
.)
.)
.(
kiki_anim_strike_up_dur:
.byt kiki_anim_strike_up_dur_pal, kiki_anim_strike_up_dur_ntsc
&kiki_start_up_tilt:
.(
; Set the appropriate animation
lda #<kiki_anim_strike_up
sta tmpfield13
lda #>kiki_anim_strike_up
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_UP_TILT
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
rts
.)
&kiki_tick_up_tilt:
.(
jsr kiki_global_tick
inc player_a_state_clock, x
ldy system_index
lda player_a_state_clock, x
cmp kiki_anim_strike_up_dur, y
bne update_velocity
jmp kiki_start_inactive_state
; No return, jump to subroutine
update_velocity:
; Do not move, velocity tends toward vector (0,0)
jmp kiki_apply_ground_friction
; No return, jump to subroutine
end:
rts
.)
.)
.(
kiki_anim_aerial_up_dur:
.byt kiki_anim_strike_up_dur_pal, kiki_anim_strike_up_dur_ntsc
&kiki_start_up_aerial:
.(
; Set the appropriate animation
lda #<kiki_anim_strike_up
sta tmpfield13
lda #>kiki_anim_strike_up
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_UP_AERIAL
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
rts
.)
&kiki_tick_up_aerial:
.(
jsr kiki_global_tick
KIKI_STATE_UP_AERIAL_DURATION = 16
jsr apply_player_gravity
ldy system_index
inc player_a_state_clock, x
lda player_a_state_clock, x
cmp kiki_anim_aerial_up_dur, y
bne end
jsr kiki_start_falling
end:
rts
.)
.)
.(
kiki_anim_strike_down_dur:
.byt kiki_anim_strike_down_dur_pal, kiki_anim_strike_down_dur_ntsc
&kiki_start_down_tilt:
.(
; Set the appropriate animation
lda #<kiki_anim_strike_down
sta tmpfield13
lda #>kiki_anim_strike_down
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_DOWN_TILT
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
rts
.)
&kiki_tick_down_tilt:
.(
jsr kiki_global_tick
inc player_a_state_clock, x
ldy system_index
lda player_a_state_clock, x
cmp kiki_anim_strike_down_dur, y
bne update_velocity
jmp kiki_start_inactive_state
; No return, jump to subroutine
update_velocity:
; Do not move, velocity tends toward vector (0,0)
jmp kiki_apply_ground_friction
; No return, jump to subroutine
;rts ; useless, unreachable
.)
.)
.(
kiki_anim_aerial_down_dur:
.byt kiki_anim_strike_down_dur_pal, kiki_anim_strike_down_dur_ntsc
&kiki_start_down_aerial:
.(
; Set the appropriate animation
lda #<kiki_anim_strike_down
sta tmpfield13
lda #>kiki_anim_strike_down
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_DOWN_AERIAL
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
rts
.)
&kiki_tick_down_aerial:
.(
jsr kiki_global_tick
jsr apply_player_gravity
ldy system_index
inc player_a_state_clock, x
lda player_a_state_clock, x
cmp kiki_anim_aerial_down_dur, y
bne end
jmp kiki_start_falling
; No return, jump to subroutine
end:
rts
.)
.)
.(
kiki_anim_aerial_strike_dur:
.byt kiki_anim_strike_dur_pal, kiki_anim_strike_dur_ntsc
&kiki_start_side_aerial_right:
.(
lda DIRECTION_RIGHT
sta player_a_direction, x
jmp kiki_start_side_aerial
; rts ; useless - kiki_start_side_aerial is a routine
.)
&kiki_start_side_aerial_left:
.(
lda DIRECTION_LEFT
sta player_a_direction, x
; jmp kiki_start_side_aerial ; useless - fallthrough
; rts ; useless - kiki_start_side_aerial is a routine
.)
&kiki_start_side_aerial:
.(
; Set the appropriate animation
lda #<kiki_anim_strike
sta tmpfield13
lda #>kiki_anim_strike
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_SIDE_AERIAL
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
rts
.)
&kiki_tick_side_aerial:
.(
jsr kiki_global_tick
KIKI_STATE_SIDE_AERIAL_DURATION = 16
jsr apply_player_gravity
ldy system_index
inc player_a_state_clock, x
lda player_a_state_clock, x
cmp kiki_anim_aerial_strike_dur, y
bne end
jmp kiki_start_falling
; No return, jump to subroutine
end:
rts
.)
.)
.(
kiki_anim_jab_dur:
.byt kiki_anim_jab_dur_pal, kiki_anim_jab_dur_ntsc
&kiki_start_jabbing:
.(
; Set the appropriate animation
lda #<kiki_anim_jab
sta tmpfield13
lda #>kiki_anim_jab
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_JABBING
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
rts
.)
&kiki_tick_jabbing:
.(
jsr kiki_global_tick
inc player_a_state_clock, x
ldy system_index
lda player_a_state_clock, x
cmp kiki_anim_jab_dur, y
bne update_velocity
jsr kiki_start_idle
jmp end
update_velocity:
; Do not move, velocity tends toward vector (0,0)
jmp kiki_apply_ground_friction
; No return, jump to subroutine
end:
rts
.)
&kiki_input_jabbing:
.(
; Allow to cut the animation for another jab
lda controller_a_btns, x
cmp #CONTROLLER_INPUT_JAB
bne end
jsr kiki_start_jabbing
end:
rts
.)
.)
.(
kiki_anim_aerial_neutral_dur:
.byt kiki_anim_aerial_neutral_dur_pal, kiki_anim_aerial_neutral_dur_ntsc
&kiki_start_neutral_aerial:
.(
; Set the appropriate animation
lda #<kiki_anim_aerial_neutral
sta tmpfield13
lda #>kiki_anim_aerial_neutral
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_NEUTRAL_AERIAL
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
rts
.)
&kiki_tick_neutral_aerial:
.(
jsr kiki_global_tick
jsr apply_player_gravity
ldy system_index
inc player_a_state_clock, x
lda player_a_state_clock, x
cmp kiki_anim_aerial_neutral_dur, y
bne end
jsr kiki_start_falling
end:
rts
.)
.)
.(
COUNTER_GUARD_ACTIVE_DURATION = 18
COUNTER_GUARD_TOTAL_DURATION = 43
velocity_table(KIKI_COUNTER_GRAVITY, kiki_counter_gravity_msb, kiki_counter_gravity_lsb)
duration_table(COUNTER_GUARD_ACTIVE_DURATION, counter_guard_active_duration)
duration_table(COUNTER_GUARD_TOTAL_DURATION, counter_guard_total_duration)
&kiki_start_counter_guard:
.(
; Set the appropriate animation
lda #<kiki_anim_counter_guard
sta tmpfield13
lda #>kiki_anim_counter_guard
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_COUNTER_GUARD
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
; Cancel vertical momentum
;lda #0 ; useless, done above
sta player_a_velocity_v_low, x
sta player_a_velocity_v, x
; Lower horizontal momentum
lda player_a_velocity_h, x ; Set sign bit in carry flag, so the following bitshift is a signed division
rol
ror player_a_velocity_h, x
ror player_a_velocity_h_low, x
; Lower gravity
ldy system_index
lda kiki_counter_gravity_lsb, y
sta player_a_gravity_lsb, x
lda kiki_counter_gravity_msb, y
sta player_a_gravity_msb, x
rts
.)
&kiki_tick_counter_guard:
.(
jsr kiki_global_tick
jsr kiki_apply_friction_lite
inc player_a_state_clock, x
ldy system_index
lda player_a_state_clock, x
cmp counter_guard_active_duration, y
bne check_total_duration
; Active duration is over, display it by switching to weak animation
lda #<kiki_anim_counter_weak
sta tmpfield13
lda #>kiki_anim_counter_weak
sta tmpfield14
jsr set_player_animation
; Reset fall speed
jsr reset_default_gravity
check_total_duration:
cmp counter_guard_total_duration, y
bne end
; Total duration is over, return to a neutral state
jsr reset_default_gravity
jmp kiki_start_inactive_state
; No return, jump to subroutine
end:
rts
.)
&kiki_hurt_counter_guard:
.(
striker_player = tmpfield10
stroke_player = tmpfield11
lda stroke_player
pha
lda striker_player
pha
; Strike if still active, else get hurt
ldy system_index
lda counter_guard_active_duration, y
cmp player_a_state_clock, x
bcc hurt
ldy striker_player
lda HITBOX_DISABLED
sta player_a_hitbox_enabled, y
jsr reset_default_gravity
jsr kiki_start_counter_strike
jmp end
hurt:
jsr hurt_player
end:
pla
sta striker_player
pla
sta stroke_player
rts
.)
.)
.(
COUNTER_STRIKE_DURATION = 12
duration_table(COUNTER_STRIKE_DURATION, counter_strike_duration)
&kiki_start_counter_strike:
.(
; Set the appropriate animation
lda #<kiki_anim_counter_strike
sta tmpfield13
lda #>kiki_anim_counter_strike
sta tmpfield14
jsr set_player_animation
; Set the player's state
lda #KIKI_STATE_COUNTER_STRIKE
sta player_a_state, x
; Initialize the clock
lda #0
sta player_a_state_clock,x
rts
.)
&kiki_tick_counter_strike:
.(
jsr kiki_global_tick
jsr apply_player_gravity
ldy system_index
inc player_a_state_clock, x
lda player_a_state_clock, x
cmp counter_strike_duration, y
bne end
jsr kiki_start_falling
end:
rts
.)
.)
!include "std_friction_routines.asm"
|
programs/oeis/083/A083031.asm | neoneye/loda | 22 | 11164 | <reponame>neoneye/loda
; A083031: Numbers that are congruent to {0, 3, 7} mod 12.
; 0,3,7,12,15,19,24,27,31,36,39,43,48,51,55,60,63,67,72,75,79,84,87,91,96,99,103,108,111,115,120,123,127,132,135,139,144,147,151,156,159,163,168,171,175,180,183,187,192,195,199,204,207,211,216,219
mul $0,16
mov $1,$0
div $0,6
div $1,12
add $0,$1
|
test/Succeed/Issue3639.agda | shlevy/agda | 1,989 | 3323 | <gh_stars>1000+
module _ where
open import Agda.Builtin.Equality
open import Agda.Builtin.Bool
open import Agda.Builtin.Unit
open import Agda.Builtin.List
open import Agda.Builtin.Nat
open import Agda.Builtin.Reflection renaming (returnTC to return; bindTC to _>>=_)
_>>_ : {A B : Set} → TC A → TC B → TC B
m >> m' = m >>= λ _ → m'
macro
solve : Nat → Term → TC ⊤
solve blocker hole = do
unify hole (lam visible (abs "x" (var 0 [])))
meta x _ ← withNormalisation true (quoteTC blocker)
where _ → return _
blockOnMeta x
mutual
blocker : Nat
blocker = _
bug : Bool
bug = (solve blocker) true
unblock : blocker ≡ 0
unblock = refl
|
Task/Array-concatenation/AppleScript/array-concatenation-1.applescript | LaudateCorpus1/RosettaCodeData | 1 | 2571 | <reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Array-concatenation/AppleScript/array-concatenation-1.applescript
set listA to {1, 2, 3}
set listB to {4, 5, 6}
return listA & listB
|
programs/oeis/034/A034911.asm | neoneye/loda | 22 | 1416 | <reponame>neoneye/loda
; A034911: One fifth of octo-factorial numbers.
; 1,13,273,7917,292929,13181805,698635665,42616775565,2940557513985,226422928576845,19245948929031825,1789873250399959725,180777198290395932225,19704714613653156612525
mov $1,1
mov $2,5
lpb $0
sub $0,1
add $2,8
mul $1,$2
lpe
mov $0,$1
|
gyak/gyak11/hauntedHouse/hauntedhouse.ads | balintsoos/LearnAda | 0 | 2018 | package hauntedhouse is
-- W: Wall, R: Room, C: Corridor, E: Exit
type Fields is (W,R,C,E);
type Position is record
x: Natural;
y: Natural;
end record;
function IsWall(pos: Position) return Boolean;
function IsCorrect(pos: Position) return Boolean;
function IsCorridor(pos: Position) return Boolean;
function GetField(pos:Position) return Fields;
function GetRandPos return Position;
private
type field_array is array(Natural range <>,Natural range <>) of Fields;
House: constant field_array(1..5,1..5):= ((C,C,C,W,R),
(R,W,C,W,C),
(W,C,C,R,R),
(C,R,W,W,R),
(R,C,E,C,C));
end hauntedhouse;
|
dv3/java/fd/ckwp.asm | olifink/smsqe | 0 | 11389 | ; DV3 Java Floppy Disk Check Wrte Protect V3.00 1993 <NAME>
; based on
; DV3 QPC Floppy Disk Check Write Protect V3.00 1993 <NAME>
section dv3
xdef fd_ckwp
include 'dev8_dv3_keys'
include 'dev8_keys_java'
;+++
; Check write protect
;
;
; a3 c p pointer to linkage block
; a4 c p pointer to drive definition
;
; all registers except d0 preserved
;
; status standard
;
;---
fd_ckwp
movem.l d7,-(sp)
move.b ddf_dnum(a4),d7 ; drive nbr (use same reg as for other traps)
moveq #jt8.ckwp,d0 ; check write protect now (sets D0)
dc.w jva.trp8
blt.s fcwp_rts
sne ddf_wprot(a4) ; set write protect
fcwp_rts
moveq #0,d0
movem.l (sp)+,d7
rts
end
|
books_and_notes/professional_courses/Assembly_language_and_programming/sources/汇编语言程序设计教程第四版/codes/9_4.asm | gxw1/review_the_national_post-graduate_entrance_examination | 640 | 170464 | <gh_stars>100-1000
STACK SEGMENT STACK
DW 64 DUP(?)
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE,SS:STACK
START: MOV CX,001AH
MOV BL,61H
MOV AH,02H
A1: MOV DL,BL
INT 21H
INC BL
PUSH CX
MOV CX,0FFFFH
A2: LOOP A2
POP CX
DEC CX
JNZ A1
MOV AH,4CH
INT 21H
CODE ENDS
END START
|
libsrc/stdio/ansi/ansifont_f6.asm | ahjelm/z88dk | 640 | 88171 | <reponame>ahjelm/z88dk<gh_stars>100-1000
SECTION rodata_font_ansi
PUBLIC ansifont_f6
ansifont_f6:
BINARY "stdio/ansi/F6.BIN"
|
oeis/091/A091753.asm | neoneye/loda-programs | 11 | 13266 | <reponame>neoneye/loda-programs
; A091753: Fourth column (m=5) of array A091752 ((-1,2)Stirling2) divided by -6.
; Submitted by <NAME>
; 1,60,6720,1232000,336336000,128076748800,64892219392000,42217023873024000,34301331896832000000,34042166278055936000000,40523794737397786214400000,56991191326140341157888000000
mov $2,$0
seq $0,91535 ; First column (k=2) of array A091534 ((5,2)-Stirling2).
add $2,1
mul $0,$2
add $2,1
mul $0,$2
div $0,2
|
Cubical/Algebra/DirectSum/DirectSumFun/Base.agda | thomas-lamiaux/cubical | 0 | 609 | {-# OPTIONS --safe #-}
module Cubical.Algebra.DirectSum.DirectSumFun.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Data.Nat renaming (_+_ to _+n_ ; _·_ to _·n_)
open import Cubical.Data.Nat.Order
open import Cubical.Data.Sigma
open import Cubical.HITs.PropositionalTruncation as PT
open import Cubical.Algebra.AbGroup
private variable
ℓ : Level
open AbGroupStr
-----------------------------------------------------------------------------
-- Definition
AlmostNullProof : (G : ℕ → Type ℓ) → (Gstr : (n : ℕ) → AbGroupStr (G n))
→ (f : (n : ℕ) → G n) → (k : ℕ) → Type ℓ
AlmostNullProof G Gstr f k = (n : ℕ) → k < n → f n ≡ 0g (Gstr n)
AlmostNull : (G : ℕ → Type ℓ) → (Gstr : (n : ℕ) → AbGroupStr (G n))
→ (f : (n : ℕ) → G n) → Type ℓ
AlmostNull G Gstr f = Σ[ k ∈ ℕ ] AlmostNullProof G Gstr f k
AlmostNullP : (G : ℕ → Type ℓ) → (Gstr : (n : ℕ) → AbGroupStr (G n))
→ (f : (n : ℕ) → G n) → Type ℓ
AlmostNullP G Gstr f = ∥ (AlmostNull G Gstr f) ∥₁
⊕Fun : (G : ℕ → Type ℓ) → (Gstr : (n : ℕ) → AbGroupStr (G n)) → Type ℓ
⊕Fun G Gstr = Σ[ f ∈ ((n : ℕ) → G n) ] AlmostNullP G Gstr f
|
src/gl/implementation/gl-api-subprogram_reference.ads | Roldak/OpenGLAda | 79 | 12225 | <reponame>Roldak/OpenGLAda
-- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
function GL.API.Subprogram_Reference (Function_Name : String)
return System.Address;
pragma Preelaborate (GL.API.Subprogram_Reference);
|
s2/sfx-original/C5 - Tally End.asm | Cancer52/flamedriver | 9 | 99127 | Sound45_TallyEnd_Header:
smpsHeaderStartSong 2
smpsHeaderVoice Sound45_TallyEnd_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $03
smpsHeaderSFXChannel cFM5, Sound45_TallyEnd_FM5, $00, $00
smpsHeaderSFXChannel cFM4, Sound45_TallyEnd_FM4, $00, $00
smpsHeaderSFXChannel cPSG3, Sound45_TallyEnd_PSG3, $00, $00
; FM5 Data
Sound45_TallyEnd_FM5:
smpsSetvoice $00
dc.b nA0, $08, nRst, $02, nA0, $08
smpsStop
; FM4 Data
Sound45_TallyEnd_FM4:
smpsSetvoice $01
dc.b nRst, $12, nA5, $55
smpsStop
; PSG3 Data
Sound45_TallyEnd_PSG3:
smpsPSGvoice fTone_02
smpsPSGform $E7
dc.b nRst, $02, nF5, $05, nG5, $04, nF5, $05, nG5, $04
smpsStop
Sound45_TallyEnd_Voices:
; Voice $00
; $3B
; $03, $02, $02, $06, $18, $1A, $1A, $96, $17, $0E, $0A, $10
; $00, $00, $00, $00, $FF, $FF, $FF, $FF, $00, $28, $39, $80
smpsVcAlgorithm $03
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $06, $02, $02, $03
smpsVcRateScale $02, $00, $00, $00
smpsVcAttackRate $16, $1A, $1A, $18
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $10, $0A, $0E, $17
smpsVcDecayRate2 $00, $00, $00, $00
smpsVcDecayLevel $0F, $0F, $0F, $0F
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $39, $28, $00
Sound_Ring_Voices:
; Voice $01
; $04
; $37, $72, $77, $49, $1F, $1F, $1F, $1F, $07, $0A, $07, $0D
; $00, $0B, $00, $0B, $1F, $0F, $1F, $0F, $23, $80, $23, $80
smpsVcAlgorithm $04
smpsVcFeedback $00
smpsVcUnusedBits $00
smpsVcDetune $04, $07, $07, $03
smpsVcCoarseFreq $09, $07, $02, $07
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $0D, $07, $0A, $07
smpsVcDecayRate2 $0B, $00, $0B, $00
smpsVcDecayLevel $00, $01, $00, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $23, $00, $23
|
BitwiseShift/bitwise_shift.adb | veyselharun/ABench2020 | 0 | 20028 | <gh_stars>0
--
-- ABench2020 Benchmark Suite
--
-- Bitwise Shift Program
--
-- Licensed under the MIT License. See LICENSE file in the ABench root
-- directory for license information.
--
-- Uncomment the line below to print the result.
-- with Ada.Text_IO; use Ada.Text_IO;
with Interfaces; use Interfaces;
procedure Bitwise_Shift is
function S_Right (Value : Unsigned_32; Shift_Amount : Natural) return Unsigned_32 is
Result : Unsigned_32;
begin
Result := Shift_Right (Value, Shift_Amount);
return Result;
end;
function S_Left (Value : Unsigned_32; Shift_Amount : Natural) return Unsigned_32 is
Result : Unsigned_32;
begin
Result := Shift_Left (Value, Shift_Amount);
return Result;
end;
Result_1 : Unsigned_32;
Result_2 : Unsigned_32;
begin
Result_1 := S_Right (100, 7);
Result_2 := S_Left (50, 9);
-- Uncomment the lines below to print the results.
-- Put (Unsigned_32'Image (Result_1));
-- Put (Unsigned_32'Image (Result_2));
end;
|
symbolinen_konekieli/Ratol_msdos/teht43.asm | tkukka/VariousContent | 0 | 170037 | <filename>symbolinen_konekieli/Ratol_msdos/teht43.asm<gh_stars>0
;RaTol Symbolinen konekieli: Harjoitus 4, tehtävä 3
;Tero Kukka IY96A
;Tiedosto: teht43.asm Versio 1.0
;Luotu 13.4.1998
include a:makrot.txt
;Ohjelman kuvaus:
;Luetaan päätteeltä N kpl oppilaiden nimiä sekä arvosanat
;ja tulostetaan ne.
;Ulkoiset aliohjelmat:
extrn _lue_nimet: proc
extrn _tulosta_jonot: proc
;Vakiot
N equ 3 ;nimien lkm
MERKKEJA equ 15 ;nimen maksimipituus
TIETUEKOKO equ MERKKEJA + 3
Oppilastiedot struc
nimi db MERKKEJA dup(0), '$'
arvosana dw ?
Oppilastiedot ends
.model small ;muistimalli
.stack 100h ;pinon koko
.data ;muuttujalohko
;merkkipuskurin varaaminen:
puskuri db MERKKEJA+1, 0, MERKKEJA+1 dup('X'), '$'
oppilas Oppilastiedot N dup(?)
;Näytölle tulostuvat tekstit:
kehote1 db 0ah, 0dh, "Anna ", '$'
kehote2 db " nimeä:", 0ah, 0dh, '$'
kehote3 db " arvosanaa:", 0ah, 0dh, '$'
tuloste db 0ah, 0dh, "Syötetyt nimet ja arvosanat:", 0ah, 0dh, '$'
.code ;ohjelmakoodi alkaa
_main proc ;pääohjelma alkaa
mov ax, @data
mov ds, ax
;nimien syöttö:
tulosta kehote1
mov byte ptr al, N ;ladataan vakio N AL:ään
bin2ascii al ;muunnos asciiksi
tulosta_ascii al ;tulostetaan luku ascii-muodossa
tulosta kehote2
;parametrit pinoon:
mov ax, offset oppilas
push ax ;tietuetaulukon siirros pinoon
push TIETUEKOKO ;yhden tietueen koko
mov ax, offset puskuri
push ax ;merkkipuskurin siirros
push ds ;datasegm.
push N ;nimien lkm
call _lue_nimet ;luetaan nimet päätteeltä
add sp, 10 ;10 tavun vapautus pinosta
;arvosanojen syöttö:
tulosta kehote1
mov byte ptr al, N
bin2ascii al
tulosta_ascii al
tulosta kehote3
;luetaan arvosanat:
mov cx, N
mov di, offset oppilas.arvosana
LUUPPI:
lue_luku di ;luetaan makrolla luku muistiin
rivin_vaihto
add di, TIETUEKOKO ;seur. tietueen word-kenttä
loop LUUPPI
;nimien tulostus alkaa:
tulosta tuloste
mov ax, offset oppilas
push ax ;siirros tietuetaulukkoon
push TIETUEKOKO ;tietueen koko pinoon
push ds ;datasegm. pinoon
push N ;pinoon jonojen lkm
call _tulosta_jonot ;tulostetaan nimet
add sp, 8 ;8 tavun vapautus pinosta
;tulostetaan arvosanat:
rivin_vaihto
mov cx, N
mov di, offset oppilas.arvosana
LUUPPI2:
tulosta_luku di ;makrolla tulostetaan luku muistista
rivin_vaihto
add di, TIETUEKOKO ;seur. tietueen kenttä
loop LUUPPI2
exit 0 ;lopetus
_main endp
end _main ;pääohjelman loppu
|
out/aaa_01hello.adb | FardaleM/metalang | 22 | 18009 |
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C;
use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C;
procedure aaa_01hello is
type stringptr is access all char_array;
procedure PString(s : stringptr) is
begin
String'Write (Text_Streams.Stream (Current_Output), To_Ada(s.all));
end;
procedure PInt(i : in Integer) is
begin
String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left));
end;
a : Integer;
begin
PString(new char_array'( To_C("Hello World")));
a := 5;
PInt((4 + 6) * 2);
PString(new char_array'( To_C(" " & Character'Val(10))));
PInt(a);
PString(new char_array'( To_C("foo")));
if 1 + 2 * 2 * (3 + 8) / 4 - 2 = 12 and then TRUE
then
PString(new char_array'( To_C("True")));
else
PString(new char_array'( To_C("False")));
end if;
PString(new char_array'( To_C("" & Character'Val(10))));
if (3 * (4 + 11) * 2 = 45) = FALSE
then
PString(new char_array'( To_C("True")));
else
PString(new char_array'( To_C("False")));
end if;
PString(new char_array'( To_C(" ")));
if (2 = 1) = FALSE
then
PString(new char_array'( To_C("True")));
else
PString(new char_array'( To_C("False")));
end if;
PString(new char_array'( To_C(" ")));
PInt(5 / 3 / 3);
PInt(4 * 1 / 3 / 2 * 1);
if not (not (a = 0) and then not (a = 4))
then
PString(new char_array'( To_C("True")));
else
PString(new char_array'( To_C("False")));
end if;
if (TRUE and then not FALSE) and then not (TRUE and then FALSE)
then
PString(new char_array'( To_C("True")));
else
PString(new char_array'( To_C("False")));
end if;
PString(new char_array'( To_C("" & Character'Val(10))));
end;
|
programs/oeis/051/A051743.asm | karttu/loda | 1 | 21217 | <reponame>karttu/loda
; A051743: a(n) = (1/24)*n*(n + 5)*(n^2 + n + 6).
; 2,7,18,39,75,132,217,338,504,725,1012,1377,1833,2394,3075,3892,4862,6003,7334,8875,10647,12672,14973,17574,20500,23777,27432,31493,35989,40950,46407,52392,58938,66079,73850,82287,91427,101308,111969,123450,135792,149037,163228,178409,194625,211922,230347,249948,270774,292875,316302,341107,367343,395064,424325,455182,487692,521913,557904,595725,635437,677102,720783,766544,814450,864567,916962,971703,1028859,1088500,1150697,1215522,1283048,1353349,1426500,1502577,1581657,1663818,1749139,1837700,1929582,2024867,2123638,2225979,2331975,2441712,2555277,2672758,2794244,2919825,3049592,3183637,3322053,3464934,3612375,3764472,3921322,4083023,4249674,4421375,4598227,4780332,4967793,5160714,5359200,5563357,5773292,5989113,6210929,6438850,6672987,6913452,7160358,7413819,7673950,7940867,8214687,8495528,8783509,9078750,9381372,9691497,10009248,10334749,10668125,11009502,11359007,11716768,12082914,12457575,12840882,13232967,13633963,14044004,14463225,14891762,15329752,15777333,16234644,16701825,17179017,17666362,18164003,18672084,19190750,19720147,20260422,20811723,21374199,21948000,22533277,23130182,23738868,24359489,24992200,25637157,26294517,26964438,27647079,28342600,29051162,29772927,30508058,31256719,32019075,32795292,33585537,34389978,35208784,36042125,36890172,37753097,38631073,39524274,40432875,41357052,42296982,43252843,44224814,45213075,46217807,47239192,48277413,49332654,50405100,51494937,52602352,53727533,54870669,56031950,57211567,58409712,59626578,60862359,62117250,63391447,64685147,65998548,67331849,68685250,70058952,71453157,72868068,74303889,75760825,77239082,78738867,80260388,81803854,83369475,84957462,86568027,88201383,89857744,91537325,93240342,94967012,96717553,98492184,100291125,102114597,103962822,105836023,107734424,109658250,111607727,113583082,115584543,117612339,119666700,121747857,123856042,125991488,128154429,130345100,132563737,134810577,137085858,139389819,141722700,144084742,146476187,148897278,151348259,153829375,156340872,158882997,161455998,164060124,166695625
add $0,4
mov $1,$0
bin $1,4
add $1,$0
sub $1,3
|
alloy4fun_models/trashltl/models/11/MidrPz7QgwRLwuWtT.als | Kaixi26/org.alloytools.alloy | 0 | 2485 | <reponame>Kaixi26/org.alloytools.alloy<filename>alloy4fun_models/trashltl/models/11/MidrPz7QgwRLwuWtT.als
open main
pred idMidrPz7QgwRLwuWtT_prop12 {
eventually some Trash
}
pred __repair { idMidrPz7QgwRLwuWtT_prop12 }
check __repair { idMidrPz7QgwRLwuWtT_prop12 <=> prop12o } |
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_317.asm | ljhsiun2/medusa | 9 | 86616 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x1c2f8, %rcx
nop
nop
xor $7913, %r8
movw $0x6162, (%rcx)
nop
nop
add $55205, %rbp
lea addresses_A_ht+0x1c78, %rdx
nop
inc %rbp
mov (%rdx), %r13w
nop
nop
sub %rdx, %rdx
lea addresses_A_ht+0x140f8, %r13
dec %r8
mov (%r13), %rcx
nop
cmp %r8, %r8
lea addresses_WC_ht+0x73f8, %rsi
lea addresses_A_ht+0x1bdf8, %rdi
nop
nop
nop
nop
nop
xor $30740, %r13
mov $110, %rcx
rep movsl
nop
nop
and $42157, %rdi
lea addresses_WC_ht+0x18d68, %rsi
lea addresses_A_ht+0x1a4f8, %rdi
nop
nop
add $64967, %r8
mov $73, %rcx
rep movsb
lfence
lea addresses_WT_ht+0x3166, %rdi
nop
nop
nop
nop
nop
cmp %rdx, %rdx
mov $0x6162636465666768, %rsi
movq %rsi, (%rdi)
nop
nop
nop
sub %r8, %r8
lea addresses_D_ht+0x1b298, %r14
nop
nop
nop
nop
cmp %r13, %r13
mov (%r14), %rdx
nop
nop
nop
nop
sub $50538, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r8
push %rax
push %rbx
push %rdx
// Faulty Load
lea addresses_WT+0x1e2f8, %rax
nop
nop
nop
and %rdx, %rdx
vmovups (%rax), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %r12
lea oracles, %r8
and $0xff, %r12
shlq $12, %r12
mov (%r8,%r12,1), %r12
pop %rdx
pop %rbx
pop %rax
pop %r8
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
UnmanagedCode/updatescoreinc.asm | SchneiderAJ/Metis2020 | 0 | 2627 | <reponame>SchneiderAJ/Metis2020
.code
UpdateScoreIncAsm proc
add ecx, 10
mov eax, ecx
ret
UpdateScoreIncAsm endp
end |
src/Generic/Test/Reify.agda | turion/Generic | 30 | 1909 | <filename>src/Generic/Test/Reify.agda
module Generic.Test.Reify where
open import Generic.Core
open import Generic.Property.Reify
open import Generic.Test.Data.Fin
open import Generic.Test.Data.Vec
open import Data.Fin renaming (Fin to StdFin)
open import Data.Vec renaming (Vec to StdVec)
xs : Vec (Fin 4) 3
xs = fsuc (fsuc (fsuc fzero)) ∷ᵥ fzero ∷ᵥ fsuc fzero ∷ᵥ []ᵥ
xs′ : StdVec (StdFin 4) 3
xs′ = suc (suc (suc zero)) ∷ zero ∷ (suc zero) ∷ []
test : reflect xs ≡ xs′
test = refl
|
tests/exec/return1.adb | xuedong/mini-ada | 0 | 28698 | with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put('A');
New_Line;
return;
Put('b');
New_Line;
end Hello;
-- Local Variables:
-- compile-command: "gnatmake return1.adb && ./return1"
-- End:
|
src/ada_containers_indefinite_holders.adb | egilhh/Futures-in-Ada | 1 | 14224 | with Ada.Unchecked_Deallocation;
package body Ada_Containers_Indefinite_Holders is
procedure Free is
new Ada.Unchecked_Deallocation (Element_Type, Element_Access);
procedure Adjust (Self : in out Holder) is
begin
Self.Element := new Element_Type'(Self.Element.all);
end Adjust;
-------------
-- Element --
-------------
function Element (Container : Holder) return Element_Type is
begin
return Container.Element.all;
end Element;
--------------
-- Finalize --
--------------
procedure Finalize (Self: in out Holder) is
begin
Free (Self.Element);
end Finalize;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Holder) return Boolean is
begin
return Container.Element = null;
end Is_Empty;
procedure Replace_Element
(Container : in out Holder;
New_Item : Element_Type)
is
begin
declare
X : Element_Access := Container.Element;
-- Element allocator may need an accessibility check in case actual
-- type is class-wide or has access discriminants (RM 4.8(10.1) and
-- AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
Container.Element := new Element_Type'(New_Item);
Free (X);
end;
end Replace_Element;
end Ada_Containers_Indefinite_Holders;
|
scripts/Batch Cue Edits/Change Patch.applescript | samschloegel/qlab-scripts | 8 | 1062 | <gh_stars>1-10
-- For help, bug reports, or feature suggestions, please visit https://github.com/samschloegel/qlab-scripts
-- Built for QLab 4. v211121-01
set networkPatchQty to 5
tell application id "com.figure53.QLab.4" to tell front workspace
set errorOccured to false
set listNetwork to {}
repeat with i from 1 to networkPatchQty
set end of listNetwork to (i as string)
end repeat
set list8 to {"1", "2", "3", "4", "5", "6", "7", "8"}
set theSelection to (selected as list)
set typeList to {}
repeat with eachCue in theSelection
set eachType to q type of eachCue
if eachType is not in typeList then
set typeList to typeList & eachType
end if
end repeat
if length of typeList is not 1 then
display alert "Select only one type of cue"
return
end if
if typeList contains "Network" then
choose from list listNetwork with title "Select the patch"
set userPatch to (result as string)
else
choose from list list8 with title "Select the patch"
set userPatch to (result as string)
end if
if userPatch is not "false" then
repeat with eachCue in theSelection
if q type of eachCue is "Network" then
set patch of eachCue to (userPatch as integer)
else if q type of eachCue is in {"Audio", "Mic", "MIDI"} and (userPatch is in list8) then
set patch of eachCue to (userPatch as integer)
else
set errorOccured to true
end if
if patch of eachCue is not (userPatch as integer) then
set errorOccured to true
end if
end repeat
end if
if errorOccured then
display alert "Something didn't work"
end if
end tell |
Appl/Games/Sokoban/sokobanDocument.asm | steakknife/pcgeos | 504 | 104407 | <reponame>steakknife/pcgeos
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
GEOWORKS CONFIDENTIAL
PROJECT: GEOS
MODULE: Sokoban
FILE: sokobanDocument.asm
AUTHOR: <NAME>, Nov 18, 1992
ROUTINES:
Name Description
---- -----------
MTD MSG_META_DOC_OUTPUT_INITIALIZE_DOCUMENT_FILE
Creates a blank saved-game.
INT InitializeGameFile Set up data structures associated with a
game.
INT GetUserName Get the user name into the map block.
MTD MSG_META_DOC_OUTPUT_ATTACH_UI_TO_DOCUMENT
User opened a saved game (or a newly
created one).
INT ReadInGameFromFile Initialize game from existing game file.
INT DetermineVideoMode Determine our video DisplayType and act
accordingly.
MTD MSG_META_DOC_OUTPUT_WRITE_CACHED_DATA_TO_FILE
Save map & data block.
INT SaveGameToFile Save the various game variables into the
game file.
MTD MSG_META_DOC_OUTPUT_READ_CACHED_DATA_FROM_FILE
Setup stuff after opening a game
INT ReadCachedDataFromFile Read in the raw data from the file.
MTD MSG_META_DOC_OUTPUT_DETACH_UI_FROM_DOCUMENT
See if we made the high score list.
MTD MSG_META_DOC_OUTPUT_PHYSICAL_SAVE_AS_FILE_HANDLE
User saves game under a new name
MTD MSG_META_DOC_OUTPUT_SAVE_AS_COMPLETED
"Save as" completed
MTD MSG_GEN_PROCESS_OPEN_APPLICATION
Start 'er up.
INT OpenAndInitGameFile Open the game file
MTD MSG_GEN_PROCESS_CLOSE_APPLICATION
Shut down the game and close application.
INT SaveAndCloseGameFile Save the game and close the game file.
INT DirtyTheSavedGame Tells the document control the game has
been dirtied
INT SokobanMarkBusy Marks the app as busy.
INT SokobanMarkNotBusy Marks the app as not-busy
MTD MSG_GEN_PROCESS_INSTALL_TOKEN
Install tokens.
MTD MSG_META_DOC_OUTPUT_UPDATE_EARLIER_INCOMPATIBLE_DOCUMENT
Update a game file from a previous sokoban
INT UpdateEarlierIncompatibleMapBlock
upgrade the map block in an old document
INT UpdateEarlierIncompatibleMap
Restore saved game map
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 11/92 Initial revision
DESCRIPTION:
document control routines for Sokoban
$Id: sokobanDocument.asm,v 1.1 97/04/04 15:13:14 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
udata segment
vmFileHandle word
udata ends
DocumentCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanInitializeDocumentFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Creates a blank saved-game.
CALLED BY: MSG_META_DOC_OUTPUT_INITIALIZE_DOCUMENT_FILE
PASS: es = dgroup
bp = file handle
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
- read level 1 into currentMap
- make a block that contains the saved-game info
- read currentMap into the save-block
- make a Map Block and save the save-block's handle in it
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 11/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
SokobanInitializeDocumentFile method dynamic SokobanProcessClass,
MSG_META_DOC_OUTPUT_INITIALIZE_DOCUMENT_FILE
call InitializeGameFile
clc
ret
SokobanInitializeDocumentFile endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InitializeGameFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set up data structures associated with a game.
CALLED BY: SokobanInitializeDocumentFile or SokobanOpenApplication,
depending on whether the DOCUMENT_CONTROL flag is set.
PASS: bp = file handle
es = dgroup
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS: initializes some global variables
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 7/30/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if not DOCUMENT_CONTROL
docToken GeodeToken <"<PASSWORD>", MANUFACTURER_ID_GEOWORKS>
endif
InitializeGameFile proc near
uses ax,bx,cx,dx,si,di,bp,ds,es
.enter
Assert dgroup es
Assert vmFileHandle bp
;
; Make sure level 1 is in currentMap, because save gets called after
; this...
;
mov es:[vmFileHandle], bp
mov es:[level], 1
;
; Set up the game state.
;
andnf es:[gameState], not (mask SGS_MOVED_BAG or \
mask SGS_SAVED_BAG or \
mask SGS_UNSAVED_BAG or \
mask SGS_CAN_UNDO)
clr es:[moves]
clr es:[pushes]
call ConvertTextMap ; reads into currentMap
;
; Create a block for the saved-position map
;
Assert dgroup es
mov bx, es:[vmFileHandle] ; file handle
mov cx, size Map
clr ax ; user id
call VMAlloc
push ax ; save handle
;
; Create a block to hold the saved map.
;
mov bx, es:[vmFileHandle] ; file handle
mov cx, size Map
clr ax ; user id
call VMAlloc
;
; Move level 1 into the save-block.
;
segmov ds, es, cx ; ds = dgroup
push ax ; save block handle
call VMLock
mov es, ax ; es = save block
clr di ; es:di = save block
mov si, offset currentMap ; ds:si = level 1
mov cx, size Map
rep movsb
call VMDirty
call VMUnlock
;
; Create a map block for holding saved-game info.
;
mov cx, size SokobanMapBlock
clr ax ; user-specified id
call VMAlloc ; ax = block handle
;
; Store the save-block vm handle in the map block, and
; intialize the other data.
;
push ax ; save handle
call VMLock ; returns segment in ax
mov ds, ax ; segment of locked map block
pop ax ; restore map block handle
pop ds:[SMB_map] ; restore save block handle
pop ds:[SMB_savedMap] ; restore save-pos handle
clr ds:[SMB_moves]
clr ds:[SMB_pushes]
clr ds:[SMB_state] ; flags
mov ds:[SMB_level], 1
if HIGH_SCORES
;
; Get the user's name for the high score list and
; store it in the map block.
;
call GetUserName
endif
;
; Set the map block.
;
Assert vmFileHandle bx
call VMDirty
call VMUnlock ; pass bp = mem handle
call VMSetMapBlock ; pass ax = block handle
if not DOCUMENT_CONTROL
;
; Some stuff has to be done manually that would otherwise be done
; by the document control. Set the document token.
;
segmov es, cs
mov di, offset docToken
mov cx, size GeodeToken
mov ax, FEA_TOKEN
call FileSetHandleExtAttributes ; ignore errors
;
; Set the creator token.
;
sub sp, size GeodeToken
mov di, sp
segmov es, ss ; es:di = token buffer
mov ax, GGIT_TOKEN_ID
push bx ; save file handle
clr bx
call GeodeGetInfo ; es:di = GeodeToken
pop bx ; restore file handle
mov ax, FEA_CREATOR
call FileSetHandleExtAttributes
add sp, size GeodeToken
endif ; not DOCUMENT_CONTROL
.leave
ret
InitializeGameFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetUserName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the user name into the map block.
CALLED BY: SokobanInitializeDocumentFile
PASS: ds = map block
RETURN: SMB_name initialized
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 6/15/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if HIGH_SCORES
GetUserName proc near
uses ax,bx,cx,dx,si,di,bp,es
.enter
;
; Fill the buffer with zeroes in advance.
;
segmov es, ds, cx
mov di, offset SMB_name
mov cx, MAX_USER_NAME_LENGTH/2
clr ax
rep stosw
;
; Select all the text.
;
GetResourceHandleNS EnterNameText, bx
mov si, offset EnterNameText
mov di, mask MF_CALL
mov ax, MSG_VIS_TEXT_SELECT_ALL
call ObjMessage
;
; Initiate the interaction for typing in their name.
;
GetResourceHandleNS EnterNameDialog, bx
mov si, offset EnterNameDialog
call UserDoDialog ; block until they respond
;
; Get the name from the dialog.
;
mov dx, ds ; dx = map block
mov bp, offset SMB_name ; dx.bp = name buffer
GetResourceHandleNS EnterNameText, bx
mov si, offset EnterNameText
mov di, mask MF_CALL
mov ax, MSG_VIS_TEXT_GET_ALL_PTR
call ObjMessage
.leave
ret
GetUserName endp
endif ; HIGH_SCORES
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanAttachUIToDocument
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: User opened a saved game (or a newly created one).
CALLED BY: MSG_META_DOC_OUTPUT_ATTACH_UI_TO_DOCUMENT
PASS: es = dgroup
bp = file handle
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
- clear the scoring information from prior game, if any
- get the map block
- get the save-block handle from the map block
- get the save-block and lock it
- get the map and read it into currentMap
- invalidate the content
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 11/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
SokobanAttachUIToDocument method dynamic SokobanProcessClass,
MSG_META_DOC_OUTPUT_ATTACH_UI_TO_DOCUMENT
.enter
;
; Call common routine for setting up game.
;
call ReadInGameFromFile
clc ; success! (?)
.leave
ret
SokobanAttachUIToDocument endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReadInGameFromFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize game from existing game file.
CALLED BY: SokobanAttachUIToDocument or OpenAndInitGameFile
depending on whether DOCUMENT_CONTROL is set.
PASS: bp = file handle
es = dgroup
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 7/30/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReadInGameFromFile proc near
uses ax,bx,cx,dx,si,di,bp
.enter
Assert dgroup es
Assert vmFileHandle bp
if not DOCUMENT_CONTROL
;
; Read in some of the data. This gets called separately
; in the document-control version of the game.
;
call ReadCachedDataFromFile
endif
;
; Initialize information about the video mode, to be used
; later in determining the right bitmaps to draw. Must be done before
; UpdateContentSize, else that routine'll think everything's 0,0
; when the app is first launched.
;
call DetermineVideoMode
;
; Don't scan the map here. We either scan the map for the
; first time in SokobanInitializeDocumentFile, or we get the
; map out of the save-map block in our document file.
;
if HIGH_SCORES
clr es:[scoreLevel]
clr es:[scoreMoves]
clr es:[scorePushes]
endif
call UpdateLevelData
call UpdateBagsData
call UpdateSavedData
call UpdateMovesData
call UpdatePushesData
call UpdateContentSize
;
; We can neither restore position nor undo if we quit
; & restart a game, so disable both triggers.
;
mov ax, MSG_GEN_SET_NOT_ENABLED
call EnableRestoreTrigger ; preserves ax
call EnableUndoTrigger ; me too
;
; Make the map update. This happens automatically
; when we open the app, but not when we switch games.
;
GetResourceHandleNS TheMap, bx
mov si, offset TheMap
mov di, mask MF_CALL
mov ax, MSG_VIS_INVALIDATE
call ObjMessage
;
; Set-usable or not-usable the "Replay Level" dialog
; based on whether they are in won-game mode.
;
call UpdateReplayLevelDialog
if PLAY_SOUNDS
;
; Update the sound option selector and color selector.
;
mov cx, es:[soundOption]
GetResourceHandleNS SoundItemGroup, bx
mov si, offset SoundItemGroup
mov di, mask MF_CALL
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
clr dx ; not indeterminate
call ObjMessage
endif
if SET_BACKGROUND_COLOR
mov cx, es:[colorOption]
GetResourceHandleNS BackgroundColorSelector, bx
mov si, offset BackgroundColorSelector
mov di, mask MF_CALL
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
clr dx ; not indeterminate
call ObjMessage
endif
.leave
ret
ReadInGameFromFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DetermineVideoMode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine our video DisplayType and act accordingly.
CALLED BY: SokobanAttachUIToDocument
PASS: es = dgroup
RETURN: nothing (sets dgroup:videoMode)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 6/15/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DetermineVideoMode proc near
uses ax,bx,cx,dx,si,di,bp
.enter
Assert dgroup es
;
; Get the display scheme.
;
GetResourceHandleNS SokobanApp, bx
mov si, offset SokobanApp
mov di, mask MF_CALL
mov ax, MSG_GEN_APPLICATION_GET_DISPLAY_SCHEME
call ObjMessage ; ah = DisplayType
;
; Store an enumeration of SokobanVideoMode in idata.
;
mov al, ah
andnf ax, mask DT_DISP_ASPECT_RATIO or \
(mask DT_DISP_CLASS shl 8)
cmp al, DAR_VERY_SQUISHED shl offset DT_DISP_ASPECT_RATIO
je cgaMode
cmp al, DAR_SQUISHED shl offset DT_DISP_ASPECT_RATIO
je cgaMode
cmp ah, DC_GRAY_1 shl offset DT_DISP_CLASS
je mcgaMode
;
; Default to VGA artwork.
;
mov es:[videoMode], SVM_VGA
mov es:[bitmapWidth], VGA_BITMAP_WIDTH
mov es:[bitmapHeight], VGA_BITMAP_HEIGHT
ornf es:[walkInfo], mask WS_MODE
jmp short done
cgaMode:
mov es:[videoMode], SVM_CGA
mov es:[bitmapWidth], CGA_BITMAP_WIDTH
mov es:[bitmapHeight], CGA_BITMAP_HEIGHT
jmp short done
mcgaMode:
mov es:[videoMode], SVM_MONO
mov es:[bitmapWidth], VGA_BITMAP_WIDTH
mov es:[bitmapHeight], VGA_BITMAP_HEIGHT
done:
;
; Set the increment for the view to be the width/height of a bitmap.
;
mov dx, size PointDWord
sub sp, dx
mov bp, sp
mov ax, es:[bitmapWidth]
mov ss:[bp].PD_x.low, ax
mov ss:[bp].PD_x.high, 0
mov ax, es:[bitmapHeight]
mov ss:[bp].PD_y.low, ax
mov ss:[bp].PD_y.high, 0
GetResourceHandleNS TheView, bx
mov si, offset TheView
mov ax, MSG_GEN_VIEW_SET_INCREMENT
mov di, mask MF_CALL or mask MF_STACK
call ObjMessage
add sp, size PointDWord
.leave
ret
DetermineVideoMode endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanWriteCachedDataToFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Save map & data block.
CALLED BY: MSG_META_DOC_OUTPUT_WRITE_CACHED_DATA_TO_FILE
PASS: es = dgroup
bp = file handle
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 11/24/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
SokobanWriteCachedDataToFile method dynamic SokobanProcessClass,
MSG_META_DOC_OUTPUT_WRITE_CACHED_DATA_TO_FILE
mov es:[vmFileHandle], bp
;
; Call common routine for saving data.
;
mov bx, bp
call SaveGameToFile
clc
ret
SokobanWriteCachedDataToFile endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SaveGameToFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Save the various game variables into the game file.
CALLED BY: SokobanWriteCachedDataToFile (DOCUMENT_CONTROL = TRUE)
or SokobanAdvanceLevel/SaveAndCloseGameFile
(DOCUMENT_CONTROL = FALSE)
PASS: es = dgroup
bx = file handle
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS: does NOT close the file.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 7/30/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SaveGameToFile proc far
uses ax,bx,cx,dx,si,di,bp,ds,es
.enter
;
; Get the save-block handle, and also save the globals:
; level, moves, pushes, saved, position. We won't be
; rescanning the map, so we need to record all this info
; in the document file.
;
call VMGetMapBlock ; returns in ax
call VMLock
mov ds, ax
push ds:[SMB_savedMap]
push ds:[SMB_map]
mov cx, es:[level]
mov ds:[SMB_level], cx
mov cx, es:[moves]
mov ds:[SMB_moves], cx
mov cx, es:[pushes]
mov ds:[SMB_pushes], cx
mov cl, es:[walkInfo]
mov ds:[SMB_walkState], cl
mov cx, es:[internalLevel]
mov ds:[SMB_internalLevel], cx
mov cx, es:[tempSave].TSS_moves
mov ds:[SMB_savedMoves], cx
mov cx, es:[tempSave].TSS_pushes
mov ds:[SMB_savedPushes], cx
;
; Only the state bits which represent information which is valid
; across resets are stored.
;
mov cx, es:[gameState]
andnf cx, mask SGS_WON_GAME or \
mask SGS_EXTERNAL_LEVEL or mask SGS_SAVED_POS
mov ds:[SMB_state], cx ; state record
;
; Dirty & unlock the map block.
;
call VMDirty
call VMUnlock
;
; Lock the save-block and read currentMap into it.
;
pop ax ; restore save-block handle
segmov ds, es, cx ; ds = dgroup
call VMLock
mov es, ax
clr di ; es:di = saved map
mov si, offset currentMap ; ds:si = currentMap
mov cx, size Map
rep movsb
call VMDirty
call VMUnlock
;
; Lock the saved-pos map and read savedMap into it
;
pop ax ; restore save-block handle
call VMLock
mov es, ax
clr di ; es:di = saved map
mov si, offset saveMap ; ds:si = currentMap
mov cx, size Map
rep movsb
call VMDirty
call VMUnlock
.leave
ret
SaveGameToFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanReadCachedDataFromFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Setup stuff after opening a game
CALLED BY: MSG_META_DOC_OUTPUT_READ_CACHED_DATA_FROM_FILE
PASS: es = dgroup
bp = file handle
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 11/24/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
SokobanReadCachedDataFromFile method dynamic SokobanProcessClass,
MSG_META_DOC_OUTPUT_READ_CACHED_DATA_FROM_FILE
mov es:[vmFileHandle], bp
call ReadCachedDataFromFile
ret
SokobanReadCachedDataFromFile endm
endif ; DOCUMENT_CONTROL
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReadCachedDataFromFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read in the raw data from the file.
CALLED BY: SokobanReadCachedDataFromFile or ReadInGameFromFile,
depending on the value of the DOCUMENT_CONTROL option.
PASS: es = dgroup
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 7/30/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReadCachedDataFromFile proc near
uses ax,bx,cx,dx,si,di,bp
.enter
Assert dgroup es
Assert vmFileHandle bp
;
; Get the map block, lock it, and get its stuff.
;
mov bx, bp
call VMGetMapBlock ; returns ax = handle
call VMLock ; lock map block
mov ds, ax
push ds:[SMB_map] ; save-game block handle
push ds:[SMB_savedMap] ; save-position block handle
mov dx, ds:[SMB_level]
mov es:[level], dx
mov dx, ds:[SMB_moves]
mov es:[moves], dx
mov dx, ds:[SMB_pushes]
mov es:[pushes], dx
mov dx, ds:[SMB_internalLevel]
mov es:[internalLevel], dx
mov dl, ds:[SMB_walkState]
mov es:[walkInfo], dl
mov dx, ds:[SMB_savedMoves]
mov es:[tempSave].TSS_moves, dx
mov dx, ds:[SMB_savedPushes]
mov es:[tempSave].TSS_pushes, dx
;
; Since we're only storing the necessary state bits in the file,
; we can just move the whole record into the state variable.
; (none of the other bits should be set at this point).
;
mov dx, ds:[SMB_state]
mov es:[gameState], dx
call VMUnlock ; unlock map block
;
; Lock the saved-position block and read its info into saveMap.
;
pop ax ; SMB_savedMap
call VMLock
mov ds, ax
clr si ; ds:si = saved-position
mov di, offset saveMap ; global variable save map
mov cx, size Map
rep movsb ; copy away!
call VMUnlock ; unlock SMB_savedMap
;
; Lock the save block and read its info into currentMap.
;
pop ax ; ax = save game handle
call VMLock
mov ds, ax
clr si ; ds:si = map
mov di, offset currentMap ; read in current game
mov cx, size Map
rep movsb
call VMUnlock
.leave
ret
ReadCachedDataFromFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanDetachUIFromDocument
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See if we made the high score list.
CALLED BY: MSG_META_DOC_OUTPUT_DETACH_UI_FROM_DOCUMENT
PASS: es = dgroup
RETURN: carry clear if successful
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 6/15/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
SokobanDetachUIFromDocument method dynamic SokobanProcessClass,
MSG_META_DOC_OUTPUT_DETACH_UI_FROM_DOCUMENT
.enter
if HIGH_SCORES
;
; Do the high score thing, if they've gone up a level.
;
tst es:[scoreLevel]
jz noScore
call UpdateScoreList
noScore:
endif
.leave
mov di, offset SokobanProcessClass
GOTO ObjCallSuperNoLock
SokobanDetachUIFromDocument endm
endif ; DOCUMENT_CONTROL
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanPhysicalSaveAsFileHandle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: User saves game under a new name
CALLED BY: MSG_META_DOC_OUTPUT_PHYSICAL_SAVE_AS_FILE_HANDLE
PASS: es = dgroup
bp = file handle
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 11/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
SokobanPhysicalSaveAsFileHandle method dynamic SokobanProcessClass,
MSG_META_DOC_OUTPUT_PHYSICAL_SAVE_AS_FILE_HANDLE
mov es:[vmFileHandle], bp
clc
ret
SokobanPhysicalSaveAsFileHandle endm
endif ; DOCUMENT_CONTROL
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanSaveAsCompleted
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: "Save as" completed
CALLED BY: MSG_META_DOC_OUTPUT_PHYSICAL_SAVE_AS_COMPLETED
PASS: es = dgroup
bp = file handle
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey /18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
SokobanSaveAsCompleted method dynamic SokobanProcessClass,
MSG_META_DOC_OUTPUT_SAVE_AS_COMPLETED
mov es:[vmFileHandle], bp
clc
ret
SokobanSaveAsCompleted endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanOpenApplication
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Start 'er up.
CALLED BY: MSG_GEN_PROCESS_OPEN_APPLICATION
PASS: ds = es = dgroup
cx - AppAttachFlags
dx - Handle of AppLaunchBlock, or 0 if none.
This block contains the name of any document file
passed into the application on invocation. Block
is freed by caller.
bp - Handle of extra state block, or 0 if none.
This is the same block as returned from
MSG_GEN_PROCESS_CLOSE_APPLICATION, in some previous
MSG_META_DETACH. Block is freed by caller.
RETURN: nothing
AppLaunchBlock - preserved
extra state block - preserved
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 6/12/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SokobanOpenApplication method dynamic SokobanProcessClass,
MSG_GEN_PROCESS_OPEN_APPLICATION
uses ax, cx, dx, bp
.enter
if LEVEL_EDITOR
;
; See if there is a state block.
;
tst bp
jz noStateBlock
;
; Restore the editor map.
;
push ax, cx
mov bx, bp
call MemLock ; ax = segment of state block
mov ds, ax
mov di, offset es:[editorMap]
clr si
mov cx, size Map
rep movsb
call MemUnlock
pop ax, cx ; restore AppAttachFlags
segmov ds, es ; restore dgroup ptr
noStateBlock:
endif ; LEVEL_EDITOR
if not DOCUMENT_CONTROL
;
; No document control shme -- open the document file and
; initialize it if necessary.
;
call OpenAndInitGameFile
endif ; (not DOCUMENT_CONTROL)
if PLAY_SOUNDS
;
; Start the sound stuff.
;
CallMod SoundSetupSounds
;
; Play something.
;
mov cx, SS_START_GAME
CallMod SoundPlaySound
endif
.leave
;
; Call the superclass.
;
mov di, offset SokobanProcessClass
GOTO ObjCallSuperNoLock
SokobanOpenApplication endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OpenAndInitGameFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open the game file
CALLED BY: SokobanOpenApplication
PASS: es = dgroup
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS: saves file handle in global variable
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 7/30/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if not DOCUMENT_CONTROL
sokobanFileName char "SOKOBAN.000",0
nullPath char "\\",0
OpenAndInitGameFile proc near
uses ax,bx,cx,dx,si,di,bp,ds
.enter
;
; Make sure the file is in SP_DOCUMENT.
;
call FilePushDir
segmov ds, cs, dx
mov dx, offset nullPath
mov bx, SP_DOCUMENT
call FileSetCurrentPath
;
; Attempt to open the file.
;
mov ax, (VMO_CREATE shl 8) or mask VMAF_FORCE_READ_WRITE
mov dx, offset sokobanFileName
clr cx
call VMOpen ; bx = file handle
jc fail
;
; We've successfully opened the file.
;
mov bp, bx
cmp ax, VM_CREATE_OK ; new file?
jne oldFile
call InitializeGameFile
oldFile:
;
; Existing file - read in game.
;
call ReadInGameFromFile
done::
;
; Store file handle in global variable.
;
Assert dgroup es
mov es:[vmFileHandle], bx
exit:
;
; Restore working directory.
;
call FilePopDir
.leave
ret
fail:
;
; Whine at user.
;
mov ax, SST_ERROR
call UserStandardSound
jmp exit
OpenAndInitGameFile endp
endif ; not DOCUMENT_CONTROL
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanCloseApplication
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Shut down the game and close application.
CALLED BY: MSG_GEN_PROCESS_CLOSE_APPLICATION
PASS: ds = es = dgroup
RETURN: cx = handle of block to save (0 for none)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 6/12/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SokobanCloseApplication method dynamic SokobanProcessClass,
MSG_GEN_PROCESS_CLOSE_APPLICATION
uses ax, dx, bp, es
.enter
if PLAY_SOUNDS
;
; Shut down the sound stuff.
;
call SoundShutOffSounds
endif
if LEVEL_EDITOR
;
; Create a state block
;
mov ax, size Map
mov cx, (mask HAF_LOCK shl 8) or mask HF_SWAPABLE
call MemAlloc ; ax = segment, bx = handle
jnc copyMap
;
; An error occurred trying to create the state block.
;
mov ax, SST_ERROR
call UserStandardSound
clr cx
jmp done
copyMap:
;
; Copy the editor map
;
mov si, offset ds:[editorMap]
mov es,ax
clr di
mov cx, size Map
rep movsb
;
; Unlock and return the state block.
;
call MemUnlock
mov cx, bx
else ; not LEVEL_EDITOR
;
; We don't need a state block for anything, since all
; our useful information is stored in the game file.
;
clr cx ; no state block
endif
if not DOCUMENT_CONTROL
;
; Save & close the file.
;
call SaveAndCloseGameFile ; don't trash cx!
endif
done::
.leave
mov di, offset SokobanProcessClass
GOTO ObjCallSuperNoLock
SokobanCloseApplication endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SaveAndCloseGameFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Save the game and close the game file.
CALLED BY: SokonbanCloseApplication
PASS: es = dgroup
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS: closes the file
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 7/30/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if not DOCUMENT_CONTROL
SaveAndCloseGameFile proc near
uses ax,bx,cx,dx,si,di,bp
.enter
Assert dgroup es
;
; Write the various global variables into the file.
;
clr bx
xchg bx, es:[vmFileHandle]
tst bx
jz done
Assert vmFileHandle bx
call SaveGameToFile
;
; Close the file.
;
clr ax ; flags
call VMClose
jnc done
;
; Whine.
;
mov ax, SST_ERROR
call UserStandardSound
done:
.leave
ret
SaveAndCloseGameFile endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DirtyTheSavedGame
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Tells the document control the game has been dirtied
CALLED BY: MoveBag, MovePlayer
PASS: nothing
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 11/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
DirtyTheSavedGame proc far
uses ax,bx,cx,dx,si,di,bp
.enter
mov bx, es:[vmFileHandle]
call VMGetMapBlock ; returns block in ax
call VMLock
call VMDirty
call VMUnlock
.leave
ret
DirtyTheSavedGame endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanMarkBusy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Marks the app as busy.
CALLED BY: UTILITY
PASS: nothing
RETURN: nothing (ds fixed up)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 12/20/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SokobanMarkBusy proc far
uses ax,bx,cx,dx,si,di,bp
.enter
GetResourceHandleNS SokobanApp, bx
mov si, offset SokobanApp
mov di, mask MF_CALL or mask MF_FIXUP_DS
mov ax, MSG_GEN_APPLICATION_MARK_BUSY
call ObjMessage
.leave
ret
SokobanMarkBusy endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanMarkNotBusy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Marks the app as not-busy
CALLED BY: UTILITY
PASS: nothing
RETURN: nothing (ds fixed up)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 12/20/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SokobanMarkNotBusy proc far
uses ax,bx,cx,dx,si,di,bp
.enter
GetResourceHandleNS SokobanApp, bx
mov si, offset SokobanApp
mov di, mask MF_CALL or mask MF_FIXUP_DS
mov ax, MSG_GEN_APPLICATION_MARK_NOT_BUSY
call ObjMessage
.leave
ret
SokobanMarkNotBusy endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanInstallToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Install tokens.
CALLED BY: MSG_GEN_PROCESS_INSTALL_TOKEN
PASS: *ds:si = SokobanProcessClass object
ds:di = SokobanProcessClass instance data
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 8/21/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SokobanInstallToken method dynamic SokobanProcessClass,
MSG_GEN_PROCESS_INSTALL_TOKEN
.enter
;
; Call our superclass to get the ball rolling...
;
mov di, offset SokobanProcessClass
call ObjCallSuperNoLock
;
; Install datafile token.
;
mov ax, ('S') or ('O' shl 8) ; ax:bx:si = token used
mov bx, ('K') or ('d' shl 8) ; for datafile
mov si, MANUFACTURER_ID_GEOWORKS
call TokenGetTokenInfo ; is it there yet?
jnc done ; yes, do nothing
mov cx, handle SokobanDatafileMonikerList
mov dx, offset SokobanDatafileMonikerList
clr bp ; list is in data resource...
call TokenDefineToken ; add icon to token database
done:
.leave
ret
SokobanInstallToken endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SokobanUpdateEarlierIncompatibleDocument
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Update a game file from a previous sokoban
CALLED BY: MSG_META_DOC_OUTPUT_UPDATE_EARLIER_INCOMPATIBLE_DOCUMENT
PASS: es = dgroup
^lcx:dx = document object
bp = file handle
RETURN: carry = set if error
ax = FileError if carry set, otherwise destroyed
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 2/ 7/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
SokobanUpdateEarlierIncompatibleDocument method dynamic SokobanProcessClass, \
MSG_META_DOC_OUTPUT_UPDATE_EARLIER_INCOMPATIBLE_DOCUMENT
uses cx, dx, bp
.enter
;
; allocate a block for the saved position
;
mov bx,bp ; bx = VM file handle
clr ax ; user id
mov cx, size Map
call VMAlloc ; ax = block
;
; load the map block
;
push ax
call VMGetMapBlock ; ax = map block handle
call VMLock ; ax = seg, bp = handle
mov ds,ax
pop ax ; ax = saved pos block
;
; update the map block
;
call UpdateEarlierIncompatibleMapBlock
;
; unlock the map block and lock down the saved game
;
mov cx, ds:[SMB_level]
mov ax, ds:[SMB_map]
call VMUnlock
call VMLock ; ax = seg, bp = mem hdl
;
; update the saved game and unlock it
;
call UpdateEarlierIncompatibleMap
call VMUnlock
;
; set the protocol in the file
;
sub sp, size ProtocolNumber
mov cx, size ProtocolNumber
segmov es,ss
mov di,sp
mov es:[di].PN_major, SOKOBAN_DOCUMENT_PROTO_MAJOR
mov es:[di].PN_minor, SOKOBAN_DOCUMENT_PROTO_MINOR
mov ax, FEA_PROTOCOL
call FileSetHandleExtAttributes
add sp, size ProtocolNumber
;
; tell the document control we were successful
;
clc
.leave
ret
SokobanUpdateEarlierIncompatibleDocument endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UpdateEarlierIncompatibleMapBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: upgrade the map block in an old document
CALLED BY: SokobanUpdateEarlierIncompatibleDocument
PASS: ax = VM handle of saved position block
bp = mem handle of map block
ds = segment of map block
RETURN: ds = segment of map block (may have changed)
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 2/ 7/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
UpdateEarlierIncompatibleMapBlock proc near
uses ax,bx,cx
.enter
;
; resize the block
;
push ax
mov ax, size SokobanMapBlock
mov bx, bp
mov ch, mask HAF_NO_ERR or mask HAF_ZERO_INIT
call MemReAlloc
mov ds,ax ; ds = map segment
pop ax
;
; initialize the new fields
;
mov ds:[SMB_savedMap], ax
andnf ds:[SMB_state], not mask SGS_EXTERNAL_LEVEL
;
; mark the map block dirty
;
call VMDirty
.leave
ret
UpdateEarlierIncompatibleMapBlock endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UpdateEarlierIncompatibleMap
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Restore saved game map
CALLED BY: SokobanUpdateEarlierIncompatibleDocument
PASS: bp = mem handle of saved game
cx = current level
es = dgroup
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
just rescan the level
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 2/ 7/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DOCUMENT_CONTROL
UpdateEarlierIncompatibleMap proc near
uses ax,bx,cx,dx,si,di,bp,ds,es
.enter
mov es:[level], cx
;
; resize the block
;
mov ax, size Map
mov bx, bp
mov ch, mask HAF_NO_ERR
call MemReAlloc ; ax = map segent
;
; reload the current level into currentMap
;
call ConvertTextMap
;
; copy it to the VM block
;
segmov ds,es
mov es,ax ; es = map segment
mov si, offset currentMap
clr di
mov cx, size Map
rep movsb
segmov es,ds
;
; dirty the block
;
call VMDirty
.leave
ret
UpdateEarlierIncompatibleMap endp
endif
DocumentCode ends
|
sharding-core/src/main/antlr4/imports/MySQLBase.g4 | ahugeStone/sharding-sphere | 0 | 5700 | <filename>sharding-core/src/main/antlr4/imports/MySQLBase.g4<gh_stars>0
grammar MySQLBase;
import MySQLKeyword, Keyword, BaseRule, DataType, Symbol;
alias
: ID | PASSWORD
;
characterSet
: (CHARACTER | CHAR) SET EQ_? charsetName | CHARSET EQ_? charsetName
;
charsetName
: ID | BINARY
;
collateClause
: COLLATE EQ_? collationName
;
keyPartsWithParen
: LP_ keyParts RP_
;
keyParts
: keyPart (COMMA keyPart)*
;
keyPart
: columnName (LP_ NUMBER RP_)? (ASC | DESC)?
;
symbol
: ID
;
indexType
: USING (BTREE | HASH)
;
indexAndKey
: INDEX | KEY
;
indexOption
: KEY_BLOCK_SIZE EQ_? value | indexType | WITH PARSER parserName | COMMENT STRING
;
valueListWithParen
: LP_ valueList RP_
;
valueList
: value (COMMA value)*
;
value
: DEFAULT | MAXVALUE | expr | exprsWithParen
;
functionCall
: (ID | DATE) LP_ distinct? (exprs | ASTERISK)? RP_
| groupConcat
| windowFunction
;
groupConcat
: GROUP_CONCAT LP_ distinct? (exprs | ASTERISK)? (orderByClause SEPARATOR expr) RP_
;
windowFunction
: ID exprsWithParen overClause
;
overClause
: OVER LP_ windowSpec RP_
| OVER ID
;
windowSpec
: ID? windowPartitionClause? orderByClause? frameClause?
;
windowPartitionClause
: PARTITION BY exprs
;
frameClause
: frameUnits frameExtent
;
frameUnits
: ROWS | RANGE
;
frameExtent
: frameStart | frameBetween
;
frameStart
: CURRENT ROW
| UNBOUNDED PRECEDING
| UNBOUNDED FOLLOWING
| expr PRECEDING
| expr FOLLOWING
;
frameBetween
: BETWEEN frameStart AND frameEnd
;
frameEnd
: frameStart
;
variable
: (AT_ AT_)? (GLOBAL | PERSIST | PERSIST_ONLY | SESSION)? DOT? ID
;
|
programs/oeis/098/A098821.asm | karttu/loda | 1 | 164477 | ; A098821: a(n) = (n-2) * 2^(n-1) + 5.
; 4,4,5,9,21,53,133,325,773,1797,4101,9221,20485,45061,98309,212997,458757,983045,2097157,4456453,9437189,19922949,41943045,88080389,184549381,385875973,805306373,1677721605,3489660933,7247757317
mov $1,$0
sub $1,2
mov $2,2
pow $2,$0
mul $1,$2
add $1,2
div $1,2
add $1,4
|
internaltest/attr.asm | akmed772/dosvax | 1 | 82847 | ;Copyright (c) 2021 akm
;This content is under the MIT License.
;directive for NASM
[BITS 16]
SIZE equ 4000
Y_ALIGN equ 800 ;=80*2*5
global start
section .text
start:
;open ATTR.BIN
mov ax, ds
add ax, 0x10;offset DS
mov ds, ax
xor ax, ax
mov ah, 0x3d ;DOS: open an existing file
;al=0 (read mode)
mov dx, Name_Binfile
int 0x21
jc err ;jump if error
mov [hndl], ax
;get size of the file
xor dx,dx ;CX:DX (offset address) = 0
xor cx,cx
mov bx, [hndl]
mov ax, 0x4202 ;seek to end of file
int 0x21
jc err
mov [fsize], ax
or dx, dx ;file size must be <64K bytes
jnz err
add ax, Y_ALIGN
jo err
cmp ah, 0x10 ;file size must be <4096 bytes
jae err
mov ax, 0x4200 ;seek to start of file
int 0x21
;read data from the file
mov dx, rdata
mov cx, [fsize] ;size of read data
mov bx, [hndl]
mov ah, 0x3f ;DOS: read data from a file
int 0x21
jc err
;transfer data from buffer to video memory
push es
mov di, 0xE000
mov es, di
mov di, Y_ALIGN ;=80*2*6
mov ax, rdata
mov si, ax
mov cx, [fsize]
rep movsb ;repeat cx times moving byte at DS:SI to ES:DI
pop es
;close a file
mov bx, [hndl]
mov ah, 0x3e ;DOS: close a file
int 0x21
xor ax, ax
jmp exit
err:
mov al, 1
jmp exit
exit:
mov ah, 0x4c ;DOS: terminate with return code
int 0x21
section .data
Name_Binfile: db "ATTR.BIN",0
section .bss
hndl: resw 1
fsize: resw 1
rdata: resb SIZE |
oeis/215/A215602.asm | neoneye/loda-programs | 11 | 82193 | ; A215602: a(n) = L(n)*L(n+1), where L = A000032 (Lucas numbers).
; Submitted by <NAME>(s2.)
; 2,3,12,28,77,198,522,1363,3572,9348,24477,64078,167762,439203,1149852,3010348,7881197,20633238,54018522,141422323,370248452,969323028,2537720637,6643838878,17393796002,45537549123,119218851372,312119004988,817138163597,2139295485798,5600748293802,14662949395603,38388099893012,100501350283428,263115950957277,688846502588398,1803423556807922,4721424167835363,12360848946698172,32361122672259148,84722519070079277,221806434537978678,580696784543856762,1520283919093591603,3980154972736918052
mov $2,1
mov $4,2
lpb $0
sub $0,1
mov $3,$4
mov $4,$2
add $2,$3
lpe
mul $4,$2
mov $0,$4
|
Classes/boolean/class of true.applescript | looking-for-a-job/applescript-examples | 1 | 455 | <filename>Classes/boolean/class of true.applescript
#!/usr/bin/osascript
class of true
--> boolean
|
Library/SpecUI/CommonUI/CWin/cwinFieldUncommon.asm | steakknife/pcgeos | 504 | 96532 | <gh_stars>100-1000
COMMENT @---------------------------------------------------------------------
Copyright (c) GeoWorks 1994 -- All Rights Reserved
GEOWORKS CONFIDENTIAL
PROJECT: GEOS
MODULE: CommonUI/CWin (common code for several specific ui's)
FILE: cwinFieldUncommon.asm
ROUTINES:
Name Description
---- -----------
MTD MSG_GEN_FIELD_GET_TOP_GEN_APPLICATION
Look through windows on field, & find top
app
INT FieldCreateAppArrayFromWindows
Create an array of GenApplication object
optrs based on the ordering of
standard-priority windows on the field.
INT FieldCreateAppArrayFromWindowsCallback
Code largely stolen from
CreateChunkArrayOnWindowsInLayerCallback to
perform additional work necessary to yield
an array of application objects.
MTD MSG_META_GAINED_FOCUS_EXCL
Handler for gaining of field exclusive;
i.e. focus field in system
MTD MSG_META_LOST_FOCUS_EXCL
Handler for when field has lost the target
exclusive, & must force active app to no
longer be active as well
INT OLFieldUpdateFocusCommon
Handler for when field has lost the target
exclusive, & must force active app to no
longer be active as well
MTD MSG_META_GAINED_TARGET_EXCL
Handler for gaining of field exclusive;
i.e. focus field in system
MTD MSG_META_LOST_TARGET_EXCL
Handler for when field has lost the target
exclusive, & must force active app to no
longer be active as well
INT OLFieldUpdateTargetCommon
Handler for when field has lost the target
exclusive, & must force active app to no
longer be active as well
MTD MSG_META_GAINED_FULL_SCREEN_EXCL
Handler for gaining of full screen
exclusive
MTD MSG_META_LOST_FULL_SCREEN_EXCL
Handler for when field has lost the full
screen exclusive
INT OLFieldUpdateFullScreenCommon
Handler for when field has lost the full
screen exclusive
MTD MSG_META_GET_TARGET_AT_TARGET_LEVEL
Returns current target object within this
branch of the hierarchical target
exclusive, at level requested
MTD MSG_META_START_SELECT Process case of menu button being pressed
in workspace area.
MTD MSG_META_START_SELECT Process case of menu button being pressed
in workspace area.
MTD MSG_OL_FIELD_POPUP_EXPRESS_MENU
Pop up the workspace menu, at the specified
location
MTD MSG_OL_FIELD_TOGGLE_EXPRESS_MENU
Open/close field's express menu.
MTD MSG_OL_FIELD_SELECT_WINDOW_LIST_ENTRY
Brings window to front
MTD MSG_OL_FIELD_WINDOW_LIST_CLOSE_WINDOW
Close the window currently selected in the
window list.
MTD MSG_GEN_FIELD_OPEN_WINDOW_LIST
Bring up the window list dialog
MTD MSG_OL_FIELD_CLOSE_WINDOW_LIST
Close the window list.
MTD MSG_OL_WIN_CLOSE Handle specific UI close message releasing
the target so the window list will go away.
MTD MSG_META_FUP_KBD_CHAR On a DELETE keypress, we want to close the
currently selected window.
MTD MSG_META_GAINED_TARGET_EXCL
Make sure the Express Menu is hidden when
the window list come up.
MTD MSG_META_LOST_TARGET_EXCL
Since we do not have a GenApplication above
us, we need to provide some extra code to
make we lose sys target.
MTD MSG_GEN_GUP_INTERACTION_COMMAND
Make sure target goes somewhere when the
window list is closed.
MTD MSG_VIS_VUP_TERMINATE_ACTIVE_MOUSE_FUNCTION
Copied from OLAppSendToFlow because
WindowListDialog is not under an
OLApplication.
MTD MSG_GEN_INTERACTION_INITIATE
Hide the tool area immediately after it is
initiated.
MTD MSG_META_MUP_ALTER_FTVMC_EXCL
Intercept change of focus within tool area
to give this app & window the focus, as
long as a child has the focus within the
dialog.
MTD MSG_GEN_BRING_TO_TOP Brings tool area to the top. We subclass
this merely to avoid giving the focus to
it. This is done in ToolAreaAlter-
FTVMCExcl, and there seems to be a problem
doing it in both places.
MTD MSG_SPEC_GUP_QUERY_VIS_PARENT
direct requests for vis parent to UIApp
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 10/10/94 Broken out of cwinField.asm
DESCRIPTION:
$Id: cwinFieldUncommon.asm,v 1.5 98/07/10 11:06:53 joon Exp $
-----------------------------------------------------------------------------@
HighUncommon segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFieldGetTopGenApplication
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Look through windows on field, & find top app
CALLED BY: MSG_GEN_FIELD_GET_TOP_GEN_APPLICATION
UIApplicationNotify
PASS: *ds:si = OLFieldClass object
ds:di = OLFieldClass instance data
es = segment of OLFieldClass
ax = message #
RETURN: ^lcx:dx = top GenApplication
0 if none
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 3/8/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFieldGetTopGenApplication method dynamic OLFieldClass,
MSG_GEN_FIELD_GET_TOP_GEN_APPLICATION
; Run through all the windows on this field, locating focusable
; application objects for each one of standard priority. The ordering
; of the windows gives us the order in which the application objects
; should be.
;
mov di, ds:[di].VCI_window ; di <- parent window
mov bp, si ; Get *ds:bp = GenField for
; callback
call FieldCreateAppArrayFromWindows
push si
; *ds:si is now a chunk array of application object optrs in the
; order in which they should be. Use this ordering to find top one.
;
mov ax, 0 ; get first one
call ChunkArrayElementToPtr
mov cx, 0 ; in case out of bounds
jc done ; out of bounds
movdw cxdx, ({optr}ds:[di])
done:
pop ax ; free app list chunk
call LMemFree
ret
OLFieldGetTopGenApplication endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FieldCreateAppArrayFromWindows
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create an array of GenApplication object optrs based on
the ordering of standard-priority windows on the field.
CALLED BY: OLFieldOrderGenApplicationList
OLFieldGetTopGenApplication
PASS: di = field window
*ds:bp = GenField object
RETURN: *ds:si = chunk array of optrs
DESTROYED: ax, bx, cx, dx, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 2/23/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FieldCreateAppArrayFromWindows proc far
uses bp
.enter
clr al ; basic chunk. we're going to nuke
; later anyway
mov bx, size optr
clr cx, si ; create chunk, please
call ChunkArrayCreate
mov bp, si ; *ds:bp is chunk array
; cx = 0 at this point (signals to callback we need the first child)
mov bx, SEGMENT_CS
mov si, offset FieldCreateAppArrayFromWindowsCallback
push ds:[LMBH_handle] ;Save handle of segment for fixup later
call WinForEach ;Does not fixup DS!
pop bx
call MemDerefDS ;Fixup LMem segment
; We now have a list of the app objects
; *ds:bp
mov si, bp ; pass chunk array in *ds:si
.leave
ret
FieldCreateAppArrayFromWindows endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FieldCreateAppArrayFromWindowsCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Code largely stolen from
CreateChunkArrayOnWindowsInLayerCallback to perform additional
work necessary to yield an array of application objects.
CALLED BY: FieldCreateAppArrayFromWindows via WinForEach
PASS: di = window handle to process
cx = 0 if di is field and shouldn't be processed.
*ds:bp = chunk array to fill
RETURN: carry set if done
carry clear to keep going:
di = next window to process
cx = non-zero
DESTROYED: bx, si
ax, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 2/23/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FieldCreateAppArrayFromWindowsCallback proc far
.enter
mov si, WIT_FIRST_CHILD_WIN
jcxz getNextWindow
;
; Fetch window priority and ensure its layer is at the standard
; priority. We only order applications based on standard priority layers
; (anything non-standard will come up to the right place all by itself)
;
mov si, WIT_PRIORITY ; Check only standard priority layers
call WinGetInfo
andnf al, mask WPD_LAYER
cmp al, (LAYER_PRIO_STD shl offset WPD_LAYER)
jne getNextSib
;
; Make sure the UI doesn't own the thing, as it can take care of itself.
;
mov bx, di
call MemOwner ; get owning geode
cmp bx, handle ui ; if owned by the UI, skip out -- must
; be the floating tool area or
; something. In any case, the UI app
; doesn't sit below any field, so this
; would be a mistake to continue.
je getNextSib
;
; Make sure the geode that owns the thing is focusable.
;
call WinGeodeGetFlags
test ax, mask GWF_FOCUSABLE
jz getNextSib
;
; Make sure the owner has an application object to be ordered.
;
call GeodeGetAppObject ; fetch application object
tst bx
jz getNextSib ; if no app object, nothing to move
;
; Now see if the beast is already in our array (might have two different
; window layers with something else mixed in, you know, or just two
; different windows in the same layer below the field...)
;
mov dx, si ; ^lbx:dx <- app object for which to
; search
mov si, ds:[bp]
mov cx, ds:[si].CAH_count
add si, ds:[si].CAH_offset ; ds:si <- first element
jcxz append ; => no elements
checkLoop:
cmp ds:[si].chunk, dx
jne checkNext
cmp ds:[si].handle, bx
je getNextSib ; => already here, so blow it off
checkNext:
add si, size optr
loop checkLoop
append:
;
; Not already in the array, so put it at the end.
;
push di ; preserve window handle
xchg si, bp
call ChunkArrayAppend
mov ds:[di].handle, bx
mov ds:[di].chunk, dx
mov bp, si
pop di
getNextSib:
mov si, WIT_NEXT_SIBLING_WIN
getNextWindow:
call WinGetInfo ; ax <- window handle
mov_tr di, ax
ornf cx, -1 ; this one ain't the field, and
; clear the carry too, please.
.leave
ret
FieldCreateAppArrayFromWindowsCallback endp
HighUncommon ends
HighUncommon segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLFieldBringToTop
DESCRIPTION: Causes field to grab field exclusives & come to the top of
the screen.
PASS:
*ds:si - instance data
es - segment of OLFieldClass
ax - MSG_BRING_TO_TOP
RETURN: nothing
ALLOWED_TO_DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 12/89 Initial version
------------------------------------------------------------------------------@
OLFieldBringToTop method OLFieldClass, MSG_GEN_BRING_TO_TOP
; Raise window to top of window group
call VisQueryWindow
EC < or di, di >
EC < ERROR_Z OL_ERROR >
clr ax
clr dx ; Leave LayerID unchanged
call WinChangePriority
if not SINGLE_FIELD_SYSTEM
; Use MSG_META_ATTACH to reinitialize our
; options (interfaceLevel, launchModel, etc.)
mov ax, MSG_META_ATTACH
call ObjCallInstanceNoLock
endif
; Start up any detached apps - we're coming
; to the front! (It is illegal to be at
; the front with detached applications)
; (THIS IS DONE WHEN THE FIELD GETS THE
; TARGET AND FOCUS EXCLUSIVES)
;
; WE SHOULD NOT CALL MSG_GEN_FIELD_RESTORE_APPS
; HERE BECAUSE WE AREN'T THE SYSTEM'S EXCLUSIVE
; FIELD YET, SO APPS MAY NOT START UNDER US.
mov bp, mask MAEF_GRAB or mask MAEF_FULL_SCREEN or \
mask MAEF_NOT_HERE
mov cx, ds:[LMBH_handle]
mov dx, si
mov ax, MSG_META_MUP_ALTER_FTVMC_EXCL
call ObjCallInstanceNoLock
mov ax, MSG_META_GRAB_TARGET_EXCL
call ObjCallInstanceNoLock
mov ax, MSG_META_GRAB_FOCUS_EXCL
call ObjCallInstanceNoLock
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov bx, ds:[di].OLFI_focusExcl.FTVMC_OD.handle
mov si, ds:[di].OLFI_focusExcl.FTVMC_OD.chunk
tst bx
jz done
mov ax, MSG_META_GRAB_MODEL_EXCL
clr di
call ObjMessage
done:
ret
OLFieldBringToTop endm
COMMENT @----------------------------------------------------------------------
METHOD: OLFieldLowerToBottom
DESCRIPTION: Causes field to grab field exclusives & come to the top of
the screen.
PASS:
*ds:si - instance data
es - segment of OLFieldClass
ax - MSG_GEN_LOWER_TO_BOTTOM
RETURN: nothing
ALLOWED_TO_DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 12/89 Initial version
------------------------------------------------------------------------------@
OLFieldLowerToBottom method OLFieldClass, MSG_GEN_LOWER_TO_BOTTOM
mov ax, MSG_META_RELEASE_FOCUS_EXCL
call ObjCallInstanceNoLock
mov ax, MSG_META_RELEASE_TARGET_EXCL
call ObjCallInstanceNoLock
mov bp, mask MAEF_FULL_SCREEN or mask MAEF_NOT_HERE
mov cx, ds:[LMBH_handle]
mov dx, si
mov ax, MSG_META_MUP_ALTER_FTVMC_EXCL
call ObjCallInstanceNoLock
call VisQueryWindow
tst di
jz done
mov ax, mask WPF_PLACE_BEHIND
clr dx ; Leave LayerID unchanged
call WinChangePriority
mov ax, MSG_META_ENSURE_ACTIVE_FT
call UserCallSystem
done:
ret
OLFieldLowerToBottom endm
COMMENT @----------------------------------------------------------------------
METHOD: OLFieldConsumeMessage
DESCRIPTION: Consume the event so that the superclass will NOT provide
default handling for it.
PASS: *ds:si - instance data
es - segment of OLFieldClass
ax - message to eat
RETURN: nothing
ax, cx, dx, bp - destroyed
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 10/91 Initial version
------------------------------------------------------------------------------@
OLFieldConsumeMessage method OLFieldClass, MSG_META_FORCE_GRAB_KBD,
MSG_VIS_FORCE_GRAB_LARGE_MOUSE,
MSG_VIS_FORCE_GRAB_MOUSE,
MSG_META_GRAB_KBD,
MSG_VIS_GRAB_LARGE_MOUSE,
MSG_VIS_GRAB_MOUSE,
MSG_META_RELEASE_KBD,
MSG_VIS_RELEASE_MOUSE
ret
OLFieldConsumeMessage endm
COMMENT @----------------------------------------------------------------------
METHOD: OLFieldGainedFocusExcl
DESCRIPTION: Handler for gaining of field exclusive; i.e. focus field
in system
PASS:
*ds:si - instance data
es - segment of OLFieldClass
ax - MSG_META_GAINED_FOCUS_EXCL
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 9/91 Initial version
------------------------------------------------------------------------------@
OLFieldGainedFocusExcl method dynamic OLFieldClass,
MSG_META_GAINED_FOCUS_EXCL
; Start up any detached apps - we're coming
; to the front! (It is illegal to be at
; the front with detached applications)
push ax
mov ax, MSG_GEN_FIELD_RESTORE_APPS
call ObjCallInstanceNoLock
pop ax
call OLFieldUpdateFocusCommon
; Update keyboard grab
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov cx, ds:[di].OLFI_focusExcl.FTVMC_OD.handle
mov dx, ds:[di].OLFI_focusExcl.FTVMC_OD.chunk
call SysUpdateKbdGrab
ret
OLFieldGainedFocusExcl endm
COMMENT @----------------------------------------------------------------------
METHOD: OLFieldLostFocusExcl
DESCRIPTION: Handler for when field has lost the target exclusive, &
must force active app to no longer be active as well
PASS:
*ds:si - instance data
es - segment of OLFieldClass
ax - MSG_META_LOST_FOCUS_EXCL
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 9/91 Initial version
------------------------------------------------------------------------------@
OLFieldLostFocusExcl method dynamic OLFieldClass,
MSG_META_LOST_FOCUS_EXCL
call OLFieldUpdateFocusCommon
; Force release of keyboard grab
;
clr cx
clr dx
call SysUpdateKbdGrab
ret
OLFieldLostFocusExcl endm
;
;---
;
OLFieldUpdateFocusCommon proc far
mov bp, MSG_META_GAINED_FOCUS_EXCL ; Pass base message in bp
mov bx, offset Vis_offset
mov di, offset OLFI_focusExcl
GOTO FlowUpdateHierarchicalGrab
OLFieldUpdateFocusCommon endp
COMMENT @----------------------------------------------------------------------
METHOD: OLFieldGainedTargetExcl
DESCRIPTION: Handler for gaining of field exclusive; i.e. focus field
in system
PASS:
*ds:si - instance data
es - segment of OLFieldClass
ax - MSG_META_GAINED_FOCUS_EXCL
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 9/91 Initial version
------------------------------------------------------------------------------@
OLFieldGainedTargetExcl method dynamic OLFieldClass,
MSG_META_GAINED_TARGET_EXCL
push ax
; Set ourselves up as being the new default field within the system
;
mov cx, ds:[LMBH_handle]
mov dx, si
mov ax, MSG_GEN_SYSTEM_SET_DEFAULT_FIELD
call UserCallSystem
; Start up any detached apps - we're coming
; to the front! (It is illegal to be at
; the front with detached applications)
mov ax, MSG_GEN_FIELD_RESTORE_APPS
call ObjCallInstanceNoLock
pop ax
GOTO OLFieldUpdateTargetCommon
OLFieldGainedTargetExcl endm
COMMENT @----------------------------------------------------------------------
METHOD: OLFieldLostTargetExcl
DESCRIPTION: Handler for when field has lost the target exclusive, &
must force active app to no longer be active as well
PASS:
*ds:si - instance data
es - segment of OLFieldClass
ax - MSG_META_LOST_TARGET_EXCL
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 9/91 Initial version
------------------------------------------------------------------------------@
OLFieldLostTargetExcl method dynamic OLFieldClass, \
MSG_META_LOST_TARGET_EXCL
call OLFieldUpdateTargetCommon
; We're no longer the default field. Clear out reference to us in the
; system object
;
EC < mov ax, MSG_GEN_SYSTEM_GET_DEFAULT_FIELD >
EC < call UserCallSystem >
EC < cmp cx, ds:[LMBH_handle] >
EC < jne badAssumption >
EC < cmp dx, si >
EC < jne badAssumption >
clr cx
clr dx
mov ax, MSG_GEN_SYSTEM_SET_DEFAULT_FIELD
call UserCallSystem
ret
EC <badAssumption: >
EC < ERROR OL_FIELD_BAD_ASSUMPTION_REGARDING_DEFAULT_FIELD >
OLFieldLostTargetExcl endm
;
;----
;
OLFieldUpdateTargetCommon proc far
mov bp, MSG_META_GAINED_TARGET_EXCL ; Pass base message in bp
mov bx, offset Vis_offset
mov di, offset OLFI_targetExcl
GOTO FlowUpdateHierarchicalGrab
OLFieldUpdateTargetCommon endp
COMMENT @----------------------------------------------------------------------
METHOD: OLFieldGainedFullScreenExcl
DESCRIPTION: Handler for gaining of full screen exclusive
PASS:
*ds:si - instance data
es - segment of OLFieldClass
ax - MSG_META_GAINED_FULL_SCREEN_EXCL
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 4/93 Initial version
------------------------------------------------------------------------------@
OLFieldGainedFullScreenExcl method dynamic OLFieldClass,
MSG_META_GAINED_FULL_SCREEN_EXCL
GOTO OLFieldUpdateFullScreenCommon
OLFieldGainedFullScreenExcl endm
COMMENT @----------------------------------------------------------------------
METHOD: OLFieldLostFullScreenExcl
DESCRIPTION: Handler for when field has lost the full screen exclusive
PASS:
*ds:si - instance data
es - segment of OLFieldClass
ax - MSG_META_LOST_FULL_SCREEN_EXCL
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 4/93 Initial version
------------------------------------------------------------------------------@
OLFieldLostFullScreenExcl method dynamic OLFieldClass,
MSG_META_LOST_FULL_SCREEN_EXCL
FALL_THRU OLFieldUpdateFullScreenCommon
OLFieldLostFullScreenExcl endm
;
;---
;
OLFieldUpdateFullScreenCommon proc far
mov bp, MSG_META_GAINED_FULL_SCREEN_EXCL ; base message in bp
mov bx, offset Vis_offset
mov di, offset OLFI_fullScreenExcl
GOTO FlowUpdateHierarchicalGrab
OLFieldUpdateFullScreenCommon endp
HighUncommon ends
HighUncommon segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLFieldGetTarget
DESCRIPTION: Returns current target object within this branch of the
hierarchical target exclusive, at level requested
PASS:
*ds:si - instance data
es - segment of OLFieldClass
ax - MSG_META_GET_TARGET_AT_TARGET_LEVEL
cx - TargetLevel
RETURN:
cx:dx - OD of target at level requested (0 if none)
ax:bp - Class of target object
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 1/90 Initial version
------------------------------------------------------------------------------@
OLFieldGetTarget method dynamic OLFieldClass, \
MSG_META_GET_TARGET_AT_TARGET_LEVEL
mov ax, TL_GEN_FIELD
mov bx, Vis_offset
mov di, offset OLFI_targetExcl
call FlowGetTargetAtTargetLevel
ret
OLFieldGetTarget endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLFieldStartMenu
DESCRIPTION: Process case of menu button being pressed in workspace area.
CALLED BY: INTERNAL
PASS:
*ds:si - OLButton object
cx, cx - ptr position
bp - OLBF_IN flag set appropriately
RETURN:
ax - 0 if ptr not in button, MRF_PROCESSED if ptr is inside
DESTROYED:
bx, cx, dx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
MENU causes the workspace menu to come up, in non-stay-up
mode. If menu is released within a certain amount of time,
a transition is made to stay-up mode.
In stay up mode, the menu button is undepressed. In non-stay-up
mode, the button will stay depressed until the menu should be
taken down, which occurs when the button is notified of having
lost the active exclusive from its UI window.
States:
OLFI_menuTimer - time at which button was pressed
on button such that a menu was
brought up.
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 7/89 Initial version
------------------------------------------------------------------------------@
if (0) ; The ability to bring up the Express menu
; by pressing the mouse in the field is hereby
; turned off, effective 6/23/92 -- Doug
; The reasons for its demise:
;
; 1) The standard Express menu is working again,
; so it is no longer necessary.
; 2) The field version didn't kick the menu
; into stay-up mode, which would be the
; correct behavior, & I don't have time to
; go trying to get it to work correctly.
OLFieldStartMenu method dynamic OLFieldClass, MSG_META_START_SELECT
mov ax, MSG_OL_FIELD_POPUP_EXPRESS_MENU
GOTO ObjCallInstanceNoLock
OLFieldStartMenu endm
endif
if (0) ; didn't work.
; A test -- let's see if we can remotely get express menu up as a stay-up menu.
;
OLFieldPutExpressMenuUpInStayUpMode method dynamic OLFieldClass, \
MSG_META_START_SELECT
; Create the workspace menu if not
; already existing, add to GenField w/
; upward link only
call OLFieldEnsureExpressMenu
push si
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov si, ds:[di].OLFI_expressMenu ;set *ds:si = menu
mov ax, MSG_OL_POPUP_ACTIVATE ; bring up menu
call ObjCallInstanceNoLock ; put it up.
mov ax, MSG_MO_MW_ENTER_STAY_UP_MODE
clr cx
call ObjCallInstanceNoLock ; put it up.
pop si
ret
OLFieldPutExpressMenuUpInStayUpMode endp
endif
COMMENT @----------------------------------------------------------------------
FUNCTION: OLFieldPopupExpressMenu
DESCRIPTION: Pop up the workspace menu, at the specified location
CALLED BY: INTERNAL
PASS:
*ds:si - OLButton object
cx, dx - ptr position (in field window)
RETURN:
ax - 0 if ptr not in button, MRF_PROCESSED if ptr is inside
DESTROYED:
bx, cx, dx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
In stay up mode, the menu button is undepressed. In non-stay-up
mode, the button will stay depressed until the menu should be
taken down, which occurs when the button is notified of having
lost the active exclusive from its UI window.
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 7/89 Initial version
------------------------------------------------------------------------------@
if (0) ; The ability to bring up the Express menu
; by pressing the mouse in the field is hereby
; turned off, effective 6/23/92 -- Doug
; The reasons for its demise:
;
; 1) The standard Express menu is working again,
; so it is no longer necessary.
; 2) The field version didn't kick the menu
; into stay-up mode, which would be the
; correct behavior, & I don't have time to
; go trying to get it to work correctly.
OLFieldPopupExpressMenu method dynamic OLFieldClass, \
MSG_OL_FIELD_POPUP_EXPRESS_MENU
; Create the workspace menu if not
; already existing, add to GenField w/
; upward link only
call OLFieldEnsureExpressMenu
mov di, ds:[si]
add di, ds:[di].Vis_offset
tst ds:[di].OLFI_expressMenu ; if no exrpress menu on field,
jz done ; exit.
push si
mov si, ds:[di].OLFI_expressMenu ;set *ds:si = menu
mov ax, MSG_OL_POPUP_ACTIVATE ; bring up menu
call ObjCallInstanceNoLock ; put it up.
pop si
call VisAddButtonPostPassive ; Add post-passive grab so we
; can take down the menu when
; everything goes away.
done:
mov ax, mask MRF_PROCESSED ; show processed
ret
OLFieldPopupExpressMenu endm
endif
if _EXPRESS_MENU
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFieldToggleExpressMenu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open/close field's express menu.
CALLED BY: MSG_OL_FIELD_TOGGLE_EXPRESS_MENU
PASS: *ds:si = OLFieldClass object
ds:di = OLFieldClass instance data
es = segment of OLFieldClass
ax = MSG_OL_FIELD_TOGGLE_EXPRESS_MENU
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 11/30/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFieldToggleExpressMenu method dynamic OLFieldClass,
MSG_OL_FIELD_TOGGLE_EXPRESS_MENU
tst ds:[di].OLFI_expressMenu ; if no exrpress menu on field,
jz done ; exit.
mov si, ds:[di].OLFI_expressMenu ;set *ds:si = menu
EC < mov di, segment OLPopupWinClass >
EC < mov es, di >
EC < mov di, offset OLPopupWinClass >
EC < call ObjIsObjectInClass >
EC < ERROR_NC OL_ERROR >
;
; if not vis built yet, open it
;
call VisCheckIfSpecBuilt
jnc open ; nope, open
;
; check if currently opened
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].VI_attrs, mask VA_REALIZED
jnz close ; visible, close it
;
; else, open it
;
open:
mov ax, MSG_OL_POPUP_FIND_BUTTON
call ObjCallInstanceNoLock ; ^lcx:dx = button
tst dx
jz done
movdw bxsi, cxdx
mov ax, MSG_GEN_ACTIVATE
clr di
GOTO ObjMessage ; open menu
close:
mov cx, IC_DISMISS
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
GOTO ObjCallInstanceNoLock
done:
ret
OLFieldToggleExpressMenu endm
endif ; if _EXPRESS_MENU
HighUncommon ends
HighUncommon segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: OLFieldUpdateTaskBarList
DESCRIPTION: Update taskbar list
PASS: *ds:si = OLFieldClass object
cx = TRUE - do a full update
FALSE - just update current selection
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 9/92 initial version
------------------------------------------------------------------------------@
if _ISUI ;_-------------------------------------------------------------------
OLFieldUpdateTaskBarList method dynamic OLFieldClass,
MSG_OL_FIELD_UPDATE_TASK_BAR_LIST
mov bx, ds:[di].OLFI_windowListList
tst bx
LONG jz done
mov si, ds:[di].OLFI_toolArea
tst si
LONG jz done
push cx
mov ax, MSG_GEN_FIND_CHILD_AT_POSITION
mov cx, 1
call ObjCallInstanceNoLock
EC < cmp cx, ds:[LMBH_handle] >
EC < ERROR_NE -1 >
mov si, dx
EC < push es, di >
EC < segmov es, <segment GenDynamicListClass>, di >
EC < mov di, offset GenDynamicListClass >
EC < call ObjIsObjectInClass >
EC < ERROR_NC -1 >
EC < pop es, di >
pop cx
jcxz updateSelection
xchg bx, si
mov ax, MSG_GEN_COUNT_CHILDREN
call ObjCallInstanceNoLock ; dx = num children
xchg bx, si
; This is a convenient place to set the destination of the taskbar list
mov di, ds:[si]
add di, ds:[di].Gen_offset
mov ds:[di].GIGI_destination.offset, bx
mov ax, ds:[LMBH_handle]
mov ds:[di].GIGI_destination.handle, ax
mov ax, MSG_GEN_DYNAMIC_LIST_INITIALIZE
mov cx, dx
call ObjCallInstanceNoLock
updateSelection:
xchg bx, si
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
call ObjCallInstanceNoLock
cmp ax, GIGS_NONE
je setNone
mov cx, ax
mov ax, MSG_GEN_ITEM_GROUP_GET_ITEM_OPTR
call ObjCallInstanceNoLock
jcxz setNone
mov ax, MSG_GEN_FIND_CHILD
call ObjCallInstanceNoLock ; bp = child position
jc setNone
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
mov cx, bp
jmp setSelection
setNone:
mov ax, MSG_GEN_ITEM_GROUP_SET_NONE_SELECTED
setSelection:
xchg bx, si
clr dx
GOTO ObjCallInstanceNoLock
done:
ret
OLFieldUpdateTaskBarList endm
endif ;----------------------------------------------------------------------
COMMENT @----------------------------------------------------------------------
FUNCTION: OLFieldSelectWindowListEntry
DESCRIPTION: Brings window to front
PASS: *ds:si - instance data
ds:bx - instance data
RETURN: ax = chunk handle of currently selected item
carry set if no window selected
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 9/92 initial version
------------------------------------------------------------------------------@
if _ISUI ;--------------------------------------------------------------------
OLFieldSelectWindowListEntry method dynamic OLFieldClass,
MSG_OL_FIELD_SELECT_WINDOW_LIST_ENTRY
;
; Get current selection
;
mov si, ds:[di].OLFI_windowListList
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
call ObjCallInstanceNoLock
jc done
;
; Send notification to the entry itself (which will provide
; behavior of relaying notification to window)
;
mov si, ax
mov ax, MSG_META_NOTIFY_TASK_SELECTED
call ObjCallInstanceNoLock
mov ax, si
clc
done:
ret
OLFieldSelectWindowListEntry endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFieldWindowListCloseWindow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close the window currently selected in the window list.
CALLED BY: MSG_OL_FIELD_WINDOW_LIST_CLOSE_WINDOW
PASS: *ds:si = OLFieldClass object
ds:di = OLFieldClass instance data
ds:bx = OLFieldClass object (same as *ds:si)
es = segment of OLFieldClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 9/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI ;--------------------------------------------------------------------
OLFieldWindowListCloseWindow method dynamic OLFieldClass,
MSG_OL_FIELD_WINDOW_LIST_CLOSE_WINDOW
mov ax, MSG_OL_FIELD_SELECT_WINDOW_LIST_ENTRY
call ObjCallInstanceNoLock
jc done
mov si, ax
mov ax, MSG_OL_WINDOW_LIST_ITEM_CLOSE_WINDOW
call ObjCallInstanceNoLock
done:
ret
OLFieldWindowListCloseWindow endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFieldOpenWindowList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Bring up the window list dialog
CALLED BY: MSG_GEN_FIELD_OPEN_WINDOW_LIST
PASS: *ds:si = OLFieldClass object
ds:di = OLFieldClass instance data
ds:bx = OLFieldClass object (same as *ds:si)
es = segment of OLFieldClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 1/25/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI ;--------------------------------------------------------------------
OLFieldOpenWindowList method dynamic OLFieldClass,
MSG_GEN_FIELD_OPEN_WINDOW_LIST
mov si, ds:[di].OLFI_windowListDialog
tst si
jz done
mov ax, MSG_GEN_INTERACTION_INITIATE
GOTO ObjCallInstanceNoLock
done:
ret
OLFieldOpenWindowList endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WindowListClose
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle specific UI close message releasing the target so
the window list will go away.
CALLED BY: MSG_OL_WIN_CLOSE
PASS: *ds:si = WindowListDialogClass object
ds:di = WindowListDialogClass instance data
ds:bx = WindowListDialogClass object (same as *ds:si)
es = segment of WindowListDialogClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 11/16/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI ;--------------------------------------------------------------------
WindowListClose method dynamic WindowListDialogClass, MSG_OL_WIN_CLOSE
mov ax, MSG_META_RELEASE_TARGET_EXCL
GOTO ObjCallInstanceNoLock
WindowListClose endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WindowListKeyboard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: On a DELETE keypress, we want to close the currently
selected window.
CALLED BY: MSG_META_FUP_KBD_CHAR
PASS: *ds:si = WindowListDialogClass object
ds:di = WindowListDialogClass instance data
ds:bx = WindowListDialogClass object (same as *ds:si)
es = segment of WindowListDialogClass
ax = message #
RETURN: carry set if character was handled by someone (and should
not be used elsewhere).
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 10/23/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI ;--------------------------------------------------------------------
WindowListKeyboard method dynamic WindowListDialogClass,
MSG_META_FUP_KBD_CHAR
test dl, mask CF_FIRST_PRESS
jz done ; ignore if not first press
tst dh
jnz callSuper ; callsuper if any ShiftState
SBCS < cmp cx, (VC_ISCTRL shl 8) or VC_ESCAPE >
DBCS < cmp cx, C_SYS_ESCAPE >
jne notESC
mov ax, MSG_OL_WIN_CLOSE ; close if Escape key pressed
call ObjCallInstanceNoLock
jmp handled
notESC:
SBCS < cmp cx, (VC_ISCTRL shl 8) or VC_DEL >
DBCS < cmp cx, C_SYS_DELETE >
jne callSuper ; callsuper if not DELETE key
mov ax, MSG_OL_FIELD_WINDOW_LIST_CLOSE_WINDOW
call GenCallParent
handled:
stc
ret
callSuper:
mov di, offset WindowListDialogClass
GOTO ObjCallSuperNoLock
done:
ret
WindowListKeyboard endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WindowListLostTargetExcl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Since we do not have a GenApplication above us, we need
to provide some extra code to make we lose sys target.
CALLED BY: MSG_META_LOST_TARGET_EXCL
PASS: *ds:si = WindowListDialogClass object
ds:di = WindowListDialogClass instance data
ds:bx = WindowListDialogClass object (same as *ds:si)
es = segment of WindowListDialogClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 10/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI ;--------------------------------------------------------------------
WindowListLostTargetExcl method dynamic WindowListDialogClass,
MSG_META_LOST_TARGET_EXCL
mov di, offset WindowListDialogClass
call ObjCallSuperNoLock
;
; Close window list dialog.
;
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
mov bx, ds:[LMBH_handle]
mov di, mask MF_FORCE_QUEUE
GOTO ObjMessage
WindowListLostTargetExcl endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WindowListInteractionCommand
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make sure target goes somewhere when the window list is closed.
CALLED BY: MSG_GEN_GUP_INTERACTION_COMMAND
PASS: *ds:si = WindowListDialogClass object
ds:di = WindowListDialogClass instance data
ds:bx = WindowListDialogClass object (same as *ds:si)
es = segment of WindowListDialogClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 3/26/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI ;--------------------------------------------------------------------
WindowListInteractionCommand method dynamic WindowListDialogClass,
MSG_GEN_GUP_INTERACTION_COMMAND
push cx
mov di, offset WindowListDialogClass
call ObjCallSuperNoLock
pop cx
cmp cx, IC_DISMISS
jne done
mov ax, MSG_META_GET_FOCUS_EXCL
call GenCallParent
mov ax, MSG_META_GRAB_TARGET_EXCL
movdw bxsi, cxdx
clr di
GOTO ObjMessage
done:
ret
WindowListInteractionCommand endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WindowListVisVupBumpMouse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copied from OLAppSendToFlow because WindowListDialog is not
under an OLApplication.
CALLED BY: MSG_VIS_VUP_BUMP_MOUSE
PASS: *ds:si = WindowListDialogClass object
ds:di = WindowListDialogClass instance data
ds:bx = WindowListDialogClass object (same as *ds:si)
es = segment of WindowListDialogClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 6/17/93 Initial version copied from OLAppSendToFlow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI ;--------------------------------------------------------------------
WindowListSendToFlow method dynamic WindowListDialogClass,
MSG_VIS_VUP_TERMINATE_ACTIVE_MOUSE_FUNCTION, \
MSG_VIS_VUP_GET_MOUSE_STATUS, \
MSG_VIS_VUP_BUMP_MOUSE
mov di, mask MF_CALL
GOTO UserCallFlow
WindowListSendToFlow endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WindowListListQueryTaskBarItemMoniker
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get moniker from window list and copy to taskbar
CALLED BY: MSG_WINDOW_LIST_LIST_QUERY_TASK_BAR_ITEM_MONIKER
PASS: *ds:si = WindowListListClass object
ds:di = WindowListListClass instance data
ds:bx = WindowListListClass object (same as *ds:si)
es = segment of WindowListListClass
ax = message #
^lcx:dx = dynamic list requesting moniker (taskbar list)
bp = position of item requested
RETURN: nothing
DESTROYED: ax, cx, dx, bp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI ;--------------------------------------------------------------------
WindowListListQueryTaskBarItemMoniker method dynamic WindowListListClass,
MSG_WINDOW_LIST_LIST_QUERY_TASK_BAR_ITEM_MONIKER
movdw bxdi, cxdx ; ^lbx:di = taskbar list
push bp
mov ax, MSG_GEN_FIND_CHILD_AT_POSITION
mov cx, bp
call ObjCallInstanceNoLock
pop bp
jcxz done
push bp
mov si, dx
mov ax, MSG_GEN_GET_VIS_MONIKER
call ObjCallInstanceNoLock
pop bp
tst ax
jz done
mov si, di
mov cx, ds:[LMBH_handle]
mov dx, ax
mov ax, MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_MONIKER_OPTR
mov di, mask MF_CALL or mask MF_FIXUP_DS
GOTO ObjMessage
done:
ret
WindowListListQueryTaskBarItemMoniker endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WindowListListSelectItem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get moniker from window list and copy to taskbar
CALLED BY: MSG_WINDOW_LIST_LIST_SELECT_ITEM
PASS: *ds:si = WindowListListClass object
ds:di = WindowListListClass instance data
ds:bx = WindowListListClass object (same as *ds:si)
es = segment of WindowListListClass
ax = message #
cx = position of the item to be selected
bp = number of selections
dl = GenItemGroupStateFlags
RETURN: none
DESTROYED: ax, cx, dx, bp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI ;--------------------------------------------------------------------
WindowListListSelectItem method dynamic WindowListListClass,
MSG_WINDOW_LIST_LIST_SELECT_ITEM
mov ax, MSG_GEN_FIND_CHILD_AT_POSITION
call ObjCallInstanceNoLock ; ^lcx:dx = item
jcxz done ; dx = identifier
mov si, dx
mov ax, MSG_META_NOTIFY_TASK_SELECTED
GOTO ObjCallInstanceNoLock
done:
ret
WindowListListSelectItem endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TaskBarListAddChild
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add some hints to TaskBarList items
CALLED BY: MSG_GEN_ADD_CHILD
PASS: *ds:si = TaskBarListClass object
ds:di = TaskBarListClass instance data
ds:bx = TaskBarListClass object (same as *ds:si)
es = segment of TaskBarListClass
ax = message #
^lcx:dx = child object to add
bp = flags for how to add child (CompChildFlags)
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 3/11/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI ;--------------------------------------------------------------------
TaskBarListAddChild method dynamic TaskBarListClass,
MSG_GEN_ADD_CHILD
push cx, dx
mov di, offset TaskBarListClass
call ObjCallSuperNoLock
pop cx, dx
movdw bxsi, cxdx
call ObjSwapLock
push bx
clr cx
mov ax, HINT_CAN_CLIP_MONIKER_WIDTH
call ObjVarAddData
mov ax, HINT_EXPAND_WIDTH_TO_FIT_PARENT
call ObjVarAddData
mov ax, HINT_EXPAND_HEIGHT_TO_FIT_PARENT
call ObjVarAddData
mov ax, HINT_MAXIMUM_SIZE
mov cx, size GadgetSizeHintArgs
call ObjVarAddData
mov ds:[bx].GSHA_width, SpecWidth <SST_AVG_CHAR_WIDTHS, 20>
mov ds:[bx].GSHA_height, 0
pop bx
call ObjSwapUnlock
ret
TaskBarListAddChild endm
endif ;----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SysTrayInteractionVisDraw
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Draw border
CALLED BY: MSG_VIS_DRAW
PASS: *ds:si = SysTrayInteractionClass object
ds:di = SysTrayInteractionClass instance data
ds:bx = SysTrayInteractionClass object (same as *ds:si)
es = segment of SysTrayInteractionClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 3/5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _ISUI or (_MOTIF and EXTENDIBLE_SYSTEM_TRAY)
SysTrayInteractionVisDraw method dynamic SysTrayInteractionClass,
MSG_VIS_DRAW
push bp
mov di, offset SysTrayInteractionClass
call ObjCallSuperNoLock
pop di ; di = gstate
call VisGetBounds
push ax
call GetDarkColor ;al <- dark color
mov ah, C_WHITE ;ah <- light color
mov bp, ax
pop ax
call OpenDrawRect
ret
SysTrayInteractionVisDraw endm
endif ; _ISUI
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolAreaRawUnivEnter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mouse pointer entered window
CALLED BY: MSG_META_RAW_UNIV_ENTER
PASS: *ds:si = ToolAreaClass object
ds:di = ToolAreaClass instance data
ds:bx = ToolAreaClass object (same as *ds:si)
es = segment of ToolAreaClass
ax = message #
^lcx:dx = InputObj of window method refers to
^hbp = Window that method refers to
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 1/31/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if TOOL_AREA_IS_TASK_BAR
ToolAreaRawUnivEnter method dynamic ToolAreaClass,
MSG_META_RAW_UNIV_ENTER
mov di, offset ToolAreaClass
call ObjCallSuperNoLock
push ds
segmov ds, dgroup
tst ds:[taskBarAutoHide]
pop ds
jz done
mov di, ds:[si]
add di, ds:[di].Gen_offset
andnf ds:[di].TAI_state, not mask TASF_AUTO_HIDE
clr ax, bx
xchg ax, ds:[di].TAI_autoHideTimerID
xchg bx, ds:[di].TAI_autoHideTimerHandle
call TimerStop ; kill the auto-hide timer
mov ax, MSG_VIS_MARK_INVALID ; ensure toolarea completely
mov cl, mask VOF_WINDOW_INVALID ; on-screen
mov dl, VUM_NOW
GOTO ObjCallInstanceNoLock
done:
ret
ToolAreaRawUnivEnter endm
endif ; TOOL_AREA_IS_TASK_BAR
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolAreaRawUnivLeave
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mouse pointer left window
CALLED BY: MSG_META_RAW_UNIV_LEAVE
PASS: *ds:si = ToolAreaClass object
ds:di = ToolAreaClass instance data
ds:bx = ToolAreaClass object (same as *ds:si)
es = segment of ToolAreaClass
ax = message #
^lcx:dx = InputObj of window method refers to
^hbp = Window that method refers to
RETURN: none
DESTROYED: ax, cx, dx, bp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if TOOL_AREA_IS_TASK_BAR
ToolAreaRawUnivLeave method dynamic ToolAreaClass,
MSG_META_RAW_UNIV_LEAVE
mov di, offset ToolAreaClass
call ObjCallSuperNoLock
push ds
segmov ds, dgroup
tst ds:[taskBarAutoHide]
pop ds
jz done
mov di, ds:[si]
add di, ds:[di].Gen_offset
EC < tst ds:[di].TAI_autoHideTimerID >
EC < ERROR_NZ OL_ERROR >
EC < tst ds:[di].TAI_autoHideTimerHandle >
EC < ERROR_NZ OL_ERROR >
StartAutoHideTimer label far
mov al, TIMER_EVENT_ONE_SHOT ; al = TimerType
mov bx, ds:[LMBH_handle] ; ^lbx:si = timer OD
mov cx, 15 ; 1/4 sec before auto-hide
mov dx, MSG_TOOL_AREA_AUTO_HIDE ; dx = method
call TimerStart
mov di, ds:[si]
add di, ds:[di].Gen_offset
mov ds:[di].TAI_autoHideTimerID, ax
mov ds:[di].TAI_autoHideTimerHandle, bx
done:
ret
ToolAreaRawUnivLeave endm
endif ; TOOL_AREA_IS_TASK_BAR
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolAreaAutoHide
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Hide taskbar
CALLED BY: MSG_TOOL_AREA_AUTO_HIDE
PASS: *ds:si = ToolAreaClass object
ds:di = ToolAreaClass instance data
ds:bx = ToolAreaClass object (same as *ds:si)
es = segment of ToolAreaClass
ax = message #
RETURN: none
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if TOOL_AREA_IS_TASK_BAR
ToolAreaAutoHide method dynamic ToolAreaClass,
MSG_TOOL_AREA_AUTO_HIDE
push ds
segmov ds, dgroup
tst ds:[taskBarAutoHide]
pop ds
jz done
; if the auto-hide timer was already stopped, then just exit
clr ax, bx
xchg ax, ds:[di].TAI_autoHideTimerID
xchg bx, ds:[di].TAI_autoHideTimerHandle
tst bx
jz done
; wait a while longer if a menu is open
mov ax, MSG_GEN_FIND_CHILD_AT_POSITION
clr cx ; find 1st child
call ObjCallInstanceNoLock
jc hide
push si
movdw bxsi, cxdx
EC < mov ax, MSG_META_IS_OBJECT_IN_CLASS >
EC < mov cx, segment ExpressMenuControlClass >
EC < mov dx, offset ExpressMenuControlClass >
EC < mov di, mask MF_CALL or mask MF_FIXUP_DS >
EC < call ObjMessage >
EC < ERROR_NC OL_ERROR >
mov ax, MSG_VIS_GET_ATTRS
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
pop si
test cl, mask VA_VISIBLE
jnz waitMore
hide:
mov di, ds:[si]
add di, ds:[di].Gen_offset
ornf ds:[di].TAI_state, mask TASF_AUTO_HIDE
mov ax, MSG_VIS_MARK_INVALID
mov cl, mask VOF_WINDOW_INVALID
mov dl, VUM_NOW
GOTO ObjCallInstanceNoLock
waitMore:
call StartAutoHideTimer
done:
ret
ToolAreaAutoHide endm
endif ; TOOL_AREA_IS_TASK_BAR
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolAreaStartSelect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle start select for possible move of taskbar
CALLED BY: MSG_META_START_SELECT
PASS: *ds:si = ToolAreaClass object
es = segment of ToolAreaClass
ax = message #
RETURN: none
DESTROYED: ax, cx, dx, bp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if TOOL_AREA_IS_TASK_BAR or (_MOTIF and EXTENDIBLE_SYSTEM_TRAY)
ToolAreaStartSelect method dynamic ToolAreaClass,
MSG_META_START_SELECT
; update the mouse pointer image, in case we have not received a
; MSG_META_PTR event recently
mov di, ds:[si]
add di, ds:[di].Vis_offset
call OpenWinUpdatePtrImage
; startup SMCO mechanism, and send event on to children
push cx, dx
call OpenWinStartButton
pop bx, bp
test ax, mask MRF_PROCESSED
jnz done
; set MOVING or RESIZING flags
segmov es, dgroup, ax
if TOOL_AREA_IS_TASK_BAR
tst es:[taskBarMovable]
jz noMove ; not supported
else
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].TAI_state, mask TASF_FLOATING_TRAY
jz noMove
endif
mov di, ds:[si]
add di, ds:[di].Vis_offset
or ds:[di].OLWI_moveResizeState, mask OLWMRS_MOVING or \
mask OLWMRS_MOVE_RESIZE_PENDING
mov es:[olXorFlags], 0
mov es:[olScreenStart].P_x, bx
mov es:[olScreenStart].P_y, bp
call VisGrabMouse
noMove:
mov ax, mask MRF_PROCESSED
done:
ret
ToolAreaStartSelect endm
endif ; TOOL_AREA_IS_TASK_BAR or (_MOTIF and EXTENDIBLE_SYSTEM_TRAY)
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolAreaVisMoveResizeWin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Constrain taskbar position to the top or bottom of the screen
CALLED BY: MSG_VIS_MOVE_RESIZE_WIN
PASS: *ds:si = ToolAreaClass object
es = segment of ToolAreaClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if TOOL_AREA_IS_TASK_BAR
ToolAreaVisMoveResizeWin method dynamic ToolAreaClass,
MSG_VIS_MOVE_RESIZE_WIN
mov bl, ds:[di].TAI_state
push ds
segmov ds, dgroup, ax
mov ax, ds:[taskBarPosition]
pop ds
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov cx, ds:[di].VI_bounds.R_left
sub ds:[di].VI_bounds.R_left, cx
sub ds:[di].VI_bounds.R_right, cx
call OpenGetScreenDimensions
mov bp, dx
shr bp, 1
cmp ds:[di].VI_bounds.R_top, bp
jg bottom
test bl, mask TASF_AUTO_HIDE
jnz topHide
clr cx
xchg cx, ds:[di].VI_bounds.R_top
sub ds:[di].VI_bounds.R_bottom, cx
tst ax
jle callSuper ; skip update if already at top
jmp updatePosition
topHide:
mov cx, 1 ; need one pixel on-screen
xchg cx, ds:[di].VI_bounds.R_bottom
dec cx ; need one pixel on-screen
sub ds:[di].VI_bounds.R_top, cx
tst ax
jle callSuper
jmp updatePosition
bottom:
test bl, mask TASF_AUTO_HIDE
jnz bottomHide
sub dx, ds:[di].VI_bounds.R_bottom
add ds:[di].VI_bounds.R_top, dx
add ds:[di].VI_bounds.R_bottom, dx
tst ax
jg callSuper ; skip update if already at bottom
jmp updatePosition
bottomHide:
dec dx ; need one pixel on-screen
sub dx, ds:[di].VI_bounds.R_top
add ds:[di].VI_bounds.R_top, dx
add ds:[di].VI_bounds.R_bottom, dx
tst ax
jg callSuper ; skip update if already at bottom
updatePosition:
push ds, si
mov bp, ds:[di].VI_bounds.R_top
segmov ds, dgroup, cx
mov ds:[taskBarPosition], bp
mov cx, cs
mov ds, cx
mov dx, offset taskBarPositionKey
mov si, offset taskBarPositionCategory
call InitFileWriteInteger
pop ds, si
; fixup window positions
mov ax, MSG_OL_FIELD_SEND_TO_GEN_APPLICATIONS
mov dx, MSG_OL_APP_UPDATE_WINDOWS_FOR_TASK_BAR
call VisCallParent
callSuper:
mov ax, MSG_VIS_MOVE_RESIZE_WIN
mov di, offset ToolAreaClass
GOTO ObjCallSuperNoLock
ToolAreaVisMoveResizeWin endm
taskBarPositionCategory char "motif options",0
taskBarPositionKey char "taskBarPosition",0
endif ; TOOL_AREA_IS_TASK_BAR
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolAreaInteractionInitiate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Hide the tool area immediately after it is initiated.
CALLED BY: MSG_GEN_INTERACTION_INITIATE
PASS: *ds:si = ToolAreaClass object
es = segment of ToolAreaClass
ax = message #
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 11/20/92 Initial version
brianc 11/30/92 updated for UIEP_LOWER_LEFT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if TOOL_AREA_IS_TASK_BAR
;
; this used to be MSG_GEN_INTERACTION_INITIATE, but that is too late
;
ToolAreaInitPosition method dynamic ToolAreaClass, MSG_TOOL_AREA_INIT_POSITION
mov ax, HINT_POSITION_WINDOW_AT_RATIO_OF_PARENT
mov cx, size SpecWinSizePair
call ObjVarAddData
clr cx
mov dx, 0 ; assume top of screen
push ds
segmov ds, dgroup
tst ds:[taskBarPosition]
pop ds
jle setPosition
mov dx, mask SWSS_RATIO or PCT_100
setPosition:
mov ds:[bx].SWSP_x, cx
mov ds:[bx].SWSP_y, dx
ret
ToolAreaInitPosition endm
endif ; TOOL_AREA_IS_TASK_BAR
ToolAreaInteractionInitiate method dynamic ToolAreaClass,
MSG_GEN_INTERACTION_INITIATE
mov di, offset ToolAreaClass
call ObjCallSuperNoLock
if TOOL_AREA_IS_TASK_BAR
push ds
segmov ds, dgroup
tst ds:[taskBarAutoHide]
pop ds
jz noHide
push ax
mov ax, MSG_TOOL_AREA_AUTO_HIDE
mov di, ds:[si]
add di, ds:[di].Gen_offset
mov ds:[di].TAI_autoHideTimerHandle, ax
call ObjCallInstanceNoLock
pop ax
noHide:
endif ; TOOL_AREA_IS_TASK_BAR
if (not TOOL_AREA_IS_TASK_BAR)
;
; if UIEP_LOWER_LEFT, force a move so that it'll be position at
; the lower left
;
push es
segmov es, dgroup, ax ;es = dgroup
mov ax, es:[olExpressOptions]
pop es
andnf ax, mask UIEO_POSITION
cmp ax, UIEP_LOWER_LEFT shl offset UIEO_POSITION
jne done
push si
mov bx, segment OLFieldClass
mov si, offset OLFieldClass
mov dx, size OLFieldMoveToolAreaParams
sub sp, dx
mov bp, sp
mov ss:[bp].OLFMTAP_geode, 0 ; park the tool area off screen
mov ss:[bp].OLFMTAP_xPos, 0 ; not needed for parking off-screen
mov ss:[bp].OLFMTAP_yPos, 0 ; not needed for parking off-screen
if EVENT_MENU
mov ss:[bp].OLFMTAP_eventPos, 0
endif
; not needed for parking off-screen
mov ss:[bp].OLFMTAP_layerPriority, 0
mov ax, MSG_OL_FIELD_MOVE_TOOL_AREA
mov di, mask MF_RECORD or mask MF_STACK
call ObjMessage
add sp, size OLFieldMoveToolAreaParams
pop si
mov cx, di
mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS
call GenCallParent
endif ; (not TOOL_AREA_IS_TASK_BAR)
done:
ret
ToolAreaInteractionInitiate endm
HighUncommon ends
HighUncommon segment resource
COMMENT @----------------------------------------------------------------------
METHOD: ToolAreaAlterFTVMCExcl
DESCRIPTION: Intercept change of focus within tool area to give this
app & window the focus, as long as a child has the focus
within the dialog.
PASS:
*ds:si - instance data (for object in OLField class)
es - segment of OLFieldClass
ax - MSG_META_MUP_ALTER_FTVMC_EXCL
^lcx:dx - object requesting grab/release
bp - MetaAlterFTVMCExclFlags
RETURN: nothing
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 6/92 Initial version
------------------------------------------------------------------------------@
ToolAreaAlterFTVMCExcl method dynamic ToolAreaClass,
MSG_META_MUP_ALTER_FTVMC_EXCL
;
; redirect requests to UIApp, if a OLWin object
;
push ax, cx, dx, bp, bx, si
movdw bxsi, cxdx
mov cx, segment OLWinClass
mov dx, offset OLWinClass
mov ax, MSG_META_IS_OBJECT_IN_CLASS
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
pop ax, cx, dx, bp, bx, si
jnc callSuper
call UserCallApplication
;
; if focus under UIApp, give it focus, else have it release focus
;
mov ax, MSG_VIS_FUP_QUERY_FOCUS_EXCL
call UserCallApplication ; ^lcx:dx = focus
jcxz release
;grab:
mov ax, MSG_META_GRAB_FOCUS_EXCL
GOTO UserCallApplication
release:
mov ax, MSG_META_RELEASE_FOCUS_EXCL
call UserCallApplication
mov ax, MSG_META_ENSURE_ACTIVE_FT
GOTO UserCallSystem
callSuper:
mov di, offset ToolAreaClass
GOTO ObjCallSuperNoLock
ToolAreaAlterFTVMCExcl endm
COMMENT @----------------------------------------------------------------------
METHOD: ToolAreaBringToTop --
MSG_GEN_BRING_TO_TOP for ToolAreaClass
DESCRIPTION: Brings tool area to the top. We subclass this merely to
avoid giving the focus to it. This is done in ToolAreaAlter-
FTVMCExcl, and there seems to be a problem doing it in both
places.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_GEN_BRING_TO_TOP
RETURN:
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 11/ 3/92 Initial Version
------------------------------------------------------------------------------@
ToolAreaBringToTop method dynamic ToolAreaClass, \
MSG_GEN_BRING_TO_TOP
;
; Hack things to avoid giving the express menu the focus.
;
mov di, ds:[si] ; can't use incoming ds:di!
add di, ds:[di].Vis_offset ; (ToolAreaClass is
; subclass of GenInter)
or ds:[di].OLCI_buildFlags, mask OLBF_TOOLBOX
mov di, offset ToolAreaClass
call ObjCallSuperNoLock
mov di, ds:[si]
add di, ds:[di].Vis_offset
and ds:[di].OLCI_buildFlags, not mask OLBF_TOOLBOX
ret
ToolAreaBringToTop endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolAreaGupQueryVisParent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: direct requests for vis parent to UIApp
CALLED BY: MSG_SPEC_GUP_QUERY_VIS_PARENT
PASS: *ds:si = ToolAreaClass object
ds:di = ToolAreaClass instance data
es = segment of ToolAreaClass
ax = MSG_SPEC_GUP_QUERY_VIS_PARENT
cx = SpecQueryVisParentType
RETURN: carry = set if data found & returned, clear if no object
responded
^lcx:dx = object suitable to be visible parent
ALLOWED TO DESTROY:
ax, bp
bx, si, di, ds, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 2/5/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ToolAreaGupQueryVisParent method dynamic ToolAreaClass,
MSG_SPEC_GUP_QUERY_VIS_PARENT
cmp cx, SQT_VIS_PARENT_FOR_POPUP
jne toApp
;
; Make our own vis parent (the field on which we sit) be the parent of
; any popup. It makes no sense to me to have it be the application
; object -- ardeb 10/5/95
;
call VisFindParent
movdw cxdx, bxsi
stc
ret
toApp:
;
; pass on to UIApp
;
call UserCallApplication
ret
ToolAreaGupQueryVisParent endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolAreaDraw
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: don't draw anything for ourselves, just our children
CALLED BY: MSG_VIS_DRAW
PASS: *ds:si = ToolAreaClass object
ds:di = ToolAreaClass instance data
ds:bx = ToolAreaClass object (same as *ds:si)
es = segment of ToolAreaClass
ax = message #
cl - DrawFlags: DF_EXPOSED set if GState is set to update window
^hbp - GState to draw through.
RETURN:
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 10/22/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if EVENT_MENU
ToolAreaDraw method dynamic ToolAreaClass,
MSG_VIS_DRAW
mov di, segment VisCompClass
mov es, di
mov di, offset VisCompClass
call ObjCallClassNoLock
ret
ToolAreaDraw endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolAreaRecalcSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: always minimize
CALLED BY: MSG_VIS_RECALC_SIZE
PASS: *ds:si = ToolAreaClass object
ds:di = ToolAreaClass instance data
ds:bx = ToolAreaClass object (same as *ds:si)
es = segment of ToolAreaClass
ax = message #
cx, dx = suggested size
RETURN: cx, dx = desired size
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 10/22/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if EVENT_MENU
ToolAreaRecalcSize method dynamic ToolAreaClass,
MSG_VIS_RECALC_SIZE
mov cx, mask RSA_CHOOSE_OWN_SIZE ; allow minimal width
mov di, offset ToolAreaClass
call ObjCallSuperNoLock
ret
ToolAreaRecalcSize endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolAreaGetMinimumSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: return minimal width
CALLED BY: MSG_VIS_COMP_GET_MINIMUM_SIZE
PASS: *ds:si = ToolAreaClass object
ds:di = ToolAreaClass instance data
ds:bx = ToolAreaClass object (same as *ds:si)
es = segment of ToolAreaClass
ax = message #
RETURN: cx, dx = minimum size
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 10/22/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if EVENT_MENU
ToolAreaGetMinimumSize method dynamic ToolAreaClass,
MSG_VIS_COMP_GET_MINIMUM_SIZE
mov di, offset ToolAreaClass
call ObjCallSuperNoLock
mov cx, 0 ; allow mimimal width
ret
ToolAreaGetMinimumSize endm
endif
if RECTANGULAR_ROTATION
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFieldRotateDisplay
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Rotate!
CALLED BY: MSG_GEN_ROTATE_DISPLAY
PASS: *ds:si = OLFieldClass object
ds:di = OLFieldClass instance data
RETURN: nuthin'
DESTROYED: nuthin' 'ceptin' ax, cx, dx, 'n' bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 2/ 2/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFieldRotateDisplay method dynamic OLFieldClass, MSG_GEN_ROTATE_DISPLAY
.enter
;
; Get the new bounds.
;
mov ax, MSG_VIS_GET_BOUNDS ; cx = width, dx = heigth
call ObjCallInstanceNoLock
xchg cx, dx ; cx = height
call ResizeFieldWindow
;
; Resize the field.
;
mov ax, MSG_VIS_SET_SIZE
call ObjCallInstanceNoLock
;
; Invalidate.
;
call VisMarkFullyInvalid ; uses VUM_MANUAL
;
; Tell children to rotate.
;
call RotateChildCallback
done:
.leave
ret
OLFieldRotateDisplay endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ResizeFieldWindow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Resize the field window.
CALLED BY: OLFieldRotateDisplay
PASS: nothing
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 2/ 9/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ResizeFieldWindow proc near
uses dx
.enter
;
; Get the window for resizing.
;
push cx, dx
mov ax, MSG_VIS_QUERY_WINDOW
call ObjCallInstanceNoLock
pop bx, dx
jcxz done
;
; Resize the window without generating an expose event.
;
push si
mov di, cx ; ^hdi = window
push ax
mov si, WIT_COLOR
mov ah, mask WCF_PLAIN ; no expose event!
call WinSetInfo ; (WIT_COLOR, WCF_PLAIN)
pop ax
mov_tr cx, bx ; cx = height
mov bx, mask WPF_ABS; move in absolute screen coordinates
push bx ; put WinPassFlags on stack
clr ax, bx, bp, si ; top, left, &
; associated region (none)
call WinResize
;
; Set the WinColorFlags back to what they were before.
;
mov si, WIT_COLOR
mov ah, mask WCF_TRANSPARENT
call WinSetInfo ; (WIT_COLOR, WCF_PLAIN)
pop si ; *ds:si = field
done:
.leave
ret
ResizeFieldWindow endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RotateChildCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Tell child to rotate.
CALLED BY: OLFieldRotate
PASS: *ds:si = field
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 2/ 8/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RotateChildCallback proc far
uses ax,bx,cx,dx,si,di,bp
.enter
;
; quit all apps in this field
;
mov di, ds:[si]
add di, ds:[di].Gen_offset
mov di, ds:[di].GFI_genApplications
tst di ; any apps?
jz done ; nope
mov di, ds:[di] ; ds:di = list
inc di
jz done ; no apps
dec di
jz done ; no apps
ChunkSizePtr ds, di, cx ; cx = size of list
shr cx
shr cx ; cx = number of apps
;
; send to all applications
; *ds:si = GenField
; cx = number of GenApps
;
mov di, ds:[si]
add di, ds:[di].Gen_offset
mov di, ds:[di].GFI_genApplications
mov di, ds:[di] ; ds:di = GenApp list
appLoop:
push cx ; save GenApp counter
push si ; save GenField chunk
;
; send MSG_GEN_ROTATE_DISPLAY to GenApp object
;
mov bx, ds:[di]+2 ; GenApp handle
mov si, ds:[di]+0 ; GenApp chunk
push di ; save GenApp list offset
mov ax, MSG_GEN_ROTATE_DISPLAY
;
; force-queue -> doesn't move lmem block
;
mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE
call ObjMessage
pop di ; retrieve GenApp list offset
add di, size optr
pop si ; *ds:si = GenField
pop cx ; cx = GenApp counter
loop appLoop
done:
.leave
ret
RotateChildCallback endp
endif ; RECTANGULAR_ROTATION
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFieldSendToGenApplications
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send message to GFI_genApplications
CALLED BY: MSG_OL_FIELD_SEND_TO_GEN_APPLICATIONS
PASS: *ds:si = OLFieldClass object
es = segment of OLFieldClass
ax = message #
dx = message to send
RETURN: nothing
DESTROYED: ax, cx, dx, bp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if TOOL_AREA_IS_TASK_BAR
OLFieldSendToGenApplications method dynamic OLFieldClass,
MSG_OL_FIELD_SEND_TO_GEN_APPLICATIONS
mov bp, ds:[si]
add bp, ds:[bp].Gen_offset
mov bp, ds:[bp].GFI_genApplications
tst bp
jz done ; no genApps
mov bp, ds:[bp]
inc bp
jz done ; no genApps
dec bp
jz done ; no genApps
ChunkSizePtr ds, bp, cx ; cx = size
shr cx
shr cx ; cx = number of genApps
jcxz done ; no genApps
genAppLoop:
push cx, dx, bp
movdw bxsi, ds:[bp] ; ^lbx:si = GenApplication
mov ax, dx ; ax = message to send
clr di
call ObjMessage
pop cx, dx, bp
add bp, size optr
loop genAppLoop
done:
ret
OLFieldSendToGenApplications endm
endif ; TOOL_AREA_IS_TASK_BAR
HighUncommon ends
|
data/profiles/N64/libs/sm64mlib/sm64functions.asm | DavidSM64/SimpleArmipsGui | 10 | 241311 | <reponame>DavidSM64/SimpleArmipsGui
// Note: All macro names are not case-sensitive
.macro .f_CalSaveChecksum, ramAddr, numBytes, upper16
li a0, ramAddr
li a1, numBytes
jal 0x8027939C
li.l a2, upper16
.endmacro
.macro .f_CheckCurrObjBehavior, behAddr
li.u a0, behAddr
jal 0x802A14FC
li.l a0, behAddr
.endmacro
.macro .f_CheckObjBehavior, objPtr, behAddr
li a0, objPtr
li.u a1, behAddr
jal 0x802A1554
li.l a1, behAddr
.endmacro
// Needed to clear .f_PlayTransition
.macro .f_ClearTransition
sb r0, 0x8033BAB3
.endmacro
.macro .f_ConfigureTimer, option
jal 0x802495E0
li.l a0, option
.endmacro
.macro .f_CreateBreakParticles, count, mdlID, size_f, param
li a0, count
li a1, mdlID
li a2, float(size_f)
jal 0x802AE0CC
li.l a3, param
.endmacro
.macro .f_CreateStar, x_f, y_f, z_f
li a0, float(x_f)
mtc1 a0, f12
li a0, float(y_f)
mtc1 a0, f14
li.u a2, float(z_f)
jal 0x802F2B88
li.l a2, float(z_f)
.endmacro
.macro .f_cosf_imm, angle_rad_f
li a0, float(angle_rad_f)
jal 0x80325310
mtc1 a0, f12
.endmacro
.macro .f_cosf, reg_f
jal 0x80325310
mov.s f12, reg_f
.endmacro
.macro .f_DeactivateObject, obj1_ptr
lw.u a0, obj1_ptr
jal 0x802A0568 // DeactivateObject
lw.l a1, obj1_ptr
.endmacro
.macro .f_DistanceFromObject3D, obj1_ptr, obj2_ptr
lw a0, obj1_ptr
lw.u a1, obj2_ptr
jal 0x8029E2F8 // DistanceFromObject3D
lw.l a1, obj2_ptr
.endmacro
.macro .f_DistanceFromObject3D_imm, obj1_ptr, obj2_ptr
li a0, obj1_ptr
li.u a1, obj2_ptr
jal 0x8029E2F8 // DistanceFromObject3D
li.l a1, obj2_ptr
.endmacro
.macro .f_DmaCopy, ramAddr, romStart, romEnd
li a0, ramAddr
li a1, romStart
li.u a2, romEnd
jal 0x80278504
li.l a2, romEnd
.endmacro
.macro .f_ExplodeCurrObject
jal 0x802E6AF8
nop
.endmacro
.macro .f_HideCurrObj
jal 0x8029F620
nop
.endmacro
.macro .f_IsMarioGroundPounding
jal 0x802A3754
nop
.endmacro
.macro .f_IsMarioStepping
jal 0x802A3CFC
nop
.endmacro
.macro .f_memcpy, dst, src, numBytes
li a0, strPtr
li a1, strPtr
jal 0x803273F0
li.l a2, numBytes
.endmacro
.macro .f_memset, dst, value, numBytes
li a0, dst
li a1, value
li a2, numBytes
beqz a2, memset_End
move a3, a0
@@memset_Loop:
addiu a2, a2, 0xFFFF
addiu a3, a3, 0x01
bnez a2, memset_Loop
sb a1, 0xFFFF(a3)
@@memset_End:
move v0, r0
.endmacro
.macro .f_osEepromRead, eepGroup, eepRAM
li a0, 0x8033AF78
li a2, eepRAM
jal 0x80329150
li.l a1, eepGroup
.endmacro
.macro .f_osEepromWrite, eepGroup, eepRAM
li a0, 0x8033AF78
li a2, eepRAM
jal 0x80328AF0
li.l a1, eepGroup
.endmacro
.macro .f_osEepromLongRead, eepGroup, eepRAM, numBytes
li a0, 0x8033AF78
li a1, eepGroup
li a2, eepRAM
jal 0x80324690
li.l a3, numBytes
.endmacro
.macro .f_osEepromLongWrite, eepGroup, eepRAM, numBytes
li a0, 0x8033AF78
li a1, eepGroup
li a2, eepRAM
jal 0x803247D0
li.l a3, numBytes
.endmacro
.macro .f_osViBlack, setBlackout
jal 0x80323340
li.l a0, setBlackout
.endmacro
.macro .f_PlaySound, argument
li.u a0, argument
jal 0x802CA190
li.l a0, argument
.endmacro
.macro .f_PlayTransition, image, time, red, green, blue
li a0, blue
sb a0, 0x10(sp)
li a0, image
li a1, time
li a2, red
jal 0x8027B1A0
li.l a3, green
.endmacro
.macro .f_PrintByte, x, y, strAddr, valueAddr
li a0, x
li a1, y
lb a3, valueAddr
la.u a2, strAddr
jal 0x802D62D8
la.l a2, strAddr
.endmacro
.macro .f_PrintUByte, x, y, strAddr, valueAddr
li a0, x
li a1, y
lbu a3, valueAddr
la.u a2, strAddr
jal 0x802D62D8
la.l a2, strAddr
.endmacro
.macro .f_PrintShort, x, y, strAddr, valueAddr
li a0, x
li a1, y
lh a3, valueAddr
la.u a2, strAddr
jal 0x802D62D8
la.l a2, strAddr
.endmacro
.macro .f_PrintUShort, x, y, strAddr, valueAddr
li a0, x
li a1, y
lhu a3, valueAddr
la.u a2, strAddr
jal 0x802D62D8
la.l a2, strAddr
.endmacro
.macro .f_PrintInt, x, y, strAddr, valueAddr
li a0, x
li a1, y
lw a3, valueAddr
la.u a2, strAddr
jal 0x802D62D8
la.l a2, strAddr
.endmacro
.macro .f_PrintImm, x, y, strAddr, value
li a0, x
li a1, y
li a3, value
la.u a2, strAddr
jal 0x802D62D8
la.l a2, strAddr
.endmacro
.macro .f_PrintReg, x, y, strAddr, register
li a0, x
li a1, y
move a3, register
la.u a2, strAddr
jal 0x802D62D8
la.l a2, strAddr
.endmacro
.macro .f_PrintXY, x, y, strAddr
li a0, x
li a1, y
la.u a2, strAddr
jal 0x802D66C0
la.l a2, strAddr
.endmacro
.macro .f_RandomRange, offset, multipler
li a0, offset
jal 0x802FA964
li.l a1, multipler
.endmacro
.macro .f_RandomRange2, offset, multipler, mod
li a0, offset
li a1, multipler
jal 0x802FA964
li.l a2, mod
.endmacro
// Returns V0 = u16 value from 0x0000 to 0xFFFF
.macro .f_RandomU16
jal 0x80383BB0
nop
.endmacro
// Returns F0 = float value from 0.0 to 1.0
.macro .f_RandomFloat
jal 0x80383CB4
nop
.endmacro
// Returns V0 = either 1 or -1
.macro .f_RandomSign
jal 0x80383D1C
nop
.endmacro
.macro .f_RotateTorwardsMario, obj_C8, obj_160, speed
lw a0, obj_C8
lw a1, obj_160
jal 0x8029E530
li.l a2, speed
.endmacro
.macro .f_SaveFileData, fileNumber
li.l a0, 0x01
lui at, 0x8034
sb a0, 0xB4A5(at)
sb a0, 0xB4A6(at)
jal 0x80279840
li.l a0, fileNumber
.endmacro
.macro .f_SaveMenuData
li a0, 0x01
lui at, 0x8034
jal 0x802794A0
sb a0, 0xB4A5(at)
.endmacro
.macro .f_SegmentedToVirtual, segAddr
li.u a0, segAddr
jal 0x80277F50
li.l a0, segAddr
.endmacro
.macro .f_SetCurrObjAnimation, animIndex
jal 0x8029F464
li.l a0, animIndex
.endmacro
.macro .f_SetCurrObjModel, mdlID
jal 0x802A04C0
li.l a0, mdlID
.endmacro
.macro .f_SetCurrObjScale, scale_f
li a0, float(scale_f)
jal 0x8029F430
mtc1 a0, f12
.endmacro
.macro .f_SetObjBehavior, objPtr, behAddr
li a1, behAddr
li.u a0, objPtr
jal 0x802A14C4
li.l a0, objPtr
.endmacro
.macro .f_SetObjScale, objPtr, sx_f, sy_f, sz_f
li a1, float(sx_f)
li a2, float(sy_f)
li a3, float(sz_f)
li.u a0, objPtr
jal 0x8029F3D0
li.l a0, objPtr
.endmacro
.macro .f_ShakeScreen, intensity
jal 0x802A50FC
li.l a0, intensity
.endmacro
.macro .f_sinf_imm, angle_rad_f
li a0, float(angle_rad_f)
jal 0x80325480
mtc1 a0, f12
.endmacro
.macro .f_sinf, reg_f
jal 0x80325480
mov.s f12, reg_f
.endmacro
.macro .f_SpawnObj, parentPtr, mdlID, behAddr
.if (parentPtr == SM64_CURR_OBJ_PTR) || (parentPtr == SM64_MARIO_OBJ_PTR)
lw a0, parentPtr
la a2, behAddr
jal 0x8029EDCC
li.l a1, mdlID
.else
.error "Sorry, .f_SpawnObj only supports SM64_CURR_OBJ_PTR and SM64_MARIO_OBJ_PTR at the moment!"
.endif
.endmacro
.macro .f_SpawnObjXYZ, mdlID, behAddr, x_f, y_f, z_f
lw a0, SM64_MARIO_OBJ_PTR
la a2, behAddr
jal 0x8029EDCC
li a1, mdlID
li a0, float(x_f)
mtc1 a0, f12
li a1, float(y_f)
mtc1 a1, f14
li a2, float(z_f)
mtc1 a2, f16
swc1 f12, 0xA0(v0)
swc1 f14, 0xA4(v0)
swc1 f16, 0xA8(v0)
.endmacro
.macro .f_strchr, strPtr, char
li a0, strPtr
jal 0x80327444
li.l a1, char
.endmacro
.macro .f_strlen, strPtr
li.u a0, strPtr
jal 0x8032741C
li.l a0, strPtr
.endmacro
// Tests for buttons held down by controller 1
; buttons = buttons pressed by player
; heldDown = make this false if you want an action to only happen once
; branchFalseLabel = branch to label if false
.macro .f_TestInput, buttons, heldDown, branchFalseLabel
.if heldDown
lh at, 0x8033AFA0
.else
lw at, 0x8033AFA0
.endif
andi at, at, buttons
li a0, buttons
bne at, a0, branchFalseLabel
nop
.endmacro
// Tests for buttons held down by controller 2
; buttons = buttons pressed by player
; heldDown = make this false if you want an action to only happen once
; branchFalseLabel = branch to label if false
.macro .f_TestInput2, buttons, heldDown, branchFalseLabel
.if heldDown
lh at, 0x8033AFBC
.else
lw at, 0x8033AFBC
.endif
andi at, at, buttons
li a0, buttons
bne at, a0, branchFalseLabel
nop
.endmacro
.macro .f_TestForMarioAction, action, branchFalseLabel
li a0, action
lw a1, SM64_MARIO_ACTION
bne a0, a1, branchFalseLabel
nop
.endmacro
.macro .f_TestForNotMarioAction, action, branchFalseLabel
li a0, action
lw a1, SM64_MARIO_ACTION
beq a0, a1, branchFalseLabel
nop
.endmacro
.macro .f_UnhideCurrObj
jal 0x8029F6BC
nop
.endmacro
.macro .f_WarpMario, warpToID, delay
lui at, 0x8034
li a0, 0x01
sh a0, 0xB252(at)
li a0, delay
sh a0, 0xB254(at)
li a0, warpToID
sh a0, 0xB256(at)
.endmacro
|
demo2.asm | 6502/js6502 | 18 | 4640 | ;
; Special locations
; (they work with LDA/STA abs only!)
;
set_palette = $FF00 ; W: sets current index
write_color = $FF01 ; W++: R, G or B
set_row = $FF02 ; W: pixel row
set_col = $FF03 ; W: pixel col
write_pixel = $FF04 ; W++: writes a pixel
random = $FF80 ; R: a random byte
clock0 = $FF81 ; R: updates clock and returns low byte
clock1 = $FF82 ; R: returns second byte of clock
clock2 = $FF83 ; R: returns third byte of clock
clock3 = $FF84 ; R: returns fourth byte of clock
;
; Execution begins at "start" and stops when
; program counter becomes $0000
;
.org $0200
start:
;
; "Regular" non-self-modifying code
;
ldx #$00
ldy #$10
lda #$00
sta set_row
sta set_col
loop1:
sta write_pixel
clc
adc #$01
bne loop1
dex
bne loop1
clc
adc #$01
dey
bne loop1
jmp $0300
.org $0300
;
; Self-modifying code
;
ldx #$00
ldy #$10
loop2:
lda #$00 ; <----- $00 will be incremented!
sta write_pixel
inc $0305
bne loop2
dex
bne loop2
inc $0305
dey
bne loop2
jmp $0000
|
externals/ffmpeg/libavcodec/x86/v210.asm | vuece/vuece-libjingle | 0 | 90560 | <reponame>vuece/vuece-libjingle
;******************************************************************************
;* V210 SIMD unpack
;* Copyright (c) 2011 <NAME> <<EMAIL>>
;* Copyright (c) 2011 <NAME> <<EMAIL>>
;*
;* This file is part of Libav.
;*
;* Libav is free software; you can redistribute it and/or
;* modify it under the terms of the GNU Lesser General Public
;* License as published by the Free Software Foundation; either
;* version 2.1 of the License, or (at your option) any later version.
;*
;* Libav is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;* Lesser General Public License for more details.
;*
;* You should have received a copy of the GNU Lesser General Public
;* License along with Libav; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "libavutil/x86/x86inc.asm"
%include "libavutil/x86/x86util.asm"
SECTION_RODATA
v210_mask: times 4 dd 0x3ff
v210_mult: dw 64,4,64,4,64,4,64,4
v210_luma_shuf: db 8,9,0,1,2,3,12,13,4,5,6,7,-1,-1,-1,-1
v210_chroma_shuf: db 0,1,8,9,6,7,-1,-1,2,3,4,5,12,13,-1,-1
SECTION .text
%macro v210_planar_unpack 2
; v210_planar_unpack(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width)
cglobal v210_planar_unpack_%1_%2, 5, 5
movsxdifnidn r4, r4d
lea r1, [r1+2*r4]
add r2, r4
add r3, r4
neg r4
mova m3, [v210_mult]
mova m4, [v210_mask]
mova m5, [v210_luma_shuf]
mova m6, [v210_chroma_shuf]
.loop
%ifidn %1, unaligned
movu m0, [r0]
%else
mova m0, [r0]
%endif
pmullw m1, m0, m3
psrld m0, 10
psrlw m1, 6 ; u0 v0 y1 y2 v1 u2 y4 y5
pand m0, m4 ; y0 __ u1 __ y3 __ v2 __
shufps m2, m1, m0, 0x8d ; y1 y2 y4 y5 y0 __ y3 __
pshufb m2, m5 ; y0 y1 y2 y3 y4 y5 __ __
movu [r1+2*r4], m2
shufps m1, m0, 0xd8 ; u0 v0 v1 u2 u1 __ v2 __
pshufb m1, m6 ; u0 u1 u2 __ v0 v1 v2 __
movq [r2+r4], m1
movhps [r3+r4], m1
add r0, mmsize
add r4, 6
jl .loop
REP_RET
%endmacro
INIT_XMM
v210_planar_unpack unaligned, ssse3
%if HAVE_AVX
INIT_AVX
v210_planar_unpack unaligned, avx
%endif
INIT_XMM
v210_planar_unpack aligned, ssse3
%if HAVE_AVX
INIT_AVX
v210_planar_unpack aligned, avx
%endif
|
src/tests/ahven/ahven-results.adb | RREE/ada-util | 60 | 5226 | <reponame>RREE/ada-util<gh_stars>10-100
--
-- Copyright (c) 2007-2009 <NAME> <<EMAIL>>
--
-- Permission to use, copy, modify, and distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--
with Ada.Unchecked_Deallocation;
package body Ahven.Results is
use Ahven.Results.Result_List;
use Ahven.Results.Result_Info_List;
-- Bunch of setters and getters.
-- The implementation is straightforward.
procedure Set_Test_Name (Info : in out Result_Info;
Name : Bounded_String) is
begin
Info.Test_Name := Name;
end Set_Test_Name;
procedure Set_Routine_Name (Info : in out Result_Info;
Name : Bounded_String) is
begin
Info.Routine_Name := Name;
end Set_Routine_Name;
procedure Set_Message (Info : in out Result_Info;
Message : Bounded_String) is
begin
Info.Message := Message;
end Set_Message;
procedure Set_Test_Name (Info : in out Result_Info; Name : String) is
begin
Set_Test_Name (Info, To_Bounded_String (Name));
end Set_Test_Name;
procedure Set_Routine_Name (Info : in out Result_Info; Name : String) is
begin
Set_Routine_Name (Info, To_Bounded_String (Name));
end Set_Routine_Name;
procedure Set_Message (Info : in out Result_Info; Message : String) is
begin
Set_Message (Info, To_Bounded_String (Message));
end Set_Message;
procedure Set_Long_Message (Info : in out Result_Info;
Message : Bounded_String) is
begin
Set_Long_Message (Info, To_String (Message));
end Set_Long_Message;
procedure Set_Long_Message
(Info : in out Result_Info;
Message : Long_AStrings.Bounded_String) is
begin
Info.Long_Message := Message;
end Set_Long_Message;
procedure Set_Long_Message (Info : in out Result_Info; Message : String) is
begin
Set_Long_Message (Info, Long_AStrings.To_Bounded_String (Message));
end Set_Long_Message;
procedure Set_Execution_Time (Info : in out Result_Info;
Elapsed_Time : Duration) is
begin
Info.Execution_Time := Elapsed_Time;
end Set_Execution_Time;
procedure Set_Output_File (Info : in out Result_Info;
Filename : Bounded_String) is
begin
Info.Output_File := Filename;
end Set_Output_File;
procedure Set_Output_File (Info : in out Result_Info;
Filename : String) is
begin
Set_Output_File (Info, To_Bounded_String (Filename));
end Set_Output_File;
function Get_Test_Name (Info : Result_Info) return String is
begin
return To_String (Info.Test_Name);
end Get_Test_Name;
function Get_Routine_Name (Info : Result_Info) return String is
begin
return To_String (Info.Routine_Name);
end Get_Routine_Name;
function Get_Message (Info : Result_Info) return String is
begin
return To_String (Info.Message);
end Get_Message;
function Get_Long_Message (Info : Result_Info) return String is
begin
return Long_AStrings.To_String (Info.Long_Message);
end Get_Long_Message;
function Get_Execution_Time (Info : Result_Info) return Duration is
begin
return Info.Execution_Time;
end Get_Execution_Time;
function Get_Output_File (Info : Result_Info) return Bounded_String is
begin
return Info.Output_File;
end Get_Output_File;
procedure Add_Child (Collection : in out Result_Collection;
Child : Result_Collection_Access) is
begin
Append (Collection.Children, (Ptr => Child));
end Add_Child;
procedure Add_Error (Collection : in out Result_Collection;
Info : Result_Info) is
begin
Append (Collection.Errors, Info);
end Add_Error;
procedure Add_Skipped (Collection : in out Result_Collection;
Info : Result_Info) is
begin
Append (Collection.Skips, Info);
end Add_Skipped;
procedure Add_Failure (Collection : in out Result_Collection;
Info : Result_Info) is
begin
Append (Collection.Failures, Info);
end Add_Failure;
procedure Add_Pass (Collection : in out Result_Collection;
Info : Result_Info) is
begin
Append (Collection.Passes, Info);
end Add_Pass;
-- When Result_Collection is released, it recursively releases
-- its all children.
procedure Release (Collection : in out Result_Collection) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Result_Collection,
Name => Result_Collection_Access);
Position : Result_List.Cursor := First (Collection.Children);
Ptr : Result_Collection_Access := null;
begin
loop
exit when not Is_Valid (Position);
Ptr := Data (Position).Ptr;
Release (Ptr.all);
Free (Ptr);
Position := Next (Position);
end loop;
Clear (Collection.Children);
-- No need to call Free for these three since
-- they are stored as plain objects instead of pointers.
Clear (Collection.Errors);
Clear (Collection.Failures);
Clear (Collection.Passes);
end Release;
procedure Set_Name (Collection : in out Result_Collection;
Name : Bounded_String) is
begin
Collection.Test_Name := Name;
end Set_Name;
procedure Set_Parent (Collection : in out Result_Collection;
Parent : Result_Collection_Access) is
begin
Collection.Parent := Parent;
end Set_Parent;
function Test_Count (Collection : Result_Collection) return Natural is
Count : Natural := Result_Info_List.Length (Collection.Errors) +
Result_Info_List.Length (Collection.Failures) +
Result_Info_List.Length (Collection.Skips) +
Result_Info_List.Length (Collection.Passes);
Position : Result_List.Cursor := First (Collection.Children);
begin
loop
exit when not Is_Valid (Position);
Count := Count + Test_Count (Data (Position).Ptr.all);
Position := Next (Position);
end loop;
return Count;
end Test_Count;
function Direct_Test_Count (Collection : Result_Collection)
return Natural
is
begin
return Length (Collection.Errors) +
Length (Collection.Failures) +
Length (Collection.Passes);
end Direct_Test_Count;
function Pass_Count (Collection : Result_Collection) return Natural is
Count : Natural := Length (Collection.Passes);
Position : Result_List.Cursor := First (Collection.Children);
begin
loop
exit when not Is_Valid (Position);
Count := Count + Pass_Count (Data (Position).Ptr.all);
Position := Next (Position);
end loop;
return Count;
end Pass_Count;
function Error_Count (Collection : Result_Collection) return Natural is
Count : Natural := Length (Collection.Errors);
Position : Result_List.Cursor := First (Collection.Children);
begin
loop
exit when not Is_Valid (Position);
Count := Count + Error_Count (Data (Position).Ptr.all);
Position := Next (Position);
end loop;
return Count;
end Error_Count;
function Failure_Count (Collection : Result_Collection) return Natural is
Count : Natural := Length (Collection.Failures);
Position : Result_List.Cursor := First (Collection.Children);
begin
loop
exit when not Is_Valid (Position);
Count := Count + Failure_Count (Data (Position).Ptr.all);
Position := Next (Position);
end loop;
return Count;
end Failure_Count;
function Skipped_Count (Collection : Result_Collection) return Natural is
Count : Natural := Length (Collection.Skips);
Position : Result_List.Cursor := First (Collection.Children);
begin
loop
exit when not Is_Valid (Position);
Count := Count + Skipped_Count (Data (Position).Ptr.all);
Position := Next (Position);
end loop;
return Count;
end Skipped_Count;
function Get_Test_Name (Collection : Result_Collection)
return Bounded_String is
begin
return Collection.Test_Name;
end Get_Test_Name;
function Get_Parent (Collection : Result_Collection)
return Result_Collection_Access is
begin
return Collection.Parent;
end Get_Parent;
function Get_Execution_Time (Collection : Result_Collection)
return Duration
is
Position : Result_Info_List.Cursor;
Total_Time : Duration := 0.0;
Child_Position : Result_List.Cursor;
begin
Position := First (Collection.Passes);
Pass_Loop :
loop
exit Pass_Loop when not Is_Valid (Position);
Total_Time := Total_Time + Get_Execution_Time (Data (Position));
Position := Next (Position);
end loop Pass_Loop;
Position := First (Collection.Failures);
Failure_Loop :
loop
exit Failure_Loop when not Is_Valid (Position);
Total_Time := Total_Time + Get_Execution_Time (Data (Position));
Position := Next (Position);
end loop Failure_Loop;
Position := First (Collection.Errors);
Error_Loop :
loop
exit Error_Loop when not Is_Valid (Position);
Total_Time := Total_Time + Get_Execution_Time (Data (Position));
Position := Next (Position);
end loop Error_Loop;
Child_Loop :
loop
exit Child_Loop when not Result_List.Is_Valid (Child_Position);
Total_Time := Total_Time +
Get_Execution_Time
(Result_List.Data (Child_Position).Ptr.all);
Child_Position := Result_List.Next (Child_Position);
end loop Child_Loop;
return Total_Time;
end Get_Execution_Time;
function First_Pass (Collection : Result_Collection)
return Result_Info_Cursor is
begin
return First (Collection.Passes);
end First_Pass;
function First_Failure (Collection : Result_Collection)
return Result_Info_Cursor is
begin
return First (Collection.Failures);
end First_Failure;
function First_Skipped (Collection : Result_Collection)
return Result_Info_Cursor is
begin
return First (Collection.Skips);
end First_Skipped;
function First_Error (Collection : Result_Collection)
return Result_Info_Cursor is
begin
return First (Collection.Errors);
end First_Error;
function Next (Position : Result_Info_Cursor) return Result_Info_Cursor is
begin
return Result_Info_Cursor
(Result_Info_List.Next (Result_Info_List.Cursor (Position)));
end Next;
function Data (Position : Result_Info_Cursor) return Result_Info is
begin
return Result_Info_List.Data (Result_Info_List.Cursor (Position));
end Data;
function Is_Valid (Position : Result_Info_Cursor) return Boolean is
begin
return Result_Info_List.Is_Valid (Result_Info_List.Cursor (Position));
end Is_Valid;
function First_Child (Collection : in Result_Collection)
return Result_Collection_Cursor is
begin
return First (Collection.Children);
end First_Child;
function Next (Position : Result_Collection_Cursor)
return Result_Collection_Cursor is
begin
return Result_Collection_Cursor
(Result_List.Next (Result_List.Cursor (Position)));
end Next;
function Is_Valid (Position : Result_Collection_Cursor) return Boolean is
begin
return Result_List.Is_Valid (Result_List.Cursor (Position));
end Is_Valid;
function Data (Position : Result_Collection_Cursor)
return Result_Collection_Access is
begin
return Result_List.Data (Result_List.Cursor (Position)).Ptr;
end Data;
function Child_Depth (Collection : Result_Collection) return Natural
is
function Child_Depth_Impl (Coll : Result_Collection;
Level : Natural) return Natural;
function Child_Depth_Impl (Coll : Result_Collection;
Level : Natural)
return Natural
is
Max : Natural := 0;
Current : Natural := 0;
Position : Result_List.Cursor := Result_List.First (Coll.Children);
begin
loop
exit when not Is_Valid (Position);
Current := Child_Depth_Impl (Data (Position).Ptr.all, Level + 1);
if Max < Current then
Max := Current;
end if;
Position := Result_List.Next (Position);
end loop;
return Level + Max;
end Child_Depth_Impl;
begin
return Child_Depth_Impl (Collection, 0);
end Child_Depth;
end Ahven.Results;
|
test/Succeed/Issue854.agda | redfish64/autonomic-agda | 3 | 11054 | -- 2013-06-15 Andreas, issue reported by <NAME>
module Issue854 where
infixr 1 _⊎_
infixr 2 _×_
infixr 4 _,_
infix 4 _≡_
data ⊥ : Set where
⊥-elim : {A : Set} → ⊥ → A
⊥-elim ()
record ⊤ : Set where
constructor tt
data Bool : Set where
true false : Bool
data ℕ : Set where
zero : ℕ
suc : (n : ℕ) → ℕ
data Maybe (A : Set) : Set where
nothing : Maybe A
just : (x : A) → Maybe A
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
data _⊎_ (A : Set) (B : Set) : Set where
inj₁ : (x : A) → A ⊎ B
inj₂ : (y : B) → A ⊎ B
[_,_] : ∀ {A : Set} {B : Set} {C : A ⊎ B → Set} →
((x : A) → C (inj₁ x)) → ((x : B) → C (inj₂ x)) →
((x : A ⊎ B) → C x)
[ f , g ] (inj₁ x) = f x
[ f , g ] (inj₂ y) = g y
[_,_]₁ : ∀ {A : Set} {B : Set} {C : A ⊎ B → Set₁} →
((x : A) → C (inj₁ x)) → ((x : B) → C (inj₂ x)) →
((x : A ⊎ B) → C x)
[ f , g ]₁ (inj₁ x) = f x
[ f , g ]₁ (inj₂ y) = g y
record Σ (A : Set) (B : A → Set) : Set where
constructor _,_
field
proj₁ : A
proj₂ : B proj₁
open Σ public
_×_ : Set → Set → Set
A × B = Σ A λ _ → B
uncurry₁ : {A : Set} {B : A → Set} {C : Σ A B → Set₁} →
((x : A) → (y : B x) → C (x , y)) →
((p : Σ A B) → C p)
uncurry₁ f (x , y) = f x y
------------------------------------------------------------------------
infix 5 _◃_
infixr 1 _⊎C_
infixr 2 _×C_
record Container : Set₁ where
constructor _◃_
field
Shape : Set
Position : Shape → Set
open Container public
⟦_⟧ : Container → (Set → Set)
⟦ S ◃ P ⟧ X = Σ S λ s → P s → X
idC : Container
idC = ⊤ ◃ λ _ → ⊤
constC : Set → Container
constC X = X ◃ λ _ → ⊥
𝟘 = constC ⊥
𝟙 = constC ⊤
_⊎C_ : Container → Container → Container
S ◃ P ⊎C S′ ◃ P′ = (S ⊎ S′) ◃ [ P , P′ ]₁
_×C_ : Container → Container → Container
S ◃ P ×C S′ ◃ P′ = (S × S′) ◃ uncurry₁ (λ s s′ → P s ⊎ P′ s′)
data μ (C : Container) : Set where
⟨_⟩ : ⟦ C ⟧ (μ C) → μ C
_⋆C_ : Container → Set → Container
C ⋆C X = constC X ⊎C C
_⋆_ : Container → Set → Set
C ⋆ X = μ (C ⋆C X)
AlgIter : Container → Set → Set
AlgIter C X = ⟦ C ⟧ X → X
iter : ∀ {C X} → AlgIter C X → μ C → X
iter φ ⟨ s , k ⟩ = φ (s , λ p → iter φ (k p))
AlgRec : Container → Set → Set
AlgRec C X = ⟦ C ⟧ (μ C × X) → X
rec : ∀ {C X} → AlgRec C X → μ C → X
rec φ ⟨ s , k ⟩ = φ (s , λ p → (k p , rec φ (k p)))
return : ∀ {C X} → X → C ⋆ X
return x = ⟨ inj₁ x , ⊥-elim ⟩
do : ∀ {C X} → ⟦ C ⟧ (C ⋆ X) → C ⋆ X
do (s , k) = ⟨ inj₂ s , k ⟩
_>>=_ : ∀ {C X Y} → C ⋆ X → (X → C ⋆ Y) → C ⋆ Y
_>>=_ {C}{X}{Y} m k = iter φ m
where
φ : AlgIter (C ⋆C X) (C ⋆ Y)
φ (inj₁ x , _) = k x
φ (inj₂ s , k) = do (s , k)
------------------------------------------------------------------------
_↠_ : Set → Set → Container
I ↠ O = I ◃ λ _ → O
State : Set → Container
State S = (⊤ ↠ S) -- get
⊎C (S ↠ ⊤) -- put
get : ∀ {S} → State S ⋆ S
get = do (inj₁ tt , return)
put : ∀ {S} → S → State S ⋆ ⊤
put s = do (inj₂ s , return)
Homo : Container → Set → Set → Container → Set → Set
Homo Σ X I Σ′ Y = AlgRec (Σ ⋆C X) (I → Σ′ ⋆ Y)
Pseudohomo : Container → Set → Set → Container → Set → Set
Pseudohomo Σ X I Σ′ Y =
⟦ Σ ⋆C X ⟧ (((Σ ⊎C Σ′) ⋆ X) × (I → Σ′ ⋆ Y)) → I → Σ′ ⋆ Y
state : ∀ {Σ S X} → Pseudohomo (State S) X S Σ (X × S)
state (inj₁ x , _) = λ s → return (x , s) -- return
state (inj₂ (inj₁ _) , k) = λ s → proj₂ (k s) s -- get
state (inj₂ (inj₂ s) , k) = λ _ → proj₂ (k tt) s -- put
Abort : Container
Abort = ⊤ ↠ ⊥
aborting : ∀ {X} → Abort ⋆ X
aborting = do (tt , ⊥-elim)
abort : ∀ {Σ X} → Pseudohomo Abort X ⊤ Σ (Maybe X)
abort (inj₁ x , _) _ = return (just x) -- return
abort (inj₂ _ , _) _ = return nothing -- abort
------------------------------------------------------------------------
record _⇒_ (C C′ : Container) : Set where
field
shape : Shape C → Shape C′
position : ∀ {s} → Position C′ (shape s) → Position C s
open _⇒_ public
idMorph : ∀ {C} → C ⇒ C
idMorph = record { shape = λ s → s; position = λ p → p }
inlMorph : ∀ {C C′ : Container} → C ⇒ (C ⊎C C′)
inlMorph = record
{ shape = inj₁
; position = λ p → p
}
swapMorph : ∀ {C C′} → (C ⊎C C′) ⇒ (C′ ⊎C C)
swapMorph {C}{C′}= record
{ shape = sh
; position = λ {s} p → pos {s} p
}
where
sh : Shape C ⊎ Shape C′ → Shape C′ ⊎ Shape C
sh (inj₁ s) = inj₂ s
sh (inj₂ s′) = inj₁ s′
pos : ∀ {s} → Position (C′ ⊎C C) (sh s) → Position (C ⊎C C′) s
pos {inj₁ s} p = p
pos {inj₂ s′} p′ = p′
⟪_⟫ : ∀ {C C′ X} → C ⇒ C′ → ⟦ C ⟧ X → ⟦ C′ ⟧ X
⟪ m ⟫ xs = shape m (proj₁ xs) , λ p′ → proj₂ xs (position m p′)
⟪_⟫Homo : ∀ {C C′ X} → C ⇒ C′ → Homo C X ⊤ C′ X
⟪ m ⟫Homo (inj₁ x , _) _ = return x
⟪ m ⟫Homo (inj₂ s , k) _ = let (s′ , k′) = ⟪ m ⟫ (s , k)
in do (s′ , λ p′ → proj₂ (k′ p′) tt)
natural : ∀ {C C′ X} → C ⇒ C′ → C ⋆ X → C′ ⋆ X
natural f m = rec ⟪ f ⟫Homo m tt
inl : ∀ {C C′ X} → C ⋆ X → (C ⊎C C′) ⋆ X
inl = natural inlMorph
squeeze : ∀ {Σ Σ′ X} → ((Σ ⊎C Σ′) ⊎C Σ′) ⋆ X → (Σ ⊎C Σ′) ⋆ X
squeeze = natural m
where
m = record
{ shape = [ (λ x → x) , inj₂ ]
; position = λ { {inj₁ x} p → p ; {inj₂ x} p → p}
}
lift : ∀ {Σ Σ′ X Y I} → Pseudohomo Σ X I Σ′ Y →
Pseudohomo (Σ ⊎C Σ′) X I Σ′ Y
lift φ (inj₁ x , _) i = φ (inj₁ x , ⊥-elim) i
lift φ (inj₂ (inj₁ s) , k) i = φ (inj₂ s , λ p →
let (w , ih) = k p in squeeze w , ih) i
lift φ (inj₂ (inj₂ s′) , k′) i = do (s′ , λ p′ → proj₂ (k′ p′) i)
weaken : ∀ {Σ Σ′ Σ″ Σ‴ X Y I} → Homo Σ′ X I Σ″ Y →
Σ ⇒ Σ′ → Σ″ ⇒ Σ‴ → Homo Σ X I Σ‴ Y
weaken {Σ}{Σ′}{Σ″}{Σ‴}{X}{Y} φ f g (s , k) i = w‴
where
w : Σ ⋆ X
w = ⟨ s , (λ p → proj₁ (k p)) ⟩
w′ : Σ′ ⋆ X
w′ = natural f w
w″ : Σ″ ⋆ Y
w″ = rec φ w′ i
w‴ : Σ‴ ⋆ Y
w‴ = natural g w″
⌈_⌉Homo : ∀ {Σ Σ′ X Y I} → Pseudohomo Σ X I Σ′ Y → Homo Σ X I Σ′ Y
⌈ φ ⌉Homo (inj₁ x , _) = φ (inj₁ x , ⊥-elim)
⌈ φ ⌉Homo (inj₂ s , k) = φ (inj₂ s , λ p → let (w , ih) = k p
in inl w , ih)
run : ∀ {Σ Σ′ Σ″ Σ‴ X Y I} → Pseudohomo Σ X I Σ′ Y →
Σ″ ⇒ (Σ ⊎C Σ′) → Σ′ ⇒ Σ‴ →
Σ″ ⋆ X → I → Σ‴ ⋆ Y
run φ p q = rec (weaken ⌈ lift φ ⌉Homo p q)
------------------------------------------------------------------------
prog : (State ℕ ⊎C Abort) ⋆ Bool
prog =
⟨ inj₂ (inj₁ (inj₁ tt)) , (λ n → -- get >>= λ n →
⟨ inj₂ (inj₁ (inj₂ (suc n))) , (λ _ → -- put (suc n)
⟨ inj₂ (inj₂ tt) , (λ _ → -- aborting
return true) ⟩) ⟩) ⟩
progA : State ℕ ⋆ Maybe Bool
progA = run abort swapMorph idMorph prog tt
progS : ℕ → Abort ⋆ (Bool × ℕ)
progS = run state idMorph idMorph prog
progAS : ℕ → 𝟘 ⋆ (Maybe Bool × ℕ)
progAS = run state inlMorph idMorph progA
progSA : ℕ → 𝟘 ⋆ Maybe (Bool × ℕ)
progSA n = run abort inlMorph idMorph (progS n) tt
testSA : progSA zero ≡ return nothing
testSA = refl
testAS : progAS zero ≡ return (nothing , suc zero)
testAS = refl
-- The last statement seemed to make the type checker loop.
-- But it just created huge terms during the conversion check
-- and never finished.
-- These terms contained many projection redexes
-- (projection applied to record value).
-- After changing the strategy, such that these redexes are,
-- like beta-redexes, removed immediately in internal syntax,
-- the code checks instantaneously.
|
programs/oeis/040/A040789.asm | neoneye/loda | 22 | 84015 | <filename>programs/oeis/040/A040789.asm<gh_stars>10-100
; A040789: Continued fraction for sqrt(818).
; 28,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1,56,1,1,1,1
seq $0,10152 ; Continued fraction for sqrt(74).
seq $0,26273 ; a(n) = least k such that s(k) = n, where s = A026272.
mov $1,$0
seq $1,189663 ; Partial sums of A189661.
sub $1,1
mul $1,3
add $0,$1
sub $0,1
|
parsers/src/main/goslin/LipidMaps.g4 | lifs-tools/jg | 0 | 3187 | ////////////////////////////////////////////////////////////////////////////////
// MIT License
//
// Copyright (c) the authors (listed in global LICENSE file)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
////////////////////////////////////////////////////////////////////////////////
//// This is a BNF grammer for lipid subspecies identifiers followed by
//// <NAME> al. 2017, PLoS One, 12(11):e0188394.
grammar LipidMaps;
/* first rule is always start rule */
lipid : lipid_rule EOF | lipid_rule adduct_info EOF;
lipid_rule: lipid_mono | lipid_mono isotope;
lipid_mono: lipid_pure | lipid_pure isoform;
lipid_pure: pure_fa | gl | pl | sl | pk | sterol | mediator;
isoform: square_open_bracket isoform_inner square_close_bracket;
isoform_inner : 'rac' | 'iso' | 'iso' number | 'R';
isotope: SPACE round_open_bracket isotope_element number round_close_bracket | DASH round_open_bracket isotope_element number round_close_bracket | DASH isotope_element number;
isotope_element: 'd';
/* adduct information */
adduct_info : adduct_sep | adduct_separator adduct_sep;
adduct_sep : '[M' adduct ']' charge_sign | '[M' adduct ']' charge charge_sign;
adduct : adduct_set;
adduct_set : adduct_element | adduct_element adduct_set;
adduct_element : element | element number | number element | plus_minus element | plus_minus element number | plus_minus number element;
/* pure fatty acid */
pure_fa: hg_fa pure_fa_species | fa_no_hg;
fa_no_hg: fa;
pure_fa_species: round_open_bracket fa round_close_bracket | fa | round_open_bracket fa2 round_close_bracket;
hg_fa: 'FA' | 'WE' | 'CoA' | 'CAR' | 'FAHFA' | 'CoA';
fa2 : fa2_unsorted | fa2_sorted;
fa2_unsorted: fa DASH fa | fa UNDERSCORE fa;
fa2_sorted: fa SLASH fa | fa BACKSLASH fa;
fa3 : fa3_unsorted | fa3_sorted;
fa3_unsorted: fa DASH fa DASH fa | fa UNDERSCORE fa UNDERSCORE fa;
fa3_sorted: fa SLASH fa SLASH fa | fa BACKSLASH fa BACKSLASH fa;
fa4 : fa4_unsorted | fa4_sorted;
fa4_unsorted: fa DASH fa DASH fa DASH fa | fa UNDERSCORE fa UNDERSCORE fa UNDERSCORE fa;
fa4_sorted: fa SLASH fa SLASH fa SLASH fa | fa BACKSLASH fa BACKSLASH fa BACKSLASH fa;
lcb_fa_sorted: lcb SLASH fa | lcb BACKSLASH fa;
species_fa : fa;
/* glycerolipid rules */
gl: sgl | tgl;
sgl: hg_sglc sgl_species | hg_sglc sgl_subspecies;
sgl_species: round_open_bracket fa round_close_bracket | fa;
sgl_subspecies: round_open_bracket fa2 round_close_bracket | fa2;
tgl: hg_glc tgl_species | hg_glc tgl_subspecies;
tgl_species: round_open_bracket fa round_close_bracket | fa;
tgl_subspecies: round_open_bracket fa3 round_close_bracket | fa3;
hg_sglc: hg_sgl | hg_sgl headgroup_separator;
hg_sgl: 'MGDG' | 'DGDG' | 'SQDG' | 'SQMG' | hg_dg | 'DGCC' | 'PE-GlcDG';
hg_dg : 'DG';
hg_glc: hg_gl | hg_gl headgroup_separator;
hg_gl: 'MG' | 'DG' | 'TG';
/* phospholipid rules */
pl: lpl | dpl | cl | fourpl | threepl | cpa;
lpl: hg_lplc round_open_bracket fa_lpl round_close_bracket | hg_lplc fa_lpl;
cpa : hg_cpa round_open_bracket fa round_close_bracket;
fa_lpl: fa_lpl_molecular | fa2;
fa_lpl_molecular: fa;
dpl: hg_ddpl dpl_species | hg_ddpl dpl_subspecies;
dpl_species: round_open_bracket fa round_close_bracket | fa;
dpl_subspecies: round_open_bracket fa2 round_close_bracket | fa2;
cl: hg_clc cl_species | hg_clc cl_subspecies;
cl_species: round_open_bracket fa round_close_bracket | fa;
cl_subspecies: round_open_bracket '1\'-' square_open_bracket fa2 square_close_bracket ',3\'-' square_open_bracket fa2 square_close_bracket round_close_bracket | hg_clc '1\'-' square_open_bracket fa2 square_close_bracket ',3\'-' square_open_bracket fa2 square_close_bracket;
fourpl: hg_fourplc round_open_bracket fa4 round_close_bracket | hg_fourplc fa4 | hg_fourplc round_open_bracket species_fa round_close_bracket | hg_fourplc species_fa;
threepl: hg_threeplc round_open_bracket fa3 round_close_bracket | hg_threeplc fa3 | hg_threeplc round_open_bracket species_fa round_close_bracket | hg_threeplc species_fa;
hg_ddpl: hg_dplc pip_position | hg_dplc;
hg_clc: hg_cl | hg_cl headgroup_separator;
hg_cl: 'CL';
hg_dplc: hg_dpl | hg_dpl headgroup_separator;
hg_cpa: 'CPA';
hg_dpl: hg_lbpa | 'CDP-DG' | 'DMPE' | 'MMPE' | 'PA' | 'PC' | 'PE' | 'PEt' | 'PG' | 'PI' | 'PIP' | 'PIP2' | 'PIP3' | 'PS' | 'PIM1' | 'PIM2' | 'PIM3' | 'PIM4' | 'PIM5' | 'PIM6' | 'Glc-DG' | 'PGP' | 'PE-NMe2' | 'AC2SGL' | 'DAT' | 'PE-NMe' | 'PT' | 'Glc-GP' | 'PPA' | 'PnC' | 'PnE' | '6-Ac-Glc-GP' | 'GPA' | 'GPCho' | 'GPEtn' | 'GPGro' | 'GPIns' | 'GPSer' | 'GPC' | 'GPE' | 'GPG' | 'GPI' | 'GPS' | 'PlsA' | 'PlsCho' | 'PlsEtn' | 'PlsGro' | 'PlsIns' | 'PlsSer';
hg_lbpa : 'LBPA';
hg_lplc: hg_lpl | hg_lpl headgroup_separator;
hg_lpl: 'lysoPC' | 'LysoPC' | 'LPC' | 'lysoPE' | 'LysoPE' | 'LPE' | 'lysoPI' | 'LysoPI' | 'LPI' | 'lysoPG' | 'LysoPG' | 'LPG' | 'lysoPS' | 'LysoPS' | 'LPS' | 'LPIM1' | 'LPIM2' | 'LPIM3' | 'LPIM4' | 'LPIM5' | 'LPIM6' | 'lysoPA' | 'LysoPA' | 'LPA';
hg_fourplc: hg_fourpl | hg_fourpl headgroup_separator;
hg_fourpl: 'PAT16' | 'PAT18';
pip_position: square_open_bracket pip_pos square_close_bracket;
pip_pos: pip_pos COMMA pip_pos | number '\'';
hg_threeplc: hg_threepl | hg_threepl headgroup_separator;
hg_threepl: 'SLBPA' | 'PS-NAc' | 'NAPE';
/* sphingolipid rules */
sl: lsl | dsl;
lsl: hg_lslc round_open_bracket lcb round_close_bracket | hg_lslc lcb;
dsl: hg_dslc dsl_species | hg_dslc dsl_subspecies;
dsl_species: round_open_bracket lcb round_close_bracket | lcb;
dsl_subspecies: round_open_bracket lcb_fa_sorted round_close_bracket | lcb_fa_sorted;
hg_dslc: hg_dsl_global | hg_dsl_global headgroup_separator;
hg_dsl_global : hg_dsl | special_cer | special_glyco;
hg_dsl: 'Cer' | 'CerP' | 'EPC' | 'GB3' | 'GB4' | 'GD3' | 'GM3' | 'GM4' | 'Hex3Cer' | 'Hex2Cer' | 'HexCer' | 'IPC' | 'M(IP)2C' | 'MIPC' | 'SHexCer' | 'SulfoHexCer' | 'SM' | 'PE-Cer' | 'PI-Cer' | 'GlcCer' | 'FMC-5' | 'FMC-6' | 'LacCer' | 'GalCer' | 'C1P' | '(3\'-sulfo)Galbeta-Cer' | omega_linoleoyloxy_Cer;
omega_linoleoyloxy_Cer : 'omega-linoleoyloxy-' special_cer_hg;
special_cer : special_cer_prefix '-Cer';
special_cer_hg : 'Cer';
special_cer_prefix : '1-O-' special_cer_prefix_1_O;
special_glyco : glyco_cer '-' special_cer_hg;
special_cer_prefix_1_O : 'myristoyl' | 'palmitoyl' | 'stearoyl' | 'eicosanoyl' | 'behenoyl' | 'lignoceroyl' | 'cerotoyl' | 'pentacosanoyl' | 'tricosanoyl' | 'carboceroyl' | 'lignoceroyl-omega-linoleoyloxy' | 'stearoyl-omega-linoleoyloxy';
glyco_cer : glyco_entity | glyco_entity '-' glyco_cer | number glyco_branch glyco_cer;
glyco_branch : '(' glyco_cer '-' number ')' | '(' glyco_cer '-' number ')' glyco_branch;
glyco_entity : glyco_struct | glyco_number glyco_struct | glyco_number glyco_struct greek | glyco_number glyco_struct greek number | glyco_number glyco_struct number | glyco_struct greek | glyco_struct greek number;
glyco_number : number | number '-';
glyco_struct : 'Hex' | 'Gal' | 'Glc' | 'Man' | 'Neu' | 'HexNAc' | 'GalNAc' | 'GlcNAc' | 'NeuAc' | 'NeuGc' | 'Kdn' | 'GlcA' | 'Xyl' | 'Fuc' | 'KDN' | 'OAc-NeuAc';
greek : 'alpha' | 'beta' | 'α' | 'β';
hg_lslc: hg_lsl | hg_lsl headgroup_separator;
hg_lsl: 'SPH' | 'Sph' | 'S1P' | 'HexSph' | 'SPC' | 'SPH-P' | 'LysoSM' | 'SIP';
/* polyketides */
pk : pk_hg pk_fa;
pk_hg : 'RESORCINOL' | 'ANACARD' | 'PHENOL' | 'CATECHOL';
pk_fa : round_open_bracket fa round_close_bracket;
/* sterol lipids */
sterol: chc | chec;
chc: ch | ch headgroup_separator;
ch: 'Cholesterol';
chec: che | che headgroup_separator | che_fa;
che: fa headgroup_separator hg_che;
che_fa: hg_che round_open_bracket fa round_close_bracket;
hg_che: 'Cholesteryl ester' | 'Cholesterol ester' | 'CE';
/* mediator lipids */
mediator: mediator_var | mediator_const;
mediator_var: mediator_prefix mediator_name_separator mediator_var_names | '(+/-)-' mediator_prefix mediator_name_separator mediator_var_names;
mediator_prefix: mediator_numbers | mediator_prefix mediator_prefix;
mediator_numbers: mediator_numbers mediator_separator mediator_numbers | mediator_number_pure | mediator_number_pure mediator_pos;
mediator_number_pure: number | round_open_bracket number round_close_bracket;
mediator_pos: 'R' | 'S';
mediator_var_names: mediator_var_name | mediator_oxo '-' mediator_var_name;
mediator_var_name: 'HHTrE' | 'EpOME' | 'HODE' | 'HOTrE' | 'DHET' | 'EET' | 'EpETE' | 'HEPE' | 'HETE' | 'PGJ2' | 'HDoHE' | 'HpETE' | 'ETE' | 'DiHETE' | 'LXA4';
mediator_const: 'Arachidonic acid' | 'Arachidonic Acid' | 'alpha-LA' | 'DHA' | 'EPA' | 'Linoleic acid' | 'LTB4' | 'LTC4' | 'LTD4' | 'Maresin 1' | 'Palmitic acid' | 'PGB2' | 'PGD2' | 'PGE2' | 'PGF2alpha' | 'PGI2' | 'Resolvin D1' | 'Resolvin D2' | 'Resolvin D3' | 'Resolvin D5' | 'tetranor-12-HETE' | 'TXB1' | 'TXB2' | 'TXB3';
mediator_oxo: 'Oxo' | 'oxo';
/* generic rules */
fa: fa_unmod | fa_unmod fa_mod | fa_unmod fa_mod_separator fa_mod;
fa_unmod: round_open_bracket fa_pure ether_suffix round_close_bracket | round_open_bracket ether_prefix fa_pure round_close_bracket | round_open_bracket fa_pure round_close_bracket | ether_prefix fa_pure | fa_pure ether_suffix | fa_pure;
fa_mod: round_open_bracket modification round_close_bracket;
modification: modification ',' modification | single_mod;
single_mod : isomeric_mod | isomeric_mod square_open_bracket stereo square_close_bracket | structural_mod | structural_mod square_open_bracket stereo square_close_bracket;
isomeric_mod : mod_pos mod_text;
structural_mod : mod_text | mod_text mod_num;
mod_pos : number;
mod_num : number;
mod_text: 'OH' | 'Ke' | 'OOH' | 'My' | 'Me' | 'Br' | 'CHO' | 'COOH' | 'Cp' | 'Ep' | 'KE' | 'NH';
ether_prefix : 'P-' | 'O-';
ether_suffix : 'p' | 'e';
stereo : 'R' | 'S';
fa_pure: carbon carbon_db_separator db | carbon carbon_db_separator db db_hydroxyl_separator hydroxyl;
lcb_pure_fa : lcb_fa;
lcb_fa: lcb_fa_unmod | lcb_fa_unmod lcb_fa_mod;
lcb_fa_unmod: carbon carbon_db_separator db;
lcb_fa_mod: round_open_bracket modification round_close_bracket;
lcb: hydroxyl_lcb lcb_fa | lcb_pure_fa;
carbon: number;
db : db_count | db_count db_positions;
db_count : number;
db_positions : ROB db_position RCB;
db_position : db_single_position | db_position db_position_separator db_position;
db_single_position : db_position_number | db_position_number cistrans;
db_position_number : number;
cistrans : 'E' | 'Z';
hydroxyl: number;
hydroxyl_lcb: 'm' | 'd' | 't';
number: digit | digit number;
digit: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
/* separators */
SPACE : ' ';
COLON : ':';
SEMICOLON : ';';
DASH : '-';
UNDERSCORE : '_';
SLASH : '/';
BACKSLASH : '\\';
COMMA: ',';
ROB: '(';
RCB: ')';
SOB: '[';
SCB: ']';
fa_separator: UNDERSCORE | SLASH | BACKSLASH | DASH;
adduct_separator : SPACE;
headgroup_separator: SPACE;
fa_mod_separator: SPACE;
carbon_db_separator: COLON;
db_hydroxyl_separator: SEMICOLON;
db_position_separator: COMMA;
mediator_separator: COMMA;
mediator_name_separator: DASH;
round_open_bracket: ROB;
round_close_bracket: RCB;
square_open_bracket: SOB;
square_close_bracket: SCB;
element: 'C' | 'H' | 'N' | 'O' | 'P' | 'S' | 'Br' | 'I' | 'F' | 'Cl' | 'As';
charge : '1' | '2' | '3' | '4';
charge_sign : plus_minus;
plus_minus : '-' | '+';
|
examples/outdated-and-incorrect/AIM6/Cat/lib/Data/Map.agda | cruhland/agda | 1,989 | 7008 | <gh_stars>1000+
module Data.Map
(Key : Set)
where
import Data.Bool
import Data.Maybe
open Data.Bool
infix 40 _<_ _>_
postulate
_<_ : Key -> Key -> Bool
_>_ : Key -> Key -> Bool
x > y = y < x
private
data Map' (a : Set) : Set where
leaf : Map' a
node : Key -> a -> Map' a -> Map' a -> Map' a
Map : Set -> Set
Map = Map'
empty : {a : Set} -> Map a
empty = leaf
insert : {a : Set} -> Key -> a -> Map a -> Map a
insert k v leaf = node k v leaf leaf
insert k v (node k' v' l r) =
| k < k' => node k' v' (insert k v l) r
| k > k' => node k' v' l (insert k v r)
| otherwise node k' v l r
open Data.Maybe
lookup : {a : Set} -> Key -> Map a -> Maybe a
lookup k leaf = nothing
lookup k (node k' v l r) =
| k < k' => lookup k l
| k > k' => lookup k r
| otherwise just v
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1410.asm | ljhsiun2/medusa | 9 | 95183 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1410.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x9321, %r15
nop
nop
add %r12, %r12
movb $0x61, (%r15)
nop
and %rbx, %rbx
lea addresses_UC_ht+0x19ec6, %r10
nop
inc %rdi
mov (%r10), %r13w
sub $2886, %r10
lea addresses_WT_ht+0x1d301, %rbx
nop
add $64322, %r13
mov (%rbx), %r12w
nop
nop
nop
nop
and %r12, %r12
lea addresses_D_ht+0x10d6f, %rsi
lea addresses_WT_ht+0x195a1, %rdi
clflush (%rsi)
nop
nop
nop
nop
and $51353, %r13
mov $67, %rcx
rep movsw
nop
nop
nop
nop
cmp $32947, %r15
lea addresses_A_ht+0x11ed, %rsi
lea addresses_WT_ht+0xef41, %rdi
nop
and $28183, %rbx
mov $108, %rcx
rep movsl
nop
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_WC_ht+0x2ed1, %rsi
lea addresses_D_ht+0x12ba1, %rdi
nop
nop
dec %r10
mov $60, %rcx
rep movsq
nop
nop
nop
and %rdi, %rdi
lea addresses_UC_ht+0x1c5b7, %rsi
lea addresses_D_ht+0x17d85, %rdi
nop
nop
cmp %r15, %r15
mov $22, %rcx
rep movsq
nop
nop
nop
inc %r13
lea addresses_WC_ht+0x109a1, %rbx
sub $10011, %rcx
mov (%rbx), %r10d
nop
sub %r13, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %rax
push %rbp
push %rbx
push %rsi
// Store
lea addresses_UC+0x71a1, %r10
nop
sub %rax, %rax
mov $0x5152535455565758, %r15
movq %r15, (%r10)
sub $9306, %r10
// Store
lea addresses_WC+0x8b1e, %rbp
nop
nop
nop
xor %rbx, %rbx
mov $0x5152535455565758, %rax
movq %rax, (%rbp)
nop
nop
nop
nop
and %r10, %r10
// Store
lea addresses_PSE+0x6e1, %rsi
nop
nop
nop
add $39114, %r10
mov $0x5152535455565758, %r13
movq %r13, %xmm4
movups %xmm4, (%rsi)
cmp %r15, %r15
// Load
lea addresses_UC+0x1f9a1, %rbp
nop
nop
and %r15, %r15
mov (%rbp), %r13w
nop
nop
nop
nop
xor %r15, %r15
// Faulty Load
lea addresses_WC+0x6ba1, %rbx
nop
nop
nop
nop
nop
xor $43497, %r10
vmovups (%rbx), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rax
lea oracles, %rsi
and $0xff, %rax
shlq $12, %rax
mov (%rsi,%rax,1), %rax
pop %rsi
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'dst': {'same': True, 'congruent': 8, 'type': 'addresses_WT_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'dst': {'same': True, 'congruent': 10, 'type': 'addresses_D_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
libsrc/games/bit_click.asm | ahjelm/z88dk | 640 | 24195 | ; $Id: bit_click.asm,v 1.6 2016-06-11 20:52:25 dom Exp $
;
; Generic 1 bit sound functions
;
; void bit_click();
;
; <NAME> - 2/10/2001
;
IF !__CPU_GBZ80__
SECTION code_clib
PUBLIC bit_click
PUBLIC _bit_click
INCLUDE "games/games.inc"
EXTERN __snd_tick
.bit_click
._bit_click
ld a,(__snd_tick)
xor sndbit_mask
IF sndbit_port > 255
IF !__CPU_INTEL__
ld bc,sndbit_port
out (c),a
ENDIF
ELSE
out (sndbit_port),a
ENDIF
ld (__snd_tick),a
ret
ENDIF
|
oeis/172/A172049.asm | neoneye/loda-programs | 11 | 160592 | <reponame>neoneye/loda-programs<filename>oeis/172/A172049.asm<gh_stars>10-100
; A172049: Irregular triangle T(n,k) = 2k-1 with A008794(n+2) values in row n.
; Submitted by <NAME>
; 1,1,1,3,5,7,1,3,5,7,1,3,5,7,9,11,13,15,17,1,3,5,7,9,11,13,15,17,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43
mov $2,1
lpb $0
mov $3,$2
mod $3,2
mul $3,$2
add $1,$3
sub $0,$1
add $2,1
lpe
mul $0,2
add $0,1
|
test/Succeed/MacroEval.agda | shlevy/agda | 1,989 | 15140 | <filename>test/Succeed/MacroEval.agda
open import Common.Prelude
open import Common.Equality
open import Common.Reflection
pattern _`+_ a b = def (quote _+_) (vArg a ∷ vArg b ∷ [])
`_ : Term → Term
` con c [] = con (quote Term.con) (vArg (lit (qname c)) ∷ vArg (con (quote []) []) ∷ [])
` _ = unknown
-- Prevent quotation
data WrapTerm : Set where
wrap : Term → WrapTerm
macro
eval : WrapTerm → Tactic
eval (wrap u) hole = bindTC (normalise u) λ u → unify hole (` u)
t : Term
t = lam visible (abs "n" (lit (nat 1) `+ var 0 []))
lem : eval (wrap t) ≡ Term.con (quote suc) []
lem = refl
|
other.7z/SFC.7z/SFC/ソースデータ/MarioKart/kart-enemy.asm | prismotizm/gigaleak | 0 | 100233 | Name: kart-enemy.asm
Type: file
Size: 25689
Last-Modified: '1992-08-30T15:00:00Z'
SHA-1: 2997F0BBD8E389E1135BD2918287D07B939A24D1
Description: null
|
Transynther/x86/_processed/NONE/_un_xt_/i9-9900K_12_0xa0.log_21829_647.asm | ljhsiun2/medusa | 9 | 85024 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x113c2, %rbp
clflush (%rbp)
nop
nop
sub $25213, %rsi
mov $0x6162636465666768, %rdx
movq %rdx, (%rbp)
nop
and $54727, %rbp
lea addresses_UC_ht+0x18872, %r14
nop
nop
inc %rbp
and $0xffffffffffffffc0, %r14
vmovaps (%r14), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $1, %xmm3, %r10
nop
nop
add $40873, %rdx
lea addresses_normal_ht+0xb1a2, %r14
sub $58271, %r15
movb (%r14), %dl
nop
xor %rsi, %rsi
lea addresses_UC_ht+0x16b06, %rbp
clflush (%rbp)
nop
sub %r9, %r9
and $0xffffffffffffffc0, %rbp
movaps (%rbp), %xmm4
vpextrq $0, %xmm4, %r14
nop
nop
add $48353, %r15
lea addresses_WT_ht+0xcfea, %rsi
lea addresses_A_ht+0x9066, %rdi
nop
xor $48635, %r9
mov $7, %rcx
rep movsw
nop
nop
sub $38635, %rcx
lea addresses_WC_ht+0x93f2, %rsi
lea addresses_A_ht+0xc74e, %rdi
nop
nop
xor $19893, %r15
mov $33, %rcx
rep movsb
sub $63613, %rdx
lea addresses_WT_ht+0x1abf2, %rdi
clflush (%rdi)
nop
sub %r15, %r15
mov (%rdi), %r9d
nop
cmp %rcx, %rcx
lea addresses_A_ht+0xbe72, %rdx
nop
add %rcx, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm5
movups %xmm5, (%rdx)
sub $55802, %r10
lea addresses_D_ht+0x1c86e, %r10
clflush (%r10)
and %rcx, %rcx
mov (%r10), %r9w
add %rcx, %rcx
lea addresses_WC_ht+0x1c012, %rsi
lea addresses_WT_ht+0x11df2, %rdi
nop
sub %rbp, %rbp
mov $79, %rcx
rep movsw
nop
nop
nop
nop
add $46604, %rsi
lea addresses_WC_ht+0x1bba0, %rdi
nop
nop
nop
cmp %r14, %r14
movups (%rdi), %xmm4
vpextrq $1, %xmm4, %r9
nop
nop
nop
inc %r15
lea addresses_normal_ht+0x15152, %rsi
lea addresses_D_ht+0x1567a, %rdi
clflush (%rdi)
nop
nop
and %r14, %r14
mov $7, %rcx
rep movsq
nop
nop
add $58102, %rdx
lea addresses_A_ht+0x71a, %rsi
lea addresses_A_ht+0x1cba2, %rdi
cmp %r14, %r14
mov $101, %rcx
rep movsq
nop
nop
nop
nop
nop
sub $35575, %rsi
lea addresses_normal_ht+0x5402, %rbp
nop
nop
nop
nop
xor $3011, %rdi
mov (%rbp), %rcx
nop
nop
nop
nop
add $53294, %rbp
lea addresses_WC_ht+0x15872, %rdx
nop
nop
cmp %rbp, %rbp
and $0xffffffffffffffc0, %rdx
vmovaps (%rdx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %rdi
nop
nop
add $44065, %rbp
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %r9
push %rax
push %rbp
push %rbx
push %rdi
// Store
mov $0x2777300000000c72, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
and $35299, %r15
mov $0x5152535455565758, %rax
movq %rax, %xmm7
vmovups %ymm7, (%rdi)
nop
nop
xor $17278, %rdi
// Faulty Load
lea addresses_PSE+0x1f072, %rbx
nop
nop
nop
and $29291, %r9
mov (%rbx), %r15d
lea oracles, %r11
and $0xff, %r15
shlq $12, %r15
mov (%r11,%r15,1), %r15
pop %rdi
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_NC', 'AVXalign': False, 'size': 32}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8}}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 16}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}}
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'same': True, 'congruent': 5, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'}
{'33': 21828, 'b6': 1}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
arch/ARM/STM32/devices/stm32f1/stm32-rcc.adb | morbos/Ada_Drivers_Library | 2 | 3908 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, 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 STM32.Device; use STM32.Device;
with STM32_SVD.PWR; use STM32_SVD.PWR;
with STM32_SVD.RCC; use STM32_SVD.RCC;
package body STM32.RCC is
-- function To_AHB1RSTR_T is new Ada.Unchecked_Conversion
-- (UInt32, AHB1RSTR_Register);
-- function To_AHB2RSTR_T is new Ada.Unchecked_Conversion
-- (UInt32, AHB2RSTR_Register);
function To_APB1RSTR_T is new Ada.Unchecked_Conversion
(UInt32, APB1RSTR_Register);
function To_APB2RSTR_T is new Ada.Unchecked_Conversion
(UInt32, APB2RSTR_Register);
---------------------------------------------------------------------------
------- Enable/Disable/Reset Routines -----------------------------------
---------------------------------------------------------------------------
procedure CRC_Clock_Enable is
begin
RCC_Periph.AHBENR.CRCEN := True;
end CRC_Clock_Enable;
procedure WWDG_Clock_Enable is
begin
RCC_Periph.APB1ENR.WWDGEN := True;
end WWDG_Clock_Enable;
procedure AHB1_Force_Reset
is
begin
null;
end AHB1_Force_Reset;
procedure AHB1_Release_Reset is
begin
null;
end AHB1_Release_Reset;
procedure AHB2_Force_Reset is
begin
null;
end AHB2_Force_Reset;
procedure AHB2_Release_Reset is
begin
null;
end AHB2_Release_Reset;
procedure APB1_Force_Reset is
begin
null;
end APB1_Force_Reset;
procedure APB1_Release_Reset is
begin
null;
end APB1_Release_Reset;
procedure APB2_Force_Reset is
begin
null;
end APB2_Force_Reset;
procedure APB2_Release_Reset is
begin
null;
end APB2_Release_Reset;
procedure CRC_Force_Reset is
begin
null;
end CRC_Force_Reset;
procedure CRC_Release_Reset is
begin
null;
end CRC_Release_Reset;
procedure OTGFS_Force_Reset is
begin
null;
end OTGFS_Force_Reset;
procedure OTGFS_Release_Reset is
begin
null;
end OTGFS_Release_Reset;
procedure WWDG_Force_Reset is
begin
null;
end WWDG_Force_Reset;
procedure WWDG_Release_Reset is
begin
null;
end WWDG_Release_Reset;
procedure SYSCFG_Force_Reset is
begin
null;
end SYSCFG_Force_Reset;
procedure SYSCFG_Release_Reset is
begin
null;
end SYSCFG_Release_Reset;
end STM32.RCC;
|
src/usb-device-hid-gamepad.ads | Fabien-Chouteau/usb_embedded | 14 | 15093 | <reponame>Fabien-Chouteau/usb_embedded
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2018-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 Interfaces;
package USB.Device.HID.Gamepad is
Gamepad_Report_Size : constant := 7;
subtype Parent is Abstract_HID_Class;
type Instance
is new Parent (Gamepad_Report_Size)
with private;
type Axis is (X, Y, Z, Rx, Ry, Rz);
procedure Set_Axis (This : in out Instance;
A : Axis;
Value : Interfaces.Integer_8);
-- Set value of stick axis
procedure Set_Buttons (This : in out Instance;
Buttons : UInt8);
-- Set the buttons state
private
type Instance
is new Abstract_HID_Class (Gamepad_Report_Size)
with null record;
HID_Gamepad_Report_Desc : aliased constant UInt8_Array :=
(
-- https://gist.github.com/wereii/b215c799a267af10154087b5d5af3a6b
16#05#, 16#01#, -- USAGE_PAGE (Generic Desktop)
16#09#, 16#05#, -- USAGE (Game pad)
16#a1#, 16#01#, -- COLLECTION (Application)
16#09#, 16#01#, -- USAGE (Pointer)
16#a1#, 16#00#, -- COLLECTION (Physical)
-- Sticks
-- 16#05#, 16#01#, -- USAGE_PAGE (Generic Desktop)
16#09#, 16#30#, -- USAGE (X)
16#09#, 16#31#, -- USAGE (Y)
16#09#, 16#32#, -- USAGE (Z)
16#09#, 16#33#, -- USAGE (Rx)
16#09#, 16#34#, -- USAGE (Ry)
16#09#, 16#35#, -- USAGE (Rz)
16#15#, 16#81#, -- LOGICAL_MINIMUM (-127)
16#25#, 16#7f#, -- LOGICAL_MAXIMUM (127)
16#95#, 16#06#, -- REPORT_COUNT (6)
16#75#, 16#08#, -- REPORT_SIZE (8)
16#81#, 16#02#, -- INPUT (Data,Var,Abs)
-- Buttons
16#05#, 16#09#, -- USAGE_PAGE (Button)
16#19#, 16#01#, -- USAGE_MINIMUM (Button 1)
16#29#, 16#08#, -- USAGE_MAXIMUM (Button 8)
16#15#, 16#00#, -- LOGICAL_MINIMUM (0)
16#25#, 16#01#, -- LOGICAL_MAXIMUM (1)
16#75#, 16#01#, -- REPORT_SIZE (1)
16#95#, 16#08#, -- REPORT_COUNT (8)
16#81#, 16#02#, -- INPUT (Data,Var,Abs)
16#c0#, -- END_COLLECTION
16#c0# -- END_COLLECTION
);
overriding
function Report_Descriptor (This : Instance)
return not null Report_Descriptor_Access
is (HID_Gamepad_Report_Desc'Access);
end USB.Device.HID.Gamepad;
|
startup.asm | tecty/toyOS | 0 | 4772 | <gh_stars>0
.extern stack_top
.global _start
_start:
// reset control registers
// we are on el1
LDR X1, =0x30C50838
MSR SCTLR_EL1, X1
ldr x30, =stack_top
mov sp, x30
bl main
hang:
b hang
.equ _psci_system_off, 0x84000008
.global system_off
system_off:
ldr x0, =_psci_system_off
hvc #0
|
oeis/107/A107003.asm | neoneye/loda-programs | 11 | 172350 | <gh_stars>10-100
; A107003: Primes of the form 24n + 5.
; Submitted by <NAME>
; 5,29,53,101,149,173,197,269,293,317,389,461,509,557,653,677,701,773,797,821,941,1013,1061,1109,1181,1229,1277,1301,1373,1493,1613,1637,1709,1733,1877,1901,1949,1973,1997,2069,2141,2213,2237,2309,2333,2357,2381,2477,2549,2621,2693,2741,2789,2837,2861,2909,2957,3221,3389,3413,3461,3533,3557,3581,3677,3701,3797,3821,3917,3989,4013,4133,4157,4229,4253,4349,4373,4397,4421,4493,4517,4637,4733,4877,4973,5021,5189,5237,5261,5309,5333,5381,5477,5501,5573,5669,5693,5717,5741,5813
mov $1,6
mov $2,$0
pow $2,2
lpb $2
mov $3,$1
sub $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,24
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,1
lpe
mov $0,$1
sub $0,1
|
oeis/271/A271079.asm | neoneye/loda-programs | 11 | 3427 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A271079: Residues (mod 32) of partial sums of Fibonacci numbers starting with F(2).
; Submitted by <NAME>
; 1,3,6,11,19,0,21,23,14,7,23,0,25,27,22,19,11,0,13,15,30,15,15,0,17,19,6,27,3,0,5,7,14,23,7,0,9,11,22,3,27,0,29,31,30,31,31,0
mov $3,1
lpb $0
sub $0,1
add $1,1
mov $2,$3
add $3,$1
mov $1,$2
lpe
add $3,$1
mov $0,$3
mod $0,32
|
programs/oeis/267/A267730.asm | neoneye/loda | 22 | 167925 | ; A267730: Number of nX3 0..1 arrays with every repeated value in every row and column greater than or equal to the previous repeated value.
; 8,64,512,3375,21952,132651,778688,4410944,24389000,131872229,700227072,3659383421,18863581528,96071912000,484106454208,2416353439059,11958715956032,58732317850311,286451826688000,1388285542167616,6689518018527448,32063175549753769,152931248775032832,726148476065265625,3433506354716205032,16171935339283541056,75895001237803470848,354972964526167438359,1655016166138527928000,7693416760621066878339,35663490978216035066432,164887128154940889559616,760453533856503941954408,3498976334424922786386125,16063726887828361024547328,73593407812393801955412629,336484667997969808629775672,1535565758381006075118495296,6995007960896189010236104000,31809856840891318952374689531,144418692261660402153620276288,654644376535444201051414040799,2963042176686062975587763978752,13392099143545872197688279976000,60445531410562390062864265686712,272463997243077917288941511831761,1226610232882163493901716856209408,5515417008775224163867752760300849,24771079712235896703097219386125000,111128552247121566855997846572841024,498010787006932387842962370055419392
add $0,1
seq $0,320947 ; a(n) is the number of dominoes, among all domino tilings of the 2 X n rectangle, sharing a length-2 side with the boundary of the rectangle.
pow $0,3
div $0,8
|
src/Categories/Diagram/KernelPair.agda | Trebor-Huang/agda-categories | 279 | 7789 | <reponame>Trebor-Huang/agda-categories
{-# OPTIONS --without-K --safe #-}
open import Categories.Category.Core
-- Kernel Pair - a Pullback of a morphism along itself
-- https://ncatlab.org/nlab/show/kernel+pair
module Categories.Diagram.KernelPair {o ℓ e} (𝒞 : Category o ℓ e) where
open import Level
open import Categories.Diagram.Pullback 𝒞
open Category 𝒞
private
variable
A B : Obj
-- Make it a pure synonym
KernelPair : (f : A ⇒ B) → Set (o ⊔ ℓ ⊔ e)
KernelPair f = Pullback f f
|
Definition/LogicalRelation/Properties/Escape.agda | Vtec234/logrel-mltt | 0 | 14751 | <reponame>Vtec234/logrel-mltt
{-# OPTIONS --without-K --safe #-}
open import Definition.Typed.EqualityRelation
module Definition.LogicalRelation.Properties.Escape {{eqrel : EqRelSet}} where
open EqRelSet {{...}}
open import Definition.Untyped
open import Definition.Typed
open import Definition.Typed.Weakening
open import Definition.Typed.Properties
open import Definition.LogicalRelation
open import Tools.Product
import Tools.PropositionalEquality as PE
-- Reducible types are well-formed.
escape : ∀ {l Γ A} → Γ ⊩⟨ l ⟩ A → Γ ⊢ A
escape (Uᵣ′ l′ l< ⊢Γ) = Uⱼ ⊢Γ
escape (ℕᵣ [ ⊢A , ⊢B , D ]) = ⊢A
escape (Emptyᵣ [ ⊢A , ⊢B , D ]) = ⊢A
escape (Unitᵣ [ ⊢A , ⊢B , D ]) = ⊢A
escape (ne′ K [ ⊢A , ⊢B , D ] neK K≡K) = ⊢A
escape (Bᵣ′ W F G [ ⊢A , ⊢B , D ] ⊢F ⊢G A≡A [F] [G] G-ext) = ⊢A
escape (emb 0<1 A) = escape A
-- Reducible type equality respect the equality relation.
escapeEq : ∀ {l Γ A B} → ([A] : Γ ⊩⟨ l ⟩ A)
→ Γ ⊩⟨ l ⟩ A ≡ B / [A]
→ Γ ⊢ A ≅ B
escapeEq (Uᵣ′ l′ l< ⊢Γ) PE.refl = ≅-Urefl ⊢Γ
escapeEq (ℕᵣ [ ⊢A , ⊢B , D ]) D′ = ≅-red D D′ ℕₙ ℕₙ (≅-ℕrefl (wf ⊢A))
escapeEq (Emptyᵣ [ ⊢A , ⊢B , D ]) D′ = ≅-red D D′ Emptyₙ Emptyₙ (≅-Emptyrefl (wf ⊢A))
escapeEq (Unitᵣ [ ⊢A , ⊢B , D ]) D′ = ≅-red D D′ Unitₙ Unitₙ (≅-Unitrefl (wf ⊢A))
escapeEq (ne′ K D neK K≡K) (ne₌ M D′ neM K≡M) =
≅-red (red D) (red D′) (ne neK) (ne neM) (~-to-≅ K≡M)
escapeEq (Bᵣ′ W F G D ⊢F ⊢G A≡A [F] [G] G-ext)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) =
≅-red (red D) D′ ⟦ W ⟧ₙ ⟦ W ⟧ₙ A≡B
escapeEq (emb 0<1 A) A≡B = escapeEq A A≡B
-- Reducible terms are well-formed.
escapeTerm : ∀ {l Γ A t} → ([A] : Γ ⊩⟨ l ⟩ A)
→ Γ ⊩⟨ l ⟩ t ∷ A / [A]
→ Γ ⊢ t ∷ A
escapeTerm (Uᵣ′ l′ l< ⊢Γ) (Uₜ A [ ⊢t , ⊢u , d ] typeA A≡A [A]) = ⊢t
escapeTerm (ℕᵣ D) (ℕₜ n [ ⊢t , ⊢u , d ] t≡t prop) =
conv ⊢t (sym (subset* (red D)))
escapeTerm (Emptyᵣ D) (Emptyₜ e [ ⊢t , ⊢u , d ] t≡t prop) =
conv ⊢t (sym (subset* (red D)))
escapeTerm (Unitᵣ D) (Unitₜ e [ ⊢t , ⊢u , d ] prop) =
conv ⊢t (sym (subset* (red D)))
escapeTerm (ne′ K D neK K≡K) (neₜ k [ ⊢t , ⊢u , d ] nf) =
conv ⊢t (sym (subset* (red D)))
escapeTerm (Bᵣ′ BΠ F G D ⊢F ⊢G A≡A [F] [G] G-ext)
(Πₜ f [ ⊢t , ⊢u , d ] funcF f≡f [f] [f]₁) =
conv ⊢t (sym (subset* (red D)))
escapeTerm (Bᵣ′ BΣ F G D ⊢F ⊢G A≡A [F] [G] G-ext)
(Σₜ p [ ⊢t , ⊢u , d ] pProd p≅p [fst] [snd]) =
conv ⊢t (sym (subset* (red D)))
escapeTerm (emb 0<1 A) t = escapeTerm A t
-- Reducible term equality respect the equality relation.
escapeTermEq : ∀ {l Γ A t u} → ([A] : Γ ⊩⟨ l ⟩ A)
→ Γ ⊩⟨ l ⟩ t ≡ u ∷ A / [A]
→ Γ ⊢ t ≅ u ∷ A
escapeTermEq (Uᵣ′ l′ l< ⊢Γ) (Uₜ₌ A B d d′ typeA typeB A≡B [A] [B] [A≡B]) =
≅ₜ-red (id (Uⱼ ⊢Γ)) (redₜ d) (redₜ d′) Uₙ (typeWhnf typeA) (typeWhnf typeB) A≡B
escapeTermEq (ℕᵣ D) (ℕₜ₌ k k′ d d′ k≡k′ prop) =
let natK , natK′ = split prop
in ≅ₜ-red (red D) (redₜ d) (redₜ d′) ℕₙ
(naturalWhnf natK) (naturalWhnf natK′) k≡k′
escapeTermEq (Emptyᵣ D) (Emptyₜ₌ k k′ d d′ k≡k′ prop) =
let natK , natK′ = esplit prop
in ≅ₜ-red (red D) (redₜ d) (redₜ d′) Emptyₙ
(ne natK) (ne natK′) k≡k′
escapeTermEq {l} {Γ} {A} {t} {u} (Unitᵣ D) (Unitₜ₌ ⊢t ⊢u) =
let t≅u = ≅ₜ-η-unit ⊢t ⊢u
A≡Unit = subset* (red D)
in ≅-conv t≅u (sym A≡Unit)
escapeTermEq (ne′ K D neK K≡K)
(neₜ₌ k m d d′ (neNfₜ₌ neT neU t≡u)) =
≅ₜ-red (red D) (redₜ d) (redₜ d′) (ne neK) (ne neT) (ne neU)
(~-to-≅ₜ t≡u)
escapeTermEq (Bᵣ′ BΠ F G D ⊢F ⊢G A≡A [F] [G] G-ext)
(Πₜ₌ f g d d′ funcF funcG f≡g [f] [g] [f≡g]) =
≅ₜ-red (red D) (redₜ d) (redₜ d′) Πₙ (functionWhnf funcF) (functionWhnf funcG) f≡g
escapeTermEq (Bᵣ′ BΣ F G D ⊢F ⊢G A≡A [F] [G] G-ext)
(Σₜ₌ p r d d′ pProd rProd p≅r [t] [u] [fstp] [fstr] [fst≡] [snd≡]) =
≅ₜ-red (red D) (redₜ d) (redₜ d′) Σₙ (productWhnf pProd) (productWhnf rProd) p≅r
escapeTermEq (emb 0<1 A) t≡u = escapeTermEq A t≡u
|
Microprocessor/matrix.asm | Nmane1612/Nihar-Mane | 3 | 17067 | <filename>Microprocessor/matrix.asm
; matrix transpose sample (reverse rows with columns).
name "matrix"
org 100h
jmp start ; go to code...
msg db "to the view matrix click vars button,", 0dh,0ah
db " and set elements property to 3 for these items:", 0dh,0ah, 0ah
db " matrix ", 0dh,0ah
db " row1 ", 0dh,0ah
db " row2 ", 0dh,0ah, 0dh,0ah
db "or add print-out support to this program...", 0dh,0ah, '$'
matrix_size equ 3
; ----- matrix ------
matrix db 1,2,3
row1 db 4,5,6
row2 db 7,8,9
;--------------------
i dw ?
j dw ?
start:
mov i, 0
next_i:
; j = i + 1
mov cx, i
inc cx
mov j, cx
next_j:
mov si, i
mov bx, j
mov al, matrix_size
mov cx, si
mul cl
mov si, ax
mov dl, matrix[si][bx]
mov si, i
mov al, matrix_size
mul bl
mov bx, ax
xchg matrix[bx][si], dl
mov bx, j
mov al, matrix_size
mov cx, si
mul cl
mov si, ax
mov matrix[si][bx], dl
inc j
cmp j, matrix_size
jb next_j
inc i
cmp i, matrix_size/2
jbe next_i
; print message....
lea dx, msg
mov ah, 9
int 21h
; wait for any key press...
mov ah, 0
int 16h
ret
|
boards/native/src/native-i2c.adb | Sawchord/Ada_Drivers_Library | 0 | 1491 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2018, 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 STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL.I2C;
package body Native.I2C is
function Configure (Device : String;
Conf : I2C_Configuration;
Status : out HAL.I2C.I2C_Status)
return I2C_Port is
File : File_Id;
Ret : Interfaces.C.Int;
begin
File := Open (Device, 8#02#, 777);
if (Integer(Err_No) /= 0) then
Status := Err_Error;
return I2C_Port'(File_Desc => -1, Config => Conf);
end if;
if Conf.Addressing_Mode = Addressing_Mode_10bit then
-- NOTE: As of now, 10-Bit mode seems not to be working
-- with many devices. Therefore we return Error, when
-- 10-Bit mode is issued, but still continue
Ret := Simple_Ioctl (File, I2C_TENBIT, 0);
Status := Err_Error;
end if;
-- TODO: Check up on SMBus mode and how to use it
Status := Ok;
return I2C_Port'(File_Desc => File, Config => Conf);
end Configure;
overriding
procedure Master_Transmit
(This : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Data : HAL.I2C.I2C_Data;
Status : out HAL.I2C.I2C_Status;
Timeout : Natural := 1000) is
Ret : Interfaces.C.int;
Size : Posix.Size;
begin
Ret := Simple_Ioctl (This.File_Desc, I2C_SLAVE, HAL.Uint64(Addr));
if Ret /= 0 then
Put_Line ("Error while setting address");
Status := Err_Error;
return;
end if;
Size := Write (This.File_Desc, Data'Address, Data'Length);
if Size /= Data'Length then
Put_Line ("Error while transmitting Data");
Status := Err_Error;
end if;
Status := Ok;
end Master_Transmit;
overriding
procedure Master_Receive
(This : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Data : out HAL.I2C.I2C_Data;
Status : out HAL.I2C.I2C_Status;
Timeout : Natural := 1000) is
begin
null;
end Master_Receive;
overriding
procedure Mem_Write
(This : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Mem_Addr : UInt16;
Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size;
Data : HAL.I2C.I2C_Data;
Status : out HAL.I2C.I2C_Status;
Timeout : Natural := 1000) is
begin
null;
end Mem_Write;
overriding
procedure Mem_Read
(This : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Mem_Addr : UInt16;
Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size;
Data : out HAL.I2C.I2C_Data;
Status : out HAL.I2C.I2C_Status;
Timeout : Natural := 1000) is
begin
null;
end Mem_Read;
end Native.I2C;
|
src/sdl-rwops.ads | treggit/sdlada | 89 | 18292 | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, <NAME>
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.RWops
--
-- Read/Write operations, i.e. file related machinery.
--------------------------------------------------------------------------------------------------------------------
with Ada.Strings.UTF_Encoding;
with Interfaces.C;
private with System;
package SDL.RWops is
pragma Preelaborate;
package C renames Interfaces.C;
package UTF_Strings renames Ada.Strings.UTF_Encoding;
RWops_Error : exception;
subtype Uint8 is Interfaces.Unsigned_8;
subtype Uint16 is Interfaces.Unsigned_16;
subtype Uint32 is Interfaces.Unsigned_32;
subtype Uint64 is Interfaces.Unsigned_64;
type RWops is limited private;
type File_Mode is (Read,
Create_To_Write,
Append,
Read_Write,
Create_To_Read_Write,
Append_And_Read,
Read_Binary,
Create_To_Write_Binary,
Append_Binary,
Read_Write_Binary,
Create_To_Read_Write_Binary,
Append_And_Read_Binary);
type Whence_Type is private;
RW_Seek_Set : constant Whence_Type; -- Seek from the beginning of data.
RW_Seek_Cur : constant Whence_Type; -- Seek relative to current read point.
RW_Seek_End : constant Whence_Type; -- Seek relative to the end of data.
type Offsets is new Interfaces.Integer_64;
Null_Offset : constant Offsets := 0;
Error_Offset : constant Offsets := -1;
subtype Sizes is Offsets;
Error_Or_EOF : constant Sizes := 0;
function Base_Path return UTF_Strings.UTF_String;
function Preferences_Path (Organisation : in UTF_Strings.UTF_String;
Application : in UTF_Strings.UTF_String) return UTF_Strings.UTF_String;
function Seek (Context : in RWops;
Offset : in Offsets;
Whence : in Whence_Type) return Offsets;
function Size (Context : in RWops) return Offsets;
function Tell (Context : in RWops) return Offsets;
function From_File (File_Name : in UTF_Strings.UTF_String;
Mode : in File_Mode) return RWops;
procedure From_File (File_Name : in UTF_Strings.UTF_String;
Mode : in File_Mode;
Ops : out RWops);
procedure Close (Ops : in RWops);
function Read_U_8 (src : in RWops) return Uint8 with
Import => True,
Convention => C,
External_Name => "SDL_ReadU8";
function Read_LE_16 (Src : in RWops) return Uint16 with
Import => True,
Convention => C,
External_Name => "SDL_ReadLE16";
function Read_BE_16 (Src : in RWops) return Uint16 with
Import => True,
Convention => C,
External_Name => "SDL_ReadBE16";
function Read_LE_32 (Src : in RWops) return Uint32 with
Import => True,
Convention => C,
External_Name => "SDL_ReadLE32";
function Read_BE_32 (Src : in RWops) return Uint32 with
Import => True,
Convention => C,
External_Name => "SDL_ReadBE32";
function Read_LE_64 (Src : in RWops) return Uint64 with
Import => True,
Convention => C,
External_Name => "SDL_ReadLE64";
function Read_BE_64 (Src : in RWops) return Uint64 with
Import => True,
Convention => C,
External_Name => "SDL_ReadBE64";
procedure Write_U_8 (Destination : in RWops; Value : in Uint8);
procedure Write_LE_16 (Destination : in RWops; Value : in Uint16);
procedure Write_BE_16 (Destination : in RWops; Value : in Uint16);
procedure Write_LE_32 (Destination : in RWops; Value : in Uint32);
procedure Write_BE_32 (Destination : in RWops; Value : in Uint32);
procedure Write_LE_64 (Destination : in RWops; Value : in Uint64);
procedure Write_BE_64 (Destination : in RWops; Value : in Uint64);
function Is_Null (Source : in RWops) return Boolean with
Inline_Always => True;
private
type Whence_Type is new C.int;
RW_Seek_Set : constant Whence_Type := 0;
RW_Seek_Cur : constant Whence_Type := 1;
RW_Seek_End : constant Whence_Type := 2;
-- The SDL_RWops struct contains a union which is only used internally by SDL.
--
-- The manual states that when a new RWops implementation is written, the Unknown struct within the union can be
-- used to store data, this consists of two pointers. This is all that is allowed.
--
-- TODO: Make it generic passing in two access types of convention C.
type User_Datums is
record
Data_1 : System.Address;
Data_2 : System.Address;
end record with
Convention => C;
type Stream_Types is new C.unsigned;
Unknown_Stream : constant Stream_Types := 0;
type RWops_Pointer;
type SDL_RWops is
record
Size : access function (Context : in RWops_Pointer) return Offsets;
Seek : access function (Context : in RWops_Pointer;
Offset : in Offsets;
Whence : in Whence_Type) return Offsets;
Read : access function (Context : in RWops_Pointer;
Ptr : in System.Address;
Size : in Sizes;
Max_Num : in C.unsigned_long) return C.unsigned_long;
Write : access function (Context : in RWops_Pointer;
Ptr : in System.Address;
Size : in Sizes;
Num : in C.unsigned_long) return C.unsigned_long;
Close : access function (Context : in RWops_Pointer) return C.int;
Stream_Type : Stream_Types; -- When creating a RWops, this should always be set to Unknown_Stream.
User_Data : User_Datums;
end record with
Convention => C_Pass_By_Copy;
type RWops_Pointer is access all SDL_RWops with
Convention => C;
type RWops is new RWops_Pointer;
end SDL.RWops;
|
programs/oeis/187/A187971.asm | neoneye/loda | 22 | 167327 | <reponame>neoneye/loda
; A187971: Positions of 1 in A187969; complement of A187970.
; 2,7,12,14,19,24,26,31,36,41,43,48,53,55,60,65,70,72,77,82,84,89,94,96,101,106,111,113,118,123,125,130,135,140,142,147,152,154,159,164,166,171,176,181,183,188,193,195,200,205,210,212,217,222,224,229,234,239,241,246,251,253,258,263,265,270,275,280,282,287,292,294,299,304,309,311,316,321,323,328,333,335,340,345,350,352,357,362,364,369,374,379,381,386,391,393,398,403,408,410
mov $2,$0
seq $0,80755 ; a(n) = ceiling(n*(1+1/sqrt(2))).
mul $0,3
sub $0,$2
sub $0,4
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt59.adb | best08618/asylo | 7 | 6556 | -- { dg-do run }
-- { dg-options "-O" }
with Opt59_Pkg; use Opt59_Pkg;
procedure Opt59 is
type Enum is (Zero, One, Two);
function Has_True (V : Boolean_Vector) return Boolean is
begin
for I in V'Range loop
if V (I) then
return True;
end if;
end loop;
return False;
end;
Data1 : constant Boolean_Vector := Get_BV1;
Data2 : constant Boolean_Vector := Get_BV2;
Result : Boolean_Vector;
function F return Enum is
Res : Enum := Zero;
Set1 : constant Boolean := Has_True (Data1);
Set2 : constant Boolean := Has_True (Data2);
begin
if Set1 then
Res := Two;
elsif Set2 then
Res := One;
end if;
return Res;
end;
Val : constant Enum := F;
begin
for I in Result'Range loop
Result (I) := Data1 (I) or Data2 (I);
end loop;
if Val /= Zero then
Test (Val = Two);
end if;
end;
|
src/_demo/debug_trace/apsepp_demo_dt_instance_client.adb | thierr26/ada-apsepp | 0 | 14454 | -- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
-- "With" the shared debug trace instance access point package.
with Apsepp.Debug_Trace;
package body Apsepp_Demo_DT_Instance_Client is
----------------------------------------------------------------------------
procedure Instance_Client is
use Apsepp.Debug_Trace; -- Makes function Apsepp.Debug_Trace.Debug_Trace
-- visible (access to the shared debug trace
-- instance).
begin
-- Call primitive operations of debug trace instance.
Debug_Trace.Trace ("Simple trace line");
Debug_Trace.Set_Local_Time_Zone;
Debug_Trace.Trace_Time;
Debug_Trace.Trace
("Trace with entity name",
"Apsepp_Demo_DT_Instance_Client.Instance_Client");
Debug_Trace.Trace_Time;
Debug_Trace.Trace ("Sleeping...");
delay (1.2); -- 1.2 seconds.
Debug_Trace.Trace_Time;
Debug_Trace.Trace ("Reset elapsed time");
Debug_Trace.Trace_Time (Reset_Elapsed => True);
Debug_Trace.Trace ("Sleeping...");
delay (0.6); -- 1.2 seconds.
Debug_Trace.Trace_Time;
end Instance_Client;
----------------------------------------------------------------------------
end Apsepp_Demo_DT_Instance_Client;
|
projects/Assembler/asm-programs/Max.asm | UrielX/nand2tetris | 0 | 243253 | <filename>projects/Assembler/asm-programs/Max.asm
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by <NAME> Schocken, MIT Press.
// File name: projects/06/max/Max.asm
// Computes R2 = max(R0, R1) (R0,R1,R2 refer to RAM[0],RAM[1],RAM[2])
@R0
D=M
@R1
D=D-M
@OUTPUT_FIRST
D;JGT
@R1
D=M
@OUTPUT_D
0;JMP
(OUTPUT_FIRST)
@R0
D=M
(OUTPUT_D)
@R2
M=D
(INFINITE_LOOP)
@INFINITE_LOOP
0;JMP
|
src/algebra/semigroup.agda | pcapriotti/agda-base | 20 | 1730 | {-# OPTIONS --without-K #-}
module algebra.semigroup where
open import algebra.semigroup.core public
open import algebra.semigroup.morphism public
|
solutions/64 - Binary Counter/size-60_speed-17.asm | michaelgundlach/7billionhumans | 45 | 15583 | -- 7 Billion Humans (2144) --
-- 64: Binary Counter --
-- Author: soerface
-- Size: 60
-- Speed: 17
if e == nothing and
w == worker:
step s
step s
pickup n
a:
mem1 = set c
drop
mem1 = set c
pickup c
jump a
endif
if w == datacube:
step s
b:
step s
step n
jump b
endif
if w == nothing:
step s
step s
pickup n
mem1 = calc 0 + 0
mem1 = calc 0 + 0
mem1 = calc 0 + 0
mem1 = set c
mem1 = set c
drop
endif
if e == nothing:
step s
step s
pickup n
jump c
d:
mem1 = set c
mem1 = set c
mem1 = set c
c:
drop
mem1 = set c
mem1 = set c
mem1 = set c
pickup c
jump d
else:
step s
step s
pickup n
jump e
f:
mem1 = set c
mem1 = set c
mem1 = set c
e:
mem1 = set c
mem1 = set c
mem1 = set c
mem1 = set c
drop
mem1 = set c
mem1 = set c
mem1 = set c
mem1 = set c
mem1 = set c
mem1 = set c
mem1 = set c
pickup c
jump f
endif
|
programs/oeis/008/A008750.asm | neoneye/loda | 22 | 102496 | <gh_stars>10-100
; A008750: Expansion of (1+x^7)/((1-x)*(1-x^2)*(1-x^3)).
; 1,1,2,3,4,5,7,9,11,14,17,20,24,28,32,37,42,47,53,59,65,72,79,86,94,102,110,119,128,137,147,157,167,178,189,200,212,224,236,249,262,275,289,303,317,332,347,362,378,394,410,427,444,461,479,497,515,534,553,572,592,612,632,653,674,695,717,739,761,784,807,830,854,878,902,927,952,977,1003,1029,1055,1082,1109,1136,1164,1192,1220,1249,1278,1307,1337,1367,1397,1428,1459,1490,1522,1554,1586,1619
bin $0,2
mov $2,$0
cmp $2,0
mov $3,$0
add $0,$2
div $3,$0
div $0,3
add $0,$3
add $0,1
|
Cubical/Algebra/Group/EilenbergMacLane/CupProduct.agda | thomas-lamiaux/cubical | 0 | 11861 | {-# OPTIONS --safe --experimental-lossy-unification #-}
module Cubical.Algebra.Group.EilenbergMacLane.CupProduct where
open import Cubical.Algebra.Group.EilenbergMacLane.Base renaming (elim to EM-elim)
open import Cubical.Algebra.Group.EilenbergMacLane.WedgeConnectivity
open import Cubical.Algebra.Group.EilenbergMacLane.GroupStructure
open import Cubical.Algebra.Group.EilenbergMacLane.Properties
open import Cubical.Algebra.Group.Base
open import Cubical.Algebra.Group.Properties
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.GroupoidLaws renaming (assoc to ∙assoc)
open import Cubical.Foundations.Path
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Pointed
open import Cubical.Foundations.Transport
open import Cubical.Foundations.Pointed.Homogeneous
open import Cubical.Functions.Morphism
open import Cubical.Homotopy.Loopspace
open import Cubical.HITs.Truncation as Trunc renaming (rec to trRec; elim to trElim)
open import Cubical.HITs.EilenbergMacLane1 renaming (rec to EMrec)
open import Cubical.Algebra.AbGroup.Base
open import Cubical.Data.Empty
renaming (rec to ⊥-rec)
open import Cubical.HITs.Truncation
renaming (elim to trElim ; rec to trRec ; rec2 to trRec2)
open import Cubical.Data.Nat hiding (_·_) renaming (elim to ℕelim)
open import Cubical.HITs.Susp
open import Cubical.Algebra.AbGroup.TensorProduct
open import Cubical.Algebra.Group
open AbGroupStr renaming (_+_ to _+Gr_ ; -_ to -Gr_)
open PlusBis
private
variable
ℓ ℓ' ℓ'' : Level
-- Lemma for distributativity of cup product (used later)
pathType : ∀ {ℓ} {G : AbGroup ℓ} (n : ℕ) (x : EM G (2 + n)) (p : 0ₖ (2 + n) ≡ x) → Type ℓ
pathType n x p = sym (rUnitₖ (2 + n) x) ∙ (λ i → x +ₖ p i)
≡ sym (lUnitₖ (2 + n) x) ∙ λ i → p i +ₖ x
pathTypeMake : ∀ {ℓ} {G : AbGroup ℓ} (n : ℕ) (x : EM G (2 + n)) (p : 0ₖ (2 + n) ≡ x)
→ pathType n x p
pathTypeMake n x = J (λ x p → pathType n x p) refl
-- Definition of cup product (⌣ₖ, given by ·₀ when first argument is in K(G,0))
module _ {G' : AbGroup ℓ} {H' : AbGroup ℓ'} where
private
G = fst G'
H = fst H'
strG = snd G'
strH = snd H'
0G = 0g strG
0H = 0g strH
_+G_ = _+Gr_ strG
_+H_ = _+Gr_ strH
-H_ = -Gr_ strH
-G_ = -Gr_ strG
·₀' : H → (m : ℕ) → EM G' m → EM (G' ⨂ H') m
·₀' h =
elim+2
(_⊗ h)
(elimGroupoid _ (λ _ → emsquash)
embase
(λ g → emloop (g ⊗ h))
λ g l →
compPathR→PathP
(sym (∙assoc _ _ _
∙∙ cong₂ _∙_ (sym (emloop-comp _ _ _)
∙ cong emloop (sym (⊗DistL+⊗ g l h))) refl
∙∙ rCancel _)))
λ n f → trRec (isOfHLevelTrunc (4 + n))
λ { north → 0ₖ (suc (suc n))
; south → 0ₖ (suc (suc n))
; (merid a i) → EM→ΩEM+1 (suc n) (f (EM-raw→EM _ _ a)) i}
·₀ : G → (m : ℕ) → EM H' m → EM (G' ⨂ H') m
·₀ g =
elim+2 (λ h → g ⊗ h)
(elimGroupoid _ (λ _ → emsquash)
embase
(λ h → emloop (g ⊗ h))
λ h l → compPathR→PathP
(sym (∙assoc _ _ _
∙∙ cong₂ _∙_ (sym (emloop-comp _ _ _) ∙ cong emloop (sym (⊗DistR+⊗ g h l))) refl
∙∙ rCancel _)))
λ n f
→ trRec (isOfHLevelTrunc (4 + n))
λ { north → 0ₖ (suc (suc n))
; south → 0ₖ (suc (suc n))
; (merid a i) → EM→ΩEM+1 (suc n) (f (EM-raw→EM _ _ a)) i}
·₀-distr : (g h : G) → (m : ℕ) (x : EM H' m) → ·₀ (g +G h) m x ≡ ·₀ g m x +ₖ ·₀ h m x
·₀-distr g h =
elim+2
(⊗DistL+⊗ g h)
(elimSet _ (λ _ → emsquash _ _)
refl
(λ w → compPathR→PathP (sym ((λ i → emloop (⊗DistL+⊗ g h w i)
∙ (lUnit (sym (cong₂+₁ (emloop (g ⊗ w)) (emloop (h ⊗ w)) i)) (~ i)))
∙∙ cong₂ _∙_ (emloop-comp _ (g ⊗ w) (h ⊗ w)) refl
∙∙ rCancel _))))
λ m ind →
trElim (λ _ → isOfHLevelTruncPath)
λ { north → refl
; south → refl
; (merid a i) k → z m ind a k i}
where
z : (m : ℕ) → ((x : EM H' (suc m))
→ ·₀ (g +G h) (suc m) x
≡ ·₀ g (suc m) x +ₖ ·₀ h (suc m) x) → (a : EM-raw H' (suc m))
→ cong (·₀ (g +G h) (suc (suc m))) (cong ∣_∣ₕ (merid a)) ≡
cong₂ _+ₖ_
(cong (·₀ g (suc (suc m))) (cong ∣_∣ₕ (merid a)))
(cong (·₀ h (suc (suc m))) (cong ∣_∣ₕ (merid a)))
z m ind a = (λ i → EM→ΩEM+1 _ (ind (EM-raw→EM _ _ a) i))
∙∙ EM→ΩEM+1-hom _ (·₀ g (suc m) (EM-raw→EM H' (suc m) a))
(·₀ h (suc m) (EM-raw→EM H' (suc m) a))
∙∙ sym (cong₂+₂ m (cong (·₀ g (suc (suc m))) (cong ∣_∣ₕ (merid a)))
(cong (·₀ h (suc (suc m))) (cong ∣_∣ₕ (merid a))))
·₀0 : (m : ℕ) → (g : G) → ·₀ g m (0ₖ m) ≡ 0ₖ m
·₀0 zero = ⊗AnnihilR
·₀0 (suc zero) g = refl
·₀0 (suc (suc m)) g = refl
·₀'0 : (m : ℕ) (h : H) → ·₀' h m (0ₖ m) ≡ 0ₖ m
·₀'0 zero = ⊗AnnihilL
·₀'0 (suc zero) g = refl
·₀'0 (suc (suc m)) g = refl
0·₀ : (m : ℕ) → (x : _) → ·₀ 0G m x ≡ 0ₖ m
0·₀ =
elim+2 ⊗AnnihilL
(elimSet _ (λ _ → emsquash _ _)
refl
λ g → compPathR→PathP ((sym (emloop-1g _)
∙ cong emloop (sym (⊗AnnihilL g)))
∙∙ (λ i → rUnit (rUnit (cong (·₀ 0G 1) (emloop g)) i) i)
∙∙ sym (∙assoc _ _ _)))
λ n f → trElim (λ _ → isOfHLevelTruncPath)
λ { north → refl
; south → refl
; (merid a i) j → (cong (EM→ΩEM+1 (suc n)) (f (EM-raw→EM _ _ a))
∙ EM→ΩEM+1-0ₖ _) j i}
0·₀' : (m : ℕ) (g : _) → ·₀' 0H m g ≡ 0ₖ m
0·₀' =
elim+2
⊗AnnihilR
(elimSet _ (λ _ → emsquash _ _)
refl
λ g → compPathR→PathP (sym (∙assoc _ _ _
∙∙ sym (rUnit _) ∙ sym (rUnit _)
∙∙ (cong emloop (⊗AnnihilR g)
∙ emloop-1g _))))
λ n f → trElim (λ _ → isOfHLevelTruncPath)
λ { north → refl
; south → refl
; (merid a i) j → (cong (EM→ΩEM+1 (suc n)) (f (EM-raw→EM _ _ a))
∙ EM→ΩEM+1-0ₖ _) j i}
-- Definition of the cup product
cup∙ : ∀ n m → EM G' n → EM∙ H' m →∙ EM∙ (G' ⨂ H') (n +' m)
cup∙ =
ℕelim
(λ m g → (·₀ g m) , ·₀0 m g)
λ n f →
ℕelim
(λ g → (λ h → ·₀' h (suc n) g) , 0·₀' (suc n) g)
λ m _ → main n m f
where
main : (n m : ℕ) (ind : ((m : ℕ) → EM G' n → EM∙ H' m →∙ EM∙ (G' ⨂ H') (n +' m)))
→ EM G' (suc n) → EM∙ H' (suc m) →∙ EM∙ (G' ⨂ H') (suc (suc (n + m)))
main zero m ind =
elimGroupoid _ (λ _ → isOfHLevel↑∙ _ _)
((λ _ → 0ₖ (2 + m)) , refl)
(f m)
λ n h → finalpp m n h
where
f : (m : ℕ) → G → typ (Ω (EM∙ H' (suc m) →∙ EM∙ (G' ⨂ H') (suc (suc m)) ∙))
fst (f m g i) x = EM→ΩEM+1 _ (·₀ g _ x) i
snd (f zero g i) j = EM→ΩEM+1-0ₖ (suc zero) j i
snd (f (suc m) g i) j = EM→ΩEM+1-0ₖ (suc (suc m)) j i
f-hom-fst : (m : ℕ) (g h : G) → cong fst (f m (g +G h)) ≡ cong fst (f m g ∙ f m h)
f-hom-fst m g h =
(λ i j x → EM→ΩEM+1 _ (·₀-distr g h (suc m) x i) j)
∙∙ (λ i j x → EM→ΩEM+1-hom _ (·₀ g (suc m) x) (·₀ h (suc m) x) i j)
∙∙ sym (cong-∙ fst (f m g) (f m h))
f-hom : (m : ℕ) (g h : G) → f m (g +G h) ≡ f m g ∙ f m h
f-hom m g h = →∙Homogeneous≡Path (isHomogeneousEM _) _ _ (f-hom-fst m g h)
finalpp : (m : ℕ) (g h : G) → PathP (λ i → f m g i ≡ f m (g +G h) i) refl (f m h)
finalpp m g h =
compPathR→PathP (sym (rCancel _)
∙∙ cong (_∙ sym (f m (g +G h))) (f-hom m g h)
∙∙ sym (∙assoc _ _ _))
main (suc n) m ind =
trElim (λ _ → isOfHLevel↑∙ (2 + n) m)
λ { north → (λ _ → 0ₖ (3 + (n + m))) , refl
; south → (λ _ → 0ₖ (3 + (n + m))) , refl
; (merid a i) → Iso.inv (ΩfunExtIso _ _)
(EM→ΩEM+1∙ _ ∘∙ ind (suc m) (EM-raw→EM _ _ a)) i}
_⌣ₖ_ : {n m : ℕ} (x : EM G' n) (y : EM H' m) → EM (G' ⨂ H') (n +' m)
_⌣ₖ_ x y = cup∙ _ _ x .fst y
⌣ₖ-0ₖ : (n m : ℕ) (x : EM G' n) → (x ⌣ₖ 0ₖ m) ≡ 0ₖ (n +' m)
⌣ₖ-0ₖ n m x = cup∙ n m x .snd
0ₖ-⌣ₖ : (n m : ℕ) (x : EM H' m) → ((0ₖ n) ⌣ₖ x) ≡ 0ₖ (n +' m)
0ₖ-⌣ₖ zero m = 0·₀ _
0ₖ-⌣ₖ (suc zero) zero x = refl
0ₖ-⌣ₖ (suc (suc n)) zero x = refl
0ₖ-⌣ₖ (suc zero) (suc m) x = refl
0ₖ-⌣ₖ (suc (suc n)) (suc m) x = refl
module LeftDistributivity {G' : AbGroup ℓ} {H' : AbGroup ℓ'} where
private
distrl1 : (n m : ℕ) → EM H' m → EM H' m
→ EM∙ G' n →∙ EM∙ (G' ⨂ H') (n +' m)
fst (distrl1 n m x y) z = z ⌣ₖ (x +ₖ y)
snd (distrl1 n m x y) = 0ₖ-⌣ₖ n m _
distrl2 : (n m : ℕ) → EM H' m → EM H' m
→ EM∙ G' n →∙ EM∙ (G' ⨂ H') (n +' m)
fst (distrl2 n m x y) z = (z ⌣ₖ x) +ₖ (z ⌣ₖ y)
snd (distrl2 n m x y) =
cong₂ _+ₖ_ (0ₖ-⌣ₖ n m x) (0ₖ-⌣ₖ n m y) ∙ rUnitₖ _ (0ₖ (n +' m))
hLevLem : (n m : ℕ) → isOfHLevel (suc (suc m)) (EM∙ G' (suc n) →∙ EM∙ (G' ⨂ H') ((suc n) +' m))
hLevLem n m =
subst (isOfHLevel (suc (suc m)))
(λ i → EM∙ G' (suc n) →∙ EM∙ (G' ⨂ H')
((cong suc (+-comm m n) ∙ sym (+'≡+ (suc n) m)) i)) (isOfHLevel↑∙ m n)
mainDistrL : (n m : ℕ) (x y : EM H' (suc m))
→ distrl1 (suc n) (suc m) x y ≡ distrl2 (suc n) (suc m) x y
mainDistrL n zero =
wedgeConEM.fun H' H' 0 0
(λ _ _ → hLevLem _ _ _ _)
(λ x → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt λ z → l x z))
(λ y → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt λ z → r y z ))
λ i → →∙Homogeneous≡ (isHomogeneousEM (suc (suc (n + 0))))
(funExt (λ z → l≡r z i))
where
l : (x : EM H' 1) (z : _)
→ (distrl1 (suc n) 1 embase x .fst z) ≡ (distrl2 (suc n) 1 embase x .fst z)
l x z = cong (z ⌣ₖ_) (lUnitₖ _ x)
∙∙ sym (lUnitₖ _ (z ⌣ₖ x))
∙∙ λ i → (⌣ₖ-0ₖ (suc n) (suc zero) z (~ i)) +ₖ (z ⌣ₖ x)
r : (z : EM H' 1) (x : EM G' (suc n))
→ (distrl1 (suc n) 1 z embase .fst x) ≡ (distrl2 (suc n) 1 z embase .fst x)
r y z = cong (z ⌣ₖ_) (rUnitₖ _ y)
∙∙ sym (rUnitₖ _ (z ⌣ₖ y))
∙∙ λ i → (z ⌣ₖ y) +ₖ (⌣ₖ-0ₖ (suc n) (suc zero) z (~ i))
l≡r : (z : EM G' (suc n)) → l embase z ≡ r embase z
l≡r z = sym (pathTypeMake _ _ (sym (⌣ₖ-0ₖ (suc n) (suc zero) z)))
mainDistrL n (suc m) =
elim2 (λ _ _ → isOfHLevelPath (4 + m) (hLevLem _ _) _ _)
(wedgeConEM.fun H' H' (suc m) (suc m)
(λ x y p q → isOfHLevelPlus {n = suc (suc m)} (suc m)
(hLevLem n (suc (suc m))
(distrl1 (suc n) (suc (suc m)) ∣ x ∣ ∣ y ∣)
(distrl2 (suc n) (suc (suc m)) ∣ x ∣ ∣ y ∣) p q))
(λ x → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt (l x)))
(λ x → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt (r x)))
λ i → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt (λ z → l≡r z i)))
where
l : (x : EM-raw H' (suc (suc m))) (z : EM G' (suc n))
→ (distrl1 (suc n) (suc (suc m)) (0ₖ _) ∣ x ∣ₕ .fst z)
≡ (distrl2 (suc n) (suc (suc m)) (0ₖ _) ∣ x ∣ₕ .fst z)
l x z = cong (z ⌣ₖ_) (lUnitₖ (suc (suc m)) ∣ x ∣)
∙∙ sym (lUnitₖ _ (z ⌣ₖ ∣ x ∣))
∙∙ λ i → (⌣ₖ-0ₖ (suc n) (suc (suc m)) z (~ i)) +ₖ (z ⌣ₖ ∣ x ∣)
r : (x : EM-raw H' (suc (suc m))) (z : EM G' (suc n))
→ (distrl1 (suc n) (suc (suc m)) ∣ x ∣ₕ (0ₖ _) .fst z)
≡ (distrl2 (suc n) (suc (suc m)) ∣ x ∣ₕ (0ₖ _) .fst z)
r x z = cong (z ⌣ₖ_) (rUnitₖ (suc (suc m)) ∣ x ∣)
∙∙ sym (rUnitₖ _ (z ⌣ₖ ∣ x ∣))
∙∙ λ i → (z ⌣ₖ ∣ x ∣) +ₖ (⌣ₖ-0ₖ (suc n) (suc (suc m)) z (~ i))
l≡r : (z : EM G' (suc n)) → l north z ≡ r north z
l≡r z = sym (pathTypeMake _ _ (sym (⌣ₖ-0ₖ (suc n) (suc (suc m)) z)))
module RightDistributivity {G' : AbGroup ℓ} {H' : AbGroup ℓ'} where
private
G = fst G'
H = fst H'
strG = snd G'
strH = snd H'
0G = 0g strG
0H = 0g strH
_+G_ = _+Gr_ strG
_+H_ = _+Gr_ strH
-H_ = -Gr_ strH
-G_ = -Gr_ strG
distrr1 : (n m : ℕ) → EM G' n → EM G' n → EM∙ H' m →∙ EM∙ (G' ⨂ H') (n +' m)
fst (distrr1 n m x y) z = (x +ₖ y) ⌣ₖ z
snd (distrr1 n m x y) = ⌣ₖ-0ₖ n m _
distrr2 : (n m : ℕ) → EM G' n → EM G' n → EM∙ H' m →∙ EM∙ (G' ⨂ H') (n +' m)
fst (distrr2 n m x y) z = (x ⌣ₖ z) +ₖ (y ⌣ₖ z)
snd (distrr2 n m x y) = cong₂ _+ₖ_ (⌣ₖ-0ₖ n m x) (⌣ₖ-0ₖ n m y) ∙ rUnitₖ _ (0ₖ (n +' m))
mainDistrR : (n m : ℕ) (x y : EM G' (suc n))
→ distrr1 (suc n) (suc m) x y ≡ distrr2 (suc n) (suc m) x y
mainDistrR zero m =
wedgeConEM.fun G' G' 0 0
(λ _ _ → isOfHLevel↑∙ 1 m _ _)
(λ x → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt (l x)))
(λ x → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt (r x)))
λ i → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt λ z → l≡r z i)
where
l : (x : _) (z : _) → _ ≡ _
l x z =
(λ i → (lUnitₖ 1 x i) ⌣ₖ z)
∙∙ sym (lUnitₖ _ (x ⌣ₖ z))
∙∙ λ i → 0ₖ-⌣ₖ _ _ z (~ i) +ₖ (x ⌣ₖ z)
r : (x : _) (z : _) → _ ≡ _
r x z =
((λ i → (rUnitₖ 1 x i) ⌣ₖ z))
∙∙ sym (rUnitₖ _ _)
∙∙ λ i → (_⌣ₖ_ {n = 1} {m = suc m} x z) +ₖ 0ₖ-⌣ₖ (suc zero) (suc m) z (~ i)
l≡r : (z : _) → l embase z ≡ r embase z
l≡r z = pathTypeMake _ _ _
mainDistrR (suc n) m =
elim2 (λ _ _ → isOfHLevelPath (4 + n)
(isOfHLevel↑∙ (2 + n) m) _ _)
(wedgeConEM.fun _ _ _ _
(λ x y → isOfHLevelPath ((2 + n) + (2 + n))
(transport (λ i → isOfHLevel (((λ i → (+-comm n 2 (~ i) + (2 + n)))
∙ sym (+-assoc n 2 (2 + n))) (~ i))
(EM∙ H' (suc m) →∙ EM∙ ((fst (AbGroupPath (G' ⨂ H') (H' ⨂ G'))) ⨂-comm (~ i))
((+'-comm (suc m) (suc (suc n))) i)))
(isOfHLevelPlus n
(LeftDistributivity.hLevLem m (suc (suc n))))) _ _)
(λ x → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt (l x)))
(λ x → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt (r x)))
λ i → →∙Homogeneous≡ (isHomogeneousEM _)
(funExt λ z → r≡l z i))
where
l : (x : _) (z : _) → _ ≡ _
l x z = (λ i → (lUnitₖ _ ∣ x ∣ i) ⌣ₖ z)
∙∙ sym (lUnitₖ _ (∣ x ∣ ⌣ₖ z))
∙∙ λ i → 0ₖ-⌣ₖ _ _ z (~ i) +ₖ (∣ x ∣ ⌣ₖ z)
r : (x : _) (z : _) → _ ≡ _
r x z = (λ i → (rUnitₖ _ ∣ x ∣ i) ⌣ₖ z)
∙∙ sym (rUnitₖ _ (∣ x ∣ ⌣ₖ z))
∙∙ λ i → (∣ x ∣ ⌣ₖ z) +ₖ 0ₖ-⌣ₖ _ _ z (~ i)
r≡l : (z : _) → l north z ≡ r north z
r≡l z = pathTypeMake _ _ _
-- TODO: Summarise distributivity proofs
-- TODO: Associativity and graded commutativity, following Cubical.ZCohomology.RingStructure
-- The following lemmas will be needed to make the types match up.
|
Base/Change/Products.agda | inc-lc/ilc-agda | 10 | 15458 | <reponame>inc-lc/ilc-agda
module Base.Change.Products where
open import Relation.Binary.PropositionalEquality
open import Level
open import Base.Change.Algebra
open import Base.Change.Equivalence
open import Base.Change.Equivalence.Realizers
-- Also try defining sectioned change structures on the positives halves of
-- groups? Or on arbitrary subsets?
-- Restriction: we pair sets on the same level (because right now everything
-- else would risk getting in the way).
module ProductChanges ℓ {A B : Set ℓ} {{CA : ChangeAlgebra A}} {{CB : ChangeAlgebra B}} where
-- Avoid having to specify A and B all the time; they'd often be ambiguous
-- otherwise.
import Data.Product as DP
open DP.Σ {A = A} {B = λ _ → B}
open DP using (_×_; _,_)
-- The simplest possible definition of changes for products.
PChange : A × B → Set ℓ
PChange (a , b) = Δ a × Δ b
-- An interesting alternative definition allows omitting the nil change of a
-- component when that nil change can be computed from the type. For instance, the nil change for integers is always the same.
-- However, the nil change for function isn't always the same (unless we
-- defunctionalize them first), so nil changes for functions can't be omitted.
_⊕_ : (v : A × B) → PChange v → A × B
_⊕_ (a , b) (da , db) = a ⊞ da , b ⊞ db
_⊝_ : A × B → (v : A × B) → PChange v
_⊝_ (aNew , bNew) (a , b) = aNew ⊟ a , bNew ⊟ b
p-nil : (v : A × B) → PChange v
p-nil (a , b) = (nil a , nil b)
p-update-diff : (u v : A × B) → v ⊕ (u ⊝ v) ≡ u
p-update-diff (ua , ub) (va , vb) =
let u = (ua , ub)
v = (va , vb)
in
begin
v ⊕ (u ⊝ v)
≡⟨⟩
(va ⊞ (ua ⊟ va) , vb ⊞ (ub ⊟ vb))
--v ⊕ ((ua ⊟ va , ub ⊟ vb))
≡⟨ cong₂ _,_ (update-diff ua va) (update-diff ub vb)⟩
(ua , ub)
≡⟨⟩
u
∎
where
open ≡-Reasoning
p-update-nil : (v : A × B) → v ⊕ (p-nil v) ≡ v
p-update-nil (a , b) =
let v = (a , b)
in
begin
v ⊕ (p-nil v)
≡⟨⟩
(a ⊞ nil a , b ⊞ nil b)
≡⟨ cong₂ _,_ (update-nil a) (update-nil b)⟩
(a , b)
≡⟨⟩
v
∎
where
open ≡-Reasoning
instance
changeAlgebraProducts : ChangeAlgebra (A × B)
changeAlgebraProducts = record
{ Change = PChange
; update = _⊕_
; diff = _⊝_
; nil = p-nil
; isChangeAlgebra = record
{ update-diff = p-update-diff
; update-nil = p-update-nil
}
}
--
-- Derivatives of introductions and elimination forms for products.
--
-- For each one define a naive derivative using nil, write a hand-optimized *realizer* for an efficient derivative, and prove they're equivalent.
--
proj₁′ : Δ proj₁
proj₁′ = nil proj₁
proj₁′-realizer : (v : A × B) → Δ v → Δ (proj₁ v)
proj₁′-realizer (a , b) (da , db) = da
proj₁′-realizer-correct : ∀ (p : A × B) (dp : Δ p) → apply proj₁′ p dp ≙₍ proj₁ p ₎ proj₁′-realizer p dp
proj₁′-realizer-correct (a , b) (da , db) = diff-update {x = a} {dx = da}
proj₁′Derivative : IsDerivative proj₁ proj₁′-realizer
-- Implementation note: we do not need to pattern match on v and dv because
-- they are records, hence Agda knows that pattern matching on records cannot
-- fail. Technically, the required feature is the eta-rule on records.
proj₁′Derivative v dv = refl
-- An extended explanation.
proj₁′Derivative₁ : IsDerivative proj₁ proj₁′-realizer
proj₁′Derivative₁ (a , b) (da , db) =
let v = (a , b)
dv = (da , db)
in
begin
proj₁ v ⊞ proj₁′-realizer v dv
≡⟨⟩
a ⊞ da
≡⟨⟩
proj₁ (v ⊞ dv)
∎
where
open ≡-Reasoning
proj₁′-faster-w-proof : equiv-raw-change-to-change-ResType proj₁ proj₁′-realizer
proj₁′-faster-w-proof = equiv-raw-change-to-change proj₁ proj₁′ proj₁′-realizer proj₁′-realizer-correct
proj₁′-faster : Δ proj₁
proj₁′-faster = DP.proj₁ proj₁′-faster-w-proof
-- Same for the second extractor.
proj₂′-realizer : (v : A × B) → Δ v → Δ (proj₂ v)
proj₂′-realizer (a , b) (da , db) = db
proj₂′ : Δ proj₂
proj₂′ = nil proj₂
proj₂′-realizer-correct : ∀ p (dp : Δ p) → apply proj₂′ p dp ≙₍ proj₂ p ₎ proj₂′-realizer p dp
proj₂′-realizer-correct (a , b) (da , db) = diff-update
proj₂′Derivative : IsDerivative proj₂ proj₂′-realizer
proj₂′Derivative v dv = refl
proj₂′-faster-w-proof : equiv-raw-change-to-change-ResType proj₂ proj₂′-realizer
proj₂′-faster-w-proof = equiv-raw-change-to-change proj₂ proj₂′ proj₂′-realizer proj₂′-realizer-correct
proj₂′-faster : Δ proj₂
proj₂′-faster = DP.proj₁ proj₂′-faster-w-proof
-- Morally, the following is a change:
-- What one could wrongly expect to be the derivative of the constructor:
_,_′-realizer : (a : A) → (da : Δ a) → (b : B) → (db : Δ b) → Δ (a , b)
_,_′-realizer a da b db = da , db
-- That has the correct behavior, in a sense, and it would be in the
-- subset-based formalization in the paper.
--
-- But the above is not even a change, because it does not contain a proof of
-- its own validity, and because after application it does not contain a
-- proof.
--
-- However, the above is (morally) a "realizer" of the actual change, since it
-- only represents its computational behavior, not its proof manipulation.
-- Hence, we need to do some additional work.
_,_′ : Δ (_,_ {A = A} {B = λ _ → B})
_,_′ = _,_ ⊟ _,_
_,_′-realizer-correct : ∀ a da b db → apply (apply _,_′ a da) b db ≙₍ a , b ₎ _,_′-realizer a da b db
_,_′-realizer-correct a da b db = doe (≙-cong₂ _,_ diff-update diff-update)
open import Data.Product using (Σ-syntax)
_,_′-faster-w-proof : equiv-raw-change-to-change-binary-ResType _,_ _,_′-realizer
_,_′-faster-w-proof = equiv-raw-change-to-change-binary _,_ _,_′ _,_′-realizer _,_′-realizer-correct
_,_′-faster : Δ (_,_ {A = A} {B = λ _ → B})
_,_′-faster = DP.proj₁ _,_′-faster-w-proof
-- Define specialized variant of uncurry, and derive it.
uncurry₀ : ∀ {C : Set ℓ} → (A → B → C) → A × B → C
uncurry₀ f (a , b) = f a b
module _ {C : Set ℓ} {{CC : ChangeAlgebra C}} where
uncurry₀′ : Δ uncurry₀
uncurry₀′ = nil (uncurry₀ {C = C})
uncurry₀′-realizer : (f : A → B → C) → Δ f → (p : A × B) → Δ p → Δ (uncurry₀ f p)
uncurry₀′-realizer f df (a , b) (da , db) = apply (apply df a da) b db
uncurry₀′-realizer-correct : ∀ f df p dp → apply (apply uncurry₀′ f df) p dp ≙₍ uncurry₀ f p ₎ uncurry₀′-realizer f df p dp
uncurry₀′-realizer-correct f df (a , b) (da , db) =
begin
(f ⊞ df) (a ⊞ da) (b ⊞ db) ⊟ f a b
≙⟨ equiv-cancel-2 _ _ (incrementalization-binary f df a da b db) ⟩
apply (apply df a da) b db
∎
where
open ≙-Reasoning
open BinaryFunctionChanges A B C
uncurry₀′-faster-w-proof : equiv-raw-change-to-change-binary-ResType uncurry₀ uncurry₀′-realizer
uncurry₀′-faster-w-proof = equiv-raw-change-to-change-binary uncurry₀ uncurry₀′ uncurry₀′-realizer uncurry₀′-realizer-correct
uncurry₀′-faster : Δ uncurry₀
uncurry₀′-faster = DP.proj₁ uncurry₀′-faster-w-proof
|
book-01/Assembly/asm/avx/packed/avx_p_array_sqrt_float.asm | gfurtadoalmeida/study-assembly-x64 | 2 | 163473 | <gh_stars>1-10
.code
; AVX_Packed_Array_Sqtr_Float_(float* input, int arrayLength, const float* output)
AVX_Packed_Array_Sqtr_Float_ proc
xor rax, rax ; Our counter for the loop
test rdx, rdx ; Exit if array length is zero
jz Done
; If (rcx & 0f) != 0 then exit
; because the address is not 16 byte
; aligned.
test rcx, 0fh
jnz Done
test r8, 0fh
jnz Done
; Calculate the square roots as a batch (packed instructions)
cmp rdx, 4
jb OneByOne ; We need >= 4 items to process as a batch, otherwise one by one.
@@:
vsqrtps xmm0, xmmword ptr [rcx+rax] ; Calculate 4 square roots
vmovaps xmmword ptr [r8+rax], xmm0 ; Save the 4 result to destination
add rax, type xmmword ; Advance to the next 4 items (16 bytes)
sub rdx, 4
cmp rdx, 4
jae @B
; Calculate the square roots for the last items (<=3 => scalar instructions)
OneByOne:
test rdx, rdx
jz Done
vsqrtss xmm0, xmm0, real4 ptr [rcx+rax] ; Calculate one square roots
vmovss real4 ptr [r8+rax], xmm0 ; Save the single result to destination
add rax, type real4 ; Advance to the next item (4 bytes)
dec rdx
jnz OneByOne
Done:
ret
AVX_Packed_Array_Sqtr_Float_ endp
end |
arch/ARM/NXP/svd/lpc55s6x/nxp_svd-pmc.ads | morbos/Ada_Drivers_Library | 2 | 20832 | -- Copyright 2016-2019 NXP
-- All rights reserved.SPDX-License-Identifier: BSD-3-Clause
-- This spec has been automatically generated from LPC55S6x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NXP_SVD.PMC is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Wake-up from DEEP POWER DOWN reset event (either from wake up I/O or RTC
-- or OS Event Timer).
type RESETCTRL_DPDWAKEUPRESETENABLE_Field is
(
-- Reset event from DEEP POWER DOWN mode is disable.
Disable,
-- Reset event from DEEP POWER DOWN mode is enable.
Enable)
with Size => 1;
for RESETCTRL_DPDWAKEUPRESETENABLE_Field use
(Disable => 0,
Enable => 1);
-- BOD VBAT reset enable.
type RESETCTRL_BODVBATRESETENABLE_Field is
(
-- BOD VBAT reset is disable.
Disable,
-- BOD VBAT reset is enable.
Enable)
with Size => 1;
for RESETCTRL_BODVBATRESETENABLE_Field use
(Disable => 0,
Enable => 1);
-- Software reset enable.
type RESETCTRL_SWRRESETENABLE_Field is
(
-- Software reset is disable.
Disable,
-- Software reset is enable.
Enable)
with Size => 1;
for RESETCTRL_SWRRESETENABLE_Field use
(Disable => 0,
Enable => 1);
-- Reset Control [Reset by: PoR, Pin Reset, Brown Out Detectors Reset, Deep
-- Power Down Reset, Software Reset]
type RESETCTRL_Register is record
-- Wake-up from DEEP POWER DOWN reset event (either from wake up I/O or
-- RTC or OS Event Timer).
DPDWAKEUPRESETENABLE : RESETCTRL_DPDWAKEUPRESETENABLE_Field :=
NXP_SVD.PMC.Disable;
-- BOD VBAT reset enable.
BODVBATRESETENABLE : RESETCTRL_BODVBATRESETENABLE_Field :=
NXP_SVD.PMC.Disable;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Software reset enable.
SWRRESETENABLE : RESETCTRL_SWRRESETENABLE_Field :=
NXP_SVD.PMC.Disable;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RESETCTRL_Register use record
DPDWAKEUPRESETENABLE at 0 range 0 .. 0;
BODVBATRESETENABLE at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
SWRRESETENABLE at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- BoD trigger level.
type BODVBAT_TRIGLVL_Field is
(
-- 1.00 V.
V_1P00,
-- 1.10 V.
V_1P10,
-- 1.20 V.
V_1P20,
-- 1.30 V.
V_1P30,
-- 1.40 V.
V_1P40,
-- 1.50 V.
V_1P50,
-- 1.60 V.
V_1P60,
-- 1.65 V.
V_1P65,
-- 1.70 V.
V_1P70,
-- 1.75 V.
V_1P75,
-- 1.80 V.
V_1P80,
-- 1.90 V.
V_1P90,
-- 2.00 V.
V_2P00,
-- 2.10 V.
V_2P10,
-- 2.20 V.
V_2P20,
-- 2.30 V.
V_2P30,
-- 2.40 V.
V_2P40,
-- 2.50 V.
V_2P50,
-- 2.60 V.
V_2P60,
-- 2.70 V.
V_2P70,
-- 2.806 V.
V_2P80,
-- 2.90 V.
V_2P90,
-- 3.00 V.
V_3P00,
-- 3.10 V.
V_3P10,
-- 3.20 V.
V_3P20,
-- 3.30 V.
V_3P30_2,
-- 3.30 V.
V_3P30_3,
-- 3.30 V.
V_3P30_4,
-- 3.30 V.
V_3P30_5,
-- 3.30 V.
V_3P30_6,
-- 3.30 V.
V_3P30_7,
-- 3.30 V.
V_3P30_8)
with Size => 5;
for BODVBAT_TRIGLVL_Field use
(V_1P00 => 0,
V_1P10 => 1,
V_1P20 => 2,
V_1P30 => 3,
V_1P40 => 4,
V_1P50 => 5,
V_1P60 => 6,
V_1P65 => 7,
V_1P70 => 8,
V_1P75 => 9,
V_1P80 => 10,
V_1P90 => 11,
V_2P00 => 12,
V_2P10 => 13,
V_2P20 => 14,
V_2P30 => 15,
V_2P40 => 16,
V_2P50 => 17,
V_2P60 => 18,
V_2P70 => 19,
V_2P80 => 20,
V_2P90 => 21,
V_3P00 => 22,
V_3P10 => 23,
V_3P20 => 24,
V_3P30_2 => 25,
V_3P30_3 => 26,
V_3P30_4 => 27,
V_3P30_5 => 28,
V_3P30_6 => 29,
V_3P30_7 => 30,
V_3P30_8 => 31);
-- BoD Hysteresis control.
type BODVBAT_HYST_Field is
(
-- 25 mV.
Hyst_25Mv,
-- 50 mV.
Hyst_50Mv,
-- 75 mV.
Hyst_75Mv,
-- 100 mV.
Hyst_100Mv)
with Size => 2;
for BODVBAT_HYST_Field use
(Hyst_25Mv => 0,
Hyst_50Mv => 1,
Hyst_75Mv => 2,
Hyst_100Mv => 3);
-- VBAT Brown Out Dectector (BoD) control register [Reset by: PoR, Pin
-- Reset, Software Reset]
type BODVBAT_Register is record
-- BoD trigger level.
TRIGLVL : BODVBAT_TRIGLVL_Field := NXP_SVD.PMC.V_1P65;
-- BoD Hysteresis control.
HYST : BODVBAT_HYST_Field := NXP_SVD.PMC.Hyst_75Mv;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BODVBAT_Register use record
TRIGLVL at 0 range 0 .. 4;
HYST at 0 range 5 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- Hysteris when hyst = '1'.
type COMP_HYST_Field is
(
-- Hysteresis is disable.
Disable,
-- Hysteresis is enable.
Enable)
with Size => 1;
for COMP_HYST_Field use
(Disable => 0,
Enable => 1);
-- Dedicated control bit to select between internal VREF and VDDA (for the
-- resistive ladder).
type COMP_VREFINPUT_Field is
(
-- Select internal VREF.
Internalref,
-- Select VDDA.
Vdda)
with Size => 1;
for COMP_VREFINPUT_Field use
(Internalref => 0,
Vdda => 1);
-- Low power mode.
type COMP_LOWPOWER_Field is
(
-- High speed mode.
Highspeed,
-- Low power mode (Low speed).
Lowspeed)
with Size => 1;
for COMP_LOWPOWER_Field use
(Highspeed => 0,
Lowspeed => 1);
-- Control word for P multiplexer:.
type COMP_PMUX_Field is
(
-- VREF (See fiedl VREFINPUT).
Vref,
-- Pin P0_0.
Cmp0_A,
-- Pin P0_9.
Cmp0_B,
-- Pin P0_18.
Cmp0_C,
-- Pin P1_14.
Cmp0_D,
-- Pin P2_23.
Cmp0_E)
with Size => 3;
for COMP_PMUX_Field use
(Vref => 0,
Cmp0_A => 1,
Cmp0_B => 2,
Cmp0_C => 3,
Cmp0_D => 4,
Cmp0_E => 5);
-- Control word for N multiplexer:.
type COMP_NMUX_Field is
(
-- VREF (See field VREFINPUT).
Vref,
-- Pin P0_0.
Cmp0_A,
-- Pin P0_9.
Cmp0_B,
-- Pin P0_18.
Cmp0_C,
-- Pin P1_14.
Cmp0_D,
-- Pin P2_23.
Cmp0_E)
with Size => 3;
for COMP_NMUX_Field use
(Vref => 0,
Cmp0_A => 1,
Cmp0_B => 2,
Cmp0_C => 3,
Cmp0_D => 4,
Cmp0_E => 5);
subtype COMP_VREF_Field is HAL.UInt5;
subtype COMP_FILTERCGF_SAMPLEMODE_Field is HAL.UInt2;
subtype COMP_FILTERCGF_CLKDIV_Field is HAL.UInt3;
-- Analog Comparator control register [Reset by: PoR, Pin Reset, Brown Out
-- Detectors Reset, Deep Power Down Reset, Software Reset]
type COMP_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Hysteris when hyst = '1'.
HYST : COMP_HYST_Field := NXP_SVD.PMC.Enable;
-- Dedicated control bit to select between internal VREF and VDDA (for
-- the resistive ladder).
VREFINPUT : COMP_VREFINPUT_Field := NXP_SVD.PMC.Internalref;
-- Low power mode.
LOWPOWER : COMP_LOWPOWER_Field := NXP_SVD.PMC.Lowspeed;
-- Control word for P multiplexer:.
PMUX : COMP_PMUX_Field := NXP_SVD.PMC.Vref;
-- Control word for N multiplexer:.
NMUX : COMP_NMUX_Field := NXP_SVD.PMC.Vref;
-- Control reference voltage step, per steps of (VREFINPUT/31).
VREF : COMP_VREF_Field := 16#0#;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- Filter Sample mode.
FILTERCGF_SAMPLEMODE : COMP_FILTERCGF_SAMPLEMODE_Field := 16#0#;
-- Filter Clock div .
FILTERCGF_CLKDIV : COMP_FILTERCGF_CLKDIV_Field := 16#0#;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for COMP_Register use record
Reserved_0_0 at 0 range 0 .. 0;
HYST at 0 range 1 .. 1;
VREFINPUT at 0 range 2 .. 2;
LOWPOWER at 0 range 3 .. 3;
PMUX at 0 range 4 .. 6;
NMUX at 0 range 7 .. 9;
VREF at 0 range 10 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
FILTERCGF_SAMPLEMODE at 0 range 16 .. 17;
FILTERCGF_CLKDIV at 0 range 18 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
-- Allows to identify Wake up I/O 0 as the wake-up source from Deep Power
-- Down mode.
type WAKEIOCAUSE_WAKEUP0_Field is
(
-- Last wake up from Deep Power down mode was NOT triggred by wake up
-- I/O 0.
Noevent,
-- Last wake up from Deep Power down mode was triggred by wake up I/O 0.
Event)
with Size => 1;
for WAKEIOCAUSE_WAKEUP0_Field use
(Noevent => 0,
Event => 1);
-- Allows to identify Wake up I/O 1 as the wake-up source from Deep Power
-- Down mode.
type WAKEIOCAUSE_WAKEUP1_Field is
(
-- Last wake up from Deep Power down mode was NOT triggred by wake up
-- I/O 1.
Noevent,
-- Last wake up from Deep Power down mode was triggred by wake up I/O 1.
Event)
with Size => 1;
for WAKEIOCAUSE_WAKEUP1_Field use
(Noevent => 0,
Event => 1);
-- Allows to identify Wake up I/O 2 as the wake-up source from Deep Power
-- Down mode.
type WAKEIOCAUSE_WAKEUP2_Field is
(
-- Last wake up from Deep Power down mode was NOT triggred by wake up
-- I/O 2.
Noevent,
-- Last wake up from Deep Power down mode was triggred by wake up I/O 2.
Event)
with Size => 1;
for WAKEIOCAUSE_WAKEUP2_Field use
(Noevent => 0,
Event => 1);
-- Allows to identify Wake up I/O 3 as the wake-up source from Deep Power
-- Down mode.
type WAKEIOCAUSE_WAKEUP3_Field is
(
-- Last wake up from Deep Power down mode was NOT triggred by wake up
-- I/O 3.
Noevent,
-- Last wake up from Deep Power down mode was triggred by wake up I/O 3.
Event)
with Size => 1;
for WAKEIOCAUSE_WAKEUP3_Field use
(Noevent => 0,
Event => 1);
-- Allows to identify the Wake-up I/O source from Deep Power Down mode
type WAKEIOCAUSE_Register is record
-- Read-only. Allows to identify Wake up I/O 0 as the wake-up source
-- from Deep Power Down mode.
WAKEUP0 : WAKEIOCAUSE_WAKEUP0_Field := NXP_SVD.PMC.Noevent;
-- Allows to identify Wake up I/O 1 as the wake-up source from Deep
-- Power Down mode.
WAKEUP1 : WAKEIOCAUSE_WAKEUP1_Field := NXP_SVD.PMC.Noevent;
-- Allows to identify Wake up I/O 2 as the wake-up source from Deep
-- Power Down mode.
WAKEUP2 : WAKEIOCAUSE_WAKEUP2_Field := NXP_SVD.PMC.Noevent;
-- Allows to identify Wake up I/O 3 as the wake-up source from Deep
-- Power Down mode.
WAKEUP3 : WAKEIOCAUSE_WAKEUP3_Field := NXP_SVD.PMC.Noevent;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for WAKEIOCAUSE_Register use record
WAKEUP0 at 0 range 0 .. 0;
WAKEUP1 at 0 range 1 .. 1;
WAKEUP2 at 0 range 2 .. 2;
WAKEUP3 at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- XTAL32 KHZ oscillator oscillation failure detection indicator.
type STATUSCLK_XTAL32KOSCFAILURE_Field is
(
-- No oscillation failure has been detetced since the last time this bit
-- has been cleared..
Nofail,
-- At least one oscillation failure has been detetced since the last
-- time this bit has been cleared..
Failure)
with Size => 1;
for STATUSCLK_XTAL32KOSCFAILURE_Field use
(Nofail => 0,
Failure => 1);
-- FRO and XTAL status register [Reset by: PoR, Brown Out Detectors Reset]
type STATUSCLK_Register is record
-- Read-only. XTAL oscillator 32 K OK signal.
XTAL32KOK : Boolean := False;
-- unspecified
Reserved_1_1 : HAL.Bit := 16#1#;
-- XTAL32 KHZ oscillator oscillation failure detection indicator.
XTAL32KOSCFAILURE : STATUSCLK_XTAL32KOSCFAILURE_Field :=
NXP_SVD.PMC.Failure;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for STATUSCLK_Register use record
XTAL32KOK at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
XTAL32KOSCFAILURE at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype AOREG1_BOOTERRORCOUNTER_Field is HAL.UInt4;
-- General purpose always on domain data storage [Reset by: PoR, Brown Out
-- Detectors Reset]
type AOREG1_Register is record
-- unspecified
Reserved_0_3 : HAL.UInt4 := 16#0#;
-- The last chip reset was caused by a Power On Reset.
POR : Boolean := False;
-- The last chip reset was caused by a Pin Reset.
PADRESET : Boolean := False;
-- The last chip reset was caused by a Brown Out Detector (BoD), either
-- VBAT BoD or Core Logic BoD.
BODRESET : Boolean := False;
-- The last chip reset was caused by a System Reset requested by the ARM
-- CPU.
SYSTEMRESET : Boolean := False;
-- The last chip reset was caused by the Watchdog Timer.
WDTRESET : Boolean := False;
-- The last chip reset was caused by a Software event.
SWRRESET : Boolean := False;
-- The last chip reset was caused by a Wake-up I/O reset event during a
-- Deep Power-Down mode.
DPDRESET_WAKEUPIO : Boolean := False;
-- The last chip reset was caused by an RTC (either RTC Alarm or RTC
-- wake up) reset event during a Deep Power-Down mode.
DPDRESET_RTC : Boolean := False;
-- The last chip reset was caused by an OS Event Timer reset event
-- during a Deep Power-Down mode.
DPDRESET_OSTIMER : Boolean := False;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- ROM Boot Fatal Error Counter.
BOOTERRORCOUNTER : AOREG1_BOOTERRORCOUNTER_Field := 16#0#;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AOREG1_Register use record
Reserved_0_3 at 0 range 0 .. 3;
POR at 0 range 4 .. 4;
PADRESET at 0 range 5 .. 5;
BODRESET at 0 range 6 .. 6;
SYSTEMRESET at 0 range 7 .. 7;
WDTRESET at 0 range 8 .. 8;
SWRRESET at 0 range 9 .. 9;
DPDRESET_WAKEUPIO at 0 range 10 .. 10;
DPDRESET_RTC at 0 range 11 .. 11;
DPDRESET_OSTIMER at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
BOOTERRORCOUNTER at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Select the 32K oscillator to be used in Deep Power Down Mode for the RTC
-- (either XTAL32KHz or FRO32KHz) .
type RTCOSC32K_SEL_Field is
(
-- FRO 32 KHz.
Fro32K,
-- XTAL 32KHz.
Xtal32K)
with Size => 1;
for RTCOSC32K_SEL_Field use
(Fro32K => 0,
Xtal32K => 1);
subtype RTCOSC32K_CLK1KHZDIV_Field is HAL.UInt3;
subtype RTCOSC32K_CLK1HZDIV_Field is HAL.UInt11;
-- RTC 1 KHZ and 1 Hz clocks source control register [Reset by: PoR, Brown
-- Out Detectors Reset]
type RTCOSC32K_Register is record
-- Select the 32K oscillator to be used in Deep Power Down Mode for the
-- RTC (either XTAL32KHz or FRO32KHz) .
SEL : RTCOSC32K_SEL_Field := NXP_SVD.PMC.Fro32K;
-- Actual division ratio is : 28 + CLK1KHZDIV.
CLK1KHZDIV : RTCOSC32K_CLK1KHZDIV_Field := 16#4#;
-- unspecified
Reserved_4_14 : HAL.UInt11 := 16#0#;
-- RTC 1KHz clock Divider status flag.
CLK1KHZDIVUPDATEREQ : Boolean := False;
-- Actual division ratio is : 31744 + CLK1HZDIV.
CLK1HZDIV : RTCOSC32K_CLK1HZDIV_Field := 16#3FF#;
-- unspecified
Reserved_27_29 : HAL.UInt3 := 16#0#;
-- Halts the divider counter.
CLK1HZDIVHALT : Boolean := False;
-- RTC 1Hz Divider status flag.
CLK1HZDIVUPDATEREQ : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTCOSC32K_Register use record
SEL at 0 range 0 .. 0;
CLK1KHZDIV at 0 range 1 .. 3;
Reserved_4_14 at 0 range 4 .. 14;
CLK1KHZDIVUPDATEREQ at 0 range 15 .. 15;
CLK1HZDIV at 0 range 16 .. 26;
Reserved_27_29 at 0 range 27 .. 29;
CLK1HZDIVHALT at 0 range 30 .. 30;
CLK1HZDIVUPDATEREQ at 0 range 31 .. 31;
end record;
-- OS Timer control register [Reset by: PoR, Brown Out Detectors Reset]
type OSTIMER_Register is record
-- Active high reset.
SOFTRESET : Boolean := False;
-- Enable OSTIMER 32 KHz clock.
CLOCKENABLE : Boolean := False;
-- Wake up enable in Deep Power Down mode (To be used in Enable Deep
-- Power Down mode).
DPDWAKEUPENABLE : Boolean := False;
-- Oscilator 32KHz (either FRO32KHz or XTAL32KHz according to RTCOSC32K.
OSC32KPD : Boolean := True;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OSTIMER_Register use record
SOFTRESET at 0 range 0 .. 0;
CLOCKENABLE at 0 range 1 .. 1;
DPDWAKEUPENABLE at 0 range 2 .. 2;
OSC32KPD at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- Controls power to VBAT Brown Out Detector (BOD).
type PDRUNCFG0_PDEN_BODVBAT_Field is
(
-- BOD VBAT is powered.
Poweredon,
-- BOD VBAT is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_BODVBAT_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to the Free Running Oscillator (FRO) 32 KHz.
type PDRUNCFG0_PDEN_FRO32K_Field is
(
-- FRO32KHz is powered.
Poweredon,
-- FRO32KHz is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_FRO32K_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to crystal 32 KHz.
type PDRUNCFG0_PDEN_XTAL32K_Field is
(
-- Crystal 32KHz is powered.
Poweredon,
-- Crystal 32KHz is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_XTAL32K_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to crystal 32 MHz.
type PDRUNCFG0_PDEN_XTAL32M_Field is
(
-- Crystal 32MHz is powered.
Poweredon,
-- Crystal 32MHz is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_XTAL32M_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to System PLL (also refered as PLL0).
type PDRUNCFG0_PDEN_PLL0_Field is
(
-- PLL0 is powered.
Poweredon,
-- PLL0 is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_PLL0_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to USB PLL (also refered as PLL1).
type PDRUNCFG0_PDEN_PLL1_Field is
(
-- PLL1 is powered.
Poweredon,
-- PLL1 is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_PLL1_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to USB Full Speed phy.
type PDRUNCFG0_PDEN_USBFSPHY_Field is
(
-- USB Full Speed phy is powered.
Poweredon,
-- USB Full Speed phy is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_USBFSPHY_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to USB High Speed Phy.
type PDRUNCFG0_PDEN_USBHSPHY_Field is
(
-- USB HS phy is powered.
Poweredon,
-- USB HS phy is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_USBHSPHY_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to Analog Comparator.
type PDRUNCFG0_PDEN_COMP_Field is
(
-- Analog Comparator is powered.
Poweredon,
-- Analog Comparator is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_COMP_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to USB high speed LDO.
type PDRUNCFG0_PDEN_LDOUSBHS_Field is
(
-- USB high speed LDO is powered.
Poweredon,
-- USB high speed LDO is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_LDOUSBHS_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to auxiliary biasing (AUXBIAS)
type PDRUNCFG0_PDEN_AUXBIAS_Field is
(
-- auxiliary biasing is powered.
Poweredon,
-- auxiliary biasing is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_AUXBIAS_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to crystal 32 MHz LDO.
type PDRUNCFG0_PDEN_LDOXO32M_Field is
(
-- crystal 32 MHz LDO is powered.
Poweredon,
-- crystal 32 MHz LDO is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_LDOXO32M_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to all True Random Number Genetaor (TRNG) clock sources.
type PDRUNCFG0_PDEN_RNG_Field is
(
-- TRNG clocks are powered.
Poweredon,
-- TRNG clocks are powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_RNG_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls power to System PLL (PLL0) Spread Spectrum module.
type PDRUNCFG0_PDEN_PLL0_SSCG_Field is
(
-- PLL0 Sread spectrum module is powered.
Poweredon,
-- PLL0 Sread spectrum module is powered down.
Poweredoff)
with Size => 1;
for PDRUNCFG0_PDEN_PLL0_SSCG_Field use
(Poweredon => 0,
Poweredoff => 1);
-- Controls the power to various analog blocks [Reset by: PoR, Pin Reset,
-- Brown Out Detectors Reset, Deep Power Down Reset, Software Reset]
type PDRUNCFG0_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#4#;
-- Controls power to VBAT Brown Out Detector (BOD).
PDEN_BODVBAT : PDRUNCFG0_PDEN_BODVBAT_Field := NXP_SVD.PMC.Poweredon;
-- unspecified
Reserved_4_5 : HAL.UInt2 := 16#0#;
-- Controls power to the Free Running Oscillator (FRO) 32 KHz.
PDEN_FRO32K : PDRUNCFG0_PDEN_FRO32K_Field := NXP_SVD.PMC.Poweredoff;
-- Controls power to crystal 32 KHz.
PDEN_XTAL32K : PDRUNCFG0_PDEN_XTAL32K_Field := NXP_SVD.PMC.Poweredoff;
-- Controls power to crystal 32 MHz.
PDEN_XTAL32M : PDRUNCFG0_PDEN_XTAL32M_Field := NXP_SVD.PMC.Poweredoff;
-- Controls power to System PLL (also refered as PLL0).
PDEN_PLL0 : PDRUNCFG0_PDEN_PLL0_Field := NXP_SVD.PMC.Poweredoff;
-- Controls power to USB PLL (also refered as PLL1).
PDEN_PLL1 : PDRUNCFG0_PDEN_PLL1_Field := NXP_SVD.PMC.Poweredoff;
-- Controls power to USB Full Speed phy.
PDEN_USBFSPHY : PDRUNCFG0_PDEN_USBFSPHY_Field :=
NXP_SVD.PMC.Poweredoff;
-- Controls power to USB High Speed Phy.
PDEN_USBHSPHY : PDRUNCFG0_PDEN_USBHSPHY_Field :=
NXP_SVD.PMC.Poweredoff;
-- Controls power to Analog Comparator.
PDEN_COMP : PDRUNCFG0_PDEN_COMP_Field := NXP_SVD.PMC.Poweredoff;
-- unspecified
Reserved_14_17 : HAL.UInt4 := 16#B#;
-- Controls power to USB high speed LDO.
PDEN_LDOUSBHS : PDRUNCFG0_PDEN_LDOUSBHS_Field :=
NXP_SVD.PMC.Poweredoff;
-- Controls power to auxiliary biasing (AUXBIAS)
PDEN_AUXBIAS : PDRUNCFG0_PDEN_AUXBIAS_Field := NXP_SVD.PMC.Poweredoff;
-- Controls power to crystal 32 MHz LDO.
PDEN_LDOXO32M : PDRUNCFG0_PDEN_LDOXO32M_Field :=
NXP_SVD.PMC.Poweredoff;
-- unspecified
Reserved_21_21 : HAL.Bit := 16#0#;
-- Controls power to all True Random Number Genetaor (TRNG) clock
-- sources.
PDEN_RNG : PDRUNCFG0_PDEN_RNG_Field := NXP_SVD.PMC.Poweredoff;
-- Controls power to System PLL (PLL0) Spread Spectrum module.
PDEN_PLL0_SSCG : PDRUNCFG0_PDEN_PLL0_SSCG_Field :=
NXP_SVD.PMC.Poweredoff;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PDRUNCFG0_Register use record
Reserved_0_2 at 0 range 0 .. 2;
PDEN_BODVBAT at 0 range 3 .. 3;
Reserved_4_5 at 0 range 4 .. 5;
PDEN_FRO32K at 0 range 6 .. 6;
PDEN_XTAL32K at 0 range 7 .. 7;
PDEN_XTAL32M at 0 range 8 .. 8;
PDEN_PLL0 at 0 range 9 .. 9;
PDEN_PLL1 at 0 range 10 .. 10;
PDEN_USBFSPHY at 0 range 11 .. 11;
PDEN_USBHSPHY at 0 range 12 .. 12;
PDEN_COMP at 0 range 13 .. 13;
Reserved_14_17 at 0 range 14 .. 17;
PDEN_LDOUSBHS at 0 range 18 .. 18;
PDEN_AUXBIAS at 0 range 19 .. 19;
PDEN_LDOXO32M at 0 range 20 .. 20;
Reserved_21_21 at 0 range 21 .. 21;
PDEN_RNG at 0 range 22 .. 22;
PDEN_PLL0_SSCG at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- PMC
type PMC_Peripheral is record
-- Reset Control [Reset by: PoR, Pin Reset, Brown Out Detectors Reset,
-- Deep Power Down Reset, Software Reset]
RESETCTRL : aliased RESETCTRL_Register;
-- VBAT Brown Out Dectector (BoD) control register [Reset by: PoR, Pin
-- Reset, Software Reset]
BODVBAT : aliased BODVBAT_Register;
-- Analog Comparator control register [Reset by: PoR, Pin Reset, Brown
-- Out Detectors Reset, Deep Power Down Reset, Software Reset]
COMP : aliased COMP_Register;
-- Allows to identify the Wake-up I/O source from Deep Power Down mode
WAKEIOCAUSE : aliased WAKEIOCAUSE_Register;
-- FRO and XTAL status register [Reset by: PoR, Brown Out Detectors
-- Reset]
STATUSCLK : aliased STATUSCLK_Register;
-- General purpose always on domain data storage [Reset by: PoR, Brown
-- Out Detectors Reset]
AOREG1 : aliased AOREG1_Register;
-- RTC 1 KHZ and 1 Hz clocks source control register [Reset by: PoR,
-- Brown Out Detectors Reset]
RTCOSC32K : aliased RTCOSC32K_Register;
-- OS Timer control register [Reset by: PoR, Brown Out Detectors Reset]
OSTIMER : aliased OSTIMER_Register;
-- Controls the power to various analog blocks [Reset by: PoR, Pin
-- Reset, Brown Out Detectors Reset, Deep Power Down Reset, Software
-- Reset]
PDRUNCFG0 : aliased PDRUNCFG0_Register;
-- Controls the power to various analog blocks [Reset by: PoR, Pin
-- Reset, Brown Out Detectors Reset, Deep Power Down Reset, Software
-- Reset]
PDRUNCFGSET0 : aliased HAL.UInt32;
-- Controls the power to various analog blocks [Reset by: PoR, Pin
-- Reset, Brown Out Detectors Reset, Deep Power Down Reset, Software
-- Reset]
PDRUNCFGCLR0 : aliased HAL.UInt32;
end record
with Volatile;
for PMC_Peripheral use record
RESETCTRL at 16#8# range 0 .. 31;
BODVBAT at 16#30# range 0 .. 31;
COMP at 16#50# range 0 .. 31;
WAKEIOCAUSE at 16#68# range 0 .. 31;
STATUSCLK at 16#74# range 0 .. 31;
AOREG1 at 16#84# range 0 .. 31;
RTCOSC32K at 16#98# range 0 .. 31;
OSTIMER at 16#9C# range 0 .. 31;
PDRUNCFG0 at 16#B8# range 0 .. 31;
PDRUNCFGSET0 at 16#C0# range 0 .. 31;
PDRUNCFGCLR0 at 16#C8# range 0 .. 31;
end record;
-- PMC
PMC_Periph : aliased PMC_Peripheral
with Import, Address => System'To_Address (16#40020000#);
end NXP_SVD.PMC;
|
Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 2314 | <gh_stars>1-10
with Ada.Text_Io;
procedure Max_Test isco
-- substitute any array type with a scalar element
type Flt_Array is array (Natural range <>) of Float;
-- Create an exception for the case of an empty array
Empty_Array : Exception;
function Max(Item : Flt_Array) return Float is
Max_Element : Float := Float'First;
begin
if Item'Length = 0 then
raise Empty_Array;
end if;
for I in Item'range loop
if Item(I) > Max_Element then
Max_Element := Item(I);
end if;
end loop;
return Max_Element;
end Max;
Buf : Flt_Array := (-275.0, -111.19, 0.0, -1234568.0, 3.14159, -3.14159);
begin
Ada.Text_IO.Put_Line(Float'Image(Max(Buf)));
end Max_Test;
|
Time & Date/part1.asm | TechZx/PICSimLab_examples_in_MicroC | 0 | 98084 | <reponame>TechZx/PICSimLab_examples_in_MicroC<gh_stars>0
; ASM code generated by mikroVirtualMachine for PIC - V. 8.0.0.0
; Date/Time: 18-Jun-20 11:26:38 PM
; Info: http://www.mikroe.com
; ADDRESS OPCODE ASM
; ----------------------------------------------
$0000 $EF6A F002 GOTO _main
$0008 $ _Delay_1us:
$0008 $0000 NOP
$000A $0000 NOP
$000C $0012 RETURN
$000E $ _Delay_5500us:
$000E $0E0F MOVLW 15
$0010 $6E0B MOVWF STACK_11, 0
$0012 $0EFF MOVLW 255
$0014 $6E0A MOVWF STACK_10, 0
$0016 $2E0B DECFSZ STACK_11, F, 0
$0018 $D001 BRA $+2
$001A $D003 BRA $+4
$001C $2E0A DECFSZ STACK_10, F, 0
$001E $D7FE BRA $-1
$0020 $D7FA BRA $-5
$0022 $0E3E MOVLW 62
$0024 $6E0A MOVWF STACK_10, 0
$0026 $2E0A DECFSZ STACK_10, F, 0
$0028 $D7FE BRA $-1
$002A $0000 NOP
$002C $0012 RETURN
$002E $ _Delay_50us:
$002E $0E21 MOVLW 33
$0030 $6E0A MOVWF STACK_10, 0
$0032 $2E0A DECFSZ STACK_10, F, 0
$0034 $D7FE BRA $-1
$0036 $0012 RETURN
$0038 $ SoftI2C_PutZerosToLAT:
$0038 $0E09 MOVLW 9
$003A $5C15 SUBWF ___porti2c, 0, 0
$003C $6EE1 MOVWF FSR1L, 0
$003E $0E0F MOVLW 15
$0040 $6EE2 MOVWF FSR1H, 0
$0042 $98E7 BCF INDF1, ____sdai2c, 0
$0044 $96E7 BCF INDF1, ____scli2c, 0
$0046 $0012 RETURN
$0048 $ _Lcd8_Cmd:
$0048 $C016 FFE9 MOVFF Lcd8bit_main_global_dataAddress, FSR0L
$004C $C017 FFEA MOVFF Lcd8bit_main_global_dataAddress+1, FSR0H
$0050 $C018 FFE1 MOVFF Lcd8bit_main_global_ctrlAddress, FSR1L
$0054 $C019 FFE2 MOVFF Lcd8bit_main_global_ctrlAddress+1, FSR1H
$0058 $6AEF CLRF INDF0, 0
$005A $5279 MOVF FARG_Lcd8_Cmd+0, 1, 0
$005C $E000 BZ L_Lcd8_Cmd_0
$005E $ L_Lcd8_Cmd_0:
$005E $BE79 BTFSC FARG_Lcd8_Cmd+0, 7, 0
$0060 $8EEF BSF INDF0, __LCD8_DB7, 0
$0062 $BC79 BTFSC FARG_Lcd8_Cmd+0, 6, 0
$0064 $8CEF BSF INDF0, __LCD8_DB6, 0
$0066 $BA79 BTFSC FARG_Lcd8_Cmd+0, 5, 0
$0068 $8AEF BSF INDF0, __LCD8_DB5, 0
$006A $B879 BTFSC FARG_Lcd8_Cmd+0, 4, 0
$006C $88EF BSF INDF0, __LCD8_DB4, 0
$006E $B679 BTFSC FARG_Lcd8_Cmd+0, 3, 0
$0070 $86EF BSF INDF0, __LCD8_DB3, 0
$0072 $B479 BTFSC FARG_Lcd8_Cmd+0, 2, 0
$0074 $84EF BSF INDF0, __LCD8_DB2, 0
$0076 $B279 BTFSC FARG_Lcd8_Cmd+0, 1, 0
$0078 $82EF BSF INDF0, __LCD8_DB1, 0
$007A $B079 BTFSC FARG_Lcd8_Cmd+0, 0, 0
$007C $80EF BSF INDF0, __LCD8_DB0, 0
$007E $501A MOVF Lcd8bit_main_global_cmd, 0, 0
$0080 $0A01 XORLW 1
$0082 $E103 BNZ L_Lcd8_Cmd_1
$0084 $94E7 BCF INDF1, __LCD8_RS, 0
$0086 $EF46 F000 GOTO L_Lcd8_Cmd_2
$008A $ L_Lcd8_Cmd_1:
$008A $84E7 BSF INDF1, __LCD8_RS, 0
$008C $ L_Lcd8_Cmd_2:
$008C $82E7 BSF INDF1, __LCD8_ENABLE, 0
$008E $EC04 F000 CALL _Delay_1us
$0092 $92E7 BCF INDF1, __LCD8_ENABLE, 0
$0094 $501A MOVF Lcd8bit_main_global_cmd, 0, 0
$0096 $0A01 XORLW 1
$0098 $E103 BNZ L_Lcd8_Cmd_3
$009A $EC07 F000 CALL _Delay_5500us
$009E $D002 BRA L_Lcd8_Cmd_4
$00A0 $ L_Lcd8_Cmd_3:
$00A0 $EC17 F000 CALL _Delay_50us
$00A4 $ L_Lcd8_Cmd_4:
$00A4 $0012 RETURN
$00A6 $ _read_keypad:
;part1.c,15 :: char read_keypad()
;part1.c,19 :: PORTD = 0xFF;
$00A6 $0EFF MOVLW 255
$00A8 $6E83 MOVWF PORTD, 0
;part1.c,20 :: TRISD = 0xFF; //configure PORT D as inpout
$00AA $0EFF MOVLW 255
$00AC $6E95 MOVWF TRISD, 0
;part1.c,22 :: TRISB = 0x00; //configure PORT B as outpout
$00AE $6A93 CLRF TRISB, 0
;part1.c,23 :: PORTB = 0xFF; //set all pins of PORT B to 1;
$00B0 $0EFF MOVLW 255
$00B2 $6E81 MOVWF PORTB, 0
;part1.c,25 :: key =0;
$00B4 $6A75 CLRF read_keypad_key_L0, 0
;part1.c,26 :: do { //1-5 buttons
$00B6 $ L_read_keypad_0:
;part1.c,28 :: PORTB.F0 = 0;
$00B6 $9081 BCF PORTB, 0, 0
;part1.c,29 :: delay_ms(10);
$00B8 $0E1A MOVLW 26
$00BA $6E0B MOVWF STACK_11, 0
$00BC $0EFF MOVLW 255
$00BE $6E0A MOVWF STACK_10, 0
$00C0 $2E0B DECFSZ STACK_11, F, 0
$00C2 $D001 BRA $+2
$00C4 $D003 BRA $+4
$00C6 $2E0A DECFSZ STACK_10, F, 0
$00C8 $D7FE BRA $-1
$00CA $D7FA BRA $-5
$00CC $0EE7 MOVLW 231
$00CE $6E0A MOVWF STACK_10, 0
$00D0 $2E0A DECFSZ STACK_10, F, 0
$00D2 $D7FE BRA $-1
$00D4 $0000 NOP
;part1.c,30 :: var = PORTD;
$00D6 $CF83 F074 MOVFF PORTD, read_keypad_var_L0
;part1.c,32 :: if (var.F2 == 0) key = '4';
$00DA $6A01 CLRF STACK_1, 0
$00DC $B474 BTFSC read_keypad_var_L0, 2, 0
$00DE $2A01 INCF STACK_1, 1, 0
$00E0 $5001 MOVF STACK_1, 0, 0
$00E2 $0A00 XORLW 0
$00E4 $E103 BNZ L_read_keypad_2
$00E6 $0E34 MOVLW 52
$00E8 $6E75 MOVWF read_keypad_key_L0, 0
$00EA $D008 BRA L_read_keypad_3
$00EC $ L_read_keypad_2:
;part1.c,33 :: else if (var.F3 == 0) key = '1';
$00EC $6A01 CLRF STACK_1, 0
$00EE $B674 BTFSC read_keypad_var_L0, 3, 0
$00F0 $2A01 INCF STACK_1, 1, 0
$00F2 $5001 MOVF STACK_1, 0, 0
$00F4 $0A00 XORLW 0
$00F6 $E102 BNZ L_read_keypad_4
$00F8 $0E31 MOVLW 49
$00FA $6E75 MOVWF read_keypad_key_L0, 0
$00FC $ L_read_keypad_4:
$00FC $ L_read_keypad_3:
;part1.c,34 :: PORTB.F0 =1;
$00FC $8081 BSF PORTB, 0, 0
;part1.c,37 :: PORTB.F1 = 0;
$00FE $9281 BCF PORTB, 1, 0
;part1.c,38 :: delay_ms(10);
$0100 $0E1A MOVLW 26
$0102 $6E0B MOVWF STACK_11, 0
$0104 $0EFF MOVLW 255
$0106 $6E0A MOVWF STACK_10, 0
$0108 $2E0B DECFSZ STACK_11, F, 0
$010A $D001 BRA $+2
$010C $D003 BRA $+4
$010E $2E0A DECFSZ STACK_10, F, 0
$0110 $D7FE BRA $-1
$0112 $D7FA BRA $-5
$0114 $0EE7 MOVLW 231
$0116 $6E0A MOVWF STACK_10, 0
$0118 $2E0A DECFSZ STACK_10, F, 0
$011A $D7FE BRA $-1
$011C $0000 NOP
;part1.c,39 :: var = PORTD;
$011E $CF83 F074 MOVFF PORTD, read_keypad_var_L0
;part1.c,41 :: if (var.F2 == 0)key = '5';
$0122 $6A01 CLRF STACK_1, 0
$0124 $B474 BTFSC read_keypad_var_L0, 2, 0
$0126 $2A01 INCF STACK_1, 1, 0
$0128 $5001 MOVF STACK_1, 0, 0
$012A $0A00 XORLW 0
$012C $E103 BNZ L_read_keypad_5
$012E $0E35 MOVLW 53
$0130 $6E75 MOVWF read_keypad_key_L0, 0
$0132 $D008 BRA L_read_keypad_6
$0134 $ L_read_keypad_5:
;part1.c,42 :: else if (var.F3 == 0)key = '2';
$0134 $6A01 CLRF STACK_1, 0
$0136 $B674 BTFSC read_keypad_var_L0, 3, 0
$0138 $2A01 INCF STACK_1, 1, 0
$013A $5001 MOVF STACK_1, 0, 0
$013C $0A00 XORLW 0
$013E $E102 BNZ L_read_keypad_7
$0140 $0E32 MOVLW 50
$0142 $6E75 MOVWF read_keypad_key_L0, 0
$0144 $ L_read_keypad_7:
$0144 $ L_read_keypad_6:
;part1.c,43 :: PORTB.F1 =1;
$0144 $8281 BSF PORTB, 1, 0
;part1.c,46 :: PORTB.F2 =0;
$0146 $9481 BCF PORTB, 2, 0
;part1.c,47 :: delay_ms(10);
$0148 $0E1A MOVLW 26
$014A $6E0B MOVWF STACK_11, 0
$014C $0EFF MOVLW 255
$014E $6E0A MOVWF STACK_10, 0
$0150 $2E0B DECFSZ STACK_11, F, 0
$0152 $D001 BRA $+2
$0154 $D003 BRA $+4
$0156 $2E0A DECFSZ STACK_10, F, 0
$0158 $D7FE BRA $-1
$015A $D7FA BRA $-5
$015C $0EE7 MOVLW 231
$015E $6E0A MOVWF STACK_10, 0
$0160 $2E0A DECFSZ STACK_10, F, 0
$0162 $D7FE BRA $-1
$0164 $0000 NOP
;part1.c,48 :: var = PORTD;
$0166 $CF83 F074 MOVFF PORTD, read_keypad_var_L0
;part1.c,50 :: if (var.F3 == 0) key = '3';
$016A $6A01 CLRF STACK_1, 0
$016C $B674 BTFSC read_keypad_var_L0, 3, 0
$016E $2A01 INCF STACK_1, 1, 0
$0170 $5001 MOVF STACK_1, 0, 0
$0172 $0A00 XORLW 0
$0174 $E102 BNZ L_read_keypad_8
$0176 $0E33 MOVLW 51
$0178 $6E75 MOVWF read_keypad_key_L0, 0
$017A $ L_read_keypad_8:
;part1.c,51 :: PORTB.F2 =1;
$017A $8481 BSF PORTB, 2, 0
;part1.c,52 :: }while (key == 0);
$017C $5075 MOVF read_keypad_key_L0, 0, 0
$017E $0A00 XORLW 0
$0180 $E09A BZ L_read_keypad_0
$0182 $ L_read_keypad_1:
;part1.c,54 :: return key;
$0182 $C075 F000 MOVFF read_keypad_key_L0, STACK_0
;part1.c,55 :: }
$0186 $0012 RETURN
$0188 $ _function_numbers:
;part1.c,57 :: unsigned char function_numbers(unsigned char v)
;part1.c,59 :: switch(v)
$0188 $D00F BRA L_function_numbers_9
;part1.c,61 :: case 1:
$018A $ L_function_numbers_11:
;part1.c,62 :: return 0x06;
$018A $0E06 MOVLW 6
$018C $6E00 MOVWF STACK_0, 0
$018E $0012 RETURN
;part1.c,63 :: case 2:
$0190 $ L_function_numbers_12:
;part1.c,64 :: return 0x5B;
$0190 $0E5B MOVLW 91
$0192 $6E00 MOVWF STACK_0, 0
$0194 $0012 RETURN
;part1.c,65 :: case 3:
$0196 $ L_function_numbers_13:
;part1.c,66 :: return 0x4F;
$0196 $0E4F MOVLW 79
$0198 $6E00 MOVWF STACK_0, 0
$019A $0012 RETURN
;part1.c,67 :: case 4:
$019C $ L_function_numbers_14:
;part1.c,68 :: return 0x66;
$019C $0E66 MOVLW 102
$019E $6E00 MOVWF STACK_0, 0
$01A0 $0012 RETURN
;part1.c,69 :: case 5:
$01A2 $ L_function_numbers_15:
;part1.c,70 :: return 0x6D;
$01A2 $0E6D MOVLW 109
$01A4 $6E00 MOVWF STACK_0, 0
$01A6 $0012 RETURN
;part1.c,72 :: }
$01A8 $ L_function_numbers_9:
$01A8 $5074 MOVF FARG_function_numbers+0, 0, 0
$01AA $0A01 XORLW 1
$01AC $E0EE BZ L_function_numbers_11
$01AE $5074 MOVF FARG_function_numbers+0, 0, 0
$01B0 $0A02 XORLW 2
$01B2 $E0EE BZ L_function_numbers_12
$01B4 $5074 MOVF FARG_function_numbers+0, 0, 0
$01B6 $0A03 XORLW 3
$01B8 $E0EE BZ L_function_numbers_13
$01BA $5074 MOVF FARG_function_numbers+0, 0, 0
$01BC $0A04 XORLW 4
$01BE $E0EE BZ L_function_numbers_14
$01C0 $5074 MOVF FARG_function_numbers+0, 0, 0
$01C2 $0A05 XORLW 5
$01C4 $E0EE BZ L_function_numbers_15
$01C6 $ L_function_numbers_10:
;part1.c,73 :: return 0;
$01C6 $6A00 CLRF STACK_0, 0
;part1.c,74 :: }
$01C8 $0012 RETURN
$01CA $ _Soft_I2C_Start:
$01CA $C015 FFE9 MOVFF ___porti2c, FSR0L
$01CE $0E0F MOVLW 15
$01D0 $6EEA MOVWF FSR0H, 0
$01D2 $88EF BSF INDF0, ____sdai2c, 0
$01D4 $EC04 F000 CALL _Delay_1us
$01D8 $86EF BSF INDF0, ____scli2c, 0
$01DA $EC04 F000 CALL _Delay_1us
$01DE $EC1C F000 CALL SoftI2C_PutZerosToLAT
$01E2 $98EF BCF INDF0, ____sdai2c, 0
$01E4 $EC04 F000 CALL _Delay_1us
$01E8 $EC1C F000 CALL SoftI2C_PutZerosToLAT
$01EC $96EF BCF INDF0, ____scli2c, 0
$01EE $0012 RETURN
$01F0 $ _Soft_I2C_Write:
$01F0 $0E01 MOVLW 1
$01F2 $6E76 MOVWF Soft_I2C_Write_result_L0, 0
$01F4 $0E08 MOVLW 8
$01F6 $6E75 MOVWF Soft_I2C_Write_temp_L0, 0
$01F8 $C015 FFE9 MOVFF ___porti2c, FSR0L
$01FC $0E0F MOVLW 15
$01FE $6EEA MOVWF FSR0H, 0
$0200 $ L_Soft_I2C_Write_4:
$0200 $5275 MOVF Soft_I2C_Write_temp_L0, 1, 0
$0202 $E022 BZ L_Soft_I2C_Write_5
$0204 $EC04 F000 CALL _Delay_1us
$0208 $EC04 F000 CALL _Delay_1us
$020C $EC1C F000 CALL SoftI2C_PutZerosToLAT
$0210 $96EF BCF INDF0, ____scli2c, 0
$0212 $EC04 F000 CALL _Delay_1us
$0216 $5274 MOVF FARG_Soft_I2C_Write+0, 1, 0
$0218 $E000 BZ L_Soft_I2C_Write_6
$021A $ L_Soft_I2C_Write_6:
$021A $EC1C F000 CALL SoftI2C_PutZerosToLAT
$021E $3674 RLCF FARG_soft_i2c_write+0, F, 0
$0220 $A0D8 BTFSS STATUS, 0, 0
$0222 $EF16 F001 GOTO l_018
$0226 $88EF BSF INDF0, ____sdai2c, 0
$0228 $EF17 F001 GOTO l_01C
$022C $ l_018:
$022C $98EF BCF INDF0, ____sdai2c, 0
$022E $ l_01C:
$022E $0000 NOP
$0230 $EC04 F000 CALL _Delay_1us
$0234 $86EF BSF INDF0, ____scli2c, 0
$0236 $0E12 MOVLW 18
$0238 $5EE9 SUBWF FSR0L, F, 0
$023A $A6EF BTFSS INDF0, ____scli2c, 0
$023C $EF1D F001 GOTO $-1
$0240 $0E12 MOVLW 18
$0242 $26E9 ADDWF FSR0L, F, 0
$0244 $0675 DECF Soft_I2C_Write_temp_L0, 1, 0
$0246 $D7DC BRA L_Soft_I2C_Write_4
$0248 $ L_Soft_I2C_Write_5:
$0248 $6A76 CLRF Soft_I2C_Write_result_L0, 0
$024A $EC04 F000 CALL _Delay_1us
$024E $EC1C F000 CALL SoftI2C_PutZerosToLAT
$0252 $0000 NOP
$0254 $96EF BCF INDF0, ____scli2c, 0
$0256 $EC04 F000 CALL _Delay_1us
$025A $88EF BSF INDF0, ____sdai2c, 0
$025C $EC04 F000 CALL _Delay_1us
$0260 $EC04 F000 CALL _Delay_1us
$0264 $5276 MOVF Soft_I2C_Write_result_L0, 1, 0
$0266 $E000 BZ L_Soft_I2C_Write_7
$0268 $ L_Soft_I2C_Write_7:
$0268 $86EF BSF INDF0, ____scli2c, 0
$026A $0E12 MOVLW 18
$026C $5EE9 SUBWF FSR0L, F, 0
$026E $A6EF BTFSS INDF0, ____scli2c, 0
$0270 $EF37 F001 GOTO $-1
$0274 $6A76 CLRF FLOC_soft_i2c_write+1, 0
$0276 $EC04 F000 CALL _Delay_1us
$027A $B8EF BTFSC INDF0, ____sdai2c, 0
$027C $8076 BSF FLOC_soft_i2c_write+1, 0, 0
$027E $EC04 F000 CALL _Delay_1us
$0282 $EC04 F000 CALL _Delay_1us
$0286 $EC04 F000 CALL _Delay_1us
$028A $EC04 F000 CALL _Delay_1us
$028E $EC04 F000 CALL _Delay_1us
$0292 $EC04 F000 CALL _Delay_1us
$0296 $EC04 F000 CALL _Delay_1us
$029A $EC04 F000 CALL _Delay_1us
$029E $EC1C F000 CALL SoftI2C_PutZerosToLAT
$02A2 $0E12 MOVLW 18
$02A4 $26E9 ADDWF FSR0L, F, 0
$02A6 $96EF BCF INDF0, ____scli2c, 0
$02A8 $98EF BCF INDF0, ____sdai2c, 0
$02AA $C076 F000 MOVFF Soft_I2C_Write_result_L0, STACK_0
$02AE $0012 RETURN
$02B0 $ _Soft_I2C_Read:
$02B0 $6A75 CLRF Soft_I2C_Read_result_L0, 0
$02B2 $0E08 MOVLW 8
$02B4 $6E76 MOVWF Soft_I2C_Read_temp_L0, 0
$02B6 $C015 FFE9 MOVFF ___porti2c, FSR0L
$02BA $0E0F MOVLW 15
$02BC $6EEA MOVWF FSR0H, 0
$02BE $ L_Soft_I2C_Read_0:
$02BE $5276 MOVF Soft_I2C_Read_temp_L0, 1, 0
$02C0 $E01C BZ L_Soft_I2C_Read_1
$02C2 $EC04 F000 CALL _Delay_1us
$02C6 $0000 NOP
$02C8 $88EF BSF INDF0, ____sdai2c, 0
$02CA $EC04 F000 CALL _Delay_1us
$02CE $5275 MOVF Soft_I2C_Read_result_L0, 1, 0
$02D0 $E000 BZ L_Soft_I2C_Read_2
$02D2 $ L_Soft_I2C_Read_2:
$02D2 $86EF BSF INDF0, ____scli2c, 0
$02D4 $0E12 MOVLW 18
$02D6 $5EE9 SUBWF FSR0L, F, 0
$02D8 $A6EF BTFSS INDF0, ____scli2c, 0
$02DA $EF6C F001 GOTO $-1
$02DE $B8EF BTFSC INDF0, ____sdai2c, 0
$02E0 $80D8 BSF STATUS, C, 0
$02E2 $A8EF BTFSS INDF0, ____sdai2c, 0
$02E4 $90D8 BCF STATUS, C, 0
$02E6 $3675 RLCF FLOC_soft_i2c_read+0, F, 0
$02E8 $EC04 F000 CALL _Delay_1us
$02EC $EC1C F000 CALL SoftI2C_PutZerosToLAT
$02F0 $0E12 MOVLW 18
$02F2 $26E9 ADDWF FSR0L, F, 0
$02F4 $96EF BCF INDF0, ____scli2c, 0
$02F6 $0676 DECF Soft_I2C_Read_temp_L0, 1, 0
$02F8 $D7E2 BRA L_Soft_I2C_Read_0
$02FA $ L_Soft_I2C_Read_1:
$02FA $88EF BSF INDF0, ____sdai2c, 0
$02FC $EC04 F000 CALL _Delay_1us
$0300 $5274 MOVF FARG_Soft_I2C_Read+0, 1, 0
$0302 $E002 BZ L_Soft_I2C_Read_3
$0304 $EC1C F000 CALL SoftI2C_PutZerosToLAT
$0308 $ L_Soft_I2C_Read_3:
$0308 $5074 MOVF FARG_soft_i2c_read+0, W, 0
$030A $B4D8 BTFSC STATUS, 2, 0
$030C $EF89 F001 GOTO L_07C
$0310 $98EF BCF INDF0, ____sdai2c, 0
$0312 $ L_07C:
$0312 $0000 NOP
$0314 $EC04 F000 CALL _Delay_1us
$0318 $86EF BSF INDF0, ____scli2c, 0
$031A $0E12 MOVLW 18
$031C $5EE9 SUBWF FSR0L, F, 0
$031E $A6EF BTFSS INDF0, ____scli2c, 0
$0320 $EF8F F001 GOTO $-1
$0324 $0E12 MOVLW 18
$0326 $26E9 ADDWF FSR0L, F, 0
$0328 $EC04 F000 CALL _Delay_1us
$032C $EC1C F000 CALL SoftI2C_PutZerosToLAT
$0330 $96EF BCF INDF0, ____scli2c, 0
$0332 $EC04 F000 CALL _Delay_1us
$0336 $EC1C F000 CALL SoftI2C_PutZerosToLAT
$033A $98EF BCF INDF0, ____sdai2c, 0
$033C $C075 F000 MOVFF Soft_I2C_Read_result_L0, STACK_0
$0340 $0012 RETURN
$0342 $ _Soft_I2C_Stop:
$0342 $C015 FFE9 MOVFF ___porti2c, FSR0L
$0346 $0E0F MOVLW 15
$0348 $6EEA MOVWF FSR0H, 0
$034A $EC1C F000 CALL SoftI2C_PutZerosToLAT
$034E $98EF BCF INDF0, ____sdai2c, 0
$0350 $EC04 F000 CALL _Delay_1us
$0354 $86EF BSF INDF0, ____scli2c, 0
$0356 $0E12 MOVLW 18
$0358 $5EE9 SUBWF FSR0L, F, 0
$035A $A6EF BTFSS INDF0, ____scli2c, 0
$035C $EFAD F001 GOTO $-1
$0360 $0E12 MOVLW 18
$0362 $26E9 ADDWF FSR0L, F, 0
$0364 $EC04 F000 CALL _Delay_1us
$0368 $EC04 F000 CALL _Delay_1us
$036C $EC04 F000 CALL _Delay_1us
$0370 $EC04 F000 CALL _Delay_1us
$0374 $88EF BSF INDF0, ____sdai2c, 0
$0376 $EC04 F000 CALL _Delay_1us
$037A $0012 RETURN
$037C $ _LCD8_Out:
$037C $D00F BRA L_LCD8_Out_12
$037E $ L_LCD8_Out_14:
$037E $0E80 MOVLW 128
$0380 $6E74 MOVWF FARG_LCD8_Out+0, 0
$0382 $D019 BRA L_LCD8_Out_13
$0384 $ L_LCD8_Out_15:
$0384 $0EC0 MOVLW 192
$0386 $6E74 MOVWF FARG_LCD8_Out+0, 0
$0388 $D016 BRA L_LCD8_Out_13
$038A $ L_LCD8_Out_16:
$038A $0E94 MOVLW 148
$038C $6E74 MOVWF FARG_LCD8_Out+0, 0
$038E $D013 BRA L_LCD8_Out_13
$0390 $ L_LCD8_Out_17:
$0390 $0ED4 MOVLW 212
$0392 $6E74 MOVWF FARG_LCD8_Out+0, 0
$0394 $D010 BRA L_LCD8_Out_13
$0396 $ L_LCD8_Out_18:
$0396 $0E80 MOVLW 128
$0398 $6E74 MOVWF FARG_LCD8_Out+0, 0
$039A $D00D BRA L_LCD8_Out_13
$039C $ L_LCD8_Out_12:
$039C $5074 MOVF FARG_LCD8_Out+0, 0, 0
$039E $0A01 XORLW 1
$03A0 $E0EE BZ L_LCD8_Out_14
$03A2 $5074 MOVF FARG_LCD8_Out+0, 0, 0
$03A4 $0A02 XORLW 2
$03A6 $E0EE BZ L_LCD8_Out_15
$03A8 $5074 MOVF FARG_LCD8_Out+0, 0, 0
$03AA $0A03 XORLW 3
$03AC $E0EE BZ L_LCD8_Out_16
$03AE $5074 MOVF FARG_LCD8_Out+0, 0, 0
$03B0 $0A04 XORLW 4
$03B2 $E0EE BZ L_LCD8_Out_17
$03B4 $D7F0 BRA L_LCD8_Out_18
$03B6 $ L_LCD8_Out_13:
$03B6 $0475 DECF FARG_LCD8_Out+1, 0, 0
$03B8 $6E00 MOVWF STACK_0, 0
$03BA $5074 MOVF FARG_LCD8_Out+0, 0, 0
$03BC $2600 ADDWF STACK_0, 1, 0
$03BE $C000 F074 MOVFF STACK_0, FARG_LCD8_Out+0
$03C2 $0E01 MOVLW 1
$03C4 $6E1A MOVWF Lcd8bit_main_global_cmd, 0
$03C6 $C000 F079 MOVFF STACK_0, FARG_Lcd8_Cmd+0
$03CA $EC24 F000 CALL _Lcd8_Cmd
$03CE $6A1A CLRF Lcd8bit_main_global_cmd, 0
$03D0 $6A78 CLRF LCD8_Out_i_L0, 0
$03D2 $ L_LCD8_Out_19:
$03D2 $5078 MOVF LCD8_Out_i_L0, 0, 0
$03D4 $2476 ADDWF FARG_LCD8_Out+2, 0, 0
$03D6 $6EE9 MOVWF FSR0L, 0
$03D8 $0E00 MOVLW 0
$03DA $2077 ADDWFC FARG_LCD8_Out+3, 0, 0
$03DC $6EEA MOVWF FSR0L+1, 0
$03DE $CFEE F000 MOVFF POSTINC0, STACK_0
$03E2 $5200 MOVF STACK_0, 1, 0
$03E4 $E00C BZ L_LCD8_Out_20
$03E6 $5078 MOVF LCD8_Out_i_L0, 0, 0
$03E8 $2476 ADDWF FARG_LCD8_Out+2, 0, 0
$03EA $6EE9 MOVWF FSR0L, 0
$03EC $0E00 MOVLW 0
$03EE $2077 ADDWFC FARG_LCD8_Out+3, 0, 0
$03F0 $6EEA MOVWF FSR0L+1, 0
$03F2 $CFEE F079 MOVFF POSTINC0, FARG_Lcd8_Cmd+0
$03F6 $EC24 F000 CALL _Lcd8_Cmd
$03FA $2A78 INCF LCD8_Out_i_L0, 1, 0
$03FC $D7EA BRA L_LCD8_Out_19
$03FE $ L_LCD8_Out_20:
$03FE $0E01 MOVLW 1
$0400 $6E1A MOVWF Lcd8bit_main_global_cmd, 0
$0402 $0012 RETURN
$0404 $ _I2C_Init:
$0404 $9CC7 BCF SSPSTAT, 6, 0
$0406 $9EC7 BCF SSPSTAT, 7, 0
$0408 $8894 BSF TRISC, 4, 0
$040A $8694 BSF TRISC, 3, 0
$040C $0E38 MOVLW 56
$040E $6EC6 MOVWF SSPCON1, 0
$0410 $0012 RETURN
$0412 $ _Soft_I2C_Init:
$0412 $C074 FFE9 MOVFF FARG_Soft_I2C_Init+0, FSR0L
$0416 $C075 FFEA MOVFF FARG_Soft_I2C_Init+1, FSR0H
$041A $0E12 MOVLW 18
$041C $2474 ADDWF FARG_Soft_I2C_Init+0, 0, 0
$041E $6E00 MOVWF STACK_0, 0
$0420 $C000 F015 MOVFF STACK_0, ___porti2c
$0424 $C000 FFE9 MOVFF STACK_0, FSR0L
$0428 $88EF BSF INDF0, ____sdai2c, 0
$042A $86EF BSF INDF0, ____scli2c, 0
$042C $0E12 MOVLW 18
$042E $5EE9 SUBWF FSR0L, 1, 0
$0430 $A6EF BTFSS INDF0, ____scli2c, 0
$0432 $EF18 F002 GOTO $-1
$0436 $0012 RETURN
$0438 $ _Lcd8_Init:
$0438 $EC07 F000 CALL _Delay_5500us
$043C $EC07 F000 CALL _Delay_5500us
$0440 $EC07 F000 CALL _Delay_5500us
$0444 $C076 F016 MOVFF FARG_Lcd8_Init+2, Lcd8bit_main_global_dataAddress
$0448 $C077 F017 MOVFF FARG_Lcd8_Init+3, Lcd8bit_main_global_dataAddress+1
$044C $C074 F018 MOVFF FARG_Lcd8_Init+0, Lcd8bit_main_global_ctrlAddress
$0450 $C075 F019 MOVFF FARG_Lcd8_Init+1, Lcd8bit_main_global_ctrlAddress+1
$0454 $C074 FFE9 MOVFF FARG_Lcd8_Init+0, FSR0L
$0458 $C075 FFEA MOVFF FARG_Lcd8_Init+1, FSR0H
$045C $90EF BCF INDF0, __LCD8_RW, 0
$045E $C076 FFE1 MOVFF FARG_Lcd8_Init+2, FSR1L
$0462 $C077 FFE2 MOVFF FARG_Lcd8_Init+3, FSR1H
$0466 $6AE6 CLRF POSTINC1, 0
$0468 $0E11 MOVLW 17
$046A $24E1 ADDWF FSR1L, 0, 0
$046C $6E00 MOVWF STACK_0, 0
$046E $C000 FFE1 MOVFF STACK_0, FSR1L
$0472 $6AE7 CLRF INDF1, 0
$0474 $0E12 MOVLW 18
$0476 $5C00 SUBWF STACK_0, 0, 0
$0478 $6EE1 MOVWF FSR1L, 0
$047A $0E12 MOVLW 18
$047C $26E9 ADDWF FSR0L, 1, 0
$047E $92EF BCF INDF0, __LCD8_ENABLE, 0
$0480 $94EF BCF INDF0, __LCD8_RS, 0
$0482 $90EF BCF INDF0, __LCD8_RW, 0
$0484 $0E12 MOVLW 18
$0486 $5EE9 SUBWF FSR0L, 1, 0
$0488 $94EF BCF INDF0, __LCD8_RS, 0
$048A $92EF BCF INDF0, __LCD8_ENABLE, 0
$048C $90EF BCF INDF0, __LCD8_RW, 0
$048E $0E30 MOVLW 48
$0490 $6E79 MOVWF FARG_Lcd8_Cmd+0, 0
$0492 $EC24 F000 CALL _Lcd8_Cmd
$0496 $0E30 MOVLW 48
$0498 $6E79 MOVWF FARG_Lcd8_Cmd+0, 0
$049A $EC24 F000 CALL _Lcd8_Cmd
$049E $0E30 MOVLW 48
$04A0 $6E79 MOVWF FARG_Lcd8_Cmd+0, 0
$04A2 $EC24 F000 CALL _Lcd8_Cmd
$04A6 $0E38 MOVLW 56
$04A8 $6E79 MOVWF FARG_Lcd8_Cmd+0, 0
$04AA $EC24 F000 CALL _Lcd8_Cmd
$04AE $0E08 MOVLW 8
$04B0 $6E79 MOVWF FARG_Lcd8_Cmd+0, 0
$04B2 $EC24 F000 CALL _Lcd8_Cmd
$04B6 $0E01 MOVLW 1
$04B8 $6E79 MOVWF FARG_Lcd8_Cmd+0, 0
$04BA $EC24 F000 CALL _Lcd8_Cmd
$04BE $0E06 MOVLW 6
$04C0 $6E79 MOVWF FARG_Lcd8_Cmd+0, 0
$04C2 $EC24 F000 CALL _Lcd8_Cmd
$04C6 $0E0C MOVLW 12
$04C8 $6E79 MOVWF FARG_Lcd8_Cmd+0, 0
$04CA $EC24 F000 CALL _Lcd8_Cmd
$04CE $0E01 MOVLW 1
$04D0 $6E1A MOVWF Lcd8bit_main_global_cmd, 0
$04D2 $0012 RETURN
$04D4 $ _main:
$04D4 $0E54 MOVLW 84
$04D6 $6E54 MOVWF lstr1_part1+0, 0
$04D8 $0E69 MOVLW 105
$04DA $6E55 MOVWF lstr1_part1+1, 0
$04DC $0E6D MOVLW 109
$04DE $6E56 MOVWF lstr1_part1+2, 0
$04E0 $0E65 MOVLW 101
$04E2 $6E57 MOVWF lstr1_part1+3, 0
$04E4 $0E3D MOVLW 61
$04E6 $6E58 MOVWF lstr1_part1+4, 0
$04E8 $6A59 CLRF lstr1_part1+5, 0
$04EA $0E3A MOVLW 58
$04EC $6E5A MOVWF lstr2_part1+0, 0
$04EE $6A5B CLRF lstr2_part1+1, 0
$04F0 $0E20 MOVLW 32
$04F2 $6E5C MOVWF lstr3_part1+0, 0
$04F4 $6A5D CLRF lstr3_part1+1, 0
$04F6 $0E20 MOVLW 32
$04F8 $6E5E MOVWF lstr4_part1+0, 0
$04FA $6A5F CLRF lstr4_part1+1, 0
$04FC $0E20 MOVLW 32
$04FE $6E60 MOVWF lstr5_part1+0, 0
$0500 $6A61 CLRF lstr5_part1+1, 0
$0502 $0E20 MOVLW 32
$0504 $6E62 MOVWF lstr6_part1+0, 0
$0506 $6A63 CLRF lstr6_part1+1, 0
$0508 $0E20 MOVLW 32
$050A $6E64 MOVWF lstr7_part1+0, 0
$050C $6A65 CLRF lstr7_part1+1, 0
$050E $0E20 MOVLW 32
$0510 $6E66 MOVWF lstr8_part1+0, 0
$0512 $6A67 CLRF lstr8_part1+1, 0
$0514 $0E44 MOVLW 68
$0516 $6E68 MOVWF lstr9_part1+0, 0
$0518 $0E61 MOVLW 97
$051A $6E69 MOVWF lstr9_part1+1, 0
$051C $0E74 MOVLW 116
$051E $6E6A MOVWF lstr9_part1+2, 0
$0520 $0E65 MOVLW 101
$0522 $6E6B MOVWF lstr9_part1+3, 0
$0524 $0E3D MOVLW 61
$0526 $6E6C MOVWF lstr9_part1+4, 0
$0528 $6A6D CLRF lstr9_part1+5, 0
$052A $0E2F MOVLW 47
$052C $6E6E MOVWF lstr10_part1+0, 0
$052E $6A6F CLRF lstr10_part1+1, 0
$0530 $0E2F MOVLW 47
$0532 $6E70 MOVWF lstr11_part1+0, 0
$0534 $6A71 CLRF lstr11_part1+1, 0
;part1.c,77 :: void main() {
;part1.c,83 :: keypressed = read_keypad();
$0536 $EC53 F000 CALL _read_keypad
$053A $C000 F072 MOVFF STACK_0, main_keypressed_L0
;part1.c,86 :: TRISD = 0x00; //Define PORTD to operate as outpout
$053E $6A95 CLRF TRISD, 0
;part1.c,87 :: TRISA = 0xFB; // Define PORTA pin 2 as output.
$0540 $0EFB MOVLW 251
$0542 $6E92 MOVWF TRISA, 0
;part1.c,90 :: keypressed = keypressed - 0x30;
$0544 $0E30 MOVLW 48
$0546 $5E00 SUBWF STACK_0, 1, 0
$0548 $C000 F072 MOVFF STACK_0, main_keypressed_L0
;part1.c,92 :: PORTD = function_numbers(keypressed); //Write the appropriate combination of bits to PORTD
$054C $C000 F074 MOVFF STACK_0, FARG_function_numbers+0
$0550 $ECC4 F000 CALL _function_numbers
$0554 $C000 FF83 MOVFF STACK_0, PORTD
;part1.c,93 :: switch (function_numbers(keypressed))
$0558 $C072 F074 MOVFF main_keypressed_L0, FARG_function_numbers+0
$055C $ECC4 F000 CALL _function_numbers
$0560 $C000 F073 MOVFF STACK_0, FLOC_main+31
$0564 $D22E BRA L_main_16
;part1.c,95 :: case 0x06:
$0566 $ L_main_18:
;part1.c,97 :: TRISE = 0x00; // PORTE is output
$0566 $6A96 CLRF TRISE, 0
;part1.c,98 :: TRISD = 0x00; // PORTD is output
$0568 $6A95 CLRF TRISD, 0
;part1.c,99 :: I2C_Init(100000);
$056A $0E14 MOVLW 20
$056C $6EC8 MOVWF SSPADD, 0
$056E $EC02 F002 CALL _I2C_Init
;part1.c,102 :: Soft_I2C_Config(&PORTC, 4, 3); //Use Port C pins 4 and 3
$0572 $0E82 MOVLW PORTC
$0574 $6E74 MOVWF FARG_Soft_I2C_Init+0, 0
$0576 $0E0F MOVLW @PORTC
$0578 $6E75 MOVWF FARG_Soft_I2C_Init+1, 0
$057A $EC09 F002 CALL _Soft_I2C_Init
;part1.c,103 :: Soft_I2C_Start(); // Issue I2C start signal
$057E $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,104 :: Soft_I2C_Write(0xD0); // Send byte (device address + W)
$0582 $0ED0 MOVLW 208
$0584 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0586 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,105 :: Soft_I2C_Write(1); // Send byte (Location of minutes register)
$058A $0E01 MOVLW 1
$058C $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$058E $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,106 :: Soft_I2C_Start(); // Issue I2C start signal
$0592 $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,107 :: Soft_I2C_Write(0xD1); // Send byte (device address + R)
$0596 $0ED1 MOVLW 209
$0598 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$059A $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,108 :: tempm = Soft_I2C_Read(0); // Read data (NO ACK)
$059E $6A74 CLRF FARG_Soft_I2C_Read+0, 0
$05A0 $EC58 F001 CALL _Soft_I2C_Read
$05A4 $C000 F01B MOVFF STACK_0, _tempm
;part1.c,109 :: Soft_I2C_Stop();
$05A8 $ECA1 F001 CALL _Soft_I2C_Stop
;part1.c,110 :: minutes[0]=((tempm & 0x70)>>4)+0x30;
$05AC $0E70 MOVLW 112
$05AE $141B ANDWF _tempm, 0, 0
$05B0 $6E1C MOVWF _minutes, 0
$05B2 $321C RRCF _minutes, 1, 0
$05B4 $9E1C BCF _minutes, 7, 0
$05B6 $321C RRCF _minutes, 1, 0
$05B8 $9E1C BCF _minutes, 7, 0
$05BA $321C RRCF _minutes, 1, 0
$05BC $9E1C BCF _minutes, 7, 0
$05BE $321C RRCF _minutes, 1, 0
$05C0 $9E1C BCF _minutes, 7, 0
$05C2 $0E30 MOVLW 48
$05C4 $261C ADDWF _minutes, 1, 0
;part1.c,111 :: minutes[1]= (tempm & 0x0F) +0x30;
$05C6 $0E0F MOVLW 15
$05C8 $141B ANDWF _tempm, 0, 0
$05CA $6E1D MOVWF _minutes+1, 0
$05CC $0E30 MOVLW 48
$05CE $261D ADDWF _minutes+1, 1, 0
;part1.c,114 :: Soft_I2C_Config(&PORTC, 4, 3); //Use Port C pins 4 and 3
$05D0 $0E82 MOVLW PORTC
$05D2 $6E74 MOVWF FARG_Soft_I2C_Init+0, 0
$05D4 $0E0F MOVLW @PORTC
$05D6 $6E75 MOVWF FARG_Soft_I2C_Init+1, 0
$05D8 $EC09 F002 CALL _Soft_I2C_Init
;part1.c,115 :: Soft_I2C_Start(); // Issue I2C start signal
$05DC $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,116 :: Soft_I2C_Write(0xD0); // Send byte (device address + W)
$05E0 $0ED0 MOVLW 208
$05E2 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$05E4 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,117 :: Soft_I2C_Write(2); // Send byte (Location of hours register)
$05E8 $0E02 MOVLW 2
$05EA $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$05EC $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,118 :: Soft_I2C_Start(); // Issue I2C start signal
$05F0 $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,119 :: Soft_I2C_Write(0xD1); // Send byte (device address + R)
$05F4 $0ED1 MOVLW 209
$05F6 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$05F8 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,120 :: temph = Soft_I2C_Read(0); // Read data (NO ACK)
$05FC $6A74 CLRF FARG_Soft_I2C_Read+0, 0
$05FE $EC58 F001 CALL _Soft_I2C_Read
$0602 $C000 F01E MOVFF STACK_0, _temph
;part1.c,121 :: Soft_I2C_Stop();
$0606 $ECA1 F001 CALL _Soft_I2C_Stop
;part1.c,122 :: hours[0]=((temph & 0x30)>>4)+0x30;
$060A $0E30 MOVLW 48
$060C $141E ANDWF _temph, 0, 0
$060E $6E1F MOVWF _hours, 0
$0610 $321F RRCF _hours, 1, 0
$0612 $9E1F BCF _hours, 7, 0
$0614 $321F RRCF _hours, 1, 0
$0616 $9E1F BCF _hours, 7, 0
$0618 $321F RRCF _hours, 1, 0
$061A $9E1F BCF _hours, 7, 0
$061C $321F RRCF _hours, 1, 0
$061E $9E1F BCF _hours, 7, 0
$0620 $0E30 MOVLW 48
$0622 $261F ADDWF _hours, 1, 0
;part1.c,123 :: hours[1]= (temph & 0x0F) +0x30;
$0624 $0E0F MOVLW 15
$0626 $141E ANDWF _temph, 0, 0
$0628 $6E20 MOVWF _hours+1, 0
$062A $0E30 MOVLW 48
$062C $2620 ADDWF _hours+1, 1, 0
;part1.c,127 :: Soft_I2C_Config(&PORTC, 4, 3); //Use PortC pins 4 and 3
$062E $0E82 MOVLW PORTC
$0630 $6E74 MOVWF FARG_Soft_I2C_Init+0, 0
$0632 $0E0F MOVLW @PORTC
$0634 $6E75 MOVWF FARG_Soft_I2C_Init+1, 0
$0636 $EC09 F002 CALL _Soft_I2C_Init
;part1.c,128 :: Soft_I2C_Start(); // Issue I2C start signal
$063A $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,129 :: Soft_I2C_Write(0xA2); // Send byte via I2C (Address of 24cO2)
$063E $0EA2 MOVLW 162
$0640 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0642 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,130 :: Soft_I2C_Write(2); // Send byte (address of EEPROM location)
$0646 $0E02 MOVLW 2
$0648 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$064A $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,131 :: Soft_I2C_Write(hours); // Send data (data to be written)
$064E $0E1F MOVLW _hours
$0650 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0652 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,132 :: Soft_I2C_Write(minutes); // Send data (data to be written)
$0656 $0E1C MOVLW _minutes
$0658 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$065A $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,133 :: Soft_I2C_Stop();
$065E $ECA1 F001 CALL _Soft_I2C_Stop
;part1.c,135 :: Soft_I2C_Start(); // Issue I2C start signal
$0662 $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,136 :: Soft_I2C_Write(0xA2); // Send byte (device address + W)
$0666 $0EA2 MOVLW 162
$0668 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$066A $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,137 :: Soft_I2C_Write(2); // Send byte (EEPROM location to read from)
$066E $0E02 MOVLW 2
$0670 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0672 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,138 :: Soft_I2C_Start(); // Issue I2C start signal
$0676 $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,139 :: Soft_I2C_Write(0xA3); // Send byte (device address + R)
$067A $0EA3 MOVLW 163
$067C $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$067E $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,140 :: mem_data[0] = Soft_I2C_Read(1); // Read data (send ACK)
$0682 $0E01 MOVLW 1
$0684 $6E74 MOVWF FARG_Soft_I2C_Read+0, 0
$0686 $EC58 F001 CALL _Soft_I2C_Read
$068A $C000 F021 MOVFF STACK_0, _mem_data
$068E $0E00 MOVLW 0
$0690 $6E22 MOVWF _mem_data+1, 0
;part1.c,141 :: mem_data[1] = Soft_I2C_Read(1); // Read data (send ACK)
$0692 $0E01 MOVLW 1
$0694 $6E74 MOVWF FARG_Soft_I2C_Read+0, 0
$0696 $EC58 F001 CALL _Soft_I2C_Read
$069A $C000 F023 MOVFF STACK_0, _mem_data+2
$069E $0E00 MOVLW 0
$06A0 $6E24 MOVWF _mem_data+3, 0
;part1.c,145 :: Soft_I2C_Config(&PORTC, 4, 3); //Use Port C pins 4 and 3
$06A2 $0E82 MOVLW PORTC
$06A4 $6E74 MOVWF FARG_Soft_I2C_Init+0, 0
$06A6 $0E0F MOVLW @PORTC
$06A8 $6E75 MOVWF FARG_Soft_I2C_Init+1, 0
$06AA $EC09 F002 CALL _Soft_I2C_Init
;part1.c,146 :: Soft_I2C_Start(); // Issue I2C start signal
$06AE $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,147 :: Soft_I2C_Write(0xD0); // Send byte (device address + W)
$06B2 $0ED0 MOVLW 208
$06B4 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$06B6 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,148 :: Soft_I2C_Write(4); // Send byte (Location of day register)
$06BA $0E04 MOVLW 4
$06BC $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$06BE $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,149 :: Soft_I2C_Start(); // Issue I2C start signal
$06C2 $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,150 :: Soft_I2C_Write(0xD1); // Send byte (device address + R)
$06C6 $0ED1 MOVLW 209
$06C8 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$06CA $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,151 :: tempDay = Soft_I2C_Read(0); // Read data (NO ACK)
$06CE $6A74 CLRF FARG_Soft_I2C_Read+0, 0
$06D0 $EC58 F001 CALL _Soft_I2C_Read
$06D4 $C000 F035 MOVFF STACK_0, _tempDay
;part1.c,152 :: Soft_I2C_Stop();
$06D8 $ECA1 F001 CALL _Soft_I2C_Stop
;part1.c,153 :: day[0]=((tempDay & 0x70)>>4)+0x30;
$06DC $0E70 MOVLW 112
$06DE $1435 ANDWF _tempDay, 0, 0
$06E0 $6E36 MOVWF _day, 0
$06E2 $3236 RRCF _day, 1, 0
$06E4 $9E36 BCF _day, 7, 0
$06E6 $3236 RRCF _day, 1, 0
$06E8 $9E36 BCF _day, 7, 0
$06EA $3236 RRCF _day, 1, 0
$06EC $9E36 BCF _day, 7, 0
$06EE $3236 RRCF _day, 1, 0
$06F0 $9E36 BCF _day, 7, 0
$06F2 $0E30 MOVLW 48
$06F4 $2636 ADDWF _day, 1, 0
;part1.c,154 :: day[1]= (tempDay & 0x0F) +0x30;
$06F6 $0E0F MOVLW 15
$06F8 $1435 ANDWF _tempDay, 0, 0
$06FA $6E37 MOVWF _day+1, 0
$06FC $0E30 MOVLW 48
$06FE $2637 ADDWF _day+1, 1, 0
;part1.c,157 :: Soft_I2C_Config(&PORTC, 4, 3); //Use Port C pins 4 and 3
$0700 $0E82 MOVLW PORTC
$0702 $6E74 MOVWF FARG_Soft_I2C_Init+0, 0
$0704 $0E0F MOVLW @PORTC
$0706 $6E75 MOVWF FARG_Soft_I2C_Init+1, 0
$0708 $EC09 F002 CALL _Soft_I2C_Init
;part1.c,158 :: Soft_I2C_Start(); // Issue I2C start signal
$070C $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,159 :: Soft_I2C_Write(0xD0); // Send byte (device address + W)
$0710 $0ED0 MOVLW 208
$0712 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0714 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,160 :: Soft_I2C_Write(5); // Send byte (Location of month register)
$0718 $0E05 MOVLW 5
$071A $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$071C $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,161 :: Soft_I2C_Start(); // Issue I2C start signal
$0720 $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,162 :: Soft_I2C_Write(0xD1); // Send byte (device address + R)
$0724 $0ED1 MOVLW 209
$0726 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0728 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,163 :: tempMonth = Soft_I2C_Read(0); // Read data (NO ACK)
$072C $6A74 CLRF FARG_Soft_I2C_Read+0, 0
$072E $EC58 F001 CALL _Soft_I2C_Read
$0732 $C000 F038 MOVFF STACK_0, _tempMonth
;part1.c,164 :: Soft_I2C_Stop();
$0736 $ECA1 F001 CALL _Soft_I2C_Stop
;part1.c,165 :: month[0]=((tempMonth & 0x30)>>4)+0x30;
$073A $0E30 MOVLW 48
$073C $1438 ANDWF _tempMonth, 0, 0
$073E $6E39 MOVWF _month, 0
$0740 $3239 RRCF _month, 1, 0
$0742 $9E39 BCF _month, 7, 0
$0744 $3239 RRCF _month, 1, 0
$0746 $9E39 BCF _month, 7, 0
$0748 $3239 RRCF _month, 1, 0
$074A $9E39 BCF _month, 7, 0
$074C $3239 RRCF _month, 1, 0
$074E $9E39 BCF _month, 7, 0
$0750 $0E30 MOVLW 48
$0752 $2639 ADDWF _month, 1, 0
;part1.c,166 :: month[1]= (tempMonth & 0x0F) +0x30;
$0754 $0E0F MOVLW 15
$0756 $1438 ANDWF _tempMonth, 0, 0
$0758 $6E3A MOVWF _month+1, 0
$075A $0E30 MOVLW 48
$075C $263A ADDWF _month+1, 1, 0
;part1.c,169 :: Soft_I2C_Config(&PORTC, 4, 3); //Use Port C pins 4 and 3
$075E $0E82 MOVLW PORTC
$0760 $6E74 MOVWF FARG_Soft_I2C_Init+0, 0
$0762 $0E0F MOVLW @PORTC
$0764 $6E75 MOVWF FARG_Soft_I2C_Init+1, 0
$0766 $EC09 F002 CALL _Soft_I2C_Init
;part1.c,170 :: Soft_I2C_Start(); // Issue I2C start signal
$076A $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,171 :: Soft_I2C_Write(0xD0); // Send byte (device address + W)
$076E $0ED0 MOVLW 208
$0770 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0772 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,172 :: Soft_I2C_Write(6); // Send byte (Location of year register)
$0776 $0E06 MOVLW 6
$0778 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$077A $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,173 :: Soft_I2C_Start(); // Issue I2C start signal
$077E $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,174 :: Soft_I2C_Write(0xD1); // Send byte (device address + R)
$0782 $0ED1 MOVLW 209
$0784 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0786 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,175 :: tempYear = Soft_I2C_Read(0); // Read data (NO ACK)
$078A $6A74 CLRF FARG_Soft_I2C_Read+0, 0
$078C $EC58 F001 CALL _Soft_I2C_Read
$0790 $C000 F03B MOVFF STACK_0, _tempYear
;part1.c,176 :: Soft_I2C_Stop();
$0794 $ECA1 F001 CALL _Soft_I2C_Stop
;part1.c,177 :: year[0]=((tempYear & 0x70)>>4)+0x30;
$0798 $0E70 MOVLW 112
$079A $143B ANDWF _tempYear, 0, 0
$079C $6E3C MOVWF _year, 0
$079E $323C RRCF _year, 1, 0
$07A0 $9E3C BCF _year, 7, 0
$07A2 $323C RRCF _year, 1, 0
$07A4 $9E3C BCF _year, 7, 0
$07A6 $323C RRCF _year, 1, 0
$07A8 $9E3C BCF _year, 7, 0
$07AA $323C RRCF _year, 1, 0
$07AC $9E3C BCF _year, 7, 0
$07AE $0E30 MOVLW 48
$07B0 $263C ADDWF _year, 1, 0
;part1.c,178 :: year[1]= (tempYear & 0x0F) +0x30;
$07B2 $0E0F MOVLW 15
$07B4 $143B ANDWF _tempYear, 0, 0
$07B6 $6E3D MOVWF _year+1, 0
$07B8 $0E30 MOVLW 48
$07BA $263D ADDWF _year+1, 1, 0
;part1.c,183 :: Soft_I2C_Config(&PORTC, 4, 3); //Use PortC pins 4 and 3
$07BC $0E82 MOVLW PORTC
$07BE $6E74 MOVWF FARG_Soft_I2C_Init+0, 0
$07C0 $0E0F MOVLW @PORTC
$07C2 $6E75 MOVWF FARG_Soft_I2C_Init+1, 0
$07C4 $EC09 F002 CALL _Soft_I2C_Init
;part1.c,184 :: Soft_I2C_Start(); // Issue I2C start signal
$07C8 $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,185 :: Soft_I2C_Write(0xA2); // Send byte via I2C (Address of 24cO2)
$07CC $0EA2 MOVLW 162
$07CE $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$07D0 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,186 :: Soft_I2C_Write(2); // Send byte (address of EEPROM location)
$07D4 $0E02 MOVLW 2
$07D6 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$07D8 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,187 :: Soft_I2C_Write(day); // Send data (data to be written)
$07DC $0E36 MOVLW _day
$07DE $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$07E0 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,189 :: Soft_I2C_Write(month); // Send data (data to be written)
$07E4 $0E39 MOVLW _month
$07E6 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$07E8 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,190 :: Soft_I2C_Write(year); // Send data (data to be written)
$07EC $0E3C MOVLW _year
$07EE $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$07F0 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,192 :: Soft_I2C_Stop();
$07F4 $ECA1 F001 CALL _Soft_I2C_Stop
;part1.c,194 :: Soft_I2C_Start(); // Issue I2C start signal
$07F8 $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,195 :: Soft_I2C_Write(0xA2); // Send byte (device address + W)
$07FC $0EA2 MOVLW 162
$07FE $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0800 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,196 :: Soft_I2C_Write(2); // Send byte (EEPROM location to read from)
$0804 $0E02 MOVLW 2
$0806 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0808 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,197 :: Soft_I2C_Start(); // Issue I2C start signal
$080C $ECE5 F000 CALL _Soft_I2C_Start
;part1.c,198 :: Soft_I2C_Write(0xA3); // Send byte (device address + R)
$0810 $0EA3 MOVLW 163
$0812 $6E74 MOVWF FARG_Soft_I2C_Write+0, 0
$0814 $ECF8 F000 CALL _Soft_I2C_Write
;part1.c,199 :: mem2_data[0] = Soft_I2C_Read(1); // Read data (send ACK)
$0818 $0E01 MOVLW 1
$081A $6E74 MOVWF FARG_Soft_I2C_Read+0, 0
$081C $EC58 F001 CALL _Soft_I2C_Read
$0820 $C000 F040 MOVFF STACK_0, _mem2_data
$0824 $0E00 MOVLW 0
$0826 $6E41 MOVWF _mem2_data+1, 0
;part1.c,200 :: mem2_data[1] = Soft_I2C_Read(1); // Read data (send ACK)
$0828 $0E01 MOVLW 1
$082A $6E74 MOVWF FARG_Soft_I2C_Read+0, 0
$082C $EC58 F001 CALL _Soft_I2C_Read
$0830 $C000 F042 MOVFF STACK_0, _mem2_data+2
$0834 $0E00 MOVLW 0
$0836 $6E43 MOVWF _mem2_data+3, 0
;part1.c,201 :: mem2_data[2] = Soft_I2C_Read(1); // Read data (send ACK)
$0838 $0E01 MOVLW 1
$083A $6E74 MOVWF FARG_Soft_I2C_Read+0, 0
$083C $EC58 F001 CALL _Soft_I2C_Read
$0840 $C000 F044 MOVFF STACK_0, _mem2_data+4
$0844 $0E00 MOVLW 0
$0846 $6E45 MOVWF _mem2_data+5, 0
;part1.c,206 :: Lcd8_Config(&PORTE, &PORTD, 2,1,0, 7,6,5,4,3,2,1,0);
$0848 $0E84 MOVLW PORTE
$084A $6E74 MOVWF FARG_Lcd8_Init+0, 0
$084C $0E0F MOVLW @PORTE
$084E $6E75 MOVWF FARG_Lcd8_Init+1, 0
$0850 $0E83 MOVLW PORTD
$0852 $6E76 MOVWF FARG_Lcd8_Init+2, 0
$0854 $0E0F MOVLW @PORTD
$0856 $6E77 MOVWF FARG_Lcd8_Init+3, 0
$0858 $EC1C F002 CALL _Lcd8_Init
;part1.c,207 :: Lcd8_Cmd(LCD_CURSOR_OFF); // Turn on blinking cursor
$085C $0E0C MOVLW 12
$085E $6E79 MOVWF FARG_Lcd8_Cmd+0, 0
$0860 $EC24 F000 CALL _Lcd8_Cmd
;part1.c,208 :: Lcd8_Cmd(LCD_CLEAR); // Clear screen
$0864 $0E01 MOVLW 1
$0866 $6E79 MOVWF FARG_Lcd8_Cmd+0, 0
$0868 $EC24 F000 CALL _Lcd8_Cmd
;part1.c,211 :: Lcd8_Out(1, 1,"Time=");
$086C $0E01 MOVLW 1
$086E $6E74 MOVWF FARG_LCD8_Out+0, 0
$0870 $0E01 MOVLW 1
$0872 $6E75 MOVWF FARG_LCD8_Out+1, 0
$0874 $0E54 MOVLW lstr1_part1
$0876 $6E76 MOVWF FARG_LCD8_Out+2, 0
$0878 $0E00 MOVLW @lstr1_part1
$087A $6E77 MOVWF FARG_LCD8_Out+3, 0
$087C $ECBE F001 CALL _LCD8_Out
;part1.c,212 :: Lcd8_Out(1, 6,mem_data[0]);
$0880 $0E01 MOVLW 1
$0882 $6E74 MOVWF FARG_LCD8_Out+0, 0
$0884 $0E06 MOVLW 6
$0886 $6E75 MOVWF FARG_LCD8_Out+1, 0
$0888 $C021 F076 MOVFF _mem_data, FARG_LCD8_Out+2
$088C $C022 F077 MOVFF _mem_data+1, FARG_LCD8_Out+3
$0890 $ECBE F001 CALL _LCD8_Out
;part1.c,213 :: Lcd8_Out(1, 8,":") ;
$0894 $0E01 MOVLW 1
$0896 $6E74 MOVWF FARG_LCD8_Out+0, 0
$0898 $0E08 MOVLW 8
$089A $6E75 MOVWF FARG_LCD8_Out+1, 0
$089C $0E5A MOVLW lstr2_part1
$089E $6E76 MOVWF FARG_LCD8_Out+2, 0
$08A0 $0E00 MOVLW @lstr2_part1
$08A2 $6E77 MOVWF FARG_LCD8_Out+3, 0
$08A4 $ECBE F001 CALL _LCD8_Out
;part1.c,214 :: Lcd8_Out(1, 9,mem_data[1]); // Print time on LCD
$08A8 $0E01 MOVLW 1
$08AA $6E74 MOVWF FARG_LCD8_Out+0, 0
$08AC $0E09 MOVLW 9
$08AE $6E75 MOVWF FARG_LCD8_Out+1, 0
$08B0 $C023 F076 MOVFF _mem_data+2, FARG_LCD8_Out+2
$08B4 $C024 F077 MOVFF _mem_data+3, FARG_LCD8_Out+3
$08B8 $ECBE F001 CALL _LCD8_Out
;part1.c,216 :: Lcd8_Out(1, 11," ") ;
$08BC $0E01 MOVLW 1
$08BE $6E74 MOVWF FARG_LCD8_Out+0, 0
$08C0 $0E0B MOVLW 11
$08C2 $6E75 MOVWF FARG_LCD8_Out+1, 0
$08C4 $0E5C MOVLW lstr3_part1
$08C6 $6E76 MOVWF FARG_LCD8_Out+2, 0
$08C8 $0E00 MOVLW @lstr3_part1
$08CA $6E77 MOVWF FARG_LCD8_Out+3, 0
$08CC $ECBE F001 CALL _LCD8_Out
;part1.c,217 :: Lcd8_Out(1, 12," ") ;
$08D0 $0E01 MOVLW 1
$08D2 $6E74 MOVWF FARG_LCD8_Out+0, 0
$08D4 $0E0C MOVLW 12
$08D6 $6E75 MOVWF FARG_LCD8_Out+1, 0
$08D8 $0E5E MOVLW lstr4_part1
$08DA $6E76 MOVWF FARG_LCD8_Out+2, 0
$08DC $0E00 MOVLW @lstr4_part1
$08DE $6E77 MOVWF FARG_LCD8_Out+3, 0
$08E0 $ECBE F001 CALL _LCD8_Out
;part1.c,218 :: Lcd8_Out(1, 13," ") ;
$08E4 $0E01 MOVLW 1
$08E6 $6E74 MOVWF FARG_LCD8_Out+0, 0
$08E8 $0E0D MOVLW 13
$08EA $6E75 MOVWF FARG_LCD8_Out+1, 0
$08EC $0E60 MOVLW lstr5_part1
$08EE $6E76 MOVWF FARG_LCD8_Out+2, 0
$08F0 $0E00 MOVLW @lstr5_part1
$08F2 $6E77 MOVWF FARG_LCD8_Out+3, 0
$08F4 $ECBE F001 CALL _LCD8_Out
;part1.c,219 :: Lcd8_Out(1, 14," ") ;
$08F8 $0E01 MOVLW 1
$08FA $6E74 MOVWF FARG_LCD8_Out+0, 0
$08FC $0E0E MOVLW 14
$08FE $6E75 MOVWF FARG_LCD8_Out+1, 0
$0900 $0E62 MOVLW lstr6_part1
$0902 $6E76 MOVWF FARG_LCD8_Out+2, 0
$0904 $0E00 MOVLW @lstr6_part1
$0906 $6E77 MOVWF FARG_LCD8_Out+3, 0
$0908 $ECBE F001 CALL _LCD8_Out
;part1.c,220 :: Lcd8_Out(1, 15," ") ;
$090C $0E01 MOVLW 1
$090E $6E74 MOVWF FARG_LCD8_Out+0, 0
$0910 $0E0F MOVLW 15
$0912 $6E75 MOVWF FARG_LCD8_Out+1, 0
$0914 $0E64 MOVLW lstr7_part1
$0916 $6E76 MOVWF FARG_LCD8_Out+2, 0
$0918 $0E00 MOVLW @lstr7_part1
$091A $6E77 MOVWF FARG_LCD8_Out+3, 0
$091C $ECBE F001 CALL _LCD8_Out
;part1.c,221 :: Lcd8_Out(1, 16," ") ;
$0920 $0E01 MOVLW 1
$0922 $6E74 MOVWF FARG_LCD8_Out+0, 0
$0924 $0E10 MOVLW 16
$0926 $6E75 MOVWF FARG_LCD8_Out+1, 0
$0928 $0E66 MOVLW lstr8_part1
$092A $6E76 MOVWF FARG_LCD8_Out+2, 0
$092C $0E00 MOVLW @lstr8_part1
$092E $6E77 MOVWF FARG_LCD8_Out+3, 0
$0930 $ECBE F001 CALL _LCD8_Out
;part1.c,223 :: Lcd8_Out(2, 1,"Date=");
$0934 $0E02 MOVLW 2
$0936 $6E74 MOVWF FARG_LCD8_Out+0, 0
$0938 $0E01 MOVLW 1
$093A $6E75 MOVWF FARG_LCD8_Out+1, 0
$093C $0E68 MOVLW lstr9_part1
$093E $6E76 MOVWF FARG_LCD8_Out+2, 0
$0940 $0E00 MOVLW @lstr9_part1
$0942 $6E77 MOVWF FARG_LCD8_Out+3, 0
$0944 $ECBE F001 CALL _LCD8_Out
;part1.c,224 :: Lcd8_Out(2, 6,mem2_data[0]);
$0948 $0E02 MOVLW 2
$094A $6E74 MOVWF FARG_LCD8_Out+0, 0
$094C $0E06 MOVLW 6
$094E $6E75 MOVWF FARG_LCD8_Out+1, 0
$0950 $C040 F076 MOVFF _mem2_data, FARG_LCD8_Out+2
$0954 $C041 F077 MOVFF _mem2_data+1, FARG_LCD8_Out+3
$0958 $ECBE F001 CALL _LCD8_Out
;part1.c,225 :: Lcd8_Out(2, 8,"/") ;
$095C $0E02 MOVLW 2
$095E $6E74 MOVWF FARG_LCD8_Out+0, 0
$0960 $0E08 MOVLW 8
$0962 $6E75 MOVWF FARG_LCD8_Out+1, 0
$0964 $0E6E MOVLW lstr10_part1
$0966 $6E76 MOVWF FARG_LCD8_Out+2, 0
$0968 $0E00 MOVLW @lstr10_part1
$096A $6E77 MOVWF FARG_LCD8_Out+3, 0
$096C $ECBE F001 CALL _LCD8_Out
;part1.c,226 :: Lcd8_Out(2, 9,mem2_data[1]); // Print month on LCD
$0970 $0E02 MOVLW 2
$0972 $6E74 MOVWF FARG_LCD8_Out+0, 0
$0974 $0E09 MOVLW 9
$0976 $6E75 MOVWF FARG_LCD8_Out+1, 0
$0978 $C042 F076 MOVFF _mem2_data+2, FARG_LCD8_Out+2
$097C $C043 F077 MOVFF _mem2_data+3, FARG_LCD8_Out+3
$0980 $ECBE F001 CALL _LCD8_Out
;part1.c,227 :: Lcd8_Out(2, 11,"/") ;
$0984 $0E02 MOVLW 2
$0986 $6E74 MOVWF FARG_LCD8_Out+0, 0
$0988 $0E0B MOVLW 11
$098A $6E75 MOVWF FARG_LCD8_Out+1, 0
$098C $0E70 MOVLW lstr11_part1
$098E $6E76 MOVWF FARG_LCD8_Out+2, 0
$0990 $0E00 MOVLW @lstr11_part1
$0992 $6E77 MOVWF FARG_LCD8_Out+3, 0
$0994 $ECBE F001 CALL _LCD8_Out
;part1.c,228 :: Lcd8_Out(2, 12,mem2_data[2]); // Print year on LCD
$0998 $0E02 MOVLW 2
$099A $6E74 MOVWF FARG_LCD8_Out+0, 0
$099C $0E0C MOVLW 12
$099E $6E75 MOVWF FARG_LCD8_Out+1, 0
$09A0 $C044 F076 MOVFF _mem2_data+4, FARG_LCD8_Out+2
$09A4 $C045 F077 MOVFF _mem2_data+5, FARG_LCD8_Out+3
$09A8 $ECBE F001 CALL _LCD8_Out
;part1.c,229 :: Lcd8_Out(2, 14,mem2_data[2]); // Print year on LCD
$09AC $0E02 MOVLW 2
$09AE $6E74 MOVWF FARG_LCD8_Out+0, 0
$09B0 $0E0E MOVLW 14
$09B2 $6E75 MOVWF FARG_LCD8_Out+1, 0
$09B4 $C044 F076 MOVFF _mem2_data+4, FARG_LCD8_Out+2
$09B8 $C045 F077 MOVFF _mem2_data+5, FARG_LCD8_Out+3
$09BC $ECBE F001 CALL _LCD8_Out
;part1.c,230 :: }
$09C0 $D004 BRA L_main_17
$09C2 $ L_main_16:
$09C2 $5073 MOVF FLOC_main+31, 0, 0
$09C4 $0A06 XORLW 6
$09C6 $B4D8 BTFSC STATUS, Z, 0
$09C8 $D5CE BRA L_main_18
$09CA $ L_main_17:
;part1.c,231 :: }
$09CA $D7FF BRA $
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/derived_type3_pkg.ads | best08618/asylo | 7 | 13161 | <reponame>best08618/asylo
package Derived_Type3_Pkg is
procedure Proc1;
procedure Proc2;
end Derived_Type3_Pkg;
|
scripts/celadonmansion1_2.asm | adhi-thirumala/EvoYellow | 0 | 247729 | <filename>scripts/celadonmansion1_2.asm
Func_f1e70:
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld hl, CeladonMansion1Text_f1e96
call PrintText
callab IsStarterPikachuInOurParty
ret nc
ld hl, CeladonMansionText_f1e9c
call PrintText
ld a, $0
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
call Func_f1ea2
call PrintText
ret
CeladonMansion1Text_f1e96:
TX_FAR _CeladonMansion1Text2
TX_WAIT_BUTTON
db "@"
CeladonMansionText_f1e9c:
TX_FAR _CeladonMansion1Text6
TX_BUTTON_SOUND
db "@"
Func_f1ea2:
ld hl, PikachuHappinessThresholds_f1eb9
.asm_f1ea5
ld a, [hli]
inc hl
and a
jr z, .asm_f1eb5
ld b, a
ld a, [wPikachuHappiness]
cp b
jr c, .asm_f1eb5
inc hl
inc hl
jr .asm_f1ea5
.asm_f1eb5
ld a, [hli]
ld h, [hl]
ld l, a
ret
PikachuHappinessThresholds_f1eb9
dw 51, CeladonMansion1Text_f1ed5
dw 101, CeladonMansion1Text_f1eda
dw 131, CeladonMansion1Text_f1edf
dw 161, CeladonMansion1Text_f1ee4
dw 201, CeladonMansion1Text_f1ee9
dw 255, CeladonMansion1Text_f1eee
dbbw 0, $ff, CeladonMansion1Text_f1eee
CeladonMansion1Text_f1ed5:
TX_FAR _CeladonMansion1Text7
db "@"
CeladonMansion1Text_f1eda:
TX_FAR _CeladonMansion1Text8
db "@"
CeladonMansion1Text_f1edf:
TX_FAR _CeladonMansion1Text9
db "@"
CeladonMansion1Text_f1ee4:
TX_FAR _CeladonMansion1Text10
db "@"
CeladonMansion1Text_f1ee9:
TX_FAR _CeladonMansion1Text11
db "@"
CeladonMansion1Text_f1eee:
TX_FAR _CeladonMansion1Text12
db "@"
|
alloy4fun_models/trashltl/models/4/vjdvnTJywobYZiMq6.als | Kaixi26/org.alloytools.alloy | 0 | 3298 | open main
pred idvjdvnTJywobYZiMq6_prop5 {
eventually some f:File | f not in Protected and File' = File -f
}
pred __repair { idvjdvnTJywobYZiMq6_prop5 }
check __repair { idvjdvnTJywobYZiMq6_prop5 <=> prop5o } |
practica6/Ejercicio4P6.asm | ramseslopez/Arqui | 0 | 174536 | <filename>practica6/Ejercicio4P6.asm
.data
menosuno: .float 1.0
iter: .float 0.0
iter1: .float 1.0
numiter: .float 0.0 #
x2: .float 2.0
x4: .float 4.0
.text
lwc1 $f11 menosuno
lwc1 $f6 iter
lwc1 $f10 iter1
lwc1 $f8 numiter
lwc1 $f9 x2
lwc1 $f14 x4
add $a0, $a0, 41 #NUMERO DE VECES DE LA SUMA
add $v1, $v1, 0 #
neg.s $f2, $f11
add.s $f4, $f2, $f6
Potencia:
mul.s $f0, $f2, $f4
add $v0, $v0, 1
add.s $f2, $f0, $f6
potenciar:
ble $v0, $v1, Potencia
multiSuma:
mul.s $f5, $f8, $f9
add.s $f5, $f5, $f11
division:
div.s $f21, $f0, $f5
SumaTotal:
add $v1, $v1, 1
add.s $f8, $f8, $f11
add.s $f20, $f20, $f21
add $a1, $a1, 1
ble $a1, $a0, Potencia
mul.s $f20, $f20, $f14
|
tests/sjasmplus_regressions/duplicated_define.asm | cizo2000/sjasmplus | 220 | 100361 | <reponame>cizo2000/sjasmplus
define label "value1"
define label "value2"
|
TestData/switch.asm | robertmuth/Cwerg | 171 | 103618 | <reponame>robertmuth/Cwerg
# demonstrates use of switch instruction for computed jumps
# requires std_lib.asm
# ========================================
.fun main NORMAL [S32] = []
.reg U32 [size i]
.jtb switch_tab 5 labelD [1 labelA 2 labelB 4 labelC]
.bbl start
mov i 0
.bbl loop
switch i switch_tab
.bbl labelA
pusharg 65:U8 # 'A'
bsr print_c_ln
bra tail
.bbl labelB
pusharg 66:U8 # 'B'
bsr print_c_ln
bra tail
.bbl labelC
pusharg 67:U8 # 'C'
bsr print_c_ln
bra tail
.bbl labelD
pusharg 68:U8 # 'D'
bsr print_c_ln
bra tail
.bbl tail
add i = i 1
blt i 5 loop
pusharg 0:S32
ret
|
2/q2/patch1.asm | tomersamara/InfoSec | 0 | 85564 | mov eax, 0x080485d4
jmp eax |
asm/sa1/rotate_yaxis.asm | VitorVilela7/SMW-CodeLib | 14 | 6506 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SA-1 32x32 "y axis" rotation
; parallel mode service
; turn off service: set $8b.7
; destination bw-ram "virtual ram" & bw-ram
!dest = $600000+($3e00*2) ;stuff
!destbw = $403e00
; temp ram ($e0-$ff)
!re = $e0 ;$e0-$e3 is reserved
!cos = $e4 ;$e4-$e5 is cosine value
!dx = $e6 ;$e6-$e7 is initial x
!x = $e8 ;$e8-$e9 is current x
!y = $ea ;$ea-$eb is current y
!ly = $ec ;$ec-$ed is reserved
!deg = $ee ;8-bit degress.
!deg2 = $ef ;8-bit degress. (backup)
!ptr = $f0 ;$f0-$f2 is current pointer
parallel_main:
phb
phk
plb
- lda $8b
bmi .end
lda !deg2
cmp !deg
beq -
sta !deg2
jsr .rotate
bra -
.end
plb
rtl
.rotate
sei
lda #$01
sta $2250 ; division
rep #$30
lda !deg
and #$00ff
asl
tax
lda.w .cos_table,x
sta !cos ; grab cos
lda #$7fff ; invert cos value. (1/x)
sta $2251
lda !cos
bne +
inc
+ bpl +
eor #$ffff
inc
+ sta $2253
nop
bra $00
lda $2306
asl
cmp #$0c00 ; make sure that A is
bcc + ; small enough to
lda #$0bff ; don't overflow
+ bit !cos
bpl +
eor #$ffff
inc
+ sta !cos
stz $2250 ; multiply mode
lda.w #$fff0 ; set initial x
sta $2251
lda !cos
sta $2253
nop
bra $00
lda $2306
clc
adc #$1000
sta !dx
sta !x
lda #!dest
sta !ptr
lda #!dest>>8
sta !ptr+1
cli
phb
pea $4040 ; set bank to $40
plb
plb
clc
; this code gets looped 32*32 times.
stz $e2
stz !y
lda #$001f
sta !ly ; 'y' loop count
.y ldy #$001f ; 'x' loop count
.x lda !x
adc !cos
sta !x
cmp #$2000
bcs .out_of_range
sta $e0
lda !y
ora $e1
tax
sep #$20
lda $b000,x ;$40b000
.back sta [!ptr]
rep #$21
inc !ptr
dey ; loop x
bpl .x
lda !dx ; reset x to default
sta !x
lda !y ; increase y by 1
adc #$0020
sta !y
dec !ly ; loop y
bpl .y
sep #$30
plb
rts
.out_of_range
sep #$20
lda #$00
bra .back
.cos_table
dw $0100,$0100,$0100,$00FF,$00FF,$00FE,$00FD,$00FC,$00FB,$00FA,$00F8,$00F7,$00F5,$00F3,$00F1,$00EF
dw $00ED,$00EA,$00E7,$00E5,$00E2,$00DF,$00DC,$00D8,$00D5,$00D1,$00CE,$00CA,$00C6,$00C2,$00BE,$00B9
dw $00B5,$00B1,$00AC,$00A7,$00A2,$009D,$0098,$0093,$008E,$0089,$0084,$007E,$0079,$0073,$006D,$0068
dw $0062,$005C,$0056,$0050,$004A,$0044,$003E,$0038,$0032,$002C,$0026,$001F,$0019,$0013,$000D,$0006
dw $0000,$FFFA,$FFF3,$FFED,$FFE7,$FFE1,$FFDA,$FFD4,$FFCE,$FFC8,$FFC2,$FFBC,$FFB6,$FFB0,$FFAA,$FFA4
dw $FF9E,$FF98,$FF93,$FF8D,$FF87,$FF82,$FF7C,$FF77,$FF72,$FF6D,$FF68,$FF63,$FF5E,$FF59,$FF54,$FF4F
dw $FF4B,$FF47,$FF42,$FF3E,$FF3A,$FF36,$FF32,$FF2F,$FF2B,$FF28,$FF24,$FF21,$FF1E,$FF1B,$FF19,$FF16
dw $FF13,$FF11,$FF0F,$FF0D,$FF0B,$FF09,$FF08,$FF06,$FF05,$FF04,$FF03,$FF02,$FF01,$FF01,$FF00,$FF00
dw $FF00,$FF00,$FF00,$FF01,$FF01,$FF02,$FF03,$FF04,$FF05,$FF06,$FF08,$FF09,$FF0B,$FF0D,$FF0F,$FF11
dw $FF13,$FF16,$FF19,$FF1B,$FF1E,$FF21,$FF24,$FF28,$FF2B,$FF2F,$FF32,$FF36,$FF3A,$FF3E,$FF42,$FF47
dw $FF4B,$FF4F,$FF54,$FF59,$FF5E,$FF63,$FF68,$FF6D,$FF72,$FF77,$FF7C,$FF82,$FF87,$FF8D,$FF93,$FF98
dw $FF9E,$FFA4,$FFAA,$FFB0,$FFB6,$FFBC,$FFC2,$FFC8,$FFCE,$FFD4,$FFDA,$FFE1,$FFE7,$FFED,$FFF3,$FFFA
dw $0000,$0006,$000D,$0013,$0019,$001F,$0026,$002C,$0032,$0038,$003E,$0044,$004A,$0050,$0056,$005C
dw $0062,$0068,$006D,$0073,$0079,$007E,$0084,$0089,$008E,$0093,$0098,$009D,$00A2,$00A7,$00AC,$00B1
dw $00B5,$00B9,$00BE,$00C2,$00C6,$00CA,$00CE,$00D1,$00D5,$00D8,$00DC,$00DF,$00E2,$00E5,$00E7,$00EA
dw $00ED,$00EF,$00F1,$00F3,$00F5,$00F7,$00F8,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF,$00FF,$0100,$0100
|
Rings/Divisible/Lemmas.agda | Smaug123/agdaproofs | 4 | 8365 | {-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Setoids.Setoids
open import Functions.Definition
open import Sets.EquivalenceRelations
open import Rings.Definition
module Rings.Divisible.Lemmas {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} (R : Ring S _+_ _*_) where
open Setoid S
open Equivalence eq
open Ring R
open import Rings.Divisible.Definition R
open import Rings.Units.Definition R
divisionTransitive : (x y z : A) → x ∣ y → y ∣ z → x ∣ z
divisionTransitive x y z (a , pr) (b , pr2) = (a * b) , transitive (transitive *Associative (*WellDefined pr reflexive)) pr2
divisionReflexive : (x : A) → x ∣ x
divisionReflexive x = 1R , transitive *Commutative identIsIdent
everythingDividesZero : (r : A) → r ∣ 0R
everythingDividesZero r = 0R , timesZero
nonzeroInherits : {x y : A} (nz : (x ∼ 0R) → False) → y ∣ x → (y ∼ 0R) → False
nonzeroInherits {x} {y} nz (c , pr) y=0 = nz (transitive (symmetric pr) (transitive (*WellDefined y=0 reflexive) (transitive *Commutative timesZero)))
nonunitInherits : {x y : A} (nonunit : Unit x → False) → x ∣ y → Unit y → False
nonunitInherits nu (s , pr) (a , b) = nu ((s * a) , transitive (transitive *Associative (*WellDefined pr reflexive)) b)
|
oeis/008/A008472.asm | neoneye/loda-programs | 11 | 242092 | ; A008472: Sum of the distinct primes dividing n.
; Submitted by <NAME>(w1)
; 0,2,3,2,5,5,7,2,3,7,11,5,13,9,8,2,17,5,19,7,10,13,23,5,5,15,3,9,29,10,31,2,14,19,12,5,37,21,16,7,41,12,43,13,8,25,47,5,7,7,20,15,53,5,16,9,22,31,59,10,61,33,10,2,18,16,67,19,26,14,71,5,73,39,8,21,18,18,79,7,3,43,83,12,22,45,32,13,89,10,20,25,34,49,24,5,97,9,14,7
add $0,1
mov $2,2
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mod $4,$2
add $2,1
cmp $4,0
cmp $4,0
sub $3,$4
lpe
lpb $0
dif $0,$2
lpe
add $1,$2
lpe
mov $0,$1
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ca/ca5006a.ada | best08618/asylo | 7 | 3464 | <gh_stars>1-10
-- CA5006A.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 A PROGRAM IS NOT REJECTED JUST BECAUSE THERE IS NO WAY TO
-- ELABORATE SECONDARY UNITS SO PROGRAM_ERROR WILL BE AVOIDED.
-- R.WILLIAMS 9/22/86
-----------------------------------------------------------------------
PACKAGE CA5006A0 IS
FUNCTION P_E_RAISED RETURN BOOLEAN;
PROCEDURE SHOW_PE_RAISED;
END CA5006A0;
-----------------------------------------------------------------------
WITH REPORT; USE REPORT;
PRAGMA ELABORATE (REPORT);
PACKAGE BODY CA5006A0 IS
RAISED : BOOLEAN := FALSE;
FUNCTION P_E_RAISED RETURN BOOLEAN IS
BEGIN
RETURN RAISED;
END P_E_RAISED;
PROCEDURE SHOW_PE_RAISED IS
BEGIN
RAISED := TRUE;
END SHOW_PE_RAISED;
BEGIN
TEST ( "CA5006A", "CHECK THAT A PROGRAM IS NOT REJECTED JUST " &
"BECAUSE THERE IS NO WAY TO ELABORATE " &
"SECONDARY UNITS SO PROGRAM_ERROR WILL BE " &
"AVOIDED" );
END CA5006A0;
-----------------------------------------------------------------------
PACKAGE CA5006A1 IS
FUNCTION F RETURN INTEGER;
END CA5006A1;
-----------------------------------------------------------------------
PACKAGE CA5006A2 IS
FUNCTION G RETURN INTEGER;
END CA5006A2;
-----------------------------------------------------------------------
WITH REPORT; USE REPORT;
WITH CA5006A0; USE CA5006A0;
WITH CA5006A2; USE CA5006A2;
PRAGMA ELABORATE(CA5006A0);
PACKAGE BODY CA5006A1 IS
X : INTEGER;
FUNCTION F RETURN INTEGER IS
BEGIN
RETURN IDENT_INT(0);
END F;
BEGIN
X := G;
IF NOT P_E_RAISED THEN
FAILED ( "G CALLED" );
END IF;
EXCEPTION
WHEN PROGRAM_ERROR =>
COMMENT ( "PROGRAM_ERROR RAISED IN CA5006A1" );
SHOW_PE_RAISED;
WHEN OTHERS =>
FAILED ( "OTHER ERROR RAISED IN CA5006A1" );
END CA5006A1;
-----------------------------------------------------------------------
WITH REPORT; USE REPORT;
WITH CA5006A0; USE CA5006A0;
WITH CA5006A1; USE CA5006A1;
PRAGMA ELABORATE(CA5006A0);
PACKAGE BODY CA5006A2 IS
X : INTEGER;
FUNCTION G RETURN INTEGER IS
BEGIN
RETURN IDENT_INT(1);
END G;
BEGIN
X := F;
IF NOT P_E_RAISED THEN
FAILED ( "F CALLED" );
END IF;
EXCEPTION
WHEN PROGRAM_ERROR =>
COMMENT ( "PROGRAM_ERROR RAISED IN CA5006A2" );
SHOW_PE_RAISED;
WHEN OTHERS =>
FAILED ( "OTHER ERROR RAISED IN CA5006A2" );
END CA5006A2;
-----------------------------------------------------------------------
WITH REPORT; USE REPORT;
WITH CA5006A0; USE CA5006A0;
WITH CA5006A1;
WITH CA5006A2;
PROCEDURE CA5006A IS
BEGIN
IF NOT P_E_RAISED THEN
FAILED ( "PROGRAM_ERROR NEVER RAISED" );
END IF;
RESULT;
END CA5006A;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.