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 |
|---|---|---|---|---|
examples.agda | guillaumebrunerie/general-type-theories | 0 | 16297 | <gh_stars>0
{-# OPTIONS --rewriting --prop #-}
open import common
open import syntx
open import derivability
open import structuralrules
open import typingrules
open import typetheories
module _ where
{- Π-Types + a dependent type -}
module _ where
TypingRuleΠ : TypingRule (TTDer ◇) ([] , (0 , Ty) , (1 , Ty)) Ty
TypingRuleΠ = Ty ([] , Ty []
, Ty ([] , (sym 0 [] / apr T 0 [])))
ΠUEl-TT1 : TypeTheory
ΠUEl-TT1 = ◇ , TypingRuleΠ
TypingRuleλ : TypingRule (TTDer ΠUEl-TT1) ([] , (0 , Ty) , (1 , Ty) , (1 , Tm)) Tm
TypingRuleλ = Tm ([] , Ty []
, Ty ([] , (sym 0 [] / apr T 0 []))
, Tm ([] , (sym 1 [] / apr T 1 []))
(sym 1 ([] , sym 0 []) /
apr T 1 ([] ,0Tm apr T 0 [])))
(sym 3 ([] , sym 2 [] , sym 1 ([] , var last)) /
apr T 3 ([] ,0Ty apr T 2 [] ,1Ty apr T 1 ([] ,0Tm apr S (var 0) ([] , apr T 2 []))))
ΠUEl-TT2 : TypeTheory
ΠUEl-TT2 = ΠUEl-TT1 , TypingRuleλ
TypingRuleapp : TypingRule (TTDer ΠUEl-TT2) ([] , (0 , Ty) , (1 , Ty) , (0 , Tm) , (0 , Tm)) Tm
TypingRuleapp = Tm ([] , Ty []
, Ty ([] , (sym 0 [] / apr T 0 []))
, Tm [] (sym 3 ([] , sym 1 [] , sym 0 ([] , var last)) /
apr T 3 ([] ,0Ty apr T 1 [] ,1Ty apr T 0 ([] ,0Tm apr S (var 0) ([] , apr T 1 []))))
, Tm [] (sym 2 [] / apr T 2 []))
(sym 2 ([] , sym 0 []) /
apr T 2 ([] ,0Tm apr T 0 []))
ΠUEl-TT3 : TypeTheory
ΠUEl-TT3 = ΠUEl-TT2 , TypingRuleapp
TypingRuleBeta : EqualityRule (TTDer ΠUEl-TT3) ([] , (0 , Ty) , (1 , Ty) , (1 , Tm) , (0 , Tm)) Tm
TypingRuleBeta = Tm= ([] , Ty []
, Ty ([] , sym 0 [] / apr T 0 [])
, Tm ([] , sym 1 [] / apr T 1 [])
(sym 1 ([] , sym 0 []) /
apr T 1 ([] ,0Tm apr T 0 []))
, Tm [] (sym 2 [] / apr T 2 []))
(sym 2 ([] , sym 0 []) <:
sym 4 ([] , sym 3 []
, sym 2 ([] , var last)
, sym 5 ([] , sym 3 [] , sym 2 ([] , var last) , sym 1 ([] , var last))
, sym 0 []) /
apr T 4 ([]
,0Ty apr T 3 []
,1Ty apr T 2 ([] ,0Tm apr S (var 0) ([] ,0Ty apr T 3 []))
,0Tm apr T 5 ([] ,0Ty apr T 3 []
,1Ty apr T 2 ([] ,0Tm apr S (var zero) ([] ,0Ty apr T 3 []))
,1Tm apr T 1 ([] ,0Tm apr S (var zero) ([] ,0Ty apr T 3 []))) {-{{((tt , (tt , tt)) , ((tt , refl) , tt)) , ((tt , refl) , (refl , tt)) , tt}}-}
,0Tm apr T 0 []) {-{{((((tt , (tt , tt)) , ((tt , refl) , tt)) , (tt , (refl , tt))) , (tt , (refl , tt))) , tt}}-}
// sym 1 ([] , sym 0 [])
/ apr T 1 ([] ,0Tm apr T 0 []))
ΠUEl-TT4 : TypeTheory
ΠUEl-TT4 = ΠUEl-TT3 ,= TypingRuleBeta
TypingRuleEta : EqualityRule (TTDer ΠUEl-TT4) ([] , (0 , Ty) , (1 , Ty) , (0 , Tm)) Tm
TypingRuleEta = Tm= ([] , Ty []
, Ty ([] , sym 0 [] / apr T 0 [])
, Tm [] (sym 4 ([] , sym 1 [] , sym 0 ([] , var last))
/ apr T 4 ([] ,0Ty apr T 1 [] ,1Ty apr T 0 ([] ,0Tm apr S (var 0) ([] ,0Ty apr T 1 [])))))
(sym 5 ([] , sym 2 [] , sym 1 ([] , var last))
<: sym 0 []
/ apr T 0 []
// sym 4 ([] , sym 2 [] , sym 1 ([] , var last) , sym 3 ([] , sym 2 [] , sym 1 ([] , var last) , sym 0 [] , var last))
/ apr T 4 ([] ,0Ty apr T 2 []
,1Ty apr T 1 ([] ,0Tm apr S (var 0) ([] ,0Ty apr T 2 []))
,1Tm apr T 3 ([] ,0Ty apr T 2 []
,1Ty apr T 1 ([] ,0Tm apr S (var 0) ([] ,0Ty apr T 2 []))
,0Tm apr T 0 []
,0Tm apr S (var 0) ([] ,0Ty apr T 2 []))))
ΠUEl-TT5 : TypeTheory
ΠUEl-TT5 = ΠUEl-TT4 ,= TypingRuleEta
TypingRuleU : TypingRule (TTDer ΠUEl-TT5) [] Ty
TypingRuleU = Ty []
ΠUEl-TT6 : TypeTheory
ΠUEl-TT6 = ΠUEl-TT5 , TypingRuleU
TypingRuleEl : TypingRule (TTDer ΠUEl-TT6) ([] , (0 , Tm)) Ty
TypingRuleEl = Ty ([] , Tm [] (sym 0 [] / apr T 0 []))
ΠUEl-TT : TypeTheory
ΠUEl-TT = ΠUEl-TT6 , TypingRuleEl
-- {- Natural numbers -}
-- module _ where
-- TypingRuleℕ : TypingRule (TTDer ◇) [] Ty
-- TypingRuleℕ = Ty []
-- ℕ-TT0 : TypeTheory
-- ℕ-TT0 = ◇ , TypingRuleℕ
-- TypingRule0 : TypingRule (TTDer ℕ-TT0) [] Tm
-- TypingRule0 = Tm [] (sym 0 [] / apr T 0 [])
-- ℕ-TT1 : TypeTheory
-- ℕ-TT1 = ℕ-TT0 , TypingRule0
-- TypingRuleS : TypingRule (TTDer ℕ-TT1) ([] , (0 , Tm)) Tm
-- TypingRuleS = Tm ([] , Tm [] (sym 1 [] / apr T 1 []))
-- (sym 2 [] / apr T 2 [])
-- ℕ-TT2 : TypeTheory
-- ℕ-TT2 = ℕ-TT1 , TypingRuleS
-- TypingRuleℕ-elim : TypingRule (TTDer ℕ-TT2) ([] , (1 , Ty) , (0 , Tm) , (2 , Tm) , (0 , Tm)) Tm
-- TypingRuleℕ-elim = Tm ([] , Ty ([] , sym 2 [] / apr T 2 [])
-- , Tm [] (sym 0 ([] , sym 2 []) / apr T 0 ([] ,0Tm apr T 2 []))
-- , Tm ([] , sym 4 [] / apr T 4 []
-- , sym 2 ([] , sym 0 []) / apr T 2 ([] ,0Tm apr T 0 []))
-- (sym 3 ([] , sym 4 ([] , sym 1 [])) /
-- apr T 3 ([] ,0Tm apr T 4 ([] ,0Tm apr T 1 [])))
-- , Tm [] (sym 5 [] / apr T 5 []))
-- (sym 3 ([] , (sym 0 [])) / apr T 3 ([] ,0Tm apr T 0 []))
-- ℕ-TT3 : TypeTheory
-- ℕ-TT3 = ℕ-TT2 , TypingRuleℕ-elim
-- TypingRuleℕ0-β : EqualityRule (TTDer ℕ-TT3) ([] , (1 , Ty) , (0 , Tm) , (2 , Tm)) Tm
-- TypingRuleℕ0-β = Tm= ([] , Ty ([] , (sym 3 [] / apr T 3 []))
-- , Tm [] (sym 0 ([] , sym 3 []) / apr T 0 ([] ,0Tm apr T 3 []))
-- , Tm ([] , (sym 5 [] / apr T 5 [])
-- , (sym 2 ([] , sym 0 []) / apr T 2 ([] ,0Tm apr T 0 [])))
-- (sym 3 ([] , sym 5 ([] , sym 1 [])) / apr T 3 ([] ,0Tm apr T 5 ([] ,0Tm apr T 1 []))))
-- (sym 2 ([] , sym 5 []) <: sym 3 ([] , sym 2 ([] , var last) , sym 1 [] , sym 0 ([] , var (prev last) , var last) , sym 5 [])
-- / apr T 3 ([] ,1Ty apr T 2 ([] ,0Tm apr S (var 0) ([] ,0Ty apr T 6 []))
-- ,0Tm apr T 1 []
-- ,2Tm apr T 0 ([] ,0Tm apr S (var 1) ([] ,0Ty apr T 6 [])
-- ,0Tm apr S (var 0) ([] ,0Ty apr T 2 ([] ,0Tm apr S (var 1) ([] ,0Ty apr T 6 []))))
-- ,0Tm apr T 5 [])
-- // sym 1 []
-- / apr T 1 [])
-- ℕ-TT4 : TypeTheory
-- ℕ-TT4 = ℕ-TT3 ,= TypingRuleℕ0-β
-- TypingRuleℕS-β : EqualityRule (TTDer ℕ-TT4) ([] , (1 , Ty) , (0 , Tm) , (2 , Tm) , (0 , Tm)) Tm
-- TypingRuleℕS-β = Tm= ([] , Ty ([] , (sym 3 [] / apr T 3 []))
-- , Tm [] (sym 0 ([] , sym 3 []) / apr T 0 ([] ,0Tm apr T 3 []))
-- , Tm ([] , (sym 5 [] / apr T 5 [])
-- , (sym 2 ([] , sym 0 []) / apr T 2 ([] ,0Tm apr T 0 [])))
-- (sym 3 ([] , sym 5 ([] , sym 1 [])) / apr T 3 ([] ,0Tm apr T 5 ([] ,0Tm apr T 1 [])))
-- , Tm [] (sym 6 [] / apr T 6 []))
-- (sym 3 ([] , sym 5 ([] , sym 0 []))
-- <: sym 4 ([] , sym 3 ([] , var last) , sym 2 [] , sym 1 ([] , var (prev last) , var last) , sym 5 ([] , sym 0 []))
-- / apr T 4 ([] ,1Ty apr T 3 ([] ,0Tm apr S (var 0) ([] ,0Ty apr T 7 [])) ,0Tm apr T 2 [] ,2Tm apr T 1 ([] ,0Tm apr S (var 1) ([] ,0Ty apr T 7 []) ,0Tm (apr S (var 0) ([] ,0Ty apr T 3 ([] ,0Tm apr S (var 1) ([] ,0Ty apr T 7 []))))) ,0Tm apr T 5 ([] ,0Tm apr T 0 []))
-- // sym 1 ([] , sym 0 [] , sym 4 ([] , sym 3 ([] , var last) , sym 2 [] , sym 1 ([] , var (prev last) , var last) , sym 0 []))
-- / apr T 1 ([] ,0Tm apr T 0 [] ,0Tm apr T 4 ([] ,1Ty apr T 3 ([] ,0Tm apr S (var 0) ([] ,0Ty apr T 7 [])) ,0Tm apr T 2 [] ,2Tm apr T 1 ([] ,0Tm apr S (var 1) ([] ,0Ty apr T 7 []) ,0Tm (apr S (var 0) ([] ,0Ty apr T 3 ([] ,0Tm apr S (var 1) ([] ,0Ty apr T 7 []))))) ,0Tm apr T 0 [])))
-- ℕ-TT5 : TypeTheory
-- ℕ-TT5 = ℕ-TT4 ,= TypingRuleℕS-β
|
programs/oeis/094/A094792.asm | neoneye/loda | 22 | 166573 | ; A094792: a(n) = (1/n!)*A001565(n).
; 2,11,32,71,134,227,356,527,746,1019,1352,1751,2222,2771,3404,4127,4946,5867,6896,8039,9302,10691,12212,13871,15674,17627,19736,22007,24446,27059,29852,32831,36002,39371,42944,46727,50726,54947,59396,64079
add $0,1
mov $1,$0
pow $1,2
add $1,2
mul $0,$1
sub $0,1
|
kern/i686/tasking/userspace_jump.asm | greck2908/LudOS | 44 | 246883 | <filename>kern/i686/tasking/userspace_jump.asm
global userspace_jump
userspace_jump:
cli ; disable instructions
pop esp ; reg_frame (= mov esp, [esp+0x0])
;;;;;;;;;;;;
pop gs ; segment registers
pop fs
pop es
pop ds
popad ; restore gprs
add esp, 8 ; int_no and err_code
iret ; to user land !
|
programs/oeis/319/A319526.asm | neoneye/loda | 22 | 3371 | ; A319526: Square array read by antidiagonals upwards: T(n,k) = sigma(n*k), n >= 1, k >= 1.
; 1,3,3,4,7,4,7,12,12,7,6,15,13,15,6,12,18,28,28,18,12,8,28,24,31,24,28,8,15,24,39,42,42,39,24,15,13,31,32,60,31,60,32,31,13,18,39,60,56,72,72,56,60,39,18,12,42,40,63,48,91,48,63,40,42,12,28,36,72,91,90,96,96,90,91,72,36,28
seq $0,59036 ; In a triangle of numbers (such as that in A059032, A059033, A059034) how many entries lie above position (n,k)? Answer: T(n,k) = (n+1)*(k+1)-1 (n >= 0, k >= 0).
seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
|
vasm/test.asm | Kannagi/AltairX | 17 | 14805 | ;syscall
;0x00
;kernel console ,read/write file
;0x01
;GIF
;0x02
;SIF
;0x03
;input (clavier/souris/joypad)
;0x04
;Net
;0x05
;GUI
include "macro.asm"
cmpi r8,1
|
experiments/algebra.agda | aronerben/agda-playground | 0 | 3460 | <reponame>aronerben/agda-playground
module algebra where
open import Relation.Binary.PropositionalEquality
open ≡-Reasoning
-- Goals are written as normalised
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
_+_ : ℕ → ℕ → ℕ
zero + y = y
suc x + y = suc (x + y)
record Semigroup (a : Set) : Set where
field
_⊛_ : a → a → a
assoc : ∀ a b c → (a ⊛ b) ⊛ c ≡ a ⊛ (b ⊛ c)
record Monoid (a : Set) : Set where
field
semigroup : Semigroup a
open Semigroup semigroup
field
e : a
idl : ∀ a → e ⊛ a ≡ a
idr : ∀ a → a ⊛ e ≡ a
record Group (a : Set) : Set where
field
monoid : Monoid a
open Monoid monoid
open Semigroup semigroup
field
-- TODO [aerben] fix this
invl : ∀ a ∃ b → a ⊛ b ≡ e
invr : ∀ a ∃ b → b ⊛ a ≡ e
record AbelianGroup (a : Set) : Set where
field
group : Group a
open Group group
open Monoid monoid
open Semigroup semigroup
field
commutative : ∀ a b → a ⊛ b ≡ b ⊛ a
record CommutativeSemigroup (a : Set) : Set where
field
_⊛_ : a → a → a
associative : ∀ a b c → (a ⊛ b) ⊛ c ≡ a ⊛ (b ⊛ c)
commutative : ∀ a b → a ⊛ b ≡ b ⊛ a
plusAssociative : ∀ a b c -> (a + b) + c ≡ a + (b + c)
-- Goal: (b + c) ≡ (b + c)
-- Follows from reflexivity
plusAssociative zero b c = refl
-- Goal: suc ((a + b) + c) ≡ suc (a + (b + c))
-- Inductive step
-- Follows from induction assumption and congruence
plusAssociative (suc a) b c =
begin
suc ((a + b) + c)
≡⟨ cong suc (plusAssociative a b c) ⟩
suc (a + (b + c))
∎
plusCommutativeLemma : ∀ a b -> a + suc b ≡ suc (a + b)
-- Goal: suc b ≡ suc b
-- Follows from reflexivity
plusCommutativeLemma zero b = refl
-- Goal: suc (a + suc b) ≡ suc (suc (a + b))
-- Inductive step
-- Follows from induction assumption and congruence
plusCommutativeLemma (suc a) b =
begin
suc (a + suc b)
≡⟨ cong suc (plusCommutativeLemma a b) ⟩
suc (suc (a + b))
∎
plusCommutative : ∀ a b -> a + b ≡ b + a
-- Goal: zero ≡ zero
-- Follows from reflexivity
plusCommutative zero zero = refl
-- Goal: suc (a + zero) ≡ suc a
-- One-sided inductive step
-- Follows from induction assumption and congruence
plusCommutative (suc a) zero =
begin
suc (a + zero)
≡⟨ cong suc (plusCommutative a zero) ⟩
suc a
∎
-- Goal: suc b ≡ suc (b + zero)
-- One-sided inductive step
-- Follows from induction assumption and congruence
plusCommutative zero (suc b) =
begin
suc b
≡⟨ cong suc (plusCommutative zero b) ⟩
suc (b + zero)
∎
-- plusCommutative (suc a) (suc b) rewrite plusCommutativeAux a b | plusCommutativeAux b a = cong suc (cong suc (plusCommutative a b))
-- Goal: suc (a + suc b) ≡ suc (b + suc a)
plusCommutative (suc a) (suc b) =
begin
suc (a + suc b)
≡⟨ cong suc (plusCommutativeLemma a b) ⟩
suc (suc (a + b))
≡⟨ cong suc (cong suc (plusCommutative a b)) ⟩
suc (suc (b + a))
-- Need to invoke symmetry since definitional equivalence does not guarantee it
≡⟨ cong suc (sym (plusCommutativeLemma b a)) ⟩
suc (b + suc a)
∎
plusSemigroup : CommutativeSemigroup ℕ
plusSemigroup = record
{ _⊛_ = _+_
; associative = plusAssociative
; commutative = plusCommutative
}
|
3-mid/physics/interface/source/motor/physics-motor-spring-angular.adb | charlie5/lace | 20 | 10273 | with physics.Conversion,
math.Algebra.linear.d3;
with physics.Vector_3;
with Ada.Text_IO; use Ada.Text_IO;
package body physics.Motor.spring.angular is
-- nb: based on PAL physics abstraction layer
--
procedure update (Self : in out Item)
is
use math.Algebra.linear.d3, physics.Conversion;
begin
--nb: this only applies to global position and orientation.
if self.is_Enabled then
-- find cross products of actual and desired forward, up, and right vectors; these represent the orientation error.
declare
use math.real_Arrays, math.Algebra.linear;
transform : math.Matrix_3x3 := +self.Rigid.Spin;
actualForward : math.Vector_3 := forward_Direction (transform);
actualUp : math.Vector_3 := up_Direction (transform);
actualRight : math.Vector_3 := right_Direction (transform);
begin
if Norm_squared (actualForward) /= 0.0 then actualForward := normalised (actualForward); end if;
if Norm_squared (actualUp) /= 0.0 then actualUp := normalised (actualUp); end if;
if Norm_squared (actualRight) /= 0.0 then actualRight := normalised (actualRight); end if;
declare
forwardError : math.Vector_3 := self.desiredForward * actualForward;
upError : math.Vector_3 := self.desiredUp * actualUp;
rightError : math.Vector_3 := self.desiredRight * actualRight;
begin
if Norm_squared (forwardError) /= 0.0 then forwardError := normalised (forwardError); end if;
if Norm_squared (upError) /= 0.0 then upError := normalised (upError); end if;
if Norm_squared (rightError) /= 0.0 then rightError := normalised (rightError); end if;
-- scale error vectors by the magnitude of the angles.
declare
use Math;
function to_Degrees (Self : in math.Vector_3) return math.Vector_3
is
begin
return Self * (180.0 / Pi);
-- return Self;
end;
f_angle : math.Real := math.Real (to_Degrees (angle_between_preNorm (self.desiredForward, actualForward)));
u_angle : math.Real := math.Real (to_Degrees (angle_between_preNorm (self.desiredUp, actualUp)));
r_angle : math.Real := math.Real (to_Degrees (angle_between_preNorm (self.desiredRight, actualRight)));
-- f_angle : math.Real := math.Real ( -(angle_between_preNorm (self.desiredForward, actualForward)));
-- u_angle : math.Real := math.Real ( -(angle_between_preNorm (self.desiredUp, actualUp)));
-- r_angle : math.Real := math.Real ( -(angle_between_preNorm (self.desiredRight, actualRight)));
begin
forwardError := forwardError * (-f_angle);
upError := upError * (-u_angle);
rightError := rightError * (-r_angle);
-- put_Line (math.Image (+self.Rigid.InvInertiaTensorWorld));
declare -- use the error vector to calculate torque.
one_Third : constant := 1.0 / 3.0;
error_Axis : math.Vector_3 := (forwardError + upError + rightError) * one_Third; -- average the vectors into one.
error_Term : math.Vector_3 := self.angularKs * error_Axis;
vel_Term : math.Vector_3 := self.angularKd * to_Degrees (+self.Rigid.Gyre);
-- the_Torque : math.Vector_3 := self.Rigid.inertia_Tensor * (error_Term - vel_Term); -- scale the torque vector by the Rigid's inertia tensor.
the_inv_Tensor : math.Matrix_3x3 := +self.Rigid.InvInertiaTensorWorld;
the_Torque : math.Vector_3 := (Inverse (the_inv_Tensor)) * (error_Term - vel_Term); -- scale the torque vector by the Rigid's inertia tensor.
-- the_Torque : math.Vector_3 := (error_Term - vel_Term) * Inverse (the_inv_Tensor); -- scale the torque vector by the Rigid's inertia tensor.
raw_Torque : aliased physics.Vector_3.item := +(20.0 * 256.0 * the_Torque * 180.0 / math.Pi);
begin
-- put_Line ("applying torque");
self.Rigid.apply_Torque (raw_Torque'unchecked_access); -- tbd: check this 'scale' factor
end;
end;
end;
end;
end if;
end;
-- procedure update (Self : in out Item)
-- is
-- use math.Algebra.linear.d3, physics.Conversion;
-- begin
-- --nb: this only applies to global position and orientation.
--
-- if self.is_Enabled then
-- -- find cross products of actual and desired forward, up, and right vectors; these represent the orientation error.
--
-- declare
-- use math.real_Arrays, math.Algebra.linear;
--
-- transform : math.Matrix_3x3 := +self.Rigid.Spin;
--
-- actualForward : math.Vector_3 := forward_Direction (transform);
-- actualUp : math.Vector_3 := up_Direction (transform);
-- actualRight : math.Vector_3 := right_Direction (transform);
-- begin
-- if Norm_squared (actualForward) /= 0.0 then actualForward := normalised (actualForward); end if;
-- if Norm_squared (actualUp) /= 0.0 then actualUp := normalised (actualUp); end if;
-- if Norm_squared (actualRight) /= 0.0 then actualRight := normalised (actualRight); end if;
--
-- declare
-- forwardError : math.Vector_3 := self.desiredForward * actualForward;
-- upError : math.Vector_3 := self.desiredUp * actualUp;
-- rightError : math.Vector_3 := self.desiredRight * actualRight;
-- begin
-- if Norm_squared (forwardError) /= 0.0 then forwardError := normalised (forwardError); end if;
-- if Norm_squared (upError) /= 0.0 then upError := normalised (upError); end if;
-- if Norm_squared (rightError) /= 0.0 then rightError := normalised (rightError); end if;
--
-- -- scale error vectors by the magnitude of the angles.
-- declare
-- use Math;
--
-- function to_Degrees (Self : in math.Vector_3) return math.Vector_3
-- is
-- begin
-- return Self * (180.0 / Pi);
-- -- return Self;
-- end;
--
-- f_angle : math.Real := math.Real (to_Degrees (angle_between_preNorm (self.desiredForward, actualForward)));
-- u_angle : math.Real := math.Real (to_Degrees (angle_between_preNorm (self.desiredUp, actualUp)));
-- r_angle : math.Real := math.Real (to_Degrees (angle_between_preNorm (self.desiredRight, actualRight)));
-- begin
-- forwardError := forwardError * (-f_angle);
-- upError := upError * (-u_angle);
-- rightError := rightError * (-r_angle);
--
-- -- put_Line (Image (+self.Rigid.InvInertiaTensorWorld));
--
-- declare -- use the error vector to calculate torque.
-- one_Third : constant := 1.0 / 3.0;
-- error_Axis : math.Vector_3 := (forwardError + upError + rightError) * one_Third; -- average the vectors into one.
-- error_Term : math.Vector_3 := self.angularKs * error_Axis;
-- vel_Term : math.Vector_3 := self.angularKd * to_Degrees (+self.Rigid.Gyre);
-- -- the_Torque : math.Vector_3 := self.Rigid.inertia_Tensor * (error_Term - vel_Term); -- scale the torque vector by the Rigid's inertia tensor.
--
-- the_inv_Tensor : math.Matrix_3x3 := +self.Rigid.InvInertiaTensorWorld;
-- the_Torque : math.Vector_3 := Inverse (the_inv_Tensor) * (error_Term - vel_Term); -- scale the torque vector by the Rigid's inertia tensor.
-- -- the_Torque : math.Vector_3 := (error_Term - vel_Term) * Inverse (the_inv_Tensor); -- scale the torque vector by the Rigid's inertia tensor.
--
-- raw_Torque : aliased physics.Vector_3.item := +(the_Torque * 180.0 / math.Pi);
-- begin
-- -- put_Line ("applying torque");
-- self.Rigid.apply_Torque (raw_Torque'unchecked_access); -- tbd: check this 'scale' factor
-- end;
-- end;
-- end;
-- end;
--
-- end if;
--
-- end;
--
--
-- void SpringMotor::setGlobalAttachPoint(const Point3r& p)
-- {
-- if (!mData.solid)
-- {
-- OPAL_LOGGER("warning") <<
-- "opal::SpringMotor::setGlobalAttachPoint: Solid pointer is \
-- invalid. Ignoring request." << std::endl;
-- return;
-- }
--
-- // Convert the global point to a local point offset from the Solid's
-- // transform.
-- Matrix44r inv = mData.solid->getTransform();
-- inv.invert();
-- mData.attachOffset = inv * p;
-- }
--
-- Point3r SpringMotor::getGlobalAttachPoint()const
-- {
-- if (!mData.solid)
-- {
-- OPAL_LOGGER("warning") <<
-- "opal::SpringMotor::getGlobalAttachPoint: Solid pointer is \
-- invalid. Returning (0,0,0)." << std::endl;
-- return Point3r();
-- }
--
-- // The global position is a combination of the Solid's global
-- // transform and the spring's local offset from the Solid's
-- // transform.
-- Point3r localPos(mData.attachOffset[0], mData.attachOffset[1],
-- mData.attachOffset[2]);
-- Point3r globalPos = mData.solid->getTransform() * localPos;
--
-- return globalPos;
-- }
--
-- void SpringMotor::setDesiredTransform(const Matrix44r& transform)
-- {
-- mData.desiredPos = transform.getPosition();
--
-- mData.desiredForward = transform.getForward();
-- if (0 != mData.desiredForward.lengthSquared())
-- {
-- mData.desiredForward.normalize();
-- }
--
-- mData.desiredUp = transform.getUp();
-- if (0 != mData.desiredUp.lengthSquared())
-- {
-- mData.desiredUp.normalize();
-- }
--
-- mData.desiredRight = transform.getRight();
-- if (0 != mData.desiredRight.lengthSquared())
-- {
-- mData.desiredRight.normalize();
-- }
-- }
--
--
-- void SpringMotor::setDesiredOrientation(const Vec3r& forward,
-- const Vec3r& up, const Vec3r& right)
-- {
-- mData.desiredForward = forward;
-- if (0 != mData.desiredForward.lengthSquared())
-- {
-- mData.desiredForward.normalize();
-- }
--
-- mData.desiredUp = up;
-- if (0 != mData.desiredUp.lengthSquared())
-- {
-- mData.desiredUp.normalize();
-- }
--
-- mData.desiredRight = right;
-- if (0 != mData.desiredRight.lengthSquared())
-- {
-- mData.desiredRight.normalize();
-- }
-- }
--
end physics.Motor.spring.angular;
|
oeis/075/A075183.asm | neoneye/loda-programs | 11 | 16754 | ; A075183: One half of third column of triangle A075181.
; Submitted by <NAME>
; 1,11,105,1020,10500,115920,1375920,17539200,239500800,3492720000,54226972800,893577484800,15583119552000,286816578048000,5557616064000000,113108602134528000,2412627824775168000
add $0,1
mov $2,$0
seq $0,120928 ; Number of "ups" and "downs" in the permutations of [n] if either a previous counted "up" ("down") or a "void" precedes an "up" ("down") which then will be counted also.
mul $0,$2
div $0,8
|
oeis/056/A056308.asm | neoneye/loda-programs | 11 | 12426 | ; A056308: Number of reversible strings with n beads using a maximum of six different colors.
; Submitted by <NAME>
; 1,6,21,126,666,3996,23436,140616,840456,5042736,30236976,181421856,1088414496,6530486976,39182222016,235093332096,1410555793536,8463334761216,50779983373056,304679900238336,1828079250264576,10968475501587456,65810852102532096,394865112615192576,2369190670249199616,14215144021495197696,85290864096319451136,511745184577916706816,3070471107271589830656,18422826643629538983936,110536959860601771442176,663221759163610628653056,3979330554974610997149696,23875983329847665982898176
mov $3,$0
seq $0,56452 ; a(n) = 6^floor((n+1)/2).
mov $2,6
pow $2,$3
add $0,$2
div $0,2
|
src/fixed_types-short.adb | gusthoff/fixed_types | 0 | 199 | -------------------------------------------------------------------------------
--
-- FIXED TYPES
--
-- Fixed_Short & Fixed_Sat_Short definitions
--
-- The MIT License (MIT)
--
-- Copyright (c) 2015 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to
-- deal in the Software without restriction, including without limitation the
-- rights to use, copy, modify, merge, publish, distribute, sublicense, and /
-- or sell copies of the Software, and to permit persons to whom the Software
-- is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-- IN THE SOFTWARE.
-------------------------------------------------------------------------------
-- with Ada.Text_IO; use Ada.Text_IO;
package body Fixed_Types.Short is
overriding
function "abs" (A : Fixed_Sat_Short) return Fixed_Sat_Short is
begin
if A = Fixed_Sat_Short'First then
return Fixed_Sat_Short'Last;
else
return Fixed_Sat_Short (abs Fixed_Short (A));
end if;
end "abs";
overriding
function "+" (A, B : Fixed_Sat_Short) return Fixed_Sat_Short is
pragma Suppress (Overflow_Check);
C : Fixed_Integer_Short;
Zero : constant Fixed_Integer_Short := 0;
begin
C := To_Fixed_Integer_Short (A) + To_Fixed_Integer_Short (B);
if A > 0.0 and then B > 0.0 and then C < Zero then
return Fixed_Sat_Short'Last;
elsif A < 0.0 and then B < 0.0 and then C > Zero then
return Fixed_Sat_Short'First;
else
return To_Fixed_Sat_Short (C);
end if;
end "+";
overriding
function "-" (A, B : Fixed_Sat_Short) return Fixed_Sat_Short is
pragma Suppress (Overflow_Check);
C : Fixed_Integer_Short;
Zero : constant Fixed_Integer_Short := 0;
begin
C := To_Fixed_Integer_Short (A) - To_Fixed_Integer_Short (B);
if A > 0.0 and then B < 0.0 and then C < Zero then
return Fixed_Sat_Short'Last;
elsif A < 0.0 and then B > 0.0 and then C > Zero then
return Fixed_Sat_Short'First;
else
return To_Fixed_Sat_Short (C);
end if;
end "-";
overriding
function "-" (A : Fixed_Sat_Short) return Fixed_Sat_Short is
pragma Suppress (Overflow_Check);
begin
if A = Fixed_Sat_Short'First then
return Fixed_Sat_Short'Last;
else
return Fixed_Sat_Short (-Fixed_Short (A));
end if;
end "-";
not overriding
function "*" (A, B : Fixed_Sat_Short) return Fixed_Sat_Short is
pragma Suppress (Overflow_Check);
begin
if A = Fixed_Sat_Short'First and then B = Fixed_Sat_Short'First then
return Fixed_Sat_Short'Last;
else
return Fixed_Sat_Short (Fixed_Short (A) * Fixed_Short (B));
end if;
end "*";
overriding
function "*" (A : Fixed_Sat_Short; B : Integer) return Fixed_Sat_Short is
pragma Unsuppress (Overflow_Check);
begin
return Fixed_Sat_Short (Fixed_Short (A) * B);
exception
when Constraint_Error =>
if (A > 0.0 and B > 0) or (A < 0.0 and B < 0) then
return Fixed_Sat_Short'Last;
else
return Fixed_Sat_Short'First;
end if;
end "*";
end Fixed_Types.Short;
|
os/windows/x86_64/fpu/fpu_cmp_f_32.asm | hcs64/cen64 | 340 | 22798 | <reponame>hcs64/cen64<gh_stars>100-1000
;
; os/windows/x86_64/fpu/fpu_cmp_f_32.asm
;
; This file is subject to the terms and conditions defined in
; 'LICENSE', which is part of this source code package.
;
.code
fpu_cmp_f_32 proc
movss xmm0, DWORD PTR [rdx]
movss xmm1, DWORD PTR [rdx]
comiss xmm1, xmm0
ret
fpu_cmp_f_32 endp
end
|
Commands/Miscellaneous Commands suite/system info/physical memory of (get system info).applescript | looking-for-a-job/applescript-examples | 1 | 454 | <filename>Commands/Miscellaneous Commands suite/system info/physical memory of (get system info).applescript
#!/usr/bin/osascript
physical memory of (get system info) |
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sccz80/esx_m_tapein_setpos.asm | Toysoft/z88dk | 0 | 161002 | <reponame>Toysoft/z88dk
; unsigned char esx_m_tapein_setpos(uint16_t block)
SECTION code_esxdos
PUBLIC esx_m_tapein_setpos
EXTERN asm_esx_m_tapein_setpos
defc esx_m_tapein_setpos = asm_esx_m_tapein_setpos
|
Task/Sorting-algorithms-Radix-sort/Ada/sorting-algorithms-radix-sort.ada | LaudateCorpus1/RosettaCodeData | 1 | 14785 | <filename>Task/Sorting-algorithms-Radix-sort/Ada/sorting-algorithms-radix-sort.ada
with Ada.Text_IO;
procedure Radix_Sort is
type Integer_Array is array (Positive range <>) of Integer;
procedure Least_Significant_Radix_Sort (Data : in out Integer_Array; Base : Positive := 10) is
type Bucket is record
Count : Natural := 0;
Content : Integer_Array (Data'Range);
end record;
subtype Bucket_Index is Integer range -Base + 1 .. Base - 1;
type Bucket_Array is array (Bucket_Index) of Bucket;
procedure Append (To : in out Bucket; Item : Integer) is
begin
To.Count := To.Count + 1;
To.Content (To.Count) := Item;
end Append;
function Get_Nth_Digit (Value : Integer; N : Positive) return Integer is
Result : Integer := (Value / (Base ** (N - 1))) mod Base;
begin
if Value < 0 then
Result := -Result;
end if;
return Result;
end Get_Nth_Digit;
function Get_Maximum return Natural is
Result : Natural := 0;
begin
for I in Data'Range loop
if abs (Data (I)) > Result then
Result := abs (Data (I));
end if;
end loop;
return Result;
end Get_Maximum;
function Split (Pass : Positive) return Bucket_Array is
Buckets : Bucket_Array;
begin
for I in Data'Range loop
Append (To => Buckets (Get_Nth_Digit (Data (I), Pass)),
Item => Data (I));
end loop;
return Buckets;
end Split;
function Merge (Buckets : Bucket_Array) return Integer_Array is
Result : Integer_Array (Data'Range);
Current_Index : Positive := 1;
begin
for Sublist in Buckets'Range loop
for Item in 1 .. Buckets (Sublist).Count loop
Result (Current_Index) := Buckets (Sublist).Content (Item);
Current_Index := Current_Index + 1;
end loop;
end loop;
return Result;
end Merge;
Max_Number : Natural := Get_Maximum;
Digit_Count : Positive := 1;
begin
-- count digits of biggest number
while Max_Number > Base loop
Digit_Count := Digit_Count + 1;
Max_Number := Max_Number / Base;
end loop;
for Pass in 1 .. Digit_Count loop
Data := Merge (Split (Pass));
end loop;
end Least_Significant_Radix_Sort;
Test_Array : Integer_Array := (170, 45, 75, -90, -802, 24, 2, 66);
begin
Least_Significant_Radix_Sort (Test_Array, 4);
for I in Test_Array'Range loop
Ada.Text_IO.Put (Integer'Image (Test_Array (I)));
end loop;
Ada.Text_IO.New_Line;
end Radix_Sort;
|
roms/mbc_test/mbc_test.asm | gerikkub/gameboycart | 0 | 243438 | <gh_stars>0
SECTION "graphics", ROMX[$4000], BANK[1]
db $00, $18, $24, $24, $24, $24, $18, $00
db $00, $18, $38, $18, $18, $18, $3C, $00
db $00, $38, $44, $04, $08, $10, $3C, $00
db $00, $18, $24, $04, $38, $04, $38, $00
db $00, $24, $24, $24, $3C, $04, $04, $00
db $00, $3C, $20, $20, $3C, $04, $3C, $00
db $00, $1C, $20, $20, $38, $24, $18, $00
db $00, $3C, $02, $04, $08, $10, $20, $00
db $00, $3C, $42, $42, $3C, $42, $3C, $00
db $00, $18, $24, $24, $18, $04, $18, $00
db $00, $18, $24, $24, $3C, $24, $24, $00
db $00, $20, $20, $20, $38, $24, $38, $00
db $00, $3C, $40, $40, $40, $40, $3C, $00
db $00, $78, $44, $44, $44, $44, $78, $00
db $00, $3C, $20, $20, $3C, $20, $3C, $00
db $00, $3C, $20, $20, $3C, $20, $20, $00
SECTION "start",ROM0[$100]
start:
nop
jp main
SECTION "title",ROM0[$134]
db "SMILEY"
SECTION "mbc", ROMX,BANK[2]
db $A5, $98
SECTION "mbc2", ROMX,BANK[3]
db $29, $F7
SECTION "main",ROM0[$150]
main:
ld hl, $FFFE
ld sp, hl
ld hl, $FF44
ld a, [hl]
cp a, 144
jp nz, main
ld hl, $FF40
ld [hl], (1 | (1 << 7))
;ld h, $98
;ld l, 32
;ld [hl], 1
;inc hl
;ld [hl], 2
;inc hl
;ld [hl], 3
;inc hl
;ld [hl], 4
;inc hl
;ld [hl], 5
;inc hl
;ld [hl], 6
;inc hl
;ld [hl], 7
;inc hl
;ld [hl], 8
;inc hl
;ld [hl], 9
;inc hl
;ld [hl], $A
;inc hl
;ld [hl], $B
;inc hl
;ld [hl], $C
;inc hl
;ld [hl], $D
;inc hl
;ld [hl], $E
;inc hl
;ld [hl], $F
;inc hl
;ld [hl], $10
ld h, $90
ld l, 16
ld b, 64
ld de, $4000
loop1:
ld a, [de]
inc de
ld [hl+], a
ld [hl+], a
dec b
jp nz, loop1
loop2_start:
ld hl, $FF44
ld a, [hl]
cp a, 144
jp nz, loop2_start
ld h, $90
ld l, 144
ld b, 64
ld de, $4040
loop2:
ld a, [de]
inc de
ld [hl+], a
ld [hl+], a
dec b
jp nz, loop2
ld hl, $FF47
ld [hl], $E4
;ld h, $21
;ld l, $00
;ld a, 3
;nop
;nop
;nop
;nop
;ld [hl], a
;inc a
;ld [hl], a
;inc a
;ld [hl], a
;inc a
;ld [hl], a
;inc a
;ld [hl], a
;inc a
;ld [hl], a
;inc a
;ld [hl], a
;inc a
;ld [hl], a
;ld a, 2
;ld b, 0
;call get_bank_byte
;ld b, 0
;call write_byte
;ld a, 2
;ld b, 1
;call get_bank_byte
;ld b, 3
;call write_byte
;ld a, 3
;ld b, 0
;call get_bank_byte
;ld b, 32
;call write_byte
;ld a, 3
;ld b, 1
;call get_bank_byte
;ld b, 35
;call write_byte
ld h, $01
ld l, $00
ld a, $A
ld [hl], a
ld d, 0
loop_read:
ld h, $A0
ld l, $40
ld b, $8E
ld [hl], b
ld a, d
sla a
sla a
sla a
sla a
sla a
ld b, a
ld a, [hl]
call write_byte
inc d
ld a, d
cp a, $8
jp nz, loop_read
end:
jp end
get_bank_byte:
ld h, $21
ld l, $00
ld [hl], a
ld h, $40
ld l, b
ld a, [hl]
ret
write_byte:
ld c, a
write_byte_sync_video
ld hl, $FF44
ld a, [hl]
cp a, 144
jp nz, write_byte_sync_video
ld h, $98
ld l, b
ld a, c
and a, $F0
srl a
srl a
srl a
srl a
inc a
ld [hl+], a
ld a, c
and a, $F
inc a
ld [hl+], a
ret
|
container/w.agda | HoTT/M-types | 27 | 5063 | <filename>container/w.agda
module container.w where
open import container.w.core public
open import container.w.algebra public
open import container.w.fibration public
|
misc/_tmp/set_flag.applescript | kinshuk4/evernote-automation | 4 | 1523 | <reponame>kinshuk4/evernote-automation
on run {flag}
if "" = flag then
return false
end if
set is_set to run script (POSIX file "/Users/IceHe/Documents/AppleScript/Lib/get_flag.applescript") with parameters {flag as string}
if is_set then
return true
end if
do shell script ("mkdir /Users/IceHe/Documents/Registry/Flag/" & flag)
set is_set to run script (POSIX file "/Users/IceHe/Documents/AppleScript/Lib/get_flag.applescript") with parameters {flag}
if not is_set then
return false
end if
return true
end run |
src/fot/FOTC/Program/Mirror/Forest/TotalityATP.agda | asr/fotc | 11 | 7934 | <reponame>asr/fotc
------------------------------------------------------------------------------
-- Totality properties for Forest
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Program.Mirror.Forest.TotalityATP where
open import FOTC.Base
open import FOTC.Base.List
open import FOTC.Data.List
open import FOTC.Program.Mirror.Type
------------------------------------------------------------------------------
++-Forest : ∀ {xs ys} → Forest xs → Forest ys → Forest (xs ++ ys)
++-Forest {ys = ys} fnil Fys = prf
where postulate prf : Forest ([] ++ ys)
{-# ATP prove prf #-}
++-Forest {ys = ys} (fcons {x} {xs} Tx Fxs) Fys = prf (++-Forest Fxs Fys)
where postulate prf : Forest (xs ++ ys) →
Forest ((x ∷ xs) ++ ys)
{-# ATP prove prf #-}
-- We don't use a combined proof, because it is necessary to erase a
-- proof term which we don't know how to erase.
map-Forest : ∀ {xs} f → (∀ {x} → Tree x → Tree (f · x)) →
Forest xs → Forest (map f xs)
map-Forest f fTree fnil = subst Forest (sym (map-[] f)) fnil
map-Forest f fTree (fcons {x} {xs} Tx Fxs) =
subst Forest
(sym (map-∷ f x xs))
(fcons (fTree Tx) (map-Forest f fTree Fxs))
rev-Forest : ∀ {xs ys} → Forest xs → Forest ys → Forest (rev xs ys)
rev-Forest {ys = ys} fnil Fys = prf
where postulate prf : Forest (rev [] ys)
{-# ATP prove prf #-}
rev-Forest {ys = ys} (fcons {x} {xs} Tx Fxs) Fys =
prf (rev-Forest Fxs (fcons Tx Fys))
where postulate prf : Forest (rev xs (x ∷ ys)) →
Forest (rev (x ∷ xs) ys)
{-# ATP prove prf #-}
postulate reverse-Forest : ∀ {xs} → Forest xs → Forest (reverse xs)
{-# ATP prove reverse-Forest rev-Forest #-}
|
oeis/290/A290612.asm | neoneye/loda-programs | 11 | 101965 | ; A290612: Number of maximal independent vertex sets (and minimal vertex covers) in the n-wheel graph.
; Submitted by <NAME>
; 4,3,6,6,8,11,13,18,23,30,40,52,69,91,120,159,210,278,368,487,645,854,1131,1498,1984,2628,3481,4611,6108,8091,10718,14198,18808,24915,33005,43722,57919,76726,101640,134644,178365,236283,313008,414647,549290,727654,963936
mov $1,1
lpb $0
sub $0,1
add $2,$3
mov $4,$3
mov $3,$1
mov $1,$2
add $4,2
mov $2,$4
lpe
mov $0,$1
add $0,3
|
Wizardry/Necessary/GrowthGetters/Get_Luk_Growth.asm | sme23/OneHourBlitz | 1 | 90424 | <filename>Wizardry/Necessary/GrowthGetters/Get_Luk_Growth.asm<gh_stars>1-10
.thumb
.org 0x0
.equ ClassGrowthOption, Extra_Growth_Boosts+4
@r0=battle struct or char data ptr
ldr r1,[r0]
add r1,#34
ldrb r1,[r1] @luk growth
ldr r2,ClassGrowthOption
cmp r2,#0
beq GetExtraGrowthBoost
ldr r2,[r0,#4]
add r2,#33
ldrb r2,[r2]
add r1,r2
GetExtraGrowthBoost:
mov r2,#16 @index of luk boost
ldr r3,Extra_Growth_Boosts
bx r3
.align
Extra_Growth_Boosts:
@
|
thirdparty/adasdl/thin/adasdl/AdaSDL_framebuff/sdltests/testlock.adb | Lucretia/old_nehe_ada95 | 0 | 13466 |
-- ----------------------------------------------------------------- --
-- --
-- This is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This software 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 --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- ----------------------------------------------------------------- --
-- ----------------------------------------------------------------- --
-- This is a translation, to the Ada programming language, of the --
-- original C test files written by <NAME> - www.libsdl.org --
-- translation made by <NAME> - www.adapower.net/~avargas --
-- ----------------------------------------------------------------- --
with System.OS_Interface;
with Interfaces.C.Strings;
with Lib_C;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.OS_Lib;
with SDL.Error;
with SDL.Quit;
with SDL.Mutex;
with SDL.Types; use SDL.Types;
with SDL.Thread;
with TestLock_Sprogs;
use TestLock_Sprogs;
procedure TestLock is
package C renames Interfaces.C;
use type C.int;
package CS renames Interfaces.C.Strings;
package Er renames SDL.Error;
package M renames SDL.Mutex;
use type M.mutex_ptr;
package T renames SDL.Thread;
use type T.SDL_Thread_ptr;
maxproc : Integer := 6;
Dummy_int : C.int;
begin
-- Load the SDL library
if SDL.Init (0) < 0 then
Put_Line (Er.Get_Error);
GNAT.OS_Lib.OS_Exit (1);
end if;
SDL.Quit.atexit (SDL.SDL_Quit'Access);
mutex := M.CreateMutex;
if mutex = M.null_mutex_ptr then
Put_Line ("Couldn't create mutex: " & Er.Get_Error);
GNAT.OS_Lib.OS_Exit (1);
end if;
mainthread := T.ThreadID;
Put_Line ("Main thread: " & Uint32'Image (mainthread));
SDL.Quit.atexit (printid'Access);
for i in 0 .. maxproc - 1 loop
threads (i) := T.CreateThread (Run'Access, System.Null_Address);
if threads (i) = T.null_SDL_Thread_ptr then
Put_Line ("Couldn't create thread!");
end if;
end loop;
Lib_C.Set_Signal (System.OS_Interface.SIGINT, terminating'Access);
Dummy_int := Run (System.Null_Address);
GNAT.OS_Lib.OS_Exit (0); -- Never reached
end TestLock;
|
programs/oeis/037/A037552.asm | karttu/loda | 0 | 2711 | ; A037552: Base 3 digits are, in order, the first n terms of the periodic sequence with initial period 2,1,1.
; 2,7,22,68,205,616,1850,5551,16654,49964,149893,449680,1349042,4047127,12141382,36424148,109272445,327817336,983452010,2950356031,8851068094,26553204284,79659612853,238978838560,716936515682
add $0,1
mov $2,8
lpb $0,1
sub $0,1
mul $2,3
mov $1,$2
add $1,6
mov $2,$1
div $1,13
lpe
|
mc-sema/validator/x86_64/tests/ADD64ri32.asm | randolphwong/mcsema | 2 | 85888 | <gh_stars>1-10
BITS 64
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=
;TEST_FILE_META_END
; Add64RI32
mov rax, 0x2
;TEST_BEGIN_RECORDING
add rax, 0x7f1111
;TEST_END_RECORDING
|
src/Category/Instance.agda | banacorn/categories | 1 | 15092 | module Category.Instance where
open import Level
open import Category.Core
𝟙 : Category _ _
𝟙 = record
{ Objects = record
{ Carrier = ⊤
; _≈_ = λ _ _ → ⊤
; isEquivalence = _
}
; Morphisms = record
{ Carrier = λ x → ⊤
; _≈_ = λ _ _ → ⊤
; isEquivalence = _
; _∘_ = λ _ _ → tt
; id = λ a → tt
; isMorphism = _
}
}
where
open import Data.Unit
-- "pointing" an element with a functor from 𝟙
point : ∀ {𝒸 ℓ} → {C : Category 𝒸 ℓ} → Category.Object C → Functor 𝟙 C
point {_} {_} {C} c = record
{ mapObject = λ _ → c
; mapMorphism = λ _ → id c
; isFunctor = record
{ preserve-id = λ a → MorphEq.refl
; preserve-∘ = λ _ _ → MorphEq.sym (left-identity (id c))
}
}
where
open Category C
open import Relation.Binary.Indexed
module MorphEq = IsEquivalence (MorphismStructure.isEquivalence Morphisms)
open IsMorphism isMorphism
-- the identity functo
identity : ∀ {𝒸 ℓ} → (C : Category 𝒸 ℓ) → Functor C C
identity C = record
{ mapObject = λ x → x
; mapMorphism = λ x → x
; isFunctor = record
{ preserve-id = λ a → MorphEq.refl
; preserve-∘ = λ f g → MorphEq.refl
}
}
where
open Category C
open import Relation.Binary.Indexed
module MorphEq = IsEquivalence (MorphismStructure.isEquivalence Morphisms)
open IsMorphism isMorphism
|
ada-iterator_interfaces.ads | mgrojo/adalib | 15 | 14409 | <filename>ada-iterator_interfaces.ads
-- Standard Ada library specification
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
generic
type Cursor;
with function Has_Element (Position : Cursor) return Boolean;
package Ada.Iterator_Interfaces is
pragma Pure (Iterator_Interfaces);
type Forward_Iterator is limited interface;
function First (Object : Forward_Iterator) return Cursor is abstract;
function Next (Object : Forward_Iterator; Position : Cursor)
return Cursor is abstract;
type Reversible_Iterator is limited interface and Forward_Iterator;
function Last (Object : Reversible_Iterator) return Cursor is abstract;
function Previous (Object : Reversible_Iterator; Position : Cursor)
return Cursor is abstract;
end Ada.Iterator_Interfaces;
|
lib/asm/aes_aesni_sse2.asm | zhouyan/MCKL | 12 | 242031 | ;;============================================================================
;; MCKL/lib/asm/aes_aesni_sse2.asm
;;----------------------------------------------------------------------------
;; MCKL: Monte Carlo Kernel Library
;;----------------------------------------------------------------------------
;; Copyright (c) 2013-2018, <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.
;;
;; 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.
;;============================================================================
global mckl_aes128_aesni_sse2_kernel
global mckl_aes192_aesni_sse2_kernel
global mckl_aes256_aesni_sse2_kernel
global mckl_ars_aesni_sse2_kernel
default rel
%macro encfirst 1
pxor xmm0, %1
pxor xmm1, %1
pxor xmm2, %1
pxor xmm3, %1
pxor xmm4, %1
pxor xmm5, %1
pxor xmm6, %1
pxor xmm7, %1
%endmacro
%macro enc 1
aesenc xmm0, %1
aesenc xmm1, %1
aesenc xmm2, %1
aesenc xmm3, %1
aesenc xmm4, %1
aesenc xmm5, %1
aesenc xmm6, %1
aesenc xmm7, %1
%endmacro
%macro enclast 1
aesenclast xmm0, %1
aesenclast xmm1, %1
aesenclast xmm2, %1
aesenclast xmm3, %1
aesenclast xmm4, %1
aesenclast xmm5, %1
aesenclast xmm6, %1
aesenclast xmm7, %1
%endmacro
%macro generate 1 ; rounds
movdqa xmm0, xmm8
movdqa xmm1, xmm8
movdqa xmm2, xmm8
movdqa xmm3, xmm8
movdqa xmm4, xmm8
movdqa xmm5, xmm8
movdqa xmm6, xmm8
movdqa xmm7, xmm8
paddq xmm0, [increment + 0x00]
paddq xmm1, [increment + 0x10]
paddq xmm2, [increment + 0x20]
paddq xmm3, [increment + 0x30]
paddq xmm4, [increment + 0x40]
paddq xmm5, [increment + 0x50]
paddq xmm6, [increment + 0x60]
paddq xmm7, [increment + 0x70]
paddq xmm8, [increment + 0x80]
encfirst xmm10
enc xmm11
enc xmm12
enc xmm13
enc xmm14
%if %1 > 5
%assign r 0
%rep %1 - 5
movdqa xmm9, [rsp + r * 0x10]
enc xmm9
%assign r r + 1
%endrep
%endif
enclast xmm15
%endmacro
; rdi:ctr.data()
; rsi:n
; rdx:r
; rcx:ks.get().data()/weyl:key
%macro kernel 1 ; rounds
push rbp
mov rbp, rsp
%if %1 > 5
sub rsp, (%1 - 5) * 0x10
%endif
cld
; early return
test rsi, rsi
jz .return
; parameter processing, leave rdi, rsi, rcx free for moving memory
mov rax, rsi ; n
mov r8, rdi ; ctr
mov r9, rcx ; key.get().data()/weyl:key
; load counter
movdqu xmm8, [r8]
add [r8], rax
%if %1 == 5 ; ARS: load weyl and key, compute round_key
movdqu xmm9, [r9 + 0x00] ; weyl
movdqu xmm10, [r9 + 0x10] ; round_key[0]
movdqa xmm11, xmm10
paddq xmm11, xmm9 ; round_key[1]
movdqa xmm12, xmm11
paddq xmm12, xmm9 ; round_key[2]
movdqa xmm13, xmm12
paddq xmm13, xmm9 ; round_key[3]
movdqa xmm14, xmm13
paddq xmm14, xmm9 ; round_key[4]
movdqa xmm15, xmm14
paddq xmm15, xmm9 ; round_key[5]
%else ; AES: load round_key
movdqu xmm10, [r9 + 0x00] ; round_key[0]
movdqu xmm11, [r9 + 0x10] ; round_key[1]
movdqu xmm12, [r9 + 0x20] ; round_key[2]
movdqu xmm13, [r9 + 0x30] ; round_key[3]
movdqu xmm14, [r9 + 0x40] ; round_key[4]
movdqu xmm15, [r9 + %1 * 0x10] ; round_key[rounds]
%if %1 > 5
mov rcx, (%1 - 5) * 2
lea rsi, [r9 + 0x50]
mov rdi, rsp
rep movsq
%endif
%endif
cmp rax, 8
jl .last
align 16
.loop:
generate %1
movdqu [rdx + 0x00], xmm0
movdqu [rdx + 0x10], xmm1
movdqu [rdx + 0x20], xmm2
movdqu [rdx + 0x30], xmm3
movdqu [rdx + 0x40], xmm4
movdqu [rdx + 0x50], xmm5
movdqu [rdx + 0x60], xmm6
movdqu [rdx + 0x70], xmm7
add rdx, 0x80
sub rax, 8
cmp rax, 8
jge .loop
.last:
test rax, rax
jz .return
generate %1
movdqa [rsp - 0x80], xmm0
movdqa [rsp - 0x70], xmm1
movdqa [rsp - 0x60], xmm2
movdqa [rsp - 0x50], xmm3
movdqa [rsp - 0x40], xmm4
movdqa [rsp - 0x30], xmm5
movdqa [rsp - 0x20], xmm6
movdqa [rsp - 0x10], xmm7
lea rcx, [rax + rax]
lea rsi, [rsp - 0x80]
mov rdi, rdx
rep movsq
.return:
mov rsp, rbp
pop rbp
ret
%endmacro
section .rodata
align 16
increment:
dq 0x01, 0x00
dq 0x02, 0x00
dq 0x03, 0x00
dq 0x04, 0x00
dq 0x05, 0x00
dq 0x06, 0x00
dq 0x07, 0x00
dq 0x08, 0x00
dq 0x08, 0x00
section .text
mckl_aes128_aesni_sse2_kernel: kernel 10
mckl_aes192_aesni_sse2_kernel: kernel 12
mckl_aes256_aesni_sse2_kernel: kernel 14
mckl_ars_aesni_sse2_kernel: kernel 5
; vim:ft=nasm
|
alloy4fun_models/trainstlt/models/5/xKee2HzkfhHA927eo.als | Kaixi26/org.alloytools.alloy | 0 | 5003 | open main
pred idxKee2HzkfhHA927eo_prop6 {
all s : Signal | always (s in Green implies s not in Green') or (s not in Green implies s in Green')
}
pred __repair { idxKee2HzkfhHA927eo_prop6 }
check __repair { idxKee2HzkfhHA927eo_prop6 <=> prop6o } |
programs/oeis/322/A322783.asm | neoneye/loda | 22 | 81581 | <filename>programs/oeis/322/A322783.asm
; A322783: a(n) = 1 - n + (2^(n+2) - (-1)^n)/3.
; 2,3,4,9,18,39,80,165,334,675,1356,2721,5450,10911,21832,43677,87366,174747,349508,699033,1398082,2796183,5592384,11184789,22369598,44739219,89478460,178956945,357913914,715827855,1431655736
sub $1,$0
lpb $0
mov $2,2
pow $2,$0
trn $0,2
add $1,$2
lpe
add $1,2
mov $0,$1
|
scripts/CinnabarGym.asm | opiter09/ASM-Machina | 1 | 243127 | <reponame>opiter09/ASM-Machina
CinnabarGym_Script:
call CinnabarGymSetMapAndTiles
call EnableAutoTextBoxDrawing
ld hl, CinnabarGym_ScriptPointers
ld a, [wCinnabarGymCurScript]
jp CallFunctionInTable
CinnabarGymSetMapAndTiles:
ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
push hl
call nz, .LoadNames
pop hl
bit 5, [hl]
res 5, [hl]
call nz, UpdateCinnabarGymGateTileBlocks
ResetEvent EVENT_2A7
ret
.LoadNames:
ld hl, .CityName
ld de, .LeaderName
jp LoadGymLeaderAndCityName
.CityName:
db "CINNABAR ISLAND@"
.LeaderName:
db "BLAINE@"
CinnabarGymResetScripts:
xor a
ld [wJoyIgnore], a
ld [wCinnabarGymCurScript], a
ld [wCurMapScript], a
ld [wOpponentAfterWrongAnswer], a
ret
CinnabarGymSetTrainerHeader:
ldh a, [hSpriteIndexOrTextID]
ld [wTrainerHeaderFlagBit], a
ret
CinnabarGym_ScriptPointers:
dw CinnabarGymScript0
dw CinnabarGymScript1
dw CinnabarGymScript2
dw CinnabarGymBlainePostBattle
CinnabarGymScript0:
ld a, [wOpponentAfterWrongAnswer]
and a
ret z
ldh [hSpriteIndex], a
cp $4
jr nz, .asm_757c3
ld a, PLAYER_DIR_DOWN
ld [wPlayerMovingDirection], a
ld de, MovementNpcToLeftAndUp
jr .MoveSprite
.asm_757c3
ld de, MovementNpcToLeft
ld a, PLAYER_DIR_RIGHT
ld [wPlayerMovingDirection], a
.MoveSprite
call MoveSprite
ld a, $1
ld [wCinnabarGymCurScript], a
ld [wCurMapScript], a
ret
MovementNpcToLeftAndUp:
db NPC_MOVEMENT_LEFT
db NPC_MOVEMENT_UP
db -1 ; end
MovementNpcToLeft:
db NPC_MOVEMENT_LEFT
db -1 ; end
CinnabarGymScript1:
ld a, [wd730]
bit 0, a
ret nz
xor a
ld [wJoyIgnore], a
ld a, [wOpponentAfterWrongAnswer]
ld [wTrainerHeaderFlagBit], a
ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
CinnabarGymFlagAction:
predef_jump FlagActionPredef
CinnabarGymScript2:
ld a, [wIsInBattle]
cp $ff
jp z, CinnabarGymResetScripts
ld a, [wTrainerHeaderFlagBit]
ldh [hGymGateIndex], a
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
ld c, a
ld b, FLAG_TEST
EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0
call CinnabarGymFlagAction
ld a, c
and a
jr nz, .asm_7581b
call WaitForSoundToFinish
ld a, SFX_GO_INSIDE
call PlaySound
call WaitForSoundToFinish
.asm_7581b
ld a, [wTrainerHeaderFlagBit]
ldh [hGymGateIndex], a
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
ld c, a
ld b, FLAG_SET
EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0
call CinnabarGymFlagAction
ld a, [wTrainerHeaderFlagBit]
sub $2
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a
ld b, FLAG_SET
EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED
call CinnabarGymFlagAction
call UpdateCinnabarGymGateTileBlocks
xor a
ld [wJoyIgnore], a
ld [wOpponentAfterWrongAnswer], a
ld a, $0
ld [wCinnabarGymCurScript], a
ld [wCurMapScript], a
ret
CinnabarGymBlainePostBattle:
ld a, [wIsInBattle]
cp $ff
jp z, CinnabarGymResetScripts
ld a, $f0
ld [wJoyIgnore], a
; fallthrough
CinnabarGymReceiveTM38:
ld a, $a
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_BEAT_BLAINE
lb bc, TM_FIRE_BLAST, 1
call GiveItem
jr nc, .BagFull
ld a, $b
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_TM38
jr .gymVictory
.BagFull
ld a, $c
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.gymVictory
ld hl, wObtainedBadges
set BIT_VOLCANOBADGE, [hl]
ld hl, wBeatGymFlags
set BIT_VOLCANOBADGE, [hl]
; deactivate gym trainers
SetEventRange EVENT_BEAT_CINNABAR_GYM_TRAINER_0, EVENT_BEAT_CINNABAR_GYM_TRAINER_6
ld hl, wCurrentMapScriptFlags
set 5, [hl]
jp CinnabarGymResetScripts
CinnabarGym_TextPointers:
dw BlaineText
dw CinnabarGymTrainerText1
dw CinnabarGymTrainerText2
dw CinnabarGymTrainerText3
dw CinnabarGymTrainerText4
dw CinnabarGymTrainerText5
dw CinnabarGymTrainerText6
dw CinnabarGymTrainerText7
dw CinnabarGymGuideText
dw BlaineVolcanoBadgeInfoText
dw ReceivedTM38Text
dw TM38NoRoomText
CinnabarGymScript_758b7:
ldh a, [hSpriteIndexOrTextID]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
ld hl, wd72d
set 6, [hl]
set 7, [hl]
ld a, [wSpriteIndex]
cp $1
jr z, .asm_758d4
ld a, $2
jr .asm_758d6
.asm_758d4
ld a, $3
.asm_758d6
ld [wCinnabarGymCurScript], a
ld [wCurMapScript], a
jp TextScriptEnd
BlaineText:
text_asm
CheckEvent EVENT_BEAT_BLAINE
jr z, .beforeBeat
CheckEventReuseA EVENT_GOT_TM38
jr nz, .afterBeat
call z, CinnabarGymReceiveTM38
call DisableWaitingAfterTextDisplay
jp TextScriptEnd
.afterBeat
ld hl, BlainePostBattleAdviceText
call PrintText
jp TextScriptEnd
.beforeBeat
ld hl, BlainePreBattleText
call PrintText
ld hl, ReceivedVolcanoBadgeText
ld de, ReceivedVolcanoBadgeText
call SaveEndBattleTextPointers
ld a, $7
ld [wGymLeaderNo], a
jp CinnabarGymScript_758b7
BlainePreBattleText:
text_far _BlainePreBattleText
text_end
ReceivedVolcanoBadgeText:
text_far _ReceivedVolcanoBadgeText
sound_get_key_item ; actually plays the second channel of SFX_BALL_POOF due to the wrong music bank being loaded
text_waitbutton
text_end
BlainePostBattleAdviceText:
text_far _BlainePostBattleAdviceText
text_end
BlaineVolcanoBadgeInfoText:
text_far _BlaineVolcanoBadgeInfoText
text_end
ReceivedTM38Text:
text_far _ReceivedTM38Text
sound_get_item_1
text_far _TM38ExplanationText
text_end
TM38NoRoomText:
text_far _TM38NoRoomText
text_end
CinnabarGymTrainerText1:
text_asm
call CinnabarGymSetTrainerHeader
CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_0
jr nz, .asm_46bb4
ld hl, CinnabarGymBattleText2
call PrintText
ld hl, CinnabarGymEndBattleText2
ld de, CinnabarGymEndBattleText2
call SaveEndBattleTextPointers
jp CinnabarGymScript_758b7
.asm_46bb4
ld hl, CinnabarGymAfterBattleText2
call PrintText
jp TextScriptEnd
CinnabarGymBattleText2:
text_far _CinnabarGymBattleText2
text_end
CinnabarGymEndBattleText2:
text_far _CinnabarGymEndBattleText2
text_end
CinnabarGymAfterBattleText2:
text_far _CinnabarGymAfterBattleText2
text_end
CinnabarGymTrainerText2:
text_asm
call CinnabarGymSetTrainerHeader
CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_1
jr nz, .asm_4b406
ld hl, CinnabarGymBattleText1
call PrintText
ld hl, CinnabarGymEndBattleText1
ld de, CinnabarGymEndBattleText1
call SaveEndBattleTextPointers
jp CinnabarGymScript_758b7
.asm_4b406
ld hl, CinnabarGymAfterBattleText1
call PrintText
jp TextScriptEnd
CinnabarGymBattleText1:
text_far _CinnabarGymBattleText1
text_end
CinnabarGymEndBattleText1:
text_far _CinnabarGymEndBattleText1
text_end
CinnabarGymAfterBattleText1:
text_far _CinnabarGymAfterBattleText1
text_end
CinnabarGymTrainerText3:
text_asm
call CinnabarGymSetTrainerHeader
CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_2
jr nz, .afterBeat
ld hl, CinnabarGymBattleText3
call PrintText
ld hl, CinnabarGymEndBattleText3
ld de, CinnabarGymEndBattleText3
call SaveEndBattleTextPointers
jp CinnabarGymScript_758b7
.afterBeat
ld hl, CinnabarGymAfterBattleText3
call PrintText
jp TextScriptEnd
CinnabarGymBattleText3:
text_far _CinnabarGymBattleText3
text_end
CinnabarGymEndBattleText3:
text_far _CinnabarGymEndBattleText3
text_end
CinnabarGymAfterBattleText3:
text_far _CinnabarGymAfterBattleText3
text_end
CinnabarGymTrainerText4:
text_asm
call CinnabarGymSetTrainerHeader
CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_3
jr nz, .afterBeat
ld hl, CinnabarGymBattleText4
call PrintText
ld hl, CinnabarGymEndBattleText4
ld de, CinnabarGymEndBattleText4
call SaveEndBattleTextPointers
jp CinnabarGymScript_758b7
.afterBeat
ld hl, CinnabarGymAfterBattleText4
call PrintText
jp TextScriptEnd
CinnabarGymBattleText4:
text_far _CinnabarGymBattleText4
text_end
CinnabarGymEndBattleText4:
text_far _CinnabarGymEndBattleText4
text_end
CinnabarGymAfterBattleText4:
text_far _CinnabarGymAfterBattleText4
text_end
CinnabarGymTrainerText5:
text_asm
call CinnabarGymSetTrainerHeader
CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_4
jr nz, .afterBeat
ld hl, CinnabarGymBattleText5
call PrintText
ld hl, CinnabarGymEndBattleText5
ld de, CinnabarGymEndBattleText5
call SaveEndBattleTextPointers
jp CinnabarGymScript_758b7
.afterBeat
ld hl, CinnabarGymAfterBattleText5
call PrintText
jp TextScriptEnd
CinnabarGymBattleText5:
text_far _CinnabarGymBattleText5
text_end
CinnabarGymEndBattleText5:
text_far _CinnabarGymEndBattleText5
text_end
CinnabarGymAfterBattleText5:
text_far _CinnabarGymAfterBattleText5
text_end
CinnabarGymTrainerText6:
text_asm
call CinnabarGymSetTrainerHeader
CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_5
jr nz, .afterBeat
ld hl, CinnabarGymBattleText6
call PrintText
ld hl, CinnabarGymEndBattleText6
ld de, CinnabarGymEndBattleText6
call SaveEndBattleTextPointers
jp CinnabarGymScript_758b7
.afterBeat
ld hl, CinnabarGymAfterBattleText6
call PrintText
jp TextScriptEnd
CinnabarGymBattleText6:
text_far _CinnabarGymBattleText6
text_end
CinnabarGymEndBattleText6:
text_far _CinnabarGymEndBattleText6
text_end
CinnabarGymAfterBattleText6:
text_far _CinnabarGymAfterBattleText6
text_end
CinnabarGymTrainerText7:
text_asm
call CinnabarGymSetTrainerHeader
CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_6
jr nz, .afterBeat
ld hl, CinnabarGymBattleText7
call PrintText
ld hl, CinnabarGymEndBattleText7
ld de, CinnabarGymEndBattleText7
call SaveEndBattleTextPointers
jp CinnabarGymScript_758b7
.afterBeat
ld hl, CinnabarGymAfterBattleText7
call PrintText
jp TextScriptEnd
CinnabarGymBattleText7:
text_far _CinnabarGymBattleText7
text_end
CinnabarGymEndBattleText7:
text_far _CinnabarGymEndBattleText7
text_end
CinnabarGymAfterBattleText7:
text_far _CinnabarGymAfterBattleText7
text_end
CinnabarGymGuideText:
text_asm
CheckEvent EVENT_BEAT_BLAINE
jr nz, .afterBeat
ld hl, CinnabarGymGuidePreBattleText
jr .done
.afterBeat
ld hl, CinnabarGymGuidePostBattleText
.done
call PrintText
jp TextScriptEnd
CinnabarGymGuidePreBattleText:
text_far _CinnabarGymGuidePreBattleText
text_end
CinnabarGymGuidePostBattleText:
text_far _CinnabarGymGuidePostBattleText
text_end
|
src/fot/FOTC/Data/Nat/PropertiesByInductionATP.agda | asr/fotc | 11 | 3655 | <reponame>asr/fotc
------------------------------------------------------------------------------
-- Arithmetic properties (using induction on the FOTC natural numbers type)
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- Usually our proofs use pattern matching instead of the induction
-- principle associated with the FOTC natural numbers. The following
-- examples show some proofs using it.
module FOTC.Data.Nat.PropertiesByInductionATP where
open import FOTC.Base
open import FOTC.Data.Nat
------------------------------------------------------------------------------
+-leftIdentity : ∀ n → zero + n ≡ n
+-leftIdentity n = +-0x n
-- See Issue https://github.com/asr/apia/issues/81 .
+-rightIdentityA : D → Set
+-rightIdentityA i = i + zero ≡ i
{-# ATP definition +-rightIdentityA #-}
+-rightIdentity : ∀ {n} → N n → n + zero ≡ n
+-rightIdentity Nn = N-ind +-rightIdentityA A0 is Nn
where
postulate A0 : +-rightIdentityA zero
{-# ATP prove A0 #-}
postulate is : ∀ {i} → +-rightIdentityA i → +-rightIdentityA (succ₁ i)
{-# ATP prove is #-}
-- See Issue https://github.com/asr/apia/issues/81 .
+-NA : D → D → Set
+-NA n i = N (i + n)
{-# ATP definition +-NA #-}
+-N : ∀ {m n} → N m → N n → N (m + n)
+-N {n = n} Nm Nn = N-ind (+-NA n) A0 is Nm
where
postulate A0 : +-NA n zero
{-# ATP prove A0 #-}
postulate is : ∀ {i} → +-NA n i → +-NA n (succ₁ i)
{-# ATP prove is #-}
-- See Issue https://github.com/asr/apia/issues/81 .
+-assocA : D → D → D → Set
+-assocA n o i = i + n + o ≡ i + (n + o)
{-# ATP definition +-assocA #-}
+-assoc : ∀ {m} → N m → ∀ n o → m + n + o ≡ m + (n + o)
+-assoc Nm n o = N-ind (+-assocA n o) A0 is Nm
where
postulate A0 : +-assocA n o zero
{-# ATP prove A0 #-}
postulate is : ∀ {i} → +-assocA n o i → +-assocA n o (succ₁ i)
{-# ATP prove is #-}
-- A proof without use ATPs definitions.
+-assoc' : ∀ {m} → N m → ∀ n o → m + n + o ≡ m + (n + o)
+-assoc' Nm n o = N-ind A A0 is Nm
where
A : D → Set
A i = i + n + o ≡ i + (n + o)
postulate A0 : zero + n + o ≡ zero + (n + o)
{-# ATP prove A0 #-}
postulate is : ∀ {i} →
i + n + o ≡ i + (n + o) →
succ₁ i + n + o ≡ succ₁ i + (n + o)
{-# ATP prove is #-}
-- See Issue https://github.com/asr/apia/issues/81 .
x+Sy≡S[x+y]A : D → D → Set
x+Sy≡S[x+y]A n i = i + succ₁ n ≡ succ₁ (i + n)
{-# ATP definition x+Sy≡S[x+y]A #-}
x+Sy≡S[x+y] : ∀ {m} → N m → ∀ n → m + succ₁ n ≡ succ₁ (m + n)
x+Sy≡S[x+y] Nm n = N-ind (x+Sy≡S[x+y]A n) A0 is Nm
where
postulate A0 : x+Sy≡S[x+y]A n zero
{-# ATP prove A0 #-}
postulate is : ∀ {i} → x+Sy≡S[x+y]A n i → x+Sy≡S[x+y]A n (succ₁ i)
{-# ATP prove is #-}
-- See Issue https://github.com/asr/apia/issues/81 .
+-commA : D → D → Set
+-commA n i = i + n ≡ n + i
{-# ATP definition +-commA #-}
+-comm : ∀ {m n} → N m → N n → m + n ≡ n + m
+-comm {n = n} Nm Nn = N-ind (+-commA n) A0 is Nm
where
postulate A0 : +-commA n zero
{-# ATP prove A0 +-rightIdentity #-}
postulate is : ∀ {i} → +-commA n i → +-commA n (succ₁ i)
{-# ATP prove is x+Sy≡S[x+y] #-}
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2052.asm | ljhsiun2/medusa | 9 | 100175 | <filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2052.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r8
push %rbp
push %rdi
push %rsi
lea addresses_normal_ht+0x1ae6b, %r15
nop
nop
cmp %r12, %r12
mov (%r15), %r8d
nop
nop
nop
sub $18159, %rbp
lea addresses_normal_ht+0xf9db, %r13
nop
nop
nop
nop
nop
xor $63996, %rsi
mov (%r13), %di
nop
nop
nop
nop
nop
add %r15, %r15
lea addresses_WC_ht+0x152eb, %r12
nop
nop
dec %r13
movb (%r12), %r15b
nop
nop
nop
nop
nop
cmp $36312, %rbp
lea addresses_D_ht+0x11b8b, %r13
nop
nop
nop
nop
dec %r8
mov (%r13), %esi
nop
and %rbp, %rbp
lea addresses_WT_ht+0x3e0b, %r15
clflush (%r15)
nop
nop
nop
nop
add $31651, %r13
mov (%r15), %r12
dec %r12
lea addresses_WC_ht+0x6c6b, %r12
nop
nop
nop
nop
xor $7832, %r8
movups (%r12), %xmm2
vpextrq $1, %xmm2, %r15
nop
nop
inc %rdi
pop %rsi
pop %rdi
pop %rbp
pop %r8
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r9
push %rax
push %rbx
push %rsi
// Store
lea addresses_A+0x15ceb, %r12
nop
nop
nop
nop
dec %rbx
movw $0x5152, (%r12)
nop
nop
nop
nop
and $35570, %rsi
// Store
lea addresses_WC+0x1382b, %r12
nop
nop
nop
xor $39713, %r9
mov $0x5152535455565758, %rbx
movq %rbx, %xmm3
movups %xmm3, (%r12)
nop
nop
xor $36568, %rbx
// Faulty Load
lea addresses_A+0x15ceb, %rsi
nop
nop
nop
nop
add $17254, %r10
movups (%rsi), %xmm7
vpextrq $1, %xmm7, %r9
lea oracles, %r10
and $0xff, %r9
shlq $12, %r9
mov (%r10,%r9,1), %r9
pop %rsi
pop %rbx
pop %rax
pop %r9
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
lib/aflexnat/misc.ads | alvaromb/Compilemon | 1 | 24048 | -- 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: /co/ua/self/arcadia/aflex/ada/src/RCS/miscS.a,v 1.9 90/01/12 15:20:19 self Exp Locker: self $
with misc_defs, tstring, text_io;
package misc is
use MISC_DEFS;
use TSTRING;
use TEXT_IO;
procedure ACTION_OUT;
procedure BUBBLE(V : in INT_PTR;
N : in INTEGER);
function CLOWER(C : in INTEGER) return INTEGER;
procedure CSHELL(V : in out CHAR_ARRAY;
N : in INTEGER);
procedure DATAEND;
procedure DATAFLUSH;
procedure DATAFLUSH(FILE : in FILE_TYPE);
function AFLEX_GETTIME return VSTRING;
procedure AFLEXERROR(MSG : in VSTRING);
procedure AFLEXERROR(MSG : in STRING);
function ALL_UPPER(STR : in VSTRING) return BOOLEAN;
function ALL_LOWER(STR : in VSTRING) return BOOLEAN;
procedure AFLEXFATAL(MSG : in VSTRING);
procedure AFLEXFATAL(MSG : in STRING);
procedure LINE_DIRECTIVE_OUT;
procedure LINE_DIRECTIVE_OUT(OUTPUT_FILE_NAME : in FILE_TYPE);
procedure MK2DATA(VALUE : in INTEGER);
procedure MK2DATA(FILE : in FILE_TYPE;
VALUE : in INTEGER);
procedure MKDATA(VALUE : in INTEGER);
function MYCTOI(NUM_ARRAY : in VSTRING) return INTEGER;
function MYESC(ARR : in VSTRING) return CHARACTER;
function OTOI(STR : in VSTRING) return CHARACTER;
function READABLE_FORM(C : in CHARACTER) return VSTRING;
procedure SYNERR(STR : in STRING);
procedure TRANSITION_STRUCT_OUT(ELEMENT_V, ELEMENT_N : in INTEGER);
function SET_YY_TRAILING_HEAD_MASK(SRC : in INTEGER) return INTEGER;
function CHECK_YY_TRAILING_HEAD_MASK(SRC : in INTEGER) return INTEGER;
function SET_YY_TRAILING_MASK(SRC : in INTEGER) return INTEGER;
function CHECK_YY_TRAILING_MASK(SRC : in INTEGER) return INTEGER;
function ISLOWER(C : in CHARACTER) return BOOLEAN;
function ISUPPER(C : in CHARACTER) return BOOLEAN;
function ISDIGIT(C : in CHARACTER) return BOOLEAN;
function TOLOWER(C : in INTEGER) return INTEGER;
function BASENAME return VSTRING;
end misc;
|
awa/plugins/awa-wikis/src/awa-wikis-previews.adb | stcarrez/ada-awa | 81 | 11918 | -----------------------------------------------------------------------
-- awa-wikis-previews -- Wiki preview management
-- Copyright (C) 2015, 2018, 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 Ada.Strings.Unbounded;
with Util.Log.Loggers;
with Util.Beans.Objects;
with Util.Files;
with Util.Processes;
with Util.Streams.Pipes;
with Util.Streams.Texts;
with EL.Contexts.TLS;
with Servlet.Core;
with ASF.Requests.Mockup;
with ASF.Responses.Mockup;
with AWA.Applications;
with AWA.Modules.Get;
package body AWA.Wikis.Previews is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Wikis.Preview");
-- ------------------------------
-- The worker procedure that performs the preview job.
-- ------------------------------
procedure Preview_Worker (Job : in out AWA.Jobs.Services.Abstract_Job_Type'Class) is
Previewer : constant Preview_Module_Access := Get_Preview_Module;
begin
Previewer.Do_Preview_Job (Job);
end Preview_Worker;
-- ------------------------------
-- Initialize the wikis module.
-- ------------------------------
overriding
procedure Initialize (Plugin : in out Preview_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config) is
begin
Log.Info ("Initializing the wiki preview module");
AWA.Modules.Module (Plugin).Initialize (App, Props);
end Initialize;
-- ------------------------------
-- Configures the module after its initialization and after having read its XML configuration.
-- ------------------------------
overriding
procedure Configure (Plugin : in out Preview_Module;
Props : in ASF.Applications.Config) is
pragma Unreferenced (Props);
begin
Plugin.Template := Plugin.Get_Config (PARAM_PREVIEW_TEMPLATE);
Plugin.Command := Plugin.Get_Config (PARAM_PREVIEW_COMMAND);
Plugin.Html := Plugin.Get_Config (PARAM_PREVIEW_HTML);
Plugin.Add_Listener (AWA.Wikis.Modules.NAME, Plugin'Unchecked_Access);
Plugin.Job_Module := AWA.Jobs.Modules.Get_Job_Module;
Plugin.Job_Module.Register (Definition => Preview_Job_Definition.Factory);
end Configure;
-- ------------------------------
-- Execute the preview job and make the thumbnail preview. The page is first rendered in
-- an HTML text file and the preview is rendered by using an external command.
-- ------------------------------
procedure Do_Preview_Job (Plugin : in Preview_Module;
Job : in out AWA.Jobs.Services.Abstract_Job_Type'Class) is
pragma Unreferenced (Job);
use Util.Beans.Objects;
Ctx : constant EL.Contexts.ELContext_Access := EL.Contexts.TLS.Current;
Template : constant String := To_String (Plugin.Template.Get_Value (Ctx.all));
Command : constant String := To_String (Plugin.Command.Get_Value (Ctx.all));
Html_File : constant String := To_String (Plugin.Html.Get_Value (Ctx.all));
begin
Log.Info ("Preview {0} with {1}", Template, Command);
declare
Req : ASF.Requests.Mockup.Request;
Reply : ASF.Responses.Mockup.Response;
Dispatcher : constant Servlet.Core.Request_Dispatcher
:= Plugin.Get_Application.Get_Request_Dispatcher (Template);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
Req.Set_Request_URI (Template);
Req.Set_Method ("GET");
Servlet.Core.Forward (Dispatcher, Req, Reply);
Reply.Read_Content (Result);
Util.Files.Write_File (Html_File, Result);
end;
declare
Pipe : aliased Util.Streams.Pipes.Pipe_Stream;
Input : Util.Streams.Texts.Reader_Stream;
begin
Log.Info ("Running preview command {0}", Command);
Pipe.Open (Command, Util.Processes.READ_ALL);
Input.Initialize (Pipe'Unchecked_Access, 1024);
while not Input.Is_Eof loop
declare
Line : Ada.Strings.Unbounded.Unbounded_String;
begin
Input.Read_Line (Line, False);
Log.Info ("Received: {0}", Line);
end;
end loop;
Pipe.Close;
if Pipe.Get_Exit_Status /= 0 then
Log.Error ("Command {0} exited with status {1}", Command,
Integer'Image (Pipe.Get_Exit_Status));
end if;
end;
end Do_Preview_Job;
-- ------------------------------
-- Create a preview job and schedule the job to generate a new thumbnail preview for the page.
-- ------------------------------
procedure Make_Preview_Job (Plugin : in Preview_Module;
Page : in AWA.Wikis.Models.Wiki_Page_Ref'Class) is
pragma Unreferenced (Plugin);
J : AWA.Jobs.Services.Job_Type;
begin
J.Set_Parameter ("wiki_space_id", Page.Get_Wiki);
J.Set_Parameter ("wiki_page_id", Page);
J.Schedule (Preview_Job_Definition.Factory.all);
end Make_Preview_Job;
-- ------------------------------
-- The `On_Create` procedure is called by `Notify_Create` to notify the creation of the page.
-- ------------------------------
overriding
procedure On_Create (Instance : in Preview_Module;
Item : in AWA.Wikis.Models.Wiki_Page_Ref'Class) is
begin
Instance.Make_Preview_Job (Item);
end On_Create;
-- ------------------------------
-- The `On_Update` procedure is called by `Notify_Update` to notify the update of the page.
-- ------------------------------
overriding
procedure On_Update (Instance : in Preview_Module;
Item : in AWA.Wikis.Models.Wiki_Page_Ref'Class) is
begin
Instance.Make_Preview_Job (Item);
end On_Update;
-- ------------------------------
-- The `On_Delete` procedure is called by `Notify_Delete` to notify the deletion of the page.
-- ------------------------------
overriding
procedure On_Delete (Instance : in Preview_Module;
Item : in AWA.Wikis.Models.Wiki_Page_Ref'Class) is
begin
null;
end On_Delete;
-- ------------------------------
-- Get the preview module instance associated with the current application.
-- ------------------------------
function Get_Preview_Module return Preview_Module_Access is
function Get is new AWA.Modules.Get (Preview_Module, Preview_Module_Access, NAME);
begin
return Get;
end Get_Preview_Module;
end AWA.Wikis.Previews;
|
third_party/antlr_grammars_v4/mckeeman-form/McKeemanForm.g4 | mikhan808/rsyntaxtextarea-antlr4-extension | 2 | 7784 | <gh_stars>1-10
// https://www.crockford.com/mckeeman.html
grammar McKeemanForm;
grammar_
: rule_ (Newline rule_)* EOF
;
Space
: ' '
;
Newline
: '\r'
| '\n'
| '\r\n'
;
Name
: [a-zA-Z_]+
;
Indentation
: ' '
;
rule_
: Name Newline nothing? alternative+
;
nothing
: Indentation '"' '"' Newline
;
alternative
: Indentation item (Space item)* Newline
;
item
: Name
| Singleton
| range exclude?
| String
;
Singleton
: '\'' . '\''
| '\'' HexCode '\''
;
fragment HexCode
: '1' '0' Hex Hex Hex Hex
| Hex? Hex Hex Hex Hex
;
fragment Hex
: [0-9a-fA-F]
;
range
: Singleton Space '.' Space Singleton
;
exclude
: Space '-' Space (Singleton | range) exclude?
;
String
: '"' .*? '"'
;
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_1_1397.asm | ljhsiun2/medusa | 9 | 9686 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x1208a, %r12
nop
nop
nop
xor %rdx, %rdx
movl $0x61626364, (%r12)
nop
sub $1585, %r9
lea addresses_normal_ht+0x3b0a, %rsi
lea addresses_D_ht+0x330a, %rdi
nop
nop
nop
sub $63534, %r14
mov $3, %rcx
rep movsb
nop
nop
nop
add %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r8
push %r9
push %rbp
// Faulty Load
lea addresses_US+0x1e30a, %r15
xor $15053, %r14
mov (%r15), %r9w
lea oracles, %rbp
and $0xff, %r9
shlq $12, %r9
mov (%rbp,%r9,1), %r9
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'00': 1}
00
*/
|
StructurallyRecursiveDescentParsing/Grammar.agda | nad/parser-combinators | 1 | 10690 | <filename>StructurallyRecursiveDescentParsing/Grammar.agda<gh_stars>1-10
------------------------------------------------------------------------
-- Parsers containing non-terminals, and grammars using such parsers
------------------------------------------------------------------------
module StructurallyRecursiveDescentParsing.Grammar where
open import Data.Bool
open import Data.Empty
open import Data.Product
open import Relation.Binary.PropositionalEquality
open import Codata.Musical.Notation
open import Level
open import StructurallyRecursiveDescentParsing.Index
import StructurallyRecursiveDescentParsing.Simplified as Simplified
open Simplified hiding (Parser; module Parser; ⟦_⟧)
infixl 10 _!>>=_ _?>>=_
infixl 5 _∣_
-- The parsers are parameterised on a type of nonterminals.
data Parser (NT : NonTerminalType) (Tok : Set) : NonTerminalType where
return : ∀ {R} (x : R) → Parser NT Tok (true ◇ ε) R
fail : ∀ {R} → Parser NT Tok (false ◇ ε) R
token : Parser NT Tok (false ◇ ε) Tok
_∣_ : ∀ {e₁ e₂ c₁ c₂ R}
(p₁ : Parser NT Tok (e₁ ◇ c₁ ) R)
(p₂ : Parser NT Tok ( e₂ ◇ c₂) R) →
Parser NT Tok (e₁ ∨ e₂ ◇ c₁ ∪ c₂) R
_?>>=_ : ∀ {e₂ c₁ c₂ R₁ R₂}
(p₁ : Parser NT Tok (true ◇ c₁ ) R₁)
(p₂ : R₁ → Parser NT Tok (e₂ ◇ c₂) R₂) →
Parser NT Tok (e₂ ◇ c₁ ∪ c₂) R₂
_!>>=_ : ∀ {c₁ R₁ R₂} {i₂ : R₁ → Index}
(p₁ : Parser NT Tok (false ◇ c₁) R₁)
(p₂ : (x : R₁) → ∞ (Parser NT Tok (i₂ x) R₂)) →
Parser NT Tok (false ◇ c₁) R₂
! : ∀ {e c R} (nt : NT (e ◇ c) R) → Parser NT Tok (e ◇ c ∪ ε) R
-- Grammars.
Grammar : NonTerminalType → Set → Set1
Grammar NT Tok = ∀ {i R} → NT i R → Parser NT Tok i R
-- An empty non-terminal type.
EmptyNT : NonTerminalType
EmptyNT _ _ = Lift _ ⊥
-- An empty grammar.
emptyGrammar : ∀ {Tok} → Grammar EmptyNT Tok
emptyGrammar (lift ())
-- The semantics of grammar-based parsers is defined in terms of their
-- translation into "plain" parsers. The translation instantiates all
-- non-terminals corecursively.
⟦_⟧ : ∀ {Tok NT e c R} →
Parser NT Tok (e ◇ c) R → Grammar NT Tok →
Simplified.Parser Tok e R
⟦ return x ⟧ g = return x
⟦ fail ⟧ g = fail
⟦ token ⟧ g = token
⟦ p₁ ∣ p₂ ⟧ g = ⟦ p₁ ⟧ g ∣ ⟦ p₂ ⟧ g
⟦ p₁ ?>>= p₂ ⟧ g = ⟦ p₁ ⟧ g ?>>= λ x → ⟦ p₂ x ⟧ g
⟦ p₁ !>>= p₂ ⟧ g = ⟦ p₁ ⟧ g !>>= λ x → ♯ ⟦ ♭ (p₂ x) ⟧ g
⟦ ! nt ⟧ g = ⟦ g nt ⟧ g
-- Note that some "plain" parsers cannot be directly rewritten using
-- the parser type in this module (although there may be /equivalent/
-- parsers):
private
only-plain : Simplified.Parser Bool false Bool
only-plain = return true ?>>= λ x →
if x then token else token ∣ token
-- The following code does not type-check.
-- doesnt-work : Parser EmptyNT Bool (false ◇ _) Bool
-- doesnt-work = return true ?>>= λ x →
-- if x then token else token ∣ token
-- A map function which can be useful when combining grammars.
mapNT : ∀ {NT₁ NT₂ Tok i R} →
(∀ {i R} → NT₁ i R → NT₂ i R) →
Parser NT₁ Tok i R → Parser NT₂ Tok i R
mapNT f (return x) = return x
mapNT f fail = fail
mapNT f token = token
mapNT f (p₁ ∣ p₂) = mapNT f p₁ ∣ mapNT f p₂
mapNT f (p₁ ?>>= p₂) = mapNT f p₁ ?>>= λ x → mapNT f (p₂ x)
mapNT f (p₁ !>>= p₂) = mapNT f p₁ !>>= λ x → ♯ mapNT f (♭ (p₂ x))
mapNT f (! nt) = ! (f nt)
|
data/mapHeaders/seafoamislands5.asm | adhi-thirumala/EvoYellow | 16 | 103558 | SeafoamIslands5_h:
db CAVERN ; tileset
db SEAFOAM_ISLANDS_5_HEIGHT, SEAFOAM_ISLANDS_5_WIDTH ; dimensions (y, x)
dw SeafoamIslands5Blocks, SeafoamIslands5TextPointers, SeafoamIslands5Script ; blocks, texts, scripts
db $00 ; connections
dw SeafoamIslands5Object ; objects
|
CPU/cpu_test/test_storage/test6_sw_jal.asm | SilenceX12138/MIPS-Microsystems | 55 | 174859 | <reponame>SilenceX12138/MIPS-Microsystems<filename>CPU/cpu_test/test_storage/test6_sw_jal.asm
ori $1,$0,0x1919
jal loop1
sw $1,-0x300c($31)
loop1:
jal loop2
ori $2,$0,0x928e
loop2:
sw $2,-0x3010($31)
jal loop3
sw $31,8($0)
loop3:
jal loop4
nop
loop4:
sw $31,12($0) |
e.asm | Flonky/e | 1 | 26557 | .arch i386
.intel_syntax noprefix
.global _start
.data
e:
.ascii "e"
.text
_start:
mov eax, 4
mov ebx, 1
lea ecx, e
mov edx, 1
int 0x80
jmp _start
|
src/util/strg/appc.asm | olifink/qspread | 0 | 242347 | ; append a character after a string 06/01-92 O.Fink
section string
include win1_keys_err
xdef st_appc ; append a character
;+++
; append a character after a string (there must be enough space!)
; abcdef -> append 1 -> abcdef1
;
; Entry Exit
; d1.b character preserved
; a0 ptr to string preserved
;
; error codes: none
; condition codes set
;---
st_appc
move.w (a0),d0
addq.w #1,d0
move.w d0,(a0)
move.b d1,1(a0,d0.w)
moveq #0,d0
rts
end
|
archive/agda-2/Oscar/Class/Functor.agda | m0davis/oscar | 0 | 14743 | <reponame>m0davis/oscar
module Oscar.Class.Functor where
open import Oscar.Class.Monoid
open import Oscar.Data.Equality
open import Oscar.Data.Product
open import Oscar.Level
open import Oscar.Relation
open import Oscar.Function
record Functor {a} {A : Set a} {b} (_↠_ : A → A → Set b) ⦃ _ : Monoid _↠_ ⦄ {c} (C : A → Set c) : Set (a ⊔ b ⊔ c) where
field
_◃_ : ∀ {m n} → m ↠ n → m ⟨ C ⟩→ n
◃-identity : ∀ {m} → (x : C m) → ε ◃ x ≡ x
◃-associativity : ∀ {l m n} (f : l ↠ m) (g : m ↠ n) → (g ◇ f) ◃_ ≡̇ g ◃_ ∘ f ◃_
◃-extensionality : ∀ {m n} {f g : m ↠ n} → f ≡ g → f ◃_ ≡ g ◃_
open Functor ⦃ … ⦄ public
open import Data.List
open import Oscar.Function
instance MonoidFunction : ∀ {a} → Monoid {A = Set a} (λ m n → m → n)
Monoid.ε MonoidFunction = λ x → x
Monoid._◇_ MonoidFunction g f = g ∘ f
Monoid.◇-left-identity MonoidFunction _ = refl
Monoid.◇-right-identity MonoidFunction _ = refl
Monoid.◇-associativity MonoidFunction _ _ _ = refl
instance FunctorList : ∀ {a} → Functor _ ⦃ MonoidFunction {a} ⦄ List
Functor._◃_ FunctorList {m} {n} f [] = []
Functor._◃_ FunctorList {m} {n} f (x ∷ xs) = f x ∷ f ◃ xs
Functor.◃-identity FunctorList = {!!}
Functor.◃-associativity FunctorList = {!!}
Functor.◃-extensionality FunctorList = {!!}
|
oeis/336/A336214.asm | neoneye/loda-programs | 11 | 103223 | <filename>oeis/336/A336214.asm
; A336214: a(n) = Sum_{k=0..n} k^n * binomial(n,k)^n, with a(0)=1.
; Submitted by <NAME>
; 1,1,8,270,41984,30706250,94770093312,1336016204844832,76829717664330940416,19838680914222199482800274,20521247958509575370600000000000,94285013320530947020636486516362047300,1715947732437668013396578734960052732361179136,137680122576821386608353184449188206337148935530282208,43424677084973235541781992798166564610719245639935112370585600,60054734349985568474595754275485430000151153748971686304951171875000000,324674751338188857579460650140551293100100894031677033924444858320440116593557504
mov $4,$0
add $0,1
lpb $0
sub $0,1
mov $2,$1
pow $2,$4
mov $3,$4
bin $3,$1
add $1,1
pow $3,$4
mul $3,$2
add $5,$3
lpe
mov $0,$5
|
src/Erased/Cubical.agda | nad/equality | 3 | 11263 | ------------------------------------------------------------------------
-- Some theory of Erased, developed using Cubical Agda
------------------------------------------------------------------------
-- This module instantiates and reexports code from Erased.
{-# OPTIONS --erased-cubical --safe #-}
import Equality.Path as P
module Erased.Cubical
{e⁺} (eq : ∀ {a p} → P.Equality-with-paths a p e⁺) where
open P.Derived-definitions-and-properties eq
open import Prelude
open import Bijection equality-with-J using (_↔_)
import Bijection P.equality-with-J as PB
open import Equality.Path.Isomorphisms eq
open import Equivalence equality-with-J as Eq
using (_≃_; Is-equivalence)
import Equivalence P.equality-with-J as PEq
import Erased.Basics as EB
import Erased.Level-1 P.equality-with-J as EP
import Erased.Level-1 equality-with-J as E
open import Function-universe equality-with-J
private
variable
a p : Level
A : Type a
x y : A
------------------------------------------------------------------------
-- []-cong
-- Given an erased path from x to y there is a path from [ x ] to
-- [ y ].
[]-cong-Path :
{@0 A : Type a} {@0 x y : A} →
EB.Erased (x P.≡ y) → EB.[ x ] P.≡ EB.[ y ]
[]-cong-Path EB.[ eq ] = λ i → EB.[ eq i ]
-- []-cong-Path is an equivalence.
[]-cong-Path-equivalence :
{@0 A : Type a} {@0 x y : A} →
PEq.Is-equivalence ([]-cong-Path {x = x} {y = y})
[]-cong-Path-equivalence =
PEq._≃_.is-equivalence $ PEq.↔⇒≃ (record
{ surjection = record
{ logical-equivalence = record
{ from = λ eq → EB.[ P.cong EB.erased eq ]
}
; right-inverse-of = λ _ → P.refl
}
; left-inverse-of = λ _ → P.refl
})
-- A rearrangement lemma for []-cong-Path (which holds by definition).
[]-cong-Path-[refl] :
{@0 A : Type a} {@0 x : A} →
[]-cong-Path EB.[ P.refl {x = x} ] P.≡ P.refl {x = EB.[ x ]}
[]-cong-Path-[refl] = P.refl
-- The []-cong axioms can be instantiated.
instance-of-[]-cong-axiomatisation-for-Path : EP.[]-cong-axiomatisation a
instance-of-[]-cong-axiomatisation-for-Path = λ where
.EP.[]-cong-axiomatisation.[]-cong → []-cong-Path
.EP.[]-cong-axiomatisation.[]-cong-equivalence → []-cong-Path-equivalence
.EP.[]-cong-axiomatisation.[]-cong-[refl] → []-cong-Path-[refl]
-- Given an erased proof of equality of x and y one can show that
-- EB.[ x ] is equal to EB.[ y ].
[]-cong : {@0 A : Type a} {@0 x y : A} →
EB.Erased (x ≡ y) → EB.[ x ] ≡ EB.[ y ]
[]-cong {x = x} {y = y} =
EB.Erased (x ≡ y) ↝⟨ (λ (EB.[ eq ]) → EB.[ _↔_.to ≡↔≡ eq ]) ⟩
EB.Erased (x P.≡ y) ↝⟨ []-cong-Path ⟩
EB.[ x ] P.≡ EB.[ y ] ↔⟨ inverse ≡↔≡ ⟩□
EB.[ x ] ≡ EB.[ y ] □
-- []-cong is an equivalence.
[]-cong-equivalence :
{@0 A : Type a} {@0 x y : A} →
Is-equivalence ([]-cong {x = x} {y = y})
[]-cong-equivalence {x = x} {y = y} = _≃_.is-equivalence (
EB.Erased (x ≡ y) ↔⟨ _≃_.from ↔≃↔ $
EP.[]-cong.Erased-cong-↔
instance-of-[]-cong-axiomatisation-for-Path
(_≃_.to ↔≃↔ ≡↔≡) ⟩
EB.Erased (x P.≡ y) ↝⟨ _↔_.from ≃↔≃ PEq.⟨ _ , []-cong-Path-equivalence ⟩ ⟩
EB.[ x ] P.≡ EB.[ y ] ↔⟨ inverse ≡↔≡ ⟩□
EB.[ x ] ≡ EB.[ y ] □)
-- A rearrangement lemma for []-cong.
[]-cong-[refl] :
{@0 A : Type a} {@0 x : A} →
[]-cong EB.[ refl x ] ≡ refl EB.[ x ]
[]-cong-[refl] {x = x} =
sym $ _↔_.to (from≡↔≡to Eq.⟨ _ , []-cong-equivalence ⟩) (
EB.[ _↔_.from ≡↔≡ (P.cong EB.erased (_↔_.to ≡↔≡ (refl EB.[ x ]))) ] ≡⟨ []-cong EB.[ sym cong≡cong ] ⟩
EB.[ cong EB.erased (_↔_.from ≡↔≡ (_↔_.to ≡↔≡ (refl EB.[ x ]))) ] ≡⟨ []-cong EB.[ cong (cong EB.erased) (_↔_.left-inverse-of ≡↔≡ _) ] ⟩
EB.[ cong EB.erased (refl EB.[ x ]) ] ≡⟨ []-cong EB.[ cong-refl _ ] ⟩∎
EB.[ refl x ] ∎)
-- The []-cong axioms can be instantiated.
instance-of-[]-cong-axiomatisation : E.[]-cong-axiomatisation a
instance-of-[]-cong-axiomatisation = λ where
.E.[]-cong-axiomatisation.[]-cong → []-cong
.E.[]-cong-axiomatisation.[]-cong-equivalence → []-cong-equivalence
.E.[]-cong-axiomatisation.[]-cong-[refl] → []-cong-[refl]
-- Some reexported definitions.
open import Erased equality-with-J instance-of-[]-cong-axiomatisation
public
hiding ([]-cong; []-cong-equivalence; []-cong-[refl];
Π-Erased≃Π0[]; Π-Erased≃Π0)
------------------------------------------------------------------------
-- Variants of some of the reexported definitions
private
-- The lemma push-subst-[], which is reexported above, can be proved
-- very easily when path equality is used.
push-subst-[]-Path :
{@0 P : A → Type p} {@0 p : P x} {x≡y : x P.≡ y} →
P.subst (λ x → Erased (P x)) x≡y [ p ] ≡ [ P.subst P x≡y p ]
push-subst-[]-Path = refl _
-- Above a lemma H-level-Erased is reexported. That lemma is proved
-- in a certain way. The following two lemmas are included to
-- illustrate a somewhat different proof technique that works for
-- individual h-levels (given by closed natural numbers).
-- Is-proposition is closed under Erased.
Is-proposition-Erased :
{@0 A : Type a} →
@0 Is-proposition A → Is-proposition (Erased A)
Is-proposition-Erased {A = A} prop =
_↔_.from (H-level↔H-level 1)
(Is-proposition-Erased′
(_↔_.to (H-level↔H-level 1) prop))
where
Is-proposition-Erased′ :
@0 P.Is-proposition A → P.Is-proposition (Erased A)
Is-proposition-Erased′ prop x y = λ i →
[ prop (erased x) (erased y) i ]
-- Is-set is closed under Erased.
Is-set-Erased :
{@0 A : Type a} →
@0 Is-set A → Is-set (Erased A)
Is-set-Erased {A = A} set =
_↔_.from (H-level↔H-level 2)
(Is-set-Erased′
(_↔_.to (H-level↔H-level 2) set))
where
Is-set-Erased′ : @0 P.Is-set A → P.Is-set (Erased A)
Is-set-Erased′ set p q = λ i j →
[ set (P.cong erased p) (P.cong erased q) i j ]
------------------------------------------------------------------------
-- Some isomorphisms/equivalences
-- The following four results are inspired by a result in
-- Mishra-Linger's PhD thesis (see Section 5.4.1).
-- There is a bijection (with paths for equality, not _≡_) between
-- (x : Erased A) → P x and (@0 x : A) → P [ x ].
Π-Erased↔Π0[] :
{@0 A : Type a} {@0 P : Erased A → Type p} →
((x : Erased A) → P x) PB.↔ ((@0 x : A) → P [ x ])
Π-Erased↔Π0[] = record
{ surjection = record
{ logical-equivalence = Π-Erased⇔Π0
; right-inverse-of = λ f _ → f
}
; left-inverse-of = λ f _ → f
}
-- There is an equivalence (with paths for equality, not _≡_) between
-- (x : Erased A) → P x and (@0 x : A) → P [ x ].
--
-- This is not proved by converting Π-Erased↔Π0[] to an equivalence,
-- because the type arguments of the conversion function in
-- Equivalence are not erased, and P can only be used in erased
-- contexts.
--
-- This is a strengthening of E.Π-Erased≃Π0[].
Π-Erased≃Π0[] :
{@0 A : Type a} {@0 P : Erased A → Type p} →
((x : Erased A) → P x) PEq.≃ ((@0 x : A) → P [ x ])
Π-Erased≃Π0[] = record
{ to = λ f x → f [ x ]
; is-equivalence =
(λ f ([ x ]) → f x)
, (λ f _ → f)
, (λ f _ → f)
, (λ f _ _ x → f [ x ])
}
-- There is a bijection (with paths for equality, not _≡_) between
-- (x : Erased A) → P (erased x) and (@0 x : A) → P x.
Π-Erased↔Π0 :
{@0 A : Type a} {@0 P : A → Type p} →
((x : Erased A) → P (erased x)) PB.↔ ((@0 x : A) → P x)
Π-Erased↔Π0 = Π-Erased↔Π0[]
-- There is an equivalence (with paths for equality, not _≡_) between
-- (x : Erased A) → P (erased x) and (@0 x : A) → P x.
--
-- This is a strengthening of E.Π-Erased≃Π0.
Π-Erased≃Π0 :
{@0 A : Type a} {@0 P : A → Type p} →
((x : Erased A) → P (erased x)) PEq.≃ ((@0 x : A) → P x)
Π-Erased≃Π0 = Π-Erased≃Π0[]
|
Antlr4Learning/src/main/java/Calculator/LabeledExpr.g4 | TsenkoTsenkov/Antlr4 | 0 | 81 | grammar LabeledExpr;
import CommonLexerRules;
prog: stat+;
stat: expr NEWLINE # printExpr
| ID '=' expr NEWLINE # assign
| 'clear' #clear
| NEWLINE # blank
;
expr: expr op=('*'|'/') expr #MulDiv
| expr op=('+'|'-') expr #AddSub
| INT # int
| ID # id
| '(' expr ')' #parens
;
MUL : '*' ; // assigns token name to '*' used above in grammar
DIV : '/' ;
ADD : '+' ;
SUB : '-' ; |
ADL/Assemble/Update/2/B~HR_sort_dec.asm | MaxMorning/LinkedListVisualization | 3 | 2677 | <gh_stars>1-10
aLine 0
gNew basePtr
gMove basePtr, Root
gNewVPtr minNext
gNewVPtr rootNext
gMoveNext rootNext, Root
gNewVPtr basePrev
gNew minPtr, 1085, 800
gNewVPtr minPrev
gNew currentPtr, 1085, 920
aLine 1
gBeq basePtr, null, 47
aLine 3
gMove minPtr, basePtr
aLine 4
gMoveNext currentPtr, basePtr
aLine 5
gBeq currentPtr, null, 8
aLine 6
vBle minPtr, currentPtr, 3
aLine 7
gMove minPtr, currentPtr
aLine 9
gMoveNext currentPtr, currentPtr
Jmp -8
aLine 12
gMovePrev basePrev, basePtr
gBne basePrev, null, 3
aLine 13
gMove Rear, minPtr
aLine 15
gBne minPtr, basePtr, 3
aLine 16
gMoveNext basePtr, basePtr
aLine 18
gMovePrev minPrev, minPtr
gMoveNext minNext, minPtr
gBeq minPrev, null, 20
aLine 19
nMoveRel minPtr, minPtr, 0, -164.545
pSetNext minPrev, minNext
aLine 20
gBeq minNext, null, 3
aLine 21
pSetPrev minNext, minPrev
aLine 23
pDeleteNext minPtr
pDeletePrev minPtr
nMoveRel minPtr, Root, -95, -164.545
pSetNext minPtr, Root
aLine 24
pSetPrev Root, minPtr
aLine 25
gMove Root, minPtr
aLine 26
pDeletePrev minPtr
aStd
Jmp -47
aLine 29
gDelete basePrev
gDelete basePtr
gDelete minNext
gDelete minPtr
gDelete minPrev
gDelete rootNext
gDelete currentPtr
aStd
Halt |
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_407.asm | ljhsiun2/medusa | 9 | 244245 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x13b40, %rsi
lea addresses_D_ht+0x17afc, %rdi
nop
nop
nop
nop
xor $15746, %rbp
mov $56, %rcx
rep movsb
nop
nop
nop
sub $34164, %r14
lea addresses_WC_ht+0x1a4c, %rbx
dec %rcx
movw $0x6162, (%rbx)
nop
nop
nop
nop
nop
dec %r14
lea addresses_A_ht+0x1cda4, %rdi
nop
nop
nop
nop
sub $56589, %r8
mov (%rdi), %r14d
nop
xor %rbp, %rbp
lea addresses_normal_ht+0x179e4, %r8
nop
cmp %rbp, %rbp
mov (%r8), %si
nop
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_D_ht+0x187d0, %rsi
lea addresses_UC_ht+0x10a84, %rdi
nop
xor $12979, %r13
mov $15, %rcx
rep movsb
nop
nop
add $31912, %rsi
lea addresses_D_ht+0xfcdc, %r8
nop
and $61879, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, (%r8)
nop
nop
sub $4517, %r8
lea addresses_WC_ht+0xe4a4, %r8
nop
nop
nop
nop
sub $46092, %rbx
and $0xffffffffffffffc0, %r8
vmovaps (%r8), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $1, %xmm3, %r14
xor $31746, %r13
lea addresses_UC_ht+0x13ca4, %rbx
nop
nop
nop
nop
nop
and %rdi, %rdi
movw $0x6162, (%rbx)
nop
nop
nop
xor %rsi, %rsi
lea addresses_normal_ht+0x188a4, %rbx
nop
nop
nop
xor $17189, %rbp
vmovups (%rbx), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %r8
nop
xor $21551, %rdi
lea addresses_WT_ht+0xeca4, %r8
nop
nop
cmp $39955, %rdi
and $0xffffffffffffffc0, %r8
vmovaps (%r8), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %rbx
nop
nop
nop
lfence
lea addresses_WT_ht+0xade4, %rdi
and $54490, %r13
movups (%rdi), %xmm3
vpextrq $0, %xmm3, %r14
nop
nop
sub %rbp, %rbp
lea addresses_WT_ht+0x29a9, %rbx
nop
nop
nop
nop
nop
add %r13, %r13
mov (%rbx), %ecx
sub $51963, %rbx
lea addresses_UC_ht+0x149a4, %rdi
sub $49779, %rbx
movw $0x6162, (%rdi)
nop
nop
nop
nop
and $61434, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_D+0x100a4, %rsi
lea addresses_D+0xf044, %rdi
nop
nop
nop
add $1965, %rbx
mov $40, %rcx
rep movsq
nop
nop
xor $50542, %r9
// Store
lea addresses_PSE+0x10e03, %rbx
nop
nop
nop
nop
cmp $38041, %r9
movl $0x51525354, (%rbx)
and $29390, %r9
// Load
lea addresses_normal+0x14ca4, %rbx
xor $33928, %rax
vmovups (%rbx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rdi
nop
nop
nop
add $22699, %rcx
// Store
lea addresses_US+0xeaa4, %r9
clflush (%r9)
nop
nop
nop
add $35340, %rdx
movl $0x51525354, (%r9)
nop
nop
add $23080, %r9
// Faulty Load
lea addresses_normal+0x14ca4, %rdx
nop
nop
sub %rcx, %rcx
mov (%rdx), %rsi
lea oracles, %rcx
and $0xff, %rsi
shlq $12, %rsi
mov (%rcx,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_US', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 8, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': True, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 7, '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
*/
|
src/inputs.adb | laurentzh/CHIP-8 | 4 | 5098 | <reponame>laurentzh/CHIP-8
with STM32.Board; use STM32.Board;
with HAL.Touch_Panel; use HAL.Touch_Panel;
package body Inputs is
procedure Update_Pressed_Keys(Keys : in out Keys_List) is
State : constant TP_State := Touch_Panel.Get_All_Touch_Points;
begin
for I in State'First .. State'Last loop
if State(I).X >= Position_X'First then
Keys(Get_Key(State(I).X, Position_Y'Last - State(I).Y)) := True;
end if;
end loop;
end Update_Pressed_Keys;
function Get_Key(X : Position_X; Y : Position_Y) return Integer is
begin
return Layout((X - Position_X'First) / 40, Y / 40);
end Get_Key;
end Inputs;
|
src/apic/stivale2_bootstrap.asm | Glowman554/FoxOS-kernel | 13 | 100747 | [global stivale2_bootstrap]
[global stivale2_data]
[extern start_apic_timer]
[extern load_gdt]
;# stivale2_bootstrap-signature: void stivale2_bootstrap(stivale2_struct* bootinfo);
;# stivale2_bootstrap-doc: The main entry point for aplication processors booted using the stivale2 boot protocol smp tag.
stivale2_bootstrap:
cli
xor rax, rax
mov eax, [stivale2_data.pagetable]
mov cr3, rax
xor rdi, rdi
mov edi, [stivale2_data.gdt]
call load_gdt
xor rax, rax
mov rax, [stivale2_data.idt]
lidt [rax]
sti
; enable coprocessor (fpu and sse)
mov rax, cr0
and ax, 0xFFFB
or ax, 0x2
mov cr0, rax
mov rax, cr4
or ax, 3 << 9
mov cr4, rax
fninit
mov rax, 1
cpuid
and ecx, 1 << 26 ; check for XSAVE support
test ecx, ecx
je .skip_xsave
mov rax, cr0
xor rax, 1 << 3
mov cr0, rax
mov rax, cr4
or eax, 1 << 18
mov cr4, rax
.skip_xsave:
mov rbp, rsp ; mark end of stack for stack trace
; setup the lapic
; enable lapic software enabled
mov rax, [stivale2_data.lapic_ptr]
mov ebx, [rax + 0x0f0]
or ebx, 0x1ff
mov [rax + 0x0f0], ebx
; calibrate the lapic timer
mov rdi, 1000
call start_apic_timer
mov [stivale2_data.status], byte 1
call [stivale2_data.entry]
jmp $
;# stivale2_data-discard
stivale2_data:
.status: db 0
.pagetable: dq 0
.idt: dq 0
.gdt: dq 0
.stack_ptr: dq 0
.entry: dq 0
.lapic_ptr: dq 0
times 4096 - ($ - $$) db 0 |
resources/scripts/crawl/commoncrawl.ads | nscuro/Amass | 1 | 13774 | <reponame>nscuro/Amass<filename>resources/scripts/crawl/commoncrawl.ads
-- Copyright © by <NAME> 2021-2022. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-- SPDX-License-Identifier: Apache-2.0
local json = require("json")
name = "CommonCrawl"
type = "crawl"
local urls = {}
function start()
set_rate_limit(7)
end
function vertical(ctx, domain)
if (urls == nil or #urls == 0) then
get_urls(ctx)
end
for _, url in pairs(urls) do
scrape(ctx, {['url']=url .. domain})
end
end
function get_urls(ctx)
local u = "https://index.commoncrawl.org"
local resp, err = request(ctx, {['url']=u})
if (err ~= nil and err ~= "") then
log(ctx, "get_urls request to service failed: " .. err)
return
end
local matches = find(resp, 'CC-MAIN[0-9-]*-index')
if (matches == nil or #matches == 0) then
log(ctx, "get_urls failed to extract endpoints")
return
end
for _, endpoint in pairs(matches) do
table.insert(urls, u .. "/" .. endpoint .. "?output=json&fl=url&url=*.")
end
end
|
src/svd/sam_svd-oscctrl.ads | Fabien-Chouteau/samd51-hal | 1 | 17124 | <gh_stars>1-10
pragma Style_Checks (Off);
-- This spec has been automatically generated from ATSAMD51G19A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAM_SVD.OSCCTRL is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- OSCCTRL_EVCTRL_CFDEO array
type OSCCTRL_EVCTRL_CFDEO_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_EVCTRL_CFDEO
type OSCCTRL_EVCTRL_CFDEO_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CFDEO as a value
Val : HAL.UInt2;
when True =>
-- CFDEO as an array
Arr : OSCCTRL_EVCTRL_CFDEO_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_EVCTRL_CFDEO_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Event Control
type OSCCTRL_EVCTRL_Register is record
-- Clock 0 Failure Detector Event Output Enable
CFDEO : OSCCTRL_EVCTRL_CFDEO_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for OSCCTRL_EVCTRL_Register use record
CFDEO at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- OSCCTRL_INTENCLR_XOSCRDY array
type OSCCTRL_INTENCLR_XOSCRDY_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTENCLR_XOSCRDY
type OSCCTRL_INTENCLR_XOSCRDY_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCRDY as a value
Val : HAL.UInt2;
when True =>
-- XOSCRDY as an array
Arr : OSCCTRL_INTENCLR_XOSCRDY_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTENCLR_XOSCRDY_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- OSCCTRL_INTENCLR_XOSCFAIL array
type OSCCTRL_INTENCLR_XOSCFAIL_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTENCLR_XOSCFAIL
type OSCCTRL_INTENCLR_XOSCFAIL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCFAIL as a value
Val : HAL.UInt2;
when True =>
-- XOSCFAIL as an array
Arr : OSCCTRL_INTENCLR_XOSCFAIL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTENCLR_XOSCFAIL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Clear
type OSCCTRL_INTENCLR_Register is record
-- XOSC 0 Ready Interrupt Enable
XOSCRDY : OSCCTRL_INTENCLR_XOSCRDY_Field :=
(As_Array => False, Val => 16#0#);
-- XOSC 0 Clock Failure Detector Interrupt Enable
XOSCFAIL : OSCCTRL_INTENCLR_XOSCFAIL_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- DFLL Ready Interrupt Enable
DFLLRDY : Boolean := False;
-- DFLL Out Of Bounds Interrupt Enable
DFLLOOB : Boolean := False;
-- DFLL Lock Fine Interrupt Enable
DFLLLCKF : Boolean := False;
-- DFLL Lock Coarse Interrupt Enable
DFLLLCKC : Boolean := False;
-- DFLL Reference Clock Stopped Interrupt Enable
DFLLRCS : Boolean := False;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- DPLL0 Lock Rise Interrupt Enable
DPLL0LCKR : Boolean := False;
-- DPLL0 Lock Fall Interrupt Enable
DPLL0LCKF : Boolean := False;
-- DPLL0 Lock Timeout Interrupt Enable
DPLL0LTO : Boolean := False;
-- DPLL0 Loop Divider Ratio Update Complete Interrupt Enable
DPLL0LDRTO : Boolean := False;
-- unspecified
Reserved_20_23 : HAL.UInt4 := 16#0#;
-- DPLL1 Lock Rise Interrupt Enable
DPLL1LCKR : Boolean := False;
-- DPLL1 Lock Fall Interrupt Enable
DPLL1LCKF : Boolean := False;
-- DPLL1 Lock Timeout Interrupt Enable
DPLL1LTO : Boolean := False;
-- DPLL1 Loop Divider Ratio Update Complete Interrupt Enable
DPLL1LDRTO : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_INTENCLR_Register use record
XOSCRDY at 0 range 0 .. 1;
XOSCFAIL at 0 range 2 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
DFLLRDY at 0 range 8 .. 8;
DFLLOOB at 0 range 9 .. 9;
DFLLLCKF at 0 range 10 .. 10;
DFLLLCKC at 0 range 11 .. 11;
DFLLRCS at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
DPLL0LCKR at 0 range 16 .. 16;
DPLL0LCKF at 0 range 17 .. 17;
DPLL0LTO at 0 range 18 .. 18;
DPLL0LDRTO at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
DPLL1LCKR at 0 range 24 .. 24;
DPLL1LCKF at 0 range 25 .. 25;
DPLL1LTO at 0 range 26 .. 26;
DPLL1LDRTO at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- OSCCTRL_INTENSET_XOSCRDY array
type OSCCTRL_INTENSET_XOSCRDY_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTENSET_XOSCRDY
type OSCCTRL_INTENSET_XOSCRDY_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCRDY as a value
Val : HAL.UInt2;
when True =>
-- XOSCRDY as an array
Arr : OSCCTRL_INTENSET_XOSCRDY_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTENSET_XOSCRDY_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- OSCCTRL_INTENSET_XOSCFAIL array
type OSCCTRL_INTENSET_XOSCFAIL_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTENSET_XOSCFAIL
type OSCCTRL_INTENSET_XOSCFAIL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCFAIL as a value
Val : HAL.UInt2;
when True =>
-- XOSCFAIL as an array
Arr : OSCCTRL_INTENSET_XOSCFAIL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTENSET_XOSCFAIL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Set
type OSCCTRL_INTENSET_Register is record
-- XOSC 0 Ready Interrupt Enable
XOSCRDY : OSCCTRL_INTENSET_XOSCRDY_Field :=
(As_Array => False, Val => 16#0#);
-- XOSC 0 Clock Failure Detector Interrupt Enable
XOSCFAIL : OSCCTRL_INTENSET_XOSCFAIL_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- DFLL Ready Interrupt Enable
DFLLRDY : Boolean := False;
-- DFLL Out Of Bounds Interrupt Enable
DFLLOOB : Boolean := False;
-- DFLL Lock Fine Interrupt Enable
DFLLLCKF : Boolean := False;
-- DFLL Lock Coarse Interrupt Enable
DFLLLCKC : Boolean := False;
-- DFLL Reference Clock Stopped Interrupt Enable
DFLLRCS : Boolean := False;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- DPLL0 Lock Rise Interrupt Enable
DPLL0LCKR : Boolean := False;
-- DPLL0 Lock Fall Interrupt Enable
DPLL0LCKF : Boolean := False;
-- DPLL0 Lock Timeout Interrupt Enable
DPLL0LTO : Boolean := False;
-- DPLL0 Loop Divider Ratio Update Complete Interrupt Enable
DPLL0LDRTO : Boolean := False;
-- unspecified
Reserved_20_23 : HAL.UInt4 := 16#0#;
-- DPLL1 Lock Rise Interrupt Enable
DPLL1LCKR : Boolean := False;
-- DPLL1 Lock Fall Interrupt Enable
DPLL1LCKF : Boolean := False;
-- DPLL1 Lock Timeout Interrupt Enable
DPLL1LTO : Boolean := False;
-- DPLL1 Loop Divider Ratio Update Complete Interrupt Enable
DPLL1LDRTO : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_INTENSET_Register use record
XOSCRDY at 0 range 0 .. 1;
XOSCFAIL at 0 range 2 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
DFLLRDY at 0 range 8 .. 8;
DFLLOOB at 0 range 9 .. 9;
DFLLLCKF at 0 range 10 .. 10;
DFLLLCKC at 0 range 11 .. 11;
DFLLRCS at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
DPLL0LCKR at 0 range 16 .. 16;
DPLL0LCKF at 0 range 17 .. 17;
DPLL0LTO at 0 range 18 .. 18;
DPLL0LDRTO at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
DPLL1LCKR at 0 range 24 .. 24;
DPLL1LCKF at 0 range 25 .. 25;
DPLL1LTO at 0 range 26 .. 26;
DPLL1LDRTO at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- OSCCTRL_INTFLAG_XOSCRDY array
type OSCCTRL_INTFLAG_XOSCRDY_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTFLAG_XOSCRDY
type OSCCTRL_INTFLAG_XOSCRDY_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCRDY as a value
Val : HAL.UInt2;
when True =>
-- XOSCRDY as an array
Arr : OSCCTRL_INTFLAG_XOSCRDY_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTFLAG_XOSCRDY_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- OSCCTRL_INTFLAG_XOSCFAIL array
type OSCCTRL_INTFLAG_XOSCFAIL_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTFLAG_XOSCFAIL
type OSCCTRL_INTFLAG_XOSCFAIL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCFAIL as a value
Val : HAL.UInt2;
when True =>
-- XOSCFAIL as an array
Arr : OSCCTRL_INTFLAG_XOSCFAIL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTFLAG_XOSCFAIL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Flag Status and Clear
type OSCCTRL_INTFLAG_Register is record
-- XOSC 0 Ready
XOSCRDY : OSCCTRL_INTFLAG_XOSCRDY_Field :=
(As_Array => False, Val => 16#0#);
-- XOSC 0 Clock Failure Detector
XOSCFAIL : OSCCTRL_INTFLAG_XOSCFAIL_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- DFLL Ready
DFLLRDY : Boolean := False;
-- DFLL Out Of Bounds
DFLLOOB : Boolean := False;
-- DFLL Lock Fine
DFLLLCKF : Boolean := False;
-- DFLL Lock Coarse
DFLLLCKC : Boolean := False;
-- DFLL Reference Clock Stopped
DFLLRCS : Boolean := False;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- DPLL0 Lock Rise
DPLL0LCKR : Boolean := False;
-- DPLL0 Lock Fall
DPLL0LCKF : Boolean := False;
-- DPLL0 Lock Timeout
DPLL0LTO : Boolean := False;
-- DPLL0 Loop Divider Ratio Update Complete
DPLL0LDRTO : Boolean := False;
-- unspecified
Reserved_20_23 : HAL.UInt4 := 16#0#;
-- DPLL1 Lock Rise
DPLL1LCKR : Boolean := False;
-- DPLL1 Lock Fall
DPLL1LCKF : Boolean := False;
-- DPLL1 Lock Timeout
DPLL1LTO : Boolean := False;
-- DPLL1 Loop Divider Ratio Update Complete
DPLL1LDRTO : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_INTFLAG_Register use record
XOSCRDY at 0 range 0 .. 1;
XOSCFAIL at 0 range 2 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
DFLLRDY at 0 range 8 .. 8;
DFLLOOB at 0 range 9 .. 9;
DFLLLCKF at 0 range 10 .. 10;
DFLLLCKC at 0 range 11 .. 11;
DFLLRCS at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
DPLL0LCKR at 0 range 16 .. 16;
DPLL0LCKF at 0 range 17 .. 17;
DPLL0LTO at 0 range 18 .. 18;
DPLL0LDRTO at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
DPLL1LCKR at 0 range 24 .. 24;
DPLL1LCKF at 0 range 25 .. 25;
DPLL1LTO at 0 range 26 .. 26;
DPLL1LDRTO at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- OSCCTRL_STATUS_XOSCRDY array
type OSCCTRL_STATUS_XOSCRDY_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_STATUS_XOSCRDY
type OSCCTRL_STATUS_XOSCRDY_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCRDY as a value
Val : HAL.UInt2;
when True =>
-- XOSCRDY as an array
Arr : OSCCTRL_STATUS_XOSCRDY_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_STATUS_XOSCRDY_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- OSCCTRL_STATUS_XOSCFAIL array
type OSCCTRL_STATUS_XOSCFAIL_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_STATUS_XOSCFAIL
type OSCCTRL_STATUS_XOSCFAIL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCFAIL as a value
Val : HAL.UInt2;
when True =>
-- XOSCFAIL as an array
Arr : OSCCTRL_STATUS_XOSCFAIL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_STATUS_XOSCFAIL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- OSCCTRL_STATUS_XOSCCKSW array
type OSCCTRL_STATUS_XOSCCKSW_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_STATUS_XOSCCKSW
type OSCCTRL_STATUS_XOSCCKSW_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCCKSW as a value
Val : HAL.UInt2;
when True =>
-- XOSCCKSW as an array
Arr : OSCCTRL_STATUS_XOSCCKSW_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_STATUS_XOSCCKSW_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Status
type OSCCTRL_STATUS_Register is record
-- Read-only. XOSC 0 Ready
XOSCRDY : OSCCTRL_STATUS_XOSCRDY_Field;
-- Read-only. XOSC 0 Clock Failure Detector
XOSCFAIL : OSCCTRL_STATUS_XOSCFAIL_Field;
-- Read-only. XOSC 0 Clock Switch
XOSCCKSW : OSCCTRL_STATUS_XOSCCKSW_Field;
-- unspecified
Reserved_6_7 : HAL.UInt2;
-- Read-only. DFLL Ready
DFLLRDY : Boolean;
-- Read-only. DFLL Out Of Bounds
DFLLOOB : Boolean;
-- Read-only. DFLL Lock Fine
DFLLLCKF : Boolean;
-- Read-only. DFLL Lock Coarse
DFLLLCKC : Boolean;
-- Read-only. DFLL Reference Clock Stopped
DFLLRCS : Boolean;
-- unspecified
Reserved_13_15 : HAL.UInt3;
-- Read-only. DPLL0 Lock Rise
DPLL0LCKR : Boolean;
-- Read-only. DPLL0 Lock Fall
DPLL0LCKF : Boolean;
-- Read-only. DPLL0 Timeout
DPLL0TO : Boolean;
-- Read-only. DPLL0 Loop Divider Ratio Update Complete
DPLL0LDRTO : Boolean;
-- unspecified
Reserved_20_23 : HAL.UInt4;
-- Read-only. DPLL1 Lock Rise
DPLL1LCKR : Boolean;
-- Read-only. DPLL1 Lock Fall
DPLL1LCKF : Boolean;
-- Read-only. DPLL1 Timeout
DPLL1TO : Boolean;
-- Read-only. DPLL1 Loop Divider Ratio Update Complete
DPLL1LDRTO : Boolean;
-- unspecified
Reserved_28_31 : HAL.UInt4;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_STATUS_Register use record
XOSCRDY at 0 range 0 .. 1;
XOSCFAIL at 0 range 2 .. 3;
XOSCCKSW at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
DFLLRDY at 0 range 8 .. 8;
DFLLOOB at 0 range 9 .. 9;
DFLLLCKF at 0 range 10 .. 10;
DFLLLCKC at 0 range 11 .. 11;
DFLLRCS at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
DPLL0LCKR at 0 range 16 .. 16;
DPLL0LCKF at 0 range 17 .. 17;
DPLL0TO at 0 range 18 .. 18;
DPLL0LDRTO at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
DPLL1LCKR at 0 range 24 .. 24;
DPLL1LCKF at 0 range 25 .. 25;
DPLL1TO at 0 range 26 .. 26;
DPLL1LDRTO at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype OSCCTRL_XOSCCTRL_IPTAT_Field is HAL.UInt2;
subtype OSCCTRL_XOSCCTRL_IMULT_Field is HAL.UInt4;
-- Start-Up Time
type XOSCCTRL_STARTUPSelect is
(-- 31 us
CYCLE1,
-- 61 us
CYCLE2,
-- 122 us
CYCLE4,
-- 244 us
CYCLE8,
-- 488 us
CYCLE16,
-- 977 us
CYCLE32,
-- 1953 us
CYCLE64,
-- 3906 us
CYCLE128,
-- 7813 us
CYCLE256,
-- 15625 us
CYCLE512,
-- 31250 us
CYCLE1024,
-- 62500 us
CYCLE2048,
-- 125000 us
CYCLE4096,
-- 250000 us
CYCLE8192,
-- 500000 us
CYCLE16384,
-- 1000000 us
CYCLE32768)
with Size => 4;
for XOSCCTRL_STARTUPSelect use
(CYCLE1 => 0,
CYCLE2 => 1,
CYCLE4 => 2,
CYCLE8 => 3,
CYCLE16 => 4,
CYCLE32 => 5,
CYCLE64 => 6,
CYCLE128 => 7,
CYCLE256 => 8,
CYCLE512 => 9,
CYCLE1024 => 10,
CYCLE2048 => 11,
CYCLE4096 => 12,
CYCLE8192 => 13,
CYCLE16384 => 14,
CYCLE32768 => 15);
-- Clock Failure Detector Prescaler
type XOSCCTRL_CFDPRESCSelect is
(-- 48 MHz
DIV1,
-- 24 MHz
DIV2,
-- 12 MHz
DIV4,
-- 6 MHz
DIV8,
-- 3 MHz
DIV16,
-- 1.5 MHz
DIV32,
-- 0.75 MHz
DIV64,
-- 0.3125 MHz
DIV128)
with Size => 4;
for XOSCCTRL_CFDPRESCSelect use
(DIV1 => 0,
DIV2 => 1,
DIV4 => 2,
DIV8 => 3,
DIV16 => 4,
DIV32 => 5,
DIV64 => 6,
DIV128 => 7);
-- External Multipurpose Crystal Oscillator Control
type OSCCTRL_XOSCCTRL_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Oscillator Enable
ENABLE : Boolean := False;
-- Crystal Oscillator Enable
XTALEN : Boolean := False;
-- unspecified
Reserved_3_5 : HAL.UInt3 := 16#0#;
-- Run in Standby
RUNSTDBY : Boolean := False;
-- On Demand Control
ONDEMAND : Boolean := True;
-- Low Buffer Gain Enable
LOWBUFGAIN : Boolean := False;
-- Oscillator Current Reference
IPTAT : OSCCTRL_XOSCCTRL_IPTAT_Field := 16#0#;
-- Oscillator Current Multiplier
IMULT : OSCCTRL_XOSCCTRL_IMULT_Field := 16#0#;
-- Automatic Loop Control Enable
ENALC : Boolean := False;
-- Clock Failure Detector Enable
CFDEN : Boolean := False;
-- Xosc Clock Switch Enable
SWBEN : Boolean := False;
-- unspecified
Reserved_18_19 : HAL.UInt2 := 16#0#;
-- Start-Up Time
STARTUP : XOSCCTRL_STARTUPSelect := SAM_SVD.OSCCTRL.CYCLE1;
-- Clock Failure Detector Prescaler
CFDPRESC : XOSCCTRL_CFDPRESCSelect := SAM_SVD.OSCCTRL.DIV1;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_XOSCCTRL_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
XTALEN at 0 range 2 .. 2;
Reserved_3_5 at 0 range 3 .. 5;
RUNSTDBY at 0 range 6 .. 6;
ONDEMAND at 0 range 7 .. 7;
LOWBUFGAIN at 0 range 8 .. 8;
IPTAT at 0 range 9 .. 10;
IMULT at 0 range 11 .. 14;
ENALC at 0 range 15 .. 15;
CFDEN at 0 range 16 .. 16;
SWBEN at 0 range 17 .. 17;
Reserved_18_19 at 0 range 18 .. 19;
STARTUP at 0 range 20 .. 23;
CFDPRESC at 0 range 24 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- External Multipurpose Crystal Oscillator Control
type OSCCTRL_XOSCCTRL_Registers is array (0 .. 1)
of OSCCTRL_XOSCCTRL_Register;
-- DFLL48M Control A
type OSCCTRL_DFLLCTRLA_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- DFLL Enable
ENABLE : Boolean := True;
-- unspecified
Reserved_2_5 : HAL.UInt4 := 16#0#;
-- Run in Standby
RUNSTDBY : Boolean := False;
-- On Demand Control
ONDEMAND : Boolean := True;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DFLLCTRLA_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
Reserved_2_5 at 0 range 2 .. 5;
RUNSTDBY at 0 range 6 .. 6;
ONDEMAND at 0 range 7 .. 7;
end record;
-- DFLL48M Control B
type OSCCTRL_DFLLCTRLB_Register is record
-- Operating Mode Selection
MODE : Boolean := False;
-- Stable DFLL Frequency
STABLE : Boolean := False;
-- Lose Lock After Wake
LLAW : Boolean := False;
-- USB Clock Recovery Mode
USBCRM : Boolean := False;
-- Chill Cycle Disable
CCDIS : Boolean := False;
-- Quick Lock Disable
QLDIS : Boolean := False;
-- Bypass Coarse Lock
BPLCKC : Boolean := False;
-- Wait Lock
WAITLOCK : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DFLLCTRLB_Register use record
MODE at 0 range 0 .. 0;
STABLE at 0 range 1 .. 1;
LLAW at 0 range 2 .. 2;
USBCRM at 0 range 3 .. 3;
CCDIS at 0 range 4 .. 4;
QLDIS at 0 range 5 .. 5;
BPLCKC at 0 range 6 .. 6;
WAITLOCK at 0 range 7 .. 7;
end record;
subtype OSCCTRL_DFLLVAL_FINE_Field is HAL.UInt8;
subtype OSCCTRL_DFLLVAL_COARSE_Field is HAL.UInt6;
subtype OSCCTRL_DFLLVAL_DIFF_Field is HAL.UInt16;
-- DFLL48M Value
type OSCCTRL_DFLLVAL_Register is record
-- Fine Value
FINE : OSCCTRL_DFLLVAL_FINE_Field := 16#0#;
-- unspecified
Reserved_8_9 : HAL.UInt2 := 16#0#;
-- Coarse Value
COARSE : OSCCTRL_DFLLVAL_COARSE_Field := 16#0#;
-- Multiplication Ratio Difference
DIFF : OSCCTRL_DFLLVAL_DIFF_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DFLLVAL_Register use record
FINE at 0 range 0 .. 7;
Reserved_8_9 at 0 range 8 .. 9;
COARSE at 0 range 10 .. 15;
DIFF at 0 range 16 .. 31;
end record;
subtype OSCCTRL_DFLLMUL_MUL_Field is HAL.UInt16;
subtype OSCCTRL_DFLLMUL_FSTEP_Field is HAL.UInt8;
subtype OSCCTRL_DFLLMUL_CSTEP_Field is HAL.UInt6;
-- DFLL48M Multiplier
type OSCCTRL_DFLLMUL_Register is record
-- DFLL Multiply Factor
MUL : OSCCTRL_DFLLMUL_MUL_Field := 16#0#;
-- Fine Maximum Step
FSTEP : OSCCTRL_DFLLMUL_FSTEP_Field := 16#0#;
-- unspecified
Reserved_24_25 : HAL.UInt2 := 16#0#;
-- Coarse Maximum Step
CSTEP : OSCCTRL_DFLLMUL_CSTEP_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DFLLMUL_Register use record
MUL at 0 range 0 .. 15;
FSTEP at 0 range 16 .. 23;
Reserved_24_25 at 0 range 24 .. 25;
CSTEP at 0 range 26 .. 31;
end record;
-- DFLL48M Synchronization
type OSCCTRL_DFLLSYNC_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- ENABLE Synchronization Busy
ENABLE : Boolean := False;
-- DFLLCTRLB Synchronization Busy
DFLLCTRLB : Boolean := False;
-- DFLLVAL Synchronization Busy
DFLLVAL : Boolean := False;
-- DFLLMUL Synchronization Busy
DFLLMUL : Boolean := False;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DFLLSYNC_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
DFLLCTRLB at 0 range 2 .. 2;
DFLLVAL at 0 range 3 .. 3;
DFLLMUL at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
end record;
--------------------------------------
-- OSCCTRL_DPLL cluster's Registers --
--------------------------------------
-- DPLL Control A
type OSCCTRL_DPLLCTRLA_OSCCTRL_DPLL_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- DPLL Enable
ENABLE : Boolean := False;
-- unspecified
Reserved_2_5 : HAL.UInt4 := 16#0#;
-- Run in Standby
RUNSTDBY : Boolean := False;
-- On Demand Control
ONDEMAND : Boolean := True;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DPLLCTRLA_OSCCTRL_DPLL_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
Reserved_2_5 at 0 range 2 .. 5;
RUNSTDBY at 0 range 6 .. 6;
ONDEMAND at 0 range 7 .. 7;
end record;
subtype OSCCTRL_DPLLRATIO_OSCCTRL_DPLL_LDR_Field is HAL.UInt13;
subtype OSCCTRL_DPLLRATIO_OSCCTRL_DPLL_LDRFRAC_Field is HAL.UInt5;
-- DPLL Ratio Control
type OSCCTRL_DPLLRATIO_OSCCTRL_DPLL_Register is record
-- Loop Divider Ratio
LDR : OSCCTRL_DPLLRATIO_OSCCTRL_DPLL_LDR_Field := 16#0#;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- Loop Divider Ratio Fractional Part
LDRFRAC : OSCCTRL_DPLLRATIO_OSCCTRL_DPLL_LDRFRAC_Field := 16#0#;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DPLLRATIO_OSCCTRL_DPLL_Register use record
LDR at 0 range 0 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
LDRFRAC at 0 range 16 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
-- Proportional Integral Filter Selection
type DPLLCTRLB_FILTERSelect is
(-- Bandwidth = 92.7Khz and Damping Factor = 0.76
FILTER1,
-- Bandwidth = 131Khz and Damping Factor = 1.08
FILTER2,
-- Bandwidth = 46.4Khz and Damping Factor = 0.38
FILTER3,
-- Bandwidth = 65.6Khz and Damping Factor = 0.54
FILTER4,
-- Bandwidth = 131Khz and Damping Factor = 0.56
FILTER5,
-- Bandwidth = 185Khz and Damping Factor = 0.79
FILTER6,
-- Bandwidth = 65.6Khz and Damping Factor = 0.28
FILTER7,
-- Bandwidth = 92.7Khz and Damping Factor = 0.39
FILTER8,
-- Bandwidth = 46.4Khz and Damping Factor = 1.49
FILTER9,
-- Bandwidth = 65.6Khz and Damping Factor = 2.11
FILTER10,
-- Bandwidth = 23.2Khz and Damping Factor = 0.75
FILTER11,
-- Bandwidth = 32.8Khz and Damping Factor = 1.06
FILTER12,
-- Bandwidth = 65.6Khz and Damping Factor = 1.07
FILTER13,
-- Bandwidth = 92.7Khz and Damping Factor = 1.51
FILTER14,
-- Bandwidth = 32.8Khz and Damping Factor = 0.53
FILTER15,
-- Bandwidth = 46.4Khz and Damping Factor = 0.75
FILTER16)
with Size => 4;
for DPLLCTRLB_FILTERSelect use
(FILTER1 => 0,
FILTER2 => 1,
FILTER3 => 2,
FILTER4 => 3,
FILTER5 => 4,
FILTER6 => 5,
FILTER7 => 6,
FILTER8 => 7,
FILTER9 => 8,
FILTER10 => 9,
FILTER11 => 10,
FILTER12 => 11,
FILTER13 => 12,
FILTER14 => 13,
FILTER15 => 14,
FILTER16 => 15);
-- Reference Clock Selection
type DPLLCTRLB_REFCLKSelect is
(-- Dedicated GCLK clock reference
GCLK,
-- XOSC32K clock reference
XOSC32,
-- XOSC0 clock reference
XOSC0,
-- XOSC1 clock reference
XOSC1)
with Size => 3;
for DPLLCTRLB_REFCLKSelect use
(GCLK => 0,
XOSC32 => 1,
XOSC0 => 2,
XOSC1 => 3);
-- Lock Time
type DPLLCTRLB_LTIMESelect is
(-- No time-out. Automatic lock
DEFAULT,
-- Time-out if no lock within 800us
Val_800US,
-- Time-out if no lock within 900us
Val_900US,
-- Time-out if no lock within 1ms
Val_1MS,
-- Time-out if no lock within 1.1ms
Val_1P1MS)
with Size => 3;
for DPLLCTRLB_LTIMESelect use
(DEFAULT => 0,
Val_800US => 4,
Val_900US => 5,
Val_1MS => 6,
Val_1P1MS => 7);
-- Sigma-Delta DCO Filter Selection
type DPLLCTRLB_DCOFILTERSelect is
(-- Capacitor(pF) = 0.5 and Bandwidth Fn (MHz) = 3.21
FILTER1,
-- Capacitor(pF) = 1 and Bandwidth Fn (MHz) = 1.6
FILTER2,
-- Capacitor(pF) = 1.5 and Bandwidth Fn (MHz) = 1.1
FILTER3,
-- Capacitor(pF) = 2 and Bandwidth Fn (MHz) = 0.8
FILTER4,
-- Capacitor(pF) = 2.5 and Bandwidth Fn (MHz) = 0.64
FILTER5,
-- Capacitor(pF) = 3 and Bandwidth Fn (MHz) = 0.55
FILTER6,
-- Capacitor(pF) = 3.5 and Bandwidth Fn (MHz) = 0.45
FILTER7,
-- Capacitor(pF) = 4 and Bandwidth Fn (MHz) = 0.4
FILTER8)
with Size => 3;
for DPLLCTRLB_DCOFILTERSelect use
(FILTER1 => 0,
FILTER2 => 1,
FILTER3 => 2,
FILTER4 => 3,
FILTER5 => 4,
FILTER6 => 5,
FILTER7 => 6,
FILTER8 => 7);
subtype OSCCTRL_DPLLCTRLB_OSCCTRL_DPLL_DIV_Field is HAL.UInt11;
-- DPLL Control B
type OSCCTRL_DPLLCTRLB_OSCCTRL_DPLL_Register is record
-- Proportional Integral Filter Selection
FILTER : DPLLCTRLB_FILTERSelect := SAM_SVD.OSCCTRL.FILTER1;
-- Wake Up Fast
WUF : Boolean := False;
-- Reference Clock Selection
REFCLK : DPLLCTRLB_REFCLKSelect := SAM_SVD.OSCCTRL.XOSC32;
-- Lock Time
LTIME : DPLLCTRLB_LTIMESelect := SAM_SVD.OSCCTRL.DEFAULT;
-- Lock Bypass
LBYPASS : Boolean := False;
-- Sigma-Delta DCO Filter Selection
DCOFILTER : DPLLCTRLB_DCOFILTERSelect := SAM_SVD.OSCCTRL.FILTER1;
-- DCO Filter Enable
DCOEN : Boolean := False;
-- Clock Divider
DIV : OSCCTRL_DPLLCTRLB_OSCCTRL_DPLL_DIV_Field := 16#0#;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DPLLCTRLB_OSCCTRL_DPLL_Register use record
FILTER at 0 range 0 .. 3;
WUF at 0 range 4 .. 4;
REFCLK at 0 range 5 .. 7;
LTIME at 0 range 8 .. 10;
LBYPASS at 0 range 11 .. 11;
DCOFILTER at 0 range 12 .. 14;
DCOEN at 0 range 15 .. 15;
DIV at 0 range 16 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
-- DPLL Synchronization Busy
type OSCCTRL_DPLLSYNCBUSY_OSCCTRL_DPLL_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit;
-- Read-only. DPLL Enable Synchronization Status
ENABLE : Boolean;
-- Read-only. DPLL Loop Divider Ratio Synchronization Status
DPLLRATIO : Boolean;
-- unspecified
Reserved_3_31 : HAL.UInt29;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DPLLSYNCBUSY_OSCCTRL_DPLL_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
DPLLRATIO at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- DPLL Status
type OSCCTRL_DPLLSTATUS_OSCCTRL_DPLL_Register is record
-- Read-only. DPLL Lock Status
LOCK : Boolean;
-- Read-only. DPLL Clock Ready
CLKRDY : Boolean;
-- unspecified
Reserved_2_31 : HAL.UInt30;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DPLLSTATUS_OSCCTRL_DPLL_Register use record
LOCK at 0 range 0 .. 0;
CLKRDY at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
type OSCCTRL_DPLL_Cluster is record
-- DPLL Control A
DPLLCTRLA : aliased OSCCTRL_DPLLCTRLA_OSCCTRL_DPLL_Register;
-- DPLL Ratio Control
DPLLRATIO : aliased OSCCTRL_DPLLRATIO_OSCCTRL_DPLL_Register;
-- DPLL Control B
DPLLCTRLB : aliased OSCCTRL_DPLLCTRLB_OSCCTRL_DPLL_Register;
-- DPLL Synchronization Busy
DPLLSYNCBUSY : aliased OSCCTRL_DPLLSYNCBUSY_OSCCTRL_DPLL_Register;
-- DPLL Status
DPLLSTATUS : aliased OSCCTRL_DPLLSTATUS_OSCCTRL_DPLL_Register;
end record
with Size => 160;
for OSCCTRL_DPLL_Cluster use record
DPLLCTRLA at 16#0# range 0 .. 7;
DPLLRATIO at 16#4# range 0 .. 31;
DPLLCTRLB at 16#8# range 0 .. 31;
DPLLSYNCBUSY at 16#C# range 0 .. 31;
DPLLSTATUS at 16#10# range 0 .. 31;
end record;
type OSCCTRL_DPLL_Clusters is array (0 .. 1) of OSCCTRL_DPLL_Cluster;
-----------------
-- Peripherals --
-----------------
-- Oscillators Control
type OSCCTRL_Peripheral is record
-- Event Control
EVCTRL : aliased OSCCTRL_EVCTRL_Register;
-- Interrupt Enable Clear
INTENCLR : aliased OSCCTRL_INTENCLR_Register;
-- Interrupt Enable Set
INTENSET : aliased OSCCTRL_INTENSET_Register;
-- Interrupt Flag Status and Clear
INTFLAG : aliased OSCCTRL_INTFLAG_Register;
-- Status
STATUS : aliased OSCCTRL_STATUS_Register;
-- External Multipurpose Crystal Oscillator Control
XOSCCTRL : aliased OSCCTRL_XOSCCTRL_Registers;
-- DFLL48M Control A
DFLLCTRLA : aliased OSCCTRL_DFLLCTRLA_Register;
-- DFLL48M Control B
DFLLCTRLB : aliased OSCCTRL_DFLLCTRLB_Register;
-- DFLL48M Value
DFLLVAL : aliased OSCCTRL_DFLLVAL_Register;
-- DFLL48M Multiplier
DFLLMUL : aliased OSCCTRL_DFLLMUL_Register;
-- DFLL48M Synchronization
DFLLSYNC : aliased OSCCTRL_DFLLSYNC_Register;
OSCCTRL_DPLL : aliased OSCCTRL_DPLL_Clusters;
end record
with Volatile;
for OSCCTRL_Peripheral use record
EVCTRL at 16#0# range 0 .. 7;
INTENCLR at 16#4# range 0 .. 31;
INTENSET at 16#8# range 0 .. 31;
INTFLAG at 16#C# range 0 .. 31;
STATUS at 16#10# range 0 .. 31;
XOSCCTRL at 16#14# range 0 .. 63;
DFLLCTRLA at 16#1C# range 0 .. 7;
DFLLCTRLB at 16#20# range 0 .. 7;
DFLLVAL at 16#24# range 0 .. 31;
DFLLMUL at 16#28# range 0 .. 31;
DFLLSYNC at 16#2C# range 0 .. 7;
OSCCTRL_DPLL at 16#30# range 0 .. 319;
end record;
-- Oscillators Control
OSCCTRL_Periph : aliased OSCCTRL_Peripheral
with Import, Address => OSCCTRL_Base;
end SAM_SVD.OSCCTRL;
|
src/u2/p11.asm | luishendrix92/lenguajezinterfaz | 0 | 81647 | <reponame>luishendrix92/lenguajezinterfaz<gh_stars>0
; 11 - Programa que pide una frase con DUP
; <NAME>
; 15211312
; 4 de Octubre del 2018
.Model small
.Stack 64
.Data
frase_prompt db "Escriba una frase (50c max): $"
frase_input db 50 dup(?),'$'
.Code
MAIN PROC
mov ax,@Data
mov ds,ax
mov ah,09h
lea dx,frase_prompt
int 21h
mov ah,3fh
mov cx,50
lea dx,frase_input
int 21h
mov ah,09h
lea dx,frase_input
int 21h
.Exit
ENDP
End MAIN
|
header.asm | fis/chainlance | 4 | 11888 | ;;; chainlance asm source -*- mode: nasm -*-
BITS 64
SECTION .text
;;; Symbolic names for fixed registers
%define rTapeSize rdx
%define rTapeSized edx
%define rTapeSizeb dl
%define rTapeA rbx
%define rTapeB rcx
%define rTapeAb bl
%define rTapeBb cl
%define rRepAd r8d
%define rRepBd r9d
%define rRepSA r10
%define rRepSB r11
%define rSaveIP r12
%define rCell2 r13b
%define rTapeBase r14
%define rCycles r15
%define rCyclesd r15d
;;; Top-level logic for BF Joust matches
%define MAXCYCLES 100000
%define MINTAPE 10
%define MAXTAPE 30
global main
main:
;; miscellaneous initialization
mov rbp, rsp
cld ; make stosb and such always advance
xor esi, esi ; sum of wins for progA
;; run through all tape sizes with progA vs progB
xor rTapeSized, rTapeSized
mov rTapeSizeb, MINTAPE
loop1: lea rSaveIP, [rel progB]
call run
inc rTapeSizeb
cmp rTapeSizeb, MAXTAPE
jbe loop1
;; run through all tape sizes with progA vs progB2 (reverse polarity)
xor rTapeSized, rTapeSized
mov rTapeSizeb, MINTAPE
loop2: lea rSaveIP, [rel progB2]
call run
inc rTapeSizeb
cmp rTapeSizeb, MAXTAPE
jbe loop2
;; all done, return the result (-42 .. 42 for tapes 10 .. 30)
mov eax, esi
ret
;;; Single-match execution and initialization
run: ;; runs a single match
;; rSaveIP should be set to either progB or progB2
;; rTapeSize should be set to the proper tape size
;; initialize tape for tape of rTapeSize bytes
;; also sets rTapeBase, rTapeA, rTapeB, rCell2
xor eax, eax
lea rdi, [rel tape]
mov rTapeBase, rdi ; save start of tape
mov ecx, rTapeSized
rep stosb ; tape[0 .. size-1] = 0
xor rTapeA, rTapeA ; tape pointer for A = 0 = left end
lea rTapeB, [rTapeA+rTapeSize-1] ; tape pointer for B = size-1 = right end
mov al, 128
mov [rTapeBase], al ; tape[0] = flagA = 128
mov [rTapeBase+rTapeB], al ; tape[size-1] = flagB = 128
mov rCell2, al ; copy of tape[B] for the first cycle
;; initialize rep counter stack
%if MAXREPS > 1
lea rRepSA, [rel repStackA]
lea rRepSB, [rel repStackB]
%endif
;; start executing this round
mov rCyclesd, MAXCYCLES ; initialize cycle counter
xor edi, edi ; used for "death flags"
runit: jmp progA
;;; Helper macros and snippets for the compiled code
;; context switch ProgA -> ProgB
%macro CTX_ProgA 0
lea rax, [rel %%next]
xchg rax, rSaveIP
jmp (rax)
%%next:
%endmacro
;; context switch ProgB -> ProgA
%macro CTX_ProgB 0
lea rax, [rel %%next]
jmp nextcycle
%%next:
%endmacro
;; end-of-cycle code
nextcycle:
cmp byte [rTapeBase], 0
jz .flagA ; A's flag is zero
btr edi, 1 ; A's flag is nonzero, clear flag
.testB: cmp byte [rTapeBase + rTapeSize - 1], 0
jz .flagB ; B's flag is zero
btr edi, 2 ; B's flag is nonzero, clear flag
.cont: bt edi, 0
jc .winB ; A totally dead, B wins
dec rCycles
jz tie ; tie if out of cycles
mov rCell2, [rTapeBase + rTapeB] ; save a copy for ProgB [ check
xchg rax, rSaveIP
jmp (rax)
.flagA:
bts edi, 1 ; ensure the zero gets flagged
jnc .testB ; first offense, let live and test B
bts edi, 0 ; second offense, flag totally dead
jmp .testB ; test B in case of ties
.flagB:
bts edi, 2 ; make sure it gets flagged
jnc .cont ; first offense, let live
bt edi, 0
jc tie ; A also dead. so tie
inc esi
ret ; A wins (esi +1)
.winB:
dec esi
ret ; B wins (esi -1)
;; A fell of the tape (middle of cycle, must wait for tie)
fallA:
bts edi, 0 ; flag A as totally dead
CTX_ProgA ; let B run to check for tie
;; B fell of the tape (end of cycle, can decide)
fallB:
bt edi, 0
jc tie ; A also totally dead, tie
cmp byte [rTapeBase], 0
jnz .notie ; A known to be alive, A wins
bt edi, 1
jc tie ; A dead by flag now, tie
.notie: inc esi
ret ; A wind (esi +1)
;; in case of a tie
tie: ret ; tie (no change in esi)
;;; Statically allocated memory for tape and such
SECTION .data
tape: times 30 db 0
%if MAXREPS > 1
repStackA:
times MAXREPS-1 dd 0
repStackB:
times MAXREPS-1 dd 0
%endif
SECTION .text
;;; Program code below
|
tests/TestNetworking/src/main.asm | Gegel85/GBEmulator | 0 | 173971 | <reponame>Gegel85/GBEmulator
include "src/constants.asm"
include "src/macro.asm"
SECTION "Main", ROM0
; Locks the CPU
; Params:
; None
; Return:
; None
; Registers:
; N/A
lockup::
reset INTERRUPT_ENABLED
halt
; Tests if the current hardware is SGB
; Params:
; None
; Return:
; a -> 0 if on DMG. 1 if on SGB.
; Flag Z -> 1 if on DMG. 0 if on SGB.
; Registers:
; af -> Not preserved
; bc -> Not preserved
; de -> Not preserved
; hl -> Not preserved
testSGB::
ld a, MLT_REQ
ld hl, MLT_REQ_PAR
call sendSGBCommand
ld hl, JOYPAD_REGISTER
ld b, [hl]
ld [hl], %11100000
ld [hl], %11010000
ld [hl], %11110000
ld a, [hl]
xor b
ret
; The text displayed when playing on a Gameboy
toSendText::
db "To send-", 0, 0
bufferText:
db "Buffer -", 0, 0
modeText:
db "Mode-"
falseText:
db "False"
trueText:
db "True", 0
internalText:
db "Internal"
externalText:
db "External"
transferText:
db "Is transfering-"
interruptText:
db "Got interrupt-"
updateText::
ld a, [TO_SEND_REGISTER]
ld de, $9808
call my_put_nbr
ld a, [$FF01]
ld de, $9828
call my_put_nbr
ld a, [$FF02]
bit 0, a
ld de, $9845
ld bc, $8
jr nz, .internal
ld hl, externalText
jr .end
.internal:
ld hl, internalText
.end:
call copyMemory
ld a, [$FF02]
bit 7, a
ld de, $986F
ld bc, $5
jr z, .noTransfer
ld hl, trueText
jr .end2
.noTransfer:
ld hl, falseText
.end2:
call copyMemory
ld a, [INTERUPT_OCCURED]
ld de, $988E
ld bc, $5
or a
jr z, .noInterrupt
ld hl, trueText
jr .end3
.noInterrupt:
ld hl, falseText
.end3:
call copyMemory
ret
; Main function
main::
call init ; Init
ld sp, $E000 ; Init stack
call loadTextAsset
ld hl, toSendText
ld bc, bufferText - toSendText
ld de, $9800
call copyMemory
ld bc, modeText - bufferText
ld de, $9820
call copyMemory
ld bc, falseText - modeText
ld de, $9840
call copyMemory
ld hl, transferText
ld bc, interruptText - transferText
ld de, $9860
call copyMemory
ld bc, interruptText - transferText
ld de, $9880
call copyMemory
reg LCD_CONTROL, %10010001
.loop:
halt
call updateText
call getKeys
ld hl, TO_SEND_REGISTER
bit 3, a
call z, .dec
bit 2, a
call z, .inc
ld hl, $FF02
bit 5, a
call z, .switch
bit 4, a
call z, .send
jr .loop
.switch:
bit 0, [hl]
jr z, .isExternal
res 0, [hl]
jr .endSwitch
.isExternal:
set 0, [hl]
.endSwitch:
ret
.dec:
dec [hl]
ret
.inc:
inc [hl]
ret
.send:
bit 7, [hl]
ret nz
ld a, [TO_SEND_REGISTER]
ld [$FF01], a
reset INTERUPT_OCCURED
set 7, [hl]
ret
include "src/init.asm"
include "src/fatal_error.asm"
include "src/utils.asm"
include "src/sgb_utils.asm"
include "src/interrupts.asm" |
software/arithmetic_test/mathtest.asm | paulscottrobson/retrochallenge-jan-2016 | 0 | 89637 | ; ******************************************************************************************************************
;
; Maths testing program
;
; ******************************************************************************************************************
cpu sc/mp
org 0xC40
include types.inc ; defines operator and testBlockSize
testStart:
ldi testTable/256 ; make P1 point to test table.
xpah p1
ldi testTable&255
xpal p1
processNext:
ld 0(p1) ; stop if all input values are 0.
or 1(p1)
or 2(p1)
or 3(p1)
jz Halt
ldi 0x0F ; make P2 point to the stack
xpah p2
ldi 0xFF
xpal p2
ld 1(p1) ; push first two values on the stack.
st @-1(p2)
ld 0(p1)
st @-1(p2)
ld 3(p1)
st @-1(p2)
ld 2(p1)
st @-1(p2)
ldi 0 ; set P3 to point to Maths routine
xpah p3
ldi 2
xpal p3
ldi operator ; pick operator
xppc p3
ld 0(p2)
xor 4(p1)
jnz Failed
ld 1(p2)
xor 5(p1)
jnz Failed
ldi operator ; division ?
xri '/'
jnz advanceNext
; ld -2(p2) ; check remainder.
; xor 6(p1)
; jnz Failed
; ld -1(p2)
; xor 7(p1)
; jnz Failed
advanceNext:
ld @testBlockSize(p1) ; go to next test
jmp processNext
Failed: ldi 0xFF ; error P1 points to sum, P2 answer
Halt: xae ; display result in E and A
lde
jmp Halt ; just stop.
org 0x1000
testTable:
include tests.inc
dw 0 ; 0 func 0 marks the end of the table.
dw 0
|
oeis/083/A083426.asm | neoneye/loda-programs | 11 | 15832 | ; A083426: (4*7^n+2^n)/5.
; Submitted by <NAME>(s1)
; 1,6,40,276,1924,13452,94132,658860,4611892,32282988,225980404,1581861804,11073030580,77511209964,542578461556,3798049214508,26586344468788,186104411215980,1302730878380788,9119116148403372
mov $1,7
pow $1,$0
mul $1,4
mov $2,2
pow $2,$0
add $1,$2
mov $0,$1
div $0,5
|
Source/Api/EtAlii.Ubigia.Api.Functional.Antlr/Primitives.g4 | vrenken/EtAlii.Ubigia | 2 | 2976 | parser grammar Primitives;
@header {
#pragma warning disable CS0115 // CS0115: no suitable method found to override
#pragma warning disable CS3021 // CS3021: The CLSCompliant attribute is not needed because the assembly does not have a CLSCompliant attribute
// ReSharper disable InvalidXmlDocComment
// ReSharper disable all
}
options {
language = CSharp;
tokenVocab = UbigiaLexer;
}
// Datetimes.
datetime_d4 : DIGIT DIGIT DIGIT DIGIT ;
datetime_d2 : DIGIT? DIGIT ;
datetime_d3 : DIGIT? DIGIT? DIGIT ;
datetime
: datetime_d4 MINUS datetime_d2 MINUS datetime_d2 WHITESPACE datetime_d2 COLON datetime_d2 COLON datetime_d2 COLON datetime_d3 #datetime_format_1
| datetime_d4 MINUS datetime_d2 MINUS datetime_d2 WHITESPACE datetime_d2 COLON datetime_d2 COLON datetime_d2 #datetime_format_2
| datetime_d4 MINUS datetime_d2 MINUS datetime_d2 WHITESPACE datetime_d2 COLON datetime_d2 #datetime_format_3
| datetime_d4 MINUS datetime_d2 MINUS datetime_d2 #datetime_format_4
| datetime_d2 MINUS datetime_d2 MINUS datetime_d4 WHITESPACE datetime_d2 COLON datetime_d2 COLON datetime_d2 COLON datetime_d3 #datetime_format_5
| datetime_d2 MINUS datetime_d2 MINUS datetime_d4 WHITESPACE datetime_d2 COLON datetime_d2 COLON datetime_d2 #datetime_format_6
| datetime_d2 MINUS datetime_d2 MINUS datetime_d4 WHITESPACE datetime_d2 COLON datetime_d2 #datetime_format_7
| datetime_d2 MINUS datetime_d2 MINUS datetime_d4 #datetime_format_8
;
timespan
: integer_literal_unsigned COLON integer_literal_unsigned COLON integer_literal_unsigned COLON integer_literal_unsigned DOT integer_literal_unsigned ;
// Objects.
object_value
: WHITESPACE* LBRACE (WHITESPACE | NEWLINE)* object_kv_pair_with_comma*? WHITESPACE* object_kv_pair_without_comma WHITESPACE* RBRACE WHITESPACE*
| WHITESPACE* LBRACE (WHITESPACE | NEWLINE)* RBRACE WHITESPACE*
;
object_kv_pair_without_comma : WHITESPACE* object_kv_key WHITESPACE* COLON WHITESPACE* object_kv_value? (WHITESPACE | NEWLINE)* ;
object_kv_pair_with_comma : WHITESPACE* object_kv_key WHITESPACE* COLON WHITESPACE* object_kv_value? (WHITESPACE | NEWLINE)* COMMA (WHITESPACE | NEWLINE)*;
object_kv_key
: identifier
| string_quoted_non_empty
;
object_kv_value
: primitive_value
| object_value
;
primitive_value
: string_quoted
| string_quoted_non_empty
| datetime
| timespan
| float_literal
| float_literal_unsigned
| integer_literal
| integer_literal_unsigned
| boolean_literal
;
reserved_words
: BOOLEAN_LITERAL
| ROOT_SUBJECT_PREFIX
| ANNOTATION_NODE
| ANNOTATION_NODES
| HEADER_OPTION_NAMESPACE
| HEADER_OPTION_CONTEXT
| VALUE_TYPE_OBJECT
| VALUE_TYPE_STRING
| VALUE_TYPE_BOOL
| VALUE_TYPE_FLOAT
| VALUE_TYPE_INT
| VALUE_TYPE_DATETIME
// | ANNOTATION_NODE_ADD
// | ANNOTATION_NODES_ADD
// | ANNOTATION_NODE_LINK
// | ANNOTATION_NODES_LINK
// | ANNOTATION_NODE_REMOVE
// | ANNOTATION_NODES_REMOVE
// | ANNOTATION_NODE_UNLINK
// | ANNOTATION_NODES_UN_LINK
// | ANNOTATION_NODE_VALUE_SET
// | ANNOTATION_NODE_VALUE_CLEAR
;
identifier : IDENTIFIER | reserved_words ;
string_quoted : STRING_QUOTED ;
string_quoted_non_empty : STRING_QUOTED_NON_EMPTY ;
integer_literal : (PLUS | MINUS) DIGIT+ ;
integer_literal_unsigned : DIGIT+ ;
float_literal : (PLUS | MINUS) DIGIT+ DOT DIGIT+ ;
float_literal_unsigned : DIGIT+ DOT DIGIT+ ;
boolean_literal : BOOLEAN_LITERAL ;
|
oeis/017/A017489.asm | neoneye/loda-programs | 11 | 169839 | <filename>oeis/017/A017489.asm
; A017489: a(n) = (11*n + 8)^5.
; 32768,2476099,24300000,115856201,380204032,992436543,2219006624,4437053125,8153726976,14025517307,22877577568,35723051649,53782400000,78502725751,111577100832,154963892093,210906087424,281950621875,370967703776,481170140857,616132666368,779811265199,976562500000,1211162837301,1488827973632,1815232161643,2196527536224,2639363440625,3150905752576,3738856210407,4411471739168,5177583776749,6046617600000,7028611650851,8134236862432,9374815985193,10762342913024,12309502009375,14029687433376
mul $0,11
add $0,8
pow $0,5
|
PRG/prg022.asm | narfman0/smb3_pp1 | 0 | 84215 | ; Super Mario Bros. 3 Full Disassembly by Southbird 2012
; For more info, see http://www.sonicepoch.com/sm3mix/
;
; PLEASE INCLUDE A CREDIT TO THE SOUTHBIRD DISASSEMBLY
; AND THE ABOVE LINK SOMEWHERE IN YOUR WORKS :)
;
; Original disassembler source generated by DCC6502 version v1.4
; (With labels, comments, and some syntax corrections for nesasm by Southbird)
; For more info about DCC6502, e-mail <EMAIL>
;
; This source file last updated: 2012-01-05 18:09:49.828384346 -0600
; Distribution package date: Fri Apr 6 23:46:16 UTC 2012
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; THE [LOST] BONUS GAMES!
;---------------------------------------------------------------------------
;
; If you don't know about it: http://themushroomkingdom.net/smb3_lost.shtml
;
; While in previous exploits I did find traces of the "lost" Bonus Games,
; the translation efforts on various sites (e.g. The Mushroom Kingdom)
; and the game "restoring" patch by BMF54123 makes some of this clear.
; It should be noted that BMF54123's patch works by constructing a custom
; pattern bank to replace the missing sprites so it's unknown how much of
; it is truly accurate (except for the alternate game hosts, which still
; exist in stock SMB3), but for now I'll have faith in his reproduction.
;
; The only thing we really have to go on with the "lost" Bonus Games are
; some scattered graphics and the string translations. During this work
; I formulated a few theories, although all of it is ultimately speculation.
;
; There appeared to have been at least four Bonus Games planned, and they
; are vaguely described as follows:
;
; The Key/Coin Game
; "If 1 appears, 1 (?)
; If 2 appears, I'll give you a key
; Otherwise, I'll give you coins."
;
; The Odd Game
; "If an odd number appears, I'll let you play the Roulette Game."
;
; The Even Game
; "If an even number appears, I'll let you play the Card Game."
;
; Koopa Troopa's "Prize" Game
; No text to describe this one, but pictures speak louder than words
; (More below...)
;
; All of these games were powered by a rotating die (as it is displayed in
; BMF54123's patch.) What the die face values meant are determined by the
; bonus game type (Bonus_GameType.)
;
; While in fact none of the prizes stated in these messages can be obtained,
; they allude to a completely different bonus game structure and another
; perhaps lost SMB3 gameplay device, the "key."
;
; Bearing in mind this is only speculation, it would make sense that the
; "Roulette" game mentioned in the text is in fact what we now know as
; the "Spade" game from the World Map, where you line up the three rows of
; images to form the picture. The "Card" game then is most likely what
; we now know as "N-Spade", the memory card matching game. Thus it can
; be suggested that direct access to either was not the original intention,
; they were "prizes" for a lucky roll of the die.
;
; However, it is not as easy to determine the purpose of two other glaring
; omissions -- the alternate game hosts (Koopa Troopa and Hammer Bro) as
; well as the mysterious "key." Why the villains would EVER host the game
; has no clear rhyme or reason. The "key" could perhaps once have been the
; means of unlocking the "locks" on the World Map, instead of the present
; day means of unlocking via the Mini-Fortress. Whether this would have
; been an item the Player carried to use at his whim or whether the lock
; would automatically clear like it does now is also indeterminable.
;
; The current state as it exists in the code:
;
;---------------------------------------------------------------------------
; Die Face 1: "If 1 appears, 1 (?)"
;---------------------------------------------------------------------------
; This currently actually gives you an extra life, but does not play the
; 1-Up sound or worry about a 99 lives cap. Like Die Face 1, it is quite
; possible that this extra life is also not the intended prize. Perhaps
; either a placeholder or a last ditch effort to spare the die games when
; it became apparent they were potentially to be cut...
;
;
;---------------------------------------------------------------------------
; Die Face 2: "If 2 appears, I'll give you a key"
;---------------------------------------------------------------------------
; This attempts to give you "something." Literally what it does is add 1
; to the lowest byte of the Player-specific score storage. But not in an
; appropriate way with carry-arithmetic. So most likely this was not
; really what was supposed to be getting incremented; it likely was giving
; you one more of "something." Whether or not that "something" was
; actually obtained is unclear, especially since the incomplete messsage
; does not allude to what it was supposed to be, if it was ever even known.
; But since it effects Player-specific memory, it can at least be assumed
; that they intended to give the current Player one of "something."
;
;
;---------------------------------------------------------------------------
; Die Face 3-6: "Otherwise, I'll give you coins."
;---------------------------------------------------------------------------
; Visually, this promise is held true; "coins" will pop out in a confetti
; like motion for Die Face 3-6. Code-wise, however, it actually ends up
; giving you (Face Value * 10) points. Don't let the multiplication lead
; you on too far, because SMB3 uses a fake leading zero on the score, so
; it's really only adding the face value of the die to your score variable.
; It is quite easy to believe that there is simply a mistake in the code
; or that this code is old and unmaintained, and in fact what is now the
; earned score used to be the earned coins. In any case, this is the only
; segment of the Die Game that seems to be almost at its intended form.
;
; The final note that should be made here is that coins have no purpose on
; the world map. Your coin total is changed to bonus at the end of every
; level, or lost upon death. So this further suggests that there was once
; a persistence of coin count on the world map, perhaps to purchase items
; (maybe Toad House would have been a shop?) or gamble with.
;
;---------------------------------------------------------------------------
; The Odd/Even Games
; "If an odd number appears, I'll let you play the Roulette Game."
; "If an even number appears, I'll let you play the Card Game."
;---------------------------------------------------------------------------
; This one is interesting and, as suggested above, most likely connected
; you to the now-known-as Spade and N-Spade games respectively. What's
; also interesting is the code for playing the Odd/Even game is still
; present but logically inaccessible; the values that originally selected
; to play the Odd/Even games have now actually been replaced by the Spade
; and N-Spade respectively! (Further suggesting the connection.)
;
; But the code and lookup tables that make the game possible still exist,
; and the way they play out now is that "winning" the Odd game sets
; Bonus_DieCnt to 5 and the Even game forces it to 6. This would be used
; to determine which game you got to play after that...
;
; It seems that the Odd/Even games were refactored to slot 5 and 6 after
; formerly occupying slot 1 and 2, respectively. This is further suggested
; by the fact that the "Round 2" strings for Bonus_Round2 1 and 2 are
; duplicated for Bonus_GameType 5 and 6.
;
;
;---------------------------------------------------------------------------
; "Round 2"
;---------------------------------------------------------------------------
; What I refer to as "Round 2" in the code was where apparently the Die game
; could transition into another bonus game. The only place this is apparently
; set up to work are the Odd/Even Games, which intended to proceed to the
; Roulette (Spade) or Card (N-Spade) games in "Round 2."
;
; At the end of all the "Host Greet" strings, there is a value that gets
; pushed into Bonus_Round2. This determines what Round 2 will be!
;
; In summary (example for Odd/Even):
; Round 1: Get instructed and play Odd/Even Game; if you win...
; Round 2: Previous dialog is erased, get instructed and play Roulette/Card Game
;
; The code was likely possibly considering that other games would have a
; "Round 2" component, but this never materialized... but some hints of what
; other "Round 2" things may have occurred are hinted by some of the strings
;
;
;---------------------------------------------------------------------------
; Koopa Troopa's "Prize" Game
;---------------------------------------------------------------------------
; This is the most incomplete of all of the games. There is no definite string
; of text to hint what the rules might have been. The only things known are:
; 1) A big [?] appears when Bonus_GameHost = 1 (Koopa Troopa with "Prize")
; 2) A "prize" emerges from it and sits atop of the box
; 3) There is code reference to these first two things (Bonus_KTPrizeGame)
; 4) Bonus_Return2_SetMapPos can set your map position partly by Bonus_KTPrizeGame
;
; There is no way to absolutely determine how this game worked, but most likely
; it would start up with you and the Koopa Troopa with a box in the middle.
; The "prize" would remain inside the box until you did whatever it took to
; "win" the prize, at which point it would rise up and presumably you'd get it.
; The reason for it rising immediately is most likely a programmer's test and
; it simply wasn't very far along yet.
;
; The big [?] that appears covers over the Die, although the die is still in
; operation behind it and for all intents and purposes, the engine is still
; running the die game. The die game should probably be disabled in this
; case, but there's just no logic for that.
;
; A possible suggestion is that this was a trading game (using the unknown
; "Round 2" string which is loosely translated as "Give Something?"), where
; you gave the Koopa Troopa an item and you got whatever was in the
; "Mystery Box", perhaps to your benefit or chagrin. But this is only a guess.
;
; If bonus loop is exited and Bonus_GameType = BONUS_UNUSED_2RETURN,
; the Player is forced to a map position based on their last movement
; and the Bonus_KTPrizeGame value! (See Bonus_Return2_SetMapPos)
; So perhaps BONUS_UNUSED_2RETURN MAY have been Koopa Troopa's "Prize" Game?
;
;
; P.S.
;
; Bonus_GameType = BONUS_UNUSED_DDDD actually sets a special variable
; Bonus_DDDD = 1 when you exit the bonus loop... interesting!!
;
; There is an unused variable Roulette_Turns which when greater than zero,
; gives you additional spins if you should lose the Roulette game! This is
; likely the unused "Play three times" message (BonusGame_UNUSED_Etc1)
;
; "Hey you! How about lending me your clothes?
; No dice?
; What a drag"
; -- Possible in-joke no one got after all these years? :P
Tile_Layout_TS15_TS16_TS17:
; This defines the individual 8x8 blocks used to construct one of the tiles
; Referenced by Address_Per_Tileset, addressed by Level_Tileset
; Stored by upper left, then lower left, then upper right, then lower right
; Remember that palette is determined by the upper 2 bits of a TILE (not the PATTERN)
; I.e. tiles starting at index $00, $40, $80, $C0 are each on that respective palette
; Upper left 8x8 pattern per tile
.byte $FD, $FD, $FD, $A6, $A7, $A8, $A4, $A5, $FE, $FF, $FD, $FF, $FF, $FF, $FF, $FF ; Tiles $00 - $0F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $10 - $1F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $20 - $2F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $30 - $3F
.byte $72, $50, $54, $FD, $58, $5C, $FD, $40, $44, $FD, $74, $08, $0A, $28, $2A, $48 ; Tiles $40 - $4F
.byte $4A, $68, $6A, $FE, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $50 - $5F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $60 - $6F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $70 - $7F
.byte $FD, $60, $64, $68, $6C, $46, $78, $20, $24, $21, $2C, $FF, $FF, $FF, $FF, $FF ; Tiles $80 - $8F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $90 - $9F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $A0 - $AF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $B0 - $BF
.byte $70, $FF, $FF, $FF, $FF, $70, $FF, $07, $07, $80, $82, $84, $86, $72, $10, $12 ; Tiles $C0 - $CF
.byte $12, $17, $1F, $1B, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $D0 - $DF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $E0 - $EF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $F0 - $FF
; Lower left 8x8 pattern per tile
.byte $A0, $A1, $A2, $A6, $A7, $FD, $FD, $FD, $FE, $FF, $FD, $FF, $FF, $FF, $FF, $FF ; Tiles $00 - $0F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $10 - $1F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $20 - $2F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $30 - $3F
.byte $73, $51, $55, $FD, $59, $5D, $FD, $41, $55, $FD, $75, $18, $1A, $38, $3A, $58 ; Tiles $40 - $4F
.byte $5A, $78, $7A, $FE, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $50 - $5F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $60 - $6F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $70 - $7F
.byte $FD, $61, $65, $69, $6D, $69, $79, $21, $25, $29, $2B, $FF, $FF, $FF, $FF, $FF ; Tiles $80 - $8F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $90 - $9F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $A0 - $AF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $B0 - $BF
.byte $71, $FF, $FF, $FF, $01, $04, $02, $07, $05, $90, $92, $94, $96, $73, $11, $14 ; Tiles $C0 - $CF
.byte $13, $18, $FD, $1C, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $D0 - $DF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $E0 - $EF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $F0 - $FF
; Upper right 8x8 pattern per tile
.byte $FD, $FD, $FD, $FE, $FD, $A4, $A4, $FD, $FE, $FF, $FD, $FF, $FF, $FF, $FF, $FF ; Tiles $00 - $0F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $10 - $1F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $20 - $2F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $30 - $3F
.byte $73, $52, $FD, $56, $5A, $FD, $66, $42, $FD, $45, $76, $09, $0B, $29, $2B, $49 ; Tiles $40 - $4F
.byte $4B, $69, $6B, $FE, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $50 - $5F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $60 - $6F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $70 - $7F
.byte $5E, $62, $FD, $6A, $FD, $6A, $7A, $22, $26, $2A, $27, $FF, $FF, $FF, $FF, $FF ; Tiles $80 - $8F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $90 - $9F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $A0 - $AF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $B0 - $BF
.byte $71, $FF, $06, $06, $FF, $71, $FF, $FF, $FF, $81, $83, $85, $87, $73, $12, $12 ; Tiles $C0 - $CF
.byte $15, $19, $1F, $1D, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $D0 - $DF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $E0 - $EF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $F0 - $FF
; Lower right 8x8 pattern per tile
.byte $A1, $A1, $FD, $FE, $FD, $FD, $FD, $FD, $FE, $FF, $FD, $FF, $FF, $FF, $FF, $FF ; Tiles $00 - $0F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $10 - $1F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $20 - $2F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $30 - $3F
.byte $72, $53, $FD, $57, $5B, $FD, $67, $43, $FD, $FD, $77, $19, $1B, $39, $3B, $59 ; Tiles $40 - $4F
.byte $5B, $79, $7B, $FE, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $50 - $5F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $60 - $6F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $70 - $7F
.byte $5F, $63, $FD, $6B, $FD, $6B, $7B, $23, $27, $2B, $2F, $FF, $FF, $FF, $FF, $FF ; Tiles $80 - $8F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $90 - $9F
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $A0 - $AF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $B0 - $BF
.byte $70, $00, $06, $03, $01, $04, $FF, $FF, $FF, $91, $93, $95, $97, $72, $13, $14 ; Tiles $C0 - $CF
.byte $16, $1A, $FD, $1E, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $D0 - $DF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $E0 - $EF
.byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Tiles $F0 - $FF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; LevelLoad_TS9
;
; Entry point for loading level layout data for Level_Tileset = 15-17
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LevelLoad_TS15_TS16_TS17:
LDY #$00
PRG022_C402:
LDA #TILE15_BLACK
JSR Tile_Mem_ClearB
JSR Tile_Mem_ClearA
CPY #$40
BNE PRG022_C402
PRG022_C40E:
LDA #TILE15_BRICKBG
JSR Tile_Mem_ClearB
LDA #TILE15_BLACK
JSR Tile_Mem_ClearA
CPY #$f0
BNE PRG022_C40E
JMP LevelLoad ; Begin actual level loading!
; The bonus room is typical level layout data...
; Only BonusLayout_Typical is ever possibly loaded, the other ones are never touched.
; See PRG012 for the indexing instruction; too bad it's fixed at Y = 0...
Bonus_LayoutData:
.word BonusLayout_Typical ; 0: Mario and Table; The only bonus game we ever saw
.word BonusLayout_NoTable ; 1: Mario only; for the die game perhaps?
.word BonusLayout_BlueBox ; 2: Mario and blue box; maybe Koopa Troopa's prize game?
.word BonusLayout_Empty1 ; 3: Empty/unused, who knows
.word BonusLayout_Empty2 ; 4: Empty/unused, who knows
; Broken into another file for ease of integration in NoDice editor
.include "PRG/levels/Bonus.asm"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; LoadLevel_Generator_TS151617
;
; Based on the values in Temp_Var15 and LL_ShapeDef, chooses an
; appropriate generator function to builds this piece of the
; level. Tedious, but saves space and is paper-design friendly.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LoadLevel_Generator_TS151617:
; NOTE: This is not a "complete" Generator as in the other level banks,
; but that's because of the simplicity (there's only one!)
LDA LL_ShapeDef
LSR A
LSR A
LSR A
LSR A
TAX
DEX
TXA ; X = (LL_ShapeDef >> 4) - 1
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word LoadLevel_BonusFloor ; 0 - Brick tiles that make up the floor
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; LeveLoad_FixedSizeGen_TS151617
;
; Much simpler generators that are fixed-size, commonly used for
; just single tile placement styles (although a couple relatively
; complex ones exist in here as well)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LeveLoad_FixedSizeGen_TS151617:
; It is verified before calling this function that all of
; the upper 4 bits of LL_ShapeDef are ZERO
; So the upper 3 bits of Temp_Var15 serve as the most significant bits
; to a value where LL_ShapeDef provide the 4 least significant bits
; NOTE: This is not a "complete" Generator as in the other level banks,
; but that's because of the simplicity... so only the 4 LSb do anything!
LDA LL_ShapeDef
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word LoadLevel_BonusPlayer ; 0 - Inserts the appropriate Player based on power up level
.word LoadLevel_UNKTALL ; 1 - Unknown tall something?
.word LoadLevel_Border ; 2 - Outside host border
.word LoadLevel_QBoxOrange ; 3 - "Orange" box, maybe once was a ? block (??)
.word LoadLevel_Table ; 4 - The table in the center of the bonus room
.word LoadLevel_Background ; 5 - Background setup (a smattering of brick tiles or whitespace behind where sprites are)
.word LoadLevel_QBoxBlue ; 6 - Blue ? block
BonusTable_Tiles:
.byte TILE15_TABLE_UL, TILE15_TABLE_UM, TILE15_TABLE_UR
.byte TILE15_TABLE_LL, TILE15_TABLE_LM, TILE15_TABLE_LR
LoadLevel_Table:
; Temp_Var1 = 0
LDA #$00
STA <Temp_Var1
PRG022_C4B2:
LDX <Temp_Var1 ; X = Temp_Var1
; Left table tile -> Temp_Var2
LDA BonusTable_Tiles,X
STA <Temp_Var2
; Middle table tile -> Temp_Var3
LDA BonusTable_Tiles+1,X
STA <Temp_Var3
; Right table tile -> Temp_Var4
LDA BonusTable_Tiles+2,X
STA <Temp_Var4
; Temp_Var1 += 3
TXA
ADD #$03
STA <Temp_Var1
LDX #$00 ; X = 0
LDY TileAddr_Off ; Y = TileAddr_Off
; Place left tile
LDA <Temp_Var2
STA [BonusText_BaseL],Y
PRG022_C4D2:
INY ; Y++ (next grid tile, DANGEROUS!)
INX ; X++
; Place middle tile (repeated)
LDA <Temp_Var3
STA [BonusText_BaseL],Y
TXA
AND #$07
CMP #$05
BNE PRG022_C4D2 ; If X is not at the fifth iteration, loop!
; Place right tile
LDA <Temp_Var4
STA [BonusText_BaseL],Y
; TileAddr_Off += 16 (next row)
LDA TileAddr_Off
ADD #16
STA TileAddr_Off
LDA <Temp_Var1
CMP #$06
BNE PRG022_C4B2 ; While Temp_Var1 <> 6, loop!
RTS ; Return
Background_Layout:
; $80 works as a "line break"
; $FF is the terminator
; For everything else: Upper 4 bits index a tile from Background_Tiles and lower 4 bits are a repeat count (base value 1)
.byte $00, $80
.byte $00, $80
.byte $00, $10, $80
.byte $10, $03, $10, $23, $10, $80
.byte $14, $23, $00, $23, $80
.byte $13, $01, $21, $00, $23, $10, $80
.byte $23, $10, $00, $21, $10, $21, $00
.byte $FF
Background_Tiles:
.byte TILE15_WHITESPACE_PAL3, TILE15_BRICKBG, TILE15_WHITESPACE_PAL0
LoadLevel_Background:
LDY TileAddr_Off ; Y = TileAddr_Off
; Temp_Var12 = 0
LDX #$00
STX <Temp_Var12
PRG022_C51E:
LDX <Temp_Var12
LDA Background_Layout,X
STA <Temp_Var1
CMP #$ff
BNE PRG022_C52A ; If not yet hit $FF value, jump to PRG022_C52A
; Terminated!
RTS ; Return
PRG022_C52A:
CMP #$80
BNE PRG022_C53D ; If not hit $80 value, jump to PRG022_C53D
; Next tile row
LDA TileAddr_Off
ADD #16
STA TileAddr_Off
TAY ; -> 'Y'
INC <Temp_Var12 ; Temp_Var12++
JMP PRG022_C51E ; Jump to PRG022_C51E
PRG022_C53D:
LSR A
LSR A
LSR A
LSR A
TAX ; X = upper 4 bits, shifted down
; Lower 4 bits -> Temp_Var11
LDA <Temp_Var1
AND #$0f
STA <Temp_Var11
PRG022_C548:
LDA Background_Tiles,X
STA [BonusText_BaseL],Y
INY ; Y++ (next tile, DANGEROUS)
DEC <Temp_Var11 ; Temp_Var11-- (repeat)
BPL PRG022_C548 ; While Temp_Var11 >= 0, loop!
INC <Temp_Var12 ; Temp_Var12++
JMP PRG022_C51E ; Jump to PRG022_C51E
; The 16x16 tiles that make up Player when he is Big (or other not supported power up)
Player_BonusTiles_Big:
.byte TILE15_BRICKBG, TILE15_PLAYERBIG_TOPM, TILE15_PLAYERBIG_TOPR
.byte TILE15_PLAYERBIG_HEADL, TILE15_PLAYERBIG_HEADM, TILE15_PLAYERBIG_HEADR
.byte TILE15_PLAYERBIG_TORL, TILE15_PLAYERBIG_TORM, TILE15_PLAYERBIG_TORR
.byte TILE15_PLAYERBIG_BOTL, TILE15_PLAYERBIG_BOTM, TILE15_PLAYERBIG_BOTR
; The 16x16 tiles that make up Player when he is Raccoon
Player_BonusTiles_Raccoon:
.byte TILE15_BRICKBG, TILE15_PLAYERRAC_TOPM, TILE15_PLAYERRAC_TOPR
.byte TILE15_PLAYERBIG_HEADL, TILE15_PLAYERBIG_HEADM, TILE15_PLAYERBIG_HEADR
.byte TILE15_PLAYERBIG_TORL, TILE15_PLAYERBIG_TORM, TILE15_PLAYERBIG_TORR
.byte TILE15_PLAYERBIG_RACL, TILE15_PLAYERBIG_RACM, TILE15_PLAYERBIG_BOTR
; The 16x16 tiles that make up Player when he is Small
Player_BonusTiles_Small:
.byte TILE15_BRICKBG, TILE15_BRICKBG, TILE15_BRICKBG
.byte TILE15_BRICKBG, TILE15_BRICKBG, TILE15_BRICKBG
.byte TILE15_BRICKBG, TILE15_PLAYERSM_TOP, TILE15_BRICKBG
.byte TILE15_BRICKBG, TILE15_PLAYERSM_BOTTOM, TILE15_BRICKBG
PlayerSuit_ToIndex:
.byte PLAYERSUIT_BIG ; 0 (Default when all else fails)
.byte PLAYERSUIT_RACCOON ; 1
.byte PLAYERSUIT_SMALL ; 2
PlayerSuit_ToIndex_End
PlayerSuit_TileBaseIndex:
.byte (Player_BonusTiles_Big - Player_BonusTiles_Big)
.byte (Player_BonusTiles_Raccoon - Player_BonusTiles_Big)
.byte (Player_BonusTiles_Small - Player_BonusTiles_Big)
LoadLevel_BonusPlayer:
; This loop tries to match the Player's power up with an index
; If nothing else, X = 0, which uses "Big"
LDX #(PlayerSuit_ToIndex_End - PlayerSuit_ToIndex - 1)
LDY Player_Current ; Y = Player_Current
LDA World_Map_Power,Y ; Get current Player's power
PRG022_C589:
CMP PlayerSuit_ToIndex,X
BEQ PRG022_C591 ; If this is the Player's current power up, jump to PRG022_C591
DEX ; X--
BNE PRG022_C589 ; While X > 0, loop!
PRG022_C591:
; Get starting tile for Player
LDA PlayerSuit_TileBaseIndex,X
TAX ; -> 'X'
; Temp_Var3 = 0
LDA #$00
STA <Temp_Var3
LDY TileAddr_Off ; Y = TileAddr_Off
PRG022_C59C:
; Temp_Var1 = 2
LDA #$02
STA <Temp_Var1
PRG022_C5A0:
; Get tile for Player -> grid
LDA Player_BonusTiles_Big,X
STA [BonusText_BaseL],Y
INY ; Y++ (next grid tile, DANGEROUS!)
INX ; X++ (next Player tile)
INC <Temp_Var3 ; Temp_Var3++
DEC <Temp_Var1 ; Temp_Var1--
BPL PRG022_C5A0 ; While Temp_Var1 >= 0, loop
; Go to next row of tiles
LDA TileAddr_Off
ADD #16
STA TileAddr_Off
TAY ; -> 'Y'
LDA <Temp_Var3
CMP #(Player_BonusTiles_Raccoon - Player_BonusTiles_Big)
BNE PRG022_C59C ; If we have more tiles to go, loop!
RTS ; Return
BonusUNKTALL_Tiles:
.byte TILE15_UNKTALL_UL, TILE15_UNKTALL_UR
.byte TILE15_UNKTALL_R1L, TILE15_UNKTALL_R1R
.byte TILE15_UNKTALL_R2L, TILE15_UNKTALL_R2R
.byte TILE15_UNKTALL_LL, TILE15_UNKTALL_LR
BonusUNKTALL_Tiles_End
LoadLevel_UNKTALL:
LDX #$00 ; X = 0
LDY TileAddr_Off ; Y = TileAddr_Off
PRG022_C5CB:
; Temp_Var1 = 1
LDA #$01
STA <Temp_Var1
PRG022_C5CF:
LDA BonusUNKTALL_Tiles,X
STA [BonusText_BaseL],Y
INY ; Y++ (next grid tile, DANGEROUS!)
INX ; X++
DEC <Temp_Var1 ; Temp_Var1--
BPL PRG022_C5CF ; While Temp_Var1 >= 0, loop
; Next tile row
LDA TileAddr_Off
ADD #16
STA TileAddr_Off
TAY ; -> 'Y'
CPX #(BonusUNKTALL_Tiles_End - BonusUNKTALL_Tiles)
BNE PRG022_C5CB ; While X < number of tiles, loop!
RTS ; Return
LoadLevel_Border:
LDY TileAddr_Off ; Y = TileAddr_Off
; Border upper left
LDA #TILE15_BORDER_UL
STA [BonusText_BaseL],Y
; Run of 14 middle tiles
PRG022_C5F0:
INY ; Y++
LDA #TILE15_BORDER_UM
STA [BonusText_BaseL],Y
CPY #$0f
BNE PRG022_C5F0
; Border upper right
LDA #TILE15_BORDER_UR
STA [BonusText_BaseL],Y
PRG022_C5FD:
INY ; Y++
TYA
AND #$0f
BNE PRG022_C607 ; If not time to place left border, jump to PRG022_C607
LDA #TILE15_BORDER_ML
BNE PRG022_C60D ; Jump (technically always) to PRG022_C60D
PRG022_C607:
CMP #$0f
BNE PRG022_C5FD ; If not time to place right border, jump to PRG022_C5FD
LDA #TILE15_BORDER_MR
PRG022_C60D:
STA [BonusText_BaseL],Y ; Store appropriate middle border
CPY #$9f
BNE PRG022_C5FD ; If Y <> $9F, loop!
INY ; Y++
; Lower left border
LDA #TILE15_BORDER_LL
STA [BonusText_BaseL],Y
; Run of 14 middle tiles
PRG022_C618:
INY ; Y++
LDA #TILE15_BORDER_LM
STA [BonusText_BaseL],Y
CPY #$af
BNE PRG022_C618
; Lower right border
LDA #TILE15_BORDER_LR
STA [BonusText_BaseL],Y
RTS ; Return
QBoxOrange_Tiles:
.byte $C9, $CA, $CB, $CC
QBoxOrange_Tiles_End
LoadLevel_QBoxOrange:
LDX #$00 ; X = 0
LDY TileAddr_Off ; Y = TileAddr_Off
PRG022_C62F:
; Temp_Var1 = 1
LDA #$01
STA <Temp_Var1
PRG022_C633:
; Add prize box tile
LDA QBoxOrange_Tiles,X
STA [BonusText_BaseL],Y
INY ; Y++ (next tile, DANGEROUS)
INX ; X++ (next prize box tile)
DEC <Temp_Var1 ; Temp_Var1--
BPL PRG022_C633 ; While Temp_Var1 >= 0, loop!
; Next row
LDA TileAddr_Off
ADD #16
STA TileAddr_Off
TAY ; -> 'Y'
CPX #(QBoxOrange_Tiles_End - QBoxOrange_Tiles)
BNE PRG022_C62F ; While tiles to go, loop!
RTS ; Return
QBoxBlue_Tiles:
.byte $87, $88, $89, $8A
QBoxBlue_Tiles_End
LoadLevel_QBoxBlue:
LDX #$00 ; X = 0
LDY TileAddr_Off ; Y = TileAddr_Off
PRG022_C656:
; Temp_Var1 = 1
LDA #$01
STA <Temp_Var1
PRG022_C65A:
; Add prize box tile
LDA QBoxBlue_Tiles,X
STA [BonusText_BaseL],Y
INY ; Y++ (next tile, DANGEROUS)
INX ; X++ (next prize box tile)
DEC <Temp_Var1 ; Temp_Var1--
BPL PRG022_C65A ; While Temp_Var1 >= 0, loop!
; Next row
LDA TileAddr_Off
ADD #16
STA TileAddr_Off
TAY ; -> 'Y'
CPX #(QBoxBlue_Tiles_End - QBoxBlue_Tiles)
BNE PRG022_C656 ; While tiles to go, loop!
RTS ; Return
LoadLevel_BonusFloor:
; Temp_Var1 = 1
LDA #$01
STA <Temp_Var1
LDY TileAddr_Off ; Y = TileAddr_Off
PRG022_C67B:
LDA LL_ShapeDef
AND #$0f
TAX ; X = lower 4 bits of LL_ShapeDef
PRG022_C681:
LDA #TILE15_BRICKFLOOR
STA [Map_Tile_AddrL],Y
INY ; Y++ (NOT SAFE!)
DEX ; X--
BPL PRG022_C681 ; While X >= 0, loop
; Next row
LDA TileAddr_Off
ADD #16
STA TileAddr_Off
TAY ; -> 'Y'
DEC <Temp_Var1 ; Temp_Var1--
BPL PRG022_C67B ; While Temp_Var1 >= 0, loop
RTS ; Return
; FIXME: Anyone want to claim this?
; $C698
; Y += 16
TYA
ADD #16
TAY
LDA <BonusText_BaseH
ADC #$00
STA <BonusText_BaseH
RTS ; Return
; FIXME: Anyone want to claim this?
; $C6A4
LDA <Temp_Var6
STA <BonusText_BaseH
LDY TileAddr_Off
INY
TYA
AND #$0f
BNE PRG022_C6E2
LDY #$00
LDA <Temp_Var15
AND #$10
BEQ PRG022_C6BA
INY
PRG022_C6BA:
STY <Temp_Var10
LDA <BonusText_BaseL
ADD #$b0
STA <BonusText_BaseL
LDA <BonusText_BaseH
ADC <Temp_Var10
STA <BonusText_BaseH
STA <Temp_Var6
LDA <Temp_Var16
AND #$f0
LSR A
LSR A
LSR A
TAY
INY
INY
LDA Tile_Mem_Addr+1,Y
STA <Temp_Var5
INC <Temp_Var5
LDA TileAddr_Off
AND #$f0
TAY
PRG022_C6E2:
STY TileAddr_Off
RTS ; Return
BonusGame_HostDraw:
LDA Bonus_GameHost
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word HostToad_Draw ; 0: Standard Toad Host
.word HostTroopa_DrawWithGameBits ; 1: (Unused, glitched) Koopa Troopa Host w/ (unused, glitched) large [?] and card
.word HostTroopa_Draw ; 2: (Unused, glitched) Koopa Troopa Host w/o the other thing
.word HostHammerBro_Draw ; 3: (Unused, glitched) Hammer Bro Host
HostToad_Draw:
JSR HostToad_DrawSprites
RTS ; Return
HostTroopa_DrawWithGameBits:
JSR HostTroopa_DrawSprites
LDA #$3f ; <-- denotes starting tile, for other prize boxes??
JSR Draw_KTPrizeGameBox ; Draw the Koopa Troopa "Prize" Game box and the prize
RTS ; Return
HostTroopa_Draw:
JSR HostTroopa_DrawSprites
RTS ; Return
HostHammerBro_Draw:
JSR HostHammerBro_DrawSprites
RTS ; Return
HostToad_SpriteYs:
.byte $60, $60, $60, $60, $70, $70, $70, $70, $80, $80, $80
HostToad_SpriteYs_End
HostToad_SpriteXs:
.byte $C0, $C8, $D0, $D8, $C0, $C8, $D0, $D8, $C0, $C8, $D0
HostToad_DrawSprites:
; Temp_Var11 = $95 (starting pattern of Toad Host sprites)
LDA #$95
STA <Temp_Var11
LDY #$00 ; Y = 0
LDX #(HostToad_SpriteYs_End - HostToad_SpriteYs - 1)
PRG022_C727:
; Set Sprite Y of this sprite of the Toad Host
LDA HostToad_SpriteYs,X
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set pattern of this sprite of the Toad Host
LDA <Temp_Var11
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set palette of this sprite of the Toad Host
LDA #SPR_PAL0
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set Sprite X of this sprite of the Toad Host
LDA HostToad_SpriteXs,X
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Temp_Var11 -= 2 (two patterns backward)
DEC <Temp_Var11
DEC <Temp_Var11
DEX ; X--
BPL PRG022_C727 ; While X >= 0, loop
RTS ; Return
HostTroopa_SpriteYs:
.byte $60, $60, $60, $70, $70, $70, $70, $80, $80, $80
HostTroopa_SpriteYs_End
HostTroopa_SpriteXs:
.byte $C0, $C8, $D0, $C0, $C8, $D0, $D8, $C8, $D0, $D8
HostTroopa_DrawSprites:
; Temp_Var11 = $99 (starting pattern of Koopa Troopa Host sprites)
LDA #$99 ; WRONG! Should be $A9, then he'll display correctly :D
STA <Temp_Var11
LDY #$00 ; Y = 0
LDX #(HostTroopa_SpriteYs_End - HostTroopa_SpriteYs - 1)
PRG022_C765:
; Set Sprite Y of this sprite of the Koopa Troopa Host
LDA HostTroopa_SpriteYs,X
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set pattern of this sprite of the Koopa Troopa Host
LDA <Temp_Var11
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set palette of this sprite of the Koopa Troopa Host
LDA #SPR_PAL0
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set Sprite X of this sprite of the Koopa Troopa Host
LDA HostTroopa_SpriteXs,X
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Temp_Var11 -= 2 (two patterns backward)
DEC <Temp_Var11
DEC <Temp_Var11
DEX ; X--
BPL PRG022_C765 ; While X >= 0, loop
RTS ; Return
HostHammerBro_SpriteYs:
.byte $60, $60, $60, $70, $70, $70, $70, $80, $80, $80, $80
HostHammerBro_SpriteYs_End
HostHammerBro_SpriteXs:
.byte $C0, $C8, $D0, $C0, $C8, $D0, $D8, $C0, $C8, $D0, $D8
HostHammerBro_DrawSprites:
; Temp_Var11 = $AF (starting pattern of Koopa Troopa Host sprites)
LDA #$AF ; WRONG! Should be $BF, then he'll display correctly :D
STA <Temp_Var11
LDY #$00 ; Y = 0
LDX #(HostHammerBro_SpriteYs_End - HostHammerBro_SpriteYs - 1)
PRG022_C7A5:
; Set Sprite Y of this sprite of the Hammer Bro Host
LDA HostHammerBro_SpriteYs,X
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set pattern of this sprite of the Hammer Bro Host
LDA <Temp_Var11
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set palette of this sprite of the Hammer Bro Host
LDA #SPR_PAL0
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set Sprite X of this sprite of the Hammer Bro Host
LDA HostHammerBro_SpriteXs,X
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Temp_Var11 -= 2 (two patterns backward)
DEC <Temp_Var11
DEC <Temp_Var11
DEX ; X--
BPL PRG022_C7A5 ; While X >= 0, loop
RTS ; Return
BonusGameBox_SpriteYs:
.byte $70, $70, $70, $70, $80, $80, $80, $80
BonusGameBox_SpriteYs_End
BonusGameBox_SpriteXs:
.byte $70, $78, $80, $88, $70, $78, $80, $88
Bonus_KTPrizeFlipBits: .byte SPR_HFLIP, $00
Bonus_KTPrizePattern:
.byte $21, $25, $23, $27
; Draws the box and the "prize" for Koopa Troopa's "Prize" Game
Draw_KTPrizeGameBox:
STA <Temp_Var11
; Draw the game box first
LDX #(BonusGameBox_SpriteYs_End - BonusGameBox_SpriteYs - 1)
PRG022_C7E1:
; Set Sprite Y of this sprite
LDA BonusGameBox_SpriteYs,X
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set pattern of this sprite
LDA <Temp_Var11
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set palette of this sprite
LDA #SPR_PAL0
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Set Sprite X of this sprite
LDA BonusGameBox_SpriteXs,X
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite RAM byte)
; Temp_Var11 -= 2 (two patterns backward)
DEC <Temp_Var11
DEC <Temp_Var11
DEX ; X--
BPL PRG022_C7E1 ; While X >= 0, loop
; Koopa Troopa must be finished introducing the game before the "Prize" is even displayed!
LDA Bonus_GameState
CMP #$02
BLT PRG022_C852 ; If Bonus_GameState < 2, jump to PRG022_C852 (RTS)
LDX Bonus_KTPrize ; X = Bonus_KTPrize
; Store pattern for prize -> Temp_Var11
LDA Bonus_KTPrizePattern,X
STA <Temp_Var11
; Temp_Var12 = Bonus_PrizeX
LDA Bonus_PrizeX
STA <Temp_Var12
LDX #$01 ; X = 1 (the two sprites that make up the prize)
PRG022_C818:
; Store prize sprite Y
LDA Bonus_PrizeY
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite byte)
; Store prize pattern
LDA <Temp_Var11
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite byte)
; Store prize attributes
LDA Bonus_KTPrizeFlipBits,X
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite byte)
; Store prize sprite X
LDA <Temp_Var12
STA Sprite_RAM+$10,Y
INY ; Y++ (next sprite byte)
; Temp_Var12 += 8
LDA <Temp_Var12
ADD #$08
STA <Temp_Var12
DEX ; X--
BPL PRG022_C818 ; While X >= 0, loop
LDA Bonus_PrizeY
CMP #$60
BEQ PRG022_C852 ; If Bonus_PrizeY = $60 (Bonus prize rose to the top), jump to PRG022_C852 (RTS)
; NOTE: It is possible that the "prize" wasn't suppose to rise until you actually won it, so
; there would be some kind of logic here to jump passed... of course, I don't know for sure.
DEC Bonus_PrizeY ; Bonus_PrizeY--
LDA Bonus_PrizeY
CMP #$5f
BGE PRG022_C852 ; If Bonus_PrizeY >= $5F (not at the top), jump to PRG022_C852
; Otherwise, stop at the top (what, thought you'd miss this with your DEC Mr. Programmer?)
LDA #$60
STA Bonus_PrizeY
PRG022_C852:
RTS ; Return
BonusText_HostGreetPtrL:
.byte LOW(BonusGame_UNUSED0_Text) ; 0: UNUSED (Japanese) Give key / coins
.byte LOW(BonusGame_Spade_Text) ; 1: Standard Spade Game instruction (OLD position of "Odd" game)
.byte LOW(BonusGame_NSpade_Text) ; 2: N-Spade instruction (OLD position of "Even" Game)
.byte LOW(BonusGame_UNUSED3_Text) ; 3: UNUSED "CCCCCCC CCCCCCC"
.byte LOW(BonusGame_UNUSED4_Text) ; 4: UNUSED "DDDDDDD"
.byte LOW(BonusGame_UNUSED5_Text) ; 5: UNUSED (Japanese) "If an odd number appears, I'll let you play the Roulette Game."
.byte LOW(BonusGame_UNUSED6_Text) ; 6: UNUSED (Japanese) "If an even number appears, I'll let you play the Card Game."
.byte LOW(BonusGame_UNUSED7_Text) ; 7: UNUSED (Japanese) "2, return (?)"
BonusText_HostGreetPtrH:
.byte HIGH(BonusGame_UNUSED0_Text) ; 0: UNUSED (Japanese) Give key / coins
.byte HIGH(BonusGame_Spade_Text) ; 1: Standard Spade Game instruction (OLD position of "Odd" game)
.byte HIGH(BonusGame_NSpade_Text) ; 2: N-Spade instruction (OLD position of "Even" game)
.byte HIGH(BonusGame_UNUSED3_Text) ; 3: UNUSED "CCCCCCC CCCCCCC"
.byte HIGH(BonusGame_UNUSED4_Text) ; 4: UNUSED "DDDDDDD"
.byte HIGH(BonusGame_UNUSED5_Text) ; 5: UNUSED (Japanese) "If an odd number appears, I'll let you play the Roulette Game."
.byte HIGH(BonusGame_UNUSED6_Text) ; 6: UNUSED (Japanese) "If an even number appears, I'll let you play the Card Game."
.byte HIGH(BonusGame_UNUSED7_Text) ; 7: UNUSED (Japanese) "2, return (?)"
; A whole bunch of unused, untranslated text only really hooked into the Odd/Even game
; These would be used in "Round 2."
BonusText_Round2PtrL:
.byte LOW(BonusGame_UNUSED_Etc0) ; 0
.byte LOW(BonusGame_UNUSED_Etc1) ; 1: OLD position of Odd Game winner (string identical to 5)
.byte LOW(BonusGame_UNUSED_Etc2) ; 2: OLD position of Even Game winner (string identical to 6)
.byte LOW(BonusGame_UNUSED_Etc3) ; 3
.byte LOW(BonusGame_UNUSED_Etc4) ; 4
.byte LOW(BonusGame_UNUSED_Etc5) ; 5: Odd Game winner! (BONUS_UNUSED_ODDROULETTE)
.byte LOW(BonusGame_UNUSED_Etc6) ; 6: Even Game winner! (BONUS_UNUSED_EVENCARD)
.byte LOW(BonusGame_UNUSED_Etc7) ; 7
BonusText_Round2PtrH:
.byte HIGH(BonusGame_UNUSED_Etc0) ; 0
.byte HIGH(BonusGame_UNUSED_Etc1) ; 1: OLD position of Odd Game winner (string identical to 5)
.byte HIGH(BonusGame_UNUSED_Etc2) ; 2: OLD position of Even Game winner (string identical to 6)
.byte HIGH(BonusGame_UNUSED_Etc3) ; 3
.byte HIGH(BonusGame_UNUSED_Etc4) ; 4
.byte HIGH(BonusGame_UNUSED_Etc5) ; 5: Odd Game winner! (BONUS_UNUSED_ODDROULETTE)
.byte HIGH(BonusGame_UNUSED_Etc6) ; 6: Even Game winner! (BONUS_UNUSED_EVENCARD)
.byte HIGH(BonusGame_UNUSED_Etc7) ; 7
BonusGame_Do:
JSR BonusGame_HostDraw ; Draw the Bonus Game host
LDA Bonus_GameState
CMP #$04
BLS PRG022_C880 ; If Bonus_GameState < 4, jump to PRG022_C880
; Bonus_GameState >= 4
JSR Bonus_DrawDie ; Draw the bonus die!
PRG022_C880:
LDA Bonus_GameState
CMP #$07
BLT PRG022_C8A0 ; If Bonus_GameState < 7, jump to PRG022_C8A0
LDA <Pad_Input
AND #(PAD_A | PAD_B)
BEQ PRG022_C8A0 ; If Player is pushing neither A nor B, jump to PRG022_C8A0
; Player pushing A or B...
LDA SndCur_Music2
BNE PRG022_C897 ; If music is playing from set 2, jump to PRG022_C897
; Otherwise, start the Bonus Game music
LDA #MUS2A_BONUSGAME
STA Sound_QMusic2
PRG022_C897:
; Bonus_GameState = 9
LDA #$09
STA Bonus_GameState
; Exit to map! (NOTE: Exits to either Spade/N-Spade game)
LDA #$01
STA <Level_ExitToMap
PRG022_C8A0:
LDA Bonus_GameState
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word Bonus_Init ; 0: Draw the dialog box, initialize the greeting text,
.word Bonus_DoHostText ; 1: Giving instructions for ALL UNUSED GAMES (then initializing the "prize"!)
.word Bonus_DieRotate ; 2: Rotating die logic; press 'A' and you may get a prize by the game type (or so it was intended)
.word Bonus_GetDiePrize ; 3: Get your die prize! (If you "won") Includes the "coin confetti"
.word Bonus_Wait80 ; 4: Waits $80 ticks
.word Bonus_DieFlyAway ; 5: Die "flies away"; go to state 6 if you won the Odd/Even game and to state 8 otherwise
.word Bonus_InitRound2 ; 6: Initialize for Round 2
.word Bonus_DoHostText ; 7: Giving instructions for Spade/N-Spade (LEGACY: For "Round 2" game)
.word Bonus_WaitA0 ; 8: Wait $A0 ticks
.word Bonus_KTPrizeGame ; 9: Appears to be all that was implemented toward "winning" the Koopa Troopa "Prize" Game
Bonus_Init:
; Graphics_Queue values $8 to $C, inclusive, build the dialog box
LDA Bonus_CurBufOffset
ADD #$08
STA <Graphics_Queue
INC Bonus_CurBufOffset ; Bonus_CurBufOffset++
CMP #$0c
BNE PRG022_C8EF ; If we've still more to queue for the instruction box, jump to PRG022_C8EF
; Done queueing the instruction box...
; Bonus_UnusedFlag = 0
LDA #$00
STA Bonus_UnusedFlag
INC Bonus_GameState ; Bonus_GameState = 1
LDY Bonus_GameType ; Y = Bonus_GameType
; Load the pointer to the host's greeting/instructional text
LDA BonusText_HostGreetPtrL,Y
STA <BonusText_BaseL
LDA BonusText_HostGreetPtrH,Y
STA <BonusText_BaseH
; NOTE: This breaks the original Odd/Even game! For Odd/Even to work the way
; it was originally intended (sort of), always jump to PRG022_C8EF!
CPY #BONUS_SPADE
BEQ PRG022_C8E6 ; If this is the Spade game, jump to PRG022_C8E6
CPY #BONUS_NSPADE
BNE PRG022_C8EF ; If this is NOT the N-Spade game, jump to PRG022_C8EF (RTS)
PRG022_C8E6:
; Spade / N-Spade
; BonusDie_Y = $F8 (hide the die)
LDA #$f8
STA <BonusDie_Y
; Bonus_GameState = 7 (give instructions to Spade/N-Spade game)
LDA #$07
STA Bonus_GameState
PRG022_C8EF:
RTS ; Return
Bonus_WaitA0:
LDA Bonus_Timer
BNE PRG022_C8FA ; If Bonus_Timer <> 0, jump to PRG022_C8FA
; Bonus_Timer = $A0
LDA #$a0
STA Bonus_Timer
PRG022_C8FA:
DEC Bonus_Timer ; Bonus_Timer--
BNE PRG022_C906 ; If Bonus_Timer not expired, jump to PRG022_C906
INC Bonus_GameState ; Bonus_GameState = 9 (bad state but nothing really happens because we're exiting)
; Exit to map
LDA #$01
STA <Level_ExitToMap
PRG022_C906:
RTS ; Return
Bonus_DoHostText:
DEC BonusText_CharPause ; BonusText_CharPause--
BNE PRG022_C970 ; If BonusText_CharPause <> 0, jump to PRG022_C970 (RTS)
; BonusText_CharPause = 4
LDA #$04
STA BonusText_CharPause
PRG022_C911:
LDA BonusText_CPos
AND #$01
BEQ PRG022_C91D ; Every other character, jump to PRG022_C91D
; Every other character, play the "blip" sound
LDA #SND_LEVELBLIP
STA Sound_QLevel1
PRG022_C91D:
LDY BonusText_CPos ; Y = BonusText_CPos
LDA [BonusText_BaseL],Y
BNE PRG022_C941 ; If character is not $00 (line break), jump to PRG022_C941
; Line break hit..
LDA BonusText_VL
ADD #32 ; +32 to next row
TAY ; -> 'Y'
LDA BonusText_VH
ADC #$00 ; Apply carry
STA BonusText_VH
; Return character to initial column
TYA
AND #$e0
ORA #$05
STA BonusText_VL
INC BonusText_CPos ; BonusText_CPos++
JMP PRG022_C911 ; Jump to PRG022_C911
PRG022_C941:
CMP #$ff
BEQ PRG022_C971 ; If $FF character (terminator), jump to PRG022_C971
LDX Graphics_BufCnt ; X = Graphics_BufCnt
; Store character into graphics buffer
STA Graphics_Buffer+$03,X
; Set current text VRAM address into graphics buffer
LDA BonusText_VH
STA Graphics_Buffer+$00,X
LDA BonusText_VL
STA Graphics_Buffer+$01,X
; Run length of 1
LDA #$01
STA Graphics_Buffer+$02,X
; Terminator
LDA #$00
STA Graphics_Buffer+$04,X
; Graphics_BufCnt += 4
LDA Graphics_BufCnt
ADD #$04
STA Graphics_BufCnt
INC BonusText_VL ; BonusText_VL++ (next VRAM byte)
INC BonusText_CPos ; BonusText_CPos++ (next character of string)
PRG022_C970:
RTS ; Return
PRG022_C971:
LDA Bonus_GameState
CMP #$07
BEQ PRG022_C980 ; If Bonus_GameState = 7 (instructions for Spade/N-Spade [Or Round 2]), jump to PRG022_C980
; Set Bonus Prize X/Y = $78
LDA #$78
STA Bonus_PrizeY
STA Bonus_PrizeX
PRG022_C980:
; BonusText_CPos = 0
LDA #$00
STA BonusText_CPos
INC Bonus_GameState ; Bonus_GameState = 2 or 8 (the latter ONLY in the final game)
INY ; Y++ (byte after string terminator)
; Get this byte -> Bonus_Round2
LDA [BonusText_BaseL],Y
STA Bonus_Round2
RTS ; Return
; High/Low VRAM address to blank out the dialog lines in preparation for Round 2
Round2LineBlank_VRAMH: .byte $28, $28, $29
Round2LineBlank_VRAML: .byte $CA, $EA, $0A
Bonus_InitRound2:
; Reset the dialog address!
LDA #$28
STA BonusText_VH
LDA #$ca
STA BonusText_VL
INC Bonus_GameState ; Bonus_GameState = 7
LDY Bonus_Round2 ; Y = Bonus_Round2
; Set the "Round 2" Text pointer
LDA BonusText_Round2PtrL,Y
STA <BonusText_BaseL
LDA BonusText_Round2PtrH,Y
STA <BonusText_BaseH
; Create a Graphics Buffer command set to clear the three lines of dialog...
; It probably would have been simpler and more efficient just to store the
; raw commands, but whatever...
LDX Graphics_BufCnt ; X = Graphics_BufCnt
LDY #$02 ; Y = 2 (0, 1, 2; three lines of dialog)
PRG022_C9B4:
; Set VRAM high for line blanking
LDA Round2LineBlank_VRAMH,Y
STA Graphics_Buffer+$00,X
INX ; X++ (next graphics buffer byte)
; Set VRAM low for line blanking
LDA Round2LineBlank_VRAML,Y
STA Graphics_Buffer+$00,X
INX ; X++ (next graphics buffer byte)
; Run length to blank a line of dialog
LDA #(VU_REPEAT | $12)
STA Graphics_Buffer+$00,X
INX ; X++ (next graphics buffer byte)
; "Space" character pattern
LDA #$fe
STA Graphics_Buffer+$00,X
INX ; X++ (next graphics buffer byte)
DEY ; Y--
BPL PRG022_C9B4 ; While Y >= 0, loop!
; Terminator
LDA #$00
STA Graphics_Buffer+$00,X
; Graphics_BufCnt += $0C
LDA Graphics_BufCnt
ADD #$0c
STA Graphics_BufCnt
RTS ; Return
Bonus_KTPrizeGame:
; PAY ATTENTION:
; 1) This actually cares about which host is running the game!
; 2) This actually cares about what height the "powerup prize" is at!
; Also, there's no way out of this state (nothing changes Bonus_GameState!)
; so you're kind of stuck if you get into this routine...
; But incidentally, the game DOES put itself in here as it is exiting, but
; since Level_ExitToMap is set, it's already on its way out...
LDA Bonus_GameHost
CMP #$01
BNE PRG022_C9EE ; If this is NOT the Koopa Troopa host (!!), jump to PRG022_C9EE
; This IS the Koopa Troopa host...
LDA Bonus_PrizeY
CMP #$60
BNE PRG022_C9F1 ; If Bonus_PrizeY <> $60 (Prize not fully raised), jump to PRG022_C9F1 (RTS)
PRG022_C9EE:
JSR Bonus_DoNothing ; Who knows??
PRG022_C9F1:
RTS ; Return
Bonus_DoNothing:
; WHAT WAS THIS? D:
; Maybe you earned the prize?
RTS ; Return
Bonus_InstBoxTop:
; Left corner
vaddr $28A4
.byte $01, $94
; Bar
vaddr $28A5
.byte VU_REPEAT | $18, $90
; Right corner
vaddr $28BD
.byte $01, $96
.byte $00 ; Terminator
Bonus_InstBoxLine1:
; Left edge
vaddr $28C4
.byte $01, $92
; Middle
vaddr $28C5
.byte VU_REPEAT | $18, $FE
; Right edge
vaddr $28DD
.byte $01, $93
.byte $00 ; Terminator
Bonus_InstBoxLine2:
; Left edge
vaddr $28E4
.byte $01, $92
; Middle
vaddr $28E5
.byte VU_REPEAT | $18, $FE
; Right edge
vaddr $28FD
.byte $01, $93
.byte $00 ; Terminator
Bonus_InstBoxLine3:
; Left edge
vaddr $2904
.byte $01, $92
; Middle
vaddr $2905
.byte VU_REPEAT | $18, $FE
; Right edge
vaddr $291D
.byte $01, $93
.byte $00 ; Terminator
Bonus_InstBoxBot:
; Left corner
vaddr $2924
.byte $01, $95
; Bar
vaddr $2925
.byte VU_REPEAT | $18, $91
; Right corner
vaddr $293D
.byte $01, $97
.byte $00 ; Terminator
; NOTE! Bonus_Round2 is actually set by a byte which follows the end of the text string!
; UNUSED (Japanese) If "1" appears, 1 (?) / If "2" appears, I'll give you a key / Otherwise, I'll give you coins.
; English mangled display "1FnSnPg 1" / "2FnSnPg FGnp" / "OjBFnBZ JBmpAInfC"
BonusGame_UNUSED0_Text:
; 1 F n S n P g 1
.byte $9D, $B5, $DD, $C2, $DD, $BF, $D6, $FE, $9D, $00
; 2 F n S n P g F G n p
.byte $9E, $B5, $DD, $C2, $DD, $BF, $D6, $FE, $B5, $B6, $DD, $DF, $00
; O j B F n B Z J B m p A I n f C
.byte $BE, $D9, $B1, $B5, $DD, $B1, $C9, $FE, $B9, $B1, $DC, $DF, $B0, $B8, $DD, $D5, $B2
; (Terminator, value into Bonus_Round2)
.byte $FF, BONUS_UNUSED_KEYCOIN
; Spade Instruction
; English: "Line up the pictures and" / "get a prize!" / "You only get one try."
BonusGame_Spade_Text:
; L i n e u p t h e p i c t u r e s a n d
.byte $BB, $D8, $DD, $D4, $FE, $CE, $DF, $FE, $CD, $D7, $D4, $FE, $DF, $D8, $D2, $CD, $CE, $CB, $D4, $CC, $FE, $D0, $DD, $D3, $00
; g e t a p r i z e !
.byte $D6, $D4, $CD, $FE, $D0, $FE, $DF, $CB, $D8, $8F, $D4, $EA, $00
; Y o u o n l y g e t o n e t r y .
.byte $C8, $DE, $CE, $FE, $DE, $DD, $DB, $8C, $FE, $D6, $D4, $CD, $FE, $DE, $DD, $D4, $FE, $CD, $CB, $8C, $E9
; (Terminator, value into Bonus_Round2)
.byte $FF, BONUS_SPADE
; N-Spade Instruction
; English: "Flip over any two cards" / "and see if they match." / "You can only miss twice!"
BonusGame_NSpade_Text:
; F l i p o v e r a n y t w o c a r d s
.byte $B5, $DB, $D8, $DF, $FE, $DE, $CF, $D4, $CB, $FE, $D0, $DD, $8C, $FE, $CD, $81, $DE, $FE, $D2, $D0, $CB, $D3, $CC, $00
; a n d s e e i f t h e y m a t c h .
.byte $D0, $DD, $D3, $FE, $CC, $D4, $D4, $FE, $D8, $D5, $FE, $CD, $D7, $D4, $8C, $FE, $DC, $D0, $CD, $D2, $D7, $E9, $00
; Y o u c a n o n l y m i s s t w i c e !
.byte $C8, $DE, $CE, $FE, $D2, $D0, $DD, $FE, $DE, $DD, $DB, $8C, $FE, $DC, $D8, $CC, $CC, $FE, $CD, $81, $D8, $D2, $D4, $EA
; (Terminator, value into Bonus_Round2)
.byte $FF, BONUS_NSPADE
; UNUSED "CCCCCCC" / "CCCCCCC"
BonusGame_UNUSED3_Text:
; C C C C C C C
.byte $B2, $B2, $B2, $B2, $B2, $B2, $B2, $00
; C C C C C C C
.byte $B2, $B2, $B2, $B2, $B2, $B2, $B2
; (Terminator, value into Bonus_Round2)
.byte $FF, BONUS_UNUSED_KEYCOIN
; UNUSED "DDDDDDD"
BonusGame_UNUSED4_Text:
; D D D D D D D
.byte $B3, $B3, $B3, $B3, $B3, $B3, $B3
; (Terminator, value into Bonus_Round2)
.byte $FF, BONUS_UNUSED_KEYCOIN
; UNUSED (Japanese) "If an odd number appears, I'll let you play the Roulette Game."
; English mangled display "GMCFn SnPg" / "i-j-TIn-ap" / "dgNS AInfC"
BonusGame_UNUSED5_Text:
; G M C F n S n P g
.byte $B6, $BC, $B2, $B5, $DD, $FE, $C2, $DD, $BF, $D6, $00
; i - j - T I n - a p
.byte $D8, $E5, $D9, $E5, $C3, $B8, $DD, $E5, $D0, $DF, $00
; d g N S A I n f C
.byte $D3, $D6, $BD, $C2, $FE, $B0, $B8, $DD, $D5, $B2
; (Terminator, value into Bonus_Round2)
.byte $FF, BONUS_UNUSED_ODDROULETTE
; UNUSED (Japanese) "If an even number appears, I'll let you play the Card Game."
; English mangled display "Hn-MCFnSnPg" / "F-TnIn-ap" / "KNS AInfC"
BonusGame_UNUSED6_Text:
; H n - M C F n S n P g
.byte $B7, $DD, $E5, $BC, $B2, $B5, $DD, $C2, $DD, $BF, $D6, $00
; F - T n I n - a p
.byte $B5, $E5, $C3, $DD, $B8, $DD, $E5, $D0, $DF, $00
; K N S A I n f C
.byte $BA, $BD, $C2, $FE, $B0, $B8, $DD, $D5, $B2
; (Terminator, value into Bonus_Round2)
.byte $FF, BONUS_UNUSED_EVENCARD
; UNUSED (Japanese) "2, return (?)"
; English mangled display "2 cTnj"
BonusGame_UNUSED7_Text:
; 2 c T n j
.byte $9E, $FE, $D2, $C3, $DD, $D9
; (Terminator, value into Bonus_Round2)
.byte $FF, BONUS_UNUSED_KEYCOIN
; The following strings are not in the "primary" set, so they would not have
; been spoken by the host at first entrance; perhaps they were in response
; to an action you would have taken within the game?
; I also notice that they used a shorter terminator...
; UNUSED (Japanese) "Give something?" (Google translates as "I'll give you something?")
; English mangled display " cYp dkC?"
BonusGame_UNUSED_Etc0:
; c Y p d k C ?
.byte $FE, $D2, $C8, $DF, $FE, $D3, $DA, $B2, $EB
; (Terminator)
.byte $FF
; UNUSED (Japanese) "Play three times!" (This apparently was for the Roulette game; would set Roulette_Turns)
; English mangled display "3FB rojBPnf"
BonusGame_UNUSED_Etc1:
; 3 F B r o j B P n f
.byte $9F, $B5, $B1, $FE, $CB, $DE, $D9, $B1, $BF, $DD, $D5
; (Terminator)
.byte $FF
; UNUSED (Japanese) "Chance to twice" / "Set aside two identical cards"
; English mangled display "QmyMZ 2FB" / "EULn F-Tnp" / "2uB ASSJngm"
BonusGame_UNUSED_Etc2:
; Q m y M Z 2 F B
.byte $C0, $8C, $DC, $BC, $C9, $FE, $9E, $B5, $B1, $00
; E U L n F - T n p
.byte $B4, $C4, $BB, $DD, $FE, $B5, $E5, $C3, $DD, $DF, $00
; 2 u B A S S J n g m
.byte $9E, $CE, $B1, $FE, $B0, $C2, $C2, $B9, $DD, $D6, $DC
; (Terminator)
.byte $FF
; UNUSED "CCCC CCCC"
BonusGame_UNUSED_Etc3:
; C C C C
.byte $B2, $B2, $B2, $B2, $00
; C C C C
.byte $B2, $B2, $B2, $B2
; (Terminator)
.byte $FF
; UNUSED "DDDD"
BonusGame_UNUSED_Etc4:
; D D D D
.byte $B3, $B3, $B3, $B3
; (Terminator)
.byte $FF
; UNUSED (Japanese) "Play three times!"
; English mangled display "3FB rojBPnf"
BonusGame_UNUSED_Etc5:
; 3 F B r o j B P n f
.byte $9F, $B5, $B1, $FE, $CB, $DE, $D9, $B1, $BF, $DD, $D5
; (Terminator)
.byte $FF
; UNUSED (Japanese) "Chance to twice" / "Set aside two identical cards"
; English mangled display "QmyMZ 2FB" / "EULn F-Tnp" / "2uB ASSJngm"
BonusGame_UNUSED_Etc6:
; Q m y M Z 2 F B
.byte $C0, $8C, $DC, $BC, $C9, $FE, $9E, $B5, $B1, $00
; E U L n F - T n p
.byte $B4, $C4, $BB, $DD, $FE, $B5, $E5, $C3, $DD, $DF, $00
; 2 u B A S S J n g m
.byte $9E, $CE, $B1, $FE, $B0, $C2, $C2, $B9, $DD, $D6, $DC
; (Terminator)
.byte $FF
; UNUSED (Japanese) "2, return (?)"
; English mangled display "2 cTnj"
BonusGame_UNUSED_Etc7:
; 2 c T n j
.byte $9E, $FE, $D2, $C3, $DD, $D9
; (Terminator)
.byte $FF
; Bonus_Return2_SetMapPos:
;
; A strange subroutine called for Bonus_GameType = BONUS_UNUSED_2RETURN!!
; It forces the Player to a different map position ??
; And marks them as having died in the bonus game ??!
;
; Since it references Bonus_KTPrize, it MAY have been Koopa Troopa's
; "Prize" Game... but death? I'm not sure the prize is worth it! D:
Bonus_Return2Row: .byte $50, $40, $80, $60 ; Literally Map Y
Bonus_Return2Col: .byte $50, $A0, $40, $A0 ; Upper bits is column, lower bits is map screen i.e. XHi
Bonus_Return2_SetMapPos:
; Temp_Var1 = Bonus_KTPrize * 2
LDA Bonus_KTPrize ; <-- !! A reference to Bonus_KTPrize
ASL A
STA <Temp_Var1
LDY Player_Current ; Y = Player_Current
LDA Map_Previous_Dir,Y
AND #$0a
BEQ PRG022_CBDD ; If Player didn't move up or left, jump to PRG022_CBDD
INC <Temp_Var1 ; Temp_Var1++
PRG022_CBDD:
LDX <Temp_Var1 ; X = Temp_Var1
LDA Bonus_Return2Row,X
STA Map_Previous_Y,Y
LDA Bonus_Return2Col,X
AND #$f0
STA Map_Previous_X,Y
LDA Bonus_Return2Col,X
AND #$0f
STA Map_Previous_XHi,Y
; Player "died" ?!!
LDA #$01
STA Map_ReturnStatus
RTS ; Return
Die_OddEven: .byte $00, $01 ; Match the odd/even (NOTE: Die face is 0 = 1, 1 = 2, etc. so odd first, then even, etc.)
Die_OddEvenMatch: .byte BONUS_UNUSED_ODDROULETTE, BONUS_UNUSED_EVENCARD ; Sets Bonus_DieCnt to this value!
Bonus_DieRotate:
INC Bonus_DieCnt ; Bonus_DieCnt++
LDA Bonus_DieCnt
AND #$03
BNE PRG022_CC18 ; 1:4 ticks proceed, otherwise jump to PRG022_CC18
INC Bonus_DiePos ; Bonus_DiePos++
; Cap the die 0-5
LDA Bonus_DiePos
CMP #$06
BNE PRG022_CC18 ; If Bonus_DiePos <> $06, jump to PRG022_CC18
; Bonus_DiePos= 0
LDA #$00
STA Bonus_DiePos
PRG022_CC18:
LDA <Pad_Input
AND #PAD_A
BEQ Bonus_DrawDie ; If Player is not pressing 'A', just go draw the Die
; Player pressed 'A'...
LDA #$00
STA Bonus_DieCnt ; Bonus_DieCnt = 0
STA Bonus_UnusedFlag ; Bonus_UnusedFlag = 0
; The following is WRONG, because the Spade/N-Spade Bonus Games will never use this state!
; This was the Odd/Even game as specified by the Japanese messages:
; "If an odd number appears, I'll let you play the Roulette Game."
; "If an even number appears, I'll let you play the Card Game."
LDY #$00 ; Y = 0 (Odd die face value will "win")
LDA Bonus_GameType
CMP #BONUS_SPADE ; <-- should be replaced by BONUS_UNUSED_ODDROULETTE
BEQ PRG022_CC34 ; If Bonus_GameType = BONUS_SPADE, jump to PRG022_CC34
INY ; Y = 1 (Even die face value will "win")
CMP #BONUS_NSPADE ; <-- should be replaced by BONUS_UNUSED_EVENCARD
BNE PRG022_CC4C ; If Bonus_GameType <> BONUS_NSPADE, jump to PRG022_CC4C
PRG022_CC34:
; Even / Odd Bonus Game
LDA Bonus_DiePos
AND #$01 ; Check odd/even of die
CMP Die_OddEven,Y
BNE PRG022_CC44 ; If die is not on proper odd/even, jump to PRG022_CC44
; Odd/Even matched win
; Set Bonus_DieCnt to the cooresponding Die_OddEvenMatch value
LDA Die_OddEvenMatch,Y
STA Bonus_DieCnt
PRG022_CC44:
; End of the Odd or Even game! Whether you won or lost, the die will now fly away.
; If you won, you go on to "Round 2"; if you lost, bail to world map.
; Bonus_GameState = 4
LDA #$04
STA Bonus_GameState
JMP Bonus_DrawDie ; Draw Die and don't come back!!
PRG022_CC4C:
; Not the Even / Odd game
LDX Bonus_DiePos ; X = Bonus_DiePos
CPX #$02
BLT PRG022_CC57 ; If Bonus_DiePos < 2 (Die face value 3), jump to PRG022_CC57
; Die face value 3 or greater nets you (Face Value * 10) points
; NOTE: This was "probably" supposed to go to your coins if the Japanese message is correct
; Further hinted because "coins" pop out...
; If "1" appears, 1 (?)
; If "2" appears, I'll give you a key
; Otherwise, I'll give you coins.
INX ; X++ (because "pos 0" --> Face value 1, etc.)
STX Score_Earned ; -> Score_Earned
PRG022_CC57:
INC Bonus_GameState ; Bonus_GameState = 3
Bonus_DrawDie:
; Set left/right die sprites Y
LDA <BonusDie_Y
STA Sprite_RAM+$F8
STA Sprite_RAM+$FC
; Set left/right die sprites patterns
LDA Bonus_DiePos
ASL A
ORA #$11
STA Sprite_RAM+$F9
STA Sprite_RAM+$FD
; Set left half of die attributes
LDA #SPR_PAL3
STA Sprite_RAM+$FA
; Set right half of die attributes
LDA #(SPR_PAL3 | SPR_HFLIP | SPR_VFLIP)
STA Sprite_RAM+$FE
; Set left half of die X
LDA <BonusDie_X
STA Sprite_RAM+$FB
; Set right half of die X
ADD #$08
STA Sprite_RAM+$FF
RTS ; Return
; ?? Is this another message?
PRG022_CC84:
.byte $CB, $DE, $E5, $BB, $E7, $FE, $B3, $E5, $FF, $60
; FIXME: Anyone want to claim this?
; Seems like it would display a short message maybe (above)
; $CC8E
LDA Bonus_UnusedFlag
BNE PRG022_CCED ; If Bonus_UnusedFlag <> 0, jump to PRG022_CCED (RTS)
INC BonusText_CharPause ; BonusText_CharPause++
LDA BonusText_CharPause
AND #$03
BNE PRG022_CCED ; 1:4 ticks proceed, otherwise jump to PRG022_CCED (RTS)
PRG022_CC9D:
LDX BonusText_CPos ; X = BonusText_CPos
LDA PRG022_CC84,X
BNE PRG022_CCB0
; Bonus_UnusedVL = $55
LDA #$55
STA Bonus_UnusedVL
INC BonusText_CPos
JMP PRG022_CC9D ; Jump to PRG022_CC9D
PRG022_CCB0:
CMP #$ff
BNE PRG022_CCC2
LDA #$35
STA Bonus_UnusedVL
LDA #$00
STA BonusText_CPos
INC Bonus_UnusedFlag
RTS ; Return
PRG022_CCC2:
LDY Graphics_BufCnt
STA Graphics_Buffer+$03,Y
LDA Bonus_UnusedVH
STA Graphics_Buffer+$00,Y
LDA Bonus_UnusedVL
STA Graphics_Buffer+$01,Y
LDA #$01
STA Graphics_Buffer+$02,Y
LDA #$00
STA Graphics_Buffer+$04,Y
LDA Graphics_BufCnt
ADD #$04
STA Graphics_BufCnt
INC Bonus_UnusedVL
INC BonusText_CPos
PRG022_CCED:
RTS ; Return
Bonus_DieFlyAway:
LDA <Counter_1
AND #$01
BNE PRG022_CD03 ; Every other tick, jump to PRG022_CD03
; The die rotates through its faces as it "flies away"
INC Bonus_DiePos ; Bonus_DiePos++
; Cap the die 0-5
LDA Bonus_DiePos
CMP #$06
BNE PRG022_CD03 ; If Bonus_DiePos <> $06, jump to PRG022_CD03
; Bonus_DiePos = 0
LDA #$00
STA Bonus_DiePos
PRG022_CD03:
LDA <BonusDie_YVel
CMP #-$80
BEQ PRG022_CD0E ; If BonusDie_YVel = -$80, jump to PRG022_CD0E
; BonusDie_YVel -= $08
SUB #$08
STA <BonusDie_YVel
PRG022_CD0E:
LDA <BonusDie_YVel ; Get die Velocity
ASL A
ASL A
ASL A
ASL A ; Fractional part shifted up
STA <Temp_Var1 ; -> Temp_Var1
LDA <BonusDie_YVel ; Get Velocity
LSR A
LSR A
LSR A
LSR A ; Whole part shifted down (integer)
CMP #%00001000 ; Check the sign bit
BLT PRG022_CD22 ; If the value was not negatively signed, jump to PRG022_CD22
ORA #%11110000 ; Apply a sign extension
PRG022_CD22:
STA <Temp_Var2 ; -> Temp_Var2
; Add to die's velocity fractional accumulator
LDA <BonusDie_YVelFrac
ADD <Temp_Var1
STA <BonusDie_YVelFrac
; Add appropriately to die's Y
LDA <BonusDie_Y
ADC <Temp_Var2
STA <BonusDie_Y
LDA <BonusDie_Y
CMP #$f8
BLT PRG022_CD50 ; If bonus die hasn't wrapped, jump to PRG022_CD50
; Hide bonus die
LDA #$f8
STA <BonusDie_Y
; Halt its velocity
LDA #$00
STA <BonusDie_YVel
; Bonus_UnusedFlag = 0
STA Bonus_UnusedFlag
LDA Bonus_DieCnt
BEQ PRG022_CD4B ; If Bonus_DieCnt = 0 (not a winner of the Odd/Even game), jump to PRG022_CD4B
; Winners of Odd/Even Game only!
INC Bonus_GameState ; Bonus_GameState = 6
; NOTE: Bonus_Round2 (i.e. what game we're going to next) was set by the intro dialog text!
RTS ; Return
PRG022_CD4B:
; Bonus_GameState = 8
LDA #$08
STA Bonus_GameState
PRG022_CD50:
RTS ; Return
Bonus_GetDiePrize:
LDA Bonus_DiePos
CMP #$02
BGE PRG022_CD6F ; If Bonus_DiePos >= 2 (Die face value of 3 or more, coin prizes), jump to PRG022_CD6F
CMP #$01
BNE PRG022_CD65 ; If Die face value is NOT 2 (i.e. it is 1), jump to PRG022_CD65
; "If 2 appears, I'll give you a key"
; Ultimately it is unclear what this was INTENDED to do. It modifies the first
; byte of the Player's "inventory" score (i.e. the backup used for Players
; switching turns), but not in a "safe" way that carries through the other bytes.
; That alone makes me believe that the memory in that area originally was for
; "something else"... what exactly I can't say! I only know it presently makes
; no sense and is -- in a small way -- corrupting memory and nothing more...
; This will increment the byte at Inventory_Cards + 3, which is the Player's score; but that
; will be overwritten when the game exits with the "current" score)
; In any case, not a "key" :(
LDX #$03 ; X = 3
JSR Bonus_Prize1 ; Get your prize?
INC Bonus_GameState ; Bonus_GameState = 4
RTS ; Return
PRG022_CD65:
; "If 1 appears, 1 (?)"
; Give Player an extra life ... apparently
LDX Player_Current
INC Player_Lives,X
INC Bonus_GameState ; Bonus_GameState = 4
RTS ; Return
PRG022_CD6F:
; Coin prizes
LDA BonusCoins_State
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word BonusCoins_Init ; 0: Initializes bonus coins based on value of the Die (Bonus_DiePos)
.word BonusCoins_UpdateAndDraw ; 1: Update and draw bonus coins until they've all fallen off-screen
BonusCoins_Init:
LDY Bonus_DiePos ; Y = Bonus_DiePos
PRG022_CD7C:
; Set coins to appear front and center!
LDA #$78
STA Bonus_CoinsY,Y
STA Bonus_CoinsX,Y
LDX #-$10 ; X = -$10
LDA RandomN,Y ; Get random value
ASL A ; Multiply by 2
PHA ; Save it
BCC PRG022_CD8F ; 50/50 chance jump to PRG022_CD8F
LDX #$00 ; Otherwise, X = $00
PRG022_CD8F:
; Temp_Var1 = -$10 or $00
TXA
STA <Temp_Var1
PLA ; Restore random value
AND #$0f ; Keep lower 4 bits
ORA <Temp_Var1 ; OR onto Temp_Var1
STA Bonus_CoinsXVel,Y ; -> Bonus_CoinsXVel
LDA RandomN,Y
AND #$07 ; Random 0-7
ORA #-$40 ; Base -$40
STA Bonus_CoinsYVel,Y ; -> Bonus_CoinsYVel
DEY ; Y--
BPL PRG022_CD7C ; While Y >= 0, loop!
INC BonusCoins_State ; BonusCoins_State = 1
RTS ; Return
BonusCoins_UpdateAndDraw:
LDY Bonus_DiePos ; Y = Bonus_DiePos
PRG022_CDAE:
JSR BonusCoin_ApplyYVel ; Apply Y velocity to coin
JSR BonusCoin_ApplyXVel ; Apply X velocity to coin
; Coins fall rate
LDA Bonus_CoinsYVel,Y
ADD #$02
STA Bonus_CoinsYVel,Y
DEY ; Y--
BPL PRG022_CDAE ; While Y >= 0, loop
JSR BonusCoins_Draw ; Draw the bonus coins
LDY Bonus_DiePos ; Y = Bonus_DiePos
PRG022_CDC6:
LDA Bonus_CoinsY,Y
CMP #$f8
BNE PRG022_CDD3 ; If this coin is not off-screen, jump to PRG022_CDD3 (RTS)
DEY ; Y--
BPL PRG022_CDC6 ; While Y >= 0, loop
; All coins are off-screen; proceed!
INC Bonus_GameState ; Bonus_GameState = 4
PRG022_CDD3:
RTS ; Return
BonusCoin_ApplyXVel:
; Offset to coin X velocity
TYA
ADD #(Bonus_CoinsXVelFrac - Bonus_CoinsYVelFrac)
TAY
JSR BonusCoin_ApplyVel ; Apply X velocity to coin
; Offset back
TYA
SUB #(Bonus_CoinsXVelFrac - Bonus_CoinsYVelFrac)
TAY
RTS ; Return
BonusCoin_ApplyYVel:
; Note: This check is superfluous because of the following one!
LDA Bonus_CoinsYVel,Y
BMI BonusCoin_ApplyVel ; If coin is moving upward, apply velocity to coin and don't come back
CMP #$40
BLS BonusCoin_ApplyVel ; If coin is moving downward < $40, apply velocity to coin and don't come back
; Max coin falling speed at $40
LDA #$40
STA Bonus_CoinsYVel,Y
BonusCoin_ApplyVel:
LDA Bonus_CoinsYVel,Y ; Get coin Velocity
ASL A
ASL A
ASL A
ASL A ; Fractional part shifted up
STA <Temp_Var1 ; -> Temp_Var1
LDX #$00 ; X = 0 (positive high part)
LDA Bonus_CoinsYVel,Y ; Get Velocity
LSR A
LSR A
LSR A
LSR A ; Whole part shifted down (integer)
CMP #%00001000 ; Check the sign bit
BLT PRG022_CE09 ; If the value was not negatively signed, jump to PRG022_CE09
DEX ; X = $FF (negative high part)
ORA #%11110000 ; Apply a sign extension
PRG022_CE09:
STA <Temp_Var2 ; -> Temp_Var2
; Add to coin's velocity fractional accumulator
LDA Bonus_CoinsYVelFrac,Y
ADD <Temp_Var1
STA Bonus_CoinsYVelFrac,Y
; Add appropriately to coin's Y
LDA Bonus_CoinsY,Y
ADC <Temp_Var2
STA Bonus_CoinsY,Y
RTS ; Return
BonusCoins_Draw:
LDY Bonus_DiePos ; Y = Bonus_DiePos
PRG022_CE20:
TYA
ASL A
ASL A
TAX ; X = Y * 4 (offset in Sprite RAM to coin's sprite)
LDA Bonus_CoinsY,Y
CMP #192
BLT PRG022_CE30 ; If coin Y < 192 (top of status bar), jump to PRG022_CE30
; Coin too low; set coin Y = $F8 (hide it!)
LDA #$f8
STA Bonus_CoinsY,Y
PRG022_CE30:
; Set coin sprite Y
STA Sprite_RAM+$80,X
; Set coin sprite pattern
LDA #$61
STA Sprite_RAM+$81,X
; Set coin attribute
LDA #SPR_PAL1
STA Sprite_RAM+$82,X
; Set coin sprite X
LDA Bonus_CoinsX,Y
STA Sprite_RAM+$83,X
DEY ; Y--
BPL PRG022_CE20 ; While Y >= 0, loop
RTS ; Return
Bonus_Wait80:
LDA Bonus_Timer
BNE PRG022_CE51 ; If Bonus_Timer <> 0, jump to PRG022_CE51
; Bonus_Timer = $80
LDA #$80
STA Bonus_Timer
PRG022_CE51:
DEC Bonus_Timer ; Bonus_Timer--
BNE PRG022_CE64 ; If Bonus_Timer has not expired, jump to PRG022_CE64
INC Bonus_GameState ; Bonus_GameState = 5/9
LDA Bonus_GameState
CMP #$09
BNE PRG022_CE64 ; If Bonus_GameState <> 9, jump to PRG022_CE64 (RTS)
; Otherwise, exit to map
LDA #$01
STA <Level_ExitToMap
PRG022_CE64:
RTS ; Return
Roulette_BorderSprites:
.byte $0F, $03, $00, $08
.byte $0F, $05, $00, $F0
.byte $0F, $0B, $00, $F8
.byte $AF, $09, $00, $08
.byte $AF, $07, $00, $F0
.byte $AF, $0B, $00, $F8
Roulette_DrawBorderSprites:
; Temp_Var1 = 31 (Sprite Y start)
LDA #31
STA <Temp_Var1
LDY #$60 ; Y = $60 (Sprite RAM offset)
PRG022_CE83:
; Set Sprite Ys
LDA <Temp_Var1
STA Sprite_RAM+$04,Y
STA Sprite_RAM+$08,Y
STA Sprite_RAM+$0C,Y
; Set border sprite patterns
LDA #$01
STA Sprite_RAM+$05,Y
STA Sprite_RAM+$09,Y
; Set right edge black sprite pattern
LDA #$0b
STA Sprite_RAM+$0D,Y
; Set sprite attributes
LDA #SPR_PAL0
STA Sprite_RAM+$06,Y
STA Sprite_RAM+$0A,Y
STA Sprite_RAM+$0E,Y
; Set sprite Xs
LDA #8
STA Sprite_RAM+$07,Y
LDA #240
STA Sprite_RAM+$0B,Y
LDA #248
STA Sprite_RAM+$0F,Y
; Temp_Var1 (Sprite Y) += 16
LDA <Temp_Var1
ADD #16
STA <Temp_Var1
TYA
SUB #12 ; -12 (3 sprites prior)
TAY
BPL PRG022_CE83 ; While Y >= 0, loop!
LDY #$17
PRG022_CEC5:
LDA Roulette_BorderSprites,Y
STA Sprite_RAM+$70,Y
DEY ; Y--
BPL PRG022_CEC5 ; While Y >= 0, loop
RTS ; Return
UpdSel_Roulette:
; Caution: You're on interrupt time here!
; Performing some work that got skipped because we diverted here in the interrupt
LDA #$00 ; A = 0
STA PPU_CTL2 ; Hide sprites and bg (most importantly)
STA PPU_SPR_ADDR ; Resets to sprite 0 in memory
LDA #$02 ; A = 2
STA SPR_DMA ; DMA sprites from RAM @ $200 (probably trying to blank them out)
JSR PT2_Full_CHRROM_Switch ; Set up PT2 (Sprites) CHRROM
LDA <Graphics_Queue
ASL A
TAX ; X = Graphics_Queue * 2
; Roulette maintains its own update table, though not really used
LDA Video_Upd_TableRoulette,X
STA <Video_Upd_AddrL
LDA Video_Upd_TableRoulette+1,X
STA <Video_Upd_AddrH
JSR Video_Misc_Updates ; Various updates other than scrolling (palettes, status bar, etc.)
; Graphics_Queue = 0
LDA #$00
STA <Graphics_Queue
STA Graphics_BufCnt ; Reset Graphics_Buffer counter
STA Graphics_Buffer+$00 ; Terminate it
LDA PPU_STAT
; Unknown hardware thing? Is this for synchronization?
LDX #$3f ;
STX PPU_VRAM_ADDR ; Access PPU address #3Fxx
LDA #$00 ;
STA PPU_VRAM_ADDR ; Access PPU address #3F00 (palettes?)
STA PPU_VRAM_ADDR ;
STA PPU_VRAM_ADDR ; Now accessing $0000 (Pattern tables?)
LDA <PPU_CTL2_Copy
ORA #%00011000
STA PPU_CTL2 ; Show BG+Sprites
; Generate VBlank Resets, use 8x16 sprites, sprites use PT2
LDA #$a8
STA PPU_CTL1
LDA PPU_STAT
LDA #$00
STA PPU_SCROLL
STA PPU_SCROLL
LDA PPU_STAT
LDA #$ff
STA MMC3_IRQCNT
STA MMC3_IRQLATCH
; Unknown hardware thing? Is this for synchronization?
LDA #$00
STA PPU_VRAM_ADDR
STA PPU_VRAM_ADDR
LDA #$10
STA PPU_VRAM_ADDR
STA PPU_VRAM_ADDR
LDA #$00
STA PPU_VRAM_ADDR
STA PPU_VRAM_ADDR
LDA #$10
STA PPU_VRAM_ADDR
STA PPU_VRAM_ADDR
LDA #$00
STA PPU_VRAM_ADDR
STA PPU_VRAM_ADDR
; Fire on scanline 32
LDA #$20
STA MMC3_IRQCNT
STA MMC3_IRQLATCH
STA MMC3_IRQENABLE
CLI ; Enable maskable interrupts
JSR Read_Joypads ; Updates both joypads in RAM
LDX #$00 ; X = 0
LDY #$02 ; Y = 2
; Temp_Var1 = 0 or 2, random
LDA Random_Pool
AND #$02
STA <Temp_Var1
; Temp_Var1 = 0 or 2, random
LDA RandomN
AND #$02
EOR <Temp_Var1
CLC ; Clear carry
BEQ PRG022_CF7C ; If random result is zero, jump to PRG022_CF7C
SEC ; Set carry if non-zero
; Rotates the first couple random values around
PRG022_CF7C:
ROR Random_Pool,X
INX ; X = 1
DEY ; Y--
BNE PRG022_CF7C ; While Y >= 0, loop
JSR Roulette_DoGame ; Actually run the Roulette game
; Switch to page 26 @ A000
LDA #MMC3_8K_TO_PRG_A000
STA MMC3_COMMAND
LDA #26
STA MMC3_PAGE
JSR StatusBar_UpdateValues ; Update Status Bar (not really used)
; Switch to page 28 @ A000
LDA #MMC3_8K_TO_PRG_A000
STA MMC3_COMMAND
LDA #28
STA MMC3_PAGE
; Jump to the sound engine, newly inserted at page A000!
JSR Sound_Engine_Begin
; Change A000 back to whatever it was before the sound engine
JSR PRGROM_Change_A000
INC <Counter_1 ; Simply increments every frame, used for timing
; Pull (pop) the three temp vars from the stack
PLA
STA <Temp_Var3
PLA
STA <Temp_Var2
PLA
STA <Temp_Var1
; This pulls (pops) all the registers from the stack...
PLA
TAY
PLA
TAX
PLA
PLP
; Fully cleaned up "NMI" interrupt
RTI
Video_Upd_TableRoulette:
.word Graphics_Buffer
.byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $BE, $07
Video_RoulBordAttr:
vaddr $2020
.byte VU_REPEAT | $20, $FC
vaddr $2040
.byte VU_REPEAT | $20, $FC
vaddr $2061
.byte VU_REPEAT | $1E, $A1
vaddr $22E0
.byte VU_REPEAT | $20, $FF
vaddr $26E0
.byte VU_REPEAT | $20, $FF
vaddr $23C8
.byte $20, $55, $55, $D5, $F5, $F5, $75, $55, $55, $55, $55, $DD, $FF, $FF, $77, $55
.byte $55, $55, $55, $DD, $FF, $FF, $77, $95, $A5, $55, $55, $DD, $FF, $FF, $77, $99, $AA
vaddr $23E8
.byte VU_REPEAT | $08, $55
vaddr $27C0
.byte VU_REPEAT | $08, $55
vaddr $27C8
.byte $20, $55, $55, $D5, $F5, $F5, $75, $55, $55, $55, $55, $DD, $FF, $FF, $77, $55
.byte $55, $A5, $65, $DD, $FF, $FF, $77, $55, $55, $AA, $66, $DD, $FF, $FF, $77, $55, $55
vaddr $27E8
.byte VU_REPEAT | $08, $55
; Terminator
.byte $00
Roulette_DoGame:
LDA Roulette_ConfigRun
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word Roulette_Configure ; Configure Roulette game
.word Roulette_RunGame ; Run it!
Roulette_Configure:
LDA Roulette_ConfigState
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word Roulette_ConfigPPUCTL2 ; Set up to show BG+Sprites
.word Roulette_ConfigTurns ; Set number of turns (always 0!)
Roulette_ConfigPPUCTL2:
; Show BG+Sprites
LDA #$18
STA <PPU_CTL2_Copy
INC Roulette_ConfigState ; Roulette_ConfigState = 1
RTS ; Return
Roulette_ConfigTurns:
INC Roulette_ConfigRun ; Roulette_ConfigRun = 1
; Roulette_Turns = 0 (No extra turns for you!)
LDA #$00
STA Roulette_Turns
RTS ; Return
Roulette_RunGame:
LDA Roulette_RunState
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word Roulette_Init ; 0: Initialize the game
.word Roulette_Run ; 1: Run the game
.word Roulette_FadeOut ; 2: Fade to black
.word Roulette_ExitToMap ; 3: Exit to map
.word Roulette_GiveReward ; 4: Get extra lives prize and display sprite
Roulette_Init:
LDA #$00
STA Roulette_StopState ; Roulette_StopState = 0
STA Roulette_StopState+1 ; Roulette_StopState+1 = 0
STA Roulette_StopState+2 ; Roulette_StopState+2 = 0
STA Roulette_Lives ; Roulette_Lives = 0
; Roulette_Speed = $70
LDA #$70
STA Roulette_Speed
; Roulette_Speed+1 = $90
LDA #$90
STA Roulette_Speed+1
; Roulette_Speed+2 = $7F
LDA #$7f
STA Roulette_Speed+2
; Roulette_Unused7A5F_Delta = $30
LDA #$30
STA Roulette_Unused7A5F_Delta
INC Roulette_RunState ; Roulette_RunState = 1 (Run game)
JMP Roulette_DrawBorderSprites ; Draw border sprites and don't come back!
Roulette_Run:
LDA <Pad_Input
AND #(PAD_A | PAD_B)
BEQ PRG022_D0DF ; If Player is NOT pressing A or B, jump to PRG022_D0DF
; Player is pressing A or B...
LDA Roulette_StopState
BNE PRG022_D0A2 ; If row 1 is already stopping/stopped, jump to PRG022_D0A2
; Row 1 needs to be stopped...
INC Roulette_StopState ; Row 1's stop state = 1
; Set Roulette_StopCnt = $20 to $2F, random
LDA RandomN
AND #$0f
ORA #$20
STA Roulette_StopCnt
JMP PRG022_D0D7 ; Jump to PRG022_D0D7
PRG022_D0A2:
LDA Roulette_StopState+1
BNE PRG022_D0BE ; If row 2 is already stopping/stopped, jump to PRG022_D0BE
LDA Roulette_StopState
CMP #$02
BLT PRG022_D0BE ; If Row 1 is not close enough to stopping yet, jump to PRG022_D0BE
INC Roulette_StopState+1 ; Row 2's stop state = 1
; Set Roulette_StopCnt+1 = $20 to $3F, random
LDA RandomN+1
AND #$1f
ORA #$20
STA Roulette_StopCnt+1
JMP PRG022_D0D7 ; Jump to PRG022_D0D7
PRG022_D0BE:
LDA Roulette_StopState+2
BNE PRG022_D0DF ; If row 3 is already stopping/stopped, jump to PRG022_D0DF
LDA Roulette_StopState+1
CMP #$02
BLT PRG022_D0DF ; If Row 2 is not close enough to stopping yet, jump to PRG022_D0DF
INC Roulette_StopState+2 ; Row 3's stop state = 1
; Set Roulette_StopCnt+2 = $40 to $7F, random
LDA RandomN+2
AND #$3f
ORA #$40
STA Roulette_StopCnt+2
PRG022_D0D7:
; Bleep sound
LDA Sound_QMap
ORA #SND_MAPPATHMOVE
STA Sound_QMap
PRG022_D0DF:
LDX #$02
PRG022_D0E1:
STX <Roulette_RowIdx ; Update Roulette_RowIdx
LDA Roulette_StopCnt,X
BEQ PRG022_D0EB ; If this row's stop counter = 0, jump to PRG022_D0EB
DEC Roulette_StopCnt,X ; Otherwise, decrement this row's stop counter
PRG022_D0EB:
JSR RouletteRow_DoStopState ; Do the row's stop state code
DEX ; X--
BPL PRG022_D0E1 ; While X >= 0, loop!
RTS ; Return
RouletteRow_DoStopState:
LDA Roulette_StopState,X
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word RouletteRow_Move ; 0: Row is not stopping; it is running, if you will
.word RouletteRow_WaitToStop ; 1: Waits for specific Roulette_StopCnt to hit zero
.word RouletteRow_Slow ; 2: Slow down row
.word RouletteRow_HitLockPos ; 3: Slide row into lock position
.word RouletteRow_LockDecide ; 4: Lock, bounce, decide reward, if any
.word RouletteRow_EndTurn ; 5: End-of-turn logic (in modern game there are no more turns, Roulette_Turns = 0)
RouletteRow_Move:
CPX #$02
BNE PRG022_D11C ; If this is NOT row 3, jump to PRG022_D11C
; On row 3 only... (basically stuff updated only once for all rows)
; Roulette_Unused7A5F (value never used for anything) += Roulette_Unused7A5F_Delta
LDA Roulette_Unused7A5F
ADD Roulette_Unused7A5F_Delta
STA Roulette_Unused7A5F
; Something removed?
NOP
NOP
; Play the "ringing" sound
LDA Sound_QPlayer
ORA #SND_PLAYERPOWER
STA Sound_QPlayer
PRG022_D11C:
JMP Roulette_MoveRow ; Jump to Roulette_MoveRow
RouletteRow_WaitToStop:
LDA Roulette_StopCnt,X
BNE RouletteRow_Move ; If this row's stop counter is not zero, move the Roulette rows and don't come back...
INC Roulette_StopState,X ; This row's stop state = 2
JMP RouletteRow_Move ; Move the Roulette rows and don't come back...
RouletteRow_Slow:
LDA Roulette_Speed,X
ADD #$3f
CMP #$7f
BGE PRG022_D13A ; If we have not reached a stop speed, jump to PRG022_D13A
INC Roulette_StopState,X ; This row's stop state = 3
JMP RouletteRow_Move ; Move the Roulette rows and don't come back...
PRG022_D13A:
CPX #$02
BNE PRG022_D151 ; If this is not the third row, jump to PRG022_D151
; Roulette_Unused7A5F_Delta is added to Roulette_Unused7A5F, but Roulette_Unused7A5F itself is never used!
LDA Roulette_Unused7A5F_Delta
CMP #$11
BLT PRG022_D151 ; If Roulette_Unused7A5F_Delta < $11, jump to PRG022_D151
DEC Roulette_Unused7A5F_Delta ; Roulette_Unused7A5F_Delta--
LDA <Counter_1
AND #$01
BNE PRG022_D151 ; Every other tick, jump to PRG022_D151
DEC Roulette_Unused7A5F_Delta ; Roulette_Unused7A5F_Delta--
PRG022_D151:
LDA Roulette_Speed,X
BPL PRG022_D15F ; If Roulette_Speed is positive, jump to PRG022_D15F
; Roulette_Speed += 4
LDA Roulette_Speed,X
ADD #$04 ; Really +2, but it hits the -2 after this
STA Roulette_Speed,X
PRG022_D15F:
; Roulette_Speed -= 2
LDA Roulette_Speed,X
SUB #$02
STA Roulette_Speed,X
JMP RouletteRow_Move ; Move the Roulette rows and don't come back...
RouletteRow_HitLockPos:
LDA Roulette_Pos,X
AND #%01111100
BNE PRG022_D192 ; If this is not a lock position, jump to PRG022_D192
; "Swim" sound (row locking)
LDA #SND_PLAYERSWIM
STA Sound_QPlayer
; Roulette_StopCnt = $12
LDA #$12
STA Roulette_StopCnt,X
; Lock row position
LDA Roulette_Pos,X
ADD #$20
AND #$80
STA Roulette_Pos,X
LDA Roulette_PosHi,X
ADC #$00
STA Roulette_PosHi,X
INC Roulette_StopState,X ; This row's stop state = 4
PRG022_D192:
JMP RouletteRow_Move ; Move the Roulette rows and don't come back...
Roulette_MatchSets:
.byte $00, $02 ; First row Mushroom (primary) alternating mushroom matches
.byte $01, $01 ; First row Flower (nothing special)
.byte $02, $00 ; First row Muchroom (secondary) alternating mushroom matches
.byte $03, $03 ; First row Star (nothing special)
Roulette_MatchReward:
.byte $02, $03, $02, $05 ; Number of lives you get (Mushroom, Flower, Mushroom, Star)
RouletteRow_LockDecide:
LDA Roulette_StopCnt,X
BNE PRG022_D20B ; If this row's stop counter is not zero, jump to PRG022_D20B
; Enforce the lock position
LDA Roulette_Pos,X
ADD #$20
AND #$80
STA Roulette_Pos,X
STA <Temp_Var1 ; -> Temp_Var1
LDA Roulette_PosHi,X
ADC #$00
STA Roulette_PosHi,X
ASL <Temp_Var1
ROL A
AND #$03
STA Roulette_ShapeLock,X
CPX #$02
BNE PRG022_D205 ; If this is not the third row, jump to PRG022_D205
; Roulette_StopCnt = $50
LDA #$50
STA Roulette_StopCnt,X
LDA Roulette_ShapeLock
ASL A
TAY ; Y = Roulette_ShapeLock * 2
LDX #$01 ; X = 1 (mainly for the dual mushroom, there is two possible matches)
PRG022_D1D3:
LDA Roulette_ShapeLock+1,X
CMP Roulette_MatchSets,Y
BEQ PRG022_D1E0 ; If the first row locked shape matches this row, jump to PRG022_D1E0
CMP Roulette_MatchSets+1,Y
BNE PRG022_D200 ; If we have a mismatch, jump to PRG022_D200
PRG022_D1E0:
DEX ; X--
BPL PRG022_D1D3 ; While X >= 0, loop
LDY Roulette_ShapeLock ; Y = Roulette_ShapeLock
LDA Roulette_MatchReward,Y
STA Roulette_Lives
; Roulette_RunState = 4
LDA #$04
STA Roulette_RunState
; Roulette_xUpY = 240
LDA #240
STA Roulette_xUpY
; Roulette_StopCnt = 0
LDA #$00
STA Roulette_StopCnt
LDX <Roulette_RowIdx ; X = Roulette_RowIdx
; Do NOT return to caller
PLA
PLA
RTS ; Return
PRG022_D200:
; Play mismatch sound
LDA #SND_MAPDENY
STA Sound_QMap
PRG022_D205:
LDX <Roulette_RowIdx ; X = Roulette_RowIdx
INC Roulette_StopState,X ; This row's stop state = 5
RTS ; Return
PRG022_D20B:
LDY #$10 ; Y = $10
AND #$04
BNE PRG022_D213 ; 4 ticks on, 4 ticks off; jump to PRG022_D213
LDY #-$10 ; Y = -$10
PRG022_D213:
; Set Roulette_Speed = $10/-$10 ("bounce" effect as locking)
TYA
STA Roulette_Speed,X
JMP RouletteRow_Move ; Move the Roulette rows and don't come back...
RouletteRow_EndTurn:
CPX #$02
BNE PRG022_D223 ; If this is not the third row, jump to PRG022_D223 (RTS) (doesn't do anything)
LDA Roulette_StopCnt,X
BEQ PRG022_D224 ; If the stop counter is zero, jump to PRG022_D224
PRG022_D223:
RTS ; Return
PRG022_D224:
LDA Roulette_Turns
BEQ PRG022_D238 ; If Roulette_Turns = 0 (out of turns), jump to PRG022_D238
; At least one turn remaining ... (this is UNUSED!)
LDA <Pad_Holding
AND #(PAD_A | PAD_B | PAD_START)
BEQ PRG022_D237 ; If Player is not pressing A, B, or START, jump to PRG022_D237
DEC Roulette_Turns ; Roulette_Turns--
; Roulette_RunState = 0 (re-initialize for another round!)
LDA #$00
STA Roulette_RunState
PRG022_D237:
RTS ; Return
PRG022_D238:
; Do not return to caller
PLA
PLA
PRG022_D23A:
; Roulette_RunState = 2
LDA #$02
STA Roulette_RunState
; Roulette_StopState = 0 <-- Reusing it differently, as pal fadeout prep flag
LDA #$00
STA Roulette_StopState
RTS ; Return
Roulette_FadeOut:
LDA Roulette_StopState ; Being reused as a flag here
BNE PRG022_D250 ; If Roulette_StopState <> 0 (palette fade prepared), jump to PRG022_D250
INC Roulette_StopState ; Roulette_StopState = 1
JMP Palette_PrepareFadeOut ; Prepare to fade out
PRG022_D250:
JSR Roulette_DoFadeOut ; Do palette fade out
LDA Fade_Level
BNE PRG022_D52B ; If not completely faded out, jump to PRG022_D52B (RTS)
INC Roulette_RunState ; Roulette_RunState = 3
PRG022_D52B:
RTS ; Return
Roulette_ExitToMap:
; Cancel the natural fade out that comes from exiting to map
LDA #$01
STA FadeOut_Cancel
; Exit to map!
LDA #$01
STA <Level_ExitToMap
LDA #$80
STA Update_Select
LDA #$00
STA Update_Request
RTS ; Return
Roulette_RewardPattern:
; 1 2 5
.byte $01, $F3, $F5, $01, $F7 ; $01 patterns are invalid
Roulette_GiveReward:
; Load patterns for "x Up"
LDA #$32
STA PatTable_BankSel+4
LDA #$55
STA PatTable_BankSel+5
LDA Roulette_StopCnt
BEQ PRG022_D2B4 ; If stop counter is zero, jump to PRG022_D2B4
DEC Roulette_StopCnt ; Roulette_StopCnt--
BNE PRG022_D28C ; If Roulette_StopCnt <> 0, jump to PRG022_D28C
JMP PRG022_D23A ; Jump to PRG022_D23A
PRG022_D28C:
LDA SndCur_Level1
BNE PRG022_D2B1 ; If 1-Up sound is playing, jump to PRG022_D2B1
LDA Roulette_LivesToGive
BEQ PRG022_D2B1 ; If no lives left to give, jump to PRG022_D2B1
; Roulette_StopCnt = $A0
LDA #$a0
STA Roulette_StopCnt
DEC Roulette_LivesToGive ; Roulette_LivesToGive--
; Play 1-up sound
LDA Sound_QLevel1
ORA #SND_LEVEL1UP
STA Sound_QLevel1
; Give life to appropriate Player
LDX Player_Current ; X = Player_Current
LDA Player_Lives,X
BMI PRG022_D2B1 ; If this Player is not dead from game over (??), jump to PRG022_D2B1
INC Player_Lives,X ; One more life
PRG022_D2B1:
JMP Roulette_DrawXUpReward ; Jump to Roulette_DrawXUpReward
PRG022_D2B4:
; "x Up" Y -= 4
DEC Roulette_xUpY
DEC Roulette_xUpY
DEC Roulette_xUpY
DEC Roulette_xUpY
LDA Roulette_xUpY
CMP #96
BGE Roulette_DrawXUpReward ; If Roulette_xUpY >= 96, jump to Roulette_DrawXUpReward
; Initialize Roulette_LivesToGive
LDA Roulette_Lives
STA Roulette_LivesToGive
; Roulette_StopCnt = $50
LDA #$50
STA Roulette_StopCnt
Roulette_DrawXUpReward:
; Set "x Up" Sprite Y
LDA Roulette_xUpY
STA Sprite_RAM+$F0
STA Sprite_RAM+$F4
STA Sprite_RAM+$F8
; Set sprite 1 X
LDA #$70
STA Sprite_RAM+$F3
; Set sprite 2 X
LDA #$7c
STA Sprite_RAM+$F7
; Set sprite 3 X
LDA #$84
STA Sprite_RAM+$FB
; Set pattern by reward level
LDY Roulette_Lives ; Y = Roulette_Lives
LDA Roulette_RewardPattern-1,Y
STA Sprite_RAM+$F1
; 'U'
LDA #$ab
STA Sprite_RAM+$F5
; 'P'
LDA #$ad
STA Sprite_RAM+$F9
; Set attributes
LDA #SPR_PAL3
STA Sprite_RAM+$F2
STA Sprite_RAM+$F6
STA Sprite_RAM+$FA
RTS ; Return
Roulette_DoFadeOut:
; Sort of a clone of Palette_DoFadeOut
LDA Fade_Tick
BEQ PRG022_D314 ; If Fade_Tick = 0, jump to PRG022_D314
DEC Fade_Tick ; Otherwise, Fade_Tick--
PRG022_D314:
LDA Fade_Level
BEQ PRG022_D33C ; If Fade_Level = 0, jump to PRG022_D33C (RTS)
LDA Fade_Tick
BNE PRG022_D33C ; If Fade_Tick <> 0, jump to PRG022_D33C (RTS)
; Fade_Tick = 4
LDA #$04
STA Fade_Tick
DEC Fade_Level ; Fade_Level--
; For all palette colors...
LDY #31
PRG022_D328:
LDA Palette_Buffer,Y ; Get this color
SUB #16 ; Subtract 16 from it
BPL PRG022_D332 ; If we didn't go below zero, jump to PRG026_AC55
LDA #$0f ; Otherwise, set it to safe minimum
PRG022_D332:
STA Palette_Buffer,Y ; Update palette color
DEY ; Y--
BPL PRG022_D328 ; While Y >= 0, loop!
; Commit palette fade
LDA #$06
STA <Graphics_Queue
PRG022_D33C:
RTS ; Return
Roulette_MoveRow:
LDA Roulette_Speed,X ; Get this Roulette row speed
ASL A
ASL A
ASL A
ASL A ; Fractional part shifted up
STA <Temp_Var2 ; -> Temp_Var2
LDA Roulette_Speed,X ; Get this Roulette row speed
LSR A
LSR A
LSR A
LSR A ; Whole part shifted down (integer)
CMP #%00001000 ; Check the sign bit
BLT PRG022_D353 ; If the value was not negatively signed, jump to PRG000_DD19
ORA #%11110000 ; Otherwise, apply a sign extension
PRG022_D353:
STA <Temp_Var1 ; -> Temp_Var1
; NOTE: Other versions of the fractional accumulator usually merge this
; part up with the sign extension application, which is probably better :)
LDY #$00 ; Y = 0 (positive high part)
CMP #$00
BPL PRG022_D35C ; If the whole part is positive, jump to PRG022_D35C
DEY ; Y = $FF (negative high part)
PRG022_D35C:
STY <Temp_Var3 ; -> Temp_Var3
; Fractional accumulation
LDA Roulette_PosFrac,X
ADD <Temp_Var2
STA Roulette_PosFrac,X
; Add to Pos/Hi
LDA Roulette_Pos,X
ADC <Temp_Var1
STA Roulette_Pos,X
LDA Roulette_PosHi,X
ADC <Temp_Var3
STA Roulette_PosHi,X
RTS ; Return
Roulette_Shapes:
.word Roulette_Star
.word Roulette_Mushroom
.word Roulette_Flower
Roulette_Star:
.byte $FE, $FE, $FE, $FE, $FE, $9D, $9E, $FE, $FE, $FE, $FE, $FE
.byte $FE, $FE, $FE, $FE, $AC, $AD, $AE, $AF, $FE, $FE, $FE, $FE
.byte $FE, $FE, $FE, $FE, $BC, $FC, $FC, $BF, $FE, $FE, $FE, $FE
.byte $FE, $FE, $FE, $9C, $CC, $FC, $FC, $CF, $9F, $FE, $FE, $FE
.byte $96, $97, $97, $CD, $FC, $FC, $FC, $FC, $84, $97, $97, $C0
.byte $A6, $FC, $FC, $FC, $34, $FC, $FC, $37, $FC, $FC, $FC, $D0
.byte $BD, $BE, $FC, $FC, $44, $FC, $FC, $47, $FC, $FC, $F0, $E0
.byte $FE, $CE, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $ED, $B2, $FE
.byte $FE, $D1, $FC, $FC, $8C, $8D, $8E, $8F, $FC, $F8, $EE, $FE
.byte $FE, $E1, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $E3, $FE
.byte $E2, $FC, $FC, $FC, $FC, $CB, $FC, $FC, $FC, $FC, $F3, $E4
.byte $F2, $FC, $FC, $F9, $DC, $DD, $DE, $DF, $FC, $FC, $FC, $F4
.byte $E5, $FC, $E7, $E8, $DA, $FE, $FE, $DB, $E9, $EA, $FC, $EC
.byte $F5, $F6, $F7, $FE, $FE, $FE, $FE, $FE, $FE, $FA, $FB, $EF
Roulette_Mushroom:
.byte $FC, $FC, $FC, $0A, $0B, $0C, $0D, $0E, $0F, $FC, $FC, $FC
.byte $FC, $FC, $1C, $1D, $FD, $FD, $06, $FE, $1E, $1F, $FC, $FC
.byte $FC, $13, $14, $15, $16, $17, $FE, $FE, $18, $00, $01, $FC
.byte $26, $2A, $FE, $FE, $FE, $FE, $FE, $FE, $2C, $FD, $2D, $2E
.byte $2F, $FE, $3C, $3D, $3E, $3F, $FE, $FE, $33, $FD, $FD, $36
.byte $31, $FE, $38, $FD, $FD, $3A, $FE, $FE, $4C, $4D, $4E, $4F
.byte $41, $FE, $43, $FD, $FD, $45, $FE, $FE, $FE, $FE, $FE, $46
.byte $5C, $5D, $5E, $5F, $48, $4A, $FE, $FE, $FE, $FE, $FE, $51
.byte $56, $5A, $FE, $62, $63, $64, $64, $65, $66, $FE, $FE, $67
.byte $6C, $6D, $6E, $6F, $34, $FC, $FC, $37, $7C, $7D, $7E, $7F
.byte $FC, $FC, $70, $FC, $44, $FC, $FC, $47, $FC, $71, $FC, $FC
.byte $FC, $FC, $7A, $FC, $FC, $FC, $FC, $FC, $FC, $7B, $FC, $FC
.byte $FC, $FC, $68, $FC, $8C, $8D, $8E, $8F, $FC, $76, $FC, $FC
.byte $FC, $FC, $89, $8A, $8B, $8B, $8B, $8B, $87, $88, $FC, $FC
Roulette_Flower:
.byte $FE, $FE, $02, $03, $04, $05, $05, $07, $08, $09, $FE, $FE
.byte $10, $11, $12, $FD, $FD, $FD, $FD, $FD, $FD, $19, $1A, $1B
.byte $20, $21, $22, $23, $24, $25, $25, $27, $28, $29, $FD, $2B
.byte $30, $FD, $32, $FC, $34, $FC, $FC, $37, $FC, $39, $FD, $3B
.byte $40, $FD, $42, $FC, $44, $FC, $FC, $47, $FC, $49, $FD, $4B
.byte $50, $FD, $52, $53, $54, $55, $55, $57, $58, $59, $FD, $5B
.byte $60, $61, $FD, $FD, $FD, $FD, $FD, $FD, $FD, $69, $6A, $6B
.byte $FE, $FE, $72, $73, $74, $75, $75, $77, $78, $79, $FE, $FE
.byte $80, $81, $82, $83, $FC, $85, $86, $FC, $FC, $FC, $FC, $FC
.byte $90, $91, $92, $93, $94, $95, $FC, $FC, $98, $99, $9A, $9B
.byte $E6, $FE, $EB, $35, $A4, $A5, $FC, $A7, $A8, $A9, $AA, $AB
.byte $B0, $B1, $FE, $B3, $B1, $B5, $B6, $B7, $B8, $B9, $BA, $BB
.byte $FC, $C1, $FE, $C3, $C4, $C5, $C6, $C7, $C8, $C9, $CA, $FC
.byte $FC, $FC, $D2, $D3, $D4, $D5, $D6, $D7, $D8, $D9, $FC, $FC
Roulette_DrawShapes:
; The actual rendered pattern is Right Half Star, Mushroom, Flower, Mushroom, Left Half Star
LDY #$20 ; Y = $20 (VRAM address high)
JSR PRG022_D57D
LDY #$24 ; Y = $24 (VRAM address high)
PRG022_D57D:
; Temp_Var1 = $80
LDA #$80
STA <Temp_Var1
PRG022_D581:
LDA PPU_STAT
; Set VRAM address high
STY PPU_VRAM_ADDR
; Set VRAM address low
LDA <Temp_Var1
STA PPU_VRAM_ADDR
; Fills in a row with the pinkish "background" color
LDX #31 ; X = 31 (32 tiles per row)
PRG022_D58E:
; Insert a background tile
LDA #$fe
STA PPU_VRAM_DATA
DEX ; X--
BPL PRG022_D58E ; While X >= 0, loop!
; Temp_Var1 += 32 (next row of patterns)
LDA <Temp_Var1
ADD #32
STA <Temp_Var1
BCC PRG022_D5A0 ; If no carry, jump to PRG022_D5A0
INY ; Otherwise, apply carry
PRG022_D5A0:
TYA ; -> 'A'
AND #$03
CMP #$02
BNE PRG022_D581 ; If not on every third, jump to PRG022_D581
LDA <Temp_Var1
CMP #$e0
BNE PRG022_D581 ; If not at end column, jump to PRG022_D581
; At end column...
; VRAM high address
LDA #$20
STA <Temp_Var1
; Temp_Var5 = 0 (current shape from Roulette_Shapes)
LDA #$00
STA <Temp_Var5
PRG022_D5B5:
; VRAM low address
LDA #$c0
STA <Temp_Var2
LDY #$06
PRG022_D5BB:
; X = Temp_Var5 * 2 (2 byte index for Roulette shape pointer)
LDA <Temp_Var5
ASL A
TAX
; Load starting address of Roulette shape
LDA Roulette_Shapes,X
STA <Temp_Var3
LDA Roulette_Shapes+1,X
STA <Temp_Var4
PRG022_D5C9:
LDA PPU_STAT
; Set VRAM address
LDA <Temp_Var1
STA PPU_VRAM_ADDR
LDA <Temp_Var2
STA PPU_VRAM_ADDR
LDX #$00 ; X = 0
PRG022_D5D8:
LDA [Temp_Var3],Y ; Get pattern for shape
STA PPU_VRAM_DATA ; Store into VRAM
INY ; Y++ (next shape pattern)
INX ; X++ (column counter)
CPX #$06
BNE PRG022_D5D8 ; While X <> 6, loop!
; Y += 6 (jump to next row only halfway across)
TYA
ADD #$06
TAY
; Temp_Var1/2 += 32 (go to next row)
LDA <Temp_Var2
ADD #32 ; +32 next row
BCC PRG022_D5F1 ; If no carry, jump to PRG022_D5F1
INC <Temp_Var1 ; Apply carry
PRG022_D5F1:
STA <Temp_Var2
AND #$e0
CMP #$80
BNE PRG022_D5C9
LDA <Temp_Var1
AND #$03
CMP #$02
BNE PRG022_D5C9
DEC <Temp_Var1
DEC <Temp_Var1
LDA <Temp_Var2
ADD #$46
STA <Temp_Var2
LDA <Temp_Var5
CMP #$01
BNE PRG022_D61A
CPY #$ae
BEQ PRG022_D61A
LDY #$06
BNE PRG022_D5C9
PRG022_D61A:
LDA <Temp_Var2
ADD #$04
STA <Temp_Var2
LDY #$00
LDA <Temp_Var1
CMP #$24
BEQ PRG022_D635
INC <Temp_Var5
LDA <Temp_Var5
CMP #$03
BNE PRG022_D5BB
LDA #$24
STA <Temp_Var1
PRG022_D635:
DEC <Temp_Var5
BMI PRG022_D642
LDA <Temp_Var5
CMP #$02
BEQ PRG022_D643
JMP PRG022_D5BB ; Jump to PRG022_D5BB
PRG022_D642:
RTS ; Return
PRG022_D643:
JMP PRG022_D5B5 ; Jump to PRG022_D5B5
Card_InitGame:
LDA Card_InitState
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word Card_InitDeck ; 0: Initialize the card deck (if a game is not already in progress)
.word Card_RenderDeck ; 1: Renders the entire deck
.word Card_InitVars ; 2: Initializes game related memory
Card_InitDeck:
LDA Map_NSpadeInProg
BNE PRG022_D668 ; If you already have an N-Spade game in progress from before, jump to PRG022_D668
; Load in the initial set of cards
LDY #(Card_InitialSet_End - Card_InitialSet - 1)
PRG022_D659:
LDA Card_InitialSet,Y ; Get initial card
STA Card_ActiveSet,Y ; Store into card memory
DEY ; Y--
BPL PRG022_D659 ; While Y >= 0, loop!
JSR Card_Shuffle ; Shuffle some of the cards a bit
INC Map_NSpadeInProg ; There is an N-Spade in progress, people!
PRG022_D668:
INC Card_InitState ; Card_InitState = 1
; Card_Index = $11
LDA #$11
STA Card_Index
RTS ; Return
Card_RenderDeck:
; Temp_Var11 = Card_Index
LDY Card_Index
STY <Temp_Var11
LDA Card_ActiveSet,Y
AND #$80
BNE PRG022_D683 ; If card value bit 7 is set (card is already flipped over), jump to PRG022_D683
JSR Card_RenderBack ; Render "N-Spade" back of this cards
JMP PRG022_D686 ; Jump to PRG022_D686
PRG022_D683:
JSR Card_RenderFace ; Render the face of the card
PRG022_D686:
DEC Card_Index ; Card_Index--
BPL PRG022_D68E ; While Card_Index >= 0, loop
INC Card_InitState ; Card_Index =2
PRG022_D68E:
RTS ; Return
Card_InitVars:
INC Card_InitState ; Card_InitState = 3 (just used to break the loop)
; Clear some card variables
LDY #$19 ; Y = $19
PRG022_D694:
LDA #$00
STA Card_SelectX,Y
DEY ; Y--
BPL PRG022_D694 ; While Y >= 0, loop
LDY #$03 ; Y = $03
PRG022_D69E:
LDA #$ff
STA Card_UnusedArray,Y
DEY ; Y--
BPL PRG022_D69E ; While Y >= 0, loop
; Card_UnusedVL = $20
LDA #$20
STA Card_UnusedVL
; Card_UnusedVH = $DA
LDA #$da
STA Card_UnusedVH
; Card_UnusedAttr = $CE
LDA #$ce
STA Card_UnusedAttr
; Card_TurnsRemain = $01
LDA #$01
STA Card_TurnsRemain
RTS ; Return
; Sprite pattern and attributes per card selection sprite
Card_SelectPattern:
.byte $8B, $8D, $8D, $8B, $8F, $8F, $8B, $8D, $8D, $8B
Card_SelectAttribute:
.byte SPR_PAL1, SPR_PAL1, SPR_PAL1, SPR_PAL1 | SPR_HFLIP, SPR_PAL1, SPR_PAL1, SPR_PAL1 | SPR_VFLIP, SPR_PAL1 | SPR_VFLIP, SPR_PAL1 | SPR_VFLIP, SPR_PAL1 | SPR_HFLIP | SPR_VFLIP
; X position of card selector by Card_Index
Card_CursorXs:
.byte $18, $38, $58, $78, $98, $B8
.byte $18, $38, $58, $78, $98, $B8
.byte $18, $38, $58, $78, $98, $B8
; Y position of card selector by Card_Index
Card_CursorYs:
.byte $20, $20, $20, $20, $20, $20
.byte $50, $50, $50, $50, $50, $50
.byte $80, $80, $80, $80, $80, $80
; Attribute by frame of card flip
CardFlip_Attributes:
.byte SPR_PAL1, SPR_PAL1, SPR_PAL1, SPR_PAL3, SPR_PAL3
; Pattern per sprite per frame of card flip
CardFlip_FrameDefs:
CardFlip_Frame4: .byte $BD, $BD, $BF, $BF
CardFlip_Frame3: .byte $B1, $B1, $B1, $B1
CardFlip_Frame2: .byte $B5, $B5, $B5, $B5
CardFlip_Frame1: .byte $B7, $B7, $B7, $B7
CardFlip_Frame0: .byte $B7, $B7, $B7, $B7
CardFlip_FrameDefOff:
.byte CardFlip_Frame0 - CardFlip_FrameDefs
.byte CardFlip_Frame1 - CardFlip_FrameDefs
.byte CardFlip_Frame2 - CardFlip_FrameDefs
.byte CardFlip_Frame3 - CardFlip_FrameDefs
.byte CardFlip_Frame4 - CardFlip_FrameDefs
; N-Spade game initial card deck
Card_InitialSet:
.byte CARD_MUSHROOM, CARD_FLOWER, CARD_1UP, CARD_MUSHROOM, CARD_10COIN, CARD_STAR
.byte CARD_20COIN, CARD_STAR, CARD_MUSHROOM, CARD_10COIN, CARD_1UP, CARD_FLOWER
.byte CARD_20COIN, CARD_FLOWER, CARD_STAR, CARD_MUSHROOM, CARD_FLOWER, CARD_STAR
Card_InitialSet_End
; N-Spade cards VRAM High address
Card_VRAMHi:
.byte $20, $20, $20, $20, $20, $20
.byte $21, $21, $21, $21, $21, $21
.byte $22, $22, $22, $22, $22, $22
; N-Spade cards VRAM Low address
Card_VRAMLo:
.byte $A3, $A7, $AB, $AF, $B3, $B7
.byte $63, $67, $6B, $6F, $73, $77
.byte $23, $27, $2B, $2F, $33, $37
Card_FacePatterns:
; CARD_MUSHROOM
.byte $58, $5A
.byte $59, $5B
; CARD_FLOWER
.byte $5C, $5E
.byte $5D, $5F
; CARD_STAR
.byte $AC, $AD
.byte $AE, $AF
; CARD_1UP
.byte $6C, $6E
.byte $6D, $6F
; CARD_10COIN
.byte $7C, $7E
.byte $7D, $7F
; CARD_20COIN
.byte $7C, $7E
.byte $7D, $7F
Card_FaceAttribute:
.byte $FD ; CARD_MUSHROOM
.byte $FE ; CARD_FLOWER
.byte $FF ; CARD_STAR
.byte $FD ; CARD_1UP
.byte $FD ; CARD_10COIN
.byte $FD ; CARD_20COIN
Card_VRAMAttrLo:
.byte $C9, $CA, $CB, $CC, $CD, $CE
.byte $D9, $DA, $DB, $DC, $DD, $DE
.byte $E1, $E2, $E3, $E4, $E5, $E6
PRG022_D777:
.byte $7F, $BF, $FF, $7F, $7F
; For the 1-up, 10 coin, and 20 coin cards that have additional text, patterns of the bottom row
Card_BottomLeft: .byte $78, $9D, $9E
Card_BottomRight: .byte $79, $7B, $7B
NSpade_DoGame:
LDA Card_CoinsToGive
BEQ PRG022_D792 ; If there aren't any coins to give, jump to PRG022_D792
; You got a coin
INC Coins_Earned
; 100 points per coin
LDA #10
STA Score_Earned
DEC Card_CoinsToGive ; Card_CoinsToGive--
PRG022_D792:
LDA Card_GameState
JSR DynJump
; THESE MUST FOLLOW DynJump FOR THE DYNAMIC JUMP TO WORK!!
.word Card_SelectCard ; 0: Perform cursor movements
.word Card_BeginFlip ; 1: Begin card flip
.word Card_DoFlip ; 2: Perform card flip
.word Card_TwoCardResponse ; 3: Respond to the two flipped cards
.word Card_HandleMatch ; 4: Reward the card match
.word Card_HandleMismatch ; 5: Handle the mismatch
.word Card_WaitThenExit ; 6: Decrements Card_MoveDelay, then exits to map
.word Card_BeginFlipBack ; 7: Begin flipping back a card
.word Card_FlipBackCard ; 8: Flip back a card
Card_SelectCard:
JSR Card_DoSelection ; Handle pressing direction or A button
JSR Card_DrawCursor ; Draw selection cursor
RTS ; Return
Card_BeginFlip:
LDY Card_Index ; Y = Card_Index
LDA Card_ActiveSet,Y
AND #$80
BNE PRG022_D7D8 ; If this card is already flipped, jump to PRG022_D7D8
; Card_FlipFrame = 4
LDA #$04
STA Card_FlipFrame
; Temp_Var11 = Card_Index
LDA Card_Index
STA <Temp_Var11
JSR Card_Blackout ; Blacks out the card that will get flipped
; Card_AnimTick = 0
LDA #$00
STA Card_AnimTick
INC Card_GameState ; Card_GameState = 2
; Flip card sound
LDA #SND_MAPINVENTORYFLIP
STA Sound_QMap
JMP Card_DoFlip ; Jump to Card_DoFlip
PRG022_D7D8:
; Card was already flipped, so cancel
DEC Card_GameState ; Card_GameState = 0
RTS ; Return
Card_DoFlip:
LDA Card_AnimTick
BEQ PRG022_D7E5 ; If Card_AnimTick = 0, jump to PRG022_D7E5
DEC Card_AnimTick ; Card_AnimTick--
RTS ; Return
PRG022_D7E5:
; Temp_Var11 = Card_Index
LDA Card_Index
STA <Temp_Var11
JSR CardFlip_Draw ; Draw card flip
DEC Card_FlipFrame ; Card_FlipFrame--
BPL PRG022_D7FD ; If Card_FlipFrame >= 0 jump to PRG022_D7FD
; Card flip complete
; Temp_Var11 = Card_Index
LDA Card_Index
STA <Temp_Var11
JSR Card_RenderFace ; Draw card face
INC Card_GameState ; Card_GameState = 3
PRG022_D7FD:
; Card_AnimTick = 4
LDA #$04
STA Card_AnimTick
RTS ; Return
Card_TwoCardResponse:
INC Card_FlipCount ; Card_FlipCount++
JSR Card_CheckForMatch ; Determines if cards matched, sets proper state
RTS ; Return
Card_HandleMatch:
LDY Card_Index ; Y = Card_Index
; Mark second card as flipped
LDA Card_ActiveSet,Y
ORA #$80
STA Card_ActiveSet,Y
; Card_GameState = 0 (Return to card selection)
LDA #$00
STA Card_GameState
INC Map_NSpadeMatches ; Map_NSpadeMatches++
INC Card_Matches ; Card_Matches++
JSR Card_MatchPairReward ; Give reward
LDA Map_NSpadeMatches
CMP #$09
BNE PRG022_D83D ; If Map_NSpadeMatches <> 9, jump to PRG022_D83D (RTS)
; 9 matches means the game is complete
; Card_GameState = 6
LDA #$06
STA Card_GameState
; Card_MoveDelay = $40
LDA #$40
STA Card_MoveDelay
LDA #$00
STA Map_NSpadeInProg ; N-Spade game is no longer in prgoress
STA Map_NSpadeMatches ; Clear the match counter
RTS ; Return
PRG022_D83D:
RTS ; Return
Card_HandleMismatch:
; Card_FlipFrame = 0
LDA #$00
STA Card_FlipFrame
; Temp_Var12 = 1
LDA #$01
STA <Temp_Var12
INC Card_GameState ; Card_GameState = 6
INC Card_GameState ; Card_GameState = 7
; Card_MoveDelay = $40
LDA #$40
STA Card_MoveDelay
LDY Card_Index ; Y = Card_Index
; Clear the card flipped flag on the second card
LDA Card_ActiveSet,Y
AND #$7f
STA Card_ActiveSet,Y
LDY Card_FirstIndex ; Y = Card_FirstIndex
; Clear the card flipped flag on the first card
LDA Card_ActiveSet,Y
AND #$7f
STA Card_ActiveSet,Y
; Mismatch sound
LDA #SND_MAPDENY
STA Sound_QMap
DEC Card_TurnsRemain ; Card_TurnsRemain-- (one less turn)
BPL PRG022_D875 ; If turns remain, jump to PRG022_D875
DEC Card_GameState ; Card_GameState = 6
PRG022_D875:
RTS ; Return
Card_WaitThenExit:
DEC Card_MoveDelay ; Card_MoveDelay--
BPL PRG022_D87D ; If Card_MoveDelay > 0, jump to PRG022_D87D (RTS)
; Exit to map
INC <Level_ExitToMap
PRG022_D87D:
RTS ; Return
Card_BeginFlipBack:
LDA Card_MoveDelay
BEQ PRG022_D887 ; If Card_MoveDelay = 0, jump to PRG022_D887
DEC Card_MoveDelay ; Card_MoveDelay--
RTS ; Return
PRG022_D887:
; Card_FlipFrame = 0
LDA #$00
STA Card_FlipFrame
LDY <Temp_Var12 ; Y = Temp_Var12
LDA Card_Index,Y ; Get first or second card face value
STA <Temp_Var11 ; Face value -> Temp_Var11
JSR Card_Blackout ; Black out this card
INC Card_GameState ; Card_GameState = 8
; Card_AnimTick= 0
LDA #$00
STA Card_AnimTick
Card_FlipBackCard:
LDA Card_AnimTick
BEQ PRG022_D8A7 ; If Card_AnimTick = 0, jump to PRG022_D8A7
DEC Card_AnimTick ; Card_AnimTick--
RTS ; Return
PRG022_D8A7:
LDY <Temp_Var12 ; Y = Temp_Var12 (first or second card index)
LDA Card_Index,Y ; Get first or second card face value
STA <Temp_Var11 ; Face value -> Temp_Var11
JSR CardFlip_Draw ; Draw card flip
INC Card_FlipFrame ; Card_FlipFrame++
LDA Card_FlipFrame
CMP #$05
BLT PRG022_D8D8 ; If Card_FlipFrame < 5, jump to PRG022_D8D8
LDY <Temp_Var12 ; Y = Temp_Var12 (first or second card index)
LDA Card_Index,Y ; Get first or second card face value
STA <Temp_Var11 ; Face value -> Temp_Var11
JSR Card_RenderBack ; Render the card's back side
DEC <Temp_Var12 ; Temp_Var12--
BPL PRG022_D8CF ; If there's another card to do, jump to PRG022_D8CF
; Both cards are flipped back over
; Card_GameState = 0 (Return to card selection)
LDA #$00
STA Card_GameState
RTS ; Return
PRG022_D8CF:
; Card_MoveDelay = 2
LDA #$02
STA Card_MoveDelay
DEC Card_GameState
RTS ; Return
PRG022_D8D8:
; Card_AnimTick = 4
LDA #$04
STA Card_AnimTick
RTS ; Return
Card_Shuffle:
; Temp_Var11 = 2 (3 shuffle operations)
LDA #$02
STA <Temp_Var11
PRG022_D8E2:
JSR Randomize
AND #$1f
TAY ; Y = 0 to 31, random
; Rotate the first 15 cards 0 to 31 (random) times to shuffle
PRG022_D8E8:
; Temp_Var12 = 15th card
LDA Card_ActiveSet+14
STA <Temp_Var12
LDX #$0D ; X = $0D
PRG022_D8EF:
; Copy card into adjacent slot
LDA Card_ActiveSet,X
STA Card_ActiveSet+1,X
DEX ; X--
BPL PRG022_D8EF ; While X >= 0, loop!
; Set the original 15th card as the first card
LDA <Temp_Var12
STA Card_ActiveSet
DEY ; Y--
BPL PRG022_D8E8 ; While Y >= 0, loop!
LDX #$00 ; X = 0 (this routine will only be run once, even though they structured a loop)
PRG022_D902:
; First card -> Temp_Var12
LDA Card_ActiveSet,X
STA <Temp_Var12
; Sixth card -> first
LDA Card_ActiveSet+5,X
STA Card_ActiveSet,X
; Eleventh card -> sixth
LDA Card_ActiveSet+10,X
STA Card_ActiveSet+5,X
; Former first card -> Eleventh
LDA <Temp_Var12
STA Card_ActiveSet+10,X
; X -= 2
DEX
DEX
BPL PRG022_D902 ; While X >= 0, loop!
DEC <Temp_Var11 ; Temp_Var11--
BPL PRG022_D8E2 ; While Temp_Var11 >= 0, loop!
RTS ; Return
Card_RenderFace:
LDY #(CardBase_BufCmds_End - CardBase_BufCmds - 1)
PRG022_D923:
LDA CardBase_BufCmds,Y
STA Graphics_Buffer+$00,Y
DEY ; Y--
BPL PRG022_D923 ; While Y >= 0, loop
LDY <Temp_Var11 ; Y = Temp_Var11 (current card)
; Get VRAM address of this card -> Card_VRAM_H/L
LDA Card_VRAMHi,Y
STA Card_VRAM_H
LDA Card_VRAMLo,Y
STA Card_VRAM_L
LDY #$00 ; Y = 0
LDX #$03 ; X = 0
PRG022_D93E:
; Patch card VRAM Hi into graphics buffer
LDA Card_VRAM_H
STA Graphics_Buffer+$00,Y
INY ; Y++ (next graphics buffer byte)
; Patch card VRAM Lo into graphics buffer
LDA Card_VRAM_L
STA Graphics_Buffer+$00,Y
; Y += 6 (next card row in buffer commands)
TYA
ADD #$06
TAY
; +32 to go to next pattern row
LDA Card_VRAM_L
ADD #32
STA Card_VRAM_L
LDA Card_VRAM_H
ADC #$00
STA Card_VRAM_H
DEX ; X--
BPL PRG022_D93E ; While X >= 0, loop
LDY <Temp_Var11 ; Y = Temp_Var11 (current card)
; Get the card face sans "already flipped" bit -> Temp_Var12
LDA Card_ActiveSet,Y
AND #$7f
STA <Temp_Var12
ASL A
ASL A
TAY ; Y = face * 4
; Add the four patterns making up the card face
LDA Card_FacePatterns,Y
STA Graphics_Buffer+$0B
INY ; Y++ (next graphics buffer byte)
LDA Card_FacePatterns,Y
STA Graphics_Buffer+$0C
INY ; Y++ (next graphics buffer byte)
LDA Card_FacePatterns,Y
STA Graphics_Buffer+$12
INY ; Y++ (next graphics buffer byte)
LDA Card_FacePatterns,Y
STA Graphics_Buffer+$13
LDY <Temp_Var12 ; Y = Temp_Var12 (current card face)
; Temp_Var13 = card face attribute
LDA Card_FaceAttribute,Y
STA <Temp_Var13
LDA <Temp_Var11
CMP #6
BLT PRG022_D99F ; If Temp_Var11 < 6 (card is on first row), jump to PRG022_D99F
CMP #12
BGE PRG022_D99F ; If Temp_Var11 < 12 (card is on second row), jump to PRG022_D99F
JMP PRG022_D9A9 ; Card is on third row; jump to PRG022_D9A9
PRG022_D99F:
LDA <Temp_Var13
ASL A
ASL A
ASL A
ASL A
ORA #$0f
STA <Temp_Var13
PRG022_D9A9:
LDX <Temp_Var11 ; X = Temp_Var11 (current card index)
; Patch attribute VRAM Hi into graphics buffer
LDA #$23
STA Graphics_Buffer+$1C
; Patch card attribute VRAM Lo into graphics buffer
LDA Card_VRAMAttrLo,X
STA Graphics_Buffer+$1D
; Run length of 1
LDA #$01
STA Graphics_Buffer+$1E
; Attribute byte
LDA <Temp_Var13
STA Graphics_Buffer+$1F
; Terminator
LDA #$00
STA Graphics_Buffer+$20
; Graphics_BufCnt = $20
LDA #$20
STA Graphics_BufCnt
LDA <Temp_Var12
CMP #CARD_1UP
BLT PRG022_D9E0 ; If Temp_Var12 < CARD_1UP, jump to PRG022_D9E0
SUB #CARD_1UP
TAY ; Y = relative (0 = 1-up, 1 = 10 coin, 2 = 20 coin)
; Add the bottom text on 1-up, 10 coin, or 20 coin cards
LDA Card_BottomLeft,Y
STA Graphics_Buffer+$19
LDA Card_BottomRight,Y
STA Graphics_Buffer+$1A
PRG022_D9E0:
; Card selector sprites all invisible
LDA #$f8
STA Sprite_RAM+$2C
STA Sprite_RAM+$30
STA Sprite_RAM+$34
STA Sprite_RAM+$38
RTS ; Return
Card_RenderBack:
LDY #(CardBack_BufCmds_End - CardBack_BufCmds - 1)
PRG022_D9F1:
LDA CardBack_BufCmds,Y ; Get graphics buffer command
STA Graphics_Buffer+$00,Y ; Store into graphics buffer
DEY ; Y--
BPL PRG022_D9F1 ; While Y >= 0, loop
LDY <Temp_Var11 ; Y = Temp_Var11 (current card)
; Get VRAM address of this card -> Card_VRAM_H/L
LDA Card_VRAMHi,Y
STA Card_VRAM_H
LDA Card_VRAMLo,Y
STA Card_VRAM_L
LDY #$00 ; Y = 0
LDX #$03 ; X = 3 (4 rows of patterns per card)
PRG022_DA0C:
; Patch card VRAM Hi into graphics buffer
LDA Card_VRAM_H
STA Graphics_Buffer+$00,Y
INY ; Y++ (next graphics buffer byte)
; Patch card VRAM Lo into graphics buffer
LDA Card_VRAM_L
STA Graphics_Buffer+$00,Y
; Y += 6 (next card row in buffer commands)
TYA
ADD #$06
TAY
; Card_VRAM_L/H += 32 (next row of patterns)
LDA Card_VRAM_L
ADD #32
STA Card_VRAM_L
LDA Card_VRAM_H
ADC #$00
STA Card_VRAM_H
DEX ; X--
BPL PRG022_DA0C ; While X >= 0, loop
LDX <Temp_Var11 ; X = Temp_Var11 (current card)
LDA #$23
STA Graphics_Buffer+$1C
LDA Card_VRAMAttrLo,X
STA Graphics_Buffer+$1D
; Run length 1
LDA #$01
STA Graphics_Buffer+$1E
; Set palette 3
LDA #$FF
STA Graphics_Buffer+$1F
; Terminator
LDA #$00
STA Graphics_Buffer+$20
; Graphics_BufCnt = $20
LDA #$20
STA Graphics_BufCnt
; Card selector sprites all invisible
LDA #$f8
STA Sprite_RAM+$2C
STA Sprite_RAM+$30
STA Sprite_RAM+$34
STA Sprite_RAM+$38
RTS ; Return
; FIXME: Anyone want to claim this??
; This seems like it'd have displayed matched pairs perhaps or even just debug data
; $DA62
LDY #$00 ; Y = 0
; Temp_Var11 = 11
LDA #$01
STA <Temp_Var11
LDX Card_Index ; X = Card_Index
; Card face -> Temp_Var12
LDA Card_ActiveSet,X
STA <Temp_Var12
ASL A
ASL A
TAX ; X = card face * 4
PRG022_DA73:
; Some VRAM Low
LDA Card_UnusedVL
STA Graphics_Buffer+$00,Y
INY ; Y++ (next graphics buffer byte)
; Some VRAM High
LDA Card_UnusedVH
STA Graphics_Buffer+$00,Y
INY ; Y++ (next graphics buffer byte)
; Run length of 2
LDA #$02
STA Graphics_Buffer+$00,Y
INY ; Y++ (next graphics buffer byte)
LDA Card_FacePatterns,X
STA Graphics_Buffer+$00,Y
INY ; Y++ (next graphics buffer byte)
INX ; X++
LDA Card_FacePatterns,X
STA Graphics_Buffer+$00,Y
INY ; Y++
INX ; X++
; +32 for next row
LDA Card_UnusedVH
ADD #32
STA Card_UnusedVH
LDA Card_UnusedVL
ADC #$00
STA Card_UnusedVL
DEC <Temp_Var11 ; Temp_Var11--
BPL PRG022_DA73 ; While Temp_Var1 >= 0, loop
LDX <Temp_Var12 ; X = Temp_Var12
; High VRAM in attribute table?
LDA #$23
STA Graphics_Buffer+$00,Y
INY ; Y++ (next graphics buffer byte)
LDA Card_UnusedAttr
STA Graphics_Buffer+$00,Y
INY ; Y++ (next graphics buffer byte)
LDA #$01
STA Graphics_Buffer+$00,Y
INY ; Y++ (next graphics buffer byte)
LDA Card_Matches
AND #$01
BEQ PRG022_DAD6
INC Card_UnusedArrIdx
LDA PRG022_D777,X
LSR A
LSR A
LSR A
LSR A
ORA #$f0
BNE PRG022_DAE2
PRG022_DAD6:
LDA Card_UnusedAttr
ADD #$08
STA Card_UnusedAttr
LDA PRG022_D777,X
PRG022_DAE2:
LDX Card_UnusedArrIdx
AND Card_UnusedArray,X
STA Card_UnusedArray,X
STA Graphics_Buffer+$00,Y
INY
LDA #$00
STA Graphics_Buffer+$00,Y
RTS
Card_Blackout:
LDY #(CardBlackout_BufCmds_End - CardBlackout_BufCmds - 1)
PRG022_DAF7:
LDA CardBlackout_BufCmds,Y ; Get buffer command
STA Graphics_Buffer+$00,Y ; Set in graphics buffer
DEY ; Y--
BPL PRG022_DAF7 ; While Y >= 0, loop
LDY <Temp_Var11 ; Y = Temp_Var11
; Get VRAM address of this card -> Card_VRAM_H/L
LDA Card_VRAMHi,Y
STA Card_VRAM_H
LDA Card_VRAMLo,Y
STA Card_VRAM_L
LDA #(CardBlackout_BufCmds_End - CardBlackout_BufCmds - 1)
STA Graphics_BufCnt
LDY #$00 ; Y = 0
LDX #$03 ; X = 3
PRG022_DB17:
; Patch card VRAM Hi into graphics buffer
LDA Card_VRAM_H
STA Graphics_Buffer+$00,Y
INY ; Y++ (next graphics buffer byte)
; Patch card VRAM Lo into graphics buffer
LDA Card_VRAM_L
STA Graphics_Buffer+$00,Y
; Y += 6 (next card row in buffer commands)
TYA
ADD #$06
TAY
; +32 to go to next pattern row
LDA Card_VRAM_L
ADD #32
STA Card_VRAM_L
LDA Card_VRAM_H
ADC #$00
STA Card_VRAM_H
DEX ; X--
BPL PRG022_DB17 ; While X >= 0, loop
RTS ; Return
Card_CheckForMatch:
LDA Card_FlipCount
AND #$01
BNE PRG022_DB7E ; If this was the first card, jump to PRG022_DB7E
; Second card flipped
LDY Card_Index ; Y = Card_Index
LDA Card_ActiveSet,Y
CMP Card_MatchCard
BEQ PRG022_DB98 ; If you picked the same card, jump to PRG022_DB98
; Mismatched cards
; UNUSED Wild card!
LDA Card_ActiveSet,Y
CMP #CARD_WILD
BNE PRG022_DB5D ; If this is not CARD_WILD, jump to PRG022_DB5D
; Wild card!
LDA Card_MatchCard ; Just pass the match on
JMP PRG022_DB6C ; Jump to PRG022_DB6C
PRG022_DB5D:
; UNUSED Wild card!
LDA Card_MatchCard
CMP #CARD_WILD
BNE PRG022_DB72 ; If this is not CARD_WILD, jump to PRG022_DB72
; Wild card!
LDA Card_ActiveSet,Y ; Get card face
ORA #$80 ; Mark card as flipped
LDY Card_FirstIndex ; Y = Card_FirstIndex (the first card that was flipped over)
PRG022_DB6C:
STA Card_ActiveSet,Y ; Mark first card as flipped
JMP PRG022_DB98 ; Jump to PRG022_DB98
PRG022_DB72:
; Cards mismatched
INC Card_GameState ; Card_GameState = 4
INC Card_GameState ; Card_GameState = 5
; Card_MoveDelay = $30
LDA #$30
STA Card_MoveDelay
RTS ; Return
PRG022_DB7E:
; First card flipped
; Card_FirstIndex = Card_Index (hold the index of the first card you flipped)
LDY Card_Index
STY Card_FirstIndex
; Record the first card face
LDA Card_ActiveSet,Y
STA Card_MatchCard
; Mark card as flipped
LDA Card_ActiveSet,Y
ORA #$80
STA Card_ActiveSet,Y
; Card_GameState = 0; Return to selection mode
LDA #$00
STA Card_GameState
RTS ; Return
PRG022_DB98:
; Cards matched
INC Card_GameState ; Card_GameState = 4
RTS ; Return
Card_DoSelection:
LDA Card_MoveDelay
BEQ PRG022_DBA5 ; If Card_MoveDelay = 0, jump to PRG022_DBA5
DEC Card_MoveDelay ; Card_MoveDelay--
RTS ; Return
PRG022_DBA5:
LDA <Pad_Holding
AND #PAD_A
BEQ PRG022_DBAF ; If Player is not pressing A, jump to PRG022_DBAF
INC Card_GameState ; Card_GameState = 1
RTS ; Return
PRG022_DBAF:
LDA <Pad_Holding
AND #(PAD_LEFT | PAD_RIGHT | PAD_UP | PAD_DOWN)
BEQ PRG022_DC1D ; If Player is not pressing a direction, jump to PRG022_DC1D (RTS)
; Card_MoveDelay = 8
LDA #$08
STA Card_MoveDelay
; Play blip sound
LDA #SND_LEVELBLIP
STA Sound_QLevel1
LDA <Pad_Holding
AND #PAD_UP
BEQ PRG022_DBD9 ; If Player is not pressing UP, jump to PRG022_DBD9
; Card_Index -= 6 (one row up)
LDA Card_Index
SUB #$06
STA Card_Index
BCS PRG022_DBD9 ; If not below zero, jump to PRG022_DBD9
; Card_Index += 18 (return to bottom row)
LDA Card_Index
ADD #18
STA Card_Index
PRG022_DBD9:
LDA <Pad_Holding
AND #PAD_DOWN
BEQ PRG022_DBF8 ; If Player is not pressing DOWN, jump to PRG022_DBF8
; Card_Index += 6 (one row down)
LDA Card_Index
ADD #$06
STA Card_Index
LDA Card_Index
CMP #18
BLT PRG022_DBF8 ; If not below the bottom row, jump to PRG022_DBF8
; Card_Index -= 18 (return to top row)
LDA Card_Index
SUB #18
STA Card_Index
PRG022_DBF8:
LDA <Pad_Holding
AND #PAD_RIGHT
BEQ PRG022_DC0D ; If Player is not pressing RIGHT, jump to PRG022_DC0D
INC Card_Index ; Card_Index++
LDA Card_Index
CMP #18
BLT PRG022_DC0D ; If not passed the last card, jump to PRG022_DC0D
; Return to first card
LDA #$00
STA Card_Index
PRG022_DC0D:
LDA <Pad_Holding
AND #PAD_LEFT
BEQ PRG022_DC1D ; If Player is not pressing LEFT, jump to PRG022_DC1D (RTS)
DEC Card_Index ; Card_Index--
BPL PRG022_DC1D ; If did not go before first card, jump to PRG022_DC1D (RTS)
; Card_Index = 17
LDA #17
STA Card_Index
PRG022_DC1D:
RTS ; Return
Card_DrawSelectSprite:
; Set sprite Y
LDA Card_SelectY
STA Sprite_RAM+$04,Y
INY ; Y++ (next Sprite RAM offset)
; Set sprite pattern
LDA Card_SelectPattern,X
STA Sprite_RAM+$04,Y
INY ; Y++ (next Sprite RAM offset)
; Set sprite attribute
LDA Card_SelectAttribute,X
STA Sprite_RAM+$04,Y
INY ; Y++ (next Sprite RAM offset)
; Set sprite Y
LDA Card_SelectX
STA Sprite_RAM+$04,Y
INY ; Y++ (next Sprite RAM offset)
INX ; X++
RTS ; Return
Card_DrawCursor:
LDX Card_Index ; X = Card_Index
; Set Card_SelectX
LDA Card_CursorXs,X
STA Card_SelectX
STA Card_SelectXOrig ; And keep original X
; Set Card_SelectY
LDA Card_CursorYs,X
STA Card_SelectY
LDX #$00 ; X = 0
LDY #$00 ; Y = 0
PRG022_DC52:
JSR Card_DrawSelectSprite ; Draw just a sprite
; Card_SelectX += 8
LDA Card_SelectX
ADD #$08
STA Card_SelectX
CPX #$04
BLT PRG022_DC52 ; While X < 4, loop
; Card_SelectY += 16
LDA Card_SelectY
ADD #16
STA Card_SelectY
; Card_SelectX = Card_SelectXOrig
LDA Card_SelectXOrig
STA Card_SelectX
; Left edge sprite
JSR Card_DrawSelectSprite
LDA Card_SelectX
ADD #24
STA Card_SelectX
; Right edge sprite
JSR Card_DrawSelectSprite
; Card_SelectY += 16
LDA Card_SelectY
ADD #16
STA Card_SelectY
; Card_SelectX = Card_SelectXOrig
LDA Card_SelectXOrig
STA Card_SelectX
PRG022_DC8F:
JSR Card_DrawSelectSprite ; Draw just a sprite
; Card_SelectX += 8
LDA Card_SelectX
ADD #$08
STA Card_SelectX
CPX #$0a
BLT PRG022_DC8F ; If X < $0A, loop
; Hold current Sprite RAM offset
STY Card_SprRAMOff
RTS ; Return
CardFlip_Draw:
LDX <Temp_Var11 ; X = Temp_Var11 (Card Index)
; Card starts at selection cursor +8
LDA Card_CursorXs,X
ADD #$08
STA Card_SelectX
STA Card_SelectXOrig
; Card is at cursor Y
LDA Card_CursorYs,X
ADD #$08
STA Card_SelectY
LDX #$00 ; X = 0
LDY Card_SprRAMOff ; Y = Card_SprRAMOff
PRG022_DCBF:
; Set sprite Y for card flip
LDA Card_SelectY
STA Sprite_RAM+$04,Y
INY ; Y++ (next sprite byte)
JSR CardFlipSprite_GetPattern ; Get pattern for sprite
STA Sprite_RAM+$04,Y ; Set pattern
INY ; Y++ (next sprite byte)
; Temp_Var11 = 0
LDA #$00
STX <Temp_Var11
LDX Card_FlipFrame ; X = Card_FlipFrame
; Sprite attribute
LDA CardFlip_Attributes,X
STA Sprite_RAM+$04,Y
LDX <Temp_Var11 ; X = Temp_Var11 (current card flip sprite)
INY ; Y++ (next sprite byte)
; Set flip sprite X
LDA Card_SelectX
STA Sprite_RAM+$04,Y
INY ; Y++ (next sprite byte)
INX ; X++
CPX #$04
BGE PRG022_DD09 ; If X >= 4, jump to PRG022_DD09
; Card_SelectX += 8
LDA Card_SelectX
ADD #$08
STA Card_SelectX
TXA
AND #$01
BNE PRG022_DD06 ; Every other flip sprite, jump to PRG022_DD06
; Card_SelectY += 16
LDA Card_SelectY
ADD #16
STA Card_SelectY
; Card_SelectX = Card_SelectXOrig
LDA Card_SelectXOrig
STA Card_SelectX
PRG022_DD06:
JMP PRG022_DCBF ; Jump to PRG022_DCBF
PRG022_DD09:
; Some card flip sprites use HFLIP
LDA Sprite_RAM+$32
ORA #SPR_HFLIP
STA Sprite_RAM+$32
LDA Sprite_RAM+$3A
ORA #SPR_HFLIP
STA Sprite_RAM+$3A
RTS ; Return
CardFlipSprite_GetPattern:
STX <Temp_Var11 ; Backup 'X' -> Temp_Var11 (current card flip sprite)
LDX Card_FlipFrame ; X = Card_FlipFrame
LDA CardFlip_FrameDefOff,X ; Get initial frame def offset
ADD <Temp_Var11 ; Offset by current flip sprite
TAX ; -> 'X'
LDA CardFlip_FrameDefs,X ; Get this sprite pattern
LDX <Temp_Var11 ; Restore 'X'
RTS ; Return
Card_MFSToInventory: .byte $01, $02, $09 ; Mushroom, Flower, Star card inventory item translation
Card_MatchPairReward:
LDY Card_Index ; Y = Card_Index
LDA Card_ActiveSet,Y ; Get the second card
AND #$0f ; Mainly to mask the bit 7 "flipped" marker
STA <Temp_Var13 ; -> Temp_Var13
CMP #CARD_1UP
BNE PRG022_DD4A ; If the match was not a 1-up card, jump to PRG022_DD4A
LDX Player_Current ; X = Player_Current
INC Player_Lives,X ; Give Player extra life
; Play 1-up sound
LDA #SND_LEVEL1UP
STA Sound_QLevel1
BNE PRG022_DD77 ; Jump (technically always) to PRG022_DD77 (RTS)
PRG022_DD4A:
CMP #CARD_10COIN
BLT PRG022_DD65 ; If this is not one of the coin cards, jump to PRG022_DD65
; A coin card
LDY #10 ; Y = 10 (10 coins)
CMP #CARD_10COIN
BEQ PRG022_DD56 ; If this is the 10 coin card, jump to PRG022_DD56
LDY #20 ; Y = 20 (20 coins)
PRG022_DD56:
TYA
ADD Card_CoinsToGive
STA Card_CoinsToGive ; Set coins to give
; Play coin sound
LDA #SND_LEVELCOIN
STA Sound_QLevel1
BNE PRG022_DD77 ; Jump (technically always) to PRG022_DD77 (RTS)
PRG022_DD65:
LDA <Temp_Var13
CMP #CARD_1UP
BGE PRG022_DD77 ; If this is the 1-up, 10, or 20 coin card, jump to PRG022_DD77 (RTS)
TAX ; Mushroom, Flower, Star index -> 'X'
LDA Card_MFSToInventory,X ; Get the appropriate inventory item for this card pair
JSR Player_GetItem ; Give it to Player
; Play card match sound
LDA #SND_MAPBONUSAPPEAR
STA Sound_QMap
PRG022_DD77:
RTS ; Return
; Base card before the face is added
CardBase_BufCmds:
vaddr $0000 ; Will be patched
.byte $04, $64, $FE, $FE, $65
vaddr $0000 ; Will be patched
.byte $04, $64, $00, $00, $65
vaddr $0000 ; Will be patched
.byte $04, $64, $00, $00, $65
vaddr $0000 ; Will be patched
.byte $04, $64, $FE, $FE, $65
CardBase_BufCmds_End
; Blacks out a card
CardBlackout_BufCmds
vaddr $0000 ; Will be patched
.byte $04, $FF, $FF, $FF, $FF
vaddr $0000 ; Will be patched
.byte $04, $FF, $FF, $FF, $FF
vaddr $0000 ; Will be patched
.byte $04, $FF, $FF, $FF, $FF
vaddr $0000 ; Will be patched
.byte $04, $FF, $FF, $FF, $FF
; Terminator
.byte $00
CardBlackout_BufCmds_End
; NSpade Card unflipped backside
CardBack_BufCmds:
vaddr $0000 ; Will be patched
.byte $04, $66, $FD, $FD, $67
vaddr $0000 ; Will be patched
.byte $04, $66, $2E, $2F, $67
vaddr $0000 ; Will be patched
.byte $04, $66, $3E, $3F, $67
vaddr $0000 ; Will be patched
.byte $04, $66, $FD, $FD, $67
CardBack_BufCmds_End
; NSpade Game's Candystripe background
Video_NSpadeBG:
vaddr $2000
.byte VU_REPEAT | $22, $98
vaddr $2020
.byte VU_REPEAT | $22, $98
vaddr $2040
.byte VU_REPEAT | VU_VERT | $14, $98
vaddr $2041
.byte VU_REPEAT | VU_VERT | $14, $98
vaddr $205E
.byte VU_REPEAT | VU_VERT | $14, $98
vaddr $205F
.byte VU_REPEAT | VU_VERT | $14, $98
vaddr $23C0
.byte $10, $3F, $0F, $0F, $0F, $0F, $0F, $0F, $CF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
vaddr $23D0
.byte $10, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
vaddr $23E0
.byte $10, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F
; Terminator
.byte $00
; Rest of ROM bank was empty
|
programs/oeis/295/A295838.asm | neoneye/loda | 22 | 28894 | ; A295838: Largest value corresponding to a string of n printable ASCII characters.
; 0,126,32382,8289918,2122219134,543288098430,139081753198206,35604928818740862,9114861777597660798,2333404615065001164414,597351581456640298090110,152922004852899916311068286,39148033242342378575633481342,10021896510039648915362171223678,2565605506570150122332715833261694,656795009681958431317175253314993790
mov $1,256
pow $1,$0
mul $1,2
div $1,510
mul $1,126
mov $0,$1
|
PRG/objects/5-1.asm | narfman0/smb3_pp1 | 0 | 160123 | <filename>PRG/objects/5-1.asm
.byte $01 ; Unknown purpose
.byte OBJ_BUSTERBEATLE, $0B, $18
.byte OBJ_CHAINCHOMP, $14, $19
.byte OBJ_CHAINCHOMP, $1A, $15
.byte OBJ_CHAINCHOMP, $27, $14
.byte OBJ_NIPPER, $30, $0C
.byte OBJ_NIPPER, $34, $0A
.byte OBJ_NIPPER, $3A, $07
.byte OBJ_BUSTERBEATLE, $3C, $06
.byte OBJ_CHAINCHOMP, $44, $08
.byte OBJ_CHAINCHOMP, $54, $09
.byte OBJ_NIPPERHOPPING, $63, $19
.byte OBJ_NIPPERHOPPING, $68, $19
.byte OBJ_PARAGOOMBAWITHMICROS, $6B, $0D
.byte OBJ_NIPPERHOPPING, $6D, $19
.byte OBJ_ENDLEVELCARD, $88, $15
.byte OBJ_NIPPER, $88, $19
.byte $FF ; Terminator
|
src/main/antlr/com/yolol/parser/Yolol.g4 | ALoTron/yolol-minifier | 3 | 5594 | grammar Yolol;
@header
{
package com.yolol.parser;
}
BREAK : '\n';
COMMENT : '//' ~('\n')*;
STRING : '"'(~'\n')*'"';
IF : I F;
THEN : T H E N;
ELSE : E L S E;
END : E N D;
GOTO : G O T O;
NOT : N O T;
AND : A N D;
OR : O R;
ABS : A B S;
SQRT : S Q R T;
SIN : S I N;
COS : C O S;
TAN : T A N;
ARCSIN : A R C S I N;
ARCCOS : A R C C O S;
ARCTAN : A R C T A N;
LBRACKET : '(';
RBRACKET : ')';
LESS : '<';
GREATER : '>';
LESSEQUAL : '<=';
GREATEREQUAL: '>=';
NOTEQUAL : '!=';
EQUAL : '==';
ASSIGN : '=';
POW : '^';
PLUS : '+';
MINUS : '-';
MULTIPLY : '*';
DIVIDE : '/';
MODULO : '%';
FACTORIAL : '!';
DOT : '.';
COLON : ':';
SPACE : (' ')+;
fragment ALPHABETICAL : [a-zA-Z]+;
fragment NUMERICAL : [0-9]+;
INTERNALVARIABLE : ALPHABETICAL (ALPHABETICAL|NUMERICAL)*;
EXTERNALVARIABLE : COLON (ALPHABETICAL|NUMERICAL)+;
NUMBER : NUMERICAL+ (DOT NUMERICAL+)?;
fragment A : [aA];
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];
chip
: (line BREAK)* line EOF?
;
line
: optionalSpace? multipleStatements? optionalSpace? COMMENT?
;
multipleStatements
: lbracket multipleStatements rbracket
| (statement | lbracket statement rbracket) (SPACE statement | lbracket statement rbracket)*
;
statement
: ifStatement
| varAssignment
| expression
| gotoStat
;
ifStatement
: IF (SPACE expression SPACE| lbracket expression rbracket)
THEN (SPACE multipleStatements SPACE | lbracket multipleStatements rbracket)
(ELSE (SPACE multipleStatements SPACE | lbracket multipleStatements rbracket))? END
;
expression
: lbracket expression rbracket
| value
| mathExpr
;
value
: primitive
| var
| increment
| decrement
;
primitive
: number
| string
;
string
: STRING
;
internalVariable
: INTERNALVARIABLE
;
externalVariable
: EXTERNALVARIABLE
;
number
: MINUS? NUMBER
;
increment
: PLUS PLUS optionalSpace? var
| var optionalSpace? PLUS PLUS
;
decrement
: MINUS MINUS optionalSpace? var
| var optionalSpace? MINUS MINUS
;
mathExpr
: lbracket mathExpr rbracket
| logicalExpression
;
logicalExpression
: lbracket logicalExpression rbracket
| arithmeticalExpression (optionalSpace? logicalOp optionalSpace? arithmeticalExpression)*
;
arithmeticalExpression
: lbracket arithmeticalExpression rbracket
| primaryExpression ( optionalSpace? arithmeticalOp optionalSpace? primaryExpression)*
;
primaryExpression
: lbracket primaryExpression rbracket
| value
| prefixOp (SPACE primaryExpression | lbracket mathExpr rbracket )
| primaryExpression factorial
| lbracket mathExpr rbracket factorial?
;
factorial
: optionalSpace? FACTORIAL
;
prefixOp
: NOT
| ABS
| SQRT
| SIN
| COS
| TAN
| ARCSIN
| ARCCOS
| ARCTAN
;
arithmeticalOp
: POW
| PLUS
| MINUS
| MULTIPLY
| DIVIDE
| MODULO
;
logicalOp
: LESS
| LESSEQUAL
| GREATER
| GREATEREQUAL
| NOTEQUAL
| EQUAL
| SPACE AND SPACE
| SPACE OR SPACE
;
varAssignment
: var optionalSpace? arithmeticalOp? ASSIGN optionalSpace? expression
;
var
: internalVariable
| externalVariable
;
gotoStat
: GOTO (SPACE expression | lbracket expression rbracket)
;
optionalSpace
: SPACE
;
lbracket
: optionalSpace? LBRACKET optionalSpace?
;
rbracket
: optionalSpace? RBRACKET optionalSpace?
; |
StarRealms.g4 | dhaven/sr_log_parser | 1 | 7310 | <reponame>dhaven/sr_log_parser<filename>StarRealms.g4<gh_stars>1-10
grammar StarRealms;
battle : turn+;
turn : action+ (endPhase | winStatus | EOF) ;
action : baseInstantEffect | purchase | purchaseHero | play | attackPlayer | attackBase | scrapCard | discard | choseEffect | activatingEffect;
winStatus : name HAS WON THE GAME NEWLINE? ;
//describes a base instant effect action
baseInstantEffect : positiveBalance | drawCardsWithShuffle;
//describe a purchase Hero action
purchaseHero : purchaseSummary purchaseHeroDetail playHero*;
//purchaseHeroSummary : ACQUIRED heroes NEWLINE;
purchaseHeroDetail : negativeBalance acquireHeroToTable refreshIndicators;
acquireHeroToTable : CHANGED card TO ON SEPARATOR TABLE IMAGE NEWLINE;
playHero : tradeRowScrap | resolveFreeAcquire | resolveSelfScrap | multiScrapSummary | positiveBalance | drawCardsWithShuffle | multiScrapDetail | simpleScrap;
tradeRowScrap : RESOLVING SCRAP ((UP TO INT CARDS)|(WORD CARD)) IN THE TRADE ROW NEWLINE;
resolveFreeAcquire : RESOLVING ACQUIRE ANY SHIP OR BASE OF COST INT OR LESS TO DECK NEWLINE;
resolveSelfScrap : RESOLVING SCRAP WORD CARD FROM YOUR HAND OR DISCARD PILE NEWLINE ;
//describes a purchase action
purchase : purchaseSummary purchaseDetail*;
purchaseSummary : ACQUIRED card NEWLINE;
purchaseDetail : negativeBalance (acquireToHand | acquireToDeck)?;
acquireToHand : ACQUIRED card TO HAND NEWLINE;
acquireToDeck : ACQUIRED card TO THE TOP OF THE DECK NEWLINE;
//describes a play action
play : playSummary playDetail* completeMission?;
playSummary : (PLAY ALL NEWLINE) | playSingle;
playSingle : PLAYED card NEWLINE;
playDetail : positiveBalance | newAbility | drawCardsWithShuffle | scrapCardEffect | discardForPool | discarding | multiScrap | noScrap | simpleScrap | destroyBase | moveBaseToDeck | freeAcquire | copyCardSummary | copyCardEffect;
newAbility : name SEPARATOR card ABILITY AVAILABLE NEWLINE;
multiScrap : multiScrapSummary multiScrapDetail;
multiScrapSummary : RESOLVING SCRAP UP TO INT CARDS FROM YOUR HAND OR DISCARD PILE NEWLINE;
multiScrapDetail : scrapCardEffect+ simpleScrap+;
scrapCardEffect : name IS SCRAPPING (':')? card NEWLINE;
simpleScrap : SCRAPPED card NEWLINE;
moveBaseToDeck : name IS SELECTING card NEWLINE;
freeAcquire : ACQUIRED card NEWLINE (acquireToHand|acquireToDeck);
//describe rewards of missions
completeMission : completeMissionSummary completeMissionsDetail*;
completeMissionSummary : REVEALED card NEWLINE;
completeMissionsDetail : positiveBalance | drawCardsWithShuffle | acquireToHand | selectMissionsReward | winStatus | freeAcquire | resolveAllyReward | resolveRuleReward | resolveDefendReward | resolveConvertReward;
selectMissionsReward : RESOLVING ADD INT TRADE OR ADD INT COMBAT OR ADD INT AUTHORITY NEWLINE;
resolveAllyReward : RESOLVING ACQUIRE ANY SHIP OR BASE OF COST INT OR LESS TO DECK NEWLINE;
resolveRuleReward : RESOLVING ACQUIRE ANY CARD OF COST INT OR LESS TO HAND NEWLINE ;
resolveDefendReward : RESOLVING RETURN TARGET BASE NEWLINE;
resolveConvertReward : RESOLVING RETURN INT CARD TO THE TOP OF YOUR DECK NEWLINE name IS RETURNING card NEWLINE discard ;
//describes a attackPlayer action
attackPlayer : attackPlayerSummary negativeBalance+;
attackPlayerSummary : ATTACKED name FOR INT newAuthority NEWLINE;
newAuthority : '(' NEW wordPlus':'(INT | DECREASE)')' ;
//describes a attackBase action
attackBase : attackBaseSummary attackBaseDetail* ;
attackBaseSummary : ATTACKED card NEWLINE;
attackBaseDetail : negativeBalance | destroyBase | scrapAction;
//describes a scrap action
scrapCard : scrappingSummary scrappingDetail;
scrappingSummary : SCRAPPING card NEWLINE;
scrappingDetail : scrapEffect+;
scrapEffect : scrapAction | drawCardsWithShuffle | (freePurchase scrapAction) | destroyBase | newBalanceDetail | replaceGambit | scrapSummary | moveDiscardToDeck | refreshIndicators;
scrapAction : SCRAPPED card NEWLINE;
freePurchase : (ACQUIRED card TO HAND NEWLINE) | ( ACQUIRED card TO THE TOP OF THE DECK NEWLINE) | (ACQUIRED card NEWLINE) ;
moveDiscardToDeck : name IS SELECTING card NEWLINE;
//describes a discard card action
discard : discardSummary discardDetail* ;
discardSummary : RESOLVING DISCARD INT CARDS NEWLINE ;
discardDetail : discardAction | discardEnd | discarding ;
discardAction : name IS DISCARDING card NEWLINE ;
discardEnd : NO MORE2 CARDS TO DISCARD NEWLINE ;
//describe a log line that starts with 'Chose ...'
//applies to ships and bases where the user can chose between one or more effects
choseEffect : choseEffectSummary choseEffectDetail*;
choseEffectSummary : discardAndDrawSummary | choseIncreasePool | choseScrapFromDiscard | choseDiscardAndIncreasePool | discountFactionGambit | hiddenBaseGambit | choseBlobDraw;
discountFactionGambit : CHOSE ACQUIRE wordPlus+ CARDS AT ONE LESS TRADE NEWLINE;
discardAndDrawSummary : CHOSE DISCARD AND REDRAW UP TO INT CARD'(s)' NEWLINE ;
choseIncreasePool : CHOSE ADD INT wordPlus NEWLINE;
choseScrapFromDiscard : CHOSE SCRAP WORD CARD FROM YOUR DISCARD PILE NEWLINE;
choseDiscardAndIncreasePool : CHOSE DISCARD UP TO INT CARDS RECEIVE INT wordPlus FOR EACH NEWLINE;
choseBlobDraw : CHOSE DRAW WORD CARD FOR EVERY BLOB CARD PLAYED THIS TURN NEWLINE;
hiddenBaseGambit : CHOSE CREATE wordPlus+ SECRET OUTPOST NEWLINE;
choseEffectDetail : selectDiscard | discardForPool | discarding | drawCardsWithShuffle | noScrap | simpleScrap | positiveBalance | refreshTradeRow | changeHiddenBaseToFaction | replaceGambit;
refreshTradeRow : REFRESH TRADE ROW DISCOUNTS NEWLINE;
changeHiddenBaseToFaction : CHANGED SECRET OUTPOST TO wordPlus+ NEWLINE;
//describes a log line that start with 'Activating ...'
//applies to bases and ships where the user can chose when the effect is activated
activatingEffect : activatingSummary activatingDetail?;
activatingSummary : ACTIVATING card NEWLINE;
activatingDetail : drawAndScrapFromHand | scrapAndDraw | scrap | noScrap | freeAcquireToTop | destroyAndScrap | noCopy | noCopyBases | copyCard | copyBase | discardAndDraw;
scrapAndDraw : scrap drawCardsWithShuffle;
scrap : scrapSummary+ scrapDetail+;
drawAndScrapFromHand : drawCardsWithShuffle resolveHandScrap;
resolveHandScrap : resolveHandScrapSummary scrapDetail;
freeAcquireToTop : ACQUIRED card NEWLINE purchaseToTop;
copyBase : copyBaseSummary copyBaseDetail;
copyBaseSummary : name COPIED BASE name NEWLINE ;
copyBaseDetail : copyCardEffect newBalanceDetail*;
noCopy : name IS NOT COPYING ANY SHIPS NEWLINE;
noCopyBases : name DID NOT COPY ANY BASES NEWLINE;
copyCard : copyCardSummary copyCardEffect;
copyCardSummary : name SELECTING SHIP card NEWLINE;
copyCardEffect : CHANGED card TO card NEWLINE;
destroyAndScrap : destroyBase | scrapDetail | destroyBase scrapDetail;
purchaseToTop : ACQUIRED card TO THE TOP OF THE DECK NEWLINE;
scrapSummary : name IS SCRAPPING (':')? card NEWLINE;
scrapDetail : SCRAPPED card NEWLINE;
resolveHandScrapSummary : RESOLVING SCRAP WORD CARD FROM YOUR HAND NEWLINE;
discardAndDraw : selectDiscard+ discarding+ drawCardsWithShuffle;
//stuff that happens at the end of the turn
endPhase : endTurn drawPhaseDetail* ;
endTurn : name ENDS TURN INT NEWLINE;
drawPhaseDetail : resetCopiedCards | drawCardsWithShuffle | refreshIndicators | newTurn;
resetCopiedCards : CHANGED card TO UNALIGNED NEWLINE;
refreshIndicators : REFRESH ALLY INDICATORS NEWLINE;
newTurn : IT IS NOW name '\'s' TURN INT NEWLINE;
//shared patterns
replaceGambit : REPLACED card NEWLINE;
noScrap : name IS NOT SCRAPPING ANY CARDS NEWLINE;
selectDiscard : name IS SELECTING card NEWLINE ;
discardForPool : name IS DISCARDING FOR wordPlus NEWLINE ;
discarding : DISCARDED card NEWLINE;
drawCardsWithShuffle : (drawCards+ shuffleCards drawCards+) | (shuffleCards? drawCards+);
drawCards : DREW INT CARDS NEWLINE;
newBalanceDetail : name SEPARATOR card? effect balance NEWLINE;
effect : (INCREMENT | DECREASE | INT) (wordPlus) ;
positiveBalance : name SEPARATOR card? (INCREMENT | INT) (wordPlus) balance NEWLINE;
negativeBalance : name SEPARATOR card? (DECREASE) (wordPlus) balance NEWLINE;
balance : '('wordPlus':'(INT | DECREASE)')' ;
destroyBase : DESTROYED card NEWLINE;
shuffleCards : SHUFFLED DISCARD PILE TO FORM NEW DECK NEWLINE;
name : (wordPlus)+ ;
card : ((wordPlus '\'s'?) | INT)+ ;
// heroes : ceoshaner | chairmanhaygan | chancellorhartman | commanderklik | commodorezhang | confessormorris | hivelord | screecher;
// ceoshaner : <NAME>;
// chairmanhaygan : <NAME>;
// chancellorhartman : <NAME>;
// commanderklik : <NAME>;
// commodorezhang : <NAME>;
// confessormorris : <NAME>;
// hivelord : HIVE LORD;
// screecher : SCREECHER;
wordPlus : WORD|COMBAT|AUTHORITY|TRADE|ACQUIRE|ACQUIRED|DISCOUNTS|CREATE|SECRET|OUTPOST|UNALIGNED|ACTIVATING|ATTACKED|SCRAPPING|SCRAPPED|RETURNING|SCRAP|SELECTING|SHUFFLED|DISCARDED|DISCARD|REFRESH|REVEALED|DISCARDING|DESTROYED|RESOLVING|INDICATORS|AVAILABLE|ABILITY|CHANGED|IMAGE|PLAYED|COPYING|COPIED|REPLACED|RECEIVE|REDRAW|COPY|RETURN|TARGET|DRAW|EVERY|BLOB|CARDS|CHOSE|TURN|SHIP|SHIPS|BASE|TABLE|BASES|PILE|EACH|PLAY|COST|FORM|DECK|DREW|ENDS|CARD|MORE2|FROM|YOUR|ALLY|THIS|HAND|GAME|LESS|ONE|NEW|ALL|NOW|ROW|THE|TOP|FOR|DID|AND|ADD|NOT|HAS|WON|ANY|IS|IT|IN|TO|OF|UP|OR|NO|ON;
fragment A : ('A'|'a');
fragment B : ('B'|'b');
fragment C : ('C'|'c');
fragment D : ('D'|'d');
fragment E : ('E'|'e');
fragment F : ('F'|'f');
fragment G : ('G'|'g');
fragment H : ('H'|'h');
fragment I : ('I'|'i');
fragment J : ('J'|'j');
fragment K : ('K'|'k');
fragment L : ('L'|'l');
fragment M : ('M'|'m');
fragment N : ('N'|'n');
fragment O : ('O'|'o');
fragment P : ('P'|'p');
fragment Q : ('Q'|'q');
fragment R : ('R'|'r');
fragment S : ('S'|'s');
fragment T : ('T'|'t');
fragment U : ('U'|'u');
fragment V : ('V'|'v');
fragment W : ('W'|'w');
fragment Y : ('Y'|'y');
fragment Z : ('Z'|'z');
//CEO : C E O;
// SHANER : S H A N E R;
// CHAIRMAN : C H A I R M A N;
// HAYGAN : H A Y G A N;
// CHANCELLOR : C H A N C E L L O R;
// HARTMAN : H A R T M A N;
// COMMANDER : C O M M A N D E R;
// KLIK : K L I K;
// COMMODORE : C O M M O D O R E;
// ZHANG : Z H A N G;
// CONFESSOR : C O N F E S S O R;
// MORRIS : M O R R I S;
// HIVE : H I V E;
// LORD : L O R D;
// SCREECHER : S C R E E C H E R;
COMBAT : C O M B A T ;
AUTHORITY : A U T H O R I T Y ;
TRADE : T R A D E ;
ACQUIRE : A C Q U I R E ;
ACQUIRED : A C Q U I R E D ;
UNALIGNED : U N A L I G N E D ;
ACTIVATING : A C T I V A T I N G ;
ATTACKED : A T T A C K E D ;
SCRAPPING : S C R A P P I N G ;
SCRAPPED : S C R A P P E D ;
SCRAP : S C R A P ;
SELECTING : S E L E C T I N G ;
SHUFFLED : S H U F F L E D ;
DISCARDED : D I S C A R D E D ;
DISCARD : D I S C A R D ;
DISCOUNTS : D I S C O U N T S ;
REFRESH : R E F R E S H ;
DISCARDING : D I S C A R D I N G ;
DESTROYED : D E S T R O Y E D ;
RESOLVING : R E S O L V I N G ;
INDICATORS : I N D I C A T O R S ;
AVAILABLE : A V A I L A B L E ;
RETURNING : R E T U R N I N G ;
ABILITY : A B I L I T Y ;
CHANGED : C H A N G E D ;
REVEALED : R E V E A L E D ;
REPLACED : R E P L A C E D ;
COPYING : C O P Y I N G ;
COPIED : C O P I E D ;
IMAGE : I M A G E ;
RECEIVE : R E C E I V E ;
REDRAW : R E D R A W ;
TABLE : T A B L E ;
CREATE : C R E A T E ;
PLAYED : P L A Y E D ;
SECRET : S E C R E T ;
OUTPOST : O U T P O S T ;
RETURN : R E T U R N ;
TARGET : T A R G E T ;
DRAW : D R A W ;
EVERY : E V E R Y ;
BLOB : B L O B ;
COPY : C O P Y ;
CARDS : C A R D S ;
CHOSE : C H O S E ;
TURN : T U R N ;
SHIP : S H I P ;
SHIPS : S H I P S ;
BASE : B A S E ;
BASES : B A S E S ;
PILE : P I L E ;
EACH : E A C H ;
PLAY : P L A Y ;
FORM : F O R M ;
COST : C O S T ;
DECK : D E C K ;
DREW : D R E W ;
ENDS : E N D S ;
CARD : C A R D ;
MORE2 : M O R E ;
FROM : F R O M ;
YOUR : Y O U R ;
ALLY : A L L Y ;
HAND : H A N D ;
GAME : G A M E ;
LESS : L E S S ;
THIS : T H I S ;
NEW : N E W ;
ALL : A L L ;
NOW : N O W ;
ROW : R O W ;
THE : T H E ;
TOP : T O P ;
FOR : F O R ;
DID : D I D ;
AND : A N D ;
ONE : O N E ;
ADD : A D D ;
NOT : N O T ;
HAS : H A S ;
WON : W O N ;
ANY : A N Y ;
IS : I S ;
IT : I T ;
AT : A T ;
IN : I N ;
TO : T O ;
OF : O F ;
UP : U P ;
OR : O R ;
NO : N O ;
ON : O N ;
WHITESPACE : (' ' | '\t') -> skip ;
COLOR_START_TAG : '<color=#'(LETTER | INT)*'>' -> skip ;
COLOR_END_TAG : '</color>' -> skip ;
END_GAME_TAG : '===' -> skip ;
DOT : '.' -> skip ;
SEMICOLUM : ';' -> skip ;
INT : [0-9]+ ;
fragment LETTER : [A-Za-z] ;
WORD : (LETTER | INT)+ ;
SEPARATOR : '>' | '-' | '<';
INCREMENT : '+'INT ;
DECREASE : '-'INT ;
NEWLINE : ('\r'? '\n' | '\r')+ ; |
programs/oeis/182/A182324.asm | neoneye/loda | 22 | 24979 | <reponame>neoneye/loda<filename>programs/oeis/182/A182324.asm
; A182324: n + (initial digit of n) in decimal representation.
; 0,2,4,6,8,10,12,14,16,18,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,74,75,77,78,79,80,81,82,83,84,85,86,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,104,105,106,107,108
mov $2,$0
lpb $0
mov $1,$0
div $0,10
lpe
add $1,$2
mov $0,$1
|
src/generator.adb | bracke/websitegenerator | 1 | 30147 | <filename>src/generator.adb
pragma Ada_2012;
with Ada.Directories;
with Ada.Text_IO;
with Ada.Strings.Fixed;
with Ada.Characters.Handling;
with Generator.Frontmatter;
with Generator.Rssfeed;
with Generator.Sitemap;
with Ada.Text_IO.Text_Streams;
with Ada.Streams;
with Ada.Streams.Stream_IO;
with Ada.Numerics.Discrete_Random;
with Progress_Indicators.Spinners;
with Version;
with Globals;
package body Generator is
use Ada.Directories;
use Ada.Text_IO;
use Progress_Indicators.Spinners;
package CH renames Ada.Characters.Handling;
package CC renames Ada.Characters.Conversions;
package DIR renames Ada.Directories;
subtype Die is Integer range 1 .. 256;
subtype Dice is Integer range 2 * Die'First .. 2 * Die'Last;
package Random_Integer is new Ada.Numerics.Discrete_Random (Die);
use Random_Integer;
function "<" (Left, Right : Document) return Boolean is
begin
return Left.Basename < Right.Basename;
end "<";
function Find (List : Document_Container.List; Name : XString) return Cursor
is
begin
for aDocument in List.Iterate loop
if Element (aDocument).Basename = Name then
return aDocument;
end if;
end loop;
return No_Element;
end Find;
------------------
-- Process_File --
------------------
procedure Process_File
(List : out Document_Container.List;
Filepath : String;
Targetpath : String;
Linkpath : String)
is
Extension : constant String := CH.To_Upper (DIR.Extension (Filepath));
begin
if Extension = "MD" or else Extension = "MARKDOWN" then
List.Append (
Generator.Frontmatter.Read (Filepath, Targetpath, Linkpath)
);
declare
Filein : Ada.Streams.Stream_IO.File_Type;
Fileout : Ada.Text_IO.File_Type;
begin
null;
-- Ada.Streams.Stream_IO.Open
-- (Filein, Ada.Streams.Stream_IO.In_File, Filepath);
-- Ada.Text_IO.Create
-- (Fileout, Ada.Text_IO.Out_File,Targetpath);
-- Renderer.Set_Output
-- (Ada.Text_IO.Text_Streams.Stream(Fileout));
-- Generator.Markdown.To_HTML (Filein);
end;
elsif Extension = "HTML" or else Extension = "HTM" then
List.Append (
Generator.Frontmatter.Read (Filepath, Targetpath, Linkpath)
);
elsif Extension = "TMPLT" then
List.Append (
Generator.Frontmatter.Read (Filepath, Targetpath, Linkpath)
);
else
if DIR.Exists (Targetpath) then
DIR.Delete_File (Targetpath);
end if;
Copy_File (Filepath, Targetpath);
end if;
end Process_File;
-----------------------
-- Process_Directory --
-----------------------
procedure Process_Directory
(List : out Document_Container.List;
Source_Directory : String;
Target_Directory : String;
LinkpathIn : String)
is
Linkpath : constant String :=
Ada.Strings.Fixed.Trim (LinkpathIn, Slash, Slash);
Dir : Directory_Entry_Type;
Dir_Search : Search_Type;
begin
if Exists (Source_Directory) then
Start_Search (Search => Dir_Search,
Directory => Source_Directory,
Pattern => "*");
loop
Get_Next_Entry (Dir_Search, Dir);
if Simple_Name (Dir) /= "." and then Simple_Name (Dir) /= ".." then
declare
Name : constant String := Simple_Name (Dir);
Fullname : constant String := Full_Name (Dir);
Targetname : constant String
:= Compose (Target_Directory, Name);
Basename : constant String := Base_Name (Fullname);
Process : constant Boolean :=
Name /= "." and
Name /= ".." and
Ada.Strings.Fixed.Head (Name, 1) /= "_";
begin
if Process then
if Debug then
Ada.Text_IO.Put_Line (Fullname);
end if;
if Kind (Dir) = Ordinary_File then
Process_File (
List,
Fullname,
Targetname,
Linkpath & "/" & Basename & ".html");
else
if not Exists (Targetname) then
Create_Directory (Targetname);
end if;
Process_Directory (
List,
Fullname,
Targetname,
Linkpath & "/" & Name);
end if;
end if;
end;
end if;
exit when not More_Entries (Dir_Search);
end loop;
End_Search (Dir_Search);
end if;
end Process_Directory;
function Get_Nav_Links (
Document : Cursor;
List : Document_Container.List) return Translate_Set is
Set : Translate_Set;
P : Cursor := Previous (Document);
N : Cursor := Next (Document);
begin
if P = No_Element then
P := Last (List);
end if;
Insert (Set, Assoc ("previouslink",
CC.To_String (To_String (Element (P).Linkpath))));
if N = No_Element then
N := First (List);
end if;
Insert (Set, Assoc ("nextlink",
CC.To_String (To_String (Element (N).Linkpath))));
return Set;
end Get_Nav_Links;
procedure Process_Documents (
List : Document_Container.List;
Set : Translate_Set;
Layoutfolder : String;
Source_Directory : String;
Targetpath : String) is
begin
for Document in List.Iterate loop
if Debug then
Ada.Text_IO.Put_Line (
CC.To_String (
To_String (
Element (Document).Targetpath))
);
end if;
if Length (Element (Document).Layout) > 0 then
declare
Name : constant String :=
CC.To_String (
To_String (Element (Document).Layout)
);
Base_Name : constant String := DIR.Base_Name (Name);
Extension : constant String := DIR.Extension (Name);
Layoutfile : constant String :=
DIR.Compose (Layoutfolder, Base_Name, Extension);
Combined_Set : Translate_Set;
Filename : constant String :=
CC.To_String (
To_String (Element (Document).Targetpath)
);
begin
Insert (Combined_Set, Set);
Insert (Combined_Set, Element (Document).T);
Insert (Combined_Set, Get_Nav_Links (Document, List));
if DIR.Exists (Layoutfile) then
declare
F : File_Type;
Template : constant String :=
Templates_Parser.Parse (Layoutfile, Combined_Set);
begin
if Exists (Filename) then
Delete_File (Filename);
end if;
Create (F, Mode => Out_File, Name => Filename);
Put (F, Template);
Close (F);
end;
else
Ada.Text_IO.Put_Line ("Layoutfile " &
Layoutfile & " does not exist");
end if;
end;
else
Ada.Text_IO.Put_Line ("Layout for " &
CC.To_String (To_String (
Element (Document).Filepath)) & " is not defined"
);
end if;
end loop;
end Process_Documents;
function Create_Vector (
List : Document_Container.List;
Prefix : String) return Translate_Set is
Set : Translate_Set;
Pagepath : Tag;
Pagename : Tag;
Pageexcerpt : Tag;
begin
for Document of List loop
declare
Name : constant String
:= Read_From_Set (Document.T, "title");
Base_Name : constant String :=
CC.To_String (To_String (Document.Basename));
Excerpt : constant String := Read_From_Set (Document.T, "title");
begin
Pagepath := Pagepath & Ada.Strings.Fixed.Trim (
CC.To_String (To_String (Document.Linkpath)),
Slash, Slash);
Pageexcerpt := Pageexcerpt & Excerpt;
if Name'Length > 0 then
Pagename := Pagename & Name;
else
Pagename := Pagename & Base_Name;
end if;
end;
end loop;
Insert (Set, Assoc (Prefix & "path", Pagepath));
Insert (Set, Assoc (Prefix & "name", Pagename));
Insert (Set, Assoc (Prefix & "excerpt", Pageexcerpt));
return Set;
end Create_Vector;
function Read_From_Set (
Set : Translate_Set;
Token : String) return String is
Assoc : constant Association := Get (Set, Token);
begin
if Assoc /= Null_Association then
return Get (Assoc);
end if;
return "";
end Read_From_Set;
-----------
-- Start --
-----------
procedure Start (
Source_Directory : String;
Target_Directory : String) is
Config_Path : constant String :=
DIR.Compose (Source_Directory,
Globals.Site_Configuration_Name);
Layoutfolder : constant String := Compose (Source_Directory,
Globals.Layout_Folder_Name);
Blog_Source_Directory : constant String :=
Compose (Source_Directory, Globals.Posts_Source_Folder_Name);
Blog_Target_Directory : constant String :=
Compose (Target_Directory, Globals.Blog_Target_Folder_Name);
Documents : Document_Container.List;
Posts : Document_Container.List;
Set : Translate_Set;
Site_Set : Translate_Set;
G : Random_Integer.Generator;
D : Dice;
Indicator : Spinner := Make;
Index: Cursor := No_Element;
begin
Ada.Text_IO.Put (Value (Indicator));
Site_Set := Null_Set;
if Exists (Config_Path) then
Generator.Frontmatter.Read_Content (Config_Path, Site_Set);
else
Ada.Text_IO.Put_Line ("No site configuration found at " & Config_Path);
end if;
-- Copy static files and directories and create List of pages.
Process_Directory (Documents, Source_Directory, Target_Directory, "");
Sort (Documents);
Index := Find (Documents, To_XString ("index"));
if Index /= No_Element then
Prepend (Documents, Element (Index));
Delete (Documents, Index);
end if;
-- Process blog
if Exists (Blog_Source_Directory) then
-- Copy static files and directories and create List of pages.
if not Exists (Blog_Target_Directory) then
Create_Directory (Blog_Target_Directory);
end if;
Process_Directory (Posts, Blog_Source_Directory,
Blog_Target_Directory, Globals.Blog_Target_Folder_Name);
end if;
Sort (Posts);
Insert (Set, Create_Vector (Documents, "page"));
Insert (Set, Create_Vector (Posts, "post"));
Insert (Set, Site_Set);
Insert (Set, Assoc ("meta_generator_link", Version.Link));
Insert (Set, Assoc ("meta_generator", Version.Name));
Insert (Set, Assoc ("meta_generator_version", Version.Current));
Reset (G); D := Random (G);
Insert (Set, Assoc ("meta_cachebuster",
Ada.Strings.Fixed.Trim (D'Image, Ada.Strings.Both)));
-- Create RSS feed
Insert (Set, Assoc ("atomfeedurl",
Generator.Rssfeed.Create (Posts,
Target_Directory, Site_Set))
);
-- Create RSS feed
Insert (Set, Assoc ("sitemapurl",
Generator.Sitemap.Create (Posts, Documents,
Target_Directory, Site_Set))
);
-- Process non-static files
Process_Documents (Documents, Set, Layoutfolder,
Source_Directory, Target_Directory);
Process_Documents (Posts, Set, Layoutfolder,
Blog_Source_Directory, Blog_Target_Directory);
Disable_All;
Ada.Text_IO.Put (Value (Indicator));
end Start;
end Generator; |
src/Categories/Object/Duality.agda | Trebor-Huang/agda-categories | 279 | 3318 | {-# OPTIONS --without-K --safe #-}
open import Categories.Category
-- Properties relating Initial and Terminal Objects,
-- Product / Coproduct, Zero objects, and Kernel / Cokernel via op
module Categories.Object.Duality {o ℓ e} (C : Category o ℓ e) where
open Category C
open import Level
open import Relation.Binary.PropositionalEquality as ≡ using (_≡_)
open import Categories.Morphism C
open import Categories.Object.Terminal op
open import Categories.Object.Initial C
open import Categories.Object.Product op
open import Categories.Object.Coproduct C
open import Categories.Object.Zero
import Categories.Object.Kernel as Kernels
import Categories.Object.Cokernel as Cokernels
private
variable
A B X Z : Obj
f g k : A ⇒ B
IsInitial⇒coIsTerminal : IsInitial X → IsTerminal X
IsInitial⇒coIsTerminal is⊥ = record
{ ! = !
; !-unique = !-unique
}
where open IsInitial is⊥
⊥⇒op⊤ : Initial → Terminal
⊥⇒op⊤ i = record
{ ⊤ = ⊥
; ⊤-is-terminal = IsInitial⇒coIsTerminal ⊥-is-initial
}
where open Initial i
coIsTerminal⇒IsInitial : IsTerminal X → IsInitial X
coIsTerminal⇒IsInitial is⊤ = record
{ ! = !
; !-unique = !-unique
}
where open IsTerminal is⊤
op⊤⇒⊥ : Terminal → Initial
op⊤⇒⊥ t = record
{ ⊥ = ⊤
; ⊥-is-initial = coIsTerminal⇒IsInitial ⊤-is-terminal
}
where open Terminal t
Coproduct⇒coProduct : Coproduct A B → Product A B
Coproduct⇒coProduct A+B = record
{ A×B = A+B.A+B
; π₁ = A+B.i₁
; π₂ = A+B.i₂
; ⟨_,_⟩ = A+B.[_,_]
; project₁ = A+B.inject₁
; project₂ = A+B.inject₂
; unique = A+B.unique
}
where
module A+B = Coproduct A+B
coProduct⇒Coproduct : ∀ {A B} → Product A B → Coproduct A B
coProduct⇒Coproduct A×B = record
{ A+B = A×B.A×B
; i₁ = A×B.π₁
; i₂ = A×B.π₂
; [_,_] = A×B.⟨_,_⟩
; inject₁ = A×B.project₁
; inject₂ = A×B.project₂
; unique = A×B.unique
}
where
module A×B = Product A×B
-- Zero objects are autodual
IsZero⇒coIsZero : IsZero C Z → IsZero op Z
IsZero⇒coIsZero is-zero = record
{ isInitial = record { ! = ! ; !-unique = !-unique }
; isTerminal = record { ! = ¡ ; !-unique = ¡-unique }
}
where
open IsZero is-zero
coIsZero⇒IsZero : IsZero op Z → IsZero C Z
coIsZero⇒IsZero co-is-zero = record
{ isInitial = record { ! = ! ; !-unique = !-unique }
; isTerminal = record { ! = ¡ ; !-unique = ¡-unique }
}
where
open IsZero co-is-zero
coZero⇒Zero : Zero op → Zero C
coZero⇒Zero zero = record
{ 𝟘 = 𝟘
; isZero = coIsZero⇒IsZero isZero
}
where
open Zero zero
Zero⇒coZero : Zero C → Zero op
Zero⇒coZero zero = record
{ 𝟘 = 𝟘
; isZero = IsZero⇒coIsZero isZero
}
where
open Zero zero
-- Tests to ensure that dualities are involutive up to definitional equality.
private
coIsTerminal⟺IsInitial : (⊥ : IsInitial X) → coIsTerminal⇒IsInitial (IsInitial⇒coIsTerminal ⊥) ≡ ⊥
coIsTerminal⟺IsInitial _ = ≡.refl
IsInitial⟺coIsTerminal : (⊤ : IsTerminal X) → IsInitial⇒coIsTerminal (coIsTerminal⇒IsInitial ⊤) ≡ ⊤
IsInitial⟺coIsTerminal _ = ≡.refl
⊥⟺op⊤ : (⊤ : Terminal) → ⊥⇒op⊤ (op⊤⇒⊥ ⊤) ≡ ⊤
⊥⟺op⊤ _ = ≡.refl
op⊤⟺⊥ : (⊥ : Initial) → op⊤⇒⊥ (⊥⇒op⊤ ⊥) ≡ ⊥
op⊤⟺⊥ _ = ≡.refl
Coproduct⟺coProduct : (p : Product A B) → Coproduct⇒coProduct (coProduct⇒Coproduct p) ≡ p
Coproduct⟺coProduct _ = ≡.refl
coProduct⟺Coproduct : (p : Coproduct A B) → coProduct⇒Coproduct (Coproduct⇒coProduct p) ≡ p
coProduct⟺Coproduct _ = ≡.refl
coIsZero⟺IsZero : {zero : IsZero op Z} → IsZero⇒coIsZero (coIsZero⇒IsZero zero) ≡ zero
coIsZero⟺IsZero = ≡.refl
IsZero⟺coIsZero : ∀ {Z} {zero : IsZero C Z} → coIsZero⇒IsZero (IsZero⇒coIsZero zero) ≡ zero
IsZero⟺coIsZero = ≡.refl
coZero⟺Zero : ∀ {zero : Zero op} → Zero⇒coZero (coZero⇒Zero zero) ≡ zero
coZero⟺Zero = ≡.refl
Zero⟺coZero : ∀ {zero : Zero C} → coZero⇒Zero (Zero⇒coZero zero) ≡ zero
Zero⟺coZero = ≡.refl
module _ (𝟎 : Zero C) where
open Kernels (Zero⇒coZero 𝟎)
open Cokernels 𝟎
coIsKernel⇒IsCokernel : IsKernel k f → IsCokernel f k
coIsKernel⇒IsCokernel isKernel = record
{ commute = commute
; universal = universal
; factors = factors
; unique = unique
}
where
open IsKernel isKernel
IsCokernel⇒coIsKernel : IsCokernel f k → IsKernel k f
IsCokernel⇒coIsKernel isCokernel = record
{ commute = commute
; universal = universal
; factors = factors
; unique = unique
}
where
open IsCokernel isCokernel
coKernel⇒Cokernel : Kernel f → Cokernel f
coKernel⇒Cokernel k = record
{ cokernel⇒ = kernel⇒
; isCokernel = coIsKernel⇒IsCokernel isKernel
}
where
open Kernel k
Cokernel⇒coKernel : Cokernel f → Kernel f
Cokernel⇒coKernel k = record
{ kernel⇒ = cokernel⇒
; isKernel = IsCokernel⇒coIsKernel isCokernel
}
where
open Cokernel k
private
coIsKernel⟺IsCokernel : ∀ {isKernel : IsKernel k f} → IsCokernel⇒coIsKernel (coIsKernel⇒IsCokernel isKernel) ≡ isKernel
coIsKernel⟺IsCokernel = ≡.refl
IsCokernel⟺coIsKernel : ∀ {isCokernel : IsCokernel f k} → coIsKernel⇒IsCokernel (IsCokernel⇒coIsKernel isCokernel) ≡ isCokernel
IsCokernel⟺coIsKernel = ≡.refl
coKernel⟺Cokernel : ∀ {kernel : Kernel f} → Cokernel⇒coKernel (coKernel⇒Cokernel kernel) ≡ kernel
coKernel⟺Cokernel = ≡.refl
Cokernel⟺coKernel : ∀ {cokernel : Cokernel f} → coKernel⇒Cokernel (Cokernel⇒coKernel cokernel) ≡ cokernel
Cokernel⟺coKernel = ≡.refl
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1364.asm | ljhsiun2/medusa | 9 | 176969 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x13418, %rbx
nop
nop
nop
add %r9, %r9
mov $0x6162636465666768, %r13
movq %r13, %xmm5
movups %xmm5, (%rbx)
nop
nop
nop
nop
nop
and $33100, %r9
lea addresses_WC_ht+0x17fb4, %rbp
clflush (%rbp)
nop
sub %r15, %r15
vmovups (%rbp), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %r12
nop
nop
cmp $63764, %r15
lea addresses_WT_ht+0x1bc18, %r9
nop
nop
nop
nop
nop
xor $23219, %rbx
mov (%r9), %r12w
nop
xor $8346, %r9
lea addresses_UC_ht+0x16418, %rsi
lea addresses_WT_ht+0x59b8, %rdi
clflush (%rsi)
clflush (%rdi)
xor %rbx, %rbx
mov $53, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $9, %rsi
lea addresses_WT_ht+0xac18, %rsi
lea addresses_UC_ht+0x1c1f0, %rdi
clflush (%rdi)
nop
nop
nop
nop
add $11129, %r9
mov $25, %rcx
rep movsl
nop
nop
nop
nop
nop
inc %rbp
lea addresses_UC_ht+0xb994, %r15
nop
nop
inc %rdi
mov $0x6162636465666768, %r12
movq %r12, %xmm4
movups %xmm4, (%r15)
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_A_ht+0x16518, %rsi
lea addresses_D_ht+0x5c18, %rdi
xor $48781, %r9
mov $105, %rcx
rep movsq
nop
xor $20030, %r13
lea addresses_WT_ht+0x10d58, %r15
nop
nop
nop
nop
and $46836, %r13
mov (%r15), %r9w
xor %r12, %r12
lea addresses_WT_ht+0x1a958, %rsi
nop
nop
nop
dec %r13
movb (%rsi), %r9b
nop
nop
nop
dec %r9
lea addresses_D_ht+0xe610, %rdi
nop
nop
nop
and $25488, %rbp
vmovups (%rdi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %r9
nop
nop
nop
nop
nop
inc %rbx
lea addresses_D_ht+0x12870, %rsi
lea addresses_WC_ht+0x1c758, %rdi
nop
nop
nop
nop
nop
dec %rbx
mov $112, %rcx
rep movsq
add %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %rax
push %rbx
push %rcx
push %rdx
push %rsi
// Store
lea addresses_WT+0xa4a2, %rdx
nop
nop
and $26292, %r11
movl $0x51525354, (%rdx)
nop
inc %rax
// Store
lea addresses_UC+0x10806, %rcx
xor %rbx, %rbx
mov $0x5152535455565758, %rax
movq %rax, (%rcx)
nop
nop
nop
add %r11, %r11
// Faulty Load
lea addresses_WC+0x5418, %rax
nop
cmp $48201, %r15
mov (%rax), %edx
lea oracles, %r15
and $0xff, %rdx
shlq $12, %rdx
mov (%r15,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': True}, 'OP': 'REPM'}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
grammars/Q2.g4 | parsaeisa/IUSTCompiler | 0 | 6955 | <filename>grammars/Q2.g4<gh_stars>0
grammar Q2 ;
@parser :: members {
temp_counter = 0
def create_temp(self):
self.temp_counter += 1
return 'T' + str(self.temp_counter)
def remove_temp(self) :
self.temp_counter -= 1
def is_temp(self, var:str):
if var[0] == 'T':
return True
return False
def create_label(self):
slef.label_counter += 1
return 'L' + str(self.tmp_counter)
}
program : mainClass ( classDeclaration )* EOF ;
mainClass : 'class' IDENTIFIER '{' 'public' 'static' 'void' 'main' '(' 'String' '[' ']' IDENTIFIER ')' '{' statement '}' '}' ;
classDeclaration : 'class' IDENTIFIER ( 'extends' IDENTIFIER )? '{' ( varDeclaration )* ( methodDeclaration )* '}' ;
varDeclaration : type IDENTIFIER ';' ;
methodDeclaration : 'public' type IDENTIFIER '(' ( type IDENTIFIER ( ',' type IDENTIFIER )* )? ')' '{' ( varDeclaration )* ( statement )* 'return' expression ';' '}' ;
type : 'int' '[' ']'
| 'boolean'
| 'int'
| IDENTIFIER
;
statement : '{' ( statement )* '}'
| 'if' '(' expression ')' statement 'else' statement
| 'while' '(' expression ')' statement
| 'System.out.println' '(' expression ')' ';'
| IDENTIFIER '=' expression ';'
| IDENTIFIER '[' expression ']' '=' expression ';'
;
expression: expression ( '&&' | '<' | '+' | '-' | '*' ) expression
| expression '[' expression ']'
| expression '.' 'length'
| expression '.' IDENTIFIER '(' ( expression ( ',' expression )* )? ')'
| INTEGER_LITERAL
| 'true'
| 'false'
| IDENTIFIER
| 'this'
| 'new' 'int' '[' expression ']'
| 'new' IDENTIFIER '(' ')'
| '!' expression
| '(' expression ')'
;
IDENTIFIER: [a-zA-Z_][a-zA-Z0-9_]* ;
INTEGER_LITERAL: '0'..'9'+ ;
WS : [ \t\r\n]+ -> skip ;
COMMENT : '/*' .*? '*/' -> skip ;
LINE_COMMENT: '//' .*? '\r'? '\n' -> skip; |
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1589.asm | ljhsiun2/medusa | 9 | 6681 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %rbx
push %rcx
push %rdi
push %rdx
lea addresses_normal_ht+0x1c47b, %r8
nop
nop
nop
xor $21773, %rbx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm4
and $0xffffffffffffffc0, %r8
movaps %xmm4, (%r8)
nop
nop
nop
nop
nop
and $8781, %r8
lea addresses_WC_ht+0xee0b, %rdi
and $4624, %r8
vmovups (%rdi), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %rdx
nop
nop
xor %rdx, %rdx
lea addresses_WC_ht+0x151f0, %rcx
sub %r14, %r14
movl $0x61626364, (%rcx)
nop
nop
add %r8, %r8
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %rbx
push %rdi
push %rdx
// Faulty Load
lea addresses_UC+0x19beb, %r10
nop
nop
cmp %rbx, %rbx
mov (%r10), %edi
lea oracles, %rdx
and $0xff, %rdi
shlq $12, %rdi
mov (%rdx,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %rbx
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_normal_ht', 'same': True, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
CNC-64/Timers.asm | Jeff-Birt/CNC-64 | 0 | 99179 | <gh_stars>0
;===============================================================================
;* CIA and Jiffy Clock Timer utilities *
;===============================================================================
;===============================================================================
; CIA Timer stuff
;===============================================================================
;===============================================================================
;* Macros *
defm CIA2TMRA_START
lda #$01 ; need to add in proper bit masking
sta $DD0E ; store to CIA TimerA register
endm
defm CIA2TMRA_STOP
lda #$00 ; need to add in proper bit masking
sta $DD0E ; store to CIA TimerA register
endm
defm CIA2TMRA_READ ; return timer A in A, X
lda $DD04 ;LSB
ldx $DD05 ;MSB
endm
defm CIA2TMRB_START
lda #%00100001 ; need to add in proper bit masking
sta $DD0F ; store to CIA TimerA register
endm
defm CIA2TMRB_STOP
lda #%00100000 ; need to add in proper bit masking
sta $DD0F ; store to CIA TimerA register
endm
defm CIA2TMRB_READ ; return timer B in A, X
lda $DD06 ;LSB
ldx $DD07 ;MSB
endm
;* end Macros *
;===============================================================================
;===============================================================================
;* Subroutines *
; instead of jify clock use CIA2 timer A,
; Set control reg $DD0E to $00 (stop, src=sysclk)
; set registers to $FFFF counts $DD04 LSB, $DD05 MSB
; lDA $DD0D to clear any flags
; set $DD0E to $01 to start, set again to $00 to stop
; read $DD04 LSB, $DDO5 MSB for elapsed time
; up to 65ms, other wise need to cascade timers
;*******************************************************************************
;* CIA2TmrA_Cfg , configute CIA2 Timer A *
; Counts down from $FFFF using sysclk, max 65.536ms *
; Variables -> None *
;*******************************************************************************
CIA2TmrA_Cfg
sei
php
pha
; timer set up here
lda #$00 ; set timer B control register
sta $DD0E ; stop, use sysclk source
lda #$FF ; timer A
sta $DD04 ; set LSB
lda #$FF ; timer A
sta $DD05 ; set MSB
lda $DD0D ; ack any NMI/flags?
pla
plp
cli
rts
;* end Subroutines *
;===============================================================================
;*******************************************************************************
;* CIA2TmrB_Cfg , configute CIA2 Timer B *
; Counts down from $FFFF using Timer A underflow, max 65.536ms *
; Variables -> None *
; start with lda #%00100001, sta $DD0F *
; stop with lda #%00100000, sta $DD0F *
;*******************************************************************************
CIA2TmrB_Cfg
sei
php
pha
; timer set up here
lda #%00100000 ; set timer B control register
sta $DD0F ; stop, use tmr A underflow
lda #$FF ; timer A
sta $DD06 ; set LSB
lda #$FF ; timer A
sta $DD07 ; set MSB
lda $DD0D ; ack any NMI/flags?
pla
plp
cli
rts
;* end Subroutines *
;===============================================================================
|
oeis/273/A273766.asm | neoneye/loda-programs | 11 | 85946 | ; A273766: Number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 913", based on the 5-celled von Neumann neighborhood.
; 1,4,17,48,81,121,169,225,289,361,441,529,625,729,841,961,1089,1225,1369,1521,1681,1849,2025,2209,2401,2601,2809,3025,3249,3481,3721,3969,4225,4489,4761,5041,5329,5625,5929,6241,6561,6889,7225,7569,7921,8281,8649,9025,9409,9801,10201,10609,11025,11449,11881,12321,12769,13225,13689,14161,14641,15129,15625,16129,16641,17161,17689,18225,18769,19321,19881,20449,21025,21609,22201,22801,23409,24025,24649,25281,25921,26569,27225,27889,28561,29241,29929,30625,31329,32041,32761,33489,34225,34969,35721
mov $3,$0
mov $4,$0
mul $0,2
add $0,16
mov $2,$3
add $3,4
mul $3,$2
mov $6,$0
mov $0,1
lpb $3
mul $3,2
trn $3,$6
lpb $6
sub $6,1
lpe
lpe
add $3,$0
mov $1,$3
mov $5,$4
mul $5,$4
mov $7,$5
mul $7,3
add $1,$7
mov $0,$1
|
programs/oeis/070/A070481.asm | neoneye/loda | 22 | 101366 | ; A070481: a(n) = n^3 mod 19.
; 0,1,8,8,7,11,7,1,18,7,12,1,18,12,8,12,11,11,18,0,1,8,8,7,11,7,1,18,7,12,1,18,12,8,12,11,11,18,0,1,8,8,7,11,7,1,18,7,12,1,18,12,8,12,11,11,18,0,1,8,8,7,11,7,1,18,7,12,1,18,12,8,12,11,11,18,0,1,8,8,7,11,7,1,18,7,12,1,18,12,8,12,11,11,18,0,1,8,8,7
pow $0,3
mod $0,19
|
Transynther/x86/_processed/NC/_zr_/i3-7100_9_0x84_notsx.log_21829_2955.asm | ljhsiun2/medusa | 9 | 160731 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x14aa9, %r12
xor $15454, %rcx
movb (%r12), %r9b
nop
nop
nop
nop
nop
and %rbx, %rbx
lea addresses_UC_ht+0xcf49, %rdi
nop
nop
nop
nop
sub $12337, %r12
mov $0x6162636465666768, %rbx
movq %rbx, (%rdi)
cmp %r12, %r12
lea addresses_WC_ht+0x132f9, %rsi
lea addresses_WC_ht+0x1a089, %rdi
nop
nop
dec %rax
mov $112, %rcx
rep movsw
nop
sub %rsi, %rsi
lea addresses_normal_ht+0x7731, %rax
nop
nop
nop
nop
nop
dec %rbx
movw $0x6162, (%rax)
nop
nop
nop
nop
nop
dec %rcx
lea addresses_A_ht+0x1a41b, %rsi
nop
nop
nop
xor %rbx, %rbx
mov (%rsi), %eax
inc %rcx
lea addresses_D_ht+0x15aa9, %r9
clflush (%r9)
nop
nop
nop
nop
add %rdi, %rdi
mov (%r9), %bx
nop
nop
nop
sub $29822, %rsi
lea addresses_WC_ht+0x13aa9, %rsi
lea addresses_D_ht+0x5929, %rdi
nop
nop
dec %rax
mov $31, %rcx
rep movsl
nop
xor $38282, %rax
lea addresses_A_ht+0x99a9, %rcx
nop
nop
nop
nop
and %rsi, %rsi
movl $0x61626364, (%rcx)
nop
nop
nop
nop
xor $64248, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %rax
push %rdi
push %rdx
push %rsi
// Faulty Load
mov $0x994be00000002a9, %rsi
nop
nop
nop
xor %rdi, %rdi
mov (%rsi), %rax
lea oracles, %rdi
and $0xff, %rax
shlq $12, %rax
mov (%rdi,%rax,1), %rax
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'same': False, 'size': 8, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 11, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/posix/ucontext_asm.asm | KristianJerpetjon/IncludeOS | 1 | 11153 | <gh_stars>1-10
USE32
extern errno
global getcontext
global setcontext
global restore_context_stack
%define EINVAL (22)
%define NULL (0)
%define sizeof_size_t (4)
struc ucontext_t
.uc_link: resd 1
.uc_stack: resb 12
.uc_mcontext: resb 40
endstruc
struc stack_t
.ss_sp: resd 1
.ss_size: resd 1
.ss_flags: resd 1
endstruc
struc mcontext_t
.edi: resd 1
.esi: resd 1
.ebp: resd 1
.ebx: resd 1
.edx: resd 1
.ecx: resd 1
.eax: resd 1
.floating_point_env: resb 28
.eip: resd 1
.flags: resd 1
.ret_esp: resd 1
endstruc
section .text
;; =============================================================================
;; Save the calling context into ucontext_t
;;
;; @param [ESP + 4] Pointer to a mcontext_t struct.
;;
;; @return -1 if an error occured, 0 for success.
;; =============================================================================
getcontext:
mov eax, DWORD [esp + 4]
cmp eax, NULL
jne .valid_arg
mov eax, -1
ret
.valid_arg:
add eax, ucontext_t.uc_mcontext
;;General purpose registers
mov DWORD [eax + mcontext_t.edi], edi
mov DWORD [eax + mcontext_t.esi], esi
mov DWORD [eax + mcontext_t.ecx], ecx
mov DWORD [eax + mcontext_t.edx], edx
mov DWORD [eax + mcontext_t.ebp], ebp
mov DWORD [eax + mcontext_t.ebx], ebp
;; Floating point env
fnstenv [eax + mcontext_t.floating_point_env]
fldenv [eax + mcontext_t.floating_point_env]
;;Eip
mov ecx, [esp]
mov DWORD [eax + mcontext_t.eip], ecx
;;Return stack
lea ecx, [esp + 4]
mov DWORD [eax + mcontext_t.ret_esp], ecx
;;Flags
pushfd
mov ebx, [esp]
mov DWORD [eax + mcontext_t.flags], ebx
popfd
sub eax, 12
mov [eax + stack_t.ss_sp], ecx
;;Size doesn't matter ( ͡° ͜ʖ ͡°)
mov DWORD [eax + stack_t.ss_size], 4096
mov eax, 0
.return:
ret
;; =============================================================================
;; Switch to other context
;;
;; @param [ESP + 4] Pointer to a mcontext_t struct.
;;
;; @return -1 if an error occured, doesn't return if successful.
;; =============================================================================
setcontext:
mov eax, DWORD [esp + 4]
test eax, eax
jne .valid_arg
mov eax, -1
mov DWORD [errno], EINVAL
ret
.valid_arg:
mov eax, [esp + 4]
add eax, 16
mov edi, [eax + mcontext_t.edi]
mov esi, [eax + mcontext_t.esi]
mov ebp, [eax + mcontext_t.ebp]
mov ebx, [eax + mcontext_t.ebx]
mov edx, [eax + mcontext_t.edx]
mov ecx, [eax + mcontext_t.ecx]
fldenv [eax + mcontext_t.floating_point_env]
push DWORD [eax + mcontext_t.flags]
popfd
;; New stack
push DWORD [eax + mcontext_t.ret_esp]
pop esp
;; Eip
push DWORD [eax + mcontext_t.eip]
.return:
ret
;; =============================================================================
;; When a context finishes its execution, it will return to this function.
;; This function will prepare the stack for 'setcontext', to successfuly
;; return to the successor context.
;;
;; @param [ESP + 4] Returning context's argc
;; @param [ESP + 8] - [ESP + 8 + (4 * argc)] Returning context's arguments
;;
;; @return None
;; =============================================================================
restore_context_stack:
;; stack pointer
lea ebx, [esp]
;;offset to the successor context pointer
mov eax, sizeof_size_t
mov ecx, DWORD [esp]
mul ecx
add ebx, eax
add ebx, 4
;; successor context pointer
mov eax, [ebx]
mov [esp + 4], eax
;;Shouldn't return
jmp setcontext
|
source/pools/s-spsuun.adb | ytomino/drake | 33 | 355 | package body System.Storage_Pools.Subpools.Unbounded is
type Unbounded_Subpool_Access is access all Unbounded_Subpool;
-- implementation
overriding function Create_Subpool (
Pool : in out Unbounded_Pool_With_Subpools)
return not null Subpool_Handle
is
Subpool : constant not null Unbounded_Subpool_Access :=
new Unbounded_Subpool;
begin
Unbounded_Allocators.Initialize (Subpool.Allocator);
declare
Result : constant not null Subpool_Handle :=
Subpool_Handle (Subpool);
begin
Set_Pool_Of_Subpool (Result, Pool);
return Result;
end;
end Create_Subpool;
overriding procedure Allocate_From_Subpool (
Pool : in out Unbounded_Pool_With_Subpools;
Storage_Address : out Address;
Size_In_Storage_Elements : Storage_Elements.Storage_Count;
Alignment : Storage_Elements.Storage_Count;
Subpool : not null Subpool_Handle)
is
pragma Unreferenced (Pool);
begin
Unbounded_Allocators.Allocate (
Unbounded_Subpool_Access (Subpool).Allocator,
Storage_Address => Storage_Address,
Size_In_Storage_Elements => Size_In_Storage_Elements,
Alignment => Alignment);
end Allocate_From_Subpool;
overriding procedure Deallocate_Subpool (
Pool : in out Unbounded_Pool_With_Subpools;
Subpool : in out Subpool_Handle)
is
pragma Unreferenced (Pool);
begin
Unbounded_Allocators.Finalize (
Unbounded_Subpool_Access (Subpool).Allocator);
end Deallocate_Subpool;
overriding procedure Deallocate (
Pool : in out Unbounded_Pool_With_Subpools;
Storage_Address : Address;
Size_In_Storage_Elements : Storage_Elements.Storage_Count;
Alignment : Storage_Elements.Storage_Count)
is
pragma Unreferenced (Pool);
begin
Unbounded_Allocators.Deallocate (
Unbounded_Allocators.Allocator_Of (Storage_Address),
Storage_Address => Storage_Address,
Size_In_Storage_Elements => Size_In_Storage_Elements,
Alignment => Alignment);
end Deallocate;
end System.Storage_Pools.Subpools.Unbounded;
|
start/tick/runsource.applescript | Object-ify/database | 0 | 253 | # runs kdb+ real time demo
# assumes install in default location, otherwise change Q, T
# Terminal|Preferences|New tabs open with must be set to "Default Settings"
global Q, R, T
set R to ""
tell application "Finder" to if exists "/opt/local/bin/rlwrap" as POSIX file then set R to "rlwrap "
set Q to R & "~/q/m32/q"
set T to "~/q/start/tick/"
on newdb(name, port)
newtab(name, Q & " " & T & "cx.q " & name & " -p " & (port as text))
end newdb
on newtab(name, cmd)
tell application "System Events" to tell process "Terminal.app" to keystroke "t" using command down
tell application "Terminal" to do script cmd in front window
setname(name)
delay (0.5)
end newtab
on setname(name)
tell front window of application "Terminal"
tell selected tab
set title displays device name to false
set title displays file name to false
set title displays shell path to false
set title displays window size to false
set title displays custom title to true
set custom title to name
end tell
end tell
end setname
on netstat()
do shell script "netstat -an | grep -i listen | grep 5010"
end netstat
on hasticker()
try
netstat()
display dialog "Tickerplant already running"
return true
end try
return false
end hasticker
on wait4ticker()
repeat 20 times
try
delay 0.1
netstat()
return true
end try
end repeat
display dialog "Could not start tickerplant"
return false
end wait4ticker
tell application "Terminal"
activate
if (true = my hasticker()) then return
do script "cd " & T & "; " & Q & " " & T & "/tick.q -p 5010"
delay (0.5)
if (false = my wait4ticker()) then return
set number of rows of front window to 30
set number of columns of front window to 100
my newtab("rdb", "cd " & T & "; " & Q & " " & T & "/tick/r.q -p 5011")
my newdb("hlcv", 5014)
my newdb("last", 5015)
my newdb("tq", 5016)
my newdb("vwap", 5017)
my newdb("show", 0)
my newtab("feed", Q & " " & T & "feed.q localhost:5010 -t 507")
set selected of tab 1 of front window to true
my setname("ticker")
set selected of tab 2 of front window to true
end tell
|
source/oasis/program-elements-raise_statements.ads | reznikmm/gela | 0 | 20889 | <reponame>reznikmm/gela
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Statements;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
package Program.Elements.Raise_Statements is
pragma Pure (Program.Elements.Raise_Statements);
type Raise_Statement is
limited interface and Program.Elements.Statements.Statement;
type Raise_Statement_Access is access all Raise_Statement'Class
with Storage_Size => 0;
not overriding function Raised_Exception
(Self : Raise_Statement)
return Program.Elements.Expressions.Expression_Access is abstract;
not overriding function Associated_Message
(Self : Raise_Statement)
return Program.Elements.Expressions.Expression_Access is abstract;
type Raise_Statement_Text is limited interface;
type Raise_Statement_Text_Access is access all Raise_Statement_Text'Class
with Storage_Size => 0;
not overriding function To_Raise_Statement_Text
(Self : in out Raise_Statement)
return Raise_Statement_Text_Access is abstract;
not overriding function Raise_Token
(Self : Raise_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function With_Token
(Self : Raise_Statement_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Raise_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Raise_Statements;
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_5328_1274.asm | ljhsiun2/medusa | 9 | 97485 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x4fd1, %rsi
lea addresses_WT_ht+0x8ab1, %rdi
nop
nop
nop
nop
nop
and $5825, %r8
mov $39, %rcx
rep movsw
nop
nop
sub $13662, %rax
lea addresses_normal_ht+0xd2b1, %rsi
lea addresses_WT_ht+0x98b1, %rdi
nop
nop
nop
nop
nop
dec %r11
mov $12, %rcx
rep movsw
nop
nop
sub %rcx, %rcx
lea addresses_UC_ht+0x1ab1, %rdi
nop
xor %r9, %r9
mov $0x6162636465666768, %rcx
movq %rcx, (%rdi)
nop
nop
nop
nop
dec %r8
lea addresses_A_ht+0x1b3f1, %rcx
nop
dec %r8
vmovups (%rcx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rsi
nop
nop
nop
nop
and $33440, %r8
lea addresses_normal_ht+0x1e4b1, %rsi
lea addresses_D_ht+0x23b1, %rdi
nop
nop
sub $49757, %r9
mov $24, %rcx
rep movsw
nop
nop
cmp $44055, %r9
lea addresses_normal_ht+0x176b1, %r9
nop
nop
nop
nop
add $23762, %r11
movb $0x61, (%r9)
cmp $44730, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r8
push %r9
push %rax
push %rbp
push %rbx
push %rdx
// Store
lea addresses_PSE+0xfeb1, %rbp
clflush (%rbp)
nop
nop
nop
inc %r8
movl $0x51525354, (%rbp)
nop
nop
add %r8, %r8
// Store
lea addresses_UC+0xfb6f, %rbx
nop
nop
add %rdx, %rdx
movl $0x51525354, (%rbx)
nop
nop
sub $36909, %r8
// Faulty Load
lea addresses_RW+0x82b1, %rbp
nop
and %rax, %rax
mov (%rbp), %edx
lea oracles, %rax
and $0xff, %rdx
shlq $12, %rdx
mov (%rax,%rdx,1), %rdx
pop %rdx
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': True}}
{'32': 5328}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
gfx/pokemon/weepinbell/anim_idle.asm | Dev727/ancientplatinum | 28 | 81753 | setrepeat 2
frame 0, 07
frame 3, 07
dorepeat 1
endanim
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_818.asm | ljhsiun2/medusa | 9 | 14453 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x14031, %rsi
lea addresses_A_ht+0x3ab1, %rdi
nop
nop
nop
nop
xor $6806, %r15
mov $99, %rcx
rep movsq
nop
sub $5182, %rbp
lea addresses_UC_ht+0x8a31, %r15
nop
nop
nop
nop
cmp $60538, %rdi
mov (%r15), %cx
inc %rcx
lea addresses_normal_ht+0x2e11, %rbx
nop
nop
add %r14, %r14
mov (%rbx), %ebp
nop
nop
nop
nop
and $61556, %rsi
lea addresses_D_ht+0x12e31, %r15
nop
nop
nop
nop
nop
inc %rdi
movl $0x61626364, (%r15)
nop
nop
nop
nop
xor $25144, %rcx
lea addresses_WT_ht+0x12a31, %rcx
clflush (%rcx)
nop
nop
nop
nop
add $18355, %rsi
movb $0x61, (%rcx)
sub $29703, %rbp
lea addresses_A_ht+0x3f31, %rbp
nop
nop
nop
nop
and $59041, %r14
mov (%rbp), %rcx
nop
nop
and %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %r9
push %rax
push %rcx
// Load
mov $0x581, %r9
nop
nop
nop
dec %r8
mov (%r9), %r13d
nop
nop
nop
nop
nop
sub $43357, %rcx
// Load
lea addresses_US+0x7531, %r13
nop
nop
nop
cmp $53021, %rcx
movups (%r13), %xmm6
vpextrq $0, %xmm6, %r8
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %r9
nop
nop
nop
nop
cmp %r9, %r9
// Faulty Load
lea addresses_WT+0x1b231, %rcx
nop
nop
nop
cmp $22879, %rax
movups (%rcx), %xmm7
vpextrq $0, %xmm7, %r13
lea oracles, %r9
and $0xff, %r13
shlq $12, %r13
mov (%r9,%r13,1), %r13
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 1, 'type': 'addresses_WT', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_P', 'congruent': 4}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_US', 'congruent': 8}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 11}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 5}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 10}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 6}}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_1636.asm | ljhsiun2/medusa | 9 | 90370 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %rax
push %rdi
push %rdx
lea addresses_WT_ht+0x7b7d, %rdx
nop
and %r11, %r11
mov $0x6162636465666768, %rdi
movq %rdi, %xmm2
movups %xmm2, (%rdx)
nop
nop
nop
nop
add $42276, %rax
lea addresses_normal_ht+0x1e585, %rdi
nop
nop
nop
nop
cmp $24394, %r15
mov (%rdi), %ax
nop
nop
xor %r11, %r11
pop %rdx
pop %rdi
pop %rax
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r15
push %rbp
push %rcx
push %rdi
// Load
lea addresses_US+0x14f3d, %rbp
nop
xor $60327, %r11
movups (%rbp), %xmm1
vpextrq $0, %xmm1, %rcx
add $21478, %r15
// Faulty Load
lea addresses_D+0xf7d, %r12
nop
add $3125, %r13
movb (%r12), %cl
lea oracles, %rbp
and $0xff, %rcx
shlq $12, %rcx
mov (%rbp,%rcx,1), %rcx
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_US', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
examples/callret.asm | lnsp/govm | 2 | 11867 | <reponame>lnsp/govm<filename>examples/callret.asm<gh_stars>1-10
; a script testing calling and returning
JMP main
add:
ADD AX BX
RET
main:
MOV 3 AX
MOV 4 BX
CALL add
HLT
|
src/windows/l10n-langinfo.ads | VitalijBondarenko/AdaNLS | 0 | 24992 | <reponame>VitalijBondarenko/AdaNLS
------------------------------------------------------------------------------
-- --
-- Copyright (c) 2014-2016 <NAME> <<EMAIL>> --
-- --
------------------------------------------------------------------------------
-- --
-- The MIT License (MIT) --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, sublicense, and/or sell copies of the Software, and to --
-- permit persons to whom the Software is furnished to do so, subject to --
-- the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY --
-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, --
-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE --
-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
------------------------------------------------------------------------------
-- X/Open’s nl_langinfo.
with Interfaces; use Interfaces;
package L10n.Langinfo is
type Locale_Item is
(RADIXCHAR,
-- Radix character (decimal point).
-- The same as the value returned by Localeconv in the Decimal_Point
-- element of the Lconv_Record.
THOUSEP,
-- Separator for thousands.
-- The same as the value returned by Localeconv in the Thousands_Sep
-- element of the Lconv_Record.
CRNCYSTR,
-- Local currency symbol, preceded by '-' if the symbol should appear
-- before the value, '+' if the symbol should appear after the value,
-- or '.' if the symbol should replace the radix character. If the local
-- currency symbol is the empty string, implementations may return the
-- empty string.
D_FMT,
-- Value can be used as a format string for represent date in a
-- locale-specific way.
AM_STR,
PM_STR,
-- Strings with appropriate ante-meridiem/post-meridiem affix.
-- NOTE that in locales which do not use this time representation these
-- strings might be empty, in which case the am/pm format cannot be
-- used at all.
DAY_1,
DAY_2,
DAY_3,
DAY_4,
DAY_5,
DAY_6,
DAY_7,
-- DAY_{1-7} is full weekday names.
-- DAY_1 corresponds to Sunday.
ABDAY_1,
ABDAY_2,
ABDAY_3,
ABDAY_4,
ABDAY_5,
ABDAY_6,
ABDAY_7,
-- ABDAY_{1-7} is abbreviated weekday names.
-- ABDAY_1 corresponds to Sunday.
MON_1,
MON_2,
MON_3,
MON_4,
MON_5,
MON_6,
MON_7,
MON_8,
MON_9,
MON_10,
MON_11,
MON_12,
-- MON_{1-12} is full month names.
-- MON_1 corresponds to January.
ABMON_1,
ABMON_2,
ABMON_3,
ABMON_4,
ABMON_5,
ABMON_6,
ABMON_7,
ABMON_8,
ABMON_9,
ABMON_10,
ABMON_11,
ABMON_12,
-- ABMON_{1-12} is abbreviated month names.
-- ABMON_1 corresponds to January.
T_FMT,
-- Value can be used as a format string for represent time in a
-- locale-specific way.
CODESET,
-- String with the name of the coded character set used in the selected
-- locale.
D_T_FMT,
-- Value can be used as a format string for represent time and date in
-- a locale-specific way.
T_FMT_AMPM,
-- Value can be used as a format string for represent time in the
-- 12-hour clock format with AM_STR and PM_STR.
-- NOTE that if the am/pm format does not make any sense for the
-- selected locale, the return value might be the same as the one for
-- T_FMT.
ERA,
-- Value represents the era used in the current locale. Most locales do
-- not define this value. Normally it should not be necessary to use
-- this value directly.
ERA_D_FMT,
-- Value can be used as a format string for represent a date in a
-- locale-specific era-based way.
ALT_DIGITS,
-- Value is a representation of up to 100 values used to represent the
-- values 0 to 99. As for ERA this value is not intended to be used
-- directly.
ERA_D_T_FMT,
-- Value can be used as a format string for represent dates and times in
-- a locale-specific era-based way.
ERA_T_FMT,
-- Value can be used as a format string for represent time in a
-- locale-specific era-based way.
YESEXPR,
-- Regular expression which can be used to recognize a positive response
-- to a yes/no question.
NOEXPR
-- Regular expression which can be used to recognize a negative response
-- to a yes/no question.
);
pragma Convention (C, Locale_Item);
-- Enumeration of locale items that can be queried with 'Nl_Langinfo'.
function Nl_Langinfo (Item : Locale_Item) return String;
-- The function shall return a string containing information relevant to
-- the particular language or cultural area defined in the current locale.
private
LOCALE_SDECIMAL : constant := 16#000e#;
LOCALE_STHOUSAND : constant := 16#000f#;
LOCALE_SGROUPING : constant := 16#0010#;
LOCALE_SCURRENCY : constant := 16#0014#;
LOCALE_SMONDECIMALSEP : constant := 16#0016#;
LOCALE_SMONTHOUSANDSEP : constant := 16#0017#;
LOCALE_SMONGROUPING : constant := 16#0018#;
LOCALE_SDATE : constant := 16#001d#;
LOCALE_STIME : constant := 16#001e#;
LOCALE_SSHORTDATE : constant := 16#001f#;
LOCALE_SLONGDATE : constant := 16#0020#;
LOCALE_S1159 : constant := 16#0028#;
LOCALE_S2359 : constant := 16#0029#;
LOCALE_SDAYNAME1 : constant := 16#002a#;
LOCALE_SDAYNAME2 : constant := 16#002b#;
LOCALE_SDAYNAME3 : constant := 16#002c#;
LOCALE_SDAYNAME4 : constant := 16#002d#;
LOCALE_SDAYNAME5 : constant := 16#002e#;
LOCALE_SDAYNAME6 : constant := 16#002f#;
LOCALE_SDAYNAME7 : constant := 16#0030#;
LOCALE_SABBREVDAYNAME1 : constant := 16#0031#;
LOCALE_SABBREVDAYNAME2 : constant := 16#0032#;
LOCALE_SABBREVDAYNAME3 : constant := 16#0033#;
LOCALE_SABBREVDAYNAME4 : constant := 16#0034#;
LOCALE_SABBREVDAYNAME5 : constant := 16#0035#;
LOCALE_SABBREVDAYNAME6 : constant := 16#0036#;
LOCALE_SABBREVDAYNAME7 : constant := 16#0037#;
LOCALE_SMONTHNAME1 : constant := 16#0038#;
LOCALE_SMONTHNAME2 : constant := 16#0039#;
LOCALE_SMONTHNAME3 : constant := 16#003a#;
LOCALE_SMONTHNAME4 : constant := 16#003b#;
LOCALE_SMONTHNAME5 : constant := 16#003c#;
LOCALE_SMONTHNAME6 : constant := 16#003d#;
LOCALE_SMONTHNAME7 : constant := 16#003e#;
LOCALE_SMONTHNAME8 : constant := 16#003f#;
LOCALE_SMONTHNAME9 : constant := 16#0040#;
LOCALE_SMONTHNAME10 : constant := 16#0041#;
LOCALE_SMONTHNAME11 : constant := 16#0042#;
LOCALE_SMONTHNAME12 : constant := 16#0043#;
LOCALE_SABBREVMONTHNAME1 : constant := 16#0044#;
LOCALE_SABBREVMONTHNAME2 : constant := 16#0045#;
LOCALE_SABBREVMONTHNAME3 : constant := 16#0046#;
LOCALE_SABBREVMONTHNAME4 : constant := 16#0047#;
LOCALE_SABBREVMONTHNAME5 : constant := 16#0048#;
LOCALE_SABBREVMONTHNAME6 : constant := 16#0049#;
LOCALE_SABBREVMONTHNAME7 : constant := 16#004a#;
LOCALE_SABBREVMONTHNAME8 : constant := 16#004b#;
LOCALE_SABBREVMONTHNAME9 : constant := 16#004c#;
LOCALE_SABBREVMONTHNAME10 : constant := 16#004d#;
LOCALE_SABBREVMONTHNAME11 : constant := 16#004e#;
LOCALE_SABBREVMONTHNAME12 : constant := 16#004f#;
LOCALE_STIMEFORMAT : constant := 16#1003#;
LOCALE_IDEFAULTANSICODEPAGE : constant := 16#1004#;
for Locale_Item use
(RADIXCHAR => LOCALE_SDECIMAL,
THOUSEP => LOCALE_STHOUSAND,
CRNCYSTR => LOCALE_SCURRENCY,
D_FMT => LOCALE_SSHORTDATE,
AM_STR => LOCALE_S1159,
PM_STR => LOCALE_S2359,
DAY_1 => LOCALE_SDAYNAME1,
DAY_2 => LOCALE_SDAYNAME2,
DAY_3 => LOCALE_SDAYNAME3,
DAY_4 => LOCALE_SDAYNAME4,
DAY_5 => LOCALE_SDAYNAME5,
DAY_6 => LOCALE_SDAYNAME6,
DAY_7 => LOCALE_SDAYNAME7,
ABDAY_1 => LOCALE_SABBREVDAYNAME1,
ABDAY_2 => LOCALE_SABBREVDAYNAME2,
ABDAY_3 => LOCALE_SABBREVDAYNAME3,
ABDAY_4 => LOCALE_SABBREVDAYNAME4,
ABDAY_5 => LOCALE_SABBREVDAYNAME5,
ABDAY_6 => LOCALE_SABBREVDAYNAME6,
ABDAY_7 => LOCALE_SABBREVDAYNAME7,
MON_1 => LOCALE_SMONTHNAME1,
MON_2 => LOCALE_SMONTHNAME2,
MON_3 => LOCALE_SMONTHNAME3,
MON_4 => LOCALE_SMONTHNAME4,
MON_5 => LOCALE_SMONTHNAME5,
MON_6 => LOCALE_SMONTHNAME6,
MON_7 => LOCALE_SMONTHNAME7,
MON_8 => LOCALE_SMONTHNAME8,
MON_9 => LOCALE_SMONTHNAME9,
MON_10 => LOCALE_SMONTHNAME10,
MON_11 => LOCALE_SMONTHNAME11,
MON_12 => LOCALE_SMONTHNAME12,
ABMON_1 => LOCALE_SABBREVMONTHNAME1,
ABMON_2 => LOCALE_SABBREVMONTHNAME2,
ABMON_3 => LOCALE_SABBREVMONTHNAME3,
ABMON_4 => LOCALE_SABBREVMONTHNAME4,
ABMON_5 => LOCALE_SABBREVMONTHNAME5,
ABMON_6 => LOCALE_SABBREVMONTHNAME6,
ABMON_7 => LOCALE_SABBREVMONTHNAME7,
ABMON_8 => LOCALE_SABBREVMONTHNAME8,
ABMON_9 => LOCALE_SABBREVMONTHNAME9,
ABMON_10 => LOCALE_SABBREVMONTHNAME10,
ABMON_11 => LOCALE_SABBREVMONTHNAME11,
ABMON_12 => LOCALE_SABBREVMONTHNAME12,
T_FMT => LOCALE_STIMEFORMAT,
CODESET => LOCALE_IDEFAULTANSICODEPAGE,
D_T_FMT => 16#20028#,
T_FMT_AMPM => 16#2002B#,
ERA => 16#2002C#,
ERA_D_FMT => 16#2002E#,
ALT_DIGITS => 16#2002F#,
ERA_D_T_FMT => 16#20030#,
ERA_T_FMT => 16#20031#,
YESEXPR => 16#50000#,
NOEXPR => 16#50001#);
end L10n.Langinfo;
|
pages-to-keynote.applescript | ingshtrom/mac-automation | 0 | 1825 | global filepath, charactersPerPage, currentText, keynoteDocument, currentTextStyles
set filepath to ""
set charactersPerPage to 175 -- CHAR_PER_LINE * <the_number_of_lines_that_fit_per_slide>
set currentText to ""
set currentTextStyles to {}
property fontSize : 95
property charSpaceCount : 10
property CHAR_PER_LINE : 35
property TEXT_FONT : "Arial Bold"
property keynoteTheme : "Black"
-- copied from somewhere. don't remember
on replaceChars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replaceChars
on addLineBreaksToCurrentText()
set updatedText to ""
set updatedStyles to {}
set shouldBreakNextSpace to false
repeat with i from 1 to length of currentText
set curChar to character i of currentText
if i mod CHAR_PER_LINE is equal to 0 then
set shouldBreakNextSpace to true
end if
if shouldBreakNextSpace is equal to true and curChar is equal to " " then
set updatedText to (updatedText & curChar & return & return)
set updatedStyles to updatedStyles & {item i of currentTextStyles} & {item i of currentTextStyles} & {item i of currentTextStyles}
set shouldBreakNextSpace to false
else
set updatedText to (updatedText & curChar)
set updatedStyles to updatedStyles & {item i of currentTextStyles}
end if
end repeat
set currentText to updatedText
set currentTextStyles to updatedStyles
end addLineBreaksToCurrentText
on flushPage()
log "FLUSHING TO KEYNOTE: " & currentText & ". Count: " & (length of currentText)
-- create new slide at the end of the document
tell application "Keynote"
tell keynoteDocument
set newSlide to make new slide with properties {base slide:master slide "Blank"} at the end of slides
tell newSlide
my addLineBreaksToCurrentText()
set slideText to make new text item with properties {object text:currentText}
set the size of object text of slideText to fontSize
set the font of object text of slideText to TEXT_FONT
repeat with i from 1 to length of currentText
set currentTextItemStyle to item i of currentTextStyles
tell slideText
-- set the font of character i of object text to (the font of currentTextItemStyle)
-- since we use a black theme, the text needs to be readible
if the color of currentTextItemStyle is not {0, 0, 0} then
set the color of character i of object text to (the color of currentTextItemStyle)
end if
end tell
end repeat
tell application "System Events"
repeat with i from 1 to 10
keystroke "]" using {command down, option down}
end repeat
end tell
end tell
end tell
end tell
-- delete any current default items in the slide
-- add currentText to the slide
set currentText to ""
set currentTextStyles to {}
end flushPage
on createNewKeynoteDocument()
tell application "Keynote"
activate
-- GET THE THEME NAMES
set the themeNames to the name of every theme
log "Available Keynote themes: " & themeNames
log "My theme: " & keynoteTheme
set keynoteDocument to make new document with properties {document theme:theme keynoteTheme, width:1920, height:1080}
tell keynoteDocument
set the base slide of the first slide to master slide "Title & Subtitle"
tell the first slide
set the object text of the default title item to "Generated on " & (current date)
end tell
end tell
end tell
end createNewKeynoteDocument
on mainFn(location)
try
set filepath to location
createNewKeynoteDocument()
set thisPOSIXPath to (the POSIX path of filepath)
log "FILE TO OPEN: " & thisPOSIXPath
do shell script "open '" & thisPOSIXPath & "'"
delay (10)
tell application "Pages"
tell the front document
tell the body text
set charRefs to a reference to every character
-- log "" & (the color of the first word of the first paragraph)
-- repeat with paragraphItem in bodyTextByParagraph
-- log "para " & (the properties of paragraphItem)
repeat with charRef in charRefs
set charItem to (contents of charRef)
set potentialNewCharacterCount to (length of currentText) + 1
if potentialNewCharacterCount is greater than or equal to charactersPerPage and charItem is equal to " " then
my flushPage()
end if
set currentText to currentText & charItem
set currentTextStyles to currentTextStyles & {charRef}
end repeat
-- end repeat
my flushPage()
end tell
end tell
quit
end tell
tell application "Keynote"
log "User is being prompted to save the keynote somewhere..."
save front document
quit
end tell
on error errStr number errorNumber
quit application "Pages" without saving
quit application "Keynote" without saving
error errStr number errorNumber
end try
end mainFn
on open droppedItems
repeat with a from 1 to length of droppedItems
set theCurrentDroppedItem to item a of droppedItems
log "DROPPED ITEM: " & theCurrentDroppedItem
my mainFn(theCurrentDroppedItem)
end repeat
end open
display dialog "Please, choose a Pages file to convert to Keynote. " & return & return & "If you need to convert a Microsoft Word document, then open it in Pages and save as a pages file." buttons {"Cancel", "Continue"} default button "Continue" cancel button "Cancel"
open {choose file}
|
programs/oeis/186/A186147.asm | jmorken/loda | 1 | 175008 | <gh_stars>1-10
; A186147: Rank of n^3 when {i^2: i>=1} and {j^3: j>=1} are jointly ranked with i^2 after j^3 when i^2=j^3. Complement of A135674.
; 1,4,8,11,16,20,25,30,35,41,47,53,59,66,73,79,87,94,101,109,117,125,133,141,149,158,167,176,185,194,203,213,222,232,242,251,262,272,282,292,303,314,324,335,346,357,369,380,391,403,415,426,438,450,462,475,487,499,512,524,537,550,563,575,589,602,615,628,642,655,669,682,696,710,724,738,752,766,781,795,809,824,839,853,868,883,898,913
mov $3,$0
mov $8,2
lpb $8
sub $8,1
add $0,$8
sub $0,1
mov $2,$0
add $2,1
lpb $2
mov $5,2
lpb $5
pow $2,3
div $5,10
lpe
mov $6,$2
mov $2,1
lpb $6
add $5,2
mov $4,$5
add $6,$2
trn $6,$5
lpe
lpe
mov $7,$8
lpb $7
mov $1,$4
sub $7,1
lpe
lpe
trn $1,2
div $1,2
add $1,1
add $1,$3
|
programs/oeis/166/A166876.asm | jmorken/loda | 1 | 103951 | <filename>programs/oeis/166/A166876.asm
; A166876: a(n) = a(n-1) + Fibonacci(n), a(1)=1983.
; 1983,1984,1986,1989,1994,2002,2015,2036,2070,2125,2214,2358,2591,2968,3578,4565,6162,8746,12927,19692,30638,48349,77006,123374,198399,319792,516210,834021,1348250,2180290,3526559,5704868,9229446,14932333,24159798,39090150,63247967,102336136,165582122,267916277,433496418,701410714,1134905151,1836313884,2971217054,4807528957,7778744030,12586271006,20365013055,32951282080,53316293154,86267573253,139583864426,225851435698,365435298143,591286731860,956722028022,1548008757901,2504730783942,4052739539862,6557470321823,10610209859704,17167680179546,27777890037269,44945570214834,72723460250122,117669030462975,190392490711116,308061521172110,498454011881245,806515533051374,1304969544930638,2111485077980031,3416454622908688,5527939700886738,8944394323793445
mov $1,2
mov $2,1
lpb $0
sub $0,1
mov $3,$2
mov $2,$1
add $1,$3
lpe
add $1,1981
|
programs/oeis/104/A104763.asm | karttu/loda | 1 | 16806 | ; A104763: Triangle read by rows: Fibonacci(1), Fibonacci(2), ..., Fibonacci(n) in row n.
; 1,1,1,1,1,2,1,1,2,3,1,1,2,3,5,1,1,2,3,5,8,1,1,2,3,5,8,13,1,1,2,3,5,8,13,21,1,1,2,3,5,8,13,21,34,1,1,2,3,5,8,13,21,34,55,1,1,2,3,5,8,13,21,34,55,89,1,1,2,3,5,8,13,21,34,55,89,144,1,1,2,3,5,8,13,21,34,55,89,144,233,1,1,2,3,5,8,13,21,34,55,89,144,233,377,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181
cal $0,134868 ; A103451 * A002260.
cal $0,22356 ; Fibonacci sequence beginning 0, 22.
mov $1,$0
sub $1,22
div $1,22
add $1,1
|
programs/oeis/240/A240506.asm | karttu/loda | 0 | 166746 | <gh_stars>0
; A240506: Number of length-n gap-free words on {1,2,3}.
; 1,3,7,21,67,213,667,2061,6307,19173,58027,175101,527347,1586133,4766587,14316141,42981187,129009093,387158347,1161737181,3485735827,10458256053,31376865307,94134790221,282412759267,847255055013,2541798719467,7625463267261,22876524019507,68629840493973,205890058352827,617671248800301,1853015893884547,5559051976620933
mov $1,1
mov $2,1
lpb $0,1
sub $0,1
mul $1,3
mul $2,2
lpe
trn $2,2
sub $1,$2
|
Task/Chinese-remainder-theorem/Ada/chinese-remainder-theorem.ada | mullikine/RosettaCodeData | 1 | 25799 | with Ada.Text_IO, Mod_Inv;
procedure Chin_Rema is
N: array(Positive range <>) of Positive := (3, 5, 7);
A: array(Positive range <>) of Positive := (2, 3, 2);
Tmp: Positive;
Prod: Positive := 1;
Sum: Natural := 0;
begin
for I in N'Range loop
Prod := Prod * N(I);
end loop;
for I in A'Range loop
Tmp := Prod / N(I);
Sum := Sum + A(I) * Mod_Inv.Inverse(Tmp, N(I)) * Tmp;
end loop;
Ada.Text_IO.Put_Line(Integer'Image(Sum mod Prod));
end Chin_Rema;
|
test/asset/agda-stdlib-1.0/Function/Endomorphism/Setoid.agda | omega12345/agda-mode | 5 | 7843 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Endomorphisms on a Setoid
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary
module Function.Endomorphism.Setoid {c e} (S : Setoid c e) where
open import Agda.Builtin.Equality
open import Algebra
open import Algebra.Structures
open import Algebra.Morphism; open Definitions
open import Function.Equality
open import Data.Nat.Base using (ℕ; _+_); open ℕ
open import Data.Nat.Properties
open import Data.Product
import Relation.Binary.Indexed.Heterogeneous.Construct.Trivial as Trivial
private
module E = Setoid (setoid S (Trivial.indexedSetoid S))
open E hiding (refl)
------------------------------------------------------------------------
-- Basic type and functions
Endo : Set _
Endo = S ⟶ S
_^_ : Endo → ℕ → Endo
f ^ zero = id
f ^ suc n = f ∘ (f ^ n)
^-cong₂ : ∀ f → (f ^_) Preserves _≡_ ⟶ _≈_
^-cong₂ f {n} refl = cong (f ^ n)
^-homo : ∀ f → Homomorphic₂ ℕ Endo _≈_ (f ^_) _+_ _∘_
^-homo f zero n x≈y = cong (f ^ n) x≈y
^-homo f (suc m) n x≈y = cong f (^-homo f m n x≈y)
------------------------------------------------------------------------
-- Structures
∘-isMagma : IsMagma _≈_ _∘_
∘-isMagma = record
{ isEquivalence = isEquivalence
; ∙-cong = λ g f x → g (f x)
}
∘-magma : Magma _ _
∘-magma = record { isMagma = ∘-isMagma }
∘-isSemigroup : IsSemigroup _≈_ _∘_
∘-isSemigroup = record
{ isMagma = ∘-isMagma
; assoc = λ h g f x≈y → cong h (cong g (cong f x≈y))
}
∘-semigroup : Semigroup _ _
∘-semigroup = record { isSemigroup = ∘-isSemigroup }
∘-id-isMonoid : IsMonoid _≈_ _∘_ id
∘-id-isMonoid = record
{ isSemigroup = ∘-isSemigroup
; identity = cong , cong
}
∘-id-monoid : Monoid _ _
∘-id-monoid = record { isMonoid = ∘-id-isMonoid }
------------------------------------------------------------------------
-- Homomorphism
^-isSemigroupMorphism : ∀ f → IsSemigroupMorphism +-semigroup ∘-semigroup (f ^_)
^-isSemigroupMorphism f = record
{ ⟦⟧-cong = ^-cong₂ f
; ∙-homo = ^-homo f
}
^-isMonoidMorphism : ∀ f → IsMonoidMorphism +-0-monoid ∘-id-monoid (f ^_)
^-isMonoidMorphism f = record
{ sm-homo = ^-isSemigroupMorphism f
; ε-homo = λ x≈y → x≈y
}
|
alloy4fun_models/trashltl/models/4/Nx3b7usZFBRmDSQG4.als | Kaixi26/org.alloytools.alloy | 0 | 2094 | <gh_stars>0
open main
pred idNx3b7usZFBRmDSQG4_prop5 {
eventually (some f : Trash | f not in File')
}
pred __repair { idNx3b7usZFBRmDSQG4_prop5 }
check __repair { idNx3b7usZFBRmDSQG4_prop5 <=> prop5o } |
tools-src/gnu/gcc/gcc/ada/sem_ch8.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 7650 | <reponame>enfoTek/tomato.linksys.e2000.nvram-mod<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ C H 8 --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Types; use Types;
package Sem_Ch8 is
-----------------------------------
-- Handling extensions of System --
-----------------------------------
-- For targets that define a much larger System package than given in
-- the RM, we use a child package containing additional declarations,
-- which is loaded when needed, and whose entities are conceptually
-- within System itself. The presence of this auxiliary package is
-- controlled with the pragma Extend_System. The following variable
-- holds the entity of the auxiliary package, to simplify the special
-- visibility rules that apply to it.
System_Aux_Id : Entity_Id := Empty;
-----------------
-- Subprograms --
-----------------
procedure Analyze_Exception_Renaming (N : Node_Id);
procedure Analyze_Expanded_Name (N : Node_Id);
procedure Analyze_Generic_Function_Renaming (N : Node_Id);
procedure Analyze_Generic_Package_Renaming (N : Node_Id);
procedure Analyze_Generic_Procedure_Renaming (N : Node_Id);
procedure Analyze_Object_Renaming (N : Node_Id);
procedure Analyze_Package_Renaming (N : Node_Id);
procedure Analyze_Subprogram_Renaming (N : Node_Id);
procedure Analyze_Use_Package (N : Node_Id);
procedure Analyze_Use_Type (N : Node_Id);
function Applicable_Use (Pack_Name : Node_Id) return Boolean;
-- Common code to Use_One_Package and Set_Use, to determine whether
-- use clause must be processed. Pack_Name is an entity name that
-- references the package in question.
procedure End_Scope;
-- Called at end of scope. On exit from blocks and bodies (subprogram,
-- package, task, and protected bodies), the name of the current scope
-- must be removed from the scope stack, and the local entities must be
-- removed from their homonym chains. On exit from record declarations,
-- from package specifications, and from tasks and protected type
-- specifications, more specialized procedures are invoked.
procedure End_Use_Clauses (Clause : Node_Id);
-- Invoked on scope exit, to undo the effect of local use clauses. U is
-- the first Use clause of a scope being exited. This can be the current
-- scope, or some enclosing scopes when building a clean environment to
-- compile an instance body for inlining.
procedure End_Use_Package (N : Node_Id);
procedure End_Use_Type (N : Node_Id);
-- Subsidiaries of End_Use_Clauses. Also called directly for use clauses
-- appearing in context clauses.
procedure Find_Direct_Name (N : Node_Id);
-- Given a direct name (Identifier or Operator_Symbol), this routine
-- scans the homonym chain for the name searching for corresponding
-- visible entities to find the referenced entity (or in the case of
-- overloading), entities. On return, the Entity, and Etype fields
-- are set. In the non-overloaded case, these are the correct final
-- entries. In the overloaded case, Is_Overloaded is set, Etype and
-- Entity refer to an arbitrary element of the overloads set, and
-- an appropriate list of entries has been made in the overload
-- interpretation table (to be disambiguated in the resolve phase).
procedure Find_Expanded_Name (N : Node_Id);
-- Selected component is known to be expanded name. Verify legality
-- of selector given the scope denoted by prefix.
procedure Find_Selected_Component (N : Node_Id);
-- Resolve various cases of selected components, recognize expanded names
procedure Find_Type (N : Node_Id);
-- Perform name resolution, and verify that the name found is that of a
-- type. On return the Entity and Etype fields of the node N are set
-- appropriately. If it is an incomplete type whose full declaration has
-- been seen, return the entity in the full declaration. Similarly, if
-- the type is private, it has receivd a full declaration, and we are
-- in the private part or body of the package, return the full
-- declaration as well. Special processing for Class types as well.
function Get_Full_View (T_Name : Entity_Id) return Entity_Id;
-- If T_Name is an incomplete type and the full declaration has been
-- seen, or is the name of a class_wide type whose root is incomplete.
-- return the corresponding full declaration.
function Has_Implicit_Operator (N : Node_Id) return Boolean;
-- N is an expanded name whose selector is an operator name (eg P."+").
-- A declarative part contains an implicit declaration of an operator
-- if it has a declaration of a type to which one of the predefined
-- operators apply. The existence of this routine is an artifact of
-- our implementation: a more straightforward but more space-consuming
-- choice would be to make all inherited operators explicit in the
-- symbol table.
procedure Initialize;
-- Initializes data structures used for visibility analysis. Must be
-- called before analyzing each new main source program.
procedure Install_Use_Clauses (Clause : Node_Id);
-- applies the use clauses appearing in a given declarative part,
-- when the corresponding scope has been placed back on the scope
-- stack after unstacking to compile a different context (subunit or
-- parent of generic body).
function In_Open_Scopes (S : Entity_Id) return Boolean;
-- S is the entity of a scope. This function determines if this scope
-- is currently open (i.e. it appears somewhere in the scope stack).
function Is_Appropriate_For_Record (T : Entity_Id) return Boolean;
-- Prefix is appropriate for record if it is of a record type, or
-- an access to such.
function Is_Appropriate_For_Entry_Prefix (T : Entity_Id) return Boolean;
-- True if it is of a task type, a protected type, or else an access
-- to one of these types.
procedure New_Scope (S : Entity_Id);
-- Make new scope stack entry, pushing S, the entity for a scope
-- onto the top of the scope table. The current setting of the scope
-- suppress flags is saved for restoration on exit.
procedure Pop_Scope;
-- Remove top entry from scope stack, restoring the saved setting
-- of the scope suppress flags.
function Present_System_Aux (N : Node_Id := Empty) return Boolean;
-- Return True if the auxiliary system file has been successfully loaded.
-- Otherwise attempt to load it, using the name supplied by a previous
-- Extend_System pragma, and report on the success of the load.
-- If N is present, it is a selected component whose prefix is System,
-- or else a with-clause on system. N is absent when the function is
-- called to find the visibility of implicit operators.
procedure Restore_Scope_Stack;
procedure Save_Scope_Stack;
-- These two procedures are called from Semantics, when a unit U1 is
-- to be compiled in the course of the compilation of another unit U2.
-- This happens whenever Rtsfind is called. U1, the unit retrieved by
-- Rtsfind, must be compiled in its own context, and the current scope
-- stack containing U2 and local scopes must be made unreachable. On
-- return, the contents of the scope stack must be made accessible again.
procedure Use_One_Package (P : Entity_Id; N : Node_Id);
-- Make visible entities declarated in package P potentially use-visible
-- in the current context. Also used in the analysis of subunits, when
-- re-installing use clauses of parent units. N is the use_clause that
-- names P (and possibly other packages).
procedure Use_One_Type (Id : Node_Id; N : Node_Id);
-- Id is the subtype mark from a use type clause. This procedure makes
-- the primitive operators of the type potentially use-visible.
-- N is the Use_Type_Clause that names Id.
procedure Set_Use (L : List_Id);
-- Find use clauses that are declarative items in a package declaration
-- and set the potentially use-visible flags of imported entities before
-- analyzing the corresponding package body.
end Sem_Ch8;
|
oeis/083/A083319.asm | neoneye/loda-programs | 11 | 2090 | ; A083319: 4^n+3^n-2^n.
; Submitted by <NAME>(s3.)
; 1,5,21,83,321,1235,4761,18443,71841,281315,1106601,4369403,17304561,68694995,273202041,1088057963,4337948481,17308878275,69106635081,276039644123,1102997363601,4408504767155,17623562909721,70462878967883
mov $1,3
pow $1,$0
mov $2,2
pow $2,$0
sub $1,$2
pow $2,2
add $2,$1
mov $0,$2
|
Transynther/x86/_processed/US/_st_sm_/i9-9900K_12_0xca_notsx.log_15_1606.asm | ljhsiun2/medusa | 9 | 176324 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r15
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x125db, %rsi
nop
nop
nop
nop
dec %r14
mov (%rsi), %ecx
nop
nop
dec %rax
lea addresses_D_ht+0x1054b, %rsi
lea addresses_WT_ht+0x1617b, %rdi
nop
nop
xor $35836, %r14
mov $87, %rcx
rep movsw
nop
nop
nop
nop
nop
cmp $35369, %r14
lea addresses_A_ht+0x25db, %r12
nop
nop
xor %rdx, %rdx
mov (%r12), %r14w
nop
nop
nop
nop
nop
sub %rdx, %rdx
lea addresses_UC_ht+0x147db, %r12
nop
nop
nop
sub $18255, %rdi
movw $0x6162, (%r12)
nop
nop
and %rax, %rax
lea addresses_D_ht+0x43db, %r14
nop
nop
nop
nop
nop
inc %rsi
movb (%r14), %dl
nop
xor $60033, %rcx
lea addresses_D_ht+0x1a0db, %rsi
lea addresses_normal_ht+0x1c1db, %rdi
nop
nop
inc %r14
mov $57, %rcx
rep movsb
nop
nop
nop
nop
nop
inc %rcx
lea addresses_WT_ht+0x2ddb, %rdi
nop
nop
nop
nop
xor %rcx, %rcx
movups (%rdi), %xmm2
vpextrq $1, %xmm2, %r12
nop
nop
sub $12683, %r12
lea addresses_D_ht+0x175db, %rsi
lea addresses_normal_ht+0x1eedb, %rdi
nop
nop
dec %r15
mov $69, %rcx
rep movsb
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_WC_ht+0x15ddb, %r14
nop
nop
xor $51881, %rcx
movw $0x6162, (%r14)
nop
nop
nop
nop
nop
add %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_D+0x1500b, %rsi
lea addresses_normal+0x45db, %rdi
nop
nop
nop
nop
sub %rax, %rax
mov $115, %rcx
rep movsb
nop
nop
nop
nop
nop
add $32244, %rax
// Store
lea addresses_D+0xc77b, %rcx
nop
nop
nop
nop
nop
cmp %r13, %r13
mov $0x5152535455565758, %rdi
movq %rdi, %xmm2
movups %xmm2, (%rcx)
nop
nop
nop
sub $140, %rdi
// REPMOV
lea addresses_RW+0x119db, %rsi
lea addresses_UC+0x12a67, %rdi
nop
nop
add $28662, %r9
mov $38, %rcx
rep movsl
nop
nop
add $7240, %r12
// Store
lea addresses_RW+0x1bfdb, %rax
xor $14782, %rdi
mov $0x5152535455565758, %r13
movq %r13, %xmm5
vmovups %ymm5, (%rax)
nop
add %rcx, %rcx
// Load
lea addresses_PSE+0xb89b, %r9
nop
nop
nop
nop
nop
inc %rdi
mov (%r9), %r13d
nop
nop
nop
xor %rax, %rax
// Store
lea addresses_US+0x2ddb, %r12
nop
sub %rsi, %rsi
mov $0x5152535455565758, %rbp
movq %rbp, %xmm1
vmovups %ymm1, (%r12)
cmp %r13, %r13
// Store
lea addresses_US+0x18e55, %r12
nop
nop
nop
nop
nop
inc %rax
mov $0x5152535455565758, %r13
movq %r13, %xmm3
movups %xmm3, (%r12)
nop
nop
nop
and %r12, %r12
// Store
lea addresses_WC+0x1aadb, %rax
nop
nop
add $32315, %rdi
mov $0x5152535455565758, %rcx
movq %rcx, (%rax)
nop
nop
nop
sub %r13, %r13
// Store
mov $0xda9090000000c41, %rax
nop
nop
nop
and $23000, %r12
mov $0x5152535455565758, %r9
movq %r9, (%rax)
nop
nop
nop
nop
sub $32514, %r12
// Faulty Load
lea addresses_US+0x2ddb, %r13
nop
nop
nop
nop
nop
xor $38659, %rsi
mov (%r13), %ax
lea oracles, %r13
and $0xff, %rax
shlq $12, %rax
mov (%r13,%rax,1), %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_D'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_normal'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_RW'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_UC'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 5, 'type': 'addresses_D_ht'}, 'dst': {'same': True, 'congruent': 10, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 10}}
{'58': 15}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
src/_test/fixtures/apsepp_scope_debug_test_fixture.ads | thierr26/ada-apsepp | 0 | 15831 | <reponame>thierr26/ada-apsepp
-- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
with Apsepp.Generic_Fixture;
with Apsepp.Debug_Trace_Class.Stub; use Apsepp.Debug_Trace_Class.Stub;
package Apsepp_Scope_Debug_Test_Fixture is
procedure Increment_Scope_Entry_Count;
procedure Increment_Scope_Exit_Count;
type Scope_Debug_Test_Fixture is tagged limited null record;
type Scope_Debug_Test_Fixture_Access
is not null access all Scope_Debug_Test_Fixture;
not overriding
procedure Reset (Obj : Scope_Debug_Test_Fixture);
not overriding
function Scope_Entry_Count (Obj : Scope_Debug_Test_Fixture) return Natural;
not overriding
function Scope_Exit_Count (Obj : Scope_Debug_Test_Fixture) return Natural;
function Allocate return Scope_Debug_Test_Fixture_Access
is (new Scope_Debug_Test_Fixture'(null record));
package Scope_Debug_T_F is new Apsepp.Generic_Fixture
(Fixture_Type => Scope_Debug_Test_Fixture,
Fixture_Type_Access => Scope_Debug_Test_Fixture_Access,
Default_Allocator => Allocate);
function Instance return Scope_Debug_Test_Fixture_Access
renames Scope_Debug_T_F.Instance;
type SDFDT is limited new Debug_Trace_Stub with null record;
overriding
procedure Trace (Obj : in out SDFDT;
Message : String;
Entity_Name : String := "");
end Apsepp_Scope_Debug_Test_Fixture;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/atomic2.adb | best08618/asylo | 7 | 43 | -- { dg-do compile }
procedure Atomic2 is
type Big is array (1..4) of Integer;
type Arr is array (1..10) of Big;
pragma Atomic_Components (Arr); -- { dg-warning "cannot be guaranteed" }
begin
null;
end;
|
orka/src/gl/implementation/gl-objects-programs-uniforms.adb | onox/orka | 52 | 25790 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 <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 GL.API.Uniforms.Singles;
with GL.API.Uniforms.Doubles;
with GL.API.Uniforms.Ints;
with GL.API.Uniforms.UInts;
with GL.Low_Level;
package body GL.Objects.Programs.Uniforms is
function Create_Uniform (Object : Program; Location : Int) return Uniform is
begin
return Uniform'(Program => Object, Location => Location);
end Create_Uniform;
-----------------------------------------------------------------------------
-- Singles --
-----------------------------------------------------------------------------
procedure Set_Single (Location : Uniform; Value : Single) is
begin
API.Uniforms.Singles.Uniform1.Ref
(Location.Program.Reference.GL_Id, Location.Location, Value);
end Set_Single;
procedure Set_Single_Vector (Location : Uniform; Value : Singles.Vector2) is
begin
API.Uniforms.Singles.Uniform2v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_Single_Vector;
procedure Set_Single_Vector (Location : Uniform; Value : Singles.Vector3) is
begin
API.Uniforms.Singles.Uniform3v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_Single_Vector;
procedure Set_Single_Vector (Location : Uniform; Value : Singles.Vector4) is
begin
API.Uniforms.Singles.Uniform4v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_Single_Vector;
procedure Set_Single_Matrix (Location : Uniform; Value : Singles.Matrix4) is
begin
API.Uniforms.Singles.Uniform_Matrix4.Ref
(Location.Program.Reference.GL_Id, Location.Location,
1, Low_Level.False, (1 => Value));
end Set_Single_Matrix;
-----------------------------------------------------------------------------
-- Doubles --
-----------------------------------------------------------------------------
procedure Set_Double (Location : Uniform; Value : Double) is
begin
API.Uniforms.Doubles.Uniform1.Ref
(Location.Program.Reference.GL_Id, Location.Location, Value);
end Set_Double;
procedure Set_Double_Vector (Location : Uniform; Value : Doubles.Vector2) is
begin
API.Uniforms.Doubles.Uniform2v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_Double_Vector;
procedure Set_Double_Vector (Location : Uniform; Value : Doubles.Vector3) is
begin
API.Uniforms.Doubles.Uniform3v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_Double_Vector;
procedure Set_Double_Vector (Location : Uniform; Value : Doubles.Vector4) is
begin
API.Uniforms.Doubles.Uniform4v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_Double_Vector;
procedure Set_Double_Matrix (Location : Uniform; Value : Doubles.Matrix4) is
begin
API.Uniforms.Doubles.Uniform_Matrix4.Ref
(Location.Program.Reference.GL_Id, Location.Location,
1, Low_Level.False, (1 => Value));
end Set_Double_Matrix;
-----------------------------------------------------------------------------
-- Integers --
-----------------------------------------------------------------------------
procedure Set_Int (Location : Uniform; Value : Int) is
begin
API.Uniforms.Ints.Uniform1.Ref
(Location.Program.Reference.GL_Id, Location.Location, Value);
end Set_Int;
procedure Set_Int_Vector (Location : Uniform; Value : Ints.Vector2) is
begin
API.Uniforms.Ints.Uniform2v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_Int_Vector;
procedure Set_Int_Vector (Location : Uniform; Value : Ints.Vector3) is
begin
API.Uniforms.Ints.Uniform3v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_Int_Vector;
procedure Set_Int_Vector (Location : Uniform; Value : Ints.Vector4) is
begin
API.Uniforms.Ints.Uniform4v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_Int_Vector;
-----------------------------------------------------------------------------
-- Unsigned Integers --
-----------------------------------------------------------------------------
procedure Set_UInt (Location : Uniform; Value : UInt) is
begin
API.Uniforms.UInts.Uniform1.Ref
(Location.Program.Reference.GL_Id, Location.Location, Value);
end Set_UInt;
procedure Set_UInt_Vector (Location : Uniform; Value : UInts.Vector2) is
begin
API.Uniforms.UInts.Uniform2v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_UInt_Vector;
procedure Set_UInt_Vector (Location : Uniform; Value : UInts.Vector3) is
begin
API.Uniforms.UInts.Uniform3v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_UInt_Vector;
procedure Set_UInt_Vector (Location : Uniform; Value : UInts.Vector4) is
begin
API.Uniforms.UInts.Uniform4v.Ref
(Location.Program.Reference.GL_Id, Location.Location, 1, (1 => Value));
end Set_UInt_Vector;
end GL.Objects.Programs.Uniforms;
|
oeis/162/A162262.asm | neoneye/loda-programs | 11 | 20292 | ; A162262: a(n) = (2*n^3 + 5*n^2 - 13*n)/2.
; Submitted by <NAME>(s2)
; -3,5,30,78,155,267,420,620,873,1185,1562,2010,2535,3143,3840,4632,5525,6525,7638,8870,10227,11715,13340,15108,17025,19097,21330,23730,26303,29055,31992,35120,38445,41973,45710,49662,53835,58235,62868,67740,72857,78225,83850,89738,95895,102327,109040,116040,123333,130925,138822,147030,155555,164403,173580,183092,192945,203145,213698,224610,235887,247535,259560,271968,284765,297957,311550,325550,339963,354795,370052,385740,401865,418433,435450,452922,470855,489255,508128,527480,547317,567645
mov $1,$0
add $0,5
mul $1,2
add $1,1
bin $1,2
sub $1,2
mul $0,$1
div $0,2
add $0,2
|
src/kernel/boot/boot.asm | dgaur/dx | 0 | 82274 | //
// boot.asm
//
// Assembly logic that starts the kernel initialization process. Kernel
// execution begins in this file.
//
#include "hal/address_space_layout.h"
//
// Do not clear any of the EFLAGS reserved bits
//
#define EFLAGS_RESERVED_BITS 0x2
//
// The base of the stack used by the boot thread
//
#define BOOT_THREAD_STACK_BASE KERNEL_BOOT_THREAD_BASE + \
THREAD_EXECUTION_BLOCK_SIZE
.text
//
// The OS basically begins right here. GRUB loads this code from disk into
// memory and jumps to it. These are the first instructions executed within
// the kernel. At this point here, the OS now has control of the system.
//
.align 4
.global boot_kernel
boot_kernel:
//
// The Multiboot loader (GRUB) guarantees the following pre-conditions:
// EAX = 0x2BADB002 (indicates a Multiboot-compliant loader)
// EBX = physical address of Multiboot info structure
// CS = flat 4GB read/execute code segment
// DS, ES, SS = flat 4GB read/write data segment
// CR0.PE = 1 (processor is in protected mode)
// CR0.PG = 0 (paging is disabled)
// EFLAGS.IF = 0 (interrupts are disabled)
// A20 line = enabled, all physical memory is accessible
//
// All other register contents are undefined or are unreliable. This
// implies that:
// * There is no stack;
// * None of the segment registers may be modified until the GDT
// is reloaded;
// * Interrupts must remain disabled until the IDT is initialized.
//
// A portion of the kernel heap is reserved specifically for this thread
// context, so immediately switch to the preallocated stack space. See
// also thread_manager::initialize_system_threads() and
// hal::read_current_thread()
movl $BOOT_THREAD_STACK_BASE, %esp
// Clear EFLAGS for safety. In particular, this clears the status flags,
// the Direction bit, the I/O privilege level, and a couple of debug flags.
// Interrupts are still disabled.
pushl $EFLAGS_RESERVED_BITS
popf
// Clear the .bss (uninitialized data) section, mainly for safety; this
// zero's any uninitalized data within the kernel image. This assumes
// the .bss section begins and ends on a 32b boundary
movl $KERNEL_BSS_START, %edi
movl $KERNEL_BSS_END, %ecx
subl %edi, %ecx
shr $2, %ecx // sizeof(.bss) in 32-bit words
xorl %eax, %eax
rep
stosl
// Jump to the main (C++) kernel code and continue booting.
pushl %ebx // Multiboot data
call initialize_kernel
// This is unexpected: the kernel should never return here. The
// state of the OS is unknown here, so just halt the system for
// safety.
cli
1:
hlt
jmp 1b
|
src/API/protypo-api-consumers-file_writer.adb | fintatarta/protypo | 0 | 24254 | pragma Ada_2012;
with Ada.Text_IO; use Ada.Text_IO;
package body Protypo.API.Consumers.File_Writer is
type Writer_Access is access Writer;
----------
-- Open --
----------
function Open (Target : Target_Name) return Consumer_Access is
use Ada.Finalization;
Result : constant Writer_Access := new Writer'(Limited_Controlled with
Target => Target.Class,
Open => True,
Output => <>);
begin
if Target.Class = File then
Ada.Text_IO.Create (File => Result.Output,
Mode => Ada.Text_IO.Out_File,
Name => Target.Name);
end if;
return Consumer_Access(Result);
end Open;
-------------
-- Process --
-------------
overriding procedure Process
(Consumer : in out Writer;
Parameter : String)
is
begin
case Consumer.Target is
when Stdout =>
Ada.Text_IO.Put (Parameter);
when Stderr =>
Ada.Text_IO.Put (Ada.Text_IO.Standard_Error, Parameter);
when File =>
Ada.Text_IO.Put (Consumer.Output, Parameter);
end case;
end Process;
-----------
-- Close --
-----------
procedure Close (Consumer : in out Writer)
is
begin
if Consumer.Open and Consumer.Target = File then
Ada.Text_Io.Close (Consumer.Output);
Consumer.Open := False;
end if;
end Close;
--------------
-- Finalize --
--------------
overriding procedure Finalize (Obj : in out Writer)
is
begin
Close (Obj);
end Finalize;
end Protypo.API.Consumers.File_Writer;
|
mc-sema/validator/x86/tests/DIVSDrr.asm | randolphwong/mcsema | 2 | 20127 | BITS 32
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=
;TEST_FILE_META_END
; convert 3 to a double precision float and store in xmm0
mov ecx, 3
cvtsi2sd xmm0, ecx
; convert 7 to a double precision float and store in xmm1
mov ecx, 7
cvtsi2sd xmm1, ecx
;TEST_BEGIN_RECORDING
divsd xmm0, xmm1
;TEST_END_RECORDING
xor ecx, ecx
cvtsi2sd xmm0, ecx
cvtsi2sd xmm1, ecx
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.