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 |
|---|---|---|---|---|
data/baseStats_original/weavile.asm | adhi-thirumala/EvoYellow | 16 | 1169 | <reponame>adhi-thirumala/EvoYellow<gh_stars>10-100
;WeavileBaseStats: ; 38aa6 (e:4aa6)
db DEX_WEAVILE ; pokedex id
db 70 ; base hp
db 120 ; base attack
db 65 ; base defense
db 125 ; base speed
db 85 ; base special
db DARK ; species type 1
db ICE ; species type 2
db 35 ; catch rate
db 199 ; base exp yield
INCBIN "pic/ymon/weavile.pic",0,1 ; 55, sprite dimensions
dw WeavilePicFront
dw WeavilePicBack
db BITE
db 0
db 0
db 0
db 3 ; growth rate
; learnset
tmlearn 1,3,5,6,8
tmlearn 9,10,13,14,15,16
tmlearn 20
tmlearn 28,30,31,32
tmlearn 34,39,40
tmlearn 41,43,44,46
tmlearn 51,53,54
db BANK(WeavilePicFront)
|
antlr/KalangParser.g4 | GaoGian/kalang | 2 | 6322 | /*
[The "BSD licence"]
Copyright (c) 2013 <NAME>, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
/*
* The kalang grammar file modified from Java.g4
*/
parser grammar KalangParser;
options { tokenVocab=KalangLexer; }
compilationUnit:
compileOption*
importDecl*
(classDef | scriptDef)
;
compileOption:
COMPILE_OPTION_LINE
;
scriptDef:
(methodDecl | stat | classDef)*
;
classDef:
annotation*
varModifier?
(
classKind='class' ('<' genericTypes+=Identifier (',' genericTypes+=Identifier)* '>')?
|classKind='interface'
)
name=Identifier?
('extends' parentClass = classType)?
( 'implements' interfaces+=classType ( ',' interfaces+=classType)* )?
'{' classBody '}'
;
importDecl:
(
'import' (importMode='static')? (root='\\')?
path+=Identifier ('\\' path+=Identifier)*
delim='\\' (
(name=Identifier ('as' alias=Identifier)? )
|(name='*')
)
|
'import' (importMode='static')?
path+=Identifier ('.' path+=Identifier)*
delim='.' (
(name=Identifier ('as' alias=Identifier)? )
|(name='*')
)
)
';'
;
qualifiedName:
Identifier ('.' Identifier)*
;
classBody:
( fieldDecl | methodDecl | classDef )*
;
fieldDecl:
varModifier? varDecl (',' varDecl)* ';'
;
methodDecl:
annotation*
OVERRIDE? DEFAULT? varModifier?
(
(returnType=type name=Identifier )
|(prefix='constructor')
)
'('
(
paramTypes+=type paramIds+=Identifier
(',' paramTypes+=type paramIds+=Identifier)*
)?
')'
('throws' exceptionTypes+=Identifier (',' exceptionTypes+=Identifier)*)?
( blockStmt | ';')
;
annotation:
'@' annotationType=Identifier
( '('
(
( annotationValueKey+=Identifier '=' annotationValue+=literal (',' annotationValueKey+=Identifier '=' annotationValue+=literal)* )
| annotationDefaultValue=literal
)?
')' )?
;
type:
classType
| primitiveType
| type '[' ']' (nullable='?')?
;
classType:
( paths +=Identifier '\\')* rawClass=Identifier
('::' innerClass=Identifier)?
('<' parameterTypes+=parameterizedElementType
( ',' parameterTypes+=parameterizedElementType)*
'>')?
(nullable='?')?
| lambdaType
;
lambdaType:
'&' returnType=type '(' (paramsTypes+=type (',' paramsTypes+=type)*)? ')' (nullable='?')?
;
parameterizedElementType:
type | wildcardType
;
wildcardType:
'?' boundKind=('extends'|'super') classType
;
primitiveType:
DOUBLE|LONG|FLOAT|INT|CHAR|BOOLEAN|BYTE|VOID
;
localVarDecl:
varDecl (',' varDecl)*
;
ifStat:
IF '(' expression ')' trueStmt=stat ( ELSE falseStmt=stat)?
;
stat:
emptyStat
|blockStmt
|varDeclStat
|exprStat
|ifStat
|whileStat
|doWhileStat
|forStat
|forEachStat
|breakStat
|continueStat
|returnStat
|tryStat
|throwStat
|errorousStat
|assertStmt
;
emptyStat:
';'
;
errorousStat:
expression
;
assertStmt:
ASSERT testCondition=expression ( ':' failMessage=expression )?
;
throwStat:
'throw' expression ';'
;
blockStmt:
'{' stat* '}'
;
tryStat:
'try' exec=blockStmt
('catch' '(' catchTypes+=classType catchVarNames+=Identifier ')'
catchExec += blockStmt
)*
('finally' finallyExec=blockStmt)?
;
returnStat:
'return' expression? ';'
;
varDeclStat:
localVarDecl ';'
;
varDecl:
(
(varToken='var'|valToken='val') name=Identifier ('as' type)? ('=' expression)?
)|(
varType=type name=Identifier ('=' expression)?
)
;
breakStat:'break' ';';
continueStat:'continue' ';';
whileStat:
WHILE '(' expression ')' stat
;
doWhileStat:
DO blockStmt WHILE '(' expression ')' ';'
;
forStat:
FOR '('
(localVarDecl | initExpressions=expressions)?
';' condition=expression?
';' updateExpressions=expressions?
')'
stat
;
forEachStat:
'foreach' '(' expression 'as' ( Identifier ',' )? Identifier ')' stat
;
expressions:
expression (',' expression)*
;
exprStat:
expression ';'
;
expression
: LPAREN
expression
RPAREN #parenExpr
| ref=('this'|'super') #selfRefExpr
| literal #literalExpr
| lambdaType? '{' ( lambdaParams+=Identifier (',' lambdaParams+=Identifier)* '=>')? stat* '}' #lambdaExpr
| ( '<' keyType=Identifier ',' valueType=Identifier '>' )? ( '[' keys+=expression ':' values+=expression ( ',' keys+=expression ':' values+=expression)* ']'
| '[' ':' ']'
) #mapExpr
| ('<' type '>')? '[' ( expression ( ',' expression )* )? ']' # arrayExpr
//| expression '.' 'this'
//| expression '.' 'new' nonWildcardTypeArguments? innerCreator
//| expression '.' 'super' superSuffix
| target=expression refKey=('.'|'->'|'*.') Identifier
'(' (params+=expression (',' params+=expression)*)? ')' #invokeExpr
| expression refKey=('.'|'->') Identifier #getFieldExpr
| (Identifier|key='this'|key='super')
'(' (params+=expression (',' params+=expression)*)? ')' #memberInvocationExpr
| expression '[' expression ']' #getArrayElementExpr
| 'new' classType
'(' (params+=expression (',' params+=expression)*)? ')' #newExpr
| ( 'new' type '[' size=expression ']'
| 'new' type '[' ']' '{' (initExpr+=expression (',' initExpr += expression)*)? '}'
) #newArrayExpr
| expression op=('++' | '--') #incExpr
| ( '+' | '-' ) expression #unaryExpr
| op=( '++' | '--' ) expression #preIncExpr
| ('~'|'!') expression #unaryExpr
| '(' type ')' expression #castExpr
| expression ('*'|'/'|'%') expression #binaryExpr
| expression ('+'|'-') expression #binaryExpr
//don't write as '<<' , '>>>' or '>>' because it would cause problem when visit HashMap<String,List<String>>
| expression (
left='<' stop='<'
| uright='>' '>' stop='>'
| right='>' stop='>'
) expression #bitShiftExpr
| expression ('<=' | '>=' | '>' | '<') expression #binaryExpr
| expression INSTANCEOF Identifier #instanceofExpr
| expression ('=='|'==='|'!='|'!==') expression #binaryExpr
| expression '&' expression #binaryExpr
| expression '^' expression #binaryExpr
| expression '|' expression #binaryExpr
| expression ('&&'|'||') expression #binaryExpr
| expression '?' expression ':' expression #questionExpr
| Identifier #identifierExpr
| expression '.' #errorousMemberExpr
| InterpolationPreffixString expression ( '}' INTERPOLATION_STRING? INTERPOLATION_INTERUPT expression)* '}' INTERPOLATION_STRING? INTERPOLATION_END #interpolationExpr
| <assoc=right> expression
( '='
| '+='
| '-='
| '*='
| '/='
| '&='
| '|='
| '^='
| '>>='
| '>>>='
| '<<='
| '%='
)
expression #assignExpr
;
literal
: IntegerLiteral
| FloatingPointLiteral
| CharacterLiteral
| StringLiteral
| MultiLineStringLiteral
| BooleanLiteral
| Identifier '.' 'class'
| 'null'
;
varModifier:('static'|'final'|'private'|'public'|'protected'|'synchronized'|'abstract'|'native'|'transient'|'volatile')+;
|
programs/oeis/143/A143059.asm | neoneye/loda | 22 | 176774 | <reponame>neoneye/loda<gh_stars>10-100
; A143059: A007318 * [1, 10, 25, 15, 1, 0, 0, 0,...].
; 1,11,46,121,252,456,751,1156,1691,2377,3236,4291,5566,7086,8877,10966,13381,16151,19306,22877,26896,31396,36411,41976,48127,54901,62336,70471,79346,89002,99481
mov $2,$0
add $2,1
mov $8,$0
lpb $2
mov $0,$8
sub $2,1
sub $0,$2
mov $12,$0
mov $13,0
mov $14,$0
add $14,1
lpb $14
mov $0,$12
mov $10,0
sub $14,1
sub $0,$14
mov $9,$0
mov $11,$0
add $11,1
lpb $11
mov $0,$9
sub $11,1
sub $0,$11
mov $4,5
mov $5,4
mov $6,$0
add $6,$0
mul $5,$6
mov $7,2
lpb $0
mov $4,$0
mov $0,2
add $3,1
div $3,$3
trn $3,2
add $3,18
mov $5,1
add $7,1
mul $7,2
sub $3,$7
add $3,5
mul $5,$3
lpe
sub $5,1
add $5,$4
add $5,2
mov $4,$5
trn $4,7
add $4,1
add $10,$4
lpe
add $13,$10
lpe
add $1,$13
lpe
mov $0,$1
|
AASRepresentation.asm | slowy07/learnAsm | 1 | 3553 | section .text
global _start
_start:
sub ah, ah
sub al, '4'
sub al, '3'
aas
or al, 30h
mov [result], ax
mov edx, len
mov ecx, msg
mov ebx, 1
mov eax, 4
int 0x80 ;kernel
mov edx, 1
mov ecx, result
mov ebx, 1
mov eax, 4
int 0x80
mov eax, 1
int 0x80
section .data
msg db "result :", 0xA
len equ $ -msg
section .bss
res resb 1
;ouput
;result :
; 1 |
agda/LookVsTime.agda | halfaya/MusicTools | 28 | 7272 | <reponame>halfaya/MusicTools
{-# OPTIONS --cubical #-}
module LookVsTime where
open import Data.Fin using (#_)
open import Data.Integer using (+_; -[1+_])
open import Data.List using (List; _∷_; []; map; concat; _++_; replicate; zip; length; take)
open import Data.Nat using (_*_; ℕ; suc; _+_)
open import Data.Product using (_,_; uncurry)
open import Data.Vec using (fromList; Vec; _∷_; []) renaming (replicate to rep; zip to vzip; map to vmap; concat to vconcat; _++_ to _+v_)
open import Function using (_∘_)
open import Pitch
open import Note using (tone; rest; Note; Duration; duration; unduration)
open import Music
open import Midi
open import MidiEvent
open import Util using (repeat; repeatV)
tempo : ℕ
tempo = 84
----
8th : ℕ → Duration
8th n = duration (2 * n)
whole : ℕ → Duration
whole n = duration (16 * n)
melodyChannel : Channel-1
melodyChannel = # 0
melodyInstrument : InstrumentNumber-1
melodyInstrument = # 8 -- celesta
melodyNotes : List Note
melodyNotes =
tone (8th 3) (c 5) ∷
tone (8th 5) (d 5) ∷
tone (8th 3) (c 5) ∷
tone (8th 5) (d 5) ∷
tone (8th 1) (g 5) ∷
tone (8th 1) (f 5) ∷
tone (8th 1) (e 5) ∷
tone (8th 5) (d 5) ∷
tone (8th 1) (g 5) ∷
tone (8th 1) (f 5) ∷
tone (8th 1) (e 5) ∷
tone (8th 5) (d 5) ∷
tone (8th 1) (a 5) ∷
tone (8th 1) (g 5) ∷
tone (8th 1) (f 5) ∷
tone (8th 2) (e 5) ∷
tone (8th 1) (c 5) ∷
tone (8th 2) (d 5) ∷
tone (8th 1) (a 5) ∷
tone (8th 1) (g 5) ∷
tone (8th 1) (f 5) ∷
tone (8th 2) (e 5) ∷
tone (8th 1) (c 5) ∷
tone (8th 2) (d 5) ∷
tone (8th 3) (b 4) ∷
tone (8th 5) (c 5) ∷
tone (8th 1) (f 5) ∷
tone (8th 1) (e 5) ∷
tone (8th 1) (d 5) ∷
tone (8th 5) (c 5) ∷
tone (8th 3) (g 5) ∷
tone (8th 3) (e 5) ∷
tone (8th 2) (d 5) ∷
tone (8th 3) (g 5) ∷
tone (8th 3) (e 5) ∷
tone (8th 2) (d 5) ∷
tone (8th 8) (c 5) ∷
tone (8th 8) (b 4) ∷
tone (8th 3) (c 5) ∷
tone (8th 5) (d 5) ∷
tone (8th 3) (c 5) ∷
tone (8th 5) (d 5) ∷
tone (8th 3) (a 5) ∷
tone (8th 5) (f 5) ∷
tone (8th 3) (e 5) ∷
tone (8th 5) (d 5) ∷
tone (8th 8) (c 5) ∷
tone (8th 8) (d 5) ∷
tone (8th 1) (c 5) ∷
tone (8th 1) (c 5) ∷
tone (8th 1) (c 5) ∷
tone (8th 5) (d 5) ∷
tone (8th 1) (c 5) ∷
tone (8th 1) (c 5) ∷
tone (8th 1) (c 5) ∷
tone (8th 5) (d 5) ∷
tone (8th 3) (a 5) ∷
tone (8th 5) (f 5) ∷
tone (8th 3) (a 5) ∷
tone (8th 5) (g 5) ∷
tone (8th 1) (a 5) ∷
tone (8th 1) (g 5) ∷
tone (8th 1) (f 5) ∷
tone (8th 2) (e 5) ∷
tone (8th 1) (c 5) ∷
tone (8th 2) (d 5) ∷
tone (8th 1) (a 5) ∷
tone (8th 1) (g 5) ∷
tone (8th 1) (f 5) ∷
tone (8th 2) (e 5) ∷
tone (8th 1) (c 5) ∷
tone (8th 2) (d 5) ∷
tone (8th 3) (b 4) ∷
tone (8th 5) (c 5) ∷
tone (8th 24) (b 4) ∷
[]
melodyTrack : MidiTrack
melodyTrack = track "Melody" melodyInstrument melodyChannel tempo (notes→events defaultVelocity melodyNotes)
----
accompChannel : Channel-1
accompChannel = # 1
accompInstrument : InstrumentNumber-1
accompInstrument = # 11 -- vibraphone
accompRhythm : Vec Duration 3
accompRhythm = vmap 8th (3 ∷ 3 ∷ 2 ∷ [])
accompF accompB2 accompC4 : Vec Pitch 3
accompF = f 4 ∷ a 4 ∷ c 5 ∷ []
accompB2 = f 4 ∷ b 4 ∷ d 4 ∷ []
accompC4 = f 4 ∷ c 5 ∷ e 5 ∷ []
accompFA : Vec Pitch 2
accompFA = f 4 ∷ a 4 ∷ []
accompChords1 : Harmony 3 128
accompChords1 =
foldIntoHarmony (repeatV 8 accompRhythm)
(repeatV 2 (vconcat (vmap (rep {n = 3}) (accompF ∷ accompB2 ∷ accompC4 ∷ accompB2 ∷ []))))
accompChords2 : Harmony 3 64
accompChords2 = addEmptyVoice (pitches→harmony (whole 4) accompFA)
accompChords3 : Harmony 3 64
accompChords3 =
foldIntoHarmony (repeatV 4 accompRhythm)
(vconcat (vmap (rep {n = 3}) (accompF ∷ accompB2 ∷ accompC4 ∷ [])) +v (accompB2 ∷ accompB2 ∷ accompF ∷ []))
accompChords4 : Harmony 3 16
accompChords4 = addEmptyVoice (foldIntoHarmony accompRhythm (rep accompFA))
accompChords5 : Harmony 3 48
accompChords5 = pitches→harmony (8th (8 + 8 + 6)) accompF +H+ pitches→harmony (8th 2) accompF
accompChords6 : Harmony 3 32
accompChords6 = pitches→harmony (8th (8 + 6)) accompB2 +H+ pitches→harmony (8th 2) accompB2
accompChords7 : Harmony 3 32
accompChords7 = pitches→harmony (whole 2) accompF
accompChords : Harmony 3 448
accompChords = accompChords1 +H+ accompChords3 +H+ accompChords2 +H+ accompChords3 +H+ accompChords4
+H+ accompChords5 +H+ accompChords6 +H+ accompChords7
accompTrack : MidiTrack
accompTrack = track "Accomp" accompInstrument accompChannel tempo (harmony→events defaultVelocity accompChords)
----
bassChannel : Channel-1
bassChannel = # 2
bassInstrument : InstrumentNumber-1
bassInstrument = # 33 -- finger bass
bassMelody : List Pitch
bassMelody = c 3 ∷ e 3 ∷ f 3 ∷ g 3 ∷ []
bassRhythm : List Duration
bassRhythm = map 8th (3 ∷ 1 ∷ 2 ∷ 2 ∷ [])
bassNotes : List Note
bassNotes = repeat 28 (map (uncurry tone) (zip bassRhythm bassMelody))
bassTrack : MidiTrack
bassTrack = track "Bass" bassInstrument bassChannel tempo (notes→events defaultVelocity bassNotes)
----
drumInstrument : InstrumentNumber-1
drumInstrument = # 0 -- SoCal?
drumChannel : Channel-1
drumChannel = # 9
drumRhythmA : List Duration
drumRhythmA = map duration (2 ∷ [])
drumRhythmB : List Duration
drumRhythmB = map duration (1 ∷ 1 ∷ 2 ∷ [])
drumRhythm : List Duration
drumRhythm = drumRhythmA ++ repeat 3 drumRhythmB ++ drumRhythmA
drumPitches : List Pitch
drumPitches = replicate (length drumRhythm) (b 4) -- Ride In
drumNotes : List Note
drumNotes = rest (whole 1) ∷ repeat 27 (map (uncurry tone) (zip drumRhythm drumPitches))
drumTrack : MidiTrack
drumTrack = track "Drums" drumInstrument drumChannel tempo (notes→events defaultVelocity drumNotes)
----
lookVsTime : List MidiTrack
lookVsTime = melodyTrack ∷ accompTrack ∷ bassTrack ∷ drumTrack ∷ []
|
Cubical/Algebra/Polynomials/Multivariate/Base.agda | howsiyu/cubical | 0 | 1153 | <filename>Cubical/Algebra/Polynomials/Multivariate/Base.agda
{-# OPTIONS --safe #-}
module Cubical.Algebra.Polynomials.Multivariate.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Data.Nat renaming (_+_ to _+n_)
open import Cubical.Data.Vec
open import Cubical.Algebra.Ring
open import Cubical.Algebra.CommRing
private variable
ℓ ℓ' : Level
module _ (A' : CommRing ℓ) where
private
A = fst A'
open CommRingStr (snd A')
-----------------------------------------------------------------------------
-- Definition
data Poly (n : ℕ) : Type ℓ where
-- elements
0P : Poly n
base : (v : Vec ℕ n) → (a : A) → Poly n
_Poly+_ : (P : Poly n) → (Q : Poly n) → Poly n
-- AbGroup eq
Poly+-assoc : (P Q R : Poly n) → P Poly+ (Q Poly+ R) ≡ (P Poly+ Q) Poly+ R
Poly+-Rid : (P : Poly n) → P Poly+ 0P ≡ P
Poly+-comm : (P Q : Poly n) → P Poly+ Q ≡ Q Poly+ P
-- Base eq
base-0P : (v : Vec ℕ n) → base v 0r ≡ 0P
base-Poly+ : (v : Vec ℕ n) → (a b : A) → (base v a) Poly+ (base v b) ≡ base v (a + b)
-- Set Trunc
trunc : isSet(Poly n)
-----------------------------------------------------------------------------
-- Induction and Recursion
module _ (A' : CommRing ℓ) where
private
A = fst A'
open CommRingStr (snd A')
module Poly-Ind-Set
-- types
(n : ℕ)
(F : (P : Poly A' n) → Type ℓ')
(issd : (P : Poly A' n) → isSet (F P))
-- elements
(0P* : F 0P)
(base* : (v : Vec ℕ n) → (a : A) → F (base v a))
(_Poly+*_ : {P Q : Poly A' n} → (PS : F P) → (QS : F Q) → F (P Poly+ Q))
-- AbGroup eq
(Poly+-assoc* : {P Q R : Poly A' n} → (PS : F P) → (QS : F Q) → (RS : F R)
→ PathP (λ i → F (Poly+-assoc P Q R i)) (PS Poly+* (QS Poly+* RS)) ((PS Poly+* QS) Poly+* RS))
(Poly+-Rid* : {P : Poly A' n} → (PS : F P) →
PathP (λ i → F (Poly+-Rid P i)) (PS Poly+* 0P*) PS)
(Poly+-comm* : {P Q : Poly A' n} → (PS : F P) → (QS : F Q)
→ PathP (λ i → F (Poly+-comm P Q i)) (PS Poly+* QS) (QS Poly+* PS))
-- Base eq
(base-0P* : (v : Vec ℕ n) → PathP (λ i → F (base-0P v i)) (base* v 0r) 0P*)
(base-Poly+* : (v : Vec ℕ n) → (a b : A)
→ PathP (λ i → F (base-Poly+ v a b i)) ((base* v a) Poly+* (base* v b)) (base* v (a + b)))
where
f : (P : Poly A' n) → F P
f 0P = 0P*
f (base v a) = base* v a
f (P Poly+ Q) = (f P) Poly+* (f Q)
f (Poly+-assoc P Q R i) = Poly+-assoc* (f P) (f Q) (f R) i
f (Poly+-Rid P i) = Poly+-Rid* (f P) i
f (Poly+-comm P Q i) = Poly+-comm* (f P) (f Q) i
f (base-0P v i) = base-0P* v i
f (base-Poly+ v a b i) = base-Poly+* v a b i
f (trunc P Q p q i j) = isOfHLevel→isOfHLevelDep 2 issd (f P) (f Q) (cong f p) (cong f q) (trunc P Q p q) i j
module Poly-Rec-Set
-- types
(n : ℕ)
(B : Type ℓ')
(iss : isSet B)
-- elements
(0P* : B)
(base* : (v : Vec ℕ n) → (a : A) → B)
(_Poly+*_ : B → B → B)
-- AbGroup eq
(Poly+-assoc* : (PS QS RS : B) → (PS Poly+* (QS Poly+* RS)) ≡ ((PS Poly+* QS) Poly+* RS))
(Poly+-Rid* : (PS : B) → (PS Poly+* 0P*) ≡ PS)
(Poly+-comm* : (PS QS : B) → (PS Poly+* QS) ≡ (QS Poly+* PS))
-- Base eq
(base-0P* : (v : Vec ℕ n) → (base* v 0r) ≡ 0P*)
(base-Poly+* : (v : Vec ℕ n) → (a b : A) → ((base* v a) Poly+* (base* v b)) ≡ (base* v (a + b)))
where
f : Poly A' n → B
f = Poly-Ind-Set.f n (λ _ → B) (λ _ → iss) 0P* base* _Poly+*_ Poly+-assoc* Poly+-Rid* Poly+-comm* base-0P* base-Poly+*
module Poly-Ind-Prop
-- types
(n : ℕ)
(F : (P : Poly A' n) → Type ℓ')
(ispd : (P : Poly A' n) → isProp (F P))
-- elements
(0P* : F 0P)
(base* : (v : Vec ℕ n) → (a : A) → F (base v a))
(_Poly+*_ : {P Q : Poly A' n} → (PS : F P) → (QS : F Q) → F (P Poly+ Q))
where
f : (P : Poly A' n) → F P
f = Poly-Ind-Set.f n F (λ P → isProp→isSet (ispd P)) 0P* base* _Poly+*_
(λ {P Q R} PS QS RQ → toPathP (ispd _ (transport (λ i → F (Poly+-assoc P Q R i)) _) _))
(λ {P} PS → toPathP (ispd _ (transport (λ i → F (Poly+-Rid P i)) _) _))
(λ {P Q} PS QS → toPathP (ispd _ (transport (λ i → F (Poly+-comm P Q i)) _) _))
(λ v → toPathP (ispd _ (transport (λ i → F (base-0P v i)) _) _))
(λ v a b → toPathP (ispd _ (transport (λ i → F (base-Poly+ v a b i)) _) _))
module Poly-Rec-Prop
-- types
(n : ℕ)
(B : Type ℓ')
(isp : isProp B)
-- elements
(0P* : B)
(base* : (v : Vec ℕ n) → (a : A) → B)
(_Poly+*_ : B → B → B)
where
f : Poly A' n → B
f = Poly-Ind-Prop.f n (λ _ → B) (λ _ → isp) 0P* base* _Poly+*_
|
programs/oeis/155/A155628.asm | karttu/loda | 1 | 14242 | <reponame>karttu/loda
; A155628: 7^n-4^n+1^n
; 1,4,34,280,2146,15784,113554,807160,5699266,40091464,281426674,1973132440,13824509986,96821901544,677954637394,4746487768120,33228635602306,232613334118024,1628344878433714,11398620307466200
mov $2,7
pow $2,$0
mov $1,$2
mov $3,4
pow $3,$0
sub $1,$3
div $1,3
mul $1,3
add $1,1
|
FunStuff/tests/mandelbrotTest.asm | Martin-H1/6502 | 3 | 169263 | ; -----------------------------------------------------------------------------
; Test for fmath functions under py65mon.
; <NAME> <<EMAIL>>
; -----------------------------------------------------------------------------
.outfile "tests/mandelbrotTest.rom"
.alias RamSize $7EFF ; default $8000 for 32 kb x 8 bit RAM
.require "../../Common/data.asm"
.text
.org $c000
.require "../mandelbrot.asm"
; Main entry point for the test
main:
ldx #SP0 ; Reset stack pointer
`pushzero
jsr mockConioInit
jsr zrSqTest
jsr ziSqTest
jsr toCharTest
jsr countAndTestTest
jsr doEscapeTest
jsr doCellTest
brk
.scope
_name: .byte "*** zrSq test ***",0
_msg1: .byte "zr sq of ",0
_msg2: .byte " = ",0
_tests: .word $d000, $e000, $f000, $f800, $0000, $0800, $1000, $2000, $3000
_testsEnd:
.alias _testsCount [_testsEnd - _tests]
zrSqTest:
`println _name
ldy #$00
_loop: lda _tests,y
`pushA
iny
lda _tests,y
sta TOS_MSB,x
jsr _test
iny
cpy #_testsCount
bmi _loop
`printcr
rts
_test: `print _msg1
jsr printTos
`pop ZREAL
`print _msg2
jsr zrSq
jsr printTosln
`drop
rts
.scend
.scope
_name: .byte "*** ziSq test ***",0
_msg1: .byte "zi sq of ",0
_msg2: .byte " = ",0
_tests: .word $e000, $f000, $f800, $0000, $0800, $1000, $2000
_testsEnd:
.alias _testsCount [_testsEnd - _tests]
ziSqTest:
`println _name
ldy #$00
_loop: lda _tests,y
`pushA
iny
lda _tests,y
sta TOS_MSB,x
jsr _test
iny
cpy #_testsCount
bmi _loop
`printcr
rts
_test: `print _msg1
jsr printTos
`pop ZIMAG
`print _msg2
jsr ziSq
jsr printTosln
`drop
rts
.scend
.scope
_name: .byte "*** toChar test ***",0
_msg1: .byte "toChar of ",0
_msg2: .byte " = ",0
_tests: .byte $00, $01, $02, $03, $04, $05, $06, $07, $08
_testsEnd:
.alias _testsCount [_testsEnd - _tests]
toCharTest:
`println _name
ldy #$00
_loop: `print _msg1
lda _tests,y
pha
jsr printa
`print _msg2
pla
jsr toChar
`printcr
iny
cpy #_testsCount
bmi _loop
`printcr
rts
.scend
.scope
_name: .byte "*** countAndTest test ***",0
_msg1: .byte "count of ",0
_msg2: .byte " = ",0
countAndTestTest:
`println _name
`pushZero
_loop: `drop
`print _msg1
jsr countAndTest
lda COUNT
jsr printa
`print _msg2
jsr printtosln
`tosZero?
beq _loop
`printcr
rts
.scend
.scope
_name: .byte "*** doEscape test ***",0
_msg1: .byte "doEscape of ",0
_msg2: .byte " = ",0
_tests: .word $d000, $e000, $f000, $0000, $1000, $2000, $3000
_testsEnd:
.alias _testsCount [_testsEnd - _tests]
doEscapeTest:
`println _name
stz COUNT
ldy #$00
_loop: `print _msg1
lda _tests,y
`pusha
iny
lda _tests,y
sta TOS_MSB,x
jsr printTos
`pop ZREAL
`pushZero
`pop ZIMAG
jsr doEscape
`print _msg2
jsr printtosln
`drop
iny
cpy #_testsCount
bmi _loop
`printcr
rts
.scend
.scope
_name: .byte "*** doCell test ***",0
_msg1: .byte "asin of ",0
_msg2: .byte " = ",0
doCellTest:
`println _name
rts
.scend
.require "../../Common/tests/mockConio.asm"
.require "../../Common/conio.asm"
.require "../../Common/math16.asm"
.require "../../Common/print.asm"
.require "../../Common/stack.asm"
.require "../../Common/vectors.asm"
|
primatives/antidebug.asm | WWelna/Pandora-OOC | 0 | 91357 | <reponame>WWelna/Pandora-OOC<gh_stars>0
; Anti-Debug
;
; Copyright (C) 2011, <NAME> All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; ; Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; ; Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY <NAME> ''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 <NAME> 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.
section .txt
global antidebug
antidebug: ; void __cdecl antidebug(void);
push ebp
mov ebp, esp
push p9001
push dword fs:[0]
mov dword fs:[0], ebp
int 0x2d
leave
ret
p9001: ret
|
src/PJ/util/doserror.asm | AnimatorPro/Animator-Pro | 119 | 247915 | <filename>src/PJ/util/doserror.asm
;include errcodes.i
;-----------------------------------------------------------------------------
;
;-----------------------------------------------------------------------------
data segment dword public 'DATA'
public pj_crit_errval
pj_crit_errval dw 0040H ; if not set by handler will be "critical" error
is_installed db 0 ; flag: are we currently installed?
data ends
;-----------------------------------------------------------------------------
;
;-----------------------------------------------------------------------------
bss segment dword public 'BSS'
old_real_vec dd ? ; dword, old real-mode vector.
old_prot_off dd ? ; old protected-mode vector offset.
old_prot_seg dw ? ; old protected-mode vector segment.
bss ends
;-----------------------------------------------------------------------------
;
;-----------------------------------------------------------------------------
code segment dword 'CODE'
CGROUP group code
DGROUP group data,bss
assume cs:CGROUP,ds:DGROUP
public pj_doserr_install_handler
public pj_doserr_remove_handler
public pj_dget_err
;*****************************************************************************
; replacement handler, turns off abort/retry/fail...
;*****************************************************************************
de_handler proc near
mov pj_crit_errval,di ; save error status for later.
mov al,3 ; tell DOS to "Fail" w/o prompting.
iretd
de_handler endp
;*****************************************************************************
;* routine to install our handler...
;*****************************************************************************
pj_doserr_install_handler proc near
test is_installed,0FFH ; have we been installed already?
jnz short #already_installed; yep, just punt.
push ebx
push es
mov cl,024H ; vector number to get.
mov ax,2502H ; phar lap get vector function code.
int 21H ; get old protected-mode vector.
mov old_prot_off,ebx ; save old vector offset value.
mov old_prot_seg,es ; save old vector segment value.
mov cl,024H ; vector number to get.
mov ax,2503H ; phar lap get vector function code.
int 21H ; get old read-mode vector.
mov old_real_vec,ebx ; save old vector value.
push ds
mov cl,024H ; vector number to set.
lea edx,de_handler ; address of handler in ds:edx.
mov ax,cs ; get code segment,
mov ds,ax ; store it into DS.
assume ds:nothing ; DS is now unusable for addressing.
mov ax,02506H ; phar lap set vector function code.
int 21H ; do it.
pop ds
assume ds:DGROUP ; DS is usable again.
pop es
pop ebx
mov is_installed,0FFh ; indicate we're now installed.
#already_installed:
ret
pj_doserr_install_handler endp
;*****************************************************************************
;* routine to de-install our handler...
;*****************************************************************************
pj_doserr_remove_handler proc near
test is_installed,0FFH ; first see if we're even installed,
jz short #not_installed ; if not, just punt.
push ebx
push ds
mov cl,024H ; vector number to set.
mov ebx,old_real_vec ; old real mode vector.
mov edx,old_prot_off ; old protected-mode offset.
mov ds,old_prot_seg ; old protected-mode segment.
assume ds:nothing ; DS is now unusable for addressing.
mov ax,2507H ; phar lap function code to set both
int 21H ; real and protected mode vectors.
pop ds
assume ds:DGROUP ; DS is usable again.
pop ebx
mov is_installed,0 ; indicate we're not installed anymore.
#not_installed:
ret
pj_doserr_remove_handler endp
;*****************************************************************************
;* routine to return error status of last critical error...
;*****************************************************************************
pj_dget_err proc near
push ebx
push esi
push edi
push ds
push es
xor ebx,ebx ;version zero...
mov ah,59H
int 21H
and eax,0FFFFH ;mask any hi bits
cmp eax,0053H ;is error to be found in critical error?
jne #return_eax
movsx eax,word ptr pj_crit_errval ; use critical error value
add eax, 0013H
#return_eax:
pop es
pop ds
pop edi
pop esi
pop ebx
ret
pj_dget_err endp
code ends
end
|
Categories/Functor/Monoidal.agda | copumpkin/categories | 98 | 5074 | <filename>Categories/Functor/Monoidal.agda
module Categories.Functor.Monoidal where
|
Testing-File/memopd.asm | srsarangi/riscv-emulator | 0 | 169764 | @Assembly code to store a doubleword to specific memory location and load from there@Assembly code to store a byte to specific memory location and load from there
.main:
addi x20, x0, 5
addi x21, x0, 5
sd x21, 6(x20)
ld x5, 6(x20)
.print x5
end |
cpm2/RomWBW/Source/HBIOS/romldr.asm | grancier/z180 | 0 | 7312 | ;
;==================================================================================================
; LOADER
;==================================================================================================
;
; INCLUDE GENERIC STUFF
;
#INCLUDE "std.asm"
;
MONIMG .EQU $1000
CPMIMG .EQU $2000
ZSYSIMG .EQU $5000
;
INT_IM1 .EQU $FF00
;
.ORG 0
;
;==================================================================================================
; NORMAL PAGE ZERO SETUP, RET/RETI/RETN AS APPROPRIATE
;==================================================================================================
;
JP $100 ; RST 0: JUMP TO BOOT CODE
.FILL (008H - $),0FFH
#IF (PLATFORM == PLT_UNA)
JP $FFFD ; RST 8: INVOKE UBIOS FUNCTION
#ELSE
JP HB_INVOKE ; RST 8: INVOKE HBIOS FUNCTION
#ENDIF
.FILL (010H - $),0FFH
RET ; RST 10
.FILL (018H - $),0FFH
RET ; RST 18
.FILL (020H - $),0FFH
RET ; RST 20
.FILL (028H - $),0FFH
RET ; RST 28
.FILL (030H - $),0FFH
RET ; RST 30
.FILL (038H - $),0FFH
#IF (PLATFORM == PLT_UNA)
RETI ; RETURN W/ INTS DISABLED
#ELSE
#IF (INTMODE == 1)
JP INT_IM1 ; JP TO INTERRUPT HANDLER IN HI MEM
#ELSE
RETI ; RETURN W/ INTS DISABLED
#ENDIF
#ENDIF
.FILL (066H - $),0FFH
RETN ; NMI
;
.FILL (100H - $),0FFH ; PAD REMAINDER OF PAGE ZERO
;
;
;==================================================================================================
; LOADER
;==================================================================================================
;
DI ; NO INTERRUPTS
LD SP,BL_STACK ; SETUP STACK
;
; BANNER
LD DE,STR_BANNER
CALL WRITESTR
;
#IF (PLATFORM != PLT_UNA)
CALL DELAY_INIT ; INIT DELAY FUNCTIONS
#ENDIF
;
#IF (PLATFORM == PLT_UNA)
; ; COPY UNA BIOS PAGE ZERO TO USER BANK, LEAVE USER BANK ACTIVE
; LD BC,$01FB ; UNA FUNC = SET BANK
; LD DE,BID_BIOS ; UBIOS_PAGE (SEE PAGES.INC)
; CALL $FFFD ; DO IT (RST 08 NOT YET INSTALLED)
; PUSH DE ; SAVE PREVIOUS BANK
;;
; LD HL,0 ; FROM ADDRESS 0 (PAGE ZERO)
; LD DE,$9000 ; USE $9000 AS BOUNCE BUFFER
; LD BC,256 ; ONE PAGE IS 256 BYTES
; LDIR ; DO IT
;;
; LD BC,$01FB ; UNA FUNC = SET BANK
; ;POP DE ; RECOVER OPERATING BANK
; LD DE,BID_USR ; TO USER BANK
; CALL $FFFD ; DO IT (RST 08 NOT YET INSTALLED)
;;
; LD HL,$9000 ; USE $9000 AS BOUNCE BUFFER
; LD DE,0 ; TO PAGE ZERO OF OPERATING BANK
; LD BC,256 ; ONE PAGE IS 256 BYTES
; LDIR ; DO IT
;;
;; ; INSTALL UNA INVOCATION VECTOR FOR RST 08
;; ; *** IS THIS REDUNDANT? ***
;; LD A,$C3 ; JP INSTRUCTION
;; LD (8),A ; STORE AT 0x0008
;; LD HL,($FFFE) ; UNA ENTRY VECTOR
;; LD (9),HL ; STORE AT 0x0009
;;
; LD BC,$01FB ; UNA FUNC = SET BANK
; POP DE ; RECOVER OPERATING BANK
; CALL $FFFD ; DO IT (RST 08 NOT YET INSTALLED)
#ELSE
; PREP THE USER BANK (SETUP PAGE ZERO)
LD B,BF_SYSSETCPY ; HBIOS FUNC: SETUP BANK COPY
LD D,BID_USR ; D = DEST BANK = USER BANK
LD E,BID_BIOS ; E = SRC BANK = BIOS BANK
LD HL,256 ; HL = COPY LEN = 1 PAGE = 256 BYTES
RST 08 ; DO IT
LD B,BF_SYSBNKCPY ; HBIOS FUNC: PERFORM BANK COPY
LD HL,0 ; COPY FROM BIOS ADDRESS 0
LD DE,0 ; TO USER ADDRESS 0
RST 08 ; DO IT
#ENDIF
EI
;
; RUN THE BOOT LOADER MENU
JP DOBOOTMENU
;
;__DOBOOT________________________________________________________________________________________________________________________
;
; PERFORM BOOT FRONT PANEL ACTION
;________________________________________________________________________________________________________________________________
;
DOBOOTMENU:
CALL NEWLINE
LD DE,STR_BOOTMENU
CALL WRITESTR
#IF (DSKYENABLE)
LD HL,BOOT ; POINT TO BOOT MESSAGE
CALL SEGDISPLAY ; DISPLAY MESSAGE
#ENDIF
#IF (BOOTTYPE == BT_AUTO)
LD BC,100 * BOOT_TIMEOUT
LD (BL_TIMEOUT),BC
#ENDIF
DB_BOOTLOOP:
;
; CHECK FOR CONSOLE BOOT KEYPRESS
;
CALL CST
OR A
JP Z,DB_CONEND
CALL CINUC
CP 'M' ; MONITOR
JP Z,GOMONSER
CP 'C' ; CP/M BOOT FROM ROM
JP Z,GOCPM
CP 'Z' ; ZSYSTEM BOOT FROM ROM
JP Z,GOZSYS
CP 'L' ; LIST DRIVES
JP Z,GOLIST
CP '0' ; 0-9, DISK DEVICE
JP C,DB_INVALID
CP '9' + 1
JP NC,DB_INVALID
SUB '0'
JP GOBOOTDISK
DB_CONEND:
;
; CHECK FOR DSKY BOOT KEYPRESS
;
#IF (DSKYENABLE)
CALL KY_STAT ; GET KEY FROM KB INTO A
OR A
JP Z,DB_DSKYEND
CALL KY_GET
CP KY_GO ; GO = MONITOR
JP Z,GOMONDSKY
CP KY_BO ; BO = BOOT ROM
JP Z,GOCPM
; CP 0AH ; A-F, DISK BOOT
; JP C,DB_INVALID
CP 0FH + 1 ; 0-F, DISK BOOT
; JP NC,DB_INVALID
; SUB 0AH
JP GOBOOTDISK
; LD HL,BOOT ; POINT TO BOOT MESSAGE
; LD A,00H ; BLANK OUT SELECTION,IT WAS INVALID
; LD (HL),A ; STORE IT IN DISPLAY BUFFER
; CALL SEGDISPLAY ; DISPLAY THE BUFFER
DB_DSKYEND:
#ENDIF
;
; IF CONFIGURED, CHECK FOR AUTOBOOT TIMEOUT
;
#IF (BOOTTYPE == BT_AUTO)
; DELAY FOR 10MS TO MAKE TIMEOUT CALC EASY
LD DE,625 ; 16US * 625 = 10MS
CALL VDELAY
; CHECK/INCREMENT TIMEOUT
LD BC,(BL_TIMEOUT)
DEC BC
LD (BL_TIMEOUT),BC
LD A,B
OR C
JP NZ,DB_BOOTLOOP
; TIMEOUT EXPIRED, PERFORM DEFAULT BOOT ACTION
LD A,BOOT_DEFAULT
CP 'M' ; MONITOR
JP Z,GOMON
CP 'C' ; CP/M BOOT FROM ROM
JP Z,GOCPM
CP 'Z' ; ZSYSTEM BOOT FROM ROM
JP Z,GOZSYS
CP 'L' ; LIST DRIVES
JP Z,GOLIST
CP '0' ; 0-9, DISK DEVICE
JP C,DB_INVALID
CP '9' + 1
JP NC,DB_INVALID
SUB '0'
JP GOBOOTDISK
#ENDIF
JP DB_BOOTLOOP
;
; BOOT OPTION PROCESSING
;
DB_INVALID:
LD DE,STR_INVALID
CALL WRITESTR
JP DOBOOTMENU
;
GOMONSER:
LD HL,MON_SERIAL ; MONITOR SERIAL INTERFACE ENTRY ADDRESS TO HL
JR GOMON ; LOAD AND RUN MONITOR
;
GOMONDSKY:
LD HL,MON_DSKY ; MONITOR DSKY INTERFACE ENTRY ADDRESS TO HL
JR GOMON ; LOAD AND RUN MONITOR
;
GOMON:
LD DE,STR_BOOTMON ; DE POINTS TO MESSAGE
CALL WRITESTR ; WRITE IT TO CONSOLE
;
PUSH HL ; SAVE DESIRED MONITOR ENTRY ADDRESS
;
; COPY MONITOR IMAGE TO EXEC ADDRESS
LD HL,MONIMG ; HL := MONITOR IMAGE ADDRESS
LD DE,MON_LOC ; DE := MONITOR EXEC ADDRESS
LD BC,MON_SIZ ; BC := MONITOR SIZE
LDIR ; COPY MONITOR CODE TO EXEC ADDRESS
;
POP HL ; RECOVER ENTRY ADDRESS
JR CHAIN ; AND CHAIN TO IT
;
GOCPM:
LD DE,STR_BOOTCPM ; DE POINTS TO MESSAGE
CALL WRITESTR ; WRITE IT TO CONSOLE
LD HL,CPMIMG ; SET HL TO CPM IMAGE ADDRESS
JR GOOS ; LOAD AND RUN OS
;
GOZSYS:
LD DE,STR_BOOTZSYS ; DE POINTS TO MESSAGE
CALL WRITESTR ; WRITE IT TO CONSOLE
LD HL,ZSYSIMG ; SET HL TO ZSYS IMAGE ADDRESS
JR GOOS ; LOAD AND RUN OS
;
GOOS:
; COPY OS IMAGE TO EXEC ADDRESS
LD DE,CPM_LOC ; DE := MONITOR EXEC ADDRESS
LD BC,CPM_SIZ ; BC := MONITOR SIZE
LDIR ; COPY MONITOR CODE TO EXEC ADDRESS
;
LD HL,CPM_ENT
;JR CHAIN ; CHAIN TO ENTRY ADDRESS IN USER BANK
;
CHAIN:
PUSH HL ; SAVE ENTRY ADDRESS
;
#IF (PLATFORM == PLT_UNA)
LD BC,$00FB ; GET LOWER PAGE ID
RST 08 ; DE := LOWER PAGE ID == BOOT ROM PAGE
LD L,1 ; BOOT DISK UNIT IS ROM (UNIT ID = 1)
LD BC,$01FC ; UNA FUNC: SET BOOTSTRAP HISTORY
RST 08 ; CALL UNA
;
; HL IS ALREADY ON STACK AS REQUIRED BY UNA EXEC CHAIN CALL
LD DE,BID_USR ; TARGET BANK ID
PUSH DE ; ... ON STACK
DI ; ENTER WITH INTS DISABLED
JP $FFF7 ; UNA INTER-PAGE EXEC CHAIN
#ELSE
LD B,BF_SYSSET ; HB FUNC: SET HBIOS PARAMETER
LD C,BF_SYSSET_BOOTINFO ; HB SUBFUNC: SET BOOT INFO
LD A,(HB_CURBNK) ; GET CURRENT BANK ID FROM PROXY DATA
LD L,A ; ... AND SAVE AS BOOT BANK
LD DE,$0100 ; BOOT VOLUME (UNIT, SLICE)
RST 08
;
LD A,BID_USR ; ACTIVATE USER BANK
POP HL ; RECOVER ENTRY ADDRESS
DI ; ENTER WITH INTS DISABLED
CALL HB_BNKCALL ; AND GO
HALT ; WE SHOULD NEVER RETURN!!!
#ENDIF
;
GOLIST:
LD DE,STR_LIST
CALL WRITESTR
LD DE,STR_DRVLIST
CALL WRITESTR
CALL PRTALL
JP DOBOOTMENU
;
GOBOOTDISK:
LD (BL_BOOTID),A
LD DE,STR_BOOTDISK
CALL WRITESTR
JP BOOTDISK
;
; BOOT FROM DISK DRIVE
;
BOOTDISK:
LD DE,STR_BOOTDISK1 ; DISK BOOT MESSAGE
CALL WRITESTR ; PRINT IT
#IF (PLATFORM == PLT_UNA)
;
; BOOT FROM UNA DISK DRIVE
;
LD A,(BL_BOOTID) ; GET BOOT DEVICE ID
LD B,A ; MOVE TO B
; LOAD SECTOR 2 (BOOT INFO)
LD C,$41 ; UNA FUNC: SET LBA
LD DE,0 ; HI WORD OF LBA IS ALWAYS ZERO
LD HL,2 ; LOAD STARTING INFO SECTOR 2
RST 08 ; SET LBA
JP NZ,DB_ERR ; HANDLE ERROR
;
LD C,$42 ; UNA FUNC: READ SECTORS
LD DE,BL_INFOSEC ; DEST OF CPM IMAGE
LD L,1 ; SECTORS TO READ
RST 08 ; DO READ
JP NZ,DB_ERR ; HANDLE ERROR
;
#ELSE
; CHECK FOR VALID DRIVE LETTER
LD A,(BL_BOOTID) ; BOOT DEVICE TO A
PUSH AF ; SAVE BOOT DEVICE
LD B,BF_SYSGET
LD C,BF_SYSGET_DIOCNT
RST 08 ; E := DISK UNIT COUNT
POP AF ; RESTORE BOOT DEVICE
CP E ; CHECK MAX (INDEX - COUNT)
JP NC,DB_NODISK ; HANDLE INVALID SELECTION
; SET THE BOOT UNIT AND SLICE
LD A,(BL_BOOTID) ; GET BOOTID
LD (BL_DEVICE),A ; STORE IT
XOR A ; LU ALWAYS ZERO
LD (BL_LU),A ; STORE IT
; SENSE MEDIA
LD A,(BL_DEVICE) ; GET DEVICE/UNIT
LD C,A ; STORE IN C
LD B,BF_DIOMEDIA ; DRIVER FUNCTION = DISK MEDIA
LD E,1 ; ENABLE MEDIA CHECK/DISCOVERY
RST 08 ; CALL HBIOS
JP NZ,DB_ERR ; HANDLE ERROR
; SEEK TO SECTOR 2 OF LU
LD A,(BL_LU) ; GET LU SPECIFIED
LD E,A ; LU INDEX
LD H,65 ; 65 TRACKS PER LU
CALL MULT8 ; HL := H * E
LD DE,$02 ; HEAD 0, SECTOR 2
LD B,BF_DIOSEEK ; SETUP FOR NEW SEEK CALL
LD A,(BL_DEVICE) ; GET BOOT DISK UNIT
LD C,A ; PUT IN C
RST 08 ; DO IT
JP NZ,DB_ERR ; HANDLE ERROR
; READ
LD B,BF_DIOREAD ; FUNCTION IN B
LD A,(BL_DEVICE) ; GET BOOT DISK UNIT
LD C,A ; PUT IN C
LD HL,BL_INFOSEC ; READ INTO INFO SEC BUFFER
LD DE,1 ; TRANSFER ONE SECTOR
RST 08 ; DO IT
JP NZ,DB_ERR ; HANDLE ERROR
;
#ENDIF
;
; CHECK SIGNATURE
CALL NEWLINE ; FORMATTING
LD DE,(BB_SIG) ; GET THE SIGNATURE
LD A,$A5 ; FIRST BYTE SHOULD BE $A5
CP D ; COMPARE
JP NZ,DB_NOBOOT ; ERROR IF NOT EQUAL
LD A,$5A ; SECOND BYTE SHOULD BE $5A
CP E ; COMPARE
JP NZ,DB_NOBOOT ; ERROR IS NOT EQUAL
; PRINT CPMLOC VALUE
CALL NEWLINE
LD DE,STR_CPMLOC
CALL WRITESTR
LD BC,(BB_CPMLOC)
CALL PRTHEXWORD
; PRINT CPMEND VALUE
CALL PC_SPACE
LD DE,STR_CPMEND
CALL WRITESTR
LD BC,(BB_CPMEND)
CALL PRTHEXWORD
; PRINT CPMENT VALUE
CALL PC_SPACE
LD DE,STR_CPMENT
CALL WRITESTR
LD BC,(BB_CPMENT)
CALL PRTHEXWORD
CALL PC_SPACE
; PRINT DISK LABEL
LD DE,STR_LABEL
CALL WRITESTR
LD DE,BB_LABEL ; if it is there, then a printable
LD A,(BB_TERM) ; Display Disk Label if Present
CP '$' ; (dwg 2/7/2012)
CALL Z,WRITESTR ; label is there as well even if spaces.
;
LD DE,STR_LOADING ; LOADING MESSAGE
CALL WRITESTR ; PRINT IT
;
; COMPUTE NUMBER OF SECTORS TO LOAD
LD HL,(BB_CPMEND) ; HL := END
LD DE,(BB_CPMLOC) ; DE := START
OR A ; CLEAR CARRY
SBC HL,DE ; HL := LENGTH TO LOAD
LD A,H ; DETERMINE 512 BYTE SECTOR COUNT
RRCA ; ... BY DIVIDING MSB BY TWO
LD (BL_COUNT),A ; ... AND SAVE IT
;
#IF (PLATFORM == PLT_UNA)
;
; READ OS IMAGE INTO MEMORY
LD C,$42 ; UNA FUNC: READ SECTORS
LD A,(BL_BOOTID) ; GET BOOT DEVICE ID
LD B,A ; MOVE TO B
LD DE,(BB_CPMLOC) ; DEST OF CPM IMAGE
LD A,(BL_COUNT) ; GET SECTORS TO READ
LD L,A ; SECTORS TO READ
RST 08 ; DO READ
JP NZ,DB_ERR ; HANDLE ERROR
;
; PASS BOOT DEVICE/UNIT/LU TO CBIOS COLD BOOT
LD DE,-1 ; BOOT ROM PAGE, -1 FOR N/A
LD A,(BL_BOOTID) ; GET BOOT DISK UNIT ID
LD L,A ; PUT IN L
LD BC,$01FC ; UNA FUNC: SET BOOTSTRAP HISTORY
RST 08 ; CALL UNA
JP NZ,DB_ERR ; HANDLE ERROR
;
; JUMP TO COLD BOOT ENTRY
LD HL,(BB_CPMENT) ; GET THE ENTRY POINT
PUSH HL ; PUT ON STACK FOR UNA CHAIN FUNC
LD DE,BID_USR ; TARGET BANK ID IS USER BANK
PUSH DE ; PUT ON STACK FOR UNA CHAIN FUNC
DI ; ENTER WITH INTS DISABLED
JP $FFF7 ; UNA INTER-PAGE EXEC CHAIN
;
#ELSE
;
; READ OS IMAGE INTO MEMORY
LD B,BF_DIOREAD ; FUNCTION IN B
LD A,(BL_DEVICE) ; GET BOOT DISK UNIT
LD C,A ; PUT IN C
LD HL,(BB_CPMLOC) ; LOAD ADDRESS
LD D,0
LD A,(BL_COUNT) ; GET SECTORS TO READ
LD E,A ; NUMBER OF SECTORS TO LOAD
RST 08
JP NZ,DB_ERR ; HANDLE ERRORS
; PASS BOOT DEVICE/UNIT/LU TO CBIOS COLD BOOT
LD B,BF_SYSSET ; HB FUNC: SET HBIOS PARAMETER
LD C,BF_SYSSET_BOOTINFO ; HB SUBFUNC: SET BOOT INFO
LD A,(HB_CURBNK) ; GET CURRENT BANK ID FROM PROXY DATA
LD L,A ; ... AND SAVE AS BOOT BANK
LD A,(BL_DEVICE) ; LOAD BOOT DEVICE/UNIT
LD D,A ; SAVE IN D
LD A,(BL_LU) ; LOAD BOOT LU
LD E,A ; SAVE IN E
RST 08
JP NZ,DB_ERR ; HANDLE ERRORS
; JUMP TO COLD BOOT ENTRY
LD A,BID_USR ; ACTIVATE USER BANK
LD HL,(BB_CPMENT) ; OS ENTRY ADDRESS
DI ; ENTER WITH INTS DISABLED
CALL HB_BNKCALL ; AND GO
HALT ; WE SHOULD NEVER RETURN!!!
;
#ENDIF
;
DB_NODISK:
; SELDSK DID NOT LIKE DRIVE SELECTION
LD DE,STR_NODISK
CALL WRITESTR
JP DOBOOTMENU
DB_NOBOOT:
; DISK IS NOT BOOTABLE
LD DE,STR_NOBOOT
CALL WRITESTR
JP DOBOOTMENU
DB_ERR:
; I/O ERROR DURING BOOT ATTEMPT
LD DE,STR_BOOTERR
CALL WRITESTR
JP DOBOOTMENU
;
#IF (DSKYENABLE)
;
;
;__SEGDISPLAY________________________________________________________________________________________
;
; DISPLAY CONTENTS OF DISPLAYBUF IN DECODED HEX BITS 0-3 ARE DISPLAYED DIG, BIT 7 IS DP
;____________________________________________________________________________________________________
;
SEGDISPLAY:
PUSH AF ; STORE AF
PUSH BC ; STORE BC
PUSH HL ; STORE HL
LD BC,0007H
ADD HL,BC
LD B,08H ; SET DIGIT COUNT
LD A,40H | 30H ; SET CONTROL PORT 7218 TO OFF
OUT (PPIC),A ; OUTPUT
CALL DLY2 ; WAIT
LD A,0F0H ; SET CONTROL TO 1111 (DATA COMING, HEX DECODE,NO DECODE, NORMAL)
SEGDISPLAY1: ;
OUT (PPIA),A ; OUTPUT TO PORT
LD A,80H | 30H ; STROBE WRITE PULSE WITH CONTROL=1
OUT (PPIC),A ; OUTPUT TO PORT
CALL DLY2 ; WAIT
LD A,40H | 30H ; SET CONTROL PORT 7218 TO OFF
OUT (PPIC),A ; OUTPUT
SEGDISPLAY_LP:
LD A,(HL) ; GET DISPLAY DIGIT
OUT (PPIA),A ; OUT TO PPIA
LD A,00H | 30H ; SET WRITE STROBE
OUT (PPIC),A ; OUT TO PPIC
CALL DLY2 ; DELAY
LD A,40H | 30H ; SET CONTROL PORT OFF
OUT (PPIC),A ; OUT TO PPIC
CALL DLY2 ; WAIT
DEC HL ; INC POINTER
DJNZ SEGDISPLAY_LP ; LOOP FOR NEXT DIGIT
POP HL ; RESTORE HL
POP BC ; RESTORE BC
POP AF ; RESTORE AF
RET
#ENDIF
#IF (PLATFORM == PLT_UNA)
;
;
; PRINT LIST OF ALL DRIVES UNDER UNA
;
PRTALL:
LD B,0 ; START WITH UNIT 0
;
PRTALL1: ; LOOP THRU ALL UNITS AVAILABLE
LD C,$48 ; UNA FUNC: GET DISK TYPE
LD L,0 ; PRESET UNIT COUNT TO ZERO
RST 08 ; CALL UNA, B IS ASSUMED TO BE UNTOUCHED!!!
LD A,L ; UNIT COUNT TO A
OR A ; PAST END?
RET Z ; WE ARE DONE
PUSH BC ; SAVE UNIT
CALL PRTDRV ; PROCESS THE UNIT
POP BC ; RESTORE UNIT
INC B ; NEXT UNIT
JR PRTALL1 ; LOOP
;
; PRINT THE UNA UNIT INFO
; ON INPUT B HAS UNIT
;
PRTDRV:
PUSH BC ; SAVE UNIT
PUSH DE ; SAVE DISK TYPE
LD DE,STR_PREFIX ; NEWLINE AND SPACING
CALL WRITESTR ; PRINT IT
LD A,B ; DRIVE LETTER TO A
ADD A,'0' ; MAKE IT DISPLAY NUMERIC
CALL COUT ; PRINT IT
LD A,')' ; DRIVE LETTER COLON
CALL COUT ; PRINT IT
CALL PC_SPACE
POP DE ; RECOVER DISK TYPE
LD A,D ; DISK TYPE TO A
CP $40 ; RAM/ROM?
JR Z,PRTDRV1 ; HANDLE RAM/ROM
LD DE,DEVIDE ; ASSUME IDE
CP $41 ; IDE?
JR Z,PRTDRV2 ; PRINT IT
LD DE,DEVPPIDE ; ASSUME PPIDE
CP $42 ; PPIDE?
JR Z,PRTDRV2 ; PRINT IT
LD DE,DEVSD ; ASSUME SD
CP $43 ; SD?
JR Z,PRTDRV2 ; PRINT IT
LD DE,DEVDSD ; ASSUME DSD
CP $44 ; DSD?
JR Z,PRTDRV2 ; PRINT IT
LD DE,DEVUNK ; OTHERWISE UNKNOWN
JR PRTDRV2
;
PRTDRV1: ; HANDLE RAM/ROM
LD C,$45 ; UNA FUNC: GET DISK INFO
LD DE,BL_INFOSEC ; 512 BYTE BUFFER
RST 08 ; CALL UNA
BIT 7,B ; TEST RAM DRIVE BIT
LD DE,DEVROM ; ASSUME ROM
JR Z,PRTDRV2 ; IF SO, PRINT IT
LD DE,DEVRAM ; OTHERWISE RAM
JR PRTDRV2 ; PRINT IT
;
PRTDRV2: ; PRINT DEVICE
POP BC ; RECOVER UNIT
CALL WRITESTR ; PRINT DEVICE NAME
LD A,B ; UNIT TO A
ADD A,'0' ; MAKE IT PRINTABLE NUMERIC
CALL COUT ; PRINT IT
LD A,':' ; DEVICE NAME COLON
CALL COUT ; PRINT IT
RET ; DONE
;
DEVRAM .DB "RAM$"
DEVROM .DB "ROM$"
DEVIDE .DB "IDE$"
DEVPPIDE .DB "PPIDE$"
DEVSD .DB "SD$"
DEVDSD .DB "DSD$"
DEVUNK .DB "UNK$"
;
#ELSE
;
; PRINT LIST OF ALL DRIVES
;
PRTALL:
;
LD B,BF_SYSGET
LD C,BF_SYSGET_DIOCNT
RST 08 ; E := DISK UNIT COUNT
LD B,E ; COUNT TO B
LD A,B ; COUNT TO A
OR A ; SET FLAGS
RET Z ; BAIL OUT IF ZERO
LD C,0 ; INIT DEVICE INDEX
;
PRTALL1:
LD DE,STR_PREFIX ; FORMATTING
CALL WRITESTR ; PRINT IT
LD A,C ; INDEX TO A
ADD A,'0' ; MAKE NUMERIC CHAR
CALL COUT ; PRINT IT
LD A,')' ; FORMATTING
CALL COUT ; PRINT IT
CALL PC_SPACE ; SPACING
PUSH BC ; SAVE LOOP CONTROL
LD B,BF_DIODEVICE ; HBIOS FUNC: REPORT DEVICE INFO
RST 08 ; CALL HBIOS
CALL PRTDRV ; PRINT IT
POP BC ; RESTORE LOOP CONTROL
INC C ; BUMP INDEX
DJNZ PRTALL1 ; LOOP AS NEEDED
RET ; DONE
;
; PRINT THE DRIVER DEVICE/UNIT INFO
; ON INPUT D HAS DRIVER ID, E HAS DRIVER MODE/UNIT
; DESTROY NO REGISTERS OTHER THAN A
;
PRTDRV:
PUSH DE ; PRESERVE DE
PUSH HL ; PRESERVE HL
LD A,D ; LOAD DEVICE/UNIT
RRCA ; ROTATE DEVICE
RRCA ; ... BITS
RRCA ; ... INTO
RRCA ; ... LOWEST 4 BITS
AND $0F ; ISOLATE DEVICE BITS
ADD A,A ; MULTIPLE BY TWO FOR WORD TABLE
LD HL,DEVTBL ; POINT TO START OF DEVICE NAME TABLE
CALL ADDHLA ; ADD A TO HL TO POINT TO TABLE ENTRY
LD A,(HL) ; DEREFERENCE HL TO LOC OF DEVICE NAME STRING
INC HL ; ...
LD D,(HL) ; ...
LD E,A ; ...
CALL WRITESTR ; PRINT THE DEVICE NMEMONIC
POP HL ; RECOVER HL
POP DE ; RECOVER DE
LD A,E ; LOAD DRIVER MODE/UNIT
AND $0F ; ISOLATE UNIT
CALL PRTDECB ; PRINT IT
CALL PC_COLON ; FORMATTING
;LD A,E ; LOAD LU
;CALL PRTDECB ; PRINT IT
RET
;
DEVTBL: ; DEVICE TABLE
.DW DEV00, DEV01, DEV02, DEV03
.DW DEV04, DEV05, DEV06, DEV07
.DW DEV08, DEV09, DEV10, DEV11
.DW DEV12, DEV13, DEV14, DEV15
;
DEVUNK .DB "???$"
DEV00 .DB "MD$"
DEV01 .DB "FD$"
DEV02 .DB "RAMF$"
DEV03 .DB "IDE$"
DEV04 .DB "ATAPI$"
DEV05 .DB "PPIDE$"
DEV06 .DB "SD$"
DEV07 .DB "PRPSD$"
DEV08 .DB "PPPSD$"
DEV09 .DB "HDSK$"
DEV10 .EQU DEVUNK
DEV11 .EQU DEVUNK
DEV12 .EQU DEVUNK
DEV13 .EQU DEVUNK
DEV14 .EQU DEVUNK
DEV15 .EQU DEVUNK
;
#ENDIF
;
;__TEXT_STRINGS_________________________________________________________________________________________________________________
;
; STRINGS
;_____________________________________________________________________________________________________________________________
;
STR_BOOTDISK .DB "BOOT FROM DISK\r\n$"
STR_BOOTDISK1 .DB "\r\nReading disk information...$"
STR_BOOTMON .DB "START MONITOR\r\n$"
STR_BOOTCPM .DB "BOOT CPM FROM ROM\r\n$"
STR_BOOTZSYS .DB "BOOT ZSYSTEM FROM ROM\r\n$"
STR_LIST .DB "LIST DEVICES\r\n$"
STR_INVALID .DB "INVALID SELECTION\r\n$"
STR_SETUP .DB "SYSTEM SETUP\r\n$"
STR_SIG .DB "SIGNATURE=$"
STR_CPMLOC .DB "LOC=$"
STR_CPMEND .DB "END=$"
STR_CPMENT .DB "ENT=$"
STR_LABEL .DB "LABEL=$"
STR_DRVLIST .DB "\r\nDisk Devices:\r\n$"
STR_PREFIX .DB "\r\n $"
STR_LOADING .DB "\r\nLoading...$"
STR_NODISK .DB "\r\nNo disk!$"
STR_NOBOOT .DB "\r\nDisk not bootable!$"
STR_BOOTERR .DB "\r\nBoot failure!$"
;
STR_BANNER .DB "\r\n", PLATFORM_NAME, " Boot Loader$"
STR_BOOTMENU .DB "\r\n"
.DB "Boot: (C)PM, (Z)System, (M)onitor,\r\n"
.DB " (L)ist disks, or Disk Unit # ===> $"
;
.IF DSKYENABLE
BOOT:
; . . t o o b
.DB 00H, 00H, 80H, 80H, 094H, 09DH, 09DH, 09FH
.ENDIF
;
#DEFINE USEDELAY
#INCLUDE "util.asm"
;
#IF (DSKYENABLE)
#DEFINE DSKY_KBD
#INCLUDE "dsky.asm"
#ENDIF
;
;==================================================================================================
; CONSOLE CHARACTER I/O HELPER ROUTINES (REGISTERS PRESERVED)
;==================================================================================================
;
#IF (PLATFORM != PLT_UNA)
;
; OUTPUT CHARACTER FROM A
;
COUT:
; SAVE ALL INCOMING REGISTERS
PUSH AF
PUSH BC
PUSH DE
PUSH HL
;
; OUTPUT CHARACTER TO CONSOLE VIA HBIOS
LD E,A ; OUTPUT CHAR TO E
LD C,CIODEV_CONSOLE ; CONSOLE UNIT TO C
LD B,BF_CIOOUT ; HBIOS FUNC: OUTPUT CHAR
RST 08 ; HBIOS OUTPUTS CHARACTDR
;
; RESTORE ALL REGISTERS
POP HL
POP DE
POP BC
POP AF
RET
;
; INPUT CHARACTER TO A
;
CIN:
; SAVE INCOMING REGISTERS (AF IS OUTPUT)
PUSH BC
PUSH DE
PUSH HL
;
; INPUT CHARACTER FROM CONSOLE VIA HBIOS
LD C,CIODEV_CONSOLE ; CONSOLE UNIT TO C
LD B,BF_CIOIN ; HBIOS FUNC: INPUT CHAR
RST 08 ; HBIOS READS CHARACTDR
LD A,E ; MOVE CHARACTER TO A FOR RETURN
;
; RESTORE REGISTERS (AF IS OUTPUT)
POP HL
POP DE
POP BC
RET
;
; RETURN INPUT STATUS IN A (0 = NO CHAR, !=0 CHAR WAITING)
;
CST:
; SAVE INCOMING REGISTERS (AF IS OUTPUT)
PUSH BC
PUSH DE
PUSH HL
;
; GET CONSOLE INPUT STATUS VIA HBIOS
LD C,CIODEV_CONSOLE ; CONSOLE UNIT TO C
LD B,BF_CIOIST ; HBIOS FUNC: INPUT STATUS
RST 08 ; HBIOS RETURNS STATUS IN A
;
; RESTORE REGISTERS (AF IS OUTPUT)
POP HL
POP DE
POP BC
RET
;
#ENDIF
;
#IF (PLATFORM == PLT_UNA)
;
; OUTPUT CHARACTER FROM A
;
COUT:
; SAVE ALL INCOMING REGISTERS
PUSH AF
PUSH BC
PUSH DE
PUSH HL
;
; OUTPUT CHARACTER TO CONSOLE VIA UBIOS
LD E,A
LD BC,$12
RST 08
;
; RESTORE ALL REGISTERS
POP HL
POP DE
POP BC
POP AF
RET
;
; INPUT CHARACTER TO A
;
CIN:
; SAVE INCOMING REGISTERS (AF IS OUTPUT)
PUSH BC
PUSH DE
PUSH HL
;
; INPUT CHARACTER FROM CONSOLE VIA UBIOS
LD BC,$11
RST 08
LD A,E
;
; RESTORE REGISTERS (AF IS OUTPUT)
POP HL
POP DE
POP BC
RET
;
; RETURN INPUT STATUS IN A (0 = NO CHAR, !=0 CHAR WAITING)
;
CST:
; SAVE INCOMING REGISTERS (AF IS OUTPUT)
PUSH BC
PUSH DE
PUSH HL
;
; GET CONSOLE INPUT STATUS VIA UBIOS
LD BC,$13
RST 08
LD A,E
;
; RESTORE REGISTERS (AF IS OUTPUT)
POP HL
POP DE
POP BC
RET
;
#ENDIF
;
; READ A CONSOLE CHARACTER AND CONVERT TO UPPER CASE
;
CINUC:
CALL CIN
AND 7FH ; STRIP HI BIT
CP 'A' ; KEEP NUMBERS, CONTROLS
RET C ; AND UPPER CASE
CP 7BH ; SEE IF NOT LOWER CASE
RET NC
AND 5FH ; MAKE UPPER CASE
RET
;
;==================================================================================================
; FILL REMAINDER OF BANK
;==================================================================================================
;
SLACK: .EQU ($1000 - $)
.FILL SLACK
;
.ECHO "LOADER space remaining: "
.ECHO SLACK
.ECHO " bytes.\n"
;
;==================================================================================================
; WORKING DATA STORAGE
;==================================================================================================
;
.ORG $8000
;
.DS 64 ; 32 LEVEL STACK
BL_STACK .EQU $ ; ... TOP IS HERE
;
BL_COUNT .DS 1 ; LOAD COUNTER
BL_TIMEOUT .DS 2 ; AUTOBOOT TIMEOUT COUNTDOWN COUNTER
BL_BOOTID .DS 1 ; BOOT DEVICE ID CHOSEN BY USER
BL_DEVICE .DS 1 ; DEVICE TO LOAD FROM
BL_LU .DS 1 ; LU TO LOAD FROM
;
; BOOT INFO SECTOR IS READ INTO AREA BELOW
; THE THIRD SECTOR OF A DISK DEVICE IS RESERVED FOR BOOT INFO
;
BL_INFOSEC .EQU $
.DS (512 - 128)
BB_METABUF .EQU $
BB_SIG .DS 2 ; SIGNATURE (WILL BE 0A55AH IF SET)
BB_PLATFORM .DS 1 ; FORMATTING PLATFORM
BB_DEVICE .DS 1 ; FORMATTING DEVICE
BB_FORMATTER .DS 8 ; FORMATTING PROGRAM
BB_DRIVE .DS 1 ; PHYSICAL DISK DRIVE #
BB_LU .DS 1 ; LOGICAL UNIT (LU)
.DS 1 ; MSB OF LU, NOW DEPRECATED
.DS (BB_METABUF + 128) - $ - 32
BB_PROTECT .DS 1 ; WRITE PROTECT BOOLEAN
BB_UPDATES .DS 2 ; UPDATE COUNTER
BB_RMJ .DS 1 ; RMJ MAJOR VERSION NUMBER
BB_RMN .DS 1 ; RMN MINOR VERSION NUMBER
BB_RUP .DS 1 ; RUP UPDATE NUMBER
BB_RTP .DS 1 ; RTP PATCH LEVEL
BB_LABEL .DS 16 ; 16 CHARACTER DRIVE LABEL
BB_TERM .DS 1 ; LABEL TERMINATOR ('$')
BB_BILOC .DS 2 ; LOC TO PATCH BOOT DRIVE INFO TO (IF NOT ZERO)
BB_CPMLOC .DS 2 ; FINAL RAM DESTINATION FOR CPM/CBIOS
BB_CPMEND .DS 2 ; END ADDRESS FOR LOAD
BB_CPMENT .DS 2 ; CP/M ENTRY POINT (CBIOS COLD BOOT)
;
.END
|
programs/oeis/182/A182058.asm | neoneye/loda | 22 | 163653 | ; A182058: Number of moves needed to solve the Towers of Hanoi puzzle with 6 pegs and n disks.
; 1,3,5,7,9,13,17,21,25,29,33,37,41,45,49,57,65,73,81,89
mov $1,$0
sub $1,4
mov $2,$0
mov $0,3
add $0,$2
lpb $1
add $0,$1
trn $1,10
add $0,$1
lpe
mul $0,2
sub $0,5
|
alloy4fun_models/trashltl/models/9/hvrp9XFhMKqQrTtJc.als | Kaixi26/org.alloytools.alloy | 0 | 2842 | <filename>alloy4fun_models/trashltl/models/9/hvrp9XFhMKqQrTtJc.als
open main
pred idhvrp9XFhMKqQrTtJc_prop10 {
always all f:File | (f in Protected implies always f in Protected) and (f not in Protected implies always f not in Protected)
}
pred __repair { idhvrp9XFhMKqQrTtJc_prop10 }
check __repair { idhvrp9XFhMKqQrTtJc_prop10 <=> prop10o } |
hello_world.adb | shalithasuranga/hello-world | 3 | 30672 | <filename>hello_world.adb
with Ada.Text_IO;
procedure HelloWorld is
begin
Ada.Text_IO.Put_Line("Hello, world!");
end HelloWorld;
|
tests/issue67/1.asm | NullMember/customasm | 414 | 161981 | <filename>tests/issue67/1.asm<gh_stars>100-1000
#subruledef Reg
{
x => 0x00
y => 0xff
}
#ruledef
{
add {r: Reg} =>
{
assert((r & 0xff) != 0xff)
r
}
}
add x
add y
; error:_:17: failed to resolve
; error:_:11: assertion |
test/Succeed/Issue907a.agda | cruhland/agda | 1,989 | 6474 | -- Andreas, 2013-10-27
{-# OPTIONS --copatterns #-}
module Issue907a where
import Common.Level
open import Common.Prelude
open import Common.Product
data Vec (A : Set) : Nat → Set where
[] : Vec A zero
test : ∀ {A} → Σ Nat λ n → Vec A n
proj₁ test = zero
proj₂ test = []
|
src/SlimShader.Tests/Shaders/Sdk/Direct3D11/ContactHardeningShadows11/ContactHardeningShadows11_VS.asm | tgjones/slimshader | 125 | 15306 | //
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20714
//
//
///
// Buffer Definitions:
//
// cbuffer cbConstants
// {
//
// float4x4 g_f4x4WorldViewProjection;// Offset: 0 Size: 64
// float4x4 g_f4x4WorldViewProjLight; // Offset: 64 Size: 64
// float4 g_vShadowMapDimensions; // Offset: 128 Size: 16 [unused]
// float4 g_f4LightDir; // Offset: 144 Size: 16
// float g_fSunWidth; // Offset: 160 Size: 4 [unused]
// float3 g_f3Padding; // Offset: 164 Size: 12 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// cbConstants cbuffer NA NA 0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION 0 xyz 0 NONE float xyz
// NORMAL 0 xyz 1 NONE float xyz
// TEXTURE 0 xy 2 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position 0 xyzw 0 POS float xyzw
// COLOR 0 xyzw 1 NONE float xyzw
// TEXTURE 0 xy 2 NONE float xy
// TEXTURE 1 xyzw 3 NONE float xyzw
//
vs_4_0
dcl_constantbuffer cb0[10], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_output o3.xyzw
dcl_temps 3
mov r0.xyz, v0.xyzx
mov r0.w, l(1.000000)
dp4 o0.x, r0.xyzw, cb0[0].xyzw
dp4 o0.y, r0.xyzw, cb0[1].xyzw
dp4 o0.z, r0.xyzw, cb0[2].xyzw
dp4 o0.w, r0.xyzw, cb0[3].xyzw
dp3 r1.x, v1.xyzx, v1.xyzx
rsq r1.x, r1.x
mul r1.xyz, r1.xxxx, v1.xyzx
dp3 r1.w, -cb0[9].xyzx, -cb0[9].xyzx
rsq r1.w, r1.w
mul r2.xyz, r1.wwww, -cb0[9].xyzx
dp3_sat o1.xyz, r1.xyzx, r2.xyzx
mov o1.w, l(1.000000)
mov o2.xy, v2.xyxx
dp4 o3.x, r0.xyzw, cb0[4].xyzw
dp4 o3.y, r0.xyzw, cb0[5].xyzw
dp4 o3.z, r0.xyzw, cb0[6].xyzw
dp4 o3.w, r0.xyzw, cb0[7].xyzw
ret
// Approximately 20 instruction slots used
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_382.asm | ljhsiun2/medusa | 9 | 87398 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x164ea, %rsi
nop
nop
sub %r9, %r9
mov (%rsi), %r8
nop
nop
nop
add $5823, %rdx
lea addresses_normal_ht+0xac0c, %rsi
lea addresses_UC_ht+0x19966, %rdi
clflush (%rsi)
nop
nop
nop
nop
cmp %rdx, %rdx
mov $66, %rcx
rep movsw
nop
nop
nop
nop
inc %rsi
lea addresses_normal_ht+0x1dbc6, %rdi
nop
nop
sub $15065, %rax
mov $0x6162636465666768, %r8
movq %r8, (%rdi)
nop
inc %r8
lea addresses_D_ht+0x1bc36, %r8
nop
cmp %r9, %r9
movb $0x61, (%r8)
sub $40577, %r8
lea addresses_A_ht+0x8fc6, %rsi
lea addresses_UC_ht+0x4026, %rdi
sub %r11, %r11
mov $118, %rcx
rep movsq
nop
nop
cmp $53528, %r8
lea addresses_A_ht+0x494e, %rax
nop
nop
nop
nop
sub $20921, %rsi
movb $0x61, (%rax)
nop
nop
sub $53343, %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r8
push %r9
push %rcx
push %rdx
// Store
lea addresses_normal+0xa3c6, %r10
nop
nop
nop
nop
nop
mfence
mov $0x5152535455565758, %r8
movq %r8, %xmm0
movups %xmm0, (%r10)
nop
nop
nop
add $44771, %r8
// Store
mov $0x14a, %r11
nop
nop
nop
inc %rdx
mov $0x5152535455565758, %rcx
movq %rcx, %xmm0
movups %xmm0, (%r11)
nop
and $22763, %r11
// Store
lea addresses_normal+0x19986, %r9
nop
nop
nop
sub $24987, %r12
mov $0x5152535455565758, %r8
movq %r8, (%r9)
nop
nop
nop
nop
xor %r11, %r11
// Store
lea addresses_WC+0x8fba, %r12
add %rdx, %rdx
movl $0x51525354, (%r12)
nop
xor $4765, %r11
// Store
lea addresses_PSE+0x150c8, %r11
nop
nop
nop
nop
xor %r12, %r12
mov $0x5152535455565758, %r9
movq %r9, %xmm7
movaps %xmm7, (%r11)
nop
nop
cmp $38264, %r8
// Faulty Load
lea addresses_D+0x8bc6, %rcx
nop
xor %r12, %r12
mov (%rcx), %r8
lea oracles, %r9
and $0xff, %r8
shlq $12, %r8
mov (%r9,%r8,1), %r8
pop %rdx
pop %rcx
pop %r9
pop %r8
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': True, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': True, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': True, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'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
*/
|
ls.asm | bhavesh01shukla/Modified-XV-6 | 0 | 102315 |
_ls: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
close(fd);
}
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 56 push %esi
e: 53 push %ebx
f: 51 push %ecx
10: 83 ec 0c sub $0xc,%esp
13: 8b 01 mov (%ecx),%eax
15: 8b 51 04 mov 0x4(%ecx),%edx
int i;
if(argc < 2){
18: 83 f8 01 cmp $0x1,%eax
1b: 7e 24 jle 41 <main+0x41>
1d: 8d 5a 04 lea 0x4(%edx),%ebx
20: 8d 34 82 lea (%edx,%eax,4),%esi
23: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
27: 90 nop
ls(".");
exit();
}
for(i=1; i<argc; i++)
ls(argv[i]);
28: 83 ec 0c sub $0xc,%esp
2b: ff 33 pushl (%ebx)
2d: 83 c3 04 add $0x4,%ebx
30: e8 db 00 00 00 call 110 <ls>
for(i=1; i<argc; i++)
35: 83 c4 10 add $0x10,%esp
38: 39 f3 cmp %esi,%ebx
3a: 75 ec jne 28 <main+0x28>
exit();
3c: e8 60 05 00 00 call 5a1 <exit>
ls(".");
41: 83 ec 0c sub $0xc,%esp
44: 68 e0 0a 00 00 push $0xae0
49: e8 c2 00 00 00 call 110 <ls>
exit();
4e: e8 4e 05 00 00 call 5a1 <exit>
53: 66 90 xchg %ax,%ax
55: 66 90 xchg %ax,%ax
57: 66 90 xchg %ax,%ax
59: 66 90 xchg %ax,%ax
5b: 66 90 xchg %ax,%ax
5d: 66 90 xchg %ax,%ax
5f: 90 nop
00000060 <fmtname>:
{
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
63: 56 push %esi
64: 53 push %ebx
65: 8b 75 08 mov 0x8(%ebp),%esi
for(p=path+strlen(path); p >= path && *p != '/'; p--)
68: 83 ec 0c sub $0xc,%esp
6b: 56 push %esi
6c: e8 5f 03 00 00 call 3d0 <strlen>
71: 83 c4 10 add $0x10,%esp
74: 01 f0 add %esi,%eax
76: 89 c3 mov %eax,%ebx
78: 0f 82 82 00 00 00 jb 100 <fmtname+0xa0>
7e: 80 38 2f cmpb $0x2f,(%eax)
81: 75 0d jne 90 <fmtname+0x30>
83: eb 7b jmp 100 <fmtname+0xa0>
85: 8d 76 00 lea 0x0(%esi),%esi
88: 80 7b ff 2f cmpb $0x2f,-0x1(%ebx)
8c: 74 09 je 97 <fmtname+0x37>
8e: 89 c3 mov %eax,%ebx
90: 8d 43 ff lea -0x1(%ebx),%eax
93: 39 c6 cmp %eax,%esi
95: 76 f1 jbe 88 <fmtname+0x28>
if(strlen(p) >= DIRSIZ)
97: 83 ec 0c sub $0xc,%esp
9a: 53 push %ebx
9b: e8 30 03 00 00 call 3d0 <strlen>
a0: 83 c4 10 add $0x10,%esp
a3: 83 f8 0d cmp $0xd,%eax
a6: 77 4a ja f2 <fmtname+0x92>
memmove(buf, p, strlen(p));
a8: 83 ec 0c sub $0xc,%esp
ab: 53 push %ebx
ac: e8 1f 03 00 00 call 3d0 <strlen>
b1: 83 c4 0c add $0xc,%esp
b4: 50 push %eax
b5: 53 push %ebx
b6: 68 18 0e 00 00 push $0xe18
bb: e8 b0 04 00 00 call 570 <memmove>
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
c0: 89 1c 24 mov %ebx,(%esp)
c3: e8 08 03 00 00 call 3d0 <strlen>
c8: 89 1c 24 mov %ebx,(%esp)
return buf;
cb: bb 18 0e 00 00 mov $0xe18,%ebx
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
d0: 89 c6 mov %eax,%esi
d2: e8 f9 02 00 00 call 3d0 <strlen>
d7: ba 0e 00 00 00 mov $0xe,%edx
dc: 83 c4 0c add $0xc,%esp
df: 29 f2 sub %esi,%edx
e1: 05 18 0e 00 00 add $0xe18,%eax
e6: 52 push %edx
e7: 6a 20 push $0x20
e9: 50 push %eax
ea: e8 11 03 00 00 call 400 <memset>
return buf;
ef: 83 c4 10 add $0x10,%esp
}
f2: 8d 65 f8 lea -0x8(%ebp),%esp
f5: 89 d8 mov %ebx,%eax
f7: 5b pop %ebx
f8: 5e pop %esi
f9: 5d pop %ebp
fa: c3 ret
fb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ff: 90 nop
100: 83 c3 01 add $0x1,%ebx
103: eb 92 jmp 97 <fmtname+0x37>
105: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
10c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000110 <ls>:
{
110: 55 push %ebp
111: 89 e5 mov %esp,%ebp
113: 57 push %edi
114: 56 push %esi
115: 53 push %ebx
116: 81 ec 64 02 00 00 sub $0x264,%esp
11c: 8b 7d 08 mov 0x8(%ebp),%edi
if((fd = open(path, 0)) < 0){
11f: 6a 00 push $0x0
121: 57 push %edi
122: e8 ba 04 00 00 call 5e1 <open>
127: 83 c4 10 add $0x10,%esp
12a: 85 c0 test %eax,%eax
12c: 0f 88 9e 01 00 00 js 2d0 <ls+0x1c0>
if(fstat(fd, &st) < 0){
132: 83 ec 08 sub $0x8,%esp
135: 8d b5 d4 fd ff ff lea -0x22c(%ebp),%esi
13b: 89 c3 mov %eax,%ebx
13d: 56 push %esi
13e: 50 push %eax
13f: e8 b5 04 00 00 call 5f9 <fstat>
144: 83 c4 10 add $0x10,%esp
147: 85 c0 test %eax,%eax
149: 0f 88 c1 01 00 00 js 310 <ls+0x200>
switch(st.type){
14f: 0f b7 85 d4 fd ff ff movzwl -0x22c(%ebp),%eax
156: 66 83 f8 01 cmp $0x1,%ax
15a: 74 64 je 1c0 <ls+0xb0>
15c: 66 83 f8 02 cmp $0x2,%ax
160: 74 1e je 180 <ls+0x70>
close(fd);
162: 83 ec 0c sub $0xc,%esp
165: 53 push %ebx
166: e8 5e 04 00 00 call 5c9 <close>
16b: 83 c4 10 add $0x10,%esp
}
16e: 8d 65 f4 lea -0xc(%ebp),%esp
171: 5b pop %ebx
172: 5e pop %esi
173: 5f pop %edi
174: 5d pop %ebp
175: c3 ret
176: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
17d: 8d 76 00 lea 0x0(%esi),%esi
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
180: 83 ec 0c sub $0xc,%esp
183: 8b 95 e4 fd ff ff mov -0x21c(%ebp),%edx
189: 8b b5 dc fd ff ff mov -0x224(%ebp),%esi
18f: 57 push %edi
190: 89 95 b4 fd ff ff mov %edx,-0x24c(%ebp)
196: e8 c5 fe ff ff call 60 <fmtname>
19b: 8b 95 b4 fd ff ff mov -0x24c(%ebp),%edx
1a1: 59 pop %ecx
1a2: 5f pop %edi
1a3: 52 push %edx
1a4: 56 push %esi
1a5: 6a 02 push $0x2
1a7: 50 push %eax
1a8: 68 c0 0a 00 00 push $0xac0
1ad: 6a 01 push $0x1
1af: e8 7c 05 00 00 call 730 <printf>
break;
1b4: 83 c4 20 add $0x20,%esp
1b7: eb a9 jmp 162 <ls+0x52>
1b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
1c0: 83 ec 0c sub $0xc,%esp
1c3: 57 push %edi
1c4: e8 07 02 00 00 call 3d0 <strlen>
1c9: 83 c4 10 add $0x10,%esp
1cc: 83 c0 10 add $0x10,%eax
1cf: 3d 00 02 00 00 cmp $0x200,%eax
1d4: 0f 87 16 01 00 00 ja 2f0 <ls+0x1e0>
strcpy(buf, path);
1da: 83 ec 08 sub $0x8,%esp
1dd: 57 push %edi
1de: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi
1e4: 57 push %edi
1e5: e8 66 01 00 00 call 350 <strcpy>
p = buf+strlen(buf);
1ea: 89 3c 24 mov %edi,(%esp)
1ed: e8 de 01 00 00 call 3d0 <strlen>
while(read(fd, &de, sizeof(de)) == sizeof(de)){
1f2: 83 c4 10 add $0x10,%esp
p = buf+strlen(buf);
1f5: 01 f8 add %edi,%eax
*p++ = '/';
1f7: 8d 48 01 lea 0x1(%eax),%ecx
p = buf+strlen(buf);
1fa: 89 85 a8 fd ff ff mov %eax,-0x258(%ebp)
*p++ = '/';
200: 89 8d a4 fd ff ff mov %ecx,-0x25c(%ebp)
206: c6 00 2f movb $0x2f,(%eax)
while(read(fd, &de, sizeof(de)) == sizeof(de)){
209: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
210: 83 ec 04 sub $0x4,%esp
213: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax
219: 6a 10 push $0x10
21b: 50 push %eax
21c: 53 push %ebx
21d: e8 97 03 00 00 call 5b9 <read>
222: 83 c4 10 add $0x10,%esp
225: 83 f8 10 cmp $0x10,%eax
228: 0f 85 34 ff ff ff jne 162 <ls+0x52>
if(de.inum == 0)
22e: 66 83 bd c4 fd ff ff cmpw $0x0,-0x23c(%ebp)
235: 00
236: 74 d8 je 210 <ls+0x100>
memmove(p, de.name, DIRSIZ);
238: 83 ec 04 sub $0x4,%esp
23b: 8d 85 c6 fd ff ff lea -0x23a(%ebp),%eax
241: 6a 0e push $0xe
243: 50 push %eax
244: ff b5 a4 fd ff ff pushl -0x25c(%ebp)
24a: e8 21 03 00 00 call 570 <memmove>
p[DIRSIZ] = 0;
24f: 8b 85 a8 fd ff ff mov -0x258(%ebp),%eax
255: c6 40 0f 00 movb $0x0,0xf(%eax)
if(stat(buf, &st) < 0){
259: 58 pop %eax
25a: 5a pop %edx
25b: 56 push %esi
25c: 57 push %edi
25d: e8 7e 02 00 00 call 4e0 <stat>
262: 83 c4 10 add $0x10,%esp
265: 85 c0 test %eax,%eax
267: 0f 88 cb 00 00 00 js 338 <ls+0x228>
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
26d: 83 ec 0c sub $0xc,%esp
270: 8b 8d e4 fd ff ff mov -0x21c(%ebp),%ecx
276: 8b 95 dc fd ff ff mov -0x224(%ebp),%edx
27c: 57 push %edi
27d: 0f bf 85 d4 fd ff ff movswl -0x22c(%ebp),%eax
284: 89 8d ac fd ff ff mov %ecx,-0x254(%ebp)
28a: 89 95 b0 fd ff ff mov %edx,-0x250(%ebp)
290: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp)
296: e8 c5 fd ff ff call 60 <fmtname>
29b: 5a pop %edx
29c: 8b 95 b0 fd ff ff mov -0x250(%ebp),%edx
2a2: 59 pop %ecx
2a3: 8b 8d ac fd ff ff mov -0x254(%ebp),%ecx
2a9: 51 push %ecx
2aa: 52 push %edx
2ab: ff b5 b4 fd ff ff pushl -0x24c(%ebp)
2b1: 50 push %eax
2b2: 68 c0 0a 00 00 push $0xac0
2b7: 6a 01 push $0x1
2b9: e8 72 04 00 00 call 730 <printf>
2be: 83 c4 20 add $0x20,%esp
2c1: e9 4a ff ff ff jmp 210 <ls+0x100>
2c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2cd: 8d 76 00 lea 0x0(%esi),%esi
printf(2, "ls: cannot open %s\n", path);
2d0: 83 ec 04 sub $0x4,%esp
2d3: 57 push %edi
2d4: 68 98 0a 00 00 push $0xa98
2d9: 6a 02 push $0x2
2db: e8 50 04 00 00 call 730 <printf>
return;
2e0: 83 c4 10 add $0x10,%esp
}
2e3: 8d 65 f4 lea -0xc(%ebp),%esp
2e6: 5b pop %ebx
2e7: 5e pop %esi
2e8: 5f pop %edi
2e9: 5d pop %ebp
2ea: c3 ret
2eb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
2ef: 90 nop
printf(1, "ls: path too long\n");
2f0: 83 ec 08 sub $0x8,%esp
2f3: 68 cd 0a 00 00 push $0xacd
2f8: 6a 01 push $0x1
2fa: e8 31 04 00 00 call 730 <printf>
break;
2ff: 83 c4 10 add $0x10,%esp
302: e9 5b fe ff ff jmp 162 <ls+0x52>
307: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
30e: 66 90 xchg %ax,%ax
printf(2, "ls: cannot stat %s\n", path);
310: 83 ec 04 sub $0x4,%esp
313: 57 push %edi
314: 68 ac 0a 00 00 push $0xaac
319: 6a 02 push $0x2
31b: e8 10 04 00 00 call 730 <printf>
close(fd);
320: 89 1c 24 mov %ebx,(%esp)
323: e8 a1 02 00 00 call 5c9 <close>
return;
328: 83 c4 10 add $0x10,%esp
}
32b: 8d 65 f4 lea -0xc(%ebp),%esp
32e: 5b pop %ebx
32f: 5e pop %esi
330: 5f pop %edi
331: 5d pop %ebp
332: c3 ret
333: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
337: 90 nop
printf(1, "ls: cannot stat %s\n", buf);
338: 83 ec 04 sub $0x4,%esp
33b: 57 push %edi
33c: 68 ac 0a 00 00 push $0xaac
341: 6a 01 push $0x1
343: e8 e8 03 00 00 call 730 <printf>
continue;
348: 83 c4 10 add $0x10,%esp
34b: e9 c0 fe ff ff jmp 210 <ls+0x100>
00000350 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
350: 55 push %ebp
char *os;
os = s;
while((*s++ = *t++) != 0)
351: 31 d2 xor %edx,%edx
{
353: 89 e5 mov %esp,%ebp
355: 53 push %ebx
356: 8b 45 08 mov 0x8(%ebp),%eax
359: 8b 5d 0c mov 0xc(%ebp),%ebx
35c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while((*s++ = *t++) != 0)
360: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
364: 88 0c 10 mov %cl,(%eax,%edx,1)
367: 83 c2 01 add $0x1,%edx
36a: 84 c9 test %cl,%cl
36c: 75 f2 jne 360 <strcpy+0x10>
;
return os;
}
36e: 5b pop %ebx
36f: 5d pop %ebp
370: c3 ret
371: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
378: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
37f: 90 nop
00000380 <strcmp>:
int
strcmp(const char *p, const char *q)
{
380: 55 push %ebp
381: 89 e5 mov %esp,%ebp
383: 56 push %esi
384: 53 push %ebx
385: 8b 5d 08 mov 0x8(%ebp),%ebx
388: 8b 75 0c mov 0xc(%ebp),%esi
while(*p && *p == *q)
38b: 0f b6 13 movzbl (%ebx),%edx
38e: 0f b6 0e movzbl (%esi),%ecx
391: 84 d2 test %dl,%dl
393: 74 1e je 3b3 <strcmp+0x33>
395: b8 01 00 00 00 mov $0x1,%eax
39a: 38 ca cmp %cl,%dl
39c: 74 09 je 3a7 <strcmp+0x27>
39e: eb 20 jmp 3c0 <strcmp+0x40>
3a0: 83 c0 01 add $0x1,%eax
3a3: 38 ca cmp %cl,%dl
3a5: 75 19 jne 3c0 <strcmp+0x40>
3a7: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx
3ab: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx
3af: 84 d2 test %dl,%dl
3b1: 75 ed jne 3a0 <strcmp+0x20>
3b3: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
3b5: 5b pop %ebx
3b6: 5e pop %esi
return (uchar)*p - (uchar)*q;
3b7: 29 c8 sub %ecx,%eax
}
3b9: 5d pop %ebp
3ba: c3 ret
3bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3bf: 90 nop
3c0: 0f b6 c2 movzbl %dl,%eax
3c3: 5b pop %ebx
3c4: 5e pop %esi
return (uchar)*p - (uchar)*q;
3c5: 29 c8 sub %ecx,%eax
}
3c7: 5d pop %ebp
3c8: c3 ret
3c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000003d0 <strlen>:
uint
strlen(const char *s)
{
3d0: 55 push %ebp
3d1: 89 e5 mov %esp,%ebp
3d3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3d6: 80 39 00 cmpb $0x0,(%ecx)
3d9: 74 15 je 3f0 <strlen+0x20>
3db: 31 d2 xor %edx,%edx
3dd: 8d 76 00 lea 0x0(%esi),%esi
3e0: 83 c2 01 add $0x1,%edx
3e3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3e7: 89 d0 mov %edx,%eax
3e9: 75 f5 jne 3e0 <strlen+0x10>
;
return n;
}
3eb: 5d pop %ebp
3ec: c3 ret
3ed: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
3f0: 31 c0 xor %eax,%eax
}
3f2: 5d pop %ebp
3f3: c3 ret
3f4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3fb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3ff: 90 nop
00000400 <memset>:
void*
memset(void *dst, int c, uint n)
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 57 push %edi
404: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
407: 8b 4d 10 mov 0x10(%ebp),%ecx
40a: 8b 45 0c mov 0xc(%ebp),%eax
40d: 89 d7 mov %edx,%edi
40f: fc cld
410: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
412: 89 d0 mov %edx,%eax
414: 5f pop %edi
415: 5d pop %ebp
416: c3 ret
417: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
41e: 66 90 xchg %ax,%ax
00000420 <strchr>:
char*
strchr(const char *s, char c)
{
420: 55 push %ebp
421: 89 e5 mov %esp,%ebp
423: 53 push %ebx
424: 8b 45 08 mov 0x8(%ebp),%eax
427: 8b 55 0c mov 0xc(%ebp),%edx
for(; *s; s++)
42a: 0f b6 18 movzbl (%eax),%ebx
42d: 84 db test %bl,%bl
42f: 74 1d je 44e <strchr+0x2e>
431: 89 d1 mov %edx,%ecx
if(*s == c)
433: 38 d3 cmp %dl,%bl
435: 75 0d jne 444 <strchr+0x24>
437: eb 17 jmp 450 <strchr+0x30>
439: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
440: 38 ca cmp %cl,%dl
442: 74 0c je 450 <strchr+0x30>
for(; *s; s++)
444: 83 c0 01 add $0x1,%eax
447: 0f b6 10 movzbl (%eax),%edx
44a: 84 d2 test %dl,%dl
44c: 75 f2 jne 440 <strchr+0x20>
return (char*)s;
return 0;
44e: 31 c0 xor %eax,%eax
}
450: 5b pop %ebx
451: 5d pop %ebp
452: c3 ret
453: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
45a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000460 <gets>:
char*
gets(char *buf, int max)
{
460: 55 push %ebp
461: 89 e5 mov %esp,%ebp
463: 57 push %edi
464: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
465: 31 f6 xor %esi,%esi
{
467: 53 push %ebx
468: 89 f3 mov %esi,%ebx
46a: 83 ec 1c sub $0x1c,%esp
46d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
470: eb 2f jmp 4a1 <gets+0x41>
472: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
478: 83 ec 04 sub $0x4,%esp
47b: 8d 45 e7 lea -0x19(%ebp),%eax
47e: 6a 01 push $0x1
480: 50 push %eax
481: 6a 00 push $0x0
483: e8 31 01 00 00 call 5b9 <read>
if(cc < 1)
488: 83 c4 10 add $0x10,%esp
48b: 85 c0 test %eax,%eax
48d: 7e 1c jle 4ab <gets+0x4b>
break;
buf[i++] = c;
48f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
493: 83 c7 01 add $0x1,%edi
496: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
499: 3c 0a cmp $0xa,%al
49b: 74 23 je 4c0 <gets+0x60>
49d: 3c 0d cmp $0xd,%al
49f: 74 1f je 4c0 <gets+0x60>
for(i=0; i+1 < max; ){
4a1: 83 c3 01 add $0x1,%ebx
4a4: 89 fe mov %edi,%esi
4a6: 3b 5d 0c cmp 0xc(%ebp),%ebx
4a9: 7c cd jl 478 <gets+0x18>
4ab: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
4ad: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
4b0: c6 03 00 movb $0x0,(%ebx)
}
4b3: 8d 65 f4 lea -0xc(%ebp),%esp
4b6: 5b pop %ebx
4b7: 5e pop %esi
4b8: 5f pop %edi
4b9: 5d pop %ebp
4ba: c3 ret
4bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
4bf: 90 nop
4c0: 8b 75 08 mov 0x8(%ebp),%esi
4c3: 8b 45 08 mov 0x8(%ebp),%eax
4c6: 01 de add %ebx,%esi
4c8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
4ca: c6 03 00 movb $0x0,(%ebx)
}
4cd: 8d 65 f4 lea -0xc(%ebp),%esp
4d0: 5b pop %ebx
4d1: 5e pop %esi
4d2: 5f pop %edi
4d3: 5d pop %ebp
4d4: c3 ret
4d5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
4dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000004e0 <stat>:
int
stat(const char *n, struct stat *st)
{
4e0: 55 push %ebp
4e1: 89 e5 mov %esp,%ebp
4e3: 56 push %esi
4e4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
4e5: 83 ec 08 sub $0x8,%esp
4e8: 6a 00 push $0x0
4ea: ff 75 08 pushl 0x8(%ebp)
4ed: e8 ef 00 00 00 call 5e1 <open>
if(fd < 0)
4f2: 83 c4 10 add $0x10,%esp
4f5: 85 c0 test %eax,%eax
4f7: 78 27 js 520 <stat+0x40>
return -1;
r = fstat(fd, st);
4f9: 83 ec 08 sub $0x8,%esp
4fc: ff 75 0c pushl 0xc(%ebp)
4ff: 89 c3 mov %eax,%ebx
501: 50 push %eax
502: e8 f2 00 00 00 call 5f9 <fstat>
close(fd);
507: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
50a: 89 c6 mov %eax,%esi
close(fd);
50c: e8 b8 00 00 00 call 5c9 <close>
return r;
511: 83 c4 10 add $0x10,%esp
}
514: 8d 65 f8 lea -0x8(%ebp),%esp
517: 89 f0 mov %esi,%eax
519: 5b pop %ebx
51a: 5e pop %esi
51b: 5d pop %ebp
51c: c3 ret
51d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
520: be ff ff ff ff mov $0xffffffff,%esi
525: eb ed jmp 514 <stat+0x34>
527: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
52e: 66 90 xchg %ax,%ax
00000530 <atoi>:
int
atoi(const char *s)
{
530: 55 push %ebp
531: 89 e5 mov %esp,%ebp
533: 53 push %ebx
534: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
537: 0f be 11 movsbl (%ecx),%edx
53a: 8d 42 d0 lea -0x30(%edx),%eax
53d: 3c 09 cmp $0x9,%al
n = 0;
53f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
544: 77 1f ja 565 <atoi+0x35>
546: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
54d: 8d 76 00 lea 0x0(%esi),%esi
n = n*10 + *s++ - '0';
550: 83 c1 01 add $0x1,%ecx
553: 8d 04 80 lea (%eax,%eax,4),%eax
556: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
55a: 0f be 11 movsbl (%ecx),%edx
55d: 8d 5a d0 lea -0x30(%edx),%ebx
560: 80 fb 09 cmp $0x9,%bl
563: 76 eb jbe 550 <atoi+0x20>
return n;
}
565: 5b pop %ebx
566: 5d pop %ebp
567: c3 ret
568: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
56f: 90 nop
00000570 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
570: 55 push %ebp
571: 89 e5 mov %esp,%ebp
573: 57 push %edi
574: 8b 55 10 mov 0x10(%ebp),%edx
577: 8b 45 08 mov 0x8(%ebp),%eax
57a: 56 push %esi
57b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
57e: 85 d2 test %edx,%edx
580: 7e 13 jle 595 <memmove+0x25>
582: 01 c2 add %eax,%edx
dst = vdst;
584: 89 c7 mov %eax,%edi
586: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
58d: 8d 76 00 lea 0x0(%esi),%esi
*dst++ = *src++;
590: a4 movsb %ds:(%esi),%es:(%edi)
while(n-- > 0)
591: 39 fa cmp %edi,%edx
593: 75 fb jne 590 <memmove+0x20>
return vdst;
}
595: 5e pop %esi
596: 5f pop %edi
597: 5d pop %ebp
598: c3 ret
00000599 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
599: b8 01 00 00 00 mov $0x1,%eax
59e: cd 40 int $0x40
5a0: c3 ret
000005a1 <exit>:
SYSCALL(exit)
5a1: b8 02 00 00 00 mov $0x2,%eax
5a6: cd 40 int $0x40
5a8: c3 ret
000005a9 <wait>:
SYSCALL(wait)
5a9: b8 03 00 00 00 mov $0x3,%eax
5ae: cd 40 int $0x40
5b0: c3 ret
000005b1 <pipe>:
SYSCALL(pipe)
5b1: b8 04 00 00 00 mov $0x4,%eax
5b6: cd 40 int $0x40
5b8: c3 ret
000005b9 <read>:
SYSCALL(read)
5b9: b8 05 00 00 00 mov $0x5,%eax
5be: cd 40 int $0x40
5c0: c3 ret
000005c1 <write>:
SYSCALL(write)
5c1: b8 10 00 00 00 mov $0x10,%eax
5c6: cd 40 int $0x40
5c8: c3 ret
000005c9 <close>:
SYSCALL(close)
5c9: b8 15 00 00 00 mov $0x15,%eax
5ce: cd 40 int $0x40
5d0: c3 ret
000005d1 <kill>:
SYSCALL(kill)
5d1: b8 06 00 00 00 mov $0x6,%eax
5d6: cd 40 int $0x40
5d8: c3 ret
000005d9 <exec>:
SYSCALL(exec)
5d9: b8 07 00 00 00 mov $0x7,%eax
5de: cd 40 int $0x40
5e0: c3 ret
000005e1 <open>:
SYSCALL(open)
5e1: b8 0f 00 00 00 mov $0xf,%eax
5e6: cd 40 int $0x40
5e8: c3 ret
000005e9 <mknod>:
SYSCALL(mknod)
5e9: b8 11 00 00 00 mov $0x11,%eax
5ee: cd 40 int $0x40
5f0: c3 ret
000005f1 <unlink>:
SYSCALL(unlink)
5f1: b8 12 00 00 00 mov $0x12,%eax
5f6: cd 40 int $0x40
5f8: c3 ret
000005f9 <fstat>:
SYSCALL(fstat)
5f9: b8 08 00 00 00 mov $0x8,%eax
5fe: cd 40 int $0x40
600: c3 ret
00000601 <link>:
SYSCALL(link)
601: b8 13 00 00 00 mov $0x13,%eax
606: cd 40 int $0x40
608: c3 ret
00000609 <mkdir>:
SYSCALL(mkdir)
609: b8 14 00 00 00 mov $0x14,%eax
60e: cd 40 int $0x40
610: c3 ret
00000611 <chdir>:
SYSCALL(chdir)
611: b8 09 00 00 00 mov $0x9,%eax
616: cd 40 int $0x40
618: c3 ret
00000619 <dup>:
SYSCALL(dup)
619: b8 0a 00 00 00 mov $0xa,%eax
61e: cd 40 int $0x40
620: c3 ret
00000621 <getpid>:
SYSCALL(getpid)
621: b8 0b 00 00 00 mov $0xb,%eax
626: cd 40 int $0x40
628: c3 ret
00000629 <sbrk>:
SYSCALL(sbrk)
629: b8 0c 00 00 00 mov $0xc,%eax
62e: cd 40 int $0x40
630: c3 ret
00000631 <sleep>:
SYSCALL(sleep)
631: b8 0d 00 00 00 mov $0xd,%eax
636: cd 40 int $0x40
638: c3 ret
00000639 <uptime>:
SYSCALL(uptime)
639: b8 0e 00 00 00 mov $0xe,%eax
63e: cd 40 int $0x40
640: c3 ret
00000641 <waitx>:
SYSCALL(waitx)
641: b8 16 00 00 00 mov $0x16,%eax
646: cd 40 int $0x40
648: c3 ret
00000649 <cps>:
SYSCALL(cps)
649: b8 17 00 00 00 mov $0x17,%eax
64e: cd 40 int $0x40
650: c3 ret
00000651 <set_priority>:
SYSCALL(set_priority)
651: b8 18 00 00 00 mov $0x18,%eax
656: cd 40 int $0x40
658: c3 ret
00000659 <getpinfo>:
659: b8 19 00 00 00 mov $0x19,%eax
65e: cd 40 int $0x40
660: c3 ret
661: 66 90 xchg %ax,%ax
663: 66 90 xchg %ax,%ax
665: 66 90 xchg %ax,%ax
667: 66 90 xchg %ax,%ax
669: 66 90 xchg %ax,%ax
66b: 66 90 xchg %ax,%ax
66d: 66 90 xchg %ax,%ax
66f: 90 nop
00000670 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
670: 55 push %ebp
671: 89 e5 mov %esp,%ebp
673: 57 push %edi
674: 56 push %esi
675: 53 push %ebx
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
676: 89 d3 mov %edx,%ebx
{
678: 83 ec 3c sub $0x3c,%esp
67b: 89 45 bc mov %eax,-0x44(%ebp)
if(sgn && xx < 0){
67e: 85 d2 test %edx,%edx
680: 0f 89 92 00 00 00 jns 718 <printint+0xa8>
686: f6 45 08 01 testb $0x1,0x8(%ebp)
68a: 0f 84 88 00 00 00 je 718 <printint+0xa8>
neg = 1;
690: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp)
x = -xx;
697: f7 db neg %ebx
} else {
x = xx;
}
i = 0;
699: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
6a0: 8d 75 d7 lea -0x29(%ebp),%esi
6a3: eb 08 jmp 6ad <printint+0x3d>
6a5: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
6a8: 89 7d c4 mov %edi,-0x3c(%ebp)
}while((x /= base) != 0);
6ab: 89 c3 mov %eax,%ebx
buf[i++] = digits[x % base];
6ad: 89 d8 mov %ebx,%eax
6af: 31 d2 xor %edx,%edx
6b1: 8b 7d c4 mov -0x3c(%ebp),%edi
6b4: f7 f1 div %ecx
6b6: 83 c7 01 add $0x1,%edi
6b9: 0f b6 92 ec 0a 00 00 movzbl 0xaec(%edx),%edx
6c0: 88 14 3e mov %dl,(%esi,%edi,1)
}while((x /= base) != 0);
6c3: 39 d9 cmp %ebx,%ecx
6c5: 76 e1 jbe 6a8 <printint+0x38>
if(neg)
6c7: 8b 45 c0 mov -0x40(%ebp),%eax
6ca: 85 c0 test %eax,%eax
6cc: 74 0d je 6db <printint+0x6b>
buf[i++] = '-';
6ce: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
6d3: ba 2d 00 00 00 mov $0x2d,%edx
buf[i++] = digits[x % base];
6d8: 89 7d c4 mov %edi,-0x3c(%ebp)
6db: 8b 45 c4 mov -0x3c(%ebp),%eax
6de: 8b 7d bc mov -0x44(%ebp),%edi
6e1: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx
6e5: eb 0f jmp 6f6 <printint+0x86>
6e7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
6ee: 66 90 xchg %ax,%ax
6f0: 0f b6 13 movzbl (%ebx),%edx
6f3: 83 eb 01 sub $0x1,%ebx
write(fd, &c, 1);
6f6: 83 ec 04 sub $0x4,%esp
6f9: 88 55 d7 mov %dl,-0x29(%ebp)
6fc: 6a 01 push $0x1
6fe: 56 push %esi
6ff: 57 push %edi
700: e8 bc fe ff ff call 5c1 <write>
while(--i >= 0)
705: 83 c4 10 add $0x10,%esp
708: 39 de cmp %ebx,%esi
70a: 75 e4 jne 6f0 <printint+0x80>
putc(fd, buf[i]);
}
70c: 8d 65 f4 lea -0xc(%ebp),%esp
70f: 5b pop %ebx
710: 5e pop %esi
711: 5f pop %edi
712: 5d pop %ebp
713: c3 ret
714: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
718: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp)
71f: e9 75 ff ff ff jmp 699 <printint+0x29>
724: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
72b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
72f: 90 nop
00000730 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
730: 55 push %ebp
731: 89 e5 mov %esp,%ebp
733: 57 push %edi
734: 56 push %esi
735: 53 push %ebx
736: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
739: 8b 75 0c mov 0xc(%ebp),%esi
73c: 0f b6 1e movzbl (%esi),%ebx
73f: 84 db test %bl,%bl
741: 0f 84 b9 00 00 00 je 800 <printf+0xd0>
ap = (uint*)(void*)&fmt + 1;
747: 8d 45 10 lea 0x10(%ebp),%eax
74a: 83 c6 01 add $0x1,%esi
write(fd, &c, 1);
74d: 8d 7d e7 lea -0x19(%ebp),%edi
state = 0;
750: 31 d2 xor %edx,%edx
ap = (uint*)(void*)&fmt + 1;
752: 89 45 d0 mov %eax,-0x30(%ebp)
755: eb 38 jmp 78f <printf+0x5f>
757: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
75e: 66 90 xchg %ax,%ax
760: 89 55 d4 mov %edx,-0x2c(%ebp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
763: ba 25 00 00 00 mov $0x25,%edx
if(c == '%'){
768: 83 f8 25 cmp $0x25,%eax
76b: 74 17 je 784 <printf+0x54>
write(fd, &c, 1);
76d: 83 ec 04 sub $0x4,%esp
770: 88 5d e7 mov %bl,-0x19(%ebp)
773: 6a 01 push $0x1
775: 57 push %edi
776: ff 75 08 pushl 0x8(%ebp)
779: e8 43 fe ff ff call 5c1 <write>
77e: 8b 55 d4 mov -0x2c(%ebp),%edx
} else {
putc(fd, c);
781: 83 c4 10 add $0x10,%esp
784: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
787: 0f b6 5e ff movzbl -0x1(%esi),%ebx
78b: 84 db test %bl,%bl
78d: 74 71 je 800 <printf+0xd0>
c = fmt[i] & 0xff;
78f: 0f be cb movsbl %bl,%ecx
792: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
795: 85 d2 test %edx,%edx
797: 74 c7 je 760 <printf+0x30>
}
} else if(state == '%'){
799: 83 fa 25 cmp $0x25,%edx
79c: 75 e6 jne 784 <printf+0x54>
if(c == 'd'){
79e: 83 f8 64 cmp $0x64,%eax
7a1: 0f 84 99 00 00 00 je 840 <printf+0x110>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
7a7: 81 e1 f7 00 00 00 and $0xf7,%ecx
7ad: 83 f9 70 cmp $0x70,%ecx
7b0: 74 5e je 810 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
7b2: 83 f8 73 cmp $0x73,%eax
7b5: 0f 84 d5 00 00 00 je 890 <printf+0x160>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
7bb: 83 f8 63 cmp $0x63,%eax
7be: 0f 84 8c 00 00 00 je 850 <printf+0x120>
putc(fd, *ap);
ap++;
} else if(c == '%'){
7c4: 83 f8 25 cmp $0x25,%eax
7c7: 0f 84 b3 00 00 00 je 880 <printf+0x150>
write(fd, &c, 1);
7cd: 83 ec 04 sub $0x4,%esp
7d0: c6 45 e7 25 movb $0x25,-0x19(%ebp)
7d4: 6a 01 push $0x1
7d6: 57 push %edi
7d7: ff 75 08 pushl 0x8(%ebp)
7da: e8 e2 fd ff ff call 5c1 <write>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
7df: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
7e2: 83 c4 0c add $0xc,%esp
7e5: 6a 01 push $0x1
7e7: 83 c6 01 add $0x1,%esi
7ea: 57 push %edi
7eb: ff 75 08 pushl 0x8(%ebp)
7ee: e8 ce fd ff ff call 5c1 <write>
for(i = 0; fmt[i]; i++){
7f3: 0f b6 5e ff movzbl -0x1(%esi),%ebx
putc(fd, c);
7f7: 83 c4 10 add $0x10,%esp
}
state = 0;
7fa: 31 d2 xor %edx,%edx
for(i = 0; fmt[i]; i++){
7fc: 84 db test %bl,%bl
7fe: 75 8f jne 78f <printf+0x5f>
}
}
}
800: 8d 65 f4 lea -0xc(%ebp),%esp
803: 5b pop %ebx
804: 5e pop %esi
805: 5f pop %edi
806: 5d pop %ebp
807: c3 ret
808: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80f: 90 nop
printint(fd, *ap, 16, 0);
810: 83 ec 0c sub $0xc,%esp
813: b9 10 00 00 00 mov $0x10,%ecx
818: 6a 00 push $0x0
81a: 8b 5d d0 mov -0x30(%ebp),%ebx
81d: 8b 45 08 mov 0x8(%ebp),%eax
820: 8b 13 mov (%ebx),%edx
822: e8 49 fe ff ff call 670 <printint>
ap++;
827: 89 d8 mov %ebx,%eax
829: 83 c4 10 add $0x10,%esp
state = 0;
82c: 31 d2 xor %edx,%edx
ap++;
82e: 83 c0 04 add $0x4,%eax
831: 89 45 d0 mov %eax,-0x30(%ebp)
834: e9 4b ff ff ff jmp 784 <printf+0x54>
839: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printint(fd, *ap, 10, 1);
840: 83 ec 0c sub $0xc,%esp
843: b9 0a 00 00 00 mov $0xa,%ecx
848: 6a 01 push $0x1
84a: eb ce jmp 81a <printf+0xea>
84c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
putc(fd, *ap);
850: 8b 5d d0 mov -0x30(%ebp),%ebx
write(fd, &c, 1);
853: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
856: 8b 03 mov (%ebx),%eax
write(fd, &c, 1);
858: 6a 01 push $0x1
ap++;
85a: 83 c3 04 add $0x4,%ebx
write(fd, &c, 1);
85d: 57 push %edi
85e: ff 75 08 pushl 0x8(%ebp)
putc(fd, *ap);
861: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
864: e8 58 fd ff ff call 5c1 <write>
ap++;
869: 89 5d d0 mov %ebx,-0x30(%ebp)
86c: 83 c4 10 add $0x10,%esp
state = 0;
86f: 31 d2 xor %edx,%edx
871: e9 0e ff ff ff jmp 784 <printf+0x54>
876: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
87d: 8d 76 00 lea 0x0(%esi),%esi
putc(fd, c);
880: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
883: 83 ec 04 sub $0x4,%esp
886: e9 5a ff ff ff jmp 7e5 <printf+0xb5>
88b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
88f: 90 nop
s = (char*)*ap;
890: 8b 45 d0 mov -0x30(%ebp),%eax
893: 8b 18 mov (%eax),%ebx
ap++;
895: 83 c0 04 add $0x4,%eax
898: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
89b: 85 db test %ebx,%ebx
89d: 74 17 je 8b6 <printf+0x186>
while(*s != 0){
89f: 0f b6 03 movzbl (%ebx),%eax
state = 0;
8a2: 31 d2 xor %edx,%edx
while(*s != 0){
8a4: 84 c0 test %al,%al
8a6: 0f 84 d8 fe ff ff je 784 <printf+0x54>
8ac: 89 75 d4 mov %esi,-0x2c(%ebp)
8af: 89 de mov %ebx,%esi
8b1: 8b 5d 08 mov 0x8(%ebp),%ebx
8b4: eb 1a jmp 8d0 <printf+0x1a0>
s = "(null)";
8b6: bb e2 0a 00 00 mov $0xae2,%ebx
while(*s != 0){
8bb: 89 75 d4 mov %esi,-0x2c(%ebp)
8be: b8 28 00 00 00 mov $0x28,%eax
8c3: 89 de mov %ebx,%esi
8c5: 8b 5d 08 mov 0x8(%ebp),%ebx
8c8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
8cf: 90 nop
write(fd, &c, 1);
8d0: 83 ec 04 sub $0x4,%esp
s++;
8d3: 83 c6 01 add $0x1,%esi
8d6: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
8d9: 6a 01 push $0x1
8db: 57 push %edi
8dc: 53 push %ebx
8dd: e8 df fc ff ff call 5c1 <write>
while(*s != 0){
8e2: 0f b6 06 movzbl (%esi),%eax
8e5: 83 c4 10 add $0x10,%esp
8e8: 84 c0 test %al,%al
8ea: 75 e4 jne 8d0 <printf+0x1a0>
8ec: 8b 75 d4 mov -0x2c(%ebp),%esi
state = 0;
8ef: 31 d2 xor %edx,%edx
8f1: e9 8e fe ff ff jmp 784 <printf+0x54>
8f6: 66 90 xchg %ax,%ax
8f8: 66 90 xchg %ax,%ax
8fa: 66 90 xchg %ax,%ax
8fc: 66 90 xchg %ax,%ax
8fe: 66 90 xchg %ax,%ax
00000900 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
900: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
901: a1 28 0e 00 00 mov 0xe28,%eax
{
906: 89 e5 mov %esp,%ebp
908: 57 push %edi
909: 56 push %esi
90a: 53 push %ebx
90b: 8b 5d 08 mov 0x8(%ebp),%ebx
90e: 8b 10 mov (%eax),%edx
bp = (Header*)ap - 1;
910: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
913: 39 c8 cmp %ecx,%eax
915: 73 19 jae 930 <free+0x30>
917: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
91e: 66 90 xchg %ax,%ax
920: 39 d1 cmp %edx,%ecx
922: 72 14 jb 938 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
924: 39 d0 cmp %edx,%eax
926: 73 10 jae 938 <free+0x38>
{
928: 89 d0 mov %edx,%eax
92a: 8b 10 mov (%eax),%edx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
92c: 39 c8 cmp %ecx,%eax
92e: 72 f0 jb 920 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
930: 39 d0 cmp %edx,%eax
932: 72 f4 jb 928 <free+0x28>
934: 39 d1 cmp %edx,%ecx
936: 73 f0 jae 928 <free+0x28>
break;
if(bp + bp->s.size == p->s.ptr){
938: 8b 73 fc mov -0x4(%ebx),%esi
93b: 8d 3c f1 lea (%ecx,%esi,8),%edi
93e: 39 fa cmp %edi,%edx
940: 74 1e je 960 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
942: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
945: 8b 50 04 mov 0x4(%eax),%edx
948: 8d 34 d0 lea (%eax,%edx,8),%esi
94b: 39 f1 cmp %esi,%ecx
94d: 74 28 je 977 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
94f: 89 08 mov %ecx,(%eax)
freep = p;
}
951: 5b pop %ebx
freep = p;
952: a3 28 0e 00 00 mov %eax,0xe28
}
957: 5e pop %esi
958: 5f pop %edi
959: 5d pop %ebp
95a: c3 ret
95b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
95f: 90 nop
bp->s.size += p->s.ptr->s.size;
960: 03 72 04 add 0x4(%edx),%esi
963: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
966: 8b 10 mov (%eax),%edx
968: 8b 12 mov (%edx),%edx
96a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
96d: 8b 50 04 mov 0x4(%eax),%edx
970: 8d 34 d0 lea (%eax,%edx,8),%esi
973: 39 f1 cmp %esi,%ecx
975: 75 d8 jne 94f <free+0x4f>
p->s.size += bp->s.size;
977: 03 53 fc add -0x4(%ebx),%edx
freep = p;
97a: a3 28 0e 00 00 mov %eax,0xe28
p->s.size += bp->s.size;
97f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
982: 8b 53 f8 mov -0x8(%ebx),%edx
985: 89 10 mov %edx,(%eax)
}
987: 5b pop %ebx
988: 5e pop %esi
989: 5f pop %edi
98a: 5d pop %ebp
98b: c3 ret
98c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000990 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
990: 55 push %ebp
991: 89 e5 mov %esp,%ebp
993: 57 push %edi
994: 56 push %esi
995: 53 push %ebx
996: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
999: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
99c: 8b 3d 28 0e 00 00 mov 0xe28,%edi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
9a2: 8d 70 07 lea 0x7(%eax),%esi
9a5: c1 ee 03 shr $0x3,%esi
9a8: 83 c6 01 add $0x1,%esi
if((prevp = freep) == 0){
9ab: 85 ff test %edi,%edi
9ad: 0f 84 ad 00 00 00 je a60 <malloc+0xd0>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
9b3: 8b 17 mov (%edi),%edx
if(p->s.size >= nunits){
9b5: 8b 4a 04 mov 0x4(%edx),%ecx
9b8: 39 f1 cmp %esi,%ecx
9ba: 73 72 jae a2e <malloc+0x9e>
9bc: 81 fe 00 10 00 00 cmp $0x1000,%esi
9c2: bb 00 10 00 00 mov $0x1000,%ebx
9c7: 0f 43 de cmovae %esi,%ebx
p = sbrk(nu * sizeof(Header));
9ca: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax
9d1: 89 45 e4 mov %eax,-0x1c(%ebp)
9d4: eb 1b jmp 9f1 <malloc+0x61>
9d6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
9dd: 8d 76 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
9e0: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
9e2: 8b 48 04 mov 0x4(%eax),%ecx
9e5: 39 f1 cmp %esi,%ecx
9e7: 73 4f jae a38 <malloc+0xa8>
9e9: 8b 3d 28 0e 00 00 mov 0xe28,%edi
9ef: 89 c2 mov %eax,%edx
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
9f1: 39 d7 cmp %edx,%edi
9f3: 75 eb jne 9e0 <malloc+0x50>
p = sbrk(nu * sizeof(Header));
9f5: 83 ec 0c sub $0xc,%esp
9f8: ff 75 e4 pushl -0x1c(%ebp)
9fb: e8 29 fc ff ff call 629 <sbrk>
if(p == (char*)-1)
a00: 83 c4 10 add $0x10,%esp
a03: 83 f8 ff cmp $0xffffffff,%eax
a06: 74 1c je a24 <malloc+0x94>
hp->s.size = nu;
a08: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
a0b: 83 ec 0c sub $0xc,%esp
a0e: 83 c0 08 add $0x8,%eax
a11: 50 push %eax
a12: e8 e9 fe ff ff call 900 <free>
return freep;
a17: 8b 15 28 0e 00 00 mov 0xe28,%edx
if((p = morecore(nunits)) == 0)
a1d: 83 c4 10 add $0x10,%esp
a20: 85 d2 test %edx,%edx
a22: 75 bc jne 9e0 <malloc+0x50>
return 0;
}
}
a24: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
a27: 31 c0 xor %eax,%eax
}
a29: 5b pop %ebx
a2a: 5e pop %esi
a2b: 5f pop %edi
a2c: 5d pop %ebp
a2d: c3 ret
if(p->s.size >= nunits){
a2e: 89 d0 mov %edx,%eax
a30: 89 fa mov %edi,%edx
a32: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
a38: 39 ce cmp %ecx,%esi
a3a: 74 54 je a90 <malloc+0x100>
p->s.size -= nunits;
a3c: 29 f1 sub %esi,%ecx
a3e: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
a41: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
a44: 89 70 04 mov %esi,0x4(%eax)
freep = prevp;
a47: 89 15 28 0e 00 00 mov %edx,0xe28
}
a4d: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
a50: 83 c0 08 add $0x8,%eax
}
a53: 5b pop %ebx
a54: 5e pop %esi
a55: 5f pop %edi
a56: 5d pop %ebp
a57: c3 ret
a58: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
a5f: 90 nop
base.s.ptr = freep = prevp = &base;
a60: c7 05 28 0e 00 00 2c movl $0xe2c,0xe28
a67: 0e 00 00
base.s.size = 0;
a6a: bf 2c 0e 00 00 mov $0xe2c,%edi
base.s.ptr = freep = prevp = &base;
a6f: c7 05 2c 0e 00 00 2c movl $0xe2c,0xe2c
a76: 0e 00 00
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
a79: 89 fa mov %edi,%edx
base.s.size = 0;
a7b: c7 05 30 0e 00 00 00 movl $0x0,0xe30
a82: 00 00 00
if(p->s.size >= nunits){
a85: e9 32 ff ff ff jmp 9bc <malloc+0x2c>
a8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
prevp->s.ptr = p->s.ptr;
a90: 8b 08 mov (%eax),%ecx
a92: 89 0a mov %ecx,(%edx)
a94: eb b1 jmp a47 <malloc+0xb7>
|
oeis/142/A142646.asm | neoneye/loda-programs | 11 | 179258 | <filename>oeis/142/A142646.asm
; A142646: Primes congruent to 13 mod 56.
; Submitted by <NAME>
; 13,181,293,349,461,797,853,1021,1301,1637,1693,1861,1973,2029,2141,2309,2477,3037,3373,3541,3709,3821,3877,3989,4157,4493,4549,5333,5501,5557,5669,6173,6229,6397,6733,7013,7069,7237,7349,7517,7573,7741,7853,8581,8693,8861,9029,9421,9533,10037,10093,10429,10597,10709,11213,11437,11549,11717,11941,12109,12277,12613,12781,12893,13229,13397,13789,13901,14293,14461,14629,14741,14797,15077,15413,15581,15749,15973,16141,16253,16421,16477,16981,17093,17317,17597,17989,18269,18493,18661,18773,19333
mov $2,$0
add $2,6
pow $2,2
mov $4,12
lpb $2
mov $3,$4
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $1,$0
max $1,0
cmp $1,$0
mul $2,$1
sub $2,1
add $4,56
lpe
mov $0,$4
add $0,1
|
doorframefixes.asm | Catobat/z3randomizer | 31 | 163675 | <gh_stars>10-100
;================================================================================
; Door Frame Fixes
;================================================================================
;--------------------------------------------------------------------------------
; StoreLastOverworldDoorID
;--------------------------------------------------------------------------------
StoreLastOverworldDoorID:
TXA : INC
STA $7F5099
LDA $1BBB73, X : STA $010E
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; CacheDoorFrameData
;--------------------------------------------------------------------------------
CacheDoorFrameData:
LDA $7F5099 : BEQ .originalBehaviour
DEC : ASL : TAX
LDA EntranceDoorFrameTable, X : STA $0696
LDA EntranceAltDoorFrameTable, X : STA $0698
BRA .done
.originalBehaviour
LDA $D724, X : STA $0696
STZ $0698
.done
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; WalkDownIntoTavern
;--------------------------------------------------------------------------------
WalkDownIntoTavern:
LDA $7F5099
; tavern door has index 0x42 (saved off value is incremented by one)
CMP #$43
RTL
;--------------------------------------------------------------------------------
|
src/test/ref/typeid-plus-byte-problem.asm | jbrandwood/kickc | 2 | 93403 | // Test that byte+byte creates a byte - even when there is a value overflow
// Commodore 64 PRG executable file
.file [name="typeid-plus-byte-problem.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.label SCREEN = $400
.segment Code
main: {
.const ubc1 = $c+$d+$e
.const ubc2 = $fa
// SCREEN[0] = ubc1+ubc2
lda #ubc1+ubc2
sta SCREEN
// }
rts
}
|
programs/oeis/210/A210978.asm | jmorken/loda | 1 | 104790 | <reponame>jmorken/loda
; A210978: A186029 and positive terms of A001106 interleaved.
; 0,1,5,9,17,24,36,46,62,75,95,111,135,154,182,204,236,261,297,325,365,396,440,474,522,559,611,651,707,750,810,856,920,969,1037,1089,1161,1216,1292,1350,1430,1491,1575,1639,1727,1794,1886,1956,2052,2125,2225,2301
mov $1,$0
add $1,9
add $1,$0
sub $0,1
mul $0,5
add $1,$0
div $1,2
bin $1,2
div $1,7
|
fixedsrc/hwif_types.ads | bhayward93/Ada-Traffic-Light-Sim | 0 | 4639 | <reponame>bhayward93/Ada-Traffic-Light-Sim
with Interfaces;
package HWIF_Types is
pragma Pure;
type Octet is new Interfaces.Unsigned_8 with Size => 8;
-- Integer.
type Int is new Interfaces.Unsigned_32 with Size => 32;
end HWIF_Types;
|
asm/in.asm | spratt/lc2.js | 1 | 103463 | <filename>asm/in.asm
;;; in.asm
;;; IN service routine (system call)
;;; adapted from Figure 9.4, Patt & Patel
.orig 0x04a0
start: st r7, SaveR7 ; Save the linkage back to the program.
st r1, SaveR1 ; Save the values in the registers
st r2, SaveR2 ; that are used so that they
st r3, SaveR3 ; can be restored before RET
ld r2, nl
l1: ldi r3, CRTSR ; Check CRTDR -- is it free?
brzp l1
sti r2, CRTDR ; Move the cursor to new clean line
lea r1, Prompt ; Load address of prompt string
loop: ldr r0, r1, #0 ; Get next prompt character
brz input ; Check for end of prompt string
l2: ldi r3, CRTSR
brzp l2
sti r0, CRTDR ; Write next character of prompt string
add r1, r1, #1 ; Increment Prompt pointer
brnzp loop
input: ldi r3, KBSR ; Has a character been typed?
brzp input
ldi r0, KBDR ; Load it into R0
l3: ldi r3, CRTSR
brzp l3
sti r0, CRTDR ; Echo input character
l4: ldi r3, CRTSR
brzp l4
sti r2, CRTDR ; Move cursor to new clean line
ld r1, SaveR1
ld r2, SaveR2
ld r3, SaveR3
ld r7, SaveR7
ret
;;; constants
SaveR7: .fill 0x0000
SaveR1: .fill 0x0000
SaveR2: .fill 0x0000
SaveR3: .fill 0x0000
CRTSR: .fill 0xf3fc
CRTDR: .fill 0xf3ff
KBSR: .fill 0xf400
KBDR: .fill 0xf401
nl: .fill 0x000A ; newline ASCII code
Prompt: .stringz "Input a character>"
.end
|
bsp/sparkduino.adb | yannickmoy/SPARKZumo | 6 | 28079 | pragma SPARK_Mode;
with System;
package body Sparkduino is
procedure Arduino_Serial_Print (Msg : System.Address);
pragma Import (C, Arduino_Serial_Print, "Serial_Print");
procedure Arduino_Serial_Print_Byte (Msg : System.Address;
Val : Byte);
pragma Import (C, Arduino_Serial_Print_Byte, "Serial_Print_Byte");
procedure Arduino_Serial_Print_Short (Msg : System.Address;
Val : short);
pragma Import (C, Arduino_Serial_Print_Short, "Serial_Print_Short");
procedure Arduino_Serial_Print_Float (Msg : System.Address;
Val : Float);
pragma Import (C, Arduino_Serial_Print_Float, "Serial_Print_Float");
procedure Serial_Print (Msg : String)
with SPARK_Mode => Off
is
Msg_Null : char_array (size_t (Msg'First) .. size_t (Msg'Last + 1));
begin
for I in Msg'Range loop
Msg_Null (size_t (I)) := char (Msg (I));
end loop;
Msg_Null (Msg_Null'Last) := nul;
Arduino_Serial_Print (Msg => Msg_Null'Address);
end Serial_Print;
procedure Serial_Print_Byte (Msg : String;
Val : Byte)
with SPARK_Mode => OFf
is
Msg_Null : char_array (size_t (Msg'First) .. size_t (Msg'Last + 1));
begin
for I in Msg'Range loop
Msg_Null (size_t (I)) := char (Msg (I));
end loop;
Msg_Null (Msg_Null'Last) := nul;
Arduino_Serial_Print_Byte (Msg => Msg_Null'Address,
Val => Val);
end Serial_Print_Byte;
procedure Serial_Print_Short (Msg : String;
Val : short)
with SPARK_Mode => OFf
is
Msg_Null : char_array (size_t (Msg'First) .. size_t (Msg'Last + 1));
begin
for I in Msg'Range loop
Msg_Null (size_t (I)) := char (Msg (I));
end loop;
Msg_Null (Msg_Null'Last) := nul;
Arduino_Serial_Print_Short (Msg => Msg_Null'Address,
Val => Val);
end Serial_Print_Short;
procedure Serial_Print_Float (Msg : String;
Val : Float)
with SPARK_Mode => OFf
is
Msg_Null : char_array (size_t (Msg'First) .. size_t (Msg'Last + 1));
begin
for I in Msg'Range loop
Msg_Null (size_t (I)) := char (Msg (I));
end loop;
Msg_Null (Msg_Null'Last) := nul;
Arduino_Serial_Print_Float (Msg => Msg_Null'Address,
Val => Val);
end Serial_Print_Float;
end Sparkduino;
|
public/wintab/wintabx/get.asm | SmileyAG/cstrike15_src | 2 | 9683 | <filename>public/wintab/wintabx/get.asm
include xlibproc.inc
include Wintab.inc
PROC_TEMPLATE WTGet, 4, Wintab, -, 61
|
intellij/src/midmod/lisp/antlr4/Lisp.g4 | jakobehmsen/midmod | 0 | 1548 | grammar Lisp;
element: list | atom;
list: OPEN_PAR element* CLOSE_PAR;
atom: word | string | number;
word: ID;
string: STRING;
number: NUMBER;
OPEN_PAR: '(';
CLOSE_PAR: ')';
fragment DIGIT: [0-9];
fragment LETTER: [A-Z]|[a-z];
fragment ID_MISC: '<'|'>'|'='|'_'|'-'|'+'|'*'|'/';
ID: (LETTER | ID_MISC) (LETTER | ID_MISC | DIGIT)*;
STRING : '"' (ESC | ~["\\])* '"' ;
fragment ESC : '\\' (["\\/bfnrt] | UNICODE) ;
fragment UNICODE : 'u' HEX HEX HEX HEX ;
fragment HEX : [0-9a-fA-F] ;
NUMBER
: '-'? INT '.' [0-9]+ EXP? // 1.35, 1.35E-9, 0.3, -4.5
| '-'? INT EXP // 1e10 -3e4
| '-'? INT // -3, 45
;
fragment INT : '0' | [1-9] [0-9]* ; // no leading zeros
fragment EXP : [Ee] [+\-]? INT ; // \- since - means "range" inside [...]
WS : [ \t\n\r]+ -> skip; |
Transynther/x86/_processed/NC/_ht_zr_/i7-7700_9_0x48.log_24_523.asm | ljhsiun2/medusa | 9 | 1660 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x7705, %rsi
lea addresses_WC_ht+0x112be, %rdi
nop
nop
nop
nop
add %rbp, %rbp
mov $40, %rcx
rep movsw
nop
sub $22833, %rdx
lea addresses_WT_ht+0x176be, %rsi
lea addresses_UC_ht+0xd33e, %rdi
nop
nop
sub %r13, %r13
mov $87, %rcx
rep movsb
nop
xor $56309, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_UC+0x18ebe, %r13
nop
nop
add %rbp, %rbp
mov $0x5152535455565758, %rdi
movq %rdi, %xmm7
vmovaps %ymm7, (%r13)
nop
nop
nop
nop
nop
cmp $23349, %rsi
// Store
lea addresses_WT+0x143c4, %rsi
nop
nop
nop
nop
xor $41444, %r11
mov $0x5152535455565758, %r13
movq %r13, %xmm1
movntdq %xmm1, (%rsi)
nop
nop
nop
inc %rdi
// Store
mov $0x6be, %rcx
nop
nop
nop
nop
nop
sub $64255, %rdi
mov $0x5152535455565758, %r13
movq %r13, (%rcx)
nop
sub %rbp, %rbp
// Faulty Load
mov $0x7ed53400000006be, %rsi
nop
nop
nop
xor %r8, %r8
vmovups (%rsi), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %rbp
lea oracles, %rsi
and $0xff, %rbp
shlq $12, %rbp
mov (%rsi,%rbp,1), %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 11, 'size': 32, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}}
{'49': 4, '00': 20}
00 00 00 00 00 00 49 49 00 00 49 00 49 00 00 00 00 00 00 00 00 00 00 00
*/
|
compiler/template/parser/AttrLexer.g4 | jinge-design/jinge | 0 | 3558 | lexer grammar AttrLexer;
EXPR_START: '${' -> pushMode(EXPR);
TEXT: ('\\$' | ('$' ~'{') | ~[<$])+;
mode EXPR;
EXPR_END: '}' -> popMode;
EXPR_SEG:
DOUBLE_QUOTE_STRING | SINGLE_QUOTE_STRING | EXPR_TEXT
;
EXPR_TEXT: (~[`}])+;
TPL_STR_START: '`' -> pushMode(TPL_STR);
mode TPL_STR;
TPL_STR_END: '`' -> popMode;
TPL_STR_TEXT: ('\\`' | '\\$' | ~[`$] | ('$' ~'{'))+;
TPL_EXPR_START: '${' -> pushMode(EXPR);
fragment DOUBLE_QUOTE_STRING: '"' (ESCAPE | ~'"')* '"';
fragment SINGLE_QUOTE_STRING: '\'' (ESCAPE | ~'\'')* '\'';
fragment ESCAPE : '\\"' | '\\\\' | '\\\''; |
src/Horseshoe/Compiler/Grammars/HorseshoeParser.g4 | vikekh/horseshoe | 2 | 6406 | parser grammar HorseshoeParser;
@parser::header {#pragma warning disable 3021}
options { tokenVocab=HorseshoeLexer; }
document
: (module | templateDecl)*
;
ignoredContent
: (DATA { System.String.IsNullOrWhiteSpace($DATA.text) }?<fail={ "Non-whitespace outside of template declaration." }>)+
;
body
: DATA+
;
module
: ignoredContent? OPEN HASH MODULE name=qualifiedIdentifier CLOSE (templateDecl)* OPEN SLASH MODULE CLOSE ignoredContent?
;
templateDecl
: ignoredContent? OPEN invertTrim=TILDE? HASH TEMPLATE name=simpleIdentifier (COLON contextTypeName=typeName)? openTrimEnd=TILDE? CLOSE (expression)* OPEN closeTrimStart=TILDE? SLASH TEMPLATE CLOSE ignoredContent?
;
expression
: substitution
| unescapedSubstitution
| conditional
| listIteration
| invoke
| body
;
conditional
: OPEN openTrimStart=TILDE? HASH IF NOT? id=scopeQualifiedIdentifier openTrimEnd=TILDE? CLOSE (expression)* elseClause? OPEN closeTrimStart=TILDE? SLASH IF closeTrimEnd=TILDE? CLOSE
;
elseClause
: OPEN trimStart=TILDE? HASH ELSE trimEnd=TILDE? CLOSE (expression)*
;
listIteration
: OPEN openTrimStart=TILDE? HASH FOREACH type=typeName variable=simpleIdentifier IN collection=scopeQualifiedIdentifier openTrimEnd=TILDE? CLOSE (expression)* OPEN closeTrimStart=TILDE? SLASH FOREACH closeTrimEnd=TILDE? CLOSE
;
invoke
: OPEN trimStart=TILDE? HASH CALL method=qualifiedIdentifier LPAREN argument=scopeQualifiedIdentifier RPAREN trimEnd=TILDE? CLOSE
;
substitution
: OPEN trimStart=TILDE? id=scopeQualifiedIdentifier trimEnd=TILDE? CLOSE
;
unescapedSubstitution
: OPEN_UNESC trimStart=TILDE? id=scopeQualifiedIdentifier trimEnd=TILDE? CLOSE_UNESC
;
scopeQualifiedIdentifier
: scope=TOPSCOPE? id=qualifiedIdentifier
;
qualifiedIdentifier
: IDENTIFIER ('.' IDENTIFIER)*
;
typeName
: qualifiedIdentifier ('<' typeName (',' typeName)* '>')? ('[' ']')*
;
simpleIdentifier
: IDENTIFIER
;
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/ドイツ_PAL/Ger_asm/ztmacro.asm | prismotizm/gigaleak | 0 | 82593 | <reponame>prismotizm/gigaleak
Name: ztmacro.asm
Type: file
Size: 1971
Last-Modified: '2016-05-13T04:23:03Z'
SHA-1: 77E8AFFB5CB7D6EABCC9FA134909156231716DF1
Description: null
|
fx/pixel.h.asm | simondotm/fast-vgm | 2 | 85637 |
; Pixel FX
MACRO SET_PIXEL_EFFECT fn
{
LDA #LO(fn):STA fx_pixel_plot+1
LDA #HI(fn):STA fx_pixel_plot+2
}
ENDMACRO
; Macros to set a pixel (X,Y) in the grid
MACRO SET_PIXEL_AX ; (X,Y)
{
\\ clip
CMP #GRID_W
BCS clip
CPX #GRID_H
BCS clip
\\ carry is clear
ADC grid_y_lookup, X
TAX
LDA #PIXEL_FULL
STA grid_array, X
.clip
}
ENDMACRO
MACRO SET_PIXEL_AX_MIRROR_OPP ; (X,Y)
{
\\ clip
CMP #GRID_W
BCS clip
CPX #GRID_H
BCS clip
\\ carry is clear
ADC grid_y_lookup, X
TAX
LDA #PIXEL_FULL
STA grid_array, X
\\ mirror opposite corner
TXA
SEC
SBC #GRID_SIZE
EOR #&FF
TAX
LDA #PIXEL_FULL
STA grid_array, X
.clip
}
ENDMACRO
MACRO SET_PIXEL_AX_MIRROR_Y ; (X,Y)
{
\\ clip
CMP #GRID_W
BCS clip
CPX #GRID_H
BCS clip
\\ remember x,y
STA load_x+1
STX load_y+1
\\ carry is clear
ADC grid_y_lookup, X
TAX
LDA #PIXEL_FULL
STA grid_array, X
\\ Mirror in Y
.load_y
LDX #0
.load_x
LDA #0
CLC
ADC grid_y_lookup_inv, X
TAX
LDA #PIXEL_FULL
STA grid_array, X
.clip
}
ENDMACRO
MACRO SET_PIXEL_AX_MIRROR_X ; (X,Y)
{
\\ clip
CMP #GRID_W
BCS clip
CPX #GRID_H
BCS clip
\\ calc 2x
ASL A
STA two_x+1
LSR A
\\ carry is clear
ADC grid_y_lookup, X
TAX
LDA #PIXEL_FULL
STA grid_array, X
\\ Mirror in X - not quicker to do a store & lookup!
TXA
ADC #(GRID_W-1)
SEC
.two_x
SBC #0
TAX
LDA #PIXEL_FULL
STA grid_array, X
.clip
}
ENDMACRO
MACRO SET_PIXEL_AX_MIRROR_FOUR ; (X,Y)
{
CMP #GRID_W
BCS clip
CPX #GRID_H
BCS clip
\\ calc 2x
ASL A
STA two_x+1
STA two_x2+1
LSR A
\\ carry is clear
ADC grid_y_lookup, X
TAX
LDA #PIXEL_FULL
STA grid_array, X
\\ Mirror in X
TXA
ADC #(GRID_W-1)
SEC
.two_x
SBC #0
TAX
LDA #PIXEL_FULL
STA grid_array, X
\\ Mirror opp corner - actually mirrors in Y
TXA
SEC
SBC #GRID_SIZE
EOR #&FF
TAX
LDA #PIXEL_FULL
STA grid_array, X
\\ Mirror in X again - actually mirrors to opp corner
TXA
ADC #(GRID_W-1)
SEC
.two_x2
SBC #0
TAX
LDA #PIXEL_FULL
STA grid_array, X
.clip
}
ENDMACRO
|
programs/oeis/212/A212506.asm | karttu/loda | 1 | 241173 | <filename>programs/oeis/212/A212506.asm
; A212506: Number of (w,x,y,z) with all terms in {1,...,n} and w<=2x and y<=2z.
; 0,1,16,64,196,441,900,1600,2704,4225,6400,9216,12996,17689,23716,30976,40000,50625,63504,78400,96100,116281,139876,166464,197136,231361,270400,313600,362404,416025,476100,541696,614656,693889,781456
mov $1,$0
pow $0,2
mul $0,3
div $0,2
add $1,$0
div $1,2
pow $1,2
|
src/003/test_types.adb | xeenta/learning-ada | 0 | 27048 | -- compile with -gnatW8
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Wide_Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Strings.Unbounded;
procedure Test_Types is
type Cows_Counter_Type is new Natural;
type Fixed_Point_Type is delta 0.01 range 0.0 .. 1_166_405_539.00;
-- decimal fixed point
type Money is delta 0.001 digits 15;
type Byte is mod 2**8;
for Byte'Size use 8;
subtype Age_Type is Integer range 0 .. 150;
package SU renames Ada.Strings.Unbounded;
subtype U_String is SU.Unbounded_String;
function Us (S : String) return U_String renames SU.To_Unbounded_String;
-- A record
type Person is
record
Name : U_String;
Surname : U_String;
Age : Age_Type;
Married : Boolean;
end record;
function To_String (P : Person) return String is
begin
return SU.To_String (P.Name) & " " &
Su.To_String (P.Surname) & ", " &
Integer'Image (P.Age) & " years old, " &
(if P.Married then "married" else "single");
end To_String;
-- overload the concat op, just for moo
function "&" (L : String;
R : Cows_Counter_Type) return String is
begin
return L & Integer'Image (Integer (R));
end "&";
Cows_In_The_Park : constant Cows_Counter_Type := 0;
Newborn_Cows : constant Integer := 1;
Huge_Number : constant Long_Integer := Long_Integer'Last;
Very_Huge_Number : constant Long_Long_Integer := Long_Long_Integer'First;
Normal_Float : constant Float := Float'Last;
Big_Float : constant Long_Float := Long_Float'Last;
Huge_Float : constant Long_Long_Float := Long_Long_Float'Last;
-- ANSI ESC seq for Bold and normal
Esc_Char : constant Character := Character'Val (27);
Bold_On : constant String := Esc_Char & "[1m";
Fancy_Off : constant String := Esc_Char & "[0m";
-- this is a way to encode a character by its code
Strange_Sign : constant Wide_Character := '["A345"]';
-- or we can write it "for real", provided the source code encoding
-- matches the one chosen by the compiler... I use UTF-8 and GNAT
-- compiler, therefore I've added the -gnatW8 option
Greek_Letter : constant Wide_Character := 'α';
-- Also with Wide_Character we can use the attribute-function Val
-- to convert the code of a character into the character
No_Hiragana : constant Wide_Character := Wide_Character'Val (16#306e#);
-- always with the -gnatW8 option, we can write "wide string"
-- directly.
Hello_String : constant Wide_String := "→Hello← ";
-- A second longs a second
One_Second : constant Duration := 1.0;
T : Duration;
-- these are bytes; let's see the wrap-around arithmetic
Byte_1 : constant Byte := 254;
Byte_2 : constant Byte := Byte_1 + 1;
Byte_3 : constant Byte := Byte_2 + 1;
Homer_Simpson : constant Person := (Name => Us ("Homer"),
Surname => Us ("Simpson"),
Age => 54,
Married => True);
package LI is new Integer_IO (Long_Integer);
package LLI is new Integer_IO (Long_Long_Integer);
package F is new Float_IO (Float);
package FF is new Float_IO (Long_Float);
package FFF is new Float_IO (Long_Long_Float);
package D is new Fixed_IO (Duration);
package M is new Modular_IO (Byte);
-- we can also have our special Cow IO
package Cow is new Integer_IO (Cows_Counter_Type);
package W renames Ada.Wide_Text_IO;
begin
-- the following won't compile
--Cows_In_The_Park := Cows_In_The_Park + Newborn_Cows;
Put_Line ("cows in the park: " & Cows_In_The_Park);
Cow.Put (Cows_In_The_Park); Put ("; ");
Put ("newborn cows: "); Put (Newborn_Cows); New_Line;
Put (Integer (Cows_Counter_Type'Last)); New_Line;
LI.Put (Huge_Number); New_Line;
LLI.Put (Very_Huge_Number); New_Line;
Put (Integer'First);
Put (Integer'Last); New_Line;
Put (Float'Digits); Put (" §§ ");
F.Put (Float'First); New_Line;
delay One_Second; -- let's waste a second of your time
Put (Long_Float'Digits); New_Line;
Put (Long_Long_Float'Digits); New_Line;
F.Put (Normal_Float); Put (" << Float"); New_Line;
FF.Put (Big_Float); Put (" << Long_Float"); New_Line;
FFF.Put (Huge_Float); Put (" << Long_Long_Float"); New_Line;
Put_Line (Bold_On & "BOLD" & Fancy_Off);
W.Put_Line (Hello_String &
Greek_Letter &
Strange_Sign &
No_Hiragana);
T := 1.0;
while T > 0.01 loop
D.Put (T, Aft => 2);
delay T;
T := T / 2.0;
end loop;
New_Line;
F.Put (Float (Duration'Delta)); New_Line;
F.Put (Float (Duration'First));
F.Put (Float (Duration'Last)); New_Line;
F.Put (Float (Duration'Small)); New_Line;
F.Put (Float (Fixed_Point_Type'Small)); New_Line;
F.Put (Float (Money'Small)); New_Line;
F.Put (Float (Money'First));
F.Put (Float (Money'Last)); New_Line;
M.Put (Byte_1); M.Put (Byte_2); M.Put (Byte_3); New_Line;
-- Let's try with a different base; unfortunately, it uses the Ada
-- notation, found no way to remove it to write e.g. FF instead of
-- 16#FF#.
M.Put (Byte_1, Width => 8, Base => 16);
M.Put (Byte_2, Width => 8, Base => 16);
M.Put (Byte_3, Width => 8, Base => 2); New_Line;
Put_Line (To_String (Homer_Simpson));
end Test_Types;
|
gcc-gcc-7_3_0-release/gcc/ada/gnatxref.adb | best08618/asylo | 7 | 24719 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T X R E F --
-- --
-- B o d y --
-- --
-- Copyright (C) 1998-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Opt;
with Osint; use Osint;
with Types; use Types;
with Switch; use Switch;
with Xr_Tabls; use Xr_Tabls;
with Xref_Lib; use Xref_Lib;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Command_Line; use GNAT.Command_Line;
with System.Strings; use System.Strings;
procedure Gnatxref is
Search_Unused : Boolean := False;
Local_Symbols : Boolean := True;
Prj_File : File_Name_String;
Prj_File_Length : Natural := 0;
Usage_Error : exception;
Full_Path_Name : Boolean := False;
Vi_Mode : Boolean := False;
Read_Only : Boolean := False;
Have_File : Boolean := False;
Der_Info : Boolean := False;
RTS_Specified : String_Access := null;
-- Used to detect multiple use of --RTS= switch
EXT_Specified : String_Access := null;
-- Used to detect multiple use of --ext= switch
procedure Parse_Cmd_Line;
-- Parse every switch on the command line
procedure Usage;
-- Display the usage
procedure Write_Usage;
-- Print a small help page for program usage
--------------------
-- Parse_Cmd_Line --
--------------------
procedure Parse_Cmd_Line is
procedure Check_Version_And_Help is new Check_Version_And_Help_G (Usage);
-- Start of processing for Parse_Cmd_Line
begin
-- First check for --version or --help
Check_Version_And_Help ("GNATXREF", "1998");
loop
case
GNAT.Command_Line.Getopt
("a aI: aO: d f g h I: nostdinc nostdlib p: u v -RTS= -ext=")
is
when ASCII.NUL =>
exit;
when 'a' =>
if GNAT.Command_Line.Full_Switch = "a" then
Read_Only := True;
elsif GNAT.Command_Line.Full_Switch = "aI" then
Osint.Add_Src_Search_Dir (GNAT.Command_Line.Parameter);
else
Osint.Add_Lib_Search_Dir (GNAT.Command_Line.Parameter);
end if;
when 'd' =>
Der_Info := True;
when 'f' =>
Full_Path_Name := True;
when 'g' =>
Local_Symbols := False;
when 'h' =>
Write_Usage;
when 'I' =>
Osint.Add_Src_Search_Dir (GNAT.Command_Line.Parameter);
Osint.Add_Lib_Search_Dir (GNAT.Command_Line.Parameter);
when 'n' =>
if GNAT.Command_Line.Full_Switch = "nostdinc" then
Opt.No_Stdinc := True;
elsif GNAT.Command_Line.Full_Switch = "nostdlib" then
Opt.No_Stdlib := True;
end if;
when 'p' =>
declare
S : constant String := GNAT.Command_Line.Parameter;
begin
Prj_File_Length := S'Length;
Prj_File (1 .. Prj_File_Length) := S;
end;
when 'u' =>
Search_Unused := True;
Vi_Mode := False;
when 'v' =>
Vi_Mode := True;
Search_Unused := False;
-- The only switch starting with -- recognized is --RTS
when '-' =>
-- Check that it is the first time we see this switch
if Full_Switch = "-RTS" then
if RTS_Specified = null then
RTS_Specified := new String'(GNAT.Command_Line.Parameter);
elsif RTS_Specified.all /= GNAT.Command_Line.Parameter then
Osint.Fail ("--RTS cannot be specified multiple times");
end if;
Opt.No_Stdinc := True;
Opt.RTS_Switch := True;
declare
Src_Path_Name : constant String_Ptr :=
Get_RTS_Search_Dir
(GNAT.Command_Line.Parameter,
Include);
Lib_Path_Name : constant String_Ptr :=
Get_RTS_Search_Dir
(GNAT.Command_Line.Parameter,
Objects);
begin
if Src_Path_Name /= null
and then Lib_Path_Name /= null
then
Add_Search_Dirs (Src_Path_Name, Include);
Add_Search_Dirs (Lib_Path_Name, Objects);
elsif Src_Path_Name = null
and then Lib_Path_Name = null
then
Osint.Fail
("RTS path not valid: missing adainclude and "
& "adalib directories");
elsif Src_Path_Name = null then
Osint.Fail
("RTS path not valid: missing adainclude directory");
elsif Lib_Path_Name = null then
Osint.Fail
("RTS path not valid: missing adalib directory");
end if;
end;
elsif GNAT.Command_Line.Full_Switch = "-ext" then
-- Check that it is the first time we see this switch
if EXT_Specified = null then
EXT_Specified := new String'(GNAT.Command_Line.Parameter);
elsif EXT_Specified.all /= GNAT.Command_Line.Parameter then
Osint.Fail ("--ext cannot be specified multiple times");
end if;
if EXT_Specified'Length = Osint.ALI_Default_Suffix'Length
then
Osint.ALI_Suffix := EXT_Specified.all'Access;
else
Osint.Fail ("--ext argument must have 3 characters");
end if;
end if;
when others =>
Try_Help;
raise Usage_Error;
end case;
end loop;
-- Get the other arguments
loop
declare
S : constant String := GNAT.Command_Line.Get_Argument;
begin
exit when S'Length = 0;
if Ada.Strings.Fixed.Index (S, ":") /= 0 then
Ada.Text_IO.Put_Line
("Only file names are allowed on the command line");
Try_Help;
raise Usage_Error;
end if;
Add_Xref_File (S);
Have_File := True;
end;
end loop;
exception
when GNAT.Command_Line.Invalid_Switch =>
Ada.Text_IO.Put_Line ("Invalid switch : "
& GNAT.Command_Line.Full_Switch);
Try_Help;
raise Usage_Error;
when GNAT.Command_Line.Invalid_Parameter =>
Ada.Text_IO.Put_Line ("Parameter missing for : "
& GNAT.Command_Line.Full_Switch);
Try_Help;
raise Usage_Error;
end Parse_Cmd_Line;
-----------
-- Usage --
-----------
procedure Usage is
begin
Put_Line ("Usage: gnatxref [switches] file1 file2 ...");
New_Line;
Put_Line (" file ... list of source files to xref, " &
"including with'ed units");
New_Line;
Put_Line ("gnatxref switches:");
Display_Usage_Version_And_Help;
Put_Line (" -a Consider all files, even when the ali file is"
& " readonly");
Put_Line (" -aIdir Specify source files search path");
Put_Line (" -aOdir Specify library/object files search path");
Put_Line (" -d Output derived type information");
Put_Line (" -f Output full path name");
Put_Line (" -g Output information only for global symbols");
Put_Line (" -Idir Like -aIdir -aOdir");
Put_Line (" -nostdinc Don't look for sources in the system default"
& " directory");
Put_Line (" -nostdlib Don't look for library files in the system"
& " default directory");
Put_Line (" --ext=xxx Specify alternate ali file extension");
Put_Line (" --RTS=dir specify the default source and object search"
& " path");
Put_Line (" -p file Use file as the default project file");
Put_Line (" -u List unused entities");
Put_Line (" -v Print a 'tags' file for vi");
New_Line;
end Usage;
-----------------
-- Write_Usage --
-----------------
procedure Write_Usage is
begin
Display_Version ("GNATXREF", "1998");
New_Line;
Usage;
raise Usage_Error;
end Write_Usage;
begin
Parse_Cmd_Line;
if not Have_File then
if Argument_Count = 0 then
Write_Usage;
else
Try_Help;
raise Usage_Error;
end if;
end if;
Xr_Tabls.Set_Default_Match (True);
-- Find the project file
if Prj_File_Length = 0 then
Xr_Tabls.Create_Project_File
(Default_Project_File (Osint.To_Host_Dir_Spec (".", False).all));
else
Xr_Tabls.Create_Project_File (Prj_File (1 .. Prj_File_Length));
end if;
-- Fill up the table
Search_Xref (Local_Symbols, Read_Only, Der_Info);
if Search_Unused then
Print_Unused (Full_Path_Name);
elsif Vi_Mode then
Print_Vi (Full_Path_Name);
else
Print_Xref (Full_Path_Name);
end if;
exception
when Usage_Error =>
null;
end Gnatxref;
|
scripts/script.scpt | BMFirman/j-tunes | 2 | 2803 | <reponame>BMFirman/j-tunes<filename>scripts/script.scpt
-- JTunes auto script
tell application "iTunes"
play track ""
end tell |
programs/oeis/193/A193252.asm | neoneye/loda | 22 | 12048 | <filename>programs/oeis/193/A193252.asm
; A193252: Great rhombicuboctahedron with faces of centered polygons.
; 1,75,365,1015,2169,3971,6565,10095,14705,20539,27741,36455,46825,58995,73109,89311,107745,128555,151885,177879,206681,238435,273285,311375,352849,397851,446525,499015,555465,616019,680821,750015,823745,902155,985389,1073591,1166905,1265475,1369445,1478959,1594161,1715195,1842205,1975335,2114729,2260531,2412885,2571935,2737825,2910699,3090701,3277975,3472665,3674915,3884869,4102671,4328465,4562395,4804605,5055239,5314441,5582355,5859125,6144895,6439809,6744011,7057645,7380855,7713785,8056579,8409381,8772335,9145585,9529275,9923549,10328551,10744425,11171315,11609365,12058719,12519521,12991915,13476045,13972055,14480089,15000291,15532805,16077775,16635345,17205659,17788861,18385095,18994505,19617235,20253429,20903231,21566785,22244235,22935725,23641399
mul $0,2
add $0,1
mov $1,$0
mul $0,2
pow $1,3
mul $1,3
sub $1,$0
mov $0,$1
|
alloy4fun_models/trashltl/models/11/pwh3Gm8qAyXroSsyL.als | Kaixi26/org.alloytools.alloy | 0 | 4440 | open main
pred idpwh3Gm8qAyXroSsyL_prop12 {
eventually (always some f:File | f not in Trash implies f in Trash')
}
pred __repair { idpwh3Gm8qAyXroSsyL_prop12 }
check __repair { idpwh3Gm8qAyXroSsyL_prop12 <=> prop12o } |
engine/events/happiness_egg.asm | Dev727/ancientplatinum | 28 | 92155 | GetFirstPokemonHappiness:
ld hl, wPartyMon1Happiness
ld bc, PARTYMON_STRUCT_LENGTH
ld de, wPartySpecies
.loop
ld a, [de]
cp EGG
jr nz, .done
inc de
add hl, bc
jr .loop
.done
ld [wNamedObjectIndexBuffer], a
ld a, [hl]
ld [wScriptVar], a
call GetPokemonName
jp CopyPokemonName_Buffer1_Buffer3
CheckFirstMonIsEgg:
ld a, [wPartySpecies]
ld [wNamedObjectIndexBuffer], a
cp EGG
ld a, TRUE
jr z, .egg
xor a
.egg
ld [wScriptVar], a
call GetPokemonName
jp CopyPokemonName_Buffer1_Buffer3
ChangeHappiness:
; Perform happiness action c on wCurPartyMon
ld a, [wCurPartyMon]
inc a
ld e, a
ld d, 0
ld hl, wPartySpecies - 1
add hl, de
ld a, [hl]
cp EGG
ret z
push bc
ld hl, wPartyMon1Happiness
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [wCurPartyMon]
call AddNTimes
pop bc
ld d, h
ld e, l
push de
ld a, [de]
cp HAPPINESS_THRESHOLD_1
ld e, 0
jr c, .ok
inc e
cp HAPPINESS_THRESHOLD_2
jr c, .ok
inc e
.ok
dec c
ld b, 0
ld hl, HappinessChanges
add hl, bc
add hl, bc
add hl, bc
ld d, 0
add hl, de
ld a, [hl]
cp $64 ; why not $80?
pop de
ld a, [de]
jr nc, .negative
add [hl]
jr nc, .done
ld a, -1
jr .done
.negative
add [hl]
jr c, .done
xor a
.done
ld [de], a
ld a, [wBattleMode]
and a
ret z
ld a, [wCurPartyMon]
ld b, a
ld a, [wPartyMenuCursor]
cp b
ret nz
ld a, [de]
ld [wBattleMonHappiness], a
ret
INCLUDE "data/events/happiness_changes.asm"
StepHappiness::
; Raise the party's happiness by 1 point every other step cycle.
ld hl, wHappinessStepCount
ld a, [hl]
inc a
and 1
ld [hl], a
ret nz
ld de, wPartyCount
ld a, [de]
and a
ret z
ld c, a
ld hl, wPartyMon1Happiness
.loop
inc de
ld a, [de]
cp EGG
jr z, .next
inc [hl]
jr nz, .next
ld [hl], $ff
.next
push de
ld de, PARTYMON_STRUCT_LENGTH
add hl, de
pop de
dec c
jr nz, .loop
ret
DayCareStep::
; Raise the experience of Day-Care Pokémon every step cycle.
ld a, [wDayCareMan]
bit DAYCAREMAN_HAS_MON_F, a
jr z, .day_care_lady
ld a, [wBreedMon1Level] ; level
cp MAX_LEVEL
jr nc, .day_care_lady
ld hl, wBreedMon1Exp + 2 ; exp
inc [hl]
jr nz, .day_care_lady
dec hl
inc [hl]
jr nz, .day_care_lady
dec hl
inc [hl]
ld a, [hl]
cp HIGH(MAX_DAY_CARE_EXP >> 8)
jr c, .day_care_lady
ld a, HIGH(MAX_DAY_CARE_EXP >> 8)
ld [hl], a
.day_care_lady
ld a, [wDayCareLady]
bit DAYCARELADY_HAS_MON_F, a
jr z, .check_egg
ld a, [wBreedMon2Level] ; level
cp MAX_LEVEL
jr nc, .check_egg
ld hl, wBreedMon2Exp + 2 ; exp
inc [hl]
jr nz, .check_egg
dec hl
inc [hl]
jr nz, .check_egg
dec hl
inc [hl]
ld a, [hl]
cp HIGH(MAX_DAY_CARE_EXP >> 8)
jr c, .check_egg
ld a, HIGH(MAX_DAY_CARE_EXP >> 8)
ld [hl], a
.check_egg
ld hl, wDayCareMan
bit DAYCAREMAN_MONS_COMPATIBLE_F, [hl]
ret z
ld hl, wStepsToEgg
dec [hl]
ret nz
call Random
ld [hl], a
callfar CheckBreedmonCompatibility
ld a, [wBreedingCompatibility]
cp 230
ld b, 32 percent - 1
jr nc, .okay
ld a, [wBreedingCompatibility]
cp 170
ld b, 16 percent
jr nc, .okay
ld a, [wBreedingCompatibility]
cp 110
ld b, 12 percent
jr nc, .okay
ld b, 4 percent
.okay
call Random
cp b
ret nc
ld hl, wDayCareMan
res DAYCAREMAN_MONS_COMPATIBLE_F, [hl]
set DAYCAREMAN_HAS_EGG_F, [hl]
ret
|
programs/oeis/218/A218746.asm | neoneye/loda | 22 | 165456 | <reponame>neoneye/loda<gh_stars>10-100
; A218746: a(n) = (43^n-1)/42.
; 0,1,44,1893,81400,3500201,150508644,6471871693,278290482800,11966490760401,514559102697244,22126041415981493,951419780887204200,40911050578149780601,1759175174860440565844,75644532518998944331293,3252714898316954606245600,139866740627629048068560801,6014269846988049066948114444,258613603420486109878768921093,11120384947080902724787063607000,478176552724478817165843735101001,20561591767152589138131280609343044,884148445987561332939645066201750893
mov $1,43
pow $1,$0
div $1,42
mov $0,$1
|
src/WZCCC/parser/antlr/C.g4 | I-Rinka/WZC-C-Cpmpiler | 4 | 1129 | <reponame>I-Rinka/WZC-C-Cpmpiler
grammar C;
primaryExpression:
Identifier
| Constant
| StringLiteral+
| '(' expression ')';
postfixExpression:
primaryExpression # postfixExpression_pass
| postfixExpression '[' expression ']' # arrayAceess_
| postfixExpression '(' argumentExpressionList? ')' # functionCall_
| postfixExpression '.' Identifier # postfixExpression_
| postfixExpression '->' Identifier # postfixExpression_
| postfixExpression '++' # postfixExpression_
| postfixExpression '--' # postfixExpression_;
argumentExpressionList:
assignmentExpression
| argumentExpressionList ',' assignmentExpression;
unaryExpression:
postfixExpression # unaryExpression_pass
| '++' unaryExpression # unaryExpression_
| '--' unaryExpression # unaryExpression_
| unaryOperator castExpression # unaryExpression_
| 'sizeof' unaryExpression # unaryTypename_
| 'sizeof' '(' typeName ')' # unaryTypename_;
unaryOperator: '&' | '*' | '+' | '-' | '~' | '!';
castExpression:
'(' typeName ')' castExpression # castExpression_
| unaryExpression # castExpression_pass;
// | DigitSequence ; // for
multiplicativeExpression:
castExpression # multiplicativeExpression_pass
| multiplicativeExpression '*' castExpression # multiplicativeExpression_
| multiplicativeExpression '/' castExpression # multiplicativeExpression_
| multiplicativeExpression '%' castExpression # multiplicativeExpression_;
additiveExpression:
multiplicativeExpression # additiveExpression_pass
| additiveExpression '+' multiplicativeExpression # additiveExpression_
| additiveExpression '-' multiplicativeExpression # additiveExpression_;
shiftExpression:
additiveExpression # shiftExpression_pass
| shiftExpression '<<' additiveExpression # shiftExpression_
| shiftExpression '>>' additiveExpression # shiftExpression_;
relationalExpression:
shiftExpression # relationalExpression_pass
| relationalExpression '<' shiftExpression # relationalExpression_
| relationalExpression '>' shiftExpression # relationalExpression_
| relationalExpression '<=' shiftExpression # relationalExpression_
| relationalExpression '>=' shiftExpression # relationalExpression_;
equalityExpression:
relationalExpression # equalityExpression_pass
| equalityExpression '==' relationalExpression # equalityExpression_
| equalityExpression '!=' relationalExpression # equalityExpression_;
andExpression:
equalityExpression
| andExpression '&' equalityExpression;
exclusiveOrExpression:
andExpression
| exclusiveOrExpression '^' andExpression;
inclusiveOrExpression:
exclusiveOrExpression
| inclusiveOrExpression '|' exclusiveOrExpression;
logicalAndExpression:
inclusiveOrExpression # logicalAndExpression_pass
| logicalAndExpression '&&' inclusiveOrExpression # logicalAndExpression_;
logicalOrExpression:
logicalAndExpression # logicalOrExpression_pass
| logicalOrExpression '||' logicalAndExpression # logicalOrExpression_;
conditionalExpression:
logicalOrExpression # conditionalExpression_pass
| logicalOrExpression (
'?' expression ':' conditionalExpression
) # conditionalExpression_;
assignmentExpression:
conditionalExpression # assignmentExpression_pass
| unaryExpression assignmentOperator assignmentExpression # assignmentExpression_;
assignmentOperator:
'='
| '*='
| '/='
| '%='
| '+='
| '-='
| '<<='
| '>>='
| '&='
| '^='
| '|=';
expression:
assignmentExpression
| expression ',' assignmentExpression;
constantExpression: conditionalExpression;
declaration:
declarationSpecifiers initDeclaratorList ';'
| declarationSpecifiers ';';
declarationSpecifiers: declarationSpecifier+;
declarationSpecifiers2: declarationSpecifier+;
declarationSpecifier:
storageClassSpecifier
| typeSpecifier
| typeQualifier;
initDeclaratorList:
initDeclarator
| initDeclaratorList ',' initDeclarator;
initDeclarator: declarator | declarator '=' initializer;
storageClassSpecifier:
'typedef'
| 'extern'
| 'static'
| 'auto'
| 'register';
typeSpecifier: (
'void'
| 'char'
| 'short'
| 'int'
| 'long'
| 'float'
| 'double'
| 'signed'
| 'unsigned'
| '_Bool'
| '_Complex'
)
| structOrUnionSpecifier
| enumSpecifier
| typedefName
| typeSpecifier pointer;
structOrUnionSpecifier:
structOrUnion Identifier? '{' structDeclarationList '}'
| structOrUnion Identifier;
structOrUnion: 'struct' | 'union';
structDeclarationList:
structDeclaration
| structDeclarationList structDeclaration;
structDeclaration:
specifierQualifierList structDeclaratorList? ';';
specifierQualifierList:
typeSpecifier specifierQualifierList?
| typeQualifier specifierQualifierList?;
structDeclaratorList:
structDeclarator
| structDeclaratorList ',' structDeclarator;
structDeclarator:
declarator
| declarator? ':' constantExpression;
enumSpecifier:
'enum' Identifier? '{' enumeratorList '}'
| 'enum' Identifier? '{' enumeratorList ',' '}'
| 'enum' Identifier;
enumeratorList: enumerator | enumeratorList ',' enumerator;
enumerator:
enumerationConstant
| enumerationConstant '=' constantExpression;
enumerationConstant: Identifier;
typeQualifier: 'const' | 'restrict' | 'volatile' | '_Atomic';
declarator: pointer? directDeclarator;
directDeclarator:
Identifier # variableDeclarator
| '(' declarator ')' # variableDeclarator
| directDeclarator '[' typeQualifierList? assignmentExpression? ']' # arrayDeclarator
| directDeclarator '[' 'static' typeQualifierList? assignmentExpression ']' # arrayDeclarator
| directDeclarator '[' typeQualifierList 'static' assignmentExpression ']' # arrayDeclarator
| directDeclarator '[' typeQualifierList? '*' ']' # arrayDeclarator
| directDeclarator '(' parameterTypeList ')' # functionDeclarator
| directDeclarator '(' identifierList? ')' # functionDeclarator;
pointer:
'*' typeQualifierList?
| '*' typeQualifierList? pointer
| '^' typeQualifierList?
| '^' typeQualifierList? pointer;
typeQualifierList:
typeQualifier
| typeQualifierList typeQualifier;
parameterTypeList: parameterList | parameterList ',' '...';
parameterList:
parameterDeclaration
| parameterList ',' parameterDeclaration;
parameterDeclaration:
declarationSpecifiers declarator
| declarationSpecifiers2 abstractDeclarator?;
identifierList: Identifier | identifierList ',' Identifier;
typeName: specifierQualifierList abstractDeclarator?;
abstractDeclarator: pointer | pointer? directAbstractDeclarator;
directAbstractDeclarator:
'(' abstractDeclarator ')'
| '[' typeQualifierList? assignmentExpression? ']'
| '[' 'static' typeQualifierList? assignmentExpression ']'
| '[' typeQualifierList 'static' assignmentExpression ']'
| '[' '*' ']'
| '(' parameterTypeList? ')'
| directAbstractDeclarator '[' typeQualifierList? assignmentExpression? ']'
| directAbstractDeclarator '[' 'static' typeQualifierList? assignmentExpression ']'
| directAbstractDeclarator '[' typeQualifierList 'static' assignmentExpression ']'
| directAbstractDeclarator '[' '*' ']'
| directAbstractDeclarator '(' parameterTypeList? ')';
typedefName: Identifier;
initializer:
assignmentExpression
| '{' initializerList '}'
| '{' initializerList ',' '}';
initializerList:
designation? initializer
| initializerList ',' designation? initializer;
designation: designatorList '=';
designatorList: designator | designatorList designator;
designator: '[' constantExpression ']' | '.' Identifier;
statement:
labeledStatement
| compoundStatement
| expressionStatement
| selectionStatement
| iterationStatement
| jumpStatement;
labeledStatement:
Identifier ':' statement
| 'case' constantExpression ':' statement
| 'default' ':' statement;
compoundStatement: '{' blockItemList? '}';
blockItemList: blockItem | blockItemList blockItem;
blockItem: statement | declaration;
expressionStatement: expression? ';';
selectionStatement:
'if' '(' expression ')' statement ('else' statement)?
| 'switch' '(' expression ')' statement;
iterationStatement:
While '(' expression ')' statement # iterationWhileStatement_
| Do statement While '(' expression ')' ';' # iterationDoStatement_
| For '(' forDeclaration ';' forExpression? ';' forExpression? ')' statement #
iterationDeclaredStatement_
| For '(' expression? ';' forExpression? ';' forExpression? ')' statement # iterationStatement_;
forDeclaration:
declarationSpecifiers initDeclaratorList
| declarationSpecifiers;
forExpression:
assignmentExpression
| forExpression ',' assignmentExpression;
jumpStatement:
'goto' Identifier ';' # GotoStatement
| 'continue' ';' # ContinueStatement
| 'break' ';' # BreakStatement
| 'return' expression? ';' # ReturnStatement;
compilationUnit: translationUnit? EOF;
translationUnit:
externalDeclaration
| translationUnit externalDeclaration;
externalDeclaration:
functionDefinition
| declaration
| ';';
functionDefinition:
declarationSpecifiers? declarator declarationList? compoundStatement;
declarationList: declaration | declarationList declaration;
Auto: 'auto';
Break: 'break';
Case: 'case';
Char: 'char';
Const: 'const';
Continue: 'continue';
Default: 'default';
Do: 'do';
Double: 'double';
Else: 'else';
Enum: 'enum';
Extern: 'extern';
Float: 'float';
For: 'for';
Goto: 'goto';
If: 'if';
Inline: 'inline';
Int: 'int';
Long: 'long';
Register: 'register';
Restrict: 'restrict';
Return: 'return';
Short: 'short';
Signed: 'signed';
Sizeof: 'sizeof';
Static: 'static';
Struct: 'struct';
Switch: 'switch';
Typedef: 'typedef';
Union: 'union';
Unsigned: 'unsigned';
Void: 'void';
Volatile: 'volatile';
While: 'while';
Alignas: '_Alignas';
Alignof: '_Alignof';
Atomic: '_Atomic';
Bool: '_Bool';
Complex: '_Complex';
LeftParen: '(';
RightParen: ')';
LeftBracket: '[';
RightBracket: ']';
LeftBrace: '{';
RightBrace: '}';
Less: '<';
LessEqual: '<=';
Greater: '>';
GreaterEqual: '>=';
LeftShift: '<<';
RightShift: '>>';
Plus: '+';
PlusPlus: '++';
Minus: '-';
MinusMinus: '--';
Star: '*';
Div: '/';
Mod: '%';
And: '&';
Or: '|';
AndAnd: '&&';
OrOr: '||';
Caret: '^';
Not: '!';
Tilde: '~';
Question: '?';
Colon: ':';
Semi: ';';
Comma: ',';
Assign: '=';
StarAssign: '*=';
DivAssign: '/=';
ModAssign: '%=';
PlusAssign: '+=';
MinusAssign: '-=';
LeftShiftAssign: '<<=';
RightShiftAssign: '>>=';
AndAssign: '&=';
XorAssign: '^=';
OrAssign: '|=';
Equal: '==';
NotEqual: '!=';
Arrow: '->';
Dot: '.';
Ellipsis: '...';
Identifier: IdentifierNondigit ( IdentifierNondigit | Digit)*;
fragment IdentifierNondigit:
Nondigit
| UniversalCharacterName;
fragment Nondigit: [a-zA-Z_];
fragment Digit: [0-9];
fragment UniversalCharacterName:
'\\u' HexQuad
| '\\U' HexQuad HexQuad;
fragment HexQuad:
HexadecimalDigit HexadecimalDigit HexadecimalDigit HexadecimalDigit;
Constant:
IntegerConstant
| FloatingConstant
//| EnumerationConstant
| CharacterConstant;
fragment IntegerConstant:
DecimalConstant IntegerSuffix?
| OctalConstant IntegerSuffix?
| HexadecimalConstant IntegerSuffix?
| BinaryConstant;
fragment BinaryConstant: '0' [bB] [0-1]+;
fragment DecimalConstant: NonzeroDigit Digit*;
fragment OctalConstant: '0' OctalDigit*;
fragment HexadecimalConstant:
HexadecimalPrefix HexadecimalDigit+;
fragment HexadecimalPrefix: '0' [xX];
fragment NonzeroDigit: [1-9];
fragment OctalDigit: [0-7];
fragment HexadecimalDigit: [0-9a-fA-F];
fragment IntegerSuffix:
UnsignedSuffix LongSuffix?
| UnsignedSuffix LongLongSuffix
| LongSuffix UnsignedSuffix?
| LongLongSuffix UnsignedSuffix?;
fragment UnsignedSuffix: [uU];
fragment LongSuffix: [lL];
fragment LongLongSuffix: 'll' | 'LL';
fragment FloatingConstant:
DecimalFloatingConstant
| HexadecimalFloatingConstant;
fragment DecimalFloatingConstant:
FractionalConstant ExponentPart? FloatingSuffix?
| DigitSequence ExponentPart FloatingSuffix?;
fragment HexadecimalFloatingConstant:
HexadecimalPrefix HexadecimalFractionalConstant BinaryExponentPart FloatingSuffix?
| HexadecimalPrefix HexadecimalDigitSequence BinaryExponentPart FloatingSuffix?;
fragment FractionalConstant:
DigitSequence? '.' DigitSequence
| DigitSequence '.';
fragment ExponentPart:
'e' Sign? DigitSequence
| 'E' Sign? DigitSequence;
fragment Sign: '+' | '-';
DigitSequence: Digit+;
fragment HexadecimalFractionalConstant:
HexadecimalDigitSequence? '.' HexadecimalDigitSequence
| HexadecimalDigitSequence '.';
fragment BinaryExponentPart:
'p' Sign? DigitSequence
| 'P' Sign? DigitSequence;
fragment HexadecimalDigitSequence: HexadecimalDigit+;
fragment FloatingSuffix: 'f' | 'l' | 'F' | 'L';
fragment CharacterConstant:
'\'' CCharSequence '\''
| 'L\'' CCharSequence '\''
| 'u\'' CCharSequence '\''
| 'U\'' CCharSequence '\'';
fragment CCharSequence: CChar+;
fragment CChar: ~['\\\r\n] | EscapeSequence;
fragment EscapeSequence:
SimpleEscapeSequence
| OctalEscapeSequence
| HexadecimalEscapeSequence
| UniversalCharacterName;
fragment SimpleEscapeSequence: '\\' ['"?abfnrtv\\];
fragment OctalEscapeSequence:
'\\' OctalDigit
| '\\' OctalDigit OctalDigit
| '\\' OctalDigit OctalDigit OctalDigit;
fragment HexadecimalEscapeSequence: '\\x' HexadecimalDigit+;
StringLiteral: EncodingPrefix? '"' SCharSequence? '"';
fragment EncodingPrefix: 'u8' | 'u' | 'U' | 'L';
fragment SCharSequence: SChar+;
fragment SChar:
~["\\\r\n]
| EscapeSequence
| '\\\n' // Added line
| '\\\r\n'; // Added line
ComplexDefine: '#' Whitespace? 'define' ~[#\r\n]* -> skip;
IncludeDirective:
'#' Whitespace? 'include' Whitespace? (
('"' ~[\r\n]* '"')
| ('<' ~[\r\n]* '>')
) Whitespace? Newline -> skip;
AsmBlock: 'asm' ~'{'* '{' ~'}'* '}' -> skip;
LineAfterPreprocessing: '#line' Whitespace* ~[\r\n]* -> skip;
LineDirective:
'#' Whitespace? DecimalConstant Whitespace? StringLiteral ~[\r\n]* -> skip;
PragmaDirective:
'#' Whitespace? 'pragma' Whitespace ~[\r\n]* -> skip;
Whitespace: [ \t\n]+ -> skip;
Newline: ( '\r' '\n'? | '\n') -> skip;
BlockComment: '/*' .*? '*/' -> skip;
LineComment: '//' ~[\r\n]* -> skip; |
Transynther/x86/_processed/US/_zr_/i7-8650U_0xd2_notsx.log_1595_1257.asm | ljhsiun2/medusa | 9 | 17219 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r15
push %r8
push %rax
push %rdi
push %rsi
lea addresses_normal_ht+0xb4d8, %r14
nop
nop
sub %rax, %rax
movw $0x6162, (%r14)
nop
nop
nop
nop
nop
sub $57537, %rdi
lea addresses_WT_ht+0x17958, %rdi
nop
nop
nop
nop
nop
and %r12, %r12
movl $0x61626364, (%rdi)
nop
nop
nop
cmp $1738, %rsi
lea addresses_UC_ht+0xb958, %r12
xor $2223, %r8
movb (%r12), %r14b
nop
nop
nop
cmp %r12, %r12
lea addresses_WC_ht+0xdbd8, %r12
nop
nop
and $17716, %r15
movb (%r12), %al
nop
nop
nop
sub %rax, %rax
pop %rsi
pop %rdi
pop %rax
pop %r8
pop %r15
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r15
push %r8
push %r9
push %rbx
// Load
lea addresses_US+0x11b58, %rbx
nop
nop
nop
nop
nop
inc %r12
mov (%rbx), %r15
nop
nop
nop
nop
nop
cmp $62837, %r9
// Load
mov $0x1585a90000000c50, %r9
nop
dec %r12
mov (%r9), %r8w
nop
nop
xor $24900, %rbx
// Store
mov $0x33966300000000c8, %r9
nop
nop
xor $56097, %r10
mov $0x5152535455565758, %rbx
movq %rbx, (%r9)
nop
nop
nop
sub %r9, %r9
// Faulty Load
lea addresses_US+0x1ab58, %rbx
nop
nop
nop
nop
sub $19246, %r14
movups (%rbx), %xmm4
vpextrq $0, %xmm4, %r8
lea oracles, %r15
and $0xff, %r8
shlq $12, %r8
mov (%r15,%r8,1), %r8
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': True}}
{'00': 1595}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
ESEMPI/PROGRAMMA CORTO.asm | Porchetta/py-pdp8-tk | 8 | 27391 | ORG 100
HLT
END
|
programs/oeis/040/A040134.asm | neoneye/loda | 22 | 104967 | ; A040134: Continued fraction for sqrt(147).
; 12,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8,24,8
mul $0,-3
add $0,2
mod $0,6
div $0,2
pow $0,2
mul $0,4
add $0,8
|
Task/RSA-code/Ada/rsa-code.ada | LaudateCorpus1/RosettaCodeData | 1 | 15065 | <reponame>LaudateCorpus1/RosettaCodeData<filename>Task/RSA-code/Ada/rsa-code.ada<gh_stars>1-10
WITH GMP, GMP.Integers, Ada.Text_IO, GMP.Integers.Aliased_Internal_Value, Interfaces.C;
USE GMP, Gmp.Integers, Ada.Text_IO, Interfaces.C;
PROCEDURE Main IS
FUNCTION "+" (U : Unbounded_Integer) RETURN Mpz_T IS (Aliased_Internal_Value (U));
FUNCTION "+" (S : String) RETURN Unbounded_Integer IS (To_Unbounded_Integer (S));
FUNCTION Image_Cleared (M : Mpz_T) RETURN String IS (Image (To_Unbounded_Integer (M)));
N : Unbounded_Integer := +"9516311845790656153499716760847001433441357";
E : Unbounded_Integer := +"65537";
D : Unbounded_Integer := +"5617843187844953170308463622230283376298685";
Plain_Text : CONSTANT String := "Rosetta Code";
M, M_C, M_D : Mpz_T;
-- We import two C functions from the GMP library which are not in the specs of the gmp package
PROCEDURE Mpz_Import
(Rop : Mpz_T; Count : Size_T; Order : Int; Size : Size_T; Endian : Int;
Nails : Size_T; Op : Char_Array);
PRAGMA Import (C, Mpz_Import, "__gmpz_import");
PROCEDURE Mpz_Export
(Rop : OUT Char_Array; Count : ACCESS Size_T; Order : Int; Size : Size_T;
Endian : Int; Nails : Size_T; Op : Mpz_T);
PRAGMA Import (C, Mpz_Export, "__gmpz_export");
BEGIN
Mpz_Init (M);
Mpz_Init (M_C);
Mpz_Init (M_D);
Mpz_Import (M, Plain_Text'Length + 1, 1, 1, 0, 0, To_C (Plain_Text));
Mpz_Powm (M_C, M, +E, +N);
Mpz_Powm (M_D, M_C, +D, +N);
Put_Line ("Encoded plain text: " & Image_Cleared (M));
DECLARE Decrypted : Char_Array (1 .. Mpz_Sizeinbase (M_C, 256));
BEGIN
Put_Line ("Encryption of this encoding: " & Image_Cleared (M_C));
Mpz_Export (Decrypted, NULL, 1, 1, 0, 0, M_D);
Put_Line ("Decryption of the encoding: " & Image_Cleared (M_D));
Put_Line ("Final decryption: " & To_Ada (Decrypted));
END;
END Main;
|
oeis/142/A142580.asm | neoneye/loda-programs | 11 | 164413 | <reponame>neoneye/loda-programs
; A142580: Primes congruent to 50 mod 53.
; Submitted by <NAME>
; 103,421,739,1163,1481,1693,2011,2647,2753,3389,3919,5297,5827,6569,6781,7417,7523,7841,8053,8689,9007,9431,9643,9749,10067,10597,11551,11657,12611,12823,13883,14519,14731,15473,15791,16427,17911,18229,19183,19289,19501,19819,20773,20879,21727,22469,22787,23741,24907,25013,26497,26921,27239,28087,28723,29147,30313,30631,30949,31267,32009,32327,33493,33599,33811,34129,34871,35083,35401,35507,36037,36779,37097,37309,39217,39323,40277,41231,41443,41549,41761,42397,42821,43457,43669,43987,44623
mov $1,51
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,1
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,53
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
mul $0,2
sub $0,105
|
test/Fail/Issue1982.agda | shlevy/agda | 1,989 | 11823 | <reponame>shlevy/agda
open import Agda.Builtin.Nat
data Tm : Nat → Set where
UP : ∀ {n} → Tm n → Tm n
!_ : ∀ {n} → Tm n → Tm (suc n)
! UP t = UP (! t)
data Ty : Nat → Set where
⊥ : ∀ {n} → Ty n
_∶_ : ∀ {n} → Tm n → Ty n → Ty (suc n)
data Cx : Set where
∅ : Cx
_,_ : ∀ {n} → Cx → Ty n → Cx
data _⊇_ : Cx → Cx → Set where
base : ∅ ⊇ ∅
weak : ∀ {Γ Γ′ n} {A : Ty n} → Γ′ ⊇ Γ → (Γ′ , A) ⊇ Γ
lift : ∀ {Γ Γ′ n} {A : Ty n} → Γ′ ⊇ Γ → (Γ′ , A) ⊇ (Γ , A)
data True (Γ : Cx) : ∀ {n} → Ty n → Set where
up : ∀ {n} {t : Tm n} {A : Ty n} → True Γ (t ∶ A) → True Γ ((! t) ∶ (t ∶ A))
ren-true--pass : ∀ {n Γ Γ′} {A : Ty n} → Γ′ ⊇ Γ → True Γ A → True Γ′ A
ren-true--pass η (up j) = up (ren-true--pass η j)
ren-true--fail : ∀ {Γ Γ′ A} → Γ′ ⊇ Γ → True Γ A → True Γ′ A
ren-true--fail η (up j) = up (ren-true--fail η j)
|
kv-avm-clients.ads | davidkristola/vole | 4 | 4262 | <reponame>davidkristola/vole<gh_stars>1-10
with Ada.Unchecked_Deallocation;
with Interfaces;
with kv.avm.Transactions;
package kv.avm.Clients is
type Client_Interface is interface;
type Client_Access is access all Client_Interface'CLASS;
type Status_Type is (Uninitialized, Closed, Running, Transacting, Failed);
subtype Open_Status_Type is Status_Type range Running .. Transacting;
procedure Bind_Address
(Self : in out Client_Interface;
Address : in String) is abstract;
procedure Bind_Port
(Self : in out Client_Interface;
Port : in Positive) is abstract;
procedure Open
(Self : in out Client_Interface) is abstract;
procedure Close
(Self : in out Client_Interface) is abstract;
function Get_Status(Self : Client_Interface) return Status_Type is abstract;
function Is_Open(Self : Client_Interface) return Boolean is abstract;
procedure Send_Transaction
(Self : in out Client_Interface;
Transaction : in kv.avm.Transactions.Transactions_Interface'CLASS) is abstract;
procedure Conclude_Transaction
(Self : in out Client_Interface) is abstract;
function Is_Transaction_Pending(Self : Client_Interface) return Boolean is abstract;
function Get_Transaction(Self : Client_Interface) return kv.avm.Transactions.Transactions_Access is abstract;
function Get_Domain(Self : Client_Interface) return Interfaces.Unsigned_32 is abstract;
procedure Free is new Ada.Unchecked_Deallocation(Client_Interface'CLASS, Client_Access);
type Client_Factory is interface;
type Factory_Access is access all Client_Factory'CLASS;
procedure New_Client
(Self : in out Client_Factory;
Client : out Client_Access) is abstract;
end kv.avm.Clients;
|
tests/src/test_text_rewrites.ads | TNO/Rejuvenation-Ada | 1 | 6436 | <reponame>TNO/Rejuvenation-Ada<gh_stars>1-10
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
package Test_Text_Rewrites is
type Text_Rewrite_Test_Case is
new Test_Case with null record;
overriding procedure Register_Tests
(T : in out Text_Rewrite_Test_Case);
-- Register routines to be run
overriding function Name
(T : Text_Rewrite_Test_Case)
return Message_String;
-- Provide name identifying the test case
end Test_Text_Rewrites;
|
libsrc/_DEVELOPMENT/adt/wa_stack/c/sdcc_iy/wa_stack_clear.asm | meesokim/z88dk | 0 | 175495 |
; void wa_stack_clear(wa_stack_t *s)
SECTION code_adt_wa_stack
PUBLIC _wa_stack_clear
EXTERN _w_array_clear
defc _wa_stack_clear = _w_array_clear
|
labs/lab1/lab01C/lab03C/main.asm | stanley-jc/COMP2121 | 2 | 95726 | <reponame>stanley-jc/COMP2121
;
; lab03C.asm
;
; Created: 2017/8/11 16:51:22
; Author : <NAME>
;
; Replace with your application code
.include"m2560def.inc"
.def counter=r19;define a counter
.dseg
array: .byte 20;set array space
sum: .byte 2;set a 16-bit variable for summation
temp: .byte 2;temporate variable
.cseg
;set register
ldi r16,low(temp)
ldi r17,high(temp)
ldi zl, low(array)
ldi zh, high(array)
ldi r21,low(sum)
ldi r22,high(sum)
;initialise value
ldi r20,200
clr r16
clr r17
clr counter
;initialise the value of the array
initialise:
mul counter,r20
mov r16,r0
mov r17,r1
st z+,r16
st z+,r17
inc counter
cpi counter,10
brlt initialise
;reload the value
clr counter
clr r0
clr r1
ldi zl, low(array)
ldi zh, high(array)
;test if values are stored correctly
;show:
;ld r0,z+
;ld r1,z+
;inc counter
;cpi counter,10
;brlt show
;ldi zl, low(array)
;ldi zh, high(array)
;clr counter
;clr r0
;clr r1
;clr r21
;clr r22
;do the summation
summation:
;load values from array a
ld r0,z+
ld r1,z+
add r21,r0
adc r22,r1
inc counter
cpi counter,10
;loop if counter is less than 10
brlt summation
;endless loop
end:
rjmp end
|
programs/oeis/317/A317318.asm | jmorken/loda | 1 | 170510 | <reponame>jmorken/loda
; A317318: Multiples of 18 and odd numbers interleaved.
; 0,1,18,3,36,5,54,7,72,9,90,11,108,13,126,15,144,17,162,19,180,21,198,23,216,25,234,27,252,29,270,31,288,33,306,35,324,37,342,39,360,41,378,43,396,45,414,47,432,49,450,51,468,53,486,55,504,57,522,59,540,61,558,63,576,65,594,67,612,69,630,71,648,73,666,75,684,77,702,79,720,81,738,83,756,85,774,87,792,89,810,91,828,93,846,95,864,97,882,99,900,101,918,103,936,105,954,107,972,109,990,111,1008,113,1026,115,1044,117,1062,119,1080,121,1098,123,1116,125,1134,127,1152,129,1170,131,1188,133,1206,135,1224,137,1242,139,1260,141,1278,143,1296,145,1314,147,1332,149,1350,151,1368,153,1386,155,1404,157,1422,159,1440,161,1458,163,1476,165,1494,167,1512,169,1530,171,1548,173,1566,175,1584,177,1602,179,1620,181,1638,183,1656,185,1674,187,1692,189,1710,191,1728,193,1746,195,1764,197,1782,199,1800,201,1818,203,1836,205,1854,207,1872,209,1890,211,1908,213,1926,215,1944,217,1962,219,1980,221,1998,223,2016,225,2034,227,2052,229,2070,231,2088,233,2106,235,2124,237,2142,239,2160,241,2178,243,2196,245,2214,247,2232,249
mov $1,$0
gcd $0,4
lpb $0
gcd $0,1
mul $1,9
lpe
|
agent/io/bind.asm | jephthai/EvilVM | 141 | 1467 | <gh_stars>100-1000
;;;
;;; A TCP bind transport, which receives a connection from a
;;; connector that will jack it into the server console.
;;;
;;; Connect it something like this:
;;;
;;; (0) Run server at a convenient location
;;; (1) Run bind payload (will bind to configured port)
;;; (2) Run socat to connect the two services together:
;;;
;;; socat TCP:<victim>:<port> TCP:<server>:<port>
;;;
%ifndef CONNECTWAIT
%define CONNECTWAIT 1000
%endif
%ifndef IPADDR
%define IPADDR 0,0,0,0
%endif
%ifndef PORT
%define PORT 1919
%endif
start_def ASM, engine, "engine"
pushthing 2 ; 2 is the network engine
end_def engine
start_def ASM, initio, "initio"
mov rbp, rsp
and rsp, -16 ; align stack
sub rsp, 0x20
call .b
.a: db "ws2_32.dll", 0
.a1: db "WSAStartup", 0
.a2: db "socket", 0
.a3: db "bind", 0
.a4: db "send", 0
.a5: db "recv", 0
.a6: db "ioctlsocket", 0
.a7: db "accept", 0
.a8: db "closesocket", 0
.a9: db "listen", 0
.b: pop rbx
lea rcx, [rbx]
call W32_LoadLibraryA
AddGlobal G_WINSOCK, rax
mov rsi, W32_GetProcAddress
mov rdi, rax
GetProcAddress code_initio.a1 - code_initio.a, G_WSASTARTUP
GetProcAddress code_initio.a2 - code_initio.a, G_WSOCKET
GetProcAddress code_initio.a3 - code_initio.a, G_WBIND
GetProcAddress code_initio.a4 - code_initio.a, G_WSEND
GetProcAddress code_initio.a5 - code_initio.a, G_WRECV
GetProcAddress code_initio.a6 - code_initio.a, G_IOCTL
GetProcAddress code_initio.a7 - code_initio.a, G_WACCEPT
GetProcAddress code_initio.a8 - code_initio.a, G_WCLOSESOCKET
GetProcAddress code_initio.a9 - code_initio.a, G_WLISTEN
;; initialize networking
mov ecx, 0x0202
mov rdx, G_HERE
call G_WSASTARTUP
;; create socket
mov ecx, 2
mov edx, 1
mov r8, 6
call G_WSOCKET
AddGlobal G_SOCK, rax
;; create address record, connect to port
mov rcx, G_SOCK
mov r8, 16
lea rdx, [ rel $ + 9 ]
jmp .conn
db 2, 0, ; AF_INET
db (PORT >> 8) ; port, high byte
db (PORT & 0xff) ; port, low byte
db IPADDR ; target IP address
dq 0 ; padding
.conn: call G_WBIND ; connect to port
;; listen
mov rcx, G_SOCK
mov rdx, 1
call G_WLISTEN
;; accept one connection
xor rdx, rdx
mov r8, rdx
mov rcx, G_SOCK
call G_WACCEPT
;; save the client socket
push rax
sub rsp, 0x20
;; close bound socket
mov rcx, G_SOCK
call G_WCLOSESOCKET
add rsp, 0x20
pop rax
mov G_SOCK, rax
mov rsp, rbp
end_def initio
start_def ASM, c2sock, "c2sock"
pushthing G_SOCK
end_def c2sock
start_def ASM, echooff, "-echo"
end_def echooff
start_def ASM, echoon, "+echo"
end_def echoon
start_def ASM, setecho, "!echo"
popthing QWORD G_ECHO
end_def setecho
start_def ASM, emit, "emit"
push rcx
push rdi
mov rcx, G_SOCK
mov rdx, rsp
xor r8, r8
inc r8
xor r9, r9
sub rsp, 0x20
call G_WSEND
add rsp, 0x28
mov rdi, [PSP]
add PSP, 8
pop rcx
end_def emit
start_def ASM, key, "key"
sub PSP, 8
mov [PSP], rdi
push rdi
mov rcx, G_SOCK
mov rdx, rsp
xor r8, r8
inc r8
xor r9, r9
sub rsp, 0x20
call G_WRECV
add rsp, 0x20
pop rdi
and rdi, 0xff
cmp dil, 0x0a
jne .notnl
inc QWORD G_LINENO
.notnl: cmp BYTE G_ECHO, BYTE 0
jz .skip
cmp TOS, 0x0a
jne .skip
call code_prompt
jmp .skip
.skip:
end_def key
start_def ASM, keyq, "key?"
push rcx
push rdx
mov rbp, rsp
sub rsp, 0x28
mov rcx, G_SOCK
mov rdx, 1074030207
lea r8, [rsp + 0x20]
call G_IOCTL
pushthing 1
mov edi, [rsp + 0x20]
mov rsp, rbp
pop rdx
pop rcx
end_def keyq
start_def ASM, type, "type"
push rcx
mov rcx, G_SOCK
mov rdx, [PSP]
mov r8, rdi
xor r9, r9
sub rsp, 0x20
call G_WSEND
add rsp, 0x20
mov rdi, [PSP+8]
add PSP, 16
pop rcx
end_def type
|
oeis/004/A004582.asm | neoneye/loda-programs | 11 | 86733 | <gh_stars>10-100
; A004582: Expansion of sqrt(8) in base 7.
; Submitted by <NAME>
; 2,5,5,4,1,0,2,4,2,3,4,2,2,4,6,5,5,2,1,5,3,0,1,4,2,0,2,4,0,3,5,3,6,5,5,1,1,3,1,1,0,1,1,5,3,2,2,5,5,1,3,4,3,5,0,4,5,6,5,3,4,6,0,3,4,4,0,5,5,1,4,6,3,3,4,3,4,5,2,0,5,4,1,6,1,1,4,3,3,2,2,3,3,3,4,0,1,1,3,3
mov $1,1
mov $2,1
mov $3,$0
add $3,3
mov $4,$0
add $4,2
mul $4,2
mov $7,10
pow $7,$4
mov $9,7
lpb $3
mov $4,$2
pow $4,2
mul $4,8
mov $5,$1
pow $5,2
add $4,$5
mov $6,$1
mov $1,$4
mul $6,$2
mul $6,2
mov $2,$6
mov $8,$4
div $8,$7
max $8,1
div $1,$8
div $2,$8
sub $3,1
lpe
mov $3,$9
pow $3,$0
div $2,$3
div $1,$2
mod $1,$9
mov $0,$1
|
oeis/003/A003035.asm | neoneye/loda-programs | 11 | 17086 | <reponame>neoneye/loda-programs
; A003035: Maximal number of 3-tree rows in n-tree orchard problem.
; Submitted by <NAME>
; 0,0,1,1,2,4,6,7,10,12,16,19,22,26
mov $2,$0
mul $2,$0
div $2,2
add $2,5
mul $2,7
sub $2,$0
div $2,22
mov $0,$2
sub $0,1
|
04 Fades/4 Create fade in.applescript | streth11/Qlab-Scripts | 0 | 2253 | <filename>04 Fades/4 Create fade in.applescript
-- @description Create fade in
-- @author <NAME>
-- @link bensmithsound.uk
-- @source <NAME> (adapted)
-- @version 1.1
-- @testedmacos 10.13.6
-- @testedqlab 4.6.9
-- @about Create a fade in for the selected audio/group cue
-- @separateprocess FALSE
-- @changelog
-- v1.1 + if no cue name, script uses file name
-- v1.0 + init
tell front workspace
set originalCue to last item of (selected as list)
-- Create fade in for an audio cue
if q type of originalCue is "Audio" then
set originalCueLevel to originalCue getLevel row 0 column 0
originalCue setLevel row 0 column 0 db -120
set originalPreWait to pre wait of originalCue
make type "Fade"
set newCue to last item of (selected as list)
set cue target of newCue to originalCue
set pre wait of newCue to originalPreWait
newCue setLevel row 0 column 0 db originalCueLevel
if q name of originalCue is not "" then
set q name of newCue to "Fade in: " & q name of originalCue
else
set originalFile to file target of originalCue
tell application "System Events"
set originalName to name of originalFile
end tell
set q name of newCue to "Fade in: " & originalName
end if
-- Create fade in for each audio cue in a selected group
else if q type of originalCue is "Group" then
set originalCueName to q name of originalCue
set cuesToFade to (cues in originalCue)
make type "Group"
set fadeGroup to last item of (selected as list)
set fadeGroupID to uniqueID of fadeGroup
set q name of fadeGroup to "Fade in: " & originalCueName
repeat with eachCue in cuesToFade
if q type of eachCue is "Audio" then
set eachCueLevel to eachCue getLevel row 0 column 0
eachCue setLevel row 0 column 0 db -120
set eachPreWait to pre wait of eachCue
make type "Fade"
set newCue to last item of (selected as list)
set cue target of newCue to eachCue
set pre wait of newCue to eachPreWait
newCue setLevel row 0 column 0 db eachCueLevel
if q name of eachCue is not "" then
set q name of newCue to "Fade in: " & q name of eachCue
else
set eachFile to file target of eachCue
tell application "System Events"
set eachName to name of eachFile
end tell
set q name of newCue to "Fade in: " & eachName
end if
set newCueID to uniqueID of newCue
move cue id newCueID of parent of newCue to end of fadeGroup
end if
end repeat
end if
end tell |
libsrc/strings/strpbrk.asm | grancier/z180 | 8 | 93529 | <reponame>grancier/z180
; CALLER linkage for function pointers
SECTION code_clib
PUBLIC strpbrk
PUBLIC _strpbrk
EXTERN strpbrk_callee
EXTERN ASMDISP_STRPBRK_CALLEE
.strpbrk
._strpbrk
pop bc
pop de
pop hl
push hl
push de
push bc
jp strpbrk_callee + ASMDISP_STRPBRK_CALLEE
|
compiler/template/parser/ImportLexer.g4 | jinge-design/jinge | 0 | 4283 | lexer grammar ImportLexer;
IMPORT: 'import';
SPACE: [ \t\r\n]+ -> channel(HIDDEN);
FROM: 'from';
AS: 'as';
LP: '{';
RP: '}';
COMMA: ',';
ID: CHAR+;
SOURCE: DOUBLE_QUOTE_STRING | SINGLE_QUOTE_STRING;
COMMENT: (INLINE_COMMENT | BLOCK_COMMENT) -> skip;
OTHER: . -> skip;
fragment CHAR : [a-zA-Z_$];
fragment INLINE_COMMENT: '//' ~[\n]*;
fragment BLOCK_COMMENT: '/*' .*? '*/';
fragment DOUBLE_QUOTE_STRING: '"' ~["]* '"';
fragment SINGLE_QUOTE_STRING: '\'' ~[']* '\''; |
P6/data_P6_2/cal_R_test2.asm | alxzzhou/BUAA_CO_2020 | 1 | 164295 | <reponame>alxzzhou/BUAA_CO_2020
lui $1,62129
ori $1,$1,58836
lui $2,61412
ori $2,$2,52283
lui $3,34461
ori $3,$3,64064
lui $4,61281
ori $4,$4,9887
lui $5,47666
ori $5,$5,19857
lui $6,24074
ori $6,$6,34799
mthi $1
mtlo $2
sec0:
nop
nop
nop
slt $5,$6,$2
sec1:
nop
nop
xor $6,$1,$5
slt $3,$6,$2
sec2:
nop
nop
sltiu $6,$4,-31478
slt $3,$6,$2
sec3:
nop
nop
mfhi $6
slt $4,$6,$2
sec4:
nop
nop
lb $6,6($0)
slt $1,$6,$2
sec5:
nop
and $6,$2,$3
nop
slt $3,$6,$2
sec6:
nop
xor $6,$3,$6
sltu $6,$2,$6
slt $2,$6,$2
sec7:
nop
xor $6,$1,$3
andi $6,$4,8873
slt $6,$6,$2
sec8:
nop
nor $6,$5,$2
mflo $6
slt $1,$6,$2
sec9:
nop
slt $6,$1,$2
lh $6,4($0)
slt $1,$6,$2
sec10:
nop
andi $6,$1,51006
nop
slt $6,$6,$2
sec11:
nop
addiu $6,$5,12602
nor $6,$5,$4
slt $3,$6,$2
sec12:
nop
ori $6,$3,45408
sltiu $6,$5,-7104
slt $3,$6,$2
sec13:
nop
ori $6,$2,62136
mfhi $6
slt $3,$6,$2
sec14:
nop
slti $6,$1,32667
lhu $6,2($0)
slt $5,$6,$2
sec15:
nop
mfhi $6
nop
slt $4,$6,$2
sec16:
nop
mfhi $6
and $6,$6,$3
slt $2,$6,$2
sec17:
nop
mflo $6
sltiu $6,$5,-5396
slt $3,$6,$2
sec18:
nop
mfhi $6
mfhi $6
slt $0,$6,$2
sec19:
nop
mfhi $6
lh $6,0($0)
slt $5,$6,$2
sec20:
nop
lw $6,8($0)
nop
slt $2,$6,$2
sec21:
nop
lhu $6,12($0)
xor $6,$2,$5
slt $1,$6,$2
sec22:
nop
lhu $6,10($0)
xori $6,$6,45323
slt $0,$6,$2
sec23:
nop
lbu $6,5($0)
mflo $6
slt $3,$6,$2
sec24:
nop
lh $6,10($0)
lb $6,1($0)
slt $3,$6,$2
sec25:
or $6,$4,$3
nop
nop
slt $3,$6,$2
sec26:
nor $6,$3,$6
nop
addu $6,$3,$1
slt $3,$6,$2
sec27:
xor $6,$2,$5
nop
addiu $6,$6,-5634
slt $1,$6,$2
sec28:
slt $6,$3,$4
nop
mflo $6
slt $2,$6,$2
sec29:
and $6,$3,$5
nop
lb $6,5($0)
slt $4,$6,$2
sec30:
slt $6,$6,$3
or $6,$3,$1
nop
slt $1,$6,$2
sec31:
xor $6,$4,$2
slt $6,$5,$6
xor $6,$5,$5
slt $2,$6,$2
sec32:
subu $6,$2,$1
slt $6,$1,$3
xori $6,$4,52659
slt $4,$6,$2
sec33:
nor $6,$4,$2
xor $6,$1,$4
mflo $6
slt $2,$6,$2
sec34:
slt $6,$3,$5
slt $6,$4,$3
lh $6,14($0)
slt $1,$6,$2
sec35:
and $6,$2,$4
slti $6,$2,18776
nop
slt $3,$6,$2
sec36:
or $6,$3,$2
xori $6,$3,37961
sltu $6,$2,$4
slt $4,$6,$2
sec37:
or $6,$3,$1
sltiu $6,$2,17173
lui $6,35693
slt $4,$6,$2
sec38:
xor $6,$3,$2
ori $6,$5,44375
mflo $6
slt $3,$6,$2
sec39:
addu $6,$6,$3
ori $6,$4,29695
lw $6,12($0)
slt $5,$6,$2
sec40:
subu $6,$5,$0
mflo $6
nop
slt $3,$6,$2
sec41:
and $6,$1,$3
mfhi $6
addu $6,$3,$4
slt $5,$6,$2
sec42:
or $6,$2,$4
mfhi $6
xori $6,$3,12073
slt $3,$6,$2
sec43:
xor $6,$3,$3
mfhi $6
mfhi $6
slt $3,$6,$2
sec44:
or $6,$6,$1
mfhi $6
lb $6,0($0)
slt $0,$6,$2
sec45:
nor $6,$3,$0
lb $6,12($0)
nop
slt $4,$6,$2
sec46:
or $6,$0,$2
lb $6,15($0)
nor $6,$4,$2
slt $4,$6,$2
sec47:
sltu $6,$5,$3
lhu $6,14($0)
andi $6,$1,18619
slt $1,$6,$2
sec48:
xor $6,$3,$1
lw $6,12($0)
mfhi $6
slt $1,$6,$2
sec49:
and $6,$4,$3
lw $6,0($0)
lw $6,4($0)
slt $1,$6,$2
sec50:
ori $6,$5,1389
nop
nop
slt $3,$6,$2
sec51:
xori $6,$0,19309
nop
sltu $6,$5,$1
slt $0,$6,$2
sec52:
andi $6,$3,29239
nop
ori $6,$4,36515
slt $4,$6,$2
sec53:
ori $6,$1,48524
nop
mflo $6
slt $1,$6,$2
sec54:
lui $6,48307
nop
lw $6,4($0)
slt $3,$6,$2
sec55:
ori $6,$0,24462
subu $6,$6,$5
nop
slt $1,$6,$2
sec56:
andi $6,$3,1957
addu $6,$5,$4
addu $6,$6,$2
slt $2,$6,$2
sec57:
sltiu $6,$4,-24873
slt $6,$3,$6
xori $6,$5,6460
slt $4,$6,$2
sec58:
addiu $6,$5,9541
subu $6,$5,$3
mfhi $6
slt $4,$6,$2
sec59:
lui $6,12022
xor $6,$1,$4
lb $6,15($0)
slt $4,$6,$2
sec60:
lui $6,25117
xori $6,$4,6205
nop
slt $2,$6,$2
sec61:
ori $6,$5,34068
andi $6,$2,6218
nor $6,$1,$3
slt $6,$6,$2
sec62:
slti $6,$2,-11556
lui $6,25341
lui $6,39939
slt $4,$6,$2
sec63:
xori $6,$4,27481
xori $6,$3,56341
mflo $6
slt $3,$6,$2
sec64:
slti $6,$4,-8789
sltiu $6,$5,317
lhu $6,4($0)
slt $4,$6,$2
sec65:
ori $6,$4,19167
mflo $6
nop
slt $4,$6,$2
sec66:
lui $6,39355
mflo $6
sltu $6,$3,$5
slt $6,$6,$2
sec67:
lui $6,43243
mflo $6
lui $6,46584
slt $5,$6,$2
sec68:
lui $6,32310
mfhi $6
mflo $6
slt $2,$6,$2
sec69:
xori $6,$2,55173
mfhi $6
lh $6,6($0)
slt $0,$6,$2
sec70:
andi $6,$5,12477
lhu $6,4($0)
nop
slt $2,$6,$2
sec71:
slti $6,$3,452
lhu $6,8($0)
subu $6,$4,$5
slt $3,$6,$2
sec72:
xori $6,$3,29262
lw $6,16($0)
xori $6,$2,51671
slt $0,$6,$2
sec73:
xori $6,$4,17047
lbu $6,3($0)
mfhi $6
slt $3,$6,$2
sec74:
lui $6,61797
lbu $6,12($0)
lhu $6,4($0)
slt $4,$6,$2
sec75:
mfhi $6
nop
nop
slt $4,$6,$2
sec76:
mflo $6
nop
slt $6,$0,$3
slt $4,$6,$2
sec77:
mflo $6
nop
andi $6,$1,56899
slt $0,$6,$2
sec78:
mfhi $6
nop
mflo $6
slt $1,$6,$2
sec79:
mflo $6
nop
lbu $6,6($0)
slt $2,$6,$2
sec80:
mflo $6
subu $6,$3,$2
nop
slt $6,$6,$2
sec81:
mflo $6
sltu $6,$6,$5
addu $6,$1,$5
slt $3,$6,$2
sec82:
mflo $6
slt $6,$3,$1
slti $6,$2,-32464
slt $3,$6,$2
sec83:
mflo $6
and $6,$2,$0
mfhi $6
slt $5,$6,$2
sec84:
mfhi $6
or $6,$1,$3
lh $6,0($0)
slt $4,$6,$2
sec85:
mflo $6
addiu $6,$4,8191
nop
slt $2,$6,$2
sec86:
mflo $6
ori $6,$0,26850
nor $6,$1,$3
slt $3,$6,$2
sec87:
mflo $6
ori $6,$3,24171
addiu $6,$3,14858
slt $0,$6,$2
sec88:
mflo $6
addiu $6,$3,14175
mfhi $6
slt $5,$6,$2
sec89:
mfhi $6
ori $6,$2,52485
lbu $6,16($0)
slt $3,$6,$2
sec90:
mfhi $6
mfhi $6
nop
slt $2,$6,$2
sec91:
mflo $6
mflo $6
xor $6,$4,$3
slt $4,$6,$2
sec92:
mfhi $6
mfhi $6
sltiu $6,$3,17026
slt $4,$6,$2
sec93:
mfhi $6
mflo $6
mflo $6
slt $1,$6,$2
sec94:
mfhi $6
mflo $6
lh $6,4($0)
slt $3,$6,$2
sec95:
mflo $6
lw $6,8($0)
nop
slt $5,$6,$2
sec96:
mfhi $6
lh $6,16($0)
sltu $6,$3,$4
slt $3,$6,$2
sec97:
mflo $6
lbu $6,3($0)
ori $6,$2,57834
slt $2,$6,$2
sec98:
mflo $6
lhu $6,8($0)
mflo $6
slt $2,$6,$2
sec99:
mflo $6
lh $6,2($0)
lhu $6,14($0)
slt $4,$6,$2
sec100:
lh $6,16($0)
nop
nop
slt $2,$6,$2
sec101:
lbu $6,15($0)
nop
addu $6,$2,$3
slt $2,$6,$2
sec102:
lbu $6,12($0)
nop
addiu $6,$4,5170
slt $5,$6,$2
sec103:
lw $6,0($0)
nop
mfhi $6
slt $0,$6,$2
sec104:
lb $6,15($0)
nop
lb $6,0($0)
slt $1,$6,$2
sec105:
lbu $6,2($0)
xor $6,$4,$3
nop
slt $6,$6,$2
sec106:
lhu $6,16($0)
and $6,$4,$5
addu $6,$5,$6
slt $3,$6,$2
sec107:
lbu $6,7($0)
xor $6,$3,$6
addiu $6,$2,-21688
slt $1,$6,$2
sec108:
lb $6,6($0)
addu $6,$2,$2
mfhi $6
slt $1,$6,$2
sec109:
lbu $6,15($0)
or $6,$5,$4
lhu $6,2($0)
slt $0,$6,$2
sec110:
lw $6,0($0)
slti $6,$6,11426
nop
slt $1,$6,$2
sec111:
lbu $6,11($0)
sltiu $6,$4,-2295
addu $6,$0,$5
slt $3,$6,$2
sec112:
lw $6,0($0)
lui $6,47235
lui $6,50260
slt $4,$6,$2
sec113:
lh $6,0($0)
slti $6,$4,826
mfhi $6
slt $1,$6,$2
sec114:
lhu $6,12($0)
lui $6,35514
lh $6,10($0)
slt $3,$6,$2
sec115:
lh $6,6($0)
mfhi $6
nop
slt $0,$6,$2
sec116:
lh $6,10($0)
mfhi $6
nor $6,$3,$0
slt $2,$6,$2
sec117:
lhu $6,6($0)
mfhi $6
andi $6,$3,52555
slt $2,$6,$2
sec118:
lh $6,14($0)
mflo $6
mflo $6
slt $2,$6,$2
sec119:
lbu $6,13($0)
mflo $6
lhu $6,2($0)
slt $3,$6,$2
sec120:
lhu $6,14($0)
lbu $6,4($0)
nop
slt $6,$6,$2
sec121:
lhu $6,16($0)
lb $6,15($0)
xor $6,$5,$4
slt $5,$6,$2
sec122:
lw $6,4($0)
lh $6,12($0)
slti $6,$3,-3407
slt $1,$6,$2
sec123:
lbu $6,3($0)
lhu $6,4($0)
mflo $6
slt $3,$6,$2
sec124:
lhu $6,12($0)
lb $6,16($0)
lb $6,16($0)
slt $5,$6,$2
|
3-mid/opengl/source/lean/model/opengl-model-capsule-lit_colored_textured.ads | charlie5/lace | 20 | 9580 | <reponame>charlie5/lace
with
openGL.Geometry;
package openGL.Model.capsule.lit_colored_textured
--
-- Models a lit, colored and textured capsule.
--
is
type Item is new Model.capsule.item with
record
Radius : Real;
Height : Real;
Color : lucid_Color;
Image : asset_Name := null_Asset;
end record;
type View is access all Item'Class;
---------
--- Forge
--
function new_Capsule (Radius : in Real;
Height : in Real;
Color : in lucid_Color;
Image : in asset_Name := null_Asset) return View;
--------------
--- Attributes
--
overriding
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
end openGL.Model.capsule.lit_colored_textured;
|
grammar/Ctf.g4 | jim-wordelman-msft/Microsoft-Performance-Tools-Linux-Android | 179 | 5387 | // Install java runtime
// Download Antlr4 jar from http://antlr.org
// run: java -jar antlr-4.7.2-complete.jar -Dlanguage=CSharp Ctf.g4
// this is almost a direct port from the BabelTrace reference implementation which
// currently uses flex/bison.
// the Antlr implementation doesn't use the ID_TYPE token, as that would require
// interaction between the lexer/parser, which isn't possible. rather, IDENTIFIER
// is used in place of ID_TYPE, and the tree walker may check for errors.
// finally, if you're reading this and know anything about Antlr or grammars in general,
// and something seems wrong... it probably is. I'm throwing this together just to try
// and get it working, without any deep understanding of what I'm doing.
// NOTE
// For CSharp, this will generate an interface ICtfListener, but in a file named CtfListener.cs.
// Be sure to rename this to ICtfListener.cs before checking in.
grammar Ctf;
import Lexer;
file:
declaration+
;
keywords:
// VOID
// | CHAR
// | SHORT
// | INT
// | LONG
// | FLOAT
// | DOUBLE
// | SIGNED
// | UNSIGNED
// | BOOL
// | COMPLEX
// | IMAGINARY
FLOATING_POINT
| INTEGER
| STRING
| ENUM
| VARIANT
| STRUCT
// | CONST
| TYPEDEF
| EVENT
| STREAM
| ENV
| TRACE
| CLOCK
| CALLSITE
| ALIGN
;
declaration:
declaration_specifiers ';'
| event_declaration
| stream_declaration
| env_declaration
| trace_declaration
| clock_declaration
| callsite_declaration
| typedef_declaration ';'
| typealias_declaration ';'
;
// typealias can be assigned to something like this:
// typealias : integer { signed=false; size=32; } const unsigned int32;
// the text from this rule should include all of "const unsigned int32", which is
// exact text that will need to be used in other locations
declared_type:
alias_declaration_specifiers
| alias_abstract_declarator_list
;
typealias_declaration:
TYPEALIAS
declaration_specifiers
abstract_declarator_list
':='
declared_type
;
typedef_declaration:
// declaration_specifiers
// TYPEDEF
// declaration_specifiers
// type_declarator_list ';' #TypeDefDeclarationWithSpecifiersBeforeAndAfter
TYPEDEF
declaration_specifiers
type_declarator_list #TypeDefDeclaration
// | declaration_specifiers
// TYPEDEF
// type_declarator_list ';' #TypeDefDeclarationWithSpecifiersBefore
;
declaration_specifiers:
// CONST #DeclarationSpecifierPrefixConst
type_specifier #DeclarationSpecifierTypeSpecifier
// | declaration_specifiers CONST #DeclarationSpecifierSuffixConst
// | declaration_specifiers type_specifier #DeclarationSpecifierCompound
;
type_specifier:
// VOID #IgnoredTypeSpecifier
// | CHAR #IgnoredTypeSpecifier
// | SHORT #IgnoredTypeSpecifier
// | INT #IgnoredTypeSpecifier
// | LONG #IgnoredTypeSpecifier
// | FLOAT #IgnoredTypeSpecifier
// | DOUBLE #IgnoredTypeSpecifier
// | SIGNED #IgnoredTypeSpecifier
// | UNSIGNED #IgnoredTypeSpecifier
// | BOOL #IgnoredTypeSpecifier
// | COMPLEX #IgnoredTypeSpecifier
// | IMAGINARY #IgnoredTypeSpecifier
FLOATING_POINT '{' '}' #TypeSpecifierFloatingPoint
| FLOATING_POINT
'{' ctf_expression_list '}' #TypeSpecifierFloatingPointWithFields
| INTEGER '{' '}' #TypeSpecifierEmptyInteger
| INTEGER
'{' ctf_expression_list '}' #TypeSpecifierInteger
| STRING #TypeSpecifierSimpleString
| STRING '{' '}' #TypeSpecifierEmptyString
| STRING
'{' ctf_expression_list '}' #TypeSpecifierString
| ENUM enum_type_specifier #TypeSpecifierEnum
| VARIANT variant_type_specifier #TypeSpecifierVariant
| STRUCT struct_type_specifier #TypeSpecifierStruct
// Note that we allow multiple IDENTIFIERs here. That is to handle type aliases
// like: typealias integer { signed=false; size=32 } const unsigned int;
// where the actual type then is 'const unsigned int'
| (IDENTIFIER)+ #TypeSpecifierIdentifier
;
event_declaration:
event_declaration_begin event_declaration_end
| event_declaration_begin ctf_expression_list event_declaration_end
;
stream_declaration:
stream_declaration_begin stream_declaration_end
| stream_declaration_begin stream_assignment_expression_list stream_declaration_end
;
env_declaration:
env_declaration_begin env_declaration_end
| env_declaration_begin ctf_expression_list env_declaration_end
;
trace_declaration:
trace_declaration_begin trace_declaration_end
| trace_declaration_begin trace_assignment_expression_list trace_declaration_end
;
clock_declaration:
CLOCK clock_declaration_begin clock_declaration_end
| CLOCK clock_declaration_begin ctf_expression_list clock_declaration_end
;
callsite_declaration:
CALLSITE callsite_declaration_begin callsite_declaration_end
| CALLSITE callsite_declaration_begin ctf_expression_list callsite_declaration_end
;
type_declarator_list:
type_declarator ( ',' type_declarator )*
;
abstract_declarator_list:
abstract_declarator ( ',' abstract_declarator )*
;
alias_declaration_specifiers:
// CONST
type_specifier
// | alias_declaration_specifiers CONST
// | alias_declaration_specifiers type_specifier
// | alias_declaration_specifiers IDENTIFIER
;
alias_abstract_declarator_list:
alias_abstract_declarator (',' alias_abstract_declarator)*
;
dynamic_scope_type_assignment:
IDENTIFIER '.' IDENTIFIER ':=' declaration_specifiers ';'
;
trace_assignment_expression_list:
// allow PACKET.HEADER in the trace assignment expressions. this is the only time the 'trace'
// keyword isn't needed first, because it's already within the context of the trace
// there is no PACKET keyword, so we have to use IDENTIFIER here, then just check post parsing
(ctf_expression | dynamic_scope_type_assignment)+
;
stream_assignment_expression_list:
// allow PACKET.CONTEXT in the stream assignment expressions. this is the only time the 'stream'
// keyword isn't needed first, because it's already within the context of the stream
// there is no PACKET keyword, so we have to use IDENTIFIER here, then just check post parsing
(ctf_expression | dynamic_scope_type_assignment)+
;
ctf_expression:
(ctf_assignment_expression | typedef_declaration | typealias_declaration) ';'
;
ctf_expression_list:
ctf_expression+
;
// Enums that do not specificy a base class use 'int' by default, which must
// be specified before the enum. See specification 1.8.2, section 4.1.8.
//
enum_type_specifier:
'{' enumerator_list '}' #AnonymousEnumTypeDefaultBase
| '{' enumerator_list ',' '}' #AnonymousEnumTypeDefaultBase
| ':' enum_integer_declaration_specifiers
'{' enumerator_list '}' #AnonymousEnumTypeSpecifiedBase
| ':' enum_integer_declaration_specifiers
'{' enumerator_list ',' '}' #AnonymousEnumTypeSpecifiedBase
| IDENTIFIER '{' enumerator_list '}' #NamedEnumTypeDefaultBase
| IDENTIFIER '{' enumerator_list ',' '}' #NamedEnumTypeDefaultBase
| IDENTIFIER ':'
enum_integer_declaration_specifiers
'{' enumerator_list '}' #NamedEnumTypeSpecifiedBase
| IDENTIFIER ':'
enum_integer_declaration_specifiers
'{' enumerator_list ',' '}' #NamedEnumTypeSpecifiedBase
// Not sure how this is used, commenting out for now.
// | IDENTIFIER
;
variant_type_specifier:
variant_declaration_begin
struct_or_variant_declaration_list
variant_declaration_end #AnonymousVariantNoTag
| '<' IDENTIFIER '>'
variant_declaration_begin
struct_or_variant_declaration_list
variant_declaration_end #AnonymousVariant
| IDENTIFIER
variant_declaration_begin
struct_or_variant_declaration_list
variant_declaration_end #NamedVariantNoTag
| IDENTIFIER
'<' IDENTIFIER '>'
variant_declaration_begin
struct_or_variant_declaration_list
variant_declaration_end #NamedVariant
| IDENTIFIER
'<' IDENTIFIER '>' #NamedVariantNoBody
;
struct_type_specifier:
struct_declaration_begin
struct_or_variant_declaration_list
struct_declaration_end #AnonymousStruct
| IDENTIFIER
struct_declaration_begin
struct_or_variant_declaration_list
struct_declaration_end #NamedStruct
| IDENTIFIER #StructAsType
| struct_declaration_begin
struct_or_variant_declaration_list
struct_declaration_end
ALIGN
'(' unary_expression ')' #AnonymousAlignedStruct
| IDENTIFIER
struct_declaration_begin
struct_or_variant_declaration_list
struct_declaration_end
ALIGN
'(' unary_expression ')' #NamedAlignedStruct
;
event_declaration_begin:
EVENT '{'
;
event_declaration_end:
'}' ';'
;
stream_declaration_begin:
STREAM '{'
;
stream_declaration_end:
'}' ';'
;
env_declaration_begin:
ENV '{'
;
env_declaration_end:
'}' ';'
;
trace_declaration_begin:
TRACE '{'
;
trace_declaration_end:
'}' ';'
;
clock_declaration_begin:
'{'
;
clock_declaration_end:
'}' ';'
;
callsite_declaration_begin:
'{'
;
callsite_declaration_end:
'}' ';'
;
type_declarator:
// pointer? direct_type_declarator
(IDENTIFIER | ('(' type_declarator ')'))? ('[' unary_expression ']')*
;
// direct_type_declarator:
// (IDENTIFIER | ('(' type_declarator ')'))? ('[' unary_expression ']')*
// ;
abstract_declarator:
// pointer? direct_abstract_declarator
( IDENTIFIER | '(' abstract_declarator ')')? ('[' unary_expression? ']')*
;
// direct_abstract_declarator:
// ( IDENTIFIER | '(' abstract_declarator ')')? ('[' unary_expression? ']')*
// ;
alias_abstract_declarator:
// pointer? ('(' alias_abstract_declarator ')')? ('[' unary_expression? ']')*
('(' alias_abstract_declarator ')')? ('[' unary_expression? ']')*
;
// CTF assignment expressions are used within CTF objects:
// these include: trace, stream, event, integer, clock, env, callsite
// This is similar to a struct, but the "fields" may be keywords.
//
ctf_assignment_expression:
IDENTIFIER '=' unary_expression #CtfIdentifierAssignment
| dynamic_reference '=' unary_expression #CtfDynamicScopeAssignment
| keywords '=' unary_expression #CtfKeywordAssignment
| unary_expression ':=' declaration_specifiers #CtfTypeAssignment
;
enumerator_list:
enumerator (',' enumerator)*
;
enum_integer_declaration_specifiers:
// CONST #EnumIntegerDeclarationConst
enum_integer_type_specifier #EnumIntegerDeclarationTypeSpecifier
// | enum_integer_declaration_specifiers CONST #EnumIntegerDeclarationsAndConst
| enum_integer_declaration_specifiers
enum_integer_type_specifier #EnumIntegerDeclarationsAndTypeSpecifier
;
variant_declaration_begin:
'{'
;
variant_declaration_end:
'}'
;
struct_or_variant_declaration_list:
struct_or_variant_declaration*
;
struct_declaration_begin:
'{'
;
struct_declaration_end:
'}'
;
unary_expression:
postfix_expression #PostfixExpressionUnaryExpression
| '+' unary_expression #PositiveUnaryExpression
| '-' unary_expression #NegativeUnaryExpression
;
//pointer:
// '*'
// | '*' pointer
// | '*' type_qualifier_list pointer
// ;
enumerator:
IDENTIFIER #EnumIdentifierValue
| keywords #EnumKeywordValue
| STRING_LITERAL #EnumStringLiteralValue
| IDENTIFIER '='
enumerator_mapping #EnumIdentifierAssignedValue
| keywords '='
enumerator_mapping #EnumKeywordAssignedValue
| STRING_LITERAL '='
enumerator_mapping #EnumStringLiteralAssignedValue
;
enum_integer_type_specifier:
// I don't believe enumerations may use anything other than integer, i've commented
// out these other options for now to simplify.
// CHAR
// | SHORT
// | INT
// | LONG
// | SIGNED
// | UNSIGNED
// | BOOL
IDENTIFIER #EnumIntegerSpecifierFromType
| INTEGER '{' '}' #EnumIntegerSpecifierWithDefaults
| INTEGER
'{' ctf_expression_list '}' #EnumIntegerSpecifier
;
struct_or_variant_declaration:
declaration_specifiers
struct_or_variant_declarator_list ';' #StructOrVariantDeclaration
// | declaration_specifiers
// TYPEDEF
// declaration_specifiers
// type_declarator_list ';' #StructOrVariantTypedef1
| typedef_declaration ';' #StructOrVariantTypedef
// | declaration_specifiers
// TYPEDEF
// type_declarator_list ';' #StructOrVariantTypedef3
| typealias_declaration ';' #StructOrVariantTypealias
;
integerLiteral:
DECIMAL_LITERAL #DecimalLiteral
| HEXADECIMAL_LITERAL #HexadecimalLiteral
| OCTAL_LITERAL #OctalLiteral
;
postfix_expression:
integerLiteral #PostfixExpressionIntegerLiteral
| STRING_LITERAL #PostfixExpressionStringLiteral
| CHARACTER_LITERAL #PostfixExpressionCharacterLiteral
| postfix_expression_complex #PostfixExpressionComplex
;
postfix_expression_complex:
IDENTIFIER #PostfixExpressionIdentifier
| dynamic_reference #PostfixExpressionDynamicReference
| '(' unary_expression ')' #PostfixExpressionParentheseUnaryExpression
| postfix_expression_complex '[' unary_expression ']' #PostfixExpressionPostfixWithBrackets
;
// According to Spec 1.82 section 7.3.2, this is a superset of dynamic scope prefixes:
dynamic_reference:
EVENT '.' IDENTIFIER ('.' IDENTIFIER)* #EventDynamicReference
| TRACE '.' IDENTIFIER ('.' IDENTIFIER)* #TraceDynamicReference
| STREAM '.' EVENT '.' IDENTIFIER ('.' IDENTIFIER)* #StreamDynamicReference
| ENV '.' IDENTIFIER ('.' IDENTIFIER)* #EnvDynamicReference
| CLOCK '.' IDENTIFIER ('.' IDENTIFIER)* #ClockDynamicReference
;
// type_qualifier_list:
// CONST
// | type_qualifier_list CONST
// ;
// this is only used for an enumerator, which must match an integer type
enumerator_mapping:
unary_expression '...' unary_expression #EnumeratorMappingRange
| unary_expression #EnumeratorMappingSimple
;
struct_or_variant_declarator_list:
struct_or_variant_declarator (',' struct_or_variant_declarator)*
;
struct_or_variant_declarator:
declarator (':' unary_expression)?
// I'm not sure where this would be used. Commenting out until we need it.
// | ':' unary_expression
;
// I've simplified declarator until for now.
declarator:
IDENTIFIER ('[' unary_expression ']')?
;
// I'm commenting out pointer support until we know we need it.
// I'm not sure what '(' declarator ')' is used for under direct_declarator. Commenting out until we need it.
// declarator:
// pointer? direct_declarator
// ;
// direct_declarator:
// IDENTIFIER #DirectDeclaratorIdentifier
// | '(' declarator ')' #ParenthesesAroundDeclarator
// | direct_declarator
// '[' unary_expression ']' #DirectDeclaratorWithIndexer
// ;
|
alloy4fun_models/trashltl/models/7/nGEja83thZ3dYPz5n.als | Kaixi26/org.alloytools.alloy | 0 | 3646 | <filename>alloy4fun_models/trashltl/models/7/nGEja83thZ3dYPz5n.als<gh_stars>0
open main
pred idnGEja83thZ3dYPz5n_prop8 {
always eventually all f:File | f in link.f implies link.f in Trash
}
pred __repair { idnGEja83thZ3dYPz5n_prop8 }
check __repair { idnGEja83thZ3dYPz5n_prop8 <=> prop8o } |
src/base/log/util-log-appenders-factories.adb | RREE/ada-util | 60 | 7528 | <reponame>RREE/ada-util
-----------------------------------------------------------------------
-- util-log-appenders -- Log appenders
-- Copyright (C) 2001 - 2019, 2021 <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.
-----------------------------------------------------------------------
package body Util.Log.Appenders.Factories is
Factory : aliased Appender_Factory (Length => Name'Length);
procedure Register is
begin
Register (Factory'Access, Name, Create);
end Register;
end Util.Log.Appenders.Factories;
|
source/streams/a-sequio.ads | ytomino/drake | 33 | 424 | <filename>source/streams/a-sequio.ads
pragma License (Unrestricted);
with Ada.IO_Exceptions;
with Ada.IO_Modes;
private with Ada.Streams; -- [gcc-5] can not find it by below "with Stream_IO"
private with Ada.Streams.Stream_IO;
generic
type Element_Type (<>) is private;
package Ada.Sequential_IO is
type File_Type is limited private;
-- Similar to Text_IO in AI12-0054-2:
-- subtype Open_File_Type is File_Type
-- with
-- Dynamic_Predicate => Is_Open (Open_File_Type),
-- Predicate_Failure => raise Status_Error with "File not open";
-- subtype Input_File_Type is Open_File_Type
-- with
-- Dynamic_Predicate => Mode (Input_File_Type) = In_File,
-- Predicate_Failure =>
-- raise Mode_Error with
-- "Cannot read file: " & Name (Input_File_Type);
-- subtype Output_File_Type is Open_File_Type
-- with
-- Dynamic_Predicate => Mode (Output_File_Type) /= In_File,
-- Predicate_Failure =>
-- raise Mode_Error with
-- "Cannot write file: " & Name (Output_File_Type);
-- type File_Mode is (In_File, Out_File, Append_File);
type File_Mode is new IO_Modes.File_Mode; -- for conversion
-- File management
procedure Create (
File : in out File_Type;
Mode : File_Mode := Out_File;
Name : String := "";
Form : String := "");
procedure Open (
File : in out File_Type;
Mode : File_Mode;
Name : String;
Form : String := "");
procedure Close (File : in out File_Type);
procedure Delete (File : in out File_Type);
procedure Reset (File : in out File_Type; Mode : File_Mode);
procedure Reset (File : in out File_Type);
function Mode (
File : File_Type) -- Open_File_Type
return File_Mode;
function Name (
File : File_Type) -- Open_File_Type
return String;
function Form (
File : File_Type) -- Open_File_Type
return String;
pragma Inline (Mode);
pragma Inline (Name);
pragma Inline (Form);
function Is_Open (File : File_Type) return Boolean;
pragma Inline (Is_Open);
procedure Flush (
File : File_Type); -- Output_File_Type
-- AI12-0130-1
-- Input and output operations
procedure Read (
File : File_Type; -- Input_File_Type
Item : out Element_Type);
procedure Write (
File : File_Type; -- Output_File_Type
Item : Element_Type);
function End_Of_File (
File : File_Type) -- Input_File_Type
return Boolean;
pragma Inline (End_Of_File);
-- Exceptions
Status_Error : exception
renames IO_Exceptions.Status_Error;
Mode_Error : exception
renames IO_Exceptions.Mode_Error;
Name_Error : exception
renames IO_Exceptions.Name_Error;
Use_Error : exception
renames IO_Exceptions.Use_Error;
Device_Error : exception
renames IO_Exceptions.Device_Error;
End_Error : exception
renames IO_Exceptions.End_Error;
Data_Error : exception
renames IO_Exceptions.Data_Error;
private
type File_Type is new Streams.Stream_IO.File_Type;
end Ada.Sequential_IO;
|
programs/oeis/010/A010010.asm | karttu/loda | 1 | 88508 | ; A010010: a(0) = 1, a(n) = 20*n^2 + 2 for n>0.
; 1,22,82,182,322,502,722,982,1282,1622,2002,2422,2882,3382,3922,4502,5122,5782,6482,7222,8002,8822,9682,10582,11522,12502,13522,14582,15682,16822,18002,19222,20482,21782,23122,24502,25922,27382,28882,30422,32002,33622,35282,36982,38722,40502,42322,44182,46082,48022,50002,52022,54082,56182,58322,60502,62722,64982,67282,69622,72002,74422,76882,79382,81922,84502,87122,89782,92482,95222,98002,100822,103682,106582,109522,112502,115522,118582,121682,124822,128002,131222,134482,137782,141122,144502,147922,151382,154882,158422,162002,165622,169282,172982,176722,180502,184322,188182,192082,196022,200002,204022,208082,212182,216322,220502,224722,228982,233282,237622,242002,246422,250882,255382,259922,264502,269122,273782,278482,283222,288002,292822,297682,302582,307522,312502,317522,322582,327682,332822,338002,343222,348482,353782,359122,364502,369922,375382,380882,386422,392002,397622,403282,408982,414722,420502,426322,432182,438082,444022,450002,456022,462082,468182,474322,480502,486722,492982,499282,505622,512002,518422,524882,531382,537922,544502,551122,557782,564482,571222,578002,584822,591682,598582,605522,612502,619522,626582,633682,640822,648002,655222,662482,669782,677122,684502,691922,699382,706882,714422,722002,729622,737282,744982,752722,760502,768322,776182,784082,792022,800002,808022,816082,824182,832322,840502,848722,856982,865282,873622,882002,890422,898882,907382,915922,924502,933122,941782,950482,959222,968002,976822,985682,994582,1003522,1012502,1021522,1030582,1039682,1048822,1058002,1067222,1076482,1085782,1095122,1104502,1113922,1123382,1132882,1142422,1152002,1161622,1171282,1180982,1190722,1200502,1210322,1220182,1230082,1240022
pow $1,$0
gcd $1,2
mov $3,$0
mul $3,$0
mov $2,$3
mul $2,20
add $1,$2
|
src/rng-prism.asm | SzieberthAdam/gb-rngdemo | 1 | 21893 | <filename>src/rng-prism.asm<gh_stars>1-10
;* RNG-PRISM
;* Original code is licensed as public domain by Aaaaaa123456789/ax6 which also
;* applies to this file:
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;* "This code was originally found in Prism. Originally written on 2016-12-18.
;* updated on 2018-08-18 with a bug fix. Since I never bothered with a license
;* header, I'm hereby placing it in the public domain as of 2019-01-04."
;* [PB.PRISM]
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;* GB-RNG adaptation and comments Copyright (c) 2019 <NAME>
;* =============================================================================
;* ABSTRACT
;* =============================================================================
;* ATTENTION! As GB-RNG project is on hiatus, this code is copypasted here
;* unprocessed for completeness.
;* =============================================================================
;* CHANGES
;* =============================================================================
;* =============================================================================
;* INCLUDES
;* =============================================================================
INCLUDE "RNG.INC"
;* =============================================================================
;* INITIALIZATION
;* =============================================================================
SECTION "RNG", ROM0
rand_init::
ld hl, RNGSEED ; 3|3
ret ; 1|4
;* =============================================================================
;* RANDOM NUMBER GENERATOR
;* =============================================================================
rand::
; in: hl: pointer to 8-byte RNG state
; out: a: random value; other registers preserved
push bc
push de
push hl
call .advance_left_register
call .advance_right_register
inc hl
inc hl
inc hl
call .advance_selector_register
pop hl
push hl
rlca
rlca
ld c, a
and 3
ld e, a
ld d, 0
add hl, de
ld b, [hl]
pop hl
push hl
ld e, 5
add hl, de
ld a, c
ld c, [hl]
rlca
rlca
and 3
call .combine_register_values
pop hl
pop de
pop bc
ret
.advance_left_register
; in: hl: pointer to left register
; out: hl: pointer to RIGHT register
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld c, a
ld a, [hld]
ld b, a
or c
or d
or e
call z, .reseed_left_register
ld a, e
xor d
ld e, a
ld a, d
xor c
ld d, a
ld a, c
xor b
ld c, a
ld a, c
ld [hld], a
ld a, d
ld [hld], a
ld [hl], e
sla e
rl d
rl c
inc hl
ld a, [hl]
xor e
ld [hli], a
ld a, [hl]
xor d
ld [hli], a
ld a, [hl]
xor c
ld [hld], a
ld b, a
ld c, [hl]
sla c
rl b
sbc a
and 1
dec hl
xor [hl]
ld [hld], a
ld a, [hl]
xor b
ld [hli], a
inc hl
inc hl
inc hl
ret
.reseed_left_register
; in: hl: pointer to left register + 2
; out: hl preserved; bcde new seed
ld de, 5
push hl
add hl, de
call .advance_selector_register
ld b, a
call .advance_selector_register
ld c, a
call .advance_selector_register
ld d, a
call .advance_selector_register
ld e, a
pop hl
inc hl
ld a, b
ld [hld], a ;only b needs to be written back, since the rest will be handled by the main function
ret
.advance_right_register
; in: hl: pointer to right register
; out: hl preserved
ld a, [hli]
cp 210
jr c, .right_carry_OK
sub 210
.right_carry_OK
ld d, a
ld a, [hli]
ld e, a
ld c, [hl]
or c
or d
jr z, .right_register_needs_reseed
ld a, c
and e
inc a
jr nz, .right_register_OK
ld a, d
cp 209
jr nz, .right_register_OK
.right_register_needs_reseed
call .reseed_right_register
.right_register_OK
ld a, e
ld [hld], a
push hl
ld b, 0
ld h, b
ld l, d
ld a, 210
.loop
add hl, bc
dec a
jr nz, .loop
ld a, l
ld b, h
pop hl
ld [hld], a
ld [hl], b
ret
.reseed_right_register
; in: hl: pointer to right register + 2
; out: hl preserved, cde new seed
inc hl
call .advance_selector_register
ld c, a
call .advance_selector_register
ld d, a
call .advance_selector_register
ld e, a
dec hl
ret
.advance_selector_register
; in: hl: pointer to selector register
; out: all registers but a preserved; a = new selector
push bc
ld a, [hl]
ld b, 0
rra
rr b
rra
rr b
ld a, [hl]
swap a
rrca
and $f8
add a, b
add a, [hl]
add a, 29
ld [hl], a
pop bc
ret
.combine_register_values
and a
jr z, .add_registers
dec a
jr z, .xor_registers
dec a
jr z, .subtract_registers
ld a, c
sub b
ret
.subtract_registers
ld a, b
sub c
ret
.add_registers
ld a, b
add a, c
ret
.xor_registers
ld a, b
xor c
ret
;* =============================================================================
;* REMARKS
;* =============================================================================
;* =============================================================================
;* REFERENCES
;* =============================================================================
;* [PB.PRISM] Aaaaaa123456789/ax6: StableRandom's original gbz80 code
;* https://pastebin.com/KF8uk9B1
|
TitleScreen.asm | RichardTND/ShockRaid | 0 | 96438 | <reponame>RichardTND/ShockRaid<gh_stars>0
;#############################
;# Shock Raid #
;# #
;# by <NAME> #
;# #
;# (C)2021 The New Dimension #
;# For Reset Magazine #
;#############################
;Title screen code
Title
TitleScreen sei
lda #$34
sta $01
lda #<ScrollText ;Initialise scroll text
sta MessRead+1
lda #>ScrollText
sta MessRead+2
;Clear the entire screen
ldx #$00
.clearfullscreen
lda #$00
sta $0400,x
sta $0500,x
sta $0600,x
sta $06e8,x
inx
bne .clearfullscreen
;Kill all IRQs and set to $0001,$35 mode.
lda #$35
sta $01
ldx #$48
ldy #$ff
stx $fffe
sty $ffff
lda #$00
sta $d01a
sta $d019
sta $d020
sta $d021
sta $d017
sta $d01d
sta $d01b
sta TitleFlashColourPointer
sta TitleFlashColourDelay
sta GameIsPaused
sta XPos
lda #$81
sta $dc0d
sta $dd0d
lda #$00
sta $d011
lda #0
sta PageNo
sta PageTimer
sta PageTimer+1
lda MusicSprite
sta $07f8
lda SFXSprite
sta $07f9
;Setup blue star sprites for title screen
ldx #$00
.makestars
lda StarSprite
sta $07fa,x
lda #14
sta $d029,x
inx
cpx #6
bne .makestars
lda #$ff
sta $d015
sta $d01c
sta $d01b
lda #$0c
sta $d025
lda #$0b
sta $d026
lda #$0c
sta ObjPos
lda #$a0
sta ObjPos+2
lda #$c8
sta ObjPos+1
sta ObjPos+3
ldx #0
.clrrest lda StarPosTable,x
sta ObjPos+4,x
inx
cpx #$0c
bne .clrrest
sta $e1
sta FireButton
;Copy the logo video and colour data then place into
;the logo's video and colour RAM at BANK $01
ldx #$00
.paintlogo lda colram,x
sta colour,x
lda colram+$100,x
sta colour+$100,x
lda colram+$200,x
sta colour+$200,x
lda colram+$2e8,x
sta colour+$2e8,x
lda #$00
sta $0400,x
sta $0500,x
sta $0600,x
sta $06e8,x
inx
bne .paintlogo
;Fill out the text rows as black
ldx #$00
.blackout lda #$00
sta colour+(9*40),x
sta $0400+(9*40),x
sta colour+(12*40),x
sta colour+(13*40),x
sta colour+(14*40),x
sta colour+(15*40),x
sta colour+(16*40),x
sta colour+(17*40),x
sta colour+(18*40),x
sta colour+(19*40),x
sta colour+(20*40),x
lda laserscrollcharcolour,x
sta colour+(10*40),x
sta colour+(22*40),x
inx
cpx #$28
bne .blackout
;Display hi scores by default
jsr DisplayHiScores
;Setup IRQ interrupts for the title screen
ldx #<tirq1
ldy #>tirq1
stx $fffe
sty $ffff
ldx #<nmi
ldy #>nmi
stx $fffa
sty $fffb
lda #$00
sta $d012
lda #$7f
sta $dc0d
sta $dd0d
lda #$1b
sta $d011
lda #$01
sta $d019
sta $d01a
lda #TitleMusic
jsr MusicInit
cli
jmp TitleLoop ;(placed after IRQS)
;Title screen irq routine (Split into 3 interrupts one for logo, one for static credits / hiscore screen and one for scroll text)
;Title screen scroll text routine
tirq1 sta tstacka1+1
stx tstackx1+1
sty tstacky1+1
lda $dc0d
sta $dd0d
asl $d019
lda #$32
sta $d012
lda #$03
sta $dd00
lda #$1b
sta $d011
lda XPos
sta $d016
lda #$12
sta $d018
lda #1
sta ST
jsr PalNTSCPlayer
ldx #<tirq2
ldy #>tirq2
stx $fffe
sty $ffff
tstacka1 lda #$00
tstackx1 ldx #$00
tstacky1 ldy #$00
rti
;Bitmap logo routine
tirq2 sta tstacka2+1
stx tstackx2+1
sty tstacky2+1
asl $d019
lda #$7a
sta $d012
lda #$00
sta $dd00
lda #$3b
sta $d011
lda #$18
sta $d016
lda #$38
sta $d018
ldx #<tirq3
ldy #>tirq3
stx $fffe
sty $ffff
tstacka2 lda #$00
tstackx2 ldx #$00
tstacky2 ldy #$00
rti
;Static title screen text
tirq3 sta tstacka3+1
stx tstackx3+1
sty tstacky3+1
asl $d019
lda #$f0
sta $d012
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
lda #$03
sta $dd00
lda #$1b
sta $d011
lda #$08
sta $d016
lda #$12
sta $d018
ldx #<tirq1
ldy #>tirq1
stx $fffe
sty $ffff
tstacka3 lda #$00
tstackx3 ldx #$00
tstacky3 ldy #$00
rti
;Main loop for our title screen
TitleLoop jsr SyncTimer ;Synchronize timer with IRQ
jsr ExpandSpritePosition ;Expand the sprite position to use full screen
jsr StarField ;Move the stars
jsr XScroller ;Scroll text routine
jsr PageFlipper ;Credits / Hall of fame swap routine
jsr FlashRoutine ;Colour flashing and washing
jsr LaserGate ;Charset animation for the scrolling lasers
jsr CheckSoundOption ;Sound option detection
jsr WashColourText ;Main colour washing text
;Read joystick to select game sound options
.titleleft lda #4 ;Left selects in game music
bit $dc00
bne .titleright
lda #0
sta SoundOption
jmp FireButtonWait
.titleright lda #8 ;Right selects sound effects
bit $dc00
bne FireButtonWait
lda #1
sta SoundOption
FireButtonWait
;Check fire button and that it has been
lda $dc00 ;released. Then start game.
lsr
lsr
lsr
lsr
lsr
bit FireButton
ror FireButton
bmi TitleLoop
bvc TitleLoop
jmp Game
;Scrolling text message
XScroller lda XPos
sec
sbc #2
and #7
sta XPos
bcs .exittextscroll
ldx #$00
.shift lda $07c1,x
sta $07c0,x
lda scrollcharcolour,x
sta colour+(24*40),x
inx
cpx #$28
bne .shift
lda #$34
sta $01
MessRead
lda ScrollText
bne .storechar
lda #<ScrollText
sta MessRead+1
lda #>ScrollText
sta MessRead+2
jmp MessRead
.storechar sta $07e7
inc MessRead+1
bne .exittextscroll
inc MessRead+2
.exittextscroll
lda #$35
sta $01
rts
;Display the hi score table
DisplayHiScores
jsr ClearNecessaryRows
ldx #$00
.puthis lda pulserow2,x
sta screen+10*40,x
lda HallOfFameText,x
sta screen+12*40,x
lda HallOfFameText+40,x
sta screen+14*40,x
lda HallOfFameText+80,x
sta screen+15*40,x
lda HallOfFameText+120,x
sta screen+16*40,x
lda HallOfFameText+160,x
sta screen+17*40,x
lda HallOfFameText+200,x
sta screen+18*40,x
lda HallOfFameText+240,x
sta screen+20*40,x
lda pulserow1,x
sta screen+22*40,x
inx
cpx #$28
bne .puthis
rts
;Display the game credits on screen (all text in shades of green)
DisplayCredits
jsr ClearNecessaryRows
ldx #$00
.putmessage lda pulserow1,x
sta screen+10*40,x
lda TitleScreenText,x
sta screen+12*40,x
lda TitleScreenText+40,x
sta screen+14*40,x
lda TitleScreenText+80,x
sta screen+15*40,x
lda TitleScreenText+120,x
sta screen+16*40,x
lda TitleScreenText+160,x
sta screen+17*40,x
lda TitleScreenText+200,x
sta screen+19*40,x
lda TitleScreenText+240,x
sta screen+20*40,x
lda pulserow2,x
sta screen+22*40,x
inx
cpx #40
bne .putmessage
rts
;Clean up a few bits
ClearNecessaryRows
ldx #$00
.clrloop lda #$20
sta screen+10*40,x
sta screen+10*40+$100,x
sta screen+$200,x
sta screen+$2e8-40,x
inx
bne .clrloop
rts
;Page flip routine - reads between title screen credits and hi score table
PageFlipper lda PageTimer
cmp #$fa
beq .next
inc PageTimer
rts
.next lda #0
sta PageTimer
inc PageTimer+1
lda PageTimer+1
cmp #$02
beq .pageread
rts
.pageread lda #0
sta PageTimer+1
lda PageNo
cmp #1
beq .hof
jsr DisplayCredits
lda #1
sta PageNo
rts
.hof jsr DisplayHiScores
lda #0
sta PageNo
rts
;The main flash routine in action
FlashRoutine lda FlashDelay
cmp #2
beq FlashMain
inc FlashDelay
rts
FlashMain lda #$00
sta FlashDelay
ldx FlashPointer
lda FlashColourTable,x
sta FlashStore
inx
cpx #FlashColourEnd-FlashColourTable
beq FlashReset
inc FlashPointer
rts
FlashReset ldx #0
stx FlashPointer
rts
CheckSoundOption
lda SoundOption
beq InGameMusicMode
lda #$0b
sta $d027
lda FlashStore
sta $d028
rts
InGameMusicMode lda #$0b
sta $d028
lda FlashStore
sta $d027
rts
StarField ldx #$00
.scrollaway lda ObjPos+4,x
clc
adc StarSpeed,x
bcs .placestar
lda #$c0
.placestar
sta ObjPos+4,x
inx
inx
cpx #$0c
bne .scrollaway
rts
;Colour flash routine (washing) for title screen text
;scroll text remains as it is.
WashColourText
lda TitleFlashColourDelay
cmp #2
beq .flashtitlemain
inc TitleFlashColourDelay
rts
.flashtitlemain lda #0
sta TitleFlashColourDelay
ldx TitleFlashColourPointer
lda TitleFlashColourTable,x
sta colour+(12*40)+39
sta colour+(13*40)
sta colour+(14*40)+39
sta colour+(15*40)
sta colour+(16*40)+39
sta colour+(17*40)
sta colour+(18*40)+39
sta colour+(19*40)
sta colour+(20*40)+39
inx
cpx #TitleFlashColourEnd-TitleFlashColourTable
beq .looptitleflash
inc TitleFlashColourPointer
jsr StoreColourToText
rts
.looptitleflash
ldx #$00
stx TitleFlashColourPointer
;Main colour washing to each text row left
StoreColourToText
jsr WashColourTextLeft
jsr WashColourTextRight
rts
WashColourTextLeft
ldx #$00
.washleft lda colour+(12*40)+1,x
sta colour+(12*40),x
lda colour+(14*40)+1,x
sta colour+(14*40),x
lda colour+(16*40)+1,x
sta colour+(16*40),x
lda colour+(18*40)+1,x
sta colour+(18*40),x
lda colour+(20*40)+1,x
sta colour+(20*40),x
inx
cpx #$28
bne .washleft
rts
WashColourTextRight
ldx #$27
.washright lda colour+(13*40)-1,x
sta colour+(13*40),x
lda colour+(15*40)-1,x
sta colour+(15*40),x
lda colour+(17*40)-1,x
sta colour+(17*40),x
lda colour+(19*40)-1,x
sta colour+(19*40),x
dex
bpl .washright
rts
;Title screen pointers
MusicSprite !byte $d6
SFXSprite !byte $d7
StarSprite !byte $dc
StarPosTable !byte $00,$90
!byte $00,$a0
!byte $00,$b0
!byte $00,$c0
!byte $00,$d0
StarSpeed !byte $fe,$00
!byte $fc,$00
!byte $fd,$00
!byte $fc,$00
!byte $fd,$00
!byte $fe,$00
SoundOption !byte 0
PageTimer !byte 0,0
PageNo !byte 0
FlashDelay !byte 0
FlashPointer !byte 0
FlashStore !byte 0
FlashColourTable
!byte $09,$05,$0d,$01,$0d,$05,$09
FlashColourEnd !byte 0
XPos !byte 0
pulserow1 !byte 99,100,99,100,99,100,99,100,99,100
!byte 99,100,99,100,99,100,99,100,99,100
!byte 99,100,99,100,99,100,99,100,99,100
!byte 99,100,99,100,99,100,99,100,99,100
pulserow2 !byte 101,102,101,102,101,102,101,102,101,102
!byte 101,102,101,102,101,102,101,102,101,102
!byte 101,102,101,102,101,102,101,102,101,102
!byte 101,102,101,102,101,102,101,102,101,102
!ct scr
scrollcharcolour !byte $09,$0b,$0c,$0f,$07
!byte $01,$01,$01,$01,$01
!byte $01,$01,$01,$01,$01
!byte $01,$01,$01,$01,$01
!byte $01,$01,$01,$01,$01
!byte $01,$01,$01,$01,$01
!byte $01,$01,$01,$01,$07
!byte $0f,$0c,$0b,$09,$09
laserscrollcharcolour
!byte $09,$0b,$0c,$0f,$07
!byte $01,$01,$01,$01,$01
!byte $01,$01,$01,$01,$01
!byte $01,$01,$01,$01,$01
!byte $01,$01,$01,$01,$01
!byte $01,$01,$01,$01,$01
!byte $01,$01,$01,$01,$01
!byte $07,$0f,$0c,$0b,$09
TitleScreenText
!text " (c) 2021 the new dimension "
!text " programming ........ <NAME> "
!text " charset ............ <NAME> "
!text " graphics+sprites ... hugues poisseroux "
!text " sfx+music .......... <NAME> "
!text " use a joystick in port 2 "
!text " - press fire to play - "
HallOfFameText !text " the hall of fame "
!text " 1. "
HiScoreTableStart
Name1 !text "richard "
HiScore1 !text "09000 "
!text " 2. "
Name2 !text "hugues "
HiScore2 !text "07500 "
!text " 3. "
Name3 !text "kevin "
HiScore3 !text "05000 "
!text " 4. "
Name4 !text "reset "
HiScore4 !text "02500 "
!text " 5. "
Name5 !text "tnd "
HiScore5 !text "00500 "
HiScoreTableEnd
HiScoreTableEnd
!text " - press fire to play - "
TitleFlashColourDelay !byte 0
TitleFlashColourPointer !byte 0
TitleFlashColourTable
!byte $09,$0b,$0c,$0f,$07,$01,$07,$0f,$0c
TitleFlashColourEnd !byte $0b
|
source/amf/mof/cmof/amf-internals-cmof_classes.ads | svn2github/matreshka | 24 | 26905 | ------------------------------------------------------------------------------
-- --
-- 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$
------------------------------------------------------------------------------
with AMF.CMOF.Classifiers.Collections;
with AMF.CMOF.Classes.Collections;
with AMF.CMOF.Elements.Collections;
with AMF.CMOF.Features.Collections;
with AMF.CMOF.Named_Elements.Collections;
with AMF.CMOF.Namespaces;
with AMF.CMOF.Operations.Collections;
with AMF.CMOF.Packageable_Elements.Collections;
with AMF.CMOF.Packages;
with AMF.CMOF.Properties.Collections;
with AMF.Internals.CMOF_Classifiers;
with AMF.String_Collections;
with AMF.Visitors;
package AMF.Internals.CMOF_Classes is
type CMOF_Class_Proxy is
limited new AMF.Internals.CMOF_Classifiers.CMOF_Classifier_Proxy
and AMF.CMOF.Classes.CMOF_Class
with null record;
-- XXX These subprograms are stubs
overriding function All_Owned_Elements
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element;
overriding function Get_Qualified_Name
(Self : not null access constant CMOF_Class_Proxy)
return Optional_String;
overriding function Is_Distinguishable_From
(Self : not null access constant CMOF_Class_Proxy;
N : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access;
Ns : AMF.CMOF.Namespaces.CMOF_Namespace_Access)
return Boolean;
overriding procedure Set_Package
(Self : not null access CMOF_Class_Proxy;
To : AMF.CMOF.Packages.CMOF_Package_Access);
overriding function Imported_Member
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Get_Names_Of_Member
(Self : not null access constant CMOF_Class_Proxy;
Element : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access)
return AMF.String_Collections.Set_Of_String;
overriding function Import_Members
(Self : not null access constant CMOF_Class_Proxy;
Imps : AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Exclude_Collisions
(Self : not null access constant CMOF_Class_Proxy;
Imps : AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Members_Are_Distinguishable
(Self : not null access constant CMOF_Class_Proxy)
return Boolean;
overriding procedure Set_Is_Final_Specialization
(Self : not null access CMOF_Class_Proxy;
To : Boolean);
overriding function Conforms_To
(Self : not null access constant CMOF_Class_Proxy;
Other : AMF.CMOF.Classifiers.CMOF_Classifier_Access)
return Boolean;
overriding function All_Features
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Features.Collections.Set_Of_CMOF_Feature;
overriding function General
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier;
overriding function Parents
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier;
overriding function Inherited_Member
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element;
overriding function All_Parents
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier;
overriding function Inheritable_Members
(Self : not null access constant CMOF_Class_Proxy;
C : AMF.CMOF.Classifiers.CMOF_Classifier_Access)
return AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element;
overriding function Has_Visibility_Of
(Self : not null access constant CMOF_Class_Proxy;
N : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access)
return Boolean;
overriding function Inherit
(Self : not null access constant CMOF_Class_Proxy;
Inhs : AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element)
return AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element;
overriding function May_Specialize_Type
(Self : not null access constant CMOF_Class_Proxy;
C : AMF.CMOF.Classifiers.CMOF_Classifier_Access)
return Boolean;
overriding function Get_Is_Abstract
(Self : not null access constant CMOF_Class_Proxy)
return Boolean;
overriding procedure Set_Is_Abstract
(Self : not null access CMOF_Class_Proxy;
To : Boolean);
overriding function Get_Owned_Attribute
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Properties.Collections.Ordered_Set_Of_CMOF_Property;
overriding function Get_Owned_Operation
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Operations.Collections.Ordered_Set_Of_CMOF_Operation;
overriding function Get_Super_Class
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Classes.Collections.Set_Of_CMOF_Class;
overriding procedure Enter_Element
(Self : not null access constant CMOF_Class_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant CMOF_Class_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant CMOF_Class_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.CMOF_Classes;
|
texmap/tmap_skv.asm | osgcc/descent-pc | 3 | 24803 | <filename>texmap/tmap_skv.asm
;THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
;SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
;END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
;ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
;IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
;SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
;FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
;CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
;AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
;COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
;
; $Source: f:/miner/source/texmap/rcs/tmap_skv.asm $
; $Revision: 1.5 $
; $Author: mike $
; $Date: 1994/11/30 00:57:03 $
;
; Vertical scanner for sky bitmap rendering.
;
; $Log: tmap_skv.asm $
; Revision 1.5 1994/11/30 00:57:03 mike
; optimization.
;
; Revision 1.4 1994/11/12 16:41:13 mike
; jae -> ja.
;
; Revision 1.3 1994/05/24 11:03:12 mike
; Make work for any sized (power of 2) bitmap.
;
; Revision 1.2 1994/01/31 15:42:14 mike
; Vertical scanning sky texture mapper (in inner loop).
;
; Revision 1.1 1994/01/30 14:10:55 mike
; Initial revision
;
;
DEBUG_ON = 1
.386
option oldstructs
.nolist
include psmacros.inc
.list
public asm_tmap_scanline_lin_sky_v_, asm_tmap_scanline_lin_v_
include tmap_inc.asm
sky_width_log_2 equ 10
sky_height_log_2 equ 7
width_log_2 equ 6
height_log_2 equ 6
_DATA SEGMENT DWORD PUBLIC USE32 'DATA'
extd _fx_u
extd _fx_v
extd _fx_du_dx
extd _fx_dv_dx
extd _fx_y
extd _fx_xleft
extd _fx_xright
extd _pixptr
extd _x
extd _loop_count
_DATA ENDS
DGROUP GROUP _DATA
_TEXT SEGMENT PARA PUBLIC USE32 'CODE'
ASSUME DS:_DATA
ASSUME CS:_TEXT
; --------------------------------------------------------------------------------------------------
; Enter:
; _xleft fixed point left x coordinate
; _xright fixed point right x coordinate
; _y fixed point y coordinate
; _pixptr address of source pixel map
; _u fixed point initial u coordinate
; _v fixed point initial v coordinate
; _du_dx fixed point du/dx
; _dv_dx fixed point dv/dx
; for (x = (int) xleft; x <= (int) xright; x++) {
; _setcolor(read_pixel_from_tmap(srcb,((int) (u/z)) & 63,((int) (v/z)) & 63));
; _setpixel(x,y);
;
; u += du_dx;
; v += dv_dx;
; z += dz_dx;
; }
align 4
asm_tmap_scanline_lin_sky_v_:
pusha
; Setup for loop: _loop_count iterations = (int) xright - (int) xleft
; esi source pixel pointer = pixptr
; edi initial row pointer = y*320+x
; set esi = pointer to start of texture map data
mov esi,_pixptr
; set edi = address of first pixel to modify
mov edi,_fx_xleft
sar edi,16
jns edi_ok
sub edi,edi
edi_ok:
cmp edi,_window_bottom
ja _none_to_do
imul edi,_bytes_per_row
add edi,_fx_y
add edi,write_buffer
; set _loop_count = # of iterations
mov eax,_fx_xright
sar eax,16
mov ebx,_fx_xleft
sar ebx,16
sub eax,ebx
js _none_to_do
cmp eax,_window_height
jbe _ok_to_do
mov eax,_window_height
_ok_to_do:
mov _loop_count,eax
; edi destination pixel pointer
mov ebx,_fx_u
mov ecx,_fx_du_dx
mov edx,_fx_dv_dx
mov ebp,_fx_v
shl ebx,16-sky_width_log_2
shl ebp,16-sky_height_log_2
shl edx,16-sky_height_log_2
shl ecx,16-sky_width_log_2
; eax work
; ebx u
; ecx du_dx
; edx dv_dx
; ebp v
; esi read address
; edi write address
_size = (_end1 - _start1)/num_iters
mov eax,num_iters-1
sub eax,_loop_count
jns j_eax_ok1
inc eax ; sort of a hack, but we can get -1 here and want to be graceful
jns j_eax_ok1 ; if we jump, we had -1, which is kind of ok, if not, we int 3
int 3 ; oops, going to jump behind _start1, very bad...
sub eax,eax ; ok to continue
j_eax_ok1: imul eax,eax,dword ptr _size
add eax,offset _start1
jmp eax
align 4
_start1:
; "OPTIMIZATIONS" maybe not worth making
; Getting rid of the esi from the mov al,[esi+eax] instruction.
; This would require moving into eax at the top of the loop, rather than doing the sub eax,eax.
; You would have to align your bitmaps so that the two shlds would create the proper base address.
; In other words, your bitmap data would have to begin at 4096x (for 64x64 bitmaps).
; I did timings without converting the sub to a mov eax,esi and setting esi to the proper value.
; There was a speedup of about 1% to 1.5% without converting the sub to a mov.
; Getting rid of the edi by doing a mov nnnn[edi],al instead of mov [edi],al.
; The problem with this is you would have a dword offset for nnnn. My timings indicate it is slower. (I think.)
; Combining u,v and du,dv into single longwords.
; The problem with this is you then must do a 16 bit operation to extract them, and you don't have enough
; instructions to separate a destination operand from being used by the next instruction. It shaves out one
; register instruction (an add reg,reg), but adds a 16 bit operation, and the setup is more complicated.
; usage:
; eax work
; ebx u coordinate
; ecx delta u
; edx delta v
; ebp v coordinate
; esi pointer to source bitmap
; edi write address
rept num_iters
mov eax,ebp ; clear for
add ebp,edx ; update v coordinate
shr eax,32-sky_height_log_2 ; shift in v coordinate
shld eax,ebx,sky_width_log_2 ; shift in u coordinate while shifting up v coordinate
add ebx,ecx ; update u coordinate
mov al,[esi+eax] ; get pixel from source bitmap
mov [edi],al
add edi,_bytes_per_row
endm
_end1:
_none_to_do: popa
ret
; --------------------------------------------------------------------------------------------------------------------------------
align 4
asm_tmap_scanline_lin_v_:
pusha
; Setup for loop: _loop_count iterations = (int) xright - (int) xleft
; esi source pixel pointer = pixptr
; edi initial row pointer = y*320+x
; set esi = pointer to start of texture map data
mov esi,_pixptr
; set edi = address of first pixel to modify
mov edi,_fx_xleft
sar edi,16
jns edi_ok_a
sub edi,edi
edi_ok_a:
cmp edi,_window_bottom
ja _none_to_do_a
imul edi,_bytes_per_row
add edi,_fx_y
add edi,write_buffer
; set _loop_count = # of iterations
mov eax,_fx_xright
sar eax,16
mov ebx,_fx_xleft
sar ebx,16
sub eax,ebx
js _none_to_do_a
cmp eax,_window_height
jbe _ok_to_do_a
mov eax,_window_height
_ok_to_do_a:
mov _loop_count,eax
; edi destination pixel pointer
mov ebx,_fx_u
mov ecx,_fx_du_dx
mov edx,_fx_dv_dx
mov ebp,_fx_v
shl ebx,16-width_log_2
shl ebp,16-height_log_2
shl edx,16-height_log_2
shl ecx,16-width_log_2
; eax work
; ebx u
; ecx du_dx
; edx dv_dx
; ebp v
; esi read address
; edi write address
_size_a = (_end1_a - _start1_a)/num_iters
mov eax,num_iters-1
sub eax,_loop_count
jns j_eax_ok1_a
inc eax ; sort of a hack, but we can get -1 here and want to be graceful
jns j_eax_ok1_a ; if we jump, we had -1, which is kind of ok, if not, we int 3
int 3 ; oops, going to jump behind _start1, very bad...
sub eax,eax ; ok to continue
j_eax_ok1_a: imul eax,eax,dword ptr _size_a
add eax,offset _start1_a
jmp eax
align 4
_start1_a:
; "OPTIMIZATIONS" maybe not worth making
; Getting rid of the esi from the mov al,[esi+eax] instruction.
; This would require moving into eax at the top of the loop, rather than doing the sub eax,eax.
; You would have to align your bitmaps so that the two shlds would create the proper base address.
; In other words, your bitmap data would have to begin at 4096x (for 64x64 bitmaps).
; I did timings without converting the sub to a mov eax,esi and setting esi to the proper value.
; There was a speedup of about 1% to 1.5% without converting the sub to a mov.
; Getting rid of the edi by doing a mov nnnn[edi],al instead of mov [edi],al.
; The problem with this is you would have a dword offset for nnnn. My timings indicate it is slower. (I think.)
; Combining u,v and du,dv into single longwords.
; The problem with this is you then must do a 16 bit operation to extract them, and you don't have enough
; instructions to separate a destination operand from being used by the next instruction. It shaves out one
; register instruction (an add reg,reg), but adds a 16 bit operation, and the setup is more complicated.
; usage:
; eax work
; ebx u coordinate
; ecx delta u
; edx delta v
; ebp v coordinate
; esi pointer to source bitmap
; edi write address
rept num_iters
mov eax,ebp ; clear for
add ebp,edx ; update v coordinate
shr eax,32-height_log_2 ; shift in v coordinate
shld eax,ebx,width_log_2 ; shift in u coordinate while shifting up v coordinate
add ebx,ecx ; update u coordinate
mov al,[esi+eax] ; get pixel from source bitmap
mov [edi],al
add edi,_bytes_per_row
endm
_end1_a:
_none_to_do_a: popa
ret
_TEXT ends
end
|
oeis/314/A314973.asm | neoneye/loda-programs | 11 | 5996 | <filename>oeis/314/A314973.asm
; A314973: Coordination sequence Gal.6.342.2 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by <NAME>
; 1,5,9,14,20,26,32,38,44,49,53,58,63,67,72,78,84,90,96,102,107,111,116,121,125,130,136,142,148,154,160,165,169,174,179,183,188,194,200,206,212,218,223,227,232,237,241,246,252,258
mov $2,$0
seq $0,313802 ; Coordination sequence Gal.6.209.2 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
mov $1,2
add $1,$0
mul $0,2
mul $1,2
div $1,3
sub $1,1
add $1,$2
add $1,$2
sub $0,$1
|
Task/Topological-sort/Ada/topological-sort-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 17840 | <filename>Task/Topological-sort/Ada/topological-sort-1.ada
with Ada.Containers.Vectors; use Ada.Containers;
package Digraphs is
type Node_Idx_With_Null is new Natural;
subtype Node_Index is Node_Idx_With_Null range 1 .. Node_Idx_With_Null'Last;
-- a Node_Index is a number from 1, 2, 3, ... and the representative of a node
type Graph_Type is tagged private;
-- make sure Node is in Graph (possibly without connections)
procedure Add_Node
(Graph: in out Graph_Type'Class; Node: Node_Index);
-- insert an edge From->To into Graph; do nothing if already there
procedure Add_Connection
(Graph: in out Graph_Type'Class; From, To: Node_Index);
-- get the largest Node_Index used in any Add_Node or Add_Connection op.
-- iterate over all nodes of Graph: "for I in 1 .. Graph.Node_Count loop ..."
function Node_Count(Graph: Graph_Type) return Node_Idx_With_Null;
-- remove an edge From->To from Fraph; do nothing if not there
-- Graph.Node_Count is not changed
procedure Del_Connection
(Graph: in out Graph_Type'Class; From, To: Node_Index);
-- check if an edge From->to exists in Graph
function Connected
(Graph: Graph_Type; From, To: Node_Index) return Boolean;
-- data structure to store a list of nodes
package Node_Vec is new Vectors(Positive, Node_Index);
-- get a list of all nodes From->Somewhere in Graph
function All_Connections
(Graph: Graph_Type; From: Node_Index) return Node_Vec.Vector;
Graph_Is_Cyclic: exception;
-- a depth-first search to find a topological sorting of the nodes
-- raises Graph_Is_Cyclic if no topological sorting is possible
function Top_Sort
(Graph: Graph_Type) return Node_Vec.Vector;
private
package Conn_Vec is new Vectors(Node_Index, Node_Vec.Vector, Node_Vec."=");
type Graph_Type is new Conn_Vec.Vector with null record;
end Digraphs;
|
Papers3/Papers_To_DEVONthink/Papers_To_DEVONthink.applescript | extracts/mac-scripting | 50 | 3814 | -- Papers to DEVONthink
-- version 1.0, licensed under the MIT license
-- by <NAME>, keypointsapp.net, mat(at)extracts(dot)de
-- Exports all notes & highlight annotations of all publications selected in your
-- Papers 3 library to DEVONthink Pro.
-- If not disabled within the script, the publication's primary PDF will be also
-- indexed in DEVONthink Pro.
-- This script requires macOS 10.10 (Yosemite) or greater, the KeypointsScriptingLib v1.2 or
-- greater, Papers 3.4.2 or greater, and DEVONthink Pro 12.9.16 or greater.
-- This export script will transfer the following annotation properties:
-- * logical page number
-- * quoted text
-- * annotation type
-- * creation date
-- * annotation color
-- In addition, these publication properties are also transferred:
-- * formatted reference
-- * cite key
-- * keywords
-- * color label
-- * flagged status
-- * "papers://…" link
-- * BibTeX metadata
-- The export of some of these properties can be disabled below. Example note as created by this script:
(*
<NAME> al., 2003. The biology and chemistry of land fast ice in the White Sea, Russia–A comparison
of winter and spring conditions. Polar Biology, 26(11), pp.707–719.
{Krell++2003WhiteSea}
p.707: Sea ice therefore probably plays a major role in structuring the White Sea ecosystem, since it
strongly alters the exchange of energy and material between water and atmosphere. -- Highlighted 26.11.2017
*)
-- NOTE: Before executing the app, make sure that your Papers and DEVONthink Pro apps are running,
-- and that you've selected all publications in your Papers library that you'd like to export to
-- DEVONthink Pro. Then run the script to start the export process. For each publication with a PDF,
-- the script will create a group within the database or group you've selected in DEVONthink Pro,
-- and populate it with RTF notes for each of your note or highlight annotations.
-- NOTE: Upon completion, DEVONthink Pro will display a modal dialog reporting how many publications
-- (and annotations) were imported.
-- NOTE: If you again select the same database or group in DEVONthink Pro, you can run the
-- script multiple times for the same PDF without creating duplicate notes. This may be useful
-- if you want to add newly added annotations or update the label color for existing ones.
-- However, if a note was modified in DEVONthink Pro, the script will leave it as is and create
-- a duplicate note with the original note contents.
-- ----------- you may edit the values of the properties below ------------------
-- Specifies whether the publication's primary PDF shall be indexed in DEVONthink Pro (`true`)
-- or not (`false`). If `true`, this script will create an index entry for the publication's primary
-- PDF next to any notes & highlight annotations exported by this script.
property transferPapersPDF : true
-- Specifies whether the publication's flagged status shall be exported to DEVONthink Pro (`true`)
-- or not (`false`). If `true`, and if the publication was flagged in your Papers library, this script
-- will mark the corresponding index entry for the publication's primary PDF as flagged. Note that
-- this script won't flag the publication's group folder since this would flag all contained items.
property transferPapersFlag : true
-- Specifies whether the publication's keywords shall be transferred to DEVONthink Pro (`true`)
-- or not (`false`). If `true`, this script will use the publication's keywords to set the tags of the
-- group & PDF index entry that are created in DEVONthink Pro for the publication.
property transferPapersKeywords : true
-- Specifies whether the publication's BibTeX metadata shall be transferred to DEVONthink Pro
-- (`true`) or not (`false`). If `true`, this script will add the publication's BibTeX metadata to the
-- Spotlight comment field of the group that's created in DEVONthink Pro for the publication. Note
-- that this script won't set the Spotlight comment field of the PDF index entry since this would cause
-- DEVONthink Pro to also set the Spotlight comment of the target PDF file accordingly (which would
-- overwrite any existing comments).
property transferPapersBibTeX : true
-- Specifies whether the publication's or annotation's color label shall be transferred to DEVONthink
-- Pro (`true`) or not (`false`). If `true`, this script will mark the records created in DEVONthink
-- Pro with an appropriate color label.
property transferPapersLabel : true
-- Specifies whether the publication's "papers://…" link shall be exported to DEVONthink Pro (`true`)
-- or not (`false`). If `true`, the "papers://…" link will be written to the "URL" field of all records
-- created in DEVONthink Pro.
property transferPapersLink : true
-- Specifies whether the publication's or annotation's creation date shall be exported to DEVONthink
-- Pro (`true`) or not (`false`). If `true`, the creation date will be written to the "creation date"
-- field of all groups and notes created in DEVONthink Pro. Note that this script won't touch the
-- creation date of the created PDF index entry (for which DEVONthink displays the file's creation date).
property transferPapersCreationDate : true
-- ----------- usually, you don't need to edit anything below this line -----------
property exportedAnnotationsCount : 0
use KeypointsLib : script "KeypointsScriptingLib"
use scripting additions
-- TODO: optionally transfer manual collections as tags
-- TODO: offer an option to put the publication's formatted reference in the Spotlight comments instead
-- adopt this routine to customize
on run
-- DEVONthink and Papers must be running for this script to work
if not my checkAppsRunning() then return
KeypointsLib's setupProgress("Exporting selected Papers publications to DEVONthink Pro…")
tell application id "com.mekentosj.papers3"
-- export the currently selected publications only
set selectedPubs to selected publications of front library window
-- filter the selection so that it only contains publications with a primary PDF
set pdfPubs to my pubsWithPDF(selectedPubs)
set pubCount to count of pdfPubs
-- get current group/window in DEVONthink which should receive the notes
set {dtContainer, dtWin} to my getDTTargetContainers()
KeypointsLib's setTotalStepsForProgress(pubCount)
set exportedAnnotationsCount to 0
repeat with i from 1 to pubCount
set aPub to item i of pdfPubs
-- gather info for this publication
set {pubRef, pubKey, pubTitle, pubLink, pubCreationDate} to {formatted reference, citekey, title, item url, creation date} of aPub
set pubKeywords to name of every keyword item of aPub
KeypointsLib's updateProgress(i, "Exporting publication " & i & " of " & pubCount & " (\"" & pubTitle & "\").")
-- get all notes & highlight annotations for this publication
set pubAnnotations to every annotation item of primary file item of aPub
if transferPapersPDF or pubAnnotations is not {} then
-- create a subfolder in DEVONthink (named like "<CITEKEY> - <TITLE>")
set folderName to pubKey & " - " & pubTitle
set pubBibTeX to bibtex string of aPub
set folderLocation to my createDTFolder(dtContainer, folderName, pubLink, pubCreationDate, pubKeywords, pubBibTeX)
my transferPapersPublicationColor(folderLocation, aPub)
if folderLocation is not missing value then
-- index PDF file
if transferPapersPDF then
set pdfFile to primary file item of aPub
set pdfPath to full path of pdfFile
set isFlagged to flagged of aPub
set indexRecord to my createDTIndexRecord(folderLocation, pdfPath, folderName, pubLink, pubKeywords, isFlagged)
my transferPapersPublicationColor(indexRecord, aPub)
end if
-- export annotations
my exportAnnotationsToDEVONthink(folderLocation, pubAnnotations, pubRef, pubKey, pubLink)
else
KeypointsLib's logToSystemConsole(name of me, "Couldn't export publication \"" & pubTitle & "\" since its group folder could not be created in DEVONthink.")
end if
end if
end repeat
end tell
tell application id "DNtp"
activate
display dialog "Imported publications: " & pubCount & linefeed & "Imported annotations: " & exportedAnnotationsCount ¬
with title "Finished Import From Papers" with icon 2 buttons {"OK"} default button "OK"
end tell
end run
-- Returns all publications from the given list of publications that have a primary PDF attached.
on pubsWithPDF(pubList)
tell application id "com.mekentosj.papers3"
set allPubsWithPDF to {}
repeat with aPub in pubList
set pdfFile to primary file item of aPub
if pdfFile is not missing value then
copy contents of aPub to end of allPubsWithPDF
end if
end repeat
return allPubsWithPDF
end tell
end pubsWithPDF
-- Creates a new (rich text) record in DEVONthink for each of the given Papers note or highlight annotations.
on exportAnnotationsToDEVONthink(folderLocation, pubAnnotations, pubRef, pubKey, pubLink)
if folderLocation is missing value or pubAnnotations is missing value then return
tell application id "com.mekentosj.papers3"
repeat with anAnnotation in pubAnnotations
if resource type of anAnnotation is not "Ink" then -- ink annotations aren't supported by this script
set recordCreationDate to creation date of anAnnotation
-- individual records have titles like "<CITEKEY> - <NOTE SUMMARY>"
set annotationSummary to content summary of anAnnotation
set recordName to pubKey & " - " & annotationSummary
-- assemble formatted text for this note
-- TODO: use a template mechanism for note formatting
set recordContents to pubRef & linefeed & linefeed ¬
& "{" & pubKey & "}" & linefeed & linefeed ¬
& annotationSummary & linefeed & linefeed
-- create a record for this note in DEVONthink
set dtRecord to my createDTRecord(folderLocation, recordName, pubLink, recordContents, recordCreationDate)
if dtRecord is not missing value then set exportedAnnotationsCount to exportedAnnotationsCount + 1
-- set color label of DEVONthink record
my transferPapersAnnotationColor(dtRecord, anAnnotation)
end if
end repeat
end tell
end exportAnnotationsToDEVONthink
-- Sets the color label of the given DEVONthink record to the publication color label
-- of the given Papers publication
on transferPapersPublicationColor(dtRecord, papersPublication)
if dtRecord is missing value or papersPublication is missing value then return
set pubJSON to my jsonStringForPapersItem(papersPublication)
if transferPapersLabel and pubJSON is not missing value then -- set color label
set papersColorIndex to KeypointsLib's regexMatch(pubJSON, "(?<=" & linefeed & " \"label\": ).+(?=,)")
if papersColorIndex > 0 then
set dtLabel to my dtLabelForPapersPublicationColor(papersColorIndex)
if dtLabel > 0 then
tell application id "DNtp" to set label of dtRecord to dtLabel
end if
end if
end if
end transferPapersPublicationColor
-- Sets the color label of the given DEVONthink record to the annotation color
-- of the given Papers note or highlight annotation
on transferPapersAnnotationColor(dtRecord, papersAnnotation)
if dtRecord is missing value or papersAnnotation is missing value then return
set noteJSON to my jsonStringForPapersItem(papersAnnotation)
if transferPapersLabel and noteJSON is not missing value then -- set color label
set papersColorIndex to KeypointsLib's regexMatch(noteJSON, "(?<=" & linefeed & " \"color\": ).+(?=,)")
if papersColorIndex > 0 then
set dtLabel to my dtLabelForPapersAnnotationColor(papersColorIndex)
if dtLabel > 0 then
tell application id "DNtp" to set label of dtRecord to dtLabel
end if
end if
end if
end transferPapersAnnotationColor
-- Returns the contents of the `json string` property for the given Papers item.
on jsonStringForPapersItem(papersItem)
set jsonString to missing value
try -- getting the json string may cause a -10000 error
tell application id "com.mekentosj.papers3" to set jsonString to json string of papersItem
on error errorText number errorNumber
if errorNumber is not -128 then
KeypointsLib's logToSystemConsole(name of me, "Couldn't fetch 'json string' property for papers item of type \"" & (class of papersItem) & "\"." & linefeed & "Error: " & errorText & " (" & errorNumber & ")")
end if
end try
return jsonString
end jsonStringForPapersItem
-- Returns the index of the DEVONthink color label corresponding to the given Papers publication color index.
on dtLabelForPapersPublicationColor(papersColorIndex)
-- Papers publication color index (name) -> DEVONthink label index (name)
-- 0 (none) -> 0 (none)
-- 1 (red) -> 1 (red)
-- 2 (orange) -> 5 (orange)
-- 3 (yellow) -> 4 (yellow)
-- 4 (green) -> 2 (green)
-- 5 (blue) -> 3 (blue)
-- 6 (purple) -> 7 (pink) // the "purple" Papers color label looks more like pink
-- 7 (light gray) -> 6 (purple) // improper mapping!
set dtLabels to {1, 5, 4, 2, 3, 7, 6}
if papersColorIndex ≥ 1 and papersColorIndex ≤ 7 then
return item papersColorIndex of dtLabels
else
return 0
end if
end dtLabelForPapersPublicationColor
-- Returns the index of the DEVONthink color label corresponding to the given Papers annotation color index.
on dtLabelForPapersAnnotationColor(papersColorIndex)
-- Papers annotation color index (name) -> DEVONthink label index (name)
-- used for highlight annotations:
-- 0 (none) -> 0 (none)
-- 1 (yellow) -> 4 (yellow)
-- 2 (blue) -> 3 (blue)
-- 3 (green) -> 2 (green)
-- 4 (pink) -> 7 (pink)
-- 5 (purple) -> 6 (purple)
-- 6 (light gray) -> 5 (orange) // improper mapping!
-- only used for ink annotations:
-- 7 (orange) -> 5 (orange)
-- 8 (red) -> 1 (red)
-- 9 (black) -> 0 (none)
set dtLabels to {4, 3, 2, 7, 6, 5, 5, 1, 0}
if papersColorIndex ≥ 1 and papersColorIndex ≤ 9 then
return item papersColorIndex of dtLabels
else
return 0
end if
end dtLabelForPapersAnnotationColor
-- Finds the DEVONthink folder for this publication, or creates it if it doesn't exist.
-- Credit: modified after script code by <NAME>
-- see https://github.com/RobTrew/tree-tools/blob/master/DevonThink%20scripts/Sente6ToDevn73.applescript
on createDTFolder(dtContainer, folderName, folderURL, folderCreationDate, folderTags, folderComment)
tell application id "DNtp"
if (count of parents of dtContainer) is 0 then
set dtLocation to (create location folderName in database of dtContainer)
else
set dtLocation to (create location (location of dtContainer & "/" & name of dtContainer & "/" & folderName) in database of dtContainer)
end if
if transferPapersLink and folderURL is not "" then
set URL of dtLocation to folderURL
end if
if transferPapersCreationDate and folderCreationDate is not missing value then
set creation date of dtLocation to folderCreationDate
end if
if transferPapersKeywords and folderTags is not {} then
set tags of dtLocation to (tags of dtLocation) & folderTags -- in case the folder already exists
end if
if transferPapersBibTeX and folderComment is not "" and folderComment is not missing value then
set comment of dtLocation to folderComment
end if
return dtLocation
end tell
end createDTFolder
-- Creates a new (rich text) record in DEVONthink with the given text and returns it.
-- Credit: modified after script code by <NAME>
-- see https://github.com/RobTrew/tree-tools/blob/master/DevonThink%20scripts/Sente6ToDevn73.applescript
on createDTRecord(folderLocation, recordName, recordURL, recordText, recordCreationDate)
tell application id "DNtp"
set newRecordData to {type:rtf, rich text:recordText, name:recordName}
if transferPapersLink and recordURL is not "" then
set newRecordData to newRecordData & {URL:recordURL}
end if
if transferPapersCreationDate and recordCreationDate is not missing value then
set newRecordData to newRecordData & {creation date:recordCreationDate}
end if
set newRecord to create record with newRecordData in folderLocation
set aRecord to my deduplicatedDTRecord(newRecord)
return aRecord
end tell
end createDTRecord
-- Creates an indexed object for the given file path in DEVONthink.
on createDTIndexRecord(folderLocation, filePath, recordName, recordURL, recordTags, isFlagged)
tell application id "DNtp"
set indexRecord to indicate filePath to folderLocation
set aliases of indexRecord to recordName
if transferPapersFlag and isFlagged then
set state of indexRecord to isFlagged
end if
if transferPapersLink and recordURL is not "" then
set URL of indexRecord to recordURL
end if
if transferPapersKeywords and recordTags is not {} then
set tags of indexRecord to (tags of indexRecord) & recordTags
end if
set aRecord to my deduplicatedDTRecord(indexRecord)
return aRecord
end tell
end createDTIndexRecord
-- If the given record duplicates another in its group, discards the given record and
-- returns the existing "duplicate" record, otherwise just returns the given record.
on deduplicatedDTRecord(aRecord)
tell application id "DNtp"
set recordDuplicates to duplicates of aRecord
if recordDuplicates is not {} then
set recordLocation to location of aRecord
repeat with aDuplicateRecord in recordDuplicates
if location of aDuplicateRecord = recordLocation then
delete record aRecord
return aDuplicateRecord
end if
end repeat
end if
return aRecord
end tell
end deduplicatedDTRecord
-- Checks if DEVONthink Pro and Papers are running.
-- Credit: modified after script code by <NAME>
-- see https://github.com/RobTrew/tree-tools/blob/master/DevonThink%20scripts/Sente6ToDevn73.applescript
on checkAppsRunning()
tell application id "sevs" -- application "System Events"
if (count of (processes where creator type = "DNtp")) < 1 then
KeypointsLib's displayError("DEVONthink Pro not running!", "Please open DEVONthink Pro and select a target database or group, then run this script again.", 15, true)
return false
end if
if (count of (processes where bundle identifier starts with "com.mekentosj.papers3")) < 1 then
KeypointsLib's displayError("Papers 3 not running!", "Please open Papers 3 and select some publication(s), then run this script again.", 15, true)
return false
end if
end tell
return true
end checkAppsRunning
-- Gets the target window as well as the group currently selected in DEVONthink Pro.
-- Credit: modified after script code by <NAME>
-- see https://github.com/RobTrew/tree-tools/blob/master/DevonThink%20scripts/Sente6ToDevn73.applescript
on getDTTargetContainers()
tell application id "DNtp"
-- get the current group, if there is one
set dtGroup to missing value
with timeout of 1 second
try
set dtGroup to current group
end try
end timeout
-- else, get the current database, if there is one
try
dtGroup
on error
set dtGroup to (root of database id 1)
set dtWin to open window for record dtGroup
return {dtGroup, dtWin}
end try
if dtGroup is missing value then
set dtGroup to (root of database id 1)
set dtWin to open window for record dtGroup
return {dtGroup, dtWin}
end if
-- ensure that a window is open for this group
set {dtDatabase, dtGroupID} to {database, id} of dtGroup
set dtWindows to viewer windows where id of its root is dtGroupID and name of its root is name of dtDatabase
if length of dtWindows < 1 then
set dtWin to open window for record dtGroup
else
set dtWin to first item of dtWindows
end if
return {dtGroup, dtWin}
end tell
end getDTTargetContainers
|
programs/oeis/177/A177239.asm | neoneye/loda | 22 | 80896 | ; A177239: Partial sums of round(n^2/20).
; 0,0,0,0,1,2,4,6,9,13,18,24,31,39,49,60,73,87,103,121,141,163,187,213,242,273,307,343,382,424,469,517,568,622,680,741,806,874,946,1022,1102,1186,1274,1366,1463,1564,1670,1780,1895,2015,2140,2270,2405,2545,2691,2842,2999,3161,3329,3503,3683,3869,4061,4259,4464,4675,4893,5117,5348,5586,5831,6083,6342,6608,6882,7163,7452,7748,8052,8364,8684,9012,9348,9692,10045,10406,10776,11154,11541,11937,12342,12756,13179,13611,14053,14504,14965,15435,15915,16405
mov $2,$0
add $2,1
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
pow $0,2
div $0,10
add $0,1
div $0,2
add $1,$0
lpe
mov $0,$1
|
dma/hdma_valid_dest_swap_bank/main.asm | AntonioND/gbc-hw-tests | 6 | 174459 |
INCLUDE "hardware.inc"
INCLUDE "header.inc"
SET_VALUES: MACRO
db \1,\1+1,\1+2,\1+3,\1+4,\1+5,\1+6,\1+7,\1+8,\1+9,\1+10,\1+11,\1+12,\1+13,\1+14,\1+15
ENDM
SECTION "22",ROMX[$4000],BANK[1]
SET_VALUES 1
SET_VALUES 2
SET_VALUES 3
SECTION "33",ROMX[$4000],BANK[2]
SET_VALUES 4
SET_VALUES 5
SET_VALUES 6
SECTION "Main",HOME
;--------------------------------------------------------------------------
wait_hbl_end:
ld a,[rHDMA5]
and a,$80
jr z,wait_hbl_end
ret
;--------------------------------------------------------------------------
;- Main() -
;--------------------------------------------------------------------------
DMA_COPY_UNSAFE: MACRO ; src, dst, size, is_hdma
ld a, ( \1 >> 8 )& $FF
ld [rHDMA1],a
ld a, \1 & $FF
ld [rHDMA2],a
ld a, ( \2 >> 8 )& $FF
ld [rHDMA3],a
ld a, \2 & $FF
ld [rHDMA4],a
ld a, ( ( ( \3 >> 4 ) - 1 ) | ( \4 << 7 ) ) ; ( Size / $10 ) - 1
ld [rHDMA5],a
ENDM
Main:
di
ld a,$0A
ld [$0000],a ; enable ram
ld d,0
ld bc,$2000
ld hl,$8000
call memset
; -------------------------------------------------------
ld a,LCDCF_ON
ld [rLCDC],a
; -------------------------------------------------------
ld b,10 ; change vram bank
call wait_ly
ld a,0
ld [rVBK],a
DMA_COPY $4000,$9000,$30,1
ld b,11
call wait_ly
ld a,1
ld [rVBK],a
ld b,15
call wait_ly
ld a,0
ld [rVBK],a
; -------------------------------------------------------
call screen_off
ld bc,$30
ld hl,$9000
ld de,$A000
call memcopy
ld a,1
ld [rVBK],a
ld bc,$30
ld hl,$9000
ld de,$A030
call memcopy
ld a,0
ld [rVBK],a
ld a,LCDCF_ON
ld [rLCDC],a
; -------------------------------------------------------
ld b,10 ; change rom bank
call wait_ly
DMA_COPY $4000,$9000,$30,1
ld a,1
ld [$2000],a
ld b,11
call wait_ly
ld a,2
ld [$2000],a
ld b,15
call wait_ly
; -------------------------------------------------------
call screen_off
ld bc,$30
ld hl,$9000
ld de,$A060
call memcopy
; -------------------------------------------------------
; invalid destinations
DMA_COPY_UNSAFE $4000,$0000,$10,0
DMA_COPY_UNSAFE $4000,$C010,$10,0
DMA_COPY_UNSAFE $4000,$A020,$10,0
DMA_COPY_UNSAFE $4000,$E030,$10,0
ld bc,$40
ld hl,$8000
ld de,$A090
call memcopy
; -------------------------------------------------------
; unaligned copy
DMA_COPY_UNSAFE $4001,$8002,$10,0
ld bc,$20
ld hl,$8000
ld de,$A0D0
call memcopy
ld hl,$A0F0
; -------------------------------------------------------
push hl ; magic number
ld [hl],$12
inc hl
ld [hl],$34
inc hl
ld [hl],$56
inc hl
ld [hl],$78
pop hl
; -------------------------------------------------------
ld a,$00
ld [$0000],a ; disable ram
.endloop:
halt
jr .endloop
|
beafix_benchmarks/A4F-1B-ATR/TRASH/trash_inv1_1.als | Kaixi26/org.alloytools.alloy | 0 | 4537 | <gh_stars>0
/**
* Relational logic revision exercises based on a simple model of a
* file system trash can.
*
* The model has 3 unary predicates (sets), File, Trash and
* Protected, the latter two a sub-set of File. There is a binary
* predicate, link, a sub-set of File x File.
*
* Solve the following exercises using Alloy's relational logic, which
* extends first-order logic with:
* - expression comparisons 'e1 in e2' and 'e1 = e2'
* - expression multiplicity tests 'some e', 'lone e', 'no e' and 'one e'
* - binary relational operators '.', '->', '&', '+', '-', ':>' and '<:'
* - unary relational operators '~', '^' and '*'
* - definition of relations by comprehension
**/
/* The set of files in the file system. */
sig File {
/* A file is potentially a link to other files. */
link : set File
}
/* The set of files in the trash. */
sig Trash extends File {}
/* The set of protected files. */
sig Protected extends File {}
/* The trash is empty. */
pred inv1 {
no Trash
}
/* All files are deleted. */
pred inv2 {
File in Trash
}
/* Some file is deleted. */
pred inv3 {
some Trash
}
/* Protected files cannot be deleted. */
pred inv4 {
no Protected & Trash
}
/* All unprotected files are deleted.. */
pred inv5 {
File - Protected in Trash
}
/* A file links to at most one file. */
pred inv6 {
~link . link in iden
}
/* There is no deleted link. */
pred inv7 {
no link.Trash
}
/* There are no links. */
pred inv8 {
no link
}
/* A link does not link to another link. */
pred inv9 {
no link.link
}
/* If a link is deleted, so is the file it links to. */
pred inv10 {
Trash.link in Trash
}
/*======== IFF PERFECT ORACLE ===============*/
pred inv1_OK {
no Trash
}
assert inv1_Repaired {
inv1[] iff inv1_OK[]
}
pred inv2_OK {
File in Trash
}
assert inv2_Repaired {
inv2[] iff inv2_OK[]
}
pred inv3_OK {
some Trash
}
assert inv3_Repaired {
inv3[] iff inv3_OK[]
}
pred inv4_OK {
no Protected & Trash
}
assert inv4_Repaired {
inv4[] iff inv4_OK[]
}
pred inv5_OK {
File - Protected in Trash
}
assert inv5_Repaired {
inv5[] iff inv5_OK[]
}
pred inv6_OK {
~link . link in iden
}
assert inv6_Repaired {
inv6[] iff inv6_OK[]
}
pred inv7_OK {
no link.Trash
}
assert inv7_Repaired {
inv7[] iff inv7_OK[]
}
pred inv8_OK {
no link
}
assert inv8_Repaired {
inv8[] iff inv8_OK[]
}
pred inv9_OK {
no link.link
}
assert inv9_Repaired {
inv9[] iff inv9_OK[]
}
pred inv10_OK {
Trash.link in Trash
}
assert inv10_Repaired {
inv10[] iff inv10_OK[]
}
check inv1_Repaired expect 0
check inv2_Repaired expect 0
check inv3_Repaired expect 0
check inv4_Repaired expect 0
check inv5_Repaired expect 0
check inv6_Repaired expect 0
check inv7_Repaired expect 0
check inv8_Repaired expect 0
check inv9_Repaired expect 0
check inv10_Repaired expect 0
pred __repair {
inv1
}
assert __repair {
inv1 <=> {
no Trash
}
}
check __repair
|
programs/oeis/298/A298705.asm | neoneye/loda | 0 | 161990 | <filename>programs/oeis/298/A298705.asm
; A298705: Numbers from the 15-theorem for universal Hermitian lattices.
; 1,2,3,5,6,7,10,13,14,15
add $0,2
mov $3,9
lpb $0
sub $0,1
mov $2,$0
max $2,0
seq $2,98802 ; Greatest prime factors in Pascal's triangle (read by rows).
add $3,$2
mul $2,$3
lpe
mov $0,$2
sub $0,10
|
emc_512/lab/PSpice/SCHEMATICS/Schematic2.als | antelk/teaching | 0 | 3817 | <gh_stars>0
* Schematics Aliases *
.ALIASES
V_V1 V1(+=$N_0001 -=0 )
C_C1 C1(1=0 2=$N_0002 )
C_C2 C2(1=$N_0002 2=$N_0003 )
R_R2 R2(1=0 2=$N_0003 )
R_R3 R3(1=$N_0001 2=$N_0002 )
.ENDALIASES
|
06/full_auto_tests/tests/testShiftU.asm | yairfine/nand-to-tetris | 1 | 90860 | <reponame>yairfine/nand-to-tetris<gh_stars>1-10
@20
M=1
M=M<<
D=M
D=D>>
A=D
A=A<<
@5
|
Cubical/Data/Nat/Properties.agda | L-TChen/cubical | 0 | 16041 | <reponame>L-TChen/cubical<filename>Cubical/Data/Nat/Properties.agda
{-# OPTIONS --cubical --no-import-sorts --no-exact-split --safe #-}
module Cubical.Data.Nat.Properties where
open import Cubical.Core.Everything
open import Cubical.Foundations.Prelude
open import Cubical.Data.Nat.Base
open import Cubical.Data.Empty as ⊥
open import Cubical.Data.Sigma
open import Cubical.Relation.Nullary
open import Cubical.Relation.Nullary.DecidableEq
private
variable
l m n : ℕ
min : ℕ → ℕ → ℕ
min zero m = zero
min (suc n) zero = zero
min (suc n) (suc m) = suc (min n m)
minComm : (n m : ℕ) → min n m ≡ min m n
minComm zero zero = refl
minComm zero (suc m) = refl
minComm (suc n) zero = refl
minComm (suc n) (suc m) = cong suc (minComm n m)
max : ℕ → ℕ → ℕ
max zero m = m
max (suc n) zero = suc n
max (suc n) (suc m) = suc (max n m)
maxComm : (n m : ℕ) → max n m ≡ max m n
maxComm zero zero = refl
maxComm zero (suc m) = refl
maxComm (suc n) zero = refl
maxComm (suc n) (suc m) = cong suc (maxComm n m)
znots : ¬ (0 ≡ suc n)
znots eq = subst (caseNat ℕ ⊥) eq 0
snotz : ¬ (suc n ≡ 0)
snotz eq = subst (caseNat ⊥ ℕ) eq 0
injSuc : suc m ≡ suc n → m ≡ n
injSuc p = cong predℕ p
discreteℕ : Discrete ℕ
discreteℕ zero zero = yes refl
discreteℕ zero (suc n) = no znots
discreteℕ (suc m) zero = no snotz
discreteℕ (suc m) (suc n) with discreteℕ m n
... | yes p = yes (cong suc p)
... | no p = no (λ x → p (injSuc x))
isSetℕ : isSet ℕ
isSetℕ = Discrete→isSet discreteℕ
-- Arithmetic facts about predℕ
suc-predℕ : ∀ n → ¬ n ≡ 0 → n ≡ suc (predℕ n)
suc-predℕ zero p = ⊥.rec (p refl)
suc-predℕ (suc n) p = refl
-- Arithmetic facts about +
+-zero : ∀ m → m + 0 ≡ m
+-zero zero = refl
+-zero (suc m) = cong suc (+-zero m)
+-suc : ∀ m n → m + suc n ≡ suc (m + n)
+-suc zero n = refl
+-suc (suc m) n = cong suc (+-suc m n)
+-comm : ∀ m n → m + n ≡ n + m
+-comm m zero = +-zero m
+-comm m (suc n) = (+-suc m n) ∙ (cong suc (+-comm m n))
-- Addition is associative
+-assoc : ∀ m n o → m + (n + o) ≡ (m + n) + o
+-assoc zero _ _ = refl
+-assoc (suc m) n o = cong suc (+-assoc m n o)
inj-m+ : m + l ≡ m + n → l ≡ n
inj-m+ {zero} p = p
inj-m+ {suc m} p = inj-m+ (injSuc p)
inj-+m : l + m ≡ n + m → l ≡ n
inj-+m {l} {m} {n} p = inj-m+ ((+-comm m l) ∙ (p ∙ (+-comm n m)))
m+n≡n→m≡0 : m + n ≡ n → m ≡ 0
m+n≡n→m≡0 {n = zero} = λ p → (sym (+-zero _)) ∙ p
m+n≡n→m≡0 {n = suc n} p = m+n≡n→m≡0 (injSuc ((sym (+-suc _ n)) ∙ p))
m+n≡0→m≡0×n≡0 : m + n ≡ 0 → (m ≡ 0) × (n ≡ 0)
m+n≡0→m≡0×n≡0 {zero} = refl ,_
m+n≡0→m≡0×n≡0 {suc m} p = ⊥.rec (snotz p)
-- Arithmetic facts about ·
0≡m·0 : ∀ m → 0 ≡ m · 0
0≡m·0 zero = refl
0≡m·0 (suc m) = 0≡m·0 m
·-suc : ∀ m n → m · suc n ≡ m + m · n
·-suc zero n = refl
·-suc (suc m) n
= cong suc
( n + m · suc n ≡⟨ cong (n +_) (·-suc m n) ⟩
n + (m + m · n) ≡⟨ +-assoc n m (m · n) ⟩
(n + m) + m · n ≡⟨ cong (_+ m · n) (+-comm n m) ⟩
(m + n) + m · n ≡⟨ sym (+-assoc m n (m · n)) ⟩
m + (n + m · n) ∎
)
·-comm : ∀ m n → m · n ≡ n · m
·-comm zero n = 0≡m·0 n
·-comm (suc m) n = cong (n +_) (·-comm m n) ∙ sym (·-suc n m)
·-distribʳ : ∀ m n o → (m · o) + (n · o) ≡ (m + n) · o
·-distribʳ zero _ _ = refl
·-distribʳ (suc m) n o = sym (+-assoc o (m · o) (n · o)) ∙ cong (o +_) (·-distribʳ m n o)
·-distribˡ : ∀ o m n → (o · m) + (o · n) ≡ o · (m + n)
·-distribˡ o m n = (λ i → ·-comm o m i + ·-comm o n i) ∙ ·-distribʳ m n o ∙ ·-comm (m + n) o
·-assoc : ∀ m n o → m · (n · o) ≡ (m · n) · o
·-assoc zero _ _ = refl
·-assoc (suc m) n o = cong (n · o +_) (·-assoc m n o) ∙ ·-distribʳ n (m · n) o
·-identityˡ : ∀ m → 1 · m ≡ m
·-identityˡ m = +-zero m
·-identityʳ : ∀ m → m · 1 ≡ m
·-identityʳ zero = refl
·-identityʳ (suc m) = cong suc (·-identityʳ m)
0≡n·sm→0≡n : 0 ≡ n · suc m → 0 ≡ n
0≡n·sm→0≡n {n = zero} p = refl
0≡n·sm→0≡n {n = suc n} p = ⊥.rec (znots p)
inj-·sm : l · suc m ≡ n · suc m → l ≡ n
inj-·sm {zero} {m} {n} p = 0≡n·sm→0≡n p
inj-·sm {l} {m} {zero} p = sym (0≡n·sm→0≡n (sym p))
inj-·sm {suc l} {m} {suc n} p = cong suc (inj-·sm (inj-m+ {m = suc m} p))
inj-sm· : suc m · l ≡ suc m · n → l ≡ n
inj-sm· {m} {l} {n} p = inj-·sm (·-comm l (suc m) ∙ p ∙ ·-comm (suc m) n)
-- Arithmetic facts about ∸
zero∸ : ∀ n → zero ∸ n ≡ zero
zero∸ zero = refl
zero∸ (suc _) = refl
∸-cancelˡ : ∀ k m n → (k + m) ∸ (k + n) ≡ m ∸ n
∸-cancelˡ zero = λ _ _ → refl
∸-cancelˡ (suc k) = ∸-cancelˡ k
∸-cancelʳ : ∀ m n k → (m + k) ∸ (n + k) ≡ m ∸ n
∸-cancelʳ m n k = (λ i → +-comm m k i ∸ +-comm n k i) ∙ ∸-cancelˡ k m n
∸-distribʳ : ∀ m n k → (m ∸ n) · k ≡ m · k ∸ n · k
∸-distribʳ m zero k = refl
∸-distribʳ zero (suc n) k = sym (zero∸ (k + n · k))
∸-distribʳ (suc m) (suc n) k = ∸-distribʳ m n k ∙ sym (∸-cancelˡ k (m · k) (n · k))
|
programs/oeis/209/A209982.asm | jmorken/loda | 1 | 178451 | ; A209982: Number of 2 X 2 matrices having all elements in {-n,...,n} and determinant 1.
; 0,20,52,116,180,308,372,564,692,884,1012,1332,1460,1844,2036,2292,2548,3060,3252,3828,4084,4468,4788,5492,5748,6388,6772,7348,7732,8628,8884,9844,10356,10996,11508,12276,12660,13812,14388,15156,15668,16948,17332,18676,19316,20084,20788,22260,22772,24116,24756,25780,26548,28212,28788,30068,30836,31988,32884,34740,35252,37172,38132,39284,40308,41844,42484,44596,45620,47028,47796,50036,50804,53108,54260,55540,56692,58612,59380,61876,62900,64628,65908,68532,69300,71348,72692,74484,75764,78580,79348,81652,83060,84980,86452,88756,89780,92852,94196,96116,97396,100596,101620,104884,106420,107956,109620,113012,114164,117620,118900,121204,122740,126324,127476,130292,132084,134388,136244,139316,140340,143860,145780,148340,150260,153460,154612,158644,160692,163380,164916,169076,170356,173812,175924,178228,180276,184628,186036,190452,191988,194932,197172,201012,202548,206132,208436,211124,213428,218164,219444,224244,226548,229620,231540,235380,236916,241908,244404,247732,249780,254004,255732,260916,263476,266036,268660,273972,275508,280500,282548,286004,288692,294196,295988,299828,302388,306100,308916,314612,316148,321908,324212,328052,330868,335476,337396,342516,345460,348916,351220,357300,359348,365492,368564,371636,374324,380596,382516,388852,391412,395636,398836,404212,406260,411380,414644,418868,421940,427700,429236,435956,439284,443764,447156,452532,454836,460596,464052,468660,471220,477364,479668,486772,489844,493684,497268,504500,506804,514100,516916,520756,524340,531764,534068,539956,543668,548660,551732,559348,561396,569076,572596,577780,581620,586996,589556,596468,600308,605556
mov $2,$0
cal $2,171503 ; Number of 2 X 2 integer matrices with entries from {0,1,...,n} having determinant 1.
mov $0,288429
mov $1,$2
lpb $0
mov $0,$4
mul $1,2
mov $3,$1
cmp $3,0
add $1,$3
lpe
sub $1,1
mul $1,4
|
mips/20-3.asm | ping58972/Computer-Organization-Architecture | 0 | 85649 | ## MIPS Assignment #3
## Ch20-3.asm
## Space Removal
## Registers:
## $8 -- pointer to the original string
## $9 -- pointer to the resulting string
## $10 -- space char
## $11 -- temporary to load char to store to $9
.data
string: .asciiz "Is this a dagger which I see before me?"
.text
.globl main
# Initialize
main: ori $10, $0, 0x20
lui $8, 0x1001 # point at first original string
lui $1, 0x1001 # pointer to the resulting string
ori $9, $1, 0x40
# while not ch==null do
loop:
lbu $11,0($8) # get the char
sll $0,$0,0 # branch delay
# If char == " " skip it.
beq $11, $10, space
sll $0,$0,0 # branch delay
# If char == "\0" end program.
beq $11,$0, done # exit loop if char == null
sll $0,$0,0 # branch delay
sb $11, 0($9)
addi $8, $8, 1 # point at the next original char
addi $9, $9, 1 # point at the next resulting char
j loop
sll $0,$0,0 # branch delay slot
space:
addi $8, $8, 1
j loop
sll $0,$0,0 # branch delay slot
done: sll $0,$0,0 # target for branch
|
gdb/testsuite/gdb.ada/rec_ptype/p.ads | greyblue9/binutils-gdb | 1 | 15561 | <gh_stars>1-10
-- Copyright 2020-2021 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package P is
type Kind_Type is (No_Kind, A_Kind, B_Kind);
type PID_Type is new Integer;
Default_Value : constant PID_Type := 0;
type Name_Type is array (1 ..3) of Character;
Name_Default_Value : constant Name_Type := "AAA";
type Variable_Record_Type(Kind : Kind_Type := No_Kind) is record
case Kind is
when A_Kind =>
Variable_Record_A : PID_Type := Default_Value;
when B_Kind =>
Variable_Record_B : Name_Type := Name_Default_Value;
when No_Kind =>
null;
end case;
end record;
type Complex_Variable_Record_Type (Kind : Kind_Type := No_Kind) is record
Complex_Variable_Record_Variable_Record : Variable_Record_Type(Kind);
end record;
type Top_Level_Record_Type is record
Top_Level_Record_Complex_Record : Complex_Variable_Record_Type;
end record;
end P;
|
linear_algebra/test_matrices.adb | jscparker/math_packages | 30 | 23131 | <filename>linear_algebra/test_matrices.adb
---------------------------------------------------------------------------
-- package body Test_Matrices
-- Copyright (C) 2008-2018 <NAME>.
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------------------------------------------
with Ada.Numerics.Discrete_Random;
--with Ada.Numerics.Generic_Elementary_Functions;
--with Ada.Numerics;
package body Test_Matrices is
Zero : constant Real := +0.0;
Half : constant Real := +0.5;
One : constant Real := +1.0;
Two : constant Real := +2.0;
Gamma : constant Real :=
+0.57721_56649_01532_86060_65120_90082_40243_10421_59335_93992;
Max_Allowed_Real : constant Real := Two ** (Real'Machine_Emax - 20);
--package Math is new Ada.Numerics.Generic_Elementary_Functions(Real);
--use Math;
-- for Random nums:
type Unsigned32 is mod 2**32;
package Discrete_32_bit is new Ada.Numerics.Discrete_Random (Unsigned32);
Random_Stream_id : Discrete_32_bit.Generator;
type Bits_per_Ran is range 1 .. 32;
----------------
-- Symmetrize --
----------------
procedure Symmetrize
(A : in out Matrix)
is
Result : Matrix;
begin
for r in Index loop
for c in Index loop
Result(r,c) := 0.5 * (A(r,c) + A(c,r));
end loop;
end loop;
A := Result;
end Symmetrize;
---------------
-- Transpose --
---------------
procedure Transpose
(A : in out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
tmp : Real;
begin
for r in Starting_Index .. Max_Index-1 loop
for c in r+1 .. Max_Index loop
tmp := A(r, c);
A(r, c) := A(c, r);
A(c, r) := tmp;
end loop;
end loop;
end Transpose;
-----------------
-- Real_Random --
-----------------
-- if you use No_of_Bits = 1, then get 0.5 and 0.0.
-- if you use No_of_Bits = 2, then get 0.75, 0.5, 0.25, 0.0.
function Real_Random (No_of_Bits : Bits_per_Ran) return Real is
N : constant Integer := Integer (No_of_Bits);
begin
return Two**(-N) * Real (Discrete_32_bit.Random (Random_Stream_id) / 2**(32-N));
end Real_Random;
function "+"(M : Matrix; Right : Real) return Matrix is
Result : Matrix;
begin
for r in Index loop
for c in Index loop
Result(r, c) := M(r, c) + Right;
end loop;
end loop;
return Result;
end "+";
----------------
-- Get_Zielke --
----------------
procedure Get_Zielke
(M : out Matrix;
Starting_Index : in Index;
Max_Index : in Index;
Z : in Real)
is
x : constant Real := One;
y : constant Real := Two;
Start : constant Index'Base := Starting_Index;
Finish : constant Index'Base := Max_Index;
M_Order : constant Real := Real (Finish) - Real (Start) + One;
Test : Real;
begin
for i in Start .. Finish loop
for j in Start .. Finish loop
Test := (Real (i) - Real (Start) + One) + (Real (j) - Real (Start) + One);
if i = j then
if Test <= M_Order then
M(i, j) := x + y + z;
elsif Test < Two*M_Order then
M(i, j) := x + z;
else
M(i, j) := x - y + z;
end if;
else
if Test <= M_Order then
M(i, j) := x + y;
else
M(i, j) := x;
end if;
end if;
end loop;
end loop;
end Get_Zielke;
---------------------
-- Get_Companion_B --
---------------------
-- Eigvals are zeros of poly w/ coefficients in 1st Col:
--
-- P(x) = x**n + C(1)*x^(n-1) + .. . + C(n-1)*x^1 + C(n)*x^0
--
-- where
--
-- M(i, Starting_Index) = -C(1+i-Starting_Index)
--
-- with
--
-- i in Starting_Index+0 .. Starting_Index+(n-1)
procedure Get_Companion_B
(M : out Matrix;
Starting_Index : in Index;
Max_Index : in Index;
B : in Real := 1.1892071150027210667175) -- Sqrt_of_Sqrt_of_2
is
Start_I : constant Integer := Integer (Starting_Index);
Exp : Integer;
Pow : constant := 1; -- 1 is stronger than 3.
--Sqrt_of_2 : constant := 1.4142135623730950488017;
begin
M := (others => (others => Zero));
for Row in Starting_Index .. Max_Index-1 loop
M(Row, Row+1) := One;
end loop;
for Row in Starting_Index .. Max_Index loop
Exp := Integer'Min (Integer(Row) - Start_I, Real'Machine_Emax/Pow-9);
M(Row, Starting_Index) := Two - B ** Exp;
end loop;
end Get_Companion_B;
--------------------------
-- Get_Pas_Fib_Rescaled --
--------------------------
procedure Get_Pas_Fib_Rescaled
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
M_max, Scale_Factor : Real;
--Exp : constant Integer := Real'Machine_Emin; -- roughly -1010 usually
--Smallest_Allowed_Real : constant Real := Two**(Exp/2 - Exp/8);
begin
M := (others => (others => One));
if Integer (Max_Index) - Integer (Starting_Index) > 0 then
for Row in Starting_Index+1 .. Max_Index loop
M_max := Zero;
for Col in Starting_Index+1 .. Max_Index loop
M(Row, Col) := M(Row-1, Col-1) + M(Row-1, Col);
if abs M(Row, Col) > M_max then M_max := abs M(Row, Col); end if;
end loop;
-- M_max gets larger each step.
-- Scale the Matrix to peak of about 1:
if M_max > Max_Allowed_Real then
Scale_Factor := One / M_max;
for r in Starting_Index .. Max_Index loop
for c in Starting_Index .. Max_Index loop
M(r, c) := Scale_Factor * M(r, c);
end loop;
end loop;
M_max := One;
end if;
end loop;
end if;
-- for r in M'Range(1) loop
-- for c in M'Range(2) loop
-- if Abs M(r,c) < Smallest_Allowed_Real * M_max then
-- M(r,c) := Smallest_Allowed_Real * M_max;
-- end if;
-- end loop;
-- end loop;
end Get_Pas_Fib_Rescaled;
-------------------------
-- Get_Pascal_Rescaled --
-------------------------
procedure Get_Pascal_Rescaled
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
M_max, Scale_Factor : Real;
--Exp : constant Integer := Real'Machine_Emin; -- roughly -1010 usually
--Smallest_Allowed_Real : constant Real := Two**(Exp/2 - Exp/8);
begin
M := (others => (others => Zero));
for Col in Index loop
M(Col, Col) := One;
end loop;
for Row in Starting_Index .. Max_Index loop
M(Row, Starting_Index) := One;
end loop;
if Integer (Max_Index) - Integer (Starting_Index) > 1 then
for Row in Starting_Index+2 .. Max_Index loop
M_max := Zero;
for Col in Starting_Index+1 .. Row-1 loop
M(Row, Col) := (M(Row-1, Col-1) + M(Row-1, Col));
if abs M(Row, Col) > M_max then M_max := abs M(Row, Col); end if;
end loop;
-- rescale the whole Matrix:
if M_max > Max_Allowed_Real then
Scale_Factor := One / M_max;
for r in Starting_Index .. Max_Index loop
for c in Starting_Index .. Max_Index loop
M(r, c) := Scale_Factor * M(r, c);
end loop;
end loop;
M_max := One;
end if;
end loop;
end if;
-- for r in M'Range(1) loop
-- for c in M'Range(2) loop
-- if Abs M(r,c) < Smallest_Allowed_Real * M_max then
-- M(r,c) := Smallest_Allowed_Real * M_max;
-- end if;
-- end loop;
-- end loop;
end Get_Pascal_Rescaled;
-----------------
-- Get_Redheff --
-----------------
procedure Get_Redheff
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
function I_divides_J (I, J : Integer) return Boolean is
begin
if (J / I) * I = J then
return True;
else
return False;
end if;
end I_divides_J;
i, j : Integer;
begin
M := (others => (others => Zero));
for r in Starting_Index .. Max_Index loop
for c in Starting_Index .. Max_Index loop
i := Integer (c) - Integer (Starting_Index) + 1;
j := Integer (r) - Integer (Starting_Index) + 1;
if I_divides_J (i, j) or j = 1 then
M(r, c) := One;
else
M(r, c) := Zero;
end if;
end loop;
end loop;
end Get_Redheff;
------------------
-- Get_Sampling --
------------------
procedure Get_Sampling
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last;
Basic : in Boolean := True)
is
Denom, Sum : Real;
X : array (Index) of Real := (others => Zero);
Half_Way : constant Integer := (Integer(Max_Index) - Integer(Starting_Index)) / 2;
Emin : constant Integer := Real'Machine_Emin;
Min_Allowed_Real : constant Real := Two ** (Emin - Emin/16);
begin
M := (others => (others => Zero));
if Basic then
for i in Starting_Index .. Max_Index loop
X(i) := Real (i) - Real (Starting_Index) + One;
end loop;
else
X(Starting_Index) := Two ** Integer'Min (Half_Way, Abs (Emin) - 2);
for i in Starting_Index+1 .. Max_Index loop
if X(i-1) > Min_Allowed_Real then
X(i) := X(i-1) * Half;
else
X(i) := X(i-1) * 701.0; -- prevent 0's in extreme limit
end if;
end loop;
end if;
for r in Starting_Index .. Max_Index loop
for c in Starting_Index .. Max_Index loop
Denom := X(r) - X(c);
if Abs Denom < Min_Allowed_Real then Denom := Min_Allowed_Real; end if;
if r /= c then
M(r, c) := X(r) / Denom;
end if;
end loop;
end loop;
for c in Starting_Index .. Max_Index loop
Sum := Zero;
for r in Starting_Index .. Max_Index loop
if r /= c then
Sum := Sum + M(r, c);
end if;
end loop;
M(c, c) := Sum;
end loop;
end Get_Sampling;
------------------
-- Get_Laguerre --
------------------
-- Eig(i) = (-1)**(i-1) / (i-1)!
-- Upper triangular(???), so Eigs are just diagonal elements.
-- Notice the TRANSPOSE at end
procedure Get_Laguerre
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
--N : Index'Base := Max_Index - Starting_Index + 1;
--Scale : Real := Two ** (- Integer(N) / 16);
i, j : Integer;
begin
M := (others => (others => Zero));
M(Starting_Index, Starting_Index) := One;
if Max_Index = Starting_Index then
return;
end if;
M(Starting_Index+1, Starting_Index) := One;
M(Starting_Index+1, Starting_Index+1) := -One;
if Max_Index = Starting_Index+1 then
return;
end if;
for r in Starting_Index+2 .. Max_Index loop
for c in Starting_Index .. Max_Index loop
i := Integer (r) - Integer (Starting_Index) + 1;
j := Integer (c) - Integer (Starting_Index) + 1;
if j = 1 then
M(r,c) := (Real (2*i - 3) * M(r-1,c)
- Real ( i - 2) * M(r-2,c))
/ Real ( i - 1);
else
M(r,c) := (Real (2*i - 3) * M(r-1,c) - M(r-1,c-1)
- Real ( i - 2) * M(r-2,c))
/ Real ( i - 1);
end if;
--if Abs M(r,c) < Two ** (Real'Machine_Emin - Real'Machine_Emin / 8) then
-- M(r,c) := Zero;
--end if;
end loop;
end loop;
Transpose (M);
end Get_Laguerre;
----------------
-- Get_Lotkin --
----------------
procedure Get_Lotkin
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
i, j : Integer;
Denominator : Real;
Prime_Factors : constant Real := (+166966608033225.0)*(+580027.0) * Two**(-68);
begin
M := (others => (others => Zero));
-- Prime_Factors=3.0*3.0*3.0*5.0*5.0*7.0*11.0*13.0*17.0*19.0*23.0*29.0*31.0*37.0;
-- so Prime_Factors / D is exactly represented in 15 digit floating point
-- up to D = 39 (allowing an 20x20 matrix). Prime_Factors = 166966608033225.0
-- Prime_Factors := +166966608033225.0 * Two**(-47); -- bring it near to One
for r in Starting_Index .. Index'Last loop
for c in Starting_Index .. Index'Last loop
i := Integer (r) - Integer (Starting_Index) + 1;
j := Integer (c) - Integer (Starting_Index) + 1;
Denominator := Real(i + j) - One;
M(r, c) := Prime_Factors / Denominator;
end loop;
end loop;
for r in Starting_Index .. Max_Index loop
M(r, Starting_Index) := One;
end loop;
end Get_Lotkin;
-----------------
-- Get_Hilbert --
-----------------
procedure Get_Hilbert
(M : out Matrix;
Starting_Index : in Index := Index'First)
is
i, j : Integer;
Denominator : Real;
Prime_Factors : constant Real := (+166966608033225.0)*(+580027.0) * Two**(-68);
begin
M := (others => (others => Zero));
-- Prime_Factors=3.0*3.0*3.0*5.0*5.0*7.0*11.0*13.0*17.0*19.0*23.0*29.0*31.0*37.0;
-- so Prime_Factors / D is exactly represented in 15 digit floating point
-- up to D = 39 (allowing an 20x20 matrix). Prime_Factors = 166966608033225.0
-- Prime_Factors := +166966608033225.0 * Two**(-47); -- bring it near to One
for r in Starting_Index .. Index'Last loop
for c in Starting_Index .. Index'Last loop
i := Integer (r) - Integer (Starting_Index) + 1;
j := Integer (c) - Integer (Starting_Index) + 1;
Denominator := Real(i + j) - One;
M(r, c) := Prime_Factors / Denominator;
end loop;
end loop;
end Get_Hilbert;
-------------------
-- Get_Ding_Dong --
-------------------
procedure Get_Ding_Dong
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
i, j : Integer;
Denominator : Real;
begin
M := (others => (others => Zero));
for r in Starting_Index .. Index'Last loop
for c in Starting_Index .. Index'Last loop
i := Integer (r) - Integer (Starting_Index) + 1;
j := Integer (c) - Integer (Starting_Index) + 1;
-- Can use Prime_Factors := 166966608033225.0 * Two**(-47) to
-- bring it near exact integer elements, but lose the Pi valued eigs.
Denominator := (Real (Max_Index) - Real (Starting_Index) + One) - Real (i + j) + 1.5;
M(r, c) := One / Denominator;
end loop;
end loop;
end Get_Ding_Dong;
-----------------
-- Get_Gregory --
-----------------
procedure Get_Gregory
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
i, j : Integer;
begin
M := (others => (others => Zero));
for r in Starting_Index .. Max_Index loop
for c in Starting_Index .. Max_Index loop
i := Integer (r) - Integer (Starting_Index) + 1;
j := Integer (c) - Integer (Starting_Index) + 1;
if r = Max_Index then
M(r,c) := Real (j);
elsif c = Max_Index then
M(r,c) := Real (i);
elsif r = c then
M(r,c) := One;
end if;
end loop;
end loop;
end Get_Gregory;
---------------
-- Get_Chow3 --
---------------
-- full rather than lower Hessenberg. Non-Symmetric.
procedure Get_Chow3
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last;
Alpha : in Real := Gamma) -- 1.0 is harder
is
i_r, j_c : Integer;
begin
M := (others => (others => Zero));
-- lower Hessenberg (r+1 >= c)
for r in Starting_Index .. Max_Index loop
for c in Starting_Index .. Max_Index loop
i_r := Integer (r) - Integer (Starting_Index) + 1;
j_c := Integer (c) - Integer (Starting_Index) + 1;
M(r, c) := Alpha ** (i_r + 1 - j_c);
if Abs M(r,c) < Two ** (Real'Machine_Emin - Real'Machine_Emin / 8) then
M(r, c) := Zero;
end if;
end loop;
end loop;
declare
Beta : constant Real := Zero;
begin
for r in Starting_Index .. Max_Index loop
M(r, r) := M(r, r) + Beta;
end loop;
end;
end Get_Chow3;
--------------
-- Get_Chow --
--------------
-- Described by <NAME>; has eigs 4*alpha*cos(k*pi/(n+2))^2
-- and Floor [N / 2] zeros (if no diagonal addends).
procedure Get_Chow
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last;
Alpha : in Real := One;
Beta : in Real := Zero)
is
i, j : Integer;
begin
M := (others => (others => Zero));
-- lower Hessenberg (r+1 >= c)
for c in Starting_Index .. Max_Index loop
for r in Starting_Index .. Max_Index loop
i := Integer (r) - Integer (Starting_Index) + 1;
j := Integer (c) - Integer (Starting_Index) + 1;
if i + 1 >= j then
M(r, c) := Alpha ** (i + 1 - j);
end if;
if Abs M(r,c) < Two ** (Real'Machine_Emin - Real'Machine_Emin / 8) then
M(r, c) := Zero;
end if;
end loop;
end loop;
for r in Starting_Index .. Max_Index loop
M(r, r) := M(r, r) + Beta;
--M(r, r) := M(r, r) + 2.0**32;
end loop;
end Get_Chow;
----------------
-- Get_Lehmer --
----------------
procedure Get_Lehmer
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
i, j : Integer;
begin
M := (others => (others => Zero));
for r in Starting_Index .. Max_Index loop
for c in Starting_Index .. Max_Index loop
i := Integer (r) - Integer (Starting_Index) + 1;
j := Integer (c) - Integer (Starting_Index) + 1;
M(r, c) := Real (Integer'Min (i, j)) / Real (Integer'Max (i, j));
end loop;
end loop;
end Get_Lehmer;
--------------
-- Get_Lesp --
--------------
-- From <NAME>:
--
-- The eigenvalues are real, and smoothly distributed in [-2*N-3.5, -4.5].
--
-- The eigenvalues are sensitive.
--
-- The matrix is similar to the symmetric tridiagonal matrix with
-- the same diagonal entries and with off-diagonal entries 1,
-- via a similarity transformation using the diagonal matrix
-- D = diagonal ( 1!, 2!, .. ., N! ).
--
procedure Get_Lesp
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
i, j : Integer;
begin
M := (others => (others => Zero));
for r in Starting_Index .. Max_Index loop
for c in Starting_Index .. Max_Index loop
i := Integer (r) - Integer (Starting_Index) + 1;
j := Integer (c) - Integer (Starting_Index) + 1;
if (i - j) = 1 then
M(r, c) := One / Real (i);
elsif i = j then
M(r, c) := -Real (2*i + 3);
elsif (i - j) = -1 then
M(r, c) := Real (j);
else
M(r, c) := Zero;
end if;
end loop;
end loop;
Transpose (M);
end Get_Lesp;
----------------
-- Get_Trench --
----------------
procedure Get_Trench
(M : out Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last;
Alpha : in Real)
is
i, j : Integer;
begin
M := (others => (others => Zero));
for r in Starting_Index .. Max_Index loop
for c in Starting_Index .. Max_Index loop
i := Integer (r) - Integer (Starting_Index) + 1;
j := Integer (c) - Integer (Starting_Index) + 1;
if i = j then
M(r, c) := Alpha;
else
M(r, c) := Two ** (-Abs (i - j) - 1);
end if;
end loop;
end loop;
end Get_Trench;
-----------------
-- Init_Matrix --
-----------------
procedure Init_Matrix
(M : out Matrix;
Desired_Matrix : in Matrix_Id := Easy_Matrix;
Starting_Index : in Index := Index'First;
Max_Index : in Index := Index'Last)
is
A, OffFactor : Real;
begin
if Max_Index <= Starting_Index then
raise Constraint_Error with "Can't have Max_Index <= Starting_Index";
end if;
M := (others => (others => Zero)); --essential init.
--the 0.0 is essential.
case Desired_Matrix is
when Laguerre =>
Get_Laguerre (M, Starting_Index, Max_Index);
when Lesp =>
Get_Lesp (M, Starting_Index, Max_Index);
when Lehmer =>
Get_Lehmer (M, Starting_Index, Max_Index);
when Chow =>
Get_Chow (M, Starting_Index, Max_Index, One, Zero);
when Chow1 =>
Get_Chow (M, Starting_Index, Max_Index, -1.05, Zero);
when Chow2 =>
Get_Chow (M, Starting_Index, Max_Index, Gamma, -One);
when Chow3 =>
Get_Chow3 (M, Starting_Index, Max_Index, 1.05);
when Redheff =>
Get_Redheff (M, Starting_Index, Max_Index);
when Sampling =>
Get_Sampling (M, Starting_Index, Max_Index);
when Sampling_1 =>
Get_Sampling (M, Starting_Index, Max_Index, False);
when Gregory =>
Get_Gregory (M, Starting_Index, Max_Index);
when Anti_Hadamard_Upper_Tri =>
M := (others => (others => Zero)); --essential init.
for Col in Index'First+1 .. Index'Last loop
for Row in Index'First .. Col-1 loop
if ((Integer(Col) + Integer(Row)) mod 2) = 1 then
M(Row, Col) := One;
else
M(Row, Col) := Zero;
end if;
end loop;
end loop;
for Col in Index loop
M(Col, Col) := One;
end loop;
M := M + Matrix_Addend;
when Anti_Hadamard_Lower_Tri =>
M := (others => (others => Zero)); --essential init.
for Col in Index'First .. Index'Last-1 loop
for Row in Col+1 .. Index'Last loop
if ((Integer(Col) + Integer(Row)) mod 2) = 1 then
M(Row, Col) := One;
else
M(Row, Col) := Zero;
end if;
end loop;
end loop;
for Col in Index loop
M(Col, Col) := One;
end loop;
M := M + Matrix_Addend;
when Symmetric_Banded =>
OffFactor := 2.101010101;
for I in Index loop
M(I, I) := One;
end loop;
declare Col : Index; begin
for BottomDiagonal in Starting_Index+1 .. Index'Last loop
for Row in BottomDiagonal .. Index'Last loop
Col := Index (Integer(Row) - Integer(BottomDiagonal) + Integer(Starting_Index));
M(Row, Col) :=
OffFactor * (Real(BottomDiagonal) - Real(Starting_Index) + 1.0);
end loop;
end loop;
end;
for Row in Starting_Index+1 .. Index'Last loop
for Col in Starting_Index .. Row-1 loop
M(Col, Row) := M(Row, Col);
end loop;
end loop;
when Easy_Matrix =>
OffFactor := 0.10101010101;
for I in Index loop
M(I, I) := 1.010101010101;
end loop;
declare Col : Index; begin
for BottomDiagonal in Starting_Index+1 .. Index'Last loop
for Row in BottomDiagonal .. Index'Last loop
Col := Index (Integer(Row) - Integer(BottomDiagonal) + Integer(Starting_Index));
M(Row, Col)
:= 0.031 * (Real(Row) - Real(Starting_Index) + One) / Real(Max_Index)
+ OffFactor / (Real(BottomDiagonal) - Real(Starting_Index));
end loop;
end loop;
end;
for Row in Starting_Index+1 .. Index'Last loop
for Col in Starting_Index .. Row-1 loop
M(Col, Row) := M(Row, Col) + 0.333;
end loop;
end loop;
when Small_Diagonal =>
OffFactor := 101010.01;
for I in Index loop
M(I, I) := 0.01010101010101010101;
end loop;
declare Col : Index; begin
for BottomDiagonal in Starting_Index+1 .. Index'Last loop
for Row in BottomDiagonal .. Index'Last loop
Col := Index (Integer(Row) - Integer(BottomDiagonal) + Integer(Starting_Index));
M(Row, Col)
:= 0.013 * (Real(Row) - Real(Starting_Index) + 1.0) / Real(Max_Index)
+ OffFactor / (Real(BottomDiagonal) - Real (Starting_Index));
end loop;
end loop;
end;
for Row in Starting_Index+1 .. Index'Last loop
for Col in Starting_Index .. Row-1 loop
M(Col, Row) := M(Row, Col) + 0.333; -- the 333 illconditions it
end loop;
end loop;
when Pascal_Col_Scaled =>
Get_Pascal_Rescaled (M, Starting_Index, Max_Index);
declare
Max, Scaling : Real;
Exp : Integer;
Col_Norm : array(Index) of Real;
begin
for Col in Starting_Index .. Max_Index loop
Max := Zero;
for Row in Starting_Index .. Max_Index loop
if not M(Row, Col)'Valid then raise constraint_error; end if;
if Abs M(Row, Col) > Max then Max := Abs M(Row, Col); end if;
end loop;
Col_Norm(Col) := Max;
end loop;
for Col in Starting_Index .. Max_Index loop
Exp := Real'Exponent (Col_Norm(Col));
if Exp < Real'Machine_Emin then
Exp := Real'Machine_Emin + 16;
elsif Exp > Real'Machine_Emax then
Exp := Real'Machine_Emax - 16;
end if;
Scaling := Two ** (-Exp);
for Row in Starting_Index .. Max_Index loop
M(Row, Col) := M(Row, Col) * Scaling;
end loop;
end loop;
end;
M := M + Matrix_Addend;
when Pascal_Row_Scaled =>
Get_Pascal_Rescaled (M, Starting_Index, Max_Index);
declare
Max, Scaling : Real;
Exp : Integer;
Row_Norm : array(Index) of Real := (others => Zero);
begin
for Row in Starting_Index .. Max_Index loop
Max := Zero;
for Col in Starting_Index .. Max_Index loop
if not M(Row, Col)'Valid then raise constraint_error; end if;
if Abs M(Row, Col) > Max then Max := Abs M(Row, Col); end if;
end loop;
Row_Norm(Row) := Max;
end loop;
for Row in Starting_Index .. Max_Index loop
Exp := Real'Exponent (Row_Norm(Row));
if Exp < Real'Machine_Emin then
Exp := Real'Machine_Emin + 16;
elsif Exp > Real'Machine_Emax then
Exp := Real'Machine_Emax - 16;
end if;
Scaling := Two ** (-Exp);
for Col in Starting_Index .. Max_Index loop
M(Row, Col) := M(Row, Col) * Scaling;
end loop;
end loop;
end;
M := M + Matrix_Addend;
when Pas_Fib =>
Get_Pas_Fib_Rescaled (M, Starting_Index, Max_Index);
when Pascal_Symmetric =>
Get_Pascal_Rescaled (M, Starting_Index, Max_Index);
for Row in Starting_Index .. Max_Index-1 loop
for Col in Row+1 .. Max_Index loop
M(Row, Col) := M(Col, Row);
end loop;
end loop;
when Pascal =>
Get_Pascal_Rescaled (M, Starting_Index, Max_Index);
M := M + Matrix_Addend;
when Forsythe_Symmetric =>
M := (others => (others => Zero));
A := Two**(-8);
for I in Index loop
M(I, I) := A;
end loop;
for Col in Starting_Index+1 .. Index'Last loop
M(Col, Col-1) := One;
end loop;
for Col in Starting_Index+1 .. Index'Last loop
M(Col-1, Col) := One;
end loop;
M(Index'First, Max_Index) := One;
M(Max_Index, Index'First) := One;
when Forsythe_0 =>
M := (others => (others => Zero));
A := Zero;
for I in Index loop
M(I, I) := A;
end loop;
for Col in Starting_Index+1 .. Index'Last loop
M(Col-1, Col) := One;
end loop;
M(Max_Index, Starting_Index) := One;
when Forsythe_1 =>
M := (others => (others => Zero));
A := Two**(0);
for I in Index loop
M(I, I) := A;
end loop;
for Col in Starting_Index+1 .. Index'Last loop
M(Col-1, Col) := One;
end loop;
M(Max_Index, Starting_Index) := One;
when Zero_Diagonal =>
M := (others => (others => Zero));
--for I in Index loop
-- M(I, I) := Two**(-63);
--end loop;
for Col in Starting_Index+1 .. Index'Last loop
M(Col-1, Col) := One;
end loop;
for Col in Starting_Index .. Index'Last-1 loop
M(Col+1, Col) := One;
end loop;
when Ring_Adjacency_0 =>
M := (others => (others => Zero));
M(Starting_Index, Max_Index) := One;
M(Max_Index, Starting_Index) := One;
for Col in Starting_Index+1 .. Max_Index loop
M(Col-1, Col) := One;
end loop;
for Col in Starting_Index .. Max_Index-1 loop
M(Col+1, Col) := One;
end loop;
when Ring_Adjacency_1 =>
M := (others => (others => Zero));
M(Starting_Index, Max_Index) := One;
M(Max_Index, Starting_Index) := -One;
for Col in Starting_Index+1 .. Max_Index loop
M(Col-1, Col) := One;
end loop;
for Col in Starting_Index .. Max_Index-1 loop
M(Col+1, Col) := One;
end loop;
when Wilkinson_Plus_2I =>
declare
Mid : constant Real := Half * (Real (Max_Index) - Real (Starting_Index) + One);
begin
for I in Index loop
M(I, I) := Abs (Mid - (Real (I) - Real (Starting_Index))) + Two;
end loop;
end;
for Col in Index'First+1 .. Index'Last loop
M(Col-1, Col) := One;
end loop;
for Col in Index'First .. Index'Last-1 loop
M(Col+1, Col) := One;
end loop;
when Wilkinson_Plus =>
declare
Mid : constant Real := Half * (Real (Max_Index) - Real (Starting_Index) + One);
begin
for I in Index loop
M(I, I) := Abs (Mid - (Real (I) - Real (Starting_Index)));
end loop;
end;
for Col in Index'First+1 .. Index'Last loop
M(Col-1, Col) := One;
end loop;
for Col in Index'First .. Index'Last-1 loop
M(Col+1, Col) := One;
end loop;
when Wilkinson_Minus =>
declare
Mid : constant Real := Half * (Real (Max_Index) - Real (Starting_Index) + One);
begin
for I in Index loop
M(I, I) := Mid - (Real (I) - Real (Starting_Index));
end loop;
end;
for Col in Index'First+1 .. Index'Last loop
M(Col-1, Col) := One;
end loop;
for Col in Index'First .. Index'Last-1 loop
M(Col+1, Col) := One;
end loop;
when QR_Test =>
for Col in Starting_Index+1 .. Index'Last loop
M(Col-1, Col) := One;
end loop;
for Col in Starting_Index .. Index'Last-1 loop
M(Col+1, Col) := One;
end loop;
if Index'Last > Starting_Index+1 then
for i in Starting_Index .. Index'Last-1 loop
if (Integer (i) - Integer (Starting_Index)) mod 4 = 1 then
M(i, i+1) := -320.0 * Real'Epsilon;
M(i+1, i) := 320.0 * Real'Epsilon;
end if;
end loop;
end if;
when Upper_Ones =>
for Row in Starting_Index .. Index'Last loop
for Col in Row .. Index'Last loop
M(Row, Col) := One;
end loop;
end loop;
for Col in Starting_Index .. Index'Last loop
M(Col, Col) := One;
end loop;
M := M + Matrix_Addend;
when Lower_Ones =>
for Row in Starting_Index .. Index'Last loop
for Col in Row .. Index'Last loop
M(Col, Row) := One;
end loop;
end loop;
for Col in Starting_Index .. Index'Last loop
M(Col, Col) := One;
end loop;
M := M + Matrix_Addend;
when Lower_Integers =>
for Row in Starting_Index .. Index'Last loop
for Col in Row .. Index'Last loop
M(Col, Row) := One;
end loop;
end loop;
for Col in Starting_Index .. Index'Last loop
M(Col, Col) := Real (Col) - Real (Starting_Index) + One;
end loop;
M := M + Matrix_Addend;
when Zero_Cols_and_Rows =>
M := (others => (others => Zero));
if Real (Starting_Index) + Two <= Real (Max_Index) then
for Row in Starting_Index+2 .. Max_Index loop
for Col in Row .. Max_Index loop
M(Col, Row) := One;
end loop;
end loop;
end if;
M := M + Matrix_Addend;
when Frank_0 => -- upper Hessenberg
-- order > 2:
-- Max_Index - Starting_Index + 1 > 2
for Row in Starting_Index .. Max_Index loop
for Col in Starting_Index .. Max_Index loop
M(Row, Col) := Real (Max_Index) - Real (Starting_Index) + One
- (Real (Col) - Real (Starting_Index));
end loop;
end loop;
for Col in Starting_Index .. Max_Index-2 loop
for Row in Col+2 .. Max_Index loop
M(Row, Col) := Zero;
end loop;
end loop;
for Row in Starting_Index+1 .. Max_Index loop
M(Row, Row-1) := M(Row-1, Row);
end loop;
M := M + Matrix_Addend;
when Frank_1 => -- upper Hessenberg
declare
i, j : Real;
begin
for Row in Starting_Index .. Max_Index loop
for Col in Starting_Index .. Max_Index loop
i := Real (Row) - Real (Starting_Index) + 1.0;
j := Real (Col) - Real (Starting_Index) + 1.0;
M(Row, Col) := Real (Max_Index) - Real (Starting_Index) + 1.0
- (Real'Min (i, j) - 1.0);
end loop;
end loop;
for Col in Index'Base (Starting_Index) .. Index'Base (Max_Index)-2 loop
for Row in Col+2 .. Max_Index loop
M(Row, Col) := Zero;
end loop;
end loop;
end;
M := M + Matrix_Addend;
when Frank_2 =>
for Row in Starting_Index .. Index'Last loop
for Col in Starting_Index .. Index'Last loop
M(Row, Col) := Real(Index'Min(Col,Row)) - Real(Starting_Index) + One;
end loop;
end loop;
when Moler =>
for Row in Starting_Index .. Index'Last loop
for Col in Starting_Index .. Index'Last loop
M(Row, Col) := (Real(Index'Min(Col,Row)) - Real(Starting_Index) - One);
end loop;
end loop;
for Col in Starting_Index .. Index'Last loop
M(Col, Col) := (Real(Col) - Real(Starting_Index) + One);
end loop;
when Random_32_bit =>
Discrete_32_bit.Reset (Random_Stream_id);
for Row in Starting_Index .. Max_Index loop
for Col in Starting_Index .. Max_Index loop
M(Row, Col) := Real_Random(32);
end loop;
end loop;
when Random_1_bit_anti =>
Discrete_32_bit.Reset (Random_Stream_id);
for Row in Starting_Index .. Index'Last loop
for Col in Starting_Index .. Row loop
M(Row, Col) := Real_Random(1) - Half;
end loop;
end loop;
for Row in Starting_Index .. Index'Last loop
for Col in Row .. Index'Last loop
M(Row, Col) := -M(Col, Row);
end loop;
end loop;
for Row in Index loop
M(Row, Row) := Zero;
end loop;
when Random_1_bit =>
Discrete_32_bit.Reset (Random_Stream_id);
for Row in Starting_Index .. Max_Index loop
for Col in Starting_Index .. Max_Index loop
M(Row, Col) := Real_Random(1) - Half;
end loop;
end loop;
when Ding_Dong =>
Get_Ding_Dong (M, Starting_Index, Max_Index);
when Clustered =>
Clustered_Eigs:
declare
Value : Real := One;
begin
for Row in Starting_Index .. Max_Index loop
for Col in Starting_Index .. Max_Index loop
M(Row, Col) := Value;
Value := Value + One;
end loop;
end loop;
end Clustered_Eigs;
when Hilbert =>
Get_Hilbert (M, Starting_Index);
when Lotkin =>
Get_Lotkin (M, Starting_Index, Max_Index);
when Fiedler_0 =>
declare
C : array(Index) of Real;
Length : constant Real := (Real (Max_Index) - Real (Starting_Index) + One);
Scale : constant Real := Two**(-Real'Exponent (Length) + 8);
begin
for i in Starting_Index .. Max_Index loop
C(i) := Scale / (Real(i) - Real(Starting_Index) + One)**2;
end loop;
for Row in Starting_Index .. Max_Index loop
for Col in Starting_Index .. Max_Index loop
M(Col, Row) := Abs (C(Row) - C(Col));
end loop;
end loop;
end;
when Fiedler_1 => -- not Fiedler's matrix
M := (others => (others => Zero));
declare
C : array(Index) of Real;
Alpha : constant Real := One;
begin
for i in Starting_Index .. Max_Index loop
C(i) := Real(i) - Real(Starting_Index) + One;
end loop;
for Row in Starting_Index .. Max_Index loop
for Col in Starting_Index .. Row loop
M(Row, Col) := Abs (C(Row) - C(Col));
M(Col, Row) := Alpha;
end loop;
end loop;
-- for Col in Starting_Index .. Max_Index loop
-- M(Col, Col) := 1.0e-5;
-- end loop;
end;
when U_Hard =>
-- hard on calculation of U, V
M := (others => (others => One));
for Col in Index loop
--M(Starting_Index, Col) := Zero;
M(Col, Starting_Index) := Zero;
end loop;
when Companion_2 =>
-- Eigvals are zeros of poly w/ coefficients in Final Row of M:
-- P(x) = x**n - M(n-1)*x**(n-1) - .. . - M(0)
-- where M(i) = M(Max_Index, Starting_Index + i).
-- Eig_Vectors are (1, lambda, lambda^2, .. . lambda^(n-1)).
-- M is not diagonizable if there exist multiple roots.
Get_Companion_2:
declare
Start_I : constant Integer := Integer (Starting_Index);
Exp, Exp0 : Integer;
Pow : constant := 3;
begin
M := (others => (others => Zero));
for Row in Starting_Index .. Max_Index-1 loop
M(Row, Row+1) := One;
end loop;
for Col in Starting_Index .. Max_Index loop
Exp0 := Integer (Max_Index) - Integer (Col) + Integer (Starting_Index);
Exp := Integer'Min (Exp0 - Start_I, Real'Machine_Emax/Pow-9);
M(Max_Index, Col) := Two - 1.01**Exp;
end loop;
end Get_Companion_2;
when Companion_1 =>
--Sqrt_of_2 : constant := 1.4142135623730950488017;
--Sqrt_of_Sqrt_of_2 : constant := 1.1892071150027210667175;
--
-- Uses default: B := Sqrt_of_Sqrt_of_2
Get_Companion_B (M, Starting_Index, Max_Index, 1.0625);
when Companion_0 =>
-- Eigvals are zeros of poly w/ coefficients in 1st Col:
--
-- P(x) = x**n + C(1)*x^(n-1) + .. . + C(n-1)*x^1 + C(n)*x^0
--
-- where
--
-- M(i, Starting_Index) = -C(1+i-Starting_Index)
--
-- with
--
-- i in Starting_Index+0 .. Starting_Index+(n-1)
Get_Companion_0:
declare
C : Array (Index) of Real := (others => Zero);
begin
M := (others => (others => Zero));
for i in Index loop
C(i) := Real (i) - Real (Starting_Index) - One;
end loop;
for r in Index loop
M(r, Starting_Index) := -C(r);
end loop;
for r in Index'First .. Index'Last-1 loop
M(r, r+1) := One;
end loop;
end Get_Companion_0;
when Companion =>
-- eigvals are zeros of poly w/ coefficients in 1st Col:
-- P(x) = x**n + M(1)*x**(n-1) + .. . + M(n)
-- here M = n, n-1, .. .
Get_Companion:
begin
M := (others => (others => Zero));
for r in Starting_Index .. Max_Index-1 loop
M(r, r+1) := One;
end loop;
for r in Starting_Index .. Max_Index loop
M(r, Starting_Index) := One/Real(-Integer(r)+Integer(Starting_Index)-1)**5;
end loop;
end Get_Companion;
when Gear_0 =>
M := (others => (others => Zero));
for Col in Index'First .. Index'Last-1 loop
M(Col+1, Col) := One;
end loop;
for Col in Index'First+1 .. Index'Last loop
M(Col-1, Col) := One;
end loop;
M(Max_Index, Starting_Index) := -(One + Two**(-8));
M(Starting_Index, Max_Index) := (One + Two**(-8));
-- the "-" makes it almost singular if M = One
when Gear_1 =>
M := (others => (others => Zero));
for Col in Index'First .. Index'Last-1 loop
M(Col+1, Col) := One;
end loop;
for Col in Index'First+1 .. Index'Last loop
M(Col-1, Col) := One;
end loop;
M(Max_Index, Starting_Index) := -One;
M(Starting_Index, Max_Index) := One;
-- the "-" makes it almost singular if M = One
when Fibonacci =>
-- golden mean eigval p = (1+sqrt(5))/2 (all same val); maximally defective;
-- Has eigenvalue p with eigenvector (1, p, p^2, .. ., p^(N-1)).
M := (others => (others => Zero));
for Col in Index loop
M(Col, Col) := One;
end loop;
for Col in Index'First .. Index'Last-1 loop
M(Col+1, Col) := One;
end loop;
M(Starting_Index, Starting_Index) := Zero;
M(Starting_Index, Starting_Index+1) := One;
M := M + Matrix_Addend;
when Peters => -- one small eig., lower triangular
for Col in Starting_Index .. Max_Index loop
for Row in Starting_Index .. Col loop
M(Col, Row) := -One;
end loop;
end loop;
for Col in Index loop
M(Col, Col) := One;
end loop;
M := M + Matrix_Addend;
when Peters_0 => -- one small eig., upper triangular, defeats Gauss. Elim.
for Col in Starting_Index .. Max_Index loop
for Row in Starting_Index .. Col loop
M(Row, Col) := -One;
end loop;
end loop;
for Col in Index loop
M(Col, Col) := One;
end loop;
M := M + Matrix_Addend;
when Combin =>
M := (others => (others => Half));
for Col in Index loop
M(Col, Col) := Half + Half**11;
end loop;
when Peters_1 => -- transpose of peters_2 matrix. row pivoting likes this:
for Row in Starting_Index .. Max_Index loop
for Col in Row .. Max_Index loop
M(Row, Col) := -One;
end loop;
end loop;
for Col in Starting_Index .. Max_Index loop
M(Max_Index, Col) := One;
end loop;
for Col in Starting_Index .. Max_Index loop
M(Col, Col) := One;
end loop;
when Peters_2 => -- Real peters matrix. row pivoting hates this:
declare
-- Eigval : constant Real := 2.0;
Eigval : constant Real := Zero;
begin
for Row in Starting_Index .. Index'Last loop
for Col in Starting_Index .. Row loop
M(Row, Col) := -One + Eigval; -- Eigval is one of the eigs
end loop;
end loop;
end;
for Row in Starting_Index .. Index'Last loop
--M(Row, Max_Index) := One - 1.0E-9; -- kills the error growth
M(Row, Max_Index) := One;
end loop;
for Col in Starting_Index .. Index'Last loop
M(Col, Col) := One;
end loop;
when Diag_Test =>
M := (others => (others => Zero)); -- Essential init. The 0.0 is essential.
for Col in Starting_Index+1 .. Max_Index loop
M(Col-1, Col) := One;
end loop;
for Col in Starting_Index .. Max_Index loop
M(Col, Col) := 0.5;
end loop;
M := M + Matrix_Addend;
when Upper_Tri_K =>
M := (others => (others => Zero));
--the 0.0 is essential.
declare
c : constant Real := Two; -- higher condition num;
--c := constant Half;
begin
for Row in Starting_Index .. Max_Index loop
for Col in Row .. Max_Index loop
M(Row, Col) := -c;
end loop;
end loop;
for Col in Starting_Index .. Max_Index loop
M(Col, Col) := One;
end loop;
end;
M := M + Matrix_Addend;
when Lower_Tri_K =>
M := (others => (others => Zero));
--the 0.0 is essential.
declare
c : constant Real := Two; -- higher condition num;
--c := constant Half;
begin
for Row in Starting_Index .. Max_Index loop
for Col in Starting_Index .. Row loop
M(Row, Col) := -c;
end loop;
end loop;
for Col in Starting_Index .. Max_Index loop
M(Col, Col) := One;
end loop;
end;
M := M + Matrix_Addend;
when Kahan_Row_Scaled => -- make max element of Kahan Row = 1
M := (others => (others => Zero));
--the 0.0 is essential.
declare
c : Real;
begin
c := 0.70710678118654752440;
for Row in Starting_Index .. Max_Index loop
for Col in Row .. Max_Index loop
M(Row, Col) := -c;
end loop;
end loop;
for Col in Starting_Index .. Max_Index loop
M(Col, Col) := One;
end loop;
end;
M := M + Matrix_Addend;
when Kahan => -- need s**2 + c**2 = 1
M := (others => (others => Zero)); --essential init.
--the 0.0 is essential.
declare
s, c, s_i : Real;
i : Integer;
begin
s := 0.70710678118654752440;
c := 0.70710678118654752440;
for Row in Starting_Index .. Max_Index loop
for Col in Row .. Max_Index loop
M(Row, Col) := -c;
end loop;
end loop;
for Col in Starting_Index .. Max_Index loop
M(Col, Col) := One;
end loop;
i := 0;
for Row in Starting_Index .. Max_Index loop
s_i := s**i;
i := i + 1;
for Col in Starting_Index .. Max_Index loop
M(Row, Col) := s_i * M(Row, Col);
end loop;
end loop;
end;
when Kahan_Col_Scaled => -- make length of Col = 1
M := (others => (others => Zero)); --essential init.
--the 0.0 is essential.
declare
s, c, s_i : Real;
i : Integer;
Col_Norm : array(Index) of Real;
begin
s := 0.70710678118654752440;
c := 0.70710678118654752440;
for Row in Starting_Index .. Max_Index loop
for Col in Row .. Max_Index loop
M(Row, Col) := -c;
end loop;
end loop;
for Col in Starting_Index .. Max_Index loop
M(Col, Col) := One;
end loop;
i := 0;
for Row in Starting_Index .. Max_Index loop
s_i := s**i;
i := i + 1;
for Col in Starting_Index .. Max_Index loop
M(Row, Col) := s_i * M(Row, Col);
end loop;
end loop;
-- Got Kahan, now normalize the cols:
for Col in Starting_Index .. Max_Index loop
s_i := Zero;
for Row in Starting_Index .. Max_Index loop
s_i := s_i + Abs M(Row, Col);
end loop;
Col_Norm(Col) := S_i;
end loop;
for Col in Starting_Index .. Max_Index loop
for Row in Starting_Index .. Max_Index loop
M(Row, Col) := M(Row, Col) / Col_Norm(Col);
end loop;
end loop;
end;
M := M + Matrix_Addend;
when Kahan_2 => -- need s**2 + c**2 = 1; make max element of Col = 1
M := (others => (others => Zero)); --essential init.
--the 0.0 is essential.
declare
s, c, s_i : Real;
i : Integer;
begin
s := 0.25;
c := 0.96824583655185422129;
for Row in Starting_Index .. Max_Index loop
for Col in Row .. Max_Index loop
M(Row, Col) := -c;
end loop;
end loop;
for Col in Starting_Index .. Max_Index loop
M(Col, Col) := One;
end loop;
i := 0;
for Row in Starting_Index .. Max_Index loop
s_i := s**i;
i := i + 1;
for Col in Starting_Index .. Max_Index loop
M(Row, Col) := s_i * M(Row, Col);
end loop;
end loop;
for Col in Starting_Index+1 .. Max_Index loop
for Row in Starting_Index .. Max_Index loop
M(Row, Col) := M(Row, Col) / (c);
end loop;
end loop;
end;
M := M + Matrix_Addend;
when Vandermonde =>
-- small elements underflow; max element near ~1.
Vandermondes_Matrix:
declare
Exp, X_Count : Integer;
X : Real;
Half_No_Of_Rows : constant Integer
:= (Integer(Max_Index) - Integer(Starting_Index) + 1)/2;
B : constant Real := One / Real (Half_No_Of_Rows);
A : constant Real := Two ** (Real'Exponent(B) - 1);
--Smallest_Allowed_Real : constant Real := Two ** (Real'Machine_Emin + 512);
begin
for Row in Starting_Index .. Max_Index loop
for Col in Starting_Index .. Max_Index loop
Exp := Integer(Col) - Integer(Starting_Index);
X_Count := Integer(Row) - Integer(Starting_Index);
X := A * (Real (X_Count - Half_No_Of_Rows));
M(Row, Col) := X ** Exp;
end loop;
end loop;
-- for r in M'Range(1) loop
-- for c in M'Range(2) loop
-- if not M(r,c)'Valid or
-- Abs M(r,c) < Smallest_Allowed_Real
-- then
-- M(r,c) := Smallest_Allowed_Real;
-- end if;
-- end loop;
-- end loop;
end Vandermondes_Matrix;
when Trench_1 =>
-- Alpha = -One; -- singular submatrices
Get_Trench (M, Starting_Index, Max_Index, Alpha => -One);
when Trench =>
-- Alpha = One; -- highest condition number
Get_Trench (M, Starting_Index, Max_Index, Alpha => One);
when Zielke_0 =>
-- Z = 1.0; -- Singular
Get_Zielke (M, Starting_Index, Max_Index, Z => One);
when Zielke_1 =>
-- Z = -1.0; -- ill conditioned
Get_Zielke (M, Starting_Index, Max_Index, Z => -One);
when Zielke_2 =>
Get_Zielke (M, Starting_Index, Max_Index, (+2.0));
when All_Zeros =>
M := (others => (others => Zero));
when All_Ones =>
M := (others => (others => One));
end case;
end Init_Matrix;
end Test_Matrices;
|
src/main/antlr/StringSelection.g4 | LIARALab/java-activity-recognition-selection | 0 | 1836 | grammar StringSelection;
NOT: 'not:';
WHITESPACE: [ \n\r\t];
STRING: '"' ('\\"'|~'"')* '"';
REGEXP: '/' ('\\/' | ~'/')* '/';
TOKEN: (~[ \n\r\t"',;/])+;
selection: filter (';' filter)* EOF;
filter: clause ((',' | WHITESPACE+) clause)*;
clause: negation
| operation
;
negation: NOT operation;
operation: REGEXP
| STRING
| TOKEN
;
|
formalization/agda/Spire/Examples/PropositionalDesc.agda | spire/spire | 43 | 10804 | {-# OPTIONS --type-in-type #-}
open import Data.Unit
open import Data.Product hiding ( curry ; uncurry )
open import Data.List hiding ( concat )
open import Data.String
open import Relation.Binary.PropositionalEquality
module Spire.Examples.PropositionalDesc where
----------------------------------------------------------------------
elimEq : (A : Set) (x : A) (P : (y : A) → x ≡ y → Set)
→ P x refl
→ (y : A) (p : x ≡ y) → P y p
elimEq A .x P prefl x refl = prefl
----------------------------------------------------------------------
Label : Set
Label = String
Enum : Set
Enum = List Label
data Tag : Enum → Set where
here : ∀{l E} → Tag (l ∷ E)
there : ∀{l E} → Tag E → Tag (l ∷ E)
Cases : (E : Enum) (P : Tag E → Set) → Set
Cases [] P = ⊤
Cases (l ∷ E) P = P here × Cases E λ t → P (there t)
case : (E : Enum) (P : Tag E → Set) (cs : Cases E P) (t : Tag E) → P t
case (l ∷ E) P (c , cs) here = c
case (l ∷ E) P (c , cs) (there t) = case E (λ t → P (there t)) cs t
UncurriedCases : (E : Enum) (P : Tag E → Set) (X : Set)
→ Set
UncurriedCases E P X = Cases E P → X
CurriedCases : (E : Enum) (P : Tag E → Set) (X : Set)
→ Set
CurriedCases [] P X = X
CurriedCases (l ∷ E) P X = P here → CurriedCases E (λ t → P (there t)) X
curryCases : (E : Enum) (P : Tag E → Set) (X : Set)
(f : UncurriedCases E P X) → CurriedCases E P X
curryCases [] P X f = f tt
curryCases (l ∷ E) P X f = λ c → curryCases E (λ t → P (there t)) X (λ cs → f (c , cs))
uncurryCases : (E : Enum) (P : Tag E → Set) (X : Set)
(f : CurriedCases E P X) → UncurriedCases E P X
uncurryCases [] P X x tt = x
uncurryCases (l ∷ E) P X f (c , cs) = uncurryCases E (λ t → P (there t)) X (f c) cs
----------------------------------------------------------------------
data Desc (I : Set) : Set₁ where
`End : (i : I) → Desc I
`Rec : (i : I) (D : Desc I) → Desc I
`Arg : (A : Set) (B : A → Desc I) → Desc I
`RecFun : (A : Set) (B : A → I) (D : Desc I) → Desc I
ISet : Set → Set₁
ISet I = I → Set
El : (I : Set) (D : Desc I) (X : ISet I) → ISet I
El I (`End j) X i = j ≡ i
El I (`Rec j D) X i = X j × El I D X i
El I (`Arg A B) X i = Σ A (λ a → El I (B a) X i)
El I (`RecFun A B D) X i = ((a : A) → X (B a)) × El I D X i
Hyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (i : I) (xs : El I D X i) → Set
Hyps I (`End j) X P i q = ⊤
Hyps I (`Rec j D) X P i (x , xs) = P j x × Hyps I D X P i xs
Hyps I (`Arg A B) X P i (a , b) = Hyps I (B a) X P i b
Hyps I (`RecFun A B D) X P i (f , xs) = ((a : A) → P (B a) (f a)) × Hyps I D X P i xs
caseD : (E : Enum) (I : Set) (cs : Cases E (λ _ → Desc I)) (t : Tag E) → Desc I
caseD E I cs t = case E (λ _ → Desc I) cs t
----------------------------------------------------------------------
TagDesc : (I : Set) → Set
TagDesc I = Σ Enum (λ E → Cases E (λ _ → Desc I))
toCase : (I : Set) (E,cs : TagDesc I) → Tag (proj₁ E,cs) → Desc I
toCase I (E , cs) = case E (λ _ → Desc I) cs
toDesc : (I : Set) → TagDesc I → Desc I
toDesc I (E , cs) = `Arg (Tag E) (toCase I (E , cs))
----------------------------------------------------------------------
UncurriedEl : (I : Set) (D : Desc I) (X : ISet I) → Set
UncurriedEl I D X = {i : I} → El I D X i → X i
CurriedEl : (I : Set) (D : Desc I) (X : ISet I) → Set
CurriedEl I (`End i) X = X i
CurriedEl I (`Rec j D) X = (x : X j) → CurriedEl I D X
CurriedEl I (`Arg A B) X = (a : A) → CurriedEl I (B a) X
CurriedEl I (`RecFun A B D) X = ((a : A) → X (B a)) → CurriedEl I D X
curryEl : (I : Set) (D : Desc I) (X : ISet I)
(cn : UncurriedEl I D X) → CurriedEl I D X
curryEl I (`End i) X cn = cn refl
curryEl I (`Rec i D) X cn = λ x → curryEl I D X (λ xs → cn (x , xs))
curryEl I (`Arg A B) X cn = λ a → curryEl I (B a) X (λ xs → cn (a , xs))
curryEl I (`RecFun A B D) X cn = λ f → curryEl I D X (λ xs → cn (f , xs))
uncurryEl : (I : Set) (D : Desc I) (X : ISet I)
(cn : CurriedEl I D X) → UncurriedEl I D X
uncurryEl I (`End i) X cn refl = cn
uncurryEl I (`Rec i D) X cn (x , xs) = uncurryEl I D X (cn x) xs
uncurryEl I (`Arg A B) X cn (a , xs) = uncurryEl I (B a) X (cn a) xs
uncurryEl I (`RecFun A B D) X cn (f , xs) = uncurryEl I D X (cn f) xs
data μ (I : Set) (D : Desc I) : I → Set where
con : UncurriedEl I D (μ I D)
con2 : (I : Set) (D : Desc I) → CurriedEl I D (μ I D)
con2 I D = curryEl I D (μ I D) con
----------------------------------------------------------------------
UncurriedHyps : (I : Set) (D : Desc I) (X : ISet I)
(P : (i : I) → X i → Set)
(cn : UncurriedEl I D X)
→ Set
UncurriedHyps I D X P cn =
(i : I) (xs : El I D X i) → Hyps I D X P i xs → P i (cn xs)
CurriedHyps : (I : Set) (D : Desc I) (X : ISet I)
(P : (i : I) → X i → Set)
(cn : UncurriedEl I D X)
→ Set
CurriedHyps I (`End i) X P cn =
P i (cn refl)
CurriedHyps I (`Rec i D) X P cn =
(x : X i) → P i x → CurriedHyps I D X P (λ xs → cn (x , xs))
CurriedHyps I (`Arg A B) X P cn =
(a : A) → CurriedHyps I (B a) X P (λ xs → cn (a , xs))
CurriedHyps I (`RecFun A B D) X P cn =
(f : (a : A) → X (B a)) (ihf : (a : A) → P (B a) (f a)) → CurriedHyps I D X P (λ xs → cn (f , xs))
curryHyps : (I : Set) (D : Desc I) (X : ISet I)
(P : (i : I) → X i → Set)
(cn : UncurriedEl I D X)
(pf : UncurriedHyps I D X P cn)
→ CurriedHyps I D X P cn
curryHyps I (`End i) X P cn pf =
pf i refl tt
curryHyps I (`Rec i D) X P cn pf =
λ x ih → curryHyps I D X P (λ xs → cn (x , xs)) (λ i xs ihs → pf i (x , xs) (ih , ihs))
curryHyps I (`Arg A B) X P cn pf =
λ a → curryHyps I (B a) X P (λ xs → cn (a , xs)) (λ i xs ihs → pf i (a , xs) ihs)
curryHyps I (`RecFun A B D) X P cn pf =
λ f ihf → curryHyps I D X P (λ xs → cn (f , xs)) (λ i xs ihs → pf i (f , xs) (ihf , ihs))
uncurryHyps : (I : Set) (D : Desc I) (X : ISet I)
(P : (i : I) → X i → Set)
(cn : UncurriedEl I D X)
(pf : CurriedHyps I D X P cn)
→ UncurriedHyps I D X P cn
uncurryHyps I (`End .i) X P cn pf i refl tt =
pf
uncurryHyps I (`Rec j D) X P cn pf i (x , xs) (ih , ihs) =
uncurryHyps I D X P (λ ys → cn (x , ys)) (pf x ih) i xs ihs
uncurryHyps I (`Arg A B) X P cn pf i (a , xs) ihs =
uncurryHyps I (B a) X P (λ ys → cn (a , ys)) (pf a) i xs ihs
uncurryHyps I (`RecFun A B D) X P cn pf i (f , xs) (ihf , ihs) =
uncurryHyps I D X P (λ ys → cn (f , ys)) (pf f ihf) i xs ihs
----------------------------------------------------------------------
ind :
(I : Set)
(D : Desc I)
(P : (i : I) → μ I D i → Set)
(pcon : UncurriedHyps I D (μ I D) P con)
(i : I)
(x : μ I D i)
→ P i x
hyps :
(I : Set)
(D₁ : Desc I)
(P : (i : I) → μ I D₁ i → Set)
(pcon : UncurriedHyps I D₁ (μ I D₁) P con)
(D₂ : Desc I)
(i : I)
(xs : El I D₂ (μ I D₁) i)
→ Hyps I D₂ (μ I D₁) P i xs
ind I D P pcon i (con xs) = pcon i xs (hyps I D P pcon D i xs)
hyps I D P pcon (`End j) i q = tt
hyps I D P pcon (`Rec j A) i (x , xs) = ind I D P pcon j x , hyps I D P pcon A i xs
hyps I D P pcon (`Arg A B) i (a , b) = hyps I D P pcon (B a) i b
hyps I D P pcon (`RecFun A B E) i (f , xs) = (λ a → ind I D P pcon (B a) (f a)) , hyps I D P pcon E i xs
----------------------------------------------------------------------
ind2 :
(I : Set)
(D : Desc I)
(P : (i : I) → μ I D i → Set)
(pcon : CurriedHyps I D (μ I D) P con)
(i : I)
(x : μ I D i)
→ P i x
ind2 I D P pcon i x = ind I D P (uncurryHyps I D (μ I D) P con pcon) i x
elim :
(I : Set)
(TD : TagDesc I)
→ let
D = toDesc I TD
E = proj₁ TD
Cs = toCase I TD
in (P : (i : I) → μ I D i → Set)
→ let
Q = λ t → CurriedHyps I (Cs t) (μ I D) P (λ xs → con (t , xs))
X = (i : I) (x : μ I D i) → P i x
in UncurriedCases E Q X
elim I TD P cs i x =
let
D = toDesc I TD
E = proj₁ TD
Cs = toCase I TD
Q = λ t → CurriedHyps I (Cs t) (μ I D) P (λ xs → con (t , xs))
p = case E Q cs
in ind2 I D P p i x
elim2 :
(I : Set)
(TD : TagDesc I)
→ let
D = toDesc I TD
E = proj₁ TD
Cs = toCase I TD
in (P : (i : I) → μ I D i → Set)
→ let
Q = λ t → CurriedHyps I (Cs t) (μ I D) P (λ xs → con (t , xs))
X = (i : I) (x : μ I D i) → P i x
in CurriedCases E Q X
elim2 I TD P =
let
D = toDesc I TD
E = proj₁ TD
Cs = toCase I TD
Q = λ t → CurriedHyps I (Cs t) (μ I D) P (λ xs → con (t , xs))
X = (i : I) (x : μ I D i) → P i x
in curryCases E Q X (elim I TD P)
----------------------------------------------------------------------
module Sugared where
data ℕT : Set where `zero `suc : ℕT
data VecT : Set where `nil `cons : VecT
ℕD : Desc ⊤
ℕD = `Arg ℕT λ
{ `zero → `End tt
; `suc → `Rec tt (`End tt)
}
ℕ : ⊤ → Set
ℕ = μ ⊤ ℕD
zero : ℕ tt
zero = con (`zero , refl)
suc : ℕ tt → ℕ tt
suc n = con (`suc , n , refl)
VecD : (A : Set) → Desc (ℕ tt)
VecD A = `Arg VecT λ
{ `nil → `End zero
; `cons → `Arg (ℕ tt) λ n → `Arg A λ _ → `Rec n (`End (suc n))
}
Vec : (A : Set) (n : ℕ tt) → Set
Vec A n = μ (ℕ tt) (VecD A) n
nil : (A : Set) → Vec A zero
nil A = con (`nil , refl)
cons : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n)
cons A n x xs = con (`cons , n , x , xs , refl)
----------------------------------------------------------------------
add : ℕ tt → ℕ tt → ℕ tt
add = ind ⊤ ℕD (λ _ _ → ℕ tt → ℕ tt)
(λ
{ tt (`zero , q) tt n → n
; tt (`suc , m , q) (ih , tt) n → suc (ih n)
}
)
tt
mult : ℕ tt → ℕ tt → ℕ tt
mult = ind ⊤ ℕD (λ _ _ → ℕ tt → ℕ tt)
(λ
{ tt (`zero , q) tt n → zero
; tt (`suc , m , q) (ih , tt) n → add n (ih n)
}
)
tt
append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)
append A = ind (ℕ tt) (VecD A) (λ m xs → (n : ℕ tt) (ys : Vec A n) → Vec A (add m n))
(λ
{ .(con (`zero , refl)) (`nil , refl) ih n ys → ys
; .(con (`suc , m , refl)) (`cons , m , x , xs , refl) (ih , tt) n ys → cons A (add m n) x (ih n ys)
}
)
concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m)
concat A m = ind (ℕ tt) (VecD (Vec A m)) (λ n xss → Vec A (mult n m))
(λ
{ .(con (`zero , refl)) (`nil , refl) tt → nil A
; .(con (`suc , n , refl)) (`cons , n , xs , xss , refl) (ih , tt) → append A m xs (mult n m) ih
}
)
----------------------------------------------------------------------
module Desugared where
ℕT : Enum
ℕT = "zero" ∷ "suc" ∷ []
VecT : Enum
VecT = "nil" ∷ "cons" ∷ []
ℕTD : TagDesc ⊤
ℕTD = ℕT
, `End tt
, `Rec tt (`End tt)
, tt
ℕCs : Tag ℕT → Desc ⊤
ℕCs = toCase ⊤ ℕTD
ℕD : Desc ⊤
ℕD = toDesc ⊤ ℕTD
ℕ : ⊤ → Set
ℕ = μ ⊤ ℕD
zero : ℕ tt
zero = con (here , refl)
suc : ℕ tt → ℕ tt
suc n = con (there here , n , refl)
zero2 : ℕ tt
zero2 = con2 ⊤ ℕD here
suc2 : ℕ tt → ℕ tt
suc2 = con2 ⊤ ℕD (there here)
VecTD : (A : Set) → TagDesc (ℕ tt)
VecTD A = VecT
, `End zero
, `Arg (ℕ tt) (λ n → `Arg A λ _ → `Rec n (`End (suc n)))
, tt
VecCs : (A : Set) → Tag VecT → Desc (ℕ tt)
VecCs A = toCase (ℕ tt) (VecTD A)
VecD : (A : Set) → Desc (ℕ tt)
VecD A = toDesc (ℕ tt) (VecTD A)
Vec : (A : Set) (n : ℕ tt) → Set
Vec A n = μ (ℕ tt) (VecD A) n
nil : (A : Set) → Vec A zero
nil A = con (here , refl)
cons : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n)
cons A n x xs = con (there here , n , x , xs , refl)
nil2 : (A : Set) → Vec A zero
nil2 A = con2 (ℕ tt) (VecD A) here
cons2 : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n)
cons2 A = con2 (ℕ tt) (VecD A) (there here)
----------------------------------------------------------------------
module Induction where
add : ℕ tt → ℕ tt → ℕ tt
add = ind ⊤ ℕD (λ _ _ → ℕ tt → ℕ tt)
(λ u t,c → case ℕT
(λ t → (c : El ⊤ (ℕCs t) ℕ u)
(ih : Hyps ⊤ ℕD ℕ (λ u n → ℕ u → ℕ u) u (t , c))
→ ℕ u → ℕ u
)
( (λ q ih n → n)
, (λ m,q ih,tt n → suc (proj₁ ih,tt n))
, tt
)
(proj₁ t,c)
(proj₂ t,c)
)
tt
mult : ℕ tt → ℕ tt → ℕ tt
mult = ind ⊤ ℕD (λ _ _ → ℕ tt → ℕ tt)
(λ u t,c → case ℕT
(λ t → (c : El ⊤ (ℕCs t) ℕ u)
(ih : Hyps ⊤ ℕD ℕ (λ u n → ℕ u → ℕ u) u (t , c))
→ ℕ u → ℕ u
)
( (λ q ih n → zero)
, (λ m,q ih,tt n → add n (proj₁ ih,tt n))
, tt
)
(proj₁ t,c)
(proj₂ t,c)
)
tt
append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)
append A = ind (ℕ tt) (VecD A) (λ m xs → (n : ℕ tt) (ys : Vec A n) → Vec A (add m n))
(λ m t,c → case VecT
(λ t → (c : El (ℕ tt) (VecCs A t) (Vec A) m)
(ih : Hyps (ℕ tt) (VecD A) (Vec A) (λ m xs → (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)) m (t , c))
(n : ℕ tt) (ys : Vec A n) → Vec A (add m n)
)
( (λ q ih n ys → subst (λ m → Vec A (add m n)) q ys)
, (λ m',x,xs,q ih,tt n ys →
let m' = proj₁ m',x,xs,q
x = proj₁ (proj₂ m',x,xs,q)
q = proj₂ (proj₂ (proj₂ m',x,xs,q))
ih = proj₁ ih,tt
in
subst (λ m → Vec A (add m n)) q (cons A (add m' n) x (ih n ys))
)
, tt
)
(proj₁ t,c)
(proj₂ t,c)
)
concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m)
concat A m = ind (ℕ tt) (VecD (Vec A m)) (λ n xss → Vec A (mult n m))
(λ n t,c → case VecT
(λ t → (c : El (ℕ tt) (VecCs (Vec A m) t) (Vec (Vec A m)) n)
(ih : Hyps (ℕ tt) (VecD (Vec A m)) (Vec (Vec A m)) (λ n xss → Vec A (mult n m)) n (t , c))
→ Vec A (mult n m)
)
( (λ q ih → subst (λ n → Vec A (mult n m)) q (nil A))
, (λ n',xs,xss,q ih,tt →
let n' = proj₁ n',xs,xss,q
xs = proj₁ (proj₂ n',xs,xss,q)
q = proj₂ (proj₂ (proj₂ n',xs,xss,q))
ih = proj₁ ih,tt
in
subst (λ n → Vec A (mult n m)) q (append A m xs (mult n' m) ih)
)
, tt
)
(proj₁ t,c)
(proj₂ t,c)
)
----------------------------------------------------------------------
module Eliminator where
elimℕ : (P : (ℕ tt) → Set)
(pzero : P zero)
(psuc : (m : ℕ tt) → P m → P (suc m))
(n : ℕ tt)
→ P n
elimℕ P pzero psuc = ind ⊤ ℕD (λ u n → P n)
(λ u t,c → case ℕT
(λ t → (c : El ⊤ (ℕCs t) ℕ u)
(ih : Hyps ⊤ ℕD ℕ (λ u n → P n) u (t , c))
→ P (con (t , c))
)
( (λ q ih →
elimEq ⊤ tt (λ u q → P (con (here , q)))
pzero
u q
)
, (λ n,q ih,tt →
elimEq ⊤ tt (λ u q → P (con (there here , proj₁ n,q , q)))
(psuc (proj₁ n,q) (proj₁ ih,tt))
u (proj₂ n,q)
)
, tt
)
(proj₁ t,c)
(proj₂ t,c)
)
tt
elimVec : (A : Set) (P : (n : ℕ tt) → Vec A n → Set)
(pnil : P zero (nil A))
(pcons : (n : ℕ tt) (a : A) (xs : Vec A n) → P n xs → P (suc n) (cons A n a xs))
(n : ℕ tt)
(xs : Vec A n)
→ P n xs
elimVec A P pnil pcons = ind (ℕ tt) (VecD A) (λ n xs → P n xs)
(λ n t,c → case VecT
(λ t → (c : El (ℕ tt) (VecCs A t) (Vec A) n)
(ih : Hyps (ℕ tt) (VecD A) (Vec A) (λ n xs → P n xs) n (t , c))
→ P n (con (t , c))
)
( (λ q ih →
elimEq (ℕ tt) zero (λ n q → P n (con (here , q)))
pnil
n q
)
, (λ n',x,xs,q ih,tt →
let n' = proj₁ n',x,xs,q
x = proj₁ (proj₂ n',x,xs,q)
xs = proj₁ (proj₂ (proj₂ n',x,xs,q))
q = proj₂ (proj₂ (proj₂ n',x,xs,q))
ih = proj₁ ih,tt
in
elimEq (ℕ tt) (suc n') (λ n q → P n (con (there here , n' , x , xs , q)))
(pcons n' x xs ih )
n q
)
, tt
)
(proj₁ t,c)
(proj₂ t,c)
)
----------------------------------------------------------------------
add : ℕ tt → ℕ tt → ℕ tt
add = elimℕ (λ _ → ℕ tt → ℕ tt)
(λ n → n)
(λ m ih n → suc (ih n))
mult : ℕ tt → ℕ tt → ℕ tt
mult = elimℕ (λ _ → ℕ tt → ℕ tt)
(λ n → zero)
(λ m ih n → add n (ih n))
append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)
append A = elimVec A (λ m xs → (n : ℕ tt) (ys : Vec A n) → Vec A (add m n))
(λ n ys → ys)
(λ m x xs ih n ys → cons A (add m n) x (ih n ys))
concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m)
concat A m = elimVec (Vec A m) (λ n xss → Vec A (mult n m))
(nil A)
(λ n xs xss ih → append A m xs (mult n m) ih)
----------------------------------------------------------------------
module GenericEliminator where
add : ℕ tt → ℕ tt → ℕ tt
add = elim2 ⊤ ℕTD _
(λ n → n)
(λ m ih n → suc (ih n))
tt
mult : ℕ tt → ℕ tt → ℕ tt
mult = elim2 ⊤ ℕTD _
(λ n → zero)
(λ m ih n → add n (ih n))
tt
append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)
append A = elim2 (ℕ tt) (VecTD A) _
(λ n ys → ys)
(λ m x xs ih n ys → cons A (add m n) x (ih n ys))
concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m)
concat A m = elim2 (ℕ tt) (VecTD (Vec A m)) _
(nil A)
(λ n xs xss ih → append A m xs (mult n m) ih)
----------------------------------------------------------------------
|
programs/oeis/212/A212523.asm | neoneye/loda | 22 | 95775 | <reponame>neoneye/loda
; A212523: Number of (w,x,y,z) with all terms in {1,...,n} and w+x<y+z.
; 0,0,5,31,106,270,575,1085,1876,3036,4665,6875,9790,13546,18291,24185,31400,40120,50541,62871,77330,94150,113575,135861,161276,190100,222625,259155,300006,345506,395995,451825,513360,580976,655061,736015,824250,920190,1024271,1136941,1258660,1389900,1531145,1682891,1845646,2019930,2206275,2405225,2617336,2843176,3083325,3338375,3608930,3895606,4199031,4519845,4858700,5216260,5593201,5990211,6407990,6847250,7308715,7793121,8301216,8833760,9391525,9975295,10585866,11224046,11890655,12586525,13312500,14069436,14858201,15679675,16534750,17424330,18349331,19310681,20309320,21346200,22422285,23538551,24695986,25895590,27138375,28425365,29757596,31136116,32561985,34036275,35560070,37134466,38760571,40439505,42172400,43960400,45804661,47706351
mov $2,$0
lpb $0
lpb $0
sub $0,1
add $4,$2
lpe
lpb $2
sub $2,1
add $4,1
add $3,$4
add $1,$3
lpe
sub $1,$3
lpe
mov $0,$1
|
programs/oeis/199/A199316.asm | karttu/loda | 1 | 11649 | <gh_stars>1-10
; A199316: 11*5^n+1.
; 12,56,276,1376,6876,34376,171876,859376,4296876,21484376,107421876,537109376,2685546876,13427734376,67138671876,335693359376,1678466796876,8392333984376,41961669921876,209808349609376,1049041748046876,5245208740234376
mov $1,5
pow $1,$0
mul $1,11
add $1,1
|
oeis/157/A157674.asm | neoneye/loda-programs | 11 | 17012 | ; A157674: G.f.: A(x) = 1 + x/exp( Sum_{k>=1} (A((-1)^k*x) - 1)^k/k ).
; Submitted by <NAME>
; 1,1,1,-1,-3,1,9,1,-27,-13,81,67,-243,-285,729,1119,-2187,-4215,6561,15505,-19683,-56239,59049,202309,-177147,-724499,531441,2589521,-1594323,-9254363,4782969,33111969,-14348907,-118725597,43046721,426892131,-129140163,-1539965973,387420489,5575175319,-1162261467,-20260052337,3486784401,73908397851,-10460353203,-270657727593,31381059609,994938310059,-94143178827,-3670934157477,282429536481,13592610767079,-847288609443,-50501725104141,2541865828329,188239881456727,-7625597484987,-703786746202189
mov $1,1
mov $3,$0
sub $3,1
mov $4,1
lpb $3
mul $1,2
sub $3,1
mul $1,$3
sub $4,2
add $5,$4
div $1,$5
add $2,$1
sub $3,1
add $4,2
lpe
mov $0,$2
add $0,1
|
assembler/tests/data/add.asm | dalloriam/slang | 0 | 81061 | .data
.text
ld $0 10
ld $1 5
ld $3 15
add $0 $1 $2
eq $2 $3
|
NULLTerminatingBytes/functions.asm | slowy07/learnAsm | 1 | 169362 | ; string message
; string len function
slen:
push ebx
push ebx, eax
nextchar:
cmp byte [eax], 0
jz finished
jnc eax
jmp nextchar
finished:
sub eax, ebx
pop ebx
ret
; print function
sprint:
push edx
push ecx
push ebx
push eax
call slen
mov ecx, eax
mov ebx, 1
mov eax, 4
int 80h
pop ebx
pop ecx
pop edx
ret
;exit
quit:
mov ebx, 0
mov eax, 1
int 80h
ret |
examples/addrconv.adb | ytomino/drake | 33 | 23376 | with Ada;
with System.Address_To_Access_Conversions;
with System.Address_To_Constant_Access_Conversions;
with System.Address_To_Named_Access_Conversions;
procedure addrconv is
package AC1 is new System.Address_To_Access_Conversions (Integer);
type TA is access all Integer;
pragma No_Strict_Aliasing (TA);
package AC2 is new System.Address_To_Named_Access_Conversions (Integer, TA);
type TC is access constant Integer;
pragma No_Strict_Aliasing (TC);
package AC3 is new System.Address_To_Constant_Access_Conversions (Integer, TC);
V : aliased Integer;
V1 : AC1.Object_Pointer := AC1.To_Pointer (V'Address);
V2 : TA := AC2.To_Pointer (V'Address);
V3 : TC := AC3.To_Pointer (V'Address);
pragma Suppress (Access_Check);
begin
V := 10;
V1.all := V1.all + 10;
V2.all := V2.all + 10;
pragma Assert (V3.all = 30);
pragma Debug (Ada.Debug.Put ("OK"));
end addrconv;
|
test/interaction/Issue1963.agda | cruhland/agda | 1,989 | 10930 | <filename>test/interaction/Issue1963.agda
-- Andreas, May-July 2016, implementing postfix projections
{-# OPTIONS --postfix-projections #-}
open import Common.Product
open import Common.Bool
pair : ∀{A : Set}(a : A) → A × A
pair a = {!!} -- C-c C-c here outputs postfix projections
record BoolFun : Set where
field out : Bool → Bool
open BoolFun
neg : BoolFun
neg .out x = {!x!} -- splitting here should preserve postfix proj
neg2 : BoolFun
out neg2 x = {!x!} -- splitting here should preserve prefix proj
module ExtendedLambda where
neg3 : BoolFun
neg3 = λ{ .out → {!!} }
pair2 : ∀{A : Set}(a : A) → A × A
pair2 = λ{ a → {!!} }
neg4 : BoolFun
neg4 = λ{ .out b → {!b!} }
-- DOES NOT WORK DUE TO ISSUE #2020
-- module LambdaWhere where
-- neg3 : BoolFun
-- neg3 = λ where
-- .out → {!!} -- splitting on result here crashes
-- pair2 : ∀{A : Set}(a : A) → A × A
-- pair2 = λ where
-- a → {!!}
-- extlam-where : Bool → Bool
-- extlam-where = λ where
-- b → {!b!}
-- -- extlam : Bool → Bool
-- -- extlam = λ
-- -- { b → {!b!}
-- -- }
|
Appl/SDK_Asm/no_go/Talk/talk.asm | steakknife/pcgeos | 504 | 98780 | <filename>Appl/SDK_Asm/no_go/Talk/talk.asm
COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Talk (Sample PC GEOS application)
FILE: talk.asm
REVISION HISTORY:
Name Date Description
---- ---- -----------
Insik 8/92 Initial Version
DESCRIPTION:
a crude "chat" application to demonstrate the Net Library and Comm
Driver.
to use the app, one must select the port and baud rate and open
a connection before typing and sending messages
RCS STAMP:
$Id: talk.asm,v 1.1 97/04/04 16:34:48 newdeal Exp $
------------------------------------------------------------------------------@
;------------------------------------------------------------------------------
; Include files
;------------------------------------------------------------------------------
include geos.def
include heap.def
include geode.def
include resource.def
include ec.def
include object.def
include graphics.def
include Objects/winC.def
; must include serialDr.def
UseDriver Internal/serialDr.def
;------------------------------------------------------------------------------
; Libraries used
;------------------------------------------------------------------------------
UseLib net.def
UseLib ui.def
UseLib Objects/vTextC.def
;------------------------------------------------------------------------------
; Class & Method Definitions
;------------------------------------------------------------------------------
TalkProcessClass class GenProcessClass
MSG_TALK_SET_PORT message
MSG_TALK_SET_RATE message
MSG_TALK_OPEN_CONNECTION message
MSG_TALK_CLOSE_CONNECTION message
MSG_TALK_SEND_TEXT message
TalkProcessClass endc ;end of class definition
UNINITIALIZED equ 8
idata segment
TalkProcessClass mask CLASSF_NEVER_SAVED
;this flag necessary because ProcessClass
;objects are hybrid objects.
; * SerialPortInfo contains the baud rate and com port info necessary to
; * open thee port
portInfo SerialPortInfo <SERIAL_COM1, SB_19200>
port word UNINITIALIZED
socket word UNINITIALIZED
idata ends
udata segment
textBuf db 82 dup (?)
udata ends
;------------------------------------------------------------------------------
; Resources
;------------------------------------------------------------------------------
include talk.rdef ;include compiled UI definitions
;------------------------------------------------------------------------------
; Code for TalkProcessClass
;------------------------------------------------------------------------------
CommonCode segment resource ;start of code resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY:
PASS: *ds:si = TalkProcessClass object
ds:di = TalkProcessClass instance data
ds:bx = TalkProcessClass object (same as *ds:si)
es = segment of TalkProcessClass
ax = message #
cx = SerialPortNum
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 8/ 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetPort method dynamic TalkProcessClass,
MSG_TALK_SET_PORT
uses ax, cx, dx, bp
.enter
segmov es,dgroup,ax
mov es:[portInfo].SPI_portNumber,cx
.leave
ret
SetPort endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetBaud
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY:
PASS: *ds:si = TalkProcessClass object
ds:di = TalkProcessClass instance data
ds:bx = TalkProcessClass object (same as *ds:si)
es = segment of TalkProcessClass
ax = message #
cx = SerialBaud
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 8/ 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetBaud method dynamic TalkProcessClass,
MSG_TALK_SET_RATE
uses ax, cx, dx, bp
.enter
segmov es,dgroup,ax
mov es:[portInfo].SPI_baudRate,cx
.leave
ret
SetBaud endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OpenConnection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open port/socket, etc
CALLED BY:
PASS: *ds:si = TalkProcessClass object
ds:di = TalkProcessClass instance data
ds:bx = TalkProcessClass object (same as *ds:si)
es = segment of TalkProcessClass
ax = message #
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 8/ 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OpenConnection method dynamic TalkProcessClass,
MSG_TALK_OPEN_CONNECTION
uses ax, cx, dx, bp
.enter
call CloseCurrentConnection
; call init procedures, first open the port
segmov ds, es, si
mov si, offset portInfo
mov cx, size SerialPortInfo
call NetMsgOpenPort ; bx - port token
jc exit
mov es:[port], bx
GetResourceHandleNS ReceiveTextDisplay, bx
mov si, bx
mov bx, es:[port]
; when we supply the callback address, we use a virtual segment so that
; the code doesn't have to reside in fixed memory
push ds
mov dx, vseg ReceiveTextCallback
mov ds, dx
mov dx, offset cs:ReceiveTextCallback
mov cx, SID_TALK ;Our ID and the dest ID
mov bp, cx ; are the same
call NetMsgCreateSocket ; ax - socket token
mov es:[socket], ax
pop ds
exit: .leave
ret
OpenConnection endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CloseConnection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: MSG_TALK_CLOSE_CONNECTION
PASS: *ds:si = TalkProcessClass object
ds:di = TalkProcessClass instance data
ds:bx = TalkProcessClass object (same as *ds:si)
es = segment of TalkProcessClass
ax = message #
RETURN:
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 1/29/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CloseConnection method dynamic TalkProcessClass,
MSG_TALK_CLOSE_CONNECTION
uses ax, cx, dx, bp
.enter
call CloseCurrentConnection
.leave
ret
CloseConnection endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CloseCurrentConnection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close current connection
CALLED BY: OpenConnection, CloseConnection
PASS: es - dgroup
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 1/29/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CloseCurrentConnection proc near
uses ax,bx,cx,dx,si,di,bp
.enter
cmp es:[port], UNINITIALIZED
je exit ; already closed
mov bx, es:[port]
mov dx, es:[socket]
call NetMsgDestroySocket
call NetMsgClosePort
mov es:[port], UNINITIALIZED
mov es:[socket], UNINITIALIZED
exit: .leave
ret
CloseCurrentConnection endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SendText
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: send text
CALLED BY: UI
PASS: *ds:si = TalkProcessClass object
ds:di = TalkProcessClass instance data
ds:bx = TalkProcessClass object (same as *ds:si)
es = segment of TalkProcessClass
ax = message #
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 8/ 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SendText method TalkProcessClass, MSG_TALK_SEND_TEXT
uses ax, cx, dx, bp
.enter
segmov ds,dgroup,ax
; get the string.
GetResourceHandleNS EntryDisplay, bx
mov si, offset EntryDisplay
mov ax,MSG_VIS_TEXT_GET_ALL_PTR
mov dx,ds
mov bp,offset textBuf ;dx:bp - string
mov di, mask MF_CALL
call ObjMessage ; cx - str length
push ds,bp
add bp, cx
mov ds,dx
mov {byte} ds:[bp], 13
pop ds,bp
inc cx
; display it in our Send Window
GetResourceHandleNS SendTextDisplay, bx
mov si, offset SendTextDisplay
mov ax,MSG_VIS_TEXT_APPEND_PTR
mov di, mask MF_FORCE_QUEUE
call ObjMessage
; now send it across the port
mov bx, ds:[port]
mov dx, ds:[socket]
mov si, offset textBuf ; ds:si - string
call NetMsgSendBuffer
; erase the Entry Display
GetResourceHandleNS EntryDisplay, bx
mov si, offset EntryDisplay
mov ax,MSG_VIS_TEXT_DELETE_ALL
mov di, mask MF_FORCE_QUEUE
call ObjMessage
.leave
ret
SendText endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReceiveTextCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: take buffer and append it
CALLED BY: Server
PASS: ds:si - buffer
cx - size
dx - data passed from remote side
di - resource handle for ReceiveTextDisplay
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
This code is called by the COMM driver's server thread, so whatever it does,
it should be quick about it. Most programs will have its own "dispatch
thread" which will get called with the buffer. Also, the buffer will be
erased once execution returns to the server thread.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 8/ 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReceiveTextCallback proc far
uses bp,ds,es
.enter
jcxz exit
cmp cx, SOCKET_HEARTBEAT
jz exit
mov bx,di
mov dx,ds
mov bp,si ;dx:bp - string
mov si, offset ReceiveTextDisplay
mov ax,MSG_VIS_TEXT_APPEND_PTR
mov di, mask MF_CALL
call ObjMessage
exit: .leave
ret
ReceiveTextCallback endp
CommonCode ends ;end of CommonCode resource
|
src/STLC/Properties/Determinism.agda | johnyob/agda-types | 0 | 5184 | module STLC.Properties.Determinism where
open import STLC.Term
open import STLC.Term.Reduction
open import Data.Nat using (ℕ; _+_)
open import Relation.Nullary using (¬_)
open import Relation.Nullary.Negation using (contradiction)
open import Data.Product using (Σ; _,_; ∃; Σ-syntax; ∃-syntax)
open import Relation.Binary.PropositionalEquality as Eq
using (refl; _≡_; cong₂)
open Eq.≡-Reasoning using (begin_; _≡⟨⟩_; _∎)
infix 4 _¬—→
_¬—→ : ∀ { n : ℕ } -> Term n -> Set
t₁ ¬—→ = ¬ (∃[ t₂ ] (t₁ —→ t₂))
¬—→-value : ∀ { n : ℕ } { t : Term n }
-> Value t
-- --------
-> t ¬—→
¬—→-value {_} {ƛ _} v = λ ()
—→-¬value : ∀ { n : ℕ } { t₁ t₂ : Term n }
-> t₁ —→ t₂
-- ---------
-> ¬ Value t₁
—→-¬value { _ } { _ } { t₂ } s v = ¬—→-value v (t₂ , s)
determinism : ∀ { n : ℕ } { t₁ t₂ t₃ : Term n }
-> t₁ —→ t₂
-> t₁ —→ t₃
-- --------
-> t₂ ≡ t₃
determinism (β-·₁ s₁) (β-·₁ s₂) = cong₂ (_·_) (determinism s₁ s₂) refl
determinism (β-·₂ _ s₁) (β-·₂ _ s₂) = cong₂ (_·_) refl (determinism s₁ s₂)
determinism (β-ƛ _) (β-ƛ _) = refl
determinism (β-·₁ s) (β-·₂ v _) = contradiction v (—→-¬value s)
determinism (β-·₂ v _) (β-·₁ s) = contradiction v (—→-¬value s)
determinism (β-·₂ _ s) (β-ƛ v) = contradiction v (—→-¬value s)
determinism (β-ƛ v) (β-·₂ _ s) = contradiction v (—→-¬value s)
|
PIM/TP7_Modules_Genericite/parenthesage.adb | Hathoute/ENSEEIHT | 1 | 16020 | <reponame>Hathoute/ENSEEIHT
with Piles;
procedure Parenthesage is
-- L'indice dans la chaîne Meule de l'élément Aiguille.
-- Si l'Aiguille n'est pas dans la Meule, on retroune Meule'Last + 1.
Function Index (Meule : in String; Aiguille: Character) return Integer with
Post => Meule'First <= Index'Result and then Index'Result <= Meule'Last + 1
and then (Index'Result > Meule'Last or else Meule (Index'Result) = Aiguille)
is
Indice: Integer;
begin
Indice := Meule'First;
for C of Meule loop
exit when C = Aiguille;
Indice := Indice + 1;
end loop;
return Indice;
end Index;
-- Programme de test de Index.
procedure Tester_Index is
ABCDEF : constant String := "abcdef";
begin
pragma Assert (1 = Index (ABCDEF, 'a'));
pragma Assert (3 = Index (ABCDEF, 'c'));
pragma Assert (6 = Index (ABCDEF, 'f'));
pragma Assert (7 = Index (ABCDEF, 'z'));
pragma Assert (4 = Index (ABCDEF (1..3), 'z'));
pragma Assert (3 = Index (ABCDEF (3..5), 'c'));
pragma Assert (5 = Index (ABCDEF (3..5), 'e'));
pragma Assert (6 = Index (ABCDEF (3..5), 'a'));
pragma Assert (6 = Index (ABCDEF (3..5), 'g'));
end;
-- Vérifier les bon parenthésage d'une Chaîne (D). Le sous-programme
-- indique si le parenthésage est bon ou non (Correct : R) et dans le cas
-- où il n'est pas correct, l'indice (Indice_Erreur : R) du symbole qui
-- n'est pas appairé (symbole ouvrant ou fermant).
--
-- Exemples
-- "[({})]" -> Correct
-- "]" -> Non Correct et Indice_Erreur = 1
-- "((()" -> Non Correct et Indice_Erreur = 2
--
procedure Verifier_Parenthesage (Chaine: in String ; Correct : out Boolean ; Indice_Erreur : out Integer) is
COuvrants : Constant String := "([{";
CFermants : Constant String := ")]}";
package Pile_Ouvrants is
new Piles(Chaine'Last - Chaine'First + 1, Character);
use Pile_Ouvrants;
package Pile_Indices is
new Piles(Chaine'Last - Chaine'First + 1, Integer);
use Pile_Indices;
Ouvrants : Pile_Ouvrants.T_Pile;
Indices : Pile_Indices.T_Pile;
Depilement: Character;
begin
Initialiser (Ouvrants);
Initialiser (Indices);
for J in Chaine'First..Chaine'Last loop
begin
case Chaine(J) is
when '(' | '[' | '{' =>
Empiler(Ouvrants, Chaine(J));
Empiler(Indices, J);
raise Constraint_Error; -- continue
when ')' => Depilement := '(';
when ']' => Depilement := '[';
when '}' => Depilement := '{';
when others => raise Constraint_Error; -- continue
end case;
if Est_Vide(Ouvrants) or else Sommet(Ouvrants) /= Depilement then
Indice_Erreur := J;
Correct := False;
return;
else
Depiler(Ouvrants);
Depiler(Indices);
end if;
exception
when Constraint_Error => Null;
end;
end loop;
if not Est_Vide(Indices) then
Indice_Erreur := Sommet(Indices);
Correct := False;
else
Correct := True;
end if;
end Verifier_Parenthesage;
-- Programme de test de Verifier_Parenthesage
procedure Tester_Verifier_Parenthesage is
Exemple1 : constant String(1..2) := "{}";
Exemple2 : constant String(11..18) := "]{[(X)]}";
Indice : Integer; -- Résultat de ... XXX
Correct : Boolean;
begin
Verifier_Parenthesage ("(a < b)", Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage ("([{a}])", Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage ("(][{a}])", Correct, Indice);
pragma Assert (not Correct);
pragma Assert (Indice = 2);
Verifier_Parenthesage ("]([{a}])", Correct, Indice);
pragma Assert (not Correct);
pragma Assert (Indice = 1);
Verifier_Parenthesage ("([{}])}", Correct, Indice);
pragma Assert (not Correct);
pragma Assert (Indice = 7);
Verifier_Parenthesage ("([{", Correct, Indice);
pragma Assert (not Correct);
pragma Assert (Indice = 3);
Verifier_Parenthesage ("([{}]", Correct, Indice);
pragma Assert (not Correct);
pragma Assert (Indice = 1);
Verifier_Parenthesage ("", Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage (Exemple1, Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage (Exemple2, Correct, Indice);
pragma Assert (not Correct);
pragma Assert (Indice = 11);
Verifier_Parenthesage (Exemple2(12..18), Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage (Exemple2(12..15), Correct, Indice);
pragma Assert (not Correct);
pragma Assert (Indice = 14);
end Tester_Verifier_Parenthesage;
begin
Tester_Index;
Tester_Verifier_Parenthesage;
end Parenthesage;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1453.asm | ljhsiun2/medusa | 9 | 24948 | <filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1453.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1db81, %rsi
lea addresses_WC_ht+0x5181, %rdi
nop
nop
nop
add %r8, %r8
mov $74, %rcx
rep movsb
nop
nop
nop
nop
add $46415, %r14
lea addresses_WT_ht+0x53c1, %rsi
lea addresses_D_ht+0x9981, %rdi
nop
sub %r11, %r11
mov $34, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %rcx
lea addresses_WT_ht+0x57a1, %rsi
lea addresses_WC_ht+0x1c199, %rdi
nop
xor %rbp, %rbp
mov $98, %rcx
rep movsl
nop
nop
nop
cmp $59718, %rsi
lea addresses_D_ht+0x6b1a, %r11
nop
cmp %rdi, %rdi
mov $0x6162636465666768, %rbp
movq %rbp, (%r11)
nop
add $63471, %r8
lea addresses_WC_ht+0x9581, %r11
nop
nop
sub $51805, %rsi
movl $0x61626364, (%r11)
cmp $45534, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r15
push %r9
push %rdi
push %rsi
// Store
lea addresses_RW+0x1ab81, %r15
nop
cmp $12050, %r11
movb $0x51, (%r15)
nop
nop
nop
nop
nop
add $32489, %rdi
// Faulty Load
lea addresses_D+0x1b181, %rsi
nop
nop
add %r10, %r10
mov (%rsi), %edi
lea oracles, %r10
and $0xff, %rdi
shlq $12, %rdi
mov (%r10,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %r9
pop %r15
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_RW'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': True, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': True, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_WC_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/299/A299412.asm | jmorken/loda | 1 | 29242 | <reponame>jmorken/loda
; A299412: Pentagonal pyramidal numbers divisible by 3.
; 0,6,18,75,126,288,405,726,936,1470,1800,2601,3078,4200,4851,6348,7200,9126,10206,12615,13950,16896,18513,22050,23976,28158,30420,35301,37926,43560,46575,53016,56448,63750,67626,75843,80190,89376,94221,104430,109800,121086,127008,139425,145926,159528,166635,181476,189216,205350,213750,231231,240318,259200,269001,289338,299880,321726,333036,356445,368550,393576,406503,433200,446976,475398,490050,520251,535806,567840,584325,618246,635688,671550,689976,727833,747270,787176,807651,849660,871200,915366,937998,984375,1008126,1056768,1081665,1132626,1158696,1212030,1239300,1295061,1323558,1381800,1411551,1472328,1503360,1566726,1599066,1665075,1698750,1767456,1802493,1873950,1910376,1984638,2022480,2099601,2138886,2218920,2259675,2342676,2384928,2470950,2514726,2603823,2649150,2741376,2788281,2883690,2932200,3030846,3080988,3182925,3234726,3340008,3393495,3502176,3557376,3669510,3726450,3842091,3900798,4020000,4080501,4203318,4265640,4392126,4456296,4586505,4652550,4786536,4854483,4992300,5062176,5203878,5275710,5421351,5495166,5644800,5720625,5874306,5952168,6109950,6189876,6351813,6433830,6599976,6684111,6854520,6940800,7115526,7203978,7383075,7473726,7657248,7750125,7938126,8033256,8225790,8323200,8520321,8620038,8821800,8923851,9130308,9234720,9445926,9552726,9768735,9877950,10098816,10210473,10436250,10550376,10781118,10897740,11133501,11252646,11493480,11615175,11861136,11985408,12236550,12363426,12619803,12749310,13010976,13143141,13410150,13545000,13817406,13954968,14232825,14373126,14656488,14799555,15088476,15234336,15528870,15677550,15977751,16129278,16435200,16589601,16901298,17058600,17376126,17536356,17859765,18022950,18352296,18518463,18853800,19022976,19364358,19536570,19884051,20059326,20412960,20591325,20951166,21132648,21498750,21683376,22055793,22243590,22622376,22813371,23198580,23392800,23784486,23981958,24380175,24580926,24985728,25189785,25601226,25808616,26226750
mov $1,$0
mov $3,1
add $3,$0
mov $4,$3
lpb $0
sub $0,1
trn $0,1
add $1,1
mov $2,$4
add $4,1
lpe
mul $1,$2
mul $1,$4
div $1,2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.