max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
oeis/091/A091630.asm
neoneye/loda-programs
11
240944
<reponame>neoneye/loda-programs ; A091630: Numbers n + product of digits associated with A091628. ; Submitted by <NAME> ; 29,235,2247,22271,222319,2222415,22222607,222222991,2222223759,22222225295,222222228367,2222222234511,22222222246799,222222222271375,2222222222320527,22222222222418831,222222222222615439 add $0,1 mov $1,5 mov $2,1 lpb $0 sub $0,1 mul $2,10 sub $2,1 add $1,$2 mul $1,2 lpe mov $0,$1 add $0,1
oeis/349/A349853.asm
neoneye/loda-programs
11
26875
; A349853: Expansion of Sum_{k>=0} k^2 * x^k/(1 + k * x). ; Submitted by <NAME> ; 0,1,3,2,4,11,-13,36,56,-515,2067,-3890,-9620,129047,-664349,1837920,2388704,-67004679,478198563,-1994889926,1669470804,56929813955,-615188040173,3794477505596,-12028579019512,-50780206473195,1172949397924211,-10766410530764090 add $0,1 lpb $0 sub $2,1 mov $3,$2 pow $3,$0 sub $0,1 add $1,1 add $1,$3 lpe mov $0,$1
programs/oeis/168/A168520.asm
neoneye/loda
22
96207
; A168520: a(n) = 98*a(n-1) - a(n-2); a(1) = 0, a(2) = 10. ; 0,10,980,96030,9409960,922080050,90354434940,8853812544070,867583274883920,85014307126080090,8330534515080964900,816307368170808480110,79989791546224150085880,7838183264161795899936130,768061970096309774043654860,75262234886174196060378240150,7374930956874974904143023879840,722667971538861366409955961984170,70814086279851538933271541250568820 mul $0,2 seq $0,122653 ; a(n) = 10*a(n-1) - a(n-2) with a(0)=0, a(1)=6. div $0,6
notes/FOT/FOTC/Program/GCD/Total/CommutativeI.agda
asr/fotc
11
7594
------------------------------------------------------------------------------ -- The gcd is commutative ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOT.FOTC.Program.GCD.Total.CommutativeI where open import Common.FOL.Relation.Binary.EqReasoning open import FOTC.Base open import FOTC.Data.Nat open import FOTC.Data.Nat.Induction.NonAcc.LexicographicI open import FOTC.Data.Nat.Inequalities open import FOTC.Data.Nat.Inequalities.EliminationPropertiesI open import FOTC.Data.Nat.Inequalities.PropertiesI open import FOTC.Data.Nat.PropertiesI open import FOTC.Program.GCD.Total.ConversionRulesI open import FOTC.Program.GCD.Total.GCD ------------------------------------------------------------------------------ -- Informal proof: -- 1. gcd 0 n = n -- gcd def -- = gcd n 0 -- gcd def -- 2. gcd n 0 = n -- gcd def -- = gcd 0 n -- gcd def -- 3.1. Case: S m > S n -- gcd (S m) (S n) = gcd (S m - S n) (S n) -- gcd def -- = gcd (S n) (S m - S n) -- IH -- = gcd (S n) (S m) -- gcd def -- 3.2. Case: S m ≮ S n -- gcd (S m) (S n) = gcd (S m) (S n - S m) -- gcd def -- = gcd (S n - S m) (S m) -- IH -- = gcd (S n) (S m) -- gcd def ------------------------------------------------------------------------------ -- Commutativity property. Comm : D → D → Set Comm t t' = gcd t t' ≡ gcd t' t {-# ATP definition Comm #-} x>y→y≯x : ∀ {m n} → N m → N n → m > n → n ≯ m x>y→y≯x nzero Nn 0>n = ⊥-elim (0>x→⊥ Nn 0>n) {-# CATCHALL #-} x>y→y≯x Nm nzero _ = 0≯x Nm x>y→y≯x (nsucc {m} Nm) (nsucc {n} Nn) Sm>Sn = trans (lt-SS m n) (x>y→y≯x Nm Nn (trans (sym (lt-SS n m)) Sm>Sn)) postulate x≯Sy→Sy>x : ∀ {m n} → N m → N n → m ≯ succ₁ n → succ₁ n > m -- x≯Sy→Sy>x {n = n} nzero Nn _ = <-0S n -- x≯Sy→Sy>x {n = n} (nsucc {m} Nm) Nn h = {!!} ------------------------------------------------------------------------------ -- gcd 0 0 is commutative. gcd-00-comm : Comm zero zero gcd-00-comm = refl ------------------------------------------------------------------------------ -- gcd (succ₁ n) 0 is commutative. gcd-S0-comm : ∀ n → Comm (succ₁ n) zero gcd-S0-comm n = trans (gcd-S0 n) (sym (gcd-0S n)) ------------------------------------------------------------------------------ -- gcd (succ₁ m) (succ₁ n) when succ₁ m > succ₁ n is commutative. gcd-S>S-comm : ∀ {m n} → N m → N n → Comm (succ₁ m ∸ succ₁ n) (succ₁ n) → succ₁ m > succ₁ n → Comm (succ₁ m) (succ₁ n) gcd-S>S-comm {m} {n} Nm Nn ih Sm>Sn = gcd (succ₁ m) (succ₁ n) ≡⟨ gcd-S>S m n Sm>Sn ⟩ gcd (succ₁ m ∸ succ₁ n) (succ₁ n) ≡⟨ ih ⟩ gcd (succ₁ n) (succ₁ m ∸ succ₁ n) ≡⟨ sym (gcd-S≯S n m (x>y→y≯x (nsucc Nm) (nsucc Nn) Sm>Sn)) ⟩ gcd (succ₁ n) (succ₁ m) ∎ ------------------------------------------------------------------------------ -- gcd (succ₁ m) (succ₁ n) when succ₁ m ≯ succ₁ n is commutative. gcd-S≯S-comm : ∀ {m n} → N m → N n → Comm (succ₁ m) (succ₁ n ∸ succ₁ m) → succ₁ m ≯ succ₁ n → Comm (succ₁ m) (succ₁ n) gcd-S≯S-comm {m} {n} Nm Nn ih Sm≯Sn = gcd (succ₁ m) (succ₁ n) ≡⟨ gcd-S≯S m n Sm≯Sn ⟩ gcd (succ₁ m) (succ₁ n ∸ succ₁ m) ≡⟨ ih ⟩ gcd (succ₁ n ∸ succ₁ m) (succ₁ m) ≡⟨ sym (gcd-S>S n m (x≯Sy→Sy>x (nsucc Nm) Nn Sm≯Sn)) ⟩ gcd (succ₁ n) (succ₁ m) ∎ ------------------------------------------------------------------------------ -- gcd m n when m > n is commutative. gcd-x>y-comm : ∀ {m n} → N m → N n → (∀ {o p} → N o → N p → Lexi o p m n → Comm o p) → m > n → Comm m n gcd-x>y-comm nzero Nn _ 0>n = ⊥-elim (0>x→⊥ Nn 0>n) gcd-x>y-comm (nsucc {n} _) nzero _ _ = gcd-S0-comm n gcd-x>y-comm (nsucc {m} Nm) (nsucc {n} Nn) ah Sm>Sn = gcd-S>S-comm Nm Nn ih Sm>Sn where -- Inductive hypothesis. ih : Comm (succ₁ m ∸ succ₁ n) (succ₁ n) ih = ah {succ₁ m ∸ succ₁ n} {succ₁ n} (∸-N (nsucc Nm) (nsucc Nn)) (nsucc Nn) ([Sx∸Sy,Sy]<[Sx,Sy] Nm Nn) ------------------------------------------------------------------------------ -- gcd m n when m ≯ n is commutative. gcd-x≯y-comm : ∀ {m n} → N m → N n → (∀ {o p} → N o → N p → Lexi o p m n → Comm o p) → m ≯ n → Comm m n gcd-x≯y-comm nzero nzero _ _ = gcd-00-comm gcd-x≯y-comm nzero (nsucc {n} _) _ _ = sym (gcd-S0-comm n) gcd-x≯y-comm (nsucc _) nzero _ Sm≯0 = ⊥-elim (S≯0→⊥ Sm≯0) gcd-x≯y-comm (nsucc {m} Nm) (nsucc {n} Nn) ah Sm≯Sn = gcd-S≯S-comm Nm Nn ih Sm≯Sn where -- Inductive hypothesis. ih : Comm (succ₁ m) (succ₁ n ∸ succ₁ m) ih = ah {succ₁ m} {succ₁ n ∸ succ₁ m} (nsucc Nm) (∸-N (nsucc Nn) (nsucc Nm)) ([Sx,Sy∸Sx]<[Sx,Sy] Nm Nn) ------------------------------------------------------------------------------ -- gcd is commutative. gcd-comm : ∀ {m n} → N m → N n → Comm m n gcd-comm = Lexi-wfind A h where A : D → D → Set A i j = Comm i j h : ∀ {i j} → N i → N j → (∀ {k l} → N k → N l → Lexi k l i j → A k l) → A i j h Ni Nj ah = case (gcd-x>y-comm Ni Nj ah) (gcd-x≯y-comm Ni Nj ah) (x>y∨x≯y Ni Nj)
oeis/131/A131658.asm
neoneye/loda-programs
11
174295
; A131658: For n >= 1, put A_n(z) = Sum_{j>=0} (n*j)!/(j!^n) * z^j and B_n(z) = Sum_{j>=0} (n*j)!/(j!^n) * z^j * (Sum__{k=j+1..j*n} (1/k)), and let u(n) be the largest integer for which exp(B_n(z)/(u(n)*A_n(z))) has integral coefficients. The sequence is u(n). ; Submitted by <NAME> ; 1,1,1,2,2,36,36,144,144,1440,1440,17280,17280,241920,3628800,29030400,29030400,1567641600,1567641600,156764160000,49380710400000,217275125760000,1086375628800000,1738201006080000,1738201006080000,45193226158080000,135579678474240000,3796230997278720000,3796230997278720000,113886929918361600000,113886929918361600000,1822190878693785600000,661455288965844172800000,22489479824838701875200000,787131793869354565632000000,28336744579296764362752000000,28336744579296764362752000000 mov $1,1 lpb $0 mov $2,$0 add $3,$1 mul $3,$0 sub $0,1 add $2,1 mul $1,$2 lpe pow $1,2 gcd $3,$1 mov $0,$3
oeis/017/A017134.asm
neoneye/loda-programs
11
103556
; A017134: a(n) = (8*n + 5)^10. ; 9765625,137858491849,16679880978201,420707233300201,4808584372417849,34050628916015625,174887470365513049,713342911662882601,2446194060654759801,7326680472586200649,19687440434072265625,48398230717929318249,110462212541120451001,236736367459211723401,480682838924478847449,931322574615478515625,1731874467807835667449,3105926159393528563401,5393400662063408511001,9099059901039401398249,14956826027973134765625,24013807852610947920649,37738596846955704499801,58159148805327867842601 mul $0,8 add $0,5 pow $0,10
LAB9/q2.asm
Avigdor-Kolonimus/ASM
0
14350
EX2DS SEGMENT is2pow DB ? ; 1- is pow, 0-is not pow NUM DW 8192 EX2DS ENDS sseg segment stack dw 100h dup(?) sseg ends cseg segment assume ds:EX2DS,cs:cseg,ss:sseg start: mov ax,EX2DS mov ds,ax ;initialisation mov si,0 mov is2pow,0 mov cx,15 mov ax,NUM ;check bit number L2: shl ax,1 jc L1 loop L2 ;check that number is pow of 2 L1: cmp ax,0 jnz SOF mov is2pow,1 SOF: mov ah,4ch int 21h cseg ends end start
src/API/Theorems.agda
asr/alga
0
5928
module API.Theorems where open import Algebra open import Algebra.Theorems open import API open import Prelude open import Reasoning -- vertices [x] == vertex x vertices-vertex : ∀ {A} {x : A} -> vertices [ x ] ≡ vertex x vertices-vertex = +identity >> reflexivity -- edge x y == clique [x, y] edge-clique : ∀ {A} {x y : A} -> edge x y ≡ clique (x :: [ y ]) edge-clique = symmetry (R *right-identity) -- vertices xs ⊆ clique xs vertices-clique : ∀ {A} {xs : List A} -> vertices xs ⊆ clique xs vertices-clique {_} {[]} = ⊆reflexivity vertices-clique {a} {_ :: t} = ⊆transitivity (⊆right-monotony (vertices-clique {a} {t})) ⊆connect -- clique (xs ++ ys) == connect (clique xs) (clique ys) connect-clique : ∀ {A} {xs ys : List A} -> clique (xs ++ ys) ≡ connect (clique xs) (clique ys) connect-clique {_} {[]} = symmetry *left-identity connect-clique {a} {_ :: t} = R (connect-clique {a} {t}) >> *associativity
test/asset/agda-stdlib-1.0/Data/Product/Function/Dependent/Propositional/WithK.agda
omega12345/agda-mode
5
13488
<filename>test/asset/agda-stdlib-1.0/Data/Product/Function/Dependent/Propositional/WithK.agda<gh_stars>1-10 ------------------------------------------------------------------------ -- The Agda standard library -- -- Dependent product combinators for propositional equality -- preserving functions ------------------------------------------------------------------------ {-# OPTIONS --with-K --safe #-} module Data.Product.Function.Dependent.Propositional.WithK where open import Data.Product open import Data.Product.Function.Dependent.Setoid open import Data.Product.Relation.Binary.Pointwise.Dependent open import Data.Product.Relation.Binary.Pointwise.Dependent.WithK open import Function.Equality using (_⟨$⟩_) open import Function.Injection as Inj using (_↣_; module Injection) open import Function.Inverse as Inv using (_↔_; module Inverse) import Relation.Binary.HeterogeneousEquality as H ------------------------------------------------------------------------ -- Combinator for Injection module _ {a₁ a₂} {A₁ : Set a₁} {A₂ : Set a₂} {b₁ b₂} {B₁ : A₁ → Set b₁} {B₂ : A₂ → Set b₂} where ↣ : ∀ (A₁↣A₂ : A₁ ↣ A₂) → (∀ {x} → B₁ x ↣ B₂ (Injection.to A₁↣A₂ ⟨$⟩ x)) → Σ A₁ B₁ ↣ Σ A₂ B₂ ↣ A₁↣A₂ B₁↣B₂ = Inverse.injection Pointwise-≡↔≡ ⟨∘⟩ injection (H.indexedSetoid B₂) A₁↣A₂ (Inverse.injection (H.≡↔≅ B₂) ⟨∘⟩ B₁↣B₂ ⟨∘⟩ Inverse.injection (Inv.sym (H.≡↔≅ B₁))) ⟨∘⟩ Inverse.injection (Inv.sym Pointwise-≡↔≡) where open Inj using () renaming (_∘_ to _⟨∘⟩_)
example_relationships/src/log.ads
cortlandstarrett/mcada
0
26897
<filename>example_relationships/src/log.ads --************************************************************************************* --* UNCLASSIFIED --* IN STRICT CONFIDENCE * --* * --************************************************************************************* --* This is an unpublished work created on the date(s) shown, any copyright in * --* which vests in BAE SYSTEMS. All rights reserved. * --* * --* The information contained in this document/record is proprietary to * --* BAE SYSTEMS unless stated otherwise and is made available in confidence; it * --* must not be used or disclosed without our express written permission. This * --* document/record may not be copied in whole or in part in any form without * --* the express written consent of BAE SYSTEMS, which may be given by contract. * --* This drawing is a design document for the purposes of the Copyright, * --* Designs and Patents Act 1988. * --* * --* Public Access: Freedom Of Information Act 2000, etc. * --* * --* This document contains commercially-sensitive trade secrets as of the date * --* provided to the original recipient by BAE SYSTEMS and is provided in * --* confidence. Following a request for this information public authorities * --* should consult with BAE SYSTEMS regarding the current releasability of the * --* information prior to the decision to release all or part of this document, * --* and in any event are to notify BAE SYSTEMS prior to any release. Release of * --* this information by a public authority may constitute an actionable breach * --* of confidence. * --* * --************************************************************************************* --* * --* Prepared by BAE SYSTEMS under Contract Number TORPC/01119 dated April 2010. * --* Restrictions on reproduction and use are subject to the terms of DEFCON 91 * --* (Edn. 11/06) as applicable, and other terms under the Contract. * --* * --************************************************************************************* --* * --* File Name: log.ads --* Drawing Number: Refer to release documentation * --* Version: As detailed by ClearCase * --* Version Date: As detailed by ClearCase * --* Creation Date: As detailed by ClearCase * --* Author: Tactical Software Team * --* Maintained by: Tactical Software Team * --* Division: Torpedoes Business Stream * --* Project: SFU (Spearfish Upgrade) * --* ClearCase VOB: Refer to release documentation * --* Section/Unit: Refer to release documentation * --* Description: --* Log package specification for debugging purposes --* Comments: Header written by header.macro * --* --* * --************************************************************************************* --* SUPPLEMENTAL INFORMATION * --* ------------------------ * --* OVERVIEW * --* -------- * --* Target specific exception handling --* --* ERROR HANDLING * --* -------------- * --* * --* SAFETY : None * --* ------ * --* * --* BUILD INFORMATION * --* ----------------- * --* * --* Build Target : Dos --* Clock Type : INTERNAL --* Debugging is : Off --* Trace is : Off --* * --* --* --* --* --* --************************************************************************************* --* COMPONENTS CONTAINED WITHIN THIS FILE * --* --************************************************************************************* -- MODIFICATION RECORD -- -------------------- -- NAME DATE ECR No MODIFICATION -- -- DB 28-03-02 - Added this file to allow log to be generated -- for single domain builds also. -- ANF 04/07/06 001798 9SR056 Archetype language reformatted -- -- ************************************************************************************** package Log is procedure Initialise(File_Name: in string); pragma inline (Initialise); procedure Put_Line (Dump_String: in string); pragma inline (Put_Line); procedure Put (Dump_String: in string); pragma inline (Put); procedure Put_Line (Dump_Integer: in integer); pragma inline (Put_Line); procedure Put (Dump_Integer: in integer); pragma inline (Put); procedure Put_Line (Dump_Float: in float); pragma inline (Put_Line); procedure Put (Dump_Float: in float); pragma inline (Put); procedure Put (Dump_Boolean: in boolean); pragma inline (Put); procedure Put (Dump_Duration: in duration); pragma inline (Put); procedure New_Line; pragma inline (New_Line); procedure Close; pragma inline (Close); end Log;
src/GBA.BIOS.ads
98devin/ada-gba-dev
7
28591
-- Copyright (c) 2021 <NAME> -- zlib License -- see LICENSE for details. with Interfaces; use Interfaces; with GBA.Numerics; use GBA.Numerics; package GBA.BIOS is pragma Preelaborate; type System_Call is ( Soft_Reset -- , Register_RAM_Reset -- , Halt -- , Stop -- , Intr_Wait -- , VBlank_Intr_Wait -- , Div -- , Div_Arm -- , Sqrt -- , Arc_Tan -- , Arc_Tan2 -- , Cpu_Set -- , Cpu_Fast_Set -- , Get_Bios_Checksum -- , Affine_Set_Ext , Obj_Affine_Set , Bit_Unpack , LZ77_Uncomp_Write8 -- for WRAM , LZ77_Uncomp_Write16 -- for VRAM , Huff_Uncomp , RL_Uncomp_Write8 -- for WRAM , RL_Uncomp_Write16 -- for VRAM , Diff_8_Unfilter_Write8 -- for WRAM , Diff_8_Unfilter_Write16 -- for VRAM , Diff_16_Unfilter , Sound_Bias , Sound_Driver_Init , Sound_Driver_Mode , Sound_Driver_Main , Sound_Driver_VSync , Sound_Channel_Clear , Midi_Key_To_Freq , Sound_Whatever0 , Sound_Whatever1 , Sound_Whatever2 , Sound_Whatever3 , Sound_Whatever4 , Multi_Boot , Hard_Reset -- , Sound_Driver_VSync_Off , Sound_Driver_VSync_On , Sound_Get_Jump_List ); for System_Call use ( Soft_Reset => 16#00# , Register_RAM_Reset => 16#01# , Halt => 16#02# , Stop => 16#03# , Intr_Wait => 16#04# , VBlank_Intr_Wait => 16#05# , Div => 16#06# , Div_Arm => 16#07# , Sqrt => 16#08# , Arc_Tan => 16#09# , Arc_Tan2 => 16#0A# , Cpu_Set => 16#0B# , Cpu_Fast_Set => 16#0C# , Get_Bios_Checksum => 16#0D# , Affine_Set_Ext => 16#0E# , Obj_Affine_Set => 16#0F# , Bit_Unpack => 16#10# , LZ77_Uncomp_Write8 => 16#11# , LZ77_Uncomp_Write16 => 16#12# , Huff_Uncomp => 16#13# , RL_Uncomp_Write8 => 16#14# , RL_Uncomp_Write16 => 16#15# , Diff_8_Unfilter_Write8 => 16#16# , Diff_8_Unfilter_Write16 => 16#17# , Diff_16_Unfilter => 16#18# , Sound_Bias => 16#19# , Sound_Driver_Init => 16#1A# , Sound_Driver_Mode => 16#1B# , Sound_Driver_Main => 16#1C# , Sound_Driver_VSync => 16#1D# , Sound_Channel_Clear => 16#1E# , Midi_Key_To_Freq => 16#1F# , Sound_Whatever0 => 16#20# , Sound_Whatever1 => 16#21# , Sound_Whatever2 => 16#22# , Sound_Whatever3 => 16#23# , Sound_Whatever4 => 16#24# , Multi_Boot => 16#25# , Hard_Reset => 16#26# , Sound_Driver_VSync_Off => 16#28# , Sound_Driver_VSync_On => 16#29# , Sound_Get_Jump_List => 16#2A# ); type Register_RAM_Reset_Flags is record Clear_External_WRAM : Boolean := False; Clear_Internal_WRAM : Boolean := False; Clear_Palette : Boolean := False; Clear_VRAM : Boolean := False; Clear_OAM : Boolean := False; Reset_SIO_Registers : Boolean := False; Reset_Sound_Registers : Boolean := False; Reset_Other_Registers : Boolean := False; end record with Size => 8; for Register_RAM_Reset_Flags use record Clear_External_WRAM at 0 range 0..0; Clear_Internal_WRAM at 0 range 1..1; Clear_Palette at 0 range 2..2; Clear_VRAM at 0 range 3..3; Clear_OAM at 0 range 4..4; Reset_SIO_Registers at 0 range 5..5; Reset_Sound_Registers at 0 range 6..6; Reset_Other_Registers at 0 range 7..7; end record; type Cpu_Set_Mode is ( Copy, Fill ); for Cpu_Set_Mode use ( Copy => 0, Fill => 1 ); type Cpu_Set_Unit_Size is ( Half_Word, Word ); for Cpu_Set_Unit_Size use ( Half_Word => 0, Word => 1 ); type Cpu_Set_Unit_Count is mod 2**21 with Object_Size => 32; type Cpu_Set_Config is record Unit_Count : Cpu_Set_Unit_Count; Copy_Mode : Cpu_Set_Mode; Unit_Size : Cpu_Set_Unit_Size; end record with Size => 32; for Cpu_Set_Config use record Unit_Count at 0 range 0 .. 20; Copy_Mode at 0 range 24 .. 24; Unit_Size at 0 range 26 .. 26; end record; type Affine_Parameters is record Scale_X, Scale_Y : Fixed_8_8; Angle : Radians_16; end record with Alignment => 4; for Affine_Parameters use record Scale_X at 0 range 0 .. 15; Scale_Y at 2 range 0 .. 15; Angle at 4 range 0 .. 15; end record; type Affine_Parameters_Ptr is access all Affine_Parameters with Storage_Size => 0; type Affine_Parameters_Ext is record Texture_X, Texture_Y : Fixed_20_8; Screen_X, Screen_Y : Integer_16; Scale_X, Scale_Y : Fixed_8_8; Angle : Radians_16; end record with Alignment => 4; for Affine_Parameters_Ext use record Texture_X at 0 range 0 .. 31; Texture_Y at 4 range 0 .. 31; Screen_X at 8 range 0 .. 15; Screen_Y at 10 range 0 .. 15; Scale_X at 12 range 0 .. 15; Scale_Y at 14 range 0 .. 15; Angle at 16 range 0 .. 15; end record; end GBA.BIOS;
um.asm
tekknolagi/customasm-um
0
82522
#bits 32 #subruledef register { r{num} => num`3 } #subruledef threereg_instruction { cmov => 0 load => 1 store => 2 add => 3 mul => 4 div => 5 nand => 6 } #subruledef tworeg_instruction { map => 8 loadp => 12 } #subruledef onereg_instruction { unmap => 9 out => 10 in => 11 } #subruledef noreg_instruction { halt => 7 } #ruledef um { {i:threereg_instruction} {a:register}, {b:register}, {c:register} => i`4 @ 0`19 @ a`3 @ b`3 @ c`3 {i:tworeg_instruction} {b:register}, {c:register} => i`4 @ 0`22 @ b`3 @ c`3 {i:onereg_instruction} {c:register} => i`4 @ 0`25 @ c`3 {i:noreg_instruction} => i`4 @ 0`28 loadi {a:register}, {val:u25} => 13`4 @ a`3 @ val }
ffight/lcs/boss/1C.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
81275
copyright zengfr site:http://github.com/zengfr/romhack 002F84 move.w D1, ($18,A6) [boss+1C, enemy+1C] 03D420 move.w D1, ($1a,A6) [boss+1C] copyright zengfr site:http://github.com/zengfr/romhack
Cubical/HITs/TypeQuotients/Properties.agda
Edlyr/cubical
0
6755
<filename>Cubical/HITs/TypeQuotients/Properties.agda {- Type quotients: -} {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.HITs.TypeQuotients.Properties where open import Cubical.HITs.TypeQuotients.Base open import Cubical.Core.Everything open import Cubical.Foundations.Prelude open import Cubical.Foundations.Function open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Equiv open import Cubical.Foundations.HLevels open import Cubical.HITs.PropositionalTruncation as PropTrunc using (∥_∥ ; ∣_∣ ; squash) open import Cubical.HITs.SetTruncation as SetTrunc using (∥_∥₂ ; ∣_∣₂ ; squash₂ ; setTruncIsSet) private variable ℓ ℓ' ℓ'' : Level A : Type ℓ R : A → A → Type ℓ' B : A /ₜ R → Type ℓ'' C : A /ₜ R → A /ₜ R → Type ℓ'' elim : (f : (a : A) → (B [ a ])) → ((a b : A) (r : R a b) → PathP (λ i → B (eq/ a b r i)) (f a) (f b)) ------------------------------------------------------------------------ → (x : A /ₜ R) → B x elim f feq [ a ] = f a elim f feq (eq/ a b r i) = feq a b r i rec : {X : Type ℓ''} → (f : A → X) → (∀ (a b : A) → R a b → f a ≡ f b) ------------------------------------- → A /ₜ R → X rec f feq [ a ] = f a rec f feq (eq/ a b r i) = feq a b r i elimProp : ((x : A /ₜ R ) → isProp (B x)) → ((a : A) → B ( [ a ])) --------------------------------- → (x : A /ₜ R) → B x elimProp Bprop f [ a ] = f a elimProp Bprop f (eq/ a b r i) = isOfHLevel→isOfHLevelDep 1 Bprop (f a) (f b) (eq/ a b r) i elimProp2 : ((x y : A /ₜ R ) → isProp (C x y)) → ((a b : A) → C [ a ] [ b ]) -------------------------------------- → (x y : A /ₜ R) → C x y elimProp2 Cprop f = elimProp (λ x → isPropΠ (λ y → Cprop x y)) (λ x → elimProp (λ y → Cprop [ x ] y) (f x))
Library/Breadbox/ImpGraph/ASMIMP/asmimpManager.asm
steakknife/pcgeos
504
161634
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Breadbox Computer Company 1997 -- All Rights Reserved PROJECT: BW QuickCam Application FILE: manager.asm AUTHOR: <NAME>, Jul 8, 1997 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- FR 07/08/97 Initial revision DESCRIPTION: These are assembly procedures for geting frames of different size and deap in the fastest. To get the fastest way for every transfer mode there is an different procedure! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;============================================================================ ; INCLUDES ;============================================================================ include stdapp.def include product.def include iimpgif.def include bitmap.def include hugearr.def SetGeosConvention include impgif.asm global _set_error_handler:far include Internal/heapInt.def ErrorHandlerContext struct EHC_ss word EHC_ds word EHC_es word EHC_di word EHC_si word EHC_cs word EHC_ip word EHC_sp word EHC_bp word EHC_stackBot word ErrorHandlerContext ends idata segment SetDefaultConvention _set_error_handler proc far errorContextP:fptr.word uses es, di .enter mov ax, size ErrorHandlerContext mov cx, ALLOC_DYNAMIC_LOCK call MemAlloc tst bx jz returnMem mov cx, es ; original ES mov es, ax clr ax mov es:[EHC_ss], ss mov es:[EHC_ds], ds mov es:[EHC_es], cx mov es:[EHC_di], di mov es:[EHC_si], si mov ax, ss:[bp] ; caller's BP mov es:[EHC_bp], ax mov ax, ss:[bp]+2 ; return off mov es:[EHC_ip], ax mov ax, ss:[bp]+4 ; return seg mov es:[EHC_cs], ax mov ax, bp add ax, 2 ; SP to return to caller mov es:[EHC_sp], ax mov ax, ss:[TPD_stackBot] mov es:[EHC_stackBot], ax call MemUnlock returnMem: mov es, errorContextP.segment mov di, errorContextP.offset mov es:[di], bx mov ax, 0 ; error handler set .leave ret _set_error_handler endp SetGeosConvention idata ends
programs/oeis/267/A267043.asm
neoneye/loda
22
3677
<reponame>neoneye/loda ; A267043: Middle column of the "Rule 91" elementary cellular automaton starting with a single ON (black) cell. ; 1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 mov $1,$0 mod $0,2 cmp $1,2 cmp $0,$1
source/RASCAL-ToolboxQuit.adb
bracke/Meaning
0
8980
-------------------------------------------------------------------------------- -- -- -- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers. -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU Lesser General Public -- -- License as published by the Free Software Foundation; either -- -- version 2.1 of the License, or (at your option) any later version. -- -- -- -- This 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. See the GNU -- -- Lesser General Public License for more details. -- -- -- -- You should have received a copy of the GNU Lesser General Public -- -- License along with this library; if not, write to the Free Software -- -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- -------------------------------------------------------------------------------- -- $Author$ -- $Date$ -- $Revision$ with RASCAL.Memory; use RASCAL.Memory; with RASCAL.OS; use RASCAL.OS; with RASCAL.Utility; use RASCAL.Utility; with Kernel; use Kernel; with Reporter; package body RASCAL.ToolboxQuit is Toolbox_ObjectMiscOp : constant Interfaces.C.unsigned := 16#44EC6#; -- function Get_Window_ID (Quit : in Object_ID; Flags: in System.Unsigned_Types.Unsigned := 0) return Object_ID is Register : aliased Kernel.swi_regs; Error : OSError_Access; begin Register.R(0) := int(Unsigned_to_Int(Flags)); Register.R(1) := int(Quit); Register.R(2) := 0; Error := Kernel.SWI(Toolbox_ObjectMiscOp,Register'Access,Register'Access); if Error /= null then Pragma Debug(Reporter.Report("ToolboxQuit.Get_Window_ID: " & To_Ada(Error.ErrMess))); OS.Raise_Error(Error); return -1; end if; return Object_ID(Register.R(0)); end Get_Window_ID; -- function Get_Message (Quit : in Object_ID; Flags: in System.Unsigned_Types.Unsigned := 0) return string is Register : aliased Kernel.swi_regs; Error : OSError_Access; Buffer_Size : integer; begin Register.R(0) := int(Unsigned_to_Int(Flags)); Register.R(1) := int(Quit); Register.R(2) := 2; Register.R(3) := 0; Register.R(4) := 0; Error := Kernel.SWI(Toolbox_ObjectMiscOp,Register'Access,Register'Access); if Error /= null then Pragma Debug(Reporter.Report("ToolboxQuit.Get_Message: " & To_Ada(Error.ErrMess))); OS.Raise_Error(Error); return ""; end if; Buffer_Size := Integer (Register.R(4)); declare Buffer : String (1..Buffer_Size); begin Register.R(0) := int(Unsigned_to_Int(Flags)); Register.R(1) := int(Quit); Register.R(2) := 2; Register.R(3) := Adr_To_Int(Buffer'Address); Register.R(4) := int(Buffer_Size); Error := Kernel.SWI(Toolbox_ObjectMiscOp,Register'Access,Register'Access); if Error /= null then Pragma Debug(Reporter.Report("ToolboxQuit.Get_Message: " & To_Ada(Error.ErrMess))); OS.Raise_Error(Error); return ""; end if; return MemoryToString(Buffer'Address); end; end Get_Message; -- function Get_Title (Quit : in Object_ID; Flags: in System.Unsigned_Types.Unsigned := 0) return String is Register : aliased Kernel.swi_regs; Error : OSError_Access; Buffer_Size : Integer; begin Register.R(0) := int(Unsigned_to_Int(Flags)); Register.R(1) := int(Quit); Register.R(2) := 3; Register.R(3) := 0; Register.R(4) := 0; Error := Kernel.SWI(Toolbox_ObjectMiscOp,Register'Access,Register'Access); if Error /= null then Pragma Debug(Reporter.Report("ToolboxQuit.Get_Title: " & To_Ada(Error.ErrMess))); OS.Raise_Error(Error); return ""; end if; Buffer_Size := integer(Register.R(4)); declare Buffer : string(1..Buffer_Size); begin Register.R(0) := int(Unsigned_to_Int(Flags)); Register.R(1) := int(Quit); Register.R(2) := 3; Register.R(3) := Adr_To_Int(Buffer'Address); Register.R(4) := int(Buffer_Size); Error := Kernel.SWI(Toolbox_ObjectMiscOp,Register'Access,Register'Access); if Error /= null then Pragma Debug(Reporter.Report("ToolboxQuit.Get_Title: " & To_Ada(Error.ErrMess))); OS.Raise_Error(Error); return ""; end if; return MemoryToString(Buffer'Address); end; end Get_Title; -- procedure Set_Message (Quit : in Object_ID; Message : in String; Flags : in System.Unsigned_Types.Unsigned := 0) is Register : aliased Kernel.swi_regs; Error : OSError_Access; Null_Message : String := Message & ASCII.NUL; begin Register.R(0) := int(Unsigned_to_Int(Flags)); Register.R(1) := int(Quit); Register.R(2) := 1; Register.R(3) := Adr_To_Int(Null_Message'Address); Error := Kernel.SWI(Toolbox_ObjectMiscOp,Register'Access,Register'Access); if Error /= null then Pragma Debug(Reporter.Report("ToolboxQuit.Set_Message: " & To_Ada(Error.ErrMess))); OS.Raise_Error(Error); null; end if; end Set_Message; -- procedure Set_Title (Quit : in Object_ID; Title : in string; Flags : in System.Unsigned_Types.Unsigned := 0) is Register : aliased Kernel.swi_regs; Error : OSError_Access; Null_Title : String := Title & ASCII.NUL; begin Register.R(0) := int(Unsigned_to_Int(Flags)); Register.R(1) := int(Quit); Register.R(2) := 3; Register.R(3) := Adr_To_Int(Null_Title'Address); Error := Kernel.SWI(Toolbox_ObjectMiscOp,Register'Access,Register'Access); if Error /= null then Pragma Debug(Reporter.Report("ToolboxQuit.Set_Title: " & To_Ada(Error.ErrMess))); OS.Raise_Error(Error); end if; end Set_Title; -- end RASCAL.ToolboxQuit;
src/dynamo.adb
My-Colaborations/dynamo
15
21501
----------------------------------------------------------------------- -- dynamo -- Ada Code Generator -- Copyright (C) 2009, 2010, 2011, 2012, 2015, 2017, 2020 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with GNAT.Command_Line; use GNAT.Command_Line; with GNAT.Traceback.Symbolic; with Sax.Readers; with Ada.Text_IO; with Ada.Strings.Unbounded; with Ada.Exceptions; with Ada.Directories; with Ada.Command_Line; with Ada.Environment_Variables; with Util.Files; with Util.Log.Loggers; with Util.Systems.Os; with Util.Commands; with Gen.Utils.GNAT; with Gen.Generator; with Gen.Commands; with Gen.Configs; procedure Dynamo is use Ada; use Ada.Strings.Unbounded; use Ada.Directories; use Ada.Command_Line; use Gen.Commands; procedure Set_Config_Directory (Path : in String; Silent : in Boolean := False); procedure Print_Configuration (Generator : in Gen.Generator.Handler); -- Print environment variable setup procedure Print_Environment (Generator : in Gen.Generator.Handler; C_Env : in Boolean := False); function Get_Installation_Directory return String; Out_Dir : Unbounded_String; Config_Dir : Unbounded_String; Template_Dir : Unbounded_String; Status : Exit_Status := Success; Debug : Boolean := False; Print_Config : Boolean := False; Print_Env : Boolean := False; Print_CEnv : Boolean := False; First : Natural := 0; -- ------------------------------ -- Print information about dynamo configuration -- ------------------------------ procedure Print_Configuration (Generator : in Gen.Generator.Handler) is begin Ada.Text_IO.Put_Line ("Dynamo version : " & Gen.Configs.VERSION); Ada.Text_IO.Put_Line ("Config directory : " & Generator.Get_Config_Directory); Ada.Text_IO.Put_Line ("UML directory : " & Generator.Get_Parameter (Gen.Configs.GEN_UML_DIR)); Ada.Text_IO.Put_Line ("Templates directory : " & Generator.Get_Parameter (Gen.Configs.GEN_TEMPLATES_DIRS)); Ada.Text_IO.Put_Line ("GNAT project directory : " & Generator.Get_Parameter (Gen.Configs.GEN_GNAT_PROJECT_DIRS)); end Print_Configuration; -- ------------------------------ -- Print environment variable setup -- ------------------------------ procedure Print_Environment (Generator : in Gen.Generator.Handler; C_Env : in Boolean := False) is begin if C_Env then Ada.Text_IO.Put ("setenv " & Gen.Utils.GNAT.ADA_PROJECT_PATH_NAME & " """); else Ada.Text_IO.Put ("export " & Gen.Utils.GNAT.ADA_PROJECT_PATH_NAME & "="""); end if; if Ada.Environment_Variables.Exists (Gen.Utils.GNAT.ADA_PROJECT_PATH_NAME) then Ada.Text_IO.Put (Ada.Environment_Variables.Value (Gen.Utils.GNAT.ADA_PROJECT_PATH_NAME)); Ada.Text_IO.Put (Util.Systems.Os.Path_Separator); end if; Ada.Text_IO.Put_Line (Generator.Get_Parameter (Gen.Configs.GEN_GNAT_PROJECT_DIRS) & """"); end Print_Environment; -- ------------------------------ -- Verify and set the configuration path -- ------------------------------ procedure Set_Config_Directory (Path : in String; Silent : in Boolean := False) is Log_Path : constant String := Ada.Directories.Compose (Path, "log4j.properties"); begin -- Ignore if the config directory was already set. if Length (Config_Dir) > 0 then return; end if; -- Check that we can read some configuration file. if not Ada.Directories.Exists (Log_Path) then if not Silent then Ada.Text_IO.Put_Line ("Invalid config directory: " & Path); Status := Failure; end if; return; end if; -- Configure the logs Util.Log.Loggers.Initialize (Log_Path); Config_Dir := To_Unbounded_String (Path); end Set_Config_Directory; function Get_Installation_Directory return String is Name : constant String := Ada.Command_Line.Command_Name; Path : constant String := Ada.Directories.Containing_Directory (Name); begin if Path = "." then return "."; else return Ada.Directories.Containing_Directory (Path); end if; end Get_Installation_Directory; begin Initialize_Option_Scan (Stop_At_First_Non_Switch => True, Section_Delimiters => "targs"); -- Parse the command line loop case Getopt ("* v d e E o: t: c:") is when ASCII.NUL => exit; when 'o' => Out_Dir := To_Unbounded_String (Parameter & "/"); First := First + 1; when 't' => Template_Dir := To_Unbounded_String (Parameter & "/"); First := First + 1; when 'c' => Set_Config_Directory (Parameter); First := First + 1; when 'e' => Print_Env := True; when 'E' => Print_CEnv := True; when 'd' => Debug := True; when 'v' => Print_Config := True; when '*' => exit; when others => null; end case; First := First + 1; end loop; if Length (Config_Dir) = 0 then declare Dir : constant String := Get_Installation_Directory; begin Set_Config_Directory (Compose (Dir, "config"), True); Set_Config_Directory (Util.Files.Compose (Dir, "share/dynamo/base"), True); Set_Config_Directory (Gen.Configs.CONFIG_DIR, True); end; end if; if Status /= Success then Gen.Commands.Short_Help_Usage; Ada.Command_Line.Set_Exit_Status (Status); return; end if; if Ada.Command_Line.Argument_Count = 0 then Gen.Commands.Short_Help_Usage; Set_Exit_Status (Failure); return; end if; declare use type Gen.Commands.Command_Access; Args : Util.Commands.Default_Argument_List (First + 1); Cmd_Name : constant String := Full_Switch; Cmd : Gen.Commands.Command_Access; Generator : Gen.Generator.Handler; begin if Length (Out_Dir) > 0 then Gen.Generator.Set_Result_Directory (Generator, To_String (Out_Dir)); end if; if Length (Template_Dir) > 0 then Gen.Generator.Set_Template_Directory (Generator, Template_Dir); end if; Gen.Generator.Initialize (Generator, Config_Dir, Debug); if Print_Config then Print_Configuration (Generator); return; elsif Print_Env then Print_Environment (Generator, False); return; elsif Print_CEnv then Print_Environment (Generator, True); return; end if; Cmd := Gen.Commands.Driver.Find_Command (Cmd_Name); -- Check that the command exists. if Cmd = null then if Cmd_Name'Length > 0 then Ada.Text_IO.Put_Line ("Invalid command: '" & Cmd_Name & "'"); end if; Gen.Commands.Short_Help_Usage; Set_Exit_Status (Failure); return; end if; Cmd.Execute (Cmd_Name, Args, Generator); Ada.Command_Line.Set_Exit_Status (Gen.Generator.Get_Status (Generator)); end; exception when E : Invalid_Switch => Ada.Text_IO.Put_Line ("Invalid option: " & Ada.Exceptions.Exception_Message (E)); Gen.Commands.Short_Help_Usage; Ada.Command_Line.Set_Exit_Status (2); when E : Gen.Generator.Fatal_Error => Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Message (E)); Ada.Command_Line.Set_Exit_Status (1); when E : Sax.Readers.XML_Fatal_Error => Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Message (E)); Ada.Command_Line.Set_Exit_Status (1); when E : others => Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Message (E)); Ada.Text_IO.Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (E)); Ada.Command_Line.Set_Exit_Status (1); end Dynamo;
sycadas/src/main/antlr/org/genevaers/sycadas/grammar/GenevaERSLexer.g4
venkateshprasad123/wb
3
897
lexer grammar GenevaERSLexer; /* * Copyright Contributors to the GenevaERS Project. * (c) Copyright IBM Corporation 2020. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ //Keywords SOURCE: S O U R C E; DESTINATION: D E S T I N A T I O N; DEST: D E S T; PROCEDURE: P R O C E D U R E; PROC: P R O C; EXTRACT: E X T R A C T; EXT: E X T; FILE: F I L E; OR: O R; AND: A N D; LHS: L H S; NOT: N O T; REPEAT: R E P E A T; ALL: A L L; SELECT: S E L E C T; SELECTIF: S E L E C T I F; SKIPF: S K I P; SKIPIF: S K I P I F; COLUMN: C O L U M N; IF: I F; THEN: T H E N; ELSE: E L S E; ENDIF: E N D I F; LIKE: L I K E; MATCHES: M A T C H E S; CONTAINS: C O N T A I N S; BEGINS_WITH: B E G I N S '_' W I T H; ENDS_WITH: E N D S '_' W I T H; DAYSBETWEEN: D A Y S B E T W E E N; MONTHSBETWEEN: M O N T H S B E T W E E N; YEARSBETWEEN: Y E A R S B E T W E E N; NEWDATE: N E W D A T E; DATE: D A T E; // Date Codes CCYY: C C Y Y; CCYYDDD: C C Y Y D D D; CCYYMMDD: C C Y Y M M D D; MMDDCCYY: M M D D C C Y Y; MMDDYY: M M D D Y Y; CCYYMM: C C Y Y M M; DDMMYY: D D M M Y Y; DDMMCCYY: D D M M C C Y Y; DD: D D; MM: M M; MMDD: M M D D; YYDDD: Y Y D D D; YYMMDD: Y Y M M D D; YY: Y Y; // Date Function Codes RUNDAY: R U N D A Y; RUNMONTH: R U N M O N T H; RUNYEAR: R U N Y E A R; FISCALDAY: F I S C A L D A Y; FISCALMONTH: F I S C A L M O N T H ; FISCALYEAR: F I S C A L Y E A R; TIMESTAMP: T I M E S T A M P; BATCHDATE: B A T C H D A T E; // Is Function Codes ISSPACES: I S S P A C E S; ISNOTSPACES: I S N O T S P A C E S; ISNUMERIC: I S N U M E R I C; ISNOTNUMERIC: I S N O T N U M E R I C; ISNULL: I S N U L L; ISNOTNULL: I S N O T N U L L; ISFOUND: I S F O U N D; ISNOTFOUND: I S N O T F O U N D; // Field Prefixes CURRENT: C U R R E N T; PRIOR: P R I O R; // Write Function stuff WRITE: W R I T E; VIEW: V I E W; INPUT: I N P U T; DATA: D A T A; MOD: M O D; USEREXIT: U S E R E X I T; DEFAULT: D E F A U L T; // Data Type Codes ALPHA: 'ALPHA'; NODTF: 'NODTF'; K_BINARY: 'BINARY'; BCD: 'BCD'; EDITED: 'EDITED'; MASKED: 'MASKED'; PACKED: 'PACKED'; BINARY: 'SBINARY'; SPACKED: 'SPACKED'; SZONED: 'SZONED'; ZONED: 'ZONED'; // String function codes SUBSTR: S U B S T R; LEFT: L E F T; RIGHT: R I G H T; // These are internal rule things? LRFIELD_REF: 'LRFIELD_REF'; LP_REF: 'LP_REF'; LPFIELD_REF: 'LPFIELD_REF'; FILE_REF: 'FILE_REF'; PROC_REF: 'PROC_REF'; COLUMN_ASSIGN: 'COLUMN_ASSIGN'; COLREF_ASSIGN: 'COLREF_ASSIGN'; LPSOURCE_KEY: 'LPSOURCE_KEY'; SYMBOL_LIST: 'SYMBOL_LIST'; LONG_NUM: 'LONG_NUM'; // Separators COMMA: ','; SEMICOLON: ';'; LPAREN: '('; RPAREN: ')'; // Operators EQ: '='; NE: '<>'; GT: '>'; LT: '<'; GE: '>='; LE: '<='; PLUS: '+'; MINUS: '-'; MULT: '*'; DIV: '/'; CONCAT: '&'; //NL : '\n'; // Whitespace and Comments WS : [ \t\r\n]+ -> skip ; // Comments start with the single quote character ' and run to the end of a line // You can also put comment after a \ character (which means ignore the rest of this line // and continue parsing on the next line) SLCOMMENT : ( '\'' | '\\' ) ( ~('\n') )*; //Literals // NB there is no signed integer, instead there is a unary minus operator that can be applied to INTEGER FLOAT : DIGITS '.' DIGITS ; NUM : DIGITS ; STRING : '"' ( ~( '\t' | '\n' | '"' ) )* '"'; // No tabs or new lines in strings. SYMBIDENT : '$' ( '_' | LETTER | DIGITS )* ; EXP : '^' ; META_REF : LETTER+ (LETTER | DIGIT | '_')* ; CURLED_NAME : '{' META_REF '}' ; DOTTED_NAME : LETTER+ (LETTER | DIGIT | '_')* '.' LETTER+ (LETTER | DIGIT | '_')* ; COL_REF : C O L '.' (DIGIT)+ ; DIGITS : DIGIT+ ; fragment DIGIT : [0-9] ; fragment LETTER : [a-zA-Z] ; fragment A : [aA]; // match either an 'a' or 'A' fragment B : [bB]; fragment C : [cC]; fragment D : [dD]; fragment E : [eE]; fragment F : [fF]; fragment G : [gG]; fragment H : [hH]; fragment I : [iI]; fragment J : [jJ]; fragment K : [kK]; fragment L : [lL]; fragment M : [mM]; fragment N : [nN]; fragment O : [oO]; fragment P : [pP]; fragment Q : [qQ]; fragment R : [rR]; fragment S : [sS]; fragment T : [tT]; fragment U : [uU]; fragment V : [vV]; fragment W : [wW]; fragment X : [xX]; fragment Y : [yY]; fragment Z : [zZ];
src/switch.asm
MalcolmLorber/kernel
3
23479
<gh_stars>1-10 ;contex switch function ;saves all relevant registers to the stack ;then changes esp to our new location ;and reforms the registers based on the stack at the new location global context_switch context_switch: mov eax, [esp+4] mov edx, [esp+8] push ebp push ebx push esi push edi mov [eax], esp mov esp, edx pop edi pop esi pop ebx pop ebp ret
programs/oeis/017/A017394.asm
neoneye/loda
22
23087
<filename>programs/oeis/017/A017394.asm ; A017394: a(n) = (11*n)^6. ; 0,1771561,113379904,1291467969,7256313856,27680640625,82653950016,208422380089,464404086784,941480149401,1771561000000,3138428376721,5289852801024,8550986578849,13339032325696,20179187015625,29721861554176,42761175875209,60254729561664,83344647990241,113379904000000,151939915084881,200859416110144,262254607552729,338550579265536,432510009765625,547263141046336,686339028913329,853698068844544,1053765797374081,1291467969000000,1572266908616041,1902199139467264,2287914286629609,2736715256013376,3256599688890625,3856302691946496,4545340842854449,5334057471375424,6233669215980921,7256313856000000,8415099419290201,9724154565432384,11198680244449489,12855002631049216,14710627334390625,16784294883374656,19096037487458569,21667237072994304,24520684595090761,27680640625000000,31172897213027361,35024841026965504,39265517766052369,43925697850453056,49037943386265625,54636676406050816,60758248384885689,67441011031941184,74725388357583601,82653950016000000,91271485923347521,100625082151426624,110764198096878249,121740744925904896,133609165294515625,146426514344294976,160252541973695809,175149776384856064,191183608905939441,208422380089000000,226937467083370681,246803372284575744,268097813258767129,290901813942684736,315299797119140625,341379678168027136,369232960092848929,398954829822778944,430644255790238281,464404086784000000,500341152077816841,538566362834572864,579194814785959009,622345892187672576,668143373050140625,716715535644767296,768195266285705049,822720168387149824,880432672796160121,941480149401000000,1006015020015006001,1074194872535977984,1146182576381093889,1222146399197348416,1302260124847515625,1386703172671635456,1475660718024024169,1569323814085808704,1667889514952984961 pow $0,6 mul $0,1771561
data/mapObjects/route11gateupstairs.asm
adhi-thirumala/EvoYellow
16
240903
<reponame>adhi-thirumala/EvoYellow Route11GateUpstairsObject: db $a ; border block db $1 ; warps db $7, $7, $4, ROUTE_11_GATE_1F db $2 ; signs db $2, $1, $3 ; Route11GateUpstairsText3 db $2, $6, $4 ; Route11GateUpstairsText4 db $2 ; objects object SPRITE_BUG_CATCHER, $4, $2, WALK, $2, $1 ; person object SPRITE_OAK_AIDE, $2, $6, STAY, NONE, $2 ; person ; warp-to EVENT_DISP ROUTE_11_GATE_2F_WIDTH, $7, $7 ; ROUTE_11_GATE_1F
exmpl_6point1.asm
selectiveduplicate/8086-assembly
2
27364
MOV AX, 0FFFFH MOV BX, 0FFFEH MOV CX, AX CMP BX, CX JLE STOP_IT MOV CX, BX STOP_IT: ;MOV CX, BX
Testcases/testcase.asm
Felipe-Rubin/MIPS-Monocycle-32-bits
0
11443
<reponame>Felipe-Rubin/MIPS-Monocycle-32-bits<gh_stars>0 .text .globl main main: la $t0, A # Carrega pos mem A lw $t0, 0 ($t0) # carrega valor pos mem A xori $t1, $zero, 0 # Zera $t1 la $t2, B #Carrega pos mem B lw $t2, 0 ($t2) #Carrega valor pos mem B addu $t0, $t0, $t2 # Soma Val[A] + Val[B] addiu $t0, $t0, 3 # incrementa o valor da soma em 3 ori $t5, $zero, 2 # i = 2 beq $zero, $zero, loop # Salta pro loop loop: sll $t0, $t0, 4 # $t0 * 8 srl $t0, $t0, 2 # $t0 / 4 addiu $t5, $t5, -1 # i-- bne $t5, $zero, loop # Se i = 0, para, senao loop denovo fim: andi $t7, $t0, 1 #Verifica se o resultado eh par = 0, ou impar = 1 slt $t8, $t5, $t0 # 1 se 0 < Resultado, senao 0 sltiu $t9, $t0, 10 # 1 se Resultado < 10, senao 0 la $t1, C # Carrega pos mem C sw $t0, 0 ($t1) # Salva o resultado em C .data A: .word 0x3 B: .word 0x4 C: .word 0x0
src/bintoasc-base16.ads
jhumphry/Ada_BinToAsc
0
10919
-- BinToAsc.Base16 -- Binary data to ASCII codecs - Base16 codec as in RFC4648 -- Copyright (c) 2015, <NAME> - see LICENSE file for details generic Alphabet : Alphabet_16; Case_Sensitive : Boolean; package BinToAsc.Base16 is type Base16_To_String is new Codec_To_String with null record; overriding procedure Reset (C : out Base16_To_String); overriding function Input_Group_Size (C : in Base16_To_String) return Positive is (1); overriding function Output_Group_Size (C : in Base16_To_String) return Positive is (2); overriding procedure Process (C : in out Base16_To_String; Input : in Bin; Output : out String; Output_Length : out Natural) with Post => (Output_Length = 2); overriding procedure Process (C : in out Base16_To_String; Input : in Bin_Array; Output : out String; Output_Length : out Natural) with Post => (Output_Length / 2 = Input'Length and Output_Length mod 2 = 0); overriding procedure Complete (C : in out Base16_To_String; Output : out String; Output_Length : out Natural) with Post => (Output_Length = 0 or Output_Length = 2); function To_String (Input : in Bin_Array) return String; type Base16_To_Bin is new Codec_To_Bin with private; overriding procedure Reset (C : out Base16_To_Bin); overriding function Input_Group_Size (C : in Base16_To_Bin) return Positive is (2); overriding function Output_Group_Size (C : in Base16_To_Bin) return Positive is (1); overriding procedure Process (C : in out Base16_To_Bin; Input : in Character; Output : out Bin_Array; Output_Length : out Bin_Array_Index) with Post => (Output_Length = 0 or Output_Length = 1); overriding procedure Process (C : in out Base16_To_Bin; Input : in String; Output : out Bin_Array; Output_Length : out Bin_Array_Index) with Post => (Output_Length = Input'Length / 2 or Output_Length = Input'Length / 2 + 1 or C.State = Failed); overriding procedure Complete (C : in out Base16_To_Bin; Output : out Bin_Array; Output_Length : out Bin_Array_Index) with Post => (Output_Length = 0); function To_Bin (Input : in String) return Bin_Array; private subtype Half_Bin is Bin range 0..15; type Base16_To_Bin is new Codec_To_Bin with record Loaded : Boolean := False; Load : Half_Bin := 0; end record; end BinToAsc.Base16;
msp430x2/msp430g2452/svd/msp430_svd-timer_0_a3.ads
ekoeppen/MSP430_Generic_Ada_Drivers
0
5633
<gh_stars>0 -- This spec has been automatically generated from out.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; -- Timer0_A3 package MSP430_SVD.TIMER_0_A3 is pragma Preelaborate; --------------- -- Registers -- --------------- -- Timer A mode control 1 type TA0CTL_MC_Field is (-- Timer A mode control: 0 - Stop Mc_0, -- Timer A mode control: 1 - Up to CCR0 Mc_1, -- Timer A mode control: 2 - Continous up Mc_2, -- Timer A mode control: 3 - Up/Down Mc_3) with Size => 2; for TA0CTL_MC_Field use (Mc_0 => 0, Mc_1 => 1, Mc_2 => 2, Mc_3 => 3); -- Timer A clock input divider 1 type TA0CTL_ID_Field is (-- Timer A input divider: 0 - /1 Id_0, -- Timer A input divider: 1 - /2 Id_1, -- Timer A input divider: 2 - /4 Id_2, -- Timer A input divider: 3 - /8 Id_3) with Size => 2; for TA0CTL_ID_Field use (Id_0 => 0, Id_1 => 1, Id_2 => 2, Id_3 => 3); -- Timer A clock source select 1 type TA0CTL_TASSEL_Field is (-- Timer A clock source select: 0 - TACLK Tassel_0, -- Timer A clock source select: 1 - ACLK Tassel_1, -- Timer A clock source select: 2 - SMCLK Tassel_2, -- Timer A clock source select: 3 - INCLK Tassel_3) with Size => 2; for TA0CTL_TASSEL_Field use (Tassel_0 => 0, Tassel_1 => 1, Tassel_2 => 2, Tassel_3 => 3); -- Timer0_A3 Control type TA0CTL_Register is record -- Timer A counter interrupt flag TAIFG : MSP430_SVD.Bit := 16#0#; -- Timer A counter interrupt enable TAIE : MSP430_SVD.Bit := 16#0#; -- Timer A counter clear TACLR : MSP430_SVD.Bit := 16#0#; -- unspecified Reserved_3_3 : MSP430_SVD.Bit := 16#0#; -- Timer A mode control 1 MC : TA0CTL_MC_Field := MSP430_SVD.TIMER_0_A3.Mc_0; -- Timer A clock input divider 1 ID : TA0CTL_ID_Field := MSP430_SVD.TIMER_0_A3.Id_0; -- Timer A clock source select 1 TASSEL : TA0CTL_TASSEL_Field := MSP430_SVD.TIMER_0_A3.Tassel_0; -- unspecified Reserved_10_15 : MSP430_SVD.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for TA0CTL_Register use record TAIFG at 0 range 0 .. 0; TAIE at 0 range 1 .. 1; TACLR at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; MC at 0 range 4 .. 5; ID at 0 range 6 .. 7; TASSEL at 0 range 8 .. 9; Reserved_10_15 at 0 range 10 .. 15; end record; -- Output mode 2 type TA0CCTL0_OUTMOD_Field is (-- PWM output mode: 0 - output only Outmod_0, -- PWM output mode: 1 - set Outmod_1, -- PWM output mode: 2 - PWM toggle/reset Outmod_2, -- PWM output mode: 3 - PWM set/reset Outmod_3, -- PWM output mode: 4 - toggle Outmod_4, -- PWM output mode: 5 - Reset Outmod_5, -- PWM output mode: 6 - PWM toggle/set Outmod_6, -- PWM output mode: 7 - PWM reset/set Outmod_7) with Size => 3; for TA0CCTL0_OUTMOD_Field use (Outmod_0 => 0, Outmod_1 => 1, Outmod_2 => 2, Outmod_3 => 3, Outmod_4 => 4, Outmod_5 => 5, Outmod_6 => 6, Outmod_7 => 7); -- Capture input select 1 type TA0CCTL0_CCIS_Field is (-- Capture input select: 0 - CCIxA Ccis_0, -- Capture input select: 1 - CCIxB Ccis_1, -- Capture input select: 2 - GND Ccis_2, -- Capture input select: 3 - Vcc Ccis_3) with Size => 2; for TA0CCTL0_CCIS_Field use (Ccis_0 => 0, Ccis_1 => 1, Ccis_2 => 2, Ccis_3 => 3); -- Capture mode 1 type TA0CCTL0_CM_Field is (-- Capture mode: 0 - disabled Cm_0, -- Capture mode: 1 - pos. edge Cm_1, -- Capture mode: 1 - neg. edge Cm_2, -- Capture mode: 1 - both edges Cm_3) with Size => 2; for TA0CCTL0_CM_Field use (Cm_0 => 0, Cm_1 => 1, Cm_2 => 2, Cm_3 => 3); -- Timer0_A3 Capture/Compare Control 0 type TA0CCTL_Register is record -- Capture/compare interrupt flag CCIFG : MSP430_SVD.Bit := 16#0#; -- Capture/compare overflow flag COV : MSP430_SVD.Bit := 16#0#; -- PWM Output signal if output mode 0 OUT_k : MSP430_SVD.Bit := 16#0#; -- Capture input signal (read) CCI : MSP430_SVD.Bit := 16#0#; -- Capture/compare interrupt enable CCIE : MSP430_SVD.Bit := 16#0#; -- Output mode 2 OUTMOD : TA0CCTL0_OUTMOD_Field := MSP430_SVD.TIMER_0_A3.Outmod_0; -- Capture mode: 1 /Compare mode : 0 CAP : MSP430_SVD.Bit := 16#0#; -- unspecified Reserved_9_9 : MSP430_SVD.Bit := 16#0#; -- Latched capture signal (read) SCCI : MSP430_SVD.Bit := 16#0#; -- Capture sychronize SCS : MSP430_SVD.Bit := 16#0#; -- Capture input select 1 CCIS : TA0CCTL0_CCIS_Field := MSP430_SVD.TIMER_0_A3.Ccis_0; -- Capture mode 1 CM : TA0CCTL0_CM_Field := MSP430_SVD.TIMER_0_A3.Cm_0; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for TA0CCTL_Register use record CCIFG at 0 range 0 .. 0; COV at 0 range 1 .. 1; OUT_k at 0 range 2 .. 2; CCI at 0 range 3 .. 3; CCIE at 0 range 4 .. 4; OUTMOD at 0 range 5 .. 7; CAP at 0 range 8 .. 8; Reserved_9_9 at 0 range 9 .. 9; SCCI at 0 range 10 .. 10; SCS at 0 range 11 .. 11; CCIS at 0 range 12 .. 13; CM at 0 range 14 .. 15; end record; ----------------- -- Peripherals -- ----------------- -- Timer0_A3 type TIMER_0_A3_Peripheral is record -- Timer0_A3 Interrupt Vector Word TA0IV : aliased MSP430_SVD.UInt16; -- Timer0_A3 Control TA0CTL : aliased TA0CTL_Register; -- Timer0_A3 Capture/Compare Control 0 TA0CCTL0 : aliased TA0CCTL_Register; -- Timer0_A3 Capture/Compare Control 1 TA0CCTL1 : aliased TA0CCTL_Register; -- Timer0_A3 Capture/Compare Control 2 TA0CCTL2 : aliased TA0CCTL_Register; -- Timer0_A3 Counter Register TA0R : aliased MSP430_SVD.UInt16; -- Timer0_A3 Capture/Compare 0 TA0CCR0 : aliased MSP430_SVD.UInt16; -- Timer0_A3 Capture/Compare 1 TA0CCR1 : aliased MSP430_SVD.UInt16; -- Timer0_A3 Capture/Compare 2 TA0CCR2 : aliased MSP430_SVD.UInt16; end record with Volatile; for TIMER_0_A3_Peripheral use record TA0IV at 16#0# range 0 .. 15; TA0CTL at 16#32# range 0 .. 15; TA0CCTL0 at 16#34# range 0 .. 15; TA0CCTL1 at 16#36# range 0 .. 15; TA0CCTL2 at 16#38# range 0 .. 15; TA0R at 16#42# range 0 .. 15; TA0CCR0 at 16#44# range 0 .. 15; TA0CCR1 at 16#46# range 0 .. 15; TA0CCR2 at 16#48# range 0 .. 15; end record; -- Timer0_A3 TIMER_0_A3_Periph : aliased TIMER_0_A3_Peripheral with Import, Address => TIMER_0_A3_Base; end MSP430_SVD.TIMER_0_A3;
lib/aflexnat/misc.adb
alvaromb/Compilemon
1
6714
<reponame>alvaromb/Compilemon -- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by <NAME> of the Arcadia project -- at the University of California, Irvine. -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- TITLE miscellaneous aflex routines -- AUTHOR: <NAME> (UCI) -- DESCRIPTION -- NOTES contains functions used in various places throughout aflex. -- $Header: /dc/uc/self/tmp/gnat_aflex/orig/RCS/misc.adb,v 1.1 1995/02/19 01:38:51 self Exp self $ with misc_defs, tstring, text_io, misc, main_body; with int_io, calendar, external_file_manager; use misc, misc_defs, text_io, external_file_manager; package body misc is use TSTRING; -- action_out - write the actions from the temporary file to lex.yy.c procedure ACTION_OUT is BUF : VSTRING; begin while (not TEXT_IO.END_OF_FILE(TEMP_ACTION_FILE)) loop TSTRING.GET_LINE(TEMP_ACTION_FILE, BUF); if ((TSTRING.LEN(BUF) >= 2) and then ((CHAR(BUF, 1) = '%') and (CHAR(BUF, 2) = '%'))) then exit; else TSTRING.PUT_LINE(BUF); end if; end loop; end ACTION_OUT; -- bubble - bubble sort an integer array in increasing order -- -- description -- sorts the first n elements of array v and replaces them in -- increasing order. -- -- passed -- v - the array to be sorted -- n - the number of elements of 'v' to be sorted procedure BUBBLE(V : in INT_PTR; N : in INTEGER) is K : INTEGER; begin for I in reverse 2 .. N loop for J in 1 .. I - 1 loop if (V(J) > V(J + 1)) then -- compare K := V(J); -- exchange V(J) := V(J + 1); V(J + 1) := K; end if; end loop; end loop; end BUBBLE; -- clower - replace upper-case letter to lower-case function CLOWER(C : in INTEGER) return INTEGER is begin if (ISUPPER(CHARACTER'VAL(C))) then return TOLOWER(C); else return C; end if; end CLOWER; -- cshell - shell sort a character array in increasing order -- -- description -- does a shell sort of the first n elements of array v. -- -- passed -- v - array to be sorted -- n - number of elements of v to be sorted procedure CSHELL(V : in out CHAR_ARRAY; N : in INTEGER) is GAP, J, JG : INTEGER; K : CHARACTER; LOWER_BOUND : INTEGER := V'FIRST; begin GAP := N/2; while GAP > 0 loop for I in GAP .. N - 1 loop J := I - GAP; while (J >= 0) loop JG := J + GAP; if (V(J + LOWER_BOUND) <= V(JG + LOWER_BOUND)) then exit; end if; K := V(J + LOWER_BOUND); V(J + LOWER_BOUND) := V(JG + LOWER_BOUND); V(JG + LOWER_BOUND) := K; J := J - GAP; end loop; end loop; GAP := GAP/2; end loop; end CSHELL; -- dataend - finish up a block of data declarations procedure DATAEND is begin if (DATAPOS > 0) then DATAFLUSH; -- add terminator for initialization TEXT_IO.PUT_LINE(" ) ;"); TEXT_IO.NEW_LINE; DATALINE := 0; end if; end DATAEND; -- dataflush - flush generated data statements procedure DATAFLUSH(FILE : in FILE_TYPE) is begin TEXT_IO.NEW_LINE(FILE); DATALINE := DATALINE + 1; if (DATALINE >= NUMDATALINES) then -- put out a blank line so that the table is grouped into -- large blocks that enable the user to find elements easily TEXT_IO.NEW_LINE(FILE); DATALINE := 0; end if; -- reset the number of characters written on the current line DATAPOS := 0; end DATAFLUSH; procedure DATAFLUSH is begin DATAFLUSH(CURRENT_OUTPUT); end DATAFLUSH; -- aflex_gettime - return current time function AFLEX_GETTIME return VSTRING is use TSTRING, CALENDAR; CURRENT_TIME : TIME; CURRENT_YEAR : YEAR_NUMBER; CURRENT_MONTH : MONTH_NUMBER; CURRENT_DAY : DAY_NUMBER; CURRENT_SECONDS : DAY_DURATION; MONTH_STRING, HOUR_STRING, MINUTE_STRING, SECOND_STRING : VSTRING; HOUR, MINUTE, SECOND : INTEGER; SECONDS_PER_HOUR : constant DAY_DURATION := 3600.0; begin CURRENT_TIME := CLOCK; SPLIT(CURRENT_TIME, CURRENT_YEAR, CURRENT_MONTH, CURRENT_DAY, CURRENT_SECONDS); case CURRENT_MONTH is when 1 => MONTH_STRING := VSTR("Jan"); when 2 => MONTH_STRING := VSTR("Feb"); when 3 => MONTH_STRING := VSTR("Mar"); when 4 => MONTH_STRING := VSTR("Apr"); when 5 => MONTH_STRING := VSTR("May"); when 6 => MONTH_STRING := VSTR("Jun"); when 7 => MONTH_STRING := VSTR("Jul"); when 8 => MONTH_STRING := VSTR("Aug"); when 9 => MONTH_STRING := VSTR("Sep"); when 10 => MONTH_STRING := VSTR("Oct"); when 11 => MONTH_STRING := VSTR("Nov"); when 12 => MONTH_STRING := VSTR("Dec"); end case; HOUR := INTEGER(CURRENT_SECONDS)/INTEGER(SECONDS_PER_HOUR); MINUTE := INTEGER((CURRENT_SECONDS - (HOUR*SECONDS_PER_HOUR))/60); SECOND := INTEGER(CURRENT_SECONDS - HOUR*SECONDS_PER_HOUR - MINUTE*60.0); if (HOUR >= 10) then HOUR_STRING := VSTR(INTEGER'IMAGE(HOUR)); else HOUR_STRING := VSTR("0" & INTEGER'IMAGE(HOUR)); end if; if (MINUTE >= 10) then MINUTE_STRING := VSTR(INTEGER'IMAGE(MINUTE)(2 .. INTEGER'IMAGE(MINUTE)' LENGTH)); else MINUTE_STRING := VSTR("0" & INTEGER'IMAGE(MINUTE)(2 .. INTEGER'IMAGE( MINUTE)'LENGTH)); end if; if (SECOND >= 10) then SECOND_STRING := VSTR(INTEGER'IMAGE(SECOND)(2 .. INTEGER'IMAGE(SECOND)' LENGTH)); else SECOND_STRING := VSTR("0" & INTEGER'IMAGE(SECOND)(2 .. INTEGER'IMAGE( SECOND)'LENGTH)); end if; return MONTH_STRING & VSTR(INTEGER'IMAGE(CURRENT_DAY)) & HOUR_STRING & ":" & MINUTE_STRING & ":" & SECOND_STRING & INTEGER'IMAGE(CURRENT_YEAR); end AFLEX_GETTIME; -- aflexerror - report an error message and terminate -- overloaded function, one for vstring, one for string. procedure AFLEXERROR(MSG : in VSTRING) is use TEXT_IO; begin TSTRING.PUT(STANDARD_ERROR, "aflex: " & MSG); TEXT_IO.NEW_LINE(STANDARD_ERROR); MAIN_BODY.AFLEXEND(1); end AFLEXERROR; procedure AFLEXERROR(MSG : in STRING) is use TEXT_IO; begin TEXT_IO.PUT(STANDARD_ERROR, "aflex: " & MSG); TEXT_IO.NEW_LINE(STANDARD_ERROR); MAIN_BODY.AFLEXEND(1); end AFLEXERROR; -- aflexfatal - report a fatal error message and terminate -- overloaded function, one for vstring, one for string. procedure AFLEXFATAL(MSG : in VSTRING) is use TEXT_IO; begin TSTRING.PUT(STANDARD_ERROR, "aflex: fatal internal error " & MSG); TEXT_IO.NEW_LINE(STANDARD_ERROR); MAIN_BODY.AFLEXEND(1); end AFLEXFATAL; procedure AFLEXFATAL(MSG : in STRING) is use TEXT_IO; begin TEXT_IO.PUT(STANDARD_ERROR, "aflex: fatal internal error " & MSG); TEXT_IO.NEW_LINE(STANDARD_ERROR); MAIN_BODY.AFLEXEND(1); end AFLEXFATAL; -- basename - find the basename of a file function BASENAME return VSTRING is END_CHAR_POS : INTEGER := LEN(INFILENAME); START_CHAR_POS : INTEGER; begin if (END_CHAR_POS = 0) then -- if reading standard input give everything this name return VSTR("aflex_yy"); end if; -- find out where the end of the basename is while ((END_CHAR_POS >= 1) and then (CHAR(INFILENAME, END_CHAR_POS) /= '.')) loop END_CHAR_POS := END_CHAR_POS - 1; end loop; -- find out where the beginning of the basename is START_CHAR_POS := END_CHAR_POS; -- start at the end of the basename while ((START_CHAR_POS > 1) and then (CHAR(INFILENAME, START_CHAR_POS) /= '/')) loop START_CHAR_POS := START_CHAR_POS - 1; end loop; if (CHAR(INFILENAME, START_CHAR_POS) = '/') then START_CHAR_POS := START_CHAR_POS + 1; end if; if (END_CHAR_POS >= 1) then return SLICE(INFILENAME, START_CHAR_POS, END_CHAR_POS - 1); else return INFILENAME; end if; end BASENAME; -- line_directive_out - spit out a "# line" statement procedure LINE_DIRECTIVE_OUT(OUTPUT_FILE_NAME : in FILE_TYPE) is begin if (GEN_LINE_DIRS) then TEXT_IO.PUT(OUTPUT_FILE_NAME, "--# line "); INT_IO.PUT(OUTPUT_FILE_NAME, LINENUM, 1); TEXT_IO.PUT(OUTPUT_FILE_NAME, " """); TSTRING.PUT(OUTPUT_FILE_NAME, INFILENAME); TEXT_IO.PUT_LINE(OUTPUT_FILE_NAME, """"); end if; end LINE_DIRECTIVE_OUT; procedure LINE_DIRECTIVE_OUT is begin if (GEN_LINE_DIRS) then TEXT_IO.PUT("--# line "); INT_IO.PUT(LINENUM, 1); TEXT_IO.PUT(" """); TSTRING.PUT(INFILENAME); TEXT_IO.PUT_LINE(""""); end if; end LINE_DIRECTIVE_OUT; -- all_upper - returns true if a string is all upper-case function ALL_UPPER(STR : in VSTRING) return BOOLEAN is begin for I in 1 .. LEN(STR) loop if (not ((CHAR(STR, I) >= 'A') and (CHAR(STR, I) <= 'Z'))) then return FALSE; end if; end loop; return TRUE; end ALL_UPPER; -- all_lower - returns true if a string is all lower-case function ALL_LOWER(STR : in VSTRING) return BOOLEAN is begin for I in 1 .. LEN(STR) loop if (not ((CHAR(STR, I) >= 'a') and (CHAR(STR, I) <= 'z'))) then return FALSE; end if; end loop; return TRUE; end ALL_LOWER; -- mk2data - generate a data statement for a two-dimensional array -- -- generates a data statement initializing the current 2-D array to "value" procedure MK2DATA(FILE : in FILE_TYPE; VALUE : in INTEGER) is begin if (DATAPOS >= NUMDATAITEMS) then TEXT_IO.PUT(FILE, ','); DATAFLUSH(FILE); end if; if (DATAPOS = 0) then -- indent TEXT_IO.PUT(FILE, " "); else TEXT_IO.PUT(FILE, ','); end if; DATAPOS := DATAPOS + 1; INT_IO.PUT(FILE, VALUE, 5); end MK2DATA; procedure MK2DATA(VALUE : in INTEGER) is begin MK2DATA(CURRENT_OUTPUT, VALUE); end MK2DATA; -- -- generates a data statement initializing the current array element to -- "value" procedure MKDATA(VALUE : in INTEGER) is begin if (DATAPOS >= NUMDATAITEMS) then TEXT_IO.PUT(','); DATAFLUSH; end if; if (DATAPOS = 0) then -- indent TEXT_IO.PUT(" "); else TEXT_IO.PUT(','); end if; DATAPOS := DATAPOS + 1; INT_IO.PUT(VALUE, 5); end MKDATA; -- myctoi - return the integer represented by a string of digits function MYCTOI(NUM_ARRAY : in VSTRING) return INTEGER is TOTAL : INTEGER := 0; CNT : INTEGER := TSTRING.FIRST; begin while (CNT <= TSTRING.LEN(NUM_ARRAY)) loop TOTAL := TOTAL*10; TOTAL := TOTAL + CHARACTER'POS(CHAR(NUM_ARRAY, CNT)) - CHARACTER'POS('0') ; CNT := CNT + 1; end loop; return TOTAL; end MYCTOI; -- myesc - return character corresponding to escape sequence function MYESC(ARR : in VSTRING) return CHARACTER is use TEXT_IO; begin case (CHAR(ARR, TSTRING.FIRST + 1)) is when 'a' => return ASCII.BEL; when 'b' => return ASCII.BS; when 'f' => return ASCII.FF; when 'n' => return ASCII.LF; when 'r' => return ASCII.CR; when 't' => return ASCII.HT; when 'v' => return ASCII.VT; when '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => -- \<octal> declare C, ESC_CHAR : CHARACTER; SPTR : INTEGER := TSTRING.FIRST + 1; begin ESC_CHAR := OTOI(TSTRING.SLICE(ARR, TSTRING.FIRST + 1, TSTRING.LEN(ARR ))); if (ESC_CHAR = ASCII.NUL) then MISC.SYNERR("escape sequence for null not allowed"); return ASCII.SOH; end if; return ESC_CHAR; end; when others => return CHAR(ARR, TSTRING.FIRST + 1); end case; end MYESC; -- otoi - convert an octal digit string to an integer value function OTOI(STR : in VSTRING) return CHARACTER is TOTAL : INTEGER := 0; CNT : INTEGER := TSTRING.FIRST; begin while (CNT <= TSTRING.LEN(STR)) loop TOTAL := TOTAL*8; TOTAL := TOTAL + CHARACTER'POS(CHAR(STR, CNT)) - CHARACTER'POS('0'); CNT := CNT + 1; end loop; return CHARACTER'VAL(TOTAL); end OTOI; -- readable_form - return the the human-readable form of a character -- -- The returned string is in static storage. function READABLE_FORM(C : in CHARACTER) return VSTRING is begin if ((CHARACTER'POS(C) >= 0 and CHARACTER'POS(C) < 32) or (C = ASCII.DEL)) then case C is when ASCII.LF => return (VSTR("\n")); -- Newline when ASCII.HT => return (VSTR("\t")); -- Horizontal Tab when ASCII.FF => return (VSTR("\f")); -- Form Feed when ASCII.CR => return (VSTR("\r")); -- Carriage Return when ASCII.BS => return (VSTR("\b")); -- Backspace when others => return VSTR("\" & INTEGER'IMAGE(CHARACTER'POS(C))); end case; elsif (C = ' ') then return VSTR("' '"); else return VSTR(C); end if; end READABLE_FORM; -- transition_struct_out - output a yy_trans_info structure -- -- outputs the yy_trans_info structure with the two elements, element_v and -- element_n. Formats the output with spaces and carriage returns. procedure TRANSITION_STRUCT_OUT(ELEMENT_V, ELEMENT_N : in INTEGER) is begin INT_IO.PUT(ELEMENT_V, 7); TEXT_IO.PUT(", "); INT_IO.PUT(ELEMENT_N, 5); TEXT_IO.PUT(","); DATAPOS := DATAPOS + TRANS_STRUCT_PRINT_LENGTH; if (DATAPOS >= 75) then TEXT_IO.NEW_LINE; DATALINE := DATALINE + 1; if (DATALINE mod 10 = 0) then TEXT_IO.NEW_LINE; end if; DATAPOS := 0; end if; end TRANSITION_STRUCT_OUT; function SET_YY_TRAILING_HEAD_MASK(SRC : in INTEGER) return INTEGER is begin if (CHECK_YY_TRAILING_HEAD_MASK(SRC) = 0) then return SRC + YY_TRAILING_HEAD_MASK; else return SRC; end if; end SET_YY_TRAILING_HEAD_MASK; function CHECK_YY_TRAILING_HEAD_MASK(SRC : in INTEGER) return INTEGER is begin if (SRC >= YY_TRAILING_HEAD_MASK) then return YY_TRAILING_HEAD_MASK; else return 0; end if; end CHECK_YY_TRAILING_HEAD_MASK; function SET_YY_TRAILING_MASK(SRC : in INTEGER) return INTEGER is begin if (CHECK_YY_TRAILING_MASK(SRC) = 0) then return SRC + YY_TRAILING_MASK; else return SRC; end if; end SET_YY_TRAILING_MASK; function CHECK_YY_TRAILING_MASK(SRC : in INTEGER) return INTEGER is begin -- this test is whether both bits are on, or whether onlyy TRAIL_MASK is set if ((SRC >= YY_TRAILING_HEAD_MASK + YY_TRAILING_MASK) or (( CHECK_YY_TRAILING_HEAD_MASK(SRC) = 0) and (SRC >= YY_TRAILING_MASK))) then return YY_TRAILING_MASK; else return 0; end if; end CHECK_YY_TRAILING_MASK; function ISLOWER(C : in CHARACTER) return BOOLEAN is begin return (C in 'a' .. 'z'); end ISLOWER; function ISUPPER(C : in CHARACTER) return BOOLEAN is begin return (C in 'A' .. 'Z'); end ISUPPER; function ISDIGIT(C : in CHARACTER) return BOOLEAN is begin return (C in '0' .. '9'); end ISDIGIT; function TOLOWER(C : in INTEGER) return INTEGER is begin return C - CHARACTER'POS('A') + CHARACTER'POS('a'); end TOLOWER; procedure SYNERR(STR : in STRING) is use TEXT_IO; begin SYNTAXERROR := TRUE; TEXT_IO.PUT(STANDARD_ERROR, "Syntax error at line "); INT_IO.PUT(STANDARD_ERROR, LINENUM); TEXT_IO.PUT(STANDARD_ERROR, STR); TEXT_IO.NEW_LINE(STANDARD_ERROR); end SYNERR; end misc;
awa/src/awa-users-beans.ads
twdroeger/ada-awa
0
22585
<reponame>twdroeger/ada-awa<gh_stars>0 ----------------------------------------------------------------------- -- awa-users-beans -- ASF Beans for user module -- Copyright (C) 2011, 2012, 2013 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Beans.Basic; with Util.Beans.Objects; with Util.Beans.Methods; with Ada.Strings.Unbounded; with AWA.Users.Services; with AWA.Users.Modules; with AWA.Users.Principals; package AWA.Users.Beans is use Ada.Strings.Unbounded; type Authenticate_Bean is new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record Module : AWA.Users.Modules.User_Module_Access := null; Manager : AWA.Users.Services.User_Service_Access := null; Email : Unbounded_String; Password : Unbounded_String; First_Name : Unbounded_String; Last_Name : Unbounded_String; Access_Key : Unbounded_String; end record; -- Attributes exposed by the <b>Authenticate_Bean</b> through Get_Value. EMAIL_ATTR : constant String := "email"; PASSWORD_ATTR : constant String := "password"; FIRST_NAME_ATTR : constant String := "firstName"; LAST_NAME_ATTR : constant String := "lastName"; KEY_ATTR : constant String := "key"; type Authenticate_Bean_Access is access all Authenticate_Bean'Class; -- Get the value identified by the name. overriding function Get_Value (From : in Authenticate_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Authenticate_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- This bean provides some methods that can be used in a Method_Expression overriding function Get_Method_Bindings (From : in Authenticate_Bean) return Util.Beans.Methods.Method_Binding_Array_Access; procedure Set_Session_Principal (Data : in Authenticate_Bean; Principal : in AWA.Users.Principals.Principal_Access); procedure Set_Authenticate_Cookie (Data : in out Authenticate_Bean; Principal : in AWA.Users.Principals.Principal_Access); -- Action to register a user procedure Register_User (Data : in out Authenticate_Bean; Outcome : in out Unbounded_String); -- Action to verify the user after the registration procedure Verify_User (Data : in out Authenticate_Bean; Outcome : in out Unbounded_String); -- Action to trigger the lost password email process. procedure Lost_Password (Data : in out Authenticate_Bean; Outcome : in out Unbounded_String); -- Action to validate the reset password key and set a new password. procedure Reset_Password (Data : in out Authenticate_Bean; Outcome : in out Unbounded_String); -- Action to authenticate a user (password authentication). procedure Authenticate_User (Data : in out Authenticate_Bean; Outcome : in out Unbounded_String); -- Logout the user and closes the session. procedure Logout_User (Data : in out Authenticate_Bean; Outcome : in out Unbounded_String); procedure Load_User (Data : in out Authenticate_Bean; Outcome : in out Unbounded_String); -- Create an authenticate bean. function Create_Authenticate_Bean (Module : in AWA.Users.Modules.User_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; -- ------------------------------ -- Current user -- ------------------------------ -- The <b>Current_User_Bean</b> provides information about the current user. -- It relies on the <b>AWA.Services.Contexts</b> to identify the current user -- and return information about him/her. type Current_User_Bean is new Util.Beans.Basic.Readonly_Bean with null record; type Current_User_Bean_Access is access all Current_User_Bean'Class; -- Attributes exposed by <b>Current_User_Bean</b> IS_LOGGED_ATTR : constant String := "isLogged"; USER_EMAIL_ATTR : constant String := "email"; USER_NAME_ATTR : constant String := "name"; USER_ID_ATTR : constant String := "id"; -- Get the value identified by the name. The following names are recognized: -- o isLogged Boolean True if a user is logged -- o name String The user name -- o email String The user email address -- o id Long The user identifier overriding function Get_Value (From : in Current_User_Bean; Name : in String) return Util.Beans.Objects.Object; -- Create the current user bean. function Create_Current_User_Bean (Module : in AWA.Users.Modules.User_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; end AWA.Users.Beans;
solutions/36 - Seek and Destroy 2/size-10_speed-152.asm
behrmann/7billionhumans
45
88842
<reponame>behrmann/7billionhumans -- 7 Billion Humans (2053) -- -- 36: Seek and Destroy 2 -- -- Author: ansvonwa -- Size: 10 -- Speed: 152 -- Speed Tests: 151, 152, 152, 151 -- Success Rate: 68/100 a: mem1 = set 99 b: step n if c < mem1: mem1 = set c endif if n != wall: jump b endif pickup mem1 mem1 = nearest shredder giveto mem1 jump a
programs/oeis/054/A054851.asm
neoneye/loda
22
80180
; A054851: a(n) = 2^(n-7)*binomial(n,7). Number of 7D hypercubes in an n-dimensional hypercube. ; 1,16,144,960,5280,25344,109824,439296,1647360,5857280,19914752,65175552,206389248,635043840,1905131520,5588385792,16066609152,45364543488,126012620800,344876646400,931166945280,2483111854080,6546385797120,17077528166400,44116947763200,112939386273792,286692288233472,722039837032448,1805099592581120,4481626574684160,11054678884220928,27101793393573888,66060621396836352,160146960962027520,386236788202536960,926968291686088704,2214424252361211904,5266738762372612096,12473854963514081280,29425504016494755840,69149934438762676224,161912041612712607744,377794763762996084736,878592473867432755200,2036737098510866841600,4707125738780670033920,10846854963277196165120,24924688000722067783680,57119076668321405337600,130557889527591783628800,297671988122909266673664,677057855338381861453824,1536400517883251147145216,3478642681999813918064640,7859155688962542555627520,17718823735115550489051136,39867353404009988600365056,89526688345846991944679424,200663266982070844013936640,448941546468361888302366720,1002636120446008217208619008,2235385448863231435088068608,4975535353921386097454088192,11056745230936413549897973760,24532153481140167563836129280,54348155404372063526036963328,120224707409671534466687827968,265570995472110255239847739392,585818372364949092440840601600,1290498443470612493492866252800,2839096575635347485684305756160,6238015011255129686855657717760,13688977385809867923933248880640,30003238105884642025059175628800,65682764502071783892697114214400,143626311711196967445364356415488,313710101895509165735927410065408,684458404135656361605659803779072,1491768316705917711191822649262080,3247900638904023371202449312317440,7064183889616250832365327254290432,15349337834227903043164167861174272,33319294323080082215649047308402688,72258710580173672274901548379668480,156560539590376289928953354822615040,338907520995638086434440203380719616,732986033781263768334952067776905216 mov $1,-2 pow $1,$0 mov $2,-8 bin $2,$0 mul $1,$2 mov $0,$1
src/test/resources/cpu_tests/interrupt.asm
caseif/jNES
1
13370
<gh_stars>1-10 ;;;;;;;;;;;;;;;; ; test interrupts ;;;;;;;;;;;;;;;; ; required for execution on the NES .org $8000 SEC ; set carry bit BRK ; issue software interrupt LDA #$01 ; set A = 1 LDY #$01 ; set Y = 1 NOP ; perform assertions: ; A = 1 ; C = 1 handler: CLC ; clear carry bit LDX #$01 ; set X = 1 RTI ; return from interrupt .org $BFFE ; constant location of interrupt vector (we take advantage of mirroring here) .dw handler ; interrupt vector itself
source/8086/program8086/program8086.asm
srfunksensei/MIPS
0
1168
.8086 .model medium ;==================================================================================================== ;************************************ CONSTANTS ********************************************** ;==================================================================================================== ;---------------------------------------------------------------- ; INTERFACES ;---------------------------------------------------------------- ;interrupt controller 8259A icw1_adr EQU 0018h icw2_adr EQU 001Ah icw3_adr EQU 001Ah icw4_adr EQU 001Ah ocw1_adr EQU 001Ah ocw2_adr EQU 0018h ocw3_adr EQU 0018h icw1 EQU 00010111b icw2 EQU 00100000b icw4 EQU 00000101b ocw1 EQU 11100000b lockKeyboard EQU 11100100b unlockKeyboard EQU 11100000b eoi0_command EQU 00110000b eoi1_command EQU 00110001b eoi2_command EQU 00110010b eoi3_command EQU 00110011b eoi4_command EQU 00110100b ;timer 8254 cnt0_adr EQU 0020h cnt1_adr EQU 0022h cnt2_adr EQU 0024h control_adr EQU 0026h cnt2_con EQU 10010110b cnt2_val EQU 1Eh ;serial (30*pclk) cnt1_con EQU 01110100b cnt1_val_low EQU 40h ;display,time (40000*pclk=10mS) cnt1_val_high EQU 9Ch ;display=x4 time=x100 cnt0_con EQU 00110100b ;printer,lad(8000*pclk=2ms) cnt0_val_low EQU 40h ;wr=x1,char=x10,cr=x100,lad=x300 cnt0_val_high EQU 1Fh ;serial 8251a serial_cnt_adr EQU 0000h ;control and status serial_data_adr EQU 0002h ;data serial_mode EQU 01001110b serial_com_T1R1 EQU 00110111b ;T-transmit serial_com_T0R1 EQU 00100110b ;R-receive serial_com_T0R0 EQU 00100010b serial_com_T1R0 EQU 00100011b ;paralel 8255 ;keyboard port key_portA EQU 0008h key_portB EQU 000Ah key_portC EQU 000Ch key_con_adr EQU 000Eh key_control EQU 10000010b init_key_val EQU 00000000b scan1 EQU 00001110b scan2 EQU 00001101b scan3 EQU 00001011b scan4 EQU 00000111b mask1 EQU 00001000b mask2 EQU 00000100b mask3 EQU 00000010b mask4 EQU 00000001b ;display port dis_portA EQU 0010h dis_portB EQU 0012h dis_portC EQU 0014h dis_cnt_adr EQU 0016h dis_control EQU 10000000b ;printer port print_portA EQU 0028h print_portB EQU 002Ah print_portC EQU 002Ch print_cnt_adr EQU 002Eh print_control EQU 10000000b start_counter EQU 10000000b stop_counter EQU 00000000b lad0wr0 EQU 00000000h lad0wr1 EQU 00000001h lad1wr0 EQU 00000010h lad1wr1 EQU 00000011h ;--------------------------------------------------------------- ; PAL16L8 ;--------------------------------------------------------------- ;PAL16L8 need to be programmed with shown equations ;RAM(pin 12)=/pin11*/pin9*/pin8*/pin7*/pin14 ;ROM(pin 13)=pin11*pin9*pin8*pin7*pin6*pin5*/pin14*pin15 ;interfaces(pin 19)=/pin11*/pin9*/pin8*/pin7*/pin6*/pin5* ; */pin4*/pin3*/pin2*/pin1*pin16*pin17* ; *pin18*pin14 ;--------------------------------------------------------------- ; SEGMENT ADDRESSES ;--------------------------------------------------------------- prog_seg EQU 0FC00h ;pocetak rom-a interrupt_seg EQU 0000h ;pocetak ram-a ;---------------------------------------------------------------- ; MACROS ;---------------------------------------------------------------- ;save reg saveReg MACRO push ax push bx push cx push dx push si push di push ds push es ENDM ;restore reg resReg MACRO pop es pop ds pop di pop si pop dx pop cx pop bx pop ax ENDM ;---------------------------------------------------------------- ; DISPLAY CONSTANTS ;---------------------------------------------------------------- select_seg0 EQU 00000000b select_seg1 EQU 00000001b select_seg2 EQU 00000010b select_seg3 EQU 00000011b select_seg4 EQU 00000100b select_seg5 EQU 00000101b select_seg6 EQU 00000110b select_seg7 EQU 00000111b select_seg8 EQU 00001111b select_seg9 EQU 00010111b select_seg10 EQU 00011111b select_seg11 EQU 00100111b select_seg12 EQU 00101111b select_seg13 EQU 00110111b select_seg14 EQU 00111111b select_seg15 EQU 01111111b select_seg16 EQU 10111111b ;null unselect_seg EQU 11111111b display_null EQU 11111111b ;numbers display0_c EQU 00011001b ;0 display0_b EQU 10011000b display1_c EQU 11110111b ;1 display1_b EQU 11101111b display2_c EQU 00111100b ;2 display2_b EQU 00111100b display3_c EQU 00111100b ;3 display3_b EQU 01111000b display4_c EQU 11011100b ;4 display4_b EQU 01111011b display5_c EQU 00011110b ;5 display5_b EQU 01111000b display6_c EQU 00011110b ;6 display6_b EQU 00111000b display7_c EQU 00111101b ;7 display7_b EQU 11111011b display8_c EQU 00011100b ;8 display8_b EQU 00111000b display9_c EQU 00011100b ;9 display9_b EQU 01111000b ;letters displayA_c EQU 00011100b ;A displayA_b EQU 00111011b displayB_c EQU 00110101b ;B displayB_b EQU 01101000b displayC_c EQU 00011111b ;C displayC_b EQU 10111100b displayD_c EQU 00110101b ;D displayD_b EQU 11101100b displayE_c EQU 00011101b ;E displayE_b EQU 10111100b displayF_c EQU 00011101b ;F displayF_b EQU 10111111b displayG_c EQU 00011111b ;G displayG_b EQU 00111000b displayH_c EQU 11011100b ;H displayH_b EQU 00111011b displayI_c EQU 00101111b ;I displayI_b EQU 11101100b displayJ_c EQU 00111101b ;J displayJ_b EQU 10111000b displayK_c EQU 11011010b ;K displayK_b EQU 10101111b displayL_c EQU 11011111b ;L displayL_b EQU 10101111b displayM_c EQU 11001001b ;M displayM_b EQU 10111011b displayN_c EQU 11001101b ;N displayN_b EQU 10110011b displayO_c EQU 00011101b ;O displayO_b EQU 10111000b displayP_c EQU 00011100b ;P displayP_b EQU 00111111b displayQ_c EQU 00011101b ;Q displayQ_b EQU 10110000b displayR_c EQU 01010110b ;R displayR_b EQU 10110111b displayS_c EQU 00011110b ;S displayS_b EQU 01111000b displayT_c EQU 00110111b ;T displayT_b EQU 11101111b displayU_c EQU 11011101b ;U displayU_b EQU 10111000b displayV_c EQU 11011011b ;V displayV_b EQU 10010011b displayW_c EQU 11011101b ;W displayW_b EQU 10010011b displayX_c EQU 11101011b ;X displayX_b EQU 10110111b displayY_c EQU 11101011b ;Y displayY_b EQU 11101111b displayZ_c EQU 00111011b ;Z displayZ_b EQU 11011100b displayMul_c EQU 11100010b ;* displayMul_b EQU 01000111b displayDD_c EQU 11110111b ;: displayDD_b EQU 11101111b ;==================================================================================================== ;************************************ RESET SEGMENT ******************************************* ;==================================================================================================== reset SEGMENT AT 0FFFF0h jmp FAR PTR startADR ;program starts at 00000h reset ENDS ;==================================================================================================== ;********************************** INTERRUPT SEGMENT ***************************************** ;==================================================================================================== interrupt SEGMENT AT 00000h ASSUME es:interrupt ; dedicaded interrupts divz dd ? ;0000h ul0 trap dd ? ;0004h ul1 nmi dd ? ;0008h ul2 brake dd ? ;000ch ul3 overflow dd ? ;0010h ul4 ; reserved interrupts reserved dd 27 dup(?) ;0014h-007ch ul5-ul31 ; available interrupts time dd ? ;0080h ul32 counter dd ? ;0104h ul33 keyboard dd ? ;0108h ul34 serial dd ? ;010ah ul35 printer dd ? ;010ch ul36 notUsed dd 2 dup(?) ;0110h-0114h ul37,ul38 falseInt dd ? ;0118h ul39 ;other interrupts others dd 216 dup(?) ;0110h-03fch ul37-ul255 interrupt ENDS ;==================================================================================================== ;************************************ STACK SEGMENT ******************************************* ;==================================================================================================== stack SEGMENT word STACK ASSUME ss:stack topStack LABEL word db 2048 dup(?) stack ENDS ;==================================================================================================== ; ************************************ DATA SEGMENT ******************************************* ;==================================================================================================== data SEGMENT word public ASSUME ds:data ;database product_database db 16000 dup(?) end_database db 1Bh cur_product_offset dw 0 ;inti protocol cur_database_ptr dw offset product_database data_count db 0 time_count db 0 protocol_phase db 0 programming db 0 progTime db 0 ;display display_buffer db 34 dup(0) cur_buffer_ptr dw 0 wait_str db " WAITING " programming_str db " PROGRAMMING " sys_err_str db "ERROR NEED RESET " err_str db " ERROR " sys_amount_str db " AMOUNT " sys_total_str db " TOTAL " ;printer have_paper db 1 print_ptr dw offset current_bill numChar_to_print dw 0 isPrinting db 0 ;keyboard isAmount db 0 isFunction db 0 cur_amount dw 1 cur_product_id dw 0 cur_product_price dw 0 data_str db " " amount_str db " " ;sys lock error db 0 lock_sys db 0 isReady db 0 ;function serialF0 db 0 ;counter counter_mode db 0 lad_cnt db 96h ;150x2mS char_cnt db 0Ah ;10x2mS cr_cnt db 64h ;100x2mS isLad db 0 isChar db 0 isCr db 0 ;time hours db 0 minutes db 0 seconds db 0 pclkSec dw 64h ;1s pclkDisplay dw 04h ;40mS show_clock db 0 time_str db " " ;bill current_bill db 512 dup(0) ;max 32 items(16B) cur_bill_ptr dw offset current_bill sending_bill db 0 cur_item_to_send dw 0 bill_price dw 0 ;daily sales total dw 0 sales_data db 14000 dup(0) cur_sales_ptr dw offset sales_data data ENDS ;==================================================================================================== ; *********************************** PROGRAM SEGMENT ***************************************** ;==================================================================================================== program SEGMENT AT 0FC000h ASSUME cs:program ;############################################################# ;---------------------- INIT --------------------------- ;############################################################# init proc near ;----------------------------------------------------- ; SET SEGMENT REGISTERS ;----------------------------------------------------- mov ax,prog_seg mov cs,ax mov ax,interrupt_seg mov es,ax mov ax, stack mov ss,ax mov sp, offset topStack mov ax, data mov ds,ax mov lock_sys,0 ;----------------------------------------------------- ; SET INTERRUPT ROUTINES ;----------------------------------------------------- ; zero div mov ax, offset div0Interrupt mov WORD PTR divz,ax mov ax, seg div0Interrupt mov WORD PTR [divz+02h],ax ; trap mov ax, offset trapInterrupt mov WORD PTR trap,ax mov ax, seg trapInterrupt mov WORD PTR [trap+02h],ax ; nmi mov ax, offset nmiInterrupt mov WORD PTR nmi,ax mov ax, seg nmiInterrupt mov WORD PTR [nmi+02h],ax ; brake point mov ax, offset brakeInterrupt mov WORD PTR brake,ax mov ax, seg brakeInterrupt mov WORD PTR [brake+02h],ax ; overflow mov ax, offset overflowInterrupt mov WORD PTR overflow,ax mov ax, seg overflowInterrupt mov WORD PTR [overflow+02h],ax ; falseInterrupt mov ax, offset falseInterrupt mov WORD PTR falseInt,ax mov ax, seg falseInterrupt mov WORD PTR [falseInt+02h],ax ; time mov ax, offset timeInterrupt mov WORD PTR time,ax mov ax, seg timeInterrupt mov WORD PTR [time+02h],ax ; counter mov ax, offset counterInterrupt mov WORD PTR counter,ax mov ax, seg counterInterrupt mov WORD PTR [counter+02h],ax ; keyboard mov ax, offset keyboardInterrupt mov WORD PTR keyboard,ax mov ax, seg keyboardInterrupt mov WORD PTR [keyboard+02h],ax ; serial mov ax, offset serialInterrupt mov WORD PTR serial,ax mov ax, seg serialInterrupt mov WORD PTR [serial+02h],ax ; printer mov ax, offset printerInterrupt mov WORD PTR printer,ax mov ax, seg printerInterrupt mov WORD PTR [printer+02h],ax ;----------------------------------------------------- ; INTERRUPT CONTROLLER 8259A ;----------------------------------------------------- mov al,icw1 out icw1_adr,al mov al,icw2 out icw2_adr,al mov al,icw4 out icw4_adr,al mov al,ocw1 out ocw1_adr,al ;------------------------------------------------------ ; TIMER 8254 ;----------------------------------------------------- mov al,cnt2_con out cnt2_adr,al mov al,cnt2_val out cnt2_adr,al mov al,cnt1_con out cnt1_adr,al mov al,cnt1_val_high out cnt1_adr,al mov al,cnt1_val_low out cnt1_adr,al mov al,cnt0_con out cnt0_adr,al mov al,cnt0_val_high out cnt0_adr,al mov al,cnt0_val_low out cnt0_adr,al ;----------------------------------------------------- ; PARALLEL 8255 ;----------------------------------------------------- ;keyboard mov al,key_control out key_con_adr,al mov al,init_key_val out key_portA,al ;display mov al,dis_control out dis_cnt_adr,al mov al,unselect_seg out dis_portA,al ;print mov al,print_control out print_cnt_adr,al mov al,0h out print_portA,al out print_portB,al out print_portC,al ;----------------------------------------------------- ; SERIAL 8251a ;----------------------------------------------------- mov al,serial_mode out serial_cnt_adr,al mov al,serial_com_T1R1 out serial_cnt_adr,al ;----------------------------------------------------- ; DISPLAY WAIT ;----------------------------------------------------- mov ax, offset wait_str push ax call fill_disply_buf init endp ;############################################################# ;--------------- INTERRUPT ROUTINES ---------------------- ;############################################################# ;div by zero div0Interrupt: iret ;trap trapInterrupt: iret ;nmi nmiInterrupt: iret ;brake brakeInterrupt: iret ;overflow overflowInterrupt: iret ;flase interrupt falseInterrupt: iret ;*********************************************************** ; TIME INTERRUPT ;*********************************************************** timeInterrupt: saveReg mov ax,pclkSec dec ax mov pclkSec,ax cmp ax,0 jne timeEnd mov pclkSec,64h inc seconds cmp seconds,60 jne setStrLab mov BYTE PTR seconds,0 inc minutes cmp minutes,60 jne setStrLab mov BYTE PTR minutes,0 inc hours cmp hours,24 jne setStrLab mov BYTE PTR hours,0 setStrLab: cmp show_clock,0 je timeEnd call time_to_string mov ax,offset time_str push ax call fill_disply_buf timeEnd: mov ax,pclkDisplay dec ax cmp ax,0 jne skipDisRefLab mov pclkDisplay,04h call display_refresh jmp tiEnd skipDisRefLab: mov pclkDisplay,ax tiEnd: mov al,eoi0_command out ocw2_adr,al resReg iret ;*********************************************************** ; COUNTER INTERRUPT ;*********************************************************** counterInterrupt: saveReg sti ;lad operations cmp isLad,1 jne cntModeLab dec lad_cnt cmp lad_cnt,0 jne cntModeLab mov lad_cnt,96h ;unlock keyboard mov al,unlockKeyboard out ocw1_adr,al cmp isPrinting,1 je ladSkipLab mov al,lad0wr0 out print_portB, al mov al,stop_counter out cnt0_adr,al jmp cntModeLab ladSkipLab: mov al,lad0wr1 out print_portB, al cntModeLab: cmp have_paper,0 je printErrLab cmp counter_mode,1 je mode1Lab cmp counter_mode,2 je mode2Lab cmp counter_mode,3 je mode3Lab jmp ciEnd printErrLab: ;no paper error mov isPrinting,0 cmp isLad,1 je pesLab mov al,lad0wr0 out print_portB,al mov al,stop_counter out cnt0_adr,al mov counter_mode,1 mov print_ptr,0 jmp ciEnd pesLab: mov al,lad1wr0 out print_portB,al mov counter_mode,1 mov print_ptr,0 jmp ciEnd mode1Lab: ;move char and start print mov bx,print_ptr mov al,[bx] inc bx mov print_ptr,bx out print_portA,al ;start print cmp isLad,1 je wrStartLab mov al,lad0wr1 out print_portB,al mov counter_mode,2 jmp ciEnd wrStartLab: mov al,lad1wr1 out print_portB,al mov counter_mode,2 jmp ciEnd mode2Lab: ;stop print and set wait cmp isLad,1 je wrStopLab mov al,lad0wr0 out print_portB,al jmp wrSkipLab wrStopLab: mov al,lad1wr0 out print_portB,al wrSkipLab: mov bx,print_ptr dec bx cmp BYTE PTR [bx],0Dh je crLab mov isChar,1 jmp skipCrLab crLab: mov isCr,1 skipCrLab: mov counter_mode,3 jmp ciEnd mode3Lab: ;set counters and waiting cmp isCr,1 jne charLab dec cr_cnt cmp cr_cnt,0 jne ciEnd mov cr_cnt,64h jmp chModeLab charLab: dec char_cnt cmp char_cnt,0 jne ciEnd mov char_cnt,0Ah jmp chModeLab chModeLab: mov bx,print_ptr dec bx cmp bx,1Bh je endPrintLab dec numChar_to_print cmp numChar_to_print,0 jne gotoM1Lab endPrintLab: mov counter_mode,0 mov print_ptr,offset current_bill mov isPrinting,0 mov al,ocw1 out ocw1_adr,al cmp isLad,1 je ciEnd mov al,stop_counter out print_portC,al jmp ciEnd gotoM1Lab: mov counter_mode,1 ciEnd: mov al,eoi1_command out ocw2_adr,al resReg iret ;*********************************************************** ; KEYBOARD INTERRUPT ;*********************************************************** keyboardInterrupt: saveReg xor bx,bx xor dx,dx sti ;--------------------- ; find pressed key ;-------------------- ; ROW 1 mov al, scan1 out key_portA,al in al,key_portB test al,mask1 jnz skip1 mov bl,00000111b jmp numLab skip1: test al,mask2 jnz skip2 mov bl,00001000b jmp numLab skip2: test al,mask3 jnz skip3 mov bl,00001001b jmp numLab skip3: test al,mask4 jnz skip4 mov bl,'F' jmp FLab skip4: ;ROW 2 mov al, scan2 out key_portA,al in al,key_portB test al,mask1 jnz skip5 mov bl,00000100b jmp numLab skip5: test al,mask2 jnz skip6 mov bl,00000101b jmp numLab skip6: test al,mask3 jnz skip7 mov bl,00000110b jmp numLab skip7: test al,mask4 jnz skip8 mov bl,'C' jmp CLab skip8: ;ROW 3 mov al, scan3 out key_portA,al in al,key_portB test al,mask1 jnz skip9 mov bl,00000001b jmp numLab skip9: test al,mask2 jnz skip10 mov bl,00000010b jmp numLab skip10: test al,mask3 jnz skip11 mov bl,00000011b jmp numLab skip11: test al,mask4 jnz skip12 mov bl,'+' jmp plusLab skip12: ;ROW 4 mov al, scan4 out key_portA,al in al,key_portB test al,mask1 jnz skip13 mov bl,'#' jmp minusLab skip13: test al,mask2 jnz skip14 mov bl,00000000b jmp numLab skip14: test al,mask3 jnz skip15 mov bl,'*' jmp mulLab skip15: test al,mask4 jnz skip16 mov bl,'=' jmp equLab skip16: ;noise mov al,eoi2_command out ocw2_adr,al iret ;------------------------ ; logic ;------------------------ numLab: cmp error,1 je keyEnd cmp isFunction,1 je funcLab cmp isAmount,1 je amountLab mov ax,cur_product_id mov dl,0Ah mul dl add ax,bx mov cur_product_id,ax mov dx,10h mul dx mov bx,ax mov cur_product_offset,bx ;display product ;move name to data_str mov show_clock,0 mov ax,ds push ax ;segment mov ax,0Ch push ax ;length 12 mov ax,offset data_str push ax ;dst offset mov ax,offset product_database add bx,ax push bx ;src offset call copy_string ;price is moved to data_str add bx,0Ch mov ax,[bx] mov cur_product_price,ax mov dx,ds push dx ;segment mov dx,offset data_str add dx,10h ;last location push dx ;offset push ax ;price call value_to_string ;prepare buffer mov ax,offset data_str push ax call fill_disply_buf jmp keyEnd amountLab: mov ax,cur_amount mov dl,0Ah mul dl add bx,ax mov cur_amount,bx ;display amount ;cur_amount to amount_str mov show_clock,0 mov si, offset amount_str add si,05h ;last location mov ax,ds push ax ;segment push si ;offset push bx ;value call value_to_string ;cur_price to amount_str add si,0Bh ;last location push ax ;segment push si ;offset mov ax,cur_product_price mul bx push ax ;val call value_to_string mov ax,offset amount_str push ax call fill_disply_buf jmp keyEnd funcLab: cmp bl,0 je func0 cmp bl,1 je func1 cmp bl,2 je func2 cmp bl,3 je func3 jmp keyEnd func0: call setup_sales_data mov ax,offset sales_data mov cur_item_to_send,ax mov numChar_to_print,16000 ;start transfer mov al,serial_com_T1R0 out serial_cnt_adr,al ;lock keyboard interrupt mov al,lockKeyboard out ocw1_adr,al ;set flags mov show_clock,1 jmp keyEnd func1: call setup_sales_data mov ax,offset sales_data mov print_ptr,ax mov numChar_to_print,16000 mov al,start_counter out print_portC,al ;lock keyboard interrupt mov al,lockKeyboard out ocw1_adr,al ;set flags mov show_clock,1 jmp keyEnd func2: ;display total mov bx, offset sys_total_str add bx,0Fh ;last location mov ax,ds push ax ;segment push bx ;offset mov ax,total push ax ;value call value_to_string mov ax, offset sys_total_str push ax call fill_disply_buf jmp keyEnd func3: ;open lad and start counter mov isLad,1 mov al,start_counter out print_portC,al cmp isPrinting,1 je ladSkip3Lab mov al,lad1wr0 out print_portB, al jmp keyEnd ladSkip3Lab: mov al,lad1wr1 out print_portB, al jmp keyEnd plusLab: cmp error,1 je keyEnd mov bx,offset product_database mov si,cur_product_offset add bx,si ;move name to bill_buf mov ax,ds push ax ;segment mov ax,0Ch push ax ;length 12 mov ax, cur_bill_ptr push ax ;dst offset add ax,0Ch mov cur_bill_ptr,ax push bx ;src offset call copy_string ;modify bill_price mov ax,cur_product_price mov dx,cur_amount mul dx mov dx,bill_price add dx,ax mov bill_price,dx ;inc total mov dx,total add dx,ax mov total,dx ;move product price to bill_buf mov dx,ds push dx ;segment mov si,cur_bill_ptr add si,05h push si ;offset push ax ;price call value_to_string ;new line mov BYTE PTR [si],0Dh inc si mov BYTE PTR [si],0Ah inc si mov cur_bill_ptr,si ;inc sold number add bx,0Eh mov ax,[bx] mov dx,cur_amount add ax,dx mov [bx],ax ;reset values mov cur_amount,0 mov cur_product_id,0 mov cur_product_offset,0 mov cur_product_price, 0 ;set display mov bx, offset sys_amount_str add bx,0Fh ;last location mov ax,ds push ax ;segment push bx ;offset mov ax,bill_price push ax ;value call value_to_string mov ax, offset sys_amount_str push ax call fill_disply_buf ;printing mov ax,numChar_to_print add ax,13h mov numChar_to_print,ax cmp isPrinting,1 je keyEnd mov isPrinting,1 mov print_ptr,offset current_bill mov counter_mode,1 ;mode 1-put data and wr=1 mov al,start_counter ;start counter out print_portC,al jmp keyEnd minusLab: cmp error,1 je keyEnd ;put '-' to bill mov bx,cur_bill_ptr mov BYTE PTR [bx],'-' inc bx mov cur_bill_ptr,bx mov bx,offset product_database mov si,cur_product_offset add bx,si mov ax,ds ;move name to bill_buf push ax ;segment mov ax,0Ch push ax ;length 12 mov ax, cur_bill_ptr push ax ;dst offset add ax,0Ch mov cur_bill_ptr,ax push bx ;src offset call copy_string ;modify bill_price mov ax,cur_product_price mov dx,cur_amount mul dx mov dx,bill_price add dx,ax mov bill_price,dx ;dec total mov dx,total sub dx,ax mov total,dx ;move product price to bill_buf mov dx,ds push dx ;segment mov si,cur_bill_ptr add si,05h push si ;offset push ax ;price call value_to_string ;new line mov BYTE PTR [si],0Dh inc si mov BYTE PTR [si],0Ah inc si mov cur_bill_ptr,si ;dec sold number add bx,0Eh mov ax,[bx] mov dx,cur_amount sub ax,dx mov [bx],ax ;reset values mov cur_amount,0 mov cur_product_id,0 mov cur_product_offset,0 mov cur_product_price, 0 ;set display mov bx, offset sys_amount_str add bx,0Fh ;last location mov ax,ds push ax ;segment push bx ;offset mov ax,bill_price push ax ;value call value_to_string mov ax, offset sys_amount_str push ax call fill_disply_buf jmp keyEnd ;printing mov ax,numChar_to_print add ax,14h mov numChar_to_print,ax cmp isPrinting,1 je keyEnd mov print_ptr,offset current_bill mov isPrinting,1 mov counter_mode,1 mov al,start_counter ;start counter out print_portC,al jmp keyEnd equLab: cmp error,1 je keyEnd ;prepare for print mov al,'=' mov si,cur_bill_ptr mov cx,0Ah equLoop: mov BYTE PTR [si],al inc si loop equLoop mov BYTE PTR [si],0Dh inc si mov BYTE PTR [si],0Ah inc si ;put total price mov ax,ds push ds ;seg push si ;off mov ax,bill_price push ax ;val call value_to_string mov BYTE PTR [si],1Bh ;escape ;reset values mov cur_bill_ptr,0 mov bill_price,0 mov isReady,1 ;display clock mov show_clock,1 ;open lad and start counter mov isLad,1 mov al,start_counter out print_portC,al cmp isPrinting,1 je ladSkip1Lab mov al,lad1wr0 out print_portB, al jmp ladSkip2Lab ladSkip1Lab: mov al,lad1wr1 out print_portB, al ladSkip2Lab: ;printing mov ax,numChar_to_print add ax,11h mov numChar_to_print,ax cmp isPrinting,1 je keyEnd mov isPrinting,1 mov counter_mode,1 mov al,start_counter ;start counter out print_portC,al jmp keyEnd FLab: cmp error,1 je keyEnd cmp isReady,1 jne errorLab mov isFunction,1 jmp keyEnd CLab: mov isFunction,0 mov cur_product_id,0 mov cur_amount,1 mov isAmount,0 mov show_clock,1 jmp keyEnd mulLab: cmp error,1 je keyEnd mov isAmount,1 jmp keyEnd errorLab: mov error,1 mov ax,offset err_str push ax call fill_disply_buf keyEnd: mov al, 0h out key_portA,al mov al,eoi2_command out ocw2_adr,al iret ;********************************************************* ; SERIAL INTERRUPT ;********************************************************* serialInterrupt: saveReg sti cmp serialF0,1 je F0Lab mov bx,offset product_database mov si,offset cur_database_ptr cmp protocol_phase,3 je phase3 cmp protocol_phase,2 je phase2 cmp protocol_phase,1 je phase1 cmp protocol_phase,0 je phase0 je siEnd phase0: ;start database init protocol ;transmit to PC SYN character mov al,16h out serial_data_adr,al mov al,protocol_phase inc al mov protocol_phase,al jmp siEnd phase1: ;turn off transmit mov al,serial_com_T0R1 out serial_cnt_adr,al mov al,protocol_phase inc al mov protocol_phase,al jmp siEnd phase2: ;receive SYN in al,serial_data_adr cmp al,16h jne siErr mov al,protocol_phase inc al mov protocol_phase,al push si mov ax,offset programming_str push ax call fill_disply_buf jmp siEnd phase3: ;programming in al,serial_data_adr cmp progTime,1 je timeLab cmp al,1bh je startTimeLab cmp data_count,11 jle nameLab cmp data_count,13 jle priceLab nameLab: mov [bx+si],al inc si mov cur_database_ptr,si inc data_count jmp siEnd priceLab: mov [bx+si],al inc si mov cur_database_ptr,si cmp data_count,13 je priceClearLab inc data_count jmp siEnd priceClearLab: mov data_count,0 mov BYTE PTR [bx+si],0 inc si mov BYTE PTR [bx+si],0 inc si mov cur_database_ptr,si jmp siEnd startTimeLab: cmp data_count,0 jne siErr mov progTime,1 jmp siEnd timeLab: mov bl,time_count cmp bl,0 je hoursLab cmp bl,1 je minutesLab cmp bl,2 je secondsLab hoursLab: mov hours,al inc bl mov time_count,bl jmp siEnd minutesLab: mov minutes,al inc bl mov time_count,bl jmp siEnd secondsLab: mov seconds,al inc bl mov time_count,bl mov al,serial_com_T0R0 out serial_cnt_adr,al mov cur_database_ptr,0 jmp siEnd F0Lab: mov bx,cur_item_to_send mov al,ds:[bx] inc bx mov cur_item_to_send,bx cmp al,1bh; escape like end jne send mov al,serial_com_T0R0 out serial_cnt_adr,al ;unmask keyboard interrupt mov al,ocw1 out ocw1_adr,al ;reset flags mov cur_bill_ptr,0 mov sending_bill,0 jmp siEnd send: out serial_data_adr,al jmp siEnd siErr: mov ax, offset sys_err_str push ax call fill_disply_buf mov lock_sys,1 siEnd: mov al,eoi3_command out ocw2_adr,al resReg iret ;********************************************************* ; PRINTER INTERRUPT ;********************************************************* printerInterrupt: mov have_paper,0 mov al,eoi4_command out ocw2_adr,al iret ;==================================================================================================== ;*********************************** UTILITY FUNCTIONS **************************************** ;==================================================================================================== ;############################################################# ; arg0: offset of src string (word) ; arg1: offset of dst string (word) ; arg2: length (word) ; arg3: segment (word) ;############################################################# copy_string proc near push bp mov bp,sp saveReg mov si,WORD PTR [bp+04h] mov ds,WORD PTR [bp+1Ah] mov di,WORD PTR [bp+06h] mov es,WORD PTR [bp+1Ah] mov cx,WORD PTR [bp+08h] cld rep movsb resReg pop bp ret 08h copy_string endp ;############################################################# ;############################################################# ; arg0: offset of string ; -string must have 17 bytes ;############################################################# fill_disply_buf proc near push bp mov bp,sp push si push di push cx mov si,[bp+04h]; mov di, offset display_buffer mov cx,17 petlja: cmp BYTE PTR ds:[si],'0' je LAB_0 cmp BYTE PTR ds:[si],'1' je LAB_1 cmp BYTE PTR ds:[si],'2' je LAB_2 cmp BYTE PTR ds:[si],'3' je LAB_3 cmp BYTE PTR ds:[si],'4' je LAB_4 cmp BYTE PTR ds:[si],'5' je LAB_5 cmp BYTE PTR ds:[si],'6' je LAB_6 cmp BYTE PTR ds:[si],'7' je LAB_7 cmp BYTE PTR ds:[si],'8' je LAB_8 cmp BYTE PTR ds:[si],'9' je LAB_9 cmp BYTE PTR ds:[si],'A' je LAB_A cmp BYTE PTR ds:[si],'B' je LAB_B cmp BYTE PTR ds:[si],'C' je LAB_C cmp BYTE PTR ds:[si],'D' je LAB_D cmp BYTE PTR ds:[si],'E' je LAB_E cmp BYTE PTR ds:[si],'F' je LAB_F cmp BYTE PTR ds:[si],'G' je LAB_G cmp BYTE PTR ds:[si],'H' je LAB_H cmp BYTE PTR ds:[si],'I' je LAB_I cmp BYTE PTR ds:[si],'J' je LAB_J cmp BYTE PTR ds:[si],'K' je LAB_K cmp BYTE PTR ds:[si],'L' je LAB_L cmp BYTE PTR ds:[si],'M' je LAB_M cmp BYTE PTR ds:[si],'N' je LAB_N cmp BYTE PTR ds:[si],'O' je LAB_O cmp BYTE PTR ds:[si],'P' je LAB_P cmp BYTE PTR ds:[si],'Q' je LAB_Q cmp BYTE PTR ds:[si],'R' je LAB_R cmp BYTE PTR ds:[si],'S' je LAB_S cmp BYTE PTR ds:[si],'T' je LAB_T cmp BYTE PTR ds:[si],'U' je LAB_U cmp BYTE PTR ds:[si],'V' je LAB_V cmp BYTE PTR ds:[si],'W' je LAB_W cmp BYTE PTR ds:[si],'X' je LAB_X cmp BYTE PTR ds:[si],'Y' je LAB_Y cmp BYTE PTR ds:[si],'Z' je LAB_Z cmp BYTE PTR ds:[si],' ' je LAB_SPACE cmp BYTE PTR ds:[si],'*' je LAB_MUL cmp BYTE PTR ds:[si],':' je LAB_DD LAB_0: mov BYTE PTR ds:[di],display0_b inc di mov BYTE PTR ds:[di],display0_c inc di LAB_1: mov BYTE PTR ds:[di],display1_b inc di mov BYTE PTR ds:[di],display1_c inc di LAB_2: mov BYTE PTR ds:[di],display2_b inc di mov BYTE PTR ds:[di],display2_c inc di LAB_3: mov BYTE PTR ds:[di],display3_b inc di mov BYTE PTR ds:[di],display3_c inc di LAB_4: mov BYTE PTR ds:[di],display4_b inc di mov BYTE PTR ds:[di],display4_c inc di LAB_5: mov BYTE PTR ds:[di],display5_b inc di mov BYTE PTR ds:[di],display5_c inc di LAB_6: mov BYTE PTR ds:[di],display6_b inc di mov BYTE PTR ds:[di],display6_c inc di LAB_7: mov BYTE PTR ds:[di],display7_b inc di mov BYTE PTR ds:[di],display7_c inc di LAB_8: mov BYTE PTR ds:[di],display8_b inc di mov BYTE PTR ds:[di],display8_c inc di LAB_9: mov BYTE PTR ds:[di],display9_b inc di mov BYTE PTR ds:[di],display9_c inc di LAB_A: mov BYTE PTR ds:[di],displayA_b inc di mov BYTE PTR ds:[di],displayA_c inc di LAB_B: mov BYTE PTR ds:[di],displayB_b inc di mov BYTE PTR ds:[di],displayB_c inc di LAB_C: mov BYTE PTR ds:[di],displayC_b inc di mov BYTE PTR ds:[di],displayC_c inc di LAB_D: mov BYTE PTR ds:[di],displayD_b inc di mov BYTE PTR ds:[di],displayD_c inc di LAB_E: mov BYTE PTR ds:[di],displayE_b inc di mov BYTE PTR ds:[di],displayE_c inc di LAB_F: mov BYTE PTR ds:[di],displayF_b inc di mov BYTE PTR ds:[di],displayF_c inc di LAB_G: mov BYTE PTR ds:[di],displayG_b inc di mov BYTE PTR ds:[di],displayG_c inc di LAB_H: mov BYTE PTR ds:[di],displayH_b inc di mov BYTE PTR ds:[di],displayH_c inc di LAB_I: mov BYTE PTR ds:[di],displayI_b inc di mov BYTE PTR ds:[di],displayI_c inc di LAB_J: mov BYTE PTR ds:[di],displayJ_b inc di mov BYTE PTR ds:[di],displayJ_c inc di LAB_K: mov BYTE PTR ds:[di],displayK_b inc di mov BYTE PTR ds:[di],displayK_c inc di LAB_L: mov BYTE PTR ds:[di],displayL_b inc di mov BYTE PTR ds:[di],displayL_c inc di LAB_M: mov BYTE PTR ds:[di],displayM_b inc di mov BYTE PTR ds:[di],displayM_c inc di LAB_N: mov BYTE PTR ds:[di],displayN_b inc di mov BYTE PTR ds:[di],displayN_c inc di LAB_O: mov BYTE PTR ds:[di],displayO_b inc di mov BYTE PTR ds:[di],displayO_c inc di LAB_P: mov BYTE PTR ds:[di],displayP_b inc di mov BYTE PTR ds:[di],displayP_c inc di LAB_Q: mov BYTE PTR ds:[di],displayQ_b inc di mov BYTE PTR ds:[di],displayQ_c inc di LAB_R: mov BYTE PTR ds:[di],displayR_b inc di mov BYTE PTR ds:[di],displayR_c inc di LAB_S: mov BYTE PTR ds:[di],displayS_b inc di mov BYTE PTR ds:[di],displayS_c inc di LAB_T: mov BYTE PTR ds:[di],displayT_b inc di mov BYTE PTR ds:[di],displayT_c inc di LAB_U: mov BYTE PTR ds:[di],displayU_b inc di mov BYTE PTR ds:[di],displayU_c inc di LAB_V: mov BYTE PTR ds:[di],displayV_b inc di mov BYTE PTR ds:[di],displayV_c inc di LAB_W: mov BYTE PTR ds:[di],displayW_b inc di mov BYTE PTR ds:[di],displayW_c inc di LAB_X: mov BYTE PTR ds:[di],displayX_b inc di mov BYTE PTR ds:[di],displayX_c inc di LAB_Y: mov BYTE PTR ds:[di],displayY_b inc di mov BYTE PTR ds:[di],displayY_c inc di LAB_Z: mov BYTE PTR ds:[di],displayZ_b inc di mov BYTE PTR ds:[di],displayZ_c inc di LAB_SPACE: mov BYTE PTR ds:[di],display_null inc di mov BYTE PTR ds:[di],display_null inc di LAB_MUL: mov BYTE PTR ds:[di],displayMul_b inc di mov BYTE PTR ds:[di],displayMul_c inc di LAB_DD: mov BYTE PTR ds:[di],displayDD_b inc di mov BYTE PTR ds:[di],displayDD_c inc di inc si dec cx jnz petlja pop cx pop di pop si pop bp retn 02h fill_disply_buf endp ;############################################################# ;############################################################# ; refresh display to show new value ; from display_buffer ;############################################################# display_refresh proc near push ax push bx push cx push si ;display buffer mov bx,offset display_buffer xor si,si ;seg 0 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg0 out dis_portA,al ;seg 1 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg1 out dis_portA,al ;seg 2 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg2 out dis_portA,al ;seg 3 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg3 out dis_portA,al ;seg 4 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg4 out dis_portA,al ;seg 5 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg5 out dis_portA,al ;seg 6 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg6 out dis_portA,al ;seg 7 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg7 out dis_portA,al ;seg 8 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg8 out dis_portA,al ;seg 9 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg9 out dis_portA,al ;seg 10 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg10 out dis_portA,al ;seg 11 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg11 out dis_portA,al ;seg 12 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg12 out dis_portA,al ;seg 13 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg13 out dis_portA,al ;seg 14 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg14 out dis_portA,al ;seg 15 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg15 out dis_portA,al ;seg 16 mov al,[bx+si] out dis_portB,al inc si mov al,[bx+si] out dis_portC,al inc si mov al,select_seg16 out dis_portA,al ;switch off mov al,unselect_seg out dis_portA,al pop si pop cx pop bx pop ax retn display_refresh endp ;############################################################# ;############################################################# ; time to string ; " h1h0 : m1mo : s1s0 " ;############################################################# time_to_string proc near push ax push bx push cx push si xor si,si xor ax,ax mov BYTE PTR [time_str+si],' ' inc si mov BYTE PTR [time_str+si],' ' inc si ;hours mov al,hours mov cl,0Ah div cl mov bl,al sub bl,'0' mov BYTE PTR [time_str+si],bl inc si mov bl,ah sub bl,'0' mov BYTE PTR [time_str+si],bl inc si mov BYTE PTR [time_str+si],' ' inc si mov BYTE PTR [time_str+si],':' inc si mov BYTE PTR [time_str+si],' ' inc si ;minutes mov al,minutes mov cl,0Ah div cl mov bl,al sub bl,'0' mov BYTE PTR [time_str+si],bl inc si mov bl,ah sub bl,'0' mov BYTE PTR [time_str+si],bl inc si mov BYTE PTR [time_str+si],' ' inc si mov BYTE PTR [time_str+si],':' inc si mov BYTE PTR [time_str+si],' ' inc si ;seconds mov al,minutes mov cl,0Ah div cl mov bl,al sub bl,'0' mov BYTE PTR [time_str+si],bl inc si mov bl,ah sub bl,'0' mov BYTE PTR [time_str+si],bl inc si mov BYTE PTR [time_str+si],' ' inc si mov BYTE PTR [time_str+si],' ' inc si cmp sending_bill,1 je starLab mov BYTE PTR [time_str+si],' ' jmp notStarLab starLab: mov BYTE PTR [time_str+si],'*' notStarLab: pop si pop cx pop bx pop ax retn time_to_string endp ;############################################################# ;############################################################# ; int to string ; arg0: value (word) ; arg1: destination offset (last location) ; arg2: destination segment ;############################################################# value_to_string proc near push bp mov bp,sp saveReg mov ax,[bp+02h] mov di,[bp+04h] mov bx,[bp+06h] mov ds,bx mov cx,0Ah mov si,05h convert: xor dx,dx div cx add dl,'0' mov ds:[di],dl dec di dec si cmp ax,0 jne convert le5Lab: cmp si,0 je conEnd mov BYTE PTR ds:[di],' ' dec di dec si jmp le5Lab conEnd: resReg pop bp retn 06h value_to_string endp ;############################################################# ;############################################################# ; setup sales data ;############################################################# setup_sales_data proc near saveReg mov bx,offset product_database xor si,si mov di,14 mov cx,1000 xor dx,dx setupLoop: mov ax,[bx+di] cmp ax,0 je skipSetupLab mov WORD PTR [bx+di],0 mov dx,ds push dx ;seg for next func push dx ;seg mov dx,0Ch push dx ;length mov dx,cur_sales_ptr push dx ;dst push si ;src call copy_string ;copy name add dx,0Ch push dx push ax call value_to_string ;copy num of sales add dx,05h mov cur_sales_ptr,dx skipSetupLab: add si,10h add di,10h loop setupLoop mov bx,dx mov BYTE PTR [bx],1Bh mov cur_sales_ptr,offset sales_data resReg setup_sales_data endp ;############################################################# ;==================================================================================================== ;************************************** MAIN ************************************************** ;==================================================================================================== startADR: cli ; inti system call init sti labStart: nop cmp lock_sys,0 je labStart cli labLock: nop ;system error detected jmp labLock program ENDS END startADR
lab3_test_harness/Lab1test/lshf.asm
Zaydax/PipelineProcessor
2
169793
<gh_stars>1-10 .ORIG x3000 AND R0, R0, #0 ADD R0, R0, xa LSHF R1, R0, #0 LSHF R2, R0, #3 LSHF R3, R0, #5 LSHF R4, R0, #8 LSHF R5, R0, #9 LSHF R6, R0, #13 LSHF R7, R0, #15 HALT .END
problems/027/a027.adb
melwyncarlo/ProjectEuler
0
18037
<gh_stars>0 with Ada.Text_IO; with Ada.Integer_Text_IO; -- Copyright 2021 <NAME> procedure A027 is use Ada.Text_IO; use Ada.Integer_Text_IO; -- File Reference: http://www.naturalnumbers.org/primes.html FT : File_Type; Last_Index : Natural; Prime_Num : String (1 .. 10); File_Name : constant String := "problems/003/PrimeNumbers_Upto_1000000"; Primes_List : array (Integer range 1 .. 1000) of Integer; A : Integer := -999; B_Count : Integer := 0; A_Max : Integer := 0; B_Max : Integer := 0; N_Max : Integer := 0; I : Integer := 1; B, N, J, Max_Prime : Integer; begin Open (FT, In_File, File_Name); while not End_Of_File (FT) and I /= 1000 loop Get_Line (FT, Prime_Num, Last_Index); if Integer'Value (Prime_Num (1 .. Last_Index)) < 1000 then B_Count := B_Count + 1; end if; Primes_List (I) := Integer'Value (Prime_Num (1 .. Last_Index)); I := I + 1; end loop; Close (FT); while A < 1000 loop B := 1; while B < B_Count loop N := 1; J := 1; Max_Prime := (N * N) + (A * N) + Primes_List (B); while J < 1000 loop if Primes_List (J) > Max_Prime then exit; end if; if Max_Prime = Primes_List (J) then N := N + 1; J := 1; Max_Prime := (N * N) + (A * N) + Primes_List (B); goto Continue; end if; J := J + 1; <<Continue>> end loop; if N > N_Max then N_Max := N; A_Max := A; B_Max := Primes_List (B); end if; B := B + 1; end loop; A := A + 1; end loop; Put (A_Max * B_Max, Width => 0); end A027;
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1446.asm
ljhsiun2/medusa
9
4613
<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1446.asm .global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r8 push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x12c5e, %rsi lea addresses_UC_ht+0x1696e, %rdi nop nop xor $51891, %r8 mov $41, %rcx rep movsl nop sub %rdx, %rdx lea addresses_WT_ht+0x816e, %rsi lea addresses_A_ht+0xa5ce, %rdi nop sub $64719, %rdx mov $74, %rcx rep movsq sub %rdx, %rdx lea addresses_WC_ht+0x199d4, %rsi nop nop nop dec %r12 movb (%rsi), %r8b nop nop nop nop and %rdi, %rdi lea addresses_UC_ht+0x1e59e, %r12 nop nop nop and $20294, %r13 mov (%r12), %rsi nop nop nop nop nop cmp %rdx, %rdx lea addresses_normal_ht+0x1556e, %rsi lea addresses_UC_ht+0x1ba30, %rdi clflush (%rsi) nop nop nop nop and %r8, %r8 mov $20, %rcx rep movsw nop nop nop sub $44780, %r12 lea addresses_A_ht+0x1648e, %rcx dec %rsi mov $0x6162636465666768, %rdi movq %rdi, %xmm2 movups %xmm2, (%rcx) nop xor $54711, %rcx lea addresses_A_ht+0x1388e, %rdi and %rsi, %rsi mov (%rdi), %r8d nop and %rcx, %rcx lea addresses_A_ht+0x1a36e, %rdx nop nop nop nop and $4530, %rsi movups (%rdx), %xmm5 vpextrq $0, %xmm5, %r13 and %r12, %r12 lea addresses_WT_ht+0x1c146, %rsi lea addresses_D_ht+0x1b716, %rdi nop nop nop nop inc %r14 mov $40, %rcx rep movsb nop nop nop nop nop lfence lea addresses_WT_ht+0x3d56, %rcx clflush (%rcx) inc %r13 movups (%rcx), %xmm7 vpextrq $0, %xmm7, %rdx nop nop nop cmp $60210, %rdi lea addresses_WT_ht+0x2d6e, %rdx nop nop sub $4977, %rsi mov $0x6162636465666768, %rdi movq %rdi, (%rdx) inc %rdx lea addresses_UC_ht+0x6d6e, %rdx nop cmp $10398, %r8 mov $0x6162636465666768, %r14 movq %r14, %xmm2 movups %xmm2, (%rdx) cmp $14990, %r14 lea addresses_normal_ht+0xe87b, %rsi lea addresses_A_ht+0x3bee, %rdi nop nop nop cmp $53338, %r8 mov $35, %rcx rep movsq add $23582, %r12 lea addresses_normal_ht+0x9bae, %r13 nop nop nop and $43161, %r8 mov $0x6162636465666768, %rsi movq %rsi, %xmm3 movups %xmm3, (%r13) nop nop add $37901, %r14 pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %r9 push %rdi push %rdx push %rsi // Store lea addresses_RW+0x1560e, %r9 nop nop nop dec %r15 movw $0x5152, (%r9) nop cmp %rdi, %rdi // Faulty Load lea addresses_normal+0xb16e, %r12 sub %rsi, %rsi mov (%r12), %dx lea oracles, %r15 and $0xff, %rdx shlq $12, %rdx mov (%r15,%rdx,1), %rdx pop %rsi pop %rdx pop %rdi pop %r9 pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_normal', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': True, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
programs/oeis/045/A045945.asm
karttu/loda
1
21155
; A045945: Hexagonal matchstick numbers: a(n) = 3*n*(3*n+1). ; 0,12,42,90,156,240,342,462,600,756,930,1122,1332,1560,1806,2070,2352,2652,2970,3306,3660,4032,4422,4830,5256,5700,6162,6642,7140,7656,8190,8742,9312,9900,10506,11130,11772,12432,13110,13806,14520,15252,16002,16770,17556,18360,19182,20022,20880,21756,22650,23562,24492,25440,26406,27390,28392,29412,30450,31506,32580,33672,34782,35910,37056,38220,39402,40602,41820,43056,44310,45582,46872,48180,49506,50850,52212,53592,54990,56406,57840,59292,60762,62250,63756,65280,66822,68382,69960,71556,73170,74802,76452,78120,79806,81510,83232,84972,86730,88506,90300,92112,93942,95790,97656,99540,101442,103362,105300,107256,109230,111222,113232,115260,117306,119370,121452,123552,125670,127806,129960,132132,134322,136530,138756,141000,143262,145542,147840,150156,152490,154842,157212,159600,162006,164430,166872,169332,171810,174306,176820,179352,181902,184470,187056,189660,192282,194922,197580,200256,202950,205662,208392,211140,213906,216690,219492,222312,225150,228006,230880,233772,236682,239610,242556,245520,248502,251502,254520,257556,260610,263682,266772,269880,273006,276150,279312,282492,285690,288906,292140,295392,298662,301950,305256,308580,311922,315282,318660,322056,325470,328902,332352,335820,339306,342810,346332,349872,353430,357006,360600,364212,367842,371490,375156,378840,382542,386262,390000,393756,397530,401322,405132,408960,412806,416670,420552,424452,428370,432306,436260,440232,444222,448230,452256,456300,460362,464442,468540,472656,476790,480942,485112,489300,493506,497730,501972,506232,510510,514806,519120,523452,527802,532170,536556,540960,545382,549822,554280,558756 mul $0,3 mov $1,$0 pow $0,2 add $1,$0
data/mapHeaders/silphco4.asm
adhi-thirumala/EvoYellow
16
88924
<filename>data/mapHeaders/silphco4.asm SilphCo4_h: db FACILITY ; tileset db SILPH_CO_4F_HEIGHT, SILPH_CO_4F_WIDTH ; dimensions (y, x) dw SilphCo4Blocks, SilphCo4TextPointers, SilphCo4Script ; blocks, texts, scripts db $00 ; connections dw SilphCo4Object ; objects
libsrc/video/tms9918/msx_vmerge.asm
jpoikela/z88dk
640
91458
<gh_stars>100-1000 ; ; MSX specific routines ; ; GFX - a small graphics library ; Copyright (C) 2004 <NAME> ; ; extern void vmerge(unsigned int addr, unsigned char value); ; ; set \a value at a given vram address \a addr, merging bits (OR) with the existing value ; ; $Id: msx_vmerge.asm,v 1.6 2016-06-16 19:30:25 dom Exp $ ; SECTION code_clib PUBLIC msx_vmerge PUBLIC _msx_vmerge EXTERN l_tms9918_disable_interrupts EXTERN l_tms9918_enable_interrupts INCLUDE "video/tms9918/vdp.inc" msx_vmerge: _msx_vmerge: ; enter vdp address pointer pop bc pop de pop hl push hl ; addr push de ; value push bc ; RET address call l_tms9918_disable_interrupts IF VDP_CMD < 0 ld bc,-VDP_CMD ld a,l ld (bc),a ELSE ld bc,VDP_CMD out (c),l ENDIF ld a,h and @00111111 IF VDP_CMD < 0 ld (bc),a ELSE out (c),a ENDIF ; read data IF VDP_DATAIN < 0 ld bc,-VDP_DATAIN ld a,(bc) ELSE ld bc,VDP_DATAIN in a,(c) ENDIF or e ld e,a ; The new value ; enter same address IF VDP_CMD < 0 ld bc,-VDP_CMD ld a,l ld (bc),a ELSE ld bc,VDP_CMD out (c),l ENDIF ld a,h or @01000000 IF VDP_DATA < 0 ld (bc),a ld bc,-VDP_DATA ld a,e ld (bc),a ELSE out (c),a ld bc, VDP_DATA out (c),e ENDIF call l_tms9918_enable_interrupts ret
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0_notsx.log_6_1323.asm
ljhsiun2/medusa
9
167203
<filename>Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0_notsx.log_6_1323.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r14 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x1439a, %r8 nop nop nop nop nop xor $17009, %r12 mov $0x6162636465666768, %r13 movq %r13, %xmm1 vmovups %ymm1, (%r8) nop nop nop add %r10, %r10 lea addresses_WT_ht+0x1153a, %r8 clflush (%r8) nop xor $43807, %rbx movw $0x6162, (%r8) nop nop nop nop and $36136, %r10 lea addresses_normal_ht+0x70e2, %rsi lea addresses_D_ht+0x8d3a, %rdi nop xor %r14, %r14 mov $82, %rcx rep movsb nop add %r12, %r12 lea addresses_UC_ht+0x1e07d, %r14 nop nop nop nop inc %r12 movw $0x6162, (%r14) nop nop nop nop nop and $6346, %rdi lea addresses_UC_ht+0x8582, %r13 nop nop nop nop nop sub %rcx, %rcx movl $0x61626364, (%r13) cmp $5106, %rcx lea addresses_normal_ht+0x79ba, %rsi nop nop cmp $53636, %r12 mov $0x6162636465666768, %rdi movq %rdi, %xmm0 movups %xmm0, (%rsi) nop nop xor %r14, %r14 lea addresses_A_ht+0x1d83a, %rcx nop cmp $61869, %rsi mov (%rcx), %edi nop nop nop cmp %r10, %r10 lea addresses_D_ht+0x11eda, %rsi lea addresses_UC_ht+0x4492, %rdi clflush (%rsi) nop nop cmp %r8, %r8 mov $120, %rcx rep movsw nop nop nop nop nop sub $3394, %r14 lea addresses_D_ht+0x9f6a, %rsi dec %rcx mov (%rsi), %r12w nop nop nop nop nop xor $31096, %r8 lea addresses_WT_ht+0x1be3a, %r8 nop nop nop nop nop cmp %r13, %r13 movb (%r8), %r14b nop nop nop nop nop sub %rsi, %rsi lea addresses_UC_ht+0xf07a, %r10 clflush (%r10) nop inc %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm1 movups %xmm1, (%r10) cmp $6079, %r10 lea addresses_UC_ht+0x106da, %rsi lea addresses_WC_ht+0x1dbba, %rdi clflush (%rdi) nop nop nop nop cmp $34790, %r10 mov $51, %rcx rep movsl nop nop inc %r10 lea addresses_UC_ht+0x1d63a, %rsi lea addresses_A_ht+0x177e2, %rdi nop nop nop nop nop dec %r10 mov $93, %rcx rep movsb nop nop xor %r13, %r13 pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r14 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %r8 push %rbp push %rcx push %rdx push %rsi // Store lea addresses_A+0x587a, %rcx xor %rbp, %rbp mov $0x5152535455565758, %r11 movq %r11, %xmm5 movups %xmm5, (%rcx) nop nop add $10873, %r8 // Store lea addresses_WT+0xc13a, %r11 and $43926, %r15 movl $0x51525354, (%r11) nop nop sub $35152, %r11 // Store lea addresses_A+0xe23a, %rcx nop nop nop nop xor $25057, %r15 mov $0x5152535455565758, %rbp movq %rbp, %xmm2 movups %xmm2, (%rcx) nop and %rsi, %rsi // Faulty Load lea addresses_US+0x1f63a, %r8 nop nop nop nop cmp %rdx, %rdx mov (%r8), %rcx lea oracles, %rdx and $0xff, %rcx shlq $12, %rcx mov (%rdx,%rcx,1), %rcx pop %rsi pop %rdx pop %rcx pop %rbp pop %r8 pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 10}} [Faulty Load] {'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 8}} {'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}} {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}} {'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}} {'00': 6} 00 00 00 00 00 00 */
third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-wc32-U8D.asm
Fimbure/icebox-1
521
6381
; $Id: bs3-wc32-U8D.asm $ ;; @file ; BS3Kit - 32-bit Watcom C/C++, 64-bit unsigned integer division. ; ; ; Copyright (C) 2007-2017 Oracle Corporation ; ; This file is part of VirtualBox Open Source Edition (OSE), as ; available from http://www.virtualbox.org. This file is free software; ; you can redistribute it and/or modify it under the terms of the GNU ; General Public License (GPL) as published by the Free Software ; Foundation, in version 2 as it comes in the "COPYING" file of the ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. ; ; The contents of this file may alternatively be used under the terms ; of the Common Development and Distribution License Version 1.0 ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the ; VirtualBox OSE distribution, in which case the provisions of the ; CDDL are applicable instead of those of the GPL. ; ; You may elect to license modified versions of this file under the ; terms and conditions of either the GPL or the CDDL or both. ; %include "bs3kit-template-header.mac" BS3_EXTERN_CMN Bs3UInt64Div ;; ; 64-bit unsigned integer division. ; ; @returns EDX:EAX Quotient, ECX:EBX Remainder. ; @param EDX:EAX Dividend. ; @param ECX:EBX Divisor ; global $??U8D $??U8D: ; ; Convert to a C __cdecl call - not doing this in assembly. ; ; Set up a frame, allocating 16 bytes for the result buffer. push ebp mov ebp, esp sub esp, 10h ; Pointer to the return buffer. push esp ; The divisor. push ecx push ebx ; The dividend. push edx push eax call Bs3UInt64Div ; Load the result. mov ecx, [ebp - 10h + 12] mov ebx, [ebp - 10h + 8] mov edx, [ebp - 10h + 4] mov eax, [ebp - 10h] leave ret
1-base/math/source/generic/pure/algebra/any_math-any_algebra-any_linear-any_d2.ads
charlie5/lace
20
22024
<gh_stars>10-100 generic package any_Math.any_Algebra.any_linear.any_d2 is pragma Pure; ----------- -- Vector_2 -- function Interpolated (From, To : in Vector_2; Percent : in Percentage) return Vector_2; function Distance (From, To : in Vector_2) return Real; function Midpoint (From, To : in Vector_2) return Vector_2; function Angle_between_pre_Norm (U, V : in Vector_2) return Radians; -- -- Given that the vectors 'U' and 'V' are already normalized, returns a positive angle between 0 and 180 degrees. ------------- -- Matrix_2x2 -- function to_Matrix (Row_1, Row_2 : in Vector_2) return Matrix_2x2; function to_rotation_Matrix (Angle : in Radians) return Matrix_2x2; function up_Direction (Self : in Matrix_2x2) return Vector_2; function right_Direction (Self : in Matrix_2x2) return Vector_2; ------------ -- Transform -- function to_Transform (Rotation : in Matrix_2x2; Translation : in Vector_2) return Matrix_3x3; function to_Transform (From : in Transform_2d) return Matrix_3x3; function to_translation_Transform (Translation : in Vector_2) return Matrix_3x3; function to_rotation_Transform (Rotation : in Matrix_2x2) return Matrix_3x3; function to_rotation_Transform (Angle : in Radians ) return Matrix_3x3; function to_scale_Transform (Scale : in Vector_2) return Matrix_3x3; function to_Transform_2d (From : in Matrix_3x3) return Transform_2d; function to_Transform_2d (Rotation : in Radians; Translation : in Vector_2) return Transform_2d; function "*" (Left : in Vector_2; Right : in Transform_2d) return Vector_2; function "*" (Left : in Vector_2; Right : in Matrix_3x3) return Vector_2; function Invert (Transform : in Transform_2d) return Transform_2d; function inverse_Transform (Transform : in Transform_2d; Vector : in Vector_2) return Vector_2; function get_Rotation (Transform : in Matrix_3x3) return Matrix_2x2; procedure set_Rotation (Transform : in out Matrix_3x3; To : in Matrix_2x2); function get_Translation (Transform : in Matrix_3x3) return Vector_2; procedure set_Translation (Transform : in out Matrix_3x3; To : in Vector_2); end any_Math.any_Algebra.any_linear.any_d2;
programs/oeis/100/A100163.asm
karttu/loda
0
241041
; A100163: Structured disdyakis dodecahedral numbers (vertex structure 5). ; 1,26,119,324,685,1246,2051,3144,4569,6370,8591,11276,14469,18214,22555,27536,33201,39594,46759,54740,63581,73326,84019,95704,108425,122226,137151,153244,170549,189110,208971,230176,252769,276794,302295,329316,357901,388094,419939,453480,488761,525826,564719,605484,648165,692806,739451,788144,838929,891850,946951,1004276,1063869,1125774,1190035,1256696,1325801,1397394,1471519,1548220,1627541,1709526,1794219,1881664,1971905,2064986,2160951,2259844,2361709,2466590,2574531,2685576,2799769,2917154,3037775,3161676,3288901,3419494,3553499,3690960,3831921,3976426,4124519,4276244,4431645,4590766,4753651,4920344,5090889,5265330,5443711,5626076,5812469,6002934,6197515,6396256,6599201,6806394,7017879,7233700,7453901,7678526,7907619,8141224,8379385,8622146,8869551,9121644,9378469,9640070,9906491,10177776,10453969,10735114,11021255,11312436,11608701,11910094,12216659,12528440,12845481,13167826,13495519,13828604,14167125,14511126,14860651,15215744,15576449,15942810,16314871,16692676,17076269,17465694,17860995,18262216,18669401,19082594,19501839,19927180,20358661,20796326,21240219,21690384,22146865,22609706,23078951,23554644,24036829,24525550,25020851,25522776,26031369,26546674,27068735,27597596,28133301,28675894,29225419,29781920,30345441,30916026,31493719,32078564,32670605,33269886,33876451,34490344,35111609,35740290,36376431,37020076,37671269,38330054,38996475,39670576,40352401,41041994,41739399,42444660,43157821,43878926,44608019,45345144,46090345,46843666,47605151,48374844,49152789,49939030,50733611,51536576,52347969,53167834,53996215,54833156,55678701,56532894,57395779,58267400,59147801,60037026,60935119,61842124,62758085,63683046,64617051,65560144,66512369,67473770,68444391,69424276,70413469,71412014,72419955,73437336,74464201,75500594,76546559,77602140,78667381,79742326,80827019,81921504,83025825,84140026,85264151,86398244,87542349,88696510,89860771,91035176,92219769,93414594,94619695,95835116,97060901,98297094,99543739,100800880,102068561,103346826,104635719,105935284,107245565,108566606,109898451,111241144,112594729,113959250 mov $6,$0 lpb $0,1 add $2,$0 sub $0,1 add $1,5 add $2,$1 add $1,4 add $5,$2 lpe add $5,1 mov $1,$5 add $1,3 add $3,3 add $1,$3 add $1,2 mul $1,2 mov $2,$1 mov $1,2 mov $4,$5 mul $4,2 add $2,$4 add $1,$2 lpb $6,1 add $1,1 sub $6,1 lpe sub $1,21
test/asm_exe/uninit03.asm
nigelperks/BasicAssembler
0
178265
<gh_stars>0 ; UNINIT stack segment IDEAL SEGMENT SEG1 ASSUME CS:SEG1 start: mov di, OFFSET stk push ax int 20h ENDS SEG1 SEGMENT SEG2 STACK UNINIT stk DB 14h DUP (?) ENDS END start
src/tests/spectre_v1.1.asm
microsoft/sca-fuzzer
2
84610
.intel_syntax noprefix MOV rcx, r14 # initialize eax and ebx with two random values XOR rax, rax XOR rbx, rbx IMUL edi, edi, 2891336453 ADD edi, 12345 MOV eax, edi IMUL edi, edi, 2891336453 ADD edi, 12345 MOV ebx, edi LFENCE # delay the cond. jump LEA rbx, [rbx + rax + 1] LEA rbx, [rbx + rax + 1] LEA rbx, [rbx + rax + 1] LEA rbx, [rbx + rax + 1] LEA rbx, [rbx + rax + 1] LEA rbx, [rbx + rax + 1] LEA rbx, [rbx + rax + 1] LEA rbx, [rbx + rax + 1] LEA rbx, [rbx + rax + 1] LEA rbx, [rbx + rax + 1] SHL rbx, 62 SHR rbx, 62 # speculative offset: # these shifts generate a random page offset, 64-bit aligned SHL rax, 58 SHR rax, 52 # speculation CMP rbx, 0 JE .l1 # rbx != 0 MOV qword ptr [rcx + rax], 42 JMP .l2 .l1: # rbx == 0 MOV qword ptr [rcx + 64], 42 .l2: MFENCE
test_eval.adb
DerickEddington/tarmi
0
30040
<reponame>DerickEddington/tarmi with Text_IO; use Text_IO; with Tarmi; use Tarmi; with Tarmi.Environments; use Tarmi.Environments; with Tarmi.Evaluation; use Tarmi.Evaluation; with Tarmi.Symbols; use Tarmi.Symbols; with Tarmi.Combiners; use Tarmi.Combiners; use type Tarmi.Datum; procedure Test_Eval is Env : Environment := Make_Environment ((Datum(Interned("foo")), Nil)); A : Datum := Eval (Nil, Env); B : Datum := Eval (Datum(Interned("foo")), Env); Op1 : Operative := new Operative_R'(Param_Tree_Formals => Ignore , Dyn_Env_Formal => Ignore , Static_Env => Env , Body_Form => Datum (Interned("foo")) ) ; Expr1 : Pair := new Pair_R'(Datum (Op1), Nil) ; C : Datum := Eval (Datum (Expr1), Env); -- Op2 : Operative_R := (Param_Tree_Formals => Interned("foo") , -- Dyn_Env_Formal => Ignore , -- Static_Env => Env , -- Body_Form => ) ; begin Put_Line (Boolean'Image(A = Nil)); Put_Line (Boolean'Image(B = Nil)); Put_Line (Boolean'Image(C = Nil)); end Test_Eval;
deps/mozjs/js/src/jswin64.asm
zpao/spidernode
48
87478
<filename>deps/mozjs/js/src/jswin64.asm ; ***** BEGIN LICENSE BLOCK ***** ; Version: MPL 1.1/GPL 2.0/LGPL 2.1 ; ; The contents of this file are subject to the Mozilla Public License Version ; 1.1 (the "License"); you may not use this file except in compliance with ; the License. You may obtain a copy of the License at ; http://www.mozilla.org/MPL/ ; ; Software distributed under the License is distributed on an "AS IS" basis, ; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ; for the specific language governing rights and limitations under the ; License. ; ; The Original Code is mozilla.org code. ; ; The Initial Developer of the Original Code is The Mozilla Foundation. ; Portions created by the Initial Developer are Copyright (C) 2011 ; the Initial Developer. All Rights Reserved. ; ; Contributor(s): ; <NAME> <<EMAIL>> (Original Author) ; ; Alternatively, the contents of this file may be used under the terms of ; either the GNU General Public License Version 2 or later (the "GPL"), or ; the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ; in which case the provisions of the GPL or the LGPL are applicable instead ; of those above. If you wish to allow use of your version of this file only ; under the terms of either the GPL or the LGPL, and not to allow others to ; use your version of this file under the terms of the MPL, indicate your ; decision by deleting the provisions above and replace them with the notice ; and other provisions required by the GPL or the LGPL. If you do not delete ; the provisions above, a recipient may use your version of this file under ; the terms of any one of the MPL, the GPL or the LGPL. ; ; ***** END LICENSE BLOCK ***** .CODE extern fmod:PROC ; This is a workaround for KB982107 (http://support.microsoft.com/kb/982107) js_myfmod PROC FRAME .ENDPROLOG fnclex jmp fmod js_myfmod ENDP END
programs/oeis/153/A153037.asm
karttu/loda
1
97259
<gh_stars>1-10 ; A153037: a(n) = 2*n^2 + 16*n + 23. ; 23,41,63,89,119,153,191,233,279,329,383,441,503,569,639,713,791,873,959,1049,1143,1241,1343,1449,1559,1673,1791,1913,2039,2169,2303,2441,2583,2729,2879,3033,3191,3353,3519,3689,3863,4041,4223,4409,4599,4793,4991,5193,5399,5609,5823,6041,6263,6489,6719,6953,7191,7433,7679,7929,8183,8441,8703,8969,9239,9513,9791,10073,10359,10649,10943,11241,11543,11849,12159,12473,12791,13113,13439,13769,14103,14441,14783,15129,15479,15833,16191,16553,16919,17289,17663,18041,18423,18809,19199,19593,19991,20393,20799,21209,21623,22041,22463,22889,23319,23753,24191,24633,25079,25529,25983,26441,26903,27369,27839,28313,28791,29273,29759,30249,30743,31241,31743,32249,32759,33273,33791,34313,34839,35369,35903,36441,36983,37529,38079,38633,39191,39753,40319,40889,41463,42041,42623,43209,43799,44393,44991,45593,46199,46809,47423,48041,48663,49289,49919,50553,51191,51833,52479,53129,53783,54441,55103,55769,56439,57113,57791,58473,59159,59849,60543,61241,61943,62649,63359,64073,64791,65513,66239,66969,67703,68441,69183,69929,70679,71433,72191,72953,73719,74489,75263,76041,76823,77609,78399,79193,79991,80793,81599,82409,83223,84041,84863,85689,86519,87353,88191,89033,89879,90729,91583,92441,93303,94169,95039,95913,96791,97673,98559,99449,100343,101241,102143,103049,103959,104873,105791,106713,107639,108569,109503,110441,111383,112329,113279,114233,115191,116153,117119,118089,119063,120041,121023,122009,122999,123993,124991,125993,126999,128009 mov $1,$0 add $0,8 mul $1,$0 mul $1,2 add $1,23
oeis/166/A166358.asm
neoneye/loda-programs
11
8710
; A166358: Row sums of exponential Riordan array [1+x*arctanh(x), x], A166357. ; Submitted by <NAME> ; 1,1,3,7,21,61,295,1331,10409,65017,694411,5454879,73145149,689074101,11090013103,121652191051,2282132463953,28550033871857,611369381873683,8587415858721079,206626962757626981,3219065122124476717 mov $1,$0 trn $0,1 seq $0,291484 ; Expansion of e.g.f. arctanh(x)*exp(x). mul $0,$1 add $0,1
src/u1/p9.asm
luishendrix92/lenguajezinterfaz
0
4229
<reponame>luishendrix92/lenguajezinterfaz ; 9 - Programa que dibuja un triángulo en pantalla ; <NAME> ; 15211312 ; 24 de Septiembre del 2018 .Model small .stack 64 .Data .Code mov ax,03h int 10h mov ah,02h mov dh,5 mov dl,39 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,6 mov dl,38 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,6 mov dl,40 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,7 mov dl,37 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,7 mov dl,41 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,8 mov dl,36 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,8 mov dl,42 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,9 mov dl,35 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,9 mov dl,43 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,10 mov dl,34 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,10 mov dl,44 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,11 mov dl,33 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,11 mov dl,45 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,12 mov dl,32 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,12 mov dl,46 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,13 mov dl,31 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,13 mov dl,47 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,14 mov dl,30 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,14 mov dl,48 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,29 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,30 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,31 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,32 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,33 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,34 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,35 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,36 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,37 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,38 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,39 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,40 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,41 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,42 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,43 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,44 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,45 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,46 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,47 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,48 int 10h mov dx,111 mov ah,02h int 21h mov ah,02h mov dh,15 mov dl,49 int 10h mov dx,111 mov ah,02h int 21h .Exit end
programs/oeis/002/A002064.asm
neoneye/loda
22
178159
<gh_stars>10-100 ; A002064: Cullen numbers: a(n) = n*2^n + 1. ; 1,3,9,25,65,161,385,897,2049,4609,10241,22529,49153,106497,229377,491521,1048577,2228225,4718593,9961473,20971521,44040193,92274689,192937985,402653185,838860801,1744830465,3623878657,7516192769,15569256449,32212254721,66571993089,137438953473,283467841537,584115552257,1202590842881,2473901162497,5085241278465,10445360463873,21440476741633,43980465111041,90159953477633,184717953466369,378231999954945,774056185954305,1583296743997441,3236962232172545,6614661952700417,13510798882111489,27584547717644289,56294995342131201,114841790497947649,234187180623265793,477381560501272577,972777519512027137,1981583836043018241,4035225266123964417,8214565720323784705,16717361816799281153,34011184385901985793,69175290276410818561,140656423562035331073,285924533142498050049,581072438321850875905,1180591620717411303425,2398076729582241710081,4869940435459321626625,9887454823508319666177,20070057552195992158209,40730410914750689968129,82641413450218791239681,167644010141872405086209,340010386766614455386113,689465506498968201199617,1397820478929414983254017,2833419889721787128217601,5742397643169488579854337,11635911013790805806546945,23574053482485268906770433,47752569874777852400893953,96714065569170333976494081,195845982777569926302400513,396527668833598369303625729,802726744224113772004900865,1624796301562061610805100545,3288278229351791355200798721,6653927711158918977582792705,13462597927228510489527975937,27234680864278366047780732929,55088331748199422233011027969,111414603535684224740921180161,225305087149939210031640608769,455561934457019941162877714433,921027389228322924524948422657,1861861819085211933448282832897,3763337719427556035693337640961,7605903601369376408980219232257,15370263527767281493147526365185,31057439705591620336669228531713,62748704711297355374086808666113 mov $1,2 pow $1,$0 mul $1,$0 add $1,1 mov $0,$1
MdePkg/Library/BaseLib/Ia32/WriteTr.nasm
CEOALT1/RefindPlusUDK
2,757
173743
<reponame>CEOALT1/RefindPlusUDK ;------------------------------------------------------------------------------ ; ; Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php. ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; WriteTr.nasm ; ; Abstract: ; ; Write TR register ; ; Notes: ; ;------------------------------------------------------------------------------ SECTION .text ;------------------------------------------------------------------------------ ; VOID ; AsmWriteTr ( ; UINT16 Selector ; ); ;------------------------------------------------------------------------------ global ASM_PFX(AsmWriteTr) ASM_PFX(AsmWriteTr): mov eax, [esp+4] ltr ax ret
T.agda
msullivan/godels-t
4
3733
<filename>T.agda module T where open import Prelude module GÖDEL-T where -- Core syntax infixr 30 _⇒_ infixl 30 _$_ data TTp : Set where nat : TTp _⇒_ : (A B : TTp) → TTp Ctx = List TTp data TExp (Γ : Ctx) : TTp → Set where var : ∀{A} (x : A ∈ Γ) → TExp Γ A Λ : ∀{A B} (e : TExp (A :: Γ) B) → TExp Γ (A ⇒ B) _$_ : ∀{A B} (e₁ : TExp Γ (A ⇒ B)) (e₂ : TExp Γ A) → TExp Γ B zero : TExp Γ nat suc : (e : TExp Γ nat) → TExp Γ nat rec : ∀{A} → (e : TExp Γ nat) → (e₀ : TExp Γ A) → (es : TExp (A :: Γ) A) → TExp Γ A TCExp = TExp [] TNat = TCExp nat ---- denotational semantics interp : TTp → Set interp nat = Nat interp (A ⇒ B) = interp A → interp B meaningη : (Γ : Ctx) → Set meaningη Γ = ∀{A} (x : A ∈ Γ) → interp A emptyη : meaningη [] emptyη () extendη : ∀{Γ A} → meaningη Γ → interp A → meaningη (A :: Γ) extendη η M Z = M extendη η M (S n) = η n meaning : ∀{A Γ} → TExp Γ A → meaningη Γ → interp A meaning (var x) η = η x meaning (Λ e) η = λ x → meaning e (extendη η x) meaning (e₁ $ e₂) η = meaning e₁ η (meaning e₂ η) meaning zero η = Z meaning (suc e) η = S (meaning e η) meaning (rec e e₀ es) η = NAT.fold (meaning e₀ η) (λ n x → meaning es (extendη η x)) (meaning e η) cmeaning : ∀{A} → TCExp A → interp A cmeaning e = meaning e emptyη ---- Definition related to substitution. -- Renamings TRen : Ctx → Ctx → Set TRen Γ Γ' = ∀ {A} → A ∈ Γ → A ∈ Γ' renId : ∀{Γ} → TRen Γ Γ renId = \ x -> x renComp : ∀{B Γ Δ} → TRen Γ Δ → TRen B Γ → TRen B Δ renComp f g = f o g wk : ∀{Γ Γ' A} → TRen Γ Γ' → TRen (A :: Γ) (A :: Γ') wk f Z = Z wk f (S n) = S (f n) ren : ∀{Γ Γ'} → TRen Γ Γ' → ∀ {A} → TExp Γ A → TExp Γ' A ren γ (var x) = var (γ x) ren γ (Λ e) = Λ (ren (wk γ) e) ren γ (e₁ $ e₂) = (ren γ e₁) $ (ren γ e₂) ren γ zero = zero ren γ (suc e) = suc (ren γ e) ren γ (rec e e₀ es) = rec (ren γ e) (ren γ e₀) (ren (wk γ) es) -- Substitutions TSubst : Ctx → Ctx → Set TSubst Γ Γ' = ∀ {A} → A ∈ Γ → TExp Γ' A emptyγ : ∀{Γ} → TSubst Γ Γ emptyγ = λ x → var x liftγ : ∀{Γ Γ' A} → TSubst Γ Γ' → TSubst (A :: Γ) (A :: Γ') liftγ γ Z = var Z liftγ γ (S n) = ren S (γ n) singγ : ∀{Γ A} → TExp Γ A → TSubst (A :: Γ) Γ singγ e Z = e singγ e (S n) = var n dropγ : ∀{Γ A Γ'} → TSubst (A :: Γ) Γ' → TSubst Γ Γ' dropγ γ n = γ (S n) closed-wkγ : {Γ : Ctx} → TRen [] Γ closed-wkγ () ssubst : ∀{Γ Γ' C} → (γ : TSubst Γ Γ') → (e : TExp Γ C) → TExp Γ' C ssubst γ (var x) = γ x ssubst γ (Λ e) = Λ (ssubst (liftγ γ) e) ssubst γ (e₁ $ e₂) = (ssubst γ e₁) $ (ssubst γ e₂) ssubst γ zero = zero ssubst γ (suc e) = suc (ssubst γ e) ssubst γ (rec e e₀ es) = rec (ssubst γ e) (ssubst γ e₀) (ssubst (liftγ γ) es) subComp : ∀{B Γ Γ'} → TSubst Γ Γ' → TSubst B Γ → TSubst B Γ' subComp f g = ssubst f o g extendγ : ∀{Γ Γ' A} → TSubst Γ Γ' → TExp Γ' A → TSubst (A :: Γ) Γ' extendγ γ e = subComp (singγ e) (liftγ γ) -- substituting one thing in a closed term subst : ∀{A C} → (e' : TCExp A) → (e : TExp (A :: []) C) → TCExp C subst e' e = ssubst (singγ e') e weaken-closed : ∀{Γ B} → TCExp B → TExp Γ B weaken-closed e = ren closed-wkγ e ---- dynamic semantics (and, implicitly, preservation) data TVal : ∀{Γ A} → TExp Γ A → Set where val-zero : ∀{Γ} → TVal {Γ} zero val-suc : ∀{Γ e} → TVal {Γ} e → TVal {Γ} (suc e) val-lam : ∀{A B} {e : TExp (A :: []) B} → TVal (Λ e) -- only worry about closed steps; embed preservation in the statement -- We are call-by-name for function application, but call-by-value for natural evaluation. -- This is so that any value of type nat is a numeral. data _~>_ : ∀{A} → TCExp A → TCExp A → Set where step-app-l : ∀{A B} {e₁ e₁' : TCExp (A ⇒ B)} {e₂ : TCExp A} → e₁ ~> e₁' → (e₁ $ e₂) ~> (e₁' $ e₂) step-beta : ∀{A B} {e : TExp (A :: []) B} {e' : TCExp A} → ((Λ e) $ e') ~> (subst e' e) step-suc : ∀{e e' : TCExp nat} → e ~> e' → (suc e) ~> (suc e') step-rec : ∀{A} {e e' : TCExp nat} {e₀ : TCExp A} {es : TExp (A :: []) A} → e ~> e' → (rec e e₀ es) ~> (rec e' e₀ es) step-rec-z : ∀{A} {e₀ : TCExp A} {es : TExp (A :: []) A} → (rec zero e₀ es) ~> e₀ step-rec-s : ∀{A} {e : TCExp nat} {e₀ : TCExp A} {es : TExp (A :: []) A} → TVal e → (rec (suc e) e₀ es) ~> subst (rec e e₀ es) es -- iterated stepping data _~>*_ : ∀{A} → TCExp A → TCExp A → Set where eval-refl : ∀{A} {e : TCExp A} → e ~>* e eval-cons : ∀{A} {e e' e'' : TCExp A} → e ~> e' → e' ~>* e'' → e ~>* e'' eval-step : ∀{A} {e e' : TCExp A} → e ~> e' → e ~>* e' eval-step s = eval-cons s eval-refl -- Should I use a record, or the product thing, or something else? data THalts : ∀{A} → TCExp A → Set where halts : {A : TTp} {e e' : TCExp A} → (eval : (e ~>* e')) → (val : TVal e') → THalts e open GÖDEL-T public
src/Categories/Object/Product.agda
Trebor-Huang/agda-categories
279
14460
<filename>src/Categories/Object/Product.agda {-# OPTIONS --without-K --safe #-} open import Categories.Category --(Binary) product of objects and morphisms module Categories.Object.Product {o ℓ e} (C : Category o ℓ e) where open import Categories.Object.Product.Core C public open import Categories.Object.Product.Morphisms C public
libsrc/_DEVELOPMENT/stdlib/z80/asm_ulltoa.asm
grancier/z180
0
173797
; =============================================================== ; May 2016 ; =============================================================== ; ; char *ulltoa(uint64_t num, char *buf, int radix) ; ; Write number to ascii buffer in radix indicated and zero ; terminate. ; ; =============================================================== SECTION code_clib SECTION code_stdlib PUBLIC asm_ulltoa PUBLIC asm0_ulltoa, asm1_ulltoa EXTERN error_zc, error_einval_zc, l_valid_base EXTERN l0_divu_64_64x8, l_num2char, l_testzero_64_dehldehl asm_ulltoa: ; enter : dehl'dehl = unsigned long long num ; ix = char *buf ; bc = int radix ; ; exit : hl = address of terminating 0 in buf ; carry reset no errors ; ; error : (*) if buf == 0 ; carry set, hl = 0 ; ; (*) if radix is invalid ; carry set, hl = 0, errno=EINVAL ; ; uses : af, bc, de, hl, bc', de', hl' ld a,ixh ; check for NULL buf or ixl jp z, error_zc asm0_ulltoa: ; bypass NULL check call l_valid_base ; radix in [2,36] ? jp nc, error_einval_zc asm1_ulltoa: ; entry for lltoa() ; use generic radix method ; generate digits onto stack in reverse order ; max stack depth is 66 bytes for base 2 xor a push af ; end of digits marked by carry reset compute_lp: ; ix = char *buf ; dehl'dehl = number ; bc = radix push bc ; save radix call l0_divu_64_64x8 ; dehl'dehl = num / radix, a = num % radix pop bc call l_num2char scf push af ; digit onto stack call l_testzero_64_dehldehl jr nz, compute_lp ; repeat until num is zero ; write digits to string ; ix = char * ; stack = list of digits push ix pop hl write_lp: pop af ld (hl),a inc hl jr c, write_lp ; last write above was NUL and carry is reset dec hl ret
projects/batfish/src/main/antlr4/org/batfish/vendor/a10/grammar/A10_ip_route.g4
ton31337/batfish
1
6093
<filename>projects/batfish/src/main/antlr4/org/batfish/vendor/a10/grammar/A10_ip_route.g4 parser grammar A10_ip_route; import A10_common; options { tokenVocab = A10Lexer; } si_route: ROUTE ip_prefix static_route_definition; // Same syntax is used for `no ip route` as for `ip route` sni_route: ROUTE ip_prefix static_route_definition; static_route_definition : ip_address ( static_route_description static_route_distance? | static_route_distance static_route_description? // acos2 | static_route_distance? CPU_PROCESS? ) NEWLINE ; static_route_description: DESCRIPTION route_description; // 1-255 static_route_distance: uint8;
Task/Power-set/Ada/power-set.ada
mbirabhadra/RosettaCodeData
1
28364
with Ada.Text_IO, Ada.Command_Line; use Ada.Text_IO, Ada.Command_Line; procedure powerset is procedure print_subset (set : natural) is -- each i'th binary digit of "set" indicates if the i'th integer belongs to "set" or not. k : natural := set; first : boolean := true; begin Put ("{"); for i in 1..Argument_Count loop if k mod 2 = 1 then if first then first := false; else Put (","); end if; Put (Argument (i)); end if; k := k / 2; -- we go to the next bit of "set" end loop; Put_Line("}"); end print_subset; begin for i in 0..2**Argument_Count-1 loop print_subset (i); end loop; end powerset;
tests/natools-reference_tests-pools.ads
faelys/natools
0
12541
<gh_stars>0 ------------------------------------------------------------------------------ -- Copyright (c) 2014, <NAME> -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Reference_Tests.Pools expands reference test suite with -- -- reference pools. -- ------------------------------------------------------------------------------ private with Natools.References.Pools; package Natools.Reference_Tests.Pools is procedure All_Tests (Report : in out NT.Reporter'Class); procedure Bounded_Pool (Report : in out NT.Reporter'Class); procedure Static_Pool (Report : in out NT.Reporter'Class); procedure Unbounded_Pool (Report : in out NT.Reporter'Class); private package Ref_Pools is new Refs.Pools; task type Pseudo_Process is entry Start (Target : in Refs.Reference; Amount : in Duration); end Pseudo_Process; procedure Bounded_Start (Process : in out Pseudo_Process; Pool : in out Ref_Pools.Pool; Amount : in Duration; Test : in out NT.Test; Expected_Instance : in Natural); procedure Unbounded_Start (Process : in out Pseudo_Process; Pool : in out Ref_Pools.Pool; Amount : in Duration; Test : in out NT.Test; Expected_Instance : in Natural); end Natools.Reference_Tests.Pools;
oeis/050/A050997.asm
neoneye/loda-programs
11
19699
<reponame>neoneye/loda-programs ; A050997: Fifth powers of primes. ; Submitted by <NAME> ; 32,243,3125,16807,161051,371293,1419857,2476099,6436343,20511149,28629151,69343957,115856201,147008443,229345007,418195493,714924299,844596301,1350125107,1804229351,2073071593,3077056399,3939040643,5584059449,8587340257,10510100501,11592740743,14025517307,15386239549,18424351793,33038369407,38579489651,48261724457,51888844699,73439775749,78502725751,95388992557,115063617043,129891985607,154963892093,183765996899,194264244901,254194901951,267785184193,296709280757,312079600999,418227202051 mul $0,2 max $0,1 seq $0,173919 ; Numbers that are prime or one less than a prime. pow $0,5
theorems/cohomology/ChainComplex.agda
mikeshulman/HoTT-Agda
0
1520
<filename>theorems/cohomology/ChainComplex.agda {-# OPTIONS --without-K --rewriting #-} open import HoTT open import groups.KernelImage module cohomology.ChainComplex where record ChainComplex i : Type (lsucc i) where field head : AbGroup i chain : ℕ → AbGroup i augment : AbGroup.grp (chain 0) →ᴳ AbGroup.grp head boundary : ∀ n → (AbGroup.grp (chain (S n)) →ᴳ AbGroup.grp (chain n)) record CochainComplex i : Type (lsucc i) where field head : AbGroup i cochain : ℕ → AbGroup i augment : AbGroup.grp head →ᴳ AbGroup.grp (cochain 0) coboundary : ∀ n → (AbGroup.grp (cochain n) →ᴳ AbGroup.grp (cochain (S n))) homology-group : ∀ {i} → ChainComplex i → (n : ℤ) → Group i homology-group cc (pos 0) = Ker/Im cc.augment (cc.boundary 0) (snd (cc.chain 0)) where module cc = ChainComplex cc homology-group cc (pos (S n)) = Ker/Im (cc.boundary n) (cc.boundary (S n)) (snd (cc.chain (S n))) where module cc = ChainComplex cc homology-group {i} cc (negsucc _) = Lift-group {j = i} Unit-group cohomology-group : ∀ {i} → CochainComplex i → (n : ℤ) → Group i cohomology-group cc (pos 0) = Ker/Im (cc.coboundary 0) cc.augment (snd (cc.cochain 0)) where module cc = CochainComplex cc cohomology-group cc (pos (S n)) = Ker/Im (cc.coboundary (S n)) (cc.coboundary n) (snd (cc.cochain (S n))) where module cc = CochainComplex cc cohomology-group {i} cc (negsucc _) = Lift-group {j = i} Unit-group complex-dualize : ∀ {i j} → ChainComplex i → AbGroup j → CochainComplex (lmax i j) complex-dualize {i} {j} cc G = record {M} where module cc = ChainComplex cc module M where head : AbGroup (lmax i j) head = hom-abgroup (AbGroup.grp cc.head) G cochain : ℕ → AbGroup (lmax i j) cochain n = hom-abgroup (AbGroup.grp (cc.chain n)) G augment : AbGroup.grp head →ᴳ AbGroup.grp (cochain 0) augment = pre∘ᴳ-hom G cc.augment coboundary : ∀ n → (AbGroup.grp (cochain n) →ᴳ AbGroup.grp (cochain (S n))) coboundary n = pre∘ᴳ-hom G (cc.boundary n)
source/asis/asis-gela-compilations.adb
faelys/gela-asis
4
22846
<reponame>faelys/gela-asis ------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $: with Asis.Gela.Lists; with Asis.Gela.Unit_Utils; with Ada.Unchecked_Deallocation; package body Asis.Gela.Compilations is use type U.Unbounded_Wide_String; procedure Free is new Ada.Unchecked_Deallocation (Compilation_List_Node, Compilation_List); Version : Version_Count := 0; ------------- -- Decoder -- ------------- function Decoder (List : Compilation_List; Item : Compilation) return Text_Utils.Decoder_Access is begin if Valid_Version (List, Item) then return List.Nodes (Item.Index).Decoder; else return null; end if; end Decoder; ---------------------- -- Drop_Compilation -- ---------------------- procedure Drop_Compilation (List : in out Compilation_List; Item : in Compilation) is begin if Valid_Version (List, Item) then Version := Version + 1; List.Nodes (Item.Index).Version := Version; List.Nodes (Item.Index).File_Name := U.Null_Unbounded_Wide_String; Pools.Deallocate_All (List.Nodes (Item.Index).Pool); Text_Utils.Free (List.Nodes (Item.Index).Buffer); end if; end Drop_Compilation; --------------- -- Enclosing -- --------------- function Enclosing (Object : Asis.Element) return Compilation is begin return Enclosing (Enclosing_Compilation_Unit (Object.all)); end Enclosing; --------------- -- Enclosing -- --------------- function Enclosing (Object : Asis.Compilation_Unit) return Compilation is begin return Unit_Utils.Compilation (Object); end Enclosing; -------------- -- Finalize -- -------------- procedure Finalize (List : in out Compilation_List) is begin if List = null then return; end if; for J in 1 .. List.Last loop if List.Nodes (J).File_Name /= U.Null_Unbounded_Wide_String then Pools.Deallocate_All (List.Nodes (J).Pool); end if; end loop; Free (List); end Finalize; --------------------- -- Get_Compilation -- --------------------- function Get_Compilation (List : in Compilation_List; File : in Wide_String) return Compilation is Max : Compilation_Count := 0; Ver : Version_Count := 0; begin for J in 1 .. List.Last loop if List.Nodes (J).File_Name = File then if Max = 0 or else Version - List.Nodes (J).Version < Version - Ver then Max := J; Ver := List.Nodes (J).Version; end if; end if; end loop; if Max = 0 then return (1, 0); end if; return (Max, Ver); end Get_Compilation; -------------- -- Get_Line -- -------------- function Get_Line (List : Compilation_List; Item : Compilation; Index : Asis.Asis_Positive) return Lines.Line is begin return Lines.Vectors.Get (List.Nodes (Item.Index).Line_List, Index); end Get_Line; -------------------- -- Get_Line_Count -- -------------------- function Get_Line_Count (List : Compilation_List; Item : Compilation) return Asis.Asis_Natural is begin return Lines.Vectors.Length (List.Nodes (Item.Index).Line_List); end Get_Line_Count; ---------------- -- Initialize -- ---------------- procedure Initialize (List : out Compilation_List) is begin List := new Compilation_List_Node (10); List.Last := 0; end Initialize; --------------------- -- New_Compilation -- --------------------- procedure New_Compilation (List : in out Compilation_List; File : in Wide_String; Buffer : in Text_Utils.Source_Buffer_Access; Decoder : in Text_Utils.Decoder_Access; Item : out Compilation) is Index : Compilation_Count := List.Last + 1; begin for J in 1 .. List.Last loop if List.Nodes (J).File_Name = U.Null_Unbounded_Wide_String then Index := J; exit; end if; end loop; if Index > List.Length then declare Save : constant Compilation_List := new Compilation_List_Node (2 * List.Length); begin Save.Nodes (1 .. List.Last) := List.Nodes (1 .. List.Last); Save.Last := List.Last; Free (List); List := Save; end; end if; if Index > List.Last then List.Last := Index; end if; Pools.Set_State (Lists.Pool, Pools.New_Pool); Version := Version + 1; List.Nodes (Index).File_Name := U.To_Unbounded_Wide_String (File); List.Nodes (Index).Version := Version; List.Nodes (Index).Pool := Pools.State (Lists.Pool); List.Nodes (Index).Buffer := Buffer; List.Nodes (Index).Decoder := Decoder; Item := (Index, Version); end New_Compilation; ------------------- -- Set_Line_List -- ------------------- procedure Set_Line_List (List : in out Compilation_List; Item : in Compilation; Line_List : in Lines.Vector) is begin Lines.Vectors.Copy (List.Nodes (Item.Index).Line_List, Line_List); end Set_Line_List; ------------------- -- Source_Buffer -- ------------------- function Source_Buffer (List : Compilation_List; Item : Compilation) return Text_Utils.Source_Buffer_Access is begin if Valid_Version (List, Item) then return List.Nodes (Item.Index).Buffer; else return null; end if; end Source_Buffer; ------------------- -- Valid_Version -- ------------------- function Valid_Version (List : Compilation_List; Item : Compilation) return Boolean is begin return List.Nodes (Item.Index).Version = Item.Version; end Valid_Version; end Asis.Gela.Compilations; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the <NAME>, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
src/soc.adb
Lucretia/so
8
27965
<filename>src/soc.adb ------------------------------------------------------------------------------------------------------------------------ -- See COPYING for licence information. ------------------------------------------------------------------------------------------------------------------------ -- Simple Oberon Compiler -- This is the driver of the compiler. with Ada.Command_Line; use Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; with Oberon.Scanner; procedure SOC is begin if Argument_Count = 0 then Put_Line ("Simple Oberon Compiler"); Put_Line (" (C) 2015 <NAME>"); New_Line; Put_Line ("Usage:"); Put_Line (" soc <filename> (without .obn extension)"); else declare Src : Oberon.Scanner.Scanner := Oberon.Scanner.Makers.Create (Argument (1)); begin Oberon.Scanner.Scan (Self => Src); -- for Index in Src'Range loop -- Put (Src (Index)); -- end loop; end; end if; end SOC;
Assembly/AL2.asm
TashreefMuhammad/University_Miscellaneous_Codes
3
80589
.MODEL SMALL .STACK 100H .DATA ;VARIABLES WILL BE DECLARED HERE .CODE MAIN PROC MOV AH, 1 ;INPUT INT 21H MOV BL, AL MOV AH,2 ;LINE FEED MOV DL, 0AH INT 21H MOV DL, 0DH ;CARRIAGE RETURN INT 21H MOV AH, 2 MOV DL, BL INT 21H MOV AH,4CH INT 21H MAIN ENDP ;OTHER PROCEDURES (IF ANY) END MAIN
Scripts Pack Source Items/Scripts Pack/Core Components/Pause Process by PID.applescript
Phorofor/ScriptsPack.macOS
1
3878
<reponame>Phorofor/ScriptsPack.macOS # Scripts Pack - Tweak various preference variables in macOS # <Phorofor, https://github.com/Phorofor/> -- Pause a process ID which is currently running. set useR to do shell script "whoami" set defaultHD to (path to system folder) as string # set tIcon to defaultHD & "Library:CoreServices:CoreTypes.bundle:Contents:Resources:ToolbarAppsFolderIcon.icns" (* set tD to display dialog "Enter the Process ID (PID) of a process you wish to temporary stop. You can find the PID for an application that is running in the Activity Monitor. These numbers change every time an application is relaunched. If you want to pause a process which require admin authorisation choose 'Stop with Admin Privledges'." default answer "The process ID should be 1 - 4 digits long... (ex. 1047)" buttons ["Exit", "Stop Process", "Stop with Administrator Privledges"] cancel button 1 default button 2 with icon file tIcon with title "Stop Running Process" *) set tD to display dialog "Enter the Process ID (PID) of a process you wish to temporary stop. You can find the PID for an application that is running in the Activity Monitor. These numbers change every time an application is relaunched. If you want to pause a process which require admin authorisation choose 'Stop as Admin'." default answer "The process ID should be 1 - 4 digits long... (ex. 1047)" buttons ["Exit", "Stop Process", "Stop as Admin"] cancel button 1 default button 2 with icon 2 with title "Stop Running Process" try set pSet to (text returned of tD) as number on error set Fail to "You attempted to set the value as different characters other than numbers, but this feature only accepts numbers for it to work properly! Perhaps you should try again. The following characters will only work when used: 1234567890." as string display alert "An Expected Error Occured: Invalid Value!" message Fail as warning buttons {"OK"} cancel button 1 default button 1 end try if the button returned of tD is "Stop Process" then try do shell script "kill -STOP " & pSet on error display alert "Expected Error!" as warning message "There was no process ID found with the PID of '" & pSet & "'. Each process ID should be at least 1 - 4 digits long, check to see the process ID you entered is correct or you tried to stop a process that wasn't started by the current user. Remember you can view a list of PIDs in the Activity Monitor for each application." buttons ["Open Activity Monitor", "OK"] cancel button 2 default button 2 tell application "Activity Monitor" to run end try else try do shell script "sudo kill -STOP " & pSet with administrator privileges on error display alert "Expected Error!" as warning message "Process failed to stop, you need administrator access in order to stop processes that are not owned by the current user. If you are trying to stop a process that is yours, you should use the 'Stop Process' button instead." buttons ["OK"] cancel button 1 end try display alert "Success! - Process has been stopped." message "You've stopped the application with the PID of " & pSet & " successfully. The application may appear with the spinning rainbow cursor if there were any windows open for it, this is normal. Be sure to make sure that all your work is saved." end if end
oeis/332/A332147.asm
neoneye/loda-programs
11
245399
; A332147: a(n) = 4*(10^(2*n+1)-1)/9 + 3*10^n. ; Submitted by <NAME>(s1) ; 7,474,44744,4447444,444474444,44444744444,4444447444444,444444474444444,44444444744444444,4444444447444444444,444444444474444444444,44444444444744444444444,4444444444447444444444444,444444444444474444444444444,44444444444444744444444444444,4444444444444447444444444444444 mov $1,10 pow $1,$0 mul $1,4 add $1,2 mul $1,10 sub $1,6 bin $1,2 div $1,45 mov $0,$1 mul $0,75 div $0,300
programs/oeis/135/A135172.asm
neoneye/loda
22
87164
<filename>programs/oeis/135/A135172.asm ; A135172: a(n) = 3^prime(n) + 2^prime(n). ; 13,35,275,2315,179195,1602515,129271235,1162785755,94151567435,68630914235795,617675543767595,450284043329950835,36472998576194041955,328256976190630099835,26588814499694991643115,19383245676687219151537715,14130386092315195257068234555,127173474827954453552096993555,92709463148045411038351601823515,7509466514982085987188150780864395,67585198634826967968486182914745315 seq $0,40 ; The prime numbers. mov $1,3 pow $1,$0 mov $2,2 pow $2,$0 add $1,$2 mov $0,$1
test/api/Issue1168.agda
redfish64/autonomic-agda
0
12289
<gh_stars>0 module Issue1168 where id : {A : Set} → A → A id {A = A} a = a
Source/newlines (2).asm
AAKMakes/ASM-projects
0
7242
<reponame>AAKMakes/ASM-projects<gh_stars>0 ;First ASM Mystack segment stack DB 64 dup('12345678') Mystack endS MyData segment example1 DB "A",13,10,"B",13,10,"$" example2 DB "1 Knollwood Drive",13,10,"Larchmont, NY 10538",13,10,"$" example3 DB "_|_|_",13,10,"_|_|_",13,10," | | $" MyData endS MyCode segment Assume CS:Mycode,DS:MyData Main PROC Start: MOV AX, MYDATA MOV DS, AX MOV AH,9 LEA DX,example1 INT 21h MOV AH,9 LEA DX,example2 INT 21h MOV AH,9 LEA DX,example3 INT 21h MOV AH, 4Ch XOR AL, AL INT 21h Main ENDP MyCode endS End Start
agda/Number/Operations/Details.agda
mchristianl/synthetic-reals
3
12159
<filename>agda/Number/Operations/Details.agda {-# OPTIONS --cubical --no-import-sorts --allow-unsolved-metas #-} module Number.Operations.Details where open import Cubical.Foundations.Everything renaming (_⁻¹ to _⁻¹ᵖ; assoc to ∙-assoc) open import Cubical.Relation.Nullary.Base -- ¬_ open import Cubical.Data.Unit.Base -- Unit open import Cubical.Data.Sigma.Base renaming (_×_ to infixr 4 _×_) open import Cubical.Data.Empty renaming (elim to ⊥-elim) -- `⊥` and `elim` open import Function.Base using (_$_) open import Cubical.Data.Nat.Properties open import Cubical.Data.Nat.Order renaming (zero-≤ to z≤n; suc-≤-suc to s≤s) open import MoreNatProperties renaming (0≤x to 0≤xⁿ) open import Number.Postulates open import Number.Structures open import Number.Bundles open import Number.Inclusions open import Number.Base open import Number.Coercions open ℕⁿ open ℤᶻ open ℚᶠ open ℝʳ open ℂᶜ infix 9 _⁻¹ infix 8 -_ open import Number.Operations.Specification open PatternsProp _⁻¹ : ∀{l p} → (x : Number (l , p)) → ⁻¹-Types x _⁻¹ {isNat } {⁇x⁇} (x ,, q) {{h}} = let r = Isℕ↪ℚ.preserves-#0 ℕ↪ℚinc _ h in _⁻¹ᶠ (ℕ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-#0 _ r _⁻¹ {isNat } {x#0} (x ,, q) {{h}} = let r = Isℕ↪ℚ.preserves-#0 ℕ↪ℚinc _ q in _⁻¹ᶠ (ℕ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-#0 _ r _⁻¹ {isNat } {0≤x} (x ,, q) {{h}} = let p = Isℕ↪ℚ.preserves-0< ℕ↪ℚinc _ (ℕ.≤-#-implies-< _ _ q (ℕ.#-sym _ _ h)) r = Isℕ↪ℚ.preserves-#0 ℕ↪ℚinc _ h in _⁻¹ᶠ (ℕ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-0< _ p r _⁻¹ {isNat } {0<x} (x ,, q) {{h}} = let p = Isℕ↪ℚ.preserves-0< ℕ↪ℚinc _ q r = Isℕ↪ℚ.preserves-#0 ℕ↪ℚinc _ (ℕ.#-sym _ _ (ℕ.<-implies-# _ _ q)) in _⁻¹ᶠ (ℕ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-0< _ p r _⁻¹ {isNat } {x≤0} (x ,, q) {{h}} = let p = Isℕ↪ℚ.preserves-<0 ℕ↪ℚinc _ (ℕ.≤-#-implies-< _ _ q h) r = Isℕ↪ℚ.preserves-#0 ℕ↪ℚinc _ h in _⁻¹ᶠ (ℕ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-<0 _ p r _⁻¹ {isInt } {⁇x⁇} (x ,, q) {{h}} = let r = Isℤ↪ℚ.preserves-#0 ℤ↪ℚinc _ h in _⁻¹ᶠ (ℤ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-#0 _ r _⁻¹ {isInt } {x#0} (x ,, q) {{h}} = let r = Isℤ↪ℚ.preserves-#0 ℤ↪ℚinc _ q in _⁻¹ᶠ (ℤ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-#0 _ r _⁻¹ {isInt } {0≤x} (x ,, q) {{h}} = let p = Isℤ↪ℚ.preserves-0< ℤ↪ℚinc _ (ℤ.≤-#-implies-< _ _ q (ℤ.#-sym _ _ h)) r = Isℤ↪ℚ.preserves-#0 ℤ↪ℚinc _ h in _⁻¹ᶠ (ℤ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-0< _ p r _⁻¹ {isInt } {0<x} (x ,, q) {{h}} = let p = Isℤ↪ℚ.preserves-0< ℤ↪ℚinc _ q r = Isℤ↪ℚ.preserves-#0 ℤ↪ℚinc _ (ℤ.#-sym _ _ (ℤ.<-implies-# _ _ q)) in _⁻¹ᶠ (ℤ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-0< _ p r _⁻¹ {isInt } {x<0} (x ,, q) {{h}} = let p = Isℤ↪ℚ.preserves-<0 ℤ↪ℚinc _ q r = Isℤ↪ℚ.preserves-#0 ℤ↪ℚinc _ (ℤ.<-implies-# _ _ q) in _⁻¹ᶠ (ℤ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-<0 _ p r _⁻¹ {isInt } {x≤0} (x ,, q) {{h}} = let p = Isℤ↪ℚ.preserves-<0 ℤ↪ℚinc _ (ℤ.≤-#-implies-< _ _ q h) r = Isℤ↪ℚ.preserves-#0 ℤ↪ℚinc _ h in _⁻¹ᶠ (ℤ↪ℚ x) {{r}} ,, ℚ.⁻¹-preserves-<0 _ p r _⁻¹ {isRat } {⁇x⁇} (x ,, q) {{h}} = _⁻¹ᶠ x {{h}} ,, ℚ.⁻¹-preserves-#0 x h _⁻¹ {isRat } {x#0} (x ,, q) {{h}} = _⁻¹ᶠ x {{q}} ,, ℚ.⁻¹-preserves-#0 x q _⁻¹ {isRat } {0≤x} (x ,, q) {{h}} = _⁻¹ᶠ x {{h}} ,, ℚ.⁻¹-preserves-0< x (ℚ.≤-#-implies-< _ _ q (ℚ.#-sym _ _ h)) h _⁻¹ {isRat } {0<x} (x ,, q) {{h}} = let r = ℚ.#-sym _ _ (ℚ.<-implies-# _ _ q) in _⁻¹ᶠ x {{r}} ,, ℚ.⁻¹-preserves-0< _ q r _⁻¹ {isRat } {x<0} (x ,, q) {{h}} = let r = ℚ.<-implies-# _ _ q in _⁻¹ᶠ x {{r}} ,, ℚ.⁻¹-preserves-<0 _ q r _⁻¹ {isRat } {x≤0} (x ,, q) {{h}} = _⁻¹ᶠ x {{h}} ,, ℚ.⁻¹-preserves-<0 x (ℚ.≤-#-implies-< _ _ q h) h _⁻¹ {isReal } {⁇x⁇} (x ,, q) {{h}} = _⁻¹ʳ x {{h}} ,, ℝ.⁻¹-preserves-#0 x h _⁻¹ {isReal } {x#0} (x ,, q) {{h}} = _⁻¹ʳ x {{q}} ,, ℝ.⁻¹-preserves-#0 x q _⁻¹ {isReal } {0≤x} (x ,, q) {{h}} = _⁻¹ʳ x {{h}} ,, ℝ.⁻¹-preserves-0< x (ℝ.≤-#-implies-< _ _ q (ℝ.#-sym _ _ h)) h _⁻¹ {isReal } {0<x} (x ,, q) {{h}} = let r = ℝ.#-sym _ _ (ℝ.<-implies-# _ _ q) in _⁻¹ʳ x {{r}} ,, ℝ.⁻¹-preserves-0< _ q r _⁻¹ {isReal } {x<0} (x ,, q) {{h}} = let r = ℝ.<-implies-# _ _ q in _⁻¹ʳ x {{r}} ,, ℝ.⁻¹-preserves-<0 _ q r _⁻¹ {isReal } {x≤0} (x ,, q) {{h}} = _⁻¹ʳ x {{h}} ,, ℝ.⁻¹-preserves-<0 x (ℝ.≤-#-implies-< _ _ q h) h _⁻¹ {isComplex} {⁇x⁇} (x ,, q) {{h}} = _⁻¹ᶜ x {{h}} ,, ℂ.⁻¹-preserves-#0 x h _⁻¹ {isComplex} {x#0} (x ,, q) {{h}} = _⁻¹ᶜ x {{q}} ,, ℂ.⁻¹-preserves-#0 x q -_ : ∀{l p} → (x : Number (l , p)) → -Types x -_ {isNat } {⁇x⁇} (x ,, p) = (-ᶻ (ℕ↪ℤ x)) ,, (ℤ.-flips-0≤ _ $ Isℕ↪ℤ.preserves-0≤ ℕ↪ℤinc _ (0≤xⁿ x)) -_ {isNat } {x#0} (x ,, p) = (-ᶻ (ℕ↪ℤ x)) ,, (ℤ.-preserves-#0 _ $ Isℕ↪ℤ.preserves-#0 ℕ↪ℤinc _ p) -_ {isNat } {0≤x} (x ,, p) = (-ᶻ (ℕ↪ℤ x)) ,, (ℤ.-flips-0≤ _ $ Isℕ↪ℤ.preserves-0≤ ℕ↪ℤinc _ p) -_ {isNat } {0<x} (x ,, p) = (-ᶻ (ℕ↪ℤ x)) ,, (ℤ.-flips-0< _ $ Isℕ↪ℤ.preserves-0< ℕ↪ℤinc _ p) -_ {isNat } {x≤0} (x ,, p) = (-ᶻ (ℕ↪ℤ x)) ,, (ℤ.-flips-≤0 _ $ Isℕ↪ℤ.preserves-≤0 ℕ↪ℤinc _ p) -_ {isInt } {⁇x⁇} (x ,, p) = (-ᶻ x ) ,, lift tt -_ {isInt } {x#0} (x ,, p) = (-ᶻ x ) ,, ℤ.-preserves-#0 _ p -_ {isInt } {0≤x} (x ,, p) = (-ᶻ x ) ,, ℤ.-flips-0≤ _ p -_ {isInt } {0<x} (x ,, p) = (-ᶻ x ) ,, ℤ.-flips-0< _ p -_ {isInt } {x<0} (x ,, p) = (-ᶻ x ) ,, ℤ.-flips-<0 _ p -_ {isInt } {x≤0} (x ,, p) = (-ᶻ x ) ,, ℤ.-flips-≤0 _ p -_ {isRat } {⁇x⁇} (x ,, p) = (-ᶠ x ) ,, lift tt -_ {isRat } {x#0} (x ,, p) = (-ᶠ x ) ,, ℚ.-preserves-#0 _ p -_ {isRat } {0≤x} (x ,, p) = (-ᶠ x ) ,, ℚ.-flips-0≤ _ p -_ {isRat } {0<x} (x ,, p) = (-ᶠ x ) ,, ℚ.-flips-0< _ p -_ {isRat } {x<0} (x ,, p) = (-ᶠ x ) ,, ℚ.-flips-<0 _ p -_ {isRat } {x≤0} (x ,, p) = (-ᶠ x ) ,, ℚ.-flips-≤0 _ p -_ {isReal } {⁇x⁇} (x ,, p) = (-ʳ x ) ,, lift tt -_ {isReal } {x#0} (x ,, p) = (-ʳ x ) ,, ℝ.-preserves-#0 _ p -_ {isReal } {0≤x} (x ,, p) = (-ʳ x ) ,, ℝ.-flips-0≤ _ p -_ {isReal } {0<x} (x ,, p) = (-ʳ x ) ,, ℝ.-flips-0< _ p -_ {isReal } {x<0} (x ,, p) = (-ʳ x ) ,, ℝ.-flips-<0 _ p -_ {isReal } {x≤0} (x ,, p) = (-ʳ x ) ,, ℝ.-flips-≤0 _ p -_ {isComplex} {⁇x⁇} (x ,, p) = (-ᶜ x ) ,, lift tt -_ {isComplex} {x#0} (x ,, p) = (-ᶜ x ) ,, ℂ.-preserves-#0 _ p _+ʰⁿ_ : ∀{p q} → (x : Number (isNat , p)) → (y : Number (isNat , q)) → PositivityKindInterpretation isNat (+-Positivityʰ isNat p q) (num x +ⁿ num y) _+ʰⁿ_ {⁇x⁇} {⁇x⁇} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {⁇x⁇} {x#0} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {⁇x⁇} {0≤x} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {⁇x⁇} {0<x} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {⁇x⁇} {x≤0} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {x#0} {⁇x⁇} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {x#0} {x#0} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {x#0} {0≤x} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {x#0} {0<x} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {x#0} {x≤0} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {0≤x} {⁇x⁇} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {0≤x} {x#0} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {0≤x} {0≤x} (a ,, pa) (b ,, pb) = ℕ.+-0≤-0≤-implies-0≤ a b pa pb -- 0 ≤ a → 0 ≤ b → 0 ≤ a + b _+ʰⁿ_ {0≤x} {0<x} (a ,, pa) (b ,, pb) = ℕ.+-0≤-0<-implies-0< a b pa pb -- 0 ≤ a → 0 < b → 0 < a + b _+ʰⁿ_ {0≤x} {x≤0} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {0<x} {⁇x⁇} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {0<x} {x#0} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {0<x} {0≤x} (a ,, pa) (b ,, pb) = ℕ.+-0<-0≤-implies-0< a b pa pb -- 0 < a → 0 ≤ b → 0 < a + b _+ʰⁿ_ {0<x} {0<x} (a ,, pa) (b ,, pb) = ℕ.+-0<-0<-implies-0< a b pa pb -- 0 < a → 0 < b → 0 < a + b _+ʰⁿ_ {0<x} {x≤0} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {x≤0} {⁇x⁇} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {x≤0} {x#0} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {x≤0} {0≤x} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {x≤0} {0<x} (a ,, pa) (b ,, pb) = tt _+ʰⁿ_ {x≤0} {x≤0} (a ,, pa) (b ,, pb) = ℕ.+-≤0-≤0-implies-≤0 a b pa pb -- a ≤ 0 → b ≤ 0 → (a + b) ≤ 0 _+ʰᶻ_ : ∀{p q} → (x : Number (isInt , p)) → (y : Number (isInt , q)) → PositivityKindInterpretation isInt (+-Positivityʰ isInt p q) (num x +ᶻ num y) _+ʰᶻ_ {⁇x⁇} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {⁇x⁇} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {⁇x⁇} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {⁇x⁇} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {⁇x⁇} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {⁇x⁇} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x#0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x#0} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x#0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x#0} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x#0} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x#0} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {0≤x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {0≤x} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {0≤x} {0≤x} (a ,, pa) (b ,, pb) = ℤ.+-0≤-0≤-implies-0≤ a b pa pb -- 0 ≤ a → 0 ≤ b → 0 ≤ a + b _+ʰᶻ_ {0≤x} {0<x} (a ,, pa) (b ,, pb) = ℤ.+-0≤-0<-implies-0< a b pa pb -- 0 ≤ a → 0 < b → 0 < a + b _+ʰᶻ_ {0≤x} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {0≤x} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {0<x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {0<x} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {0<x} {0≤x} (a ,, pa) (b ,, pb) = ℤ.+-0<-0≤-implies-0< a b pa pb -- 0 < a → 0 ≤ b → 0 < a + b _+ʰᶻ_ {0<x} {0<x} (a ,, pa) (b ,, pb) = ℤ.+-0<-0<-implies-0< a b pa pb -- 0 < a → 0 < b → 0 < a + b _+ʰᶻ_ {0<x} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {0<x} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x<0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x<0} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x<0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x<0} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x<0} {x<0} (a ,, pa) (b ,, pb) = ℤ.+-<0-<0-implies-<0 a b pa pb -- a < 0 → b < 0 → (a + b) < 0 _+ʰᶻ_ {x<0} {x≤0} (a ,, pa) (b ,, pb) = ℤ.+-<0-≤0-implies-<0 a b pa pb -- a < 0 → b ≤ 0 → (a + b) < 0 _+ʰᶻ_ {x≤0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x≤0} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x≤0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x≤0} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶻ_ {x≤0} {x<0} (a ,, pa) (b ,, pb) = ℤ.+-≤0-<0-implies-<0 a b pa pb -- a ≤ 0 → b < 0 → (a + b) < 0 _+ʰᶻ_ {x≤0} {x≤0} (a ,, pa) (b ,, pb) = ℤ.+-≤0-≤0-implies-≤0 a b pa pb -- a ≤ 0 → b ≤ 0 → (a + b) ≤ 0 _+ʰᶠ_ : ∀{p q} → (x : Number (isRat , p)) → (y : Number (isRat , q)) → PositivityKindInterpretation isRat (+-Positivityʰ isRat p q) (num x +ᶠ num y) _+ʰᶠ_ {⁇x⁇} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {⁇x⁇} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {⁇x⁇} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {⁇x⁇} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {⁇x⁇} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {⁇x⁇} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x#0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x#0} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x#0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x#0} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x#0} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x#0} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {0≤x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {0≤x} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {0≤x} {0≤x} (a ,, pa) (b ,, pb) = ℚ.+-0≤-0≤-implies-0≤ a b pa pb -- 0 ≤ a → 0 ≤ b → 0 ≤ a + b _+ʰᶠ_ {0≤x} {0<x} (a ,, pa) (b ,, pb) = ℚ.+-0≤-0<-implies-0< a b pa pb -- 0 ≤ a → 0 < b → 0 < a + b _+ʰᶠ_ {0≤x} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {0≤x} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {0<x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {0<x} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {0<x} {0≤x} (a ,, pa) (b ,, pb) = ℚ.+-0<-0≤-implies-0< a b pa pb -- 0 < a → 0 ≤ b → 0 < a + b _+ʰᶠ_ {0<x} {0<x} (a ,, pa) (b ,, pb) = ℚ.+-0<-0<-implies-0< a b pa pb -- 0 < a → 0 < b → 0 < a + b _+ʰᶠ_ {0<x} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {0<x} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x<0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x<0} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x<0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x<0} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x<0} {x<0} (a ,, pa) (b ,, pb) = ℚ.+-<0-<0-implies-<0 a b pa pb -- a < 0 → b < 0 → (a + b) < 0 _+ʰᶠ_ {x<0} {x≤0} (a ,, pa) (b ,, pb) = ℚ.+-<0-≤0-implies-<0 a b pa pb -- a < 0 → b ≤ 0 → (a + b) < 0 _+ʰᶠ_ {x≤0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x≤0} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x≤0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x≤0} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰᶠ_ {x≤0} {x<0} (a ,, pa) (b ,, pb) = ℚ.+-≤0-<0-implies-<0 a b pa pb -- a ≤ 0 → b < 0 → (a + b) < 0 _+ʰᶠ_ {x≤0} {x≤0} (a ,, pa) (b ,, pb) = ℚ.+-≤0-≤0-implies-≤0 a b pa pb -- a ≤ 0 → b ≤ 0 → (a + b) ≤ 0 _+ʰʳ_ : ∀{p q} → (x : Number (isReal , p)) → (y : Number (isReal , q)) → PositivityKindInterpretation isReal (+-Positivityʰ isReal p q) (num x +ʳ num y) _+ʰʳ_ {⁇x⁇} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {⁇x⁇} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {⁇x⁇} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {⁇x⁇} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {⁇x⁇} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {⁇x⁇} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x#0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x#0} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x#0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x#0} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x#0} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x#0} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {0≤x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {0≤x} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {0≤x} {0≤x} (a ,, pa) (b ,, pb) = ℝ.+-0≤-0≤-implies-0≤ a b pa pb -- 0 ≤ a → 0 ≤ b → 0 ≤ a + b _+ʰʳ_ {0≤x} {0<x} (a ,, pa) (b ,, pb) = ℝ.+-0≤-0<-implies-0< a b pa pb -- 0 ≤ a → 0 < b → 0 < a + b _+ʰʳ_ {0≤x} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {0≤x} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {0<x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {0<x} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {0<x} {0≤x} (a ,, pa) (b ,, pb) = ℝ.+-0<-0≤-implies-0< a b pa pb -- 0 < a → 0 ≤ b → 0 < a + b _+ʰʳ_ {0<x} {0<x} (a ,, pa) (b ,, pb) = ℝ.+-0<-0<-implies-0< a b pa pb -- 0 < a → 0 < b → 0 < a + b _+ʰʳ_ {0<x} {x<0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {0<x} {x≤0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x<0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x<0} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x<0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x<0} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x<0} {x<0} (a ,, pa) (b ,, pb) = ℝ.+-<0-<0-implies-<0 a b pa pb -- a < 0 → b < 0 → (a + b) < 0 _+ʰʳ_ {x<0} {x≤0} (a ,, pa) (b ,, pb) = ℝ.+-<0-≤0-implies-<0 a b pa pb -- a < 0 → b ≤ 0 → (a + b) < 0 _+ʰʳ_ {x≤0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x≤0} {x#0} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x≤0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x≤0} {0<x} (a ,, pa) (b ,, pb) = lift tt _+ʰʳ_ {x≤0} {x<0} (a ,, pa) (b ,, pb) = ℝ.+-≤0-<0-implies-<0 a b pa pb -- a ≤ 0 → b < 0 → (a + b) < 0 _+ʰʳ_ {x≤0} {x≤0} (a ,, pa) (b ,, pb) = ℝ.+-≤0-≤0-implies-≤0 a b pa pb -- a ≤ 0 → b ≤ 0 → (a + b) ≤ 0 _+ʰᶜ_ : ∀{p q} → (x : Number (isComplex , p)) → (y : Number (isComplex , q)) → PositivityKindInterpretation isComplex (+-Positivityʰ isComplex p q) (num x +ᶜ num y) _+ʰᶜ_ x y = lift tt _·ʰⁿ_ : ∀{p q} → (x : Number (isNat , p)) → (y : Number (isNat , q)) → PositivityKindInterpretation isNat (·-Positivityʰ isNat p q) (num x ·ⁿ num y) _·ʰⁿ_ {⁇x⁇} {⁇x⁇} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {⁇x⁇} {x#0} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {⁇x⁇} {0≤x} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {⁇x⁇} {0<x} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {⁇x⁇} {x≤0} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {x#0} {⁇x⁇} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {x#0} {x#0} (a ,, pa) (b ,, pb) = ℕ.·-#0-#0-implies-#0 a b pa pb -- a # 0 → b # 0 → (a · b) # 0 _·ʰⁿ_ {x#0} {0≤x} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {x#0} {0<x} (a ,, pa) (b ,, pb) = ℕ.·-#0-0<-implies-#0 a b pa pb -- a # 0 → 0 < b → (a · b) # 0 _·ʰⁿ_ {x#0} {x≤0} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {0≤x} {⁇x⁇} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {0≤x} {x#0} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {0≤x} {0≤x} (a ,, pa) (b ,, pb) = ℕ.·-0≤-0≤-implies-0≤ a b pa pb -- 0 ≤ a → 0 ≤ b → 0 ≤ (a · b) _·ʰⁿ_ {0≤x} {0<x} (a ,, pa) (b ,, pb) = ℕ.·-0≤-0<-implies-0≤ a b pa pb -- 0 ≤ a → 0 < b → 0 ≤ (a · b) _·ʰⁿ_ {0≤x} {x≤0} (a ,, pa) (b ,, pb) = ℕ.·-0≤-≤0-implies-≤0 a b pa pb -- 0 ≤ a → b ≤ 0 → (a · b) ≤ 0 _·ʰⁿ_ {0<x} {⁇x⁇} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {0<x} {x#0} (a ,, pa) (b ,, pb) = ℕ.·-0<-#0-implies-#0 a b pa pb -- 0 < a → b # 0 → (a · b) # 0 _·ʰⁿ_ {0<x} {0≤x} (a ,, pa) (b ,, pb) = ℕ.·-0<-0≤-implies-0≤ a b pa pb -- 0 < a → 0 ≤ b → 0 ≤ (a · b) _·ʰⁿ_ {0<x} {0<x} (a ,, pa) (b ,, pb) = ℕ.·-0<-0<-implies-0< a b pa pb -- 0 < a → 0 < b → 0 < (a · b) _·ʰⁿ_ {0<x} {x≤0} (a ,, pa) (b ,, pb) = ℕ.·-0<-≤0-implies-≤0 a b pa pb -- 0 < a → b ≤ 0 → (a · b) ≤ 0 _·ʰⁿ_ {x≤0} {⁇x⁇} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {x≤0} {x#0} (a ,, pa) (b ,, pb) = tt _·ʰⁿ_ {x≤0} {0≤x} (a ,, pa) (b ,, pb) = ℕ.·-≤0-0≤-implies-≤0 a b pa pb -- a ≤ 0 → 0 ≤ b → (a · b) ≤ 0 _·ʰⁿ_ {x≤0} {0<x} (a ,, pa) (b ,, pb) = ℕ.·-≤0-0<-implies-≤0 a b pa pb -- a ≤ 0 → 0 < b → (a · b) ≤ 0 _·ʰⁿ_ {x≤0} {x≤0} (a ,, pa) (b ,, pb) = ℕ.·-≤0-≤0-implies-0≤ a b pa pb -- a ≤ 0 → b ≤ 0 → 0 ≤ (a · b) _·ʰᶻ_ : ∀{p q} → (x : Number (isInt , p)) → (y : Number (isInt , q)) → PositivityKindInterpretation isInt (·-Positivityʰ isInt p q) (num x ·ᶻ num y) _·ʰᶻ_ {⁇x⁇} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {⁇x⁇} {x#0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {⁇x⁇} {0≤x} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {⁇x⁇} {0<x} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {⁇x⁇} {x<0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {⁇x⁇} {x≤0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {x#0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {x#0} {x#0} (a ,, pa) (b ,, pb) = ℤ.·-#0-#0-implies-#0 a b pa pb -- a # 0 → b # 0 → (a · b) # 0 _·ʰᶻ_ {x#0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {x#0} {0<x} (a ,, pa) (b ,, pb) = ℤ.·-#0-0<-implies-#0 a b pa pb -- a # 0 → 0 < b → (a · b) # 0 _·ʰᶻ_ {x#0} {x<0} (a ,, pa) (b ,, pb) = ℤ.·-#0-<0-implies-#0 a b pa pb -- a # 0 → b < 0 → (a · b) # 0 _·ʰᶻ_ {x#0} {x≤0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {0≤x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {0≤x} {x#0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {0≤x} {0≤x} (a ,, pa) (b ,, pb) = ℤ.·-0≤-0≤-implies-0≤ a b pa pb -- 0 ≤ a → 0 ≤ b → 0 ≤ (a · b) _·ʰᶻ_ {0≤x} {0<x} (a ,, pa) (b ,, pb) = ℤ.·-0≤-0<-implies-0≤ a b pa pb -- 0 ≤ a → 0 < b → 0 ≤ (a · b) _·ʰᶻ_ {0≤x} {x<0} (a ,, pa) (b ,, pb) = ℤ.·-0≤-<0-implies-≤0 a b pa pb -- 0 ≤ a → b < 0 → (a · b) ≤ 0 _·ʰᶻ_ {0≤x} {x≤0} (a ,, pa) (b ,, pb) = ℤ.·-0≤-≤0-implies-≤0 a b pa pb -- 0 ≤ a → b ≤ 0 → (a · b) ≤ 0 _·ʰᶻ_ {0<x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {0<x} {x#0} (a ,, pa) (b ,, pb) = ℤ.·-0<-#0-implies-#0 a b pa pb -- 0 < a → b # 0 → (a · b) # 0 _·ʰᶻ_ {0<x} {0≤x} (a ,, pa) (b ,, pb) = ℤ.·-0<-0≤-implies-0≤ a b pa pb -- 0 < a → 0 ≤ b → 0 ≤ (a · b) _·ʰᶻ_ {0<x} {0<x} (a ,, pa) (b ,, pb) = ℤ.·-0<-0<-implies-0< a b pa pb -- 0 < a → 0 < b → 0 < (a · b) _·ʰᶻ_ {0<x} {x<0} (a ,, pa) (b ,, pb) = ℤ.·-0<-<0-implies-<0 a b pa pb -- 0 < a → b < 0 → (a · b) < 0 _·ʰᶻ_ {0<x} {x≤0} (a ,, pa) (b ,, pb) = ℤ.·-0<-≤0-implies-≤0 a b pa pb -- 0 < a → b ≤ 0 → (a · b) ≤ 0 _·ʰᶻ_ {x<0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {x<0} {x#0} (a ,, pa) (b ,, pb) = ℤ.·-<0-#0-implies-#0 a b pa pb -- a < 0 → b # 0 → (a · b) # 0 _·ʰᶻ_ {x<0} {0≤x} (a ,, pa) (b ,, pb) = ℤ.·-<0-0≤-implies-≤0 a b pa pb -- a < 0 → 0 ≤ b → (a · b) ≤ 0 _·ʰᶻ_ {x<0} {0<x} (a ,, pa) (b ,, pb) = ℤ.·-<0-0<-implies-<0 a b pa pb -- a < 0 → 0 < b → (a · b) < 0 _·ʰᶻ_ {x<0} {x<0} (a ,, pa) (b ,, pb) = ℤ.·-<0-<0-implies-0< a b pa pb -- a < 0 → b < 0 → 0 < (a · b) _·ʰᶻ_ {x<0} {x≤0} (a ,, pa) (b ,, pb) = ℤ.·-<0-≤0-implies-0≤ a b pa pb -- a < 0 → b ≤ 0 → 0 ≤ (a · b) _·ʰᶻ_ {x≤0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {x≤0} {x#0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶻ_ {x≤0} {0≤x} (a ,, pa) (b ,, pb) = ℤ.·-≤0-0≤-implies-≤0 a b pa pb -- a ≤ 0 → 0 ≤ b → (a · b) ≤ 0 _·ʰᶻ_ {x≤0} {0<x} (a ,, pa) (b ,, pb) = ℤ.·-≤0-0<-implies-≤0 a b pa pb -- a ≤ 0 → 0 < b → (a · b) ≤ 0 _·ʰᶻ_ {x≤0} {x<0} (a ,, pa) (b ,, pb) = ℤ.·-≤0-<0-implies-0≤ a b pa pb -- a ≤ 0 → b < 0 → 0 ≤ (a · b) _·ʰᶻ_ {x≤0} {x≤0} (a ,, pa) (b ,, pb) = ℤ.·-≤0-≤0-implies-0≤ a b pa pb -- a ≤ 0 → b ≤ 0 → 0 ≤ (a · b) _·ʰᶠ_ : ∀{p q} → (x : Number (isRat , p)) → (y : Number (isRat , q)) → PositivityKindInterpretation isRat (·-Positivityʰ isRat p q) (num x ·ᶠ num y) _·ʰᶠ_ {⁇x⁇} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {⁇x⁇} {x#0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {⁇x⁇} {0≤x} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {⁇x⁇} {0<x} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {⁇x⁇} {x<0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {⁇x⁇} {x≤0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {x#0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {x#0} {x#0} (a ,, pa) (b ,, pb) = ℚ.·-#0-#0-implies-#0 a b pa pb -- a # 0 → b # 0 → (a · b) # 0 _·ʰᶠ_ {x#0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {x#0} {0<x} (a ,, pa) (b ,, pb) = ℚ.·-#0-0<-implies-#0 a b pa pb -- a # 0 → 0 < b → (a · b) # 0 _·ʰᶠ_ {x#0} {x<0} (a ,, pa) (b ,, pb) = ℚ.·-#0-<0-implies-#0 a b pa pb -- a # 0 → b < 0 → (a · b) # 0 _·ʰᶠ_ {x#0} {x≤0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {0≤x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {0≤x} {x#0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {0≤x} {0≤x} (a ,, pa) (b ,, pb) = ℚ.·-0≤-0≤-implies-0≤ a b pa pb -- 0 ≤ a → 0 ≤ b → 0 ≤ (a · b) _·ʰᶠ_ {0≤x} {0<x} (a ,, pa) (b ,, pb) = ℚ.·-0≤-0<-implies-0≤ a b pa pb -- 0 ≤ a → 0 < b → 0 ≤ (a · b) _·ʰᶠ_ {0≤x} {x<0} (a ,, pa) (b ,, pb) = ℚ.·-0≤-<0-implies-≤0 a b pa pb -- 0 ≤ a → b < 0 → (a · b) ≤ 0 _·ʰᶠ_ {0≤x} {x≤0} (a ,, pa) (b ,, pb) = ℚ.·-0≤-≤0-implies-≤0 a b pa pb -- 0 ≤ a → b ≤ 0 → (a · b) ≤ 0 _·ʰᶠ_ {0<x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {0<x} {x#0} (a ,, pa) (b ,, pb) = ℚ.·-0<-#0-implies-#0 a b pa pb -- 0 < a → b # 0 → (a · b) # 0 _·ʰᶠ_ {0<x} {0≤x} (a ,, pa) (b ,, pb) = ℚ.·-0<-0≤-implies-0≤ a b pa pb -- 0 < a → 0 ≤ b → 0 ≤ (a · b) _·ʰᶠ_ {0<x} {0<x} (a ,, pa) (b ,, pb) = ℚ.·-0<-0<-implies-0< a b pa pb -- 0 < a → 0 < b → 0 < (a · b) _·ʰᶠ_ {0<x} {x<0} (a ,, pa) (b ,, pb) = ℚ.·-0<-<0-implies-<0 a b pa pb -- 0 < a → b < 0 → (a · b) < 0 _·ʰᶠ_ {0<x} {x≤0} (a ,, pa) (b ,, pb) = ℚ.·-0<-≤0-implies-≤0 a b pa pb -- 0 < a → b ≤ 0 → (a · b) ≤ 0 _·ʰᶠ_ {x<0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {x<0} {x#0} (a ,, pa) (b ,, pb) = ℚ.·-<0-#0-implies-#0 a b pa pb -- a < 0 → b # 0 → (a · b) # 0 _·ʰᶠ_ {x<0} {0≤x} (a ,, pa) (b ,, pb) = ℚ.·-<0-0≤-implies-≤0 a b pa pb -- a < 0 → 0 ≤ b → (a · b) ≤ 0 _·ʰᶠ_ {x<0} {0<x} (a ,, pa) (b ,, pb) = ℚ.·-<0-0<-implies-<0 a b pa pb -- a < 0 → 0 < b → (a · b) < 0 _·ʰᶠ_ {x<0} {x<0} (a ,, pa) (b ,, pb) = ℚ.·-<0-<0-implies-0< a b pa pb -- a < 0 → b < 0 → 0 < (a · b) _·ʰᶠ_ {x<0} {x≤0} (a ,, pa) (b ,, pb) = ℚ.·-<0-≤0-implies-0≤ a b pa pb -- a < 0 → b ≤ 0 → 0 ≤ (a · b) _·ʰᶠ_ {x≤0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {x≤0} {x#0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶠ_ {x≤0} {0≤x} (a ,, pa) (b ,, pb) = ℚ.·-≤0-0≤-implies-≤0 a b pa pb -- a ≤ 0 → 0 ≤ b → (a · b) ≤ 0 _·ʰᶠ_ {x≤0} {0<x} (a ,, pa) (b ,, pb) = ℚ.·-≤0-0<-implies-≤0 a b pa pb -- a ≤ 0 → 0 < b → (a · b) ≤ 0 _·ʰᶠ_ {x≤0} {x<0} (a ,, pa) (b ,, pb) = ℚ.·-≤0-<0-implies-0≤ a b pa pb -- a ≤ 0 → b < 0 → 0 ≤ (a · b) _·ʰᶠ_ {x≤0} {x≤0} (a ,, pa) (b ,, pb) = ℚ.·-≤0-≤0-implies-0≤ a b pa pb -- a ≤ 0 → b ≤ 0 → 0 ≤ (a · b) _·ʰʳ_ : ∀{p q} → (x : Number (isReal , p)) → (y : Number (isReal , q)) → PositivityKindInterpretation isReal (·-Positivityʰ isReal p q) (num x ·ʳ num y) _·ʰʳ_ {⁇x⁇} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {⁇x⁇} {x#0} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {⁇x⁇} {0≤x} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {⁇x⁇} {0<x} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {⁇x⁇} {x<0} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {⁇x⁇} {x≤0} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {x#0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {x#0} {x#0} (a ,, pa) (b ,, pb) = ℝ.·-#0-#0-implies-#0 a b pa pb -- a # 0 → b # 0 → (a · b) # 0 _·ʰʳ_ {x#0} {0≤x} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {x#0} {0<x} (a ,, pa) (b ,, pb) = ℝ.·-#0-0<-implies-#0 a b pa pb -- a # 0 → 0 < b → (a · b) # 0 _·ʰʳ_ {x#0} {x<0} (a ,, pa) (b ,, pb) = ℝ.·-#0-<0-implies-#0 a b pa pb -- a # 0 → b < 0 → (a · b) # 0 _·ʰʳ_ {x#0} {x≤0} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {0≤x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {0≤x} {x#0} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {0≤x} {0≤x} (a ,, pa) (b ,, pb) = ℝ.·-0≤-0≤-implies-0≤ a b pa pb -- 0 ≤ a → 0 ≤ b → 0 ≤ (a · b) _·ʰʳ_ {0≤x} {0<x} (a ,, pa) (b ,, pb) = ℝ.·-0≤-0<-implies-0≤ a b pa pb -- 0 ≤ a → 0 < b → 0 ≤ (a · b) _·ʰʳ_ {0≤x} {x<0} (a ,, pa) (b ,, pb) = ℝ.·-0≤-<0-implies-≤0 a b pa pb -- 0 ≤ a → b < 0 → (a · b) ≤ 0 _·ʰʳ_ {0≤x} {x≤0} (a ,, pa) (b ,, pb) = ℝ.·-0≤-≤0-implies-≤0 a b pa pb -- 0 ≤ a → b ≤ 0 → (a · b) ≤ 0 _·ʰʳ_ {0<x} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {0<x} {x#0} (a ,, pa) (b ,, pb) = ℝ.·-0<-#0-implies-#0 a b pa pb -- 0 < a → b # 0 → (a · b) # 0 _·ʰʳ_ {0<x} {0≤x} (a ,, pa) (b ,, pb) = ℝ.·-0<-0≤-implies-0≤ a b pa pb -- 0 < a → 0 ≤ b → 0 ≤ (a · b) _·ʰʳ_ {0<x} {0<x} (a ,, pa) (b ,, pb) = ℝ.·-0<-0<-implies-0< a b pa pb -- 0 < a → 0 < b → 0 < (a · b) _·ʰʳ_ {0<x} {x<0} (a ,, pa) (b ,, pb) = ℝ.·-0<-<0-implies-<0 a b pa pb -- 0 < a → b < 0 → (a · b) < 0 _·ʰʳ_ {0<x} {x≤0} (a ,, pa) (b ,, pb) = ℝ.·-0<-≤0-implies-≤0 a b pa pb -- 0 < a → b ≤ 0 → (a · b) ≤ 0 _·ʰʳ_ {x<0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {x<0} {x#0} (a ,, pa) (b ,, pb) = ℝ.·-<0-#0-implies-#0 a b pa pb -- a < 0 → b # 0 → (a · b) # 0 _·ʰʳ_ {x<0} {0≤x} (a ,, pa) (b ,, pb) = ℝ.·-<0-0≤-implies-≤0 a b pa pb -- a < 0 → 0 ≤ b → (a · b) ≤ 0 _·ʰʳ_ {x<0} {0<x} (a ,, pa) (b ,, pb) = ℝ.·-<0-0<-implies-<0 a b pa pb -- a < 0 → 0 < b → (a · b) < 0 _·ʰʳ_ {x<0} {x<0} (a ,, pa) (b ,, pb) = ℝ.·-<0-<0-implies-0< a b pa pb -- a < 0 → b < 0 → 0 < (a · b) _·ʰʳ_ {x<0} {x≤0} (a ,, pa) (b ,, pb) = ℝ.·-<0-≤0-implies-0≤ a b pa pb -- a < 0 → b ≤ 0 → 0 ≤ (a · b) _·ʰʳ_ {x≤0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {x≤0} {x#0} (a ,, pa) (b ,, pb) = lift tt _·ʰʳ_ {x≤0} {0≤x} (a ,, pa) (b ,, pb) = ℝ.·-≤0-0≤-implies-≤0 a b pa pb -- a ≤ 0 → 0 ≤ b → (a · b) ≤ 0 _·ʰʳ_ {x≤0} {0<x} (a ,, pa) (b ,, pb) = ℝ.·-≤0-0<-implies-≤0 a b pa pb -- a ≤ 0 → 0 < b → (a · b) ≤ 0 _·ʰʳ_ {x≤0} {x<0} (a ,, pa) (b ,, pb) = ℝ.·-≤0-<0-implies-0≤ a b pa pb -- a ≤ 0 → b < 0 → 0 ≤ (a · b) _·ʰʳ_ {x≤0} {x≤0} (a ,, pa) (b ,, pb) = ℝ.·-≤0-≤0-implies-0≤ a b pa pb -- a ≤ 0 → b ≤ 0 → 0 ≤ (a · b) _·ʰᶜ_ : ∀{p q} → (x : Number (isComplex , p)) → (y : Number (isComplex , q)) → PositivityKindInterpretation isComplex (·-Positivityʰ isComplex p q) (num x ·ᶜ num y) _·ʰᶜ_ {⁇x⁇} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶜ_ {⁇x⁇} {x#0} (a ,, pa) (b ,, pb) = lift tt _·ʰᶜ_ {x#0} {⁇x⁇} (a ,, pa) (b ,, pb) = lift tt _·ʰᶜ_ {x#0} {x#0} (a ,, pa) (b ,, pb) = ℂ.·-#0-#0-implies-#0 a b pa pb -- a # 0 → b # 0 → (a · b) # 0 open PatternsType -- abs x = max x (- x) abs : ∀{l p} → (x : Number (l , p)) → abs-Types x abs {isNat } {X } (x ,, p) = (absⁿ x ,, 0≤xⁿ x) abs {isNat } {X⁺⁻} (x ,, p) = (absⁿ x ,, ℕ.0≤-#0-implies-0< x (0≤xⁿ x) p) abs {isNat } {X₀⁺} (x ,, p) = (absⁿ x ,, p) abs {isNat } {X⁺ } (x ,, p) = (absⁿ x ,, p) abs {isNat } {X₀⁻} (x ,, p) = (absⁿ x ,, (0ⁿ , (sym $ ≤0→≡0 p))) abs {isInt } {X } (x ,, p) = (absᶻ x ,, {!!}) -- ∀ x → 0 ≤ abs x abs {isInt } {X⁺⁻} (x ,, p) = (absᶻ x ,, {!!}) -- ∀ x → x # 0 → 0 < abs x abs {isInt } {X₀⁺} (x ,, p) = (absᶻ x ,, {!!}) -- ∀ x → 0 ≤ abs x abs {isInt } {X⁺ } (x ,, p) = (absᶻ x ,, {!!}) -- ∀ x → 0 < x → 0 < abs x abs {isInt } {X⁻ } (x ,, p) = (absᶻ x ,, {!!}) -- ∀ x → x < 0 → 0 < abs x abs {isInt } {X₀⁻} (x ,, p) = (absᶻ x ,, {!!}) -- ∀ x → 0 ≤ abs x abs {isRat } {X } (x ,, p) = (absᶠ x ,, {!!}) -- ∀ x → 0 ≤ abs x abs {isRat } {X⁺⁻} (x ,, p) = (absᶠ x ,, {!!}) -- ∀ x → x # 0 → 0 < abs x abs {isRat } {X₀⁺} (x ,, p) = (absᶠ x ,, {!!}) -- ∀ x → 0 ≤ abs x abs {isRat } {X⁺ } (x ,, p) = (absᶠ x ,, {!!}) -- ∀ x → 0 < x → 0 < abs x abs {isRat } {X⁻ } (x ,, p) = (absᶠ x ,, {!!}) -- ∀ x → x < 0 → 0 < abs x abs {isRat } {X₀⁻} (x ,, p) = (absᶠ x ,, {!!}) -- ∀ x → 0 ≤ abs x abs {isReal } {X } (x ,, p) = (absʳ x ,, {!!}) -- ∀ x → 0 ≤ abs x abs {isReal } {X⁺⁻} (x ,, p) = (absʳ x ,, {!!}) -- ∀ x → x # 0 → 0 < abs x abs {isReal } {X₀⁺} (x ,, p) = (absʳ x ,, {!!}) -- ∀ x → 0 ≤ abs x abs {isReal } {X⁺ } (x ,, p) = (absʳ x ,, {!!}) -- ∀ x → 0 < x → 0 < abs x abs {isReal } {X⁻ } (x ,, p) = (absʳ x ,, {!!}) -- ∀ x → x < 0 → 0 < abs x abs {isReal } {X₀⁻} (x ,, p) = (absʳ x ,, {!!}) -- ∀ x → 0 ≤ abs x abs {isComplex} {X } (x ,, p) = (absᶜ x ,, 0≤abs x) abs {isComplex} {X⁺⁻} (x ,, p) = (absᶜ x ,, γ) where pʳ = ℂ.0≤abs x γ : 0ʳ <ʳ absᶜ x γ = ℝ.0≤-#0-implies-0< (absᶜ x) pʳ (ℂ.abs-preserves-#0 x p) -- a < b → ¬(b ≤ a) = ¬¬(a < b) -- 0≤abs : ∀ x → 0ʳ ≤ʳ abs x -- abs-preserves-0 : ∀ x → x ≡ 0f → abs x ≡ 0ʳ -- abs-reflects-0 : ∀ x → abs x ≡ 0ʳ → x ≡ 0f -- abs-preserves-· : ∀ x y → abs (x · y) ≡ (abs x) ·ʳ (abs y) -- #-tight : ∀ x y → ¬(x # y) → x ≡ y -- a ≤ b = ¬(b < a)
oeis/259/A259546.asm
neoneye/loda-programs
11
163155
; A259546: a(n) = n^3*Fibonacci(n). ; 0,1,8,54,192,625,1728,4459,10752,24786,55000,118459,248832,511901,1034488,2058750,4042752,7846061,15069888,28677479,54120000,101370906,188586728,348669719,640991232,1172265625,2133603368,3866095494,6976587072,12541531081,22465080000,40106699779,71378829312,126662759586,224146270648,395627561875,696590502912,1223665904501,2144846009368,3751688643534,6549385920000,11411948897861,19849234362048,34465842202559,59748801511872,103418051366250,178739255390408,308480462524079,531674023329792 mov $1,$0 pow $0,2 seq $1,45925 ; a(n) = n*Fibonacci(n). mul $0,$1
08 Soundcheck/Route audio to ADDITIONAL outputs.applescript
streth11/Qlab-Scripts
0
921
<reponame>streth11/Qlab-Scripts<filename>08 Soundcheck/Route audio to ADDITIONAL outputs.applescript<gh_stars>0 -- @description Route audio to ADDITIONAL outputs -- @author <NAME> -- @link bensmithsound.uk -- @version 1.0 -- @testedmacos 10.13.6 -- @testedqlab 4.6.9 -- @about Routes the cue output faders to additional sets of outputs, e.g. Foldback, Delays, Reverbs -- @separateprocess TRUE -- @changelog -- v1.0 + init -- USER DEFINED VARIABLES ----------------- set numberOfOutputs to 10 -- total number of cue outputs in use set outputsToAdd to {5, 6} -- list all output numbers that this script to affect routing to set userLevel to -12 set thisCueNumber to "FB" set otherCueNumbers to {"LR", "PA", "US", "Sur"} -- list of the cue numbers of other instances of these scripts set cueListToRoute to "Soundcheck" -- the name of the soundcheck cue list. If this is blank, it will use selected cues ---------- END OF USER DEFINED VARIABLES -- -- RUN SCRIPT ----------------------------- tell application id "com.figure53.Qlab.4" tell front workspace -- A button to set routing of soundcheck tracks to additional places, or not. -- Only adjust the faders that need to change, e.g. foldback, leave the rest as they are. -- use row 0 (fader) and columns 1 onwards -- Set names for the cue, and q colors in each step of the script, whether it is on or off. -- Define variable set oldLevel to {} -- Run script if cueListToRoute is not "" then set selectedCues to (cues in (first cue list whose q name is cueListToRoute) as list) else set selectedCues to (selected as list) end if repeat with eachCue in selectedCues set cueType to q type of eachCue if cueType is "Audio" then -- Determine whether this button is already active or inactive. Set correct column/s. set currentOutput to 1 repeat with eachOutput in outputsToAdd set oldOutputLevel to getLevel eachCue row 0 column eachOutput as number set end of oldLevel to oldOutputLevel set currentOutput to currentOutput + 1 end repeat repeat with eachLevel in oldLevel if eachLevel is greater than -60 then set isActive to true else set isActive to false end if end repeat if isActive is true then -- DEACTIVATE send. Set correct column/s. Turns off send. repeat with eachOutput in outputsToAdd setLevel eachCue row 0 column eachOutput db "-inf" end repeat set q color of cue thisCueNumber to "none" else if isActive is false then -- ACTIVATE send. Set correct column/s. Turns on send. repeat with eachOutput in outputsToAdd setLevel eachCue row 0 column eachOutput db userLevel end repeat set q color of cue thisCueNumber to "cerulean" end if end if end repeat end tell end tell
source/xml/sax/xml-sax-input_sources-streams-files.adb
svn2github/matreshka
24
30000
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package body XML.SAX.Input_Sources.Streams.Files is use Ada.Streams.Stream_IO; package Naming_Utilities is function Absolute_Name (Name : League.Strings.Universal_String) return League.Strings.Universal_String; -- Constructs absolute name of the file when specified name is relative. function File_Name_To_URI (File_Name : League.Strings.Universal_String) return League.Strings.Universal_String; -- Extracts file name from the URI. function URI_To_File_Name (URI : League.Strings.Universal_String) return League.Strings.Universal_String; -- Extracts file name from the URI. function To_Ada_RTL_File_Name (Name : League.Strings.Universal_String) return String; -- Converts file name to Ada RTL convention. end Naming_Utilities; ----------- -- Close -- ----------- not overriding procedure Close (Self : in out File_Input_Source) is begin Close (Self.File); end Close; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : in out File_Input_Source) is begin if Is_Open (Self.File) then Close (Self.File); end if; Stream_Input_Source (Self).Finalize; end Finalize; ---------------------- -- Naming_Utilities -- ---------------------- package body Naming_Utilities is separate; ----------------------- -- Open_By_File_Name -- ----------------------- not overriding procedure Open_By_File_Name (Self : in out File_Input_Source; Name : League.Strings.Universal_String) is File_Name : constant League.Strings.Universal_String := Naming_Utilities.Absolute_Name (Name); begin Open (Self.File, Ada.Streams.Stream_IO.In_File, Naming_Utilities.To_Ada_RTL_File_Name (File_Name), "SHARED=NO"); Self.Set_System_Id (Naming_Utilities.File_Name_To_URI (File_Name)); Self.Set_Stream (Stream_Access (Stream (Self.File))); end Open_By_File_Name; ----------------- -- Open_By_URI -- ----------------- not overriding procedure Open_By_URI (Self : in out File_Input_Source; URI : League.Strings.Universal_String) is begin Self.Open_By_File_Name (Naming_Utilities.URI_To_File_Name (URI)); end Open_By_URI; ---------------------- -- URI_To_File_Name -- ---------------------- function URI_To_File_Name (URI : League.Strings.Universal_String) return League.Strings.Universal_String renames Naming_Utilities.URI_To_File_Name; end XML.SAX.Input_Sources.Streams.Files;
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_1040.asm
ljhsiun2/medusa
9
102022
.global s_prepare_buffers s_prepare_buffers: push %r15 push %r8 push %r9 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0xccba, %rsi and %rbp, %rbp movups (%rsi), %xmm6 vpextrq $0, %xmm6, %r9 nop nop nop and %r8, %r8 lea addresses_WC_ht+0x327a, %r15 nop nop sub $23820, %rdx movups (%r15), %xmm2 vpextrq $0, %xmm2, %r9 nop nop nop nop nop lfence lea addresses_normal_ht+0x1e27a, %rbp nop nop nop inc %rbx movb (%rbp), %r8b nop nop nop nop nop add $63243, %rbx lea addresses_WT_ht+0xf7da, %rsi nop nop nop nop and %r15, %r15 mov (%rsi), %bx and %r8, %r8 lea addresses_A_ht+0xccba, %rdx nop nop nop nop nop and %rbp, %rbp vmovups (%rdx), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %rsi and %rsi, %rsi lea addresses_WC_ht+0x11cb1, %rsi lea addresses_A_ht+0x138fa, %rdi nop nop nop nop and %rbp, %rbp mov $5, %rcx rep movsq nop nop nop nop nop and %r15, %r15 lea addresses_A_ht+0x18e2, %rbx nop nop inc %rdi movb (%rbx), %r9b nop nop add %r15, %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r8 pop %r15 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %r15 push %rcx push %rdi // Faulty Load lea addresses_RW+0x1a4ba, %r13 nop nop nop nop nop dec %r14 mov (%r13), %r10 lea oracles, %r13 and $0xff, %r10 shlq $12, %r10 mov (%r13,%r10,1), %r10 pop %rdi pop %rcx pop %r15 pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'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 */
source/sql/matreshka-internals-sql_parameter_rewriters.adb
svn2github/matreshka
24
3425
<filename>source/sql/matreshka-internals-sql_parameter_rewriters.adb ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Characters.Wide_Wide_Latin_1; package body Matreshka.Internals.SQL_Parameter_Rewriters is ------------- -- Rewrite -- ------------- procedure Rewrite (Self : Abstract_Parameter_Rewriter'Class; Source : League.Strings.Universal_String; Rewritten : out League.Strings.Universal_String; Parameters : out SQL_Parameter_Sets.Parameter_Set) is Placeholder : League.Strings.Universal_String; Number : Positive := 1; Index : Positive := 1; First : Positive; begin Rewritten.Clear; Parameters.Clear; while Index <= Source.Length loop case Source.Element (Index).To_Wide_Wide_Character is when ':' => -- Parameter placeholder. First := Index; Index := Index + 1; -- First character must be ID_Start. if Index <= Source.Length and then Source.Element (Index).Is_ID_Start then Index := Index + 1; -- And others are ID_Continue. while Index <= Source.Length loop exit when not Source.Element (Index).Is_ID_Continue; Index := Index + 1; end loop; Index := Index - 1; -- Replace generic parameter placeholder by database -- specific one. Self.Database_Placeholder (Source.Slice (First, Index).To_Casefold, Number, Placeholder, Parameters); Rewritten.Append (Placeholder); Number := Number + 1; else raise Program_Error; end if; when ''' => -- String literal. Rewritten.Append (Source.Element (Index)); Index := Index + 1; -- Copy all characters till end of statement or single -- apostrophe character (two sequential apostrophe characters -- is escape sequence in SQL) is reached. while Index <= Source.Length loop Rewritten.Append (Source.Element (Index)); exit when Source.Element (Index).To_Wide_Wide_Character = ''' and (Index = Source.Length or else Source.Element (Index + 1).To_Wide_Wide_Character /= '''); Index := Index + 1; end loop; when '-' => Rewritten.Append (Source.Element (Index)); -- Comment starts from to minus signs and ends by end of line. if Index < Source.Length and then Source.Element (Index + 1).To_Wide_Wide_Character = '-' then Index := Index + 1; Rewritten.Append (Source.Element (Index)); Index := Index + 1; while Index <= Source.Length loop Rewritten.Append (Source.Element (Index)); exit when Source.Element (Index).To_Wide_Wide_Character = Ada.Characters.Wide_Wide_Latin_1.CR or Source.Element (Index).To_Wide_Wide_Character = Ada.Characters.Wide_Wide_Latin_1.LF; Index := Index + 1; end loop; end if; when others => Rewritten.Append (Source.Element (Index)); end case; Index := Index + 1; end loop; end Rewrite; end Matreshka.Internals.SQL_Parameter_Rewriters;
out/euler30.adb
FardaleM/metalang
22
11856
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 euler30 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; type g is Array (Integer range <>) of Integer; type g_PTR is access g; sum : Integer; s : Integer; r : Integer; p : g_PTR; begin -- --a + b * 10 + c * 100 + d * 1000 + e * 10 000 = -- a ^ 5 + -- b ^ 5 + -- c ^ 5 + -- d ^ 5 + -- e ^ 5 -- p := new g (0..9); for i in integer range 0..9 loop p(i) := i * i * i * i * i; end loop; sum := 0; for a in integer range 0..9 loop for b in integer range 0..9 loop for c in integer range 0..9 loop for d in integer range 0..9 loop for e in integer range 0..9 loop for f in integer range 0..9 loop s := p(a) + p(b) + p(c) + p(d) + p(e) + p(f); r := a + b * 10 + c * 100 + d * 1000 + e * 10000 + f * 100000; if s = r and then r /= 1 then PInt(f); PInt(e); PInt(d); PInt(c); PInt(b); PInt(a); PString(new char_array'( To_C(" "))); PInt(r); PString(new char_array'( To_C("" & Character'Val(10)))); sum := sum + r; end if; end loop; end loop; end loop; end loop; end loop; end loop; PInt(sum); end;
Driver/SoundSystem.asm
gb-archive/GBSoundSystem
1
24854
INCLUDE "SoundSystemNotes.inc" INCLUDE "SoundSystem.def" INCLUDE "SoundSystem.inc" ; tabs=8,hard ;*************************************************************************************************************************** ;* default behaviors ;*************************************************************************************************************************** ; force support for color gameboy-specific roms to be disabled if not user-specified IF !DEF(SOUNDSYSTEM_GBC_COMPATIBLE) SOUNDSYSTEM_GBC_COMPATIBLE EQU 0 ENDC ; force support for banking if not user-specified IF !DEF(SOUNDSYSTEM_ROM_BANKING) SOUNDSYSTEM_ROM_BANKING EQU 1 ENDC ; force support for large roms to be disabled if not user-specified IF !DEF(SOUNDSYSTEM_LARGE_ROM) SOUNDSYSTEM_LARGE_ROM EQU 0 ENDC ; force the code to reside in bank 0 if not user-specified IF !DEF(SOUNDSYSTEM_CODE_BANK) SOUNDSYSTEM_CODE_BANK EQU 0 ENDC ; force the variables to reside in wram bank 0 if not user-specified IF !DEF(SOUNDSYSTEM_WRAM_BANK) SOUNDSYSTEM_WRAM_BANK EQU 0 ENDC ; force the sfx to be enabled if not user-specified if !DEF(SOUNDSYSTEM_ENABLE_SFX) SOUNDSYSTEM_ENABLE_SFX EQU 1 ENDC ; force the vu meters to be disabled if not user-specified if !DEF(SOUNDSYSTEM_ENABLE_VUM) SOUNDSYSTEM_ENABLE_VUM EQU 0 ENDC ; force certain settings if the rom is not specific to color gameboy IF (SOUNDSYSTEM_GBC_COMPATIBLE == 0) PURGE SOUNDSYSTEM_WRAM_BANK SOUNDSYSTEM_WRAM_BANK EQU 0 ENDC ; do some sanity checking IF (SOUNDSYSTEM_GBC_COMPATIBLE != 0) ASSERT(SOUNDSYSTEM_WRAM_BANK < 8) ; force boolean PURGE SOUNDSYSTEM_GBC_COMPATIBLE SOUNDSYSTEM_GBC_COMPATIBLE EQU 1 ENDC IF (SOUNDSYSTEM_LARGE_ROM != 0) ASSERT(SOUNDSYSTEM_ROM_BANKING != 0) ASSERT(SOUNDSYSTEM_CODE_BANK < 512) ; force boolean PURGE SOUNDSYSTEM_LARGE_ROM SOUNDSYSTEM_LARGE_ROM EQU 1 ENDC IF (SOUNDSYSTEM_ENABLE_SFX != 0) ; force boolean PURGE SOUNDSYSTEM_ENABLE_SFX SOUNDSYSTEM_ENABLE_SFX EQU 1 ENDC IF (SOUNDSYSTEM_ENABLE_VUM != 0) ; force boolean PURGE SOUNDSYSTEM_ENABLE_VUM SOUNDSYSTEM_ENABLE_VUM EQU 1 ENDC sizeof_BANK_VAR = 1+SOUNDSYSTEM_LARGE_ROM ; the size, in bytes, of the bank variables ; display the configuration PRINTLN "SoundSystem Configuration:" IF (SOUNDSYSTEM_GBC_COMPATIBLE == 0) PRINTLN " GBC Only: no" ELSE PRINTLN " GBC Only: YES" ENDC IF (SOUNDSYSTEM_LARGE_ROM == 0) PRINTLN " Large ROM: no" ELSE PRINTLN " Large ROM: YES" ENDC PRINTLN " Code Bank: {SOUNDSYSTEM_CODE_BANK}" PRINTLN " WRAM Bank: {SOUNDSYSTEM_WRAM_BANK}" IF (SOUNDSYSTEM_ROM_BANKING == 0) PRINTLN " ROM Banking: disabled" ELSE PRINTLN " ROM Banking: ENABLED" ENDC IF (SOUNDSYSTEM_ENABLE_SFX == 0) PRINTLN " SFX: disabled" ELSE PRINTLN " SFX: ENABLED" ENDC IF (SOUNDSYSTEM_ENABLE_VUM == 0) PRINTLN " VU Meters: disabled" ELSE PRINTLN " VU Meters: ENABLED" ENDC ;*************************************************************************************************************************** ;* hardware registers ;*************************************************************************************************************************** rROMB0 EQU $2000 ; $2000->$2FFF rROMB1 EQU $3000 ; $3000->$3FFF - If more than 256 ROM banks are present. rSVBK EQU $FF70 rAUD1SWEEP EQU $FF10 rAUD1LEN EQU $FF11 rAUD1ENV EQU $FF12 rAUD1LOW EQU $FF13 rAUD1HIGH EQU $FF14 rAUD2LEN EQU $FF16 rAUD2ENV EQU $FF17 rAUD2LOW EQU $FF18 rAUD2HIGH EQU $FF19 rAUD3ENA EQU $FF1A rAUD3LEN EQU $FF1B rAUD3LEVEL EQU $FF1C rAUD3LOW EQU $FF1D rAUD3HIGH EQU $FF1E rAUD4LEN EQU $FF20 rAUD4ENV EQU $FF21 rAUD4POLY EQU $FF22 rAUD4GO EQU $FF23 rAUDVOL EQU $FF24 rAUDTERM EQU $FF25 rAUDENA EQU $FF26 _AUD3WAVERAM EQU $FF30 ; $FF30->$FF3F ; values for rAUD1LEN, rAUD2LEN AUDLEN_DUTY_75 EQU %11000000 ; 75% AUDLEN_DUTY_50 EQU %10000000 ; 50% AUDLEN_DUTY_25 EQU %01000000 ; 25% AUDLEN_DUTY_12_5 EQU %00000000 ; 12.5% AUDLEN_LENGTHMASK EQU %00111111 ; values for rAUD1HIGH, rAUD2HIGH, rAUD3HIGH AUDHIGH_RESTART EQU %10000000 AUDHIGH_LENGTH_ON EQU %01000000 AUDHIGH_LENGTH_OFF EQU %00000000 ; values for rAUD3ENA AUD3ENA_ON EQU %10000000 ; values for rAUDVOL AUDVOL_VIN_LEFT EQU %10000000 ; SO2 AUDVOL_VIN_RIGHT EQU %00001000 ; SO1 ; values for rAUDTERM ; SO2 AUDTERM_4_LEFT EQU %10000000 AUDTERM_3_LEFT EQU %01000000 AUDTERM_2_LEFT EQU %00100000 AUDTERM_1_LEFT EQU %00010000 ; SO1 AUDTERM_4_RIGHT EQU %00001000 AUDTERM_3_RIGHT EQU %00000100 AUDTERM_2_RIGHT EQU %00000010 AUDTERM_1_RIGHT EQU %00000001 AUDTERM_ALL EQU $FF ; shorthand instead of ORing all the EQUs together ;*************************************************************************************************************************** ;* supported music commands ;*************************************************************************************************************************** RSSET 0 MUSIC_CMD_ENDOFFRAME RB 1 MUSIC_CMD_PLAYINSTNOTE RB 1 MUSIC_CMD_PLAYINST RB 1 MUSIC_CMD_SETVOLUME RB 1 MUSIC_CMD_VIBRATO_ON RB 1 MUSIC_CMD_EFFECT_OFF RB 1 MUSIC_CMD_SYNCFLAG RB 1 MUSIC_CMD_ENDOFPATTERN RB 1 MUSIC_CMD_GOTOORDER RB 1 MUSIC_CMD_ENDOFSONG RB 1 MUSIC_CMD_SETSPEED RB 1 MUSIC_CMD_ENDOFFRAME1X RB 1 MUSIC_CMD_ENDOFFRAME2X RB 1 MUSIC_CMD_ENDOFFRAME3X RB 1 MUSIC_CMD_ENDOFFRAME4X RB 1 MUSIC_CMD_PITCHUP_ON RB 1 MUSIC_CMD_PITCHDOWN_ON RB 1 MUSIC_CMD_TRIPLENOTE_ON RB 1 MUSIC_CMD_EXTRA RB 1 ;*************************************************************************************************************************** ;* supported music effects ;*************************************************************************************************************************** RSRESET MUSIC_FX_NONE RB 1 MUSIC_FX_VIB1 RB 1 MUSIC_FX_VIB2 RB 1 MUSIC_FX_TRIPLEFREQ1 RB 1 MUSIC_FX_TRIPLEFREQ2 RB 1 MUSIC_FX_TRIPLEFREQ3 RB 1 MUSIC_FX_PITCHUP RB 1 MUSIC_FX_PITCHDOWN RB 1 ;*************************************************************************************************************************** ;* supported instrument commands ;*************************************************************************************************************************** RSRESET ; common commands MUSIC_INSTCMD_X_FRAMEEND RB 1 MUSIC_INSTCMD_X_START RB 1 MUSIC_INSTCMD_X_END RB 1 MUSIC_INSTCMD_X_ENVELOPE RB 1 MUSIC_INSTCMD_X_STARTFREQ RB 1 MUSIC_INSTCMD_X_ENVELOPEVOL RB 1 MUSIC_INSTCMD_X_STARTENVVOLFREQ RB 1 MUSIC_INSTCMD_X_PANMID RB 1 MUSIC_INSTCMD_X_PANRIGHT RB 1 MUSIC_INSTCMD_X_PANLEFT RB 1 ; count of common instrument commands MUSIC_INSTCMD_COMMONCOUNT RB 0 ; specific commands ; channels 1 and 2 RSSET MUSIC_INSTCMD_COMMONCOUNT MUSIC_INSTCMD_12_PULSELEN RB 1 MUSIC_INSTCMD_1_SWEEP RB 1 ; channel 3 RSSET MUSIC_INSTCMD_COMMONCOUNT MUSIC_INSTCMD_3_WAVE RB 1 MUSIC_INSTCMD_3_LEN RB 1 ; channel 4 RSSET MUSIC_INSTCMD_COMMONCOUNT MUSIC_INSTCMD_4_POLYLOAD RB 1 MUSIC_INSTCMD_4_LEN RB 1 ;*************************************************************************************************************************** ;* wSoundFXLock bit definitions ;*************************************************************************************************************************** SFXLOCKF_4_LEFT EQU AUDTERM_4_LEFT SFXLOCKF_3_LEFT EQU AUDTERM_3_LEFT SFXLOCKF_2_LEFT EQU AUDTERM_2_LEFT SFXLOCKF_1_LEFT EQU AUDTERM_1_LEFT SFXLOCKF_4_RIGHT EQU AUDTERM_4_RIGHT SFXLOCKF_3_RIGHT EQU AUDTERM_3_RIGHT SFXLOCKF_2_RIGHT EQU AUDTERM_2_RIGHT SFXLOCKF_1_RIGHT EQU AUDTERM_1_RIGHT SFXLOCKB_CHANNEL4 EQU 3 SFXLOCKB_CHANNEL3 EQU 2 SFXLOCKB_CHANNEL2 EQU 1 SFXLOCKB_CHANNEL1 EQU 0 ;*************************************************************************************************************************** ;* work ram ;*************************************************************************************************************************** IF (SOUNDSYSTEM_WRAM_BANK == 0) SECTION "SoundSystem Variables",WRAM0,ALIGN[7] ELSE SECTION "SoundSystem Variables",WRAMX,BANK[SOUNDSYSTEM_WRAM_BANK],ALIGN[7] ENDC wMusicSyncData:: DS 1 ; arbitrary value set by the song to sync visual effects with bg music ; soundfx variables wSoundFXLock: DS 1 ; bitfield (see above), 1 = Music, 0 = SFX Locked wSoundFXTable: DS 2 ; table of soundfx pointers IF (SOUNDSYSTEM_ROM_BANKING != 0) wSoundFXBank: DS sizeof_BANK_VAR ; bank of soundfxs ENDC wSoundFXStart: DS 4 ; sound fx to start wSoundFXNote: DS 1 ; sound fx's start note ; music/sfx shared variables wMusicSFXPanning: DS 1 wMusicSFXInstPause1: DS 1 ; frames left before instrument/soundfx update for channel 1 wMusicSFXInstPause2: DS 1 ; frames left before instrument/soundfx update for channel 2 wMusicSFXInstPause3: DS 1 ; frames left before instrument/soundfx update for channel 3 wMusicSFXInstPause4: DS 1 ; frames left before instrument/soundfx update for channel 4 wMusicSFXInstPtr1: DS 2 ; pointer to playing instrument/soundfx for channel 1 wMusicSFXInstPtr2: DS 2 ; pointer to playing instrument/soundfx for channel 2 wMusicSFXInstPtr3: DS 2 ; pointer to playing instrument/soundfx for channel 3 wMusicSFXInstPtr4: DS 2 ; pointer to playing instrument/soundfx for channel 4 IF (SOUNDSYSTEM_ROM_BANKING != 0) wMusicSFXInstBank1: DS sizeof_BANK_VAR ; bank of active instrument for channel 1 wMusicSFXInstBank2: DS sizeof_BANK_VAR ; bank of active instrument for channel 2 wMusicSFXInstBank3: DS sizeof_BANK_VAR ; bank of active instrument for channel 3 wMusicSFXInstBank4: DS sizeof_BANK_VAR ; bank of active instrument for channel 4 ENDC wMusicSFXInstChnl3WaveID: DS 1 ; current waveid loaded, IDs of 255 in instruments will load, whatever the value here wMusicSFXInstChnl3Lock: DS 1 ; 0 = no lock, 1 = external lock ; music variables wMusicPlayState:: DS 1 ; current music playback state, 0 = stopped, 1 = playing wMusicNextFrame: DS 1 ; number of frames until the next music commands wMusicCommandPtr: DS 2 ; position of playing music IF (SOUNDSYSTEM_ROM_BANKING != 0) wMusicCommandBank: DS sizeof_BANK_VAR ; bank of playing music ENDC wMusicOrderPtr: DS 2 ; position of pattern order list (list of pointers to start of patterns) IF (SOUNDSYSTEM_ROM_BANKING != 0) wMusicOrderBank: DS sizeof_BANK_VAR ; bank of order list ENDC wMusicInstrumentTable: DS 2 ; table of instrument pointers IF (SOUNDSYSTEM_ROM_BANKING != 0) wMusicInstrumentBank: DS sizeof_BANK_VAR ; bank of instruments ENDC ; miscellaneous variables wChannelMusicFreq1: DS 2 ; GB frequency of channel 1 for music backup wChannelMusicFreq2: DS 2 ; GB frequency of channel 2 for music backup wChannelMusicFreq3: DS 2 ; GB frequency of channel 3 for music backup wChannelMusicFreq4: DS 2 ; GB frequency of channel 4 for music backup wChannelMusicNote1: DS 1 ; note of channel 1 for music backup wChannelMusicNote2: DS 1 ; note of channel 2 for music backup wChannelMusicNote3: DS 1 ; note of channel 3 for music backup wChannelMusicNote4: DS 1 ; note of channel 4 for music backup wChannelFreq1: DS 2 ; GB frequency of channel 1 wChannelFreq2: DS 2 ; GB frequency of channel 2 wChannelFreq3: DS 2 ; GB frequency of channel 3 wChannelFreq4: DS 2 ; GB frequency of channel 4 wChannelVol1: DS 1 ; volumes of channel 1, byte[4:VOL,4:xxxx] wChannelVol2: DS 1 ; volumes of channel 2, byte[4:VOL,4:xxxx] wChannelVol3: DS 1 ; volumes of channel 3, byte[4:VOL,4:xxxx] wChannelVol4: DS 1 ; volumes of channel 4, byte[4:VOL,4:xxxx] wMusicSpeed: DS 1 ; speed ; effect variables wChannelMusicEffect1: DS 1 ; active effect for channel 1, 0 = none wChannelMusicEffect2: DS 1 ; active effect for channel 2, 0 = none wChannelMusicEffect3: DS 1 ; active effect for channel 3, 0 = none wChannelMusicEffect4: DS 1 ; active effect for channel 4, 0 = none wChannelMusicFXParamA1: DS 2 ; effect parameters for channel 1 wChannelMusicFXParamA2: DS 2 ; effect parameters for channel 2 wChannelMusicFXParamA3: DS 2 ; effect parameters for channel 3 wChannelMusicFXParamA4: DS 2 ; effect parameters for channel 4 wChannelMusicFXParamB1: DS 2 ; effect parameters for channel 1 wChannelMusicFXParamB2: DS 2 ; effect parameters for channel 2 wChannelMusicFXParamB3: DS 2 ; effect parameters for channel 3 wChannelMusicFXParamB4: DS 2 ; effect parameters for channel 4 wTemp: DS 2 ; temporary storage for player calcs IF (SOUNDSYSTEM_ENABLE_VUM) wVUMeter1:: DS 1 ; vu meter data for channel 1 wVUMeter2:: DS 1 ; vu meter data for channel 2 wVUMeter3:: DS 1 ; vu meter data for channel 3 wVUMeter4:: DS 1 ; vu meter data for channel 4 ENDC ;*************************************************************************************************************************** ;* Identification ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Identity",ROM0 ELSE SECTION "SoundSystem_Identity",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SoundSystem_Version:: DB "SoundSystem v20.249",$00 SoundSystem_Author:: DB "Code: <NAME>",$00 ;*************************************************************************************************************************** ;* SoundSystem_Init ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Init",ROM0 ELSE SECTION "SoundSystem_Init",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SoundSystem_Init:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ; set all channel samples to 'stop' ld hl,wMusicSFXInstPtr1 ld e,4 .instptrloop: ld a,LOW(Music_InstrumentEnd) ld [hl+],a ld a,HIGH(Music_InstrumentEnd) ld [hl+],a dec e jr nz,.instptrloop IF (SOUNDSYSTEM_ROM_BANKING != 0) ; set all channel banks to be the bank with the stop instrument ld hl,wMusicSFXInstBank1 ld e,4 IF (SOUNDSYSTEM_LARGE_ROM) .instbankloop: ld a,LOW(BANK(Music_InstrumentEnd)) ld [hl+],a ld a,HIGH(BANK(Music_InstrumentEnd)) ld [hl+],a dec e jr nz,.instbankloop ELSE ld a,BANK(Music_InstrumentEnd) .instbankloop: ld [hl+],a dec e jr nz,.instbankloop ENDC ENDC ; set all channel volumes to 8 ld a,$80 ld hl,wChannelVol1 REPT 4 ld [hl+],a ENDR ; set all channel sfxs to unused (etc.) ld a,$FF ld hl,wSoundFXStart REPT 4 ld [hl+],a ENDR ld [wSoundFXLock],a ld [wMusicSFXPanning],a ld [wMusicSFXInstChnl3WaveID],a ; clear all channel music effects xor a ld hl,wChannelMusicEffect1 REPT 4 ld [hl+],a ENDR ld [wMusicSFXInstChnl3Lock],a ; clear all sfx pause timers ld hl,wMusicSFXInstPause1 REPT 4 ld [hl+],a ENDR ; clear all channel music frequencies ld hl,wChannelMusicFreq1 REPT 8 ld [hl+],a ENDR IF (SOUNDSYSTEM_ENABLE_VUM) ; clear all vu meter values ld hl,wVUMeter1 REPT 4 ld [hl+],a ENDR ENDC ; enable sound ld a,AUD3ENA_ON ldh [rAUDENA],a ; channel 1 xor a ldh [rAUD1SWEEP],a ; all channels off call Music_Pause ; general ld a,(AUDVOL_VIN_LEFT|AUDVOL_VIN_RIGHT) ^ $FF ; same as ~(), but ~ here triggers a false warning ldh [rAUDVOL],a ld a,AUDTERM_ALL ldh [rAUDTERM],a ret ; dummy instrument to init/clear instrument pointers Music_InstrumentEnd: DB MUSIC_INSTCMD_X_END ;*************************************************************************************************************************** ;* SoundSystem_Process ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Process",ROM0 ELSE SECTION "SoundSystem_Process",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SoundSystem_Process:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC IF (SOUNDSYSTEM_ENABLE_SFX) ; sfx start process ld hl,wSoundFXStart ld c,4 .multisfx: ld a,[hl] push hl push bc xor $FF jp z,.nonewsfx ld b,a ; save IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wSoundFXBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wSoundFXBank+1] ld [rROMB1],a ENDC ENDC ; lock & update SFX ld a,b ; restore cpl ; calculate table plus index address ld b,a ;save ld a,[wSoundFXTable] ld e,a ld a,[wSoundFXTable+1] ld d,a ld a,b ;restore ld b,0 add a rl b add a rl b add a ; 4 words rl b add e ld l,a ld a,0 ; can't xor a here becuase of the adc adc d add b ld h,a push hl ld a,[wSoundFXNote] add a ld l,a ld h,HIGH(FrequencyTable) ASSERT LOW(FrequencyTable) == 0 ld a,[hl+] ld [wTemp],a ld a,[hl] ld [wTemp+1],a ; store note freq pop hl ; update wSoundFXLock ld a,[wSoundFXLock] ld d,a ; load channel 1 ld a,[hl+] ld c,a ld a,[hl+] ld b,a or c jr z,.nosfxchnl1 ld a,c ld [wMusicSFXInstPtr1],a ld a,b ld [wMusicSFXInstPtr1+1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wSoundFXBank] ld [wMusicSFXInstBank1],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wSoundFXBank+1] ld [wMusicSFXInstBank1+1],a ENDC ENDC ld a,[wTemp] ld [wChannelFreq1],a ld a,[wTemp+1] ld [wChannelFreq1+1],a ld a,d and ~(SFXLOCKF_1_LEFT|SFXLOCKF_1_RIGHT) ld d,a ld a,1 ; set counter to immediate start ld [wMusicSFXInstPause1],a .nosfxchnl1: ; load channel 2 ld a,[hl+] ld c,a ld a,[hl+] ld b,a or c jr z,.nosfxchnl2 ld a,c ld [wMusicSFXInstPtr2],a ld a,b ld [wMusicSFXInstPtr2+1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wSoundFXBank] ld [wMusicSFXInstBank2],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wSoundFXBank+1] ld [wMusicSFXInstBank2+1],a ENDC ENDC ld a,[wTemp] ld [wChannelFreq2],a ld a,[wTemp+1] ld [wChannelFreq2+1],a ld a,d and ~(SFXLOCKF_2_LEFT|SFXLOCKF_2_RIGHT) ld d,a ld a,1 ; set counter to immediate start ld [wMusicSFXInstPause2],a .nosfxchnl2: ; load channel 3 ld a,[hl+] ld c,a ld a,[hl+] ld b,a or c jr z,.nosfxchnl3 ld a,[wMusicSFXInstChnl3Lock] or a jr nz,.nosfxchnl3 ld a,c ld [wMusicSFXInstPtr3],a ld a,b ld [wMusicSFXInstPtr3+1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wSoundFXBank] ld [wMusicSFXInstBank3],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wSoundFXBank+1] ld [wMusicSFXInstBank3+1],a ENDC ENDC ld a,[wTemp] ld [wChannelFreq3],a ld a,[wTemp+1] ld [wChannelFreq3+1],a ld a,d and ~(SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT) ld d,a ld a,1 ; set counter to immediate start ld [wMusicSFXInstPause3],a .nosfxchnl3: ; load channel 4 ld a,[hl+] ld c,a ld a,[hl+] ld b,a or c jr z,.nosfxchnl4 ld a,c ld [wMusicSFXInstPtr4],a ld a,b ld [wMusicSFXInstPtr4+1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wSoundFXBank] ld [wMusicSFXInstBank4],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wSoundFXBank+1] ld [wMusicSFXInstBank4+1],a ENDC ENDC ld a,d and (SFXLOCKF_4_LEFT|SFXLOCKF_4_RIGHT) ^ $FF ; same as ~(), but ~ here triggers a false warning ld d,a ld a,1 ; set counter to immediate start ld [wMusicSFXInstPause4],a .nosfxchnl4: pop bc pop hl ; update wSoundFXLock ld a,d ld [wSoundFXLock],a ; de-flag sfx start ld a,$FF ld [hl+],a dec c jp nz,.multisfx jr .newsfxdone .nonewsfx: add sp,4 .newsfxdone: ENDC ;------------------------------- ; instruments and SFX process ;------------------------------- ; channel 1 ld hl,wMusicSFXInstPause1 dec [hl] jr nz,SSFP_Inst1UpdateDone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicSFXInstBank1] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicSFXInstBank1+1] ld [rROMB1],a ENDC ENDC ld hl,wMusicSFXInstPtr1 ld a,[hl+] ld d,[hl] ld e,a jp SSFP_Inst1Update SSFP_Inst1UpdateFrameEnd: ; save back ld hl,wMusicSFXInstPtr1 ld a,e ld [hl+],a ld [hl],d SSFP_Inst1UpdateDone: ;------------------------------- ; channel 2 ld hl,wMusicSFXInstPause2 dec [hl] jr nz,SSFP_Inst2UpdateDone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicSFXInstBank2] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicSFXInstBank2+1] ld [rROMB1],a ENDC ENDC ld hl,wMusicSFXInstPtr2 ld a,[hl+] ld d,[hl] ld e,a jp SSFP_Inst2Update SSFP_Inst2UpdateFrameEnd: ; save back ld hl,wMusicSFXInstPtr2 ld a,e ld [hl+],a ld [hl],d SSFP_Inst2UpdateDone: ;------------------------------- ; channel 3 ld hl,wMusicSFXInstPause3 dec [hl] jr nz,SSFP_Inst3UpdateDone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicSFXInstBank3] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicSFXInstBank3+1] ld [rROMB1],a ENDC ENDC ld hl,wMusicSFXInstPtr3 ld a,[hl+] ld d,[hl] ld e,a jp SSFP_Inst3Update SSFP_Inst3UpdateFrameEnd: ; save back ld hl,wMusicSFXInstPtr3 ld a,e ld [hl+],a ld [hl],d SSFP_Inst3UpdateDone: ;------------------------------- ; channel 4 ld hl,wMusicSFXInstPause4 dec [hl] jr nz,SSFP_Inst4UpdateDone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicSFXInstBank4] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicSFXInstBank4+1] ld [rROMB1],a ENDC ENDC ld hl,wMusicSFXInstPtr4 ld a,[hl+] ld d,[hl] ld e,a jp SSFP_Inst4Update SSFP_Inst4UpdateFrameEnd: ; save back ld hl,wMusicSFXInstPtr4 ld a,e ld [hl+],a ld [hl],d SSFP_Inst4UpdateDone: ;------------------------------- ; process music ld a,[wMusicPlayState] or a ; is music playing? ret z ; no, exit early (nothing to do) ;------------------------------- ; update music effects ;------------------------------- ; channel 1 ld a,[wChannelMusicEffect1] or a ; is channel 1 playing music fx? jr z,SSFP_MusicFX_Done1 ; no, skip to the next channel ; check if sound effect active (no music fx then) ld b,a ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL1,a ; is channel 1 playing fx? jr z,SSFP_MusicFX_Done1 ; no, skip to the next channel ; call the fx handler ld a,b ld hl,SSFP_MusicFX_JumpTable1 add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl SSFP_MusicFX_Done1: ; some handlers return here ;------------------------------- ; channel 2 ld a,[wChannelMusicEffect2] or a ; is channel 2 playing music fx? jr z,SSFP_MusicFX_Done2 ; no, skip to the next channel ; check if sound effect active (no music fx then) ld b,a ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL2,a ; is channel 2 playing fx? jr z,SSFP_MusicFX_Done2 ; no, skip to the next channel ; call the fx handler ld a,b ld hl,SSFP_MusicFX_JumpTable2 add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl SSFP_MusicFX_Done2: ; some handlers return here ;------------------------------- ; channel 3 ld a,[wChannelMusicEffect3] or a ; is channel 3 playing music fx? jr z,SSFP_MusicFX_Done3 ; no, skip to the next channel ; check if sound effect active (no music fx then) ld b,a ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL3,a ; is channel 3 playing fx? jr z,SSFP_MusicFX_Done3 ; no, skip to the next channel ; call the fx handler ld a,b ld hl,SSFP_MusicFX_JumpTable3 add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl SSFP_MusicFX_Done3: ; some handlers return here ;------------------------------- ; update music ; determine if music should update this frame ld a,[wMusicNextFrame] dec a ld [wMusicNextFrame],a ret nz ; no update needed IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicCommandBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicCommandBank+1] ld [rROMB1],a ENDC ENDC ; put the music command handler in de ld hl,wMusicCommandPtr ld a,[hl+] ld e,a ld d,[hl] ;------------------------------- SSFP_MusicUpdate: ; some handlers return here ld a,[de] inc de ld hl,SSFP_Music_JumpTable add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl ;------------------------------- SSFP_MusicUpdateFrameEnd: ; some handlers return here ; update the ptr for next time ld hl,wMusicCommandPtr ld a,e ld [hl+],a ld [hl],d ret ;*************************************************************************************************************************** ;* Music_PrepareInst ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Music_PrepareInst",ROM0 ELSE SECTION "SoundSystem_Music_PrepareInst",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC Music_PrepareInst:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ld hl,wMusicInstrumentTable ld a,e ld [hl+],a ld a,d ld [hl+],a ; hl = wMusicInstrumentBank IF (SOUNDSYSTEM_ROM_BANKING != 0) ASSERT wMusicInstrumentBank == wMusicInstrumentTable+2 ld a,c ld [hl+],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,b ld [hl],a ENDC ENDC ret ;*************************************************************************************************************************** ;* Music_Play ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Music_Play",ROM0 ELSE SECTION "SoundSystem_Music_Play",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC Music_Play:: IF (SOUNDSYSTEM_ROM_BANKING != 0) push bc ENDC call Music_Pause IF (SOUNDSYSTEM_ROM_BANKING != 0) pop bc ENDC IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change to the rom bank containting the order list ld a,c ld [wMusicOrderBank],a ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,b ld [wMusicOrderBank+1],a ld [rROMB1],a ENDC ENDC ; set to advance on next frame ld a,1 ld [wMusicNextFrame],a ; clear misc variables xor a ld [wMusicSyncData],a ; clear effects ld hl,wChannelMusicEffect1 ld [hl+],a ld [hl+],a ld [hl+],a ld [hl],a ; set command pointer to value of first order ld h,d ld l,e ld a,[hl+] ld [wMusicCommandPtr],a ld a,[hl+] ld [wMusicCommandPtr+1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ld a,[hl+] ld [wMusicCommandBank],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[hl] ld [wMusicCommandBank+1],a ENDC ENDC ; set order pointer to next order ld a,e add 4 ld [wMusicOrderPtr],a ld a,d adc 0 ld [wMusicOrderPtr+1],a ; turn on the music ld a,MUSIC_STATE_PLAYING ld [wMusicPlayState],a ret ;*************************************************************************************************************************** ;* Music_Pause ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Music_Pause",ROM0 ELSE SECTION "SoundSystem_Music_Pause",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC Music_Pause:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ; stop playing xor a ld [wMusicPlayState],a ; turn off channels used by music ld a,[wSoundFXLock] ld b,a ld c,AUDHIGH_RESTART ;------------------------------- ; channel 1 bit SFXLOCKB_CHANNEL1,b ; is channel 1 playing music? jr z,.nomusic1 ; no, skip to the next channel ; clear the channel 1 registers xor a ldh [rAUD1ENV],a ld a,c ldh [rAUD1HIGH],a ; set the stop command ld hl,wMusicSFXInstPtr1 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nomusic1: ;------------------------------- ; channel 2 bit SFXLOCKB_CHANNEL2,b ; is channel 2 playing music? jr z,.nomusic2 ; no, skip to the next channel ; clear the channel 2 registers xor a ldh [rAUD2ENV],a ld a,c ldh [rAUD2HIGH],a ; set the stop command ld hl,wMusicSFXInstPtr2 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nomusic2: ;------------------------------- ; channel 3 bit SFXLOCKB_CHANNEL3,b ; is channel 3 playing music? jr z,.nomusic3 ; no, skip to the next channel ; clear the channel 3 registers xor a ldh [rAUD3ENA],a ; set the stop command ld hl,wMusicSFXInstPtr3 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nomusic3: ;------------------------------- ; channel 4 bit SFXLOCKB_CHANNEL4,b ; is channel 4 playing music? ret z ; no, exit ; clear the channel 4 registers xor a ldh [rAUD4ENV],a ld a,c ldh [rAUD4GO],a ; set the stop command ld hl,wMusicSFXInstPtr4 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) ret ;*************************************************************************************************************************** ;* Music_Resume ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Music_Resume",ROM0 ELSE SECTION "SoundSystem_Music_Resume",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC Music_Resume:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ld a,MUSIC_STATE_PLAYING ld [wMusicPlayState],a ret ;*************************************************************************************************************************** ;* SFX_Prepare ;*************************************************************************************************************************** IF (SOUNDSYSTEM_ENABLE_SFX) IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SFX_Prepare",ROM0 ELSE SECTION "SoundSystem_SFX_Prepare",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SFX_Prepare:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ld hl,wSoundFXTable ld a,e ld [hl+],a ld a,d ld [hl+],a ; hl = wSoundFXBank here IF (SOUNDSYSTEM_ROM_BANKING != 0) ASSERT wSoundFXBank == wSoundFXTable+2 ld a,c ld [hl+],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,b ld [hl],a ENDC ENDC ret ENDC ;*************************************************************************************************************************** ;* SFX_Play ;*************************************************************************************************************************** IF (SOUNDSYSTEM_ENABLE_SFX) IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SFX_Play",ROM0 ELSE SECTION "SoundSystem_SFX_Play",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SFX_Play:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ; find an open channel, else put it on channel 4 ld hl,wSoundFXStart ld d,4 .loop: ld a,[hl] xor $FF ; is this channel open? jr z,.found ; yes, store the sfx data inc hl dec d jr nz,.loop .found: ld a,b ld [hl],a ld a,c ld [wSoundFXNote],a ret ENDC ;*************************************************************************************************************************** ;* SFX_Stop ;*************************************************************************************************************************** IF (SOUNDSYSTEM_ENABLE_SFX) IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SFX_Stop",ROM0 ELSE SECTION "SoundSystem_SFX_Stop",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SFX_Stop:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ; turn off channels used by sfx ld a,[wSoundFXLock] ld b,a ld c,AUDHIGH_RESTART ; channel 1 bit SFXLOCKB_CHANNEL1,b ; is channel 1 playing sfx? jr nz,.nosfx1 ; no, skip to the next channel xor a ld [rAUD1ENV],a ld a,c ld [rAUD1HIGH],a ld hl,wMusicSFXInstPtr1 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nosfx1: ; channel 2 bit SFXLOCKB_CHANNEL2,b ; is channel 2 playing sfx? jr nz,.nosfx2 ; no, skip to the next channel xor a ld [rAUD2ENV],a ld a,c ld [rAUD2HIGH],a ld hl,wMusicSFXInstPtr2 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nosfx2: ; channel 3 bit SFXLOCKB_CHANNEL3,b ; is channel 3 playing sfx? jr nz,.nosfx3 ; no, skip to the next channel ld a,[wMusicSFXInstChnl3Lock] or a jr nz,.nosfx3 ld [rAUD3ENA],a ; a = 0 here ld hl,wMusicSFXInstPtr3 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nosfx3: ; channel 4 bit SFXLOCKB_CHANNEL4,b ; is channel 4 playing sfx? ret nz ; no, exit xor a ld [rAUD4ENV],a ld a,c ld [rAUD4GO],a ld hl,wMusicSFXInstPtr4 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) ret ENDC ;*************************************************************************************************************************** ;* SFX_LockChannel3 ;*************************************************************************************************************************** IF (SOUNDSYSTEM_ENABLE_SFX) IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SFX_LockChannel3",ROM0 ELSE SECTION "SoundSystem_SFX_LockChannel3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SFX_LockChannel3:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ld a,1 ld [wMusicSFXInstChnl3Lock],a ld a,[wSoundFXLock] and ~(SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT) ld [wSoundFXLock],a ld hl,wMusicSFXInstPtr1 ld a,LOW(Music_InstrumentEnd) ld [hl+],a ld a,HIGH(Music_InstrumentEnd) ld [hl],a ret ENDC ;*************************************************************************************************************************** ;* SFX_UnlockChannel3 ;*************************************************************************************************************************** IF (SOUNDSYSTEM_ENABLE_SFX) IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SFX_UnlockChannel3",ROM0 ELSE SECTION "SoundSystem_SFX_UnlockChannel3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SFX_UnlockChannel3:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC xor a ld [wMusicSFXInstChnl3Lock],a ld a,[wSoundFXLock] or SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT ld [wSoundFXLock],a ret ENDC ;*************************************************************************************************************************** ;* music fx handlers ;*************************************************************************************************************************** ; channel 1 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_VIB1: ld hl,wChannelFreq1 ld a,[hl] add 1 ; can't use inc a here because of the adc ld [hl+],a ldh [rAUD1LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD1HIGH],a ld hl,wChannelMusicFXParamA1+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done1 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB2 ld [wChannelMusicEffect1],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_VIB2: ld hl,wChannelFreq1 ld a,[hl] add $FF ; can't use dec a here because of the adc ld [hl+],a ldh [rAUD1LOW],a ld a,[hl] adc $FF and $07 ld [hl],a ldh [rAUD1HIGH],a ld hl,wChannelMusicFXParamA1+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done1 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB1 ld [wChannelMusicEffect1],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_TF1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_TF1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_TF1: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote1] ld c,a ld a,[wChannelMusicFXParamA1] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD1LOW],a ld a,[hl] ldh [rAUD1HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ2 ld [wChannelMusicEffect1],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_TF2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_TF2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_TF2: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote1] ld c,a ld a,[wChannelMusicFXParamA1+1] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD1LOW],a ld a,[hl] ldh [rAUD1HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ3 ld [wChannelMusicEffect1],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_TF3",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_TF3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_TF3: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote1] add a ld l,a ld a,[hl+] ldh [rAUD1LOW],a ld a,[hl] ldh [rAUD1HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ1 ld [wChannelMusicEffect1],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHUP",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHUP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_PITCHUP: ld hl,wChannelMusicFXParamA1 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done1 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB1 ld b,[hl] ld hl,wChannelFreq1 ld a,[hl] add b ld [hl+],a ldh [rAUD1LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD1HIGH],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHDOWN",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHDOWN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_PITCHDOWN: ld hl,wChannelMusicFXParamA1 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done1 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB1 ld b,[hl] ld hl,wChannelFreq1 ld a,[hl] sub b ld [hl+],a ldh [rAUD1LOW],a ld a,[hl] sbc 0 and $07 ld [hl],a ldh [rAUD1HIGH],a jp SSFP_MusicFX_Done1 ; ========================================================================================================================== ; channel 2 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_VIB1: ld hl,wChannelFreq2 ld a,[hl] add 1 ; can't use inc a here because of the adc ld [hl+],a ldh [rAUD2LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD2HIGH],a ld hl,wChannelMusicFXParamA2+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done2 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB2 ld [wChannelMusicEffect2],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_VIB2: ld hl,wChannelFreq2 ld a,[hl] add $FF ; can't use dec a here because of the adc ld [hl+],a ldh [rAUD2LOW],a ld a,[hl] adc $FF and $07 ld [hl],a ldh [rAUD2HIGH],a ld hl,wChannelMusicFXParamA2+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done2 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB1 ld [wChannelMusicEffect2],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_TF1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_TF1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_TF1: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote2] ld c,a ld a,[wChannelMusicFXParamA2] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD2LOW],a ld a,[hl] ldh [rAUD2HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ2 ld [wChannelMusicEffect2],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_TF2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_TF2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_TF2: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote2] ld c,a ld a,[wChannelMusicFXParamA2+1] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD2LOW],a ld a,[hl] ldh [rAUD2HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ3 ld [wChannelMusicEffect2],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_TF3",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_TF3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_TF3: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote2] add a ld l,a ld a,[hl+] ldh [rAUD2LOW],a ld a,[hl] ldh [rAUD2HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ1 ld [wChannelMusicEffect2],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHUP",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHUP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_PITCHUP: ld hl,wChannelMusicFXParamA2 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done2 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB2 ld b,[hl] ld hl,wChannelFreq2 ld a,[hl] add b ld [hl+],a ldh [rAUD2LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD2HIGH],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHDOWN",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHDOWN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_PITCHDOWN: ld hl,wChannelMusicFXParamA2 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done2 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB2 ld b,[hl] ld hl,wChannelFreq2 ld a,[hl] sub b ld [hl+],a ldh [rAUD2LOW],a ld a,[hl] sbc 0 and $07 ld [hl],a ldh [rAUD2HIGH],a jp SSFP_MusicFX_Done2 ; ========================================================================================================================== ; channel 3 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_VIB1: ld hl,wChannelFreq3 ld a,[hl] add 1 ; can't use inc a here because of the adc ld [hl+],a ldh [rAUD3LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD3HIGH],a ld hl,wChannelMusicFXParamA3+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done3 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB2 ld [wChannelMusicEffect3],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_VIB2: ld hl,wChannelFreq3 ld a,[hl] add $FF ; can't use dec a here because of the adc ld [hl+],a ldh [rAUD3LOW],a ld a,[hl] adc $FF and $07 ld [hl],a ldh [rAUD3HIGH],a ld hl,wChannelMusicFXParamA3+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done3 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB1 ld [wChannelMusicEffect3],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_TF1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_TF1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_TF1: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote3] ld c,a ld a,[wChannelMusicFXParamA3] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD3LOW],a ld a,[hl] ldh [rAUD3HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ2 ld [wChannelMusicEffect3],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_TF2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_TF2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_TF2: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote3] ld c,a ld a,[wChannelMusicFXParamA3+1] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD3LOW],a ld a,[hl] ldh [rAUD3HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ3 ld [wChannelMusicEffect3],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_TF3",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_TF3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_TF3: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote3] add a ld l,a ld a,[hl+] ldh [rAUD3LOW],a ld a,[hl] ldh [rAUD3HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ1 ld [wChannelMusicEffect3],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHUP",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHUP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_PITCHUP: ld hl,wChannelMusicFXParamA3 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done3 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB3 ld b,[hl] ld hl,wChannelFreq3 ld a,[hl] add b ld [hl+],a ldh [rAUD3LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD3HIGH],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHDOWN",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHDOWN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_PITCHDOWN: ld hl,wChannelMusicFXParamA3 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done3 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB3 ld b,[hl] ld hl,wChannelFreq3 ld a,[hl] sub b ld [hl+],a ldh [rAUD3LOW],a ld a,[hl] sbc 0 and $07 ld [hl],a ldh [rAUD3HIGH],a jp SSFP_MusicFX_Done3 ;*************************************************************************************************************************** ;* music command handlers ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFFRAME: ld a,[de] inc de ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_PLAYINST/NOTE",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_PLAYINST/NOTE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_PLAYINSTNOTE: ld a,[de] inc de ld l,a ld a,[de] and $03 ld b,HIGH(wChannelMusicNote1) add LOW(wChannelMusicNote1) ld c,a ld a,l ld [bc],a ld a,l add a ld l,a ld h,HIGH(FrequencyTable) ASSERT LOW(FrequencyTable) == 0 ld b,HIGH(wChannelMusicFreq1) ld a,[de] and $03 add a add LOW(wChannelMusicFreq1) ld c,a ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a ; store note freq ; fall-through ; -------------------------------------------------------------------------------------------------------------------------- SSFP_MUSIC_CMD_PLAYINST: ld a,[de] inc de ld b,a ;save and $FC srl a ld c,a ld hl,wMusicInstrumentTable ld a,[hl+] add c ld c,a ld a,[hl] adc 0 ld h,a ld l,c ; check for lock ld a,[wSoundFXLock] ld c,a ld a,b ;restore and $03 jp z,.playchannel1 dec a jr z,.playchannel2 dec a jr z,.playchannel3 .playchannel4: bit SFXLOCKB_CHANNEL4,c jp z,.channeldone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicInstrumentBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [rROMB1],a ENDC ENDC ld a,[hl+] ld [wMusicSFXInstPtr4],a ld a,[hl] ld [wMusicSFXInstPtr4+1],a ld a,1 ld [wMusicSFXInstPause4],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wMusicInstrumentBank] ld [wMusicSFXInstBank4],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [wMusicSFXInstBank4+1],a ENDC ENDC ld hl,wChannelMusicFreq4 ld bc,wChannelFreq4 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jr .channeldone .playchannel2: bit SFXLOCKB_CHANNEL2,c jr z,.channeldone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicInstrumentBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [rROMB1],a ENDC ENDC ld a,[hl+] ld [wMusicSFXInstPtr2],a ld a,[hl] ld [wMusicSFXInstPtr2+1],a ld a,1 ld [wMusicSFXInstPause2],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wMusicInstrumentBank] ld [wMusicSFXInstBank2],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [wMusicSFXInstBank2+1],a ENDC ENDC ld hl,wChannelMusicFreq2 ld bc,wChannelFreq2 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jr .channeldone .playchannel3: bit SFXLOCKB_CHANNEL3,c jr z,.channeldone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicInstrumentBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [rROMB1],a ENDC ENDC ld a,[hl+] ld [wMusicSFXInstPtr3],a ld a,[hl] ld [wMusicSFXInstPtr3+1],a ld a,1 ld [wMusicSFXInstPause3],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wMusicInstrumentBank] ld [wMusicSFXInstBank3],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [wMusicSFXInstBank3+1],a ENDC ENDC ld hl,wChannelMusicFreq3 ld bc,wChannelFreq3 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jr .channeldone .playchannel1: bit SFXLOCKB_CHANNEL1,c jr z,.channeldone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicInstrumentBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [rROMB1],a ENDC ENDC ld a,[hl+] ld [wMusicSFXInstPtr1],a ld a,[hl] ld [wMusicSFXInstPtr1+1],a ld a,1 ld [wMusicSFXInstPause1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wMusicInstrumentBank] ld [wMusicSFXInstBank1],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [wMusicSFXInstBank1+1],a ENDC ENDC ld hl,wChannelMusicFreq1 ld bc,wChannelFreq1 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a .channeldone: IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicCommandBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicCommandBank+1] ld [rROMB1],a ENDC ENDC jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_SETVOLUME",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_SETVOLUME",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_SETVOLUME: ld a,[de] inc de ld c,a and $03 add LOW(wChannelVol1) ld l,a ld a,HIGH(wChannelVol1) adc 0 ld h,a ld a,c and $F0 ld [hl],a jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_VIBRATO_ON",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_VIBRATO_ON",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_VIBRATO_ON: ld a,[de] ld c,a and $03 add LOW(wChannelMusicEffect1) ld h,HIGH(wChannelMusicEffect1) ld l,a ld [hl],MUSIC_FX_VIB1 sub LOW(wChannelMusicEffect1) add a add LOW(wChannelMusicFXParamA1) ld c,a ld b,HIGH(wChannelMusicFXParamA1) ld a,[de] swap a and $0F ld [bc],a ; store max inc bc ld l,a and $01 srl l or l ld [bc],a ; store max inc de jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_EFFECT_OFF",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_EFFECT_OFF",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_EFFECT_OFF: ld a,[de] inc de add LOW(wChannelMusicEffect1) ld h,HIGH(wChannelMusicEffect1) ld l,a ld [hl],MUSIC_FX_NONE jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_SYNCFLAG",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_SYNCFLAG",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_SYNCFLAG: ld a,[de] inc de ld [wMusicSyncData],a jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFPATTERN",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFPATTERN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFPATTERN: IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicOrderBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicOrderBank+1] ld [rROMB1],a ENDC ENDC ld hl,wMusicOrderPtr ld a,[hl+] ld h,[hl] ld l,a add 4 ld [wMusicOrderPtr],a ld a,h adc 0 ld [wMusicOrderPtr+1],a ld a,[hl+] ld e,a ld a,[hl+] ld d,a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change and update the rom bank ld a,[hl+] ld [wMusicCommandBank],a ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[hl] ld [wMusicCommandBank+1],a ld [rROMB1],a ENDC ENDC ld a,1 ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_GOTOORDER",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_GOTOORDER",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_GOTOORDER: ld a,[wMusicOrderPtr] ld c,a ld a,[wMusicOrderPtr+1] ld b,a ld a,[de] inc de ld l,a ld a,[de] inc de ld h,a add hl,bc ld a,h ld [wMusicOrderPtr+1],a ld a,l ld [wMusicOrderPtr],a jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFSONG",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFSONG",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFSONG: xor a ld [wMusicPlayState],a dec de jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_SETSPEED",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_SETSPEED",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_SETSPEED: ld a,[de] inc de ld [wMusicSpeed],a jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME1X",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME1X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFFRAME1X: ld a,[wMusicSpeed] ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME2X",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME2X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFFRAME2X: ld a,[wMusicSpeed] add a ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME3X",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME3X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFFRAME3X: ld a,[wMusicSpeed] ld c,a add a add c ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME4X",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME4X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFFRAME4X: ld a,[wMusicSpeed] add a add a ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_PITCHUPDOWN_ON",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_PITCHUPDOWN_ON",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_PITCHUP_ON: ld a,[de] and $03 add LOW(wChannelMusicEffect1) ld h,HIGH(wChannelMusicEffect1) ld l,a ld [hl],MUSIC_FX_PITCHUP jr SSFP_MUSIC_CMD_PITCHUP_reuse SSFP_MUSIC_CMD_PITCHDOWN_ON: ld a,[de] and $03 add LOW(wChannelMusicEffect1) ld h,HIGH(wChannelMusicEffect1) ld l,a ld [hl],MUSIC_FX_PITCHDOWN SSFP_MUSIC_CMD_PITCHUP_reuse: sub LOW(wChannelMusicEffect1) add a add LOW(wChannelMusicFXParamA1) ld c,a ld b,HIGH(wChannelMusicFXParamA1) ld a,[de] swap a and $0F ld [bc],a ; store max inc c ld [bc],a ; store max ld a,7 add c ld c,a ld a,[de] srl a srl a and $03 inc a ld [bc],a inc de jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_TRIPLENOTE_ON",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_TRIPLENOTE_ON",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_TRIPLENOTE_ON: ld a,[de] inc de ; note ld l,a ld b,HIGH(wChannelMusicFXParamA1) ld a,[de] and $03 add a add LOW(wChannelMusicFXParamA1) ld c,a ld a,l swap a and $0F ld [bc],a inc c ld a,l and $0F ld [bc],a ; store note freq ld a,[de] inc de ld c,a and $03 add LOW(wChannelMusicEffect1) ld h,HIGH(wChannelMusicEffect1) ld l,a ld [hl],MUSIC_FX_TRIPLEFREQ1 jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_EXTRA",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_EXTRA",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_EXTRA: ld a,[de] inc de ld c,a and $03 jr z,SSFP_MUSIC_CMD_EXTRA_chnl1 dec a jr z,SSFP_MUSIC_CMD_EXTRA_chnl2 dec a jr z,SSFP_MUSIC_CMD_EXTRA_chnl3 ; chnl 4 jp SSFP_MusicUpdate SSFP_MUSIC_CMD_EXTRA_chnl1: ld a,c and $FC ldh [rAUD1LEN],a jp SSFP_MusicUpdate SSFP_MUSIC_CMD_EXTRA_chnl2: ld a,c and $FC ldh [rAUD2LEN],a jp SSFP_MusicUpdate SSFP_MUSIC_CMD_EXTRA_chnl3: ld a,[wMusicSFXInstChnl3Lock] or a jp nz,SSFP_MusicUpdate ld a,c and $FC ldh [rAUD3LEVEL],a jp SSFP_MusicUpdate ;*************************************************************************************************************************** ;* instrument command handlers ;*************************************************************************************************************************** ; channel 1 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1Update",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1Update: ld a,[de] inc de ld hl,SSFP_Inst1_JumpTable add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_FRAMEEND",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_FRAMEEND: ld a,[de] inc de ld [wMusicSFXInstPause1],a ; load new pause jp SSFP_Inst1UpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_START",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_START: ld a,[wChannelFreq1] ldh [rAUD1LOW],a ld a,[de] inc de ld hl,wChannelFreq1+1 or [hl] ldh [rAUD1HIGH],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_END",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_END: dec de ; rewind counter ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL1,a jp nz,SSFP_Inst1UpdateFrameEnd or SFXLOCKF_1_LEFT|SFXLOCKF_1_RIGHT ld [wSoundFXLock],a ; restore music freq ld hl,wChannelMusicFreq1 ld bc,wChannelFreq1 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jp SSFP_Inst1UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait) ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPE",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_ENVELOPE: ld a,[de] inc de ld hl,wChannelVol1 or [hl] ldh [rAUD1ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter1],a ENDC jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_STARTFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_STARTFREQ: ld a,[de] inc de ldh [rAUD1LOW],a ld a,[de] inc de ldh [rAUD1HIGH],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPEVOL",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_ENVELOPEVOL: ld a,[de] inc de ldh [rAUD1ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter1],a ENDC jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_STARTENVVOLFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_STARTENVVOLFREQ: ld a,[de] inc de ldh [rAUD1ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter1],a ENDC ld a,[de] inc de ldh [rAUD1LOW],a ld a,[de] inc de ldh [rAUD1HIGH],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_PANMID",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_PANMID: ld hl,wMusicSFXPanning ld a,AUDTERM_1_LEFT|AUDTERM_1_RIGHT or [hl] ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_PANRIGHT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_PANRIGHT: ld hl,wMusicSFXPanning ld a,AUDTERM_1_RIGHT or [hl] and ~AUDTERM_1_LEFT ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_PANLEFT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_PANLEFT: ld hl,wMusicSFXPanning ld a,AUDTERM_1_LEFT or [hl] and ~AUDTERM_1_RIGHT ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_PULSELEN",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_PULSELEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_PULSELEN: ld a,[de] inc de ldh [rAUD1LEN],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_SWEEP",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_SWEEP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_SWEEP: ld a,[de] inc de ldh [rAUD1SWEEP],a jp SSFP_Inst1Update ; ========================================================================================================================== ; channel 2 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2Update",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2Update: ld a,[de] inc de ld hl,SSFP_Inst2_JumpTable add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_FRAMEEND",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_FRAMEEND: ld a,[de] inc de ld [wMusicSFXInstPause2],a ; load new pause jp SSFP_Inst2UpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_START",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_START: ld a,[wChannelFreq2] ldh [rAUD2LOW],a ld a,[de] inc de ld hl,wChannelFreq2+1 or [hl] ldh [rAUD2HIGH],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_END",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_END: dec de ; rewind counter ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL2,a jp nz,SSFP_Inst2UpdateFrameEnd or SFXLOCKF_2_LEFT|SFXLOCKF_2_RIGHT ld [wSoundFXLock],a ; restore music freq ld hl,wChannelMusicFreq2 ld bc,wChannelFreq2 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jp SSFP_Inst2UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait) ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPE",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_ENVELOPE: ld a,[de] inc de ld hl,wChannelVol2 or [hl] ldh [rAUD2ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter2],a ENDC jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_STARTFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_STARTFREQ: ld a,[de] inc de ldh [rAUD2LOW],a ld a,[de] inc de ldh [rAUD2HIGH],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPEVOL",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_ENVELOPEVOL: ld a,[de] inc de ldh [rAUD2ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter2],a ENDC jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_STARTENVVOLFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_STARTENVVOLFREQ: ld a,[de] inc de ldh [rAUD2ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter2],a ENDC ld a,[de] inc de ldh [rAUD2LOW],a ld a,[de] inc de ldh [rAUD2HIGH],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_PANMID",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_PANMID: ld hl,wMusicSFXPanning ld a,AUDTERM_2_LEFT|AUDTERM_2_RIGHT or [hl] ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_PANRIGHT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_PANRIGHT: ld hl,wMusicSFXPanning ld a,AUDTERM_2_RIGHT or [hl] and ~AUDTERM_2_LEFT ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_PANLEFT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_PANLEFT: ld hl,wMusicSFXPanning ld a,AUDTERM_2_LEFT or [hl] and ~AUDTERM_2_RIGHT ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_PULSELEN",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_PULSELEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_PULSELEN: ld a,[de] inc de ldh [rAUD2LEN],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_SWEEP",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_SWEEP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_SWEEP: inc de ; ignore jp SSFP_Inst2Update ; ========================================================================================================================== ; channel 3 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3Update",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3Update: ld a,[de] inc de ld hl,SSFP_Inst3_JumpTable add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_FRAMEEND",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_FRAMEEND: ld a,[de] inc de ld [wMusicSFXInstPause3],a ; load new pause jp SSFP_Inst3UpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_START",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_START: ld a,[wChannelFreq3] ldh [rAUD3LOW],a ld a,AUD3ENA_ON ldh [rAUD3ENA],a ld a,[de] inc de ld hl,wChannelFreq3+1 or [hl] ldh [rAUD3HIGH],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_END",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_END: dec de ; rewind counter xor a ldh [rAUD3ENA],a IF (SOUNDSYSTEM_ENABLE_VUM) ld [wVUMeter3],a ENDC ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL3,a jp nz,SSFP_Inst3UpdateFrameEnd or SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT ld [wSoundFXLock],a ; restore music freq ld hl,wChannelMusicFreq3 ld bc,wChannelFreq3 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jp SSFP_Inst3UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait) ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPE",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_ENVELOPE: ld a,[de] inc de ld hl,wChannelVol3 or [hl] ldh [rAUD3LEVEL],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a sla a and $0C dec a xor $0C ld [wVUMeter3],a ENDC jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_STARTFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_STARTFREQ: ld a,[de] inc de ldh [rAUD3LOW],a ld a,AUD3ENA_ON ldh [rAUD3ENA],a ld a,[de] inc de ldh [rAUD3HIGH],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPEVOL",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_ENVELOPEVOL: ld a,[de] inc de ldh [rAUD3LEVEL],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a sla a and $0C dec a xor $0C ld [wVUMeter3],a ENDC jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_STARTENVVOLFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_STARTENVVOLFREQ: ld a,[de] inc de ldh [rAUD3LEVEL],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a sla a and $0C dec a xor $0C ld [wVUMeter3],a ENDC ld a,[de] inc de ldh [rAUD3LOW],a ld a,AUD3ENA_ON ldh [rAUD3ENA],a ld a,[de] inc de ldh [rAUD3HIGH],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_PANMID",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_PANMID: ld hl,wMusicSFXPanning ld a,AUDTERM_3_LEFT|AUDTERM_3_RIGHT or [hl] ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_PANRIGHT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_PANRIGHT: ld hl,wMusicSFXPanning ld a,AUDTERM_3_RIGHT or [hl] and ~AUDTERM_3_LEFT ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_PANLEFT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_PANLEFT: ld hl,wMusicSFXPanning ld a,AUDTERM_3_LEFT or [hl] and ~AUDTERM_3_RIGHT ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_WAVE",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_WAVE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_WAVE: ld hl,wMusicSFXInstChnl3WaveID ld a,[de] inc de cp 255 jr z,.loadlong cp [hl] jr z,.skip .loadlong: ld hl,_AUD3WAVERAM xor a ldh [rAUD3ENA],a REPT 16 ld a,[de] inc de ld [hl+],a ENDR jp SSFP_Inst3Update .skip: ld a,e add 16 ld e,a ld a,d adc 0 ld d,a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_LEN",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_LEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_LEN: ld a,[de] inc de ldh [rAUD3LEN],a jp SSFP_Inst3Update ; ========================================================================================================================== ; channel 4 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4Update",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4Update: ld a,[de] inc de ld hl,SSFP_Inst4_JumpTable add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_FRAMEEND",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_FRAMEEND: ld a,[de] inc de ld [wMusicSFXInstPause4],a ; load new pause jp SSFP_Inst4UpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_START",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_START: ld a,[de] inc de ldh [rAUD4GO],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_END",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_END: dec de ; rewind counter ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL4,a jp nz,SSFP_Inst4UpdateFrameEnd or SFXLOCKF_4_LEFT|SFXLOCKF_4_RIGHT ld [wSoundFXLock],a ; restore music freq ld hl,wChannelMusicFreq4 ld bc,wChannelFreq4 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jp SSFP_Inst4UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait) ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPE",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_ENVELOPE: ld a,[de] inc de ld hl,wChannelVol4 or [hl] ldh [rAUD4ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter4],a ENDC jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_STARTFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_STARTFREQ: ld a,[de] inc de ldh [rAUD4POLY],a ld a,[de] inc de ldh [rAUD4GO],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPEVOL",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_ENVELOPEVOL: ld a,[de] inc de ldh [rAUD4ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter4],a ENDC jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_STARTENVVOLFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_STARTENVVOLFREQ: ld a,[de] inc de ldh [rAUD4ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter4],a ENDC ld a,[de] inc de ldh [rAUD4POLY],a ld a,[de] inc de ldh [rAUD4GO],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_PANMID",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_PANMID: ld hl,wMusicSFXPanning ld a,AUDTERM_4_LEFT|AUDTERM_4_RIGHT or [hl] ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_PANRIGHT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_PANRIGHT: ld hl,wMusicSFXPanning ld a,AUDTERM_4_RIGHT or [hl] and AUDTERM_4_LEFT ^ $FF ; same as ~, but ~ here triggers a false warning ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_PANLEFT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_PANLEFT: ld hl,wMusicSFXPanning ld a,AUDTERM_4_LEFT or [hl] and ~AUDTERM_4_RIGHT ld [hl],a ldh [rAUDTERM],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_POLYLOAD",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_POLYLOAD",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_POLYLOAD: ld a,[de] inc de ldh [rAUD4POLY],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_LEN",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_LEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_LEN: ld a,[de] inc de ldh [rAUD4LEN],a jp SSFP_Inst4Update ;*************************************************************************************************************************** ;* tables of fx/command handlers ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Music FX Table 1",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Music FX Table 1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_MusicFX_JumpTable1: DW $0000 ; dummy DW SSFP_MUSIC_FX1_VIB1 DW SSFP_MUSIC_FX1_VIB2 DW SSFP_MUSIC_FX1_TF1 DW SSFP_MUSIC_FX1_TF2 DW SSFP_MUSIC_FX1_TF3 DW SSFP_MUSIC_FX1_PITCHUP DW SSFP_MUSIC_FX1_PITCHDOWN ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Music FX Table 2",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Music FX Table 2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_MusicFX_JumpTable2: DW $0000 ; dummy DW SSFP_MUSIC_FX2_VIB1 DW SSFP_MUSIC_FX2_VIB2 DW SSFP_MUSIC_FX2_TF1 DW SSFP_MUSIC_FX2_TF2 DW SSFP_MUSIC_FX2_TF3 DW SSFP_MUSIC_FX2_PITCHUP DW SSFP_MUSIC_FX2_PITCHDOWN ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Music FX Table 3",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Music FX Table 3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_MusicFX_JumpTable3: DW $0000 ; dummy DW SSFP_MUSIC_FX3_VIB1 DW SSFP_MUSIC_FX3_VIB2 DW SSFP_MUSIC_FX3_TF1 DW SSFP_MUSIC_FX3_TF2 DW SSFP_MUSIC_FX3_TF3 DW SSFP_MUSIC_FX3_PITCHUP DW SSFP_MUSIC_FX3_PITCHDOWN ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Music Table",ROM0,ALIGN[6] ELSE SECTION "SoundSystem Music Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[6] ENDC SSFP_Music_JumpTable: DW SSFP_MUSIC_CMD_ENDOFFRAME DW SSFP_MUSIC_CMD_PLAYINSTNOTE DW SSFP_MUSIC_CMD_PLAYINST DW SSFP_MUSIC_CMD_SETVOLUME DW SSFP_MUSIC_CMD_VIBRATO_ON DW SSFP_MUSIC_CMD_EFFECT_OFF DW SSFP_MUSIC_CMD_SYNCFLAG DW SSFP_MUSIC_CMD_ENDOFPATTERN DW SSFP_MUSIC_CMD_GOTOORDER DW SSFP_MUSIC_CMD_ENDOFSONG DW SSFP_MUSIC_CMD_SETSPEED DW SSFP_MUSIC_CMD_ENDOFFRAME1X DW SSFP_MUSIC_CMD_ENDOFFRAME2X DW SSFP_MUSIC_CMD_ENDOFFRAME3X DW SSFP_MUSIC_CMD_ENDOFFRAME4X DW SSFP_MUSIC_CMD_PITCHUP_ON DW SSFP_MUSIC_CMD_PITCHDOWN_ON DW SSFP_MUSIC_CMD_TRIPLENOTE_ON DW SSFP_MUSIC_CMD_EXTRA ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Inst1 Table",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Inst1 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_Inst1_JumpTable: ; common commands DW SSFP_Inst1_CMD_FRAMEEND DW SSFP_Inst1_CMD_START DW SSFP_Inst1_CMD_END DW SSFP_Inst1_CMD_ENVELOPE DW SSFP_Inst1_CMD_STARTFREQ DW SSFP_Inst1_CMD_ENVELOPEVOL DW SSFP_Inst1_CMD_STARTENVVOLFREQ DW SSFP_Inst1_CMD_PANMID DW SSFP_Inst1_CMD_PANRIGHT DW SSFP_Inst1_CMD_PANLEFT ; specific commands DW SSFP_Inst1_CMD_PULSELEN DW SSFP_Inst1_CMD_SWEEP ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Inst2 Table",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Inst2 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_Inst2_JumpTable: ; common commands DW SSFP_Inst2_CMD_FRAMEEND DW SSFP_Inst2_CMD_START DW SSFP_Inst2_CMD_END DW SSFP_Inst2_CMD_ENVELOPE DW SSFP_Inst2_CMD_STARTFREQ DW SSFP_Inst2_CMD_ENVELOPEVOL DW SSFP_Inst2_CMD_STARTENVVOLFREQ DW SSFP_Inst2_CMD_PANMID DW SSFP_Inst2_CMD_PANRIGHT DW SSFP_Inst2_CMD_PANLEFT ; specific commands DW SSFP_Inst2_CMD_PULSELEN DW SSFP_Inst2_CMD_SWEEP ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Inst3 Table",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Inst3 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_Inst3_JumpTable: ; common commands DW SSFP_Inst3_CMD_FRAMEEND DW SSFP_Inst3_CMD_START DW SSFP_Inst3_CMD_END DW SSFP_Inst3_CMD_ENVELOPEVOL ; prevent crash DW SSFP_Inst3_CMD_STARTFREQ DW SSFP_Inst3_CMD_ENVELOPEVOL DW SSFP_Inst3_CMD_STARTENVVOLFREQ DW SSFP_Inst3_CMD_PANMID DW SSFP_Inst3_CMD_PANRIGHT DW SSFP_Inst3_CMD_PANLEFT ; specific commands DW SSFP_Inst3_CMD_WAVE DW SSFP_Inst3_CMD_LEN ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Inst4 Table",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Inst4 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_Inst4_JumpTable: ; common commands DW SSFP_Inst4_CMD_FRAMEEND DW SSFP_Inst4_CMD_START DW SSFP_Inst4_CMD_END DW SSFP_Inst4_CMD_ENVELOPE DW SSFP_Inst4_CMD_STARTFREQ DW SSFP_Inst4_CMD_ENVELOPEVOL DW SSFP_Inst4_CMD_STARTENVVOLFREQ DW SSFP_Inst4_CMD_PANMID DW SSFP_Inst4_CMD_PANRIGHT DW SSFP_Inst4_CMD_PANLEFT ; specific commands DW SSFP_Inst4_CMD_POLYLOAD DW SSFP_Inst4_CMD_LEN ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Frequency Table",ROM0,ALIGN[8] ELSE SECTION "SoundSystem Frequency Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[8] ENDC FrequencyTable: ; C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B DW $0020,$0091,$00FC,$0160,$01C0,$0219,$026E,$02BE,$030a,$0351,$0394,$03D4 ; octave 2 DW $0410,$0448,$047E,$04B0,$04E0,$050D,$0537,$055F,$0585,$05A8,$05Ca,$05EA ; octave 3 DW $0608,$0624,$063F,$0658,$0670,$0686,$069C,$06B0,$06C2,$06D4,$06E5,$06F5 ; octave 4 DW $0704,$0712,$071F,$072C,$0738,$0743,$074E,$0758,$0761,$076a,$0773,$077A ; octave 5 DW $0782,$0789,$0790,$0796,$079C,$07A2,$07A7,$07AC,$07B1,$07B5,$07B9,$07BD ; octave 6 DW $07C1,$07C5,$07C8,$07CB,$07CE,$07D1,$07D3,$07D6,$07D8,$07DB,$07DD,$07DF ; octave 7
unit_tests/static-tests/common/struct.maxsize3.error.asm
undisbeliever/untech-engine
34
9641
include "../../../src/common/struct.inc" include "../../../src/common/assert.inc" namespace Base { basestruct() struct_maxsize(12) field(a, 5) endstruct() } namespace BaseWithParent { basestruct(Base) field(b, 5) endstruct() } namespace Child { childstruct(BaseWithParent) field(c, 5) // ERROR endstruct() }
oeis/101/A101562.asm
neoneye/loda-programs
11
18678
; A101562: a(n)=(-1)^n*coefficient of x^n in sum{k>=1,x^(k-1)/(1+4x^k)}. ; Submitted by <NAME> ; 1,3,17,67,257,1011,4097,16451,65553,261891,1048577,4195379,16777217,67104771,268435729,1073758275,4294967297,17179804659,68719476737,274878168899,1099511631889,4398045462531,17592186044417,70368748389427 add $0,1 mov $2,$0 lpb $0 div $1,-1 mul $1,4 mov $3,$2 dif $3,$0 sub $0,1 cmp $3,$2 cmp $3,0 add $1,$3 lpe add $1,1 gcd $0,$1
agda-stdlib/src/Data/Rational/Unnormalised.agda
DreamLinuxer/popl21-artifact
5
444
------------------------------------------------------------------------ -- The Agda standard library -- -- Rational numbers in non-reduced form. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Rational.Unnormalised where open import Data.Integer.Base as ℤ using (ℤ; ∣_∣; +_; +0; +[1+_]; -[1+_]) open import Data.Nat as ℕ using (ℕ; zero; suc) open import Level using (0ℓ) open import Relation.Nullary using (¬_) open import Relation.Nullary.Decidable using (False) open import Relation.Binary using (Rel) open import Relation.Binary.PropositionalEquality using (_≡_) ------------------------------------------------------------------------ -- Definition -- Here we define rationals that are not necessarily in reduced form. -- Consequently there are multiple ways of representing a given rational -- number, and the performance of the arithmetic operations may suffer -- due to blowup of the numerator and denominator. -- Nonetheless they are much easier to reason about. In general proofs -- are first proved for these unnormalised rationals and then translated -- into the normalised rationals. record ℚᵘ : Set where constructor mkℚᵘ field numerator : ℤ denominator-1 : ℕ denominatorℕ : ℕ denominatorℕ = suc denominator-1 denominator : ℤ denominator = + denominatorℕ open ℚᵘ public using () renaming ( numerator to ↥_ ; denominator to ↧_ ; denominatorℕ to ↧ₙ_ ) ------------------------------------------------------------------------ -- Equality of rational numbers (does not coincide with _≡_) infix 4 _≃_ data _≃_ : Rel ℚᵘ 0ℓ where *≡* : ∀ {p q} → (↥ p ℤ.* ↧ q) ≡ (↥ q ℤ.* ↧ p) → p ≃ q ------------------------------------------------------------------------ -- Ordering of rationals infix 4 _≤_ _<_ _≥_ _>_ _≰_ _≱_ _≮_ _≯_ data _≤_ : Rel ℚᵘ 0ℓ where *≤* : ∀ {p q} → (↥ p ℤ.* ↧ q) ℤ.≤ (↥ q ℤ.* ↧ p) → p ≤ q data _<_ : Rel ℚᵘ 0ℓ where *<* : ∀ {p q} → (↥ p ℤ.* ↧ q) ℤ.< (↥ q ℤ.* ↧ p) → p < q _≥_ : Rel ℚᵘ 0ℓ x ≥ y = y ≤ x _>_ : Rel ℚᵘ 0ℓ x > y = y < x _≰_ : Rel ℚᵘ 0ℓ x ≰ y = ¬ (x ≤ y) _≱_ : Rel ℚᵘ 0ℓ x ≱ y = ¬ (x ≥ y) _≮_ : Rel ℚᵘ 0ℓ x ≮ y = ¬ (x < y) _≯_ : Rel ℚᵘ 0ℓ x ≯ y = ¬ (x > y) ------------------------------------------------------------------------ -- Constructing rationals infix 4 _≢0 _≢0 : ℕ → Set n ≢0 = False (n ℕ.≟ 0) -- An alternative constructor for ℚᵘ. See the constants section below -- for examples of how to use this operator. infixl 7 _/_ _/_ : (n : ℤ) (d : ℕ) .{d≢0 : d ≢0} → ℚᵘ n / suc d = mkℚᵘ n d ------------------------------------------------------------------------------ -- Operations on rationals infix 8 -_ 1/_ infixl 7 _*_ _÷_ infixl 6 _-_ _+_ -- negation -_ : ℚᵘ → ℚᵘ - mkℚᵘ n d = mkℚᵘ (ℤ.- n) d -- addition _+_ : ℚᵘ → ℚᵘ → ℚᵘ p + q = (↥ p ℤ.* ↧ q ℤ.+ ↥ q ℤ.* ↧ p) / (↧ₙ p ℕ.* ↧ₙ q) -- multiplication _*_ : ℚᵘ → ℚᵘ → ℚᵘ p * q = (↥ p ℤ.* ↥ q) / (↧ₙ p ℕ.* ↧ₙ q) -- subtraction _-_ : ℚᵘ → ℚᵘ → ℚᵘ p - q = p + (- q) -- reciprocal: requires a proof that the numerator is not zero 1/_ : (p : ℚᵘ) → .{n≢0 : ∣ ↥ p ∣ ≢0} → ℚᵘ 1/ mkℚᵘ +[1+ n ] d = mkℚᵘ +[1+ d ] n 1/ mkℚᵘ -[1+ n ] d = mkℚᵘ -[1+ d ] n -- division: requires a proof that the denominator is not zero _÷_ : (p q : ℚᵘ) → .{n≢0 : ∣ ↥ q ∣ ≢0} → ℚᵘ (p ÷ q) {n≢0} = p * (1/_ q {n≢0}) ------------------------------------------------------------------------------ -- Some constants 0ℚᵘ : ℚᵘ 0ℚᵘ = + 0 / 1 1ℚᵘ : ℚᵘ 1ℚᵘ = + 1 / 1 ½ : ℚᵘ ½ = + 1 / 2 -½ : ℚᵘ -½ = - ½
count1.asm
kanpapa/cosmac
2
93091
* * Counter program 1 for COSMAC * SB-Assembler * .CR 1802 ;To load the 1802 cross overlay .OR $0000 * START LDI #IOR ;D <- #IOR PLO 3 ;R(3).0 <- D SEX 3 ;X <- 3 LOOP1 GLO 4 ;D <- R(4).0 STR 3 ;M(R(3)) <- D OUT 1 ;BUS <- M(R(3)); R(3)++ DEC 3 ;R(3)-- INC 4 ;R(4)++ BR LOOP1 ;Branch to LOOP1 * IOR .DB 0 ;IO Register .EN
programs/oeis/017/A017224.asm
karttu/loda
1
80505
; A017224: a(n) = (9*n + 5)^4. ; 625,38416,279841,1048576,2825761,6250000,12117361,21381376,35153041,54700816,81450625,116985856,163047361,221533456,294499921,384160000,492884401,623201296,777796321,959512576,1171350625,1416468496,1698181681,2019963136,2385443281,2798410000,3262808641,3782742016,4362470401,5006411536,5719140625,6505390336,7370050801,8318169616,9354951841,10485760000,11716114081,13051691536,14498327281,16062013696,17748900625,19565295376,21517662721,23612624896,25856961601,28257610000,30821664721,33556377856,36469158961,39567575056,42859350625,46352367616,50054665441,53974440976,58120048561,62500000000,67122964561,71997768976,77133397441,82538991616,88223850625,94197431056,100469346961,107049369856,113947428721,121173610000,128738157601,136651472896,144924114721,153566799376,162590400625,172005949696,181824635281,192057803536,202716958081,213813760000,225360027841,237367737616,249849022801,262816174336,276281640625,290258027536,304758098401,319794774016,335381132641,351530410000,368255999281,385571451136,403490473681,422026932496,441194850625,461008408576,481481944321,502629953296,524467088401,547008160000,570268135921,594262141456,619005459361,644513529856,670801950625,697886476816,725783021041,754507653376,784076601361,814506250000,845813141761,878013976576,911125611841,945165062416,980149500625,1016096256256,1053022816561,1090946826256,1129886087521,1169858560000,1210882360801,1252975764496,1296157203121,1340445266176,1385858700625,1432416410896,1480137458881,1529041063936,1579146602881,1630473610000,1683041777041,1736870953216,1791981145201,1848392517136,1906125390625,1965200244736,2025637716001,2087458598416,2150683843441,2215334560000,2281432014481,2348997630736,2418052990081,2488619831296,2560720050625,2634375701776,2709608995921,2786442301696,2864898145201,2944999210000,3026768337121,3110228525056,3195402929761,3282314864656,3370987800625,3461445366016,3553711346641,3647809685776,3743764484161,3841600000000,3941340648961,4043011004176,4146635796241,4252239913216,4359848400625,4469486461456,4581179456161,4694952902656,4810832476321,4928844010000,5049013494001,5171367076096,5295931061521,5422731912976,5551796250625,5683150852096,5816822652481,5952838744336,6091226377681,6232012960000,6375226056241,6520893388816,6669042837601,6819702439936,6972900390625,7128665041936,7287024903601,7448008642816,7611645084241,7777963210000,7946992159681,8118761230336,8293299876481,8470637710096,8650804500625,8833830174976,9019744817521,9208578670096,9400362132001,9595125760000,9792900268321,9993716528656,10197605570161,10404598579456,10614726900625,10828022035216,11044515642241,11264239538176,11487225696961,11713506250000,11943113486161,12176079851776,12412437950641,12652220544016,12895460550625,13142191046656,13392445265761,13646256599056,13903658595121,14164684960000,14429369557201,14697746407696,14969849689921,15245713739776,15525373050625,15808862273296,16096216216081,16387469844736,16682658282481,16981816810000,17284980865441,17592186044416,17903468100001,18218862942736,18538406640625,18862135419136,19190085661201,19522293907216,19858796855041,20199631360000,20544834434881,20894443249936,21248495132881,21607027568896,21970078200625,22337684828176,22709885409121,23086718058496,23468221048801,23854432810000,24245391929521,24641137152256,25041707380561,25447141674256 mul $0,9 add $0,5 pow $0,4 mov $1,$0
src/TAlgebra.agda
myuon/agda-cate
2
4941
module TAlgebra where open import Level open import Data.Product open import Relation.Binary open Setoid open import Basic open import Category import Functor import Nat import Adjoint open import Monad open Category.Category open Functor.Functor open Nat.Nat open Nat.Export open Adjoint.Export open Monad.Monad record TAlgebra {C₀ C₁ ℓ} {C : Category C₀ C₁ ℓ} (T : Monad C) : Set (C₀ ⊔ C₁ ⊔ ℓ) where field Tobj : Obj C Tmap : Hom C (fobj (MFunctor T) Tobj) Tobj field join-fmap-alg : C [ C [ Tmap ∘ component (Mjoin T) Tobj ] ≈ C [ Tmap ∘ fmap (MFunctor T) Tmap ] ] map-unit : C [ C [ Tmap ∘ component (Munit T) Tobj ] ≈ id C ] open TAlgebra record TAlgMap {C₀ C₁ ℓ} {C : Category C₀ C₁ ℓ} {T : Monad C} (a b : TAlgebra T) : Set (C₁ ⊔ ℓ) where field Thom : Hom C (Tobj a) (Tobj b) field hom-comm : C [ C [ Tmap b ∘ fmap (MFunctor T) Thom ] ≈ C [ Thom ∘ Tmap a ] ] open TAlgMap compose : ∀ {C₀ C₁ ℓ} {C : Category C₀ C₁ ℓ} {T : Monad C} {a b c : TAlgebra T} → TAlgMap b c → TAlgMap a b → TAlgMap a c compose {C = C} {T} {a} {b} {c} f g = record { Thom = C [ Thom f ∘ Thom g ] ; hom-comm = begin⟨ C ⟩ C [ Tmap c ∘ fmap (MFunctor T) (C [ Thom f ∘ Thom g ]) ] ≈⟨ ≈-composite C (refl-hom C) (preserveComp (MFunctor T)) ⟩ C [ Tmap c ∘ C [ fmap (MFunctor T) (Thom f) ∘ fmap (MFunctor T) (Thom g) ] ] ≈⟨ sym-hom C (assoc C) ⟩ C [ C [ Tmap c ∘ fmap (MFunctor T) (Thom f) ] ∘ fmap (MFunctor T) (Thom g) ] ≈⟨ ≈-composite C (hom-comm f) (refl-hom C) ⟩ C [ C [ Thom f ∘ Tmap b ] ∘ fmap (MFunctor T) (Thom g) ] ≈⟨ assoc C ⟩ C [ Thom f ∘ C [ Tmap b ∘ fmap (MFunctor T) (Thom g) ] ] ≈⟨ ≈-composite C (refl-hom C) (hom-comm g) ⟩ C [ Thom f ∘ C [ Thom g ∘ Tmap a ] ] ≈⟨ sym-hom C (assoc C) ⟩ C [ C [ Thom f ∘ Thom g ] ∘ Tmap a ] ∎ } identity : ∀ {C₀ C₁ ℓ} {C : Category C₀ C₁ ℓ} {T : Monad C} {a : TAlgebra T} → TAlgMap a a identity {C = C} {T} {a} = record { Thom = id C ; hom-comm = begin⟨ C ⟩ C [ Tmap a ∘ fmap (MFunctor T) (id C) ] ≈⟨ ≈-composite C (refl-hom C) (preserveId (MFunctor T)) ⟩ C [ Tmap a ∘ id C ] ≈⟨ rightId C ⟩ Tmap a ≈⟨ sym-hom C (leftId C) ⟩ C [ id C ∘ Tmap a ] ∎ } T-Algs : ∀ {C₀ C₁ ℓ} {C : Category C₀ C₁ ℓ} (T : Monad C) → Category _ _ _ T-Algs {C = C} T = record { Obj = TAlgebra T; Homsetoid = λ a b → record { Carrier = TAlgMap a b ; _≈_ = λ f g → C [ Thom f ≈ Thom g ] ; isEquivalence = record { refl = refl-hom C ; sym = sym-hom C ; trans = trans-hom C } }; comp = compose; id = identity; leftId = leftId C; rightId = rightId C; assoc = assoc C; ≈-composite = ≈-composite C } Free-TAlg : ∀ {C₀ C₁ ℓ} {C : Category C₀ C₁ ℓ} (T : Monad C) → Functor.Functor C (T-Algs T) Free-TAlg {C = C} T = record { fobj = λ x → record { Tobj = fobj (MFunctor T) x ; Tmap = component (Mjoin T) x ; join-fmap-alg = join_join T ; map-unit = unit_MFunctor T } ; fmapsetoid = λ {a} {b} → record { mapping = λ x → record { Thom = fmap (MFunctor T) x ; hom-comm = naturality (Mjoin T) } ; preserveEq = Functor.preserveEq (MFunctor T) } ; preserveId = preserveId (MFunctor T) ; preserveComp = preserveComp (MFunctor T) } Forgetful-TAlg : ∀ {C₀ C₁ ℓ} {C : Category C₀ C₁ ℓ} (T : Monad C) → Functor.Functor (T-Algs T) C Forgetful-TAlg {C = C} T = record { fobj = Tobj ; fmapsetoid = record { mapping = Thom ; preserveEq = λ x≈y → x≈y } ; preserveId = refl-hom C ; preserveComp = refl-hom C } Free⊣Forgetful-TAlg : ∀ {C₀ C₁ ℓ} {C : Category C₀ C₁ ℓ} (T : Monad C) → Free-TAlg T ⊣ Forgetful-TAlg T Free⊣Forgetful-TAlg {C = C} T = Adjoint.unit-triangular-holds-adjoint {C = C} {D = T-Algs T} {FT} {GT} ηT εT triL (λ {a} → triR {a}) where FT = Free-TAlg T GT = Forgetful-TAlg T ηT = record { component = component (Munit T) ; naturality = naturality (Munit T) } εT = record { component = λ X → record { Thom = Tmap X ; hom-comm = sym-hom C (join-fmap-alg X) } ; naturality = λ {a} {b} {f} → hom-comm f } triL : [ C , T-Algs T ] [ Nat.compose (Nat.compose Nat.leftIdNat→ (εT N∘F FT)) (Nat.compose (Nat.assocNat← {F = FT} {GT} {FT}) (Nat.compose (FT F∘N ηT) Nat.rightIdNat←)) ≈ id [ C , T-Algs T ] ] triL = λ {a} → begin⟨ C ⟩ C [ C [ id C ∘ Thom (component εT (fobj FT a)) ] ∘ C [ id C ∘ C [ Thom (fmap FT (component ηT a)) ∘ id C ] ] ] ≈⟨ ≈-composite C (leftId C) (trans-hom C (leftId C) (rightId C)) ⟩ C [ component (Mjoin T) a ∘ fmap (MFunctor T) (component (Munit T) a) ] ≈⟨ MFunctor_unit T ⟩ id C ∎ triR : [ T-Algs T , C ] [ Nat.compose (Nat.compose Nat.rightIdNat→ (GT F∘N εT)) (Nat.compose (Nat.assocNat→ {F = GT} {FT} {GT}) (Nat.compose (ηT N∘F GT) Nat.leftIdNat←)) ≈ id [ T-Algs T , C ] ] triR = λ {a} → begin⟨ C ⟩ C [ C [ id C ∘ fmap GT (component εT a) ] ∘ C [ id C ∘ C [ component ηT (fobj GT a) ∘ id C ] ] ] ≈⟨ ≈-composite C (leftId C) (trans-hom C (leftId C) (rightId C)) ⟩ C [ fmap GT (component εT a) ∘ component ηT (fobj GT a) ] ≈⟨ refl-hom C ⟩ C [ component (GT F∘N εT) a ∘ component (Munit T) (Tobj a) ] ≈⟨ map-unit a ⟩ id C ∎
load.asm
aak1247/Notebook-ASM
0
95235
.386 .model flat, stdcall option casemap: none public Preload public hIcon public hBitmapBgnd include windows.inc include gdi32.inc includelib gdi32.lib include msimg32.inc includelib msimg32.lib include user32.inc includelib user32.lib include kernel32.inc includelib kernel32.lib include masm32.inc includelib masm32.lib include debug.inc includelib debug.lib .data? hIcon dd ? hBitmapBgnd dd ? .const szIcon db 'img\\mysterious\\icon.ico', 0 szBitmapBgnd1 db 'Res\\5.bmp', 0 .code Preload proc invoke LoadImage, NULL, addr szBitmapBgnd1, IMAGE_BITMAP, 592, 592, LR_LOADFROMFILE mov hBitmapBgnd, eax ; default background color invoke LoadImage, NULL, addr szIcon, IMAGE_ICON, 16, 16, LR_LOADFROMFILE mov hIcon, eax ret Preload endp end
data/jpred4/jp_batch_1613899824__FWuJ6YS/jp_batch_1613899824__FWuJ6YS.als
jonriege/predict-protein-structure
0
3756
SILENT_MODE BLOCK_FILE jp_batch_1613899824__FWuJ6YS.concise.blc MAX_NSEQ 643 MAX_INPUT_LEN 645 OUTPUT_FILE jp_batch_1613899824__FWuJ6YS.concise.ps PORTRAIT POINTSIZE 8 IDENT_WIDTH 12 X_OFFSET 2 Y_OFFSET 2 DEFINE_FONT 0 Helvetica DEFAULT DEFINE_FONT 1 Helvetica REL 0.75 DEFINE_FONT 7 Helvetica REL 0.6 DEFINE_FONT 3 Helvetica-Bold DEFAULT DEFINE_FONT 4 Times-Bold DEFAULT DEFINE_FONT 5 Helvetica-BoldOblique DEFAULT # DEFINE_COLOUR 3 1 0.62 0.67 # Turquiose DEFINE_COLOUR 4 1 1 0 # Yellow DEFINE_COLOUR 5 1 0 0 # Red DEFINE_COLOUR 7 1 0 1 # Purple DEFINE_COLOUR 8 0 0 1 # Blue DEFINE_COLOUR 9 0 1 0 # Green DEFINE_COLOUR 10 0.41 0.64 1.00 # Pale blue DEFINE_COLOUR 11 0.41 0.82 0.67 # Pale green DEFINE_COLOUR 50 0.69 0.18 0.37 # Pink (helix) DEFINE_COLOUR 51 1.00 0.89 0.00 # Gold (strand) NUMBER_INT 10 SETUP # # Highlight specific residues. # Avoid highlighting Lupas 'C' predictions by # limiting the highlighting to the alignments Scol_CHARS C 1 1 111 632 4 Ccol_CHARS H ALL 5 Ccol_CHARS P ALL 8 SURROUND_CHARS LIV ALL # # Replace known structure types with whitespace SUB_CHARS 1 633 111 642 H SPACE SUB_CHARS 1 633 111 642 E SPACE SUB_CHARS 1 633 111 642 - SPACE STRAND 13 636 18 COLOUR_TEXT_REGION 13 636 18 636 51 STRAND 30 636 37 COLOUR_TEXT_REGION 30 636 37 636 51 STRAND 44 636 49 COLOUR_TEXT_REGION 44 636 49 636 51 STRAND 68 636 77 COLOUR_TEXT_REGION 68 636 77 636 51 STRAND 87 636 94 COLOUR_TEXT_REGION 87 636 94 636 51 STRAND 101 636 106 COLOUR_TEXT_REGION 101 636 106 636 51 STRAND 4 641 5 COLOUR_TEXT_REGION 4 641 5 641 51 STRAND 14 641 18 COLOUR_TEXT_REGION 14 641 18 641 51 STRAND 30 641 37 COLOUR_TEXT_REGION 30 641 37 641 51 STRAND 44 641 50 COLOUR_TEXT_REGION 44 641 50 641 51 STRAND 68 641 77 COLOUR_TEXT_REGION 68 641 77 641 51 STRAND 87 641 94 COLOUR_TEXT_REGION 87 641 94 641 51 STRAND 101 641 106 COLOUR_TEXT_REGION 101 641 106 641 51 STRAND 13 642 18 COLOUR_TEXT_REGION 13 642 18 642 51 STRAND 30 642 36 COLOUR_TEXT_REGION 30 642 36 642 51 STRAND 44 642 48 COLOUR_TEXT_REGION 44 642 48 642 51 STRAND 69 642 77 COLOUR_TEXT_REGION 69 642 77 642 51 STRAND 87 642 94 COLOUR_TEXT_REGION 87 642 94 642 51 STRAND 101 642 106 COLOUR_TEXT_REGION 101 642 106 642 51
programs/oeis/101/A101863.asm
neoneye/loda
22
84391
; A101863: Main diagonal of A101858. ; 2,13,25,52,89,117,170,208,277,356,410,505,610,680,801,881,1018,1165,1261,1424,1530,1709,1898,2020,2225,2440,2578,2809,2957,3204,3461,3625,3898,4181,4361,4660,4850,5165,5490,5696,6037,6253,6610,6977,7209,7592,7985 mov $5,$0 seq $0,90908 ; Terms a(k) of A073869 for which a(k)=a(k+1). mov $2,$0 add $4,$0 mul $2,$4 mov $1,$2 add $1,1 mov $3,$5 mul $3,2 add $1,$3 mov $6,$5 mul $6,$5 add $1,$6 mov $0,$1
Library/Kernel/Initfile/initfileHash.asm
steakknife/pcgeos
504
245253
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% (c) Copyright Geoworks 1996. All rights reserved. GEOWORKS CONFIDENTIAL PROJECT: Hash table module. MODULE: FILE: initfileHash.asm AUTHOR: <NAME>, Nov 8, 1996 ROUTINES: Name Description ---- ----------- ?? INT InitFileInitHashTable Create the hash table used to speed up ini reads and writes. ?? INT HashProcessIniFile Process one ini file. ?? INT HashAddPrimaryEntry Hash a new category for the primary init file ?? INT HashAddEntry Add an entry to the table. ?? INT HashCheckForCollision See if the category already in this element is different than the one we're hashing. ?? INT HashDealWithCollision Deal with a collision when building the table. ?? INT HashHashCat Get the hash value for the passed category string. ?? INT HashGetNextCat Find the next category in the ini file. ?? INT HashCreateTable Create the chunk array for the table. ?? INT HashFindCategory Locates the given category. ?? INT HashRemoveCategory Remove the hash entry for a category ?? INT HashUpdateTblPtrs update all the chunk array element pointers located after the element just deleted. ?? INT HashFindCategoryLow Locates the given category. ?? INT HashUpdateHashTable Update all of the hash table entries located after the current pointer into the file. REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/ 8/96 Initial revision DESCRIPTION: $Id: initfileHash.asm,v 1.1 97/04/05 01:18:09 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if HASH_INIFILE InitfileRead segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% InitFileInitHashTable %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create the hash table used to speed up ini reads and writes. CALLED BY: InitGeos PASS: nothing RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/ 8/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ InitFileInitHashTable proc far uses ax,bx,cx,dx,si,di,bp, ds, es .enter inherit ; ; Grab the ini file sem and get dgroup ( ds <- dgroup ). ; call LoadVarSegDS_PInitFile segmov es, ds ; es <- dgroup ; ; Allocate a block for the table. ; call HashCreateTable ;bx <- blk, *ds:si <- array mov es:[hashTableBlkHandle], bx mov es:[hashTableChunkHandle], si ; ; Process each ini file. ; clr di ; init file counter iniFileLoop: ; ; Get the next ini block handle. ; mov bx, es:[loaderVars][di].KLV_initFileBufHan tst bx jz cleanUp ; ; Process the file, then set up for getting next ini blk handle. ; clr ax ; start at begining of file call HashProcessIniFile add di, size hptr cmp di, (MAX_INI_FILES* size hptr) jb iniFileLoop cleanUp: mov bx, es:[hashTableBlkHandle] call MemUnlock segmov ds, es ; ds <- dgroup call VInitFile .leave ret InitFileInitHashTable endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashProcessIniFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Process one ini file. CALLED BY: InitFileInitHashTable PASS: ^hbx = ini file block handle *ds:si = hash table chunk array es = dgroup di = Offset into the KLV_initFileBufHan variable. We use it as an offset into any hash table entry we deal with as each element can have ptrs into different ini buffers. See initfileVariable.def and the definition of InitFileHashEntry for more details. ax = offset into the ini buffer where we want to start processing. so that *(^hbx:ax) is where we should start. This is 0 when building and something else if we're writting something out. RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/ 8/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashProcessIniFile proc near ; !!! MUST BE IDENTICAL to local vars in HashAddPrimaryEntry tableSeg local sptr push ds tableHandle local hptr push si iniFileBlkHan local hptr push bx iniFileBlkHanOffset local word push di iniFileBufferOffset local word push ax ForceRef tableSeg ForceRef tableHandle ForceRef iniFileBlkHan ForceRef iniFileBlkHanOffset uses ax,bx,cx,dx,si,di,bp, ds .enter ; ; Lock the ini file block and save the segment. ; call MemLock ; ax <- seg of ini file mov ds, ax mov es:[initFileBufSegAddr], ax mov si, ss:[iniFileBufferOffset] ; ds:si <- ini file start ; processNextCategory: ; ; Get the next cat string from the ini file, hash it, then add ; the entry to the table. Loop. ; call HashGetNextCat ; ds:si <- category string jc done call HashHashCat ; dx <- table location call HashAddEntry jmp processNextCategory done: call MemUnlock .leave ret HashProcessIniFile endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashAddPrimaryEntry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Hash a new category for the primary init file CALLED BY: CreateCategory PASS: cx - near pointer to new category es - dgroup RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- EW 12/16/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashAddPrimaryEntry proc far uses ax,bx,cx,dx,si,di,bp,ds ; !!! MUST BE IDENTICAL to local vars in HashProcessIniFile tableSeg local sptr tableHandle local hptr iniFileBlkHan local hptr iniFileBlkHanOffset local word iniFileBufferOffset local word ForceRef iniFileBlkHan ForceRef iniFileBufferOffset uses ax,bx,cx,dx,si,di,bp, ds .enter ; ; we only write to the primary init file, which is offset 0 ; clr ss:[iniFileBlkHanOffset] ; ; get the hash block ; mov bx, es:[hashTableBlkHandle] mov si, es:[hashTableChunkHandle] call MemLock mov ss:[tableSeg], ax mov ss:[tableHandle], si ; ; hash the category ; mov ds, es:[initFileBufSegAddr] mov si, cx ; ds:si = category call HashHashCat ; dx <- table location call HashAddEntry .leave ret HashAddPrimaryEntry endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashAddEntry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add an entry to the table. CALLED BY: HashProcessIniFile PASS: bp = stackframe from HashProcessIniFile tableSeg tableHandle initFileBlkHanOffset si = nptr to category string in ini file dx = table position RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/ 8/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashAddEntry proc near uses ax,bx,cx,dx,si,di,bp, ds .enter inherit HashProcessIniFile EC < Assert le dx, INITFILE_HASH_TABLE_SIZE > EC < Assert stackFrame bp > ; ; Get the table in ds:si ; mov cx, si ; cx <- nptr to category mov ax, ss:[tableSeg] mov ds, ax mov si, ss:[tableHandle] ; *ds:si chunk array ; ; Load up the table entry. dx is the table entry number. ; mov si, ds:[si] ; ds:si <- header add si, offset IFHTH_table ; ds:si <- table shl dx ; convert index to word sized add si, dx ; ds:si <- entry location ; ; See if we already have an element. ; tst {word}ds:[si] jnz elementExists ; ; No element here yet. Create one and stick it in the table. ; ; mov bx, si mov si, ss:[tableHandle] ; *ds:si <- chunk array call ChunkArrayAppend ; di <- offset of element segmov tableSeg, ds, ax sub di, ds:[si] ; make offset relative to chunk ; ChunkArrayAppend might have caused the lmem block to move, so ; calculate the offset again mov bx, ds:[si] add bx, offset IFHTH_table add bx, dx mov ds:[bx], di ; store offset in hash table add di, ds:[si] ; ds:di = new IFHE jmp haveElement elementExists: ; ; See if this is a collision or just a duplicate category in a ; different ini file. ; mov di, ds:[si] ; ds:di <- offset in chunk mov ax, di ; save offset mov si, ss:[tableHandle] add di, ds:[si] ; ds:di = existing IFHE call HashCheckForCollision jz haveElement ; ; Deal with the collision. ; pass in the offset of the elem in chunk instead of absolute address ; because the lmem block might move, which will result in a bogus ; address call HashDealWithCollision jmp finish haveElement: ; ; Element is in ds:di. ; mov bx, ss:[iniFileBlkHanOffset] ; if this a catPtr already exists it's because the ini file has two ; entries for the same category. We ignore all but the first entry. tst ds:[di][bx].IFHE_catPtrs jnz finish mov ds:[di][bx].IFHE_catPtrs, cx finish: .leave ret HashAddEntry endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashCheckForCollision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: See if the category already in this element is different than the one we're hashing. CALLED BY: HashAddEntry PASS: ds:di = existing element we collided with es = dgroup cx = nptr to category we're hashing relative to the segment in initFileBufSegAddr in dgroup RETURN: z flag set if no collision. This means that target string equals the existing element string. DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/12/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashCheckForCollision proc near uses ax, bx, cx, dx, ds, es, si, di .enter ; ; Get a hold of a ptr to a category within this existing element. ; clr bx catLoop: mov ax, ds:[di][bx].IFHE_catPtrs tst ax jnz foundCat add bx, size hptr cmp bx, (MAX_INI_FILES* size hptr) jb catLoop ; ; If we reach this point, it means that all the pointers ; were null, so why does this entry even exist? In NEC, ; just ignore this entry. ; EC < ERROR INIT_FILE_CORRUPT_HASH_TABLE > NEC < inc bx ; clear z flag > NEC < jmp done > ; ; We found a pointer to the category label. See if this ; is the desired category. ; foundCat: mov si, ax mov bx, es:[loaderVars][bx].KLV_initFileBufHan call MemLock mov ds, ax ; ds:si <- file str mov di, cx mov cx, es:[catStrLen] ; length mov es, es:[initFileBufSegAddr] ; es:di <- hash str repe cmpsb NEC < done: > call MemUnlock .leave ret HashCheckForCollision endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashDealWithCollision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Deal with a collision when building the table. CALLED BY: HashAddEntry PASS: ds:di = the existing element we collided with ax = offset of element in chunk cx = nptr to target category relative to current ini blk es = dgroup *ds:si = the hash table chunk RETURN: nothing DESTROYED: REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/11/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashDealWithCollision proc near uses ax,bx,cx,dx,si,di,bp, ds, es .enter inherit HashProcessIniFile ; ; Get to the end of the chain. ; mov bx, ss:[iniFileBlkHanOffset] findEndLoop: tst ds:[di].IFHE_next jz atEnd mov di, ds:[di].IFHE_next ; offset from start of chunk add di, ds:[si] ; ds:di = next IFHE call HashCheckForCollision jnz findEndLoop ; ; We don't want to clobber an exisiting entry ; tst ds:[di][bx].IFHE_catPtrs jnz done mov ds:[di][bx].IFHE_catPtrs, cx jmp done atEnd: call ChunkArrayAppend ; ds:di <- element segmov tableSeg, ds, dx ; ; Set up the element. ; mov ds:[di][bx].IFHE_catPtrs, cx sub di, ds:[si] ; convert to chunk-relative ; ; the lmem block may have moved due to the ChunkArrayAppend, so the ; position of the existing IFHE might have moved, so we calculate it ; again ; mov si, ss:[tableHandle] add ax, ds:[si] mov_tr bx, ax mov ds:[bx].IFHE_next, di done: .leave ret HashDealWithCollision endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashHashCat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get the hash value for the passed category string. CALLED BY: ini Hash routines PASS: ds:si = string to hash RETURN: dx = value DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/ 8/96 Initial version hash code from adam %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashHashCat proc near uses ax,bx,cx,si,di,bp .enter clr bx, dx mov cl, 5 clr ah charLoop: lodsb ; ; When building the table ']' signals the end of a string. When ; reading and such the strings are ASCIIZ... ; cmp al, ']' ; end of cat string? je done ; yes tst al jz done ; ; Skip this if it's a space. ; cmp al, ' ' je charLoop ; ; Downsize this if it's a cap. but let non-letters slip through. ; cmp al, 'z' ja ready cmp al, 'a' jb ready sub al, 'a'-'A' ready: ; ; Multiply existing value by 33 ; movdw dibp, bxdx ; save current value for add rol dx, cl ; *32, saving high 5 bits in low ones shl bx, cl ; *32, making room for high 5 bits of ; dx mov ch, dl andnf ch, 0x1f ; ch <- high 5 bits of dx andnf dl, not 0x1f ; nuke saved high 5 bits or bl, ch ; shift high 5 bits into bx adddw bxdx, dibp ; *32+1 = *33 ; ; Add current character into the value. ; add dx, ax adc bx, 0 jmp charLoop done: ; nifty steveK business to speed this up. mov ax, dx mov dx, bx ; dxax <- value divideLoop: cmpdw dxax, 65536*INITFILE_HASH_TABLE_SIZE jb finishUp subdw dxax, 65536*INITFILE_HASH_TABLE_SIZE jmp divideLoop finishUp: mov bx, INITFILE_HASH_TABLE_SIZE div bx finished:: .leave ret HashHashCat endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashGetNextCat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find the next category in the ini file. CALLED BY: InitFileInitHashTable PASS: ds:si = ptr to ini buffer RETURN: ds:si = ptr to category, just after '[' delimeter catStrLen in dgoup set to the length of this category string. DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/ 8/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashGetNextCat proc near uses ax,bx,cx,dx,di,bp .enter ; ; We simply parse through the file looking for a '['. ; mov ah, '[' ; marks category findLoop: lodsb cmp al, MSDOS_TEXT_FILE_EOF je eof cmp al, '\\' je escapedChar cmp al, INIT_FILE_COMMENT je commentChar afterComment: cmp ah, al jne findLoop push es segmov es, ds mov di, si ; es:di <- ptr to cat mov cx, MAX_INITFILE_CATEGORY_LENGTH mov al, ']' ; check for this repne scasb dec di ; move back to ] sub di, si ; di <- the length EC < Assert le di, MAX_INITFILE_CATEGORY_LENGTH > pop es mov es:[catStrLen], di clc exit: .leave ret eof: stc ; return EOF found jmp exit escapedChar: ; Escaped char hit... lodsb ; read past escaped char cmp al, MSDOS_TEXT_FILE_EOF je eof jmp findLoop ; & continue w/NEXT char commentChar: ; Comment char hit... lodsb ; read through EOLN, cmp al, MSDOS_TEXT_FILE_EOF je eof cmp al, '\n' jne commentChar jmp short afterComment ; continue with EOLN itself HashGetNextCat endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashCreateTable %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create the chunk array for the table. CALLED BY: InitFileInitHashTable PASS: nothing RETURN: bx = block handle of table chunk array (LOCKED!) *ds:si = chunk array, ready to party DESTROYED: nothing NOTES: The structure of the table is this. The chunk array header contains the 271 possible hash buckets. Each one of these entries is either NULL or a chunk array element number. REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/ 8/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashCreateTable proc near uses ax,cx,dx,di,bp .enter ; ; Create the block. ; mov ax, LMEM_TYPE_GENERAL clr cx call MemAllocLMem push bx ; save heap handle ; ; Make the thing sharable. ; clr ah ; clear no flags mov al, mask HF_SHARABLE call MemModifyFlags ; ; Make the chunk array. ChunkArrayCreate zeros things out for us. ; call MemLock ; ax <- segment mov ds, ax ; block for the new array mov bx, size InitFileHashEntry ; bx <- elem size mov cx, size InitFileHashTableHeader ; cx <- header size clr ax, si ; si = create a chunk handle ; al = ObjChunkFlags call ChunkArrayCreate ; *ds:si <- array pop bx ; recover heap handle .leave ret HashCreateTable endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashFindCategory %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Locates the given category. CALLED BY: FindCategory for now. PASS: es, bp - dgroup dgroup:[catStrAddr] - category ASCIIZ string dgroup:[catStrOffset] dgroup:[catStrLen] dgroup:[currentIniOffset] RETURN: IF CATEGORY FOUND: CARRY CLEAR dgroup:[initFileBufPos] - offset from BufAddr to character after ']' ELSE CARRY SET initFileBufPos - unchanged DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/12/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashFindCategory proc near uses bx, dx, si, di, ds .enter ; ; Hash the string to get the table location. ; lds si, es:[catStrAddr] ;ds:si <- string to hash call HashHashCat ; dx <- table location ; ; Search for the category ; call HashFindCategoryLow ; ; Unlock the hash table ; mov bx, es:[hashTableBlkHandle] call MemUnlock .leave ret HashFindCategory endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashRemoveCategory %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Remove the hash entry for a category CALLED BY: InitFileDeleteCategory PASS: es, bp - dgroup dgroup:[catStrAddr] - category ASCIIZ string dgroup:[catStrOffset] dgroup:[catStrLen] dgroup:[currentIniOffset] RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- EW 12/17/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashRemoveCategory proc far uses ax, bx, cx, dx, si, di, bp, ds .enter ; ; Hash the string to get the table location. ; lds si, es:[catStrAddr] ;ds:si <- string to hash call HashHashCat ; dx <- table location ; ; Search for the category ; call HashFindCategoryLow ; ds:di = IFHE EC < ERROR_C INIT_FILE_CORRUPT_HASH_TABLE > ; ; Remove the pointer to the first init file ; clr {word}ds:[di].IFHE_catPtrs ; ; See if this category is in any other file ; CheckHack <MAX_INI_FILES gt 1> mov bx, 2*(MAX_INI_FILES-1) check: tst_clc ds:[di].IFHE_catPtrs[bx] jnz cleanup dec bx dec bx jnz check ; ; There are no other references, so we need to deallocate this ; chunk array entry. We start by checking to see if this entry ; is referenced directly by the hash table. ; mov si, es:[hashTableChunkHandle] mov si, ds:[si] ; ds:si <- header mov bx, si ; bx = chunk base add si, offset IFHTH_table shl dx ; convert to word add si, dx ; ds:si <- tableloc sub di, bx ; di = relative offset ; ; walk down the linked list until we find the pointer to the ; selected entry ; docmp: cmp di, ds:[si] je found mov si, ds:[si] ; offset relative to chunk EC < tst si > EC < ERROR_Z INIT_FILE_CORRUPT_HASH_TABLE > add si, bx ; actual offset add si, offset IFHE_next jmp docmp ; ; make the entry which points to the deleted entry point to the ; entry following the deleted entry, or null ; found: add di, bx segmov ds:[si], ds:[di].IFHE_next, ax ; ; remove the actual element ; mov cx, di mov si, es:[hashTableChunkHandle] call ChunkArrayDelete ; does ds:di point to the same element, if not this means that we ; deleted the last element in the chunk array, so we needn't update teh ; hash table cmp cx, di jne cleanup sub di, bx ; restore relative ptr ; ; all elements after this one just moved up, so we need to update ; pointers to them in the hash table ; call HashUpdateTblPtrs ; ; Unlock the hash table ; cleanup: mov bx, es:[hashTableBlkHandle] call MemUnlock .leave ret HashRemoveCategory endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashUpdateTblPtrs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: update all the chunk array element pointers located after the element just deleted. CALLED BY: HashRemoveCategory PASS: es - dgroup ds:di - reletive ptr to chunk array element RETURN: nothing DESTROYED: nothing SIDE EFFECTS: nothing PSEUDO CODE/STRATEGY: loop through the entire hash table if chunkPtr > di chunkPtr -= size InitFileHashEntry loop through all elements in chunkarray if IFHTH_next > di IFHTH_next -= size InitFileHashEntry REVISION HISTORY: Name Date Description ---- ---- ----------- mjoy 3/ 6/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashUpdateTblPtrs proc near uses si, bx, cx .enter mov si, es:[hashTableChunkHandle] ; ds:si - header mov si, ds:[si] ; si - chunk base add si, offset IFHTH_table ; ds:si<- table mov bx, 2*INITFILE_HASH_TABLE_SIZE updateHash: ; ds:[si][bx]=hash slot sub bx, 2 jb hashDone ; no more slots cmp ds:[si][bx], di ; do we need to shift? jb updateHash sub {word}ds:[si][bx], size InitFileHashEntry jmp updateHash hashDone: ; ; similarly, we need to update all the IFHE_next pointers ; sub si, offset IFHTH_table mov cx, ds:[si].CAH_count add si, ds:[si].CAH_offset sub si, size InitFileHashEntry updateNext: add si, size InitFileHashEntry jcxz done dec cx cmp ds:[si].IFHE_next, di jb updateNext sub ds:[si].IFHE_next, size InitFileHashEntry jmp updateNext done: .leave ret HashUpdateTblPtrs endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashFindCategoryLow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Locates the given category. CALLED BY: HashFindCategory, HashRemoveCategory PASS: es, bp - dgroup dx - hash value dgroup:[catStrAddr] - category ASCIIZ string dgroup:[catStrOffset] dgroup:[catStrLen] dgroup:[currentIniOffset] RETURN: IF CATEGORY FOUND: CARRY CLEAR dgroup:[initFileBufPos] - offset from BufAddr to character after ']' ds:di - InitFileHashEntry (hash table block locked) ELSE CARRY SET initFileBufPos - unchanged hash table block locked DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/12/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashFindCategoryLow proc far uses ax,bx,cx,dx,si,bp .enter ; ; Lock down the chunk array block. ; mov bx, es:[hashTableBlkHandle] call MemLock mov ds, ax mov bx, es:[hashTableChunkHandle] ; *ds:si table ; ; Get the element chunk handle from the table. ; mov si, ds:[bx] ; ds:si <- header add si, offset IFHTH_table shl dx ; convert to word add si, dx ; ds:si <- tableloc tst {word}ds:[si] jz fail ; ; An element exists. Get the element and check the nptr in the ; appropriate spot. ; mov di, ds:[si] ; di <-offset in chunk scanElement: ; ; all the pointers in the table are relative to the chunk, so we need ; to add in the chunk's base address to get a real pointer ; add di, ds:[bx] ; ds:di <- IFHE ; ; currentIniOffset is the offset to the ini blk handle in kvars. ; Again, we use it to know which catPtr to look at. ; push bx mov bx, es:[currentIniOffset] mov cx, ds:[di][bx].IFHE_catPtrs pop bx ; if cx is zero it could mean that there is not entry for that cat in ; the current ini file. But there could still be some value in ; IFHT_next jcxz setUpForRetry ; ; We have an nptr. See if it actually matches the category string. ; pushdw dsdi ; save element mov es:[initFileBufPos], cx lds si, es:[catStrAddr] ; ds:si cat string call CmpString jc popAndRetry call GetChar jc error ; cmp al, ']' ; jne huh? mov ax, es:[initFileBufPos] mov es:[curCatOffset], ax popdw dsdi clc jmp exit popAndRetry: popdw dsdi setUpForRetry: ; ; Get the next element and try again. ; tst ds:[di].IFHE_next jz fail mov di, ds:[di].IFHE_next jmp scanElement fail: stc exit: ; ; LEAVE HASH BLOCK LOCKED ; .leave ret error: popdw dsdi GOTO CorruptedIniFileError HashFindCategoryLow endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HashUpdateHashTable %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Update all of the hash table entries located after the current pointer into the file. CALLED BY: InitFileWrite PASS: es - dgroup dgroup:[initFileBufPos] - offset from buffer to insertion loc (new data will start at this location) cx - amount of space added (negative if space removed) RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jimw 11/13/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HashUpdateHashTable proc far uses ax, bx, cx, si, di, ds .enter ; ; get a pointer to the table ; mov bx, es:[hashTableBlkHandle] mov si, es:[hashTableChunkHandle] call MemLock mov ds, ax ; ; set up for loop ; mov ax, cx ; ax = adjustment mov di, ds:[si] ; ds:di = array mov cx, ds:[di].CAH_count ; cx = # of elements add di, ds:[di].CAH_offset ; ds:di = 1st element mov si, es:[initFileBufPos] sub di, size InitFileHashEntry CheckHack <offset IFHE_catPtrs eq 0> ; ; main loop: ; ds:di = <some element>.IFHE_catPtrs[0] ; cx = # of remaining elements ; si = offset at which to start adjusting ; ax = amount by which to adjust ; top: add di, size InitFileHashEntry ; goto next entry jcxz done dec cx cmp si, ds:[di] ; past insert point? ja top ; branch if not add ds:[di], ax ; adjust the offset jmp top done: call MemUnlock .leave ret HashUpdateHashTable endp InitfileRead ends endif ; HASH_INIFILE
lab3_test_harness/Lab1test/cc.asm
Zaydax/PipelineProcessor
2
25754
<filename>lab3_test_harness/Lab1test/cc.asm .ORIG x3000 ; add AND R0, R0, #0 ; 3000 BRN DONE ; 3002 BRP DONE ; 3004 BRNP DONE ; 3006 ADD R1, R1, #1 ; 3008 BRN DONE ; 300a BRZ DONE ; 300c BRNZ DONE ; 300e ADD R7, R1, #-2 ; 3010 BRP DONE ; 3012 BRZ DONE ; 3014 BRZP DONE ; 3016 ; and/ld LEA R0, A ; 3018 LDW R5, R0, #0 ; 301a LDW R4, R0, #0 ; 301c AND R6, R5, R4 ; 301e BRP DONE ; 3020 BRZ DONE ; 3022 LDW R7, R0, #-1 ; 3024 BRP DONE ; 3026 BRN DONE ; 3028 BRNP DONE ; 302a LDW R3, R0, #2 ; 302c BRN DONE ; 302e BRZ DONE ; 3030 BRNZ DONE ; 3032 AND R4, R0, #0 ; 3034 BRN DONE ; 3036 BRP DONE ; 3038 BRNP DONE ; 303a ;LEA R1, D ;BRZ DONE ;BRN DONE ;BRNZ DONE LDW R5, R0, #0 ;303c NOT R5, R5 ;303e BRN DONE ;3040 BRZ DONE ;3042 BRNZ DONE ;3044 NOT R4, R5 ; 3046 BRZ DONE ; 3048 BRP DONE ; 304a BRZP DONE ; 304c AND R3, R3, #0 ; 304e NOT R3, R3 ; 3050 NOT R6, R3 ; 3062 BRN DONE ; 3054 BRP DONE ; 3056 BRNP DONE ; 3058 LDW R1, R0, #1 ; 305a BRZ DONE ; 305c BRP DONE ; 305e BRZP DONE ; 3060 ADD R0, R0, #5 ; 3062 DONE HALT ; 3064 C .FILL x0 ; 3066 A .FILL xEFFF ; 3068 B .FILL xF000 D .FILL x1100 .END
programs/oeis/194/A194391.asm
jmorken/loda
1
19089
<reponame>jmorken/loda ; A194391: Numbers m such that Sum_{k=1..m} (<1/2 + k*r> - <k*r>) > 0, where r=sqrt(12) and < > denotes fractional part. ; 1,3,5,7,9,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,29,31,33,35,37,39,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,57,59,61,63,65,67,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,85,87,89,91,93 mov $2,$0 add $2,1 lpb $2 mov $0,$6 sub $2,1 sub $0,$2 mov $3,8 mov $4,2 mov $8,2 lpb $0 add $3,8 div $3,2 mod $5,$4 mov $7,$0 mov $0,0 sub $3,2 add $5,5 div $7,7 mul $8,$7 gcd $8,$3 mul $8,$5 lpe div $8,28 add $8,1 add $1,$8 lpe
src/sys/os-windows/util-systems-os.adb
RREE/ada-util
60
28329
----------------------------------------------------------------------- -- util-system-os -- Windows system operations -- Copyright (C) 2011, 2012, 2015, 2018, 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Characters.Conversions; package body Util.Systems.Os is use type Interfaces.Unsigned_32; use type Interfaces.Unsigned_64; use type Interfaces.C.size_t; function To_WSTR (Value : in String) return Wchar_Ptr is Result : constant Wchar_Ptr := new Interfaces.C.wchar_array (0 .. Value'Length + 1); Pos : Interfaces.C.size_t := 0; begin for C of Value loop Result (Pos) := Interfaces.C.To_C (Ada.Characters.Conversions.To_Wide_Character (C)); Pos := Pos + 1; end loop; Result (Pos) := Interfaces.C.wide_nul; return Result; end To_WSTR; function Sys_SetFilePointerEx (Fs : in File_Type; Offset : in Util.Systems.Types.off_t; Result : access Util.Systems.Types.off_t; Mode : in Util.Systems.Types.Seek_Mode) return BOOL with Import => True, Convention => Stdcall, Link_Name => "SetFilePointerEx"; function Sys_Lseek (Fs : in File_Type; Offset : in Util.Systems.Types.off_t; Mode : in Util.Systems.Types.Seek_Mode) return Util.Systems.Types.off_t is Result : aliased Util.Systems.Types.off_t; begin if Sys_SetFilePointerEx (Fs, Offset, Result'Access, Mode) /= 0 then return Result; else return -1; end if; end Sys_Lseek; function Sys_GetFileSizeEx (Fs : in File_Type; Result : access Util.Systems.Types.off_t) return BOOL with Import => True, Convention => Stdcall, Link_Name => "GetFileSizeEx"; function Sys_GetFileTime (Fs : in File_Type; Create : access FileTime; AccessTime : access FileTime; ModifyTime : access FileTime) return BOOL with Import => True, Convention => Stdcall, Link_Name => "GetFileTime"; TICKS_PER_SECOND : constant := 10000000; EPOCH_DIFFERENCE : constant := 11644473600; function To_Time (Time : in FileTime) return Types.Time_Type is Value : Interfaces.Unsigned_64; begin Value := Interfaces.Shift_Left (Interfaces.Unsigned_64 (Time.dwHighDateTime), 32); Value := Value + Interfaces.Unsigned_64 (Time.dwLowDateTime); Value := Value / TICKS_PER_SECOND; Value := Value - EPOCH_DIFFERENCE; return Types.Time_Type (Value); end To_Time; function Sys_Fstat (Fs : in File_Type; Stat : access Util.Systems.Types.Stat_Type) return Integer is Size : aliased Util.Systems.Types.off_t; Creation_Time : aliased FileTime; Access_Time : aliased FileTime; Write_Time : aliased FileTime; begin Stat.st_dev := 0; Stat.st_ino := 0; Stat.st_mode := 0; Stat.st_nlink := 0; Stat.st_uid := 0; Stat.st_gid := 0; Stat.st_rdev := 0; Stat.st_atime := 0; Stat.st_mtime := 0; Stat.st_ctime := 0; if Sys_GetFileSizeEx (Fs, Size'Access) = 0 then return -1; end if; if Sys_GetFileTime (Fs, Creation_Time'Access, Access_Time'Access, Write_Time'Access) = 0 then return -1; end if; Stat.st_size := Size; Stat.st_ctime := To_Time (Creation_Time); Stat.st_mtime := To_Time (Write_Time); Stat.st_atime := To_Time (Access_Time); return 0; end Sys_Fstat; -- Open a file function Sys_Open (Path : in Ptr; Flags : in Interfaces.C.int; Mode : in Util.Systems.Types.mode_t) return File_Type is pragma Unreferenced (Mode); function Has_Flag (M : in Interfaces.C.int; F : in Interfaces.C.int) return Boolean is ((Interfaces.Unsigned_32 (M) and Interfaces.Unsigned_32 (F)) /= 0); Sec : aliased Security_Attributes; Result : File_Type; Desired_Access : DWORD; Share_Mode : DWORD := FILE_SHARE_READ + FILE_SHARE_WRITE; Creation : DWORD; WPath : Wchar_Ptr; begin WPath := To_WSTR (Interfaces.C.Strings.Value (Path)); Sec.Length := Security_Attributes'Size / 8; Sec.Security_Descriptor := System.Null_Address; Sec.Inherit := (if Has_Flag (Flags, Util.Systems.Constants.O_CLOEXEC) then 0 else 1); if Has_Flag (Flags, O_WRONLY) then Desired_Access := GENERIC_WRITE; elsif Has_Flag (Flags, O_RDWR) then Desired_Access := GENERIC_READ + GENERIC_WRITE; else Desired_Access := GENERIC_READ; end if; if Has_Flag (Flags, O_CREAT) then if Has_Flag (Flags, O_EXCL) then Creation := CREATE_NEW; else Creation := CREATE_ALWAYS; end if; else Creation := OPEN_EXISTING; end if; if Has_Flag (Flags, O_APPEND) then Desired_Access := FILE_APPEND_DATA; end if; if Has_Flag (Flags, O_EXCL) then Share_Mode := 0; end if; Result := Create_File (WPath.all'Address, Desired_Access, Share_Mode, Sec'Unchecked_Access, Creation, FILE_ATTRIBUTE_NORMAL, NO_FILE); Free (WPath); return (if Result = INVALID_HANDLE_VALUE then NO_FILE else Result); end Sys_Open; function Sys_SetEndOfFile (Fs : in File_Type) return BOOL with Import => True, Convention => Stdcall, Link_Name => "SetEndOfFile"; function Sys_Ftruncate (Fs : in File_Type; Length : in Util.Systems.Types.off_t) return Integer is begin if Sys_Lseek (Fs, Length, Util.Systems.Types.SEEK_SET) < 0 then return -1; end if; if Sys_SetEndOfFile (Fs) = 0 then return -1; end if; return 0; end Sys_Ftruncate; function Sys_Fchmod (Fd : in File_Type; Mode : in Util.Systems.Types.mode_t) return Integer is pragma Unreferenced (Fd, Mode); begin return 0; end Sys_Fchmod; -- Close a file function Sys_Close (Fd : in File_Type) return Integer is begin if Close_Handle (Fd) = 0 then return -1; else return 0; end if; end Sys_Close; end Util.Systems.Os;
programs/oeis/118/A118827.asm
karttu/loda
0
169327
<gh_stars>0 ; A118827: 2-adic continued fraction of zero, where a(n) = 1 if n is odd, otherwise -2*A006519(n/2). ; 1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-16,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-32,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-16,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-64,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-16,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-32,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-16,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-128,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-16,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-32,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-16,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-64,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-16,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-32,1,-2,1,-4,1,-2,1,-8,1,-2,1,-4,1,-2,1,-16,1,-2,1,-4,1,-2,1,-8,1,-2 add $0,1 gcd $0,281474976710656 lpb $0,1 add $2,$0 mod $0,2 add $1,$2 lpe sub $0,$1 mov $1,$0
components/src/screen/ili9341/ili9341_regs.ads
rocher/Ada_Drivers_Library
192
21913
<filename>components/src/screen/ili9341/ili9341_regs.ads ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, 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. -- -- -- ------------------------------------------------------------------------------ package ILI9341_Regs is ILI9341_RESET : constant := 16#01#; ILI9341_SLEEP_OUT : constant := 16#11#; ILI9341_GAMMA : constant := 16#26#; ILI9341_DISPLAY_OFF : constant := 16#28#; ILI9341_DISPLAY_ON : constant := 16#29#; ILI9341_COLUMN_ADDR : constant := 16#2A#; ILI9341_PAGE_ADDR : constant := 16#2B#; ILI9341_GRAM : constant := 16#2C#; ILI9341_MAC : constant := 16#36#; ILI9341_PIXEL_FORMAT : constant := 16#3A#; ILI9341_WDB : constant := 16#51#; ILI9341_WCD : constant := 16#53#; ILI9341_RGB_INTERFACE : constant := 16#B0#; ILI9341_FRC : constant := 16#B1#; ILI9341_BPC : constant := 16#B5#; ILI9341_DFC : constant := 16#B6#; ILI9341_POWER1 : constant := 16#C0#; ILI9341_POWER2 : constant := 16#C1#; ILI9341_VCOM1 : constant := 16#C5#; ILI9341_VCOM2 : constant := 16#C7#; ILI9341_POWERA : constant := 16#CB#; ILI9341_POWERB : constant := 16#CF#; ILI9341_PGAMMA : constant := 16#E0#; ILI9341_NGAMMA : constant := 16#E1#; ILI9341_DTCA : constant := 16#E8#; ILI9341_DTCB : constant := 16#EA#; ILI9341_POWER_SEQ : constant := 16#ED#; ILI9341_3GAMMA_EN : constant := 16#F2#; ILI9341_INTERFACE : constant := 16#F6#; ILI9341_PRC : constant := 16#F7#; end ILI9341_Regs;
os.asm
thirdcoder/tca5
3
242712
<filename>os.asm NOP ; write to memory-mapped video LDA #%i1i1i .equ $wdddd video_start .equ $ddddd video_end STA video_start STA $wdddd STA $0zzzz STA $0zzzy STA $0zzzx STA $0zzzw STA $0zzz0 STA $0zzza .equ -3282 chargen .equ -3283 row .equ -3284 col .equ -3286 beep ; write to text character generator LDA #'X LDX #0 STX row LDY #4 STY col LDX #1 STA chargen ADC #2 STI A ; simple ternary inverter STA chargen ; trit-text red 'Z' LDX #4 INX STX col DEC chargen ; trit-text 'Y' TXA ; X->A, 5 ; setup stack, since default 0 overlaps with memory-mapped screen output .equ -10000 stack LDY #>stack LDX #<stack TXYS ; loop 6..19 loop: INC A STA col STA chargen CMP #20 ;BNE #-11 BNE loop LDA #1 STA row STZ col ; print greeting LDA #<greeting LDX #>greeting JSR print_string INC row STZ col LDA #<prompt_string LDX #>prompt_string JSR print_string ;STZ beep ; set input interrupt handler .equ -29524 int_inputL .equ -29523 int_inputH LDA #<handle_input STA int_inputL LDA #>handle_input STA int_inputH SEIP ; enable interrupt -1 (keyboard input) TODO: also handle int 1, then can unmask all with CLI ; set pulse interrupt handler .equ -29520 int_pulseL .equ -29519 int_pulseH LDA #<handle_pulse STA int_pulseL LDA #>handle_pulse STA int_pulseH CLI ; enable all interrupts LDA #'_ ; a suitable cursor character ;LDA #'▒ ; alternative block cursor TODO: use in 'insert' mode? STA cursor_char .equ -3285 timer_freq LDA #1 ; 100 ms ; cursor blink - disable when want quiescence (noisy) STA timer_freq ; triggers interrupt immediately.. TODO: probably should delay! or never returns? ; HALTZ cursor_char: .tryte 0 greeting: .data "Hello, world! ☺ 3502 CPU online: system ready---------------------------------------------" .tryte 0 prompt_string: ;TODO: support newlines in print_string '.tryte 12', // trit-text newline TODO: support embedding in .data .data "$ " .tryte 0 bad_command_string: .data "Bad command or file name: " .tryte 0 help_command_string: .data "Available commands: " .data "Help: " .data "beep - sound a beep through the speaker " .data "clear - clear terminal screen display " .data "help - show help on supported commands " .data "read - read data from floppy disk " .data "write - write data to floppy disk " .data "echo - echo input to terminal " .tryte 0 handle_pulse: ; blinking cursor LDA cursor_char STA chargen STI cursor_char ; simple ternary inverter, toggle red/green '_' RTI ; return from interrupt ; subroutine to advance terminal to next line next_line: INC row STZ col RTS handle_prev_line: DEC row LDA #44 ; TODO: .equ STA col JMP handled_input handle_backspace: JSR truncate_line_buffer BCS handle_backspace_denied ; if couldn't delete STZ chargen ; clear cursor DEC col LDA col CMP #-1 BEQ handle_prev_line STZ chargen JMP handled_input handle_backspace_denied: STZ beep ; user feedback that their backspacing was denied JMP handled_input handle_enter: STZ chargen ; clear cursor JSR next_line ; check commands TODO: strcmp, check full string instead of only first character LDY #0 LDA #'\0 CMP line_buffer,Y BEQ command_null LDA #'b CMP line_buffer,Y BEQ command_beep LDA #'c CMP line_buffer,Y BEQ command_clear LDA #'h CMP line_buffer,Y BEQ command_help LDA #'r CMP line_buffer,Y BEQ command_read LDA #'w CMP line_buffer,Y BEQ command_write LDA #'e CMP line_buffer,Y BEQ command_echo JMP command_bad handle_enter_done: JSR reset_line_buffer STZ col LDA #<prompt_string LDX #>prompt_string JSR print_string JMP handled_input ; interrupt handler: handle_input: CMP #'\n BEQ handle_enter CMP #0 BEQ handle_backspace JSR save_line_buffer_char JSR print_char handled_input: RTI command_bad: LDA #<bad_command_string LDX #>bad_command_string JSR print_string LDA #<line_buffer LDX #>line_buffer JSR print_string INC row JMP handle_enter_done command_help: LDA #<help_command_string LDX #>help_command_string JSR print_string JMP handle_enter_done command_beep: STA beep JMP handle_enter_done command_null: JMP handle_enter_done command_read: JMP command_read2 ; too far command_write: JMP command_write2 command_echo: LDA #<line_buffer LDX #>line_buffer JSR print_string INC row JMP handle_enter_done .equ 45 col_count .equ 28 row_count command_clear: STZ col STZ row _command_clear_next_row: _command_clear_next_col: STZ chargen ; write empty character at each cursor position to clear terminal TODO: instead write to tritmapped memory? INC col LDA col CMP #col_count BNE _command_clear_next_col INC row LDA row CMP #row_count BNE _command_clear_next_row STZ beep ; beep when done STZ col ; reset cursor to beginning STZ row JMP handle_enter_done ; append character in A to line_buffer save_line_buffer_char: LDY line_buffer_offset STA line_buffer,Y INC line_buffer_offset INY LDX #0 STX line_buffer,Y ; null terminate RTS line_buffer_offset: .tryte 0 ; reset line buffer to empty string reset_line_buffer: STZ line_buffer_offset STZ line_buffer RTS ; delete last character of line buffer, sets carry flag if cannot be deleted truncate_line_buffer: LDY line_buffer_offset DEY CPY #0 BMI _truncate_line_buffer_skip ; empty buffer, cannot truncate further STZ line_buffer,Y STY line_buffer_offset CLC RTS _truncate_line_buffer_skip: SECN RTS ; print character in A to screen and advance cursor print_char: STA chargen INC col LDX col CPX #col_count BNE print_char_done JSR next_line ; at last column, wrap cursor to next line print_char_done: RTS ; print a null-terminated string pointed to by A,X print_string: STA _print_string_param STX _print_string_param+1 LDY #0 _print_string_loop: LDA (_print_string_param),Y CMP #0 BEQ _print_string_done JSR print_char LDA #1 ADC _print_string_param STA _print_string_param LDA #0 ADC _print_string_param+1 STA _print_string_param+1 BRA _print_string_loop _print_string_done: RTS _print_string_param: .word 0 .equ -3290 floppy_data_ptr .equ -3292 floppy_name_ptr .equ -3294 floppy_length_ptr .equ -3296 floppy_command_execute .equ -1 floppy_command_read .equ 0 floppy_command_write ; write data to floppy (similar to echo text > filename TODO) command_write2: LDA #<line_buffer LDX #>line_buffer STA floppy_data_ptr ; TODO: increment pointer to remove command prefix STX floppy_data_ptr+1 LDA #<filename LDX #>filename STA floppy_name_ptr STX floppy_name_ptr+1 LDA #floppy_command_write STA floppy_command_execute ; TODO: print out number of trytes written? to filename? JMP handle_enter_done ; read data from floppy TODO: rename 'cat'...? Unix command_read2: LDA #<line_buffer LDX #>line_buffer STA floppy_data_ptr STX floppy_data_ptr+1 LDA #<filename LDX #>filename STA floppy_name_ptr STX floppy_name_ptr+1 LDA #floppy_command_read STA floppy_command_execute LDA #<line_buffer LDX #>line_buffer JSR print_string INC row STZ col JMP handle_enter_done ; floppy filename TODO: read from argument filename: .data "hi" .tryte 0 line_buffer: .tryte 0 ; may extend further
Math Expression/mathExp.g4
Ronney31/Antlr4-Basic
0
3253
<reponame>Ronney31/Antlr4-Basic grammar mathExp; /* * Parser Rules */ start : (exp NEWLINE)* ; exp : exp sym exp | num | '(' exp ')' ; num : (NUMBER)+ ; sym : SYMBOLS ; /* * Lexer Rules */ fragment DIGIT : [0-9] ; NUMBER : DIGIT+ ; SYMBOLS : ('+' | '-' | '*' | '/')+ ; NEWLINE : [\r\n]+ ;
lab3_test_harness/test/state_data_in/12.asm
Zaydax/PipelineProcessor
2
169810
.ORIG x1234 RSHFA R2, R7, #4 RSHFA R2, R7, #4 RSHFA R2, R7, #4 RSHFA R2, R7, #4 RSHFA R2, R7, #4 .END
src/ada/src/services/spark/avtas-lmcp-object-spark_boundary.ads
VVCAS-Sean/OpenUxAS
88
22452
<reponame>VVCAS-Sean/OpenUxAS package AVTAS.LMCP.object.SPARK_Boundary with SPARK_Mode is pragma Annotate (GNATprove, Terminating, SPARK_Boundary); type My_Object_Any is private; function Deref (X : My_Object_Any) return Object'Class with Global => null, Inline; function Wrap (X : Object_Any) return My_Object_Any with Global => null, Inline, SPARK_Mode => Off; function Unwrap (X : My_Object_Any) return Object_Any with Global => null, Inline, SPARK_Mode => Off; private pragma SPARK_Mode (Off); type My_Object_Any is new Object_Any; function Deref (X : My_Object_Any) return Object'Class is (X.all); function Wrap (X : Object_Any) return My_Object_Any is (My_Object_Any (X)); function Unwrap (X : My_Object_Any) return Object_Any is (Object_Any (X)); end AVTAS.LMCP.Object.SPARK_Boundary;
src/_demo/output_sink_as_shared_instance/apsepp_demo_output_sink_as_shared_instance.adb
thierr26/ada-apsepp
0
19543
-- Copyright (C) 2019 <NAME> <<EMAIL>> -- MIT license. Please refer to the LICENSE file. with Apsepp_Demo_OSASI_Instance_Controllers; use Apsepp_Demo_OSASI_Instance_Controllers; -- See comments in package bodies Apsepp_Demo_OSASI_Instance_Controllers and -- Apsepp_Demo_OSASI_Instance_Client. procedure Apsepp_Demo_Output_Sink_As_Shared_Instance is begin Show_Output_Sink_Instance_State; -- Output line A1. Output_Sink_Instance_Controller; Show_Output_Sink_Instance_State; -- Output line A4. Deeper_Output_Sink_Instance_Controller; Show_Output_Sink_Instance_State; -- Output line A6. Deeper_Output_Sink_Instance_Controller (J_P => True); Show_Output_Sink_Instance_State; -- Output line A8. end Apsepp_Demo_Output_Sink_As_Shared_Instance;
aflex/src/vaxvms/command_lineb.ada
irion7/aflex-ayacc-mirror
1
1184
<filename>aflex/src/vaxvms/command_lineb.ada<gh_stars>1-10 -- TITLE command line interface -- AUTHOR: <NAME> -- DESCRIPTION command line interface body for use with VAX/VMS -- NOTES this file is system dependent with Tstring; with Handle_Foreign_Command; package body Command_Line_Interface is subtype Argument_Number is Integer range 1 .. Max_Number_Args; procedure Handle (N : Argument_Number; A : String); procedure Process_Command_Line is new Handle_Foreign_Command (Argument_Count => Argument_Number, Handle_Argument => Handle); procedure Handle (N : Argument_Number; A : String) is begin Argv (N) := Tstring.Vstr (A); Argc := N + 1; end Handle; procedure Initialize_Command_Line is begin Argc := 1; Argv (0) := Tstring.Vstr ("Aflex"); Process_Command_Line; end Initialize_Command_Line; end Command_Line_Interface;
examples/ada/sl/unit/testposition.ads
rewriting/tom
36
24419
<filename>examples/ada/sl/unit/testposition.ads with PositionPackage, PathPackage, Ada.Text_IO, Ada.Assertions; use PositionPackage, PathPackage, Ada.Text_IO, Ada.Assertions; package TestPosition is procedure run_test; end TestPosition;
programs/oeis/274/A274427.asm
karttu/loda
0
171563
; A274427: Positions in A274426 of products of distinct Fibonacci numbers > 1. ; 1,2,4,5,7,8,11,12,13,16,17,18,22,23,24,25,29,30,31,32,37,38,39,40,41,46,47,48,49,50,56,57,58,59,60,61,67,68,69,70,71,72,79,80,81,82,83,84,85,92,93,94,95,96,97,98,106,107,108,109,110,111,112,113,121,122,123,124,125,126,127,128,137,138,139,140,141,142,143,144,145,154,155,156,157,158,159,160,161,162,172,173,174,175,176,177,178,179,180,181,191,192,193,194,195,196,197,198,199,200,211,212,213,214,215,216,217,218,219,220,221,232,233,234,235,236,237,238,239,240,241,242,254,255,256,257,258,259,260,261,262,263,264,265,277,278,279,280,281,282,283,284,285,286,287,288,301,302,303,304,305,306,307,308,309,310,311,312,313,326,327,328,329,330,331,332,333,334,335,336,337,338,352,353,354,355,356,357,358,359,360,361,362,363,364,365,379,380,381,382,383,384,385,386,387,388,389,390,391,392,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,466,467,468,469,470,471,472,473,474,475 mov $4,$0 add $4,1 mov $9,$0 lpb $4,1 mov $0,$9 sub $4,1 sub $0,$4 mov $5,$0 mov $7,2 lpb $7,1 mov $0,$5 sub $7,1 add $0,$7 sub $0,1 mov $10,$0 sub $10,$0 mul $0,2 lpb $0,1 sub $0,1 sub $0,$3 mov $2,$3 div $2,2 add $3,1 add $10,$2 lpe mov $2,$3 sub $3,2 sub $10,$3 mov $3,1 mov $8,$7 add $10,$2 mul $10,5 sub $10,9 div $10,5 lpb $8,1 mov $6,$10 sub $8,1 lpe lpe lpb $5,1 mov $5,0 sub $6,$10 lpe mov $10,$6 add $10,1 add $1,$10 lpe
programs/oeis/094/A094390.asm
neoneye/loda
22
82519
; A094390: A Beatty sequence using exp(Pi/4). ; 2,4,6,8,10,13,15,17,19,21,24,26,28,30,32,35,37,39,41,43,46,48,50,52,54,57,59,61,63,65,67,70,72,74,76,78,81,83,85,87,89,92,94,96,98,100,103,105,107,109,111,114,116,118,120,122,125,127,129,131,133,135,138,140 mov $1,$0 mul $0,6 add $0,5 div $0,31 add $0,2 mov $2,$1 mul $2,2 add $0,$2
programs/oeis/267/A267489.asm
karttu/loda
1
175801
; A267489: a(n) = n^2 - 4*floor(n^2/6). ; 0,1,4,5,8,9,12,17,24,29,36,41,48,57,68,77,88,97,108,121,136,149,164,177,192,209,228,245,264,281,300,321,344,365,388,409,432,457,484,509,536,561,588,617,648,677,708,737,768,801,836,869,904,937,972,1009,1048,1085,1124,1161,1200,1241,1284,1325,1368,1409,1452,1497,1544,1589,1636,1681,1728,1777,1828,1877,1928,1977,2028,2081,2136,2189,2244,2297,2352,2409,2468,2525,2584,2641,2700,2761,2824,2885,2948,3009,3072,3137,3204,3269,3336,3401,3468,3537,3608,3677,3748,3817,3888,3961,4036,4109,4184,4257,4332,4409,4488,4565,4644,4721,4800,4881,4964,5045,5128,5209,5292,5377,5464,5549,5636,5721,5808,5897,5988,6077,6168,6257,6348,6441,6536,6629,6724,6817,6912,7009,7108,7205,7304,7401,7500,7601,7704,7805,7908,8009,8112,8217,8324,8429,8536,8641,8748,8857,8968,9077,9188,9297,9408,9521,9636,9749,9864,9977,10092,10209,10328,10445,10564,10681,10800,10921,11044,11165,11288,11409,11532,11657,11784,11909,12036,12161,12288,12417,12548,12677,12808,12937,13068,13201,13336,13469,13604,13737,13872,14009,14148,14285,14424,14561,14700,14841,14984,15125,15268,15409,15552,15697,15844,15989,16136,16281,16428,16577,16728,16877,17028,17177,17328,17481,17636,17789,17944,18097,18252,18409,18568,18725,18884,19041,19200,19361,19524,19685,19848,20009,20172,20337,20504,20669 pow $0,2 mov $1,$0 div $0,6 mov $2,2 mul $2,$0 mul $2,2 sub $1,$2